commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
e72c7fb4249895f2d6f4c9f36153786b75d5e8fa | chainer/functions/reshape.py | chainer/functions/reshape.py | import numpy
from chainer import function
from chainer.utils import type_check
class Reshape(function.Function):
type_check_prod = type_check.Variable(numpy.prod, 'prod')
"""Reshapes an input array without copy."""
def __init__(self, shape):
self.shape = shape
def check_type_forward(self, ... | import numpy
from chainer import function
from chainer.utils import type_check
_type_check_prod = type_check.Variable(numpy.prod, 'prod')
class Reshape(function.Function):
"""Reshapes an input array without copy."""
def __init__(self, shape):
self.shape = shape
def check_type_forward(self, i... | Move type_chack_prod module level variable and change its name to _type_check_prod | Move type_chack_prod module level variable and change its name to _type_check_prod
| Python | mit | kikusu/chainer,niboshi/chainer,sou81821/chainer,elviswf/chainer,anaruse/chainer,okuta/chainer,okuta/chainer,AlpacaDB/chainer,tkerola/chainer,ktnyt/chainer,wkentaro/chainer,chainer/chainer,woodshop/complex-chainer,jfsantos/chainer,keisuke-umezawa/chainer,yanweifu/chainer,truongdq/chainer,niboshi/chainer,aonotas/chainer,... | ---
+++
@@ -4,8 +4,10 @@
from chainer.utils import type_check
+_type_check_prod = type_check.Variable(numpy.prod, 'prod')
+
+
class Reshape(function.Function):
- type_check_prod = type_check.Variable(numpy.prod, 'prod')
"""Reshapes an input array without copy."""
@@ -15,15 +17,15 @@
def check_t... |
737bf244f36b73a54b5b4f89f0c7e604d3f34b72 | tests/grammar_term-nonterm_test/NonterminalGetTest.py | tests/grammar_term-nonterm_test/NonterminalGetTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
from grammpy import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Th... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
from grammpy import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Th... | Add tests of get nonterms | Add tests of get nonterms
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -25,7 +25,49 @@
class TerminalGetTest(TestCase):
- pass
+ def test_getNontermEmpty(self):
+ gr = Grammar()
+ self.assertIsNone(gr.get_nonterm(TempClass))
+ self.assertIsNone(gr.get_nonterm(Second))
+ self.assertIsNone(gr.get_nonterm(Third))
+
+ def test_getNontermC... |
0b1702314fca978db1d0475ff3bc14977e7675a2 | hxl_proxy/__init__.py | hxl_proxy/__init__.py | """
Top-level Flask application for HXL Proxy
David Megginson
January 2015
License: Public Domain
Documentation: http://hxlstandard.org
"""
import os
import requests_cache
from flask import Flask, g, request
from flask_cache import Cache
import werkzeug.datastructures
# Main application object
app = Flask(__name__... | """
Top-level Flask application for HXL Proxy
David Megginson
January 2015
License: Public Domain
Documentation: http://hxlstandard.org
"""
import os
import requests_cache
from flask import Flask, g, request
from flask_cache import Cache
import werkzeug.datastructures
# Main application object
app = Flask(__name__... | Add 1-hour expiry to requests_cache (formerly 5 minutes). | Add 1-hour expiry to requests_cache (formerly 5 minutes).
| Python | unlicense | HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy | ---
+++
@@ -31,7 +31,7 @@
'CACHE_DEFAULT_TIMEOUT': app.config.get('CACHE_DEFAULT_TIMEOUT_SECONDS', 3600)
})
-requests_cache.install_cache('/tmp/hxl_proxy_requests')
+requests_cache.install_cache('/tmp/hxl_proxy_requests', expire_after=3600)
# Needed to register annotations
import hxl_proxy.controllers |
093b08f6bd03bd938ae7b7a18297708faa353766 | django_lightweight_queue/middleware/transaction.py | django_lightweight_queue/middleware/transaction.py | from django.db import transaction, connection
class TransactionMiddleware(object):
def process_job(self, job):
if not connection.in_atomic_block:
transaction.set_autocommit(False)
def process_result(self, job, result, duration):
if not connection.in_atomic_block:
transa... | from django.db import transaction, connection
class TransactionMiddleware(object):
def process_job(self, job):
transaction.atomic(savepoint=False).__enter__()
def process_result(self, job, result, duration):
transaction.atomic(savepoint=False).__exit__(None, None, None)
def process_except... | Use Django's Atomic decorator logic | Use Django's Atomic decorator logic
We now keep Autocommit on it’s new default of True, as we only need the
ability to rollback the contents of a queue job. By setting
savepoint=False, the whole job will roll back if anything fails, rather
than just up to the containing savepoint.
| Python | bsd-3-clause | thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue,prophile/django-lightweight-queue | ---
+++
@@ -2,16 +2,13 @@
class TransactionMiddleware(object):
def process_job(self, job):
- if not connection.in_atomic_block:
- transaction.set_autocommit(False)
+ transaction.atomic(savepoint=False).__enter__()
def process_result(self, job, result, duration):
- if not... |
9eec7f7f39dc7e1af6e78e4be8d01b50626a4eb5 | tests/acceptance/test_scoring.py | tests/acceptance/test_scoring.py | import shelve
def test_shows_player_rating(browser, test_server, database_url):
with shelve.open(database_url) as db:
db.clear()
db['p1'] = 1000
app = ScoringApp(browser, test_server)
app.visit('/')
app.shows('P1 1000')
def test_user_adding(browser, test_server):
app = ScoringAp... | import shelve
from whatsmyrank.players import START_RANK
from whatsmyrank.players import PlayerRepository
def test_shows_player_rating(browser, test_server, database_url):
player_repo = PlayerRepository(database_url, START_RANK)
player_repo.create('p1')
app = ScoringApp(browser, test_server)
app.vis... | Remove database details from acceptance test | Remove database details from acceptance test
| Python | bsd-2-clause | abele/whatsmyrank,abele/whatsmyrank | ---
+++
@@ -1,10 +1,12 @@
import shelve
+
+from whatsmyrank.players import START_RANK
+from whatsmyrank.players import PlayerRepository
def test_shows_player_rating(browser, test_server, database_url):
- with shelve.open(database_url) as db:
- db.clear()
- db['p1'] = 1000
+ player_repo = Pla... |
d436bcc20be8eb81960a53d442f699e42e2f9ea7 | src/tkjoincsv.py | src/tkjoincsv.py |
import tkFileDialog
import joincsv
import os.path
import sys
if __name__ == '__main__':
filetypes=[("Spreadsheets", "*.csv"),
("Spreadsheets", "*.xls"),
("Spreadsheets", "*.xlsx")]
if len(sys.argv) == 2:
input_filename = sys.argv[1]
else:
input_filename =... |
import tkFileDialog
import joincsv
import os.path
import sys
if __name__ == '__main__':
filetypes=[("Spreadsheets", "*.csv"),
("Spreadsheets", "*.xls"),
("Spreadsheets", "*.xlsx")]
if len(sys.argv) == 2:
input_filename = sys.argv[1]
else:
input_filename =... | Allow saving to a file that does not already exist again. | Allow saving to a file that does not already exist again.
| Python | apache-2.0 | peterSW/corow | ---
+++
@@ -18,9 +18,8 @@
exit(0)
output_filename = tkFileDialog.asksaveasfilename(filetypes=filetypes, defaultextension=".csv")
- if not os.path.isfile(output_filename):
- exit(0)
-
- joiner = joincsv.RecordJoiner(input_filename)
- joiner.save(output_filename)
+ i... |
342d62a42bb4e1993bbe9d755e6daabcaffe4122 | chdb.py | chdb.py | import sqlite3
DB_FILENAME = 'citationhunt.sqlite3'
def init_db():
return sqlite3.connect(DB_FILENAME)
def reset_db():
db = init_db()
with db:
db.execute('''
DROP TABLE categories
''')
db.execute('''
DROP TABLE articles
''')
db.execute('''
... | import sqlite3
DB_FILENAME = 'citationhunt.sqlite3'
def init_db():
return sqlite3.connect(DB_FILENAME)
def reset_db():
db = init_db()
with db:
db.execute('''
DROP TABLE IF EXISTS categories
''')
db.execute('''
DROP TABLE IF EXISTS articles
''')
... | Revert "Remove IF EXISTS from DROP TABLE when resetting the db." | Revert "Remove IF EXISTS from DROP TABLE when resetting the db."
This reverts commit 271668a20a2262fe6211b9f61146ad90d8096486 [formerly a7dce25964cd740b0d0db86b255ede60c913e73d].
Former-commit-id: 08199327c411663a199ebf36379e88a514935399 | Python | mit | eggpi/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt | ---
+++
@@ -10,16 +10,16 @@
with db:
db.execute('''
- DROP TABLE categories
+ DROP TABLE IF EXISTS categories
''')
db.execute('''
- DROP TABLE articles
+ DROP TABLE IF EXISTS articles
''')
db.execute('''
- DROP ... |
8b3ca76b980f126912de1bc8ffa067c199693eb3 | cinder/db/sqlalchemy/migrate_repo/versions/061_add_snapshot_id_timestamp_to_backups.py | cinder/db/sqlalchemy/migrate_repo/versions/061_add_snapshot_id_timestamp_to_backups.py | # Copyright (c) 2015 EMC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | # Copyright (c) 2015 EMC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Fix race conditions in migration 061 | Fix race conditions in migration 061
Migration 061 is supposed to add new `data_timestamp` field and populate
it with value of `created_at` column. This was done by selecting all the
backups and doing updates one-by-one. As it wasn't done in transaction
solution was prone to race condition when a new backup is added w... | Python | apache-2.0 | phenoxim/cinder,cloudbase/cinder,j-griffith/cinder,phenoxim/cinder,Nexenta/cinder,Datera/cinder,mahak/cinder,mahak/cinder,j-griffith/cinder,ge0rgi/cinder,Nexenta/cinder,openstack/cinder,cloudbase/cinder,eharney/cinder,eharney/cinder,Hybrid-Cloud/cinder,bswartz/cinder,NetApp/cinder,Hybrid-Cloud/cinder,Datera/cinder,open... | ---
+++
@@ -25,16 +25,6 @@
data_timestamp = Column('data_timestamp', DateTime)
backups.create_column(snapshot_id)
- backups.update().values(snapshot_id=None).execute()
backups.create_column(data_timestamp)
- backups.update().values(data_timestamp=None).execute()
-
- # Copy existing created... |
960ce03fc6d861c8df8d7aef5042f71c101794ca | pavement.py | pavement.py | # -*- coding: utf-8 -*-
from paver.easy import *
@task
def test(options):
info("Running tests for Python 2")
sh('python2 tests.py')
info("Running tests for Python 3")
sh('python3 tests.py')
@task
def coverage(options):
info("Running coverage for Python 2")
sh('coverage2 run --source ldapom ./... | # -*- coding: utf-8 -*-
from paver.easy import *
@task
def test(options):
info("Running tests for Python 2")
sh('python2 -m unittest -v tests')
info("Running tests for Python 3")
sh('python3 -m unittest -v tests')
@task
def coverage(options):
info("Running coverage for Python 2")
sh('coverage... | Make paver unittest run more verbose | Make paver unittest run more verbose
| Python | mit | HaDiNet/ldapom | ---
+++
@@ -5,9 +5,9 @@
@task
def test(options):
info("Running tests for Python 2")
- sh('python2 tests.py')
+ sh('python2 -m unittest -v tests')
info("Running tests for Python 3")
- sh('python3 tests.py')
+ sh('python3 -m unittest -v tests')
@task
def coverage(options): |
f69ea0232881c923e71bd2716fb6faa5d0d99491 | yithlibraryserver/tests/test_views.py | yithlibraryserver/tests/test_views.py | # Yith Library Server is a password storage server.
# Copyright (C) 2012 Yaco Sistemas
# Copyright (C) 2012 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is free software:... | # Yith Library Server is a password storage server.
# Copyright (C) 2012 Yaco Sistemas
# Copyright (C) 2012 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is free software:... | Test the new tos view | Test the new tos view
| Python | agpl-3.0 | lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server | ---
+++
@@ -26,3 +26,7 @@
def test_home(self):
res = self.testapp.get('/')
self.assertEqual(res.status, '200 OK')
+
+ def test_tos(self):
+ res = self.testapp.get('/tos')
+ self.assertEqual(res.status, '200 OK') |
69e5e6e3cbddc2c5c2f1ebc13095c88b9f9dbe56 | src/moore/urls.py | src/moore/urls.py | from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from search import views as search_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import u... | from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from search import views as search_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import u... | Fix the inaccessible pages within the involvement package | :bug: Fix the inaccessible pages within the involvement package
| Python | agpl-3.0 | Dekker1/moore,UTNkar/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore | ---
+++
@@ -9,8 +9,8 @@
from wagtail.wagtaildocs import urls as wagtaildocs_urls
urlpatterns = [
+ url(r'', include('involvement.urls')), # Needs to be imported before wagtail admin
url(r'^admin/', include(wagtailadmin_urls)),
- url(r'', include('involvement.urls')),
url(r'^documents/', include(w... |
a3f1bd9b27bb605fe363a69a34a92862a1899da1 | notifications/alliance_selections.py | notifications/alliance_selections.py | from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class AllianceSelectionNotification(BaseNotification):
def __init__(self, event):
self.event = event
self._event_feed = event.key_name
... | from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class AllianceSelectionNotification(BaseNotification):
def __init__(self, event):
self.event = event
self._event_feed = event.key_name
... | Add event name and key to alliance selection notifications | Add event name and key to alliance selection notifications
This info is already included in 'event', but adding for consistency | Python | mit | jaredhasenklein/the-blue-alliance,synth3tk/the-blue-alliance,jaredhasenklein/the-blue-alliance,the-blue-alliance/the-blue-alliance,synth3tk/the-blue-alliance,bdaroz/the-blue-alliance,synth3tk/the-blue-alliance,tsteward/the-blue-alliance,jaredhasenklein/the-blue-alliance,jaredhasenklein/the-blue-alliance,the-blue-allian... | ---
+++
@@ -18,5 +18,7 @@
data = {}
data['message_type'] = NotificationType.type_names[self._type]
data['message_data'] = {}
+ data['message_data']['event_name'] = self.event.name
+ data['message_data']['event_key'] = self.event.key_name
data['message_data']['event'] ... |
30a2a16aff030235941eac3786cc49b42e0ed868 | bootstrap/conf/salt/state/run-tracking-db/scripts/import_sample_data.py | bootstrap/conf/salt/state/run-tracking-db/scripts/import_sample_data.py | import pandas as pd
import sys
df = pd.read_csv(sys.argv[1])
df.columns = [c.lower() for c in df.columns]
from sqlalchemy import create_engine
engine = create_engine('postgresql://localhost:5432/germline_genotype_tracking')
try:
df.to_sql("pcawg_samples", engine)
except ValueError as e:
if str(e) != "Table ... | import pandas as pd
import sys
df = pd.read_csv(sys.argv[1])
df.columns = [c.lower() for c in df.columns]
from sqlalchemy import create_engine
engine = create_engine('postgresql://localhost:5432/germline_genotype_tracking')
try:
df.to_sql("pcawg_samples", engine)
except ValueError as e:
if str(e) != "Table ... | Print an error message when table already exists without failing the script. | Print an error message when table already exists without failing the script.
| Python | mit | llevar/germline-regenotyper,llevar/germline-regenotyper | ---
+++
@@ -12,6 +12,7 @@
df.to_sql("pcawg_samples", engine)
except ValueError as e:
if str(e) != "Table 'pcawg_samples' already exists.":
- print (e)
+ print str(e)
exit(1)
-
+ else:
+ print str(e) |
69559162db6818371a41b7b3e3092d767d198f3f | core/create_event.py | core/create_event.py | from django.template.loader import render_to_string
from core.default_eventpage_content import (
get_default_eventpage_data,
get_default_menu,
)
from core.models import Event
def create_event_from_event_application(event_application):
""" Creates event based on the data from the object.
If the ev... | from django.template.loader import render_to_string
from core.default_eventpage_content import (
get_default_eventpage_data,
get_default_menu,
)
from core.models import Event
def create_event_from_event_application(event_application):
""" Creates event based on the data from the object.
If the ev... | Fix typo in method call | Fix typo in method call
Ticket #342
| Python | bsd-3-clause | DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls | ---
+++
@@ -30,6 +30,6 @@
# populate content & menu from the default event
event.add_default_content()
- event.adefault_menu()
+ event.add_default_menu()
return event |
6113b60187da1da42b26bee81556aad3efef57c4 | nipype/interfaces/tests/test_afni.py | nipype/interfaces/tests/test_afni.py | from nipype.interfaces import afni
from nose.tools import assert_equal
def test_To3d():
cmd = afni.To3d()
cmd._compile_command()
yield assert_equal, cmd.cmdline, 'to3d'
cmd = afni.To3d(anat=True)
cmd._compile_command()
yield assert_equal, cmd.cmdline, 'to3d -anat'
cmd = afni.To3d()
cm... | from nipype.interfaces import afni
from nose.tools import assert_equal
def test_To3d():
cmd = afni.To3d()
cmd._compile_command()
yield assert_equal, cmd.cmdline, 'to3d'
cmd = afni.To3d(anat=True)
cmd._compile_command()
yield assert_equal, cmd.cmdline, 'to3d -anat'
cmd = afni.To3d()
cm... | Add tests to afni To3d. | Add tests to afni To3d.
git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@165 ead46cd0-7350-4e37-8683-fc4c6f79bf00
| Python | bsd-3-clause | rameshvs/nipype,grlee77/nipype,dmordom/nipype,glatard/nipype,fprados/nipype,rameshvs/nipype,wanderine/nipype,mick-d/nipype_source,dgellis90/nipype,sgiavasis/nipype,arokem/nipype,Leoniela/nipype,pearsonlab/nipype,pearsonlab/nipype,FCP-INDI/nipype,mick-d/nipype,satra/NiPypeold,gerddie/nipype,FredLoney/nipype,dgellis90/ni... | ---
+++
@@ -14,3 +14,13 @@
cmd.inputs.datum = 'float'
cmd._compile_command()
yield assert_equal, cmd.cmdline, 'to3d -datum float'
+ cmd = afni.To3d()
+ cmd.inputs.session = '/home/bobama'
+ cmd._compile_command()
+ yield assert_equal, cmd.cmdline, 'to3d -session /home/bobama'
+ cmd = afn... |
e2bac19e08197dc33756d7b7cf1f88e4ba808ae1 | PyFVCOM/__init__.py | PyFVCOM/__init__.py | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.4.1'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.4.1'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | Add missing module to the project. | Add missing module to the project.
| Python | mit | pwcazenave/PyFVCOM | ---
+++
@@ -17,6 +17,7 @@
from PyFVCOM import buoy_tools
from PyFVCOM import cst_tools
from PyFVCOM import ctd_tools
+from PyFVCOM import current_tools
from PyFVCOM import grid_tools
from PyFVCOM import ll2utm
from PyFVCOM import ocean_tools |
bf1bafbbebeab86a213e4c4bed0be6f1b18404c6 | python/grizzly/grizzly/lazy_op.py | python/grizzly/grizzly/lazy_op.py | """Summary
"""
from weld.weldobject import *
def to_weld_type(weld_type, dim):
"""Summary
Args:
weld_type (TYPE): Description
dim (TYPE): Description
Returns:
TYPE: Description
"""
for i in xrange(dim):
weld_type = WeldVec(weld_type)
return weld_type
class L... | """Summary
"""
from weld.weldobject import *
def to_weld_type(weld_type, dim):
"""Summary
Args:
weld_type (TYPE): Description
dim (TYPE): Description
Returns:
TYPE: Description
"""
for i in xrange(dim):
weld_type = WeldVec(weld_type)
return weld_type
class L... | Add passes to Grizzly's lazyOp | Add passes to Grizzly's lazyOp
| Python | bsd-3-clause | rahulpalamuttam/weld,rahulpalamuttam/weld,weld-project/weld,sppalkia/weld,weld-project/weld,weld-project/weld,rahulpalamuttam/weld,weld-project/weld,sppalkia/weld,sppalkia/weld,sppalkia/weld,sppalkia/weld,weld-project/weld,rahulpalamuttam/weld,rahulpalamuttam/weld | ---
+++
@@ -40,7 +40,7 @@
self.weld_type = weld_type
self.dim = dim
- def evaluate(self, verbose=True, decode=True):
+ def evaluate(self, verbose=True, decode=True, passes=None):
"""Summary
Args:
@@ -56,5 +56,6 @@
self.weld_type,
... |
d12907dd681c1d16c623b9dcceed9ff5e85c2ac6 | views.py | views.py |
from django.shortcuts import render
def intro(request, template='intro.html'):
response = render(request, template)
response['X-Frame-Options'] = 'SAMEORIGIN'
return response
| from django.shortcuts import render
from django.views.decorators.clickjacking import xframe_options_sameorigin
@xframe_options_sameorigin
def intro(request, template='intro.html'):
response = render(request, template)
return response
| Use X-Frame-Options decorator to override middleware. | Use X-Frame-Options decorator to override middleware.
| Python | bsd-3-clause | m8ttyB/pontoon-intro,mathjazz/pontoon-intro,mathjazz/pontoon-intro,Osmose/pontoon-intro,jotes/pontoon-intro,Osmose/pontoon-intro,jotes/pontoon-intro,m8ttyB/pontoon-intro,jotes/pontoon-intro,mathjazz/pontoon-intro,m8ttyB/pontoon-intro,Osmose/pontoon-intro | ---
+++
@@ -1,9 +1,8 @@
-
from django.shortcuts import render
+from django.views.decorators.clickjacking import xframe_options_sameorigin
+@xframe_options_sameorigin
def intro(request, template='intro.html'):
response = render(request, template)
- response['X-Frame-Options'] = 'SAMEORIGIN'
-
return... |
ffc01b11b0a63b22ddab341e2f0cab0707551409 | src/puzzle/problems/logic_problem.py | src/puzzle/problems/logic_problem.py | import ast
import sys
from data.logic import _grammar_transformer
from puzzle.problems import problem
class LogicProblem(problem.Problem):
@staticmethod
def score(lines):
if len(lines) <= 1:
return 0
program = '\n'.join(lines)
try:
parsed = ast.parse(program)
if isinstance(parsed, a... | import ast
import sys
from data.logic import _grammar_transformer
from puzzle.problems import problem
class LogicProblem(problem.Problem):
@staticmethod
def score(lines):
if len(lines) <= 1:
return 0
program = '\n'.join(lines)
try:
parsed = ast.parse(program)
if isinstance(parsed, a... | Remove redundant ast.fix_missing_locations call. Moved to transformer. | Remove redundant ast.fix_missing_locations call. Moved to transformer.
| Python | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | ---
+++
@@ -24,7 +24,6 @@
def _solve(self):
parsed = self._parse()
- ast.fix_missing_locations(parsed)
compiled = compile(parsed, '<string>', 'exec')
variables = {}
exec(compiled, variables) |
32a831d575b5354468a8f9c2a815f9f1aa03f2fb | api/caching/listeners.py | api/caching/listeners.py | from api.caching.tasks import ban_url
from framework.tasks.handlers import enqueue_task
from modularodm import signals
@signals.save.connect
def log_object_saved(sender, instance, fields_changed, cached_data):
abs_url = None
if hasattr(instance, 'absolute_api_v2_url'):
abs_url = instance.absolute_api_v... | from functools import partial
from api.caching.tasks import ban_url
from framework.tasks.postcommit_handlers import enqueue_postcommit_task
from modularodm import signals
@signals.save.connect
def log_object_saved(sender, instance, fields_changed, cached_data):
abs_url = None
if hasattr(instance, 'absolute_a... | Switch cache ban request to new postcommit synchronous method | Switch cache ban request to new postcommit synchronous method
| Python | apache-2.0 | kwierman/osf.io,amyshi188/osf.io,baylee-d/osf.io,felliott/osf.io,chrisseto/osf.io,amyshi188/osf.io,felliott/osf.io,samchrisinger/osf.io,cslzchen/osf.io,icereval/osf.io,cwisecarver/osf.io,sloria/osf.io,kwierman/osf.io,kch8qx/osf.io,asanfilippo7/osf.io,TomHeatwole/osf.io,DanielSBrown/osf.io,cslzchen/osf.io,CenterForOpenS... | ---
+++
@@ -1,6 +1,9 @@
+from functools import partial
+
from api.caching.tasks import ban_url
-from framework.tasks.handlers import enqueue_task
+from framework.tasks.postcommit_handlers import enqueue_postcommit_task
from modularodm import signals
+
@signals.save.connect
def log_object_saved(sender, instance,... |
90963666f22bea81d433724d232deaa0f3e2fec1 | st2common/st2common/exceptions/db.py | st2common/st2common/exceptions/db.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... | Add a special exception for capturing object conflicts. | Add a special exception for capturing object conflicts.
| Python | apache-2.0 | jtopjian/st2,StackStorm/st2,StackStorm/st2,emedvedev/st2,dennybaa/st2,StackStorm/st2,alfasin/st2,pixelrebel/st2,nzlosh/st2,Itxaka/st2,StackStorm/st2,dennybaa/st2,punalpatel/st2,Plexxi/st2,lakshmi-kannan/st2,lakshmi-kannan/st2,grengojbo/st2,Itxaka/st2,jtopjian/st2,alfasin/st2,punalpatel/st2,peak6/st2,tonybaloney/st2,pin... | ---
+++
@@ -22,3 +22,12 @@
class StackStormDBObjectMalformedError(StackStormBaseException):
pass
+
+
+class StackStormDBObjectConflictError(StackStormBaseException):
+ """
+ Exception that captures a DB object conflict error.
+ """
+ def __init__(self, message, conflict_id):
+ super(StackSt... |
39b57462b69d78825fd217822d9be2f1eea5a06d | src/ansible/models.py | src/ansible/models.py | from django.db import models
from django.conf import settings
class Playbook(models.Model):
name = models.CharField(max_length=200)
inventory = models.CharField(max_length=200, default="hosts")
user = models.CharField(max_length=200, default="ubuntu")
directory = models.CharField(max_length=200, editab... | from django.db import models
from django.conf import settings
class Playbook(models.Model):
name = models.CharField(max_length=200)
inventory = models.CharField(max_length=200, default="hosts")
user = models.CharField(max_length=200, default="ubuntu")
directory = models.CharField(max_length=200, editab... | Set default value for Registry.playbook | Set default value for Registry.playbook
| Python | bsd-3-clause | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | ---
+++
@@ -24,7 +24,7 @@
class Registry(models.Model):
- playbook = models.ForeignKey(Playbook, on_delete=models.CASCADE)
+ playbook = models.ForeignKey("Playbook", default=1, on_delete=models.CASCADE)
name = models.CharField(max_length=200)
item = models.FilePathField(path=settings.PLAYBOOK_DIR... |
4bf129f49eb608e34e46f60edb1d23303dd2ed27 | examples/__main__.py | examples/__main__.py | import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
tornado.options.define("port", default=8888, type=int)
if __name__ == "__main__":
tornado.options.parse_command_line()
application = tornado.web.Application([], **{
"static_path": ".",
"static_url_prefix": ... | import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
tornado.options.define("port", default=8888, type=int)
if __name__ == "__main__":
tornado.options.parse_command_line()
application = tornado.web.Application([], **{
"static_path": ".",
"static_url_prefix": ... | Use localhost rather than 0.0.0.0. | Use localhost rather than 0.0.0.0.
| Python | bsd-3-clause | qqqlllyyyy/d3,xc145214/d3,wangjun/d3,imshibaji/d3,alexgarciac/d3,markengelstad/d3,KevinMarkVI/d3,amorwilliams/d3,clayzermk1/d3,codingang/d3-1,overmind1980/d3,peterwu8/d3,baegjins/d3,christianevans214/d3,ilovezy/d3,ilo10/d3,UpstatePedro/d3,nbende/d3,trankmichael/d3,oanaradulescu/d3,MartinDavila/d3,Sachin-Ganesh/d3,nhein... | ---
+++
@@ -14,5 +14,5 @@
})
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(tornado.options.options.port)
- print "http://0.0.0.0:%d/examples/index.html" % tornado.options.options.port
+ print "http://localhost:%d/examples/index.html" % tornado.options.options.port
tornado.i... |
8a583c522dff8fc2671d7b51042a8c9ff07e86dc | pyp2rpmlib/package_data.py | pyp2rpmlib/package_data.py | class PackageData(object):
def __init__(self, local_file, name, version):
self.local_file = local_file
self.name = name
self.version = version
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
return None
class PypiData(Packa... | class PackageData(object):
def __init__(self, local_file, name, version):
self.local_file = local_file
self.name = name
self.version = version
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
return 'TODO:'
@property
... | Return TODO rather than None, add pkg_name property for PackageData | Return TODO rather than None, add pkg_name property for PackageData
| Python | mit | MichaelMraka/pyp2rpm,mcyprian/pyp2rpm,fedora-python/pyp2rpm,joequant/pyp2rpm,henrysher/spec4pypi,pombredanne/pyp2rpm,yuokada/pyp2rpm | ---
+++
@@ -8,7 +8,14 @@
if name in self.__dict__:
return self.__dict__[name]
- return None
+ return 'TODO:'
+
+ @property
+ def pkg_name(self, name):
+ if self.name.lower().find('py') != -1:
+ return self.name
+ else:
+ return 'python-%s... |
c7512104dce2e9ca83e8400b399b4f77113f9368 | packs/travisci/actions/lib/action.py | packs/travisci/actions/lib/action.py | import requests
from st2actions.runners.pythonrunner import Action
API_URL = 'https://api.travis-ci.org'
HEADERS_ACCEPT = 'application/vnd.travis-ci.2+json'
CONTENT_TYPE = 'application/json'
class TravisCI(Action):
def _get_auth_headers(self):
headers = {}
headers['Authorization'] = self.config[... | import httplib
import requests
from st2actions.runners.pythonrunner import Action
API_URL = 'https://api.travis-ci.org'
HEADERS_ACCEPT = 'application/vnd.travis-ci.2+json'
CONTENT_TYPE = 'application/json'
class TravisCI(Action):
def _get_auth_headers(self):
headers = {}
headers['Authorization'... | Throw on invalid / missing credentials. | Throw on invalid / missing credentials.
| Python | apache-2.0 | pidah/st2contrib,lmEshoo/st2contrib,psychopenguin/st2contrib,psychopenguin/st2contrib,armab/st2contrib,StackStorm/st2contrib,tonybaloney/st2contrib,pidah/st2contrib,pearsontechnology/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,pearsontechnology/st2contrib,pidah/st2contrib,armab/st2contrib,armab/st2contrib,S... | ---
+++
@@ -1,3 +1,5 @@
+import httplib
+
import requests
from st2actions.runners.pythonrunner import Action
@@ -30,4 +32,9 @@
headers = self._get_auth_headers()
response = requests.put(url, data=data, headers=headers)
+ if response.status_code in [httplib.FORBIDDEN, httplib.UNA... |
fa3ec9a764ca0d646588e908395367ce553981e1 | tca/chat/views.py | tca/chat/views.py | from django.shortcuts import render
from rest_framework import viewsets
from chat.models import Member
from chat.models import ChatRoom
from chat.serializers import MemberSerializer
from chat.serializers import ChatRoomSerializer
class MemberViewSet(viewsets.ModelViewSet):
model = Member
serializer_class = ... | from django.shortcuts import render
from django.shortcuts import get_object_or_404
from rest_framework import viewsets
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.response import Response
from chat.models import Member
from chat.models import ChatRoom
from chat.s... | Add an action for adding members to a chat room | Add an action for adding members to a chat room
Even though django-rest-framework supports a Ruby-on-Rails style
of updating existing resources by issuing a PATCH or PUT request,
such updates are unsafe and can cause race-conditions to lose
some state. The implementation of this action isn't fully RESTful,
but neither... | Python | bsd-3-clause | mlalic/TumCampusAppBackend,mlalic/TumCampusAppBackend | ---
+++
@@ -1,6 +1,10 @@
from django.shortcuts import render
+from django.shortcuts import get_object_or_404
from rest_framework import viewsets
+from rest_framework import status
+from rest_framework.decorators import action
+from rest_framework.response import Response
from chat.models import Member
from ch... |
01e911926d37fa981fd7703f751ff91f052313e2 | tkLibs/__init__.py | tkLibs/__init__.py | __all__ = ['autoScrollbar', 'button', 'combobox', 'listbox', 'window']
from .autoScrollbar import autoScrollbar
from .button import button
from .combobox import combobox
from .listbox import listbox
from .window import window
| __all__ = ['autoScrollbar', 'button', 'combobox', 'entry', 'frame', 'label', 'listbox', 'toplevel', 'window']
from .autoScrollbar import autoScrollbar
from .button import button
from .combobox import combobox
from .entry import entry
from .frame import frame
from .label import label
from .listbox import listbox
from .... | Add import of new widgets. | Add import of new widgets. | Python | mit | Kyle-Fagan/tkLibs | ---
+++
@@ -1,7 +1,11 @@
-__all__ = ['autoScrollbar', 'button', 'combobox', 'listbox', 'window']
+__all__ = ['autoScrollbar', 'button', 'combobox', 'entry', 'frame', 'label', 'listbox', 'toplevel', 'window']
from .autoScrollbar import autoScrollbar
from .button import button
from .combobox import combobox
+from ... |
a6ce4b1add0bcc664240cd63b27e460194e27c3f | src/glob2/__init__.py | src/glob2/__init__.py | from __future__ import absolute_import
from .impl import *
__version__ = (0, 3)
| from __future__ import absolute_import
from .impl import *
__version__ = (0, 4)
| Increment version number for new release. | Increment version number for new release.
| Python | bsd-2-clause | musically-ut/python-glob2 | ---
+++
@@ -2,4 +2,4 @@
from .impl import *
-__version__ = (0, 3)
+__version__ = (0, 4) |
71cb7a3d83cbb352a358ba8ac260584a6666b5ad | seleniumbase/config/proxy_list.py | seleniumbase/config/proxy_list.py | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | Update the example proxy list | Update the example proxy list
| Python | mit | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -23,7 +23,7 @@
"""
PROXY_LIST = {
- "example1": "170.39.193.236:3128", # (Example) - set your own proxy here
+ "example1": "151.181.91.10:80", # (Example) - set your own proxy here
"example2": "socks4://50.197.210.138:32100", # (Example)
"proxy1": None,
"proxy2": None, |
1d88ea54d1f4ce63893b906a5b79faa4dd25243f | grow/commands/convert.py | grow/commands/convert.py | from grow.pods import pods
from grow.pods import storage
from grow.conversion import *
import click
import os
@click.command()
@click.argument('pod_path', default='.')
@click.option('--type', type=click.Choice(['content_locale_split']))
def convert(pod_path, type):
"""Converts pod files from an earlier version of... | from grow.pods import pods
from grow.pods import storage
from grow.conversion import content_locale_split
import click
import os
@click.command()
@click.argument('pod_path', default='.')
@click.option('--type', type=click.Choice(['content_locale_split']))
def convert(pod_path, type):
"""Converts pod files from an... | Adjust import to fix build with PyInstaller. | Adjust import to fix build with PyInstaller.
| Python | mit | grow/pygrow,grow/pygrow,grow/pygrow,grow/grow,grow/grow,grow/grow,grow/grow | ---
+++
@@ -1,6 +1,6 @@
from grow.pods import pods
from grow.pods import storage
-from grow.conversion import *
+from grow.conversion import content_locale_split
import click
import os
|
3c442bc0304394095053b1a71e4a0aa37f72522b | sale_require_contract/__openerp__.py | sale_require_contract/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Sale Order Require Contract on Confirmation',
'version': '1.0',
'category': 'Projects & Services',
'sequence': 14,
'summary': '',
'description': """
Sale Order Require Contract on Confirmation
===========================================
""",
'author': ... | # -*- coding: utf-8 -*-
{
'name': 'Sale Order Require Contract on Confirmation',
'version': '1.0',
'category': 'Projects & Services',
'sequence': 14,
'summary': '',
'description': """
Sale Order Require Contract on Confirmation
===========================================
""",
'author': ... | FIX disable sale require contract | FIX disable sale require contract
| Python | agpl-3.0 | ingadhoc/sale,ingadhoc/partner,adhoc-dev/account-financial-tools,ingadhoc/sale,ingadhoc/account-payment,ingadhoc/account-invoicing,ingadhoc/account-analytic,adhoc-dev/odoo-addons,ingadhoc/odoo-addons,ingadhoc/odoo-addons,sysadminmatmoz/ingadhoc,ingadhoc/product,maljac/odoo-addons,bmya/odoo-addons,syci/ingadhoc-odoo-add... | ---
+++
@@ -22,7 +22,7 @@
],
'test': [
],
- 'installable': True,
+ 'installable': False,
'auto_install': False,
'application': False,
} |
688bec4dc00dd1040901ca446c6b6cc7fa6fbbcb | downstream-farmer/utils.py | downstream-farmer/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
def urlencode(string):
return urlencode(string)
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from urllib import quote_plus
except ImportError:
from urllib.parse import quote_plus
def urlify(string):
""" You might be wondering: why is this here at all, since it's basically
doing exactly what the quote_plus function in urllib does. Well, to k... | Add documentation and py3k compat | Add documentation and py3k compat
| Python | mit | Storj/downstream-farmer | ---
+++
@@ -1,11 +1,23 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+
try:
- from urllib import urlencode
+ from urllib import quote_plus
except ImportError:
- from urllib.parse import urlencode
+ from urllib.parse import quote_plus
-def urlencode(string):
- return urlencode(string)
+def ... |
30e567adb809810930616493fd92ef1c40c9207b | dthm4kaiako/users/forms.py | dthm4kaiako/users/forms.py | """Forms for user application."""
from django.forms import ModelForm
from django.contrib.auth import get_user_model, forms
User = get_user_model()
class SignupForm(ModelForm):
"""Sign up for user registration."""
class Meta:
"""Metadata for SignupForm class."""
model = get_user_model()
... | """Forms for user application."""
from django.forms import ModelForm
from django.contrib.auth import get_user_model, forms
from captcha.fields import ReCaptchaField
from captcha.widgets import ReCaptchaV3
User = get_user_model()
class SignupForm(ModelForm):
"""Sign up for user registration."""
captcha = Re... | Add recaptcha to signup page | Add recaptcha to signup page
Signup page is currently not used, but
doing it now in case it is forgotten later.
| Python | mit | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | ---
+++
@@ -2,12 +2,16 @@
from django.forms import ModelForm
from django.contrib.auth import get_user_model, forms
+from captcha.fields import ReCaptchaField
+from captcha.widgets import ReCaptchaV3
User = get_user_model()
class SignupForm(ModelForm):
"""Sign up for user registration."""
+
+ captc... |
c0eb0f902b0fcbea29c8a3bf70f80ca9384cce9f | scripts/remove_after_use/send_mendeley_reauth_email.py | scripts/remove_after_use/send_mendeley_reauth_email.py | # -*- coding: utf-8 -*-
import sys
import logging
from website.app import setup_django
setup_django()
from website import mails
from osf.models import OSFUser
from addons.mendeley.models import UserSettings
import progressbar
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def main(d... | # -*- coding: utf-8 -*-
import sys
import logging
from website.app import setup_django
setup_django()
from website import mails
from osf.models import OSFUser
from addons.mendeley.models import UserSettings
import progressbar
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def main(d... | Remove junk and add more logging | Remove junk and add more logging
| Python | apache-2.0 | cslzchen/osf.io,icereval/osf.io,brianjgeiger/osf.io,mattclark/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,adlius/osf.io,cslzchen/osf.io,mattclark/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,baylee-d... | ---
+++
@@ -15,9 +15,10 @@
def main(dry=True):
- user = OSFUser.load('qrgl2')
- qs = UserSettings.objects.filter(owner__is_active=True).select_related('owner')
- pbar = progressbar.ProgressBar(maxval=qs.count()).start()
+ qs = UserSettings.objects.filter(owner__is_active=True).select_related('owner')... |
75f01ff3be060e033b24d141b0ca824cb7f81c22 | tests/twisted/avahi/test-register.py | tests/twisted/avahi/test-register.py | from saluttest import exec_test
import avahitest
from avahitest import AvahiListener
import time
def test(q, bus, conn):
a = AvahiListener(q)
a.listen_for_service("_presence._tcp")
conn.Connect()
q.expect('service-added',
name='test-register@' + avahitest.get_host_name())
if __name__ == '__ma... | from saluttest import exec_test
import avahitest
from avahitest import AvahiListener
from avahitest import txt_get_key
from avahi import txt_array_to_string_array
import time
PUBLISHED_NAME="test-register"
FIRST_NAME="lastname"
LAST_NAME="lastname"
def test(q, bus, conn):
a = AvahiListener(q)
a.listen_for_se... | Test that the service is register with the correct txt record | Test that the service is register with the correct txt record
| Python | lgpl-2.1 | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | ---
+++
@@ -1,8 +1,14 @@
from saluttest import exec_test
import avahitest
from avahitest import AvahiListener
+from avahitest import txt_get_key
+from avahi import txt_array_to_string_array
import time
+
+PUBLISHED_NAME="test-register"
+FIRST_NAME="lastname"
+LAST_NAME="lastname"
def test(q, bus, conn):
... |
f898d1cc96fe66a097def29552f3774f3509be83 | insultgenerator/words.py | insultgenerator/words.py | import pkg_resources
import random
_insulting_adjectives = []
def _load_wordlists():
global _insulting_adjectives
insulting_adjective_list = pkg_resources.resource_string(__name__, "wordlists/insulting_adjectives.txt")
_insulting_adjectives = insulting_adjective_list.decode().split('\n')
def get_insulting_adjecti... | import pkg_resources
import random
_insulting_adjectives = []
def _load_wordlists():
global _insulting_adjectives
insulting_adjective_list = pkg_resources.resource_string(__name__, "wordlists/insulting_adjectives.txt")
_insulting_adjectives = insulting_adjective_list.decode().split('\n')
def get_insulting_adjecti... | Revert "Adding test failure to ensure that CI is functioning correctly" | Revert "Adding test failure to ensure that CI is functioning correctly"
This reverts commit 754be81c1ccc385d8e7b418460271966d7db2361.
| Python | mit | tr00st/insult_generator | ---
+++
@@ -9,7 +9,6 @@
_insulting_adjectives = insulting_adjective_list.decode().split('\n')
def get_insulting_adjective():
- return _insulting_adjectives[0]
return random.choice(_insulting_adjectives)
_load_wordlists() |
6fbe58692005e5c8b7a9c4f4e98984ae86d347a2 | pinax/messages/context_processors.py | pinax/messages/context_processors.py | from .models import Thread
def user_messages(request):
c = {}
if request.user.is_authenticated():
c["inbox_count"] = Thread.inbox(request.user).count()
return c
| from .models import Thread
def user_messages(request):
c = {}
if request.user.is_authenticated():
c["inbox_threads"] = Thread.inbox(request.user)
c["unread_threads"] = Thread.unread(request.user)
return c
| Return querysets in context processor to be more useful | Return querysets in context processor to be more useful
| Python | mit | eldarion/user_messages,pinax/pinax-messages,pinax/pinax-messages,arthur-wsw/pinax-messages,eldarion/user_messages,arthur-wsw/pinax-messages | ---
+++
@@ -4,5 +4,6 @@
def user_messages(request):
c = {}
if request.user.is_authenticated():
- c["inbox_count"] = Thread.inbox(request.user).count()
+ c["inbox_threads"] = Thread.inbox(request.user)
+ c["unread_threads"] = Thread.unread(request.user)
return c |
c63a1c2bc92267ac2b5ffc52c7189942d034c37b | src/dashboard/src/installer/views.py | src/dashboard/src/installer/views.py | # This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the ... | # This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the ... | Define skeleton for the function that will create the superuser | Define skeleton for the function that will create the superuser
Autoconverted from SVN (revision:2929)
| Python | agpl-3.0 | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | ---
+++
@@ -15,8 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see <http://www.gnu.org/licenses/>.
+from django.contrib.auth.models import User
from django.shortcuts import render
from django.http import HttpResponse
def welcome(request):
... |
c555c53290c8894c80dc7991081dd5d7591fda8c | helpers/run_feeds.py | helpers/run_feeds.py | from core.feed import Feed
import core.config.celeryimports
if __name__ == '__main__':
all_feeds = Feed.objects()
for n in all_feeds:
print "Testing: {}".format(n)
n.update()
| import sys
from core.feed import Feed
import core.config.celeryimports
if __name__ == '__main__':
if len(sys.argv) == 1:
all_feeds = Feed.objects()
elif len(sys.argv) >= 2:
all_feeds = [Feed.objects.get(name=sys.argv[1])]
print all_feeds
for n in all_feeds:
print "Testing: {... | Add argument to run single feed | Add argument to run single feed
| Python | apache-2.0 | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | ---
+++
@@ -1,9 +1,17 @@
+import sys
+
from core.feed import Feed
import core.config.celeryimports
if __name__ == '__main__':
- all_feeds = Feed.objects()
+
+ if len(sys.argv) == 1:
+ all_feeds = Feed.objects()
+ elif len(sys.argv) >= 2:
+ all_feeds = [Feed.objects.get(name=sys.argv[1])]... |
12254ea15b1f761ad63095ed7244f347d42e4c85 | file_encryptor/__init__.py | file_encryptor/__init__.py |
from file_encryptor import (convergence, key_generators)
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Storj Labs
#
# 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 witho... | Add copyright, license and version information. | Add copyright, license and version information.
| Python | mit | Storj/file-encryptor | ---
+++
@@ -1,2 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2014 Storj Labs
+#
+# 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... |
864dac9b2586891f62700e3170421617aca48a88 | deployment/config.py | deployment/config.py | class Azure:
resource_group = "MajavaShakki"
location = "northeurope"
cosmosdb_name = f"{resource_group}mongo".lower()
plan_name = f"{resource_group}Plan"
site_name = f"{resource_group}Site"
class Mongo:
database_name = "Majavashakki"
collection_throughput = 500
collections = ["gamemodels", "sessions",... | class Azure:
resource_group = "MajavaShakki"
location = "northeurope"
cosmosdb_name = f"{resource_group}mongo".lower()
plan_name = f"{resource_group}Plan"
site_name = f"{resource_group}Site"
class Mongo:
database_name = "Majavashakki"
collection_throughput = 500
system_indexes_collection = "undefined" ... | Configure throughput for 'undefined' collection | Configure throughput for 'undefined' collection
https://github.com/Automattic/mongoose/issues/6989
https://jira.mongodb.org/browse/NODE-1662
| Python | mit | Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki | ---
+++
@@ -8,4 +8,5 @@
class Mongo:
database_name = "Majavashakki"
collection_throughput = 500
- collections = ["gamemodels", "sessions", "users"]
+ system_indexes_collection = "undefined" # https://github.com/Automattic/mongoose/issues/6989
+ collections = ["gamemodels", "sessions", "users", system_indexe... |
f0c684ab89fa4fe698c9e20e7e904d3371fe58e2 | setup.py | setup.py | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup
setup(
name='alfred-workflow-packager',
version='0.11.0',
description='A CLI utility for packaging and exporting Alfred workflows',
url='https://github.com/caleb531/alfred-workflow-packager',
author='Caleb Evans',
author_email='... | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup
setup(
name='alfred-workflow-packager',
version='0.11.0',
description='A CLI utility for packaging and exporting Alfred workflows',
url='https://github.com/caleb531/alfred-workflow-packager',
author='Caleb Evans',
author_email='... | Add awp as an additional shell command | Add awp as an additional shell command
| Python | mit | caleb531/alfred-workflow-packager | ---
+++
@@ -23,7 +23,8 @@
entry_points={
'console_scripts': [
'alfred-workflow-packager=awp.main:main',
- 'workflow-packager=awp.main:main'
+ 'workflow-packager=awp.main:main',
+ 'awp=awp.main:main'
]
}
) |
6218287f7123e7c952e35ef8e12cacb985cea435 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.core import Extension
VERSION = '1.0.5'
LONG_DESCRIPTION = """
A numerical geometric algebra module for python. BSD License.
"""
setup(
name='clifford',
version=VERSION,
license='bsd',
description='Numerical Geometric Alge... | #!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.core import Extension
import os
version_path = os.path.join('clifford', '_version.py')
exec(open(version_path).read())
LONG_DESCRIPTION = """
A numerical geometric algebra module for python. BSD License.
"""
setup(
name='clifford',
... | Add missing change from gh-172 | Add missing change from gh-172
Not sure how this got lost
| Python | bsd-3-clause | arsenovic/clifford,arsenovic/clifford | ---
+++
@@ -1,14 +1,18 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.core import Extension
+import os
-VERSION = '1.0.5'
+version_path = os.path.join('clifford', '_version.py')
+exec(open(version_path).read())
+
LONG_DESCRIPTION = """
A numerical geometric algebra module f... |
2ef3699e0635f96ee6371806d157ec1d159b60b7 | setup.py | setup.py | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='ppp_datamodel',
version='0.1',
description='Data model for the Projet Pensées Profondes.',
url='https://github.com/ProjetPP/PPP-datamodel-Python',
author='Valentin Lorentz',
author_email='valentin.lorentz+ppp@ens-l... | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='ppp_datamodel',
version='0.1',
description='Data model for the Projet Pensées Profondes.',
url='https://github.com/ProjetPP/PPP-datamodel-Python',
author='Valentin Lorentz',
author_email='valentin.lorentz+ppp@ens-l... | Fix classifiers (Python 3.2 is supported). | Fix classifiers (Python 3.2 is supported).
| Python | agpl-3.0 | ProjetPP/PPP-datamodel-Python,ProjetPP/PPP-datamodel-Python | ---
+++
@@ -16,6 +16,7 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.... |
e09d2d2be0c2dbb605f562dca857562acc0c0fdb | setup.py | setup.py | """This is the docstring for the example.py module. Modules names should
have short, all-lowercase names. The module name may have underscores if
this improves readability.
Every module should have a docstring at the very top of the file. The
module's docstring may extend over multiple lines. If your docstring does... | """This is the docstring for the example.py module. Modules names should
have short, all-lowercase names. The module name may have underscores if
this improves readability.
Every module should have a docstring at the very top of the file. The
module's docstring may extend over multiple lines. If your docstring does... | Update PyPSA version in requirements | Update PyPSA version in requirements
| Python | agpl-3.0 | openego/ego.powerflow | ---
+++
@@ -20,7 +20,7 @@
license="GNU GENERAL PUBLIC LICENSE Version 3",
packages=find_packages(),
install_requires=['pandas >= 0.17.0, <=0.19.1',
- 'pypsa >= 0.6.2, <= 0.6.2',
+ 'pypsa >= 0.8.0, <= 0.8.0',
'sqlalchemy >= 1.0... |
506612277718e13d852330553f52903544e3f3c2 | setup.py | setup.py | from os.path import abspath, dirname, join, normpath
from setuptools import setup
setup(
# Basic package information:
name = 'django-heroku-memcacheify',
version = '0.8',
py_modules = ('memcacheify',),
# Packaging options:
zip_safe = False,
include_package_data = True,
# Package de... | from os.path import abspath, dirname, join, normpath
from setuptools import setup
setup(
# Basic package information:
name = 'django-heroku-memcacheify',
version = '0.8',
py_modules = ('memcacheify',),
# Packaging options:
zip_safe = False,
include_package_data = True,
# Package de... | Update django-pylibmc dependency to >=0.6.1 | Update django-pylibmc dependency to >=0.6.1
As a bonus, django-pylibmc 0.5.0+ supports Python 3, for which testing
will be enabled in another PR.
I've switched to using greater than, since the Python packaging
guidelines say it's not best practice to use `install_requires` to pin
dependencies to specific versions:
ht... | Python | unlicense | rdegges/django-heroku-memcacheify | ---
+++
@@ -15,7 +15,7 @@
include_package_data = True,
# Package dependencies:
- install_requires = ['django-pylibmc==0.5.0'],
+ install_requires = ['django-pylibmc>=0.6.1'],
# Metadata for PyPI:
author = 'Randall Degges', |
5c3aee40f21b6346120df99698b1f273886b5e70 | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup
import ibei
setup(name = "ibei",
version = ibei.__version__,
author = "Joshua Ryan Smith",
author_email = "joshua.r.smith@gmail.com",
packages = ["ibei", "physicalproperty"],
url = "https://github.com/jrsmith3/ibei",
description =... | # -*- coding: utf-8 -*-
from setuptools import setup
import ibei
setup(name="ibei",
version=ibei.__version__,
author="Joshua Ryan Smith",
author_email="joshua.r.smith@gmail.com",
packages=["ibei", "physicalproperty"],
url="https://github.com/jrsmith3/ibei",
description="Calculator f... | Fix pep8 and whitespace issues | Fix pep8 and whitespace issues
| Python | mit | jrsmith3/ibei | ---
+++
@@ -2,20 +2,20 @@
from setuptools import setup
import ibei
-setup(name = "ibei",
- version = ibei.__version__,
- author = "Joshua Ryan Smith",
- author_email = "joshua.r.smith@gmail.com",
- packages = ["ibei", "physicalproperty"],
- url = "https://github.com/jrsmith3/ibei",
- ... |
182985866082ae039629ac3bcd84e62e169655ba | setup.py | setup.py | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
import pyvim
long_description = open(
os.path.join(
os.path.dirname(__file__),
'README.rst'
)
).read()
setup(
name='pyvim',
author='Jonathan Slenders',
version=pyvim.__version__,
license='LICENSE',
... | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
import pyvim
long_description = open(
os.path.join(
os.path.dirname(__file__),
'README.rst'
)
).read()
setup(
name='pyvim',
author='Jonathan Slenders',
version=pyvim.__version__,
license='LICENSE',
... | Upgrade of prompt-toolkit and ptpython. | Upgrade of prompt-toolkit and ptpython.
| Python | bsd-3-clause | jonathanslenders/pyvim,amjith/pyvim | ---
+++
@@ -21,8 +21,8 @@
long_description=long_description,
packages=find_packages('.'),
install_requires = [
- 'prompt-toolkit==0.46',
- 'ptpython==0.21', # For the Python completion (with Jedi.)
+ 'prompt-toolkit==0.50',
+ 'ptpython==0.22', # For the Python completion (... |
0e400261b2dad04dc9f290cdbc5b16222487d4e3 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name="pysovo",
version="0.4.1",
packages=['pysovo', 'pysovo.comms',
'pysovo.tests', 'pysovo.tests.resources'],
package_data={'pysovo':['tests/resources/*.xm... | #!/usr/bin/env python
from setuptools import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name="pysovo",
version="0.4.1",
packages=['pysovo', 'pysovo.comms', 'pysovo.triggers',
'pysovo.tests', 'pysovo.tests.resources'],
package_data={'pysovo':['t... | Add triggers module to install. | Add triggers module to install.
| Python | bsd-2-clause | timstaley/pysovo | ---
+++
@@ -8,7 +8,7 @@
setup(
name="pysovo",
version="0.4.1",
- packages=['pysovo', 'pysovo.comms',
+ packages=['pysovo', 'pysovo.comms', 'pysovo.triggers',
'pysovo.tests', 'pysovo.tests.resources'],
package_data={'pysovo':['tests/resources/*.xml', 'templates/*.txt']},
desc... |
343422a7f609d0f0c1484ea4573064c7f9d54156 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.core import Extension
module = Extension('confluent_kafka.cimpl',
include_dirs = ['/usr/local/include'],
libraries= ['rdkafka'],
sources=['confluent_kafka/src/confluent_kafka.c... | #!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.core import Extension
module = Extension('confluent_kafka.cimpl',
include_dirs = ['/usr/local/include'],
libraries= ['rdkafka'],
sources=['confluent_kafka/src/confluent_kafka.c... | Include LICENSE file in bdist | Include LICENSE file in bdist
| Python | apache-2.0 | blindroot/confluent-kafka-python,blindroot/confluent-kafka-python | ---
+++
@@ -18,4 +18,5 @@
author_email='support@confluent.io',
url='https://github.com/confluentinc/confluent-kafka-python',
ext_modules=[module],
- packages=find_packages())
+ packages=find_packages(),
+ data_files = [('', ['LICENSE'])]) |
54098ac30100cc40373689a35dfc2a1f96a5844d | setup.py | setup.py | from setuptools import setup, find_packages
deps = [
'mozillapulse',
'mozci>=0.7.0',
'requests',
]
setup(name='pulse-actions',
version='0.1.4',
description='A pulse listener that acts upon messages with mozci.',
classifiers=['Intended Audience :: Developers',
'License ... | from setuptools import setup, find_packages
deps = [
'mozillapulse',
'mozci>=0.7.3',
'requests',
]
setup(name='pulse-actions',
version='0.1.4',
description='A pulse listener that acts upon messages with mozci.',
classifiers=['Intended Audience :: Developers',
'License ... | Update mozci version to handle credentials in env variables | Update mozci version to handle credentials in env variables
| Python | mpl-2.0 | vaibhavmagarwal/pulse_actions,nikkisquared/pulse_actions,armenzg/pulse_actions,adusca/pulse_actions,mozilla/pulse_actions | ---
+++
@@ -2,7 +2,7 @@
deps = [
'mozillapulse',
- 'mozci>=0.7.0',
+ 'mozci>=0.7.3',
'requests',
]
|
ccafb464e8baadcf5064708b8f2e2ccc9f6943b4 | setup.py | setup.py | from ez_setup import use_setuptools
use_setuptools() # nopep8
from setuptools import setup, find_packages
import os
import re
with open(os.path.join('activitysim', '__init__.py')) as f:
info = re.search(r'__.*', f.read(), re.S)
exec(info[0])
setup(
name='activitysim',
version=__versio... | from ez_setup import use_setuptools
use_setuptools() # nopep8
from setuptools import setup, find_packages
import os
import re
with open(os.path.join('activitysim', '__init__.py')) as f:
info = re.search(r'__.*', f.read(), re.S)
exec(info[0])
setup(
name='activitysim',
version=__versio... | Use Cython version of toolz | Use Cython version of toolz
Usage of activitysim within popultionsim fails with missing module cytoolz - i believe that activitysim is using cytoolz internally rather than toolz | Python | agpl-3.0 | synthicity/activitysim,synthicity/activitysim | ---
+++
@@ -33,7 +33,7 @@
'pandas >= 1.1.0',
'pyyaml >= 5.1',
'tables >= 3.5.1',
- 'toolz >= 0.8.1',
+ 'cytoolz >= 0.8.1',
'psutil >= 4.1',
'requests >= 2.7',
'numba >= 0.51.2', |
85e5ea5b4fcc7039a6d3441fcc65fc3d0825f16c | setup.py | setup.py | import os, sys
from setuptools import setup
setup(
name='reddit_comment_scraper',
version='2.0.0',
description='A simple Reddit-scraping script',
url='https://github.com/jfarmer/reddit_comment_scraper',
author='Jesse Farmer',
author_email='jesse@20bits.com',
license='MIT',
packages=['r... | import os, sys
from setuptools import setup
setup(
name='reddit_comment_scraper',
version='2.0.0',
description='A simple Reddit-scraping script',
url='https://github.com/jfarmer/reddit_comment_scraper',
author='Jesse Farmer',
author_email='jesse@20bits.com',
license='MIT',
packages=['r... | Add more versions of Windows + environment | Add more versions of Windows + environment
| Python | mit | jfarmer/reddit_comment_scraper,chrisswk/reddit_comment_scraper | ---
+++
@@ -26,8 +26,12 @@
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
+ 'Environment :: Console',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
- 'Operating System :: Microsoft :: Window... |
c1edd4d1a9ba3ef57ea3524013efdb4faa51fc94 | setup.py | setup.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from setuptools import setup, find_packages
import os
try:
import pypandoc
README = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
README = ''
setup(name='niprov',
version='0.1.post1',
author='Jasper J.F. van den Bosch',
author_... | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from setuptools import setup, find_packages
import os
try:
import pypandoc
README = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
README = ''
setup(name='niprov',
version='0.1.post2',
author='Jasper J.F. van den Bosch',
author_... | Patch version bump to .post2 | Patch version bump to .post2
| Python | bsd-3-clause | ilogue/niprov,ilogue/niprov,ilogue/niprov,ilogue/niprov | ---
+++
@@ -10,7 +10,7 @@
README = ''
setup(name='niprov',
- version='0.1.post1',
+ version='0.1.post2',
author='Jasper J.F. van den Bosch',
author_email='japsai@gmail.com',
description='provenance for neuroimaging data', |
cba6cbc22faf1bf1d1351417854a06b1472c13dc | setup.py | setup.py | from distutils.core import setup
import os
from setuptools import find_packages
__version__ = 'unknown'
version_path = os.path.join(os.path.split(__file__)[0], 'banneret/version.py')
with open(version_path) as version_file:
exec(version_file.read())
URL = 'https://github.com/lancelote/banneret'
setup(
name... | from distutils.core import setup
import os
from setuptools import find_packages
__version__ = 'unknown'
version_path = os.path.join(os.path.split(__file__)[0], 'banneret/version.py')
with open(version_path) as version_file:
exec(version_file.read())
URL = 'https://github.com/lancelote/banneret'
setup(
name... | Switch entry point to click's cli | Switch entry point to click's cli
| Python | mit | lancelote/banneret | ---
+++
@@ -23,7 +23,7 @@
keywords=['pycharm', 'cli'],
entry_points={
'console_scripts': [
- 'bnrt = banneret.main:main'
+ 'bnrt = banneret.main:cli'
]
},
install_requires=[ |
0eba6d5b468bf2a03883638fd7d3500585029b86 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
]
dist = setup(
name='cloudpickle',
version='0.1.0',
description='Extended pickling support for Python objects',
autho... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
'pytest',
'pytest-cov'
]
dist = setup(
name='cloudpickle',
version='0.1.0',
description='Extended pickling support... | Bring in pytest and pytest-cov | Bring in pytest and pytest-cov
| Python | bsd-3-clause | pczerkas/cloudpickle,pczerkas/cloudpickle | ---
+++
@@ -10,6 +10,8 @@
]
test_requirements = [
+ 'pytest',
+ 'pytest-cov'
]
dist = setup( |
3eb3cc047f2f5a358066eac8f806580089d70df2 | setup.py | setup.py | from distutils.core import setup
setup(name='dscsrf',
version='1.0',
description='Global double-submit Flask CSRF',
packages=['dscsrf'],
py_modules=['flask'],
)
| from distutils.core import setup
setup(name='dscsrf',
version='1.0',
description='Global double-submit Flask CSRF',
packages=['dscsrf'],
py_modules=['flask'],
author='sc4reful',
url = 'https://github.com/sc4reful/dscsrf',
keywords = ['security', 'flask', 'website', 'csrf'],
download_url = 'https://github.com/s... | Prepare for tagging for PyPI | Prepare for tagging for PyPI
| Python | mit | wkoathp/dscsrf | ---
+++
@@ -4,4 +4,8 @@
description='Global double-submit Flask CSRF',
packages=['dscsrf'],
py_modules=['flask'],
+ author='sc4reful',
+ url = 'https://github.com/sc4reful/dscsrf',
+ keywords = ['security', 'flask', 'website', 'csrf'],
+ download_url = 'https://github.com/sc4reful/dscsrf/tarball/1.0',
) |
666cb18b25a22c0192420755148684d8e005572c | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='relengapi-mapper',
version='0.1',
description='hg to git mapper',
author='Chris AtLee',
author_email='chris@atlee.ca',
url='https://github.com/catlee/mapper',
packages=find_packages(),
namespace_pac... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='relengapi-mapper',
version='0.1',
description='hg to git mapper',
author='Chris AtLee',
author_email='chris@atlee.ca',
url='https://github.com/petemoore/mapper',
packages=find_packages(),
namespace_... | Update url to current RoR | Update url to current RoR | Python | mpl-2.0 | mozilla-releng/services,lundjordan/services,Callek/build-relengapi,srfraser/services,andrei987/services,mozilla/build-relengapi,hwine/build-relengapi,La0/mozilla-relengapi,lundjordan/services,Callek/build-relengapi,djmitche/build-relengapi,garbas/mozilla-releng-services,lundjordan/services,hwine/build-relengapi,Callek/... | ---
+++
@@ -7,7 +7,7 @@
description='hg to git mapper',
author='Chris AtLee',
author_email='chris@atlee.ca',
- url='https://github.com/catlee/mapper',
+ url='https://github.com/petemoore/mapper',
packages=find_packages(),
namespace_packages=['relengapi', 'relengapi.bluepri... |
f53667ef43e1b57b611e55155571cf985fdf40d5 | setup.py | setup.py | from setuptools import find_packages, setup
with open('README.rst') as f:
long_description = f.read()
setup(
name='ocdsmerge',
version='0.6.6',
author='Open Contracting Partnership',
author_email='data@open-contracting.org',
url='https://github.com/open-contracting/ocds-merge',
description... | from setuptools import find_packages, setup
with open('README.rst') as f:
long_description = f.read()
setup(
name='ocdsmerge',
version='0.6.6',
author='Open Contracting Partnership',
author_email='data@open-contracting.org',
url='https://github.com/open-contracting/ocds-merge',
description... | Add Python :: Implementation classifiers | build: Add Python :: Implementation classifiers
| Python | bsd-3-clause | open-contracting/ocds-merge | ---
+++
@@ -34,5 +34,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
... |
5c6bb0b463f0cfde26f56251bb3225e358d4b2b6 | setup.py | setup.py | from setuptools import setup, find_packages
setup(name='corker',
version='0.4',
description='Another WSGI Framework',
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"T... | from setuptools import setup, find_packages
setup(name='corker',
version='0.4.1',
description='Another WSGI Framework',
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
... | Bump to version 0.4.1 since 0.4 was mis-packaged. | Bump to version 0.4.1 since 0.4 was mis-packaged.
| Python | bsd-2-clause | jd-boyd/corker,vs-networks/corker | ---
+++
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='corker',
- version='0.4',
+ version='0.4.1',
description='Another WSGI Framework',
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Developers", |
19d2fcf0da030f32d9cef9384a5b5113dfcd8443 | setup.py | setup.py | from setuptools import setup
from rewrite_external_links import get_version
description = (
'Rewrite all external (off-site) links to go via a message page, '
+ 'using a middleware class.'
)
setup(
name="django-rewrite-external-links",
packages=["rewrite_external_links"],
include_package_data=Tr... | from setuptools import setup
from rewrite_external_links import get_version
description = (
'Rewrite all external (off-site) links to go via a message page, '
'using a middleware class.'
)
setup(
name="django-rewrite-external-links",
packages=["rewrite_external_links"],
include_package_data=True... | Fix W503 line break before binary operator | Fix W503 line break before binary operator
| Python | bsd-2-clause | incuna/django-rewrite-external-links,incuna/django-rewrite-external-links | ---
+++
@@ -5,7 +5,7 @@
description = (
'Rewrite all external (off-site) links to go via a message page, '
- + 'using a middleware class.'
+ 'using a middleware class.'
)
setup( |
a0b75e48cad0be6028e6ff12873d1bd73307734c | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import derpibooru
setup(
name = "DerPyBooru",
description = "Python bindings for Derpibooru's API",
url = "https://github.com/joshua-stone/DerPyBooru",
version = "0.5.2",
author = "Joshua Stone",
author_email = "joshu... | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import derpibooru
setup(
name = "DerPyBooru",
description = "Python bindings for Derpibooru's API",
url = "https://github.com/joshua-stone/DerPyBooru",
version = "0.5.2",
author = "Joshua Stone",
author_email = "joshu... | Change license classifier to BSD License to remove PyPI error | Change license classifier to BSD License to remove PyPI error
| Python | bsd-2-clause | joshua-stone/DerPyBooru | ---
+++
@@ -22,7 +22,7 @@
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
- "License :: OSI Approved :: Simplified BSD License",
+ "License :: OSI Approved :: BSD License",
"Topic :: Software Development :: Libraries :: Python Module... |
5a92773a1d9c40e745026ca318ae21bfce2d4fb6 | flaskext/cache/backends.py | flaskext/cache/backends.py | from werkzeug.contrib.cache import (NullCache, SimpleCache, MemcachedCache,
GAEMemcachedCache, FileSystemCache)
def null(app, args, kwargs):
return NullCache()
def simple(app, args, kwargs):
kwargs.update(dict(threshold=app.config['CACHE_THRESHOLD']))
return SimpleCache... | from werkzeug.contrib.cache import (NullCache, SimpleCache, MemcachedCache,
GAEMemcachedCache, FileSystemCache)
def null(app, args, kwargs):
return NullCache()
def simple(app, args, kwargs):
kwargs.update(dict(threshold=app.config['CACHE_THRESHOLD']))
return SimpleCache... | Make CACHE_REDIS_PASSWORD really optional, because it does not work with older Werkzeug. | Make CACHE_REDIS_PASSWORD really optional, because it does not work with older Werkzeug.
| Python | bsd-3-clause | kazeeki/mezmorize,kazeeki/mezmorize,j-fuentes/flask-cache,ordbogen/flask-cache,j-fuentes/flask-cache,thadeusb/flask-cache,alexey-sveshnikov/flask-cache,ordbogen/flask-cache,alexey-sveshnikov/flask-cache,thadeusb/flask-cache,gerasim13/flask-cache,gerasim13/flask-cache | ---
+++
@@ -32,7 +32,10 @@
kwargs.update(dict(
host=app.config.get('CACHE_REDIS_HOST', 'localhost'),
port=app.config.get('CACHE_REDIS_PORT', 6379),
- password=app.config.get('CACHE_REDIS_PASSWORD', None)
))
+ password = app.config.get('CACHE_REDIS_PASSWORD... |
f019902da41a5b224537ef8a4a87e90701ec538a | project_template/project_settings.py | project_template/project_settings.py | # Do not commit secrets to VCS.
# Local environment variables will be loaded from `.env.local`.
# Additional environment variables will be loaded from `.env.$DOTENV`.
# Local settings will be imported from `project_settings_local.py`
from icekit.project.settings.icekit import * # glamkit, icekit
# Override the defa... | # Do not commit secrets to VCS.
# Local environment variables will be loaded from `.env.local`.
# Additional environment variables will be loaded from `.env.$DOTENV`.
# Local settings will be imported from `project_settings_local.py`
from icekit.project.settings.glamkit import * # glamkit, icekit
# Override the def... | Enable extra GLAMkit features by default in ICEkit project | Enable extra GLAMkit features by default in ICEkit project
Enable GLAMkit features by default for new ICEkit projects, since they
will probably be wanted anyway and because it will also indirectly
ensure we run unit tests for all GLAMkit features.
| Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | ---
+++
@@ -4,6 +4,6 @@
# Additional environment variables will be loaded from `.env.$DOTENV`.
# Local settings will be imported from `project_settings_local.py`
-from icekit.project.settings.icekit import * # glamkit, icekit
+from icekit.project.settings.glamkit import * # glamkit, icekit
# Override the def... |
c9c0104456ef7d5dcda29db67788112a8435945b | scripts/createDataModel.py | scripts/createDataModel.py | # script :: creating a datamodel that fits mahout from ratings.dat
ratings_dat = open('../data/movielens-1m/ratings.dat', 'r')
ratings_csv = open('../data/movielens-1m/ratings_without_timestamp.txt', 'w')
for line in ratings_dat:
arr = line.split('::')
new_line = ','.join(arr[:3])+'\n';
ratings_csv.write(new_lin... | #!/usr/bin/env python
# script :: creating a datamodel that fits mahout from ratings.dat
ratings_dat = open('../data/movielens-1m/users.dat', 'r')
ratings_csv = open('../data/movielens-1m/users.txt', 'w')
for line in ratings_dat:
arr = line.split('::')
new_line = '\t'.join(arr)
ratings_csv.write(new_line)
rati... | Convert data delimiter from :: to tab character. | Convert data delimiter from :: to tab character.
| Python | mit | monsendag/goldfish,ntnu-smartmedia/goldfish,ntnu-smartmedia/goldfish,monsendag/goldfish,ntnu-smartmedia/goldfish,monsendag/goldfish | ---
+++
@@ -1,12 +1,14 @@
+#!/usr/bin/env python
# script :: creating a datamodel that fits mahout from ratings.dat
-ratings_dat = open('../data/movielens-1m/ratings.dat', 'r')
-ratings_csv = open('../data/movielens-1m/ratings_without_timestamp.txt', 'w')
+
+ratings_dat = open('../data/movielens-1m/users.dat', '... |
a71bd3f953b0363df82d1e44b0d6df6cbe4d449b | vocab.py | vocab.py | import fire
import json
import sys
from source import VocabularyCom
from airtable import Airtable
class CLI:
class source:
"""Import word lists from various sources"""
def vocabulary_com(self, list_url, pretty=False):
result = VocabularyCom().collect(list_url)
if pretty:
... | import fire
import json
import sys
from source import VocabularyCom
from airtable import Airtable
class CLI:
class source:
"""Import word lists from various sources"""
def vocabulary_com(self, list_url, pretty=False):
result = VocabularyCom().collect(list_url)
if pretty:
... | Print number of terms loaded to Airtable. | Print number of terms loaded to Airtable.
| Python | mit | zqureshi/vocab | ---
+++
@@ -21,20 +21,18 @@
"""Sync lists to Airtable"""
def load(self, list_url, endpoint, key):
- airtable = Airtable(endpoint, key)
-
words = VocabularyCom().collect(list_url)
- airtable.load(words)
-
- print 'List loaded to Airtable.'
+ ... |
c354d130cb542c2a5d57e519ce49175daa597e9c | froide/accesstoken/apps.py | froide/accesstoken/apps.py | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class AccessTokenConfig(AppConfig):
name = 'froide.accesstoken'
verbose_name = _('Secret Access Token')
def ready(self):
from froide.account import account_canceled
account_canceled.connect(cancel_u... | import json
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class AccessTokenConfig(AppConfig):
name = 'froide.accesstoken'
verbose_name = _('Secret Access Token')
def ready(self):
from froide.account import account_canceled
from froide.account.e... | Add user data export for accesstokens | Add user data export for accesstokens | Python | mit | fin/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide | ---
+++
@@ -1,3 +1,5 @@
+import json
+
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
@@ -8,8 +10,10 @@
def ready(self):
from froide.account import account_canceled
+ from froide.account.export import registry
account_canceled.connect(ca... |
9ad1929ee16a805acb9e8fbc57312466fdb1770e | cnxepub/tests/scripts/test_collated_single_html.py | cnxepub/tests/scripts/test_collated_single_html.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import mimetypes
import os.path
import tempfile
import unittest
try:
from unittest import mock
except ... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import io
import mimetypes
import os.path
import sys
import tempfile
import unittest
from lxml import etre... | Add a test for the validate-collated tree output | Add a test for the validate-collated tree output
| Python | agpl-3.0 | Connexions/cnx-epub,Connexions/cnx-epub,Connexions/cnx-epub | ---
+++
@@ -5,15 +5,12 @@
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
-
+import io
import mimetypes
import os.path
+import sys
import tempfile
import unittest
-try:
- from unittest import mock
-except ImportError:
- import mock
from lxml import etree
@@ -36,3 +33,15 @@
... |
020eea26390ab7fa20527ed24021522512a100a5 | account_operating_unit/__manifest__.py | account_operating_unit/__manifest__.py | # © 2019 Eficent Business and IT Consulting Services S.L.
# © 2019 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Accounting with Operating Units",
"summary": "Introduces Operating Unit (OU) in invoices and "
"Accounting Entries with cl... | # © 2019 Eficent Business and IT Consulting Services S.L.
# © 2019 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Accounting with Operating Units",
"summary": "Introduces Operating Unit (OU) in invoices and "
"Accounting Entries with cl... | Reduce the width of dependency from analytic_operating_unit to operating_unit | Reduce the width of dependency from analytic_operating_unit to operating_unit
| Python | agpl-3.0 | OCA/operating-unit,OCA/operating-unit | ---
+++
@@ -12,7 +12,7 @@
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/operating-unit",
"category": "Accounting & Finance",
- "depends": ["account", "analytic_operating_unit"],
+ "depends": ["account", "operating_unit"],
"license": "LGPL-3",
"data": [
... |
eba354cfaa96754b814daeb7fa453e538b07a879 | krcurrency/utils.py | krcurrency/utils.py | """:mod:`krcurrency.utils` --- Helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from bs4 import BeautifulSoup as BS
import requests
__all__ = 'request',
def request(url, encoding='utf-8', parselib='lxml'):
"""url로 요청한 후 돌려받은 값을 BeautifulSoup 객체로 변환해서 반환합니다.
"""
r = requests.get(url)
if r.status_c... | """:mod:`krcurrency.utils` --- Helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from bs4 import BeautifulSoup as BS
import requests
__all__ = 'request', 'tofloat',
def request(url, encoding='utf-8', parselib='lxml'):
"""url로 요청한 후 돌려받은 값을 BeautifulSoup 객체로 변환해서 반환합니다.
"""
r = requests.get(url)
if... | Add tofloat function that transforms from any float-based string into float | Add tofloat function that transforms from any float-based string into float
| Python | mit | ssut/py-krcurrency | ---
+++
@@ -5,7 +5,7 @@
from bs4 import BeautifulSoup as BS
import requests
-__all__ = 'request',
+__all__ = 'request', 'tofloat',
def request(url, encoding='utf-8', parselib='lxml'):
"""url로 요청한 후 돌려받은 값을 BeautifulSoup 객체로 변환해서 반환합니다.
@@ -21,3 +21,12 @@
except Exception as e:
pass
retu... |
ee498b8a22def03fb745ebab53a875c9097d44b6 | test/mgdpck/syntax_test.py | test/mgdpck/syntax_test.py | import mgdpck
from mgdpck import _version
from mgdpck import data_access
from mgdpck import exceptions
from mgdpck import logging_util
from mgdpck import model
from mgdpck import actions
from mgdpck.readers import *
from mgdpck.writters import *
from scripts import mgd
| import mgdpck
from mgdpck import _version
from mgdpck import data_access
from mgdpck import exceptions
from mgdpck import logging_util
from mgdpck import model
from mgdpck import actions
from mgdpck.readers import *
from mgdpck.writters import *
# from scripts import mgd
| Remove a problematic test on travis. | Remove a problematic test on travis.
| Python | apache-2.0 | Djabx/mgd | ---
+++
@@ -7,4 +7,4 @@
from mgdpck import actions
from mgdpck.readers import *
from mgdpck.writters import *
-from scripts import mgd
+# from scripts import mgd |
c1da1e8d15990efa7b30de241e3604bc824792dc | py101/introduction/__init__.py | py101/introduction/__init__.py | """"
Introduction Adventure
Author: igui
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"Introduction Adventure test"
def __init__(self, sourcefile):
... | """"
Introduction Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"Introduction Adventure test"
de... | Correct Author string in module | Correct Author string in module
| Python | mit | sophilabs/py101 | ---
+++
@@ -1,7 +1,7 @@
""""
Introduction Adventure
-Author: igui
+Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io |
2651ddf1946ec489195ec9c3fb23e00e5735c79c | sites/cozylan/extension.py | sites/cozylan/extension.py | """
Site-specific code extension
"""
from __future__ import annotations
from typing import Any
from flask import g
from byceps.services.seating import seat_service
from byceps.services.ticketing import ticket_service
def template_context_processor() -> dict[str, Any]:
"""Extend template context."""
if g.pa... | """
Site-specific code extension
"""
from __future__ import annotations
from typing import Any
from flask import g
from byceps.services.seating import seat_service
from byceps.services.ticketing import ticket_service
def template_context_processor() -> dict[str, Any]:
"""Extend template context."""
context... | Restructure context assembly for CozyLAN site | Restructure context assembly for CozyLAN site
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -13,13 +13,13 @@
def template_context_processor() -> dict[str, Any]:
"""Extend template context."""
- if g.party_id is None:
- return {}
+ context = {}
- sale_stats = ticket_service.get_ticket_sale_stats(g.party_id)
- seat_utilization = seat_service.get_seat_utilization(g.party... |
624ce97b011100cc1aac9446c7f1c8a97eae5f34 | workshops/migrations/0040_add_country_to_online_events.py | workshops/migrations/0040_add_country_to_online_events.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_country_to_online_events(apps, schema_editor):
"""Add an 'Online' country to all events tagged with 'online' tag."""
Event = apps.get_model('workshops', 'Event')
Tag = apps.get_model('worksho... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_country_to_online_events(apps, schema_editor):
"""Add an 'Online' country to all events tagged with 'online' tag."""
Event = apps.get_model('workshops', 'Event')
Tag = apps.get_model('worksho... | Migrate online events to the Pole of Inaccessibility lat/long | Migrate online events to the Pole of Inaccessibility lat/long
...and 'internet' as a venue.
| Python | mit | pbanaszkiewicz/amy,vahtras/amy,swcarpentry/amy,swcarpentry/amy,wking/swc-amy,vahtras/amy,wking/swc-amy,wking/swc-amy,vahtras/amy,pbanaszkiewicz/amy,wking/swc-amy,pbanaszkiewicz/amy,swcarpentry/amy | ---
+++
@@ -14,8 +14,14 @@
defaults={'details': 'Events taking place entirely online'},
)
+ # Oceanic Pole of Inaccessibility coordinates:
+ # https://en.wikipedia.org/wiki/Pole_of_inaccessibility#Oceanic_pole_of_inaccessibility
+ latitude = -48.876667
+ longitude = -123.393333
+
Even... |
d2046bcf01d02ae9dee91363f61b6afcba3f882f | weave-and-docker-platform/app/app.py | weave-and-docker-platform/app/app.py | from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello World! I have been seen %s times.' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
| from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello World! I have been seen %s times.\n' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
| Add new line. This was annoying. | Add new line. This was annoying.
| Python | apache-2.0 | pessoa/guides,pessoa/guides | ---
+++
@@ -7,7 +7,7 @@
@app.route('/')
def hello():
redis.incr('hits')
- return 'Hello World! I have been seen %s times.' % redis.get('hits')
+ return 'Hello World! I have been seen %s times.\n' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True) |
9ad98b4bbed0c67f25576187996e7e1d534f6a90 | mammoth/__init__.py | mammoth/__init__.py | from .results import Result
from . import docx, conversion, style_reader
def convert_to_html(fileobj):
return docx.read(fileobj).bind(lambda document:
conversion.convert_document_element_to_html(document, styles=_create_default_styles())
)
def _create_default_styles():
lines = filter(None, map(... | from .results import Result
from . import docx, conversion, style_reader
def convert_to_html(fileobj):
return docx.read(fileobj).bind(lambda document:
conversion.convert_document_element_to_html(document, styles=_create_default_styles())
)
def _create_default_styles():
lines = filter(None, map(... | Add full list of default styles | Add full list of default styles
| Python | bsd-2-clause | mwilliamson/python-mammoth,JoshBarr/python-mammoth | ---
+++
@@ -13,5 +13,18 @@
return map(style_reader.read_style, lines)
_default_styles = """
+p.Heading1 => h1:fresh
+p.Heading2 => h2:fresh
+p.Heading3 => h3:fresh
+p.Heading4 => h4:fresh
p:unordered-list(1) => ul > li:fresh
+p:unordered-list(2) => ul|ol > li > ul > li:fresh
+p:unordered-list(3) => ul|ol > l... |
87f483668e352a5807ffafca061238f4a7f86fab | tests/Mechanics/Threads.py | tests/Mechanics/Threads.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_approx_equal, assert_allclose
from UliEngineering.Mechanics.Threads import *
import unittest
class TestThreads(unittest.TestCase):
def test_thread_params(self):
self.assertEqual(threads["M3"].outer_diameter, 41)
| #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_approx_equal, assert_allclose
from UliEngineering.Mechanics.Threads import *
import unittest
class TestThreads(unittest.TestCase):
def test_thread_params(self):
self.assertEqual(threads["M3"].outer_diameter, 3.0)
| Fix intentionally bad testcase which was not run before | Fix intentionally bad testcase which was not run before
| Python | apache-2.0 | ulikoehler/UliEngineering | ---
+++
@@ -6,4 +6,4 @@
class TestThreads(unittest.TestCase):
def test_thread_params(self):
- self.assertEqual(threads["M3"].outer_diameter, 41)
+ self.assertEqual(threads["M3"].outer_diameter, 3.0) |
afd6b5b29b60c59689e0a1be38a0483a7e4db312 | miniraf/__init__.py | miniraf/__init__.py | import argparse
import astropy.io.fits as fits
import numpy as np
import calc
import combine
if __name__=="__main__":
argparser = argparse.ArgumentParser()
subparsers = argparser.add_subparsers(help="sub-command help")
calc.create_parser(subparsers)
combine.create_parser(subparsers)
args = argpars... | import argparse
import calc
import combine
from combine import stack_fits_data
from calc import load_fits_data
def _argparse():
argparser = argparse.ArgumentParser()
subparsers = argparser.add_subparsers(help="sub-command help")
calc.create_parser(subparsers)
combine.create_parser(subparsers)
ret... | Create main() entry point for final script | Create main() entry point for final script
Signed-off-by: Lizhou Sha <d6acb26e253550574bc1141efa0eb5e6de15daeb@mit.edu>
| Python | mit | vulpicastor/miniraf | ---
+++
@@ -1,16 +1,21 @@
import argparse
-import astropy.io.fits as fits
-import numpy as np
import calc
import combine
-if __name__=="__main__":
+from combine import stack_fits_data
+from calc import load_fits_data
+
+def _argparse():
argparser = argparse.ArgumentParser()
subparsers = argparser.add... |
60bb1425e94e15b59a05b485113cc68ed0146ac8 | nbtutor/__init__.py | nbtutor/__init__.py | # -*- coding: utf-8 -*-
"""
nbtutor - a small utility to indicate which cells should be cleared (exercises).
"""
import os
try:
from nbconvert.preprocessors.base import Preprocessor
except ImportError:
from IPython.nbconvert.preprocessors.base import Preprocessor
from traitlets import Unicode
class ClearEx... | # -*- coding: utf-8 -*-
"""
nbtutor - a small utility to indicate which cells should be cleared (exercises).
"""
import os
try:
from nbconvert.preprocessors.base import Preprocessor
except ImportError:
from IPython.nbconvert.preprocessors.base import Preprocessor
from traitlets import Unicode
class ClearEx... | Create solutions directory if it does not exist | Create solutions directory if it does not exist
| Python | bsd-2-clause | jorisvandenbossche/nbtutor,jorisvandenbossche/nbtutor | ---
+++
@@ -17,6 +17,12 @@
solutions_dir = Unicode("_solutions").tag(config=True)
+ def __init__(self, **kw):
+ if not os.path.exists(self.solutions_dir):
+ os.makedirs(self.solutions_dir)
+
+ super(Preprocessor, self).__init__(**kw)
+
def preprocess_cell(self, cell, resource... |
09195f50e328d3aee4cc60f0702d8605ea520eb3 | tests/sentry/utils/models/tests.py | tests/sentry/utils/models/tests.py | from __future__ import absolute_import
from django.db import models
from sentry.utils.models import Model
from sentry.testutils import TestCase
# There's a good chance this model wont get created in the db, so avoid
# assuming it exists in these tests.
class DummyModel(Model):
foo = models.CharField(max_length=3... | from __future__ import absolute_import
from django.db import models
from sentry.utils.models import Model
from sentry.testutils import TestCase
# There's a good chance this model wont get created in the db, so avoid
# assuming it exists in these tests.
class DummyModel(Model):
foo = models.CharField(max_length=3... | Add missing assertion in test | Add missing assertion in test
| Python | bsd-3-clause | NickPresta/sentry,jokey2k/sentry,1tush/sentry,zenefits/sentry,SilentCircle/sentry,wujuguang/sentry,ifduyue/sentry,Kryz/sentry,JamesMura/sentry,Natim/sentry,NickPresta/sentry,BuildingLink/sentry,rdio/sentry,BuildingLink/sentry,ngonzalvez/sentry,JamesMura/sentry,mvaled/sentry,JackDanger/sentry,SilentCircle/sentry,ifduyue... | ---
+++
@@ -28,3 +28,4 @@
self.assertTrue(inst.has_changed('foo'))
self.assertEquals(inst.old_value('foo'), 'bar')
models.signals.post_save.send(instance=inst, sender=type(inst), created=False)
+ self.assertFalse(inst.has_changed('foo')) |
57d49b185d1daf0e6a27e0daee8960c2816615cc | alg_kruskal_minimum_spanning_tree.py | alg_kruskal_minimum_spanning_tree.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def kruskal():
"""Kruskal's algorithm for minimum spanning tree in weighted graph.
Time complexity for graph G(V, E): TBD.
"""
pass
def main():
w_graph_d = {
'a': {'b': 1, 'd': 4, 'e': 3},
... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def kruskal():
"""Kruskal's algorithm for minimum spanning tree
in weighted graph.
Time complexity for graph G(V, E):
O(|E|+|V|+|E|log(|V|)) = O(|E|log(|V|^2)) = O(|E|log(|V|)).
"""
pass
def ma... | Revise doc string and add time complexity | Revise doc string and add time complexity
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -3,9 +3,11 @@
from __future__ import print_function
def kruskal():
- """Kruskal's algorithm for minimum spanning tree in weighted graph.
+ """Kruskal's algorithm for minimum spanning tree
+ in weighted graph.
- Time complexity for graph G(V, E): TBD.
+ Time complexity for graph G(V, E):
+ ... |
c1dc5494c461677e15be52576c55585742ad4a7a | bluebottle/bb_follow/migrations/0003_auto_20180530_1621.py | bluebottle/bb_follow/migrations/0003_auto_20180530_1621.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-30 14:21
from __future__ import unicode_literals
from django.db import migrations
def fix_followers(apps, schema_editor):
Donation = apps.get_model('donations', 'Donation')
Follow = apps.get_model('bb_follow', 'Follow')
ContentType = apps.ge... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-30 14:21
from __future__ import unicode_literals
from django.db import migrations
def fix_followers(apps, schema_editor):
Donation = apps.get_model('donations', 'Donation')
Follow = apps.get_model('bb_follow', 'Follow')
ContentType = apps.ge... | Add donation migration dependancy in bb_follow | Add donation migration dependancy in bb_follow
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -32,6 +32,7 @@
dependencies = [
('bb_follow', '0002_follow_user'),
+ ('donations', '0008_auto_20170927_1021')
]
operations = [ |
0284126969e76a55a00aa4e4ce22f089d543c1dc | vizier/__init__.py | vizier/__init__.py | # Copyright 2022 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 2022 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, ... | Update to 0.0.11 version for PyPI. | Update to 0.0.11 version for PyPI.
PiperOrigin-RevId: 484429105
| Python | apache-2.0 | google/vizier,google/vizier | ---
+++
@@ -21,4 +21,4 @@
sys.path.append(PROTO_ROOT)
-__version__ = "0.0.10"
+__version__ = "0.0.11" |
51801b0902e5a33c38e4c3cbff243ca6529bab64 | app/awards/forms.py | app/awards/forms.py | from flask.ext.wtf import Form
from wtforms import SelectField, RadioField
# TODO add validation to ensure same award isn't assigned twice
class AwardWinnerForm(Form):
# TODO these category constants should live separately
category_id = SelectField(u'Award category',
choices=[(0,... | from flask.ext.wtf import Form
from wtforms import SelectField, RadioField
from .models import AwardCategory
# TODO add validation to ensure same award isn't assigned twice
class AwardWinnerForm(Form):
# TODO these category constants should live separately
category_id = SelectField(u'Award category',
... | Update award winner form to use award category enum for select field choices | Update award winner form to use award category enum for select field choices
| Python | mit | rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy | ---
+++
@@ -1,22 +1,13 @@
from flask.ext.wtf import Form
from wtforms import SelectField, RadioField
+from .models import AwardCategory
# TODO add validation to ensure same award isn't assigned twice
class AwardWinnerForm(Form):
# TODO these category constants should live separately
category_id = Se... |
1c5a4afa06f56ca8fd7c36b633b7f73d259f1281 | lib/filesystem/__init__.py | lib/filesystem/__init__.py | import os
__author__ = 'mfliri'
def create_directory(output_dir):
if not os.path.exists(output_dir):
os.makedirs(output_dir) | import os
def create_directory(output_dir):
if not os.path.exists(output_dir):
os.makedirs(output_dir)
| Remove author notice and add newline at end of file | Remove author notice and add newline at end of file
| Python | mit | alphagov/transactions-explorer,gds-attic/transactions-explorer,alphagov/transactions-explorer,gds-attic/transactions-explorer,alphagov/transactions-explorer,alphagov/transactions-explorer,alphagov/transactions-explorer,gds-attic/transactions-explorer,gds-attic/transactions-explorer,gds-attic/transactions-explorer | ---
+++
@@ -1,6 +1,4 @@
import os
-
-__author__ = 'mfliri'
def create_directory(output_dir): |
96a6b929d80bd5ad8a7bf5d09955b3e45e5bbe56 | test/test_Spectrum.py | test/test_Spectrum.py | #!/usr/bin/env python
from __future__ import division, print_function
import pytest
import sys
# Add Spectrum location to path
sys.path.append('../')
import Spectrum
# Test using hypothesis
from hypothesis import given
import hypothesis.strategies as st
@given(st.lists(st.floats()), st.lists(st.floats()), st.boolea... | #!/usr/bin/env python
from __future__ import division, print_function
import pytest
import sys
# Add Spectrum location to path
sys.path.append('../')
import Spectrum
# Test using hypothesis
from hypothesis import given
import hypothesis.strategies as st
@given(st.lists(st.floats()), st.lists(st.floats()), st.boolea... | Test property of wavelength selection | Test property of wavelength selection
That afterwards the values are all above and below the min and max
values used.
| Python | mit | jason-neal/spectrum_overload,jason-neal/spectrum_overload,jason-neal/spectrum_overload | ---
+++
@@ -30,3 +30,21 @@
assert spec.flux == y
assert spec.xaxis == x
assert spec.calibrated == calib_val
+
+
+@given(st.lists(st.floats()), st.lists(st.floats()), st.booleans(), st.floats(), st.floats())
+def test_wav_select(y, x, calib, wav_min, wav_max):
+ # Create specturm
+ spec = Spectrum... |
c61e595098cd4b03828a81db98fb1e2b91b2eec0 | anna/model/utils.py | anna/model/utils.py | import tensorflow as tf
def rnn_cell(num_units, dropout, mode, residual=False, name=None, reuse=None):
dropout = dropout if mode == tf.contrib.learn.ModeKeys.TRAIN else 0.0
cell = tf.nn.rnn_cell.GRUCell(num_units, name=name, reuse=reuse)
if dropout > 0.0:
keep_prop = (1.0 - dropout)
cell... | import tensorflow as tf
def rnn_cell(num_units, dropout, mode, residual=False, name=None, reuse=None):
dropout = dropout if mode == tf.contrib.learn.ModeKeys.TRAIN else 0.0
cell = tf.nn.rnn_cell.GRUCell(num_units, name=name, reuse=reuse)
if dropout > 0.0:
keep_prop = (1.0 - dropout)
cell... | Remove dropout from output/state in rnn cells | Remove dropout from output/state in rnn cells
| Python | mit | jpbottaro/anna | ---
+++
@@ -11,8 +11,6 @@
cell = tf.nn.rnn_cell.DropoutWrapper(
cell=cell,
input_keep_prob=keep_prop,
- output_keep_prob=keep_prop,
- state_keep_prob=keep_prop
)
if residual: |
37207b2e91eee3f7f2417ff8157fada890c2d05b | blaze/tests/test_calc.py | blaze/tests/test_calc.py | import blaze
from blaze.datadescriptor import dd_as_py
import unittest
class TestBasic(unittest.TestCase):
def test_add(self):
types = ['int8', 'int16', 'int32', 'int64']
for type_ in types:
a = blaze.array(range(3), dshape=type_)
c = blaze.eval(((a+a)*a))
self... | import blaze
from blaze.datadescriptor import dd_as_py
import unittest
class TestBasic(unittest.TestCase):
def test_add(self):
types = ['int8', 'int16', 'int32', 'int64']
for type_ in types:
a = blaze.array(range(3), dshape=type_)
c = blaze.eval(a+a)
self.asser... | Add a test case of just two identical arguments to a blaze func | Add a test case of just two identical arguments to a blaze func
| Python | bsd-3-clause | cowlicks/blaze,ChinaQuants/blaze,scls19fr/blaze,ContinuumIO/blaze,AbhiAgarwal/blaze,mrocklin/blaze,dwillmer/blaze,AbhiAgarwal/blaze,alexmojaki/blaze,maxalbert/blaze,ContinuumIO/blaze,markflorisson/blaze-core,maxalbert/blaze,LiaoPan/blaze,FrancescAlted/blaze,scls19fr/blaze,markflorisson/blaze-core,cowlicks/blaze,cpcloud... | ---
+++
@@ -9,6 +9,8 @@
types = ['int8', 'int16', 'int32', 'int64']
for type_ in types:
a = blaze.array(range(3), dshape=type_)
+ c = blaze.eval(a+a)
+ self.assertEqual(dd_as_py(c._data), [0, 2, 4])
c = blaze.eval(((a+a)*a))
self.assertEqu... |
aa114d31ab8f97430faf0c16de2d6aff577a0d20 | anchorhub/lib/filetolist.py | anchorhub/lib/filetolist.py | """
Class for FileToList
"""
class FileToList(object):
"""
FileToList is a helper class used to import text files and turn them into
lists, with each index in the list representing a single line from the
text file.
"""
@staticmethod
def to_list(file_path):
"""
Static method... | """
Class for FileToList
"""
class FileToList(object):
"""
FileToList is a helper class used to import text files and turn them into
lists, with each index in the list representing a single line from the
text file.
"""
@staticmethod
def to_list(file_path):
"""
Static method... | Add 'rb' flag to FileToList | Add 'rb' flag to FileToList
| Python | apache-2.0 | samjabrahams/anchorhub | ---
+++
@@ -19,7 +19,7 @@
to lines in the file pointed to in file_path
"""
l = []
- f = open(file_path)
+ f = open(file_path, 'rb')
for line in f:
l.append(line)
f.close() |
66946f72d243f1836df0dbd8917f204011ec1701 | hs_core/autocomplete_light_registry.py | hs_core/autocomplete_light_registry.py | from autocomplete_light import shortcuts as autocomplete_light
from django.contrib.auth.models import User, Group
class UserAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = ['username', 'first_name', 'last_name']
split_words = True
def choices_for_request(self):
self.choices... | from autocomplete_light import shortcuts as autocomplete_light
from django.contrib.auth.models import User, Group
class UserAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = ['username', 'first_name', 'last_name']
split_words = True
def choices_for_request(self):
self.choice... | Add middle name display to autocomplete widget | Add middle name display to autocomplete widget
| Python | bsd-3-clause | hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare | ---
+++
@@ -1,5 +1,6 @@
from autocomplete_light import shortcuts as autocomplete_light
from django.contrib.auth.models import User, Group
+
class UserAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = ['username', 'first_name', 'last_name']
@@ -10,15 +11,7 @@
return super(UserA... |
f5d36900f7b0503a60a526fd70b57ecb91625fa0 | armstrong/core/arm_sections/views.py | armstrong/core/arm_sections/views.py | from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from .models import Section
class SimpleSectionView(DetailView):
context_object_name = 'section'
model = Section
def g... | from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from .models import Section
class SimpleSectionView(DetailView):
context_object_name = 'section'
model = Section
def g... | Handle queryset argument to get_object | Handle queryset argument to get_object
| Python | apache-2.0 | texastribune/armstrong.core.tt_sections,texastribune/armstrong.core.tt_sections,armstrong/armstrong.core.arm_sections,armstrong/armstrong.core.arm_sections,texastribune/armstrong.core.tt_sections | ---
+++
@@ -10,12 +10,13 @@
context_object_name = 'section'
model = Section
- def get_object(self):
- return self.get_section()
+ def get_object(self, queryset=None):
+ return self.get_section(queryset=queryset)
- def get_section(self):
- return get_object_or_404(self.get_q... |
7e766747dbda4548b63b278e062335c8a10fe008 | src/vimapt/library/vimapt/data_format/yaml.py | src/vimapt/library/vimapt/data_format/yaml.py | from pureyaml import dump as dumps
from pureyaml import load as loads
__all__ = ['dumps', 'loads']
| from __future__ import absolute_import
import functools
from yaml import dump, Dumper, load, Loader
dumps = functools.partial(dump, Dumper=Dumper)
loads = functools.partial(load, Loader=Loader)
__all__ = ['dumps', 'loads']
| Use PyYAML as YAML's loader and dumper | Use PyYAML as YAML's loader and dumper
| Python | mit | howl-anderson/vimapt,howl-anderson/vimapt | ---
+++
@@ -1,4 +1,10 @@
-from pureyaml import dump as dumps
-from pureyaml import load as loads
+from __future__ import absolute_import
+
+import functools
+
+from yaml import dump, Dumper, load, Loader
+
+dumps = functools.partial(dump, Dumper=Dumper)
+loads = functools.partial(load, Loader=Loader)
__all__ = ['d... |
f600ec497a6ff20c4cd8c983e27482fc77ab4deb | moksha/api/hub/consumer.py | moksha/api/hub/consumer.py | """
Consumers
=========
A `Consumer` is a simple consumer of messages. Based on a given `routing_key`,
your consumer's :meth:`consume` method will be called with the message.
Example consumers:
-tapping into a koji build, and sending a notification?
- hook into a given RSS feed and save data in a DB?
Addin... | # This file is part of Moksha.
#
# Moksha is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Moksha is distributed in the hope that it... | Update our message Consumer api to consume a `topic`, not a `queue`. | Update our message Consumer api to consume a `topic`, not a `queue`.
| Python | apache-2.0 | lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,lmacken/moksha,pombredanne/moksha,mokshaproject/moksha,ralphbean/moksha,mokshaproject/moksha,mokshaproject/moksha,ralphbean/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha | ---
+++
@@ -1,28 +1,24 @@
-"""
-Consumers
-=========
-
-A `Consumer` is a simple consumer of messages. Based on a given `routing_key`,
-your consumer's :meth:`consume` method will be called with the message.
-
-Example consumers:
-
- -tapping into a koji build, and sending a notification?
- - hook into a given... |
0a5513672c7d591338f3a7db1f87c78f137f7d1f | apps/mozorg/urls.py | apps/mozorg/urls.py | from django.conf.urls.defaults import *
from views import home, contribute, channel, firefox_performance, firefox_features, firefox_customize, firefox_happy, firefox_security, firefox_speed, firefox_technology, button, new, sandstone, geolocation
urlpatterns = patterns('',
url(r'^home/', home, name='mozorg.home')... | from django.conf.urls.defaults import *
from views import home, contribute, channel, firefox_performance, firefox_features, firefox_customize, firefox_happy, firefox_security, firefox_speed, firefox_technology, button, new, sandstone, geolocation
urlpatterns = patterns('',
url(r'^$', home, name='mozorg.home'),
... | Fix URL for home page (thanks jlongster) | Fix URL for home page (thanks jlongster)
| Python | mpl-2.0 | marcoscaceres/bedrock,davehunt/bedrock,pmclanahan/bedrock,sylvestre/bedrock,SujaySKumar/bedrock,Sancus/bedrock,TheJJ100100/bedrock,kyoshino/bedrock,mkmelin/bedrock,elin-moco/bedrock,kyoshino/bedrock,schalkneethling/bedrock,jacshfr/mozilla-bedrock,elin-moco/bedrock,mozilla/bedrock,mmmavis/bedrock,kyoshino/bedrock,chiril... | ---
+++
@@ -3,7 +3,7 @@
urlpatterns = patterns('',
- url(r'^home/', home, name='mozorg.home'),
+ url(r'^$', home, name='mozorg.home'),
(r'^button/', button),
(r'^channel/', channel), |
357a445021bd459cc0196269033ea181594a1456 | UliEngineering/Physics/NTC.py | UliEngineering/Physics/NTC.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utilities regarding NTC thermistors
See http://www.vishay.com/docs/29053/ntcintro.pdf for details
"""
from UliEngineering.Physics.Temperature import zero_point_celsius, normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.U... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utilities regarding NTC thermistors
See http://www.vishay.com/docs/29053/ntcintro.pdf for details
"""
from UliEngineering.Physics.Temperature import normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
imp... | Fix build error due to replacing zero_point_celsius by scipy equivalent | Fix build error due to replacing zero_point_celsius by scipy equivalent
| Python | apache-2.0 | ulikoehler/UliEngineering | ---
+++
@@ -5,10 +5,11 @@
See http://www.vishay.com/docs/29053/ntcintro.pdf for details
"""
-from UliEngineering.Physics.Temperature import zero_point_celsius, normalize_temperature
+from UliEngineering.Physics.Temperature import normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from... |
cddb0ae5c9c2d96c5902943f8b341ab2b698235f | paveldedik/forms.py | paveldedik/forms.py | # -*- coding: utf-8 -*-
from flask.ext.mongoengine.wtf import model_form
from paveldedik.models import User, Post
post_args = {
'title': {'label': u'Title'},
'leading': {'label': u'Leading'},
'content': {'label': u'Content'},
}
UserForm = model_form(User)
PostForm = model_form(Post, field_args=post_... | # -*- coding: utf-8 -*-
from flask.ext.mongoengine.wtf import model_form
from paveldedik.models import User, Post
#: Model the user form. Additional field arguments can be included using
#: the key-word argument ``field_args``. For more information about using
#: WTForms follow `this link<http://flask.pocoo.org/sn... | Exclude post_id from the wtform. | Exclude post_id from the wtform.
| Python | mit | paveldedik/blog,paveldedik/blog | ---
+++
@@ -6,13 +6,12 @@
from paveldedik.models import User, Post
-post_args = {
- 'title': {'label': u'Title'},
- 'leading': {'label': u'Leading'},
- 'content': {'label': u'Content'},
-}
-
-
+#: Model the user form. Additional field arguments can be included using
+#: the key-word argument ``field_arg... |
9f00aeff695dd587bf7db1e126e57596616ef95e | backend/messages.py | backend/messages.py | # -*- coding: utf-8 -*-
import json
from enum import Enum
class BEMessages(Enum):
ALL_MAIN_BROADCAST = 'ALL_MAIN_BROADCAST'
class FEMessages(Enum):
pass
class AllMainBroadCast(object):
message_type = BEMessages.ALL_MAIN_BROADCAST
def __init__(self):
pass
def broadcast(self, handler)... | # -*- coding: utf-8 -*-
import json
from enum import Enum
class BEMessages(Enum):
ALL_MAIN_BROADCAST = 'ALL_MAIN_BROADCAST'
class FEMessages(Enum):
pass
class Broadcast(object):
data = {}
def __init__(self, *args, **kwargs):
self.data.update(kwargs)
def broadcast(self, handler):
... | Split Broadcast into base class | Split Broadcast into base class
| Python | mit | verekia/hackarena,verekia/hackarena,verekia/hackarena,verekia/hackarena | ---
+++
@@ -11,18 +11,23 @@
pass
-class AllMainBroadCast(object):
+class Broadcast(object):
- message_type = BEMessages.ALL_MAIN_BROADCAST
+ data = {}
- def __init__(self):
- pass
+ def __init__(self, *args, **kwargs):
+ self.data.update(kwargs)
def broadcast(self, handle... |
98b84a09fb64f0647cd136f63603a5f37de2b0ee | tensorforce/tests/test_trpo_agent.py | tensorforce/tests/test_trpo_agent.py | # Copyright 2017 reinforce.io. 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... | # Copyright 2017 reinforce.io. 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... | Update TRPO, inconsistent results between Travis and local. | Update TRPO, inconsistent results between Travis and local.
| Python | apache-2.0 | reinforceio/tensorforce,lefnire/tensorforce | ---
+++
@@ -29,8 +29,8 @@
deterministic = False
config = dict(
- batch_size=8,
- learning_rate=1e-2
+ batch_size=16,
+ learning_rate=0.005
)
multi_config = dict( |
bbff08c49df269ad24851d4264fd3f1dbd141358 | test/contrib/test_securetransport.py | test/contrib/test_securetransport.py | # -*- coding: utf-8 -*-
import contextlib
import socket
import ssl
import pytest
try:
from urllib3.contrib.securetransport import WrappedSocket
except ImportError:
pass
def setup_module():
try:
from urllib3.contrib.securetransport import inject_into_urllib3
inject_into_urllib3()
exce... | # -*- coding: utf-8 -*-
import contextlib
import socket
import ssl
import pytest
try:
from urllib3.contrib.securetransport import WrappedSocket
except ImportError:
pass
def setup_module():
try:
from urllib3.contrib.securetransport import inject_into_urllib3
inject_into_urllib3()
exce... | Fix whitespace issue in SecureTransport test | Fix whitespace issue in SecureTransport test | Python | mit | urllib3/urllib3,sigmavirus24/urllib3,sigmavirus24/urllib3,urllib3/urllib3 | ---
+++
@@ -37,4 +37,4 @@
with contextlib.closing(socket.socket()) as s:
ws = WrappedSocket(s)
with pytest.raises(ssl.SSLError):
-ws._custom_validate(True, b"")
+ ws._custom_validate(True, b"") |
141b46d1f5178df7e110aee7b2b50ce6f5b44b7a | contrib/python-copper/t/test_wsgi.py | contrib/python-copper/t/test_wsgi.py | # -*- coding: utf-8 -*-
from copper.wsgi_support import wsgi
def test_http_handler(copper_client, copper_http_client):
def application(environ, start_response):
message = 'Hello, %s!' % (environ['PATH_INFO'],)
start_response('200 OK', [
('Content-Type', 'text/plain; charset=UTF-8'),
... | # -*- coding: utf-8 -*-
from copper.wsgi_support import wsgi
def test_http_handler(copper_client, copper_http_client):
def application(environ, start_response):
message = 'Hello, %s!' % (environ['PATH_INFO'],)
start_response('200 OK', [
('Content-Type', 'text/plain; charset=UTF-8'),
... | Fix python tests re: http routing | Fix python tests re: http routing | Python | mit | snaury/copper,snaury/copper,snaury/copper | ---
+++
@@ -9,11 +9,11 @@
('Content-Length', '%d' % len(message)),
])
return [message]
- with copper_client.publish('http:/hello/', wsgi(application)):
+ with copper_client.publish('http:hello', wsgi(application)):
result = copper_http_client.open('copper:///hello/world')... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.