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 |
|---|---|---|---|---|---|---|---|---|---|---|
b964c71509d1c562d4080a39bf5fc7333da39608 | fedora/__init__.py | fedora/__init__.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | Rearrange imports of gettext and release because of dependencies in circular import. | Rearrange imports of gettext and release because of dependencies in
circular import.
| Python | lgpl-2.1 | fedora-infra/python-fedora | ---
+++
@@ -17,10 +17,10 @@
Modules to communicate with and help implement Fedora Services.
'''
-from fedora import release
-__version__ = release.VERSION
-
import gettext
translation = gettext.translation('python-fedora', '/usr/share/locale',
fallback=True)
_ = translation.ugettext
+
+from fedora imp... |
f3735ed56bff6425eb87f492707b7a8a5ef3119a | touch/__init__.py | touch/__init__.py | from pelican import signals
import logging
import os
import time
logger = logging.getLogger(__name__)
def touch_file(path, context):
content = context.get('article', context.get('page'))
if content and hasattr(content, 'date'):
mtime = time.mktime(content.date.timetuple())
logger.info('touc... | from pelican import signals
import logging
import os
import time
logger = logging.getLogger(__name__)
def set_file_utime(path, datetime):
mtime = time.mktime(datetime.timetuple())
logger.info('touching %s', path)
os.utime(path, (mtime, mtime))
def touch_file(path, context):
content = context.get(... | Make touch plugin touch files with lists | Make touch plugin touch files with lists
| Python | agpl-3.0 | xsteadfastx/pelican-plugins,doctorwidget/pelican-plugins,lazycoder-ru/pelican-plugins,Neurita/pelican-plugins,lele1122/pelican-plugins,mitchins/pelican-plugins,jantman/pelican-plugins,samueljohn/pelican-plugins,MarkusH/pelican-plugins,jakevdp/pelican-plugins,florianjacob/pelican-plugins,danmackinlay/pelican-plugins,dan... | ---
+++
@@ -8,12 +8,23 @@
logger = logging.getLogger(__name__)
+def set_file_utime(path, datetime):
+ mtime = time.mktime(datetime.timetuple())
+ logger.info('touching %s', path)
+ os.utime(path, (mtime, mtime))
+
+
def touch_file(path, context):
content = context.get('article', context.get('page'... |
f4d5bafcf99d2117fe589d8c31f8aff8ed3467a5 | RefreshScripts.py | RefreshScripts.py | #from CreateTableFromDatabase import getRankingsFromDatabase
import time
from CheckAndPostForSeriesSubmissions import checkNewSubmissions
# Refreshes all other scripts every couple of minutes
def refreshScripts():
while True:
checkNewSubmissions()
timeToSleep = 900
print("Sleeping for " + ... | ### exclam /usr/bin/env python3
#from CreateTableFromDatabase import getRankingsFromDatabase
import time
from CheckAndPostForSeriesSubmissions import checkNewSubmissions
# Refreshes all other scripts every couple of minutes
def refreshScripts():
while True:
try:
checkNewSubmissions()
... | Refresh script now displays error message | Refresh script now displays error message
| Python | mit | LiquidFun/Reddit-GeoGuessr-Tracking-Bot | ---
+++
@@ -1,3 +1,5 @@
+### exclam /usr/bin/env python3
+
#from CreateTableFromDatabase import getRankingsFromDatabase
import time
from CheckAndPostForSeriesSubmissions import checkNewSubmissions
@@ -6,7 +8,12 @@
def refreshScripts():
while True:
- checkNewSubmissions()
+ try:
+ c... |
e881465050ef9edbf2b47071b1fa2fc27ac26c1a | tests/Settings/TestExtruderStack.py | tests/Settings/TestExtruderStack.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import pytest #This module contains automated tests.
import unittest.mock #For the mocking and monkeypatching functionality.
import cura.Settings.ExtruderStack #The module we're testing.
from cura.Settings.Exceptions impor... | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import pytest #This module contains automated tests.
import unittest.mock #For the mocking and monkeypatching functionality.
import cura.Settings.ExtruderStack #The module we're testing.
from cura.Settings.Exceptions impor... | Add delimiter between global stuff and test cases | Add delimiter between global stuff and test cases
Helps provide some oversight since this module is about to explode in size.
Contributes to issue CURA-3497.
| Python | agpl-3.0 | hmflash/Cura,ynotstartups/Wanhao,Curahelper/Cura,ynotstartups/Wanhao,hmflash/Cura,fieldOfView/Cura,fieldOfView/Cura,Curahelper/Cura | ---
+++
@@ -11,6 +11,8 @@
@pytest.fixture()
def extruder_stack() -> cura.Settings.ExtruderStack.ExtruderStack:
return cura.Settings.ExtruderStack.ExtruderStack
+
+#############################START OF TEST CASES################################
## Tests whether adding a container is properly forbidden.
def... |
1d1348eb2126a0a8ee1a18b37a5254b59c3a4c76 | examples/ensemble/plot_forest_importances_faces.py | examples/ensemble/plot_forest_importances_faces.py | """
=======================================
Pixel importances with forests of trees
=======================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more important.
"""
print __doc__
impor... | """
=======================================
Pixel importances with forests of trees
=======================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more important.
"""
print __doc__
from ... | Update random forest face example to use several cores | Update random forest face example to use several cores
| Python | bsd-3-clause | scikit-learn/scikit-learn,madjelan/scikit-learn,xubenben/scikit-learn,Vimos/scikit-learn,nrhine1/scikit-learn,zhenv5/scikit-learn,liberatorqjw/scikit-learn,ndingwall/scikit-learn,beepee14/scikit-learn,shyamalschandra/scikit-learn,walterreade/scikit-learn,dhruv13J/scikit-learn,Adai0808/scikit-learn,Nyker510/scikit-learn... | ---
+++
@@ -9,10 +9,14 @@
"""
print __doc__
+from time import time
import pylab as pl
from sklearn.datasets import fetch_olivetti_faces
from sklearn.ensemble import ExtraTreesClassifier
+
+# Number of cores to use to perform parallel fitting of the forest model
+n_jobs=2
# Loading the digits dataset
data... |
27be11775d23e873f9e568b86b8a0b2409878d30 | job_runner/settings/env/development.py | job_runner/settings/env/development.py | import os
from job_runner.settings.base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, '..', 'database.sqlite'),
}
}
JOB_RUNNER_WS_SERVER = 'ws://localhost:5000/'
EMAIL_BACKEND = 'django.c... | import os
from job_runner.settings.base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, '..', 'database.sqlite'),
}
}
JOB_RUNNER_WS_SERVER = 'ws://localhost:5000/'
EMAIL_BACKEND = 'django.c... | Hide the django backend db log messages. | Hide the django backend db log messages.
| Python | bsd-3-clause | spilgames/job-runner,spilgames/job-runner | ---
+++
@@ -37,6 +37,11 @@
},
},
'loggers': {
+ 'django.db.backends': {
+ 'handlers': ['console'],
+ 'level': 'INFO',
+ 'propagate': False,
+ },
'': {
'handlers': ['console'],
'level': 'DEBUG', |
9de6036f722fb63378a74f08d7f05d184e1b175f | src/buildercore/concurrency.py | src/buildercore/concurrency.py | from . import bluegreen, context_handler
# TODO: move as buildercore.concurrency.concurrency_for
def concurrency_for(stackname, concurrency_name):
"""concurrency default is to perform updates one machine at a time.
Concurrency can be:
- serial: one at a time
- parallel: all together
- blue-green: ... | from . import bluegreen, context_handler
# TODO: move as buildercore.concurrency.concurrency_for
def concurrency_for(stackname, concurrency_name):
"""concurrency default is to perform updates one machine at a time.
Concurrency can be:
- serial: one at a time
- parallel: all together
- blue-green: ... | Correct tuple for error message arguments | Correct tuple for error message arguments
| Python | mit | elifesciences/builder,elifesciences/builder | ---
+++
@@ -21,4 +21,4 @@
if concurrency_name is None:
return 'parallel'
- raise ValueError("Concurrency %s is not supported. Supported models: %s" % concurrency_name, concurrency_names)
+ raise ValueError("Concurrency %s is not supported. Supported models: %s" % (concurrency_name, concurrency_n... |
29d6010c18605179860afe08f5cac218e1a65716 | dbaas/workflow/steps/util/resize/check_database_status.py | dbaas/workflow/steps/util/resize/check_database_status.py | # -*- coding: utf-8 -*-
import logging
from ...util.base import BaseStep
LOG = logging.getLogger(__name__)
class CheckDatabaseStatus(BaseStep):
def __unicode__(self):
return "Checking database status..."
def do(self, workflow_dict):
try:
if not 'database' in workflow_dict:
... | # -*- coding: utf-8 -*-
import logging
from ...util.base import BaseStep
LOG = logging.getLogger(__name__)
class CheckDatabaseStatus(BaseStep):
def __unicode__(self):
return "Checking database status..."
def do(self, workflow_dict):
try:
if not 'database' in workflow_dict:
... | Change check_db connection resize step to wait database start process | Change check_db connection resize step to wait database start process
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -20,6 +20,9 @@
LOG.info("Getting driver class")
driver = workflow_dict['databaseinfra'].get_driver()
+ from time import sleep
+
+ sleep(60)
if driver.check_status():
LOG.info("Database is ok...") |
08167d79efb97a0728564caf96a96b08763ddf60 | bibliopixel/util/importer.py | bibliopixel/util/importer.py | import importlib
def import_symbol(typename):
"""Import a module or typename within a module from its name."""
try:
return importlib.import_module(typename)
except ImportError as e:
parts = typename.split('.')
if len(parts) > 1:
typename = parts.pop()
# Ca... | import importlib
def import_symbol(typename, package=None):
"""Import a module or typename within a module from its name."""
try:
return importlib.import_module(typename, package=package)
except ImportError as e:
parts = typename.split('.')
if len(parts) > 1:
typename ... | Add a package argument to import_symbol. | Add a package argument to import_symbol.
| Python | mit | ManiacalLabs/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel | ---
+++
@@ -1,10 +1,10 @@
import importlib
-def import_symbol(typename):
+def import_symbol(typename, package=None):
"""Import a module or typename within a module from its name."""
try:
- return importlib.import_module(typename)
+ return importlib.import_module(typename, package=package)... |
5c7f6f90f4ae88e70c738ab13170ad1c64447db3 | xfdf2ascii.py | xfdf2ascii.py | #!/usr/bin/env python
from lxml import etree
import sys
comments_file = open("examples/Technical_Document_Comments.xfdf", "r")
comments_xml = etree.parse(comments_file)
root = comments_xml.getroot()
prefix = None
try:
prefix = root.tag.partition("}")[0].partition("{")[-1]
except:
pass
if prefix:
highlight... | #!/usr/bin/env python
from lxml import etree
import sys
comments_file = open("examples/Technical_Document_Comments.xfdf", "r")
comments_xml = etree.parse(comments_file)
root = comments_xml.getroot()
prefix = None
try:
prefix = root.tag.partition("}")[0].partition("{")[-1]
except:
pass
if prefix:
highlight... | Correct the off-by one error from logical to physical pages | Correct the off-by one error from logical to physical pages
| Python | mit | juandesant/xfdf2ascii | ---
+++
@@ -22,7 +22,7 @@
issue = 1
for h in highlights:
try:
- page = h.get("page")
+ page = int(h.get("page"))+1
except:
continue
try: |
a5a92b81244076e8cf04c06398ce63a87d1357dd | adhocracy/tests/test_doctest_files.py | adhocracy/tests/test_doctest_files.py | from glob import glob
import doctest
from doctest import DocFileSuite
from os.path import dirname
import unittest
from adhocracy.tests.testbrowser import ADHOCRACY_LAYER, ADHOCRACY_LAYER_APP
from adhocracy.tests.testbrowser import app_url, instance_url
from adhocracy.tests.testbrowser import Browser
def find_use_cas... | from glob import glob
import doctest
from doctest import DocFileSuite
from os.path import dirname
import unittest
from adhocracy import model
from adhocracy.tests import testtools
from adhocracy.tests.testbrowser import ADHOCRACY_LAYER, ADHOCRACY_LAYER_APP
from adhocracy.tests.testbrowser import app_url, instance_url
... | Add the modules models and testtools to the doctest globals | Add the modules models and testtools to the doctest globals
| Python | agpl-3.0 | SysTheron/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,alkadis/vcv,alkadis/vcv,SysTheron/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,SysTheron/adhocracy,liqd/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,alk... | ---
+++
@@ -4,6 +4,8 @@
from os.path import dirname
import unittest
+from adhocracy import model
+from adhocracy.tests import testtools
from adhocracy.tests.testbrowser import ADHOCRACY_LAYER, ADHOCRACY_LAYER_APP
from adhocracy.tests.testbrowser import app_url, instance_url
from adhocracy.tests.testbrowser imp... |
1ed6c3f6d79aca5d647e8ff8332096c4fc111548 | neuroimaging/utils/tests/test_utils.py | neuroimaging/utils/tests/test_utils.py | from numpy.testing import NumpyTest, NumpyTestCase
class test_Template(NumpyTestCase):
def setUp(self): pass
#print "TestCase initialization..."
def test_foo(self): pass
#print "testing foo"
def test_bar(self): pass
#print "testing bar"
if __name__ == '__main__':
Nump... | from numpy.testing import NumpyTest, NumpyTestCase
class test_Template(NumpyTestCase):
def setUp(self):
pass
#print "TestCase initialization..."
def test_foo(self):
self.fail('neuroimaging.utils, odict, path, etc... have _NO_ tests!')
if __name__ == '__main__':
NumpyTest().run()
| Fix test example so it runs. | BUG: Fix test example so it runs. | Python | bsd-3-clause | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | ---
+++
@@ -2,15 +2,12 @@
class test_Template(NumpyTestCase):
- def setUp(self): pass
+ def setUp(self):
+ pass
#print "TestCase initialization..."
- def test_foo(self): pass
- #print "testing foo"
-
- def test_bar(self): pass
- #print "testing bar"
-
+ def te... |
3a2b536f24eee711a1329daf7403bd92840a87e3 | gpxpandas/gpxreader.py | gpxpandas/gpxreader.py | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | __author__ = 'max'
import gpxpy
import pandas as pd
def parse_gpx(gpx_file_name):
return gpxpy.parse(gpx_file_name)
def data_frame_for_track_segment(segment):
seg_dict = {}
for point in segment.points:
seg_dict[point.time] = [point.latitude, point.longitude,
poi... | Use gpx.name as index to gpx data_frame | Use gpx.name as index to gpx data_frame
| Python | mit | komax/gpx-pandas | ---
+++
@@ -31,4 +31,5 @@
tracks_frames = (track_segment_mapping(track) for track in gpx.tracks)
# Create a hierarchical DataFrame by unstacking.
tracks_frame = pd.DataFrame(tracks_frames)
- return tracks_frame.unstack()
+ assert gpx.name
+ return pd.DataFrame({gpx.name:tracks_frame.unstack()}... |
f2f422702985c3e890fa19a7f841baba837c5bba | main.py | main.py | from listing import Listing, session
from scraper import Scraper
from slack import Slack
import sys
import traceback
import time
slack = Slack()
def scrape():
results = 0
duplicates = 0
for result in Scraper().results():
results += 1
listing = Listing(result).process()
if listi... | from listing import Listing, session
from scraper import Scraper
from slack import Slack
from random import randint
import sys
import traceback
import time
slack = Slack()
def scrape():
results = 0
duplicates = 0
for result in Scraper().results():
results += 1
listing = Listing(result).... | Increase and fuzz sleep time | Increase and fuzz sleep time
| Python | mit | vboginskey/cribfinder | ---
+++
@@ -2,6 +2,7 @@
from scraper import Scraper
from slack import Slack
+from random import randint
import sys
import traceback
import time
@@ -50,4 +51,4 @@
print("Error:", sys.exc_info()[0])
traceback.print_exc()
- time.sleep(3600)
+ time.sleep(14400 + randint(-6... |
56b4532bd330ad4075f882511c87cb97eaeff10e | jujupy/__init__.py | jujupy/__init__.py | from jujupy.client import *
from jujupy.client import _temp_env
__all__ = ['_temp_env']
| from jujupy.client import (
AgentsNotStarted,
AuthNotAccepted,
AGENTS_READY,
client_from_config,
ConditionList,
coalesce_agent_status,
describe_substrate,
EnvJujuClient,
EnvJujuClient1X,
EnvJujuClient25,
ensure_dir,
get_cache_path,
get_client_class,
get_local_root... | Switch to explicit imports for jujupy. | Switch to explicit imports for jujupy. | Python | agpl-3.0 | mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju | ---
+++
@@ -1,4 +1,89 @@
-from jujupy.client import *
-from jujupy.client import _temp_env
+from jujupy.client import (
+ AgentsNotStarted,
+ AuthNotAccepted,
+ AGENTS_READY,
+ client_from_config,
+ ConditionList,
+ coalesce_agent_status,
+ describe_substrate,
+ EnvJujuClient,
+ EnvJujuClie... |
55f0ab3ba544344bda4c95b014193dffe9db70cd | examples/99bottles.py | examples/99bottles.py | #!/usr/bin/env python
# XXX: Broken - Does O_NONBLOCK work at all?
"""An implementation of the Python Concurrency Problem of 99 Bottles of Beer
See: http://wiki.python.org/moin/Concurrency/99Bottles
"""
import sys
from circuits.io import File
from circuits import Component
from circuits.net.protocols import LP
c... | #!/usr/bin/env python
# XXX: Broken - Does O_NONBLOCK work at all?
"""An implementation of the Python Concurrency Problem of 99 Bottles of Beer
See: http://wiki.python.org/moin/Concurrency/99Bottles
"""
import sys
from circuits.io import File
from circuits import Component
from circuits.net.protocols import LP
c... | Use explicit API(s) for examples | Use explicit API(s) for examples
| Python | mit | nizox/circuits,eriol/circuits,treemo/circuits,treemo/circuits,treemo/circuits,eriol/circuits,eriol/circuits | ---
+++
@@ -45,5 +45,6 @@
print(line)
# Configure and "run" the System.
-from circuits import Debugger
-(Tail(sys.argv[1]) + Debugger() + Grep(sys.argv[2])).run()
+app = Tail(sys.argv[1])
+Grep(sys.argv[2]).register(app)
+app.run() |
497451ee060b1dd7655ad648f4026633e6e3318c | leaflets/models.py | leaflets/models.py | from django.db import models
from django.contrib import admin
class Leaflet(models.Model):
'''
Represents a given (generated) leaflet.
'''
competition = models.ForeignKey('competitions.Competition')
year = models.IntegerField()
issue = models.IntegerField()
# Fields added via foreign key... | import reversion
from django.db import models
from django.contrib import admin
class Leaflet(models.Model):
'''
Represents a given (generated) leaflet.
'''
def generate_name(self, filename):
return "leaflets/{competition}-{year}-{issue}.pdf"\
.format(competition=self.competiti... | Add capability to upload Leaflets | Add capability to upload Leaflets
| Python | mit | matus-stehlik/roots,matus-stehlik/roots,matus-stehlik/glowing-batman,rtrembecky/roots,tbabej/roots,matus-stehlik/roots,tbabej/roots,tbabej/roots,rtrembecky/roots,matus-stehlik/glowing-batman,rtrembecky/roots | ---
+++
@@ -1,3 +1,5 @@
+import reversion
+
from django.db import models
from django.contrib import admin
@@ -7,9 +9,22 @@
Represents a given (generated) leaflet.
'''
+ def generate_name(self, filename):
+ return "leaflets/{competition}-{year}-{issue}.pdf"\
+ .format(competitio... |
3f394b37174d97b53fdef8ce662e258c6b2aa337 | src/appleseed.python/studio/__init__.py | src/appleseed.python/studio/__init__.py |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017 Gleb Mishchenko, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017 Gleb Mishchenko, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... | Add PySide to as.studio init preferred binding | Add PySide to as.studio init preferred binding
| Python | mit | luisbarrancos/appleseed,est77/appleseed,appleseedhq/appleseed,pjessesco/appleseed,gospodnetic/appleseed,Vertexwahn/appleseed,appleseedhq/appleseed,dictoon/appleseed,Aakash1312/appleseed,Biart95/appleseed,Vertexwahn/appleseed,dictoon/appleseed,Biart95/appleseed,aytekaman/appleseed,pjessesco/appleseed,aytekaman/appleseed... | ---
+++
@@ -30,6 +30,6 @@
# Prevent Qt.py importing PySide2 and PyQt5.
if not os.getenv("QT_PREFERRED_BINDING"):
- os.environ["QT_PREFERRED_BINDING"] = "PyQt4"
+ os.environ["QT_PREFERRED_BINDING"] = os.pathsep.join(["PySide", "PyQt4"])
from _appleseedstudio import * |
4f9e602bfbf145adfc93270d915325b59c710a46 | conman/routes/migrations/0001_initial.py | conman/routes/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Route',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Route',
... | Update new migration to match existing docstring | Update new migration to match existing docstring
| Python | bsd-2-clause | Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman | ---
+++
@@ -15,7 +15,7 @@
name='Route',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
- ('slug', models.SlugField(help_text='\n Used to create the location of the Route. The Root Route needs\... |
2ac7b22e592557ea8be70311e641b1f42f6c7128 | tests/settings.py | tests/settings.py | import dj_database_url
DATABASES = {
'default': dj_database_url.config(
default='postgres://localhost/test_utils',
),
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
MIDDLEWARE_CLASSES = ()
SECRET_KEY = 'test'
| import dj_database_url
DATABASES = {
'default': dj_database_url.config(
default='postgres://localhost/test_utils',
),
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
MIDDLEWARE_CLASSES = ()
PASSWORD_HASHERS = ['django.contrib.auth.has... | Use md5 password hasher for tests | Use md5 password hasher for tests
| Python | bsd-2-clause | incuna/incuna-test-utils,incuna/incuna-test-utils | ---
+++
@@ -12,4 +12,5 @@
'django.contrib.sessions',
)
MIDDLEWARE_CLASSES = ()
+PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
SECRET_KEY = 'test' |
d9d2c7d341894e28a5ad73469ec0d9d23d78429e | vispy/visuals/graphs/layouts/__init__.py | vispy/visuals/graphs/layouts/__init__.py | from .random import random # noqa
from .circular import circular # noqa
| import inspect
from .random import random
from .circular import circular
from .force_directed import fruchterman_reingold
_layout_map = {
'random': random,
'circular': circular,
'force_directed': fruchterman_reingold
}
def get(name, *args, **kwargs):
if name not in _layout_map:
raise KeyErr... | Add new way of retreiving graph layouts | Add new way of retreiving graph layouts
| Python | bsd-3-clause | ghisvail/vispy,michaelaye/vispy,Eric89GXL/vispy,michaelaye/vispy,Eric89GXL/vispy,Eric89GXL/vispy,drufat/vispy,drufat/vispy,ghisvail/vispy,michaelaye/vispy,drufat/vispy,ghisvail/vispy | ---
+++
@@ -1,2 +1,24 @@
-from .random import random # noqa
-from .circular import circular # noqa
+import inspect
+
+from .random import random
+from .circular import circular
+from .force_directed import fruchterman_reingold
+
+
+_layout_map = {
+ 'random': random,
+ 'circular': circular,
+ 'force_direct... |
739ae88d817cb86723b126360aaf3dd6df3045c0 | tests/test_log.py | tests/test_log.py | import json
import logging
from unittest.mock import Mock, patch
from jsonrpcclient.log import _trim_string, _trim_values
def test_trim_string():
message = _trim_string("foo" * 100)
assert "..." in message
def test_trim_values():
message = _trim_values({"list": [0] * 100})
assert "..." in message["... | import json
import logging
from unittest.mock import Mock, patch
from jsonrpcclient.log import _trim_string, _trim_values, _trim_message
def test_trim_string():
message = _trim_string("foo" * 100)
assert "..." in message
def test_trim_values():
message = _trim_values({"list": [0] * 100})
assert "..... | Add coverage to some of log.py | Add coverage to some of log.py
| Python | mit | bcb/jsonrpcclient | ---
+++
@@ -2,7 +2,7 @@
import logging
from unittest.mock import Mock, patch
-from jsonrpcclient.log import _trim_string, _trim_values
+from jsonrpcclient.log import _trim_string, _trim_values, _trim_message
def test_trim_string():
@@ -26,5 +26,5 @@
def test_trim_message():
- message = _trim_values([... |
1927c503fda892490fb7262ba480e429a0f416fb | intermol/orderedset.py | intermol/orderedset.py | import collections
from copy import deepcopy
class OrderedSet(collections.Set):
def __init__(self, iterable=()):
self.d = collections.OrderedDict.fromkeys(iterable)
def add(self, key):
self.d[key] = None
def discard(self, key):
del self.d[key]
def difference_update(self, *a... | from collections.abc import Set
from collections import OrderedDict
from copy import deepcopy
class OrderedSet(Set):
def __init__(self, iterable=()):
self.d = OrderedDict.fromkeys(iterable)
def add(self, key):
self.d[key] = None
def discard(self, key):
del self.d[key]
def d... | Update collections imports for deprecations | Update collections imports for deprecations
| Python | mit | shirtsgroup/InterMol,shirtsgroup/InterMol | ---
+++
@@ -1,11 +1,12 @@
-import collections
+from collections.abc import Set
+from collections import OrderedDict
from copy import deepcopy
-class OrderedSet(collections.Set):
+class OrderedSet(Set):
def __init__(self, iterable=()):
- self.d = collections.OrderedDict.fromkeys(iterable)
+ s... |
3bd409a0c7f252811c7e8488493270d225e8616a | src/main/python/piglatin.py | src/main/python/piglatin.py | import sys
def parseCommandLine(argv):
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
| import sys
def parseCommandLine(argv):
print 'Inside parser'
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
| Test case: failing print for python3 | Test case: failing print for python3
| Python | mit | oneyoke/sw_asgmt_2 | ---
+++
@@ -1,6 +1,7 @@
import sys
def parseCommandLine(argv):
+ print 'Inside parser'
return argv[1] if len(argv) > 1 else ""
|
5185222f82b22868a28cb93a6a11632a9e1f6456 | libdotify/utils.py | libdotify/utils.py | import os
import shlex
import logging
import subprocess
import contextlib
@contextlib.contextmanager
def cd(newdir):
prevdir = os.getcwd()
os.chdir(os.path.expanduser(newdir))
try:
yield
finally:
os.chdir(prevdir)
def execute(cmd):
args = shlex.split(cmd)
p = subprocess.Popen(a... | import os
import shlex
import logging
import subprocess
import contextlib
@contextlib.contextmanager
def cd(newdir):
prevdir = os.getcwd()
os.chdir(os.path.expanduser(newdir))
try:
yield
finally:
os.chdir(prevdir)
def execute(cmd):
args = shlex.split(cmd)
p = subprocess.Popen(a... | Fix path creation/git detection bugs | [libdotify] Fix path creation/git detection bugs
| Python | mit | tobi-wan-kenobi/dotfiles | ---
+++
@@ -26,19 +26,23 @@
def git_update(dotmodule, dst, plugins):
for plugin in plugins:
- if "\.git" in plugin:
+ if ".git" in plugin:
name = os.path.basename(plugin).rpartition(".git")[0] # replace trailing ".git"
else:
name = os.path.basename(plugin)
... |
a09edcdf11c0d6c6b43cbff5029ac8cfb5741170 | application.py | application.py | #!/usr/bin/env python
import os
from app import create_app, db
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
application = create_app(os.getenv('FLASH_CONFIG') or 'development')
manager = Manager(application)
migrate = Migrate(application, db)
manager.add_command('db', Mig... | #!/usr/bin/env python
import os
from app import create_app, db
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
application = create_app(os.getenv('FLASH_CONFIG') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))
migr... | Update to run on port 5000 | Update to run on port 5000
For development we will want to run multiple apps, so they should each bind to a different port number.
The default port is 5000 anyway, but we should state the port explicitly in the code which is why I've added it here.
| Python | mit | mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-... | ---
+++
@@ -2,11 +2,12 @@
import os
from app import create_app, db
-from flask.ext.script import Manager
+from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
application = create_app(os.getenv('FLASH_CONFIG') or 'development')
manager = Manager(application)
+man... |
9cdf014f2349b7c39974ccfc5e873dbcb8e9cee9 | application.py | application.py |
from remedy.radremedy import create_app
application, manager = create_app('remedy.config.ProductionConfig')
application.debug = True
if __name__ == '__main__':
manager.run()
| #!/usr/bin/env python
from remedy.radremedy import create_app
application, manager = create_app('remedy.config.ProductionConfig')
application.debug = True
if __name__ == '__main__':
manager.run()
| Make it easier to run | Make it easier to run
| Python | mpl-2.0 | radremedy/radremedy,radioprotector/radremedy,radioprotector/radremedy,AllieDeford/radremedy,AllieDeford/radremedy,radremedy/radremedy,radioprotector/radremedy,AllieDeford/radremedy,radremedy/radremedy,radremedy/radremedy,radioprotector/radremedy | ---
+++
@@ -1,4 +1,4 @@
-
+#!/usr/bin/env python
from remedy.radremedy import create_app
application, manager = create_app('remedy.config.ProductionConfig') |
d2f1b9311b546c079490e5f0bdb45b9c9d570bb1 | system/test_coupling_fields.py | system/test_coupling_fields.py |
from __future__ import print_function
import os
import netCDF4 as nc
from model_test_helper import ModelTestHelper
class TestCouplingFields(ModelTestHelper):
def __init__(self):
super(TestCouplingFields, self).__init__()
def test_swflx(self):
"""
Compare short wave flux over a geog... |
from __future__ import print_function
import os
import netCDF4 as nc
from model_test_helper import ModelTestHelper
class TestCouplingFields(ModelTestHelper):
def __init__(self):
super(TestCouplingFields, self).__init__()
def test_swflx(self):
"""
Compare short wave flux over a geog... | Fix up paths in system test. | Fix up paths in system test.
| Python | apache-2.0 | CWSL/access-om | ---
+++
@@ -17,9 +17,12 @@
models.
"""
- hi_fields = os.path.join(self.paths['cm_1440x1080-test']['output'], 'ice',
+ hi_paths = self.make_paths('cm_1440x1080-test')
+ lo_paths = self.make_paths('cm_360x300-test')
+
+ hi_fields = os.path.join(hi_paths['output'], 'ice',
... |
2d30393166e6c9bd0995810226a223b44635da6d | src/stratis_cli/_version.py | src/stratis_cli/_version.py | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | Set stratis-cli version to 3.1.0 | Set stratis-cli version to 3.1.0
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | apache-2.0 | stratis-storage/stratis-cli,stratis-storage/stratis-cli | ---
+++
@@ -17,5 +17,5 @@
.. moduleauthor:: mulhern <amulhern@redhat.com>
"""
-__version_info__ = (3, 0, 1)
+__version_info__ = (3, 1, 0)
__version__ = ".".join(str(x) for x in __version_info__) |
655c3ca55a5b3bb1f03d524219c3d038c2d02ed5 | st2client/st2client/models/datastore.py | st2client/st2client/models/datastore.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... | Update KeyValuePair model so delete and other operations which require "id" attribute to be present still work. | Update KeyValuePair model so delete and other operations which require "id"
attribute to be present still work.
| Python | apache-2.0 | tonybaloney/st2,alfasin/st2,nzlosh/st2,tonybaloney/st2,pixelrebel/st2,Plexxi/st2,punalpatel/st2,StackStorm/st2,Itxaka/st2,nzlosh/st2,pinterb/st2,StackStorm/st2,emedvedev/st2,alfasin/st2,jtopjian/st2,peak6/st2,peak6/st2,emedvedev/st2,tonybaloney/st2,Itxaka/st2,lakshmi-kannan/st2,Plexxi/st2,grengojbo/st2,dennybaa/st2,nzl... | ---
+++
@@ -27,3 +27,8 @@
_plural = 'Keys'
_plural_display_name = 'Key Value Pairs'
_repr_attributes = ['name', 'value']
+
+ @property
+ def id(self):
+ # Note: This is a temporary hack until we refactor client and make it support non id PKs
+ return self.name |
24dba96be4a9202fdac5fa779c52789ec6cd13c4 | api/common/views.py | api/common/views.py | import subprocess
from django.conf import settings
from django.contrib.sites.models import Site
from django.http import JsonResponse, HttpResponseBadRequest
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from rest_framework.authtoken.models import Token
@csrf_exempt
def dep... | import subprocess
from django.conf import settings
from django.contrib.sites.models import Site
from django.http import JsonResponse, HttpResponseBadRequest
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from rest_framework.authtoken.models import Token
@csrf_exempt
def dep... | Improve subprocess call during deployment | Improve subprocess call during deployment
| Python | apache-2.0 | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder | ---
+++
@@ -16,7 +16,8 @@
if deploy_secret_key != settings.SECRET_KEY:
return HttpResponseBadRequest('Incorrect key.')
- subprocess.Popen(['scripts/deploy.sh', commit], stdout=subprocess.PIPE)
+ subprocess.run(['scripts/deploy.sh', commit],
+ stdout=subprocess.PIPE, stderr=subp... |
6740f677903c7d48748fd0a595762b8bf2c7dcb3 | test_connector/components/components.py | test_connector/components/components.py | # -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
# TODO make API short paths
# from odoo.addons.connector import Component
from odoo.addons.connector.components.core import Component
from odoo.addons.connector.components.collection import use
... | # -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
# TODO make API short paths
# from odoo.addons.connector import Component
from odoo.addons.connector.components.core import Component
class BaseComponent(Component):
_inherit = 'base'
d... | Improve on the collections, work, ... | Improve on the collections, work, ...
| Python | agpl-3.0 | OCA/connector,OCA/connector | ---
+++
@@ -5,7 +5,6 @@
# TODO make API short paths
# from odoo.addons.connector import Component
from odoo.addons.connector.components.core import Component
-from odoo.addons.connector.components.collection import use
class BaseComponent(Component): |
3bee320f66d192e2e40b6b91a53c3ccd64c09443 | test/MSVC/query_vcbat.py | test/MSVC/query_vcbat.py | import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
if sys.platform != 'win32':
msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
#####
# Test the basics
test.write('SConstruct',"""
import os
env = Environment(tools = ['MSVCC... | import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
if sys.platform != 'win32':
msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
#####
# Test the basics
test.write('SConstruct',"""
from SCons.Tool.MSVCCommon import FindMSVSB... | Update our fake test for debugging purpose. | Update our fake test for debugging purpose.
| Python | mit | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons | ---
+++
@@ -12,8 +12,20 @@
# Test the basics
test.write('SConstruct',"""
-import os
-env = Environment(tools = ['MSVCCommon'])
+from SCons.Tool.MSVCCommon import FindMSVSBatFile, ParseBatFile, MergeMSVSBatFile, query_versions
+#env = Environment(tools = ['mingw'])
+DefaultEnvironment(tools = [])
+#for v in [9, 8,... |
d58eb0f244d461222d5cd0719675cf46a9297081 | app/influx/views.py | app/influx/views.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from flask import jsonify
from flask import current_app
from influxdb import InfluxDBClient
from app.base import ApiResource
class InfluxResource(ApiResource):
endpoint = 'influxdb'
url_prefix = '/influxdb'
url_rules = {
'index': {
'rule... | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from flask import jsonify
from flask import current_app
from influxdb import InfluxDBClient
from app.base import ApiResource
class InfluxResource(ApiResource):
endpoint = 'influxdb'
url_prefix = '/influxdb'
url_rules = {
'index': {
'rule... | Stop watching movies while editing code! | Stop watching movies while editing code! | Python | bsd-2-clause | Crapworks/ceph-dash,Crapworks/ceph-dash,Aorjoa/aiyara-ceph-dash,Crapworks/ceph-dash,Aorjoa/aiyara-ceph-dash,Aorjoa/aiyara-ceph-dash,Aorjoa/aiyara-ceph-dash,Crapworks/ceph-dash,Aorjoa/aiyara-ceph-dash | ---
+++
@@ -6,8 +6,8 @@
from influxdb import InfluxDBClient
+from app.base import ApiResource
-from app.base import ApiResource
class InfluxResource(ApiResource):
endpoint = 'influxdb' |
165d76e68492070060a7045e08a7bec09a226093 | api/base/exceptions.py | api/base/exceptions.py |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
# ... |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
# Import inside method to avoid errors when the OSF is loaded without Django
from rest_framework.view... | Add comment to explain import inside method | Add comment to explain import inside method
| Python | apache-2.0 | arpitar/osf.io,mluke93/osf.io,icereval/osf.io,DanielSBrown/osf.io,MerlinZhang/osf.io,pattisdr/osf.io,cslzchen/osf.io,ckc6cz/osf.io,ckc6cz/osf.io,sbt9uc/osf.io,RomanZWang/osf.io,sloria/osf.io,jnayak1/osf.io,petermalcolm/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,alexschiller/osf.io,Ghalko/osf.io,alexschiller/osf... | ---
+++
@@ -6,6 +6,7 @@
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
+ # Import inside method to avoid errors when the OSF is loaded without Django
from rest_framework.views import exception_handler
response = exception_hand... |
2a925111aa0cd114b30e94c6a8d7d96d46f6d3d8 | appengine_config.py | appengine_config.py | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | Enable the Appstats Interactive Playground. | Enable the Appstats Interactive Playground.
| Python | apache-2.0 | riannucci/rietveldv2,riannucci/rietveldv2 | ---
+++
@@ -34,8 +34,10 @@
# Segregate Appstats by runtime (python vs. python27).
appstats_KEY_NAMESPACE = '__appstats_%s__' % os.getenv('APPENGINE_RUNTIME')
+# Enable Interactive Playground.
+appstats_SHELL_OK = True
+
# Django 1.2+ requires DJANGO_SETTINGS_MODULE environment variable to be set
-# http://code.g... |
df2fe66f64f79127374d2f183cb76966f77761ee | signac/common/errors.py | signac/common/errors.py | # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the MIT License.
class Error(Exception):
pass
class ConfigError(Error, RuntimeError):
pass
class AuthenticationError(Error, RuntimeError):
pass
| # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the MIT License.
class Error(Exception):
pass
class ConfigError(Error, RuntimeError):
pass
class AuthenticationError(Error, RuntimeError):
def __str__(self):
if len(self.arg... | Improve error message for authentication issues. | Improve error message for authentication issues.
| Python | bsd-3-clause | csadorf/signac,csadorf/signac | ---
+++
@@ -12,4 +12,9 @@
class AuthenticationError(Error, RuntimeError):
- pass
+
+ def __str__(self):
+ if len(self.args) > 0:
+ return "Failed to authenticate with host '{}'.".format(self.args[0])
+ else:
+ return "Failed to authenticate with host." |
b1adfacff3b7c319ae148e79807d371ded934a5c | tx_salaries/management/commands/generate_transformer_hash.py | tx_salaries/management/commands/generate_transformer_hash.py | from django.core.management.base import BaseCommand
from ...utils import transformer
class Command(BaseCommand):
def handle(self, filename, *args, **kwargs):
reader = transformer.convert_to_csv_reader(filename)
labels = reader.next()
print transformer.generate_key(labels)
| from django.core.management.base import BaseCommand
from ...utils import transformer
class Command(BaseCommand):
def handle(self, filename, *args, **kwargs):
reader = transformer.convert_to_csv_reader(filename)
labels = reader.next()
transformer_key = transformer.generate_key(labels)
... | Add message if transformer_hash already exists | Add message if transformer_hash already exists
| Python | apache-2.0 | texastribune/tx_salaries,texastribune/tx_salaries | ---
+++
@@ -7,4 +7,9 @@
def handle(self, filename, *args, **kwargs):
reader = transformer.convert_to_csv_reader(filename)
labels = reader.next()
- print transformer.generate_key(labels)
+ transformer_key = transformer.generate_key(labels)
+
+ if transformer_key in transform... |
e4b47c9bc3de18c83a2fb718c806b7668b492de6 | authentication/urls.py | authentication/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'authentication/login.html'}),
url(r'^logout/$', 'logout_then_login')) | from django.conf.urls import patterns, include, url
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'authentication/login.html'}),
url(r'^logout/$', 'logout_then_login',name='logout')) | Add name to logout url regex | Add name to logout url regex
| Python | mit | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | ---
+++
@@ -3,4 +3,4 @@
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'authentication/login.html'}),
- url(r'^logout/$', 'logout_then_login'))
+ url(r'^logout/$', 'logout_then_login',name='logout')) |
caa2b1e9303d2ba67a0491942d2459006ea8efe3 | bucky/__init__.py | bucky/__init__.py | from flask import Flask
from flask_login import LoginManager
from config import config
database = {}
login_manager = LoginManager()
def create_app(config_name):
app = Flask(__name__)
app.database = database
app.config.from_object(config[config_name])
login_manager.init_app(app)
@logi... | from flask import Flask
from flask_login import LoginManager
from config import config
database = {}
current_user = {}
login_manager = LoginManager()
def create_app(config_name):
app = Flask(__name__)
app.database = database
app.current_user = current_user
app.config.from_object(config[con... | Add current_user to app properties | Add current_user to app properties
| Python | mit | JoshuaOndieki/buckylist,JoshuaOndieki/buckylist | ---
+++
@@ -3,11 +3,13 @@
from config import config
database = {}
+current_user = {}
login_manager = LoginManager()
def create_app(config_name):
app = Flask(__name__)
app.database = database
+ app.current_user = current_user
app.config.from_object(config[config_name])
login_manager.init... |
b9b194b9eb9a9ddefa9549a522fc67c181acbc4a | tests/test_importlazy.py | tests/test_importlazy.py | """
To run this test:
1. cd importlazy/tests
2. python -m unittest test_importlazy.py
"""
import unittest
import sys
class ImportLazyTest(unittest.TestCase):
def test1_initial_state(self):
"""Initially, the module must not exist in the imported modules.
The package or module should not be import... | """
To run this test:
1. cd importlazy/tests
2. python -m unittest test_importlazy.py
"""
import unittest
import sys
class ImportLazyTest(unittest.TestCase):
def test1_initial_state(self):
"""Initially, the module must not exist in the imported modules.
The package or module should not be import... | Check the instance against the original class declaration. | Check the instance against the original class declaration.
| Python | mit | ldiary/importlazy | ---
+++
@@ -37,5 +37,6 @@
# Check that we can really create an instance of the imported class
one = firstpkg.path.ClassOne()
- assert isinstance(one, firstpkg.path.ClassOne)
+ from firstpkg.a_module import AModuleClassOne
+ assert isinstance(one, AModuleClassOne)
|
0f16fe34654560f8889ad1f5b199cb8bfa2b3846 | tests/web/test_status.py | tests/web/test_status.py | """
Test Status Endpoint
GET /status
HEAD /status
"""
from biothings.tests.web import BiothingsTestCase
from setup import setup_es # pylint: disable=unused-import
class TestStatus(BiothingsTestCase):
def test_01_get(self):
res = self.request('/status').text
assert res == 'OK'
... | """
Test Status Endpoint
GET /status
HEAD /status
"""
from biothings.tests.web import BiothingsTestCase
from setup import setup_es # pylint: disable=unused-import
class TestStatus(BiothingsTestCase):
def test_01_get(self):
"""
{
"code": 200,
"status": "yel... | Update test case for status handler accordingly | Update test case for status handler accordingly
| Python | apache-2.0 | biothings/biothings.api,biothings/biothings.api | ---
+++
@@ -13,9 +13,28 @@
class TestStatus(BiothingsTestCase):
def test_01_get(self):
-
- res = self.request('/status').text
- assert res == 'OK'
+ """
+ {
+ "code": 200,
+ "status": "yellow",
+ "payload": {
+ "id": "1017",
+ ... |
69d88adcedaf3779e5bf5a5757a21c71d4aa3016 | novajoin/errors.py | novajoin/errors.py | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Use Exception instead of StandardError | Use Exception instead of StandardError
StandardError was deprecated in python 3.X.
| Python | apache-2.0 | rcritten/novajoin | ---
+++
@@ -13,7 +13,7 @@
# under the License.
-class ConfigurationError(StandardError):
+class ConfigurationError(Exception):
def __init__(self, message):
- StandardError.__init__(self, message)
+ super(Exception, self).__init__(message) |
6caa1c3962ecc7ab57dea83a5c7beef4f3c1220e | pmxbot/__init__.py | pmxbot/__init__.py | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
from __future__ import absolute_import
import socket
import logging
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
password = No... | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
from __future__ import absolute_import
import socket
import logging as _logging
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
p... | Fix issue with conflated pmxbot.logging | Fix issue with conflated pmxbot.logging
| Python | bsd-3-clause | jamwt/diesel-pmxbot,jamwt/diesel-pmxbot | ---
+++
@@ -4,7 +4,7 @@
from __future__ import absolute_import
import socket
-import logging
+import logging as _logging
from .dictlib import ConfigDict
@@ -30,6 +30,6 @@
librarypaste = 'http://paste.jaraco.com',
)
config['logs URL'] = 'http://' + socket.getfqdn()
-config['log level'] = logging.INFO
+con... |
0928060f4390f221d68518a9ec7b8b43b82423b2 | iatidq/dqfunctions.py | iatidq/dqfunctions.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Adjust for new IATI Updates API; don't have to page through results | Adjust for new IATI Updates API; don't have to page through results
| Python | agpl-3.0 | pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality | ---
+++
@@ -32,16 +32,18 @@
db.session.add(pkg)
def packages_from_registry(registry_url):
- offset = 0
- while True:
- data = urllib2.urlopen(registry_url % (offset), timeout=60).read()
- print (registry_url % (offset))
- data = json.loads(data)
+ #offset = 0
+ #while ... |
c9f4c6442c250d8daecb7476bb1a22dae53f3859 | blockbuster/__init__.py | blockbuster/__init__.py | __author__ = 'Matt Stibbs'
__version__ = '1.27.00'
target_schema_version = '1.25.00'
from flask import Flask
app = Flask(__name__)
def startup():
import blockbuster.bb_dbconnector_factory
import blockbuster.bb_logging as log
import blockbuster.bb_auditlogger as audit
blockbuster.app.debug = blockbus... | __author__ = 'Matt Stibbs'
__version__ = '1.27.00'
target_schema_version = '1.25.00'
from flask import Flask
import logging
logger = logging.getLogger(__name__)
app = Flask(__name__)
import blockbuster.bb_auditlogger as audit
def startup():
import blockbuster.bb_dbconnector_factory
blockbuster.app.debug =... | Change logging to use standard logging library. | Change logging to use standard logging library.
| Python | mit | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | ---
+++
@@ -3,19 +3,26 @@
target_schema_version = '1.25.00'
from flask import Flask
+import logging
+
+logger = logging.getLogger(__name__)
+
app = Flask(__name__)
+import blockbuster.bb_auditlogger as audit
def startup():
import blockbuster.bb_dbconnector_factory
- import blockbuster.bb_logging as ... |
df45251622e6b935b27022e36fcbd79e9228f989 | bonobo/commands/init.py | bonobo/commands/init.py | import os
def execute(name, branch, overwrite_if_exists=False):
try:
from cookiecutter.main import cookiecutter
except ImportError as exc:
raise ImportError(
'You must install "cookiecutter" to use this command.\n\n $ pip install cookiecutter\n'
) from exc
if os.listdir... | import os
def execute(name, branch):
try:
from cookiecutter.main import cookiecutter
except ImportError as exc:
raise ImportError(
'You must install "cookiecutter" to use this command.\n\n $ pip install cookiecutter\n'
) from exc
overwrite_if_exists = False
project_... | Check if target directory is empty instead of current directory and remove overwrite_if_exists argument | Check if target directory is empty instead of current directory and remove overwrite_if_exists argument
| Python | apache-2.0 | hartym/bonobo,python-bonobo/bonobo,hartym/bonobo,hartym/bonobo,python-bonobo/bonobo,python-bonobo/bonobo | ---
+++
@@ -1,6 +1,6 @@
import os
-def execute(name, branch, overwrite_if_exists=False):
+def execute(name, branch):
try:
from cookiecutter.main import cookiecutter
except ImportError as exc:
@@ -8,7 +8,9 @@
'You must install "cookiecutter" to use this command.\n\n $ pip install coo... |
c8a2647424a24ea97c1e5ed5a14c85f8a8eadd8b | email_tools.py | email_tools.py | from contextlib import contextmanager
import logging
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from settings import Settings
@contextmanager
def smtp_server():
s = smtplib.SMTP(Settings.SMTP_HOST, Settings.SMTP_PORT)
s.starttls()
s.login(Settings.... | from contextlib import contextmanager
import logging
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from settings import Settings
@contextmanager
def smtp_server():
s = smtplib.SMTP(Settings.SMTP_HOST, Settings.SMTP_PORT)
s.starttls()
s.login(Settings.... | Raise exception is EMAIL_RECIPIENT not set | Raise exception is EMAIL_RECIPIENT not set
| Python | mit | achauve/pycurator | ---
+++
@@ -18,8 +18,11 @@
def send_email(s, sender, msg_subject, html_content):
+ if Settings.EMAIL_RECIPIENT is None:
+ raise Exception('EMAIL_RECIPIENT env variable must be set')
+ recipients = [Settings.EMAIL_RECIPIENT]
+
msg = MIMEMultipart()
- recipients = [Settings.EMAIL_RECIPIENT]
... |
c4bf617dddd15e77974b000e8fa90750e1761386 | siteconfig/__init__.py | siteconfig/__init__.py | from .configobj import Config
config = Config.from_environ()
# Add the data and some of the API as attributes of the top-level package.
globals().update(config)
get = config.get
| from .configobj import Config
config = Config.from_environ()
# Add the data and some of the API as attributes of the top-level package.
globals().update(config)
get = config.get
get_bool = config.get_bool
| Add get_bool to package exports | Add get_bool to package exports
| Python | bsd-3-clause | mikeboers/siteconfig,mikeboers/siteconfig | ---
+++
@@ -4,4 +4,6 @@
# Add the data and some of the API as attributes of the top-level package.
globals().update(config)
+
get = config.get
+get_bool = config.get_bool |
4c71ba23720001d06d519a7828f2866814f1c46a | tests/conftest.py | tests/conftest.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
from UM.Application import Application
class FixtureApplication(Application):
def __init__(self):
Application._instance = None
super().__init__("test", "1.0")
def functionEvent(se... | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
from UM.Application import Application
from UM.Signal import Signal
class FixtureApplication(Application):
def __init__(self):
Application._instance = None
super().__init__("test", "1.... | Make sure to set the test application instance as app for Signals | Make sure to set the test application instance as app for Signals
This makes singals be properly emitted in tests
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium | ---
+++
@@ -4,14 +4,16 @@
import pytest
from UM.Application import Application
+from UM.Signal import Signal
class FixtureApplication(Application):
def __init__(self):
Application._instance = None
super().__init__("test", "1.0")
+ Signal._app = self
def functionEvent(self, ... |
14917a4d503569147277bfd5fefa4b2600dfea40 | tests/conftest.py | tests/conftest.py | import pytest
@pytest.fixture(autouse=True)
def tagschecker(request):
tags = set(request.config.getini('TAGS'))
tags_marker = request.node.get_marker('tags')
xfailtags_marker = request.node.get_marker('xfailtags')
skiptags_marker = request.node.get_marker('skiptags')
if tags_marker and tags.isdi... | import pytest
@pytest.fixture(autouse=True)
def tagschecker(request):
tags = set(request.config.getini('TAGS'))
tags_marker = request.node.get_marker('tags')
xfailtags_marker = request.node.get_marker('xfailtags')
skiptags_marker = request.node.get_marker('skiptags')
if xfailtags_marker and not ... | Set xfailtags as first priority | Set xfailtags as first priority
| Python | mit | dincamihai/salt-toaster,dincamihai/salt-toaster | ---
+++
@@ -9,9 +9,10 @@
xfailtags_marker = request.node.get_marker('xfailtags')
skiptags_marker = request.node.get_marker('skiptags')
- if tags_marker and tags.isdisjoint(set(tags_marker.args)):
- pytest.skip('skipped for this tags: {}'.format(tags))
- elif skiptags_marker and not tags.i... |
eacfca844e5ab590acfcd193e2ca1fa379e10009 | alg_strongly_connected_components.py | alg_strongly_connected_components.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def strongly_connected_components():
"""Strongly connected components for graph.
Procedure:
- Call (Depth First Search) DFS on graph G to
compute finish times for each vertex.
- C... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def _previsit():
pass
def _postvisit():
pass
def dfs():
pass
def _transpose_graph():
pass
def _inverse_postvisit_vertex():
pass
def strongly_connected_components():
"""Strongl... | Add strongly connected components's methods | Add strongly connected components's methods
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -1,6 +1,26 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
+
+
+def _previsit():
+ pass
+
+
+def _postvisit():
+ pass
+
+
+def dfs():
+ pass
+
+
+def _transpose_graph():
+ pass
+
+
+def _inverse_postvisit_vertex():
+ pass
... |
150058856f10992d0f65f47d79ac14e2f52818cc | cellcounter/urls.py | cellcounter/urls.py | from django.conf.urls import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.contrib.auth.views import login, logout
from cellcounter.main.views import new_count, view_cou... | from django.conf.urls import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.contrib.auth.views import login, logout
from cellcounter.main.views import new_count, view_cou... | Add URL to enable user list view | Add URL to enable user list view
| Python | mit | cellcounter/cellcounter,oghm2/hackdayoxford,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcountr,haematologic/cellcounter,cellcounter/cellcounter,haematologic/cellcountr,haematologic/cellcounter,haematologic/cellcounter,oghm2/hackdayoxford | ---
+++
@@ -5,7 +5,7 @@
from django.contrib import admin
from django.contrib.auth.views import login, logout
-from cellcounter.main.views import new_count, view_count, edit_count
+from cellcounter.main.views import new_count, view_count, edit_count, ListMyCountsView
admin.autodiscover()
@@ -19,6 +19,8 @@
... |
c18bdb90e6197e298cc6bfb5f52ffbf1d48f029e | paramrunner.py | paramrunner.py | # -*- coding: utf-8 -*-
# paramrunner.py
# Run findparams on linde model and save results
import helpers
import findparams
import tables
import numpy as np
savedir = "/home/ith/results/"
savefile = "linde-params.hf5"
WMAP5PIVOT = np.array([5.25e-60])
lindefx = {"vars":["mass","lambda"], "values": [np.linspace(4.9e-8... | # -*- coding: utf-8 -*-
# paramrunner.py
# Run findparams on linde model and save results
import helpers
import findparams
import tables
import numpy as np
savedir = "/home/ith/results/"
savefile = "linde-params.hf5"
WMAP5PIVOT = np.array([5.25e-60])
lindefx = {"vars":["mass","lambda"], "values": [np.linspace(4.9e-8... | Change name of results array. | Change name of results array.
| Python | bsd-3-clause | ihuston/pyflation,ihuston/pyflation | ---
+++
@@ -34,7 +34,7 @@
try:
rfile = tables.openFile(sd + sf, "w")
- rfile.createArray(rfile.root, "params-results", results, "Model parameter search results")
+ rfile.createArray(rfile.root, "params_results", results, "Model parameter search results")
print "Results saved... |
705b93f7fd688c4889562a9950c220db23ffa98a | tomso/__init__.py | tomso/__init__.py | __version__ = "0.0.12"
__all__ = [
'adipls',
'utils',
'constants',
'gyre',
'fgong',
'mesa',
'stars'
]
| __version__ = "0.0.12"
__all__ = [
'adipls',
'constants',
'fgong',
'gyre',
'mesa',
'stars',
'utils'
]
| Put modules in alphabetical order | Put modules in alphabetical order
| Python | mit | warrickball/tomso | ---
+++
@@ -2,10 +2,10 @@
__all__ = [
'adipls',
- 'utils',
'constants',
+ 'fgong',
'gyre',
- 'fgong',
'mesa',
- 'stars'
+ 'stars',
+ 'utils'
] |
594f6b189f496ec01c8c6742cde8639689dd50cc | tomso/__init__.py | tomso/__init__.py | __version__ = "0.0.11a"
__all__ = [
'adipls',
'common',
'gyre',
'io',
'mesa',
'stars'
]
| __version__ = "0.0.11a"
__all__ = [
'adipls',
'common',
'gyre',
'fgong',
'mesa',
'stars'
]
| Fix list of submodules so that from tomso import * works | Fix list of submodules so that from tomso import * works
| Python | mit | warrickball/tomso | ---
+++
@@ -4,7 +4,7 @@
'adipls',
'common',
'gyre',
- 'io',
+ 'fgong',
'mesa',
'stars'
] |
72455eeeab41810e49a182422c41a4c6e315055e | build.py | build.py | import os.path
from buildlib import *
CONFIGURATION = 'Debug'
project = Project(__file__, 'build')
project.version = '0.1.0'
project.versioninfo = 'alpha'
project.build_number = 0
project.configuration = 'Release'
project.start()
project.clean()
project.write_version('src/.version/VersionInfo.cs')
pr... | import os.path
from buildlib import *
project = Project(__file__, 'build')
project.version = '0.0.0'
project.versioninfo = 'alpha'
project.build_number = 0
project.configuration = 'Debug'
project.start()
project.clean()
project.write_version('src/.version/VersionInfo.cs')
project.msbuild('src/Dolstagis.... | Build as 0.0.0-debug for now. | Build as 0.0.0-debug for now.
| Python | mit | jammycakes/dolstagis.web,jammycakes/dolstagis.web,jammycakes/dolstagis.web | ---
+++
@@ -1,14 +1,12 @@
import os.path
from buildlib import *
-CONFIGURATION = 'Debug'
-
project = Project(__file__, 'build')
-project.version = '0.1.0'
+project.version = '0.0.0'
project.versioninfo = 'alpha'
project.build_number = 0
-project.configuration = 'Release'
+project.configuration = 'Debug'
p... |
8445c6bc549285fea5313a72c0500e2240460332 | avalonstar/apps/subscribers/admin.py | avalonstar/apps/subscribers/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Ticket
class TicketAdmin(admin.ModelAdmin):
list_display = ['name', 'display_name', 'updated', 'is_active', 'is_paid', 'twid']
list_editable = ['is_active', 'is_paid']
ordering = ['-updated']
admin.site.register(Ticket, TicketAd... | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Ticket
class TicketAdmin(admin.ModelAdmin):
list_display = ['name', 'display_name', 'created', 'updated', 'is_active', 'is_paid', 'twid']
list_editable = ['created', 'updated', 'is_active', 'is_paid']
ordering = ['-updated']
adm... | Add created to list_display; make it editable. | Add created to list_display; make it editable.
| Python | apache-2.0 | bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv | ---
+++
@@ -5,7 +5,7 @@
class TicketAdmin(admin.ModelAdmin):
- list_display = ['name', 'display_name', 'updated', 'is_active', 'is_paid', 'twid']
- list_editable = ['is_active', 'is_paid']
+ list_display = ['name', 'display_name', 'created', 'updated', 'is_active', 'is_paid', 'twid']
+ list_editable ... |
5af67c1bf24768e5d2fe573198866af7d3e766de | lms/djangoapps/heartbeat/views.py | lms/djangoapps/heartbeat/views.py | import json
from datetime import datetime
from django.http import HttpResponse
from xmodule.modulestore.django import modulestore
def heartbeat(request):
"""
Simple view that a loadbalancer can check to verify that the app is up
"""
output = {
'date': datetime.now().isoformat(),
'cours... | import json
from datetime import datetime
from django.http import HttpResponse
from xmodule.modulestore.django import modulestore
def heartbeat(request):
"""
Simple view that a loadbalancer can check to verify that the app is up
"""
output = {
'date': datetime.now().isoformat(),
'cours... | Put course location urls in heartbeat page, rather than lists | Put course location urls in heartbeat page, rather than lists
| Python | agpl-3.0 | edx-solutions/edx-platform,beni55/edx-platform,arifsetiawan/edx-platform,lduarte1991/edx-platform,dsajkl/123,J861449197/edx-platform,ampax/edx-platform-backup,motion2015/edx-platform,alexthered/kienhoc-platform,cyanna/edx-platform,ZLLab-Mooc/edx-platform,motion2015/a3,amir-qayyum-khan/edx-platform,wwj718/edx-platform,j... | ---
+++
@@ -10,6 +10,6 @@
"""
output = {
'date': datetime.now().isoformat(),
- 'courses': [course.location for course in modulestore().get_courses()],
+ 'courses': [course.location.url() for course in modulestore().get_courses()],
}
return HttpResponse(json.dumps(output, ind... |
7ba76f2f4dd861e4acd34536e3484fc8ef001b3f | IPython/nbconvert/exporters/python.py | IPython/nbconvert/exporters/python.py | """Python script Exporter class"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----------... | """Python script Exporter class"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----------... | Add the . into file_extension | Add the . into file_extension
| Python | bsd-3-clause | cornhundred/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,cornhundred/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,cornhundred/ipywidgets,ipython/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipy... | ---
+++
@@ -23,7 +23,7 @@
Exports a Python code file.
"""
def _file_extension_default(self):
- return 'py'
+ return '.py'
def _template_file_default(self):
return 'python' |
2e1b5f4804023cd551b1d641e4b4dc5ba693ff62 | demos/simple.py | demos/simple.py | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
if __name__ == '__main__':
sn = 0.2
ell = 0.670104947766
sf = 1.25415619045
model = pbm.Sinusoidal(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds... | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
def run_model(Model, sn, ell, sf, T):
model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds)
xmin = model.bounds[0][0]
xmax = model.bounds[0][1]... | Add a harder test example. | Add a harder test example.
| Python | bsd-2-clause | mwhoffman/pybo,jhartford/pybo | ---
+++
@@ -6,12 +6,8 @@
import pybo.policies as pbp
-if __name__ == '__main__':
- sn = 0.2
- ell = 0.670104947766
- sf = 1.25415619045
-
- model = pbm.Sinusoidal(0.2)
+def run_model(Model, sn, ell, sf, T):
+ model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.... |
d008a08d0c79610eba715842c2f437bf89f8787c | puffin/gui/form.py | puffin/gui/form.py | from flask_wtf import Form
from wtforms import StringField, IntegerField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, Regexp
from ..core.db import db
from ..core.security import User
from .. import app
class ApplicationForm(Form):
start = SubmitField('Start')
stop =... | from flask_wtf import Form
from flask_security.core import current_user
from wtforms import StringField, IntegerField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, Regexp
from ..core.db import db
from ..core.security import User
from .. import app
class ApplicationForm(Form)... | Allow changing domain to own | Allow changing domain to own
| Python | agpl-3.0 | loomchild/jenca-puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,loomchild/puffin,loomchild/puffin,loomchild/jenca-puffin | ---
+++
@@ -1,4 +1,5 @@
from flask_wtf import Form
+from flask_security.core import current_user
from wtforms import StringField, IntegerField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, Regexp
from ..core.db import db |
5944ada060154cde31c1fe04adeb1fb10a718eaf | urllibRequests.py | urllibRequests.py | import urllib.request
import urllib.parse
def get(urlStr,params={}):
if params == {}:
req = urllib.request.urlopen(urlStr)
else:
reqdata = urllib.request.Request(urlStr,urllib.parse.urlencode(params).encode('ascii'))
req = urllib.request.urlopen(reqdata)
return req.read()
| import urllib.request
import urllib.parse
def get(urlStr,params={}):
reqdata = urllib.request.Request(urlStr)
reqdata.add_header('User-Agent',
'VocabTool/0.2 (https://github.com/RihanWu/vocabtool)')
if params != {}:
reqdata.data = urllib.parse.urlencode(params).encode('ascii'... | Add User-Agent for better netiquette | Add User-Agent for better netiquette
| Python | mit | RihanWu/vocabtool | ---
+++
@@ -2,9 +2,10 @@
import urllib.parse
def get(urlStr,params={}):
- if params == {}:
- req = urllib.request.urlopen(urlStr)
- else:
- reqdata = urllib.request.Request(urlStr,urllib.parse.urlencode(params).encode('ascii'))
+ reqdata = urllib.request.Request(urlStr)
+ reqdata.add_hea... |
c72120b4b3b7131450f1ee34c9b373f61a80c581 | utils/database.py | utils/database.py | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | import json
class Database(dict):
"""Holds a dict that contains all the information about the users in a channel"""
def __init__(self, irc):
super(Database, self).__init__(json.load(open("userdb.json")))
self.irc = irc
def remove_entry(self, event, nick):
try:
del self... | Fix NameError: global name 'messsage' is not defined | Fix NameError: global name 'messsage' is not defined
| Python | mit | wolfy1339/Python-IRC-Bot | ---
+++
@@ -21,7 +21,7 @@
'hostmask': hostmask,
'host': hostmask.split("@")[1],
'account': account,
- 'seen': [{"time":__import__("time").time(), messsage:""}]
+ 'seen': [{"time":__import__("time").time(), "messsage":""}]
}
if nick in self... |
cde59e7f8f8ea74c720f107c80c933b5b9aa913e | recipy/__init__.py | recipy/__init__.py | # These lines ARE needed, as they actually set up sys.meta_path
from . import PatchWarnings
from . import PatchBaseScientific
from . import PatchScientific
from .log import *
from .utils import open
__version__ = '0.2.3'
# Patch built-in open function
# orig_open = __builtins__['open']
# def patched_open(*args, **k... | # These lines ARE needed, as they actually set up sys.meta_path
from . import PatchWarnings
from . import PatchBaseScientific
from . import PatchScientific
from .log import *
from .utils import open
__version__ = '0.3'
log_init()
| Remove old commented out code, and update version to 0.3 | Remove old commented out code, and update version to 0.3
| Python | apache-2.0 | recipy/recipy,recipy/recipy | ---
+++
@@ -7,16 +7,6 @@
from .utils import open
-__version__ = '0.2.3'
-
-# Patch built-in open function
-# orig_open = __builtins__['open']
-# def patched_open(*args, **kwargs):
-# print('Called open!')
-# print(args)
-# print(kwargs)
-# return(orig_open(*args, **kwargs))
-
-# __builtins__['open'] = patche... |
f7dd603d4e24134affda6430736838ecaaab9938 | jungle/cli.py | jungle/cli.py | # -*- coding: utf-8 -*-
import click
from . import __version__
class JungleCLI(click.MultiCommand):
"""Jangle CLI main class"""
def list_commands(self, ctx):
"""return available modules"""
return ['ec2', 'elb', 'emr', 'asg']
def get_command(self, ctx, name):
"""get command"""
... | # -*- coding: utf-8 -*-
import click
from . import __version__
class JungleCLI(click.MultiCommand):
"""Jangle CLI main class"""
def list_commands(self, ctx):
"""return available modules"""
return ['ec2', 'elb', 'emr', 'asg']
def get_command(self, ctx, name):
"""get command"""
... | Fix unintended ImportError for wrong subcommnad | Fix unintended ImportError for wrong subcommnad
| Python | mit | achiku/jungle | ---
+++
@@ -14,11 +14,14 @@
def get_command(self, ctx, name):
"""get command"""
- mod = __import__('jungle.' + name, None, None, ['cli'])
- return mod.cli
+ try:
+ mod = __import__('jungle.' + name, None, None, ['cli'])
+ return mod.cli
+ except Import... |
d0211871e11d2a2ce9f9a961750aa12a28658c62 | vroom/graphics.py | vroom/graphics.py | import pygame
class Graphic:
car_color = (255, 50, 50)
car_width = 3
road_color = (255, 255, 255)
road_width = 6
draw_methods = {
'Car': 'draw_car',
'Road': 'draw_road',
}
def __init__(self, surface):
self.surface = surface
def draw(self, obj):
object_... | import pygame
class Graphic:
car_color = (255, 50, 50)
car_width = 3
road_color = (255, 255, 255)
road_width = 6
draw_methods = {
'Car': 'draw_car',
'Road': 'draw_road',
}
def __init__(self, surface):
self.surface = surface
def draw(self, obj):
object_... | Change car color depending on acceleration rate | Change car color depending on acceleration rate
| Python | mit | thibault/vroom | ---
+++
@@ -23,9 +23,18 @@
def draw_car(self, car):
coord = car.coordinates
+ acceleration_rate = car.acceleration_rate
rect = pygame.Rect(coord.x, coord.y,
self.car_width, self.car_width)
- pygame.draw.rect(self.surface, self.car_color, rect, 0)
+
+ ... |
bddf5358b92d58549496de41ffeea724aeb2feb7 | openmm/run_test.py | openmm/run_test.py | #!/usr/bin/env python
from simtk import openmm
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
assert openmm.Platform.getOpenMMVersion() == '7.1.1', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == 'c1a64aa... | #!/usr/bin/env python
from simtk import openmm
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
assert openmm.Platform.getOpenMMVersion() == '7.2', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
# Check git hash
assert openmm.version.git_revision == '07c1b86c9... | Update test for 7.2 beta build | [openmm] Update test for 7.2 beta build
| Python | mit | peastman/conda-recipes,omnia-md/conda-recipes,peastman/conda-recipes,omnia-md/conda-recipes,omnia-md/conda-recipes,peastman/conda-recipes | ---
+++
@@ -4,7 +4,7 @@
# Check major version number
# If Z=0 for version X.Y.Z, out put is "X.Y"
-assert openmm.Platform.getOpenMMVersion() == '7.1.1', "openmm.Platform.getOpenMMVersion() = %s" % openmm.Platform.getOpenMMVersion()
+assert openmm.Platform.getOpenMMVersion() == '7.2', "openmm.Platform.getOpenMMVer... |
9c184878af2e7dd45bc7ff653979d008a77b0e30 | SimPEG/regularization/__init__.py | SimPEG/regularization/__init__.py | from .base import (
BaseRegularization,
LeastSquaresRegularization,
BaseSimilarityMeasure,
Small,
SmoothDeriv,
SmoothDeriv2,
)
from .regularization_mesh import RegularizationMesh
from .sparse import SparseSmall, SparseDeriv, Sparse
from .pgi import (
PGIsmallness,
PGI,
PGIwithNonline... | from ..utils.code_utils import deprecate_class
from .base import (
BaseRegularization,
LeastSquaresRegularization,
BaseSimilarityMeasure,
Small,
SmoothDeriv,
SmoothDeriv2,
)
from .regularization_mesh import RegularizationMesh
from .sparse import SparseSmall, SparseDeriv, Sparse
from .pgi import ... | Move deprecate reg classed to init | Move deprecate reg classed to init
| Python | mit | simpeg/simpeg | ---
+++
@@ -1,3 +1,4 @@
+from ..utils.code_utils import deprecate_class
from .base import (
BaseRegularization,
LeastSquaresRegularization,
@@ -14,7 +15,33 @@
PGIwithNonlinearRelationshipsSmallness,
PGIwithRelationships,
)
-from .tikhonov import Tikhonov
from .cross_gradient import CrossGradien... |
f9b6dbc958251050c6170587d5a205350252329c | samples/ucrmain.py | samples/ucrmain.py | """
Script for performing queries on large time series by using UCR ED and DTW algs.
"""
from time import time
import blaze
from blaze.ts.ucr_dtw import ucr
# Convert txt file into Blaze native format
def convert(filetxt, storage):
import os.path
if not os.path.exists(storage):
blaze.Array(np.loadtx... | """
Script for performing queries on large time series by using UCR ED and DTW algs.
"""
from time import time
import blaze
from blaze.ts.ucr_dtw import ucr
import numpy as np
# Convert txt file into Blaze native format
def convert(filetxt, storage):
import os.path
if not os.path.exists(storage):
bl... | Fix missing numpy import in ucr test | Fix missing numpy import in ucr test
| Python | bsd-2-clause | seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core | ---
+++
@@ -7,6 +7,7 @@
import blaze
from blaze.ts.ucr_dtw import ucr
+import numpy as np
# Convert txt file into Blaze native format
def convert(filetxt, storage): |
29d24fb5e484e552b12778268d249b62390408be | webserver/urls.py | webserver/urls.py | from django.conf.urls.defaults import patterns, url, include
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
# Webserver urls
url(r'^', include('webserver.home.urls')),
url(r'^', include('webserver.profiles.urls')),
url(r'^', inc... | from django.conf.urls.defaults import patterns, url, include
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
# Webserver urls
url(r'^', include('webserver.home.urls')),
url(r'^', include('webserver.profiles.urls')),
url(r'^', inc... | Fix that makes the media uploads work correctly. | Fix that makes the media uploads work correctly.
| Python | bsd-3-clause | siggame/webserver,siggame/webserver,siggame/webserver | ---
+++
@@ -29,17 +29,18 @@
url(r'^admin_tools/', include('admin_tools.urls')),
)
+if settings.DEBUG:
+ urlpatterns += patterns(
+ '',
+ url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
+ {'document_root': settings.MEDIA_ROOT,'show_indexes':True}),
+ url(r'^static/(... |
d00aea75e0f4e6ba74a2ccf57d02a0ef912d17ac | db/TableConfig.py | db/TableConfig.py | {
PDBConst.Name: "config",
PDBConst.Columns: [
{
PDBConst.Name: "Name",
PDBConst.Attributes: ["varchar(128)", "not null", "primary key"]
},
{
PDBConst.Name: "Value",
PDBConst.Attributes: ["varchar(128)"]
}],
PDBConst.Initials: [
{"Name": "'version'", "... | {
PDBConst.Name: "config",
PDBConst.Columns: [
{
PDBConst.Name: "Name",
PDBConst.Attributes: ["varchar(128)", "not null", "primary key"]
},
{
PDBConst.Name: "Value",
PDBConst.Attributes: ["varchar(128)"]
}],
PDBConst.Initials: [
{"Name": "'version'", "... | Update DB to v4.2 on note pdf support | Update DB to v4.2 on note pdf support
| Python | mit | eddiedb6/ej,eddiedb6/ej,eddiedb6/ej | ---
+++
@@ -10,6 +10,6 @@
PDBConst.Attributes: ["varchar(128)"]
}],
PDBConst.Initials: [
- {"Name": "'version'", "Value": "'4.1'"}
+ {"Name": "'version'", "Value": "'4.2'"}
]
} |
bce79a9156f93fd3c9356579bcb9309a66f2bdf2 | pushbullet/filetype.py | pushbullet/filetype.py | def _magic_get_file_type(f, _):
file_type = magic.from_buffer(f.read(1024), mime=True)
f.seek(0)
return file_type.decode('utf-8')
def _guess_file_type(_, filename):
return mimetypes.guess_type(filename)[0]
try:
import magic
except ImportError:
import mimetypes
get_file_type = _guess_file... | def _magic_get_file_type(f, _):
file_type = magic.from_buffer(f.read(1024), mime=True)
f.seek(0)
return maybe_decode(file_type)
def _guess_file_type(_, filename):
return mimetypes.guess_type(filename)[0]
# return str on python3. Don't want to unconditionally
# decode because that results in unicode... | Return str rather than bytes for the description strings on python3. | Return str rather than bytes for the description strings on python3.
| Python | mit | randomchars/pushbullet.py,kovacsbalu/pushbullet.py,Saturn/pushbullet.py | ---
+++
@@ -1,11 +1,20 @@
def _magic_get_file_type(f, _):
file_type = magic.from_buffer(f.read(1024), mime=True)
f.seek(0)
- return file_type.decode('utf-8')
+ return maybe_decode(file_type)
def _guess_file_type(_, filename):
return mimetypes.guess_type(filename)[0]
+
+
+# return str on pyt... |
2a57e5c17115e9c89936e6667985af1a47bf3247 | raiden/utils/typing.py | raiden/utils/typing.py | # -*- coding: utf-8 -*-
from typing import * # NOQA pylint:disable=wildcard-import,unused-wildcard-import
from typing import NewType
T_Address = bytes
Address = NewType('Address', bytes)
T_BlockExpiration = int
BlockExpiration = NewType('BlockExpiration', int)
T_BlockNumber = int
BlockNumber = NewType('BlockNumber'... | # -*- coding: utf-8 -*-
from typing import * # NOQA pylint:disable=wildcard-import,unused-wildcard-import
from typing import NewType
T_Address = bytes
Address = NewType('Address', bytes)
T_BlockExpiration = int
BlockExpiration = NewType('BlockExpiration', int)
T_BlockNumber = int
BlockNumber = NewType('BlockNumber'... | Fix an oversight in new type definitions | Fix an oversight in new type definitions
| Python | mit | hackaugusto/raiden,hackaugusto/raiden | ---
+++
@@ -14,8 +14,8 @@
T_BlockTimeout = int
BlockTimeout = NewType('BlockNumber', int)
-T_ChannelID = T_Address
-ChannelID = NewType('ChannelID', Address)
+T_ChannelID = bytes
+ChannelID = NewType('ChannelID', bytes)
T_Keccak256 = bytes
Keccak256 = NewType('Keccak256', bytes) |
525a9fcb14a1f91aa94508ca6dcc362d430d2969 | __openerp__.py | __openerp__.py | {
'name': "Project Logical Framework",
'category': 'Project',
'sequence': 1,
'description': """
Project Logical Framework
=========================
""",
'version': '0.3',
'depends': ['project'],
'data': [
'static/src/xml/create_project.xml',
],
}
| {
'name': "Project Logical Framework",
'author' : 'Stéphane Codazzi @ TeMPO-consulting',
'category': 'Project',
'sequence': 1,
'description': """
Project Logical Framework
=========================
""",
'version': '0.3',
'depends': ['project'],
'data': [
'static/src/xml/creat... | Add o2m between project and logical frameworks lines | Add o2m between project and logical frameworks lines
| Python | mit | stephane-/project_logical_framework | ---
+++
@@ -1,5 +1,6 @@
{
'name': "Project Logical Framework",
+ 'author' : 'Stéphane Codazzi @ TeMPO-consulting',
'category': 'Project',
'sequence': 1,
'description': """ |
fc203d643aa9a69c835aebee0de9b17851ef7a58 | compose/cli/docker_client.py | compose/cli/docker_client.py | from docker import Client
from docker import tls
import ssl
import os
def docker_client():
"""
Returns a docker-py client configured using environment variables
according to the same logic as the official Docker client.
"""
cert_path = os.environ.get('DOCKER_CERT_PATH', '')
if cert_path == '':... | from docker import Client
from docker import tls
import ssl
import os
def docker_client():
"""
Returns a docker-py client configured using environment variables
according to the same logic as the official Docker client.
"""
cert_path = os.environ.get('DOCKER_CERT_PATH', '')
if cert_path == '':... | Allow API version specification via env var | Allow API version specification via env var
Hard-coding the API version to '1.18' with the docker-py constructor will
cause the docker-py logic at
https://github.com/docker/docker-py/blob/master/docker/client.py#L143-L146
to always fail, which will cause authentication issues if you're using a
remote daemon using API ... | Python | apache-2.0 | jeanpralo/compose,shubheksha/docker.github.io,saada/compose,talolard/compose,joaofnfernandes/docker.github.io,ionrock/compose,iamluc/compose,goloveychuk/compose,vdemeester/compose,menglingwei/denverdino.github.io,qzio/compose,d2bit/compose,docker/docker.github.io,GM-Alex/compose,bdwill/docker.github.io,anweiss/docker.g... | ---
+++
@@ -14,6 +14,8 @@
cert_path = os.path.join(os.environ.get('HOME', ''), '.docker')
base_url = os.environ.get('DOCKER_HOST')
+ api_version = os.environ.get('COMPOSE_API_VERSION', '1.18')
+
tls_config = None
if os.environ.get('DOCKER_TLS_VERIFY', '') != '':
@@ -32,4 +34,4 @@
... |
21dabaa963815f5dc99f19a7e3f792b0515c9089 | Mockbox.py | Mockbox.py | from threading import Thread
from Queue import Queue
from twisted.python import log
import time
import Mailbox, Web
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--verbose", "-v", help="output logs to std out, not the file",
action="store_true")
args = parser.pa... | from threading import Thread
from Queue import Queue
from twisted.python import log
import time
import Mailbox, Web
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--verbose", "-v", help="output logs to std out, not the file",
action="store_true")
args = parser.pa... | Fix logging so it doesn't erase the file | Fix logging so it doesn't erase the file
| Python | mit | jkingsman/Mockbox,jkingsman/Mockbox,jkingsman/Mockbox | ---
+++
@@ -21,7 +21,7 @@
if args.verbose:
log.startLogging(sys.stdout)
else:
- log.startLogging(open('mockbox.log', 'w'))
+ log.startLogging(open('mockbox.log', 'a'))
MailboxThread.start()
WebThread.start() |
7343cf6fe3b9dde76a629fd0c607d7ce0b632a64 | coupons/settings.py | coupons/settings.py | import string
from django.conf import settings
COUPON_TYPES = getattr(settings, 'COUPONS_COUPON_TYPES', (
('monetary', 'Money based coupon'),
('percentage', 'Percentage discount'),
('virtual_currency', 'Virtual currency'),
))
CODE_LENGTH = getattr(settings, 'COUPNS_CODE_LENGTH', 15)
CODE_CHARS = getatt... | import string
from django.conf import settings
COUPON_TYPES = getattr(settings, 'COUPONS_COUPON_TYPES', (
('monetary', 'Money based coupon'),
('percentage', 'Percentage discount'),
('virtual_currency', 'Virtual currency'),
))
CODE_LENGTH = getattr(settings, 'COUPONS_CODE_LENGTH', 15)
CODE_CHARS = getat... | Correct typo in setting names | Correct typo in setting names
| Python | bsd-3-clause | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | ---
+++
@@ -9,6 +9,6 @@
('virtual_currency', 'Virtual currency'),
))
-CODE_LENGTH = getattr(settings, 'COUPNS_CODE_LENGTH', 15)
+CODE_LENGTH = getattr(settings, 'COUPONS_CODE_LENGTH', 15)
-CODE_CHARS = getattr(settings, 'COUPNS_CODE_CHARS', string.ascii_letters+string.digits)
+CODE_CHARS = getattr(settings,... |
093702a38645853d560606446da0b078ba12d14e | eventkit_cloud/auth/admin.py | eventkit_cloud/auth/admin.py |
import logging
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from eventkit_cloud.auth.models import OAuth
from eventkit_cloud.jobs.models import UserLicense
logger = logging.getLogger(__... |
import logging
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from eventkit_cloud.auth.models import OAuth
from eventkit_cloud.jobs.models import UserLicense
logger = logging.getLogger(__... | Add OAuth class information to the UserAdmin page. | Add OAuth class information to the UserAdmin page.
| Python | bsd-3-clause | terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud | ---
+++
@@ -26,13 +26,14 @@
actions.pop('delete_selected', None)
return actions
+class OAuthInline(admin.StackedInline):
+ model = OAuth
class UserLicenseInline(admin.TabularInline):
model = UserLicense
extra = 0
-
-UserAdmin.inlines = [UserLicenseInline]
+UserAdmin.inlines = [OA... |
bf4b22ef25d158ddeb1a98432d29451e10a912e6 | quick_orm/examples/hello_world.py | quick_orm/examples/hello_world.py | from quick_orm.core import Database
from sqlalchemy import Column, String
__metaclass__ = Database.DefaultMeta
class User:
name = Column(String(30))
Database.register()
if __name__ == '__main__':
db = Database('sqlite://')
db.create_tables()
user = User(name = 'Hello World')
... | from quick_orm.core import Database
from sqlalchemy import Column, String
__metaclass__ = Database.DefaultMeta
class User:
name = Column(String(30))
Database.register()
if __name__ == '__main__':
db = Database('sqlite://') # database urls: http://docs.sqlalchemy.org/en/latest/core/engines.html#da... | Add a link for database urls | Add a link for database urls
| Python | bsd-3-clause | tek/sqlpharmacy,tylerlong/quick_orm | ---
+++
@@ -9,11 +9,11 @@
Database.register()
if __name__ == '__main__':
- db = Database('sqlite://')
+ db = Database('sqlite://') # database urls: http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
db.create_tables()
-
+
user = User(name = 'Hello World')
db.session.add_... |
c55a2b152cd2b6603ef358e0f764eeb0308ff332 | Orange/__init__.py | Orange/__init__.py | from __future__ import absolute_import
from importlib import import_module
try:
from .import version
# Always use short_version here (see PEP 386)
__version__ = version.short_version
__git_revision__ = version.git_revision
except ImportError:
__version__ = "unknown"
__git_revision__ = "unknown"... | from __future__ import absolute_import
from importlib import import_module
try:
from .import version
# Always use short_version here (see PEP 386)
__version__ = version.short_version
__git_revision__ = version.git_revision
except ImportError:
__version__ = "unknown"
__git_revision__ = "unknown"... | Remove imports in Orange, except data | Remove imports in Orange, except data
| Python | bsd-2-clause | marinkaz/orange3,kwikadi/orange3,qusp/orange3,kwikadi/orange3,kwikadi/orange3,qPCR4vir/orange3,kwikadi/orange3,qPCR4vir/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,qusp/orange3,qPCR4vir/orange3,cheral/orange3,qusp/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,qPCR4vir/orange3,ch... | ---
+++
@@ -44,10 +44,6 @@
# globals()['clasification'] = classification
_import(".data")
-_import(".distance")
-_import(".feature")
-_import(".feature.discretization")
-_import(".data.discretization")
del _import
del alreadyWarned |
1bd90d597b23f49bce3ca3402256c9bb1ad22647 | accounts/management/commands/request_common_profile_update.py | accounts/management/commands/request_common_profile_update.py | from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
from post_office import mail
class Command(BaseCommand):
help = "Notify users to update."
def handle(self, *args, **option... | from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
from post_office import mail
class Command(BaseCommand):
help = "Notify use... | Handle missing and invalid email addresses. | Handle missing and invalid email addresses.
| Python | agpl-3.0 | osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,osamak/student-portal | ---
+++
@@ -1,7 +1,9 @@
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
+from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
+
from post_office import mail
@@ -14,8 +16,12 ... |
c2973d4f2ae7da0f75f573cebd8eb1780d5b33e1 | account_withholding_automatic/models/account_payment_group.py | account_withholding_automatic/models/account_payment_group.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class Ac... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class Ac... | FIX withholdings computation when payment come from invoices | FIX withholdings computation when payment come from invoices
| Python | agpl-3.0 | ingadhoc/account-payment | ---
+++
@@ -30,7 +30,11 @@
for rec in self:
if rec.partner_type != 'supplier':
continue
- self.env['account.tax'].search([
+ # limpiamos el type por si se paga desde factura ya que el en ese
+ # caso viene in_invoice o out_invoice y en search de ... |
987d943a076b591309c06f67834dcb0012dd8491 | audio_train.py | audio_train.py | #%% Setup.
import numpy as np
import scipy.io.wavfile
from keras.utils.visualize_util import plot
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.utils import np_utils
from eva.models.wavenet import Wavenet, compute_receptive_field
from eva.util.mutil import sparse_labels
#%% Data
RATE, DATA = s... | #%% Setup.
import numpy as np
import scipy.io.wavfile
from keras.utils.visualize_util import plot
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.utils import np_utils
from eva.models.wavenet import Wavenet, compute_receptive_field
from eva.util.mutil import sparse_labels
#%% Data
RATE, DATA = s... | Fix OOM by reducing batch | Fix OOM by reducing batch
| Python | apache-2.0 | israelg99/eva | ---
+++
@@ -39,5 +39,5 @@
TRAIN = np_utils.to_categorical(DATA, BINS)
TRAIN = TRAIN[:TRAIN.shape[0]//LENGTH*LENGTH].reshape(TRAIN.shape[0]//LENGTH, LENGTH, BINS)
-M.fit(TRAIN, sparse_labels(TRAIN), nb_epoch=2000, batch_size=32,
+M.fit(TRAIN, sparse_labels(TRAIN), nb_epoch=2000, batch_size=8,
callbacks=[Ten... |
fdfe3c77e7b147f813b4cbb13b211f6ed8ff9057 | sublime_plugin_tests/launchers/init.py | sublime_plugin_tests/launchers/init.py | # Load in core dependencies
import code
import os
import sublime
# Set up constants
__dir__ = os.path.dirname(os.path.abspath(__file__))
def run():
# On every run, re-import the test class
# TODO: Determine if this is necessary
filepath = __dir__ + '/plugin_runner.py'
plugin_dict = {
'__dir__... | # Load in core dependencies
import code
import os
import sublime
# Set up constants
__dir__ = os.path.dirname(os.path.abspath(__file__))
def run():
# On every run, re-import the test class
# TODO: Determine if this is necessary
filepath = __dir__ + '/plugin_runner.py'
plugin_dict = {
'__dir__... | Increase the timeout to an absurd value | Increase the timeout to an absurd value
| Python | unlicense | twolfson/sublime-plugin-tests,twolfson/sublime-plugin-tests | ---
+++
@@ -33,4 +33,4 @@
# TODO: Set timeout loop that checks if `run` has set a global variable
# TODO: This thought was along side a plugin hook so we can guarantee most plugins are loaded
-sublime.set_timeout(run, 1000)
+sublime.set_timeout(run, 5000) |
ffa6417b30517569cadff00aec839d968f3c91d7 | bisnode/constants.py | bisnode/constants.py | COMPANY_STANDARD_REPORT = "NRGCompanyReportStandard"
COMPANY_RATING_REPORT = "NRGCompanyReportRating"
HIGH = 'AAA'
GOOD = 'AA'
WORTHY = 'A'
BELOW_AVERAGE = 'B'
BAD = 'C'
MISSING = '-'
RATING_CHOICES = (
(HIGH, "high"),
(GOOD, "good"),
(WORTHY, "worthy"),
(BELOW_AVERAGE, "below average"),
(BAD, "ba... | COMPANY_STANDARD_REPORT = "NRGCompanyReportStandard"
COMPANY_RATING_REPORT = "NRGCompanyReportRating"
HIGH = 'AAA'
GOOD = 'AA'
WORTHY = 'A'
NEW = 'AN'
BELOW_AVERAGE = 'B'
BAD = 'C'
MISSING = '-'
RATING_CHOICES = (
(HIGH, "high"),
(GOOD, "good"),
(WORTHY, "worthy"),
(NEW, "new"),
(BELOW_AVERAGE, "b... | Add a new rating code | Add a new rating code
| Python | mit | FundedByMe/django-bisnode | ---
+++
@@ -4,6 +4,7 @@
HIGH = 'AAA'
GOOD = 'AA'
WORTHY = 'A'
+NEW = 'AN'
BELOW_AVERAGE = 'B'
BAD = 'C'
MISSING = '-'
@@ -12,6 +13,7 @@
(HIGH, "high"),
(GOOD, "good"),
(WORTHY, "worthy"),
+ (NEW, "new"),
(BELOW_AVERAGE, "below average"),
(BAD, "bad"),
(MISSING, "missing"), |
73b1273de8f8e17adf51893bdbd24d2067866297 | bootstrap/helpers.py | bootstrap/helpers.py | # -*- coding: utf-8 -*-
"""
bootstrap.helpers
~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.orga.models import OrgaFlag
from byceps.services.user.models.user import User
from byceps.services.user import service as user_service
... | # -*- coding: utf-8 -*-
"""
bootstrap.helpers
~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.user.models.user import User
from byceps.services.user import service as user_service
from .util import add_to_database
# -----------... | Remove bootstrap helper to promote a user to organizer as there is a service function (and a script calling it) for that | Remove bootstrap helper to promote a user to organizer as there is a service function (and a script calling it) for that
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | ---
+++
@@ -8,7 +8,6 @@
:License: Modified BSD, see LICENSE for details.
"""
-from byceps.services.orga.models import OrgaFlag
from byceps.services.user.models.user import User
from byceps.services.user import service as user_service
@@ -32,12 +31,3 @@
def get_user(screen_name):
return User.query.filt... |
a1e56d65807228b952036fc182071aab5e6ff25f | tests/cli/test_pixel.py | tests/cli/test_pixel.py | """ Test ``yatsm line``
"""
import os
from click.testing import CliRunner
import matplotlib as mpl
import pytest
from yatsm.cli.main import cli
mpl_skip = pytest.mark.skipif(
mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ,
reason='Requires either matplotlib "agg" backend or that DISPLAY" is set')... | """ Test ``yatsm line``
"""
import os
from click.testing import CliRunner
import matplotlib as mpl
import pytest
from yatsm.cli.main import cli
mpl_skip = pytest.mark.skipif(
mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ,
reason='Requires either matplotlib "agg" backend or that DISPLAY" is set')... | Add test for all plot types | Add test for all plot types
| Python | mit | valpasq/yatsm,c11/yatsm,ceholden/yatsm,ceholden/yatsm,c11/yatsm,valpasq/yatsm | ---
+++
@@ -27,3 +27,19 @@
example_timeseries['config'], '1', '1'
])
assert result.exit_code == 0
+
+
+@mpl_skip
+def test_cli_pixel_pass_2(example_timeseries):
+ """ Correctly run for one pixel for 3 plots
+ """
+ runner = CliRunner()
+ result = runner.invoke(
+ cli,
+ ... |
1441a4e96ee610cbb6c87a9e04491102a29c0032 | importlib_metadata/tests/test_main.py | importlib_metadata/tests/test_main.py | import unittest
import re
import importlib
import importlib_metadata
class BasicTests(unittest.TestCase):
version_pattern = r'\d+\.\d+(\.\d)?'
def test_retrieves_version_of_self(self):
dist = importlib_metadata.Distribution.for_module(importlib_metadata)
assert isinstance(dist.version, str)
... | import unittest
import re
import importlib
import importlib_metadata
class BasicTests(unittest.TestCase):
version_pattern = r'\d+\.\d+(\.\d)?'
def test_retrieves_version_of_self(self):
dist = importlib_metadata.Distribution.from_module(importlib_metadata)
assert isinstance(dist.version, str)... | Fix test failures after method renames | Fix test failures after method renames
| Python | apache-2.0 | python/importlib_metadata | ---
+++
@@ -9,7 +9,7 @@
version_pattern = r'\d+\.\d+(\.\d)?'
def test_retrieves_version_of_self(self):
- dist = importlib_metadata.Distribution.for_module(importlib_metadata)
+ dist = importlib_metadata.Distribution.from_module(importlib_metadata)
assert isinstance(dist.version, str... |
4107fe1240598f64335bf3203c717f4ef00f9e0f | settings/travis.py | settings/travis.py | from defaults import *
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'ENGINE': 'django.contrib.gis.db.backends.postgis',
'ENGINE': 'django.db.backends.sqlite3',
#'NAME': 'atlas_test',
#'USER': 'postgres',
'PASSWORD': '',
'HO... | from defaults import *
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.postgresql_psycopg2',
'ENGINE': 'django.contrib.gis.db.backends.postgis',
# 'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'atlas_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST... | Switch to postgis for Travis | Switch to postgis for Travis
At least until I have time to figure out the spatialite automatic build.
| Python | mit | denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase | ---
+++
@@ -3,10 +3,10 @@
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.postgresql_psycopg2',
-# 'ENGINE': 'django.contrib.gis.db.backends.postgis',
- 'ENGINE': 'django.db.backends.sqlite3',
- #'NAME': 'atlas_test',
- #'USER': 'postgres',
+ 'ENGINE': 'djan... |
e0fa24595a60dd3c2ab5d1b64a76bae9ce3c05a8 | testproject/testapp/tests/test_root.py | testproject/testapp/tests/test_root.py | from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.RootView
def test_get_should_retur... | from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.RootView
def test_get_should_retur... | Add test for non existent url pattern | Add test for non existent url pattern
| Python | mit | akalipetis/djoser,sunscrapers/djoser,akalipetis/djoser,sunscrapers/djoser,sunscrapers/djoser | ---
+++
@@ -28,3 +28,11 @@
urlpattern_names = view_object.aggregate_djoser_urlpattern_names()
for urlpattern_name in urlpattern_names:
self.assertIn(urlpattern_name, response.data)
+
+ def test_non_existent_urlpattern_results_in_empty_string(self):
+ request = self.factory.get... |
8f24d774227dca13500c0db0c10771d6b4ee7141 | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
import csv
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
def handle(self, *args, **options):
with open('domain_results.csv', 'wb+') as csvfile:
... | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
import csv
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
def check_domain(self, domain, csv_writer):
if domain.secure_submissions:
for app in do... | Add audio/video support and bail on findings | Add audio/video support and bail on findings
| Python | bsd-3-clause | qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttar... | ---
+++
@@ -5,6 +5,20 @@
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
+
+ def check_domain(self, domain, csv_writer):
+ if domain.secure_submissions:
+ for app in domain.full_applications(include_builds=False):
+ for module i... |
194a84b4559449f0b0e3e9cc9e7026392822c0af | questions/urls.py | questions/urls.py | from django.conf.urls.defaults import *
from spenglr.education.models import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', { 'queryset': Module.... | from django.conf.urls.defaults import *
from spenglr.education.models import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', { 'queryset': Module.... | Change to questions template location. | Change to questions template location.
| Python | bsd-3-clause | mfitzp/smrtr,mfitzp/smrtr | ---
+++
@@ -8,6 +8,6 @@
urlpatterns = patterns('',
- (r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', { 'queryset': Module.objects.all(), 'template_name': 'education/module_questions.html' } ),
+ (r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', {... |
b9389a54183e37d8b0d17f74c4655dfb51bf2053 | neo/test/rawiotest/test_openephysbinaryrawio.py | neo/test/rawiotest/test_openephysbinaryrawio.py | import unittest
from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO
from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase):
rawioclass = OpenEphysBinaryRawIO
entities_to_download = [
'openephysbinary'
]
entit... | import unittest
from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO
from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase):
rawioclass = OpenEphysBinaryRawIO
entities_to_download = [
'openephysbinary'
]
entit... | Add new OE test folder | Add new OE test folder
| Python | bsd-3-clause | NeuralEnsemble/python-neo,INM-6/python-neo,JuliaSprenger/python-neo,apdavison/python-neo | ---
+++
@@ -13,6 +13,7 @@
'openephysbinary/v0.5.3_two_neuropixels_stream',
'openephysbinary/v0.4.4.1_with_video_tracking',
'openephysbinary/v0.5.x_two_nodes',
+ 'openephysbinary/v0.6.x_neuropixels_multiexp_multistream',
]
|
9f8db061956fc73a197d9c5eb1b045a6e0655dc0 | fc2json.py | fc2json.py | #!/usr/bin/env python
import sys, json
file = sys.argv[1]
subject = file.split('.')[0]
data = {
"subject": subject,
"cards": {}
}
fc = [line.split(':') for line in open(file, 'r').read().splitlines()]
js = open(subject + ".json", 'w')
for line in fc:
data["cards"][line[0]] = line[1]
js.write(json.dum... | #!/usr/bin/env python
'''
File: fc2json.py
Author: Kristoffer Dalby
Description: Tiny script for converting flashcard format to json.
'''
import sys, json
file = sys.argv[1]
subject = file.split('.')[0]
data = {
"subject": subject,
"cards": {}
}
fc = [line.split(':') for line in open(file, 'r').read().spli... | Use a real JS construct, WTF knows why this works in chromium. | Use a real JS construct, WTF knows why this works in chromium.
| Python | mit | kradalby/flashcards,kradalby/flashcards | ---
+++
@@ -1,4 +1,9 @@
#!/usr/bin/env python
+'''
+File: fc2json.py
+Author: Kristoffer Dalby
+Description: Tiny script for converting flashcard format to json.
+'''
import sys, json
|
9d78b571fcd0575e02d4849a0938a51f15e07961 | multi_schema/management/__init__.py | multi_schema/management/__init__.py | from django.db import models, connection
from django.core.management.color import no_style
from multi_schema.models import Schema
def post_syncdb_duplicator(sender, **kwargs):
# See if any of the newly created models are schema-aware
schema_aware_models = [m for m in kwargs['created_models'] if m._is_schema_a... | from django.db import models, connection
from django.core.management.color import no_style
from multi_schema.models import Schema
def post_syncdb_duplicator(sender, **kwargs):
# See if any of the newly created models are schema-aware
schema_aware_models = [m for m in kwargs['created_models'] if m._is_schema_a... | Create the correct references to other tables in all schemata. | Create the correct references to other tables in all schemata.
| Python | bsd-3-clause | schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse | ---
+++
@@ -7,16 +7,27 @@
# See if any of the newly created models are schema-aware
schema_aware_models = [m for m in kwargs['created_models'] if m._is_schema_aware and kwargs['app'].__name__ == m.__module__]
if schema_aware_models:
- import pdb; pdb.set_trace()
for schema in Schema.obj... |
533194b5b8e044bca2aaeccff4d550731922b3b8 | genome_designer/conf/demo_settings.py | genome_designer/conf/demo_settings.py | """
Settings for DEMO_MODE.
Must set DEMO_MODE = True in local_settings.py.
"""
# Views that are visible in demo mode.
DEMO_SAFE_VIEWS = [
'main.views.home_view',
'main.views.project_list_view',
'main.views.project_view',
'main.views.tab_root_analyze',
'main.views.reference_genome_list_view',
... | """
Settings for DEMO_MODE.
Must set DEMO_MODE = True in local_settings.py.
"""
# Views that are visible in demo mode.
DEMO_SAFE_VIEWS = [
'main.views.home_view',
'main.views.project_list_view',
'main.views.project_view',
'main.views.tab_root_analyze',
'main.views.reference_genome_list_view',
... | Add login and logout to allowed views in DEMO_MODE. | Add login and logout to allowed views in DEMO_MODE.
| Python | mit | woodymit/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone_accidental_source | ---
+++
@@ -27,4 +27,6 @@
'main.xhr_handlers.get_ref_genomes',
'main.xhr_handlers.compile_jbrowse_and_redirect',
'main.template_xhrs.variant_filter_controls',
+ 'main.demo_view_overrides.login_demo_account',
+ 'django.contrib.auth.views.logout'
] |
6282aa2617bcc9bb8f293ea620eff23d2009334b | example/test.py | example/test.py |
import rust_ext
import numpy as np
a = np.array([1.0, 2.0])
rust_ext.mult(3, a)
print(a)
| #!/usr/bin/env python
import rust_ext
import numpy as np
x = np.array([1.0, 2.0])
y = np.array([2.0, 3.0])
result = rust_ext.axpy(3, x, y)
print(result)
| Use axpy on sample Python script | Use axpy on sample Python script
| Python | bsd-2-clause | termoshtt/rust-numpy,termoshtt/rust-numpy | ---
+++
@@ -1,7 +1,9 @@
+#!/usr/bin/env python
import rust_ext
import numpy as np
-a = np.array([1.0, 2.0])
-rust_ext.mult(3, a)
-print(a)
+x = np.array([1.0, 2.0])
+y = np.array([2.0, 3.0])
+result = rust_ext.axpy(3, x, y)
+print(result) |
f894aff53577fb459bfac1802f3880133e4143cf | build/build.py | build/build.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import shutil
import util
class Make:
def doBuild(self, dir):
os.system("cd %s; make" % dir)
class MakeInstall:
def doInstall(self, dir, root):
os.system("cd %s; make %s=%s install" % (dir, self.rootVar, root))
def __init__(self,... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import shutil
import util
class ManualConfigure:
def doBuild(self, dir):
os.system("cd %s; ./configure %s" % (dir, self.extraflags))
def __init__(self, extraflags=""):
self.extraflags = extraflags
class Configure:
def doBu... | Add classes to run ./configure | Add classes to run ./configure
| Python | apache-2.0 | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | ---
+++
@@ -5,6 +5,22 @@
import os
import shutil
import util
+
+class ManualConfigure:
+
+ def doBuild(self, dir):
+ os.system("cd %s; ./configure %s" % (dir, self.extraflags))
+
+ def __init__(self, extraflags=""):
+ self.extraflags = extraflags
+
+class Configure:
+
+ def doBuild(self, dir):
+ os... |
cf3596ee93eabf425c7d42c15fc07b11f7741158 | humblemedia/causes/models.py | humblemedia/causes/models.py | from django.db import models
class Cause(models.Model):
title = models.CharField(max_length=64)
description = models.TextField()
creator = models.ForeignKey('auth.User', related_name='causes')
target = models.PositiveIntegerField(null=True, blank=True)
url = models.URLField(null=True, blank=True)
... | from django.db import models
class Cause(models.Model):
title = models.CharField(max_length=64)
description = models.TextField()
creator = models.ForeignKey('auth.User', related_name='causes')
organization = models.ForeignKey('organizations.Organization', related_name='causes', null=True, blank=True)
... | Add organization to cause model | Add organization to cause model
| Python | mit | vladimiroff/humble-media,vladimiroff/humble-media | ---
+++
@@ -5,6 +5,7 @@
title = models.CharField(max_length=64)
description = models.TextField()
creator = models.ForeignKey('auth.User', related_name='causes')
+ organization = models.ForeignKey('organizations.Organization', related_name='causes', null=True, blank=True)
target = models.Positiv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.