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 |
|---|---|---|---|---|---|
#!/usr/bin/python
"""
blink.py
Blink an output (relay)
=======
run with:
sudo ./blink.py
Copyright 2014 David P. Bradway (dpb6@duke.edu)
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:... | davidbradway/beaglebone-python | blink.py | Python | apache-2.0 | 1,134 |
#
# Module implementing synchronization primitives
#
# multiprocessing/synchronize.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event'
]
import threading
import sys
import... | Orav/kbengine | kbe/src/lib/python/Lib/multiprocessing/synchronize.py | Python | lgpl-3.0 | 12,642 |
import os
from flask import Flask
from flask import render_template
from flask.ext.sqlalchemy import SQLAlchemy
path = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + path + '/test.db'
db = SQLAlchemy(app)
class Categories(db.Model):
__ta... | jairot/yogcheck | hello.py | Python | bsd-3-clause | 1,832 |
from nntplib import *
s = NNTP('web.aioe.org')
(resp, count, first, last, name) = s.group('comp.lang.python')
(resp, subs) = s.xhdr('subject', (str(first)+'-'+str(last)))
for subject in subs[-10:]:
print(subject)
number = input('Which article do you want to read? ')
(reply, num, id, list) = s.body(str(number))
for l... | simontakite/sysadmin | pythonscripts/webprogrammingwithpython/Working Files/Chapter 5/0504 newsreader.py | Python | gpl-2.0 | 347 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import os
from telemetry.core import util
BASE_PROFILE_TYPES = ['clean', 'default']
PROFILE_TYPE_MAPPING = {
't... | catapult-project/catapult | telemetry/telemetry/internal/browser/profile_types.py | Python | bsd-3-clause | 1,031 |
# -*- coding: utf-8 -*-
import os
import json
from flask import Flask, request, \
render_template, \
send_file, \
session
import config
from common.db import init_db
from common import db
from models.user import User
app = Flask(__name__, template_folder="feifanote... | livoras/feifanote-server | app.py | Python | mit | 1,364 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abst... | UnrememberMe/pants | src/python/pants/base/payload_field.py | Python | apache-2.0 | 4,593 |
"""
Django management command to create a course in a specific modulestore
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from xmodule.modulestore import ModuleStoreEnum
from contentstore.views.course import create_new_course_in_store
from contentstore.... | olexiim/edx-platform | cms/djangoapps/contentstore/management/commands/create_course.py | Python | agpl-3.0 | 2,078 |
'''
Translates a source file using a translation model.
'''
import argparse
import theano
import numpy
import cPickle as pkl
from nmt import (build_sampler, gen_sample, load_params,
init_params, init_tparams)
from multiprocessing import Process, Queue
def translate_model(queue, rqueue, mask_left, ... | howardchenhd/Syntax-awared-NMT | translate.py | Python | bsd-3-clause | 6,967 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
import tensorflow as tf
import numpy as np
from time import time
import os
from six.moves.cPickle import dump, load
from snorkel.learning.classifi... | HazyResearch/snorkel | snorkel/learning/tensorflow/noise_aware_model.py | Python | apache-2.0 | 15,676 |
'''
commant regarding project
Raw Score 100.00 / 100.00
'''
import test_graphs as test
from collections import deque
import random
#import poc_queue
def bfs_visited(ugraph, start_node):
'''
Input:
ugraph - undirected graph represented as adjacent list
start_node - initial node. (in this case integer... | maistrovas/My-Courses-Solutions | Coursera Algorithmic Thinking (Part 1)/Module 2/Project/BFS_project.py | Python | mit | 2,344 |
"""
TESTS is a dict with all you tests.
Keys for this will be categories' names.
Each test is dict with
"input" -- input data for user function
"answer" -- your right answer
"explanation" -- not necessary key, it's using for additional info in animation.
"""
TESTS = {
"Basics": [
{
... | Bryukh-Checkio-Tasks/checkio-mission-super-root | verification/tests.py | Python | mit | 2,112 |
# PyTransit: fast and easy exoplanet transit modelling in Python.
# Copyright (C) 2010-2019 Hannu Parviainen
#
# 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 Licen... | hpparvi/PyTransit | pytransit/contamination/__init__.py | Python | gpl-2.0 | 1,603 |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Element SW Software Snapshot Schedule"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alexlo03/ansible | lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py | Python | gpl-3.0 | 22,400 |
import datetime
import functools
import json
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db import connection, transaction
import olympia.core.logger
from . import models as context
task_log = olympia.core.logger.getLogger('z.task')
def... | harry-7/addons-server | src/olympia/amo/decorators.py | Python | bsd-3-clause | 7,689 |
from distutils.core import setup, Extension
setup(name = 'pyqspline',
version = '0.2',
author = 'James McEnnan, Planet Labs',
description = 'Python version of qspline, which produces a quaternion spline interpolation of sparse data.',
py_modules = ['pyqspline'],
ext_modules = [Extension('... | planetlabs/pyqspline | setup.py | Python | gpl-2.0 | 355 |
#!/usr/bin/env python3
import pytest
from exercise3 import decide_rps
def test_checksum():
"""
Inputs that are the correct format and length
"""
#Check Correct
assert decide_rps("Rock", "Paper") == 2
assert decide_rps("Rock", "Scissors") == 1
assert decide_rps("Rock", "Rock") == 0
ass... | Xwzhou/1340A1 | test_exercise3.py | Python | mit | 708 |
import datetime
import decimal
import hashlib
from time import time
from django.conf import settings
from django.utils.log import getLogger
from django.utils.timezone import utc
logger = getLogger('django.db.backends')
class CursorWrapper(object):
def __init__(self, cursor, db):
self.cursor = cursor
... | mixman/djangodev | django/db/backends/util.py | Python | bsd-3-clause | 4,511 |
from pybox import *
tab = np.loadtxt('./results/kepler.dat')
tab2 = np.loadtxt('./results/kepler_gr.dat')
if tab.size != tab2.size :
print "error, arrays of different sizes can't be compared"
else :
#col 12 : omega (argument periastre), col 11 : Omega (longitude du noeud ascendant)
omega = tab[:, 11... | neutrinoceros/mt1 | pyplot/perihelie.py | Python | gpl-2.0 | 738 |
from pyblish import api
from pyblish_bumpybox import inventory
class CollectRender(api.ContextPlugin):
""" Integrates render """
order = inventory.get_order(__file__, "CollectRender")
def process(self, context):
import json
import math
import clique
job = context.data("... | Bumpybox/pyblish-bumpybox | pyblish_bumpybox/plugins/deadline/OnJobSubmitted/collect_render.py | Python | lgpl-3.0 | 2,350 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.http import request
class NoteController(http.Controller):
@http.route('/note/new', type='json', auth='user')
def note_new_from_systray(self, note, activity_type_id=None, date_d... | t3dev/odoo | addons/note/controllers/note.py | Python | gpl-3.0 | 1,139 |
from pgcli.packages.sqlcompletion import suggest_type
import pytest
def sorted_dicts(dicts):
"""input is a list of dicts"""
return sorted(tuple(x.items()) for x in dicts)
def test_select_suggests_cols_with_visible_table_scope():
suggestions = suggest_type('SELECT FROM tabl', 'SELECT ')
assert sorted_... | czchen/debian-pgcli | tests/test_sqlcompletion.py | Python | bsd-3-clause | 11,428 |
info_system = 'http://webpac.lib.nthu.edu.tw/F/'
top_circulations = 'http://www.lib.nthu.edu.tw/guide/topcirculations/index.htm'
top_circulations_bc2007 = 'http://www.lib.nthu.edu.tw/guide/topcirculations/bc2007.htm'
rss_recent_books = 'http://webpac.lib.nthu.edu.tw:8080/nbr/reader/rbn_rss.jsp'
lost_found_url = 'http:/... | leVirve/NTHU-Library | nthu_library/static_urls.py | Python | gpl-2.0 | 363 |
# 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... | jmcgeheeiv/pyfakefs | pyfakefs/tests/mox3_stubout_example.py | Python | apache-2.0 | 892 |
import time
from openerp.report import report_sxw
class sms_report_studentslist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(sms_report_studentslist, self).__init__(cr, uid, name, context = context)
self.localcontext.update( {
'time': time,
'rep... | inovtec-solutions/OpenERP | openerp/addons/sms/report/sms_report_studentslist.py | Python | agpl-3.0 | 8,433 |
# -*- coding: utf-8 -*-
"""
github3.users
=============
This module contains everything relating to Users.
"""
from __future__ import unicode_literals
from json import dumps
from uritemplate import URITemplate
from .events import Event
from .models import GitHubObject, GitHubCore, BaseAccount
from .decorators import... | ueg1990/github3.py | github3/users.py | Python | bsd-3-clause | 14,886 |
#!/usr/bin/python
#
# Copyright (c) 2012 The Native Client 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 sys
import textwrap
from subprocess import Popen, PIPE
_OBJDUMP = 'arm-linux-gnueabi-objdump'
def _objdump(binary, v... | yantrabuddhi/nativeclient | src/trusted/validator_arm/validation-report.py | Python | bsd-3-clause | 3,574 |
'''
A runner is executes a 'distributable' job. FastLmmSet is an example of a distributable job.
Local is an example of a runner. Local can execute FastLMMSet (or any other distributable job) on a local machine as a single process.
LocalMultiProc is another runner. It can execute FastLmmSet, etc on a multiple proces... | zhonghualiu/FaST-LMM | fastlmm/util/runner/__init__.py | Python | apache-2.0 | 17,553 |
"""
TestCenter package tests that require actual TestCenter chassis and active ports.
Test setup:
Two STC ports connected back to back.
@author yoram@ignissoft.com
"""
from os import path
from testcenter.stc_statistics_view import StcStats
from testcenter.stc_app import StcSequencerOperation
from testcenter.test.t... | shmir/PyTestCenter | testcenter/test/test_online.py | Python | apache-2.0 | 10,809 |
#! /usr/bin/env python
import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
d,a = pipe.read("time_complex.fid")
d,a = p.qart(d,a,a=1.0,f=0.5)
pipe.write("qart.glue",d,a,overwrite=True)
d,a = pipe.read("time_complex.fid")
d,a = p.qart(d,a,a=0.8,f=1.2)
pipe.write("qart2.glue",d,a,overwrite=True)
| rpbarnes/nmrglue | tests/pipe_proc_tests/qart.py | Python | bsd-3-clause | 318 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('djangorrd', '0003_auto_20151010_2128'),
]
operations = [
migrations.AddField(
model_name='graph',
na... | okami-1/django-rrd | djangorrd/migrations/0004_auto_20151104_1439.py | Python | gpl-3.0 | 859 |
import base64
from django.db import models
from django.utils.translation import gettext_lazy as _
from .request import FoiRequest
class DeferredMessageManager(models.Manager):
def get_publicbody_for_email(self, email):
deferreds = (
self.get_queryset()
.filter(sender=email, reque... | fin/froide | froide/foirequest/models/deferred.py | Python | mit | 1,968 |
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# This file is part of the Patchwork package.
#
# Patchwork 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; eith... | ivyl/patchwork | patchwork/views/xmlrpc.py | Python | gpl-2.0 | 22,918 |
#!flask/bin/python
import re
import sys
import time
from process_tournament import *
def main():
'''
Takes args from command prompt:
tournamentlist is a .txt file from tournamentlists subfolder
region is a string that is the name of an existing Region
Example call: ./process_tournamentlist.py tournamentlist... | lawrluor/matchstats | process_tournamentlist.py | Python | bsd-3-clause | 818 |
# -*- coding: utf-8 -*-
"""
sockjs.tornado.router
~~~~~~~~~~~~~~~~~~~~~
SockJS protocol router implementation.
"""
from tornado import ioloop, version_info
from octoprint.vendor.sockjs.tornado import transports, session, sessioncontainer, static, stats, proto
DEFAULT_SETTINGS = {
# Sessions check i... | Jaesin/OctoPrint | src/octoprint/vendor/sockjs/tornado/router.py | Python | agpl-3.0 | 6,630 |
from time import time
DATARATE_UPDATE = 1.0 # Time slice (in second) for datarate computation
class DataRate:
"""
Compute average speed in bits per second of a function.
Store self.size data rates to compute good average speed.
Don't compute average before self.min_size values are computed.
"""
... | foreni-packages/hachoir-subfile | hachoir_subfile/data_rate.py | Python | gpl-2.0 | 1,237 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'DumpReport', fields ['keyword']['submission_id']
db.create_index('bednets_dumpreport', ['... | unicefuganda/rapidsms-bednets | bednets/migrations/0005_add_index_DumpReport_keyword.py | Python | bsd-3-clause | 2,707 |
# -*- coding: utf-8 -*-
#
# 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
... | prestodb/presto-admin | prestoadmin/config.py | Python | apache-2.0 | 3,399 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#***************************************************************************
#* Copyright (C) 2014 by Sebastian Schmidt [schro.sb@gmail.com] *
#* *
#* ... | DefaultUser/DontSleep | dontsleep.py | Python | gpl-3.0 | 10,120 |
"""
ICS Ops Common Library
"""
import os
from os.path import dirname
from os.path import realpath
from os.path import join as pathjoin
import boto
__version__ = "0.0.3.3"
__release__ = "alpha"
CONFIG = "opslib.ini"
LOG_NAME = "opslib"
AWS_ACCESS_KEY_NAME = "aws_access_key_id"
AWS_SECRET_KEY_NAME = "aws_secret_acces... | henrysher/opslib | opslib/__init__.py | Python | apache-2.0 | 1,905 |
# 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... | a10networks/a10-horizon | a10_horizon/dashboard/a10networks/a10ssl/panel.py | Python | apache-2.0 | 1,266 |
"""
WSGI config for django_project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | pengutronix/aiohttp-json-rpc | tests/django_project/django_project/wsgi.py | Python | apache-2.0 | 405 |
#coding=utf-8
from django.db import models
from django.contrib.auth.models import AbstractUser
class Pages(object):
'''
分页查询工具
'''
def __init__(self, count, current_page=1, list_rows=40):
self.total = count
self._current = current_page
self.size = list_rows
self.pages =... | Liubusy/V2GO | forum/models.py | Python | mit | 10,188 |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm is free software: you can redistribute it and/or modify it
from datetime import date
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... | r4vi/open-ihm | src/openihm/control/openihmexportmanager1.py | Python | lgpl-3.0 | 14,926 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from canopen_301_402.async.async_operation import AsyncOperation
class AsyncSendAndAwait(AsyncOperation):
"""docstring for AsyncChain"""
def __init__(self, node, send_msg_factory, await_msg_predicate, *args, **kwargs):
self.node = node
self.send_m... | xaedes/canopen_301_402 | src/canopen_301_402/async/async_send_and_await.py | Python | mit | 669 |
import json
import os
version_info = (0, 0, 0)
__version__ = "0.0.0"
here = os.path.dirname(__file__)
with open(os.path.join(here, "package.json")) as f:
packageJSON = json.load(f)
__version__ = packageJSON['version']
version_info = tuple(__version__.split('.'))
| captainsafia/nteract | applications/jupyter-extension/nteract_on_jupyter/_version.py | Python | bsd-3-clause | 279 |
#! /usr/bin/env python
import sys
import struct
print_fmt = "boot_ind=%02x\n" \
"head=%02x sector=%02x(%02x) cylinder=%02x(%02x)\n" \
"sys_ind=%02x\n" \
"end_head=%02x end_sector=%02x(%02x) end_cylinder=%02x(%02x)\n" \
"start=%08x size=%08x\n"
class Partition:
"store one partition information"
... | yupeng820921/mbr-ayalysiser | analysis_mbr.py | Python | gpl-2.0 | 3,068 |
import string
import os, sys
try:
import json
except ImportError:
import simplejson as json
import subprocess
### url = 'http://bubba.jpl.nasa.gov:8083'
url = 'http://cmacws.jpl.nasa.gov:8083'
# function to print out mesg
def print_mesg(mesg, keyword):
if keyword is 'Error':
keyword1 = 'Err'
else:
k... | chrismattmann/apple | distribution/src/main/resources/bin/checker_client.py | Python | apache-2.0 | 2,189 |
#!/usr/bin/env python
import uuid
import sys
import re
import os
sys.path.insert(0, "..")
import pytest
from conftest import parse_a01, parse_a01_factory
from ciscoconfparse.ciscoconfparse import CiscoConfParse
from ciscoconfparse.models_asa import ASAObjGroupService
from ciscoconfparse.ccp_util import L4Object
fro... | mpenning/ciscoconfparse | tests/test_Models_Asa.py | Python | gpl-3.0 | 16,385 |
# id3 support for mutagen
# Copyright (C) 2005 Michael Urman
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# $Id: id3.py 4285 2008-09-06 08:01:31Z piman $
"""ID3v2 reading a... | hzlf/openbroadcast.org | website/tools/mutagen-v1.20.1/id3.py | Python | gpl-3.0 | 79,625 |
# -*- coding: utf-8 -*-
from django import forms
from .models import User
class UserForm(forms.ModelForm):
class Meta:
model = User
# Constrain the UserForm to just these fields.
fields = ("first_name", "last_name") | chhantyal/referly | referly/users/forms.py | Python | bsd-3-clause | 248 |
from internals.commandRegistry import CommandRegistry
import re
import subprocess
def local_git_helper(target):
try:
out = subprocess.check_output(
["/usr/bin/git", "pull"],
stderr=subprocess.STDOUT,
cwd=target['directory']
)
except subprocess.CalledProcessEr... | kaithar/muhubot | attic/commands/deploy.py | Python | gpl-2.0 | 1,470 |
from ajenti.api import *
from ajenti.ui.binder import Binder
from ajenti.plugins.main.api import SectionPlugin
from ajenti.ui import on
from ajenti.util import platform_select
from reconfigure.configs import SambaConfig, PasswdConfig
from reconfigure.items.samba import ShareData
from status import SambaMonitor
from s... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/samba/main.py | Python | apache-2.0 | 3,182 |
import os
from veros import logger, veros_kernel, KernelOutput
from veros.diagnostics.base import VerosDiagnostic
from veros.core import density
from veros.variables import Variable, allocate
from veros.distributed import global_sum
from veros.core.operators import numpy as npx, update, update_add, at, for_loop
VAR... | dionhaefner/veros | veros/diagnostics/overturning.py | Python | mit | 9,629 |
# -*- coding: utf-8 -*-
'''
The module used to execute states in salt. A state is unlike a module
execution in that instead of just executing a command it ensure that a
certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state fun... | victorywang80/Maintenance | saltstack/src/salt/state.py | Python | apache-2.0 | 104,050 |
import random
def brut_force(n, A):
global m
if n == 0:
t = sum([0 if A[i] == 0 else abc[i][A[i] - 1] for i in range(len(A))])
if m > t:
m = t
return
if n >= 3:
B = list(A)
B.extend([3, 0 , 0])
brut_force(n - 3, B)
if n >= 2:
B = list(A)
B.extend([2, 0])
brut_force(n - 2, B)
if n >= 1:
B = ... | Senbjorn/mipt_lab_2016 | contest_222/tickets.py | Python | gpl-3.0 | 1,379 |
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright (C) 2015-16 Alexander Thomas <alexander@collab.net>
#
# This file is part of DumpFixit!
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the ... | kcaalexander/DumpFixIt | dumpfixit/dump.py | Python | gpl-2.0 | 3,761 |
import re
import hashlib
import logging
class Register(object):
POST = 'POST'
GET = 'GET'
def __init__(self):
self.handler = None
self.post_callables = {}
self.get_callables = {}
self.post_expressions = []
self.get_expressions = []
self.path_rege... | USMediaConsulting/pywebev | server/register.py | Python | apache-2.0 | 3,493 |
#module for Publication Statement (<editionstmt>) for both <control> and <eadheader>
import xml.etree.cElementTree as ET
import globals
def publicationstmt(control_root, CSheet):
if CSheet.find('Publisher/AddressLine') is None:
if CSheet.find('Publisher/PublisherName').text:
pub_data = True
else:
pub_data =... | gwiedeman/eadmachine | source/SpreadsheettoEAD/func/publicationstmt.py | Python | unlicense | 4,839 |
"""Display Class"""
import time
class Display:
"""Display the progress of a process.
Will print a progress bar updated by function calls made off of an
instance of this type. Will also estimate time to completion via naieve
averaging.
Attributes:
start_time (float): Seconds since epoch to when p... | wwunlp/sner | sner/classes/display.py | Python | mit | 3,703 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Chap14 Classes et méthodes...
# Override, Operator overloading
# by Elian
import os
# Réécriture des fonctions Point en POO
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
# renvoie une représentation texte de l'objet Point.
# On override la f... | Elian-0x/practice-python | tutos/How to Think Like a Computer Scientist/chap14_c.py | Python | gpl-3.0 | 3,619 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | factorlibre/OCB | addons/report/controllers/main.py | Python | agpl-3.0 | 6,965 |
from django.db import migrations, models
import proposal.models
class Migration(migrations.Migration):
dependencies = [
('proposal', '0022_complete_timestamp'),
]
operations = [
migrations.AddField(
model_name='event',
name='agenda_url',
field=models.U... | codeforboston/cornerwise | server/proposal/migrations/0023_event_agenda_url.py | Python | mit | 358 |
"""
This program search for files or folders, based on the filename or MD5 hash
Copyright (C) 2017 Mondei1 - Nicolas
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 ... | Mondei1/FileFinder | main.py | Python | gpl-3.0 | 8,783 |
# -*- coding: utf-8 -*-
class BoundingBox:
def __init__(self, topLeft, botRight)
self.tl = topLeft
self.br = botRight
def check_collision(p1, B1, p2, B2):
ret = [False, None]
offx = p2[0]-p1[0]
offy = p2[1]-p1[1]
left = B1.br[0] - (B2.tl[0]+offx)
if(left <= 0):
return ret
right = (B2.br[0]+offx) - B... | PongUIO/FinalShot | collision.py | Python | gpl-3.0 | 710 |
#!/usr/bin/env python
# This example demonstrates the use of multiline 2D text using
# vtkTextMappers. It shows several justifications as well as
# single-line and multiple-line text inputs.
import vtk
font_size = 14
# Create the text mappers and the associated Actor2Ds.
# The font and text properties (except jus... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Examples/Annotation/Python/multiLineText.py | Python | gpl-3.0 | 6,590 |
from django.test import TestCase
from user.forms import PatientForm
from user.models import User
class TestPatientForm(TestCase):
def setUp(self):
self.name_valid = 'Teste Nome'
self.name_invalid = 'a12'
self.name_invalid_TYPE = 'a@hjasgdjasd1al'
self.name_invalid_MAX = 'aasdkgasgh... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/user/test/test_form_patient.py | Python | mit | 27,066 |
import unittest
from trac.admin.tests import console
from trac.admin.tests.functional import functionalSuite
def suite():
suite = unittest.TestSuite()
suite.addTest(console.suite())
return suite
if __name__ == '__main__':
unittest.main(defaultTest='suite')
| apache/bloodhound | trac/trac/admin/tests/__init__.py | Python | apache-2.0 | 278 |
class ConfigParser(dict):
def __init__(self, file_name=None):
# self._dic = {}
super(ConfigParser, self).__init__()
self._config = []
if file_name is None:
return
with open(file_name, 'r') as f:
count = 0
for line in f:
if no... | jamesblunt/chorus | packaging/setup/configParser.py | Python | apache-2.0 | 1,699 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | low_rank_local_connectivity/models/simple_model_test.py | Python | apache-2.0 | 3,634 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Fizians SAS. <http://www.fizians.com>
# This file is part of Rozofs.
#
# Rozofs is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 2.
#
# Rozofs is distribut... | rozofs/rozofs | manager/rozofs/core/storaged.py | Python | gpl-2.0 | 16,172 |
# hgweb/hgwebdir_mod.py - Web interface for a directory of repositories.
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later v... | dscho/hg | mercurial/hgweb/hgwebdir_mod.py | Python | gpl-2.0 | 18,835 |
import pyptly
import os
import six
from .conf import (AptlyTestCase, assert_is_instance, assert_equals,
assert_in, assert_true, assert_raises)
class Test_local_repo_methods(AptlyTestCase):
def test_get_local_repos(self):
repos = self.api.get_local_repos
assert_is_instance(repos... | repelista/pyptly | tests/test_api.py | Python | mit | 9,869 |
"""
WSGI config for demosite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | tiwoc/django-exceptionfilter-demo | demosite/wsgi.py | Python | mit | 1,425 |
from django.conf.urls import patterns, url
urlpatterns = patterns('regme.views',
url('register/', 'register', {}, 'register'),
url('registered/', 'registered', {}, 'registered'),
url('activate/(?P<username>\w+)/(?P<activation_key>\w+)',
'activate', {}, 'activate'),
url('activated/', 'activated... | lig/regme | regme/urls.py | Python | apache-2.0 | 343 |
"""
term utils.
>>> c = colored(enabled=True)
>>> print(str(c.red("the quick "), c.blue("brown ", c.bold("fox ")),
c.magenta(c.underline("jumps over")),
c.yellow(" the lazy "),
c.green("dog ")))
"""
import platform
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = ran... | frac/celery | celery/utils/term.py | Python | bsd-3-clause | 3,306 |
import unittest
from kdt import *
from kdt import pyCombBLAS as pcb
class ParVecTests(unittest.TestCase):
def initializeParVec(self, length, i, v=1):
"""
Initialize a ParVec instance with values equal to one or the input value.
"""
ret = ParVec(length, 0)
for ind in range(le... | harperj/KDTSpecializer | test/TestParVec.py | Python | bsd-3-clause | 23,275 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Launcher
# ------------------------------------------------------------
import os
import sys
import threading
import time
from functools import wraps
# Requerido para el ejecutable en windows
import SimpleHTT... | alfa-jor/addon | mediaserver/alfa.py | Python | gpl-3.0 | 3,632 |
from flask_login import current_user
from flask_restful import abort
import functools
from funcy import any, flatten
view_only = True
not_view_only = False
def has_access(object_groups, user, need_view_only):
if 'admin' in user.permissions:
return True
matching_groups = set(object_groups.keys()).int... | akariv/redash | redash/permissions.py | Python | bsd-2-clause | 1,964 |
''' Predict and output scores.
- Reads model param file.
- Runs data.
- Remaps label indices.
- Outputs protobuf file.
'''
from neural_srl.shared import *
from neural_srl.shared.constants import *
from neural_srl.shared.conll_utils import print_to_conll
from neural_srl.shared.dictionary import Dictionary
... | luheng/deep_srl | python/predict.py | Python | apache-2.0 | 8,962 |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['am_bno055_gyro'],
package_dir={'': 'src'}
)
setup(**d)
| HusqvarnaResearch/hrp | am_bno055_gyro/setup.py | Python | mit | 196 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | KousikaGanesh/purchaseandInventory | openerp/addons/auth_ldap/users_ldap.py | Python | agpl-3.0 | 10,950 |
# -*- coding: utf-8 -*-
import base64
import json
import os
import os.path
import shutil
import sys
import tempfile
import unittest
from docker.api.client import APIClient
from docker.constants import IS_WINDOWS_PLATFORM
from docker.errors import DockerException
from docker.utils import (
convert_filters, conver... | funkyfuture/docker-py | tests/unit/utils_test.py | Python | apache-2.0 | 22,906 |
# Information on 2's complement: https://en.wikipedia.org/wiki/Two%27s_complement
def twos_complement(number: int) -> str:
"""
Take in a negative integer 'number'.
Return the two's complement representation of 'number'.
>>> twos_complement(0)
'0b0'
>>> twos_complement(-1)
'0b11'
>>> t... | TheAlgorithms/Python | bit_manipulation/binary_twos_complement.py | Python | mit | 1,121 |
# Generated by Django 2.2.18 on 2021-03-24 21:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wells', '0125_alter_fieldsprovided_water_1658'),
]
operations = [
migrations.AlterField(
model_name='activitysubmission',
... | bcgov/gwells | app/backend/wells/migrations/0126_alter_well_submission_transmissivity_water_1444.py | Python | apache-2.0 | 1,429 |
# -*- coding: utf-8 -*-
import stock_inventory
import stock_inventory_line
| jmankiewicz/odooAddons | stock_inventory_extended/__init__.py | Python | agpl-3.0 | 75 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | NaohiroTamura/ironic | ironic/drivers/modules/ilo/power.py | Python | apache-2.0 | 8,691 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Herald core package
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.2.dev
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you ... | isandlaTech/cohorte-demos | led/dump/led-demo-yun/cohorte/dist/cohorte-1.0.0-20141216.234517-57-python-distribution/repo/herald/__init__.py | Python | apache-2.0 | 3,210 |
from statFMB.views import db
from statFMB.models import *
import csv
from collections import defaultdict
from operator import itemgetter
#create the Database and db tables
def create_tables():
db.create_all()
insert_countries()
insert_municipalities_and_alias()
insert_gates()
insert_vehicle_types()... | maia-dev/statFMB | statFMB/db_create.py | Python | gpl-3.0 | 2,813 |
#import pickle, os
from util.infinity import INFINITY
from iterator import Iterator
from t_core.messages import TransformationException
class Rollbacker(Iterator):
'''
Provides back-tracking capacity.
'''
def __init__(self, condition, max_iterations=INFINITY):
'''
... | levilucio/SyVOLT | t_core/rollbacker.py | Python | mit | 3,343 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Sibyl: A modular Python chat bot framework
# Copyright (c) 2015-2017 Joshua Haas <jahschwa.com>
#
# This file is part of Sibyl.
#
# Sibyl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | jfrederickson/sibyl | client3.py | Python | gpl-3.0 | 19,909 |
# -*- coding: utf-8 -*-
import contextlib
from io import StringIO
from django.core.management import call_command
from ...test.ion_test import IonTestCase
class TemplateTest(IonTestCase):
"""Tests for the templates."""
def test_validate_templates(self):
"""Validates all the templates."""
o... | jacobajit/ion | intranet/apps/templatetags/tests.py | Python | gpl-2.0 | 496 |
from datetime import date
from django.db import models
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from modelcluster.fields import ParentalKey
from modelcluster.tags import ClusterTaggableManager
from taggit.models import TaggedItemBase
from wagtail.wagtailcore.models import Page, Ordera... | stevenewey/wagtail | wagtail/tests/demosite/models.py | Python | bsd-3-clause | 16,493 |
# 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
# d... | openstack/ironic | ironic/api/controllers/v1/portgroup.py | Python | apache-2.0 | 22,713 |
#!/usr/bin/python3
import sys
import csv
from lxml import html
import requests
import re
# XPATHs
XPATH = {
'ID': 'string(./@data-post-id)',
'IP': 'string(./div[@class="comment-date"])',
'Date': 'string(./div[@class="comment-date"])',
'Time': 'string(./div[@class="comment-date"])',
'Name': 'st... | liudvikasakelis/delfi | delfi.py | Python | unlicense | 2,556 |
f = open("taylor.txt")
lines = f.read().split("\n")
f.close()
words = []
for i in lines:
words.extend( i.split(" ") )
words = pd.Dataframe( words )
words = words[0].unique()
db = {}
for word in words:
db.update( { word : { "_word" : word } } )
db.update( {"_begin" : {"_word" : "_begin" } } )
for i in line... | Gurulhu/Reborn | features/chat/markov_creation_snippets.py | Python | mit | 895 |
# -*- encoding: utf-8 -*-
# Copyright 2012-2016 PressLabs SRL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | PressLabs/django-payu | setup.py | Python | apache-2.0 | 2,413 |
from flask import Flask, render_template, url_for, redirect, request, abort
app = Flask(__name__)
@app.route('/')
def index():
return render_template('login.html')
@app.route('/login', methods=['POST', 'GET'])
def login():
if request.method == 'POST':
if request.form['usuario'] == 'admin':
... | ampotty/uip-pc4 | 09.Flask/ejemplo03/__init__.py | Python | mit | 677 |
from .gui import GUI
| johnnygreco/udg-zoo | thezoo/__init__.py | Python | mit | 21 |
__all__ = ['VERSION']
import os
# Start ignoring PyUnusedCodeBear
from bears import VERSION
# Stop ignoring PyUnusedCodeBear
# Path to the bears directory
bears_root = os.path.dirname(__file__)
| coala/coala-bears | bears/Constants.py | Python | agpl-3.0 | 197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.