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 |
|---|---|---|---|---|---|---|---|---|
60246d5d52d8f9eeff29b2b6c602c39f7ac17260 | Fix redirection after add | agateau/tmc2,agateau/tmc2 | views.py | views.py | from flask import render_template, request, redirect, url_for
from app import app
from models import Quote
PAGE_SIZE = 3
@app.route('/', methods=['GET'])
def homepage():
try:
page = int(request.args.get('page'))
except TypeError:
page = 0
quotes, page_count = Quote.paged(page, PAGE_SIZE)... | from flask import render_template, request, redirect
from app import app
from models import Quote
PAGE_SIZE = 3
@app.route('/', methods=['GET'])
def homepage():
try:
page = int(request.args.get('page'))
except TypeError:
page = 0
quotes, page_count = Quote.paged(page, PAGE_SIZE)
ret... | apache-2.0 | Python |
2f628df5df7be9b28eade103dd9bfd3385f7d645 | Add link to user avatar in the API | lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter | dwitter/serializers.py | dwitter/serializers.py | from rest_framework import serializers
from dwitter.models import Dweet, Comment
from dwitter.templatetags.insert_magic_links import insert_magic_links
from dwitter.templatetags.to_gravatar_url import to_gravatar_url
from django.contrib.auth.models import User
from django.template.defaultfilters import urlizetrunc
cl... | from rest_framework import serializers
from dwitter.models import Dweet, Comment
from dwitter.templatetags.insert_magic_links import insert_magic_links
from django.contrib.auth.models import User
from django.template.defaultfilters import urlizetrunc
class UserSerializer(serializers.ModelSerializer):
link = seria... | apache-2.0 | Python |
c20d95ca96cef17d905fc3d39c49ad589549f32e | add select related query for group social links | tomaszroszko/django-social-links | sociallinks/templatetags/sociallink_tags.py | sociallinks/templatetags/sociallink_tags.py | # -*- coding: utf-8 -*-
from django import template
from django.contrib.contenttypes.models import ContentType
from sociallinks.models import SocialLink, SocialLinkGroup
register = template.Library()
@register.assignment_tag
def obj_social_links(obj):
"""return list of social links for obj. Obj is instance of a... | # -*- coding: utf-8 -*-
from django import template
from django.contrib.contenttypes.models import ContentType
from sociallinks.models import SocialLink, SocialLinkGroup
register = template.Library()
@register.assignment_tag
def obj_social_links(obj):
"""return list of social links for obj. Obj is instance of a... | bsd-3-clause | Python |
dfee9aca2398a3f51763f64571ceac796ad6a555 | fix bug when return value of write is negative in download | f-koehler/dotgen | dotgen/plugins/download.py | dotgen/plugins/download.py | # -*- coding: utf-8 -*-
import math
import os
import requests
import subprocess
import tqdm
from dotgen import hashing
rank = 0
def handle(output_dir, config):
for download in config:
cfg = config[download]
download_path = os.path.join(output_dir, cfg["path"])
hash_cfg = cfg["hash"]
... | # -*- coding: utf-8 -*-
import math
import os
import requests
import subprocess
import tqdm
from dotgen import hashing
rank = 0
def handle(output_dir, config):
for download in config:
cfg = config[download]
download_path = os.path.join(output_dir, cfg["path"])
hash_cfg = cfg["hash"]
... | mit | Python |
1bce066b00416cde7f255ef6f03fe56ebe4d28ac | Read from rtl_433 output, convert to wu update string | nordoff/rtl_433_to_wu,nordoff/rtl_433_to_wu | weatherd.py | weatherd.py | #!/bin/python
import subprocess
import os
import signal
import time
import sys
import re
import urllib
wu_uri = 'http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php'
class Sensor:
wind_mph = None
temp_f = None
rh_pct = None
winddir_deg = None
rain_in = None
timestamp = None
def reset(self... | #!/bin/python
import urllib
params = urllib.urlencode({
'action':'updateraw',
'id':'myid',
'password':'mypw',
'dateutc':'now',
'winddir':180,
'windspeedmph':2,
'humidity':50,
'tempf':20,
'rainin':0.0,
'dailyrainin':0.0,
'baromin':29.92,
'dewptf':29,
'softwaretyp... | apache-2.0 | Python |
ff174fe12e0ef00fc46582e7d710c76929825a05 | Add exit logic | jwarshaw/RaspberryDrive | views/takePicture.py | views/takePicture.py | import picamera as p
import os
import time
print "in take picture"
os.chdir('/home/pi/Desktop')
cam = p.PiCamera()
cam.resolution = (320,240)
x = 0
while x < 50:
#os.unlink('greg.jpg')
img = cam.capture('gregTest.jpg')
time.sleep(.25)
#oc.rename('gregTemp.jpg', 'greg.jpg')
x +=1
exit()
| import picamera as p
import os
import time
os.chdir('/home/pi/Desktop')
cam = p.PiCamera()
cam.resolution = (320,240)
x = 0
while x < 50:
#os.unlink('greg.jpg')
img = cam.capture('gregTest.jpg')
time.sleep(.25)
#oc.rename('gregTemp.jpg', 'greg.jpg')
x +=1
| mit | Python |
59b7ab5bceb8e8dbc28306e7d2a437ec3a8e2a38 | bump to 0.35.0 | efiop/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc | dvc/version.py | dvc/version.py | # Used from setup.py, so don't pull any additional dependencies
import os
import subprocess
def generate_version(base_version):
"""Generate a version with information about the git repository"""
pkg_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if not is_git_repo(pkg_dir) or not have_... | # Used from setup.py, so don't pull any additional dependencies
import os
import subprocess
def generate_version(base_version):
"""Generate a version with information about the git repository"""
pkg_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if not is_git_repo(pkg_dir) or not have_... | apache-2.0 | Python |
b9ce19c58576ac97489f76624fe93d48960a34f0 | bump version | Storj/downstream-node,Storj/downstream-node | downstream_node/version.py | downstream_node/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.1.2'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.1.1'
| mit | Python |
32b5b33329ef71586ae47b1b879bf90f79edab2f | bump to 1.5.1 | efiop/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc | dvc/version.py | dvc/version.py | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "1.5.1"
def _generate_version(base_version):
"""Generate a version ... | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "1.5.0"
def _generate_version(base_version):
"""Generate a version ... | apache-2.0 | Python |
e0056693326579d99b0d32c0164624cc1c6d47e9 | Remove GYP trybots | yarrcc/libyuv-ios,lemenkov/libyuv,yarrcc/libyuv-ios,yarrcc/libyuv-ios,lemenkov/libyuv,lemenkov/libyuv,yarrcc/libyuv-ios,lemenkov/libyuv | PRESUBMIT.py | PRESUBMIT.py | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors... | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors... | bsd-3-clause | Python |
6a90e1dbfd58095605e2382320230ae620c0b4a5 | add refs for strlen | axt/angr,axt/angr,tyb0807/angr,f-prettyland/angr,angr/angr,iamahuman/angr,angr/angr,iamahuman/angr,chubbymaggie/angr,chubbymaggie/angr,f-prettyland/angr,chubbymaggie/simuvex,tyb0807/angr,chubbymaggie/simuvex,f-prettyland/angr,schieb/angr,schieb/angr,tyb0807/angr,chubbymaggie/simuvex,zhuyue1314/simuvex,axt/angr,angr/sim... | simuvex/procedures/libc.so.6/strlen.py | simuvex/procedures/libc.so.6/strlen.py | import simuvex
import symexec as se
import logging
l = logging.getLogger("simuvex.procedures.libc.strlen")
class strlen(simuvex.SimProcedure):
def __init__(self): # pylint: disable=W0231,
s = self.get_arg_expr(0)
max_symbolic = self.state['libc'].buf_symbolic_bytes
max_str_len = self.state['libc'].max_str_len... | import simuvex
import symexec as se
import logging
l = logging.getLogger("simuvex.procedures.libc.strlen")
class strlen(simuvex.SimProcedure):
def __init__(self): # pylint: disable=W0231,
s = self.get_arg_expr(0)
max_symbolic = self.state['libc'].buf_symbolic_bytes
max_str_len = self.state['libc'].max_str_len... | bsd-2-clause | Python |
28b0db225b6b96c0d4c8694e25b3232f2196eff1 | Update apps list | aptivate/kashana,aptivate/alfie,aptivate/alfie,aptivate/alfie,aptivate/kashana,daniell/kashana,aptivate/kashana,aptivate/kashana,daniell/kashana,daniell/kashana,daniell/kashana,aptivate/alfie | deploy/project_settings.py | deploy/project_settings.py | # this is for settings to be used by tasks.py
import os
from os import path
###############################
# THESE SETTINGS MUST BE EDITED
###############################
# This is the directory inside the project dev dir that contains the django
# application
project_name = "kashana"
user = "daniell"
# The django ... | # this is for settings to be used by tasks.py
import os
from os import path
###############################
# THESE SETTINGS MUST BE EDITED
###############################
# This is the directory inside the project dev dir that contains the django
# application
project_name = "kashana"
user = "daniell"
# The django ... | agpl-3.0 | Python |
2bc4ad258a620b2824432ae9c7676b225c66b305 | update from 1.x API to 3.x API (drops non-https mode entirely, including the option in the call, also set_request_token went away but that may have been wrong anyhow) | eichin/thok-ztwitgw,eichin/thok-ztwitgw | zpost.py | zpost.py | #!/usr/bin/python
# Copyright (c) 2008-2011 Mark Eichin <eichin@thok.org>
# See ./LICENSE (MIT style.)
"""zwrite-like twitter poster
(mostly to share a common password file with ztwitgw)"""
__version__ = "0.4"
__author__ = "Mark Eichin <eichin@thok.org>"
__license__ = "MIT"
import sys
import tweepy
import optpars... | #!/usr/bin/python
# Copyright (c) 2008-2011 Mark Eichin <eichin@thok.org>
# See ./LICENSE (MIT style.)
"""zwrite-like twitter poster
(mostly to share a common password file with ztwitgw)"""
__version__ = "0.4"
__author__ = "Mark Eichin <eichin@thok.org>"
__license__ = "MIT"
import sys
import tweepy
import optpars... | mit | Python |
67d1afa481f173fdf26469cb6347ae5730289e5f | allow section breaks and relayout grid | gangadhar-kadam/laganerp,rohitwaghchaure/erpnext-receipher,saurabh6790/test_final_med_app,mahabuber/erpnext,shft117/SteckerApp,mbauskar/alec_frappe5_erpnext,treejames/erpnext,gangadhar-kadam/nassimapp,mahabuber/erpnext,indictranstech/reciphergroup-erpnext,saurabh6790/tru_app_back,gangadhar-kadam/latestchurcherp,saurabh... | patches/may_2013/p06_make_notes.py | patches/may_2013/p06_make_notes.py | import webnotes, markdown2
def execute():
webnotes.reload_doc("utilities", "doctype", "note")
webnotes.reload_doc("utilities", "doctype", "note_user")
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
name = question.question[:180]
if webnotes.conn.exists("Note", name):
webn... | import webnotes
def execute():
webnotes.reload_doc("utilities", "doctype", "note")
webnotes.reload_doc("utilities", "doctype", "note_user")
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
name = question.question[:180]
if webnotes.conn.exists("Note", name):
webnotes.delete... | agpl-3.0 | Python |
9cc4817977dbce0751c69f5b56c367f139db8c03 | Allow user to exit game | kangareuben/PuppysPen,kangareuben/PuppysPen | PuppysPen.py | PuppysPen.py | #!/usr/bin/python
'''
Primary pygame file. Deals with all the stuff.
'''
# python
import random
# gtk
from gi.repository import Gtk
# pygame
import pygame
from pygame.locals import QUIT, MOUSEBUTTONUP, MOUSEMOTION, VIDEORESIZE, ACTIVEEVENT
# app
class PuppysPen:
# Runs before the game loop begins
def __in... | #!/usr/bin/python
'''
Primary pygame file. Deals with all the stuff.
'''
# python
import random
# gtk
from gi.repository import Gtk
# pygame
import pygame
#from pygame.locals import QUIT, MOUSEBUTTONUP, MOUSEMOTION, VIDEORESIZE, ACTIVEEVENT
# app
class PuppysPen:
# Runs before the game loop begins
def __i... | mit | Python |
6c9016a9987bf2efcfd8f237f8bbfbd5c4328ba1 | Add card verification function | amalshehu/exercism-python | luhn/luhn.py | luhn/luhn.py | # File: luhn.py
# Purpose: Write a program that can take a number and determine whether
# or not it is valid per the Luhn formula.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Sunday 18 September 2016, 09:55 PM
def Luhn(card_number):
digits = digits_of(card_number)
... | # File: luhn.py
# Purpose: Write a program that can take a number and determine whether
# or not it is valid per the Luhn formula.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Sunday 18 September 2016, 09:55 PM
| mit | Python |
df6717dfb0ee2d2d3c8e0a3485644061099a5b47 | Update run.py | DEV3L/python-flask-example,DEV3L/python-flask-example | wsgi/run.py | wsgi/run.py | from flask import Flask
app = Flask(__name__)
# Create our index or root / route
@app.route("/")
@app.route("/index")
def index():
return "Python - Hello World! v1.1 - Hi Candace"
@app.route("/nick")
def index():
return "Nick's secret route"
if __name__ == "__main__":
app.run() # debug="True")
| from flask import Flask
app = Flask(__name__)
# Create our index or root / route
@app.route("/")
@app.route("/index")
def index():
return "Python - Hello World! v1.1 - Hi Candace"
if __name__ == "__main__":
app.run() # debug="True")
| mit | Python |
212919c62183c9a8f9a6c7a7e88f0ad57f130064 | Change match syntax | ids1024/python-rustenum | algebraic.py | algebraic.py | class AlgebraicVariantBase(tuple):
def __new__(cls, *args):
if len(args) != cls._num:
name = type(cls).__name__ + '.' + cls.__name__
raise TypeError("Wrong number of arguments to " + name)
return super().__new__(cls, args)
def __repr__(self):
name = type(type(sel... | class AlgebraicVariantBase(tuple):
def __new__(cls, *args):
if len(args) != cls._num:
name = type(cls).__name__ + '.' + cls.__name__
raise TypeError("Wrong number of arguments to " + name)
return super().__new__(cls, args)
def __repr__(self):
name = type(type(sel... | mit | Python |
bca1fea34863babfa2fa504e2ad6dadad9a277ac | Revert "zinnia.urls is not longer needed in the urls with the app-hook" | django-blog-zinnia/cmsplugin-zinnia,bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,bittner/cmsplugin-zinnia,bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia | demo_cmsplugin_zinnia/urls.py | demo_cmsplugin_zinnia/urls.py | """Urls for the cmsplugin_zinnia demo"""
from django.conf import settings
from django.contrib import admin
from django.conf.urls import url
from django.conf.urls import include
from django.conf.urls import patterns
from zinnia.sitemaps import TagSitemap
from zinnia.sitemaps import EntrySitemap
from zinnia.sitemaps imp... | """Urls for the cmsplugin_zinnia demo"""
from django.conf import settings
from django.contrib import admin
from django.conf.urls import url
from django.conf.urls import include
from django.conf.urls import patterns
from zinnia.sitemaps import TagSitemap
from zinnia.sitemaps import EntrySitemap
from zinnia.sitemaps imp... | bsd-3-clause | Python |
886539f4bd3d67938f90b6500ee625db470284a2 | Make basic composite pass work | onitake/Uranium,onitake/Uranium | UM/View/CompositePass.py | UM/View/CompositePass.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application
from UM.Resources import Resources
from UM.Math.Matrix import Matrix
from UM.View.RenderPass import RenderPass
from UM.View.GL.OpenGL import OpenGL
class CompositePass(RenderPass):
... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Resources import Resources
from UM.View.RenderPass import RenderPass
from UM.View.GL.OpenGL import OpenGL
class CompositePass(RenderPass):
def __init__(self, name, width, height):
super().__init__(name... | agpl-3.0 | Python |
2c38c3e41b09db595d8adfcfc70ac9a9fd821df9 | Remove http_parser dep in test_kyoukai | SunDwarf/Kyoukai | test_kyoukai.py | test_kyoukai.py | """
py.test test suite for kyoukai
"""
import json
import pytest
from kyoukai.testing.testdata import kyk
@pytest.mark.asyncio
async def test_http_10():
response = await kyk.feed_request("GET / HTTP/1.0\n")
assert response.get_response_http_version() == "1.0"
assert response.code == 200
@pytest.mark.a... | """
py.test test suite for kyoukai
"""
import json
import pytest
try:
from http_parser.parser import HttpParser
except ImportError:
from http_parser.pyparser import HttpParser
from kyoukai.testing.testdata import kyk
@pytest.mark.asyncio
async def test_http_10():
response = await kyk.feed_request("GET ... | mit | Python |
855c4aa081f821cbfe295978283c1fdf390986d6 | Bump version number to v1.6.2 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/__init__.py | fpr/__init__.py | """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.6.2'
| """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.6.1'
| agpl-3.0 | Python |
c0cf37b017fa8abfd3e52adecbe4cede77090344 | swap arguments around again. This will allow easy autocompletion later on | SkaveRat/ansishell,SkaveRat/ansishell | ansishell.py | ansishell.py | #!/usr/bin/env python2
from ansible import inventory
import subprocess
import ConfigParser
import argparse
from os.path import expanduser, isfile
dotfile = ConfigParser.ConfigParser()
home = expanduser("~")
dotfile_path = home + "/.ansishell"
if not isfile(dotfile_path):
print("~/.ansishell config not found")
... | #!/usr/bin/env python2
from ansible import inventory
import subprocess
import ConfigParser
import argparse
from os.path import expanduser, isfile
dotfile = ConfigParser.ConfigParser()
home = expanduser("~")
dotfile_path = home + "/.ansishell"
if not isfile(dotfile_path):
print("~/.ansishell config not found")
... | mit | Python |
45ed884db0bc50b4ee807891d789bd925e671d11 | Bump version number to v1.7.0 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/__init__.py | fpr/__init__.py | """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.7.0'
| """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.6.2'
| agpl-3.0 | Python |
3c023c61ab04853014cc9276c159740e4c45cd09 | Update __init__.py | teaguesterling/aggregator-advisor-example,teaguesterling/aggregator-advisor-example | aggregatoradvisor/__init__.py | aggregatoradvisor/__init__.py | from core import (
app,
db,
login,
admin,
)
import models
import admin_ui
import views
| from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin import Admin
from flask.ext.login import LoginManager
import admin_auth
app = Flask(__name__)
app.config.from_object('aggregatoradvisor.config')
app.config.from_pyfile('aggregatoradvisor.cfg', silent=True)
app.config.from_envvar(... | mit | Python |
15e008255aab61711c01d54baeb9c887499527b2 | Enable hoverxref | bbatsche/Verify | docs/conf.py | docs/conf.py | import os, sys
from subprocess import Popen, PIPE
def get_version():
if os.environ.get('READTHEDOCS') == 'True':
return os.environ.get('READTHEDOCS_VERSION')
pipe = Popen('git branch | grep \*', stdout=PIPE,
shell=True, universal_newlines=True)
version = pipe.stdout.read()
if... | import os, sys
from subprocess import Popen, PIPE
def get_version():
if os.environ.get('READTHEDOCS') == 'True':
return os.environ.get('READTHEDOCS_VERSION')
pipe = Popen('git branch | grep \*', stdout=PIPE,
shell=True, universal_newlines=True)
version = pipe.stdout.read()
if... | mit | Python |
189f12b45e5641d4cfa2f8584840389572fefaaf | Update deprecated function-based generic views | rinfo/fst,rinfo/fst,kamidev/autobuild_fst,rinfo/fst,kamidev/autobuild_fst,rinfo/fst,kamidev/autobuild_fst,kamidev/autobuild_fst | fst_web/urls.py | fst_web/urls.py | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin
from adminplus import AdminSitePlus
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.base import TemplateView, RedirectView
from django.views.... | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin
from adminplus import AdminSitePlus
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.base import TemplateView, RedirectView
from django.views.... | bsd-3-clause | Python |
15aa8c66588c8350cf4d60ae13bdc08e527fced5 | Bump version number to 0.1a3 | jacebrowning/gdm-demo,jacebrowning/gitman,jacebrowning/gdm | gdm/__init__.py | gdm/__init__.py | """Package for GDM."""
import sys
__project__ = 'GDM'
__version__ = '0.1a3'
CLI = 'gdm'
VERSION = __project__ + '-' + __version__
DESCRIPTION = 'A very basic language-agnostic "dependency manager" using Git.'
PYTHON_VERSION = 3, 3
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exi... | """Package for GDM."""
import sys
__project__ = 'GDM'
__version__ = '0.1a2'
CLI = 'gdm'
VERSION = __project__ + '-' + __version__
DESCRIPTION = 'A very basic language-agnostic "dependency manager" using Git.'
PYTHON_VERSION = 3, 3
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exi... | mit | Python |
d1f69174a11e07d3535c008548564792f1a2d991 | add a missing module doc text | ssato/python-anyconfig,ssato/python-anyconfig | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
#
# pylint:disable=invalid-name
"""conf.py for sphinx."""
import sys
import pathlib
sys.path.insert(0, str(pathlib.Path(__file__).parent.resolve() / 'src'))
extensions = [
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints'
]
source_suffix = '.rst'
master_doc = 'index'
project = u'python... | # -*- coding: utf-8 -*-
#
# pylint:disable=invalid-name
import sys
import pathlib
sys.path.insert(0, str(pathlib.Path(__file__).parent.resolve() / 'src'))
extensions = [
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints'
]
source_suffix = '.rst'
master_doc = 'index'
project = u'python-anyconfig'
copyright = u'... | mit | Python |
8bf86544f41e668e46dcc06f2e6762ccf0be9eb2 | Change Sphinx documentation theme | xolox/python-humanfriendly,xolox/python-humanfriendly | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
"""Documentation build configuration file for the `humanfriendly` package."""
import os
import sys
# Add the 'humanfriendly' source distribution's root directory to the module path.
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration -----------------------------------------... | # -*- coding: utf-8 -*-
"""Documentation build configuration file for the `humanfriendly` package."""
import os
import sys
# Add the 'humanfriendly' source distribution's root directory to the module path.
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration -----------------------------------------... | mit | Python |
7eaf5e239fa544d9e2f975d3dcce3d3d7f599678 | Fix sendFrom initialisation | mailosaur/mailosaur-python,mailosaur/mailosaur-python | mailosaur/models/message_create_options.py | mailosaur/models/message_create_options.py | import json
class MessageCreateOptions(object):
"""MessageCreateOptions.
:param to: The email address to which the email will be sent. Must be a verified email address.
:type to: str
:param sendFrom: Allows for the partial override of the message's 'from' address. This **must** be an
address end... | import json
class MessageCreateOptions(object):
"""MessageCreateOptions.
:param to: The email address to which the email will be sent. Must be a verified email address.
:type to: str
:param sendFrom: Allows for the partial override of the message's 'from' address. This **must** be an
address end... | mit | Python |
384e5119506de8a3b95260cf644bef4fe6fd3b67 | fix args | danesjenovdan/badzet,danesjenovdan/badzet,danesjenovdan/badzet,danesjenovdan/badzet | django_app/badzet/views.py | django_app/badzet/views.py | from django.shortcuts import render
from django.forms.models import model_to_dict
from django.http import JsonResponse
import json
from .models import Budget
# Create your views here.
FIELDS = ['subject', 'konto', 'revenue_expenses', 'classification', 'name', 'money', 'year']
TEXT_FIELDS = ['subject', 'name', 'revenu... | from django.shortcuts import render
from django.forms.models import model_to_dict
from django.http import JsonResponse
import json
from .models import Budget
# Create your views here.
FIELDS = ['subject', 'konto', 'revenue_expenses', 'classification', 'name', 'money', 'year']
TEXT_FIELDS = ['subject', 'name', 'revenu... | unlicense | Python |
3d2edb23156acc3eeb06732598af457a031843be | Fix floatsabs checker accepting NaN | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/checkers/floatsabs.py | dmoj/checkers/floatsabs.py | from six.moves import zip, filter
def check(process_output, judge_output, precision, **kwargs):
process_lines = list(filter(None, process_output.split(b'\n')))
judge_lines = list(filter(None, judge_output.split(b'\n')))
if len(process_lines) != len(judge_lines):
return False
epsilon = 10 ** ... | from six.moves import zip, filter
def check(process_output, judge_output, precision, **kwargs):
process_lines = list(filter(None, process_output.split(b'\n')))
judge_lines = list(filter(None, judge_output.split(b'\n')))
if len(process_lines) != len(judge_lines):
return False
epsilon = 10 ** ... | agpl-3.0 | Python |
dedf4ca9d36f7cc25f03e5bac4a120b6a256a35f | Fix zero-length field error when building docs in Python 2.6 | STIXProject/python-stix,chriskiehl/python-stix | docs/conf.py | docs/conf.py | import os
import stix
project = u'python-stix'
copyright = u'2015, The MITRE Corporation'
version = stix.__version__
release = version
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.ifconfig',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon',
]... | import os
import stix
project = u'python-stix'
copyright = u'2015, The MITRE Corporation'
version = stix.__version__
release = version
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.ifconfig',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon',
]... | bsd-3-clause | Python |
53efdbc5114fdcb36ee848fb460d924cdc7e82ed | Remove some monkey patches | matthiask/feincms3,matthiask/feincms3,matthiask/feincms3 | tests/manage.py | tests/manage.py | #!/usr/bin/env python
import os
import sys
from os.path import abspath, dirname
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testapp.settings")
sys.path.insert(0, dirname(dirname(abspath(__file__))))
from django.core.management import execute_from_command_line
execute... | #!/usr/bin/env python
import os
import sys
from os.path import abspath, dirname
# Patch some stuff for Django 3.1 (because versatileimagefield isn't compatible yet)
try:
from django.utils import six # noqa
except ImportError:
import six
sys.modules["django.utils.six"] = six
try:
from django.utils.e... | bsd-3-clause | Python |
167bc3b36fe49ce0fbaaee4562de2b1a9bcac04e | Add more stub tests | singingwolfboy/invoke,kejbaly2/invoke,pfmoore/invoke,frol/invoke,pyinvoke/invoke,mattrobenolt/invoke,kejbaly2/invoke,mattrobenolt/invoke,tyewang/invoke,pyinvoke/invoke,sophacles/invoke,alex/invoke,pfmoore/invoke,mkusz/invoke,frol/invoke,mkusz/invoke | tests/parser.py | tests/parser.py | from spec import Spec, skip, ok_, eq_, raises
from invoke.parser import Parser, Context, Argument
from invoke.collection import Collection
class Parser_(Spec):
def can_take_initial_context(self):
c = Context()
p = Parser(initial=c)
eq_(p.initial, c)
def can_take_initial_and_other_con... | from spec import Spec, skip, ok_, eq_, raises
from invoke.parser import Parser, Context, Argument
from invoke.collection import Collection
class Parser_(Spec):
def can_take_initial_context(self):
c = Context()
p = Parser(initial=c)
eq_(p.initial, c)
def can_take_initial_and_other_con... | bsd-2-clause | Python |
7bde729300fb056e24405db9ad55de0963093e73 | remove faulty update syntax | harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity | api/views.py | api/views.py | from django.http import JsonResponse
from module.models import *
from module import utils
from lti.utils import grade_passback
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
## choose the recommendation service here
if settings.ACTIVITY_SERVICE is 'tutorgen':
from module imp... | from django.http import JsonResponse
from module.models import *
from module import utils
from lti.utils import grade_passback
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
## choose the recommendation service here
if settings.ACTIVITY_SERVICE is 'tutorgen':
from module imp... | bsd-3-clause | Python |
332fadd1f232ac2a79ef19de4b5358b75735442d | add newline | pansapiens/mytardis,pansapiens/mytardis,pansapiens/mytardis,pansapiens/mytardis | tardis/tardis_portal/models/instrument.py | tardis/tardis_portal/models/instrument.py | from django.db import models
from tardis.tardis_portal.models import Facility
class Instrument(models.Model):
'''
Represents an instrument belonging to a facility that produces data
'''
name = models.CharField(max_length=100, unique=True)
facility = models.ForeignKey(Facility)
class Meta:
... | from django.db import models
from tardis.tardis_portal.models import Facility
class Instrument(models.Model):
'''
Represents an instrument belonging to a facility that produces data
'''
name = models.CharField(max_length=100, unique=True)
facility = models.ForeignKey(Facility)
class Meta:
... | bsd-3-clause | Python |
e2cd4678aa25bcbdaadd8e3892cf0d681b9db1e7 | Select empty recordset if that case happens, instead of excepting. | open-synergy/event,open-synergy/event | event_registration_cancel_reason/wizard/event_registration_cancel_log_reason.py | event_registration_cancel_reason/wizard/event_registration_cancel_log_reason.py | # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L.
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import _, api, exceptions, fields, models
class EventRegistrationCancelLogReason(models.TransientModel):
_name = 'event.re... | # -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L.
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import _, api, exceptions, fields, models
class EventRegistrationCancelLogReason(models.TransientModel):
_name = 'event.re... | agpl-3.0 | Python |
b4e44a9c6cb8a7598c81c526d1ddea135ff17bc9 | Include default acCD threshold in ricdwrap format so that it's obvious that the value can be modified by the user | MOLSSI-BSE/basis_set_exchange | basis_set_exchange/writers/ricdwrap.py | basis_set_exchange/writers/ricdwrap.py | '''
This is a wrapper for generating acCD basis sets with OpenMolcas
'''
from .. import lut, manip, printing, misc, sort
def write_ricdwrap(basis):
'''Generates an input file for OpenMolcas that generates the acCD basis
'''
basis = manip.make_general(basis, False, True)
basis = sort.sort_basis(basis... | '''
This is a wrapper for generating acCD basis sets with OpenMolcas
'''
from .. import lut, manip, printing, misc, sort
def write_ricdwrap(basis):
'''Generates an input file for OpenMolcas that generates the acCD basis
'''
basis = manip.make_general(basis, False, True)
basis = sort.sort_basis(basis... | bsd-3-clause | Python |
9810cf40300b2a0ce83d22128b80ccbe5e4ca163 | Change type from int to long for integers | admk/soap | expr/parser.py | expr/parser.py | #!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
from common import OPERATORS
def _to_number(s):
try:
return long(s)
except ValueError:
return float(s)
def _try_to_number(s):
try:
return _to_number(s)
except (ValueError, TypeError):
return s
def _parse_r(s):
... | #!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
from common import OPERATORS
def _to_number(s):
try:
return int(s)
except ValueError:
return float(s)
def _try_to_number(s):
try:
return _to_number(s)
except (ValueError, TypeError):
return s
def _parse_r(s):
... | mit | Python |
8482dce74d3d6fe3d19af668db91f26b8608b14f | Remove rc module from __all__ list, no point to have it listed there | pressel/mpi4py,mpi4py/mpi4py,mpi4py/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py,pressel/mpi4py | src/__init__.py | src/__init__.py | # Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
"""
This is the **MPI for Python** package.
What is *MPI*?
==============
The *Message Passing Interface*, is a standardized and portable
message-passing system designed to function on a wide variety of
parallel computers. The standard defines the syntax and sem... | # Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
"""
This is the **MPI for Python** package.
What is *MPI*?
==============
The *Message Passing Interface*, is a standardized and portable
message-passing system designed to function on a wide variety of
parallel computers. The standard defines the syntax and sem... | bsd-2-clause | Python |
126d2ff2b2bc8ac50c97476529e09027ba43cca0 | Update to version v0.9.0.dev | alexhersh/calico-docker,tomdee/calico-docker,insequent/calico-docker,robbrockbank/calico-docker,robbrockbank/calico-containers,caseydavenport/calico-docker,tomdee/calico-containers,TrimBiggs/calico-containers,Metaswitch/calico-docker,projectcalico/calico-docker,projectcalico/calico-containers,caseydavenport/calico-cont... | calico_containers/calico_ctl/__init__.py | calico_containers/calico_ctl/__init__.py | __version__ = "0.9.0.dev"
| __version__ = "0.8.0.dev"
| apache-2.0 | Python |
13a7b771be80625b15856d5343be5fa9c695ab29 | Fix status message when header is colored | Brickstertwo/git-commands | bin/commands/stateextensions/status.py | bin/commands/stateextensions/status.py | import os
import re
from ast import literal_eval
from subprocess import call, check_output, Popen, PIPE
from colorama import Fore
def _set_color_status(show_color):
# make sure status will output ANSI codes
# this must be done using config since status has no --color option
status_color = Popen(['git', ... | import os
from ast import literal_eval
from subprocess import call, check_output, Popen, PIPE
from colorama import Fore
def _set_color_status(show_color):
# make sure status will output ANSI codes
# this must be done using config since status has no --color option
status_color = Popen(['git', 'config', ... | mit | Python |
5931aafef9026998d6ba43142ee71c090d69dc45 | put these functions into a slightly more logical place | jameshensman/pymc3,wanderer2/pymc3,kyleam/pymc3,dhiapet/PyMC3,Anjum48/pymc3,LoLab-VU/pymc,LoLab-VU/pymc,JesseLivezey/pymc3,tyarkoni/pymc3,MichielCottaar/pymc3,clk8908/pymc3,arunlodhi/pymc3,superbobry/pymc3,kyleam/pymc3,hothHowler/pymc3,hothHowler/pymc3,Anjum48/pymc3,jameshensman/pymc3,tyarkoni/pymc3,arunlodhi/pymc3,wan... | mcex/misc.py | mcex/misc.py | '''
Created on Jul 5, 2012
@author: jsalvatier
'''
import numpy as np
def make_univariate(var, idx, C, f):
"""
convert a function that takes a parameter point into one that takes a single value
for a specific parameter holding all the other parameters constant.
"""
def univariate(x):
c = C... | '''
Created on Jul 5, 2012
@author: jsalvatier
'''
import numpy as np
def make_univariate(var, idx, C, f):
def univariate(x):
c = C.copy()
v = c[var].copy()
v[idx] = x
c[var] = v
return f(c)
return univariate
def hist_covar(hist, vars):
def flat_h(var):... | apache-2.0 | Python |
a2e4e8593ec4c09d504b74544b134d27d1428ce3 | Include flux package in doc | arokem/PyEMMA,trendelkampschroer/PyEMMA,trendelkampschroer/PyEMMA,arokem/PyEMMA | emma2/msm/flux/__init__.py | emma2/msm/flux/__init__.py | r"""
===================================================================
flux - Reactive flux an transition pathways (:mod:`emma2.msm.flux`)
===================================================================
.. currentmodule:: emma2.msm.flux
This module contains functions to compute reactive flux networks and
find ... | from .api import *
| bsd-2-clause | Python |
5ae5c27f69cdfb1c53ada0a2aa90d76c4d3ce421 | Use regexp for checking the line | innogames/igcollect | memcached.py | memcached.py | #!/usr/bin/env python
#
# igcollect - Memcached
#
# Copyright (c) 2016, InnoGames GmbH
#
import telnetlib
import sys
import socket
import time
import re
def main(host='127.0.0.1', port='11211'):
hostname = socket.gethostname().replace('.', '_')
ts = str(int(time.time()))
template = 'servers.' + hostname ... | #!/usr/bin/env python
#
# igcollect - Memcached
#
# Copyright (c) 2016, InnoGames GmbH
#
import telnetlib
import sys
import socket
import time
def main(host='127.0.0.1', port='11211'):
hostname = socket.gethostname().replace('.', '_')
ts = str(int(time.time()))
template = 'servers.' + hostname + '.softwa... | mit | Python |
9af0d77de1547a4f68f57501e50ee5f5b494dedf | remove reference to subnet | jermowery/xos,xmaruto/mcord,wathsalav/xos,opencord/xos,opencord/xos,opencord/xos,open-cloud/xos,wathsalav/xos,open-cloud/xos,wathsalav/xos,cboling/xos,zdw/xos,zdw/xos,cboling/xos,xmaruto/mcord,cboling/xos,zdw/xos,xmaruto/mcord,jermowery/xos,open-cloud/xos,cboling/xos,cboling/xos,jermowery/xos,zdw/xos,wathsalav/xos,jerm... | plstackapi/core/models/__init__.py | plstackapi/core/models/__init__.py | from plstackapi.core.models.plcorebase import PlCoreBase
from plstackapi.core.models.deploymentnetwork import DeploymentNetwork
from plstackapi.core.models.site import Site
from plstackapi.core.models.site import SitePrivilege
from plstackapi.core.models.image import Image
from plstackapi.core.models.pluser import PLUs... | from plstackapi.core.models.plcorebase import PlCoreBase
from plstackapi.core.models.deploymentnetwork import DeploymentNetwork
from plstackapi.core.models.site import Site
from plstackapi.core.models.site import SitePrivilege
from plstackapi.core.models.image import Image
from plstackapi.core.models.pluser import PLUs... | apache-2.0 | Python |
0ec37337e43e5652098fc1c34cc07d7be3133066 | add TestAmbulanceCallTimeSerializer, update call Serializer | EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient | ambulance/tests/test_calls.py | ambulance/tests/test_calls.py | from ambulance.models import Call, Patient
from ambulance.serializers import CallSerializer
from emstrack.tests.util import date2iso, point2str, dict2point
from django.test import Client
from django.utils import timezone
from django.conf import settings
from rest_framework.parsers import JSONParser
from io import Bytes... | from ambulance.models import Call, Patient
from ambulance.serializers import CallSerializer
from emstrack.tests.util import date2iso, point2str, dict2point
from django.test import Client
from django.utils import timezone
from django.conf import settings
from rest_framework.parsers import JSONParser
from io import Bytes... | bsd-3-clause | Python |
a4e6643fdd50f2ecbd61a6429d02673dac834129 | Speed up the tile entry script by using a spatial filter | simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic | tiled-bounds.py | tiled-bounds.py | #!/usr/bin/env python
from osgeo import ogr
from osgeo import osr
from osgeo import gdal
import os.path
import os
import shutil
STEP = 10000
MINX = 180000 #189774.764105
MINY = 4810000 #4816337.325688
MAXX = 770000 #761944.028930
MAXY = 5480000 #5472405.931701
shutil.rmtree('tile-entries', True)
os.mkdir('tile-entrie... | #!/usr/bin/env python
from osgeo import ogr
from osgeo import osr
from osgeo import gdal
import os.path
import os
import shutil
STEP = 10000
MINX = 180000 #189774.764105
MINY = 4810000 #4816337.325688
MAXX = 770000 #761944.028930
MAXY = 5480000 #5472405.931701
shutil.rmtree('tile-entries', True)
os.mkdir('tile-entrie... | mit | Python |
f59e9b59189da6380d43c3506bbc6fd0768285cf | return !changed url to string! | ztp99/pyweb,ztp99/pyweb,ztp99/pyweb,zatuper/pywebstepic,zatuper/pywebstepic,zatuper/pywebstepic | etc/hello.py | etc/hello.py |
CONFIG = {
'mode': 'wsgi',
'working_dir': '/path/to/my/app',
'python': '/usr/bin/python',
'args': (
'--bind=127.0.0.1:8080',
'--workers=16',
'--timeout=60',
'app.module',
),
}
def application(env, start_response):
url = []
start_response('200 OK', [('Content... |
CONFIG = {
'mode': 'wsgi',
'working_dir': '/path/to/my/app',
'python': '/usr/bin/python',
'args': (
'--bind=127.0.0.1:8080',
'--workers=16',
'--timeout=60',
'app.module',
),
}
def application(env, start_response):
# url = []
start_response('200 OK', [('Conten... | apache-2.0 | Python |
3863bda6af40f62e49f4883468f4947d46f0cccc | Update dsub version to 0.3.6 | DataBiosphere/dsub,DataBiosphere/dsub | dsub/_dsub_version.py | dsub/_dsub_version.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
9a791b9c5e79011edaa2a9d2f25bf92e0bf17543 | Make sure version is initialized | erlware-deprecated/sinan,erlware-deprecated/sinan,ericbmerritt/sinan,ericbmerritt/sinan,erlware-deprecated/sinan,ericbmerritt/sinan | client/libsinan/version_check_handler.py | client/libsinan/version_check_handler.py | import libsinan
from libsinan import handler, output, jsax
class VersionCheckTaskHandler(output.SimpleTaskHandler):
def __init__(self):
output.SimpleTaskHandler.__init__(self)
self.version = None
def object_end(self):
""" We only get one object per right now so
lets print it ... | import libsinan
from libsinan import handler, output, jsax
class VersionCheckTaskHandler(output.SimpleTaskHandler):
def object_end(self):
""" We only get one object per right now so
lets print it out when we get it """
if self.task == "version":
if self.event_type == 'info':... | mit | Python |
d26fa6f1cbeff1cdaae85eb16d9896e73c253638 | Use Snowball Stemmer | pprakhar30/MOQA | documents.py | documents.py | import gzip
import json
import nltk
import numpy as np
from collections import defaultdict
from nltk.stem import SnowballStemmer
from utils import check_sent, normalize
from nltk.tokenize import RegexpTokenizer
tokenizer = RegexpTokenizer(r'\w+')
stemmer = SnowballStemmer("english")
class QAdoc:
def __init__(s... | import gzip
import json
import nltk
import numpy as np
from collections import defaultdict
from nltk.stem import SnowballStemmer
from utils import check_sent, normalize
from nltk.tokenize import RegexpTokenizer
tokenizer = RegexpTokenizer(r'\w+')
stemmer = SnowballStemmer("english")
class QAdoc:
def __init__(s... | mit | Python |
ace28383b70e593ee20651dc0486d71c2643ba0b | Add dijkstraPQ method. | efrainc/data_structures | simple_graph/shortest_path.py | simple_graph/shortest_path.py | from weighted_graph import Wgraph
import copy
def dijkstra(weighted_graph, start, end):
list_of_tuples_node_totalweight = []
list_of_tuples_node_totalweight.append((start, 0))
# weight_dict[start] = 0 # total weight/distance
prev = [] # previous node
# unvisited = []
for nod... | from weighted_graph import Wgraph
import copy
def dijkstra(weighted_graph, start, end):
list_of_tuples_node_totalweight = []
list_of_tuples_node_totalweight.append((start, 0))
# weight_dict[start] = 0 # total weight/distance
prev = [] # previous node
# unvisited = []
for nod... | mit | Python |
6b5cf5cedea127187270275bc4753ce693e0bae8 | Add missing properties to InvestmentAgreementTO | threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend | plugins/tff_backend/to/investor.py | plugins/tff_backend/to/investor.py | # -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | # -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | bsd-3-clause | Python |
35b9dafdbe8cbae4f02da8ff550d21877e65d478 | correct views.py | abonte/southtyrolean-healthservices-waitingtimes,abonte/southtyrolean-healthservices-waitingtimes,abonte/southtyrolean-healthservices-waitingtimes | app/views.py | app/views.py | from flask import render_template
from app import app
import requests
import demjson
from .forms import SearchForm
import json
@app.route('/', methods=('GET', 'POST'))
@app.route('/submit', methods=('GET', 'POST'))
def submit():
form = SearchForm()
r = requests.get('http://daten.buergernetz.bz.it/services/Wai... | from flask import render_template
from app import app
import requests
import demjson
from .forms import SearchForm
import json
@app.route('/', methods=('GET', 'POST'))
@app.route('/submit', methods=('GET', 'POST'))
def submit():
form = SearchForm()
r = requests.get('http://daten.buergernetz.bz.it/services/Wai... | mit | Python |
20921b7b131d640d5f70d97f61e95f63a191d706 | add some inline documentation | wxs/keras,dxj19831029/keras,ledbetdr/keras,relh/keras,jonberliner/keras,OlafLee/keras,ml-lab/keras,stephenbalaban/keras,iamtrask/keras,kemaswill/keras,xiaoda99/keras,Aureliu/keras,llcao/keras,dribnet/keras,jalexvig/keras,untom/keras,keskarnitish/keras,jimgoo/keras,nzer0/keras,saurav111/keras,kuza55/keras,brainwater/ker... | tests/auto/keras/layers/test_recurrent.py | tests/auto/keras/layers/test_recurrent.py | import unittest
import numpy as np
import theano
from keras.layers import recurrent
nb_samples, timesteps, input_dim, output_dim = 3, 3, 10, 5
def _runner(layer_class):
"""
All the recurrent layers share the same interface, so we can run through them with a single
function.
"""
for weights in [N... | import unittest
import numpy as np
import theano
from keras.layers import recurrent
nb_samples, timesteps, input_dim, output_dim = 3, 3, 10, 5
def _runner(layer_class):
for weights in [None, [np.ones((input_dim, output_dim))]]:
for ret_seq in [True, False]:
layer = layer_class(input_dim, out... | mit | Python |
8fb22eea3566bb935390ed97a626fccf20f5ab70 | fix old currsession reference and old useage of autoload_server and session | quasiben/bokeh,DuCorey/bokeh,gpfreitas/bokeh,jakirkham/bokeh,mindriot101/bokeh,ptitjano/bokeh,maxalbert/bokeh,rs2/bokeh,maxalbert/bokeh,azjps/bokeh,mindriot101/bokeh,phobson/bokeh,philippjfr/bokeh,timsnyder/bokeh,aavanian/bokeh,KasperPRasmussen/bokeh,timsnyder/bokeh,bokeh/bokeh,philippjfr/bokeh,jakirkham/bokeh,dennisob... | examples/embed/animated.py | examples/embed/animated.py | # The bokeh-server must be running to see this example
from __future__ import print_function
from bokeh.plotting import figure, output_server, show, curdoc
from bokeh.models import GlyphRenderer
import bokeh.embed as embed
from bokeh.client import push_session
import time
from numpy import pi, cos, sin, linspace, ro... | # The bokeh-server must be running to see this example
from __future__ import print_function
from bokeh.plotting import cursession, figure, output_server, show, push
from bokeh.models import GlyphRenderer
import bokeh.embed as embed
import time
from numpy import pi, cos, sin, linspace, roll
N = 50 + 1
r_base = 8
th... | bsd-3-clause | Python |
5abe9a29ae586907304649fe6682e3e8997da310 | Update stream name to Replay | vprnet/audio-player,vprnet/audio-player,vprnet/audio-player | app/views.py | app/views.py | from index import app
from flask import render_template, request
from config import BASE_URL
from query import get_callout, get_billboard
SHEET_ID = 'tzE2PsqJoWRpENlMr-ZlS8A'
#SHEET_ID = 'tIk5itVcfOHUmakkmpjCcxw' # Demo sheet
@app.route('/')
def index():
page_url = BASE_URL + request.path
page_title = 'Audi... | from index import app
from flask import render_template, request
from config import BASE_URL
from query import get_callout, get_billboard
SHEET_ID = 'tzE2PsqJoWRpENlMr-ZlS8A'
#SHEET_ID = 'tIk5itVcfOHUmakkmpjCcxw' # Demo sheet
#@app.route('/')
#def index():
# page_url = BASE_URL + request.path
# page_title = '... | apache-2.0 | Python |
d0fbd2851fa435918951e4e04dd55f8f4ff3a23d | Revert "[#4] handle not available user. better indentation of code" | zpidreamteam/ZPI,zpidreamteam/ZPI,zpidreamteam/ZPI | app/views.py | app/views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm
from forms import LoginForm, RegisterForm
from models import User
@app.before_request
def before_request():
g.user = current... | from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm
from forms import LoginForm, RegisterForm
from models import User
@app.before_request
def before_request():
g.user = current_u... | mit | Python |
ffcdbed1a84187a516be7af1f29224a479625bea | duplicate imports | amcsorley/aapi,amcsorley/aapi | aapi/aapi_util.py | aapi/aapi_util.py | import os, sys, errno
class mkDir:
def __init__(self, path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise
class forkIt:
def __init__(self, it, pidfile):
try:
... | import os, errno
class mkDir:
def __init__(self, path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise
class forkIt:
def __init__(self, it, pidfile):
import sys, o... | apache-2.0 | Python |
37bdfff3f1525086a7a46f46154574c963f5a7e5 | add unit test to functional_tests.py | StuJ/collator,StuJ/collator,StuJ/collator,StuJ/collator | collator/users/tests/functional_tests.py | collator/users/tests/functional_tests.py | from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_create_node_and_retrieve_it_later(self):
self.browser.get('http://localhost:8000')
... | from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'Django' in browser.title
| mit | Python |
a63a8e7d46a31d84293c67230fe80d00bea8fc17 | Fix project root and image side settings | alexmic/great-again,alexmic/great-again | ga/settings.py | ga/settings.py | # -*- coding: utf-8 -*-
import os
env = os.environ
PROJECT_ROOT = env.get('GA_PROJECT_ROOT', 'great-again')
DEBUG = env.get('GA_DEBUG', 'true') == 'true'
TESTING = env.get('GA_TESTING', '') == 'true'
SERVER_NAME = env.get('GA_SERVER_NAME', 'localhost:5000')
SECRET_KEY = '4\xc8Dq\x04R>\x8a\x02\xd5\x95\x0eDx\xd4&\xe5... | # -*- coding: utf-8 -*-
import os
env = os.environ
PROJECT_ROOT = env.get('GA_PROJECT_ROOT', 'ga')
DEBUG = env.get('GA_DEBUG', 'true') == 'true'
TESTING = env.get('GA_TESTING', '') == 'true'
SERVER_NAME = env.get('GA_SERVER_NAME', 'localhost:5000')
SECRET_KEY = '4\xc8Dq\x04R>\x8a\x02\xd5\x95\x0eDx\xd4&\xe5\x83\xf6T... | mit | Python |
738b0e1344572d000f51e862000fb719c7035c2c | Fix rules engine version reporting. | Itxaka/st2,punalpatel/st2,grengojbo/st2,grengojbo/st2,jtopjian/st2,nzlosh/st2,lakshmi-kannan/st2,peak6/st2,jtopjian/st2,peak6/st2,alfasin/st2,jtopjian/st2,Itxaka/st2,Itxaka/st2,pinterb/st2,StackStorm/st2,punalpatel/st2,tonybaloney/st2,punalpatel/st2,pixelrebel/st2,StackStorm/st2,pixelrebel/st2,lakshmi-kannan/st2,StackS... | st2reactor/st2reactor/cmd/rulesengine.py | st2reactor/st2reactor/cmd/rulesengine.py | import os
import sys
from oslo.config import cfg
from st2common import log as logging
from st2common.models.db import db_setup
from st2common.models.db import db_teardown
from st2common.constants.logging import DEFAULT_LOGGING_CONF_PATH
from st2reactor.rules import config
from st2reactor.rules import worker
LOG = lo... | import os
from oslo.config import cfg
from st2common import log as logging
from st2common.models.db import db_setup
from st2common.models.db import db_teardown
from st2common.constants.logging import DEFAULT_LOGGING_CONF_PATH
from st2reactor.rules import config
from st2reactor.rules import worker
LOG = logging.getLo... | apache-2.0 | Python |
248ec2691eed49911fb12409199bb3a874fa0a9b | Rework unit test | eugeneia/snabb,dpino/snabbswitch,Igalia/snabb,dpino/snabbswitch,alexandergall/snabbswitch,SnabbCo/snabbswitch,snabbco/snabb,alexandergall/snabbswitch,heryii/snabb,heryii/snabb,eugeneia/snabbswitch,dpino/snabb,dpino/snabb,Igalia/snabb,snabbco/snabb,Igalia/snabbswitch,SnabbCo/snabbswitch,alexandergall/snabbswitch,snabbco... | src/program/lwaftr/tests/subcommands/run_nohw_test.py | src/program/lwaftr/tests/subcommands/run_nohw_test.py | """
Test the "snabb lwaftr run-nohw" subcommand.
"""
import unittest
from random import randint
from subprocess import call, check_call
from test_env import DATA_DIR, SNABB_CMD, BaseTestCase
class TestRun(BaseTestCase):
cmd_args = [
str(SNABB_CMD), 'lwaftr', 'run-nohw',
]
cmd_options = {
... | """
Test the "snabb lwaftr run_nohw" subcommand.
"""
import unittest
from random import randint
from subprocess import call, check_call
from test_env import DATA_DIR, SNABB_CMD, BaseTestCase
class TestRun(BaseTestCase):
program = [
str(SNABB_CMD), 'lwaftr', 'run_nohw',
]
cmd_args = {
'--... | apache-2.0 | Python |
fa674e918e3298eb00eb036b94a39a8b16a21198 | Fix typo in example/controller.py | juju/python-libjuju,juju/python-libjuju | examples/controller.py | examples/controller.py | """
This example:
1. Connects to current controller.
2. Creates a new model.
3. Deploys an application on the new model.
"""
import asyncio
import logging
from juju.model import Model, ModelObserver
from juju.controller import Controller
class MyModelObserver(ModelObserver):
async def on_change(self, delta, ol... | """
This example:
1. Connects to current controller.
2. Creates a new model.
3. Deploys an application on the new model.
"""
import asyncio
import logging
from juju.model import Model, ModelObserver
from juju.controller import Controller
class MyModelObserver(ModelObserver):
async def on_change(self, delta, ol... | apache-2.0 | Python |
5434ed53ff3e4831b93ac4a51963332ec8643473 | Add missing return values | libvirt/libvirt-python,libvirt/libvirt-python,libvirt/libvirt-python | examples/dhcpleases.py | examples/dhcpleases.py | #!/usr/bin/env python3
# netdhcpleases - print leases info for given virtual network
import libvirt
import sys
import time
def usage():
print("Usage: %s [URI] NETWORK" % sys.argv[0])
print(" Print leases info for a given virtual network")
uri = None
network = None
args = len(sys.argv)
if args == 2:
... | #!/usr/bin/env python3
# netdhcpleases - print leases info for given virtual network
import libvirt
import sys
import time
def usage():
print("Usage: %s [URI] NETWORK" % sys.argv[0])
print(" Print leases info for a given virtual network")
uri = None
network = None
args = len(sys.argv)
if args == 2:
... | lgpl-2.1 | Python |
0eeb9112afd3983149f03241d26ff179ea43d980 | fix type name | mgx2/python-nvd3,pignacio/python-nvd3,yelster/python-nvd3,pignacio/python-nvd3,vdloo/python-nvd3,Coxious/python-nvd3,vdloo/python-nvd3,oz123/python-nvd3,oz123/python-nvd3,BibMartin/python-nvd3,Coxious/python-nvd3,liang42hao/python-nvd3,vdloo/python-nvd3,mgx2/python-nvd3,BibMartin/python-nvd3,yelster/python-nvd3,liang42... | examples/examples01.py | examples/examples01.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | mit | Python |
6a6310f1c9bc76363b2aa2aa33d154b2ac624ed9 | fix cache.purge method for integration teets under multi CPU | thomasyu888/synapsePythonClient | tests/integration/synapseclient/core/test_download.py | tests/integration/synapseclient/core/test_download.py | import filecmp
import os
import tempfile
import shutil
import pytest
from synapseclient import File
from synapseclient.core.exceptions import SynapseMd5MismatchError
import synapseclient.core.utils as utils
def test_download_check_md5(syn, project, schedule_for_cleanup):
tempfile_path = utils.make_bogus_data_fi... | import filecmp
import os
import tempfile
import shutil
import time
import pytest
from synapseclient import File
from synapseclient.core.exceptions import SynapseMd5MismatchError
import synapseclient.core.utils as utils
def test_download_check_md5(syn, project, schedule_for_cleanup):
tempfile_path = utils.make_b... | apache-2.0 | Python |
3d82ce211148f98319656cf4f4b4e358f4d6367b | Implement blueprint on stock indicators | z0rkuM/stockbros,z0rkuM/stockbros,z0rkuM/stockbros,z0rkuM/stockbros | StockBros.py | StockBros.py | #!flask/bin/python
from flask import Flask, abort, jsonify, make_response, url_for, request
from StockIndicators.StockIndicators import *
from flask_httpauth import HTTPBasicAuth
from datetime import datetime
import pymongo
from dbWrapper import db
from util import *
#Create application object
app = Flask(__name__)
#... | #!flask/bin/python
from flask import Flask, abort, jsonify, make_response, url_for, request
from flask_httpauth import HTTPBasicAuth
from datetime import datetime
import pymongo
from dbWrapper import db
from util import *
#Create application object
app = Flask(__name__)
auth = HTTPBasicAuth()
#####################
#... | mit | Python |
cee09a2d53f96779351145bc1e51a231500212bf | Update gdb.py | vadimkantorov/wigwam | wigs/gdb.py | wigs/gdb.py | class gdb(Wig):
tarball_uri = 'http://ftp.gnu.org/gnu/gdb/gdb-$RELEASE_VERSION$.tar.gz'
last_release_version = 'v7.12'
dependencies = ['texinfo']
| class gdb(Wig):
tarball_uri = 'http://ftp.gnu.org/gnu/gdb/gdb-$RELEASE_VERSION$.tar.gz'
last_release_version = 'v7.10.1'
dependencies = ['texinfo']
| mit | Python |
27590fea8b34f95fc4419524db18cc5053699bee | Drop redundant comment. | HireAnEsquire/django-rest-framework,hunter007/django-rest-framework,ebsaral/django-rest-framework,jerryhebert/django-rest-framework,atombrella/django-rest-framework,gregmuellegger/django-rest-framework,ambivalentno/django-rest-framework,fishky/django-rest-framework,kylefox/django-rest-framework,andriy-s/django-rest-fra... | djangorestframework/status.py | djangorestframework/status.py | """
Descriptive HTTP status codes, for code readability.
See RFC 2616 - Sec 10: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Also see django.core.handlers.wsgi.STATUS_CODE_TEXT
"""
HTTP_100_CONTINUE = 100
HTTP_101_SWITCHING_PROTOCOLS = 101
HTTP_200_OK = 200
HTTP_201_CREATED = 201
HTTP_202_ACCEPTED = 202
HTT... | """
Descriptive HTTP status codes, for code readability.
See RFC 2616 - Sec 10: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Also see django.core.handlers.wsgi.STATUS_CODE_TEXT
"""
# Verbose format
HTTP_100_CONTINUE = 100
HTTP_101_SWITCHING_PROTOCOLS = 101
HTTP_200_OK = 200
HTTP_201_CREATED = 201
HTTP_202_A... | bsd-2-clause | Python |
77b5680794a7a60dedf687f4a199e48121f96955 | Add sets + a float value to the benchmark. | yuecong/dd-agent,darron/dd-agent,oneandoneis2/dd-agent,AniruddhaSAtre/dd-agent,packetloop/dd-agent,remh/dd-agent,guruxu/dd-agent,jyogi/purvar-agent,relateiq/dd-agent,JohnLZeller/dd-agent,citrusleaf/dd-agent,lookout/dd-agent,citrusleaf/dd-agent,zendesk/dd-agent,zendesk/dd-agent,JohnLZeller/dd-agent,oneandoneis2/dd-agent... | tests/performance/benchmark_aggregator.py | tests/performance/benchmark_aggregator.py | """
Performance tests for the agent/dogstatsd metrics aggregator.
"""
from aggregator import MetricsAggregator
class TestAggregatorPerf(object):
def test_aggregation_performance(self):
ma = MetricsAggregator('my.host')
flush_count = 10
loops_per_flush = 10000
metric_count = 5... | """
Performance tests for the agent/dogstatsd metrics aggregator.
"""
from aggregator import MetricsAggregator
class TestAggregatorPerf(object):
def test_aggregation_performance(self):
ma = MetricsAggregator('my.host')
flush_count = 10
loops_per_flush = 10000
metric_count = 5... | bsd-3-clause | Python |
e8f4c3d44265efdfbc30d2a7e54f7d28c075b14a | support str node | hiroara/tree-python,hiroara/tree-python | tree/builder.py | tree/builder.py | from .structs import Tree, LeafTree, LeafNode
def build_tree(data, root_value=None):
return Tree(root_value, __build_children(data))
def __build_children(data):
if __is_as_dict(data):
return [__build_child(key, val) for (key, val) in sorted(data.items(), key=lambda item: item[0])]
elif __is_as_l... | from .structs import Tree, LeafTree, LeafNode
def build_tree(data, root_value=None):
return Tree(root_value, __build_children(data))
def __build_children(data):
if __is_as_dict(data):
return [__build_child(key, val) for (key, val) in sorted(data.items(), key=lambda item: item[0])]
elif __is_as_l... | mit | Python |
160e618bf5d6a255fd33be45bd18737e3185ce07 | fix imports | jkafader/trough,jkafader/trough | trough/write.py | trough/write.py | #!/usr/bin/env python3
import trough
from trough.settings import settings
import sqlite3
import ujson
import os
import sqlparse
import logging
import consulate
import urllib
class WriteServer:
def write(self, segment, query):
logging.info('Servicing request: {query}'.format(query=query))
# if one o... | #!/usr/bin/env python3
import trough
from trough.settings import settings
import sqlite3
import ujson
import os
import sqlparse
import logging
import consulate
class WriteServer:
def write(self, segment, query):
logging.info('Servicing request: {query}'.format(query=query))
# if one or more of the ... | bsd-2-clause | Python |
e78f3ed040e95a31bff7c78db80aca9916774b94 | Update armadillo (#14499) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/armadillo/package.py | var/spack/repos/builtin/packages/armadillo/package.py | # Copyright 2013-2020 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 Armadillo(CMakePackage):
"""Armadillo is a high quality linear algebra library (matrix mat... | # Copyright 2013-2020 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 Armadillo(CMakePackage):
"""Armadillo is a high quality linear algebra library (matrix mat... | lgpl-2.1 | Python |
87420dccee42dfc51aa1844fb28ae6e2ecfc6333 | Add version 2.27.1 (#6693) | EmreAtes/spack,krafczyk/spack,EmreAtes/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,LLNL/spack,iulian787/spack,EmreAtes/spack,krafczyk/spack,iulian787/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,tmerrick1/spack,matthiasdiener/spack,iulian787/spack,LLNL/spack,tmerrick1/spack,matthiasdiener/spack,LLNL/spack,ma... | var/spack/repos/builtin/packages/bedtools2/package.py | var/spack/repos/builtin/packages/bedtools2/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
6f4b7870f20865132040d2d301ea4d773db45434 | Fix checksum error (#21457) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/http-ping/package.py | var/spack/repos/builtin/packages/http-ping/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import datetime
class HttpPing(MakefilePackage):
"""http_ping is like the regular ping command, ... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import datetime
class HttpPing(MakefilePackage):
"""http_ping is like the regular ping command, ... | lgpl-2.1 | Python |
8b890db50ffc15f46583d134af942e6479c87cec | add java dependency so jni hooks get built (#8524) | iulian787/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,iulian787/spack,iulian787/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,mfherbst/spack,LLNL/spack,LLNL/spack,mfherbst/spack,LLNL/spack | var/spack/repos/builtin/packages/libbeagle/package.py | var/spack/repos/builtin/packages/libbeagle/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
05cbc08e200472345a56b3ce38d5289b292de241 | Update tokenizer.py | Anson-Doan/py_stringmatching,anhaidgroup/py_stringmatching | py_stringmatching/tokenizer/tokenizer.py | py_stringmatching/tokenizer/tokenizer.py | """Tokenizer"""
class Tokenizer(object):
"""Tokenizer class.
Parameters:
return_set (boolean): an attribute which is a flag to indicate whether to return a set of
tokens instead of a bag of tokens (defaults to False).
"""
def __init__(self, return_set=False):
... | """Tokenizer"""
class Tokenizer(object):
"""Tokenizer class.
Parameters:
return_set (boolean): flag to indicate whether to return a set of
tokens. (defaults to False)
"""
def __init__(self, return_set=False):
self.return_set = return_set
def get_retu... | bsd-3-clause | Python |
21270397fb8d1f4b5ea9ea840c4e14c8ed97ea74 | Fix authentication selenium test | jucacrispim/toxicbuild,jucacrispim/toxicbuild,jucacrispim/toxicbuild,jucacrispim/toxicbuild | tests/webui/steps/authentication_steps.py | tests/webui/steps/authentication_steps.py | # -*- coding: utf-8 -*-
import time
from behave import when, then, given
from toxicbuild.ui import settings
from tests.webui.steps.base_steps import ( # noqa f811
given_logged_in_webui, user_sees_main_main_page_login)
# Scenario: Someone try to access a page without being logged.
@when('someone tries to access... | # -*- coding: utf-8 -*-
import time
from behave import when, then, given
from toxicbuild.ui import settings
from tests.webui.steps.base_steps import ( # noqa f811
given_logged_in_webui, user_sees_main_main_page_login)
# Scenario: Someone try to access a page without being logged.
@when('someone tries to access... | agpl-3.0 | Python |
d1bfa57bf87faa751cbd72ed0db8370f5f65cc78 | Tidy code up. | gizmoguy/python-yoapi | yoapi/yo.py | yoapi/yo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
class api():
def __init__(self, api_key):
self.api_key = api_key
def yoall(self):
requests.post("http://api.justyo.co/yoall/",
data={'api_token': self.api_key})
def yo(self, username):
requests.post("ht... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
class api():
def __init__(self, api_key):
self.api_key = api_key
def yoall(self):
requests.post("http://api.justyo.co/yoall/", data={'api_token': self.api_key})
def yo(self, username):
requests.post("http://api.justyo.... | apache-2.0 | Python |
9b70a2d2e91a9a1ed097a6b50f501d348648a8cd | Update poke_run.py | raul-jr3/dope-learning | pokemon_classification/poke_run.py | pokemon_classification/poke_run.py | import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import Adam
# the helpers
from process_data import *
# model parameters
n_hidden1 = 32
n_hidden2 = 64
nb_classes = 19
nb_epochs = 1750
optimizer = Adam()
def build_model():
"""
builds the neural n... | import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import Adam
# the helpers
from process_data import *
# model parameters
n_hidden1 = 32
n_hidden2 = 64
nb_classes = 19
nb_epochs = 1750
optimizer = Adam()
def build_model():
"""
builds the neural n... | mit | Python |
4993a3e4a05f455d53ca5a5942f75447b35482b0 | Add private notes permission to default 'Talk Mentors' permissions | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/management/commands/wafer_add_default_groups.py | wafer/management/commands/wafer_add_default_groups.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
class Command(BaseCommand):
help = "Add some useful default groups"
GROUPS = {
# Permissions are specified as (app, code_name) pairs
'Page Editors': (
... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
class Command(BaseCommand):
help = "Add some useful default groups"
GROUPS = {
# Permissions are specified as (app, code_name) pairs
'Page Editors': (
... | isc | Python |
1e542ede66bb7b508beaee26f3d6931678e6c8cc | Add todo. | tpcstld/youtube,tpcstld/youtube,tpcstld/youtube | youtube/downloader.py | youtube/downloader.py | import os
from youtube_dl import YoutubeDL
from youtube_dl import MaxDownloadsReached
# TODO: Add progress bar feature.
def download(download):
"""Downloads the youtube video from the url
Args:
download: A DownloadRequest.
Returns:
A (file name, video title) tuple.
The file name is ... | import os
from youtube_dl import YoutubeDL
from youtube_dl import MaxDownloadsReached
def download(download):
"""Downloads the youtube video from the url
Args:
download: A DownloadRequest.
Returns:
A (file name, video title) tuple.
The file name is ONLY the file name, and does not i... | mit | Python |
0c28e5be9f5eaee1f5220930d142908818d2b234 | Add WSGI-compliant log handlers in wsgi.py | Kitware/girder,girder/girder,girder/girder,kotfic/girder,kotfic/girder,kotfic/girder,jbeezley/girder,manthey/girder,manthey/girder,RafaelPalomar/girder,Kitware/girder,RafaelPalomar/girder,jbeezley/girder,RafaelPalomar/girder,RafaelPalomar/girder,Kitware/girder,girder/girder,jbeezley/girder,girder/girder,RafaelPalomar/g... | girder/wsgi.py | girder/wsgi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2017 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2017 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | apache-2.0 | Python |
64849ebcc84c38c305f2ade21b6e8212b2e42090 | Remove unused import in dropdown example | Rapptz/discord.py,rapptz/discord.py | examples/views/dropdown.py | examples/views/dropdown.py | # This example requires the 'message_content' privileged intent to function.
import discord
from discord.ext import commands
# Defines a custom Select containing colour options
# that the user can choose. The callback function
# of this class is called when the user changes their choice
class Dropdown(discord.ui.Sele... | # This example requires the 'message_content' privileged intent to function.
import typing
import discord
from discord.ext import commands
# Defines a custom Select containing colour options
# that the user can choose. The callback function
# of this class is called when the user changes their choice
class Dropdown(... | mit | Python |
3e3129f01977d522ac1aeb24568794033fbef2a1 | Use urllib2 so that we can add a timeout | kfdm/gntp | gntp_bridge.py | gntp_bridge.py | from gntp import *
import urllib2
import Growl
def register_send(self):
'''
Resend a GNTP Register message to Growl running on a local OSX Machine
'''
print 'Sending Local Registration'
#Local growls only need a list of strings
notifications=[]
defaultNotifications = []
for notice in self.notifications:
no... | from gntp import *
import urllib
import Growl
def register_send(self):
'''
Resend a GNTP Register message to Growl running on a local OSX Machine
'''
print 'Sending Local Registration'
#Local growls only need a list of strings
notifications=[]
defaultNotifications = []
for notice in self.notifications:
not... | mit | Python |
9ade476e5dad2e5a806bd68f89afa9725bfb6969 | Add Media.url | tweepy/tweepy,svven/tweepy | tweepy/media.py | tweepy/media.py | # Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
from tweepy.mixins import DataMapping
class Media(DataMapping):
__slots__ = (
"data", "media_key", "type", "duration_ms", "height",
"non_public_metrics", "organic_metrics", "preview_image_url",
"promoted_metrics",... | # Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
from tweepy.mixins import DataMapping
class Media(DataMapping):
__slots__ = (
"data", "media_key", "type", "duration_ms", "height",
"non_public_metrics", "organic_metrics", "preview_image_url",
"promoted_metrics",... | mit | Python |
8747da53c996669cf05c900df11273228534a87e | refactor quit mechanism | bufferx/twork,bufferx/twork | twork/tworkd.py | twork/tworkd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/L... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/L... | apache-2.0 | Python |
f9019ea6b377dc5d1b1de5efa797c1f515855cf9 | bump page size up more to see if it helps | CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api | exp/utils.py | exp/utils.py | import csv
import io
RESPONSE_PAGE_SIZE = 500 # for pagination of responses when processing for download
def flatten_dict(d):
"""Flatten a dictionary where values may be other dictionaries
The dictionary returned will have keys created by joining higher- to lower-level keys with dots. e.g. if the original dic... | import csv
import io
RESPONSE_PAGE_SIZE = 250 # for pagination of responses when processing for download
def flatten_dict(d):
"""Flatten a dictionary where values may be other dictionaries
The dictionary returned will have keys created by joining higher- to lower-level keys with dots. e.g. if the original dic... | apache-2.0 | Python |
25e2c8c50428198f9b37df8bb5034200b27c7890 | fix tests | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/ui/views/tests/test_welcome.py | subiquity/ui/views/tests/test_welcome.py | import unittest
from unittest import mock
import urwid
from subiquitycore.testing import view_helpers
from subiquity.controllers.welcome import WelcomeController
from subiquity.models.locale import LocaleModel
from subiquity.ui.views.welcome import WelcomeView
class FakeApp:
class opts:
run_on_serial = ... | import unittest
from unittest import mock
import urwid
from subiquitycore.testing import view_helpers
from subiquity.controllers.welcome import WelcomeController
from subiquity.models.locale import LocaleModel
from subiquity.ui.views.welcome import WelcomeView
class WelcomeViewTests(unittest.TestCase):
def ma... | agpl-3.0 | Python |
b7da5821d86afe5c9d384c12c6f52553d73e17f9 | Fix replace in clean_str_to_div_id | roramirez/qpanel,roramirez/qpanel,roramirez/qpanel,roramirez/qpanel,skazancev/qpanel,skazancev/qpanel,skazancev/qpanel,skazancev/qpanel | libs/qpanel/utils.py | libs/qpanel/utils.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Rodrigo Ramírez Norambuena <a@rodrigoramirez.com>
#
import ConfigParser
from datetime import timedelta
import time
def unified_configs(file_config, file_template, sections=[]):
f = open(file_config, 'r')
config = ConfigParser.ConfigParser()
config.read... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Rodrigo Ramírez Norambuena <a@rodrigoramirez.com>
#
import ConfigParser
from datetime import timedelta
import time
def unified_configs(file_config, file_template, sections=[]):
f = open(file_config, 'r')
config = ConfigParser.ConfigParser()
config.read... | mit | Python |
451be200d7af1ea25e52021bddf26b1c9209de3c | add function upload all files in a directory | zenja/benchmarking-cloud-storage-systems | benchcloud/operators/uploader.py | benchcloud/operators/uploader.py | import os
import ntpath
from benchcloud.drivers import driver
class Uploader(object):
def __init__(self, server_driver):
"""Init a Uploader object
Args:
server_driver: a driver already connected to cloud service
"""
if not issubclass(driver.Driver, driver.Driver):
... | from benchcloud.drivers import driver
import ntpath
class Uploader(object):
def __init__(self, server_driver):
"""Init a Uploader object
Args:
server_driver: a driver already connected to cloud service
"""
if not issubclass(driver.Driver, driver.Driver):
ra... | apache-2.0 | Python |
7fc98a2b6f308b0c75200c2c30836a8a71cfe689 | Add fakesetup for home screen spotlight | youtify/youtify,youtify/youtify,youtify/youtify | fakesetup.py | fakesetup.py | from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import urlfetch
from django.utils import simplejson
from model import get_current_youtify_user_model
from model import Playlist
from model import ExternalUser
from config import ON_PRODUCTION
EXTERNAL_USERS =... | from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from django.utils import simplejson
from model import get_current_youtify_user_model
from model import Playlist
from config import ON_PRODUCTION
class Handler(webapp.RequestHandler):
def get(self):
user = get_current_yout... | mit | Python |
c9d1a3ad2c3c64f49ec83cf8d09cc6d35915990c | Add aircraft and seating arrangement to Flight | kentoj/python-fundamentals | airtravel.py | airtravel.py | """Model for aircraft flights"""
class Flight:
"""A flight with a specific passenger aircraft."""
def __init__(self, number, aircraft):
if not number[:4].isalpha():
raise ValueError("No airline code in '{}'".format(number))
if not number[:4].isupper():
raise ValueErro... | """Model for aircraft flights"""
class Flight:
def __init__(self, number):
if not number[:4].isalpha():
raise ValueError("No airline code in '{}'".format(number))
if not number[:4].isupper():
raise ValueError("Invalid airline code'{}'".format(number))
if not (numb... | mit | Python |
924da709a57f868d8e96d4e520572a56273451a6 | Add a copyright notice. | eliteraspberries/fftresize | fftresize.py | fftresize.py | #!/usr/bin/env python2
# Copyright 2013, Mansour Moufid <mansourmoufid@gmail.com>
from matplotlib import image, pyplot
from numpy import append, array, real, zeros
from numpy.fft import fft2, ifft2, fftshift, ifftshift
try:
from os import EX_NOINPUT, EX_USAGE
except ImportError:
EX_NOINPUT, EX_USAGE = 1, 2
fro... | #!/usr/bin/env python2
from matplotlib import image, pyplot
from numpy import append, array, real, zeros
from numpy.fft import fft2, ifft2, fftshift, ifftshift
try:
from os import EX_NOINPUT, EX_USAGE
except ImportError:
EX_NOINPUT, EX_USAGE = 1, 2
from os.path import basename, exists, splitext
from random imp... | isc | Python |
ef30ee868c454691820b85a56e0a9f3403c11e3a | Split into two functions | minrk/findspark,freeman-lab/findspark,stared/findspark,marichkakorolyuk/findspark | findspark.py | findspark.py | """Find spark home, and initialize by adding pyspark to sys.path.
If SPARK_HOME is defined, it will be used to put pyspark on sys.path.
Otherwise, common locations for spark (currently only Homebrew's default) will be searched.
"""
from glob import glob
import os
import sys
__version__ = '0.0.2'
def find():
""... | """Find spark home, and add pyspark to sys.path.
If SPARK_HOME is defined, it will be used to put pyspark on sys.path.
Otherwise, common locations for spark (currently only Homebrew's default) will be searched.
"""
from glob import glob
import os
import sys
__version__ = '0.0.2'
def find_spark(spark_home=None):
... | bsd-3-clause | Python |
0e1de6f1fbec5b174c2daca1e9c5aba6e4fa6fe3 | add aklog-method | openafs-contrib/afspy,openafs-contrib/afspy | afs/dao/PAGDAO.py | afs/dao/PAGDAO.py | import string,re,sys,time
import afs.dao.bin
from afs.exceptions.krb5Error import krb5Error
class PAGDAO(object) :
"""
Access to a pag, like getting information about tokens
"""
TokenRegEx1=re.compile("User's \(AFS ID (\d+)\) tokens for (\S+)@(\S+) \[Expires (.*)\]")
TokenRegEx2=re.compi... | import string,re,sys,time
import afs.dao.bin
class PAGDAO() :
"""
Access to a pag, like getting information about tokens
"""
TokenRegEx1=re.compile("User's \(AFS ID (\d+)\) tokens for (\S+)@(\S+) \[Expires (.*)\]")
TokenRegEx2=re.compile("User's \(AFS ID (\d+)\) (\S+) tokens for (\S+) \[... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.