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
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **GUI Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. 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 Fre... | Samweli/inasafe | safe/impact_statistics/test/test_aggregator.py | Python | gpl-3.0 | 21,613 |
#!/usr/bin/env python
#!/usr/bin/python
import h5py
from matplotlib import pylab
import matplotlib.pylab as plt
import sys
from matplotlib.font_manager import FontProperties
import math
import numpy as np
import h5py
import matplotlib.pylab as plt
import matplotlib as mpl
import sys
import numpy as np;
plt.rcParams.u... | BorisJeremic/Real-ESSI-Examples | analytic_solution/test_cases/Contact/Dynamic_Shear_Behaviour/Total_Energy_Verification/dt_1e-2/Plot_Results.py | Python | cc0-1.0 | 2,936 |
import _plotly_utils.basevalidators
class CmaxValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="cmax", parent_name="scatter.marker", **kwargs):
super(CmaxValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/marker/_cmax.py | Python | mit | 467 |
def data_to_lines(data):
#calculate headings
headings = set()
for y in data:
headings.update(data[y].keys())
headings = sorted(headings)
#output header
line = "\t"+"\t".join(str(x) for x in headings)+"\n"
yield line
#output data
for y in sorted(data.keys()):
... | afaulconbridge/PyAChemKit | achemkit/utils/datafile.py | Python | bsd-3-clause | 1,294 |
# Copyright (C) 2011 by Matteo Franchin (fnch@users.sourceforge.net)
#
# This file is part of Pyrtist.
#
# Pyrtist is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License... | mfnch/pyrtist | pyrtist/gui/dox/logger.py | Python | lgpl-2.1 | 1,678 |
from distutils.core import setup
from Cython.Build import cythonize
import numpy as np
setup(
ext_modules = cythonize("hmm.pyx"),
include_dirs = [np.get_include()]
)
| tqian86/MPBST | clustering/setup.py | Python | mit | 176 |
#
# (c) 2018 Extreme Networks 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.
#
# Ans... | alxgu/ansible | lib/ansible/plugins/action/voss_config.py | Python | gpl-3.0 | 1,098 |
#
# LeetCode
# Algorithm 125 Valid Palindrome
#
# Rick Lan, May 6, 2017.
# See LICENSE
#
# Test case(s):
# ""
# "1"
# ";-="
# "A man, a plan, a canal: Panama"
# "race a car"
#
# Your runtime beats 51.13 % of python submissions.
#
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
... | rlan/LeetCode | P125-ValidPalindrome/main.py | Python | mit | 1,269 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-----------------------------------------------------------------------------
"""ERChime Unit Test."""
__author__ = ('Lance Finn Helsten',)
__version__ = '1.0'
__copyright__ = """Copyright 2011 Lance Finn Helsten (helsten@acm.org)"""
__license__ = """
Licensed under the Ap... | sietse/pyietflib | setup/lib/__init__.py | Python | apache-2.0 | 898 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
#
##############################################################################
# Script used in the paper:
# Evaluation of TanDEM-X DEMs on selected Brazilian sites: comparison with SRTM, ASTER GDEM and ALOS AW3D30
# by
# Carlos H. Grohmann - 2017
# guano (at) usp (dot) b... | CarlosGrohmann/scripts_papers | tdx_brazil/import_tdx_brazil.py | Python | mit | 32,149 |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the getblockfilter RPC."""
from test_framework.test_framework import BitcoinTestFramework
from test_fr... | OmniLayer/omnicore | test/functional/rpc_getblockfilter.py | Python | mit | 2,446 |
# -*- coding: utf-8 -*-
from mock import patch
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.exception import BotoClientError
from boto.s3.connection import S3Connection
from boto.s3.bucket import Bucket
from boto.s3.deletemarker import DeleteMarker
from boto.s3.key import Ke... | dablak/boto | tests/unit/s3/test_bucket.py | Python | mit | 6,606 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_doughnut05.py | Python | bsd-2-clause | 1,412 |
# Password to use for web authentication
# the password can be generated with:
# >>>from notebook.auth import passwd
# >>>passwd("glotaran")
# c.NotebookApp.password = u'sha1:deef177aa2dd:657a28dd6c1a12eaf67aa6ab4dfb64166a6ba787'
c.NotebookApp.token = ''
c.NotebookApp.notebook_dir = '/vagrant/tests/notebooks'
# Set... | glotaran/glotaran | .jupyter_config.py | Python | gpl-3.0 | 584 |
'''Provides the keys of the media/types.py file.
It's usefull to have the keys in a separate file, since that way we can avoir
loading all the program just to check the available keys.
'''
MEDIA_TYPES_KEYS = ('anime', 'movie')
| vivescere/yajuu | yajuu/types.py | Python | gpl-3.0 | 230 |
#
#
# Copyright (c) 2013 fpgaminer@bitcoin-mining.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 version 3 of the License, or
# (at your option) any later version.
#
# This pro... | fpgaminer/fpgaminer-vanitygen | tools/check_result.py | Python | gpl-3.0 | 1,692 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/failed_upgrade_domain_progress_object.py | Python | mit | 1,400 |
from src.game_object.triggerable import Triggerable
"""
Contains all events that
are passed into the event handler
"""
def call_bomb_events(player, level=None):
animate_bombs(player)
play_bomb_beeps(player)
def animate_bombs(player, level=None):
"""A wrapper to animate all bombs
that are owned by... | joereynolds/Mr-Figs | src/events.py | Python | gpl-3.0 | 708 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A module that extends the operations provided by Theano.
The functions are designed to be compatible with the Keras interface.
"""
import theano.tensor as tensor
from theano.gof import MissingInputError
def conv2d(input_matrix, filters, strides=(1, 1), padding='valid... | senarvi/theanolm | theanolm/backend/operations.py | Python | apache-2.0 | 6,418 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | pwong-mapr/private-hue | apps/sqoop/src/sqoop/client/resource.py | Python | apache-2.0 | 3,643 |
import numpy as np
import time
import math
import cv2
from pylab import array, arange, uint8
from PIL import Image
import eventlet
from eventlet import Timeout
import multiprocessing as mp
# Change the path below to point to the directoy where you installed the AirSim PythonClient
#sys.path.append('C:/Users/Kjell/Goog... | Kjell-K/AirGym | gym_airsim/envs/myAirSimClient.py | Python | mit | 6,563 |
#!/usr/bin/env python
'''joystick interface module
Contributed by AndrewF:
http://diydrones.com/profile/AndrewF
'''
import pygame, fnmatch
from time import sleep
mpstate = None
from MAVProxy.modules.lib import mp_module
'''
A map of joystick identifiers to channels and scalings.
Each joystick type can control ... | mazafrav/JdeRobot | src/drivers/MAVLinkServer/modules/mavproxy_joystick.py | Python | gpl-3.0 | 5,202 |
import sys
sys.path.append('../ssd1306_8x64bit_driver')
from myhdl import *
from ssd1306_8x64bit_driver import *
from spi4 import *
from font_rom import *
from ssd1306_8x64bit_fsm import *
"""
This script generates an application example of core#1.
"""
@block
def const_driver(val, clk, reset ):
@always_seq(c... | DeadBugEngineering/myHDL_shenanigans | ssd1306_8x64bit_driver_demo_1/demo_1_testbench.py | Python | lgpl-2.1 | 3,176 |
# * Copyright 2014 Shopzilla.com
# *
# * 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... | Shopzilla-Ops/gitlab-jenkins-connector | gitlabjenkins/basehandler.py | Python | apache-2.0 | 2,757 |
# Copyright 2014 NEC Corporation. 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 ... | openstack/python-magnumclient | magnumclient/v1/bays.py | Python | apache-2.0 | 977 |
#!/usr/bin/env python3
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Show fans information.
$ python fans.py
asus
cpu_fan 3200 RPM
"""
from __future__ import print_function
imp... | giampaolo/psutil | scripts/fans.py | Python | bsd-3-clause | 772 |
import requests
import re
from bs4 import BeautifulSoup
import csv
def get(url):
try:
r = requests.get(url)
status = r.status_code
if status is 200:
soup = BeautifulSoup(r.text, 'html.parser')
return soup
else:
print('Error code: {}; URL: {}'.for... | jessefeinman/FintechHackathon | python-getting-started/nlp/scraper.py | Python | bsd-2-clause | 1,275 |
#!/usr/bin/env python
# Copyright (c) 2018 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
"""Ease dep... | opnfv/functest | functest/core/singlevm.py | Python | apache-2.0 | 20,236 |
import unittest
from .. import Stopwords
class TestStopwords(unittest.TestCase):
def test_default(self):
test = Stopwords()
compare = Stopwords('arakhne/stopwords/defaults/english.txt')
return self.assertEqual(test, compare)
| thePortus/arakhne | arakhne/stopwords/tests/test_stopwords.py | Python | mit | 257 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/model_search | model_search/search/categorical_harmonica.py | Python | apache-2.0 | 13,285 |
from setuptools import setup, find_packages
setup(
name='django-oneforty',
version=__import__('oneforty').__version__,
description='django-oneforty is designed to be a simple, lightweight status/update engine.',
long_description=open('README.txt').read(),
author='Pure Blue Inc',
author_email='d... | davemerwin/django-oneforty | setup.py | Python | bsd-3-clause | 1,060 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from . import models
class ProductAdmin(admin.ModelAdmin):
list_display = ('is_active', 'name', 'ordering', 'unit_price')
list_display_links = ('name',)
list_filter = ('is_active',)
prepopulated_fields = {'slug':... | ixc/plata | examples/oneprice/admin.py | Python | bsd-3-clause | 427 |
import pytest
from jailscraper.models import InmatePage
def get_inmate(id):
with open('tests/sample_pages/{0}.html'.format(id)) as f:
body = f.read()
return InmatePage(body)
# @TODO is there a way to do this more elegantly with fixtures?
testdata = (
# An old inmate: Especially important is to m... | propublica/cookcountyjail2 | tests/test_parser.py | Python | mit | 3,761 |
"""Support to send and receive Telegram messages."""
from functools import partial
import importlib
import io
from ipaddress import ip_network
import logging
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from telegram import (
Bot,
InlineKeyboardButton,
InlineKeyboardMarkup,
R... | Teagan42/home-assistant | homeassistant/components/telegram_bot/__init__.py | Python | apache-2.0 | 29,102 |
#!/bin/python
# -*- coding: utf-8 -*-
import organization_map
class mapod2ckan():
def __init__(self):
self.package={'extras':[], 'tag':[], 'resources':[], 'org':{'extras':[]}}
self.license_id='1'
self.license_url='http'
def map_package_params(self, key, value):
self.package[key] = value
def map_tag_p... | Thomas-Tsai/od2ckan | map2ckan.py | Python | gpl-3.0 | 3,559 |
# 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... | Huyuwei/tvm | topi/python/topi/cuda/ssd/multibox.py | Python | apache-2.0 | 16,799 |
#
# Hiiktuu features (dicts).
#
########################################################################
#
# This file is part of the HLTDI L^3 project
# for parsing, generation, translation, and computer-assisted
# human translation.
#
# Copyright (C) 2014, HLTDI <gasser@cs.indiana.edu>
#
# This prog... | LowResourceLanguages/hltdi-l3 | hiiktuu/features.py | Python | gpl-3.0 | 15,227 |
#!/usr/bin/env python
from pylab import *
try:
import Image
except ImportError, exc:
raise SystemExit("PIL must be loaded to run this example")
lena = Image.open('data/lena.jpg')
dpi = rcParams['figure.dpi']
figsize = lena.size[0]/dpi, lena.size[1]/dpi
figure(figsize=figsize)
im = imshow(lena, origin='lower'... | sniemi/SamPy | sandbox/src1/examples/image_demo3.py | Python | bsd-2-clause | 355 |
import re
import pickle
import matplotlib.pyplot as plt
import itertools
import numpy as np
def FindUrls(message):
return re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', message)
def PickleMe(object, name, path = './pickles/'):
print 'saving ' + name
with open(... | amirhmoin/recodev | RecoDev-Prototype/master_utils.py | Python | bsd-3-clause | 3,729 |
#!/usr/bin/python3
__author__ = 'danielh'
import argparse
import sys
import operator
from collections import OrderedDict
from numpy import array
from ucca import layer0
from ucca import layer1
from util import file2passage
from nerv.net import keyed_source_vertex
from nerv.net import average_vertex
from nerv.net imp... | danielhers/nerv | src/ucca_parser/ucca_to_net.py | Python | isc | 3,248 |
"""The test for the version sensor platform."""
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
MOCK_VERSION = "10.0"
async def test_version_sensor(hass):
"""Test the Version sensor."""
config = {"sensor": {"platform": "version"}}
assert await async_setup_compon... | tchellomello/home-assistant | tests/components/version/test_sensor.py | Python | apache-2.0 | 734 |
PREFIXES = (
'868',
) | coralhq/phone-id | phoneid/byru.py | Python | mit | 25 |
import os
def create_token_file(token):
try:
home_directory = os.path.expanduser('~')
file = open(os.path.join(home_directory, ".AUTHTOKEN"), 'w')
file.write(token['token'])
file.close()
return(200)
except:
print('Something went wrong!')
def remove_token_file(... | dmonn/socialize | socialize/helpers/auth_helpers.py | Python | bsd-3-clause | 494 |
# 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 unittest
from telemetry.core import util
from telemetry.page import page_runner
from telemetry.page import page as page_module
from telemetry.pag... | mkaluza/external_chromium_org | tools/telemetry/telemetry/page/page_measurement_unittest_base.py | Python | bsd-3-clause | 1,781 |
#!/usr/bin/env python
from validictory.validator import (SchemaValidator, FieldValidationError, MultipleValidationError,
ValidationError, SchemaError)
__all__ = ['validate', 'SchemaValidator', 'FieldValidationError', 'MultipleValidationError',
'ValidationError', 'SchemaEr... | sunlightlabs/validictory | validictory/__init__.py | Python | mit | 2,816 |
import pytest
from ai import *
from grid import Grid
def test_case_1_horizontal():
ai = Minimax()
grid = [[1,1,0],[0,0,0],[0,0,0]]
print(ai.make_move(grid, True))
assert ai.make_move(grid, True) == (0,2)
grid = [[2,2,0],[0,0,0],[0,0,0]]
assert ai.make_move(grid, False) == (0,2)
grid = [... | shanesatterfield/tic-tac-toe | tic-tac-toe/test/test_minimax_goes_for_win.py | Python | mit | 4,525 |
'''
Created on Apr 5, 2016
@author: Victor
'''
from neo4jrestclient import traversals
from neo4jrestclient.client import GraphDatabase
from neo4jrestclient.query import Q
db = GraphDatabase('http://localhost:7474/db/data/')
home = db.node(name='Home')
neo = db.node(name='Thomas Anderson', age=29)
trinity = db.nod... | vitongos/ufv-social-network-analysis-neo4j | src/05.traversal.neo4j.py | Python | mit | 1,260 |
import datetime
data = [
{
"name": "test_put_contest_no_login",
"url": "/api/contest/",
"method": "put",
"payload": {
"title": "change",
"start": "2001-01-01 00:00:00",
"end": "2001-01-01 00:00:00",
"freeze": "0",
"descripti... | Tocknicsu/nctuoj_contest | test/api/contest/put_contest.py | Python | apache-2.0 | 3,747 |
#!/usr/bin/python
import os
import httplib2
import datetime
import magic
import settings
import sys
from apiclient.discovery import build
from apiclient.http import MediaFileUpload
from oauth2client.client import OAuth2WebServerFlow
# Oauth settings
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive'
REDIRECT_URI... | julienc91/grivesync | grivesync.py | Python | gpl-2.0 | 4,322 |
def is_prime(number):
"""Return True if *number* is prime."""
for element in range(2, number):
if number % element == 0:
return False
return True
def print_next_prime(number):
"""Print the closest prime number
larger than *number*."""
index = number
while True:
... | tongpo/Holle-World | py/unitTest/src/prime.py | Python | gpl-2.0 | 458 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... | ivmech/iviny-scope | lib/xlsxwriter/test/comparison/test_chart_axis34.py | Python | gpl-3.0 | 2,185 |
#!/usr/bin/python
# -*- coding=utf-8 -*-
import sys
import pymatgen as mg
import numpy as np
from pymatgen.io.vaspio.vasp_input import Poscar
def look4VacantPosition():
""" """
s = mg.Structure.from_file(sys.argv[1])
fill_s = s.copy()
grid = mg.Structure(s.lattice, [], [])
# grid step in frac c... | gVallverdu/myScripts | VASP/vacantPosition.py | Python | gpl-2.0 | 2,293 |
#!/usr/bin/python
from subprocess import call
import json
used_ports = json.load(open("usedports.json"))
print used_ports
ps = {'http' : '10.0.2.15,8000' , 'webshell' : '10.0.2.15,12320', 'webmin' : '10.0.2.15,12321', 'ssh' : '10.0.2.15,22' }
ports = {'http' : 8000, 'https' : 4000, 'ssh' : 22000, 'webshell' : 12000,... | matteomitico/vtc-senior-project | back-end/python-scripts/calltest.py | Python | mit | 745 |
# Authors:
# Rob Crittenden <rcritten@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 Software Foundation, either... | hatchetation/freeipa | ipalib/plugins/passwd.py | Python | gpl-3.0 | 4,219 |
#!/usr/bin/python -u
import re
import math
import argparse
import ConfigParser
import MySQLdb
import MySQLdb.cursors
#
def map_position(domain, substitution):
"""
"""
if int(substitution[1:-1]) < int(domain['seq_begin']) or \
int(substitution[1:-1]) > int(domain['seq_end']):
return... | HAShihab/fathmm | cgi-bin/fathmm.py | Python | gpl-3.0 | 20,652 |
import unittest
from literoticapi.author import *
class testStory(unittest.TestCase):
def setUp(self):
self.author = Author(868670)
def testGetSeriesAndNonSeries(self):
assert len(self.author.get_stories()) >= 132
if __name__ == "__main__":
unittest.main()
| hrroon/literoticapi | test/author_test.py | Python | gpl-3.0 | 290 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
from pants.backend.python.targets.import_wheels_mixin import ImportWheelsMixin
from pants.base.deprecated import deprecated_conditional
from pants.base.payload import Paylo... | tdyas/pants | src/python/pants/backend/python/targets/unpacked_whls.py | Python | apache-2.0 | 4,698 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-22 01:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Member... | gtalent/soma | api_server/church_directory/migrations/0001_initial.py | Python | mpl-2.0 | 1,994 |
import django
from evostream.default import api
from evostream.management.base import BaseEvoStreamCommand
class Command(BaseEvoStreamCommand):
help = 'Returns the information of the stream by the configId.'
requires_system_checks = False
silent_keys = ('configId', 'localStreamName')
if django.VER... | tomi77/django-evostream | evostream/management/commands/getconfiginfo.py | Python | mit | 720 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import print_function
# Imported from https://github.com/PiSupply/PiJuice/issues/105
import time
from pijuice import PiJuice
# ---
pijuice = PiJuice(1,0x14)
print(time.strftime( "%Y%m%d%H%M%S", time.localtime( time.time() ) ) )
firmware = pijuice.config.Get... | claremacrae/raspi_code | hardware/pijuice/pijuice_status.py | Python | mit | 1,063 |
#!/usr/bin/env python
# encoding: utf-8
import smtplib
from email.mime.text import MIMEText
from config import GMAIL_CONFIG
def send_mail(to_list,sub,content):
'''
to_list:发给谁
sub:主题
content:内容
send_mail("zhkzyth@gmail.com","sub","content")
'''
mail_host = GMAIL_CONFIG['mail_host']
mai... | zhkzyth/a-super-fast-crawler | monitor.py | Python | mit | 949 |
# 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 PyAvro(PythonPackage):
"""Avro is a serialization and RPC framework."""
homepage = "h... | LLNL/spack | var/spack/repos/builtin/packages/py-avro/package.py | Python | lgpl-2.1 | 688 |
"""
Utilities useful during the build.
"""
# author: Andy Mueller, Gael Varoquaux
# license: BSD
import os
from distutils.version import LooseVersion
import contextlib
from .openmp_helpers import check_openmp_support
DEFAULT_ROOT = 'sklearn'
# on conda, this is the latest for python 3.5
CYTHON_MIN_VERSION = '0.28... | chrsrds/scikit-learn | sklearn/_build_utils/__init__.py | Python | bsd-3-clause | 2,533 |
#"""
#This file is part of Happypanda.
#Happypanda 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
#any later version.
#Happypanda is distributed in the hope that it will be ... | peaceandpizza/happypanda | version/settings.py | Python | gpl-3.0 | 5,358 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
from __future__ import unicode_literals
import frappe
import frappe.defaults
import frappe.permissions
from frappe.model.document import Document
from frappe.utils import get_fullname
from frappe import _
class Feed(Docume... | indictranstech/reciphergroup-frappe | frappe/desk/doctype/feed/feed.py | Python | mit | 2,651 |
#!/usr/bin/env python
# ------------------------------------------------------------------------
# File Name: lambda.py
# Author: Zhao Yanbai
# Sun Apr 8 12:07:55 2012
# Description: none
# ------------------------------------------------------------------------
# -*- coding: utf-8 -*-
import math
... | acevest/acecode | learn/python/lambda.py | Python | gpl-2.0 | 384 |
# Copyright (c) 2014 Rackspace Hosting 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 t... | rackerlabs/marconi | marconi/queues/storage/sqlalchemy/__init__.py | Python | apache-2.0 | 753 |
class Frob(object):
def __init__(self, name):
self.name = name
self.before = None
self.after = None
def setBefore(self, before):
# example: a.setBefore(b) sets b before a
self.before = before
def setAfter(self, after):
# example: a.setAfter(b) sets b after a
... | tqsclass/edX | 6001x/final/linkedlist.py | Python | mit | 4,074 |
import qi
import argparse
import sys
import time
import threading
import action_base
from action_base import *
actionName = "wait"
def actionThread_exec (params):
t = threading.currentThread()
memory_service = getattr(t, "mem_serv", None)
print "Action "+actionName+" started with params "+params
# ... | LCAS/spqrel_tools | actions/wait.py | Python | mit | 1,044 |
class Base():
"""
Simple Property Provider that is actually nothing more then normal dictionary
"""
def get(self, key, field=None):
"""
Implement this method in the child class
"""
return {}
def set(self, key, field, value):
"""
Implement this method ... | slaff/attachix | server/core/provider/property.py | Python | mit | 1,852 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | rcatwood/Savu | savu/plugins/filters/base_component_analysis.py | Python | gpl-3.0 | 3,645 |
"""
Django settings for painindex project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | catherinev/quest_maker | quest_maker/settings/settings_base.py | Python | mit | 4,546 |
import logging
from ftmstore import get_dataset
log = logging.getLogger(__name__)
MODEL_ORIGIN = "model"
def get_aggregator_name(collection):
return "collection_%s" % collection.id
def get_aggregator(collection, origin="aleph"):
"""Connect to a followthemoney dataset."""
dataset = get_aggregator_name(c... | pudo/aleph | aleph/logic/aggregator.py | Python | mit | 378 |
"""TreeNode operation to find next node."""
import threading
from src.core import tree
from src.ops import abstract
class NextNodeOp(abstract.AbstractOp):
"""Finds next TreeNode instance in the tree in in-order traversal."""
def do(self, root, args):
"""Implements NextNodeOp.
See http://www.geeksforg... | cripplet/treedoc-py | src/ops/next_node.py | Python | mit | 1,836 |
#!/usr/bin/env python
import feedparser
import urllib3.request
import shutil
import re
import time
from datetime import datetime
linkList = []
linksList = []
nameList = []
dir = '/home/pi/python-stuff/auto-podcast-update/'
lastDateFilePath = dir+'last-date.txt'
feedsFilePath = dir+'feeds.txt'
audioDir = dir+'audio/'
... | JamesWoodham/auto-podcast-update | podcast_rss.py | Python | mit | 1,597 |
from __future__ import division, print_function, absolute_import
from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor
from sklearn.metrics import mean_squared_error
import numpy
from rep.data import LabeledDataStorage
from rep.metaml import RegressorsFactory
from six.moves import cPickle
from rep.rep... | yandex/rep | tests/test_factory_reg.py | Python | apache-2.0 | 3,000 |
"""
The bearlib is an optional library designed to ease the task of any Bear. Just
as the rest of coala the bearlib is designed to be as easy to use as possible
while offering the best possible flexibility.
"""
import logging
from functools import wraps
from coalib.settings.FunctionMetadata import FunctionMetadata
... | Nosferatul/coala | coalib/bearlib/__init__.py | Python | agpl-3.0 | 7,005 |
#!/usr/bin/python
# Given a template (with a specific format), a target document root and a set of formatted XML
# documents, generate HTML documentation for public web access.
# Extracts information from XML using regular expression and proper parsing
from sys import argv, stderr, exit
if len(argv) < 3:
print ... | AlphaCluster/NewsBlur | vendor/feedvalidator/demo/docs-xml/build-html-docs.py | Python | mit | 2,061 |
from shakedown import *
def test_install_package_cli():
assert not package_installed('dcos-enterprise-cli')
install_package_and_wait('dcos-enterprise-cli')
assert package_installed('dcos-enterprise-cli')
def test_uninstall_package_cli():
assert package_installed('dcos-enterprise-cli')
uninstall_pa... | dcos/shakedown | tests/acceptance/test_dcos_package_cli.py | Python | apache-2.0 | 414 |
from toee import *
import tpactions
def GetActionName():
return "Imbue Arrow"
def GetActionDefinitionFlags():
return D20ADF_MagicEffectTargeting | D20ADF_Breaks_Concentration
def GetTargetingClassification():
return D20TC_CastSpell
def GetActionCostType():
return D20ACT_Standard_Action
def Add... | GrognardsFromHell/TemplePlus | tpdatasrc/tpgamefiles/rules/d20_actions/action02000_arc_archer_imbue_arrow.py | Python | mit | 1,335 |
# pib.py - functions for handling Serbian VAT numbers
# coding: utf-8
#
# Copyright (C) 2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the L... | arthurdejong/python-stdnum | stdnum/rs/pib.py | Python | lgpl-2.1 | 1,963 |
__author__ = 'tylercook'
import csv
class GeoIP:
def __init__(self):
rows, _ = self.__parse_csv("geoip.csv")
self.records = list()
for row in rows:
self.records.append({'start': int(row[2]), 'end': int(row[3]), 'country': row[4]})
def get_country(self, ip):
ip_int... | Chef1991/LoginLogs | geo_ip.py | Python | gpl-2.0 | 1,753 |
import urllib2
import HttpRequest
class Get(HttpRequest.HttpRequest):
data = None
def __init__(self, data):
self.data = self._setData(data)
def sendRequest(self, url):
return urllib2.urlopen(url+self.data).read()
def _setData(self, data):
queryString = "?... | aaronjwood/multilib | Python/http/request/Get.py | Python | gpl-3.0 | 550 |
from django.conf.urls import patterns, url
# Import class based views
from polls import views
urlpatterns = patterns('',
# ex: /polls/
url(r'^$', views.IndexView.as_view(), name='index'),
# ex: /polls/5/
url(r'^(?P<pk>\d+)/$',... | paleocore/django_polls | polls/urls.py | Python | mit | 664 |
from django.utils import translation
from dragoman_blog.test_utils.fixtures import *
from dragoman_blog.test_utils.testcase import FixtureTestCase
from dragoman_blog.models import Entry, EntryTranslation, TranslationTagged
class TwoLanguageTagsTest(FixtureTestCase, TwoLanguage):
def assert_tags_equal(self, ... | fivethreeo/django-dragoman-blog | dragoman_blog/tests/tags.py | Python | bsd-3-clause | 1,915 |
import json
from django import forms
from django.forms import URLField as DefaultUrlField
from django.core.validators import URLValidator
class URLField(DefaultUrlField):
myregex = ('(http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a'
'-fA-F][0-9a-fA-F]))+)')
default_validators = [UR... | ljwolford/ADL_LRS | adl_lrs/forms.py | Python | apache-2.0 | 2,504 |
# -*- coding: utf-8 -*-
# Generated from the Telepathy spec
""" Copyright (C) 2007 Collabora Limited
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or ... | davidedmundson/telepathy-hangups | telepathy/_generated/Channel_Interface_Chat_State.py | Python | lgpl-2.1 | 2,416 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import glob
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from drawsettings import DrawSettings
from labeleditdialog import LabelEditDialog
from ..core.labelconfig import LabelConfig
from... | BNUCNL/FreeROI | froi/widgets/labelmanagedialog.py | Python | bsd-3-clause | 5,137 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | dhermes/gcloud-python | logging/google/cloud/logging/_gapic.py | Python | apache-2.0 | 21,485 |
import os
import sys
import fnmatch
import codecs
if len(sys.argv) < 3:
print os.path.basename(__file__), 'target_path', 'framework_names...'
sys.exit(1)
FRAMEWORK_PATH = os.path.join(os.path.dirname(__file__), 'Frameworks')
target_path = sys.argv[1]
print 'Patching #import in *.h/*.m from', target_path
heade... | cubie-api/cubie-sdk-ios | fix_imports.py | Python | apache-2.0 | 1,286 |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""A proxy that looks like MAASClient.
This actually passes the requests on to a django.test.client.Client, to avoid
having to go via a real HTTP server.
"""
from __future__ impo... | cloudbase/maas | src/apiclient/testing/django_client_proxy.py | Python | agpl-3.0 | 1,513 |
#!/srv/newsblur/venv/newsblur/bin/python
from utils.munin.base import MuninGraph
class NBMuninGraph(MuninGraph):
@property
def graph_config(self):
return {
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Users',
'graph_vlabel' : 'users',
'graph... | manderson23/NewsBlur | utils/munin/newsblur_users.py | Python | mit | 1,277 |
#!/usr/bin/python
from gevent import monkey; monkey.patch_all()
import os
import traceback
from django.core.handlers.wsgi import WSGIHandler
from django.core.signals import got_request_exception
from django.core.management import call_command
os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings'
def exception_pri... | fdr/tinytalk | webchat/application.py | Python | bsd-2-clause | 473 |
"""
Gridsearch implementation
"""
from hops import hdfs, tensorboard, devices
from hops.experiment_impl.util import experiment_utils
from hops.experiment import Direction
import threading
import six
import time
import os
def _run(sc, train_fn, run_id, args_dict, direction=Direction.MAX, local_logdir=False, name="no... | hopshadoop/hops-util-py | hops/experiment_impl/parallel/grid_search.py | Python | apache-2.0 | 4,463 |
"""
Python helper class for interfacing with Bonjour.
bonjour.py provides a simple way of advertising a service on a known registration
type and then also browses the current network to find clients of the same
registration type.
"""
__author__ = 'Michael Carroll <carroll.michael@gmail.com>'
import pybonjour
im... | sloev/data-pie | data-pie/oldStuff/Bonjour.py | Python | gpl-2.0 | 13,570 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Connecter
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Itemizers.Parenter"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classe... | Ledoux/ShareYourSystem | Pythonlogy/draft/Connecter/__init__.py | Python | mit | 2,600 |
'''
Retrieve game list (by Requests).
Update log: (date / version / author : comments)
2020-07-10 / 1.0.0 / Du Jiang : Creation
'''
from com.djs.learn.playstationstore import RetrieveGameList
__data_type = 0
__output_file_path = "../../../../../Temp/{0}.csv".format("PlayStationStore_GameList")
argv = ["-d", __data_... | djsilenceboy/LearnTest | Python_Test/PyDataMiningSample/com/djs/learn/test/playstationstore/TestRetrieveGameDetails.py | Python | apache-2.0 | 522 |
#!/usr/bin/env python
'''
Realtime anonmymous chat app
'''
import logging
import tornado.auth
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import os.path
import uuid
import advertising
import threading
import Queue
import sys
import time
import usermes... | mikemaccana/imeveryone | imeveryone.py | Python | mit | 26,633 |
from compile_funcs import *
| tos-kamiya/pyrem_torq | src/pyrem_torq/script/__init__.py | Python | mit | 29 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | reeshupatel/demo | keystone/contrib/revoke/controllers.py | Python | apache-2.0 | 1,785 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.