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 |
|---|---|---|---|---|---|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def __init__(self):
self.ans = 0
def dfs(self, root, path):
if root.left is None and root.right is None:
print path... | xingjian-f/Leetcode-solution | 129. Sum Root to Leaf Numbers.py | Python | mit | 719 |
import sys
from resources.datatables import Options
def setup(core, object):
#object.setAttachment('radial_filename', 'object/conversation');
#object.setAttachment('conversationFile','junk_dealer')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
obj... | agry/NGECore2 | scripts/object/mobile/javran_mu.py | Python | lgpl-3.0 | 369 |
#!/usr/bin/env python
"""Graphical interface for DropTheBeat."""
import os
import sys
import argparse
from tkinter import * # pylint: disable=wildcard-import,unused-wildcard-import
from tkinter import messagebox, simpledialog, filedialog
from tkinter.ttk import * # pylint: disable=wildcard-import,unused-wildcard-im... | jacebrowning/dropthebeat | dtb/gui.py | Python | lgpl-3.0 | 12,164 |
import sys
import os
import time
from itertools import tee, imap, izip, izip_longest, product, cycle, islice, chain
from functools import partial
import traceback
from multiprocessing import Pool
import random
import string
import math
import importlib
import imp
from ctypes import cdll
from contextlib import contextma... | nanoporetech/nanonet | nanonet/util.py | Python | mpl-2.0 | 16,481 |
# Movie Model
class Movie(object):
# Movie Constructor
def __init__(self, title, story_line, poster_image, trailer_youtube, year):
self.title = title
self.storyline = story_line
self.poster_image_url = poster_image
self.trailer_youtube_url = trailer_youtube
self.year = year
| vzool/fullstack-nanodegree-movie-trailer-website | app/model/movie.py | Python | mit | 287 |
"""VetAppDjango 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')
Clas... | mape90/VetAppDjango | VetAppDjango/urls.py | Python | mit | 1,565 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/SHH_WT_models46742.py | Python | gpl-3.0 | 17,581 |
import itertools
def main():
list_a = list(map(int, input().split(' ')))
list_b = list(map(int, input().split(' ')))
return list(itertools.product(list_a, list_b))
if __name__ == '__main__':
print(*main())
| FireClaw/HackerRank | Python/itertools-product.py | Python | mit | 224 |
"""
============================
Gradient Boosting regression
============================
Demonstrate Gradient Boosting on the boston housing dataset.
This example fits a Gradient Boosting model with least squares loss and
500 regression trees of depth 4.
"""
print __doc__
# Author: Peter Prettenhofer <peter.prette... | seckcoder/lang-learn | python/sklearn/examples/ensemble/plot_gradient_boosting_regression.py | Python | unlicense | 2,480 |
"""
Core components of Home Assistant.
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
# pylint: disable=unused-import, too-many-lines
import asyncio
from concurrent.futures import ThreadPoolExecutor
import enum
import functools as ft
import logging
import os... | varunr047/homefile | homeassistant/core.py | Python | mit | 41,923 |
from __future__ import unicode_literals
from django.db import models
from django.core.validators import RegexValidator
class WebPage(models.Model):
feed_name = models.CharField(
max_length=50,
unique=True,
validators=[RegexValidator(regex="[\w\-]+")]
)
url = models.URLField()
... | theju/atifier | server/core/models.py | Python | mit | 1,199 |
#!/usr/bin/env python
"""
Project:
Date: 10/27/17 12:40 PM
Author: Demian D. Gomez
"""
import os
import traceback
import platform
import datetime
# deps
from tqdm import tqdm
# app
import dbConnection
import pyOptions
import pyArchiveStruct
import pyRinex
import pyDate
import pyJobServer
from Utils import file_appe... | demiangomez/Parallel.GAMIT | com/amend.py | Python | gpl-3.0 | 6,532 |
#!/usr/bin/env python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | dekom/threepress-bookworm-read-only | bookworm/gdata/tests/all_tests.py | Python | bsd-3-clause | 3,464 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
# Copyright (C) Zing contributors.
#
# This file is a part of the Zing project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from django... | iafan/zing | pootle/apps/pootle_language/views.py | Python | gpl-3.0 | 4,465 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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 http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The Initia... | gale320/newfies-dialer | newfies/callcenter/views.py | Python | mpl-2.0 | 12,784 |
# $Id$
#
# Copyright (C) 2000-2008 greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
""" code for dealing with composite models
For a model to be useable here, it should support the following API:
- _ClassifyExample(example)_, returns a classification
Other compatibility notes:
1) To use _Compo... | jandom/rdkit | rdkit/ML/Composite/Composite.py | Python | bsd-3-clause | 20,782 |
__author__ = 'cruser42'
a_i = 5
b_i = 7
a_f = 5.0
b_f = 7.0
print("integer division")
print("a: {}, b: {}, a/b: {}".format(a_i, b_i, a_i/b_i))
print("float division")
print("a: {}, b: {}, a/b: {}".format(a_f, b_f, a_f/b_f))
print("mixed num float")
print("a_f: {}, b_i: {}, a/b: {}".format(a_f, b_i, a_f/b_i))
pr... | cruser42/python_course | alex/ints_floats.py | Python | gpl-2.0 | 943 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... | pybuilder/pybuilder | src/integrationtest/python/should_raise_exception_when_detect_task_cycle_tests.py | Python | apache-2.0 | 1,410 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, GeekChimp - Franck Nijhof <[email protected]>
#
# 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 you... | kaarolch/ansible | lib/ansible/modules/system/osx_defaults.py | Python | gpl-3.0 | 14,430 |
"""This script generates nginx configure file for Tor."""
# -*- coding: utf-8 -*-
import codecs # UTF-8 support for the text files
def text2file(txt, filename):
"""Write the txt to the file."""
outputfile = codecs.open(filename, "w", "utf-8")
outputfile.write(txt)
outputfile.close()
def main():
... | juhanurmi/hs-honeypot | tools/generate_nginx_conf.py | Python | gpl-2.0 | 1,663 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | pacoqueen/odfpy | odf/draw.py | Python | gpl-2.0 | 5,750 |
from utils.header import MagicField, Field
from load_command import LoadCommandHeader, LoadCommandCommand
class PrebindCksumCommand(LoadCommandHeader):
ENDIAN = None
FIELDS = (
MagicField('cmd', 'I', {LoadCommandCommand.COMMANDS['LC_DYSYMTAB']: 'LC_DYSYMTAB'}),
Field('cmdsize', 'I'),
F... | hkkwok/MachOTool | mach_o/headers/prebind_cksum_command.py | Python | apache-2.0 | 488 |
class InstanceResource(object):
def __init__(self, version):
"""
:param Version version:
"""
self._version = version
""" :type: Version """
| twilio/twilio-python | twilio/base/instance_resource.py | Python | mit | 185 |
import src.lib.modules.memes
import src.lib.modules.comics
import src.lib.modules.plusplus
import src.lib.modules.flipcoin
import src.lib.modules.calc
import src.lib.modules.poll
import src.lib.modules.magicball
import src.lib.modules.define
import src.lib.modules.help
import src.lib.modules.clear
import src.lib.runtim... | ubidiscordbot/ubi | src/lib/essentials/commandHandler.py | Python | mit | 2,712 |
'''
Written by JT Fuchs, UNC.
PURPOSE: This program takes ZZ Ceti observations with Goodman and runs the full pipeline on a night. Uses ReduceSpec.py, spectral_extraction.py, Wavelenght_Calibration.py, continuum_normalization.py, flux_calibration.py, and diagnostics.py (and all dependencies therein).
DIRECTORY FILES... | bkaiser94/red_cam_pipeline | reduceall.py | Python | mit | 8,368 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding fields
safe_add_column('auth_user', 'new_response_co... | PearsonIOKI/compose-forum | askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py | Python | gpl-3.0 | 27,178 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2016 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... | crisely09/horton | doc/update_lib_doc.py | Python | gpl-3.0 | 4,657 |
import urllib2, sys
import xml.etree.ElementTree as etree
try: zipcode = sys.argv[1]
except: zipcode = '1700003'
resp = urllib2.urlopen('http://zip.cgis.biz/xml/zip.php?zn=%s'%zipcode).read()
output = {}
tree = etree.fromstring(resp)
for e in tree[-1]:
output[e.attrib.keys()[0]] = e.attrib.values()[0]
print out... | yk-tanigawa/2015gci | webdata/sample.py | Python | mit | 383 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of t... | Hybrid-Cloud/cinder | cinder/tests/unit/test_fixtures.py | Python | apache-2.0 | 2,439 |
from __future__ import absolute_import
import difflib
from functools import wraps, partial
import re
from flask import request, url_for, current_app
from flask import abort as original_flask_abort
from flask.views import MethodView
from flask.signals import got_request_exception
from werkzeug.exceptions import HTTPExce... | pyblish/pyblish-endpoint | pyblish_endpoint/vendor/flask_restful/__init__.py | Python | lgpl-3.0 | 22,183 |
# 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... | openstack/keystone | keystone/conf/eventlet_server.py | Python | apache-2.0 | 2,959 |
# Copyright (c) 2009 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. 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 abov... | mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/tool/bot/queueengine.py | Python | apache-2.0 | 6,810 |
#-*- coding: utf-8 -*-
def factorial(n):
"""Return the factorial of n"""
if n < 2:
return 1
return n * factorial(n - 1)
def fibonacci(n):
"""Return the nth fibonacci number"""
if n < 2:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
def fib_fac(x=30, y=900):
fib = ... | ealogar/curso-python | advanced/fib_fac.py | Python | apache-2.0 | 1,159 |
from trueskill import TrueSkill, Rating, rate
import argparse
from pytba import api as tba
import math
class FrcTrueSkill:
def __init__(self):
self.env = TrueSkill(draw_probability=0.02)
self.trueskills = {}
self.events = {}
def update(self, red_alliance, red_score, blue_alliance, blu... | Ninjakow/TrueSkill | ranking.py | Python | gpl-3.0 | 5,051 |
# Copyright 2017 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... | chemelnucfin/tensorflow | tensorflow/contrib/quantize/python/quantize_parameterized_test.py | Python | apache-2.0 | 35,969 |
#Initially forked from Bojan's kernel here: https://www.kaggle.com/tunguz/bow-meta-text-and-dense-features-lb-0-2242/code
#That kernel was forked from Nick Brook's kernel here: https://www.kaggle.com/nicapotato/bow-meta-text-and-dense-features-lgbm?scriptVersionId=3493400
#Used oof method from Faron's kernel here: http... | ifuding/Kaggle | SVPC/Code/philly/HimanChau.py | Python | apache-2.0 | 9,735 |
# -*- coding: utf-8 -*-
"""Module where all interfaces, events and exceptions live."""
from plone.theme.interfaces import IDefaultPloneLayer
from zope.interface import Interface
class IAde25ContactLayer(IDefaultPloneLayer):
"""Marker interface that defines a Zope 3 browser layer."""
class IContactImagesTool(In... | ade25/ade25.contacts | ade25/contacts/interfaces.py | Python | mit | 727 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
# Date: 10/04/2014
#
# This program is free software: you can redistribute it and/or... | avanzosc/avanzosc6.1 | l10n_es_devolucion_remesas/wizard/remesas_run.py | Python | agpl-3.0 | 1,359 |
#
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Tests for the HostRegistry class."""
import unittest
from htrun.host_tests_registry import HostRegistry
from htrun import BaseHostTest
class HostRegistryTestCase(unittest.TestCase):
class HostTest... | ARMmbed/greentea | test/host_tests/host_registry.py | Python | apache-2.0 | 2,499 |
# -*- coding: utf-8 -*-
import types
import hasbug.store as store
import hasbug.validation as validation
import hasbug.user
import hasbug.shortener
OWNERSHIP_UPPER_LIMIT = 10
class Belongings(object):
def __init__(self, ownerhips):
self._ownerhips = ownerhips
@property
def shortener_hosts(self):... | omo/hasb.ug | hasbug/ownership.py | Python | bsd-3-clause | 3,379 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from copy import deepcopy
import subprocess
import time
import platform
import random
from atomic_reactor.constants import (IMAGE_TYPE_DOCKE... | DBuildService/atomic-reactor | atomic_reactor/plugins/post_tag_and_push.py | Python | bsd-3-clause | 10,695 |
from app import db
import datetime
from geoalchemy2 import Geometry
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import Column
import sqlalchemy
from slugify import slugify
from flask.ext.login import UserMixin
class User(UserMixin, db.Model):
__tablen... | hardworkingcoder/dw_experiments | models.py | Python | mit | 1,081 |
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2018, Raffaele Salmaso <[email protected]>
# Copyright (c) 2012 Omoto Kenji
# Copyright (c) 2011 Sam Stephenson
# Copyright (c) 2011 Josh Peek
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... | rsalmaso/django-babeljs | babeljs/execjs/runtime.py | Python | mit | 8,806 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# $Id$
# Copyright (c) 2011, 2012 Technische Universität Dortmund
#
# This file is part of doyouspeakOCCI.
#
# doyouspeakOCCI 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 Foun... | irf/doyouspeakocci | dyso/model.py | Python | gpl-3.0 | 2,552 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2017 David Mandelberg
# Copyright (C) 2017-2018 Sambhav Kothari
# Copyright (C) 2017-2019 Laurent Monin
# Copyright (C) 2018-2020 Philipp Wolfer
# Copyright (C) 2019 Michael Wiencek
#
# This program is free software; you can re... | Sophist-UK/Sophist_picard | picard/mbjson.py | Python | gpl-2.0 | 18,697 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0041_auto_20160214_1225'),
]
operations = [
migrations.AlterField(
model_name='event',
nam... | I-sektionen/i-portalen | wsgi/iportalen_django/events/migrations/0042_auto_20160215_2024.py | Python | mit | 512 |
# -*- coding: utf-8 -*-
"""The json serializer object implementation."""
import binascii
import collections
import json
from dfvfs.path import path_spec as dfvfs_path_spec
from dfvfs.path import factory as dfvfs_path_spec_factory
from plaso.containers import interface as containers_interface
from plaso.containers im... | dc3-plaso/plaso | plaso/serializer/json_serializer.py | Python | apache-2.0 | 13,349 |
from __future__ import division, print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.misc import logsumexp
from autograd.convenience_wrappers import value_and_grad as vgrad
from functools import partial
from os.path import join, dirname
import string
import sys
def EM(in... | barak/autograd | examples/hmm_em.py | Python | mit | 2,862 |
#!/usr/bin/python
import struct
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 12777))
sock.listen(1)
conn, addr = sock.accept()
data = ''
while 1:
while len(data) < 16:
data += conn.recv(1024)
if not data: break
if not data: break
i, size = struct.u... | jonstewart/liblightgrep | pytest/receive_data.py | Python | gpl-3.0 | 634 |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, 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... | gogoair/foremast | src/foremast/utils/properties.py | Python | apache-2.0 | 1,548 |
"""Provides the options command."""
from functools import partial
from gsb.intercept import Menu
from forms import set_value
from parsers import parser
from options import options
from util import done
def show_section(section, caller):
"""Show the player an instance of OptionsMenu."""
caller.con... | chrisnorman7/game | commands/options.py | Python | mpl-2.0 | 2,845 |
import codecs
import re
import types
import sys
from constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from constants import encodings, ReparseException
import utils
#Non-unicode versions of constants for use in the pre-parser
spaceCharactersBytes = frozenset([str(item) for item in spaceCharacters])... | dewitt/appengine-unshorten | third_party/html5lib/inputstream.py | Python | apache-2.0 | 27,634 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.common.task_utils import cleanup, error_cleanup, task
from bliss.common.measurement import SamplingCounter
from bliss.common.gr... | tiagocoutinho/bliss | bliss/controllers/ls335.py | Python | lgpl-3.0 | 1,796 |
""" Classes to handle HTMLText and Catalogues in PubTal.
Copyright (c) 2015 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source c... | owlfish/pubtal | lib/pubtal/plugins/markdown.py | Python | bsd-3-clause | 3,304 |
from .file_logger import FileLogger | philipperemy/tensorflow-phased-lstm | helpers/__init__.py | Python | mit | 35 |
# xiaolongdolly 2017.8.20
cubes = [cube**3 for cube in range(1, 11)]
print(cubes)
| xiaolongdolly/Python_Course | chapter_4/cubes/cubes_2.py | Python | gpl-3.0 | 83 |
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0
# Logic to spawn a sub-process and interact with its stdio.
import os
import re
import pty
import signal
import select
import time
class Timeout(Exception):
"""An exception sub-class that indicates that a tim... | guileschool/beagleboard | u-boot/test/py/u_boot_spawn.py | Python | mit | 6,482 |
# -*- coding: utf-8 -*-
"""
tests/__init__.py
"""
import unittest
import trytond.tests.test_tryton
from tests.test_wishlist import TestWishlist
def suite():
"""
Define suite
"""
test_suite = trytond.tests.test_tryton.suite()
test_suite.addTests([
unittest.TestLoader().loadTestsFromT... | fulfilio/nereid-wishlist | tests/__init__.py | Python | bsd-3-clause | 455 |
#!/usr/bin/python3
import sys
import subprocess
repoquery = ['repoquery', '--plugins', '--resolve', '--qf',
'%{name}.%{arch} %{repoid} %{location}', '--plugins', '-R']
package_info = dict()
def check_dep(packages):
#print(packages)
if len(packages) == 0:
return
cmd = repoquery + packages
output... | Zor-X-L/offline-utils | rhel6-utils/repoquery-recursive.py | Python | mit | 815 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
freeseer - vga/presentation capture software
Copyright (C) 2011 Free and Open Source Software Learning Centre
http://fosslc.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 ... | Freeseer/freeseer | src/freeseer/frontend/configtool/ConfigToolWidget.py | Python | gpl-3.0 | 3,246 |
import SSD1331
import time
import datetime
device = SSD1331.SSD1331()
def test(device):
r, g, b = (48, 213, 200)
rd, gd, bd = (1,1,1)
arr = []
for x in range(9000):
color = device.color565_fast(r, g, b)
r +=1 * rd
g +=2 * gd
b +=3 * bd
i... | Zurek87/SSD1331_rpi | test.py | Python | mit | 997 |
# exceptions.py
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Michael Bayer [email protected]
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""exception classes"""
import traceback, sys, re
from mako import util
class MakoException(E... | sadanandb/pmt | src/mako/exceptions.py | Python | epl-1.0 | 11,269 |
# Copyright 2019 Capital One Services, 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... | FireballDWF/cloud-custodian | tools/sandbox/c7n_autodoc/c7n-autodoc.py | Python | apache-2.0 | 6,289 |
import math
def linear(pos):
return pos
def quadIn(pos):
return pow(pos, 2)
def quadOut(pos):
return -(pow((pos - 1), 2) -1)
def quadInOut(pos):
pos /= 0.5
if pos < 1:
return 0.5 * pow(pos, 2);
pos -= 2
return -0.5 * (pos * pos - 2);
def sineIn(pos):
return -math.cos(pos * ... | bitsawer/renpy-shader | ShaderDemo/game/shader/easing.py | Python | mit | 2,658 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | lakshmi-kannan/st2 | st2common/st2common/models/db/keyvalue.py | Python | apache-2.0 | 1,989 |
import time
import RPi.GPIO as GPIO
from Adafruit_BME280 import *
led_output = 27
sensor = BME280(t_mode=BME280_OSAMPLE_8, p_mode=BME280_OSAMPLE_8, h_mode=BME280_OSAMPLE_8)
GPIO.setmode(GPIO.BCM)
GPIO.setup(led_output, GPIO.OUT)
led = False
while True:
degrees = sensor.read_temperature()
print('Temp = ' + s... | gdmgent-1718-wot/Hardware | rpi-gpio/BMP280Sensor/BMP280.py | Python | apache-2.0 | 480 |
#! /usr/bin/env python3
import argparse
import asyncio
import ast
import sys
from colorama import init as colorama_init, Fore, Style
class NotSupportedNodeError(ValueError): pass
def attr2str(node):
if isinstance(node, ast.Attribute):
if isinstance(node.value, ast.Attribute):
value = attr2s... | lablup/coroutine-check | check.py | Python | mit | 7,691 |
from rdkit import Chem
from numpy.testing import assert_almost_equal
from mordred.SLogP import SMR, SLogP
def test_WildmanCrippen1():
mol = Chem.MolFromSmiles("Oc1ccccc1OC")
yield assert_almost_equal, SLogP()(mol), 1.4, 2
yield assert_almost_equal, SMR()(mol), 34.66, 2
def test_WildmanCrippen2():
m... | mordred-descriptor/mordred | mordred/tests/test_SLogP.py | Python | bsd-3-clause | 417 |
from twisted.web import resource
import headers
class DynamicOptions(resource.Resource):
def getChild(self, name, request):
return self
"""
Get HTTP Options
"""
def render_OPTIONS(self, request):
headers.setContentHeaders(request)
headers.setAccessControlHeaders(request)
request.setResponse... | michaelmp/web-res-scaf | web/options.py | Python | agpl-3.0 | 344 |
#!/usr/bin/env python
import base64
import itertools
import os
import argparse
from bugzilla.models import Bug, Attachment, Flag, User, Comment
from bugzilla.agents import BugzillaAgent
from bugzilla.utils import urljoin, qs, get_credentials, FILE_TYPES
REVIEW = 4
class AttachmentAgent(BugzillaAgent):
"""Stores... | LegNeato/bztools | scripts/attach.py | Python | bsd-3-clause | 4,585 |
# Modules required for the functions here
import sys
import inspect
import numpy
import math
import copy
import random
import collections
import functools
# Find the require libraries for Windows. This change was prompted by how
# shared libaries are linked in Python 3.8
import ctypes
import ctypes.util
if sys.platfo... | OptimoJoe/Optizelle | src/python/Optizelle/__init__.py | Python | bsd-2-clause | 4,597 |
# -*- coding: utf-8 -*-
"""Test utilities."""
#
# (C) Pywikibot team, 2013-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import print_function, unicode_literals
__version__ = '$Id$'
#
import inspect
import json
import os
import re
import subprocess
import sys
import time
import traceback
i... | valhallasw/pywikibot-core | tests/utils.py | Python | mit | 20,611 |
"""
Here is probably the place to write the docs, since the test-cases
show how the type behave.
Later...
"""
from ctypes import *
from ctypes.test import need_symbol
import os, sys, unittest
try:
WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
WINFUNCTYPE = CFUNCTYPE
import _ctypes_te... | slozier/ironpython2 | Src/StdLib/Lib/ctypes/test/test_functions.py | Python | apache-2.0 | 13,037 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
import unittest
from contextlib import contextmanager
from textwrap import dedent
from unittest import skipIf
from pants.scm.git import Git
from pants.scm.scm ... | tdyas/pants | tests/python/pants_test/scm/test_git.py | Python | apache-2.0 | 24,683 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 program is distributed i... | Erethon/synnefo | astakosclient/astakosclient/errors.py | Python | gpl-3.0 | 3,137 |
# coding: utf-8
# ## K-means clustering
# #### This notebook presents the machine learning analysis of the gapminder dataset accessible from http://www.gapminder.org/data/
# In[1]:
get_ipython().magic(u'matplotlib inline')
# import the necessary libraries
import pandas as pd
import numpy as np
import matplotlib.py... | duttashi/Data-Analysis-Visualization | scripts/general/k-means-breastcancer_prediction.py | Python | mit | 5,294 |
from django import template
register = template.Library()
def easy_tag(func):
"""Decorator to facilitate template tag creation"""
def inner(parser, token):
"""deal with the repetitive parts of parsing template tags"""
try:
return func(*token.split_contents())
except TypeErr... | Turupawn/website | games/templatetags/append_to_get.py | Python | agpl-3.0 | 1,303 |
# 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-mgmt-devtestlabs/azure/mgmt/devtestlabs/dev_test_labs_client.py | Python | mit | 10,265 |
#!/usr/bin/env python
"""
Read a MAF from stdin and break into several new mafs containing no more than
`chunk_size` columns. The new mafs will be written to `out_dir` along with a
file "intervals.txt" specifying the range covered by each new maf file. A
probability for writing each chunk can optionally be specified, ... | uhjish/bx-python | scripts/maf_chunk.py | Python | mit | 2,486 |
__author__ = 'Dominic Miglar <[email protected]>'
from unittest import TestSuite
from .testcase_get_undefined import HttpGetUndefinedTestCase
from .testcase_post_undefined import HttpPostUndefinedTestCase
from .testcase_delete_undefined import HttpDeleteUndefinedTestCase
def get_test_suite():
test_sui... | bitmovin/bitcodin-python | bitcodin/test/http/__init__.py | Python | unlicense | 516 |
import itertools
import types
from copy import deepcopy, copy
from contextlib import suppress
from warnings import warn
import numpy as np
import pandas as pd
import pandas.api.types as pdtypes
from .strips import strips
from ..utils import cross_join, match
from ..exceptions import PlotnineError, PlotnineWarning
fro... | has2k1/plotnine | plotnine/facets/facet.py | Python | gpl-2.0 | 18,851 |
#import win32traceutil
import traceback
import sys
import os
import time
import new
# these three are required pre-imported, for pyjamas to work
# with the pyjd imputil etc. awful, i know...
import threading
import encodings
import encodings.cp437
from windows import *
from ctypes import *
from ctypes.wintypes imp... | lovelysystems/pyjamas | pyjd/mshtml.py | Python | apache-2.0 | 10,213 |
from pytest_voluptuous import S
from voluptuous.validators import ExactSequence, Datetime
from skylines.model.notification import create_follower_notification
from tests.api import auth_for
from tests.data import users
def test_list_all(db_session, client):
john = users.john()
jane = users.jane()
max = ... | skylines-project/skylines | tests/api/views/notifications/list_test.py | Python | agpl-3.0 | 1,495 |
def extractWwwBlexbinNet(item):
'''
Parser for 'www.blexbin.net'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterou... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwBlexbinNet.py | Python | bsd-3-clause | 542 |
## @file
# This is an XML API that uses a syntax similar to XPath, but it is written in
# standard python so that no extra python packages are required to use it.
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under ... | svn2github/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py | Python | gpl-2.0 | 6,987 |
from hearthbreaker.cards.minions.neutral import (
BloodfenRaptor,
IronbeakOwl,
NoviceEngineer,
StonetuskBoar,
WarGolem,
MogushanWarden,
FaerieDragon,
KoboldGeomancer,
ElvenArcher,
ArgentSquire,
SilvermoonGuardian,
TwilightDrake,
MagmaRager,
DireWolfAlpha,
Worg... | anuragpapineni/Hearthbreaker-evolved-agent | hearthbreaker/cards/minions/__init__.py | Python | mit | 5,168 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | sputnick-dev/weboob | weboob/capabilities/contact.py | Python | agpl-3.0 | 7,083 |
import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.authentication_provider import AuthenticationProvider
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestAuthenticationProvider(unittest.TestCase):
def setUp(self):
self.canvas... | ucfopen/canvasapi | tests/test_authentication_providers.py | Python | mit | 1,880 |
import random
def insertion_sort(items):
"""Return the list in sort order and the number of swaps.
Implements insertion sort algorithm.
"""
swaps = 0
# caches the size of the list
items_size = len(items)
# iterates over the list, skipping the first item,
# since there is no previous items to compar... | marioluan/data-structures-and-algorithms | algorithms/python/src/sorting_algorithms/insertion_sort.py | Python | mit | 873 |
from __future__ import absolute_import, unicode_literals
import time
from datetime import timedelta
from djcelery_transactions import task
from django.utils import timezone
from redis_cache import get_redis_connection
from .models import CreditAlert, Invitation, Org, TopUpCredits
@task(track_started=True, name='sen... | ewheeler/rapidpro | temba/orgs/tasks.py | Python | agpl-3.0 | 1,662 |
from django.test import TestCase
from lib import grades
class GradesTestCase(TestCase):
def test_numeric_value_for_grade_retrieves_single_letter_grades(self):
for grade, value in grades.GRADE_MAPPINGS.iteritems():
self.assertEqual(grades.numeric_value_for_grade(grade), value)
def test_nu... | layuplist/layup-list | apps/web/tests/lib_tests/test_grades.py | Python | gpl-3.0 | 1,236 |
# -*- coding: utf-8 -*-
#
# 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
#... | sid88in/incubator-airflow | airflow/hooks/mysql_hook.py | Python | apache-2.0 | 4,636 |
# -*- coding: utf-8 -*-
import datetime, time, csv, os
import numpy as np
from utils.db import SqliteDB
from utils.rwlogging import log
from utils.rwlogging import strategyLogger as logs
from utils.rwlogging import balLogger as logb
from strader import Trader
from indicator import ma, macd, bolling, rsi, kdj
from mas.m... | rolandwz/pymisc | trader/mas/maStrategy.py | Python | mit | 5,600 |
# -*- coding: utf-8 -*-
from micolog_plugin import *
from BeautifulSoup import *
from datetime import datetime
from model import Entry,Comment,Media
import logging,math
import re
from base import BaseRequestHandler,urldecode
class Importhandler(BaseRequestHandler):
def post(self):
if not self.is_login:
self.re... | Alwnikrotikz/micolog2 | plugins/live_import/live_import.py | Python | gpl-3.0 | 3,458 |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... | matthiaskramm/corepy | corepy/arch/ptx/isa/__init__.py | Python | bsd-3-clause | 2,838 |
# firebird/__init__.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from sqlalchemy.dialects.firebird.base import BIGINT
from sqlalchemy.dialects.... | monetate/sqlalchemy | lib/sqlalchemy/dialects/firebird/__init__.py | Python | mit | 1,153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
import logging
import urllib2
import urllib
import base64
import json
from cherrypy.lib.auth2 import require
class TVHeadend(object):
def __init__(self):
self.logger = logging.getLogger('modules.tvheadend')
htpc.MODULES.app... | scith/htpc-manager_ynh | sources/modules/tvheadend.py | Python | gpl-3.0 | 4,053 |
# encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so
# by generator 1.135
# no doc
# imports
import sip as __sip
class QVariant(): # skipped bases: <type 'sip.simplewrapper'>
"""
QVariant()
QVariant(Type)
QVariant(int, sip.voidptr)
QVariant(QVariant)
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtCore/__init__/QVariant.py | Python | gpl-2.0 | 9,340 |
import abc
import os
import numpy as np
import pandas as pd
from scipy.io import loadmat
from scipy.misc import imread, imresize
from cvds.dataset_base import *
from cvds.meta.path import get_path
class Caltech101(CategoryNestedDataSetBase):
"""
The Caltech-101 dataset
"""
@property
def name(se... | Hezi-Resheff/vision-datasets | cvds/datasets.py | Python | gpl-3.0 | 5,330 |
from mock import *
from gp_unittest import *
from gppylib.operations.package import IsVersionCompatible
class IsVersionCompatibleTestCase(GpTestCase):
def setUp(self):
self.gppkg_mock_values = \
{'main_rpm': 'plperl-1.1-2.x86_64.rpm',
'postupdate': [],
'pkgname': 'plp... | lintzc/gpdb | gpMgmt/bin/gppylib/test/unit/test_unit_package.py | Python | apache-2.0 | 3,737 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.