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
b3889bbdab80fb502c74b99b61cf36bae112ce2c
node/node.py
node/node.py
from configparser import ConfigParser from driver import BTRFSDriver class Node: """ # Dummy config example [bk1-z3.presslabs.net] ssd = True """ def __init__(self, context): self._conf_path = context['node']['conf_path'] self._driver = BTRFSDriver(context['volume_path']) self._name, self._labels = '', {} config = ConfigParser() config.read(self._conf_path) try: self._name = config.sections()[0] for label, value in config[self._name].iteritems(): self._labels[label] = value except IndexError: pass def get_subvolumes(self): return self._driver.get_all() def name(self): return self._name def labels(self): return self._labels
from configparser import ConfigParser from driver import BTRFSDriver class Node: """ # Dummy config example [bk1-z3.presslabs.net] ssd = True """ def __init__(self, context): self._conf_path = context['node']['conf_path'] self._driver = BTRFSDriver(context['volume_path']) self._name, self._labels = '', {} config = ConfigParser() config.read(self._conf_path) try: self._name = config.sections()[0] for label, value in config[self._name].iteritems(): self._labels[label] = value except IndexError: pass def get_subvolumes(self): return self._driver.get_all() @property def name(self): return self._name @property def labels(self): return self._labels
Add property decorator to getters
Add property decorator to getters
Python
apache-2.0
PressLabs/cobalt,PressLabs/cobalt
--- +++ @@ -26,9 +26,11 @@ def get_subvolumes(self): return self._driver.get_all() + @property def name(self): return self._name + @property def labels(self): return self._labels
493637ace6881defedee22971f3bc39fe9a5bd0a
freesas/test/__init__.py
freesas/test/__init__.py
#!usr/bin/env python # coding: utf-8 __author__ = "Jérôme Kieffer" __license__ = "MIT" __date__ = "05/09/2017" __copyright__ = "2015, ESRF" import unittest from .test_all import suite def run(): runner = unittest.TextTestRunner() return runner.run(suite()) if __name__ == '__main__': run()
#!usr/bin/env python # coding: utf-8 __author__ = "Jérôme Kieffer" __license__ = "MIT" __date__ = "15/01/2021" __copyright__ = "2015-2021, ESRF" import sys import unittest from .test_all import suite def run_tests(): """Run test complete test_suite""" mysuite = suite() runner = unittest.TextTestRunner() if not runner.run(mysuite).wasSuccessful(): print("Test suite failed") return 1 else: print("Test suite succeeded") return 0 run = run_tests if __name__ == '__main__': sys.exit(run_tests())
Make it compatible with Bob
Make it compatible with Bob
Python
mit
kif/freesas,kif/freesas,kif/freesas
--- +++ @@ -3,17 +3,27 @@ __author__ = "Jérôme Kieffer" __license__ = "MIT" -__date__ = "05/09/2017" -__copyright__ = "2015, ESRF" +__date__ = "15/01/2021" +__copyright__ = "2015-2021, ESRF" +import sys import unittest from .test_all import suite -def run(): +def run_tests(): + """Run test complete test_suite""" + mysuite = suite() runner = unittest.TextTestRunner() - return runner.run(suite()) + if not runner.run(mysuite).wasSuccessful(): + print("Test suite failed") + return 1 + else: + print("Test suite succeeded") + return 0 +run = run_tests + if __name__ == '__main__': - run() + sys.exit(run_tests())
ef03541b2b25ab9cf34deec554a19a32dad7fbec
tools/python/odin_data/meta_writer/__init__.py
tools/python/odin_data/meta_writer/__init__.py
from pkg_resources import require require('pygelf==0.3.1') require("h5py==2.8.0") require('pyzmq==16.0.2')
from pkg_resources import require require('pygelf==0.3.1') require("h5py==2.8.0") require('pyzmq==16.0.2')
Add new line to end of init file for Meta Writer application
Add new line to end of init file for Meta Writer application
Python
apache-2.0
percival-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,percival-detector/odin-data
eaae2a1e88572e224621e242be1d15e92065f15e
mopidy_nad/__init__.py
mopidy_nad/__init__.py
from __future__ import unicode_literals import os import pygst pygst.require('0.10') import gst import gobject from mopidy import config, ext __version__ = '1.0.0' class Extension(ext.Extension): dist_name = 'Mopidy-NAD' ext_name = 'nad' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') return config.read(conf_file) def register_gstreamer_elements(self): from .mixer import NadMixer gobject.type_register(NadMixer) gst.element_register(NadMixer, 'nadmixer', gst.RANK_MARGINAL)
from __future__ import unicode_literals import os import pygst pygst.require('0.10') import gst import gobject from mopidy import config, ext __version__ = '1.0.0' class Extension(ext.Extension): dist_name = 'Mopidy-NAD' ext_name = 'nad' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') return config.read(conf_file) def setup(self, registry): from .mixer import NadMixer gobject.type_register(NadMixer) gst.element_register(NadMixer, 'nadmixer', gst.RANK_MARGINAL)
Use new extension setup() API
Use new extension setup() API
Python
apache-2.0
ZenithDK/mopidy-primare,mopidy/mopidy-nad
--- +++ @@ -22,7 +22,7 @@ conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') return config.read(conf_file) - def register_gstreamer_elements(self): + def setup(self, registry): from .mixer import NadMixer gobject.type_register(NadMixer) gst.element_register(NadMixer, 'nadmixer', gst.RANK_MARGINAL)
42f74f304d0ac404f17d6489033b6140816cb194
fireplace/cards/gvg/neutral_common.py
fireplace/cards/gvg/neutral_common.py
from ..utils import * ## # Minions # Explosive Sheep class GVG_076: def deathrattle(self): for target in self.game.board: self.hit(target, 2) # Clockwork Gnome class GVG_082: deathrattle = giveSparePart # Micro Machine class GVG_103: def TURN_BEGIN(self, player): # That card ID is not a mistake self.buff(self, "GVG_076a") # Pistons class GVG_076a: Atk = 1
from ..utils import * ## # Minions # Stonesplinter Trogg class GVG_067: def CARD_PLAYED(self, player, card): if player is not self.controller and card.type == CardType.SPELL: self.buff("GVG_067a") class GVG_067a: Atk = 1 # Burly Rockjaw Trogg class GVG_068: def CARD_PLAYED(self, player, card): if player is not self.controller and card.type == CardType.SPELL: self.buff("GVG_068a") class GVG_068a: Atk = 2 # Ship's Cannon class GVG_075: def OWN_MINION_SUMMONED(self, minion): if minion.race == Race.PIRATE: targets = self.controller.getTargets(TARGET_ENEMY_CHARACTERS) self.hit(random.choice(targets), 2) # Explosive Sheep class GVG_076: def deathrattle(self): for target in self.game.board: self.hit(target, 2) # Clockwork Gnome class GVG_082: deathrattle = giveSparePart # Micro Machine class GVG_103: def TURN_BEGIN(self, player): # That card ID is not a mistake self.buff(self, "GVG_076a") # Pistons class GVG_076a: Atk = 1
Implement Stonesplinter Trogg, Burly Rockjaw Trogg, Ship's Cannon
Implement Stonesplinter Trogg, Burly Rockjaw Trogg, Ship's Cannon
Python
agpl-3.0
Ragowit/fireplace,NightKev/fireplace,jleclanche/fireplace,smallnamespace/fireplace,smallnamespace/fireplace,amw2104/fireplace,beheh/fireplace,Meerkov/fireplace,amw2104/fireplace,oftc-ftw/fireplace,butozerca/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Meerkov/fireplace,butozerca/fireplace,Ragowit/fireplace,liujimj/fireplace
--- +++ @@ -3,6 +3,34 @@ ## # Minions + +# Stonesplinter Trogg +class GVG_067: + def CARD_PLAYED(self, player, card): + if player is not self.controller and card.type == CardType.SPELL: + self.buff("GVG_067a") + +class GVG_067a: + Atk = 1 + + +# Burly Rockjaw Trogg +class GVG_068: + def CARD_PLAYED(self, player, card): + if player is not self.controller and card.type == CardType.SPELL: + self.buff("GVG_068a") + +class GVG_068a: + Atk = 2 + + +# Ship's Cannon +class GVG_075: + def OWN_MINION_SUMMONED(self, minion): + if minion.race == Race.PIRATE: + targets = self.controller.getTargets(TARGET_ENEMY_CHARACTERS) + self.hit(random.choice(targets), 2) + # Explosive Sheep class GVG_076:
7d1463fc732cdc6aef3299c6d2bbe916418e6d6e
hkisaml/api.py
hkisaml/api.py
from django.contrib.auth.models import User from rest_framework import permissions, routers, serializers, generics, mixins from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope class UserSerializer(serializers.ModelSerializer): def to_representation(self, obj): ret = super(UserSerializer, self).to_representation(obj) if hasattr(obj, 'profile'): ret['department_name'] = obj.profile.department_name return ret class Meta: fields = [ 'last_login', 'username', 'email', 'date_joined', 'first_name', 'last_name' ] model = User # ViewSets define the view behavior. class UserView(generics.RetrieveAPIView, mixins.RetrieveModelMixin): def get_queryset(self): user = self.request.user if user.is_superuser: return self.queryset else: return self.queryset.filter(id=user.id) def get_object(self): username = self.kwargs.get('username', None) if username: qs = self.get_queryset() obj = generics.get_object_or_404(qs, username=username) else: obj = self.request.user return obj permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope] queryset = User.objects.all() serializer_class = UserSerializer #router = routers.DefaultRouter() #router.register(r'users', UserViewSet)
from django.contrib.auth.models import User from rest_framework import permissions, serializers, generics, mixins from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope class UserSerializer(serializers.ModelSerializer): def to_representation(self, obj): ret = super(UserSerializer, self).to_representation(obj) if hasattr(obj, 'profile'): ret['department_name'] = obj.profile.department_name if obj.first_name and obj.last_name: ret['full_name'] = '%s %s' % (obj.first_name, obj.last_name) return ret class Meta: fields = [ 'last_login', 'username', 'email', 'date_joined', 'first_name', 'last_name' ] model = User # ViewSets define the view behavior. class UserView(generics.RetrieveAPIView, mixins.RetrieveModelMixin): def get_queryset(self): user = self.request.user if user.is_superuser: return self.queryset else: return self.queryset.filter(id=user.id) def get_object(self): username = self.kwargs.get('username', None) if username: qs = self.get_queryset() obj = generics.get_object_or_404(qs, username=username) else: obj = self.request.user return obj permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope] queryset = User.objects.all() serializer_class = UserSerializer #router = routers.DefaultRouter() #router.register(r'users', UserViewSet)
Add full_name field to API
Add full_name field to API
Python
mit
mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo
--- +++ @@ -1,5 +1,5 @@ from django.contrib.auth.models import User -from rest_framework import permissions, routers, serializers, generics, mixins +from rest_framework import permissions, serializers, generics, mixins from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope @@ -8,6 +8,8 @@ ret = super(UserSerializer, self).to_representation(obj) if hasattr(obj, 'profile'): ret['department_name'] = obj.profile.department_name + if obj.first_name and obj.last_name: + ret['full_name'] = '%s %s' % (obj.first_name, obj.last_name) return ret class Meta:
15f22d7c0ac9ddce6cb14cb0cbb35c4d630605d2
api/ud_helper.py
api/ud_helper.py
import re from ufal.udpipe import Model, Pipeline, ProcessingError class Parser: MODELS = { "swe": "data/swedish-ud-2.0-170801.udpipe", } def __init__(self, language): model_path = self.MODELS.get(language, None) if not model_path: raise ParserException("Cannot find model for language '%s'" % language) model = Model.load(model_path) if not model: raise ParserException("Cannot load model from file '%s'\n" % model_path) self.model = model def parse(self, text): text = text.strip() last_character = text.strip()[-1] if re.match(r"\w", last_character, flags=re.UNICODE): text += "." pipeline = Pipeline( self.model, "tokenize", Pipeline.DEFAULT, Pipeline.DEFAULT, "conllu" ) error = ProcessingError() processed = pipeline.process(text, error) if error.occurred(): raise ParserException(error.message) return processed class ParserException(Exception): pass
import re from ufal.udpipe import Model, Pipeline, ProcessingError class Parser: MODELS = { "swe": "data/swedish-ud-2.0-170801.udpipe", } def __init__(self, language): model_path = self.MODELS.get(language, None) if not model_path: raise ParserException("Cannot find model for language '%s'" % language) model = Model.load(model_path) if not model: raise ParserException("Cannot load model from file '%s'\n" % model_path) self.model = model def parse(self, text): text = text.strip() # Adding a period improves detection on especially short sentences period_added = False last_character = text.strip()[-1] if re.match(r"\w", last_character, flags=re.UNICODE): text += "." period_added = True pipeline = Pipeline( self.model, "tokenize", Pipeline.DEFAULT, Pipeline.DEFAULT, "conllu" ) error = ProcessingError() processed = pipeline.process(text, error) if error.occurred(): raise ParserException(error.message) # Remove the period to make sure input corresponds to output if period_added: processed = "\n".join(processed.rstrip().split("\n")[:-1]) + "\n\n" return processed class ParserException(Exception): pass
Remove period so input corresponds to output.
Remove period so input corresponds to output. Former-commit-id: ec6debb1637304407715441ae8319787fe7f0945
Python
mit
EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger
--- +++ @@ -20,9 +20,12 @@ def parse(self, text): text = text.strip() + # Adding a period improves detection on especially short sentences + period_added = False last_character = text.strip()[-1] if re.match(r"\w", last_character, flags=re.UNICODE): text += "." + period_added = True pipeline = Pipeline( self.model, @@ -37,6 +40,10 @@ if error.occurred(): raise ParserException(error.message) + # Remove the period to make sure input corresponds to output + if period_added: + processed = "\n".join(processed.rstrip().split("\n")[:-1]) + "\n\n" + return processed class ParserException(Exception):
f5de027e14e50ff5085ac1765bdfd2ee7646cabb
extras/sublime_mdown.py
extras/sublime_mdown.py
import sublime import sublime_plugin from os.path import basename, dirname import subprocess def parse_file_name(file_name): if file_name is None: title = "Untitled" basepath = None else: title = basename(file_name) basepath = dirname(file_name) return title, basepath class MdownPreviewCommand(sublime_plugin.TextCommand): def run(self, edit): title, basepath = parse_file_name(self.view.file_name()) self.convert(title, basepath) def convert(self, title, basepath): binary = sublime.load_settings("mdown.sublime-settings").get("binary", None) if binary is not None: cmd = [binary, "-t", title, "-s", "-p"] if basepath is not None: cmd += ["-b", basepath] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for line in self.view.lines(sublime.Region(0, self.view.size())): p.stdin.write((self.view.substr(line) + '\n').encode('utf-8')) print(p.communicate()[0].decode("utf-8"))
import sublime import sublime_plugin from os.path import basename, dirname import subprocess def parse_file_name(file_name): if file_name is None: title = "Untitled" basepath = None else: title = basename(file_name) basepath = dirname(file_name) return title, basepath class MdownPreviewCommand(sublime_plugin.TextCommand): def run(self, edit): title, basepath = parse_file_name(self.view.file_name()) self.convert(title, basepath) def convert(self, title, basepath): binary = sublime.load_settings("mdown.sublime-settings").get("binary", None) if binary is not None: cmd = [binary, "-T", title, "-s", "-p"] if basepath is not None: cmd += ["-b", basepath] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for line in self.view.lines(sublime.Region(0, self.view.size())): p.stdin.write((self.view.substr(line) + '\n').encode('utf-8')) print(p.communicate()[0].decode("utf-8"))
Adjust extras sublime plugin to follow new changes
Adjust extras sublime plugin to follow new changes
Python
mit
facelessuser/PyMdown,facelessuser/PyMdown,facelessuser/PyMdown
--- +++ @@ -23,7 +23,7 @@ binary = sublime.load_settings("mdown.sublime-settings").get("binary", None) if binary is not None: - cmd = [binary, "-t", title, "-s", "-p"] + cmd = [binary, "-T", title, "-s", "-p"] if basepath is not None: cmd += ["-b", basepath]
ba5edd102ddd53f2e95da8b673bf14bdd72dc012
pw_cli/py/pw_cli/argument_types.py
pw_cli/py/pw_cli/argument_types.py
# Copyright 2021 The Pigweed Authors # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. """Defines argument types for use with argparse.""" import argparse import logging from pathlib import Path def directory(arg: str) -> Path: path = Path(arg) if path.is_dir(): return path.resolve() raise argparse.ArgumentTypeError(f'{path} is not a directory') def log_level(arg: str) -> int: try: return getattr(logging, arg.upper()) except AttributeError: raise argparse.ArgumentTypeError( f'{arg.upper()} is not a valid log level')
# Copyright 2021 The Pigweed Authors # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. """Defines argument types for use with argparse.""" import argparse import logging from pathlib import Path def directory(arg: str) -> Path: path = Path(arg) if path.is_dir(): return path.resolve() raise argparse.ArgumentTypeError(f'"{path}" is not a directory') def log_level(arg: str) -> int: try: return getattr(logging, arg.upper()) except AttributeError: raise argparse.ArgumentTypeError( f'"{arg.upper()}" is not a valid log level')
Add quotes around user-provided values
pw_cli: Add quotes around user-provided values Change-Id: Ifc5fafeefef0dea65cb3aba90b985e6be31fa0bd Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/81980 Reviewed-by: Joe Ethier <f5eb8cb2f5310c7fa9df6f16eabccb4436f47999@google.com> Commit-Queue: RJ Ascani <4734195edb8e393f72741de86b813743e1460cb1@google.com>
Python
apache-2.0
google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed
--- +++ @@ -23,7 +23,7 @@ if path.is_dir(): return path.resolve() - raise argparse.ArgumentTypeError(f'{path} is not a directory') + raise argparse.ArgumentTypeError(f'"{path}" is not a directory') def log_level(arg: str) -> int: @@ -31,4 +31,4 @@ return getattr(logging, arg.upper()) except AttributeError: raise argparse.ArgumentTypeError( - f'{arg.upper()} is not a valid log level') + f'"{arg.upper()}" is not a valid log level')
9783844b1597598fad833794b4b291fce49438d4
app/hr/tasks.py
app/hr/tasks.py
from django.conf import settings import logging from datetime import datetime, timedelta from celery.decorators import task from hr.utils import blacklist_values from django.contrib.auth.models import User from django.core.mail import send_mail @task(ignore_result=True) def blacklist_check(): log = blacklist_check.get_logger() users = User.objects.filter(is_active=True) for u in users: if u.groups.count() > 0: # Has groups val = blacklist_values(u) if len(val) > 0: # Report possible issue log.warning("Suspect User: %s, %s entries found: %s" % (u.username, len(val), val)) blstr = "" for i in val: blstr = "%s%s - %s - %s\n" % (blstr, i.get_type_display(), i.value, i.reason) msg = "Suspect User found: %s\nGroups: %s\nBlacklist Items:\n\n%s" % (u.username, ", ".join(u.groups.all().values_list('name', flat=True)), blstr) send_mail('Automated blacklist checker alert - %s' % u.username, msg, 'blacklist@pleaseignore.com', ['abuse@pleaseignore.com'])
from django.conf import settings import logging from datetime import datetime, timedelta from celery.decorators import task from hr.utils import blacklist_values from django.contrib.auth.models import User from django.core.mail import send_mail @task(ignore_result=True) def blacklist_check(): log = blacklist_check.get_logger() users = User.objects.filter(is_active=True) alerts = 0 msg = "" for u in users: if u.groups.count() > 0: # Has groups val = blacklist_values(u) if len(val) > 0: alerts += 1 # Report possible issue log.warning("Suspect User: %s, %s entries found: %s" % (u.username, len(val), val)) blstr = "" for i in val: blstr = "%s%s - %s - %s\n" % (blstr, i.get_type_display(), i.value, i.reason) msg += "\n\n-----\n\n" msg += "Suspect User found: %s\nGroups: %s\nBlacklist Items:\n\n%s" % (u.username, ", ".join(u.groups.all().values_list('name', flat=True)), blstr) if alerts: send_mail('Automated blacklist checker alerts', msg, 'blacklist@pleaseignore.com', ['abuse@pleaseignore.com'])
Send alerts as one mail
Send alerts as one mail
Python
bsd-3-clause
nikdoof/test-auth
--- +++ @@ -12,16 +12,24 @@ users = User.objects.filter(is_active=True) + alerts = 0 + msg = "" + for u in users: if u.groups.count() > 0: # Has groups val = blacklist_values(u) if len(val) > 0: + alerts += 1 # Report possible issue log.warning("Suspect User: %s, %s entries found: %s" % (u.username, len(val), val)) blstr = "" for i in val: blstr = "%s%s - %s - %s\n" % (blstr, i.get_type_display(), i.value, i.reason) - msg = "Suspect User found: %s\nGroups: %s\nBlacklist Items:\n\n%s" % (u.username, ", ".join(u.groups.all().values_list('name', flat=True)), blstr) - send_mail('Automated blacklist checker alert - %s' % u.username, msg, 'blacklist@pleaseignore.com', ['abuse@pleaseignore.com']) + + msg += "\n\n-----\n\n" + msg += "Suspect User found: %s\nGroups: %s\nBlacklist Items:\n\n%s" % (u.username, ", ".join(u.groups.all().values_list('name', flat=True)), blstr) + + if alerts: + send_mail('Automated blacklist checker alerts', msg, 'blacklist@pleaseignore.com', ['abuse@pleaseignore.com'])
7fb89e4dbe2cbed4ef37e13073d4fa3f2a650049
InvenTree/part/apps.py
InvenTree/part/apps.py
from __future__ import unicode_literals from django.apps import AppConfig class PartConfig(AppConfig): name = 'part'
from __future__ import unicode_literals import os from django.db.utils import OperationalError, ProgrammingError from django.apps import AppConfig from django.conf import settings class PartConfig(AppConfig): name = 'part' def ready(self): """ This function is called whenever the Part app is loaded. """ self.generate_part_thumbnails() def generate_part_thumbnails(self): from .models import Part print("Checking Part image thumbnails") try: for part in Part.objects.all(): if part.image: url = part.image.thumbnail.name #if url.startswith('/'): # url = url[1:] loc = os.path.join(settings.MEDIA_ROOT, url) if not os.path.exists(loc): print("InvenTree: Generating thumbnail for Part '{p}'".format(p=part.name)) part.image.render_variations(replace=False) except (OperationalError, ProgrammingError): print("Could not generate Part thumbnails")
Check for missing part thumbnails when the server first runs
Check for missing part thumbnails when the server first runs
Python
mit
inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree
--- +++ @@ -1,7 +1,36 @@ from __future__ import unicode_literals +import os + +from django.db.utils import OperationalError, ProgrammingError from django.apps import AppConfig +from django.conf import settings class PartConfig(AppConfig): name = 'part' + + def ready(self): + """ + This function is called whenever the Part app is loaded. + """ + + self.generate_part_thumbnails() + + def generate_part_thumbnails(self): + from .models import Part + + print("Checking Part image thumbnails") + + try: + for part in Part.objects.all(): + if part.image: + url = part.image.thumbnail.name + #if url.startswith('/'): + # url = url[1:] + loc = os.path.join(settings.MEDIA_ROOT, url) + if not os.path.exists(loc): + print("InvenTree: Generating thumbnail for Part '{p}'".format(p=part.name)) + part.image.render_variations(replace=False) + except (OperationalError, ProgrammingError): + print("Could not generate Part thumbnails")
e6e0d96790d71caccb3f00487bfeeddccdc78139
app/raw/tasks.py
app/raw/tasks.py
from __future__ import absolute_import from celery import shared_task from twisted.internet import reactor from scrapy.crawler import Crawler from scrapy import log, signals from scrapy.utils.project import get_project_settings import os from raw.scraper.spiders.legco_library import LibraryAgendaSpider from raw.scraper.spiders.members import LibraryMemberSpider @shared_task def run_scraper(): output_name = 'foo.jl' spider = LibraryAgendaSpider() settings = get_project_settings() url_path = os.path.join(settings.get('DATA_DIR_BASE'), 'scrapes', output_name) settings.overrides['FEED_URI'] = url_path crawler = Crawler(settings) crawler.signals.connect(reactor.stop, signal=signals.spider_closed) crawler.configure() crawler.crawl(spider) crawler.start() log.start(loglevel=log.INFO, logstdout=True) reactor.run() return output_name
from __future__ import absolute_import from celery import shared_task from twisted.internet import reactor from scrapy.crawler import Crawler from scrapy import log, signals from scrapy.utils.project import get_project_settings import os from raw.scraper.spiders.legco_library import LibraryAgendaSpider from raw.scraper.spiders.members import LibraryMemberSpider @shared_task def run_scraper(): output_name = 'foo.jl' spider = LibraryAgendaSpider() settings = get_project_settings() output_path = os.path.join(settings.get('DATA_DIR_BASE'), 'scrapes', output_name) settings.overrides['FEED_URI'] = output_path crawler = Crawler(settings) crawler.signals.connect(reactor.stop, signal=signals.spider_closed) crawler.configure() crawler.crawl(spider) crawler.start() log.start(loglevel=log.INFO, logstdout=True) reactor.run() return output_path
Fix variable and return value
Fix variable and return value
Python
mit
legco-watch/legco-watch,comsaint/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch
--- +++ @@ -14,8 +14,8 @@ output_name = 'foo.jl' spider = LibraryAgendaSpider() settings = get_project_settings() - url_path = os.path.join(settings.get('DATA_DIR_BASE'), 'scrapes', output_name) - settings.overrides['FEED_URI'] = url_path + output_path = os.path.join(settings.get('DATA_DIR_BASE'), 'scrapes', output_name) + settings.overrides['FEED_URI'] = output_path crawler = Crawler(settings) crawler.signals.connect(reactor.stop, signal=signals.spider_closed) @@ -24,4 +24,4 @@ crawler.start() log.start(loglevel=log.INFO, logstdout=True) reactor.run() - return output_name + return output_path
e71870736959efcde2188bdcbd89838b67ca8582
pathvalidate/__init__.py
pathvalidate/__init__.py
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from .__version__ import __author__, __copyright__, __email__, __license__, __version__ from ._common import ( Platform, ascii_symbols, normalize_platform, replace_ansi_escape, replace_unprintable_char, unprintable_ascii_chars, validate_null_string, validate_pathtype, ) from ._filename import FileNameSanitizer, is_valid_filename, sanitize_filename, validate_filename from ._filepath import ( FilePathSanitizer, is_valid_filepath, sanitize_file_path, sanitize_filepath, validate_file_path, validate_filepath, ) from ._ltsv import sanitize_ltsv_label, validate_ltsv_label from ._symbol import replace_symbol, validate_symbol from .error import ( ErrorReason, InvalidCharError, InvalidLengthError, InvalidReservedNameError, NullNameError, ReservedNameError, ValidationError, ValidReservedNameError, )
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from .__version__ import __author__, __copyright__, __email__, __license__, __version__ from ._base import AbstractSanitizer, AbstractValidator from ._common import ( Platform, ascii_symbols, normalize_platform, replace_ansi_escape, replace_unprintable_char, unprintable_ascii_chars, validate_null_string, validate_pathtype, ) from ._filename import FileNameSanitizer, is_valid_filename, sanitize_filename, validate_filename from ._filepath import ( FilePathSanitizer, is_valid_filepath, sanitize_file_path, sanitize_filepath, validate_file_path, validate_filepath, ) from ._ltsv import sanitize_ltsv_label, validate_ltsv_label from ._symbol import replace_symbol, validate_symbol from .error import ( ErrorReason, InvalidCharError, InvalidLengthError, InvalidReservedNameError, NullNameError, ReservedNameError, ValidationError, ValidReservedNameError, )
Add AbstractSanitizer/AbstractValidator class to import path
Add AbstractSanitizer/AbstractValidator class to import path
Python
mit
thombashi/pathvalidate
--- +++ @@ -3,6 +3,7 @@ """ from .__version__ import __author__, __copyright__, __email__, __license__, __version__ +from ._base import AbstractSanitizer, AbstractValidator from ._common import ( Platform, ascii_symbols,
99818f02ebc46debe349a6c1b6bba70be6e04968
skimage/io/_plugins/null_plugin.py
skimage/io/_plugins/null_plugin.py
__all__ = ['imshow', 'imread', 'imsave', '_app_show'] import warnings message = '''\ No plugin has been loaded. Please refer to skimage.io.plugins() for a list of available plugins.''' def imshow(*args, **kwargs): warnings.warn(RuntimeWarning(message)) def imread(*args, **kwargs): warnings.warn(RuntimeWarning(message)) def imsave(*args, **kwargs): warnings.warn(RuntimeWarning(message)) _app_show = imshow
__all__ = ['imshow', 'imread', 'imsave', '_app_show'] import warnings message = '''\ No plugin has been loaded. Please refer to the docstring for ``skimage.io`` for a list of available plugins. You may specify a plugin explicitly as an argument to ``imread``, e.g. ``imread("image.jpg", plugin='pil')``. ''' def imshow(*args, **kwargs): warnings.warn(RuntimeWarning(message)) def imread(*args, **kwargs): warnings.warn(RuntimeWarning(message)) def imsave(*args, **kwargs): warnings.warn(RuntimeWarning(message)) _app_show = imshow
Update error message for no plugins
Update error message for no plugins
Python
bsd-3-clause
oew1v07/scikit-image,robintw/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,Hiyorimi/scikit-image,paalge/scikit-image,juliusbierk/scikit-image,ofgulban/scikit-image,bennlich/scikit-image,bsipocz/scikit-image,chriscrosscutler/scikit-image,vighneshbirodkar/scikit-image,keflavich/scikit-image,oew1v07/scikit-image,jwiggins/scikit-image,pratapvardhan/scikit-image,paalge/scikit-image,WarrenWeckesser/scikits-image,ajaybhat/scikit-image,ajaybhat/scikit-image,chriscrosscutler/scikit-image,newville/scikit-image,blink1073/scikit-image,Britefury/scikit-image,juliusbierk/scikit-image,keflavich/scikit-image,GaZ3ll3/scikit-image,jwiggins/scikit-image,dpshelio/scikit-image,michaelpacer/scikit-image,emon10005/scikit-image,youprofit/scikit-image,ClinicalGraphics/scikit-image,ofgulban/scikit-image,newville/scikit-image,Britefury/scikit-image,robintw/scikit-image,michaelaye/scikit-image,blink1073/scikit-image,vighneshbirodkar/scikit-image,ofgulban/scikit-image,bennlich/scikit-image,paalge/scikit-image,emon10005/scikit-image,GaZ3ll3/scikit-image,michaelaye/scikit-image,Hiyorimi/scikit-image,ClinicalGraphics/scikit-image,dpshelio/scikit-image,bsipocz/scikit-image,WarrenWeckesser/scikits-image,Midafi/scikit-image,Midafi/scikit-image,warmspringwinds/scikit-image,rjeli/scikit-image,pratapvardhan/scikit-image,youprofit/scikit-image,rjeli/scikit-image,warmspringwinds/scikit-image,michaelpacer/scikit-image
--- +++ @@ -3,11 +3,11 @@ import warnings message = '''\ -No plugin has been loaded. Please refer to +No plugin has been loaded. Please refer to the docstring for ``skimage.io`` +for a list of available plugins. You may specify a plugin explicitly as +an argument to ``imread``, e.g. ``imread("image.jpg", plugin='pil')``. -skimage.io.plugins() - -for a list of available plugins.''' +''' def imshow(*args, **kwargs):
9ee9ba34e447e99c868fcb43d40ce905cebf5fb9
noah/noah.py
noah/noah.py
import json class Noah(object): pass
import json class Noah(object): def __init__(self, dictionary_file): self.dictionary = json.load(dictionary_file) def list(self): return '\n'.join([entry['word'] for entry in self.dictionary]) def define(self, word): entry = next((x for x in self.dictionary if x['word'] == word), None) if not entry is None: return '%s (%s)' % (entry['word'], entry['part_of_speech']) def main(): with open('../dictionaries/english.json') as dictionary: n = Noah(dictionary) print n.list() print n.define('aardvark') if __name__ == '__main__': main()
Add list and define functions.
Add list and define functions.
Python
mit
maxdeviant/noah
--- +++ @@ -1,4 +1,24 @@ import json class Noah(object): - pass + def __init__(self, dictionary_file): + self.dictionary = json.load(dictionary_file) + + def list(self): + return '\n'.join([entry['word'] for entry in self.dictionary]) + + def define(self, word): + entry = next((x for x in self.dictionary if x['word'] == word), None) + + if not entry is None: + return '%s (%s)' % (entry['word'], entry['part_of_speech']) + +def main(): + with open('../dictionaries/english.json') as dictionary: + n = Noah(dictionary) + + print n.list() + print n.define('aardvark') + +if __name__ == '__main__': + main()
55983401814bc0e7158d213885ebdfdbc7e02e9b
DeployUtil/authentication.py
DeployUtil/authentication.py
import urllib.request import http.cookiejar import DeployUtil.toolsession as session #TODO: give an indicator of success #TODO: handle errors a bit better. def do_pair(ip, pin, **_args): # IF YOU DON'T DO THIS OVER HTTPS YOU WILL GET 308s to goto HTTPS scheme = 'https://' port = '' api = '/api/authorize/pair?pin={pin}&persistent=0' verb = 'POST' request_url = scheme + ip + port + api.format_map({'pin':pin}) https_handler = session.create_toolsess_httpsHandler() request = urllib.request.Request(url=request_url, method=verb) cookies = urllib.request.HTTPCookieProcessor(http.cookiejar.MozillaCookieJar("deployUtil.cookies")) opener = urllib.request.build_opener(https_handler, cookies) resp = opener.open(request) cookies.cookiejar.save(ignore_discard=True)
import requests import json #TODO: give an indicator of success #TODO: handle errors a bit better. def do_pair(ip, pin, **_args): # IF YOU DON'T DO THIS OVER HTTPS YOU WILL GET 308s to goto HTTPS # But we cannot verify our HTTPS cert yet because we cannot get it off # of all devices. # If the tooling gets smarter about what its talking to, then we can # make an educated choice. scheme = 'https://' port = '' api = '/api/authorize/pair?pin={pin}&persistent=0' request_url = scheme + ip + port + api.format_map({'pin':pin}) with requests.Session() as session: response = session.post(request_url, verify=False) cookie_filename = 'deployUtil.cookies' cookies = requests.utils.dict_from_cookiejar(response.cookies) with open(cookie_filename,'w') as cookie_file: json.dump(cookies, cookie_file)
Add dependency on the requests module and refactor
Add dependency on the requests module and refactor Since I didn't want to have to write my own Multipart POST handler when I start writing the install command, I started doing research on the options and came across "requests". I added the dependency and tried it out by reimplementing the pair command using that library instead of urllib.request and its supporting types. On the good side, the library is very easy to use. On the other hand, I have picked up a nice warning telling to verify my certificate chains which isn't possible yet for all the devices the WDP runs on.
Python
mit
loarabia/DeployUtil
--- +++ @@ -1,23 +1,23 @@ -import urllib.request -import http.cookiejar -import DeployUtil.toolsession as session +import requests +import json #TODO: give an indicator of success #TODO: handle errors a bit better. def do_pair(ip, pin, **_args): # IF YOU DON'T DO THIS OVER HTTPS YOU WILL GET 308s to goto HTTPS + # But we cannot verify our HTTPS cert yet because we cannot get it off + # of all devices. + # If the tooling gets smarter about what its talking to, then we can + # make an educated choice. scheme = 'https://' port = '' api = '/api/authorize/pair?pin={pin}&persistent=0' - verb = 'POST' - request_url = scheme + ip + port + api.format_map({'pin':pin}) - https_handler = session.create_toolsess_httpsHandler() - request = urllib.request.Request(url=request_url, method=verb) - - cookies = urllib.request.HTTPCookieProcessor(http.cookiejar.MozillaCookieJar("deployUtil.cookies")) - opener = urllib.request.build_opener(https_handler, cookies) - resp = opener.open(request) - cookies.cookiejar.save(ignore_discard=True) + with requests.Session() as session: + response = session.post(request_url, verify=False) + cookie_filename = 'deployUtil.cookies' + cookies = requests.utils.dict_from_cookiejar(response.cookies) + with open(cookie_filename,'w') as cookie_file: + json.dump(cookies, cookie_file)
da5a05c27f1c19c69ce23f5cd6cd0f09edb9d7f7
paranuara_api/views.py
paranuara_api/views.py
from rest_framework import viewsets from paranuara_api.models import Company, Person from paranuara_api.serializers import ( CompanySerializer, CompanyListSerializer, PersonListSerializer, PersonSerializer ) class CompanyViewSet(viewsets.ReadOnlyModelViewSet): queryset = Company.objects.all() lookup_field = 'index' serializers = { 'list': CompanyListSerializer, 'retrieve': CompanySerializer, } def get_serializer_class(self): return self.serializers[self.action] class PersonViewSet(viewsets.ReadOnlyModelViewSet): queryset = Person.objects.all() lookup_field = 'index' serializers = { 'list': PersonListSerializer, 'retrieve': PersonSerializer, } def get_serializer_class(self): return self.serializers[self.action]
from rest_framework import viewsets from paranuara_api.models import Company, Person from paranuara_api.serializers import ( CompanySerializer, CompanyListSerializer, PersonListSerializer, PersonSerializer ) class MultiSerializerMixin(object): def get_serializer_class(self): return self.serializers[self.action] class CompanyViewSet(MultiSerializerMixin, viewsets.ReadOnlyModelViewSet): queryset = Company.objects.all() lookup_field = 'index' serializers = { 'list': CompanyListSerializer, 'retrieve': CompanySerializer, } class PersonViewSet(MultiSerializerMixin, viewsets.ReadOnlyModelViewSet): queryset = Person.objects.all() lookup_field = 'index' serializers = { 'list': PersonListSerializer, 'retrieve': PersonSerializer, }
Refactor common serializer selection code.
Refactor common serializer selection code.
Python
bsd-3-clause
jarvis-cochrane/paranuara
--- +++ @@ -6,7 +6,13 @@ PersonSerializer ) -class CompanyViewSet(viewsets.ReadOnlyModelViewSet): +class MultiSerializerMixin(object): + + def get_serializer_class(self): + return self.serializers[self.action] + + +class CompanyViewSet(MultiSerializerMixin, viewsets.ReadOnlyModelViewSet): queryset = Company.objects.all() lookup_field = 'index' @@ -15,11 +21,8 @@ 'retrieve': CompanySerializer, } - def get_serializer_class(self): - return self.serializers[self.action] - -class PersonViewSet(viewsets.ReadOnlyModelViewSet): +class PersonViewSet(MultiSerializerMixin, viewsets.ReadOnlyModelViewSet): queryset = Person.objects.all() lookup_field = 'index' @@ -28,6 +31,3 @@ 'retrieve': PersonSerializer, } - def get_serializer_class(self): - return self.serializers[self.action] -
d36e17e3823af74b5a6f75191f141ec98fdf281f
plugins/irc/irc.py
plugins/irc/irc.py
from p1tr.helpers import clean_string from p1tr.plugin import * @meta_plugin class Irc(Plugin): """Provides commands for basic IRC operations.""" @command @require_master def nick(self, server, channel, nick, params): """Usage: nick NEW_NICKNAME - changes the bot's nickname.""" if len(params) < 1: return clean_string(self.nick.__doc__) self.bot.client.send('NICK', params[0]) @command @require_master def join(self, server, channel, nick, params): """ Usage: join #CHANNEL [PASSWORD] - the bot will enter the specified channel. A password may be provided optionally, if it is required. """ if len(params) < 1: return clean_string(self.join.__doc__) password = '' if len(params) > 1: password = params[0] self.bot.client.send('JOIN', params[0], password) @command @require_op def part(self, server, channel, nick, params): """ Usage: part [#CHANNEL] - asks the bot to leave the current channel. Optionally, a channel may be specified if it should be left instead of the current one. """ if len(params) > 0: channel = params[0] self.bot.client.send('PART', channel) @command @require_master def quit(self, server, channel, nick, params): self.blot.intended_disconnect = True
from p1tr.helpers import clean_string from p1tr.plugin import * @meta_plugin class Irc(Plugin): """Provides commands for basic IRC operations.""" @command @require_master def nick(self, server, channel, nick, params): """Usage: nick NEW_NICKNAME - changes the bot's nickname.""" if len(params) < 1: return clean_string(self.nick.__doc__) self.bot.client.send('NICK', params[0]) @command @require_master def join(self, server, channel, nick, params): """ Usage: join #CHANNEL [PASSWORD] - the bot will enter the specified channel. A password may be provided optionally, if it is required. """ if len(params) < 1: return clean_string(self.join.__doc__) password = '' if len(params) > 1: password = params[0] self.bot.client.send('JOIN', params[0], password) @command @require_op def part(self, server, channel, nick, params): """ Usage: part [#CHANNEL] - asks the bot to leave the current channel. Optionally, a channel may be specified if it should be left instead of the current one. """ if len(params) > 0: channel = params[0] self.bot.client.send('PART', channel) @command @require_master def quit(self, server, channel, nick, params): """ Usage: quit - Tell the bot to disconnect from the server. """ self.bot.intended_disconnect = True self.bot.exit()
Fix failing reconnects; add quit IRC command
Fix failing reconnects; add quit IRC command
Python
mit
howard/p1tr-tng,howard/p1tr-tng
--- +++ @@ -38,8 +38,12 @@ if len(params) > 0: channel = params[0] self.bot.client.send('PART', channel) - + @command @require_master def quit(self, server, channel, nick, params): - self.blot.intended_disconnect = True + """ + Usage: quit - Tell the bot to disconnect from the server. + """ + self.bot.intended_disconnect = True + self.bot.exit()
d8e0109e4c697f4a920ff4993c491eb5b0d38d55
setup.py
setup.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2010-2018 OneLogin, Inc. # MIT License from setuptools import setup setup( name='python-saml', version='2.4.1', description='Onelogin Python Toolkit. Add SAML support to your Python software using this library', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', ], author='OneLogin', author_email='support@onelogin.com', license='MIT', url='https://github.com/onelogin/python-saml', packages=['onelogin', 'onelogin/saml2'], include_package_data=True, package_data={ 'onelogin/saml2/schemas': ['*.xsd'], }, package_dir={ '': 'src', }, test_suite='tests', install_requires=[ 'dm.xmlsec.binding==1.3.3', 'isodate>=0.5.0', 'defusedxml>=0.4.1', ], extras_require={ 'test': ( 'coverage>=3.6', 'freezegun==0.3.5', 'pylint==1.3.1', 'pep8==1.5.7', 'pyflakes==0.8.1', 'coveralls==1.1', ), }, keywords='saml saml2 xmlsec django flask', )
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2010-2018 OneLogin, Inc. # MIT License from setuptools import setup setup( name='python-saml', version='2.4.1', description='Onelogin Python Toolkit. Add SAML support to your Python software using this library', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', ], author='OneLogin', author_email='support@onelogin.com', license='MIT', url='https://github.com/onelogin/python-saml', packages=['onelogin', 'onelogin/saml2'], include_package_data=True, package_data={ 'onelogin/saml2/schemas': ['*.xsd'], }, package_dir={ '': 'src', }, test_suite='tests', install_requires=[ 'dm.xmlsec.binding==1.3.3', 'isodate>=0.5.0', 'defusedxml>=0.4.1', ], extras_require={ 'test': ( 'coverage>=3.6', 'freezegun==0.3.5', 'pylint==1.9.1', 'pep8==1.5.7', 'pyflakes==0.8.1', 'coveralls==1.1', ), }, keywords='saml saml2 xmlsec django flask', )
Update pylint dependency to 1.9.1
Update pylint dependency to 1.9.1
Python
mit
onelogin/python-saml,onelogin/python-saml
--- +++ @@ -40,7 +40,7 @@ 'test': ( 'coverage>=3.6', 'freezegun==0.3.5', - 'pylint==1.3.1', + 'pylint==1.9.1', 'pep8==1.5.7', 'pyflakes==0.8.1', 'coveralls==1.1',
cf16c64e378f64d2267f75444c568aed895f940c
setup.py
setup.py
import platform, sys from distutils.core import setup from distextend import * packages, package_data = findPackages("countershape") setup( name = "countershape", version = "0.1", description = "A framework for rendering static documentation.", author = "Nullcube Pty Ltd", author_email = "aldo@nullcube.com", url = "http://dev.nullcube.com", packages = packages, package_data = package_data, scripts = ["cshape"], )
import platform, sys from distutils.core import setup from distextend import * packages, package_data = findPackages("countershape") setup( name = "countershape", version = "0.1", description = "A framework for rendering static documentation.", author = "Nullcube Pty Ltd", author_email = "aldo@nullcube.com", url = "http://dev.nullcube.com", packages = packages, package_data = package_data, scripts = ["cshape", "csblog"], )
Add csblog to installed scripts.
Add csblog to installed scripts.
Python
mit
mhils/countershape,samtaufa/countershape,cortesi/countershape,cortesi/countershape,samtaufa/countershape,mhils/countershape
--- +++ @@ -12,5 +12,5 @@ url = "http://dev.nullcube.com", packages = packages, package_data = package_data, - scripts = ["cshape"], + scripts = ["cshape", "csblog"], )
075488b6f2b33c211b734dc08414d45cb35c4e68
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages # Match releases to redis-py versions __version__ = '2.9.0.11' # Jenkins will replace __build__ with a unique value. __build__ = '' setup(name='mockredispy', version=__version__ + __build__, description='Mock for redis-py', url='http://www.github.com/locationlabs/mockredis', license='Apache2', packages=find_packages(exclude=['*.tests']), setup_requires=[ 'nose' ], extras_require={ 'lua': ['lunatic-python-bugfix==1.1.1'], }, tests_require=[ 'redis>=2.9.0' ], test_suite='mockredis.tests', entry_points={ 'nose.plugins.0.10': [ 'with_redis = mockredis.noseplugin:WithRedis' ] })
#!/usr/bin/env python from setuptools import setup, find_packages # Match releases to redis-py versions __version__ = '2.9.0.12' # Jenkins will replace __build__ with a unique value. __build__ = '' setup(name='mockredispy', version=__version__ + __build__, description='Mock for redis-py', url='http://www.github.com/locationlabs/mockredis', license='Apache2', packages=find_packages(exclude=['*.tests']), setup_requires=[ 'nose' ], extras_require={ 'lua': ['lunatic-python-bugfix==1.1.1'], }, tests_require=[ 'redis>=2.9.0' ], test_suite='mockredis.tests', entry_points={ 'nose.plugins.0.10': [ 'with_redis = mockredis.noseplugin:WithRedis' ] })
Bump version to prepare for next release.
Bump version to prepare for next release.
Python
apache-2.0
locationlabs/mockredis
--- +++ @@ -3,7 +3,7 @@ from setuptools import setup, find_packages # Match releases to redis-py versions -__version__ = '2.9.0.11' +__version__ = '2.9.0.12' # Jenkins will replace __build__ with a unique value. __build__ = ''
76f254582243dc927ca25eebf2b47702ef43167b
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup from mongorm import VERSION def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() version = '.'.join(map(str, VERSION)) if __name__ == '__main__': setup( name='mongorm', version=version, author='Rahul AG', author_email='r@hul.ag', description=('An extremely thin ORM-ish wrapper over pymongo.'), long_description=read('README.rst'), license = 'BSD', keywords = ['mongodb', 'mongo', 'orm', 'odm'], url = 'https://github.com/rahulg/mongorm', packages=['mongorm', 'tests'], classifiers=[ 'Development Status :: 3 - Alpha', 'Topic :: Database :: Front-Ends', 'License :: OSI Approved :: BSD License', 'Intended Audience :: Developers', 'Operating System :: OS Independent' ], test_suite='tests', install_requires=[ 'pymongo', 'inflection', 'simplejson' ], )
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup VERSION = (0, 6, 5) def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() version = '.'.join(map(str, VERSION)) if __name__ == '__main__': setup( name='mongorm', version=version, author='Rahul AG', author_email='r@hul.ag', description=('An extremely thin ORM-ish wrapper over pymongo.'), long_description=read('README.rst'), license = 'BSD', keywords = ['mongodb', 'mongo', 'orm', 'odm'], url = 'https://github.com/rahulg/mongorm', packages=['mongorm', 'tests'], classifiers=[ 'Development Status :: 3 - Alpha', 'Topic :: Database :: Front-Ends', 'License :: OSI Approved :: BSD License', 'Intended Audience :: Developers', 'Operating System :: OS Independent' ], test_suite='tests', install_requires=[ 'pymongo', 'inflection', 'simplejson' ], )
Fix install-time dependency on pymongo.
Fix install-time dependency on pymongo.
Python
bsd-2-clause
rahulg/mongorm
--- +++ @@ -4,7 +4,7 @@ import os from setuptools import setup -from mongorm import VERSION +VERSION = (0, 6, 5) def read(fname):
047215a3e07e7cebf78e409602dd57a2709f8923
setup.py
setup.py
import sys from setuptools import setup, find_packages from cement.utils import version VERSION = version.get_version() f = open('README.md', 'r') LONG = f.read() f.close() setup(name='cement', version=VERSION, description='CLI Framework for Python', long_description=LONG, long_description_content_type='text/markdown', classifiers=[], install_requires=[], keywords='cli framework', author='Data Folk Labs, LLC', author_email='derks@datafolklabs.com', url='http://builtoncement.org', license='BSD', packages=find_packages(exclude=['ez_setup', 'tests*']), package_data={'cement': ['cement/cli/templates/generate/*']}, include_package_data=True, zip_safe=False, test_suite='nose.collector', entry_points=""" [console_scripts] cement = cement.cli.main:main """, )
import sys from setuptools import setup, find_packages from cement.utils import version VERSION = version.get_version() f = open('README.md', 'r') LONG = f.read() f.close() setup(name='cement', version=VERSION, description='CLI Framework for Python', long_description=LONG, long_description_content_type='text/markdown', classifiers=[], install_requires=[], keywords='cli framework', author='Data Folk Labs, LLC', author_email='derks@datafolklabs.com', url='https://builtoncement.com', license='BSD', packages=find_packages(exclude=['ez_setup', 'tests*']), package_data={'cement': ['cement/cli/templates/generate/*']}, include_package_data=True, zip_safe=False, test_suite='nose.collector', entry_points=""" [console_scripts] cement = cement.cli.main:main """, )
Update broken link in PyPi (Homepage)
Update broken link in PyPi (Homepage)
Python
bsd-3-clause
datafolklabs/cement,datafolklabs/cement,datafolklabs/cement
--- +++ @@ -19,7 +19,7 @@ keywords='cli framework', author='Data Folk Labs, LLC', author_email='derks@datafolklabs.com', - url='http://builtoncement.org', + url='https://builtoncement.com', license='BSD', packages=find_packages(exclude=['ez_setup', 'tests*']), package_data={'cement': ['cement/cli/templates/generate/*']},
ca7df2103a2e53f0b401c7004a2a5e942bd3e7e1
setup.py
setup.py
from distutils.core import setup from setuptools import setup, find_packages setup(name = "django-image-cropping", version = "0.3.0", description = "A reusable app for cropping images easily and non-destructively in Django", long_description=open('README.rst').read(), author = "jonasvp", author_email = "jvp@jonasundderwolf.de", url = "http://github.com/jonasundderwolf/django-image-cropping", #Name the folder where your packages live: #(If you have other packages (dirs) or modules (py files) then #put them into the package directory - they will be found #recursively.) packages = find_packages(), include_package_data=True, install_requires = [ 'docutils', 'PIL', 'easy_thumbnails', ], classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules', ], )
from distutils.core import setup from setuptools import setup, find_packages setup(name = "django-image-cropping", version = "0.3.0", description = "A reusable app for cropping images easily and non-destructively in Django", long_description=open('README.rst').read(), author = "jonasvp", author_email = "jvp@jonasundderwolf.de", url = "http://github.com/jonasundderwolf/django-image-cropping", #Name the folder where your packages live: #(If you have other packages (dirs) or modules (py files) then #put them into the package directory - they will be found #recursively.) packages = find_packages(), include_package_data=True, install_requires = [ 'easy_thumbnails', ], classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules', ], )
Remove PIL and docutils from requirements, easy_thumbnails requires it anyway
Remove PIL and docutils from requirements, easy_thumbnails requires it anyway
Python
bsd-3-clause
winzard/django-image-cropping,henriquechehad/django-image-cropping,henriquechehad/django-image-cropping,winzard/django-image-cropping,henriquechehad/django-image-cropping,winzard/django-image-cropping
--- +++ @@ -15,8 +15,6 @@ packages = find_packages(), include_package_data=True, install_requires = [ - 'docutils', - 'PIL', 'easy_thumbnails', ], classifiers = [
4b3dc61e5cb46774cf647f8c640b280aae1e4e90
setup.py
setup.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # © 2017-2019 qsuscs, TobiX # Should still run with Python 2.7... from __future__ import print_function, unicode_literals import os import sys from glob import glob os.chdir(os.path.dirname(os.path.abspath(__file__))) exit = 0 for f in glob('dot.*'): dst_home = '~/' + f[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-") dst = os.path.expanduser(dst_home) src = os.path.join(os.getcwd(), f) src_rel = os.path.relpath(src, os.path.dirname(dst)) try: os.makedirs(os.path.dirname(dst)) except OSError: pass try: os.symlink(src_rel, dst) except OSError: # Broken symbolic links do not "exist" if not os.path.exists(dst): print('"{}" is a broken link pointing to "{}", replacing.'.format( dst_home, os.readlink(dst))) os.remove(dst) os.symlink(src_rel, dst) elif not os.path.samefile(src, dst): print('"{}" exists and does not link to "{}".'.format(dst_home, f)) exit = 1 sys.exit(exit)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # © 2017-2021 qsuscs, TobiX # Should still run with Python 2.7... from __future__ import print_function, unicode_literals import os import sys from glob import glob os.chdir(os.path.dirname(os.path.abspath(__file__))) home = os.path.realpath(os.path.expanduser('~')) exit = 0 for f in glob('dot.*'): dst_home = f[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-") dst = home + '/' + dst_home src = os.path.join(os.getcwd(), f) src_rel = os.path.relpath(src, os.path.dirname(dst)) try: os.makedirs(os.path.dirname(dst)) except OSError: pass try: os.symlink(src_rel, dst) except OSError: # Broken symbolic links do not "exist" if not os.path.exists(dst): print('"{}" is a broken link pointing to "{}", replacing.'.format( dst_home, os.readlink(dst))) os.remove(dst) os.symlink(src_rel, dst) elif not os.path.samefile(src, dst): print('"{}" exists and does not link to "{}".'.format(dst_home, f)) exit = 1 sys.exit(exit)
Handle symlinks in path to home directory
Handle symlinks in path to home directory
Python
isc
TobiX/dotfiles,TobiX/dotfiles
--- +++ @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# © 2017-2019 qsuscs, TobiX +# © 2017-2021 qsuscs, TobiX # Should still run with Python 2.7... from __future__ import print_function, unicode_literals @@ -10,11 +10,13 @@ from glob import glob os.chdir(os.path.dirname(os.path.abspath(__file__))) +home = os.path.realpath(os.path.expanduser('~')) + exit = 0 for f in glob('dot.*'): - dst_home = '~/' + f[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-") - dst = os.path.expanduser(dst_home) + dst_home = f[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-") + dst = home + '/' + dst_home src = os.path.join(os.getcwd(), f) src_rel = os.path.relpath(src, os.path.dirname(dst))
f8c049e1b6a6309d494771e4038aa10b40bfbf76
setup.py
setup.py
from setuptools import setup VERSION = '1.2.2' setup( name='pkgconfig', version=VERSION, author='Matthias Vogelgesang', author_email='matthias.vogelgesang@gmail.com', url='http://github.com/matze/pkgconfig', license='MIT', packages=['pkgconfig'], description="Interface Python with pkg-config", long_description=open('README.rst').read(), setup_requires=['nose>=1.0'], python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*', test_suite='test', )
from setuptools import setup VERSION = '1.2.2' setup( name='pkgconfig', version=VERSION, author='Matthias Vogelgesang', author_email='matthias.vogelgesang@gmail.com', url='http://github.com/matze/pkgconfig', license='MIT', packages=['pkgconfig'], description="Interface Python with pkg-config", long_description=open('README.rst').read(), tests_require=['nose>=1.0'], python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*', test_suite='test', )
Move 'nose' dependency to 'tests_require'
Move 'nose' dependency to 'tests_require' `nose` is only required for invoking `setup.py test`, not for any other `setup.py` command. This avoids the auto-download behavior when just building and installing the module (e.g., installing via `pip`). Signed-off-by: Eric N. Vander Weele <4c4001a597f85b23ba16d5c26e44733bbe755332@gmail.com>
Python
mit
matze/pkgconfig
--- +++ @@ -12,7 +12,7 @@ packages=['pkgconfig'], description="Interface Python with pkg-config", long_description=open('README.rst').read(), - setup_requires=['nose>=1.0'], + tests_require=['nose>=1.0'], python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*', test_suite='test', )
70be93343a985b4aa81944649c42c4138fece388
setup.py
setup.py
from __future__ import print_function import codecs import os from setuptools import setup, find_packages import piazza_api def read(filename): """Read and return `filename` in root dir of project and return string""" here = os.path.abspath(os.path.dirname(__file__)) return codecs.open(os.path.join(here, filename), 'r').read() install_requires = read("requirements.txt").split() long_description = read('README.md') setup( name='piazza-api', version=piazza_api.__version__, url='http://github.com/hfaran/piazza-api/', license='MIT License', author='Hamza Faran', install_requires=install_requires, description="Unofficial Client for Piazza's Internal API", long_description=long_description, packages=['piazza_api'], platforms='any', classifiers = [ 'Programming Language :: Python', 'Development Status :: 3 - Alpha', 'Natural Language :: English', 'Environment :: Web Environment', 'Intended Audience :: Developers', "License :: OSI Approved :: MIT License", 'Operating System :: OS Independent', "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", 'Topic :: Software Development :: Libraries :: Python Modules', ], )
from __future__ import print_function import codecs import os import re from setuptools import setup def read(filename): """Read and return `filename` in root dir of project and return string""" here = os.path.abspath(os.path.dirname(__file__)) return codecs.open(os.path.join(here, filename), 'r').read() # https://github.com/kennethreitz/requests/blob/master/setup.py#L32 with open('piazza_api/__init__.py', 'r') as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) install_requires = read("requirements.txt").split() long_description = read('README.md') setup( name='piazza-api', version=version, url='http://github.com/hfaran/piazza-api/', license='MIT License', author='Hamza Faran', install_requires=install_requires, description="Unofficial Client for Piazza's Internal API", long_description=long_description, packages=['piazza_api'], platforms='any', classifiers = [ 'Programming Language :: Python', 'Development Status :: 3 - Alpha', 'Natural Language :: English', 'Environment :: Web Environment', 'Intended Audience :: Developers', "License :: OSI Approved :: MIT License", 'Operating System :: OS Independent', "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", 'Topic :: Software Development :: Libraries :: Python Modules', ], )
Use regex for finding version in __init__.py
Use regex for finding version in __init__.py
Python
mit
hfaran/piazza-api
--- +++ @@ -2,9 +2,8 @@ import codecs import os -from setuptools import setup, find_packages - -import piazza_api +import re +from setuptools import setup def read(filename): @@ -13,13 +12,17 @@ return codecs.open(os.path.join(here, filename), 'r').read() +# https://github.com/kennethreitz/requests/blob/master/setup.py#L32 +with open('piazza_api/__init__.py', 'r') as fd: + version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) install_requires = read("requirements.txt").split() long_description = read('README.md') setup( name='piazza-api', - version=piazza_api.__version__, + version=version, url='http://github.com/hfaran/piazza-api/', license='MIT License', author='Hamza Faran',
e1cc4d49f37abbda308968b1bf4f49298a1c904e
setup.py
setup.py
#!/usr/bin/env python # coding=utf8 import os from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='legitfs', version='0.3dev', description='A read-only FUSE-based filesystem allowing you to browse ' 'git repositories', long_description=read('README.rst'), keywords='git,fuse,filesystem,fs,read-only,readonly,legit,legitfs', author='Marc Brinkmann', author_email='git@marcbrinkmann.de', url='http://github.com/mbr/legitfs', license='MIT', packages=find_packages(exclude=['tests']), install_requires=['dulwich', 'fusepy', 'click', 'logbook'], entry_points={ 'console_scripts': [ 'legitfs = legitfs.cli:main', ] } )
#!/usr/bin/env python # coding=utf8 import os from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='legitfs', version='0.3.dev1', description='A read-only FUSE-based filesystem allowing you to browse ' 'git repositories', long_description=read('README.rst'), keywords='git,fuse,filesystem,fs,read-only,readonly,legit,legitfs', author='Marc Brinkmann', author_email='git@marcbrinkmann.de', url='http://github.com/mbr/legitfs', license='MIT', packages=find_packages(exclude=['tests']), install_requires=['dulwich', 'fusepy', 'click', 'logbook'], entry_points={ 'console_scripts': [ 'legitfs = legitfs.cli:main', ] } )
Change version to prevent unleash from choking.
Change version to prevent unleash from choking.
Python
mit
mbr/legitfs
--- +++ @@ -11,7 +11,7 @@ setup(name='legitfs', - version='0.3dev', + version='0.3.dev1', description='A read-only FUSE-based filesystem allowing you to browse ' 'git repositories', long_description=read('README.rst'),
90c82f0936addeb4469db2c42c1cd48713e7f3cf
progress_logger.py
progress_logger.py
# Copyright Google # BSD License import copy import wash # from http://stackoverflow.com/questions/8924173/how-do-i-print-bold-text-in-python class color: PURPLE = '\033[95m' CYAN = '\033[96m' DARKCYAN = '\033[36m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' BOLD = '\033[1m' UNDERLINE = '\033[4m' END = '\033[0m' class TermLogger(object): def print_progress(self, lots, text, bold_lots): lots = copy.copy(lots) # so I can re-sort non-destructively print text lots.sort(cmp=wash.cmp_by_buy_date) bold_ids = [id(lot) for lot in bold_lots] for lot in lots: header = '' footer = '' if id(lot) in bold_ids: header = color.BOLD footer = color.END print header + str(lot) + footer raw_input('hit enter>') class NullLogger(object): def print_progress(self, lots, text, bold_lots): pass
# Copyright Google # BSD License import copy import wash # from http://stackoverflow.com/questions/8924173/how-do-i-print-bold-text-in-python class color: PURPLE = '\033[95m' CYAN = '\033[96m' DARKCYAN = '\033[36m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' BOLD = '\033[1m' UNDERLINE = '\033[4m' END = '\033[0m' class TermLogger(object): def print_progress(self, lots, text, red_lots): lots = copy.copy(lots) # so I can re-sort non-destructively print text lots.sort(cmp=wash.cmp_by_buy_date) red_ids = [id(lot) for lot in red_lots] for lot in lots: header = '' footer = '' if id(lot) in red_ids: header = color.RED footer = color.END print header + str(lot) + footer raw_input('hit enter>') class NullLogger(object): def print_progress(self, lots, text, red_lots): pass
Switch from bold to red highlighting.
Switch from bold to red highlighting. With many terminal fonts bold is subtle. The red is much more clear.
Python
bsd-2-clause
adlr/wash-sale-calculator
--- +++ @@ -19,20 +19,20 @@ END = '\033[0m' class TermLogger(object): - def print_progress(self, lots, text, bold_lots): + def print_progress(self, lots, text, red_lots): lots = copy.copy(lots) # so I can re-sort non-destructively print text lots.sort(cmp=wash.cmp_by_buy_date) - bold_ids = [id(lot) for lot in bold_lots] + red_ids = [id(lot) for lot in red_lots] for lot in lots: header = '' footer = '' - if id(lot) in bold_ids: - header = color.BOLD + if id(lot) in red_ids: + header = color.RED footer = color.END print header + str(lot) + footer raw_input('hit enter>') class NullLogger(object): - def print_progress(self, lots, text, bold_lots): + def print_progress(self, lots, text, red_lots): pass
8f815c41b505c01cbc1c57088ddc3a465f1ac07c
fmn/web/default_config.py
fmn/web/default_config.py
SECRET_KEY = 'changeme please' # TODO -- May I set this to true? FAS_OPENID_CHECK_CERT = False #ADMIN_GROUPS = ['sysadmin-web']
SECRET_KEY = 'changeme please' # TODO -- May I set this to true? FAS_OPENID_CHECK_CERT = False #ADMIN_GROUPS = ['sysadmin-web'] FMN_FEDORA_OPENID = 'https://id.fedoraproject.org'
Add a configuration key for the URL of the Fedora OpenID server
Add a configuration key for the URL of the Fedora OpenID server
Python
lgpl-2.1
jeremycline/fmn,jeremycline/fmn,jeremycline/fmn
--- +++ @@ -4,3 +4,5 @@ FAS_OPENID_CHECK_CERT = False #ADMIN_GROUPS = ['sysadmin-web'] + +FMN_FEDORA_OPENID = 'https://id.fedoraproject.org'
c0c3d63c6124549008a2dc17c1e691e799129444
plex2myshows/modules/plex/plex.py
plex2myshows/modules/plex/plex.py
class Plex(object): def __init__(self, plex): self.plex = plex def get_watched_episodes(self, section_name): watched_episodes = set(self.plex.library.section(section_name).searchEpisodes(unwatched=False)) return watched_episodes
class Plex(object): def __init__(self, plex): self.plex = plex def get_watched_episodes(self, section_name): watched_episodes = [] shows = self.plex.library.section(section_name).searchShows() for show in shows: watched_episodes.extend(show.watched()) return watched_episodes
Fix getting unwatched episodes from Plex
Fix getting unwatched episodes from Plex
Python
mit
verdel/plex2myshows
--- +++ @@ -3,5 +3,8 @@ self.plex = plex def get_watched_episodes(self, section_name): - watched_episodes = set(self.plex.library.section(section_name).searchEpisodes(unwatched=False)) + watched_episodes = [] + shows = self.plex.library.section(section_name).searchShows() + for show in shows: + watched_episodes.extend(show.watched()) return watched_episodes
b34c8b94202294f63ff88d2d8085222bfa50dc46
candidates/csv_helpers.py
candidates/csv_helpers.py
from __future__ import unicode_literals from compat import BufferDictWriter from .models import CSV_ROW_FIELDS def _candidate_sort_by_name_key(row): return ( row['name'].split()[-1], not row['election_current'], row['election_date'], row['election'], row['post_label'] ) def _candidate_sort_by_post_key(row): return ( not row['election_current'], row['election_date'], row['election'], row['post_label'], row['name'].split()[-1]) def list_to_csv(candidates_list, group_by_post=False): from .election_specific import EXTRA_CSV_ROW_FIELDS csv_fields = CSV_ROW_FIELDS + EXTRA_CSV_ROW_FIELDS writer = BufferDictWriter(fieldnames=csv_fields) writer.writeheader() if group_by_post: sorted_rows = sorted(candidates_list, key=_candidate_sort_by_post_key) else: sorted_rows = sorted(candidates_list, key=_candidate_sort_by_name_key) for row in sorted_rows: writer.writerow(row) return writer.output
from __future__ import unicode_literals from compat import BufferDictWriter from .models import CSV_ROW_FIELDS def _candidate_sort_by_name_key(row): return ( row['name'].split()[-1], row['name'].rsplit(None, 1)[0], not row['election_current'], row['election_date'], row['election'], row['post_label'] ) def _candidate_sort_by_post_key(row): return ( not row['election_current'], row['election_date'], row['election'], row['post_label'], row['name'].split()[-1], row['name'].rsplit(None, 1)[0], ) def list_to_csv(candidates_list, group_by_post=False): from .election_specific import EXTRA_CSV_ROW_FIELDS csv_fields = CSV_ROW_FIELDS + EXTRA_CSV_ROW_FIELDS writer = BufferDictWriter(fieldnames=csv_fields) writer.writeheader() if group_by_post: sorted_rows = sorted(candidates_list, key=_candidate_sort_by_post_key) else: sorted_rows = sorted(candidates_list, key=_candidate_sort_by_name_key) for row in sorted_rows: writer.writerow(row) return writer.output
Sort on first name after last name
Sort on first name after last name
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -7,6 +7,7 @@ def _candidate_sort_by_name_key(row): return ( row['name'].split()[-1], + row['name'].rsplit(None, 1)[0], not row['election_current'], row['election_date'], row['election'], @@ -19,7 +20,9 @@ row['election_date'], row['election'], row['post_label'], - row['name'].split()[-1]) + row['name'].split()[-1], + row['name'].rsplit(None, 1)[0], + ) def list_to_csv(candidates_list, group_by_post=False):
0ed07211d62044a42e1b0ff024f8feb20435270d
pombola/south_africa/views/api.py
pombola/south_africa/views/api.py
from django.http import JsonResponse from django.views.generic import ListView from pombola.core.models import Organisation # Output Popolo JSON suitable for WriteInPublic for any committees that have an # email address. class CommitteesPopoloJson(ListView): queryset = Organisation.objects.filter( kind__name='National Assembly Committees', contacts__kind__slug='email' ) def render_to_response(self, context, **response_kwargs): return JsonResponse( { 'persons': [ { 'id': committee.id, 'name': committee.name, 'email': committee.contacts.filter(kind__slug='email')[0].value, 'contact_details': [] } for committee in context['object_list'] ] } )
from django.http import JsonResponse from django.views.generic import ListView from pombola.core.models import Organisation # Output Popolo JSON suitable for WriteInPublic for any committees that have an # email address. class CommitteesPopoloJson(ListView): queryset = Organisation.objects.filter( kind__name='National Assembly Committees', contacts__kind__slug='email' ) def render_to_response(self, context, **response_kwargs): return JsonResponse( { 'persons': [ { 'id': str(committee.id), 'name': committee.name, 'email': committee.contacts.filter(kind__slug='email')[0].value, 'contact_details': [] } for committee in context['object_list'] ] } )
Use strings for IDs in Committee Popolo
Use strings for IDs in Committee Popolo
Python
agpl-3.0
mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola
--- +++ @@ -17,7 +17,7 @@ { 'persons': [ { - 'id': committee.id, + 'id': str(committee.id), 'name': committee.name, 'email': committee.contacts.filter(kind__slug='email')[0].value, 'contact_details': []
1a18445482c67b38810e330065e5ff04e772af4a
foundation/letters/migrations/0009_auto_20151216_0656.py
foundation/letters/migrations/0009_auto_20151216_0656.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def split_models(apps, schema_editor): # We can't import the Person model directly as it may be a newer # version than this migration expects. We use the historical version. L = apps.get_model("letters", "Letter") OL = apps.get_model("letters", "OutgoingLetter") IL = apps.get_model("letters", "IncomingLetter") for letter in L.objects.filter(incoming=True).all(): IL.objects.create(parent=letter, temp_from_email=letter.email, temp_sender=letter.sender_office) for letter in L.objects.filter(incoming=False).all(): OL.objects.create(parent=letter, temp_send_at=letter.send_at, temp_sender=letter.sender_user, temp_author=letter.author, temp_email=letter.email) class Migration(migrations.Migration): dependencies = [ ('letters', '0008_auto_20151216_0647'), ] operations = [ migrations.RunPython(split_models), ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def split_models(apps, schema_editor): # We can't import the Person model directly as it may be a newer # version than this migration expects. We use the historical version. L = apps.get_model("letters", "Letter") OL = apps.get_model("letters", "OutgoingLetter") IL = apps.get_model("letters", "IncomingLetter") for letter in L.objects.filter(incoming=True).all(): IL.objects.create(parent=letter, temp_email=letter.email, temp_sender=letter.sender_office) for letter in L.objects.filter(incoming=False).all(): OL.objects.create(parent=letter, temp_send_at=letter.send_at, temp_sender=letter.sender_user, temp_author=letter.author, temp_email=letter.email) class Migration(migrations.Migration): dependencies = [ ('letters', '0008_auto_20151216_0647'), ] operations = [ migrations.RunPython(split_models), ]
Fix from_email in IncomingLetter migrations
Fix from_email in IncomingLetter migrations
Python
bsd-3-clause
ad-m/foundation-manager,pilnujemy/pytamy,pilnujemy/pytamy,pilnujemy/pytamy,ad-m/foundation-manager,ad-m/foundation-manager,pilnujemy/pytamy,ad-m/foundation-manager
--- +++ @@ -13,7 +13,7 @@ for letter in L.objects.filter(incoming=True).all(): IL.objects.create(parent=letter, - temp_from_email=letter.email, + temp_email=letter.email, temp_sender=letter.sender_office) for letter in L.objects.filter(incoming=False).all(): OL.objects.create(parent=letter,
e47b7e5952d4001459aee5ba570a7cc6d4c10d43
tests/unit/directory/test_directory.py
tests/unit/directory/test_directory.py
"""Contains the unit tests for the inner directory package""" import unittest import os from classyfd import Directory class TestDirectory(unittest.TestCase): def setUp(self): self.fake_path = os.path.abspath("hello-world-dir") return def test_create_directory_object(self): d = Directory(self.fake_path) self.assertTrue(d) return if __name__ == "__main__": unittest.main()
"""Contains the unit tests for the inner directory package""" import unittest import os from classyfd import Directory, InvalidDirectoryValueError class TestDirectory(unittest.TestCase): def setUp(self): self.fake_path = os.path.abspath("hello-world-dir") return def test_create_directory_object(self): d = Directory(self.fake_path) self.assertTrue(d) return if __name__ == "__main__": unittest.main()
Add import of the InvalidDirectoryValueError to the directory package's test file
Add import of the InvalidDirectoryValueError to the directory package's test file
Python
mit
SizzlingVortex/classyfd
--- +++ @@ -3,7 +3,7 @@ import unittest import os -from classyfd import Directory +from classyfd import Directory, InvalidDirectoryValueError class TestDirectory(unittest.TestCase): def setUp(self): @@ -14,6 +14,8 @@ d = Directory(self.fake_path) self.assertTrue(d) return + + if __name__ == "__main__":
4b7b2727a35cfcb0117b0ba4571da9a0ea81824a
greenmine/base/routers.py
greenmine/base/routers.py
# -*- coding: utf-8 -*- from rest_framework import routers # Special router for actions. actions_router = routers.Route(url=r'^{prefix}/{methodname}{trailing_slash}$', mapping={'{httpmethod}': '{methodname}'}, name='{basename}-{methodnamehyphen}', initkwargs={}) class DefaultRouter(routers.DefaultRouter): routes = [ routers.DefaultRouter.routes[0], actions_router, routers.DefaultRouter.routes[2], routers.DefaultRouter.routes[1] ] __all__ = ["DefaultRouter"]
# -*- coding: utf-8 -*- from rest_framework import routers class DefaultRouter(routers.DefaultRouter): pass __all__ = ["DefaultRouter"]
Remove old reimplementation of routes.
Remove old reimplementation of routes.
Python
agpl-3.0
joshisa/taiga-back,joshisa/taiga-back,gam-phon/taiga-back,bdang2012/taiga-back-casting,jeffdwyatt/taiga-back,rajiteh/taiga-back,crr0004/taiga-back,crr0004/taiga-back,EvgeneOskin/taiga-back,dayatz/taiga-back,Rademade/taiga-back,joshisa/taiga-back,Rademade/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,coopsource/taiga-back,dycodedev/taiga-back,frt-arch/taiga-back,astagi/taiga-back,Rademade/taiga-back,astronaut1712/taiga-back,astagi/taiga-back,seanchen/taiga-back,Tigerwhit4/taiga-back,seanchen/taiga-back,dayatz/taiga-back,taigaio/taiga-back,Tigerwhit4/taiga-back,gauravjns/taiga-back,jeffdwyatt/taiga-back,EvgeneOskin/taiga-back,joshisa/taiga-back,forging2012/taiga-back,Zaneh-/bearded-tribble-back,obimod/taiga-back,forging2012/taiga-back,Tigerwhit4/taiga-back,gauravjns/taiga-back,gam-phon/taiga-back,taigaio/taiga-back,obimod/taiga-back,astronaut1712/taiga-back,rajiteh/taiga-back,gauravjns/taiga-back,gam-phon/taiga-back,coopsource/taiga-back,WALR/taiga-back,Zaneh-/bearded-tribble-back,Zaneh-/bearded-tribble-back,jeffdwyatt/taiga-back,jeffdwyatt/taiga-back,xdevelsistemas/taiga-back-community,gauravjns/taiga-back,astagi/taiga-back,CoolCloud/taiga-back,obimod/taiga-back,bdang2012/taiga-back-casting,CoolCloud/taiga-back,seanchen/taiga-back,Rademade/taiga-back,Tigerwhit4/taiga-back,coopsource/taiga-back,dycodedev/taiga-back,crr0004/taiga-back,rajiteh/taiga-back,CMLL/taiga-back,CMLL/taiga-back,xdevelsistemas/taiga-back-community,CoolCloud/taiga-back,CMLL/taiga-back,dycodedev/taiga-back,WALR/taiga-back,Rademade/taiga-back,bdang2012/taiga-back-casting,obimod/taiga-back,WALR/taiga-back,xdevelsistemas/taiga-back-community,rajiteh/taiga-back,dayatz/taiga-back,astronaut1712/taiga-back,WALR/taiga-back,seanchen/taiga-back,19kestier/taiga-back,frt-arch/taiga-back,CMLL/taiga-back,EvgeneOskin/taiga-back,19kestier/taiga-back,bdang2012/taiga-back-casting,forging2012/taiga-back,astagi/taiga-back,crr0004/taiga-back,coopsource/taiga-back,frt-arch/taiga-back,19kestier/taiga-back,EvgeneOskin/taiga-back,dycodedev/taiga-back,CoolCloud/taiga-back,taigaio/taiga-back,gam-phon/taiga-back
--- +++ @@ -2,20 +2,9 @@ from rest_framework import routers -# Special router for actions. -actions_router = routers.Route(url=r'^{prefix}/{methodname}{trailing_slash}$', - mapping={'{httpmethod}': '{methodname}'}, - name='{basename}-{methodnamehyphen}', - initkwargs={}) - class DefaultRouter(routers.DefaultRouter): - routes = [ - routers.DefaultRouter.routes[0], - actions_router, - routers.DefaultRouter.routes[2], - routers.DefaultRouter.routes[1] - ] + pass __all__ = ["DefaultRouter"]
d896082b282d17616573de2bcca4b383420d1e7a
python/__init__.py
python/__init__.py
# -*- coding: UTF-8 -*- # Copyright (C) 2009 Itaapy, ArsAperta, Pierlis, Talend # Import from itools from itools.pkg import get_version __version__ = get_version()
# -*- coding: UTF-8 -*- # Copyright (C) 2009 Itaapy, ArsAperta, Pierlis, Talend # Import from itools from itools.core import get_version __version__ = get_version()
Fix a bad import (get_version)
Fix a bad import (get_version)
Python
apache-2.0
Agicia/lpod-python,lpod/lpod-docs,Agicia/lpod-python,lpod/lpod-docs
--- +++ @@ -2,7 +2,7 @@ # Copyright (C) 2009 Itaapy, ArsAperta, Pierlis, Talend # Import from itools -from itools.pkg import get_version +from itools.core import get_version __version__ = get_version()
b78ce84f2a36789fc0fbb6b184b5c8d8ebb23234
run_tests.py
run_tests.py
#!/usr/bin/env python import sys import pytest if __name__ == '__main__': sys.exit(pytest.main())
#!/usr/bin/env python import sys import pytest if __name__ == '__main__': # show output results from every test function args = ['-v'] # show the message output for skipped and expected failure tests args.append('-rxs') # compute coverage stats for bluesky args.extend(['--cov', 'bluesky']) # call pytest and exit with the return code from pytest so that # travis will fail correctly if tests fail sys.exit(pytest.main(args))
Clarify py.test arguments in run_test.py
TST: Clarify py.test arguments in run_test.py
Python
bsd-3-clause
ericdill/bluesky,ericdill/bluesky
--- +++ @@ -3,4 +3,12 @@ import pytest if __name__ == '__main__': - sys.exit(pytest.main()) + # show output results from every test function + args = ['-v'] + # show the message output for skipped and expected failure tests + args.append('-rxs') + # compute coverage stats for bluesky + args.extend(['--cov', 'bluesky']) + # call pytest and exit with the return code from pytest so that + # travis will fail correctly if tests fail + sys.exit(pytest.main(args))
d043eef098be68690b9d6cd5790b667cdb2d825b
runserver.py
runserver.py
from wKRApp import app app.secret_key = "my precious" # 2 security flaws, need to sort out app.run(debug=True)
from wKRApp import app # 2 security flaws, need to sort out # 1. the key should be randomy generated # 2. the key should be set in a config file that is then imported in. app.secret_key = "my precious" app.run(debug=True)
Add comments about security issue
style(comments): Add comments about security issue - Added comments about two security issues relating to the session secret key
Python
mit
stuffy-the-dragon/wKRApp,bafana5/wKRApp,stuffy-the-dragon/wKRApp,stuffy-the-dragon/wKRApp,bafana5/wKRApp,bafana5/wKRApp
--- +++ @@ -1,3 +1,6 @@ from wKRApp import app -app.secret_key = "my precious" # 2 security flaws, need to sort out + # 2 security flaws, need to sort out + # 1. the key should be randomy generated + # 2. the key should be set in a config file that is then imported in. +app.secret_key = "my precious" app.run(debug=True)
803368f1741a9558ea84092dc975c1a10f51fa79
administracion/urls.py
administracion/urls.py
from django.conf.urls import url from .views import admin_main_dashboard, admin_users_dashboard, \ admin_users_create, admin_users_edit, admin_users_edit_form, \ admin_users_delete_modal, admin_users_delete, list_studies app_name = 'administracion' # Urls en espanol urlpatterns = [ url(r'^principal/', admin_main_dashboard, name='main'), url(r'^usuarios/nuevo/', admin_users_create, name='users_add'), url(r'^usuarios/editar/(\d+)/', admin_users_edit_form, name='users_edit_form'), url(r'^usuarios/editar/guardar/', admin_users_edit, name='users_edit'), url(r'^usuarios/borrar/(\d+)/', admin_users_delete_modal, name='users_delete_modal'), url(r'^usuarios/borrar/confirmar/', admin_users_delete, name='users_delete'), url(r'^usuarios/', admin_users_dashboard, name='users'), url(r'^principal/(?P<status_study>[\w\-]+)/$', list_studies, name='main_estudios'), ]
from django.conf.urls import url from .views import admin_main_dashboard, admin_users_dashboard, \ admin_users_create, admin_users_edit, admin_users_edit_form, \ admin_users_delete_modal, admin_users_delete, list_studies app_name = 'administracion' # Urls en espanol urlpatterns = [ url(r'^principal/$', admin_main_dashboard, name='main'), url(r'^usuarios/nuevo/', admin_users_create, name='users_add'), url(r'^usuarios/editar/(\d+)/', admin_users_edit_form, name='users_edit_form'), url(r'^usuarios/editar/guardar/', admin_users_edit, name='users_edit'), url(r'^usuarios/borrar/(\d+)/', admin_users_delete_modal, name='users_delete_modal'), url(r'^usuarios/borrar/confirmar/', admin_users_delete, name='users_delete'), url(r'^usuarios/', admin_users_dashboard, name='users'), url(r'^principal/(?P<status_study>[\w\-]+)/$', list_studies, name='main_estudios'), ]
Change url in dashboard administrador
Change url in dashboard administrador
Python
mit
erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online
--- +++ @@ -7,7 +7,7 @@ # Urls en espanol urlpatterns = [ - url(r'^principal/', admin_main_dashboard, name='main'), + url(r'^principal/$', admin_main_dashboard, name='main'), url(r'^usuarios/nuevo/', admin_users_create, name='users_add'), url(r'^usuarios/editar/(\d+)/', admin_users_edit_form, name='users_edit_form'), url(r'^usuarios/editar/guardar/', admin_users_edit, name='users_edit'),
3450712ec629c1720b6a6af28835d95a91b8fce7
setup.py
setup.py
#!/usr/bin/python import os import re from setuptools import setup from m2r import parse_from_file import restructuredtext_lint # Parser README.md into reStructuredText format rst_readme = parse_from_file('README.md') # Validate the README, checking for errors errors = restructuredtext_lint.lint(rst_readme) # Raise an exception for any errors found if errors: print(rst_readme) raise ValueError('README.md contains errors: ', ', '.join([e.message for e in errors])) # Attempt to get version number from TravisCI environment variable version = os.environ.get('TRAVIS_TAG', default='0.0.0') # Remove leading 'v' version = re.sub('^v', '', version) setup( name='anybadge', description='Simple, flexible badge generator for project badges.', long_description=rst_readme, version=version, author='Jon Grace-Cox', author_email='jongracecox@gmail.com', py_modules=['anybadge', 'anybadge_server'], setup_requires=['setuptools', 'wheel'], tests_require=['unittest'], install_requires=[], data_files=[], options={ 'bdist_wheel': {'universal': True} }, url='https://github.com/jongracecox/anybadge', entry_points={ 'console_scripts': ['anybadge=anybadge:main', 'anybadge-server=anybadge_server:main'], } )
#!/usr/bin/python import os import re from setuptools import setup from m2r import parse_from_file import restructuredtext_lint # Parser README.md into reStructuredText format rst_readme = parse_from_file('README.md') # Validate the README, checking for errors errors = restructuredtext_lint.lint(rst_readme) # Raise an exception for any errors found if errors: print(rst_readme) raise ValueError('README.md contains errors: ', ', '.join([e.message for e in errors])) # Attempt to get version number from TravisCI environment variable version = os.environ.get('TRAVIS_TAG', default='0.0.0') # Remove leading 'v' version = re.sub('^v', '', version) setup( name='anybadge', description='Simple, flexible badge generator for project badges.', long_description=rst_readme, version=version, author='Jon Grace-Cox', author_email='jongracecox@gmail.com', py_modules=['anybadge', 'anybadge_server'], setup_requires=['setuptools', 'wheel'], tests_require=['unittest'], install_requires=[], data_files=[], options={ 'bdist_wheel': {'universal': True} }, url='https://github.com/jongracecox/anybadge', entry_points={ 'console_scripts': ['anybadge=anybadge:main', 'anybadge-server=anybadge_server:main'], }, classifiers=[ 'License :: OSI Approved :: MIT License' ] )
Use classifiers to specify the license.
Use classifiers to specify the license. Classifiers are a standard way of specifying a license, and make it easy for automated tools to properly detect the license of the package. The "license" field should only be used if the license has no corresponding Trove classifier.
Python
mit
jongracecox/anybadge,jongracecox/anybadge
--- +++ @@ -42,5 +42,8 @@ entry_points={ 'console_scripts': ['anybadge=anybadge:main', 'anybadge-server=anybadge_server:main'], - } + }, + classifiers=[ + 'License :: OSI Approved :: MIT License' + ] )
e2e6cdac88ee03f78713ac4a50d0003a471a0027
setup.py
setup.py
from setuptools import setup long_description = open('README.rst').read() setup( name="celery-redbeat", description="A Celery Beat Scheduler using Redis for persistent storage", long_description=long_description, version="2.0.0", url="https://github.com/sibson/redbeat", license="Apache License, Version 2.0", author="Marc Sibson", author_email="sibson+redbeat@gmail.com", keywords="python celery beat redis".split(), packages=["redbeat"], classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: Apache Software License', 'Topic :: System :: Distributed Computing', 'Topic :: Software Development :: Object Brokering', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', 'Operating System :: OS Independent', ], install_requires=['redis>=3.2', 'celery>=4.2', 'python-dateutil', 'tenacity'], tests_require=['pytest'], )
from setuptools import setup long_description = open('README.rst').read() setup( name="celery-redbeat", description="A Celery Beat Scheduler using Redis for persistent storage", long_description=long_description, version="2.0.0", url="https://github.com/sibson/redbeat", license="Apache License, Version 2.0", author="Marc Sibson", author_email="sibson+redbeat@gmail.com", keywords="python celery beat redis".split(), packages=["redbeat"], classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: Apache Software License', 'Topic :: System :: Distributed Computing', 'Topic :: Software Development :: Object Brokering', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Operating System :: OS Independent', ], install_requires=['redis>=3.2', 'celery>=4.2', 'python-dateutil', 'tenacity'], tests_require=['pytest'], )
Add Python 3.9 to the list of supported versions.
Add Python 3.9 to the list of supported versions.
Python
apache-2.0
sibson/redbeat
--- +++ @@ -23,6 +23,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Operating System :: OS Independent', ],
38fb1ef71f827ff8483984ed9b7844dbdd945643
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup( name='Dapi', version='1.0', description='DevAssistant Package Index', author='Miro Hroncok', author_email='mhroncok@redhat.com', url='https://github.com/hroncok/dapi', license='AGPLv3', install_requires=[ 'Django==1.6', 'psycopg2', 'South', 'daploader>=0.0.5', 'PyYAML', 'python-social-auth', 'django-taggit', 'django-simple-captcha', 'django-haystack', 'whoosh', 'djangorestframework', 'django-gravatar2', 'markdown2', 'Markdown', ], dependency_links = [ 'git+git://github.com/omab/python-social-auth.git@c5dd3339#egg=python-social-auth', 'git+git://github.com/tomchristie/django-rest-framework.git@03b4c60b#egg=djangorestframework', ] )
#!/usr/bin/env python from setuptools import setup setup( name='Dapi', version='1.0', description='DevAssistant Package Index', author='Miro Hroncok', author_email='mhroncok@redhat.com', url='https://github.com/hroncok/dapi', license='AGPLv3', install_requires=[ 'Django==1.6', 'psycopg2', 'South', 'daploader>=0.0.5', 'PyYAML', 'python-social-auth', 'django-taggit', 'django-simple-captcha', 'django-haystack', 'whoosh', 'djangorestframework', 'django-gravatar2', 'markdown2', 'Markdown', ], dependency_links = [ 'git+git://github.com/omab/python-social-auth.git@c5dd3339#egg=python-social-auth', 'git+git://github.com/tomchristie/django-rest-framework.git@03b4c60b#egg=djangorestframework', 'https://pypi.python.org/packages/source/d/daploader/daploader-0.0.5.tar.gz' ] )
Add dependency link to daploader from pypi to overide Openshift's cache
Add dependency link to daploader from pypi to overide Openshift's cache
Python
agpl-3.0
devassistant/dapi,devassistant/dapi,devassistant/dapi
--- +++ @@ -29,5 +29,6 @@ dependency_links = [ 'git+git://github.com/omab/python-social-auth.git@c5dd3339#egg=python-social-auth', 'git+git://github.com/tomchristie/django-rest-framework.git@03b4c60b#egg=djangorestframework', + 'https://pypi.python.org/packages/source/d/daploader/daploader-0.0.5.tar.gz' ] )
04a31c02c8186505e6e211e76903e5f1b62b3f90
setup.py
setup.py
from distutils.core import setup, Extension setup(name='python-pytun', author='montag451', author_email='montag451 at laposte.net', maintainer='montag451', maintainer_email='montag451 at laposte.net', url='https://github.com/montag451/pytun', description='Linux TUN/TAP wrapper for Python', long_description=open('README.rst').read(), version='2.2', ext_modules=[Extension('pytun', ['pytun.c'])], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX :: Linux', 'Programming Language :: C', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: System :: Networking'])
from distutils.core import setup, Extension setup(name='python-pytun', author='montag451', author_email='montag451 at laposte.net', maintainer='montag451', maintainer_email='montag451 at laposte.net', url='https://github.com/montag451/pytun', description='Linux TUN/TAP wrapper for Python', long_description=open('README.rst').read(), version='2.2.1', ext_modules=[Extension('pytun', ['pytun.c'])], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX :: Linux', 'Programming Language :: C', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: System :: Networking'])
Change version number (v2.2 -> v2.2.1)
Change version number (v2.2 -> v2.2.1)
Python
mit
montag451/pytun,montag451/pytun
--- +++ @@ -8,7 +8,7 @@ url='https://github.com/montag451/pytun', description='Linux TUN/TAP wrapper for Python', long_description=open('README.rst').read(), - version='2.2', + version='2.2.1', ext_modules=[Extension('pytun', ['pytun.c'])], classifiers=[ 'Development Status :: 5 - Production/Stable',
6ab083eede68946f4a87d24732cd82be09734d52
setup.py
setup.py
import os from setuptools import setup longDesc = "" if os.path.exists("README.md"): longDesc = open("README.md").read().strip() setup( name = "pytesseract", version = "0.1.6", author = "Samuel Hoffstaetter", author_email="", maintainer = "Matthias Lee", maintainer_email = "pytesseract@madmaze.net", description = ("Python-tesseract is a python wrapper for google's Tesseract-OCR"), long_description = longDesc, license = "GPLv3", keywords = "python-tesseract OCR Python", url = "https://github.com/madmaze/python-tesseract", packages=['pytesseract'], package_dir={'pytesseract': 'src'}, package_data = {'pytesseract': ['*.png','*.jpg']}, entry_points = {'console_scripts': ['pytesseract = pytesseract.pytesseract:main']}, classifiers = [ 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', ] )
import os from setuptools import setup longDesc = "" if os.path.exists("README.rst"): longDesc = open("README.rst").read().strip() setup( name = "pytesseract", version = "0.1.6", author = "Samuel Hoffstaetter", author_email="", maintainer = "Matthias Lee", maintainer_email = "pytesseract@madmaze.net", description = ("Python-tesseract is a python wrapper for google's Tesseract-OCR"), long_description = longDesc, license = "GPLv3", keywords = "python-tesseract OCR Python", url = "https://github.com/madmaze/python-tesseract", packages=['pytesseract'], package_dir={'pytesseract': 'src'}, package_data = {'pytesseract': ['*.png','*.jpg']}, entry_points = {'console_scripts': ['pytesseract = pytesseract.pytesseract:main']}, classifiers = [ 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', ] )
Update the long_description with README.rst
Update the long_description with README.rst
Python
apache-2.0
madmaze/pytesseract
--- +++ @@ -3,8 +3,8 @@ longDesc = "" -if os.path.exists("README.md"): - longDesc = open("README.md").read().strip() +if os.path.exists("README.rst"): + longDesc = open("README.rst").read().strip() setup( name = "pytesseract",
1ba7e00ac7ef7f22aed22833940d3666d7584deb
setup.py
setup.py
from setuptools import setup setup( name='tangled.sqlalchemy', version='0.1a3.dev0', description='Tangled SQLAlchemy integration', long_description=open('README.rst').read(), url='http://tangledframework.org/', download_url='https://github.com/TangledWeb/tangled.sqlalchemy/tags', author='Wyatt Baldwin', author_email='self@wyattbaldwin.com', packages=[ 'tangled', 'tangled.sqlalchemy', ], install_requires=[ 'tangled>=0.1a5', 'SQLAlchemy', ], extras_require={ 'dev': [ 'tangled[dev]>=0.1a5', ], }, classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ], )
from setuptools import setup setup( name='tangled.sqlalchemy', version='0.1a3.dev0', description='Tangled SQLAlchemy integration', long_description=open('README.rst').read(), url='http://tangledframework.org/', download_url='https://github.com/TangledWeb/tangled.sqlalchemy/tags', author='Wyatt Baldwin', author_email='self@wyattbaldwin.com', packages=[ 'tangled', 'tangled.sqlalchemy', ], install_requires=[ 'tangled>=0.1a5', 'SQLAlchemy', ], extras_require={ 'dev': [ 'tangled[dev]>=0.1a5', ], }, classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ], )
Add generic Python 3 trove classifier
Add generic Python 3 trove classifier
Python
mit
TangledWeb/tangled.sqlalchemy
--- +++ @@ -27,6 +27,7 @@ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ],
a84159df875f6a07300deb8f98224f92e0578445
setup.py
setup.py
import os from os.path import relpath, join from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def find_package_data(data_root, package_root): files = [] for root, dirnames, filenames in os.walk(data_root): for fn in filenames: files.append(relpath(join(root, fn), package_root)) return files setup( name = "smarty", version = "0.1.5", author = "John Chodera, David Mobley, and others", author_email = "john.chodera@choderalab.org", description = ("Automated Bayesian atomtype sampling"), license = "MIT", keywords = "Bayesian atomtype sampling forcefield parameterization", url = "http://github.com/open-forcefield-group/smarty", packages=['smarty', 'smarty/tests', 'smarty/data'], long_description=read('README.md'), classifiers=[ "Development Status :: 3 - Alpha", "Topic :: Utilities", "License :: OSI Approved :: MIT", ], entry_points={'console_scripts': ['smarty = smarty.cli_smarty:main', 'smirky = smarty.cli_smirky:main']}, package_data={'smarty': find_package_data('smarty/data', 'smarty')}, )
import os from os.path import relpath, join from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def find_package_data(data_root, package_root): files = [] for root, dirnames, filenames in os.walk(data_root): for fn in filenames: files.append(relpath(join(root, fn), package_root)) return files setup( name = "smarty", version = "0.1.6", author = "John Chodera, David Mobley, and others", author_email = "john.chodera@choderalab.org", description = ("Automated Bayesian atomtype sampling"), license = "MIT", keywords = "Bayesian atomtype sampling forcefield parameterization", url = "http://github.com/open-forcefield-group/smarty", packages=['smarty', 'smarty/tests', 'smarty/data'], long_description=read('README.md'), classifiers=[ "Development Status :: 3 - Alpha", "Topic :: Utilities", "License :: OSI Approved :: MIT", ], entry_points={'console_scripts': ['smarty = smarty.cli_smarty:main', 'smirky = smarty.cli_smirky:main']}, package_data={'smarty': find_package_data('smarty/data', 'smarty')}, )
Increment version number now that 0.1.5 release out.
Increment version number now that 0.1.5 release out.
Python
mit
open-forcefield-group/openforcefield,open-forcefield-group/openforcefield,openforcefield/openff-toolkit,open-forcefield-group/openforcefield,openforcefield/openff-toolkit
--- +++ @@ -14,7 +14,7 @@ setup( name = "smarty", - version = "0.1.5", + version = "0.1.6", author = "John Chodera, David Mobley, and others", author_email = "john.chodera@choderalab.org", description = ("Automated Bayesian atomtype sampling"),
fb166c2afa110b758efbc8aeae9ff177050bfa0c
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup import sys setup(name="OnionLauncher", version="0.0.1", description="Launcher for Tor", license = "BSD", author="Neel Chauhan", author_email="neel@neelc.org", url="https://www.github.com/neelchauhan/OnionLauncher/", packages=["OnionLauncher"], entry_points={'gui_scripts': ['OnionLauncher=OnionLauncher.main:main_loop']}, package_data={"OnionLauncher": ["data/*"]}, install_requires=[ "stem", ], data_files=[ (sys.prefix + "/share/pixmaps", ["icons/scalable/onionlauncher.svg"]), (sys.prefix + "/share/applications", ["data/onionlauncher.desktop"]), ], classifiers=[ "Environment :: X11 Applications :: Qt", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", ], )
#!/usr/bin/env python from setuptools import setup import sys setup(name="OnionLauncher", version="0.0.1", description="Launcher for Tor", license = "BSD", author="Neel Chauhan", author_email="neel@neelc.org", url="https://www.github.com/neelchauhan/OnionLauncher/", packages=["OnionLauncher"], entry_points={'gui_scripts': ['OnionLauncher=OnionLauncher.main:main_loop']}, package_data={"OnionLauncher": ["ui_files/*"]}, install_requires=[ "stem", ], data_files=[ (sys.prefix + "/share/pixmaps", ["icons/scalable/onionlauncher.svg"]), (sys.prefix + "/share/applications", ["data/onionlauncher.desktop"]), ], classifiers=[ "Environment :: X11 Applications :: Qt", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", ], )
Add correct filename in OnionLauncher ui directory
Add correct filename in OnionLauncher ui directory
Python
bsd-2-clause
neelchauhan/OnionLauncher
--- +++ @@ -12,7 +12,7 @@ url="https://www.github.com/neelchauhan/OnionLauncher/", packages=["OnionLauncher"], entry_points={'gui_scripts': ['OnionLauncher=OnionLauncher.main:main_loop']}, - package_data={"OnionLauncher": ["data/*"]}, + package_data={"OnionLauncher": ["ui_files/*"]}, install_requires=[ "stem", ],
3352920f7e92e2732eb2914313bdee6b5ab7f549
setup.py
setup.py
# -*- coding: utf-8 -*- # Copyright (C) 2012-2014 MUJIN Inc from distutils.core import setup try: from mujincommon.setuptools import Distribution except ImportError: from distutils.dist import Distribution version = {} exec(open('python/mujincontrollerclient/version.py').read(), version) setup( distclass=Distribution, name='mujincontrollerclient', version=version['__version__'], packages=['mujincontrollerclient'], package_dir={'mujincontrollerclient': 'python/mujincontrollerclient'}, scripts=['bin/mujin_controllerclientpy_registerscene.py', 'bin/mujin_controllerclientpy_applyconfig.py'], locale_dir='locale', license='Apache License, Version 2.0', long_description=open('README.rst').read(), # flake8 compliance configuration enable_flake8=True, # Enable checks fail_on_flake=True, # Fail builds when checks fail install_requires=[], )
# -*- coding: utf-8 -*- # Copyright (C) 2012-2014 MUJIN Inc from distutils.core import setup try: from mujincommon.setuptools import Distribution except ImportError: from distutils.dist import Distribution version = {} exec(open('python/mujincontrollerclient/version.py').read(), version) setup( distclass=Distribution, name='mujincontrollerclient', version=version['__version__'], packages=['mujincontrollerclient'], package_dir={'mujincontrollerclient': 'python/mujincontrollerclient'}, data_files=[ # using scripts= will cause the first line of the script being modified for python2 or python3 # put the scripts in data_files will copy them as-is ('bin', ['bin/mujin_controllerclientpy_registerscene.py', 'bin/mujin_controllerclientpy_applyconfig.py']), ], locale_dir='locale', license='Apache License, Version 2.0', long_description=open('README.rst').read(), # flake8 compliance configuration enable_flake8=True, # Enable checks fail_on_flake=True, # Fail builds when checks fail install_requires=[], )
Fix bin scripts having python2 or python3 specific path.
Fix bin scripts having python2 or python3 specific path.
Python
apache-2.0
mujin/mujincontrollerclientpy
--- +++ @@ -15,7 +15,11 @@ version=version['__version__'], packages=['mujincontrollerclient'], package_dir={'mujincontrollerclient': 'python/mujincontrollerclient'}, - scripts=['bin/mujin_controllerclientpy_registerscene.py', 'bin/mujin_controllerclientpy_applyconfig.py'], + data_files=[ + # using scripts= will cause the first line of the script being modified for python2 or python3 + # put the scripts in data_files will copy them as-is + ('bin', ['bin/mujin_controllerclientpy_registerscene.py', 'bin/mujin_controllerclientpy_applyconfig.py']), + ], locale_dir='locale', license='Apache License, Version 2.0', long_description=open('README.rst').read(),
16d509f2ff1af0f7588f302323c883edcd4384b4
setup.py
setup.py
#!/usr/bin/env python import os import sys import shutil import setuptools.command.egg_info as egg_info_cmd from setuptools import setup, find_packages SETUP_DIR = os.path.dirname(__file__) README = os.path.join(SETUP_DIR, 'README.rst') try: import gittaggers tagger = gittaggers.EggInfoFromGit except ImportError: tagger = egg_info_cmd.egg_info setup(name='cwltest', version='1.0', description='Common workflow language testing framework', long_description=open(README).read(), author='Common workflow language working group', author_email='common-workflow-language@googlegroups.com', url="https://github.com/common-workflow-language/cwltest", download_url="https://github.com/common-workflow-language/cwltest", license='Apache 2.0', packages=["cwltest"], install_requires=[ 'schema-salad >= 1.17', 'typing >= 3.5.2' ], tests_require=[], entry_points={ 'console_scripts': [ "cwltest=cwltest:main" ] }, zip_safe=True, cmdclass={'egg_info': tagger}, )
#!/usr/bin/env python import os import sys import shutil import setuptools.command.egg_info as egg_info_cmd from setuptools import setup, find_packages SETUP_DIR = os.path.dirname(__file__) README = os.path.join(SETUP_DIR, 'README.rst') try: import gittaggers tagger = gittaggers.EggInfoFromGit except ImportError: tagger = egg_info_cmd.egg_info setup(name='cwltest', version='1.0', description='Common workflow language testing framework', long_description=open(README).read(), author='Common workflow language working group', author_email='common-workflow-language@googlegroups.com', url="https://github.com/common-workflow-language/cwltest", download_url="https://github.com/common-workflow-language/cwltest", license='Apache 2.0', packages=["cwltest"], install_requires=[ 'schema-salad >= 1.14', 'typing >= 3.5.2' ], tests_require=[], entry_points={ 'console_scripts': [ "cwltest=cwltest:main" ] }, zip_safe=True, cmdclass={'egg_info': tagger}, )
Move schema salad minimum version back to earlier version.
Move schema salad minimum version back to earlier version.
Python
apache-2.0
common-workflow-language/cwltest,common-workflow-language/cwltest
--- +++ @@ -27,7 +27,7 @@ license='Apache 2.0', packages=["cwltest"], install_requires=[ - 'schema-salad >= 1.17', + 'schema-salad >= 1.14', 'typing >= 3.5.2' ], tests_require=[], entry_points={
fb3983017da558018fd0de7ef10a4c0e98bbb0ec
txircd/modules/cmd_user.py
txircd/modules/cmd_user.py
from twisted.words.protocols import irc from txircd.modbase import Command import string class UserCommand(Command): def onUse(self, user, data): if not user.username: user.registered -= 1 user.setUsername(data["ident"]) user.realname = data["gecos"] if user.registered == 0: user.register() def processParams(self, user, params): if user.registered == 0: user.sendMessage(irc.ERR_ALREADYREGISTRED, ":You may not reregister") return {} if params and len(params) < 4: user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Not enough parameters") return {} ident = filter(lambda x: x in string.ascii_letters + string.digits + "-_", params[0][:12]) if not ident: user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Your username is not valid") return {} return { "user": user, "ident": ident, "gecos": params[3] } class Spawner(object): def __init__(self, ircd): self.ircd = ircd def spawn(self): return { "commands": { "USER": UserCommand() } }
from twisted.words.protocols import irc from txircd.modbase import Command import string class UserCommand(Command): def onUse(self, user, data): if not user.username: user.registered -= 1 user.setUsername(data["ident"]) user.setRealname(data["gecos"]) if user.registered == 0: user.register() def processParams(self, user, params): if user.registered == 0: user.sendMessage(irc.ERR_ALREADYREGISTRED, ":You may not reregister") return {} if params and len(params) < 4: user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Not enough parameters") return {} ident = filter(lambda x: x in string.ascii_letters + string.digits + "-_", params[0][:12]) if not ident: user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Your username is not valid") return {} return { "user": user, "ident": ident, "gecos": params[3] } class Spawner(object): def __init__(self, ircd): self.ircd = ircd def spawn(self): return { "commands": { "USER": UserCommand() } }
Send the gecos input from USER through the sanitization as well
Send the gecos input from USER through the sanitization as well
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd,DesertBus/txircd
--- +++ @@ -7,7 +7,7 @@ if not user.username: user.registered -= 1 user.setUsername(data["ident"]) - user.realname = data["gecos"] + user.setRealname(data["gecos"]) if user.registered == 0: user.register()
a013af88adad469782d2f05a0b882c2f5500b6b8
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup( name='gallerize', version='0.3.1', description='Create a static HTML/CSS image gallery from a bunch of images.', author='Jochen Kupperschmidt', author_email='homework@nwsnet.de', url='http://homework.nwsnet.de/releases/cc0e/#gallerize', )
# -*- coding: utf-8 -*- from setuptools import setup def read_readme(): with open('README.rst') as f: return f.read() setup( name='gallerize', version='0.3.1', description='Create a static HTML/CSS image gallery from a bunch of images.', long_description=read_readme(), license='MIT', author='Jochen Kupperschmidt', author_email='homework@nwsnet.de', url='http://homework.nwsnet.de/releases/cc0e/#gallerize', )
Include README as long package description. Specified license.
Include README as long package description. Specified license.
Python
mit
TheLady/gallerize,TheLady/gallerize
--- +++ @@ -1,12 +1,19 @@ -#!/usr/bin/env python +# -*- coding: utf-8 -*- from setuptools import setup + + +def read_readme(): + with open('README.rst') as f: + return f.read() setup( name='gallerize', version='0.3.1', description='Create a static HTML/CSS image gallery from a bunch of images.', + long_description=read_readme(), + license='MIT', author='Jochen Kupperschmidt', author_email='homework@nwsnet.de', url='http://homework.nwsnet.de/releases/cc0e/#gallerize',
71acce577d1fc7d3366e1cc763433f18bbdfdc00
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setup( name="valideer", version="0.4.1", description="Lightweight data validation and adaptation library for Python", long_description=open("README.rst").read(), url="https://github.com/podio/valideer", author="George Sakkis", author_email="george.sakkis@gmail.com", packages=find_packages(), install_requires=["decorator"], test_suite="valideer.tests", platforms=["any"], keywords="validation adaptation typechecking jsonschema", classifiers=[ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "License :: OSI Approved :: MIT License", ], )
#!/usr/bin/env python from setuptools import setup, find_packages setup( name="valideer", version="0.4.1", description="Lightweight data validation and adaptation library for Python", long_description=open("README.rst").read(), url="https://github.com/podio/valideer", author="George Sakkis", author_email="george.sakkis@gmail.com", packages=find_packages(), install_requires=["decorator"], test_suite="valideer.tests", platforms=["any"], keywords="validation adaptation typechecking jsonschema", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules", "License :: OSI Approved :: MIT License", ], )
Upgrade status to Production/Stable and add specific python version to classifiers
Upgrade status to Production/Stable and add specific python version to classifiers
Python
mit
gsakkis/valideer,podio/valideer
--- +++ @@ -16,11 +16,14 @@ platforms=["any"], keywords="validation adaptation typechecking jsonschema", classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules", "License :: OSI Approved :: MIT License", ],
c96dfa0387380da023f72b77b2d159e400d2f491
setup.py
setup.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. from setuptools import setup PACKAGE_VERSION = '0.1' deps = ['fxos-appgen>=0.2.7', 'marionette_client>=0.7.1.1', 'marionette_extension >= 0.1', 'mozdevice >= 0.33', 'mozlog >= 1.8', 'moznetwork >= 0.24', 'mozprocess >= 0.18', 'wptserve >= 1.0.1', 'wptrunner >= 0.2.8, < 0.3'] setup(name='fxos-certsuite', version=PACKAGE_VERSION, description='Certification suite for FirefoxOS', classifiers=[], keywords='mozilla', author='Mozilla Automation and Testing Team', author_email='tools@lists.mozilla.org', url='https://github.com/mozilla-b2g/fxos-certsuite', license='MPL', packages=['certsuite'], include_package_data=True, zip_safe=False, install_requires=deps, entry_points=""" # -*- Entry points: -*- [console_scripts] runcertsuite = certsuite:harness_main cert = certsuite:certcli """)
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. from setuptools import setup PACKAGE_VERSION = '0.1' deps = ['fxos-appgen>=0.2.7', 'marionette_client>=0.7.1.1', 'marionette_extension >= 0.1', 'mozdevice >= 0.33', 'mozlog >= 1.8', 'moznetwork >= 0.24', 'mozprocess >= 0.18', 'wptserve >= 1.0.1', 'wptrunner >= 0.3'] setup(name='fxos-certsuite', version=PACKAGE_VERSION, description='Certification suite for FirefoxOS', classifiers=[], keywords='mozilla', author='Mozilla Automation and Testing Team', author_email='tools@lists.mozilla.org', url='https://github.com/mozilla-b2g/fxos-certsuite', license='MPL', packages=['certsuite'], include_package_data=True, zip_safe=False, install_requires=deps, entry_points=""" # -*- Entry points: -*- [console_scripts] runcertsuite = certsuite:harness_main cert = certsuite:certcli """)
Update to the latest version of wptrunner.
Update to the latest version of wptrunner.
Python
mpl-2.0
ypwalter/fxos-certsuite,mozilla-b2g/fxos-certsuite,ShakoHo/fxos-certsuite,Conjuror/fxos-certsuite,ShakoHo/fxos-certsuite,ypwalter/fxos-certsuite,oouyang/fxos-certsuite,ypwalter/fxos-certsuite,mozilla-b2g/fxos-certsuite,cr/fxos-certsuite,ypwalter/fxos-certsuite,oouyang/fxos-certsuite,askeing/fxos-certsuite,mozilla-b2g/fxos-certsuite,oouyang/fxos-certsuite,cr/fxos-certsuite,askeing/fxos-certsuite,askeing/fxos-certsuite,cr/fxos-certsuite,Conjuror/fxos-certsuite,mozilla-b2g/fxos-certsuite,ypwalter/fxos-certsuite,cr/fxos-certsuite,ypwalter/fxos-certsuite,Conjuror/fxos-certsuite,Conjuror/fxos-certsuite,ShakoHo/fxos-certsuite,mozilla-b2g/fxos-certsuite,mozilla-b2g/fxos-certsuite,ypwalter/fxos-certsuite,ShakoHo/fxos-certsuite,ShakoHo/fxos-certsuite,askeing/fxos-certsuite,cr/fxos-certsuite,cr/fxos-certsuite,oouyang/fxos-certsuite,ShakoHo/fxos-certsuite,askeing/fxos-certsuite,oouyang/fxos-certsuite,oouyang/fxos-certsuite,askeing/fxos-certsuite,oouyang/fxos-certsuite,askeing/fxos-certsuite,ShakoHo/fxos-certsuite,Conjuror/fxos-certsuite,mozilla-b2g/fxos-certsuite,Conjuror/fxos-certsuite,cr/fxos-certsuite,Conjuror/fxos-certsuite
--- +++ @@ -13,7 +13,7 @@ 'moznetwork >= 0.24', 'mozprocess >= 0.18', 'wptserve >= 1.0.1', - 'wptrunner >= 0.2.8, < 0.3'] + 'wptrunner >= 0.3'] setup(name='fxos-certsuite', version=PACKAGE_VERSION,
6da15fd8f95638d919e47fe1150acce5a9401745
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages import conveyor install_requires = [ "APScheduler", "forklift", "redis", "xmlrpc2", ] setup( name="conveyor", version=conveyor.__version__, description="Warehouse and PyPI Synchronization", long_description=open("README.rst").read(), url="https://github.com/crateio/conveyor/", license=open("LICENSE").read(), author="Donald Stufft", author_email="donald.stufft@gmail.com", install_requires=install_requires, packages=find_packages(exclude=["tests"]), zip_safe=False, )
#!/usr/bin/env python from setuptools import setup, find_packages import conveyor install_requires = [ "APScheduler", "forklift", "redis", "six", "xmlrpc2", ] setup( name="conveyor", version=conveyor.__version__, description="Warehouse and PyPI Synchronization", long_description=open("README.rst").read(), url="https://github.com/crateio/conveyor/", license=open("LICENSE").read(), author="Donald Stufft", author_email="donald.stufft@gmail.com", install_requires=install_requires, packages=find_packages(exclude=["tests"]), zip_safe=False, )
Add six to the requirements
Add six to the requirements
Python
bsd-2-clause
crateio/carrier
--- +++ @@ -8,6 +8,7 @@ "APScheduler", "forklift", "redis", + "six", "xmlrpc2", ]
7bab32ef89d760a8cf4aeb2700725ea88e3fc31c
tests/basics/builtin_hash.py
tests/basics/builtin_hash.py
# test builtin hash function print(hash(False)) print(hash(True)) print({():1}) # hash tuple print({1 << 66:1}) # hash big int print(hash in {hash:1}) # hash function try: hash([]) except TypeError: print("TypeError") class A: def __hash__(self): return 123 def __repr__(self): return "a instance" print(hash(A())) print({A():1}) # all user-classes have default __hash__ class B: pass hash(B()) # if __eq__ is defined then default __hash__ is not used class C: def __eq__(self, another): return True try: hash(C()) except TypeError: print("TypeError") # __hash__ must return an int class D: def __hash__(self): return None try: hash(D()) except TypeError: print("TypeError")
# test builtin hash function print(hash(False)) print(hash(True)) print({():1}) # hash tuple print({1 << 66:1}) # hash big int print(hash in {hash:1}) # hash function try: hash([]) except TypeError: print("TypeError") class A: def __hash__(self): return 123 def __repr__(self): return "a instance" print(hash(A())) print({A():1}) # all user-classes have default __hash__ class B: pass hash(B()) # if __eq__ is defined then default __hash__ is not used class C: def __eq__(self, another): return True try: hash(C()) except TypeError: print("TypeError") # __hash__ must return an int class D: def __hash__(self): return None try: hash(D()) except TypeError: print("TypeError") # __hash__ returning a bool should be converted to an int class E: def __hash__(self): return True print(hash(E())) # __hash__ returning a large number should be truncated class F: def __hash__(self): return 1 << 70 | 1 print(hash(F()) != 0)
Add further tests for class defining __hash__.
tests: Add further tests for class defining __hash__.
Python
mit
martinribelotta/micropython,puuu/micropython,ganshun666/micropython,suda/micropython,EcmaXp/micropython,ChuckM/micropython,mgyenik/micropython,pramasoul/micropython,infinnovation/micropython,bvernoux/micropython,xyb/micropython,lbattraw/micropython,adafruit/circuitpython,blazewicz/micropython,tobbad/micropython,kostyll/micropython,toolmacher/micropython,kostyll/micropython,chrisdearman/micropython,cwyark/micropython,dhylands/micropython,orionrobots/micropython,omtinez/micropython,trezor/micropython,lowRISC/micropython,ernesto-g/micropython,blmorris/micropython,kerneltask/micropython,lowRISC/micropython,stonegithubs/micropython,tralamazza/micropython,mpalomer/micropython,skybird6672/micropython,trezor/micropython,PappaPeppar/micropython,blmorris/micropython,cloudformdesign/micropython,mianos/micropython,ruffy91/micropython,mpalomer/micropython,dhylands/micropython,dinau/micropython,ericsnowcurrently/micropython,toolmacher/micropython,noahchense/micropython,galenhz/micropython,ceramos/micropython,ChuckM/micropython,adafruit/circuitpython,oopy/micropython,supergis/micropython,pramasoul/micropython,xhat/micropython,henriknelson/micropython,jimkmc/micropython,misterdanb/micropython,dxxb/micropython,ganshun666/micropython,martinribelotta/micropython,hiway/micropython,rubencabrera/micropython,jmarcelino/pycom-micropython,MrSurly/micropython-esp32,deshipu/micropython,orionrobots/micropython,bvernoux/micropython,mgyenik/micropython,deshipu/micropython,chrisdearman/micropython,orionrobots/micropython,pramasoul/micropython,skybird6672/micropython,tdautc19841202/micropython,ernesto-g/micropython,pramasoul/micropython,slzatz/micropython,ganshun666/micropython,pfalcon/micropython,vitiral/micropython,swegener/micropython,dinau/micropython,praemdonck/micropython,vitiral/micropython,TDAbboud/micropython,firstval/micropython,tuc-osg/micropython,tdautc19841202/micropython,omtinez/micropython,puuu/micropython,emfcamp/micropython,neilh10/micropython,cloudformdesign/micropython,orionrobots/micropython,drrk/micropython,Peetz0r/micropython-esp32,swegener/micropython,HenrikSolver/micropython,torwag/micropython,cnoviello/micropython,feilongfl/micropython,turbinenreiter/micropython,lowRISC/micropython,chrisdearman/micropython,pfalcon/micropython,neilh10/micropython,SHA2017-badge/micropython-esp32,ahotam/micropython,feilongfl/micropython,chrisdearman/micropython,adamkh/micropython,MrSurly/micropython,micropython/micropython-esp32,cwyark/micropython,adamkh/micropython,ruffy91/micropython,tralamazza/micropython,rubencabrera/micropython,henriknelson/micropython,selste/micropython,danicampora/micropython,blmorris/micropython,adafruit/circuitpython,suda/micropython,rubencabrera/micropython,jlillest/micropython,puuu/micropython,TDAbboud/micropython,hiway/micropython,suda/micropython,tdautc19841202/micropython,matthewelse/micropython,feilongfl/micropython,heisewangluo/micropython,matthewelse/micropython,stonegithubs/micropython,mianos/micropython,alex-march/micropython,Peetz0r/micropython-esp32,xyb/micropython,slzatz/micropython,hosaka/micropython,TDAbboud/micropython,selste/micropython,ceramos/micropython,MrSurly/micropython,HenrikSolver/micropython,misterdanb/micropython,skybird6672/micropython,adamkh/micropython,adamkh/micropython,henriknelson/micropython,ernesto-g/micropython,MrSurly/micropython,MrSurly/micropython-esp32,xyb/micropython,adafruit/circuitpython,neilh10/micropython,oopy/micropython,stonegithubs/micropython,MrSurly/micropython,martinribelotta/micropython,firstval/micropython,EcmaXp/micropython,ruffy91/micropython,TDAbboud/micropython,alex-robbins/micropython,neilh10/micropython,AriZuu/micropython,heisewangluo/micropython,bvernoux/micropython,xyb/micropython,TDAbboud/micropython,utopiaprince/micropython,noahchense/micropython,ahotam/micropython,hiway/micropython,tralamazza/micropython,jlillest/micropython,vriera/micropython,dinau/micropython,tuc-osg/micropython,slzatz/micropython,danicampora/micropython,adafruit/micropython,MrSurly/micropython,utopiaprince/micropython,drrk/micropython,skybird6672/micropython,dxxb/micropython,adafruit/circuitpython,pfalcon/micropython,kerneltask/micropython,infinnovation/micropython,Timmenem/micropython,dhylands/micropython,xuxiaoxin/micropython,stonegithubs/micropython,Peetz0r/micropython-esp32,pozetroninc/micropython,suda/micropython,galenhz/micropython,xuxiaoxin/micropython,mhoffma/micropython,deshipu/micropython,bvernoux/micropython,hosaka/micropython,danicampora/micropython,dmazzella/micropython,jlillest/micropython,ernesto-g/micropython,orionrobots/micropython,galenhz/micropython,noahwilliamsson/micropython,jmarcelino/pycom-micropython,ahotam/micropython,pozetroninc/micropython,toolmacher/micropython,galenhz/micropython,supergis/micropython,turbinenreiter/micropython,noahchense/micropython,martinribelotta/micropython,AriZuu/micropython,redbear/micropython,xhat/micropython,pfalcon/micropython,oopy/micropython,mpalomer/micropython,matthewelse/micropython,AriZuu/micropython,alex-robbins/micropython,tobbad/micropython,ryannathans/micropython,blazewicz/micropython,blmorris/micropython,supergis/micropython,mhoffma/micropython,tobbad/micropython,omtinez/micropython,tdautc19841202/micropython,suda/micropython,toolmacher/micropython,ceramos/micropython,dinau/micropython,feilongfl/micropython,ruffy91/micropython,xuxiaoxin/micropython,noahwilliamsson/micropython,stonegithubs/micropython,Timmenem/micropython,emfcamp/micropython,slzatz/micropython,vitiral/micropython,xhat/micropython,Peetz0r/micropython-esp32,ahotam/micropython,selste/micropython,infinnovation/micropython,heisewangluo/micropython,trezor/micropython,micropython/micropython-esp32,hosaka/micropython,torwag/micropython,heisewangluo/micropython,PappaPeppar/micropython,praemdonck/micropython,micropython/micropython-esp32,kostyll/micropython,kerneltask/micropython,HenrikSolver/micropython,ChuckM/micropython,noahwilliamsson/micropython,cloudformdesign/micropython,jlillest/micropython,noahchense/micropython,tuc-osg/micropython,tuc-osg/micropython,lowRISC/micropython,lbattraw/micropython,pozetroninc/micropython,feilongfl/micropython,blmorris/micropython,vriera/micropython,dmazzella/micropython,tobbad/micropython,deshipu/micropython,vitiral/micropython,mgyenik/micropython,alex-march/micropython,ryannathans/micropython,vriera/micropython,hosaka/micropython,cwyark/micropython,ericsnowcurrently/micropython,pozetroninc/micropython,dhylands/micropython,mhoffma/micropython,danicampora/micropython,adafruit/circuitpython,lbattraw/micropython,hosaka/micropython,kostyll/micropython,HenrikSolver/micropython,mianos/micropython,lbattraw/micropython,lbattraw/micropython,adafruit/micropython,hiway/micropython,vriera/micropython,blazewicz/micropython,pramasoul/micropython,turbinenreiter/micropython,cwyark/micropython,MrSurly/micropython-esp32,alex-march/micropython,cwyark/micropython,alex-robbins/micropython,trezor/micropython,tdautc19841202/micropython,micropython/micropython-esp32,praemdonck/micropython,SHA2017-badge/micropython-esp32,tuc-osg/micropython,ruffy91/micropython,Timmenem/micropython,dxxb/micropython,dmazzella/micropython,noahwilliamsson/micropython,SHA2017-badge/micropython-esp32,PappaPeppar/micropython,turbinenreiter/micropython,torwag/micropython,alex-march/micropython,kerneltask/micropython,misterdanb/micropython,ericsnowcurrently/micropython,cnoviello/micropython,swegener/micropython,puuu/micropython,ChuckM/micropython,ahotam/micropython,PappaPeppar/micropython,firstval/micropython,emfcamp/micropython,torwag/micropython,turbinenreiter/micropython,PappaPeppar/micropython,MrSurly/micropython-esp32,mianos/micropython,toolmacher/micropython,noahchense/micropython,alex-robbins/micropython,chrisdearman/micropython,jmarcelino/pycom-micropython,MrSurly/micropython-esp32,adafruit/micropython,alex-robbins/micropython,ceramos/micropython,henriknelson/micropython,jmarcelino/pycom-micropython,ernesto-g/micropython,SHA2017-badge/micropython-esp32,jlillest/micropython,EcmaXp/micropython,kerneltask/micropython,dhylands/micropython,redbear/micropython,ganshun666/micropython,torwag/micropython,ChuckM/micropython,adafruit/micropython,mgyenik/micropython,drrk/micropython,jimkmc/micropython,blazewicz/micropython,redbear/micropython,oopy/micropython,dxxb/micropython,ryannathans/micropython,cnoviello/micropython,dmazzella/micropython,kostyll/micropython,AriZuu/micropython,cloudformdesign/micropython,mpalomer/micropython,puuu/micropython,redbear/micropython,rubencabrera/micropython,omtinez/micropython,matthewelse/micropython,vitiral/micropython,matthewelse/micropython,SHA2017-badge/micropython-esp32,mpalomer/micropython,praemdonck/micropython,xuxiaoxin/micropython,ryannathans/micropython,praemdonck/micropython,dxxb/micropython,micropython/micropython-esp32,Timmenem/micropython,mgyenik/micropython,Peetz0r/micropython-esp32,vriera/micropython,pfalcon/micropython,jmarcelino/pycom-micropython,xyb/micropython,selste/micropython,infinnovation/micropython,matthewelse/micropython,danicampora/micropython,ryannathans/micropython,pozetroninc/micropython,tralamazza/micropython,jimkmc/micropython,slzatz/micropython,cnoviello/micropython,xhat/micropython,heisewangluo/micropython,dinau/micropython,martinribelotta/micropython,utopiaprince/micropython,HenrikSolver/micropython,henriknelson/micropython,adamkh/micropython,hiway/micropython,jimkmc/micropython,skybird6672/micropython,trezor/micropython,cloudformdesign/micropython,neilh10/micropython,alex-march/micropython,emfcamp/micropython,AriZuu/micropython,adafruit/micropython,firstval/micropython,lowRISC/micropython,drrk/micropython,mhoffma/micropython,deshipu/micropython,ericsnowcurrently/micropython,xuxiaoxin/micropython,infinnovation/micropython,ceramos/micropython,selste/micropython,galenhz/micropython,drrk/micropython,utopiaprince/micropython,ericsnowcurrently/micropython,noahwilliamsson/micropython,cnoviello/micropython,mianos/micropython,bvernoux/micropython,swegener/micropython,EcmaXp/micropython,omtinez/micropython,emfcamp/micropython,ganshun666/micropython,misterdanb/micropython,utopiaprince/micropython,firstval/micropython,mhoffma/micropython,xhat/micropython,blazewicz/micropython,oopy/micropython,swegener/micropython,supergis/micropython,tobbad/micropython,redbear/micropython,EcmaXp/micropython,Timmenem/micropython,rubencabrera/micropython,supergis/micropython,jimkmc/micropython,misterdanb/micropython
--- +++ @@ -42,3 +42,15 @@ hash(D()) except TypeError: print("TypeError") + +# __hash__ returning a bool should be converted to an int +class E: + def __hash__(self): + return True +print(hash(E())) + +# __hash__ returning a large number should be truncated +class F: + def __hash__(self): + return 1 << 70 | 1 +print(hash(F()) != 0)
4d6fdc98fd681a78eeeff6041efdfe7107a9743c
setup.py
setup.py
from setuptools import setup, find_packages import account setup( name="django-user-accounts", version=account.__version__, author="Brian Rosner", author_email="brosner@gmail.com", description="a Django user account app", long_description=open("README.rst").read(), license="MIT", url="http://github.com/pinax/django-user-accounts", packages=find_packages(), install_requires=[ "django-appconf>=0.6", "pytz>=2013.9" ], zip_safe=False, package_data={ "account": [ "locale/*/LC_MESSAGES/*", ], }, test_suite="runtests.runtests", classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Framework :: Django", ] )
from setuptools import setup, find_packages import account setup( name="django-user-accounts", version=account.__version__, author="Brian Rosner", author_email="brosner@gmail.com", description="a Django user account app", long_description=open("README.rst").read(), license="MIT", url="http://github.com/pinax/django-user-accounts", packages=find_packages(), install_requires=[ "django-appconf>=0.6", "pytz>=2015.6" ], zip_safe=False, package_data={ "account": [ "locale/*/LC_MESSAGES/*", ], }, test_suite="runtests.runtests", classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Framework :: Django", ] )
Set new minimum pytz version
Set new minimum pytz version
Python
mit
GeoNode/geonode-user-accounts,ntucker/django-user-accounts,nderituedwin/django-user-accounts,mysociety/django-user-accounts,pinax/django-user-accounts,jawed123/django-user-accounts,pinax/django-user-accounts,ntucker/django-user-accounts,jpotterm/django-user-accounts,nderituedwin/django-user-accounts,jawed123/django-user-accounts,GeoNode/geonode-user-accounts,mysociety/django-user-accounts,jpotterm/django-user-accounts
--- +++ @@ -15,7 +15,7 @@ packages=find_packages(), install_requires=[ "django-appconf>=0.6", - "pytz>=2013.9" + "pytz>=2015.6" ], zip_safe=False, package_data={
0936621b0a4162589560cc112f4f8e4425fed652
setup.py
setup.py
from setuptools import setup, find_packages setup( name = "django-ajax-utilities", url = 'https://github.com/citylive/django-ajax-utilities', license = 'BSD', description = "Pagination, xhr and tabbing utilities for the Django framework.", long_description = open('README','r').read(), author = 'Jonathan Slenders, City Live nv', packages = find_packages('src'), package_data = {'django_ajax': [ 'static/*.js', 'static/*/*.js', 'static/*/*/*.js', 'static/*.css', 'static/*/*.css', 'static/*/*/*.css', 'static/*.png', 'static/*/*.png', 'static/*/*/*.png', 'static/*/*/*/*.png', 'static/*.gif', 'static/*/*.gif', 'static/*/*/*.gif', 'static/*/*/*/*.gif', 'templates/*.html', 'templates/*/*.html', 'templates/*/*/*.html' ],}, zip_safe=False, # Don't create egg files, Django cannot find templates in egg files. include_package_data=True, package_dir = {'': 'src'}, classifiers = [ 'Intended Audience :: Developers', 'Programming Language :: Python', 'Operating System :: OS Independent', 'Environment :: Web Environment', 'Framework :: Django', ], )
from setuptools import setup, find_packages setup( name = "django-ajax-utilities", version = '1.2.0', url = 'https://github.com/citylive/django-ajax-utilities', license = 'BSD', description = "Pagination, xhr and tabbing utilities for the Django framework.", long_description = open('README','r').read(), author = 'Jonathan Slenders, City Live nv', packages = find_packages('src'), package_data = {'django_ajax': [ 'static/*.js', 'static/*/*.js', 'static/*/*/*.js', 'static/*.css', 'static/*/*.css', 'static/*/*/*.css', 'static/*.png', 'static/*/*.png', 'static/*/*/*.png', 'static/*/*/*/*.png', 'static/*.gif', 'static/*/*.gif', 'static/*/*/*.gif', 'static/*/*/*/*.gif', 'templates/*.html', 'templates/*/*.html', 'templates/*/*/*.html' ],}, zip_safe=False, # Don't create egg files, Django cannot find templates in egg files. include_package_data=True, package_dir = {'': 'src'}, classifiers = [ 'Intended Audience :: Developers', 'Programming Language :: Python', 'Operating System :: OS Independent', 'Environment :: Web Environment', 'Framework :: Django', ], )
Change to semantic version number
Change to semantic version number
Python
bsd-3-clause
vikingco/django-ajax-utilities,vikingco/django-ajax-utilities,vikingco/django-ajax-utilities
--- +++ @@ -2,6 +2,7 @@ setup( name = "django-ajax-utilities", + version = '1.2.0', url = 'https://github.com/citylive/django-ajax-utilities', license = 'BSD', description = "Pagination, xhr and tabbing utilities for the Django framework.",
9712dd202f4fe5ee3938dbea987ced267a5199e5
setup.py
setup.py
from setuptools import setup, find_packages setup( name='pyhaproxy', version='0.3.0', keywords=('haproxy', 'parse'), description='A Python library to parse haproxy configuration file', license='MIT License', install_requires=[], include_package_data=True, package_data={ 'pyhaproxy': ['*.peg'], }, author='Joey', author_email='majunjiev@gmail.com', url='https://github.com/imjoey/pyhaproxy', packages=find_packages(), platforms='any', )
from setuptools import setup, find_packages setup( name='pyhaproxy', version='0.3.2', keywords=('haproxy', 'parse'), description='A Python library to parse haproxy configuration file', license='MIT License', install_requires=[], include_package_data=True, package_data={ 'pyhaproxy': ['*.peg'], }, author='Joey', author_email='majunjiev@gmail.com', url='https://github.com/imjoey/pyhaproxy', packages=find_packages(), platforms='any', )
Change version to v0.3.2. Release Notes: fix the incorrect attribute accessing in class Option.
Change version to v0.3.2. Release Notes: fix the incorrect attribute accessing in class Option.
Python
mit
imjoey/pyhaproxy
--- +++ @@ -2,7 +2,7 @@ setup( name='pyhaproxy', - version='0.3.0', + version='0.3.2', keywords=('haproxy', 'parse'), description='A Python library to parse haproxy configuration file', license='MIT License',
dae923853e0218fc77923f4512f72d0109e8f4bb
setup.py
setup.py
from setuptools import setup PACKAGE_NAME = 'funsize' PACKAGE_VERSION = '0.1' setup(name=PACKAGE_NAME, version=PACKAGE_VERSION, description='partial mar webservice prototype', long_description='https://wiki.mozilla.org/User:Ffledgling/Senbonzakura', classifiers=[], author='Anhad Jai Singh', author_email='ffledgling@gmail.com', url='https://wiki.mozilla.org/User:Ffledgling/Senbonzakura', license='MPL', install_requires=[ 'Flask==0.10.1', 'celery==3.1.11', 'nose==1.3.3', 'requests==2.2.1', ], packages=[ 'funsize', 'funsize.backend', 'funsize.cache', 'funsize.frontend', 'funsize.utils', ], tests_require=[ 'nose', 'mock' ], )
from setuptools import setup PACKAGE_NAME = 'funsize' PACKAGE_VERSION = '0.1' setup(name=PACKAGE_NAME, version=PACKAGE_VERSION, description='partial mar webservice prototype', long_description='https://wiki.mozilla.org/User:Ffledgling/Senbonzakura', classifiers=[], author='Anhad Jai Singh', author_email='ffledgling@gmail.com', url='https://wiki.mozilla.org/User:Ffledgling/Senbonzakura', license='MPL', install_requires=[ 'Flask==0.10.1', 'celery==3.1.11', 'nose==1.3.3', 'requests==2.2.1', 'boto==2.33.0', ], packages=[ 'funsize', 'funsize.backend', 'funsize.cache', 'funsize.frontend', 'funsize.utils', ], tests_require=[ 'nose', 'mock' ], )
Add boto as requirement for funsize deployment.
Add boto as requirement for funsize deployment.
Python
mpl-2.0
petemoore/build-funsize,petemoore/build-funsize
--- +++ @@ -17,6 +17,7 @@ 'celery==3.1.11', 'nose==1.3.3', 'requests==2.2.1', + 'boto==2.33.0', ], packages=[ 'funsize',
bfc85ac3d2b29e5287fa556e0e2215bc39668db5
setup.py
setup.py
"""setup.py - build script for parquet-python.""" try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='parquet', version='1.2', description='Python support for Parquet file format', author='Joe Crobak', author_email='joecrow@gmail.com', url='https://github.com/jcrobak/parquet-python', license='Apache License 2.0', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], packages=['parquet'], install_requires=[ 'python-snappy', 'thriftpy>=0.3.6', ], extras_require={ ':python_version=="2.7"': [ "backports.csv", ], }, entry_points={ 'console_scripts': [ 'parquet = parquet.__main__:main', ] }, package_data={'parquet': ['*.thrift']}, include_package_data=True, )
"""setup.py - build script for parquet-python.""" try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='parquet', version='1.2', description='Python support for Parquet file format', author='Joe Crobak', author_email='joecrow@gmail.com', url='https://github.com/jcrobak/parquet-python', license='Apache License 2.0', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], packages=['parquet'], install_requires=[ 'python-snappy', 'thriftpy2', ], extras_require={ ':python_version=="2.7"': [ "backports.csv", ], }, entry_points={ 'console_scripts': [ 'parquet = parquet.__main__:main', ] }, package_data={'parquet': ['*.thrift']}, include_package_data=True, )
Replace thriftpy dependency with thriftpy2
Replace thriftpy dependency with thriftpy2
Python
apache-2.0
jcrobak/parquet-python
--- +++ @@ -30,7 +30,7 @@ packages=['parquet'], install_requires=[ 'python-snappy', - 'thriftpy>=0.3.6', + 'thriftpy2', ], extras_require={ ':python_version=="2.7"': [
c4e1059b387269b6098d05d2227c085e7931b140
setup.py
setup.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from distutils.core import setup, Extension cpp_args = ['-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7'] ext_modules = [ Extension( 'make_asym', ['make_asym.cc'], include_dirs=['include'], language='c++', extra_compile_args=cpp_args, ), ] setup( name='make_asym', version='0.1', author='Nate Lust', author_email='nlust@astro.princeton.edu', description='A python extension module for calculating asymmetry values', ext_modules=ext_modules, )
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from distutils.core import setup, Extension cpp_args = ['-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7'] ext_modules = [ Extension( 'make_asym', ['make_asym.cc'], include_dirs=['include'], language='c++', extra_compile_args=cpp_args, ), ] setup( name='make_asym', version='0.1', author='Nate Lust', author_email='nlust@astro.princeton.edu', description='A module for calculating centers though least asymmetry', ext_modules=ext_modules, )
Update module description for clarity
Update module description for clarity
Python
mpl-2.0
natelust/least_asymmetry,natelust/least_asymmetry,natelust/least_asymmetry
--- +++ @@ -21,6 +21,6 @@ version='0.1', author='Nate Lust', author_email='nlust@astro.princeton.edu', - description='A python extension module for calculating asymmetry values', + description='A module for calculating centers though least asymmetry', ext_modules=ext_modules, )
a52c84f092d89f89130c2696c98779e955f083dc
tests/test_version_parser.py
tests/test_version_parser.py
import pytest from leak.version_parser import versions_split def test_versions_split(): pass def test_wrong_versions_split(): # too many dots assert versions_split('1.2.3.4') == [0, 0, 0] # test missing numeric version with pytest.raises(ValueError): versions_split('not.numeric') # test not string provided with pytest.raises(AttributeError): versions_split(12345)
import pytest from leak.version_parser import versions_split def test_versions_split(): assert versions_split('1.8.1') == [1, 8, 1] assert versions_split('1.4') == [1, 4, 0] assert versions_split('2') == [2, 0, 0] def test_versions_split_str_mapping(): assert versions_split('1.11rc1', type_applyer=str) == ['1', '11rc1', '0'] assert versions_split('1.10b1', type_applyer=str) == ['1', '10b1', '0'] assert versions_split('text', type_applyer=str) == ['text', '0', '0'] def test_wrong_versions_split(): # too many dots assert versions_split('1.2.3.4') == [0, 0, 0] # test missing numeric version with pytest.raises(ValueError): versions_split('not.numeric') # test not string provided with pytest.raises(AttributeError): versions_split(12345)
Add tests for version splitting
Add tests for version splitting
Python
mit
bmwant21/leak
--- +++ @@ -4,7 +4,15 @@ def test_versions_split(): - pass + assert versions_split('1.8.1') == [1, 8, 1] + assert versions_split('1.4') == [1, 4, 0] + assert versions_split('2') == [2, 0, 0] + + +def test_versions_split_str_mapping(): + assert versions_split('1.11rc1', type_applyer=str) == ['1', '11rc1', '0'] + assert versions_split('1.10b1', type_applyer=str) == ['1', '10b1', '0'] + assert versions_split('text', type_applyer=str) == ['text', '0', '0'] def test_wrong_versions_split():
fdb461f000adefff0d1050464e5783c96222f364
setup.py
setup.py
from setuptools import setup setup( name='scuevals-api', packages=['scuevals_api'], include_package_data=True, test_suite='tests', entry_points={ 'console_scripts': [ 'app=scuevals_api.cmd:cli' ] }, install_requires=[ 'alembic==0.9.7', 'beautifulsoup4==4.6.0', 'blinker==1.4', 'coveralls==1.2.0', 'Flask-Caching==1.3.3', 'Flask-Cors==3.0.3', 'Flask-JWT-Extended==3.6.0', 'Flask-Migrate==2.1.1', 'Flask-RESTful==0.3.6', 'Flask-Rollbar==1.0.1', 'Flask-SQLAlchemy==2.3.2', 'Flask==0.12.2', 'gunicorn==19.7.1', 'newrelic==2.100.0.84', 'psycopg2==2.7.3.2', 'python-jose==2.0.1', 'PyYAML==3.12', 'requests==2.18.4', 'rollbar==0.13.17', 'vcrpy==1.11.1', 'webargs==1.8.1', ], )
from setuptools import setup setup( name='scuevals-api', packages=['scuevals_api'], include_package_data=True, test_suite='tests', entry_points={ 'console_scripts': [ 'app=scuevals_api.cmd:cli' ] }, install_requires=[ 'alembic==0.9.7', 'beautifulsoup4==4.6.0', 'blinker==1.4', 'coveralls==1.2.0', 'Flask-Caching==1.3.3', 'Flask-Cors==3.0.3', 'Flask-JWT-Extended==3.6.0', 'Flask-Migrate==2.1.1', 'Flask-RESTful==0.3.6', 'Flask-Rollbar==1.0.1', 'Flask-SQLAlchemy==2.3.2', 'Flask==0.12.2', 'gunicorn==19.7.1', 'newrelic==2.100.0.84', 'psycopg2==2.7.3.2', 'pycryptodome>=3.4.7' 'python-jose==2.0.1', 'PyYAML==3.12', 'requests==2.18.4', 'rollbar==0.13.17', 'vcrpy==1.11.1', 'webargs==1.8.1', ], )
Add minimum version for pycryptodome
Add minimum version for pycryptodome
Python
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
--- +++ @@ -26,6 +26,7 @@ 'gunicorn==19.7.1', 'newrelic==2.100.0.84', 'psycopg2==2.7.3.2', + 'pycryptodome>=3.4.7' 'python-jose==2.0.1', 'PyYAML==3.12', 'requests==2.18.4',
43dc6dc0a9b33de0db1f79f7470d69519192dc1f
setup.py
setup.py
from setuptools import setup, find_packages try: import nose.commands extra_args = dict( cmdclass={'test': nose.commands.nosetests}, ) except ImportError: extra_args = dict() setup( name='dear_astrid', version='0.1.0', author='Randy Stauner', author_email='randy@magnificent-tears.com', packages=find_packages(), #['dear_astrid', 'dear_astrid.test'], #scripts=['bin/dear_astrid.py'], url='http://github.com/rwstauner/dear_astrid/', license='MIT', description='Migrate tasks from Astrid backup xml', long_description=open('README.rst').read(), install_requires=[ 'pyrtm>=0.4.1', ], setup_requires=['nose>=1.0'], tests_require=[ 'nose', 'mock', ], **extra_args )
from setuptools import setup, find_packages try: import nose.commands extra_args = dict( cmdclass={'test': nose.commands.nosetests}, ) except ImportError: extra_args = dict() # TODO: would this work? (is the file included in the dist?) #tests_require = [l.strip() for l in open('test-requirements.txt').readlines()] tests_require = ['mock'] setup( name='dear_astrid', version='0.1.0', author='Randy Stauner', author_email='randy@magnificent-tears.com', packages=find_packages(), #['dear_astrid', 'dear_astrid.test'], #scripts=['bin/dear_astrid.py'], url='http://github.com/rwstauner/dear_astrid/', license='MIT', description='Migrate tasks from Astrid backup xml', long_description=open('README.rst').read(), install_requires=[ 'pyrtm>=0.4.1', ], setup_requires=['nose>=1.0'], tests_require=tests_require, extras_require={ 'test': tests_require, }, **extra_args )
Put tests_require into extras_require also
Put tests_require into extras_require also
Python
mit
rwstauner/dear_astrid,rwstauner/dear_astrid
--- +++ @@ -7,6 +7,10 @@ ) except ImportError: extra_args = dict() + +# TODO: would this work? (is the file included in the dist?) +#tests_require = [l.strip() for l in open('test-requirements.txt').readlines()] +tests_require = ['mock'] setup( name='dear_astrid', @@ -29,10 +33,11 @@ setup_requires=['nose>=1.0'], - tests_require=[ - 'nose', - 'mock', - ], + tests_require=tests_require, + + extras_require={ + 'test': tests_require, + }, **extra_args )
85d2c012bfaeeb04fa8dd31cd05a04a8dc43c14e
tests/grammar_term-nonterm_test/NonterminalsInvalidTest.py
tests/grammar_term-nonterm_test/NonterminalsInvalidTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy.RawGrammar import RawGrammar class NonterminalsInvalidTest(TestCase): pass if __name__ == '__main__': main()
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy.RawGrammar import RawGrammar as Grammar from grammpy import Nonterminal from grammpy.exceptions import NotNonterminalException class TempClass(Nonterminal): pass class NonterminalsInvalidTest(TestCase): def test_invalidAddNumber(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.add_nonterm(0) def test_invalidAddString(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.add_nonterm("string") def test_invalidAddAfterCorrectAdd(self): gr = Grammar() gr.add_nonterm(TempClass) with self.assertRaises(NotNonterminalException): gr.add_nonterm("asdf") def test_invalidAddInArray(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.add_nonterm([TempClass, "asdf"]) def test_invalidHaveNumber(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.have_nonterm(0) def test_invalidHaveString(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.have_nonterm("string") def test_invalidHaveAfterCorrectAdd(self): gr = Grammar() gr.add_nonterm(TempClass) with self.assertRaises(NotNonterminalException): gr.have_nonterm("asdf") def test_invalidHaveInArray(self): gr = Grammar() with self.assertRaises(NotNonterminalException): gr.have_nonterm([TempClass, "asdf"]) if __name__ == '__main__': main()
Add tests that have and get of nonterms raise exceptions
Add tests that have and get of nonterms raise exceptions
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -7,13 +7,57 @@ """ from unittest import TestCase, main -from grammpy.RawGrammar import RawGrammar +from grammpy.RawGrammar import RawGrammar as Grammar +from grammpy import Nonterminal +from grammpy.exceptions import NotNonterminalException + + +class TempClass(Nonterminal): + pass class NonterminalsInvalidTest(TestCase): - pass + def test_invalidAddNumber(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.add_nonterm(0) + def test_invalidAddString(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.add_nonterm("string") + def test_invalidAddAfterCorrectAdd(self): + gr = Grammar() + gr.add_nonterm(TempClass) + with self.assertRaises(NotNonterminalException): + gr.add_nonterm("asdf") + + def test_invalidAddInArray(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.add_nonterm([TempClass, "asdf"]) + + def test_invalidHaveNumber(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.have_nonterm(0) + + def test_invalidHaveString(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.have_nonterm("string") + + def test_invalidHaveAfterCorrectAdd(self): + gr = Grammar() + gr.add_nonterm(TempClass) + with self.assertRaises(NotNonterminalException): + gr.have_nonterm("asdf") + + def test_invalidHaveInArray(self): + gr = Grammar() + with self.assertRaises(NotNonterminalException): + gr.have_nonterm([TempClass, "asdf"]) if __name__ == '__main__':
d57161b9449faa1218e4dab55fe4b2bd6f0c3436
utils.py
utils.py
import json import os import time import uuid from google.appengine.api import urlfetch from models import Profile def getUserId(user, id_type="email"): if id_type == "email": return user.email() if id_type == "oauth": """A workaround implementation for getting userid.""" auth = os.getenv('HTTP_AUTHORIZATION') bearer, token = auth.split() token_type = 'id_token' if 'OAUTH_USER_ID' in os.environ: token_type = 'access_token' url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?%s=%s' % (token_type, token)) user = {} wait = 1 for i in range(3): resp = urlfetch.fetch(url) if resp.status_code == 200: user = json.loads(resp.content) break elif resp.status_code == 400 and 'invalid_token' in resp.content: url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?%s=%s' % ('access_token', token)) else: time.sleep(wait) wait = wait + i return user.get('user_id', '') if id_type == "custom": # implement your own user_id creation and getting algorythm # this is just a sample that queries datastore for an existing profile # and generates an id if profile does not exist for an email profile = Conference.query(Conference.mainEmail == user.email()) if profile: return profile.id() else: return str(uuid.uuid1().get_hex())
import json import os import time from google.appengine.api import urlfetch def getUserId(user, id_type="email"): if id_type == "email": return user.email() if id_type == "oauth": """A workaround implementation for getting userid.""" auth = os.getenv('HTTP_AUTHORIZATION') bearer, token = auth.split() token_type = 'id_token' if 'OAUTH_USER_ID' in os.environ: token_type = 'access_token' url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?%s=%s' % (token_type, token)) user = {} wait = 1 for i in range(3): resp = urlfetch.fetch(url) if resp.status_code == 200: user = json.loads(resp.content) break elif resp.status_code == 400 and 'invalid_token' in resp.content: url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?%s=%s' % ('access_token', token)) else: time.sleep(wait) wait = wait + i return user.get('user_id', '')
Remove unused code and get rid of flake8 errors
Remove unused code and get rid of flake8 errors
Python
apache-2.0
swesterveld/udacity-nd004-p4-conference-organization-app,swesterveld/udacity-nd004-p4-conference-organization-app,swesterveld/udacity-nd004-p4-conference-organization-app
--- +++ @@ -1,10 +1,9 @@ import json import os import time -import uuid from google.appengine.api import urlfetch -from models import Profile + def getUserId(user, id_type="email"): if id_type == "email": @@ -33,13 +32,3 @@ time.sleep(wait) wait = wait + i return user.get('user_id', '') - - if id_type == "custom": - # implement your own user_id creation and getting algorythm - # this is just a sample that queries datastore for an existing profile - # and generates an id if profile does not exist for an email - profile = Conference.query(Conference.mainEmail == user.email()) - if profile: - return profile.id() - else: - return str(uuid.uuid1().get_hex())
2a7ed7c2d6f37c3b6965ad92b21cecc0a4abd91a
upload_datasets_to_galaxy.py
upload_datasets_to_galaxy.py
#!/usr/bin/python3 import argparse # from bioblend.galaxy import GalaxyInstance import configparser def upload_datasets_to_galaxy(): # Arguments initialization parser = argparse.ArgumentParser(description="Script to upload a folder into" "Galaxy Data Libraries") parser.add_argument('--folder', help='Folder to add in Data Libraries of Galaxy') args = parser.parse_args() # Fetch arguments folder_path = args.folder # Launch config config = configparser.ConfigParser() config.read('config.ini') galaxy_config = config['Galaxy'] # gi = GalaxyInstance(url=galaxy_config['url'], key=galaxy_config['api-key']) # print(gi.histories.get_histories()) if __name__ == "__main__": upload_datasets_to_galaxy()
#!/usr/bin/python3 import argparse from bioblend.galaxy import GalaxyInstance import configparser import os def upload_datasets_to_galaxy(): # Arguments initialization parser = argparse.ArgumentParser(description="Script to upload a folder into" "Galaxy Data Libraries") parser.add_argument('--folder', help='Folder to add in Data Libraries of Galaxy') args = parser.parse_args() # Fetch arguments folder_path = args.folder # Launch config config = configparser.ConfigParser() config.read('config.ini') galaxy_config = config['Galaxy'] gi = GalaxyInstance(url='http://127.0.0.1:8080', key='5e8cc5748922c598c1aa6ec9e605780f') name_folder_test = '160802_D00281L_0127_C9NPBANXX' path_folder_test = './test-data/staging/' + name_folder_test path_to_fastq_folder_test = os.path.join(path_folder_test, 'fastq') # TODO: Make a loop which execute the following, for each directory found libs_folder = gi.libraries.get_libraries(name=name_folder_test) # TODO: Check the library does already exist # Create the library with the name equal to the folder name # and description 'Library' + folder_name dict_library_test = gi.libraries.create_library(name_folder_test, description=' '.join(['Library', name_folder_test]), synopsis=None) # Upload the data in the library just created list_of_files = '\n'.join(os.listdir(path_to_fastq_folder_test)) unknow_return = gi.libraries.upload_from_galaxy_filesystem( library_id=dict_library_test.get('id'), filesystem_paths=list_of_files, file_type='auto', link_data_only='link_to_files', ) print(unknow_return) # TODO: Check if no new files, else upload them # print("Already there! Skipping {0}".format(name_folder_test)) #print(gi.histories.get_histories()) if __name__ == "__main__": upload_datasets_to_galaxy()
Add first verion to upload via BioBlend
Add first verion to upload via BioBlend
Python
mit
pajanne/galaxy-kickstart,pajanne/galaxy-kickstart
--- +++ @@ -1,7 +1,8 @@ #!/usr/bin/python3 import argparse -# from bioblend.galaxy import GalaxyInstance +from bioblend.galaxy import GalaxyInstance import configparser +import os def upload_datasets_to_galaxy(): # Arguments initialization @@ -21,9 +22,34 @@ galaxy_config = config['Galaxy'] - # gi = GalaxyInstance(url=galaxy_config['url'], key=galaxy_config['api-key']) + gi = GalaxyInstance(url='http://127.0.0.1:8080', key='5e8cc5748922c598c1aa6ec9e605780f') - # print(gi.histories.get_histories()) + name_folder_test = '160802_D00281L_0127_C9NPBANXX' + path_folder_test = './test-data/staging/' + name_folder_test + path_to_fastq_folder_test = os.path.join(path_folder_test, 'fastq') + + # TODO: Make a loop which execute the following, for each directory found + libs_folder = gi.libraries.get_libraries(name=name_folder_test) + # TODO: Check the library does already exist + # Create the library with the name equal to the folder name + # and description 'Library' + folder_name + dict_library_test = gi.libraries.create_library(name_folder_test, + description=' '.join(['Library', name_folder_test]), + synopsis=None) + + # Upload the data in the library just created + list_of_files = '\n'.join(os.listdir(path_to_fastq_folder_test)) + unknow_return = gi.libraries.upload_from_galaxy_filesystem( + library_id=dict_library_test.get('id'), + filesystem_paths=list_of_files, + file_type='auto', + link_data_only='link_to_files', + ) + print(unknow_return) + # TODO: Check if no new files, else upload them + # print("Already there! Skipping {0}".format(name_folder_test)) + + #print(gi.histories.get_histories()) if __name__ == "__main__":
e890ac9ef00193beac77b757c62911553cebf656
test.py
test.py
import urllib urllib.urlretrieve('http://192.168.0.13:8080/photoaf.jpg', '/home/pi/img/img.jpg')
import urllib urllib.urlretrieve('http://192.168.0.13:8080/photoaf.jpg', 'img.jpg')
Change save path to local path
Change save path to local path
Python
mit
adampiskorski/lpr_poc
--- +++ @@ -1,2 +1,2 @@ import urllib -urllib.urlretrieve('http://192.168.0.13:8080/photoaf.jpg', '/home/pi/img/img.jpg') +urllib.urlretrieve('http://192.168.0.13:8080/photoaf.jpg', 'img.jpg')
ac8d6210b1e48e7ce1131412b45d23846b7c73d2
test.py
test.py
import time import panoply KEY = "panoply/2g866xw4oaqt1emi" SECRET = "MmM0NWNvc2wwYmJ4ZDJ0OS84MmY3MzQ4NC02MDIzLTQyN2QtODdkMS0yY2I0NTAzNDk0NDQvMDM3MzM1OTk5NTYyL3VzLWVhc3QtMQ==" # noqa sdk = panoply.SDK(KEY, SECRET) sdk.write('roi-test', {'hello': 1}) print sdk.qurl time.sleep(5)
import time import panoply KEY = "panoply/2g866xw4oaqt1emi" SECRET = "MmM0NWNvc2wwYmJ4ZDJ0OS84MmY3MzQ4NC02MDIzLTQyN2QtODdkMS0yY2I0NTAzNDk0NDQvMDM3MzM1OTk5NTYyL3VzLWVhc3QtMQ==" # noqa sdk = panoply.SDK(KEY, SECRET) sdk.write('roi-test', {'hello': 1}) print sdk.qurl time.sleep(5)
Fix to minor style issue
Fix to minor style issue
Python
mit
panoplyio/panoply-python-sdk
--- +++ @@ -7,8 +7,6 @@ sdk = panoply.SDK(KEY, SECRET) sdk.write('roi-test', {'hello': 1}) - - print sdk.qurl time.sleep(5)
0c1b0a7787bd6824815ae208edab8f208b53af09
api/base/exceptions.py
api/base/exceptions.py
def jsonapi_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array with a 'detail' member """ from rest_framework.views import exception_handler response = exception_handler(exc, context) if response is not None: if 'detail' in response.data: response.data = {'errors': [response.data]} else: response.data = {'errors': [{'detail': response.data}]} if response is not None and response.data['errors'][0]['detail'] == "Authentication credentials were not provided.": response.status_code = 401 return response
def jsonapi_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array with a 'detail' member """ from rest_framework.views import exception_handler response = exception_handler(exc, context) if response is not None: if 'detail' in response.data: response.data = {'errors': [response.data]} else: response.data = {'errors': [{'detail': response.data}]} # Returns 401 instead of 403 during unauthorized requests without having user to log in with Basic Auth if response is not None and response.data['errors'][0]['detail'] == "Authentication credentials were not provided.": response.status_code = 401 return response
Add comment to override of status code
Add comment to override of status code
Python
apache-2.0
Ghalko/osf.io,billyhunt/osf.io,wearpants/osf.io,asanfilippo7/osf.io,ticklemepierce/osf.io,kch8qx/osf.io,GageGaskins/osf.io,njantrania/osf.io,mluke93/osf.io,baylee-d/osf.io,alexschiller/osf.io,asanfilippo7/osf.io,wearpants/osf.io,kwierman/osf.io,leb2dg/osf.io,leb2dg/osf.io,chennan47/osf.io,arpitar/osf.io,leb2dg/osf.io,erinspace/osf.io,Johnetordoff/osf.io,Ghalko/osf.io,petermalcolm/osf.io,adlius/osf.io,abought/osf.io,icereval/osf.io,cwisecarver/osf.io,samchrisinger/osf.io,saradbowman/osf.io,DanielSBrown/osf.io,sbt9uc/osf.io,HalcyonChimera/osf.io,kwierman/osf.io,GageGaskins/osf.io,brianjgeiger/osf.io,felliott/osf.io,Nesiehr/osf.io,felliott/osf.io,SSJohns/osf.io,baylee-d/osf.io,KAsante95/osf.io,billyhunt/osf.io,sbt9uc/osf.io,mluke93/osf.io,mluo613/osf.io,RomanZWang/osf.io,Johnetordoff/osf.io,samanehsan/osf.io,mluke93/osf.io,crcresearch/osf.io,ticklemepierce/osf.io,petermalcolm/osf.io,caseyrollins/osf.io,RomanZWang/osf.io,Nesiehr/osf.io,amyshi188/osf.io,laurenrevere/osf.io,cwisecarver/osf.io,billyhunt/osf.io,arpitar/osf.io,brandonPurvis/osf.io,rdhyee/osf.io,samchrisinger/osf.io,emetsger/osf.io,Ghalko/osf.io,haoyuchen1992/osf.io,alexschiller/osf.io,doublebits/osf.io,abought/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,samanehsan/osf.io,monikagrabowska/osf.io,rdhyee/osf.io,ZobairAlijan/osf.io,laurenrevere/osf.io,SSJohns/osf.io,aaxelb/osf.io,ZobairAlijan/osf.io,kwierman/osf.io,Johnetordoff/osf.io,TomBaxter/osf.io,HalcyonChimera/osf.io,alexschiller/osf.io,sbt9uc/osf.io,TomHeatwole/osf.io,pattisdr/osf.io,Nesiehr/osf.io,binoculars/osf.io,kwierman/osf.io,emetsger/osf.io,petermalcolm/osf.io,zachjanicki/osf.io,zamattiac/osf.io,crcresearch/osf.io,felliott/osf.io,doublebits/osf.io,rdhyee/osf.io,leb2dg/osf.io,alexschiller/osf.io,chrisseto/osf.io,HalcyonChimera/osf.io,acshi/osf.io,njantrania/osf.io,billyhunt/osf.io,SSJohns/osf.io,CenterForOpenScience/osf.io,caneruguz/osf.io,cslzchen/osf.io,zamattiac/osf.io,emetsger/osf.io,abought/osf.io,mluke93/osf.io,RomanZWang/osf.io,danielneis/osf.io,acshi/osf.io,danielneis/osf.io,erinspace/osf.io,samchrisinger/osf.io,wearpants/osf.io,aaxelb/osf.io,rdhyee/osf.io,doublebits/osf.io,zamattiac/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,KAsante95/osf.io,GageGaskins/osf.io,kch8qx/osf.io,DanielSBrown/osf.io,caneruguz/osf.io,hmoco/osf.io,icereval/osf.io,danielneis/osf.io,TomHeatwole/osf.io,njantrania/osf.io,haoyuchen1992/osf.io,caseyrygt/osf.io,SSJohns/osf.io,GageGaskins/osf.io,ZobairAlijan/osf.io,CenterForOpenScience/osf.io,asanfilippo7/osf.io,brandonPurvis/osf.io,zamattiac/osf.io,njantrania/osf.io,ticklemepierce/osf.io,RomanZWang/osf.io,zachjanicki/osf.io,jnayak1/osf.io,billyhunt/osf.io,caseyrollins/osf.io,caseyrollins/osf.io,mluo613/osf.io,chennan47/osf.io,binoculars/osf.io,hmoco/osf.io,monikagrabowska/osf.io,amyshi188/osf.io,samanehsan/osf.io,caneruguz/osf.io,kch8qx/osf.io,doublebits/osf.io,samanehsan/osf.io,acshi/osf.io,TomHeatwole/osf.io,aaxelb/osf.io,sloria/osf.io,KAsante95/osf.io,sbt9uc/osf.io,monikagrabowska/osf.io,caseyrygt/osf.io,caseyrygt/osf.io,mfraezz/osf.io,DanielSBrown/osf.io,laurenrevere/osf.io,petermalcolm/osf.io,wearpants/osf.io,emetsger/osf.io,mluo613/osf.io,caneruguz/osf.io,haoyuchen1992/osf.io,zachjanicki/osf.io,chrisseto/osf.io,chrisseto/osf.io,ticklemepierce/osf.io,brandonPurvis/osf.io,brandonPurvis/osf.io,adlius/osf.io,HalcyonChimera/osf.io,hmoco/osf.io,sloria/osf.io,monikagrabowska/osf.io,cosenal/osf.io,doublebits/osf.io,TomBaxter/osf.io,DanielSBrown/osf.io,KAsante95/osf.io,saradbowman/osf.io,haoyuchen1992/osf.io,mfraezz/osf.io,kch8qx/osf.io,crcresearch/osf.io,jnayak1/osf.io,abought/osf.io,cosenal/osf.io,cslzchen/osf.io,icereval/osf.io,monikagrabowska/osf.io,mluo613/osf.io,mfraezz/osf.io,danielneis/osf.io,sloria/osf.io,jnayak1/osf.io,acshi/osf.io,caseyrygt/osf.io,mluo613/osf.io,cwisecarver/osf.io,cosenal/osf.io,hmoco/osf.io,amyshi188/osf.io,acshi/osf.io,TomHeatwole/osf.io,asanfilippo7/osf.io,RomanZWang/osf.io,aaxelb/osf.io,adlius/osf.io,KAsante95/osf.io,TomBaxter/osf.io,mattclark/osf.io,pattisdr/osf.io,brandonPurvis/osf.io,jnayak1/osf.io,arpitar/osf.io,binoculars/osf.io,arpitar/osf.io,brianjgeiger/osf.io,cosenal/osf.io,mfraezz/osf.io,alexschiller/osf.io,baylee-d/osf.io,chrisseto/osf.io,GageGaskins/osf.io,mattclark/osf.io,zachjanicki/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,kch8qx/osf.io,samchrisinger/osf.io,brianjgeiger/osf.io,adlius/osf.io,cslzchen/osf.io,Nesiehr/osf.io,ZobairAlijan/osf.io,Ghalko/osf.io,erinspace/osf.io,amyshi188/osf.io,cwisecarver/osf.io,felliott/osf.io,mattclark/osf.io,cslzchen/osf.io
--- +++ @@ -12,6 +12,7 @@ else: response.data = {'errors': [{'detail': response.data}]} + # Returns 401 instead of 403 during unauthorized requests without having user to log in with Basic Auth if response is not None and response.data['errors'][0]['detail'] == "Authentication credentials were not provided.": response.status_code = 401
a155e8654a95969abc2290d4198622991d6cb00e
ideascube/conf/idb_bdi.py
ideascube/conf/idb_bdi.py
"""Generic config for Ideasbox of Burundi""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ USER_FORM_FIELDS = ( ('Ideasbox', ['serial', 'box_awareness']), (_('Personal informations'), ['refugee_id', 'short_name', 'full_name', 'birth_year', 'gender', 'phone']), # noqa (_('Family'), ['marital_status', 'family_status', 'children_under_12', 'children_under_18', 'children_above_18']), # noqa (_('In the camp'), ['camp_entry_date', 'camp_activities', 'current_occupation', 'camp_address']), # noqa (_('Origin'), ['country', 'city', 'country_of_origin_occupation', 'school_level', 'is_sent_to_school']), # noqa (_('Language skills'), ['rn_level', 'sw_level', 'fr_level']), (_('National residents'), ['id_card_number']), ) HOME_CARDS = HOME_CARDS + [ { 'id': 'vikidia', }, { 'id': 'gutenberg', }, { 'id': 'cpassorcier', }, { 'id': 'ted', }, ]
"""Generic config for Ideasbox of Burundi""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ USER_FORM_FIELDS = ( ('Ideasbox', ['serial', 'box_awareness']), (_('Personal informations'), ['refugee_id', 'short_name', 'full_name', 'birth_year', 'gender', 'phone']), # noqa (_('Family'), ['marital_status', 'family_status', 'children_under_12', 'children_under_18', 'children_above_18']), # noqa (_('In the camp'), ['camp_entry_date', 'camp_activities', 'current_occupation', 'camp_address']), # noqa (_('Origin'), ['country', 'city', 'country_of_origin_occupation', 'school_level', 'is_sent_to_school']), # noqa (_('Language skills'), ['rn_level', 'sw_level', 'fr_level']), (_('National residents'), ['id_card_number']), ) HOME_CARDS = HOME_CARDS + [ { 'id': 'cpassorcier', }, { 'id': 'ted', }, ]
Remove duplicate entry for vikidia and gutenberg in burundi boxes
Remove duplicate entry for vikidia and gutenberg in burundi boxes
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -14,12 +14,6 @@ HOME_CARDS = HOME_CARDS + [ { - 'id': 'vikidia', - }, - { - 'id': 'gutenberg', - }, - { 'id': 'cpassorcier', }, {
bc199a9eaa2416b35d1d691f580e6c9ca0b1a2ae
website/discovery/views.py
website/discovery/views.py
from website import settings from website.project import Node from website.project import utils from modularodm.query.querydialect import DefaultQueryDialect as Q def activity(): node_data = utils.get_node_data() if node_data: hits = utils.hits(node_data) else: hits = {} # New Projects new_and_noteworthy_pointers = Node.find_one(Q('_id', 'eq', settings.NEW_AND_NOTEWORTHY_LINKS_NODE)).nodes_pointer new_and_noteworthy_projects = [pointer.node for pointer in new_and_noteworthy_pointers] # Popular Projects popular_public_projects = Node.find_one(Q('_id', 'eq', settings.POPULAR_LINKS_NODE)).nodes_pointer # Popular Registrations popular_public_registrations = Node.find_one(Q('_id', 'eq', settings.POPULAR_LINKS_NODE_REGISTRATIONS)).nodes_pointer return { 'new_and_noteworthy_projects': new_and_noteworthy_projects, 'recent_public_registrations': utils.recent_public_registrations(), 'popular_public_projects': popular_public_projects, 'popular_public_registrations': popular_public_registrations, 'hits': hits, }
from website import settings from website.project import Node from website.project import utils from modularodm.query.querydialect import DefaultQueryDialect as Q def activity(): """Reads node activity from pre-generated popular projects and registrations. New and Noteworthy projects are set manually or through `scripts/populate_new_and_noteworthy_projects.py` Popular projects and registrations are generated by `scripts/populate_popular_projects_and_registrations.py` """ # New and Noreworthy Projects new_and_noteworthy_pointers = Node.find_one(Q('_id', 'eq', settings.NEW_AND_NOTEWORTHY_LINKS_NODE)).nodes_pointer new_and_noteworthy_projects = [pointer.node for pointer in new_and_noteworthy_pointers] # Popular Projects popular_public_projects = Node.find_one(Q('_id', 'eq', settings.POPULAR_LINKS_NODE)).nodes_pointer # Popular Registrations popular_public_registrations = Node.find_one(Q('_id', 'eq', settings.POPULAR_LINKS_NODE_REGISTRATIONS)).nodes_pointer return { 'new_and_noteworthy_projects': new_and_noteworthy_projects, 'recent_public_registrations': utils.recent_public_registrations(), 'popular_public_projects': popular_public_projects, 'popular_public_registrations': popular_public_registrations, }
Remove node counts and update docstrings on new view for activity
Remove node counts and update docstrings on new view for activity
Python
apache-2.0
monikagrabowska/osf.io,binoculars/osf.io,monikagrabowska/osf.io,acshi/osf.io,laurenrevere/osf.io,cslzchen/osf.io,laurenrevere/osf.io,alexschiller/osf.io,monikagrabowska/osf.io,Johnetordoff/osf.io,alexschiller/osf.io,mluo613/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,mfraezz/osf.io,aaxelb/osf.io,alexschiller/osf.io,Nesiehr/osf.io,mluo613/osf.io,sloria/osf.io,CenterForOpenScience/osf.io,mluo613/osf.io,acshi/osf.io,erinspace/osf.io,monikagrabowska/osf.io,rdhyee/osf.io,caneruguz/osf.io,adlius/osf.io,binoculars/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,baylee-d/osf.io,acshi/osf.io,adlius/osf.io,icereval/osf.io,monikagrabowska/osf.io,baylee-d/osf.io,adlius/osf.io,leb2dg/osf.io,icereval/osf.io,brianjgeiger/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io,brianjgeiger/osf.io,leb2dg/osf.io,brianjgeiger/osf.io,laurenrevere/osf.io,mfraezz/osf.io,mattclark/osf.io,crcresearch/osf.io,rdhyee/osf.io,aaxelb/osf.io,Nesiehr/osf.io,cwisecarver/osf.io,TomBaxter/osf.io,cslzchen/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,icereval/osf.io,mattclark/osf.io,crcresearch/osf.io,HalcyonChimera/osf.io,saradbowman/osf.io,pattisdr/osf.io,sloria/osf.io,caneruguz/osf.io,brianjgeiger/osf.io,sloria/osf.io,mluo613/osf.io,felliott/osf.io,HalcyonChimera/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,pattisdr/osf.io,leb2dg/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,aaxelb/osf.io,caneruguz/osf.io,adlius/osf.io,cwisecarver/osf.io,hmoco/osf.io,TomBaxter/osf.io,erinspace/osf.io,acshi/osf.io,leb2dg/osf.io,mattclark/osf.io,alexschiller/osf.io,TomBaxter/osf.io,Nesiehr/osf.io,binoculars/osf.io,acshi/osf.io,chennan47/osf.io,cwisecarver/osf.io,caneruguz/osf.io,chrisseto/osf.io,baylee-d/osf.io,felliott/osf.io,felliott/osf.io,caseyrollins/osf.io,chrisseto/osf.io,saradbowman/osf.io,cwisecarver/osf.io,hmoco/osf.io,erinspace/osf.io,crcresearch/osf.io,rdhyee/osf.io,chrisseto/osf.io,rdhyee/osf.io,hmoco/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,cslzchen/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,chrisseto/osf.io,felliott/osf.io,alexschiller/osf.io,Nesiehr/osf.io,hmoco/osf.io,mluo613/osf.io
--- +++ @@ -6,14 +6,12 @@ def activity(): + """Reads node activity from pre-generated popular projects and registrations. + New and Noteworthy projects are set manually or through `scripts/populate_new_and_noteworthy_projects.py` + Popular projects and registrations are generated by `scripts/populate_popular_projects_and_registrations.py` + """ - node_data = utils.get_node_data() - if node_data: - hits = utils.hits(node_data) - else: - hits = {} - - # New Projects + # New and Noreworthy Projects new_and_noteworthy_pointers = Node.find_one(Q('_id', 'eq', settings.NEW_AND_NOTEWORTHY_LINKS_NODE)).nodes_pointer new_and_noteworthy_projects = [pointer.node for pointer in new_and_noteworthy_pointers] @@ -28,5 +26,4 @@ 'recent_public_registrations': utils.recent_public_registrations(), 'popular_public_projects': popular_public_projects, 'popular_public_registrations': popular_public_registrations, - 'hits': hits, }
e968983001cced5391a163ab282ef2f2ded492f6
eliot/__init__.py
eliot/__init__.py
""" Eliot: An Opinionated Logging Library Suppose we turn from outside estimates of a man, to wonder, with keener interest, what is the report of his own consciousness about his doings or capacity: with what hindrances he is carrying on his daily labors; what fading of hopes, or what deeper fixity of self-delusion the years are marking off within him; and with what spirit he wrestles against universal pressure, which will one day be too heavy for him, and bring his heart to its final pause. -- George Eliot, "Middlemarch" See http://wiki.hybrid-cluster.com/index.php?title=Logging_Design_Document for motivation. """ # Expose the public API: from ._message import Message from ._action import startAction, startTask, Action from ._output import ILogger, Logger, MemoryLogger from ._validation import Field, MessageType, ActionType from ._traceback import writeTraceback, writeFailure addDestination = Logger._destinations.add removeDestination = Logger._destinations.remove __all__ = ["Message", "writeTraceback", "writeFailure", "startAction", "startTask", "Action", "Field", "MessageType", "ActionType", "ILogger", "Logger", "MemoryLogger", "addDestination", "removeDestination", ]
""" Eliot: Logging as Storytelling Suppose we turn from outside estimates of a man, to wonder, with keener interest, what is the report of his own consciousness about his doings or capacity: with what hindrances he is carrying on his daily labors; what fading of hopes, or what deeper fixity of self-delusion the years are marking off within him; and with what spirit he wrestles against universal pressure, which will one day be too heavy for him, and bring his heart to its final pause. -- George Eliot, "Middlemarch" """ # Expose the public API: from ._message import Message from ._action import startAction, startTask, Action from ._output import ILogger, Logger, MemoryLogger from ._validation import Field, MessageType, ActionType from ._traceback import writeTraceback, writeFailure addDestination = Logger._destinations.add removeDestination = Logger._destinations.remove __all__ = ["Message", "writeTraceback", "writeFailure", "startAction", "startTask", "Action", "Field", "MessageType", "ActionType", "ILogger", "Logger", "MemoryLogger", "addDestination", "removeDestination", ]
Remove link to private document.
Remove link to private document.
Python
apache-2.0
ScatterHQ/eliot,ClusterHQ/eliot,ScatterHQ/eliot,iffy/eliot,ScatterHQ/eliot
--- +++ @@ -1,5 +1,5 @@ """ -Eliot: An Opinionated Logging Library +Eliot: Logging as Storytelling Suppose we turn from outside estimates of a man, to wonder, with keener interest, what is the report of his own consciousness about his doings or @@ -10,9 +10,6 @@ its final pause. -- George Eliot, "Middlemarch" - -See http://wiki.hybrid-cluster.com/index.php?title=Logging_Design_Document for -motivation. """ # Expose the public API:
4d46001296ad083df6827a9c97333f0f093f31bd
example/config.py
example/config.py
# Mnemosyne configuration # ======================= # # This file is a Python script. When run, the following variables will be # defined for you; you may change or add to them as you see fit. # # ``entries_dir``: a Maildir containing all the blog entries. # ``layout_dir``: the blog's layout, as a skeleton directory tree. # ``style_dir``: empy styles used for filling layout templates. # ``output_dir``: location where we will write the generated pages. # # These will be $HOME/Mnemosyne/{entries,layout,style,htdocs} respectively. # # ``vars``: a dict of default local variables passed to all templates. # # This will contain the keys __version__, __url__, __author__, and __email__. # # You may also define functions here to add 'magic' attributes to each entry. # A function with a name of the form ``make_MAGIC`` (which takes a single # argument, the entry) will be used to create an attribute ``e._MAGIC`` for # each entry ``e``. Either a single value or a list of values may be returned. # # In your layout, a file or directory name containing ``__MAGIC__`` will then # be evaluated once for each value ``make_MAGIC`` returns, with the entries # for which ``make_MAGIC`` returns that value or a list containing it. vars['blogname'] = 'Example Blog' class Entry: def get_organization(self): return self.m.get('Organization')
# Mnemosyne configuration # ======================= # # This file is a Python script. When run, the following variables will be # defined for you; you may change or add to them as you see fit. # # * ``entries_dir``: a Maildir containing all the blog entries. # * ``layout_dir``: the blog's layout, as a skeleton directory tree. # * ``style_dir``: empy styles used for filling layout templates. # * ``output_dir``: location where we will write the generated pages. # # These will be $HOME/Mnemosyne/{entries,layout,style,htdocs} respectively. # # * ``locals``: a dict of default local variables passed to all templates. # # This will contain the keys __version__, __url__, __author__, and __email__. # # * ``MnemosyneEntry``: a class used to represent each entry passed to the # templates. # # If you wish to extend this class, you may define a new class ``Entry`` here, # using ``MnemosyneEntry`` as its base class. Any methods with a name of the # form ``get_ATTRIBUTE`` will be used to provide e.ATTRIBUTE at runtime. locals['blogname'] = 'Example Blog' locals['base'] = 'http://example.invalid' class Entry: def get_organization(self): return self.m.get('Organization')
Document new evil magic, and add required var.
Document new evil magic, and add required var.
Python
isc
decklin/ennepe
--- +++ @@ -4,27 +4,26 @@ # This file is a Python script. When run, the following variables will be # defined for you; you may change or add to them as you see fit. # -# ``entries_dir``: a Maildir containing all the blog entries. -# ``layout_dir``: the blog's layout, as a skeleton directory tree. -# ``style_dir``: empy styles used for filling layout templates. -# ``output_dir``: location where we will write the generated pages. +# * ``entries_dir``: a Maildir containing all the blog entries. +# * ``layout_dir``: the blog's layout, as a skeleton directory tree. +# * ``style_dir``: empy styles used for filling layout templates. +# * ``output_dir``: location where we will write the generated pages. # # These will be $HOME/Mnemosyne/{entries,layout,style,htdocs} respectively. # -# ``vars``: a dict of default local variables passed to all templates. +# * ``locals``: a dict of default local variables passed to all templates. # # This will contain the keys __version__, __url__, __author__, and __email__. # -# You may also define functions here to add 'magic' attributes to each entry. -# A function with a name of the form ``make_MAGIC`` (which takes a single -# argument, the entry) will be used to create an attribute ``e._MAGIC`` for -# each entry ``e``. Either a single value or a list of values may be returned. +# * ``MnemosyneEntry``: a class used to represent each entry passed to the +# templates. # -# In your layout, a file or directory name containing ``__MAGIC__`` will then -# be evaluated once for each value ``make_MAGIC`` returns, with the entries -# for which ``make_MAGIC`` returns that value or a list containing it. +# If you wish to extend this class, you may define a new class ``Entry`` here, +# using ``MnemosyneEntry`` as its base class. Any methods with a name of the +# form ``get_ATTRIBUTE`` will be used to provide e.ATTRIBUTE at runtime. -vars['blogname'] = 'Example Blog' +locals['blogname'] = 'Example Blog' +locals['base'] = 'http://example.invalid' class Entry: def get_organization(self):
5b0386d0872d4106902655ada78389503c62a95a
yunity/models/relations.py
yunity/models/relations.py
from django.db.models import ForeignKey, DateTimeField, ManyToManyField from yunity.models.entities import User, Location, Mappable, Message from yunity.models.utils import BaseModel, MaxLengthCharField from yunity.utils.decorators import classproperty class Chat(BaseModel): participants = ManyToManyField(User) messages = ManyToManyField(Message) class MappableLocation(BaseModel): mappable = ForeignKey(Mappable) location = ForeignKey(Location) startTime = DateTimeField(null=True) endTime = DateTimeField(null=True) class MappableResponsibility(BaseModel): @classproperty def TYPE(cls): return cls.create_constants('type', 'OWNER') @classproperty def STATUS(cls): return cls.create_constants('status', 'GRANTED', 'PENDING', 'REQUESTED') responsible = ForeignKey(User, null=True) mappable = ForeignKey(Mappable) status = MaxLengthCharField() date = DateTimeField(null=True, auto_now=True) type = MaxLengthCharField() class UserLocation(BaseModel): user = ForeignKey(User) location = ForeignKey(Location) type = MaxLengthCharField() class ItemRequest(BaseModel): requester = ForeignKey(User) requested = ForeignKey(Mappable) feedback = MaxLengthCharField(null=True, default=None)
from django.db.models import ForeignKey, DateTimeField, ManyToManyField from yunity.models.entities import User, Location, Mappable, Message from yunity.models.utils import BaseModel, MaxLengthCharField from yunity.utils.decorators import classproperty class Chat(BaseModel): participants = ManyToManyField(User) messages = ManyToManyField(Message) class MappableLocation(BaseModel): mappable = ForeignKey(Mappable) location = ForeignKey(Location) startTime = DateTimeField(null=True) endTime = DateTimeField(null=True) class MappableResponsibility(BaseModel): @classproperty def TYPE(cls): return cls.create_constants('type', 'OWNER') @classproperty def STATUS(cls): return cls.create_constants('status', 'GRANTED', 'PENDING', 'REQUESTED') responsible = ForeignKey(User, null=True) mappable = ForeignKey(Mappable) status = MaxLengthCharField() date = DateTimeField(null=True, auto_now=True) type = MaxLengthCharField() class UserLocation(BaseModel): user = ForeignKey(User) location = ForeignKey(Location) type = MaxLengthCharField() class ItemRequest(BaseModel): @classproperty def FEEDBACK(cls): return cls.create_constants('feedback', 'OK', 'NO_SHOW', 'NOT_GRANTED') requester = ForeignKey(User) requested = ForeignKey(Mappable) feedback = MaxLengthCharField(null=True, default=None)
Add some default feedback types for item requests
Add some default feedback types for item requests
Python
agpl-3.0
yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend
--- +++ @@ -42,6 +42,10 @@ class ItemRequest(BaseModel): + @classproperty + def FEEDBACK(cls): + return cls.create_constants('feedback', 'OK', 'NO_SHOW', 'NOT_GRANTED') + requester = ForeignKey(User) requested = ForeignKey(Mappable)
af4c5a72afb80ff59662cc6992ce3084fed75dfe
node/deduplicate.py
node/deduplicate.py
#!/usr/bin/env python from nodes import Node class Deduplicate(Node): char = "}" args = 1 results = 2 @Node.test_func([2], [4]) @Node.test_func([1.5], [3]) def double(self, inp: Node.number): """inp*2""" self.results = 1 return inp*2 def func(self, seq:Node.indexable): """remove duplicates from seq""" if isinstance(seq, str): return "".join(set(seq)) return [type(seq)(set(seq))]
#!/usr/bin/env python from nodes import Node class Deduplicate(Node): char = "}" args = 1 results = 1 @Node.test_func([2], [4]) @Node.test_func([1.5], [3]) def double(self, inp: Node.number): """inp*2""" return inp*2 @Node.test_func([[1,2,3,1,1]], [[1,2,3]]) @Node.test_func(["hi!!!"], ["hi!"]) def func(self, seq:Node.indexable): """remove duplicates from seq""" seen = set() seen_add = seen.add if isinstance(seq, str): return "".join(x for x in seq if not (x in seen or seen_add(x))) return[type(seq)([x for x in seq if not (x in seen or seen_add(x))])]
Fix dedupe not preserving order
Fix dedupe not preserving order
Python
mit
muddyfish/PYKE,muddyfish/PYKE
--- +++ @@ -5,17 +5,20 @@ class Deduplicate(Node): char = "}" args = 1 - results = 2 + results = 1 @Node.test_func([2], [4]) @Node.test_func([1.5], [3]) def double(self, inp: Node.number): """inp*2""" - self.results = 1 return inp*2 + @Node.test_func([[1,2,3,1,1]], [[1,2,3]]) + @Node.test_func(["hi!!!"], ["hi!"]) def func(self, seq:Node.indexable): """remove duplicates from seq""" + seen = set() + seen_add = seen.add if isinstance(seq, str): - return "".join(set(seq)) - return [type(seq)(set(seq))] + return "".join(x for x in seq if not (x in seen or seen_add(x))) + return[type(seq)([x for x in seq if not (x in seen or seen_add(x))])]
05c319f868215f832e97577f5e158edf82fab074
markdown/__version__.py
markdown/__version__.py
# # markdown/__version__.py # # version_info should conform to PEP 386 # (major, minor, micro, alpha/beta/rc/final, #) # (1, 1, 2, 'alpha', 0) => "1.1.2.dev" # (1, 2, 0, 'beta', 2) => "1.2b2" version_info = (2, 6, 0, 'zds', 7) def _get_version(): " Returns a PEP 386-compliant version number from version_info. " assert len(version_info) == 5 assert version_info[3] in ('alpha', 'beta', 'rc', 'final', 'zds') parts = 2 if version_info[2] == 0 else 3 main = '.'.join(map(str, version_info[:parts])) sub = '' if version_info[3] == 'alpha' and version_info[4] == 0: # TODO: maybe append some sort of git info here?? sub = '.dev' elif version_info[3] != 'final': mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c', 'zds': 'post'} sub = mapping[version_info[3]] + str(version_info[4]) return str(main + sub) version = _get_version()
# # markdown/__version__.py # # version_info should conform to PEP 386 # (major, minor, micro, alpha/beta/rc/final, #) # (1, 1, 2, 'alpha', 0) => "1.1.2.dev" # (1, 2, 0, 'beta', 2) => "1.2b2" version_info = (2, 6, 0, 'zds', 8) def _get_version(): " Returns a PEP 386-compliant version number from version_info. " assert len(version_info) == 5 assert version_info[3] in ('alpha', 'beta', 'rc', 'final', 'zds') parts = 2 if version_info[2] == 0 else 3 main = '.'.join(map(str, version_info[:parts])) sub = '' if version_info[3] == 'alpha' and version_info[4] == 0: # TODO: maybe append some sort of git info here?? sub = '.dev' elif version_info[3] != 'final': mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c', 'zds': 'post'} sub = mapping[version_info[3]] + str(version_info[4]) return str(main + sub) version = _get_version()
Change version for next release
Change version for next release
Python
bsd-3-clause
zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown
--- +++ @@ -5,7 +5,7 @@ # (major, minor, micro, alpha/beta/rc/final, #) # (1, 1, 2, 'alpha', 0) => "1.1.2.dev" # (1, 2, 0, 'beta', 2) => "1.2b2" -version_info = (2, 6, 0, 'zds', 7) +version_info = (2, 6, 0, 'zds', 8) def _get_version():
ab10f3d134065047a7260662d3c39295904795b8
migration/versions/001_initial_migration.py
migration/versions/001_initial_migration.py
from __future__ import print_function from getpass import getpass import readline import sys from sqlalchemy import * from migrate import * from migrate.changeset.constraint import ForeignKeyConstraint import annotateit from annotateit import db from annotateit.model import Consumer, User meta = MetaData() consumer = Table('consumer', meta, Column('id', Integer, primary_key=True, nullable=False), Column('key', String), Column('secret', String), Column('ttl', Integer), Column('created_at', DateTime), Column('updated_at', DateTime), Column('user_id', Integer), ) user = Table('user', meta, Column('id', Integer, primary_key=True, nullable=False), Column('username', String), Column('email', String), Column('password_hash', String), Column('created_at', DateTime), Column('updated_at', DateTime), ) consumer_user_id_fkey = ForeignKeyConstraint([consumer.c.user_id], [user.c.id]) def upgrade(migrate_engine): meta.bind = migrate_engine consumer.create() user.create() consumer_user_id_fkey.create() def downgrade(migrate_engine): meta.bind = migrate_engine consumer_user_id_fkey.create() user.drop() consumer.drop()
from sqlalchemy import * from migrate import * import annotateit from annotateit import db from annotateit.model import Consumer, User meta = MetaData() consumer = Table('consumer', meta, Column('id', Integer, primary_key=True, nullable=False), Column('key', String), Column('secret', String), Column('ttl', Integer), Column('created_at', DateTime), Column('updated_at', DateTime), Column('user_id', Integer, ForeignKey('user.id')), ) user = Table('user', meta, Column('id', Integer, primary_key=True, nullable=False), Column('username', String), Column('email', String), Column('password_hash', String), Column('created_at', DateTime), Column('updated_at', DateTime), ) def upgrade(migrate_engine): meta.bind = migrate_engine user.create() consumer.create() def downgrade(migrate_engine): meta.bind = migrate_engine consumer.drop() user.drop()
Add fkey constraints at the same time
Add fkey constraints at the same time
Python
agpl-3.0
openannotation/annotateit,openannotation/annotateit
--- +++ @@ -1,11 +1,5 @@ -from __future__ import print_function -from getpass import getpass -import readline -import sys - from sqlalchemy import * from migrate import * -from migrate.changeset.constraint import ForeignKeyConstraint import annotateit from annotateit import db @@ -20,7 +14,7 @@ Column('ttl', Integer), Column('created_at', DateTime), Column('updated_at', DateTime), - Column('user_id', Integer), + Column('user_id', Integer, ForeignKey('user.id')), ) user = Table('user', meta, @@ -32,16 +26,12 @@ Column('updated_at', DateTime), ) -consumer_user_id_fkey = ForeignKeyConstraint([consumer.c.user_id], [user.c.id]) - def upgrade(migrate_engine): meta.bind = migrate_engine + user.create() consumer.create() - user.create() - consumer_user_id_fkey.create() def downgrade(migrate_engine): meta.bind = migrate_engine - consumer_user_id_fkey.create() + consumer.drop() user.drop() - consumer.drop()
1421866ac3c4e4f1f09d17019d058aa903597df5
modules/menus_reader.py
modules/menus_reader.py
# -*- coding: utf-8 -*- from json_reader import * from config import * def get_menus_data(): old_data = read_json_from_file(filenames["menus"]) if old_data == None or type(old_data) is not dict: # rewrite old_data and create new recipe dictionary # initialize new dict old_data = {} old_data["menus"] = {} elif "menus" not in old_data and type(old_data) is dict: # save other data (maybe worthless) # add new row: recipes old_data["menus"] = {} return old_data def get_menus(): data = get_menus_data() return data["menus"] def get_menu(index): #get recipe with spesific index pass #return get_menus()[index]
# -*- coding: utf-8 -*- from json_reader import * from config import * def get_menus_data(): old_data = read_json_from_file(filenames["menus"]) if old_data == None or type(old_data) is not dict: # rewrite old_data and create new recipe dictionary # initialize new dict old_data = {} old_data["menus"] = {} elif "menus" not in old_data and type(old_data) is dict: # save other data (maybe worthless) # add new row: recipes old_data["menus"] = {} return old_data def get_menus(): data = get_menus_data() return data["menus"] def get_menu(index): #get recipe with spesific index return get_menus()[index] def is_week_menu_created(week): return week in get_menus() # True/False
Add new feature: find out is current week menu created already
Add new feature: find out is current week menu created already
Python
mit
Jntz/RuokalistaCommandLine
--- +++ @@ -17,5 +17,7 @@ return data["menus"] def get_menu(index): #get recipe with spesific index - pass - #return get_menus()[index] + return get_menus()[index] + +def is_week_menu_created(week): + return week in get_menus() # True/False
10dc027ee15428d7ca210e0b74e5ae9274de0fa8
lianXiangCi.py
lianXiangCi.py
#coding:utf-8 import urllib import urllib2 import re from random import choice ipList=['120.76.115.134:80','222.83.14.145:3128','119.188.94.145:80'] thisIp=choice(ipList) keyWord=urllib.quote('科学') url='http://search.sina.com.cn/iframe/suggest/index.php?q='+keyWord headers={ 'Get':url, 'Host':'search.sina.com.cn', 'Referer':'http://search.sina.com.cn/', 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36' } proxy_support = urllib2.ProxyHandler({'http': 'http://'+thisIp}) opener=urllib2.build_opener(proxy_support) urllib2.install_opener(opener) req=urllib2.Request(url) for key in headers: req.add_header(key,headers[key]) html=urllib2.urlopen(req).read() file=open('C:\Users\Ryan\Desktop\lianXC.txt','w') file.write(html)
#coding:utf-8 import urllib import urllib2 import re from random import choice ipList=['120.76.115.134:80','222.83.14.145:3128','119.188.94.145:80'] thisIp=choice(ipList) input = raw_input("Please input your key words:") keyWord=urllib.quote(input) url='http://search.sina.com.cn/iframe/suggest/index.php?q='+keyWord headers={ 'Get':url, 'Host':'search.sina.com.cn', 'Referer':'http://search.sina.com.cn/', 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36' } proxy_support = urllib2.ProxyHandler({'http': 'http://'+thisIp}) opener=urllib2.build_opener(proxy_support) urllib2.install_opener(opener) req=urllib2.Request(url) for key in headers: req.add_header(key,headers[key]) html=urllib2.urlopen(req).read() file=open('C:\Users\Ryan\Desktop\lianXC.txt','w') file.write(html)
Use raw_input instead of the unmodified words
Use raw_input instead of the unmodified words
Python
mit
YChrisZhang/PythonCrawler
--- +++ @@ -8,7 +8,8 @@ ipList=['120.76.115.134:80','222.83.14.145:3128','119.188.94.145:80'] thisIp=choice(ipList) -keyWord=urllib.quote('科学') +input = raw_input("Please input your key words:") +keyWord=urllib.quote(input) url='http://search.sina.com.cn/iframe/suggest/index.php?q='+keyWord
03fec45fa269a8badbe047b4911c655c3c952404
st2client/st2client/models/action_alias.py
st2client/st2client/models/action_alias.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 this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from st2client.models import core __all__ = [ 'ActionAlias' ] class ActionAlias(core.Resource): _alias = 'ActionAlias' _display_name = 'Action Alias' _plural = 'ActionAliases' _plural_display_name = 'Runners' _url_path = 'actionalias' _repr_attributes = ['name', 'pack', 'action_ref']
# 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 this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from st2client.models import core __all__ = [ 'ActionAlias' ] class ActionAlias(core.Resource): _alias = 'Action-Alias' _display_name = 'Action Alias' _plural = 'ActionAliases' _plural_display_name = 'Runners' _url_path = 'actionalias' _repr_attributes = ['name', 'pack', 'action_ref']
Use consistent CLI command names.
Use consistent CLI command names.
Python
apache-2.0
alfasin/st2,Itxaka/st2,StackStorm/st2,StackStorm/st2,alfasin/st2,punalpatel/st2,punalpatel/st2,dennybaa/st2,alfasin/st2,punalpatel/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,peak6/st2,pixelrebel/st2,armab/st2,tonybaloney/st2,grengojbo/st2,Plexxi/st2,grengojbo/st2,emedvedev/st2,Plexxi/st2,nzlosh/st2,pixelrebel/st2,StackStorm/st2,dennybaa/st2,dennybaa/st2,armab/st2,emedvedev/st2,lakshmi-kannan/st2,tonybaloney/st2,pixelrebel/st2,tonybaloney/st2,Itxaka/st2,grengojbo/st2,nzlosh/st2,emedvedev/st2,Itxaka/st2,nzlosh/st2,armab/st2,lakshmi-kannan/st2,peak6/st2,lakshmi-kannan/st2,peak6/st2
--- +++ @@ -21,7 +21,7 @@ class ActionAlias(core.Resource): - _alias = 'ActionAlias' + _alias = 'Action-Alias' _display_name = 'Action Alias' _plural = 'ActionAliases' _plural_display_name = 'Runners'
70181b3069649eddacac86dbcb49cb43733be0ec
tw_begins.py
tw_begins.py
#!/usr/bin/env python import begin import twitterlib @begin.subcommand def timeline(): "Display recent tweets from users timeline" for status in begin.context.api.timeline: print u"%s: %s" % (status.user.screen_name, status.text) @begin.subcommand def mentions(): "Display recent tweets mentioning user" for status in begin.context.api.mentions: print u"%s: %s" % (status.user.screen_name, status.text) @begin.subcommand def retweets(): "Display recent retweets from user's timeline" for status in begin.context.api.retweets: print u"%s: %s" % (status.user.screen_name, status.text) @begin.start(env_prefix='', short_args=False) def main(api_key='', api_secret='', access_token='', access_secret=''): """Minimal Twitter client Demonstrate the use of the begins command line application framework by implementing a simple Twitter command line client. """ api = twitterlib.API(api_key, api_secret, access_token, access_secret) begin.context.api = api
#!/usr/bin/env python import begin import twitterlib # sub-command definitions using subcommand decorator for each sub-command that # implements a timeline display @begin.subcommand def timeline(): "Display recent tweets from users timeline" for status in begin.context.api.timeline: print u"%s: %s" % (status.user.screen_name, status.text) @begin.subcommand def mentions(): "Display recent tweets mentioning user" for status in begin.context.api.mentions: print u"%s: %s" % (status.user.screen_name, status.text) @begin.subcommand def retweets(): "Display recent retweets from user's timeline" for status in begin.context.api.retweets: print u"%s: %s" % (status.user.screen_name, status.text) # program main definition replace __name__ === '__main__' magic # sub-commands are registered and loaded automatically @begin.start(env_prefix='', short_args=False) def main(api_key='', api_secret='', access_token='', access_secret=''): """Minimal Twitter client Demonstrate the use of the begins command line application framework by implementing a simple Twitter command line client. """ api = twitterlib.API(api_key, api_secret, access_token, access_secret) begin.context.api = api
Add code comments for begins example
Add code comments for begins example Code comments for the major sections of the begins example program.
Python
mit
aliles/cmdline_examples
--- +++ @@ -4,6 +4,8 @@ import twitterlib +# sub-command definitions using subcommand decorator for each sub-command that +# implements a timeline display @begin.subcommand def timeline(): "Display recent tweets from users timeline" @@ -22,6 +24,8 @@ for status in begin.context.api.retweets: print u"%s: %s" % (status.user.screen_name, status.text) +# program main definition replace __name__ === '__main__' magic +# sub-commands are registered and loaded automatically @begin.start(env_prefix='', short_args=False) def main(api_key='', api_secret='', access_token='', access_secret=''): """Minimal Twitter client
c95bff54d8ff6534c40d60f34484f864cc04754a
lib/web/web.py
lib/web/web.py
import os, os.path import random import string import json import cherrypy from . import get_pic class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head> <link href="/static/css/style.css" rel="stylesheet"> </head> <body> wrong page </body> </html>""" @cherrypy.expose def get_picture(self, url=""): return get_pic.base64_picture(url) @cherrypy.expose def search(self, query): return json.dumps({"book": {"title":"Gs", "author":"Bash Gs", "url":"https://chitanka.info/text/1"}, "recommended":[{"title":"Gs1", "author":"Bash Gs1", "url":"https://chitanka.info/text/2"}, {"title":"Gs2", "author":"Bash Gs2", "url":"https://chitanka.info/text/3"}]}) @cherrypy.expose def display(self): return cherrypy.session['mystring'] def main(): conf = { '/': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join( os.path.abspath(os.path.dirname(os.path.realpath(__file__))), 'web' ) }, } cherrypy.quickstart(StringGenerator(), '/', conf) if __name__ == '__main__': main()
import os, os.path import random import string import json import cherrypy from . import get_pic class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head> <link href="/static/css/style.css" rel="stylesheet"> </head> <body> wrong page </body> </html>""" @cherrypy.expose def get_picture(self, url=""): return get_pic.base64_picture(url) @cherrypy.expose def search(self, query): return json.dumps({"book": {"title":"Gs", "author":"Bash Gs", "url":"https://chitanka.info/text/1"}, "recommended":[{"title":"Gs1", "author":"Bash Gs1", "url":"https://chitanka.info/text/2"}, {"title":"Gs2", "author":"Bash Gs2", "url":None}]}) @cherrypy.expose def display(self): return cherrypy.session['mystring'] def main(): conf = { '/': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join( os.path.abspath(os.path.dirname(os.path.realpath(__file__))), 'web' ) }, } cherrypy.quickstart(StringGenerator(), '/', conf) if __name__ == '__main__': main()
Add example for when there is no book cover url
Add example for when there is no book cover url
Python
mit
DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat
--- +++ @@ -29,8 +29,8 @@ @cherrypy.expose def search(self, query): return json.dumps({"book": {"title":"Gs", "author":"Bash Gs", "url":"https://chitanka.info/text/1"}, - "recommended":[{"title":"Gs1", "author":"Bash Gs1", "url":"https://chitanka.info/text/2"}, - {"title":"Gs2", "author":"Bash Gs2", "url":"https://chitanka.info/text/3"}]}) + "recommended":[{"title":"Gs1", "author":"Bash Gs1", "url":"https://chitanka.info/text/2"}, + {"title":"Gs2", "author":"Bash Gs2", "url":None}]}) @cherrypy.expose def display(self):
ecc471f94dc2ca2931370e53948d9f674dd673d4
h2o-py/tests/testdir_munging/unop/pyunit_cor.py
h2o-py/tests/testdir_munging/unop/pyunit_cor.py
from builtins import range import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils ## # Test out the cor() functionality # If NAs in the frame, they are skipped in calculation unless na.rm = F # If any categorical columns, throw an error ## import numpy as np def cor_test(): iris_h2o = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris.csv")) iris_np = np.genfromtxt(pyunit_utils.locate("smalldata/iris/iris.csv"), delimiter=',', skip_header=1, usecols=(0, 1, 2, 3)) cor_np = h2o.H2OFrame(np.corrcoef(iris_np,rowvar=0)) cor_h2o = iris_h2o[0:4].cor() cor_diff = abs(cor_h2o - cor_np) print("Correlation matrix with H2O: ") print cor_h2o print("Correlation matrix with Numpy: ") print cor_np print("Correlation differences between H2O and Numpy: ") print cor_diff print("Max difference in correlation calculation between H2O and Numpy: ") print cor_diff.max() max = cor_diff.max() assert max < .006, "expected equal correlations" if __name__ == "__main__": pyunit_utils.standalone_test(cor_test) else: cor_test()
from builtins import range import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils ## # Test out the cor() functionality # If NAs in the frame, they are skipped in calculation unless na.rm = F # If any categorical columns, throw an error ## import numpy as np def cor_test(): iris_h2o = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris.csv")) iris_np = np.genfromtxt(pyunit_utils.locate("smalldata/iris/iris.csv"), delimiter=',', skip_header=1, usecols=(0, 1, 2, 3)) cor_np = h2o.H2OFrame(np.corrcoef(iris_np,rowvar=0)) cor_h2o = iris_h2o[0:4].cor() cor_diff = abs(cor_h2o - cor_np) print("Correlation matrix with H2O: ") print(cor_h2o) print("Correlation matrix with Numpy: ") print(cor_np) print("Correlation differences between H2O and Numpy: ") print(cor_diff) print("Max difference in correlation calculation between H2O and Numpy: ") print(cor_diff.max()) max = cor_diff.max() assert max < .006, "expected equal correlations" if __name__ == "__main__": pyunit_utils.standalone_test(cor_test) else: cor_test()
Add parenthesis to print statement
Add parenthesis to print statement
Python
apache-2.0
mathemage/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,h2oai/h2o-3,mathemage/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,h2oai/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,spennihana/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,spennihana/h2o-3
--- +++ @@ -29,16 +29,16 @@ cor_diff = abs(cor_h2o - cor_np) print("Correlation matrix with H2O: ") - print cor_h2o + print(cor_h2o) print("Correlation matrix with Numpy: ") - print cor_np + print(cor_np) print("Correlation differences between H2O and Numpy: ") - print cor_diff + print(cor_diff) print("Max difference in correlation calculation between H2O and Numpy: ") - print cor_diff.max() + print(cor_diff.max()) max = cor_diff.max() assert max < .006, "expected equal correlations"
4adb78fde502faed78350233896f3efd3f42816e
cytoplasm/interpreters.py
cytoplasm/interpreters.py
''' These are some utilites used when writing and handling interpreters. ''' import shutil from cytoplasm import configuration from cytoplasm.errors import InterpreterError def SaveReturned(fn): '''Some potential interpreters, like Mako, don't give you an easy way to save to a destination. In these cases, simply use this function as a decorater.''' def InterpreterWithSave(source, destination, **kwargs): # under some circumstances, this should be able to write to file-like objects; # so if destination is a string, assume it's a path; otherwise, it's a file-like object if isinstance(destination, str): f = open(destination, "w") else: f = destination # pass **kwargs to this function. f.write(fn(source, **kwargs)) f.close() return InterpreterWithSave def interpret(file, destination, **kwargs): "Interpret a file with an interpreter according to its suffix." # get the list of interpreters from the configuration interpreters = configuration.get_config().interpreters # figure out the suffix of the file, to use to determine which interpreter to use ending = ".".join(file.split(".")[:-1]) try: interpreters.get(ending, shutil.copyfile)(file, destination, **kwargs) except Exception as exception: # if the interpreter chokes, raise an InterpreterError with some useful information. raise InterpreterError("%s on file '%s': %s" %(ending, file, exception))
''' These are some utilites used when writing and handling interpreters. ''' import shutil from cytoplasm import configuration from cytoplasm.errors import InterpreterError def SaveReturned(fn): '''Some potential interpreters, like Mako, don't give you an easy way to save to a destination. In these cases, simply use this function as a decorater.''' def InterpreterWithSave(source, destination, **kwargs): # under some circumstances, this should be able to write to file-like objects; # so if destination is a string, assume it's a path; otherwise, it's a file-like object if isinstance(destination, str): f = open(destination, "w") else: f = destination # pass **kwargs to this function. f.write(fn(source, **kwargs)) f.close() return InterpreterWithSave @SaveReturned def default_interpreter(source, **kwargs): f = open(source) source_string = f.read() f.close() return source_string def interpret(file, destination, **kwargs): "Interpret a file with an interpreter according to its suffix." # get the list of interpreters from the configuration interpreters = configuration.get_config().interpreters # figure out the suffix of the file, to use to determine which interpreter to use ending = file.split(".")[-1] interpreters.get(ending, default_interpreter)(file, destination, **kwargs)
Define a default interpreter rather than using shutil.copyfile.
Define a default interpreter rather than using shutil.copyfile. It would choke before if it was handed a file-like object rather than a file name. Even more bleh!.
Python
mit
startling/cytoplasm
--- +++ @@ -21,15 +21,18 @@ f.close() return InterpreterWithSave +@SaveReturned +def default_interpreter(source, **kwargs): + f = open(source) + source_string = f.read() + f.close() + return source_string + def interpret(file, destination, **kwargs): "Interpret a file with an interpreter according to its suffix." # get the list of interpreters from the configuration interpreters = configuration.get_config().interpreters # figure out the suffix of the file, to use to determine which interpreter to use - ending = ".".join(file.split(".")[:-1]) - try: - interpreters.get(ending, shutil.copyfile)(file, destination, **kwargs) - except Exception as exception: - # if the interpreter chokes, raise an InterpreterError with some useful information. - raise InterpreterError("%s on file '%s': %s" %(ending, file, exception)) + ending = file.split(".")[-1] + interpreters.get(ending, default_interpreter)(file, destination, **kwargs)
5934669c0edbd914d14612e16be7c88641b50bee
test/test_chat_chatserverstatus.py
test/test_chat_chatserverstatus.py
from pytwitcherapi import chat def test_eq_str(servers): assert servers[0] == '192.16.64.11:80',\ "Server should be equal to the same address." def test_noteq_str(servers): assert servers[0] != '192.16.64.50:89',\ """Server should not be equal to a different address""" def test_eq(servers): s1 = chat.ChatServerStatus('192.16.64.11:80') assert servers[0] == s1,\ """Servers with same address should be equal""" def test_noteq(servers): assert servers[0] != servers[1],\ """Servers with different address should not be equal""" def test_lt(servers): sortedservers = sorted(servers) expected = [servers[2], servers[3], servers[0], servers[1]] assert sortedservers == expected,\ """Server should be sorted like this: online, then offline, little errors, then more errors, little lag, then more lag."""
from pytwitcherapi import chat def test_eq_str(servers): assert servers[0] == '192.16.64.11:80',\ "Server should be equal to the same address." def test_noteq_str(servers): assert servers[0] != '192.16.64.50:89',\ """Server should not be equal to a different address""" def test_eq(servers): s1 = chat.ChatServerStatus('192.16.64.11:80') assert servers[0] == s1,\ """Servers with same address should be equal""" assert not (s1 == 123),\ """Servers should not be eqaul to other classes with different id""" def test_noteq(servers): assert not (servers[0] == servers[1]),\ """Servers with different address should not be equal""" def test_lt(servers): sortedservers = sorted(servers) expected = [servers[2], servers[3], servers[0], servers[1]] assert sortedservers == expected,\ """Server should be sorted like this: online, then offline, little errors, then more errors, little lag, then more lag."""
Fix test for eq and test eq with other classes
Fix test for eq and test eq with other classes
Python
bsd-3-clause
Pytwitcher/pytwitcherapi,Pytwitcher/pytwitcherapi
--- +++ @@ -15,10 +15,12 @@ s1 = chat.ChatServerStatus('192.16.64.11:80') assert servers[0] == s1,\ """Servers with same address should be equal""" + assert not (s1 == 123),\ + """Servers should not be eqaul to other classes with different id""" def test_noteq(servers): - assert servers[0] != servers[1],\ + assert not (servers[0] == servers[1]),\ """Servers with different address should not be equal"""
0cc04e9a486fb7dcf312a5c336f8f529f8b1f32d
skcode/__init__.py
skcode/__init__.py
""" SkCode (Python implementation of BBcode syntax) parser library. """ # Package information __author__ = "Fabien Batteix (@skywodd)" __copyright__ = "Copyright 2015, TamiaLab" __credits__ = ["Fabien Batteix", "TamiaLab"] __license__ = "GPLv3" __version__ = "1.0.4" __maintainer__ = "Fabien Batteix" __email__ = "fabien.batteix@tamialab.fr" __status__ = "Development" # "Production" # User friendly imports from .treebuilder import parse_skcode from .render import (render_to_html, render_to_skcode, render_to_text)
""" SkCode (Python implementation of BBcode syntax) parser library. """ # Package information __author__ = "Fabien Batteix (@skywodd)" __copyright__ = "Copyright 2015, TamiaLab" __credits__ = ["Fabien Batteix", "TamiaLab"] __license__ = "GPLv3" __version__ = "1.0.5" __maintainer__ = "Fabien Batteix" __email__ = "fabien.batteix@tamialab.fr" __status__ = "Development" # "Production" # User friendly imports from .treebuilder import parse_skcode from .render import (render_to_html, render_to_skcode, render_to_text)
Update version 1.0.4 -> 1.0.5
Update version 1.0.4 -> 1.0.5
Python
agpl-3.0
TamiaLab/PySkCode
--- +++ @@ -7,7 +7,7 @@ __copyright__ = "Copyright 2015, TamiaLab" __credits__ = ["Fabien Batteix", "TamiaLab"] __license__ = "GPLv3" -__version__ = "1.0.4" +__version__ = "1.0.5" __maintainer__ = "Fabien Batteix" __email__ = "fabien.batteix@tamialab.fr" __status__ = "Development" # "Production"
76829380376c31ea3f1e899770d1edffd1afc047
apps/profiles/utils.py
apps/profiles/utils.py
import hashlib def get_gravatar_url(email): email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() return "http://www.gravatar.com/avatar/{}".format(email_hash)
import hashlib def get_gravatar_url(email): email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() return "https://www.gravatar.com/avatar/{}".format(email_hash)
Change gravatar url to use https
Change gravatar url to use https
Python
mit
SoPR/horas,SoPR/horas,SoPR/horas,SoPR/horas
--- +++ @@ -3,4 +3,4 @@ def get_gravatar_url(email): email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() - return "http://www.gravatar.com/avatar/{}".format(email_hash) + return "https://www.gravatar.com/avatar/{}".format(email_hash)
ae916c1ee52941bb5a1ccf87abe2a9758897bd08
IPython/utils/ulinecache.py
IPython/utils/ulinecache.py
""" Wrapper around linecache which decodes files to unicode according to PEP 263. """ import functools import linecache import sys from IPython.utils import py3compat from IPython.utils import openpy getline = linecache.getline # getlines has to be looked up at runtime, because doctests monkeypatch it. @functools.wraps(linecache.getlines) def getlines(filename, module_globals=None): return linecache.getlines(filename, module_globals=module_globals)
""" This module has been deprecated since IPython 6.0. Wrapper around linecache which decodes files to unicode according to PEP 263. """ import functools import linecache import sys from warnings import warn from IPython.utils import py3compat from IPython.utils import openpy getline = linecache.getline # getlines has to be looked up at runtime, because doctests monkeypatch it. @functools.wraps(linecache.getlines) def getlines(filename, module_globals=None): """ Deprecated since IPython 6.0 """ warn(("`IPython.utils.ulinecache.getlines` is deprecated since" " IPython 6.0 and will be removed in future versions."), DeprecationWarning, stacklevel=2) return linecache.getlines(filename, module_globals=module_globals)
Add deprecation warnings and message to getlines function
Add deprecation warnings and message to getlines function
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -1,9 +1,12 @@ """ +This module has been deprecated since IPython 6.0. + Wrapper around linecache which decodes files to unicode according to PEP 263. """ import functools import linecache import sys +from warnings import warn from IPython.utils import py3compat from IPython.utils import openpy @@ -13,4 +16,10 @@ # getlines has to be looked up at runtime, because doctests monkeypatch it. @functools.wraps(linecache.getlines) def getlines(filename, module_globals=None): + """ + Deprecated since IPython 6.0 + """ + warn(("`IPython.utils.ulinecache.getlines` is deprecated since" + " IPython 6.0 and will be removed in future versions."), + DeprecationWarning, stacklevel=2) return linecache.getlines(filename, module_globals=module_globals)
31381728cb8d76314c82833d4400b4140fcc573f
django_jinja/builtins/global_context.py
django_jinja/builtins/global_context.py
# -*- coding: utf-8 -*- import logging from django.conf import settings from django.core.urlresolvers import reverse as django_reverse, NoReverseMatch from django.contrib.staticfiles.storage import staticfiles_storage JINJA2_MUTE_URLRESOLVE_EXCEPTIONS = getattr(settings, "JINJA2_MUTE_URLRESOLVE_EXCEPTIONS", False) logger = logging.getLogger(__name__) def url(name, *args, **kwargs): """ Shortcut filter for reverse url on templates. Is a alternative to django {% url %} tag, but more simple. Usage example: {{ url('web:timeline', userid=2) }} This is a equivalent to django: {% url 'web:timeline' userid=2 %} """ try: return django_reverse(name, args=args, kwargs=kwargs) except NoReverseMatch as exc: logger.error('Error: %s', exc) if not JINJA2_MUTE_URLRESOLVE_EXCEPTIONS: raise return '' def static(path): return staticfiles_storage.url(path)
# -*- coding: utf-8 -*- import logging from django.conf import settings from django.core.urlresolvers import reverse as django_reverse, NoReverseMatch from django.contrib.staticfiles.storage import staticfiles_storage JINJA2_MUTE_URLRESOLVE_EXCEPTIONS = getattr(settings, "JINJA2_MUTE_URLRESOLVE_EXCEPTIONS", False) logger = logging.getLogger(__name__) def url(view_name, *args, **kwargs): """ Shortcut filter for reverse url on templates. Is a alternative to django {% url %} tag, but more simple. Usage example: {{ url('web:timeline', userid=2) }} This is a equivalent to django: {% url 'web:timeline' userid=2 %} """ try: return django_reverse(view_name, args=args, kwargs=kwargs) except NoReverseMatch as exc: logger.error('Error: %s', exc) if not JINJA2_MUTE_URLRESOLVE_EXCEPTIONS: raise return '' def static(path): return staticfiles_storage.url(path)
Change parameter name so it does not conflict with an url parameter called "name".
builtins/url: Change parameter name so it does not conflict with an url parameter called "name". This reflects the same name used in https://github.com/coffin/coffin/blob/master/coffin/template/defaultfilters.py, but it's probably as bad as a solution, because now you cannot use url() with a "view_name" url parameter. Maybe a better way to implement it would be to pop the first *args element (that'd raise if no arg is provided) and use it as the view name.
Python
bsd-3-clause
akx/django-jinja,glogiotatidis/django-jinja,glogiotatidis/django-jinja,akx/django-jinja,akx/django-jinja,glogiotatidis/django-jinja,niwinz/django-jinja,glogiotatidis/django-jinja,niwinz/django-jinja,akx/django-jinja,niwinz/django-jinja
--- +++ @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) -def url(name, *args, **kwargs): +def url(view_name, *args, **kwargs): """ Shortcut filter for reverse url on templates. Is a alternative to django {% url %} tag, but more simple. @@ -23,7 +23,7 @@ """ try: - return django_reverse(name, args=args, kwargs=kwargs) + return django_reverse(view_name, args=args, kwargs=kwargs) except NoReverseMatch as exc: logger.error('Error: %s', exc) if not JINJA2_MUTE_URLRESOLVE_EXCEPTIONS:
6dffa2d22fa5da3b2d8fbcdff04477ff0116bfc1
utilities.py
utilities.py
# Function to return a list of pvs from a given file import pkg_resources pkg_resources.require('aphla') import aphla as ap def get_pv_names(mode): ''' Given a certain ring mode as a string, return all available pvs ''' ap.machines.load(mode) result = set() elements = ap.getElements('*') for element in elements: pvs = element.pv() if(len(pvs) > 0): pv_name = pvs[0].split(':')[0] result.add(pv_name) return result def get_pvs_from_file(filepath): ''' Return a list of pvs from a given file ''' with open(filepath) as f: contents = f.read().splitlines() return contents def write_pvs_to_file(filename, data): ''' Write given pvs to file ''' f = open(filename, 'w') for element in data: f.write(element, '\n') f.close()
# Function to return a list of pvs from a given file import pkg_resources pkg_resources.require('aphla') import aphla as ap def get_pv_names(mode): ''' Given a certain ring mode as a string, return all available pvs ''' ap.machines.load(mode) result = set() elements = ap.getElements('*') for element in elements: pvs = element.pv() if(len(pvs) > 0): pv_name = pvs[0].split(':')[0] result.add(pv_name) return result def get_pvs_from_file(filepath): ''' Return a list of pvs from a given file ''' with open(filepath) as f: contents = f.read().splitlines() return contents def write_pvs_to_file(filename, data): ''' Write given pvs to file ''' f = open(filename, 'w') for element in data: f.write(element + '\n') f.close()
Resolve a bug in the write function
Resolve a bug in the write function
Python
apache-2.0
razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects
--- +++ @@ -31,5 +31,5 @@ ''' Write given pvs to file ''' f = open(filename, 'w') for element in data: - f.write(element, '\n') + f.write(element + '\n') f.close()
7f13b29cc918f63c4d1fc24717c0a0b5d2f5f8ad
filter.py
filter.py
import numpy as np class LowPassFilter(object): ''' First order discrete IIR filter. ''' def __init__(self, feedback_gain, initial_value=0.0): self.feedback_gain = np.ones_like(initial_value) * feedback_gain self.initial_value = initial_value self.output_gain = 1.0 - feedback_gain self.input = np.nan self.output = initial_value self.feedback_value = initial_value / self.output_gain def filter(self, value): #if not math.isanan(value) and math.isinf(value): self.input = value self.feedback_value = value + self.feedback_gain * self.feedback_value self.output = self.output_gain * self.feedback_value return self.output class MovingAverage(object): ''' Moving average filter. ''' def __init__(self, lifetime, sampling_time): self.lifetime = lifetime self.sampling_time = sampling_time self.exp = np.exp(-sampling_time / lifetime) self.last_value = np.nan self.mean_value = np.nan def filter(self, value): self.last_value = value if np.isnan(self.mean_value): self.mean_value = value else: self.mean_value = value + self.exp * (self.mean_value - value) return self.mean_value
import numpy as np class LowPassFilter(object): ''' First order discrete IIR filter. ''' def __init__(self, feedback_gain, initial_value=0.0): self.feedback_gain = np.ones_like(initial_value) * feedback_gain self.initial_value = initial_value self.output_gain = 1.0 - feedback_gain self.input = np.nan self.output = initial_value self.feedback_value = initial_value / self.output_gain def filter(self, value): #if not math.isanan(value) and math.isinf(value): self.input = value self.feedback_value = value + self.feedback_gain * self.feedback_value self.output = self.output_gain * self.feedback_value return self.output class MovingAverage(object): ''' Moving average filter. ''' def __init__(self, lifetime, sampling_time): self.lifetime = lifetime self.sampling_time = sampling_time self.exp = np.exp(-sampling_time / lifetime) self.last_value = None self.mean_value = None def filter(self, value): self.last_value = value if self.mean_value is None: self.mean_value = value else: self.mean_value = value + self.exp * (self.mean_value - value) return self.mean_value
Fix problem with array values.
Fix problem with array values.
Python
mit
jcsharp/DriveIt
--- +++ @@ -28,12 +28,12 @@ self.lifetime = lifetime self.sampling_time = sampling_time self.exp = np.exp(-sampling_time / lifetime) - self.last_value = np.nan - self.mean_value = np.nan + self.last_value = None + self.mean_value = None def filter(self, value): self.last_value = value - if np.isnan(self.mean_value): + if self.mean_value is None: self.mean_value = value else: self.mean_value = value + self.exp * (self.mean_value - value)
b717696b5cff69e3586e06c399be7d06c057e503
nova/tests/fake_utils.py
nova/tests/fake_utils.py
# Copyright (c) 2013 Rackspace Hosting # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """This modules stubs out functions in nova.utils.""" from nova import utils def stub_out_utils_spawn_n(stubs): """Stubs out spawn_n with a blocking version. This aids testing async processes by blocking until they're done. """ def no_spawn(func, *args, **kwargs): return func(*args, **kwargs) stubs.Set(utils, 'spawn_n', no_spawn)
# Copyright (c) 2013 Rackspace Hosting # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """This modules stubs out functions in nova.utils.""" from nova import utils def stub_out_utils_spawn_n(stubs): """Stubs out spawn_n with a blocking version. This aids testing async processes by blocking until they're done. """ def no_spawn(func, *args, **kwargs): try: return func(*args, **kwargs) except Exception: # NOTE(danms): This is supposed to simulate spawning # of a thread, which would run separate from the parent, # and die silently on error. If we don't catch and discard # any exceptions here, we're not honoring the usual # behavior. pass stubs.Set(utils, 'spawn_n', no_spawn)
Make spawn_n() stub properly ignore errors in the child thread work
Make spawn_n() stub properly ignore errors in the child thread work When we call spawn_n() normally, we fork off a thread that can run or die on its own, without affecting the parent. In unit tests, we stub this out to be a synchronous call, but we allow any exceptions that occur in that work to bubble up to the caller. This is not normal behavior and thus we should discard any such exceptions in order to mimic actual behavior of a child thread. Change-Id: I35ab21e9525aa76cced797436daa0b99a4fa99f2 Related-bug: #1349147
Python
apache-2.0
barnsnake351/nova,dawnpower/nova,alvarolopez/nova,JioCloud/nova_test_latest,joker946/nova,apporc/nova,cyx1231st/nova,dims/nova,klmitch/nova,mgagne/nova,openstack/nova,orbitfp7/nova,phenoxim/nova,rajalokan/nova,Stavitsky/nova,akash1808/nova_test_latest,apporc/nova,projectcalico/calico-nova,devendermishrajio/nova_test_latest,noironetworks/nova,maelnor/nova,j-carpentier/nova,dims/nova,ted-gould/nova,tangfeixiong/nova,zaina/nova,rajalokan/nova,rahulunair/nova,takeshineshiro/nova,LoHChina/nova,cloudbase/nova,fnordahl/nova,mikalstill/nova,fnordahl/nova,viggates/nova,gooddata/openstack-nova,vmturbo/nova,saleemjaveds/https-github.com-openstack-nova,alaski/nova,Metaswitch/calico-nova,JioCloud/nova_test_latest,devendermishrajio/nova,belmiromoreira/nova,eonpatapon/nova,cloudbase/nova-virtualbox,felixma/nova,JioCloud/nova,CEG-FYP-OpenStack/scheduler,alaski/nova,thomasem/nova,hanlind/nova,noironetworks/nova,klmitch/nova,edulramirez/nova,isyippee/nova,mmnelemane/nova,jeffrey4l/nova,CloudServer/nova,silenceli/nova,eayunstack/nova,sebrandon1/nova,tealover/nova,scripnichenko/nova,Francis-Liu/animated-broccoli,projectcalico/calico-nova,angdraug/nova,tianweizhang/nova,rahulunair/nova,BeyondTheClouds/nova,scripnichenko/nova,belmiromoreira/nova,iuliat/nova,berrange/nova,double12gzh/nova,viggates/nova,openstack/nova,mahak/nova,tangfeixiong/nova,nikesh-mahalka/nova,Stavitsky/nova,LoHChina/nova,zhimin711/nova,alexandrucoman/vbox-nova-driver,petrutlucian94/nova,klmitch/nova,angdraug/nova,CEG-FYP-OpenStack/scheduler,berrange/nova,tianweizhang/nova,devendermishrajio/nova,petrutlucian94/nova,vmturbo/nova,blueboxgroup/nova,badock/nova,adelina-t/nova,virtualopensystems/nova,nikesh-mahalka/nova,redhat-openstack/nova,ruslanloman/nova,yosshy/nova,mmnelemane/nova,NeCTAR-RC/nova,whitepages/nova,varunarya10/nova_test_latest,jianghuaw/nova,bgxavier/nova,affo/nova,jeffrey4l/nova,blueboxgroup/nova,dawnpower/nova,hanlind/nova,barnsnake351/nova,akash1808/nova,sebrandon1/nova,Francis-Liu/animated-broccoli,eayunstack/nova,cernops/nova,mandeepdhami/nova,phenoxim/nova,rajalokan/nova,Yusuke1987/openstack_template,sebrandon1/nova,JioCloud/nova,akash1808/nova_test_latest,affo/nova,joker946/nova,kimjaejoong/nova,Juniper/nova,MountainWei/nova,double12gzh/nova,mgagne/nova,mandeepdhami/nova,yosshy/nova,watonyweng/nova,cernops/nova,yatinkumbhare/openstack-nova,cyx1231st/nova,rajalokan/nova,zzicewind/nova,CCI-MOC/nova,yatinkumbhare/openstack-nova,BeyondTheClouds/nova,bigswitch/nova,jianghuaw/nova,redhat-openstack/nova,vladikr/nova_drafts,Tehsmash/nova,cloudbase/nova,cernops/nova,JianyuWang/nova,orbitfp7/nova,devendermishrajio/nova_test_latest,felixma/nova,mahak/nova,Metaswitch/calico-nova,Tehsmash/nova,TwinkleChawla/nova,vladikr/nova_drafts,gooddata/openstack-nova,ruslanloman/nova,tealover/nova,BeyondTheClouds/nova,zaina/nova,watonyweng/nova,bigswitch/nova,MountainWei/nova,thomasem/nova,kimjaejoong/nova,bgxavier/nova,Juniper/nova,cloudbase/nova-virtualbox,alvarolopez/nova,TwinkleChawla/nova,raildo/nova,edulramirez/nova,ted-gould/nova,Juniper/nova,zhimin711/nova,saleemjaveds/https-github.com-openstack-nova,alexandrucoman/vbox-nova-driver,zzicewind/nova,tudorvio/nova,vmturbo/nova,virtualopensystems/nova,gooddata/openstack-nova,Juniper/nova,isyippee/nova,hanlind/nova,takeshineshiro/nova,silenceli/nova,gooddata/openstack-nova,NeCTAR-RC/nova,CloudServer/nova,eonpatapon/nova,shail2810/nova,Yusuke1987/openstack_template,CCI-MOC/nova,badock/nova,rahulunair/nova,shail2810/nova,mikalstill/nova,jianghuaw/nova,tudorvio/nova,varunarya10/nova_test_latest,klmitch/nova,maelnor/nova,iuliat/nova,j-carpentier/nova,whitepages/nova,akash1808/nova,jianghuaw/nova,adelina-t/nova,vmturbo/nova,openstack/nova,raildo/nova,cloudbase/nova,mikalstill/nova,JianyuWang/nova,mahak/nova
--- +++ @@ -23,6 +23,14 @@ This aids testing async processes by blocking until they're done. """ def no_spawn(func, *args, **kwargs): - return func(*args, **kwargs) + try: + return func(*args, **kwargs) + except Exception: + # NOTE(danms): This is supposed to simulate spawning + # of a thread, which would run separate from the parent, + # and die silently on error. If we don't catch and discard + # any exceptions here, we're not honoring the usual + # behavior. + pass stubs.Set(utils, 'spawn_n', no_spawn)
e76777897bed5b9396d126e384555ea230b35784
sass_processor/apps.py
sass_processor/apps.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os from django.apps import apps, AppConfig APPS_INCLUDE_DIRS = [] class SassProcessorConfig(AppConfig): name = 'sass_processor' verbose_name = "Sass Processor" _static_dir = 'static' _sass_exts = ('.scss', '.sass') def ready(self): app_configs = apps.get_app_configs() for app_config in app_configs: static_dir = os.path.join(app_config.path, self._static_dir) if os.path.isdir(static_dir): self.traverse_tree(static_dir) print(APPS_INCLUDE_DIRS) @classmethod def traverse_tree(cls, static_dir): """traverse the static folders an look for at least one file ending in .scss/.sass""" for root, dirs, files in os.walk(static_dir): for filename in files: basename, ext = os.path.splitext(filename) if basename.startswith('_') and ext in cls._sass_exts: APPS_INCLUDE_DIRS.append(static_dir) return
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os from django.apps import apps, AppConfig from django.conf import settings from django.core.files.storage import get_storage_class APPS_INCLUDE_DIRS = [] class SassProcessorConfig(AppConfig): name = 'sass_processor' verbose_name = "Sass Processor" _sass_exts = ('.scss', '.sass') _storage = get_storage_class(import_path=settings.STATICFILES_STORAGE)() def ready(self): app_configs = apps.get_app_configs() for app_config in app_configs: static_dir = os.path.join(app_config.path, self._storage.base_url.strip(os.path.sep)) if os.path.isdir(static_dir): self.traverse_tree(static_dir) @classmethod def traverse_tree(cls, static_dir): """traverse the static folders an look for at least one file ending in .scss/.sass""" for root, dirs, files in os.walk(static_dir): for filename in files: basename, ext = os.path.splitext(filename) if basename.startswith('_') and ext in cls._sass_exts: APPS_INCLUDE_DIRS.append(static_dir) return
Use StaticFileStorage to determine source directories
Use StaticFileStorage to determine source directories
Python
mit
jrief/django-sass-processor,jrief/django-sass-processor
--- +++ @@ -3,6 +3,8 @@ import os from django.apps import apps, AppConfig +from django.conf import settings +from django.core.files.storage import get_storage_class APPS_INCLUDE_DIRS = [] @@ -10,17 +12,15 @@ class SassProcessorConfig(AppConfig): name = 'sass_processor' verbose_name = "Sass Processor" - _static_dir = 'static' _sass_exts = ('.scss', '.sass') + _storage = get_storage_class(import_path=settings.STATICFILES_STORAGE)() def ready(self): app_configs = apps.get_app_configs() for app_config in app_configs: - static_dir = os.path.join(app_config.path, self._static_dir) + static_dir = os.path.join(app_config.path, self._storage.base_url.strip(os.path.sep)) if os.path.isdir(static_dir): self.traverse_tree(static_dir) - - print(APPS_INCLUDE_DIRS) @classmethod def traverse_tree(cls, static_dir):
dac0afb3db74b1e8cd144993e662dc8ac0622cb9
osbrain/ftp.py
osbrain/ftp.py
""" Implementation of FTP-related features. """ from .core import BaseAgent from .common import address_to_host_port class FTPAgent(BaseAgent): """ An agent that provides basic FTP functionality. """ def ftp_configure(self, addr, user, passwd, path, perm='elr'): from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler from pyftpdlib.servers import FTPServer # Create authorizer authorizer = DummyAuthorizer() authorizer.add_user(user, passwd, path, perm=perm) # Create handler handler = FTPHandler handler.authorizer = authorizer # Create server host, port = address_to_host_port(addr) # TODO: is this necessary? Or would `None` be sufficient? if port is None: port = 0 self.ftp_server = FTPServer((host, port), handler) return self.ftp_server.socket.getsockname() @Pyro4.oneway def ftp_run(self): # Serve forever self.ftp_server.serve_forever() def ftp_addr(self): return self.ftp_server.socket.getsockname() def ftp_retrieve(self, addr, origin, destiny, user, passwd): import ftplib host, port = addr ftp = ftplib.FTP() ftp.connect(host, port) ftp.login(user, passwd) ftp.retrbinary('RETR %s' % origin, open(destiny, 'wb').write) ftp.close() return destiny
""" Implementation of FTP-related features. """ import Pyro4 from .core import BaseAgent from .common import address_to_host_port class FTPAgent(BaseAgent): """ An agent that provides basic FTP functionality. """ def ftp_configure(self, addr, user, passwd, path, perm='elr'): from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler from pyftpdlib.servers import FTPServer # Create authorizer authorizer = DummyAuthorizer() authorizer.add_user(user, passwd, path, perm=perm) # Create handler handler = FTPHandler handler.authorizer = authorizer # Create server host, port = address_to_host_port(addr) # TODO: is this necessary? Or would `None` be sufficient? if port is None: port = 0 self.ftp_server = FTPServer((host, port), handler) return self.ftp_server.socket.getsockname() @Pyro4.oneway def ftp_run(self): # Serve forever self.ftp_server.serve_forever() def ftp_addr(self): return self.ftp_server.socket.getsockname() def ftp_retrieve(self, addr, origin, destiny, user, passwd): import ftplib host, port = addr ftp = ftplib.FTP() ftp.connect(host, port) ftp.login(user, passwd) ftp.retrbinary('RETR %s' % origin, open(destiny, 'wb').write) ftp.close() return destiny
Add missing import to FTP module
Add missing import to FTP module
Python
apache-2.0
opensistemas-hub/osbrain
--- +++ @@ -1,6 +1,7 @@ """ Implementation of FTP-related features. """ +import Pyro4 from .core import BaseAgent from .common import address_to_host_port
3199b523a67f9c241950992a07fe38d2bbee07dc
seedlibrary/migrations/0003_extendedview_fix.py
seedlibrary/migrations/0003_extendedview_fix.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2017-02-21 02:55 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('seedlibrary', '0002_auto_20170219_2058'), ] operations = [ migrations.RenameField( model_name='extendedview', old_name='external_field', new_name='external_url', ), migrations.AddField( model_name='extendedview', name='grain_subcategory', field=models.CharField(blank=True, max_length=50), ), ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2017-02-21 02:55 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('seedlibrary', '0002_add_extendedview'), ] operations = [ migrations.RenameField( model_name='extendedview', old_name='external_field', new_name='external_url', ), migrations.AddField( model_name='extendedview', name='grain_subcategory', field=models.CharField(blank=True, max_length=50), ), ]
Update migration file for namechange
Update migration file for namechange
Python
mit
RockinRobin/seednetwork,RockinRobin/seednetwork,RockinRobin/seednetwork
--- +++ @@ -8,7 +8,7 @@ class Migration(migrations.Migration): dependencies = [ - ('seedlibrary', '0002_auto_20170219_2058'), + ('seedlibrary', '0002_add_extendedview'), ] operations = [
17b0f5d7b718bc12755f7ddefdd76ee9312adf5f
books.py
books.py
import falcon import template def get_paragraphs(pathname: str) -> list: result = [] with open(pathname) as f: for line in f.readlines(): if line != '\n': result.append(line[:-1]) return result class BooksResource: def on_get(self, req, resp): resp.status = falcon.HTTP_200 paragraphs = get_paragraphs('/home/sanchopanca/Documents/thunder.txt') resp.body = template.render_template('book.html', paragraphs=paragraphs) app = falcon.API() books = BooksResource() app.add_route('/books', books) if __name__ == '__main__': paragraphs = get_paragraphs('/home/sanchopanca/Documents/thunder.txt') print(paragraphs)
import falcon import template def get_paragraphs(pathname: str) -> list: result = [] with open(pathname) as f: for line in f.readlines(): if line != '\n': result.append(line[:-1]) return result class BooksResource: def on_get(self, req, resp): resp.status = falcon.HTTP_200 resp.content_type = 'text/html' paragraphs = get_paragraphs('/home/sanchopanca/Documents/thunder.txt') resp.body = template.render_template('book.html', paragraphs=paragraphs) app = falcon.API() books = BooksResource() app.add_route('/books', books) if __name__ == '__main__': paragraphs = get_paragraphs('/home/sanchopanca/Documents/thunder.txt') print(paragraphs)
Add content type text/html to response
Add content type text/html to response
Python
agpl-3.0
sanchopanca/reader,sanchopanca/reader
--- +++ @@ -14,6 +14,7 @@ class BooksResource: def on_get(self, req, resp): resp.status = falcon.HTTP_200 + resp.content_type = 'text/html' paragraphs = get_paragraphs('/home/sanchopanca/Documents/thunder.txt') resp.body = template.render_template('book.html', paragraphs=paragraphs)
02efde47b5cf20b7385eacaa3f21454ffa636ad7
troposphere/codestarconnections.py
troposphere/codestarconnections.py
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags VALID_CONNECTION_PROVIDERTYPE = ('Bitbucket') def validate_connection_providertype(connection_providertype): """Validate ProviderType for Connection""" if connection_providertype not in VALID_CONNECTION_PROVIDERTYPE: raise ValueError("Connection ProviderType must be one of: %s" % ", ".join(VALID_CONNECTION_PROVIDERTYPE)) return connection_providertype class Connection(AWSObject): resource_type = "AWS::CodeStarConnections::Connection" props = { 'ConnectionName': (basestring, True), 'ProviderType': (validate_connection_providertype, True), 'Tags': (Tags, False), }
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags VALID_CONNECTION_PROVIDERTYPE = ('Bitbucket') def validate_connection_providertype(connection_providertype): """Validate ProviderType for Connection""" if connection_providertype not in VALID_CONNECTION_PROVIDERTYPE: raise ValueError("Connection ProviderType must be one of: %s" % ", ".join(VALID_CONNECTION_PROVIDERTYPE)) return connection_providertype class Connection(AWSObject): resource_type = "AWS::CodeStarConnections::Connection" props = { 'ConnectionName': (basestring, True), 'HostArn': (basestring, False), 'ProviderType': (validate_connection_providertype, True), 'Tags': (Tags, False), }
Update CodeStarConnections::Connection per 2020-07-23 update
Update CodeStarConnections::Connection per 2020-07-23 update
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
--- +++ @@ -24,6 +24,7 @@ props = { 'ConnectionName': (basestring, True), + 'HostArn': (basestring, False), 'ProviderType': (validate_connection_providertype, True), 'Tags': (Tags, False), }
b628e466f86bc27cbe45ec27a02d4774a0efd3bb
semantic_release/pypi.py
semantic_release/pypi.py
"""PyPI """ from invoke import run from semantic_release import ImproperConfigurationError def upload_to_pypi( dists: str = 'sdist bdist_wheel', username: str = None, password: str = None, skip_existing: bool = False ): """Creates the wheel and uploads to pypi with twine. :param dists: The dists string passed to setup.py. Default: 'bdist_wheel' :param username: PyPI account username string :param password: PyPI account password string :param skip_existing: Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) """ if username is None or password is None or username == "" or password == "": raise ImproperConfigurationError('Missing credentials for uploading') run('python setup.py {}'.format(dists)) run( 'twine upload -u {} -p {} {} {}'.format( username, password, '--skip-existing' if skip_existing else '', 'dist/*' ) ) run('rm -rf build dist')
"""PyPI """ from invoke import run from semantic_release import ImproperConfigurationError def upload_to_pypi( dists: str = 'sdist bdist_wheel', username: str = None, password: str = None, skip_existing: bool = False ): """Creates the wheel and uploads to pypi with twine. :param dists: The dists string passed to setup.py. Default: 'bdist_wheel' :param username: PyPI account username string :param password: PyPI account password string :param skip_existing: Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) """ if username is None or password is None or username == "" or password == "": raise ImproperConfigurationError('Missing credentials for uploading') run('rm -rf build dist') run('python setup.py {}'.format(dists)) run( 'twine upload -u {} -p {} {} {}'.format( username, password, '--skip-existing' if skip_existing else '', 'dist/*' ) ) run('rm -rf build dist')
Clean out dist and build before building
fix: Clean out dist and build before building This should fix the problem with uploading old versions. Fixes #86
Python
mit
relekang/python-semantic-release,relekang/python-semantic-release
--- +++ @@ -21,6 +21,7 @@ """ if username is None or password is None or username == "" or password == "": raise ImproperConfigurationError('Missing credentials for uploading') + run('rm -rf build dist') run('python setup.py {}'.format(dists)) run( 'twine upload -u {} -p {} {} {}'.format(