commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
130663a47fe3c497aedd39acd12de70bab230dec | make things login free | datahuborg/datahub,dnsserver/datahub,RogerTangos/datahub-stub,anantb/datahub,zjsxzy/datahub,datahuborg/datahub,RogerTangos/datahub-stub,dnsserver/datahub,zjsxzy/datahub,anantb/datahub,RogerTangos/datahub-stub,zjsxzy/datahub,dnsserver/datahub,zjsxzy/datahub,dnsserver/datahub,zjsxzy/datahub,anantb/datahub,datahuborg/data... | src/datahub/browser/views.py | src/datahub/browser/views.py | import json, sys, re, hashlib, smtplib, base64, urllib, os
from auth import *
from django.http import *
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from django.core.context_processors import csrf
from django.core.validators import email_re
from django.db.utils i... | import json, sys, re, hashlib, smtplib, base64, urllib, os
from auth import *
from django.http import *
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from django.core.context_processors import csrf
from django.core.validators import email_re
from django.db.utils i... | mit | Python |
7219ace435351fc20e4b7fd95d0befea24e545be | advance version to push to pypi | evernym/ledger | ledger/__metadata__.py | ledger/__metadata__.py | """
Ledger package metadata
"""
__version_info__ = (0, 0, 30)
__version__ = '{}.{}.{}'.format(*__version_info__)
__author__ = "Evernym, Inc."
__license__ = "Apache 2.0"
__all__ = ['__version_info__', '__version__', '__author__', '__license__']
| """
Ledger package metadata
"""
__version_info__ = (0, 0, 29)
__version__ = '{}.{}.{}'.format(*__version_info__)
__author__ = "Evernym, Inc."
__license__ = "Apache 2.0"
__all__ = ['__version_info__', '__version__', '__author__', '__license__']
| apache-2.0 | Python |
c9187cecbdb196343586378ca637d76079ff058f | Improve sub-package imports | hendrikx-itc/minerva,hendrikx-itc/minerva | src/minerva/storage/notification/__init__.py | src/minerva/storage/notification/__init__.py | # -*- coding: utf-8 -*-
__docformat__ = "restructuredtext en"
__copyright__ = """
Copyright (C) 2011-2013 Hendrikx-ITC B.V.
Distributed under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option) any later
version. The full license is in the f... | # -*- coding: utf-8 -*-
__docformat__ = "restructuredtext en"
__copyright__ = """
Copyright (C) 2011-2013 Hendrikx-ITC B.V.
Distributed under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option) any later
version. The full license is in the f... | agpl-3.0 | Python |
334334c95a543de3e92c96ef807b2cad684f4362 | Update URL construction from FPLX db_refs | bgyori/indra,pvtodorov/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,bgyori/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra | indra/databases/__init__.py | indra/databases/__init__.py | import logging
logger = logging.getLogger('databases')
def get_identifiers_url(db_name, db_id):
"""Return an identifiers.org URL for a given database name and ID.
Parameters
----------
db_name : str
An internal database name: HGNC, UP, CHEBI, etc.
db_id : str
An identifier in the ... | import logging
logger = logging.getLogger('databases')
def get_identifiers_url(db_name, db_id):
"""Return an identifiers.org URL for a given database name and ID.
Parameters
----------
db_name : str
An internal database name: HGNC, UP, CHEBI, etc.
db_id : str
An identifier in the ... | bsd-2-clause | Python |
d60dea7b7b1fb073eef2c350177b3920f32de748 | Add comments indicating source of formulae.. | cveazey/ProjectEuler,cveazey/ProjectEuler | 6/e6.py | 6/e6.py | #!/usr/bin/env python
# http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares
def sum_seq_squares(n):
return (n * (n+1) * ((2*n)+1)) / 6
# http://www.regentsprep.org/regents/math/algtrig/ATP2/ArithSeq.htm
def sum_seq(n):
return (n * (n + 1)) / 2
def main():
sum_seq_sq_100 = sum_seq_squares(100)
sum_seq_... | #!/usr/bin/env python
def sum_seq_squares(n):
return (n * (n+1) * ((2*n)+1)) / 6
def sum_seq(n):
return (n * (n + 1)) / 2
def main():
sum_seq_sq_100 = sum_seq_squares(100)
sum_seq_100 = sum_seq(100)
sq_sum_seq_100 = sum_seq_100**2
diff = sq_sum_seq_100 - sum_seq_sq_100
print('diff is {0}'.format(diff))
... | mit | Python |
36e8549053d28f51cc1e846e86bbdc8b32527cbe | Make app.py localhost only | pcchou/plant-rank,pcchou/plant-rank,pcchou/plant-rank | app.py | app.py | #!/usr/bin/python3
from json import dumps
from datetime import datetime
import os
from bottle import app as bottleapp
from bottle import route, run, static_file, template
from pymongo import MongoClient
import sprout
os.chdir(os.path.dirname(os.path.abspath(__file__)))
mongo = MongoClient('localhost', 27017)
col = mo... | #!/usr/bin/python3
from json import dumps
from datetime import datetime
import os
from bottle import app as bottleapp
from bottle import route, run, static_file, template
from pymongo import MongoClient
import sprout
os.chdir(os.path.dirname(os.path.abspath(__file__)))
mongo = MongoClient('localhost', 27017)
col = mo... | mit | Python |
91ff11cde50ce2485c0a6725651931f88a085ca7 | Update get_time to handle timeout errors. | danriti/short-circuit,danriti/short-circuit | app.py | app.py | """ app.py """
from flask import Flask, render_template
import requests
app = Flask(__name__)
def get_time():
try:
response = requests.get('http://localhost:3001/time', timeout=3.0)
except (requests.exceptions.ConnectionError,
requests.exceptions.Timeout):
return 'Unavailable'
... | """ app.py """
from flask import Flask, render_template
import requests
app = Flask(__name__)
def get_time():
try:
response = requests.get('http://localhost:3001/time')
except requests.exceptions.ConnectionError:
return 'Unavailable'
return response.json().get('datetime')
def get_user... | mit | Python |
b2a1dcd25ecc9d50a975a41330a1620b52312857 | add docstring | francois-berder/PyLetMeCreate | letmecreate/click/motion.py | letmecreate/click/motion.py | #!/usr/bin/env python3
"""Python binding of Motion Click wrapper of LetMeCreate library."""
import ctypes
_lib = ctypes.CDLL('libletmecreate_click.so')
callback_type = ctypes.CFUNCTYPE(None, ctypes.c_uint8)
callbacks = [None, None]
def enable(mikrobus_index):
"""Enable the motion click.
Configures the EN p... | #!/usr/bin/env python3
import ctypes
_lib = ctypes.CDLL('libletmecreate_click.so')
callback_type = ctypes.CFUNCTYPE(None, ctypes.c_uint8)
callbacks = [None, None]
def enable(mikrobus_index):
ret = _lib.motion_click_enable(mikrobus_index)
if ret < 0:
raise Exception("motion click enable failed")
de... | bsd-3-clause | Python |
460b48c10461df264a30ac26630d7299370988cd | Support alternative URLs | gregvonkuster/cargo-port,gregvonkuster/cargo-port,galaxyproject/cargo-port,galaxyproject/cargo-port,gregvonkuster/cargo-port,erasche/community-package-cache,erasche/community-package-cache,erasche/community-package-cache | gsl.py | gsl.py | #!/usr/bin/python
from urlparse import urlparse
import urllib
import urllib2
import click
import os
import hashlib
PACKAGE_SERVER = 'https://server-to-be-determined/'
@click.command()
@click.option('--package_id', help='Package ID', required=True)
@click.option('--download_location', default='./',
help=... | #!/usr/bin/python
from urlparse import urlparse
import urllib
import urllib2
import click
import os
import hashlib
PACKAGE_SERVER = 'https://server-to-be-determined/'
@click.command()
@click.option('--package_id', help='Package ID', required=True)
@click.option('--download_location', default='./',
help=... | mit | Python |
9c012f3b5609b557b9d14059f2b2a6412283e0ed | support option ax='new' | sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper | src/pyquickhelper/helpgen/graphviz_helper.py | src/pyquickhelper/helpgen/graphviz_helper.py | """
@file
@brief Helper about graphviz.
"""
import os
from ..loghelper import run_cmd
from .conf_path_tools import find_graphviz_dot
def plot_graphviz(dot, ax=None, temp_dot=None, temp_img=None, dpi=300):
"""
Plots a dot graph into a :epkg:`matplotlib` plot.
@param dot dot language
@param a... | """
@file
@brief Helper about graphviz.
"""
import os
from ..loghelper import run_cmd
from .conf_path_tools import find_graphviz_dot
def plot_graphviz(dot, ax=None, temp_dot=None, temp_img=None, dpi=300):
"""
Plots a dot graph into a :epkg:`matplotlib` plot.
@param dot dot language
@param a... | mit | Python |
cbe379efeb7592e9c918fc4d092098b74a3b8c1a | Update Deck.py - Add shuffle method to shuffle the deck and then return the shuffled cards. | VictorLoren/card-deck-python | Deck.py | Deck.py | #Deck
class Deck:
'''Definition of a card deck.'''
from random import shuffle as rShuffle
def __init__(self,hasJoker=False):
self.suits = ['H','D','S','C']
self.values = [str(x) for x in range(2,10)] #2-9 cards
self.values.extend(['T','J','Q','K','A']) #Face cards (including the 10s)
#Assemble deck
self.... | #Deck
class Deck:
'''Definition of a card deck.'''
def __init__(self,hasJoker=False):
self.suits = ['H','D','S','C']
self.values = [str(x) for x in range(2,10)] #2-9 cards
self.values.extend(['T','J','Q','K','A']) #Face cards (including the 10s)
#Assemble deck
self.cards = [(v,s) for v in self.values for ... | mit | Python |
3bd37ff8b91787da22f925ab858157bffa5698d7 | Remove unnecessary import | Laserbear/Python-Scripts | Fibo.py | Fibo.py | import sys
def Fibo(num):
if num <= 2:
return 1
else:
return Fibo(num-1)+Fibo(num-2)
print(Fibo(int(sys.argv[1])))
| import math
import sys
def Fibo(num):
if num <= 2:
return 1
else:
return Fibo(num-1)+Fibo(num-2)
print(Fibo(int(sys.argv[1])))
| apache-2.0 | Python |
6855564716827546a5b68c154b0d95daba969119 | add more user tests | RogerTangos/datahub-stub,anantb/datahub,anantb/datahub,RogerTangos/datahub-stub,datahuborg/datahub,datahuborg/datahub,datahuborg/datahub,datahuborg/datahub,anantb/datahub,datahuborg/datahub,RogerTangos/datahub-stub,anantb/datahub,RogerTangos/datahub-stub,datahuborg/datahub,RogerTangos/datahub-stub,RogerTangos/datahub-s... | src/inventory/tests/tests.py | src/inventory/tests/tests.py | from django.test import TestCase
from inventory.models import *
class UserTests(TestCase):
def test_for_fields(self):
""" saving and loading users"""
initial_user = User(id=10, username="user", password="pass", email="email",
f_name="f_name", l_name="l_name", active=True).save()
... | from django.test import TestCase
from inventory.models import *
class UserTests(TestCase):
def test_for_fields(self):
""" saving and loading users"""
initial_user = User(username="user", password="pass", email="email",
f_name="fname", l_name="lname", active=True).save()
loaded... | mit | Python |
237b9d4577f004401c2385163b060c785692c8b6 | add when_over and when_over_guessed fields to Event (db change) | Shrulik/Open-Knesset,ofri/Open-Knesset,MeirKriheli/Open-Knesset,navotsil/Open-Knesset,ofri/Open-Knesset,DanaOshri/Open-Knesset,Shrulik/Open-Knesset,OriHoch/Open-Knesset,jspan/Open-Knesset,ofri/Open-Knesset,noamelf/Open-Knesset,otadmor/Open-Knesset,alonisser/Open-Knesset,otadmor/Open-Knesset,jspan/Open-Knesset,alonisser... | src/knesset/events/models.py | src/knesset/events/models.py | from datetime import datetime
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from knesset.persons.models import Person
class Event(models.Model):
''' hold the when, who, ... | from datetime import datetime
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from knesset.persons.models import Person
class Event(models.Model):
''' hold the when, who, ... | bsd-3-clause | Python |
d53dc67fc002448c7b94758843223a17d4623483 | Allow IP to be blank | Ecotrust/madrona_addons,Ecotrust/madrona_addons | lingcod/bookmarks/models.py | lingcod/bookmarks/models.py | from django.contrib.gis.db import models
from lingcod.features import register
from lingcod.features.models import Feature
from django.utils.html import escape
from django.conf import settings
class Bookmark(Feature):
description = models.TextField(default="", null=True, blank=True)
latitude = models.FloatFiel... | from django.contrib.gis.db import models
from lingcod.features import register
from lingcod.features.models import Feature
from django.utils.html import escape
from django.conf import settings
class Bookmark(Feature):
description = models.TextField(default="", null=True, blank=True)
latitude = models.FloatFiel... | bsd-3-clause | Python |
d137005229e180b509f0a2f83f5d2472b40d8890 | Set up Sentry if we're configured for it (so I don't lose this code again) | markpasc/makerbase,markpasc/makerbase | run.py | run.py | import os
from os.path import abspath, dirname, join
from makerbase import app
if 'MAKERBASE_SETTINGS' not in os.environ:
os.environ['MAKERBASE_SETTINGS'] = join(dirname(abspath(__file__)), 'settings.py')
app.config.from_envvar('MAKERBASE_SETTINGS')
if 'SENTRY_DSN' in app.config:
from raven.contrib.flask i... | import os
from os.path import abspath, dirname, join
from makerbase import app
if 'MAKERBASE_SETTINGS' not in os.environ:
os.environ['MAKERBASE_SETTINGS'] = join(dirname(abspath(__file__)), 'settings.py')
app.config.from_envvar('MAKERBASE_SETTINGS')
if __name__ == '__main__':
app.run(debug=True)
| mit | Python |
a4656021f6a97bf5ffccb3d6e522515769ba0d21 | Remove unnecessary calls to disable_continuous_mode | illumenati/duwamish-sensor,tipsqueal/duwamish-sensor | run.py | run.py | import argparse
import serial
import threading
from io import BufferedRWPair, TextIOWrapper
from time import sleep
temp_usb = '/dev/ttyAMA0'
BAUD_RATE = 9600
parser = argparse.ArgumentParser()
parser.add_argument('oxygen', help='The USB port of the oxygen sensor.')
parser.add_argument('salinity', help='The USB port o... | import argparse
import serial
import threading
from io import BufferedRWPair, TextIOWrapper
from time import sleep
temp_usb = '/dev/ttyAMA0'
BAUD_RATE = 9600
parser = argparse.ArgumentParser()
parser.add_argument('oxygen', help='The USB port of the oxygen sensor.')
parser.add_argument('salinity', help='The USB port o... | mit | Python |
1c8a1bfeef8206267a45562d4932cece1cbea1b4 | Fix some pylint issues | lubomir/libtrie,lubomir/libtrie,lubomir/libtrie | Trie.py | Trie.py | #! /usr/bin/env python
# vim: set encoding=utf-8
from ctypes import cdll, c_char_p, c_void_p, create_string_buffer
libtrie = cdll.LoadLibrary("./libtrie.so")
libtrie.trie_load.argtypes = [c_char_p]
libtrie.trie_load.restype = c_void_p
libtrie.trie_lookup.argtypes = [c_void_p, c_char_p, c_char_p]
libtrie.trie_lookup.r... | #! /usr/bin/env python
# vim: set encoding=utf-8
from ctypes import *
libtrie = cdll.LoadLibrary("./libtrie.so")
libtrie.trie_load.argtypes = [c_char_p]
libtrie.trie_load.restype = c_void_p
libtrie.trie_lookup.argtypes = [ c_void_p, c_char_p, c_char_p ]
libtrie.trie_lookup.restype = c_void_p
libtrie.trie_get_last_err... | bsd-3-clause | Python |
e62db9661295ff3912dbaaaff0d9f267f0b7ffe1 | Add url callback on custom login | AndrzejR/mining,mining/mining,mlgruby/mining,mining/mining,mlgruby/mining,mlgruby/mining,jgabriellima/mining,avelino/mining,jgabriellima/mining,seagoat/mining,chrisdamba/mining,seagoat/mining,avelino/mining,AndrzejR/mining,chrisdamba/mining | auth.py | auth.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle.ext import auth
from utils import conf
try:
auth_import = conf('auth')['engine'].split('.')[-1]
auth_from = u".".join(conf('auth')['engine'].split('.')[:-1])
auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]),
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle.ext import auth
from utils import conf
try:
auth_import = conf('auth')['engine'].split('.')[-1]
auth_from = u".".join(conf('auth')['engine'].split('.')[:-1])
auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]),
... | mit | Python |
95723719050aa08119ed2478c0bb40253a2b0b3e | Remove methods with unnecessary super delegation. | ramnes/qtile,ramnes/qtile,qtile/qtile,qtile/qtile | libqtile/layout/max.py | libqtile/layout/max.py | # Copyright (c) 2008, Aldo Cortesi. All rights reserved.
# Copyright (c) 2017, Dirk Hartmann.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitati... | # Copyright (c) 2008, Aldo Cortesi. All rights reserved.
# Copyright (c) 2017, Dirk Hartmann.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitati... | mit | Python |
5ebf34e1c572e5db9012af4228eaca2a8461b8d9 | add some extra debug logging to smr-reduce | codebynumbers/smr,50onRed/smr | smr/reduce.py | smr/reduce.py | #!/usr/bin/env python
import sys
from .shared import get_config, configure_logging
def main():
if len(sys.argv) < 2:
sys.stderr.write("usage: smr-reduce config.py\n")
sys.exit(1)
config = get_config(sys.argv[1])
configure_logging(config)
try:
for result in iter(sys.stdin.read... | #!/usr/bin/env python
import sys
from .shared import get_config, configure_logging
def main():
if len(sys.argv) < 2:
sys.stderr.write("usage: smr-reduce config.py\n")
sys.exit(1)
config = get_config(sys.argv[1])
configure_logging(config)
try:
for result in iter(sys.stdin.read... | mit | Python |
dd020b279f011ff78a6a41571a839e4c57333e93 | Rename username field to userspec (#196). | devilry/devilry-django,vegarang/devilry-django,devilry/devilry-django,vegarang/devilry-django,devilry/devilry-django,devilry/devilry-django | devilry/apps/core/models/relateduser.py | devilry/apps/core/models/relateduser.py | import re
from django.db import models
from django.db.models import Q
from django.core.exceptions import ValidationError
from period import Period
from node import Node
from abstract_is_admin import AbstractIsAdmin
class RelatedUserBase(models.Model, AbstractIsAdmin):
"""
Base class for :cls:`RelatedExamine... | import re
from django.db import models
from django.db.models import Q
from django.core.exceptions import ValidationError
from period import Period
from node import Node
from abstract_is_admin import AbstractIsAdmin
class RelatedUserBase(models.Model, AbstractIsAdmin):
"""
Base class for :cls:`RelatedExamine... | bsd-3-clause | Python |
4b330755edab7a57de6d39a7e365c5f79df81065 | Update config.py | nicholas-moreles/blaspy | blaspy/config.py | blaspy/config.py | """
Copyright (c) 2014, The University of Texas at Austin.
All rights reserved.
This file is part of BLASpy and is available under the 3-Clause
BSD License, which can be found in the LICENSE file at the top-level
directory or at http://opensource.org/licenses/BSD-3-Clause
"""
from .errors import... | """
Copyright (c) 2014, The University of Texas at Austin.
All rights reserved.
This file is part of BLASpy and is available under the 3-Clause
BSD License, which can be found in the LICENSE file at the top-level
directory or at http://opensource.org/licenses/BSD-3-Clause
"""
from .errors import... | bsd-3-clause | Python |
1809df6d5886ac6c0c35c8e879d9eda334606f4e | Simplify handling from_db_value across django versions | Niklas9/django-unixdatetimefield,Niklas9/django-unixdatetimefield | django_unixdatetimefield/fields.py | django_unixdatetimefield/fields.py | import datetime
import time
import django.db.models as models
class UnixDateTimeField(models.DateTimeField):
# TODO(niklas9):
# * should we take care of transforming between time zones in any way here ?
# * get default datetime format from settings ?
DEFAULT_DATETIME_FMT = '%Y-%m-%d %H:%M:%S'
TZ... | import datetime
import time
import django
import django.db.models as models
class UnixDateTimeField(models.DateTimeField):
# TODO(niklas9):
# * should we take care of transforming between time zones in any way here ?
# * get default datetime format from settings ?
DEFAULT_DATETIME_FMT = '%Y-%m-%d %H... | bsd-3-clause | Python |
20053951b3036d0ae49f7f1ae25d600848872c82 | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.36.2'
| __version__ = '2.36.1'
| mit | Python |
f426d44f82a4f1855cb180b5aff98221c14537f1 | Update version.py | elvandy/nltools,ljchang/neurolearn,ljchang/nltools | nltools/version.py | nltools/version.py | """Specifies current version of nltools to be used by setup.py and __init__.py
"""
__version__ = '0.3.7'
| """Specifies current version of nltools to be used by setup.py and __init__.py
"""
__version__ = '0.3.6'
| mit | Python |
fcf5d1f33026069d69690c67f7ddcc8c77f15626 | add exception handingling for debug | XertroV/opreturn-ninja,XertroV/opreturn-ninja,XertroV/opreturn-ninja | opreturnninja/views.py | opreturnninja/views.py | import json
import random
from pyramid.view import view_config
from .constants import ELECTRUM_SERVERS
from bitcoin.rpc import RawProxy, DEFAULT_USER_AGENT
import socket
@view_config(route_name='api', renderer='json')
def api_view(request):
global rpc
assert hasattr(request, 'json_body')
assert 'meth... | import json
import random
from pyramid.view import view_config
from .constants import ELECTRUM_SERVERS
from bitcoin.rpc import RawProxy, DEFAULT_USER_AGENT
import socket
@view_config(route_name='api', renderer='json')
def api_view(request):
global rpc
assert hasattr(request, 'json_body')
assert 'meth... | mit | Python |
43d7850403e1e98951909bcb0c441098c3221bde | Update ipc_lista1.4.py | any1m1c/ipc20161 | lista1/ipc_lista1.4.py | lista1/ipc_lista1.4.py | #ipc_lista1.4
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça as 4 notas bimestrais e mostre a media
nota1 = int(input("Digite a primeira nota do bimestre: "))
nota2 = int(input("Digite a segunda nota do bimestre: "))
nota3 = int(input("Digite a terceira nota do bismestr... | #ipc_lista1.4
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça as 4 notas bimestrais e mostre a media
nota1 = int(input("Digite a primeira nota do bimestre: "))
nota2 = int(input("Digite a segunda nota do bimestre: "))
nota3 = int(input("Digite a terceira nota do bismestr... | apache-2.0 | Python |
fb772e5e597082a119348efa68f70e60c11506cd | clean up | timotheus/python-patterns | lists/gift_exchange.py | lists/gift_exchange.py |
import random
import itertools
givers = [('tim', 'shirt'), ('jim', 'shoe'), ('john', 'ball'), ('joe', 'fruit')]
if len(givers) < 2:
print "must have more than 1 givers"
else:
a = list(givers)
b = list(givers)
while a == b:
random.shuffle(a)
random.shuffle(b)
for i, j in iter... |
import random
import itertools
givers = [('tim', 'shirt'), ('jim', 'shoe'), ('joe', 'fruit'), ('john', 'ball')]
def valid(a, b):
if a == b:
return False
else:
return True
if len(givers) < 2:
print "must have more than 1 givers"
else:
a = list(givers)
b = list(givers)
whi... | unlicense | Python |
b76e1697b92565ca3fc8a7ee2961adf894095e04 | Add User as foreign key in Bill | ioO/billjobs | billing/models.py | billing/models.py | from django.db import models
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import pre_save, pre_init
import datetime
class Bill(models.Model):
user = models.ForeignKey(User)
number = models.CharField(max_length=10, unique=True, blank=True)
... | from django.db import models
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import pre_save, pre_init
import datetime
class Bill(models.Model):
number = models.CharField(max_length=10, unique=True, blank=True)
isPaid = models.BooleanField(defaul... | mit | Python |
17d3d63564798cd03788ce579227d5425cd866c0 | Make fake uploader use zlib compression | orlissenberg/eve-market-data-relay,gtaylor/EVE-Market-Data-Relay | bin/fake_order.py | bin/fake_order.py | #!/usr/bin/env python
"""
A fake order upload script, used to manually test the whole stack.
"""
import simplejson
import requests
import zlib
data = """
{
"resultType" : "orders",
"version" : "0.1alpha",
"uploadKeys" : [
{ "name" : "emk", "key" : "abc" },
{ "name" : "ec" , "key" : "def" }
],
"genera... | #!/usr/bin/env python
"""
A fake order upload script, used to manually test the whole stack.
"""
import simplejson
import requests
data = """
{
"resultType" : "orders",
"version" : "0.1alpha",
"uploadKeys" : [
{ "name" : "emk", "key" : "abc" },
{ "name" : "ec" , "key" : "def" }
],
"generator" : { "na... | mit | Python |
348896e6f9318755d9bbefdf94de18ed32b17d1d | Update item.py | Lincoln-Cybernetics/Explore- | item.py | item.py | import pygame
class Item(pygame.sprite.Sprite):
def __init__(self, level, *groups):
super(Item, self).__init__(*groups)
#the game level
self.level = level
#base image
self.level.animator.set_Img(0,5)
self.image = self.level.animator.get_Img().convert()
self.image.set_colorkey((255,0,0))
self.level.ani... | import pygame
class Item(pygame.sprite.Sprite):
def __init__(self, level, *groups):
super(Item, self).__init__(*groups)
#the game level
self.level = level
#base image
self.level.animator.set_Img(6,0)
self.image = self.level.animator.get_Img().convert()
self.image.set_colorkey((255,0,0))
#type
sel... | unlicense | Python |
5fc8258c4d3819b6a4b23819fd3c4578510dd633 | Allow www.lunahealing.ca as a domain | jessamynsmith/lunahealing,jessamynsmith/lunahealing,jessamynsmith/lunahealing | lunahealing/site_settings/prod.py | lunahealing/site_settings/prod.py | # Django settings for quotations project.
import os
from lunahealing.site_settings.common import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES = {
'default': ... | # Django settings for quotations project.
import os
from lunahealing.site_settings.common import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES = {
'default': ... | mit | Python |
ed472902f71f39cf09eca5ee9193bcf99283b566 | Remove unused code | QuiteQuiet/PokemonShowdownBot | room.py | room.py | # Each PS room joined creates an object here.
# Objects control settings on a room-per-room basis, meaning every room can
# be treated differently.
from plugins.tournaments import Tournament
class Room:
def __init__(self, room, data):
if not data:
# This is a hack to support both strings and di... | # Each PS room joined creates an object here.
# Objects control settings on a room-per-room basis, meaning every room can
# be treated differently.
from plugins.tournaments import Tournament
class Room:
def __init__(self, room, data):
if not data:
# This is a hack to support both strings and di... | mit | Python |
bd313ff4ce69e7b9a9765672442ef6cf9fa00dba | Fix parameter validation tests | openfisca/openfisca-core,openfisca/openfisca-core | tests/core/parameter_validation/test_parameter_clone.py | tests/core/parameter_validation/test_parameter_clone.py | import os
from openfisca_core.parameters import ParameterNode
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
year = 2016
def test_clone():
path = os.path.join(BASE_DIR, 'filesystem_hierarchy')
parameters = ParameterNode('', directory_path = path)
parameters_at_instant = parameters('2016-01-01')
... | # -*- coding: utf-8 -*-
from ..test_countries import tax_benefit_system
import os
from openfisca_core.parameters import ParameterNode
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
year = 2016
def test_clone():
path = os.path.join(BASE_DIR, 'filesystem_hierarchy')
parameters = ParameterNode('', direct... | agpl-3.0 | Python |
1f752237d83c486b94ddcc7f5e3b42eb5951a60b | remove unused imports | mkorpela/pabot,mkorpela/pabot | pabot/SharedLibrary.py | pabot/SharedLibrary.py | from robot.libraries.BuiltIn import BuiltIn
from robot.libraries.Remote import Remote
from robot.api import logger
from robot.running.testlibraries import TestLibrary
from robotremoteserver import RemoteLibraryFactory
from .pabotlib import PABOT_QUEUE_INDEX
class SharedLibrary(object):
ROBOT_LIBRARY_SCOPE = 'GLOB... | from robot.libraries.BuiltIn import BuiltIn
from robot.libraries.Remote import Remote
from robot.api import logger
from robot.running.testlibraries import TestLibrary
from robot.running.context import EXECUTION_CONTEXTS
from robot.running.model import Keyword
from robotremoteserver import RemoteLibraryFactory
from .pab... | apache-2.0 | Python |
1f4ef496f932ec2a12d348b0c90b1f57d6ef9e20 | update version number | nutils/nutils,CVerhoosel/nutils,joostvanzwieten/nutils,timovanopstal/nutils,wijnandhoitinga/nutils | nutils/__init__.py | nutils/__init__.py | import numpy
from distutils.version import LooseVersion
assert LooseVersion(numpy.version.version) >= LooseVersion('1.8'), 'nutils requires numpy 1.8 or higher, got %s' % numpy.version.version
version = '2.0beta'
_ = numpy.newaxis
__all__ = [ '_', 'numpy', 'core', 'numeric', 'element', 'function',
'mesh', 'plot', ... | import numpy
from distutils.version import LooseVersion
assert LooseVersion(numpy.version.version) >= LooseVersion('1.8'), 'nutils requires numpy 1.8 or higher, got %s' % numpy.version.version
version = '1.dev'
_ = numpy.newaxis
__all__ = [ '_', 'numpy', 'core', 'numeric', 'element', 'function',
'mesh', 'plot', 'l... | mit | Python |
577697301f8682293a00a793807687df9d0ce679 | Fix fetch_ceph_keys to run in python3 | openstack/kolla,rahulunair/kolla,stackforge/kolla,stackforge/kolla,stackforge/kolla,openstack/kolla,rahulunair/kolla | docker/ceph/ceph-mon/fetch_ceph_keys.py | docker/ceph/ceph-mon/fetch_ceph_keys.py | #!/usr/bin/python
# Copyright 2015 Sam Yaple
#
# 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 agree... | #!/usr/bin/python
# Copyright 2015 Sam Yaple
#
# 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 agree... | apache-2.0 | Python |
b4acd028b613a721ffbe5a3136700f190635f7c9 | Fix import. | supergis/micropython,xuxiaoxin/micropython,feilongfl/micropython,Vogtinator/micropython,oopy/micropython,pfalcon/micropython,rubencabrera/micropython,mpalomer/micropython,noahchense/micropython,pozetroninc/micropython,paul-xxx/micropython,Timmenem/micropython,dmazzella/micropython,cwyark/micropython,micropython/micropy... | tests/basics/class_store_class.py | tests/basics/class_store_class.py | # Inspired by urlparse.py from CPython 3.3 stdlib
# There was a bug in MicroPython that under some conditions class stored
# in instance attribute later was returned "bound" as if it was a method,
# which caused class constructor to receive extra argument.
from _collections import namedtuple
_DefragResultBase = namedt... | # Inspired by urlparse.py from CPython 3.3 stdlib
# There was a bug in MicroPython that under some conditions class stored
# in instance attribute later was returned "bound" as if it was a method,
# which caused class constructor to receive extra argument.
from collections import namedtuple
_DefragResultBase = namedtu... | mit | Python |
7a331edf955d914c82751eb7ec1dd20896e25f83 | Use SequenceEqual because we care about maintaining order. | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | tests/cases/stats/tests/kmeans.py | tests/cases/stats/tests/kmeans.py | import os
from django.test import TestCase
from avocado.stats import cluster, kmeans
from scipy.cluster import vq
import numpy
from itertools import chain
__all__ = ('KmeansTestCase',)
random_points_file = open(os.path.join(os.path.dirname(__file__), '../fixtures/random_points.txt'))
random_points_3d_file = open(os.p... | import os
from django.test import TestCase
from avocado.stats import cluster, kmeans
from scipy.cluster import vq
import numpy
from itertools import chain
__all__ = ('KmeansTestCase',)
random_points_file = open(os.path.join(os.path.dirname(__file__), '../fixtures/random_points.txt'))
random_points_3d_file = open(os.p... | bsd-2-clause | Python |
268914e7a29231da882457a6e4744c9661526a73 | Add latest version of py-tabulate (#14138) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-tabulate/package.py | var/spack/repos/builtin/packages/py-tabulate/package.py | # Copyright 2013-2019 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 PyTabulate(PythonPackage):
"""Pretty-print tabular data"""
homepage = "https://bitbuc... | # Copyright 2013-2019 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 PyTabulate(PythonPackage):
"""Pretty-print tabular data"""
homepage = "https://bitbuc... | lgpl-2.1 | Python |
b286e10d7d7c43ceea80cd4025105851ebb9bd8f | Comment out save statement | alexmilesyounger/ds_basics | s4v3.py | s4v3.py | from s4v2 import *
import openpyxl
from openpyxl import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
def save_spreadsheet(filename, data_sample):
wb = Workbook() # shortcut for typing Workbook function
ws = wb.active # shortcut for typing active workbook function... | from s4v2 import *
import openpyxl
from openpyxl import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
def save_spreadsheet(filename, data_sample):
wb = Workbook() # shortcut for typing Workbook function
ws = wb.active # shortcut for typing active workbook function... | mit | Python |
5dd61d20f14ecbe1bc20fe8db3fd73a78707485a | Refactor partition. | joshbohde/functional_python | lazy.py | lazy.py | import operator as op
import itertools as it
from functools import partial
from collections import deque
class Wrapper(object):
def __init__(self, data):
self.data = data
def __lt__(self, other):
print 'comparing', self.data, other.data
return self.data < other.data
def partition(pre... | import operator as op
import itertools as it
from functools import partial
class Wrapper(object):
def __init__(self, data):
self.data = data
def __lt__(self, other):
print 'comparing', self.data, other.data
return self.data < other.data
def partition(predicate, iterable):
pack = ... | bsd-3-clause | Python |
14f0afc20c9d6c200c6e9fa52a4121c98d349be7 | Set version 0.2.5 | pombredanne/django-page-cms-1,remik/django-page-cms,pombredanne/django-page-cms-1,pombredanne/django-page-cms-1,akaihola/django-page-cms,remik/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,remik/django-page-cms,remik/django-page-cms,oliciv/django-page-cms,oliciv/django-page-cms,akaihola/django-page-c... | pages/__init__.py | pages/__init__.py | # -*- coding: utf-8 -*-
VERSION = (0, 2, 5)
__version__ = '.'.join(map(str, VERSION))
| # -*- coding: utf-8 -*-
VERSION = (0, 2, 4)
__version__ = '.'.join(map(str, VERSION))
| bsd-3-clause | Python |
d282d5525c4d965dbe0a6ee4967a14f1f412f2b4 | update version number from 1.4 to 1.5 | hearsaycorp/python-oauth2,armersong/python-oauth2,dpedowitz/python-oauth2,simplegeo/python-oauth2,jasonrubenstein/python_oauth2,edevil/python-oauth2,hayd/python-oauth2,jackiekazil/python-oauth2,MiCHiLU/python-oauth2,InnovativeTravel/python-oauth2,mop/python-oauth2,fmondaini/python-oauth2,avenpace/python-oauth2,kylemcc/... | oauth2/_version.py | oauth2/_version.py | # This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "143"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | # This is the version of this source code.
manual_verstr = "1.4"
auto_build_num = "143"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | mit | Python |
7bfc2287d15198d9e37b4def4632481c8446a932 | bump version | caktus/django_bread,caktus/django_bread,caktus/django_bread,caktus/django_bread | bread/__init__.py | bread/__init__.py | VERSION = '0.6.0'
| VERSION = '0.5.1'
| apache-2.0 | Python |
928c3bb38f4fa24d082ea18db09ff4542b78466c | remove units from x gt 1 example | galbramc/gpkit,galbramc/gpkit,convexopt/gpkit,hoburg/gpkit,hoburg/gpkit,convexopt/gpkit | docs/source/examples/x_greaterthan_1.py | docs/source/examples/x_greaterthan_1.py | from gpkit import Variable, GP
# Decision variable
x = Variable('x')
# Constraint
constraints = [x >= 1]
# Objective (to minimize)
objective = x
# Formulate the GP
gp = GP(objective, constraints)
# Solve the GP
sol = gp.solve()
# Print results table
print sol.table()
| from gpkit import Variable, GP
# Decision variable
x = Variable("x", "m", "A really useful variable called x with units of meters")
# Constraint
constraint = [1/x <= 1]
# Objective (to minimize)
objective = x
# Formulate the GP
gp = GP(objective, constraint)
# Solve the GP
sol = gp.solve()
# Print results table
p... | mit | Python |
5d30c02f9adb7de3ce9eebef5178466711d96c64 | Remove unused import: `RelatedField` | kevin-brown/drf-json-api | rest_framework_json_api/utils.py | rest_framework_json_api/utils.py | from django.utils.encoding import force_text
from django.utils.text import slugify
try:
from rest_framework.serializers import ManyRelatedField
except ImportError:
ManyRelatedField = type(None)
try:
from rest_framework.serializers import ListSerializer
except ImportError:
ListSerializer = type(None)
... | from django.utils.encoding import force_text
from django.utils.text import slugify
from rest_framework.serializers import RelatedField
try:
from rest_framework.serializers import ManyRelatedField
except ImportError:
ManyRelatedField = type(None)
try:
from rest_framework.serializers import ListSerializer
... | mit | Python |
8157af3da0e535074b18c76f0e5391d8cac806e8 | Add error field to expected JSON | osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api | whats_fresh/whats_fresh_api/tests/views/test_stories.py | whats_fresh/whats_fresh_api/tests/views/test_stories.py | from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
import json
class StoriesTestCase(TestCase):
fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json']
def s... | from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
import json
class StoriesTestCase(TestCase):
fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json']
def s... | apache-2.0 | Python |
feab9b1067a42a6d5d8586361ab1d02f1844aa7e | Remove unused imports | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/integration/api/conftest.py | tests/integration/api/conftest.py | """
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
API-specific fixtures
"""
import pytest
from .helpers import assemble_authorization_header
API_TOKEN = 'just-say-PLEASE!'
@pytest.fixture(scope='package')
# `admin_app` fixture is required because it sets up the... | """
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
API-specific fixtures
"""
import pytest
from tests.conftest import CONFIG_PATH_DATA_KEY
from tests.helpers import create_admin_app
from .helpers import assemble_authorization_header
API_TOKEN = 'just-say-PLEASE!'... | bsd-3-clause | Python |
f2139cad673ee50f027164bda80d86979d5ce7a0 | Add more imports for further functionality | GregBrimble/boilerplate-web-service,GregBrimble/boilerplate-web-service | passenger_wsgi.py | passenger_wsgi.py | import os
import sys
try:
from flask import Flask
import flask_login
from flask_restless import APIManager
from flask_sqlalchemy import SQLAlchemy
import requests
except ImportError:
INTERP = "venv/bin/python"
if os.path.relpath(sys.executable, os.getcwd()) != INTERP:
try:
... | import os
import sys
try:
from flask import Flask, render_template, send_file, Response
import requests
except ImportError:
INTERP = "venv/bin/python"
if os.path.relpath(sys.executable, os.getcwd()) != INTERP:
try:
os.execl(INTERP, INTERP, *sys.argv)
except OSError:
... | mit | Python |
f4e6f2c6eb77876b646da14805ee496b0b25f0bc | Support PortOpt from oslo.cfg | FrankDuan/df_code,openstack/dragonflow,FrankDuan/df_code,FrankDuan/df_code,openstack/dragonflow,openstack/dragonflow | dragonflow/common/common_params.py | dragonflow/common/common_params.py | # 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... | # 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... | apache-2.0 | Python |
4ec09eb10aa352175769cc00f189ece719802ea6 | remove temperature for now | mookfist/mookfist-lled-controller | lled.py | lled.py | #!/usr/bin/env python
"""Mookfist LimitlessLED Control
This tool can be used to control your LimitlessLED based lights.
Usage:
lled.py fade <start> <end> (--group=<GROUP>)... [options]
lled.py fadec <start> <end> (--group=<GROUP>)... [options]
lled.py fadeb <startb> <endb> <startc> <endc> (--group=<GROUP>... | #!/usr/bin/env python
"""Mookfist LimitlessLED Control
This tool can be used to control your LimitlessLED based lights.
Usage:
lled.py fade <start> <end> (--group=<GROUP>)... [options]
lled.py fadec <start> <end> (--group=<GROUP>)... [options]
lled.py fadeb <startb> <endb> <startc> <endc> (--group=<GROUP>... | mit | Python |
a324e8de7dc0bcb1676a8ae506d139f05751b233 | fix lint for tests | catmaid/catpy | tests/test_relation_identifier.py | tests/test_relation_identifier.py | from __future__ import absolute_import
import pytest
from catpy.client import ConnectorRelation, CatmaidClient
from catpy.applications import RelationIdentifier
from tests.common import relation_identifier, connectors_types # noqa
def test_from_id(relation_identifier): # noqa
assert relation_identifier.from_... | from __future__ import absolute_import
import pytest
from catpy.client import ConnectorRelation, CatmaidClient
from catpy.applications import RelationIdentifier
from tests.common import relation_identifier, connectors_types # noqa
def test_from_id(relation_identifier): # noqa
assert relation_identifier.from_... | mit | Python |
ad4b9ffb7292a5b810df033088008cd503bc1169 | Add pre-fabricated fake PyPI envs at the top. | suutari/prequ,suutari/prequ,suutari-ai/prequ | tests/unit/test_spec_resolving.py | tests/unit/test_spec_resolving.py | import unittest
from piptools.datastructures import SpecSet
from piptools.package_manager import FakePackageManager
def print_specset(specset, round):
print('After round #%s:' % (round,))
for spec in specset:
print(' - %s' % (spec.description(),))
simple = {
'foo-0.1': ['bar'],
'bar-1.2': [... | import unittest
from piptools.datastructures import SpecSet
from piptools.package_manager import FakePackageManager
def print_specset(specset, round):
print('After round #%s:' % (round,))
for spec in specset:
print(' - %s' % (spec.description(),))
class TestDependencyResolving(unittest.TestCase):
... | bsd-2-clause | Python |
bbfa9c3135ebdc5a99257d62556b691f8c87a26c | Update irrigate.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/irrigate.py | device/src/irrigate.py | #!/usr/bin/env python
#In this project, I use a servo to simulate the water tap.
#Roating to 90 angle suggest that the water tap is open, and 0 angle means close.
#Pin connection:
#deep red <--> GND
#red <--> VCC
#yellow <--> signal(X1)
#Update!!!!!
#Use real water pump(RS360) to irrigate the plants, need to us... | #!/usr/bin/env python
#In this project, I use a servo to simulate the water tap.
#Roating to 90 angle suggest that the water tap is open, and 0 angle means close.
#Pin connection:
#deep red <--> GND
#red <--> VCC
#yellow <--> signal(X1)
from pyb import Servo
servo=Servo(1) # X1
def irrigate_start():
servo.angl... | mit | Python |
173d7ffefe10e8896055bd5b41272c2d0a1f8889 | Update version to 0.1.6 for upcoming release | MatthewGilbert/pdblp | pdblp/_version.py | pdblp/_version.py | __version__ = "0.1.6"
| __version__ = "0.1.5"
| mit | Python |
b87ebc9dbbc33928345a83ac8ea0ce71806ac024 | simplify play down to wall and standard defense | RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software | soccer/gameplay/plays/Defend_Restart_Defensive/BasicDefendRestartDefensive.py | soccer/gameplay/plays/Defend_Restart_Defensive/BasicDefendRestartDefensive.py | import main
import robocup
import behavior
import constants
import enum
import standard_play
import tactics.positions.submissive_goalie as submissive_goalie
import tactics.positions.submissive_defender as submissive_defender
import evaluation.opponent as eval_opp
import tactics.positions.wing_defender as wing_defender... | import main
import robocup
import behavior
import constants
import enum
import standard_play
import tactics.positions.submissive_goalie as submissive_goalie
import tactics.positions.submissive_defender as submissive_defender
import evaluation.opponent as eval_opp
import tactics.positions.wing_defender as wing_defender... | apache-2.0 | Python |
abae242bbcdc3eefcd0ab1ff29f660f89d47db1a | Add absolute URL for Surprises | mirigata/mirigata,mirigata/mirigata,mirigata/mirigata,mirigata/mirigata | mirigata/surprise/models.py | mirigata/surprise/models.py | from django.core.urlresolvers import reverse
from django.db import models
class Surprise(models.Model):
link = models.URLField(max_length=500)
description = models.TextField(max_length=1000)
def get_absolute_url(self):
return reverse('surprise-detail', kwargs={"pk": self.id})
| from django.db import models
class Surprise(models.Model):
link = models.URLField(max_length=500)
description = models.TextField(max_length=1000)
| agpl-3.0 | Python |
c0fdbf78fcc6b74086cc40e8e0deb273dee6d03c | Update BUILD_OSS to 4666. | google/mozc,google/mozc,fcitx/mozc,google/mozc,fcitx/mozc,fcitx/mozc,google/mozc,fcitx/mozc,fcitx/mozc,google/mozc | src/data/version/mozc_version_template.bzl | src/data/version/mozc_version_template.bzl | # Copyright 2010-2021, Google 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 above copyright
# notice, this list of conditions and ... | # Copyright 2010-2021, Google 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 above copyright
# notice, this list of conditions and ... | bsd-3-clause | Python |
c5225c00191595b6d1a824ee808465e0c488769b | Add missing arg which didn't make it because of the bad merge conflict resolution. | nzlosh/st2,nzlosh/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2 | st2stream/st2stream/controllers/v1/stream.py | st2stream/st2stream/controllers/v1/stream.py | # 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... | # 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... | apache-2.0 | Python |
1df3dc91f71bf2a02b059d414ea5b041a382f1ad | change CSS selectors | jrafa/hotshot,jrafa/hotshot,jrafa/hotshot | shot.py | shot.py | # -*- coding: utf-8 -*-
import redis
import urllib2
from bs4 import BeautifulSoup
from datetime import datetime
url = 'http://www.x-kom.pl'
FORMAT_DATETIME = '%Y-%m-%d %H:%M:%S.%f'
redis_server = redis.Redis(host='localhost', port=6379)
def get_number(number):
return float(number.strip().split()[0].replace(',',... | # -*- coding: utf-8 -*-
import redis
import urllib2
from bs4 import BeautifulSoup
from datetime import datetime
url = 'http://www.x-kom.pl'
FORMAT_DATETIME = '%Y-%m-%d %H:%M:%S.%f'
redis_server = redis.Redis(host='localhost', port=6379)
def get_number(number):
return float(number.strip().split()[0].replace(',',... | mit | Python |
8b944f04ebf9b635029182a3137e9368edafe9d2 | Handle exception for bad search strings | groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu | pgsearch/utils.py | pgsearch/utils.py | from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery
import shlex
import string
def parseSearchString(search_string):
try:
search_strings = shlex.split(search_string)
translator = str.maketrans({key: None for key in string.punctuation})
search_strings = [s.trans... | from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery
import shlex
import string
def parseSearchString(search_string):
search_strings = shlex.split(search_string)
translator = str.maketrans({key: None for key in string.punctuation})
search_strings = [s.translate(translator) for ... | bsd-3-clause | Python |
6df0e3efd239f7be073057ede44033dc95064a23 | Fix StringIO import | ktdreyer/teuthology,ceph/teuthology,ktdreyer/teuthology,ceph/teuthology | teuthology/task/tests/test_run.py | teuthology/task/tests/test_run.py | import logging
import pytest
from io import StringIO
from teuthology.exceptions import CommandFailedError
log = logging.getLogger(__name__)
class TestRun(object):
"""
Tests to see if we can make remote procedure calls to the current cluster
"""
def test_command_failed_label(self, ctx, config):
... | import logging
import pytest
from StringIO import StringIO
from teuthology.exceptions import CommandFailedError
log = logging.getLogger(__name__)
class TestRun(object):
"""
Tests to see if we can make remote procedure calls to the current cluster
"""
def test_command_failed_label(self, ctx, config... | mit | Python |
8e24d3139c11428cda1e07da62ff007be9c77424 | Add convenience method. | abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core | abilian/testing/__init__.py | abilian/testing/__init__.py | """Base stuff for testing.
"""
import os
import subprocess
import requests
assert not 'twill' in subprocess.__file__
from flask.ext.testing import TestCase
from abilian.application import Application
__all__ = ['TestConfig', 'BaseTestCase']
class TestConfig(object):
SQLALCHEMY_DATABASE_URI = "sqlite://"
SQ... | """Base stuff for testing.
"""
import os
import subprocess
import requests
assert not 'twill' in subprocess.__file__
from flask.ext.testing import TestCase
from abilian.application import Application
__all__ = ['TestConfig', 'BaseTestCase']
class TestConfig(object):
SQLALCHEMY_DATABASE_URI = "sqlite://"
SQ... | lgpl-2.1 | Python |
7292b2d276db056870993a108466fccc18debcae | Update count-different-palindromic-subsequences.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/count-different-palindromic-subsequences.py | Python/count-different-palindromic-subsequences.py | # Time: O(n^2)
# Space: O(n^2)
# Given a string S, find the number of different non-empty palindromic subsequences in S,
# and return that number modulo 10^9 + 7.
#
# A subsequence of a string S is obtained by deleting 0 or more characters from S.
#
# A sequence is palindromic if it is equal to the sequence reversed.... | # Time: O(n^2)
# Space: O(n^2)
class Solution(object):
def countPalindromicSubsequences(self, S):
"""
:type S: str
:rtype: int
"""
def dp(i, j, prv, nxt, lookup):
if lookup[i][j] is not None:
return lookup[i][j]
result = 1
... | mit | Python |
358de4c3ce20569e217b1caf5c25ce826b536bbc | Reformat datastructuretools | Pulgama/supriya,Pulgama/supriya,josiah-wolf-oberholtzer/supriya,Pulgama/supriya,Pulgama/supriya | supriya/tools/datastructuretools/__init__.py | supriya/tools/datastructuretools/__init__.py | # -*- encoding: utf-8 -*-
r"""
Tools for working with generic datastructures.
"""
from abjad.tools import systemtools
systemtools.ImportManager.import_structured_package(
__path__[0],
globals(),
)
| # -*- encoding: utf-8 -*-
r'''
Tools for working with generic datastructures.
'''
from abjad.tools import systemtools
systemtools.ImportManager.import_structured_package(
__path__[0],
globals(),
)
| mit | Python |
9098692bf431b4947da96dc054fe8e1559e27aa5 | Update hexagon_nn_headers to v1.10.3.1.3 Changes Includes: * Support soc_id:371 * New method exposed that returns the version of hexagon_nn used in libhexagon_interface.so | tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,freedomtan/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_t... | third_party/hexagon/workspace.bzl | third_party/hexagon/workspace.bzl | """Loads the Hexagon NN Header files library, used by TF Lite."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "hexagon_nn",
sha256 = "281d46b47f7191f03a8a4071c4c8d2af9409bb9d59573dc2e42f04c4fd61f1fd",
urls = [
"https:/... | """Loads the Hexagon NN Header files library, used by TF Lite."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "hexagon_nn",
sha256 = "4cbf3c18834e24b1f64cc507f9c2f22b4fe576c6ff938d55faced5d8f1bddf62",
urls = [
"https:/... | apache-2.0 | Python |
86391ed76c49578321c026187f159c53c2cf4ed1 | Fix slack welcome message display bug and add user handle | b12io/orchestra,Sonblind/orchestra,b12io/orchestra,Sonblind/orchestra,unlimitedlabs/orchestra,b12io/orchestra,b12io/orchestra,b12io/orchestra,Sonblind/orchestra,unlimitedlabs/orchestra,unlimitedlabs/orchestra | orchestra/slack.py | orchestra/slack.py | import base64
from uuid import uuid1
from django.conf import settings
import slacker
from orchestra.utils.settings import run_if
class SlackService(object):
"""
Wrapper slack service to allow easy swapping and mocking out of API.
"""
def __init__(self, api_key):
self._service = slacker.Slack... | import base64
from uuid import uuid1
from django.conf import settings
import slacker
from orchestra.utils.settings import run_if
class SlackService(object):
"""
Wrapper slack service to allow easy swapping and mocking out of API.
"""
def __init__(self, api_key):
self._service = slacker.Slack... | apache-2.0 | Python |
e7b50269a6d83234b283f769265bf474666b6cd2 | Update project model with property has_description | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/projects/models.py | polyaxon/projects/models.py | import uuid
from django.conf import settings
from django.core.validators import validate_slug
from django.db import models
from libs.blacklist import validate_blacklist_name
from libs.models import DescribableModel, DiffModel
class Project(DiffModel, DescribableModel):
"""A model that represents a set of experi... | import uuid
from django.conf import settings
from django.core.validators import validate_slug
from django.db import models
from libs.blacklist import validate_blacklist_name
from libs.models import DescribableModel, DiffModel
class Project(DiffModel, DescribableModel):
"""A model that represents a set of experi... | apache-2.0 | Python |
76bf774f3af2fb4fc2518945944b9f64c413712a | Simplify "cursor" function in "misc" module | idanarye/breeze.vim | autoload/breeze/utils/misc.py | autoload/breeze/utils/misc.py | # -*- coding: utf-8 -*-
"""
breeze.utils.misc
~~~~~~~~~~~~~~~~~
This module defines various utility functions and some tiny wrappers
around vim functions.
"""
import vim
import breeze.utils.settings
def echom(msg):
"""Gives a simple feedback to the user via the command line."""
vim.command('echom "[breeze] ... | # -*- coding: utf-8 -*-
"""
breeze.utils.misc
~~~~~~~~~~~~~~~~~
This module defines various utility functions and some tiny wrappers
around vim functions.
"""
import vim
import breeze.utils.settings
def echom(msg):
"""Gives a simple feedback to the user via the command line."""
vim.command('echom "[breeze] ... | mit | Python |
5cc1cc719958178519e10c06f7337b8b48ce02fc | sort house numbers | sambandi/eMonitor,sambandi/eMonitor,digifant/eMonitor,digifant/eMonitor,digifant/eMonitor,sambandi/eMonitor | emonitor/modules/streets/street.py | emonitor/modules/streets/street.py | import yaml
from sqlalchemy.orm import relationship
from emonitor.extensions import db
from emonitor.modules.streets.housenumber import Housenumber
class Street(db.Model):
__tablename__ = 'streets'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
navigation = db.Column... | import yaml
from sqlalchemy.orm import relationship
from emonitor.extensions import db
from emonitor.modules.streets.housenumber import Housenumber
class Street(db.Model):
__tablename__ = 'streets'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
navigation = db.Column... | bsd-3-clause | Python |
8da02c7c4ad382f4e7a2f7a017b32c0cff51547e | set limit of tw id over 5 letters | amimoto-ami/amimoto-amazon-alexa,amimoto-ami/amimoto-amazon-alexa | build_attendee.py | build_attendee.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from pyquery import PyQuery as pq
import json
if __name__ == "__main__":
## ref: pyquery
# https://media.readthedocs.org/pdf/pyquery/latest/pyquery.pdf
data = dict()
file = ope... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from pyquery import PyQuery as pq
import json
if __name__ == "__main__":
## ref: pyquery
# https://media.readthedocs.org/pdf/pyquery/latest/pyquery.pdf
data = dict()
file = ope... | mit | Python |
dc54a12bfd2124e7203270940928e47198ed914e | bump version | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/__init__.py | bulbs/__init__.py | __version__ = "0.6.24"
| __version__ = "0.6.23"
| mit | Python |
64383b6d8095f27af775d3c6030b22ee36055b29 | Change summoner example function name, add params | robrua/cassiopeia,10se1ucgo/cassiopeia,meraki-analytics/cassiopeia | examples/summoner.py | examples/summoner.py | import cassiopeia as cass
from cassiopeia.core import Summoner
def print_summoner(name: str, region: str):
summoner = Summoner(name=name, region=region)
print("Name:", summoner.name)
print("ID:", summoner.id)
print("Account ID:", summoner.account.id)
print("Level:", summoner.level)
print("Revi... | import cassiopeia as cass
from cassiopeia.core import Summoner
def test_cass():
name = "Kalturi"
me = Summoner(name=name)
print("Name:", me.name)
print("Id:", me.id)
print("Account id:", me.account.id)
print("Level:", me.level)
print("Revision date:", me.revision_date)
print("Profile i... | mit | Python |
b077df615eb4354f416877cc2857fb9848e158eb | Fix get_sort_by_toggle to work with QueryDicts with multiple values | UITools/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor | saleor/core/templatetags/shop.py | saleor/core/templatetags/shop.py | from __future__ import unicode_literals
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
from django.template import Library
from django.utils.http import urlencode
register = Library()
@register.filter
def slice(items, group_size=1):
args = [... | from __future__ import unicode_literals
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
from django.template import Library
from django.utils.http import urlencode
register = Library()
@register.filter
def slice(items, group_size=1):
args = [... | bsd-3-clause | Python |
3e62a39892c231419ac09310808d95cb42b4f69f | add python solution for valid_parentheses | hsadler/programming-language-examples,hsadler/programming-language-examples,hsadler/programming-language-examples,hsadler/programming-language-examples,hsadler/programming-language-examples | python/valid_parentheses.py | python/valid_parentheses.py |
# validate parentheses of string
import sys
inputChars = [ x for x in sys.argv[1] ]
openParens = ('(', '[', '{')
closeParens = (')', ']', '}')
parenPairs = {
')': '(',
']': '[',
'}': '{'
}
parenHistory = []
for c in inputChars:
if c in openParens:
parenHistory.append(c)
elif c in closeP... | mit | Python | |
60f753e736827f61607e10d160b7e7bab75b77cc | update pyasn version for workers | Jigsaw-Code/censoredplanet-analysis,Jigsaw-Code/censoredplanet-analysis | pipeline/setup.py | pipeline/setup.py | # 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, ... | # 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, ... | apache-2.0 | Python |
7842919b2af368c640363b4e4e05144049b111ba | Remove BaseMail dependency on User object | OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core | ovp_core/emails.py | ovp_core/emails.py | from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template
from django.template.loader import get_template
from django.conf import settings
import threading
class EmailThread(threading.Thread):
def __init__(self, msg):
self.msg = msg
threading.Thread.__init__(sel... | from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template
from django.template.loader import get_template
from django.conf import settings
import threading
class EmailThread(threading.Thread):
def __init__(self, msg):
self.msg = msg
threading.Thread.__init__(sel... | agpl-3.0 | Python |
3c9de69112c8158877e4b0060ef0ab89c083f376 | Build 1.14.0.1 package for Windows | GStreamer/cerbero,atsushieno/cerbero,centricular/cerbero,fluendo/cerbero,atsushieno/cerbero,nirbheek/cerbero,fluendo/cerbero,centricular/cerbero,centricular/cerbero,GStreamer/cerbero,fluendo/cerbero,atsushieno/cerbero,fluendo/cerbero,nirbheek/cerbero,centricular/cerbero,GStreamer/cerbero,atsushieno/cerbero,atsushieno/c... | packages/custom.py | packages/custom.py | # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.packages import package
from cerbero.enums import License
class GStreamer:
url = "http://gstreamer.freedesktop.org"
version = '1.14.0.1'
vendor = 'GStreamer Project'
licenses = [License.LGPL]
org = 'org.freedesktop.gstream... | # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.packages import package
from cerbero.enums import License
class GStreamer:
url = "http://gstreamer.freedesktop.org"
version = '1.14.0'
vendor = 'GStreamer Project'
licenses = [License.LGPL]
org = 'org.freedesktop.gstreamer... | lgpl-2.1 | Python |
2250fdef5528bb59ca2c3218110d637484737659 | fix pilutil.imresize test. Patch by Mark Wiebe. | mhogg/scipy,giorgiop/scipy,richardotis/scipy,pbrod/scipy,befelix/scipy,zaxliu/scipy,pnedunuri/scipy,niknow/scipy,pschella/scipy,nmayorov/scipy,Stefan-Endres/scipy,sauliusl/scipy,chatcannon/scipy,vhaasteren/scipy,tylerjereddy/scipy,Shaswat27/scipy,gfyoung/scipy,jonycgn/scipy,jsilter/scipy,ogrisel/scipy,newemailjdm/scipy... | scipy/misc/tests/test_pilutil.py | scipy/misc/tests/test_pilutil.py | import os.path
import numpy as np
from numpy.testing import assert_, assert_equal, \
dec, decorate_methods, TestCase, run_module_suite
try:
import PIL.Image
except ImportError:
_have_PIL = False
else:
_have_PIL = True
import scipy.misc.pilutil as pilutil
# Function / method decorator for skip... | import os.path
import numpy as np
from numpy.testing import assert_, assert_equal, \
dec, decorate_methods, TestCase, run_module_suite
try:
import PIL.Image
except ImportError:
_have_PIL = False
else:
_have_PIL = True
import scipy.misc.pilutil as pilutil
# Function / method decorator for skip... | bsd-3-clause | Python |
b3573faeff22f220990ea2c97a7c9eae26429258 | add parse for application/json | hugoxia/Python,hugoxia/Python,hugoxia/Python,hugoxia/Python | tornado-sqlalchemy-example/app.py | tornado-sqlalchemy-example/app.py | # -*- coding: utf-8 -*-
import os
import tornado.web
import tornado.options
import tornado.ioloop
from db import db
from model import User
from tornado.escape import json_decode, to_unicode
class BaseHandler(tornado.web.RequestHandler):
@property
def db(self):
return self.application.db
def get_... | import os
import tornado.web
import tornado.options
import tornado.ioloop
from db import db
from model import User
class BaseHandler(tornado.web.RequestHandler):
@property
def db(self):
return self.application.db
class IndexHandler(BaseHandler):
def get(self):
data = self.db.query(User)... | mit | Python |
bf81484b7fd55e6383ae8e0f103e5e69ddea430e | Update utils.py | AcademicTorrents/python-r-api | academictorrents/utils.py | academictorrents/utils.py | import hashlib
import os
import json
import datetime
import calendar
import time
def convert_bytes_to_decimal(headerBytes):
size = 0
power = len(headerBytes) - 1
for ch in headerBytes:
if isinstance(ch, int):
size += ch * 256 ** power
else:
size += int(ord(ch)) * 25... | import hashlib
import os
import json
import datetime
import calendar
import time
def convert_bytes_to_decimal(headerBytes):
size = 0
power = len(headerBytes) - 1
for ch in headerBytes:
if isinstance(ch, int):
size += ch * 256 ** power
else:
size += int(ord(ch)) * 25... | mit | Python |
2b5ac57fd02e5e20f738f9060456542f69eeff95 | Bump version to 4.0.0a12 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
82a1bcd4bd104ca2b45cb5dc93a44e4a16d1cbe3 | add more QC options and colorized output for quicker review | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/asos/archive_quantity.py | scripts/asos/archive_quantity.py | """ Create a simple prinout of observation quanity in the database """
import datetime
now = datetime.datetime.utcnow()
import numpy
counts = numpy.zeros((120,12))
mslp = numpy.zeros((120,12))
metar = numpy.zeros((120,12))
import iemdb
ASOS = iemdb.connect('asos', bypass=True)
acursor = ASOS.cursor()
import sys
stid ... | """ Create a simple prinout of observation quanity in the database """
import datetime
now = datetime.datetime.utcnow()
import numpy
counts = numpy.zeros((120,12))
import iemdb
ASOS = iemdb.connect('asos', bypass=True)
acursor = ASOS.cursor()
import sys
stid = sys.argv[1]
acursor.execute("""SELECT extract(year from ... | mit | Python |
546d8fc8b41de424a76beb03c6530a7cf505a6a3 | add orca EarthLocation | tamasgal/km3pipe,tamasgal/km3pipe | km3pipe/constants.py | km3pipe/constants.py | # coding=utf-8
# Filename: constants.py
# pylint: disable=C0103
# pragma: no cover
"""
The constants used in KM3Pipe.
"""
from __future__ import division, absolute_import, print_function
# TODO: this module should be refactored soon!
import math
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal an... | # coding=utf-8
# Filename: constants.py
# pylint: disable=C0103
# pragma: no cover
"""
The constants used in KM3Pipe.
"""
from __future__ import division, absolute_import, print_function
# TODO: this module should be refactored soon!
import math
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal an... | mit | Python |
ce47d219076dc2ff36c58db1d91ba349b9968d61 | Update test_bandits.py | yngtodd/tanuki | bandits/tests/test_bandits.py | bandits/tests/test_bandits.py | from sklearn.utils.testing import assert_equal
import numpy as np
import pytest
@pytest.mark.fast_test
def dummy_test():
"""
Quick test to build with Circle CI.
"""
x = 2 + 2
assert_equal(x, 4)
| from sklearn.utils.testing import assert_equal
import numpy as np
import pytest
print("Hello tests!")
| mit | Python |
2652919c8d2e6fad8f7b3d47f5e82528b4b5214e | Write the last point for plot completeness | ECP-CANDLE/Database,ECP-CANDLE/Database | plots/monotone.py | plots/monotone.py |
# MONOTONE
# Produce a monotonically decreasing output plot from noisy data
# Input: columns: t x
# Output: columns: t_i x_i , sampled such that x_i <= x_j
# for j > i.
from string import *
import sys
# Set PYTHONPATH=$PWD
from plottools import *
if len(sys.argv) != 3:
abort("usage:... |
# MONOTONE
# Produce a monotonically decreasing output plot from noisy data
# Input: columns: t x
# Output: columns: t_i x_i , sampled such that x_i <= x_j
# for j > i.
from string import *
import sys
# Set PYTHONPATH=$PWD
from plottools import *
if len(sys.argv) != 3:
abort("usage:... | mit | Python |
6482c485982fe5039574eab797b46d5f1b93bacc | Refactor populate script | trimailov/finance,trimailov/finance,trimailov/finance | finance/management/commands/populate.py | finance/management/commands/populate.py | import random
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
import factory
from accounts.factories import UserFactory
from books.factories import TransactionFactory
class Command(BaseCommand):
help = "Popoulates databse with dummy data"
def handle(self, *a... | import random
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db import IntegrityError
import factory
from accounts.factories import UserFactory
from books.factories import TransactionFactory
class Command(BaseCommand):
help = "Popoulates databse with... | mit | Python |
4475cd927dda1d8ab685507895e0fc4bde6e3b4a | switch window index error | malongge/selenium-pom | pages/base_page.py | pages/base_page.py | from .page import Page
class BasePage(Page):
def get_cookie_index_page(self, url, cookie):
self.get_relative_path(url)
self.maximize_window()
self.selenium.add_cookie(cookie)
self.selenium.refresh()
def switch_to_second_window(self):
handles = self.selenium.... | from .page import Page
class BasePage(Page):
def get_cookie_index_page(self, url, cookie):
self.get_relative_path(url)
self.maximize_window()
self.selenium.add_cookie(cookie)
self.selenium.refresh()
def switch_to_second_window(self):
handles = self.selenium.... | apache-2.0 | Python |
e69efded329ebbcf5ccf74ef137dc1a80bd4b4a6 | add 2.1.2, re-run cython if needed (#13102) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-line-profiler/package.py | var/spack/repos/builtin/packages/py-line-profiler/package.py | # Copyright 2013-2019 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)
import os
from spack import *
class PyLineProfiler(PythonPackage):
"""Line-by-line profiler."""
homepage = "ht... | # Copyright 2013-2019 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 PyLineProfiler(PythonPackage):
"""Line-by-line profiler."""
homepage = "https://githu... | lgpl-2.1 | Python |
381adeeec0fd1d65372d7003183d4b1ec8f2cfbf | Increase V8JS Stack Limit (#584) | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/V8JS.py | dmoj/executors/V8JS.py | from dmoj.executors.script_executor import ScriptExecutor
class Executor(ScriptExecutor):
ext = 'js'
name = 'V8JS'
command = 'v8dmoj'
test_program = 'print(gets());'
address_grace = 786432
nproc = -1
@classmethod
def get_version_flags(cls, command):
return [('-e', 'print(versi... | from dmoj.executors.script_executor import ScriptExecutor
class Executor(ScriptExecutor):
ext = 'js'
name = 'V8JS'
command = 'v8dmoj'
test_program = 'print(gets());'
address_grace = 786432
nproc = -1
@classmethod
def get_version_flags(cls, command):
return [('-e', 'print(versi... | agpl-3.0 | Python |
7fba4a676622e93416f32ee69bfa295647979c7a | fix path on test file | mcdeaton13/Tax-Calculator,jlyons871/Tax-Calculator,mcdeaton13/Tax-Calculator,rkuchan/Tax-Calculator,rkuchan/Tax-Calculator,mmessick/Tax-Calculator,xiyuw123/Tax-Calculator,xiyuw123/Tax-Calculator,mmessick/Tax-Calculator,jlyons871/Tax-Calculator | taxcalc/tests/test_calculate.py | taxcalc/tests/test_calculate.py | import os
import sys
cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(cur_path, "../../"))
sys.path.append(os.path.join(cur_path, "../"))
import numpy as np
import pandas as pd
from numba import jit, vectorize, guvectorize
from taxcalc import *
def test_make_Calculator():
tax_dta... | import os
import sys
cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(cur_path, "../../"))
sys.path.append(os.path.join(cur_path, "../"))
import numpy as np
import pandas as pd
from numba import jit, vectorize, guvectorize
from taxcalc import *
def test_make_Calculator():
tax_dta... | mit | Python |
faf9638bc69dc79c7fdc9294cc309c40ca57d518 | Fix process names in test_nailyd_alive | SmartInfrastructures/fuel-main-dev,SergK/fuel-main,huntxu/fuel-main,teselkin/fuel-main,dancn/fuel-main-dev,stackforge/fuel-web,zhaochao/fuel-main,AnselZhangGit/fuel-main,teselkin/fuel-main,ddepaoli3/fuel-main-dev,SmartInfrastructures/fuel-web-dev,zhaochao/fuel-web,stackforge/fuel-main,huntxu/fuel-web,AnselZhangGit/fuel... | fuelweb_test/integration/test_nailyd.py | fuelweb_test/integration/test_nailyd.py | import logging
import xmlrpclib
from fuelweb_test.integration.base import Base
from fuelweb_test.helpers import SSHClient
class TestNailyd(Base):
def __init__(self, *args, **kwargs):
super(TestNailyd, self).__init__(*args, **kwargs)
self.remote = SSHClient()
def setUp(self):
logging... | import logging
import xmlrpclib
from fuelweb_test.integration.base import Base
from fuelweb_test.helpers import SSHClient
class TestNailyd(Base):
def __init__(self, *args, **kwargs):
super(TestNailyd, self).__init__(*args, **kwargs)
self.remote = SSHClient()
def setUp(self):
logging... | apache-2.0 | Python |
13a64059b71fccb8315f552d8e96f130c513a540 | Remove old code. | colmcoughlan/alchemy-server | charity_server.py | charity_server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 01:14:12 2017
@author: colm
"""
from flask import Flask, jsonify
from parse_likecharity import refresh_charities
from datetime import datetime
app = Flask(__name__)
refresh_rate = 24 * 60 * 60 #Seconds
start_time = datetime.now()
initialized =... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 01:14:12 2017
@author: colm
"""
from flask import Flask, jsonify
from parse_likecharity import refresh_charities
import threading
from datetime import datetime
app = Flask(__name__)
refresh_rate = 24 * 60 * 60 #Seconds
start_time = datetime.no... | mit | Python |
d6de45a751034fc6721886b670219eb55c589886 | reduce load size | leeopop/2015-CS570-Project | test.py | test.py | from loader import *
from create_feature import *
def main():
total_data = load_all(file_list=['Author', 'Paper', 'PaperAuthor'])
load_title_lda(total_data)
paper_topic(total_data)
author_topic(total_data)
paper_author_topic_sum(total_data)
save_topic_sum(total_data)
pass
if __name__ == '__main__':
main()
| from loader import *
from create_feature import *
def main():
total_data = load_all()
load_title_lda(total_data)
paper_topic(total_data)
author_topic(total_data)
paper_author_topic_sum(total_data)
save_topic_sum(total_data)
pass
if __name__ == '__main__':
main()
| mit | Python |
21bbf9ec71c2d63f5c826dfdc3641927692cb202 | test test | jantman/kvmdash,jantman/kvmdash,jantman/kvmdash | test.py | test.py | from flask import Flask
import pytest
def test_app():
app = Flask(__name__)
app.testing = True
@app.route("/")
def hello():
return "Hello World!"
# app.run() # this actually works here...
with app.test_client() as client:
response = client.get("/")
assert response.stat... | from flask import Flask
import pytest
def test_app():
app = Flask(__name__)
app.testing = True
@app.route("/")
def hello():
return "Hello World!"
# app.run() # this actually works here...
client = app.test_client()
response = client.get("/")
assert response.status_code == 200
... | agpl-3.0 | Python |
727078f0d7105138310f0870f8ab3a751e0f72da | Fix linting issues in test runner | cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot | test.py | test.py | """
Run all tests in this project.
"""
import unittest
if __name__ == "__main__":
loader = unittest.TestLoader()
tests = loader.discover(".", pattern="test_*.py")
runner = unittest.TextTestRunner()
runner.run(tests)
| # Run all tests in this project
import os
import sys
import unittest
if __name__=="__main__":
loader = unittest.TestLoader()
tests = loader.discover(".", pattern="test_*.py")
runner = unittest.TextTestRunner()
runner.run(tests)
| apache-2.0 | Python |
26fc8789445c22f85467387bec7eeb6eccedc2c5 | Stop before starting when restarting | matrix-org/synapse,howethomas/synapse,howethomas/synapse,matrix-org/synapse,iot-factory/synapse,iot-factory/synapse,matrix-org/synapse,rzr/synapse,illicitonion/synapse,rzr/synapse,illicitonion/synapse,TribeMedia/synapse,matrix-org/synapse,iot-factory/synapse,howethomas/synapse,TribeMedia/synapse,TribeMedia/synapse,illi... | synapse/app/synctl.py | synapse/app/synctl.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 req... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 req... | apache-2.0 | Python |
6c02b743ad3859e05eeb980298e54acf3fbd9788 | Add __len__ to FlagField (#3981) | allenai/allennlp,allenai/allennlp,allenai/allennlp,allenai/allennlp | allennlp/data/fields/flag_field.py | allennlp/data/fields/flag_field.py | from typing import Any, Dict, List
from overrides import overrides
from allennlp.data.fields.field import Field
class FlagField(Field[Any]):
"""
A class representing a flag, which must be constant across all instances in a batch.
This will be passed to a `forward` method as a single value of whatever ty... | from typing import Any, Dict, List
from overrides import overrides
from allennlp.data.fields.field import Field
class FlagField(Field[Any]):
"""
A class representing a flag, which must be constant across all instances in a batch.
This will be passed to a `forward` method as a single value of whatever ty... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.