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
837df000bc86d6bd9c0101f13e3ef18d2873750b
furious/_pkg_meta.py
furious/_pkg_meta.py
version_info = (1, 3, 0) version = '.'.join(map(str, version_info))
version_info = (1, 4, 0) version = '.'.join(map(str, version_info))
Update the version to 1.4.0 for the latest release
Update the version to 1.4.0 for the latest release
Python
apache-2.0
andreleblanc-wf/furious,andreleblanc-wf/furious,Workiva/furious,mattsanders-wf/furious,mattsanders-wf/furious,beaulyddon-wf/furious,beaulyddon-wf/furious,Workiva/furious
--- +++ @@ -1,2 +1,2 @@ -version_info = (1, 3, 0) +version_info = (1, 4, 0) version = '.'.join(map(str, version_info))
3ba6ad452d747135134ec23d62d0b327708e8ef5
python/setup.py
python/setup.py
from setuptools import setup # This is the atca_rapid_response_api Python library. # Jamie Stevens 2017 # ATCA Senior Systems Scientist # Jamie.Stevens@csiro.au setup(name='atca_rapid_response_api', version='1.0', description='ATCA Rapid Response Mode API', url='https://github.com/ste616/atca-rapid-...
from setuptools import setup # This is the atca_rapid_response_api Python library. # Jamie Stevens 2017 # ATCA Senior Systems Scientist # Jamie.Stevens@csiro.au setup(name='atca_rapid_response_api', version='1.1', description='ATCA Rapid Response Mode API', url='https://github.com/ste616/atca-rapid-...
Update the library version to 1.1 for the recent change.
Update the library version to 1.1 for the recent change.
Python
mit
ste616/atca-rapid-response-api
--- +++ @@ -6,7 +6,7 @@ # Jamie.Stevens@csiro.au setup(name='atca_rapid_response_api', - version='1.0', + version='1.1', description='ATCA Rapid Response Mode API', url='https://github.com/ste616/atca-rapid-response-api', author='Jamie Stevens', @@ -19,3 +19,5 @@ zip_safe=Fal...
8a9a2a860772ec71c517c4ae4dd93aa4ab2ea342
git_gutter_events.py
git_gutter_events.py
import sublime import sublime_plugin import view_collection class GitGutterEvents(sublime_plugin.EventListener): def on_new(self, view): view_collection.ViewCollection.add(view) def on_load(self, view): view_collection.ViewCollection.add(view) def on_modified(self, view): view_collection.ViewCollec...
import sublime import sublime_plugin import view_collection class GitGutterEvents(sublime_plugin.EventListener): def on_load(self, view): view_collection.ViewCollection.add(view) def on_modified(self, view): if view.settings().get('git_gutter_live_mode', True): view_collection.ViewCollection.add(vi...
Add settings to turn off live mode
Add settings to turn off live mode
Python
mit
michaelhogg/GitGutter,akpersad/GitGutter,bradsokol/VcsGutter,biodamasceno/GitGutter,robfrawley/sublime-git-gutter,natecavanaugh/GitGutter,natecavanaugh/GitGutter,biodamasceno/GitGutter,michaelhogg/GitGutter,robfrawley/sublime-git-gutter,tushortz/GitGutter,akpersad/GitGutter,ariofrio/VcsGutter,tushortz/GitGutter,natecav...
--- +++ @@ -3,14 +3,16 @@ import view_collection class GitGutterEvents(sublime_plugin.EventListener): - def on_new(self, view): - view_collection.ViewCollection.add(view) def on_load(self, view): view_collection.ViewCollection.add(view) def on_modified(self, view): - view_collection.ViewColl...
fb87194d6409149e71d6ee52c620fe04f8ca482f
scrapi/processing/osf/collision.py
scrapi/processing/osf/collision.py
from __future__ import unicode_literals import requests from scrapi import settings from scrapi.processing.osf.hashing import REPORT_HASH_FUNCTIONS from scrapi.processing.osf.hashing import RESOURCE_HASH_FUNCTIONS def detect_collisions(hashlist, additional=''): uuids = 'uuid:{}'.format(','.join(hashlist)) u...
from __future__ import unicode_literals import json import requests from scrapi import settings from scrapi.processing.osf.hashing import REPORT_HASH_FUNCTIONS from scrapi.processing.osf.hashing import RESOURCE_HASH_FUNCTIONS def detect_collisions(hashlist, is_resource=False): if is_resource: _filter =...
Update to the latest osf API
Update to the latest osf API
Python
apache-2.0
felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,mehanig/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,fabianvf/scrapi,mehanig/scrapi,alexgarciac/scrapi,felliott/scrapi,fabianvf/scrapi
--- +++ @@ -1,4 +1,6 @@ from __future__ import unicode_literals + +import json import requests @@ -7,14 +9,51 @@ from scrapi.processing.osf.hashing import RESOURCE_HASH_FUNCTIONS -def detect_collisions(hashlist, additional=''): - uuids = 'uuid:{}'.format(','.join(hashlist)) - url = '{}?q={}{}'.format...
a39c288e9beb506d62de66d72fc95750e54d833b
social_core/backends/universe.py
social_core/backends/universe.py
from .oauth import BaseOAuth2 class UniverseOAuth2(BaseOAuth2): """Universe Ticketing OAuth2 authentication backend""" name = 'universe' AUTHORIZATION_URL = 'https://www.universe.com/oauth/authorize' ACCESS_TOKEN_URL = 'https://www.universe.com/oauth/token' BASE_API_URL = 'https://www.universe.com...
from .oauth import BaseOAuth2 class UniverseOAuth2(BaseOAuth2): """Universe Ticketing OAuth2 authentication backend""" name = 'universe' AUTHORIZATION_URL = 'https://www.universe.com/oauth/authorize' ACCESS_TOKEN_URL = 'https://www.universe.com/oauth/token' BASE_API_URL = 'https://www.universe.com...
Remove f-string for pre-Python 3.6 support.
Remove f-string for pre-Python 3.6 support.
Python
bsd-3-clause
python-social-auth/social-core,python-social-auth/social-core
--- +++ @@ -30,4 +30,4 @@ def user_data(self, access_token, *args, **kwargs): """Loads user data from service""" - return self.get_json(self.USER_INFO_URL, headers={'Authorization': f'Bearer {access_token}'}) + return self.get_json(self.USER_INFO_URL, headers={'Authorization': 'Bearer {}...
ef38b68aa288bb43bc33a860ac995836f892854e
usr/examples/99-Tests/unittests.py
usr/examples/99-Tests/unittests.py
# OpenMV Unit Tests. # import os, sensor, gc TEST_DIR = "unittest" TEMP_DIR = "unittest/temp" DATA_DIR = "unittest/data" SCRIPT_DIR = "unittest/script" if not (TEST_DIR in os.listdir("")): raise Exception('Unittest dir not found!') print("") test_failed = False def print_result(test, passed): s = ...
# OpenMV Unit Tests. # import os, sensor, gc TEST_DIR = "unittest" TEMP_DIR = "unittest/temp" DATA_DIR = "unittest/data" SCRIPT_DIR = "unittest/script" if not (TEST_DIR in os.listdir("")): raise Exception('Unittest dir not found!') print("") test_failed = False def print_result(test, passed): s = ...
Move GC collect after loading unit test function.
Move GC collect after loading unit test function.
Python
mit
kwagyeman/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv
--- +++ @@ -26,8 +26,8 @@ test_passed = True test_path = "/".join((mod_path, test)) try: + exec(open(test_path).read()) gc.collect() - exec(open(test_path).read()) if unittest(DATA_DIR, TEMP_DIR) == False: ...
2522f5e1a132597e56d1e8e8559b3e16c15be47f
app/twitter/views.py
app/twitter/views.py
from flask import Blueprint, request, render_template from ..load import processing_results, api import string import tweepy twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static') ascii_chars = set(string.printable) ascii_chars.remove(' ') ascii_chars.add('...') def takeo...
from flask import Blueprint, request, render_template from ..load import processing_results, api import string import tweepy twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static') ascii_chars = set(string.printable) ascii_chars.remove(' ') ascii_chars.add('...') def takeo...
Reduce number of tweets to reduce CPU compuation time of the unoptimised models
Reduce number of tweets to reduce CPU compuation time of the unoptimised models
Python
mit
griimick/feature-mlsite,griimick/feature-mlsite,griimick/feature-mlsite
--- +++ @@ -20,7 +20,7 @@ if request.method == 'POST': text = [] - for tweet in tweepy.Cursor(api.search, request.form['topic'], lang='hi').items(100): + for tweet in tweepy.Cursor(api.search, request.form['topic'], lang='hi').items(50): temp = ''.join(takeout_non_ascii(twee...
8aff9605a91f1041a1040c2cfc000dbc588c0503
biobox_cli/util.py
biobox_cli/util.py
import sys, yaml, os.path def select_module(module, name): """ Select and return a biobox module """ mod_name = ".".join(["biobox_cli", module, name]) try: __import__(mod_name) except ImportError: err_exit('unknown_command', {'command_type': str.replace(module, '...
import sys, yaml, os.path def select_module(module, name): """ Select and return a biobox module """ mod_name = ".".join(["biobox_cli", module, name]) try: __import__(mod_name) except ImportError: err_exit('unknown_command', {'command_type': str.replace(module, '...
Use resource_string for error messages
Use resource_string for error messages Signed-off-by: Michael Barton <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@michaelbarton.me.uk>
Python
mit
pbelmann/command-line-interface,pbelmann/command-line-interface,michaelbarton/command-line-interface,bioboxes/command-line-interface,fungs/bbx-cli,fungs/bbx-cli,bioboxes/command-line-interface,michaelbarton/command-line-interface
--- +++ @@ -21,9 +21,8 @@ options_first = is_main_module) def err_message(msg_key, locals_): - path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'assets', 'error_messages.yml') - with open(path, 'r') as f: - errors = yaml.load(f.read()) + from pkg_resource...
22758183910a479f62f9fb42bb5acdc09deff448
qual/calendars/historical.py
qual/calendars/historical.py
from datetime import date from base import Calendar from date import InvalidDate from main import JulianCalendar class JulianToGregorianCalendar(Calendar): def date(self, year, month, day): gregorian_date = date(year, month, day) if gregorian_date < self.first_gregorian_day: julian_dat...
from datetime import date from base import Calendar from date import InvalidDate from main import JulianCalendar class JulianToGregorianCalendar(Calendar): def date(self, year, month, day): gregorian_date = date(year, month, day) if gregorian_date < self.first_gregorian_day: julian_dat...
Change comparison to be non-strict.
Change comparison to be non-strict.
Python
apache-2.0
jwg4/calexicon,jwg4/qual
--- +++ @@ -9,7 +9,7 @@ gregorian_date = date(year, month, day) if gregorian_date < self.first_gregorian_day: julian_date = JulianCalendar().date(year, month, day) - if julian_date > self.first_gregorian_day: + if not julian_date < self.first_gregorian_day: ...
e09414c101d49c70c6da4fcdabf3e985fb92f468
passenger_wsgi.py
passenger_wsgi.py
import os import subprocess import sys try: from flask import Flask import flask_login from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: ...
import os import subprocess import sys try: from flask import Flask import flask_login from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: ...
Improve error catching logic for update
Improve error catching logic for update
Python
mit
GregBrimble/boilerplate-web-service,GregBrimble/boilerplate-web-service
--- +++ @@ -32,8 +32,12 @@ def update(): subprocess.call(['git', 'fetch', 'origin']) subprocess.call(['git', 'pull']) - subprocess.call(['mkdir', 'tmp']) + try: + subprocess.check_call(['mkdir', 'tmp']) + except subprocess.CalledProcessError, e: + pass subprocess.call(['touch', ...
12a61da411134d2fc02e91d41b6687de8763a374
modules/pipetruncate.py
modules/pipetruncate.py
# pipetruncate.py # from pipe2py import util def pipe_truncate(context, _INPUT, conf, **kwargs): """This operator truncates the number of items in a feed. Keyword arguments: context -- pipeline context _INPUT -- source generator kwargs -- terminal, if the truncation value is wired in conf: ...
# pipetruncate.py # from pipe2py import util def pipe_truncate(context, _INPUT, conf, **kwargs): """This operator truncates the number of items in a feed. Keyword arguments: context -- pipeline context _INPUT -- source generator kwargs -- terminal, if the truncation value is wired in conf: ...
Fix for taking feed from a split output
Fix for taking feed from a split output
Python
mit
nerevu/riko,nerevu/riko
--- +++ @@ -19,6 +19,9 @@ count = conf['count'] limit = int(util.get_value(count, None, **kwargs)) - for i in xrange(0, limit): - yield _INPUT.next() - + i = 0 + for item in _INPUT: + if i >= limit: + break + yield item + i += 1
cad0f1ebeeaac1af296930bc98cf892395293112
grako/rendering.py
grako/rendering.py
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import print_function, division, absolute_import, unicode_literals import itertools from .util import trim def render(item, **field...
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import print_function, division, absolute_import, unicode_literals import itertools from .util import trim def render(item, **field...
Use 'fields' instead of 'kwargs' to document intent.
Use 'fields' instead of 'kwargs' to document intent.
Python
bsd-2-clause
vmuriart/grako,frnknglrt/grako
--- +++ @@ -34,7 +34,7 @@ def render_fields(self, fields): pass - def render(self, template=None, **kwargs): + def render(self, template=None, **fields): fields = ({k:v for k, v in vars(self).items() if not k.startswith('_')}) override = self.render_fields(fields) @@ -44,7 +4...
c617083fa413a0d45ff26c96751210901dfad7cf
cab/urls/search.py
cab/urls/search.py
from django.conf.urls import url from haystack.views import SearchView, search_view_factory from ..forms import AdvancedSearchForm search_view = search_view_factory(view_class=SearchView, template='search/advanced_search.html', form_class=AdvancedSea...
from django.conf.urls import url from haystack.views import SearchView, basic_search, search_view_factory from ..forms import AdvancedSearchForm from ..views.snippets import autocomplete search_view = search_view_factory(view_class=SearchView, template='search/advanced_search.html', ...
Remove string views in urlpatterns
Remove string views in urlpatterns
Python
bsd-3-clause
django/djangosnippets.org,django/djangosnippets.org,django/djangosnippets.org,django-de/djangosnippets.org,django-de/djangosnippets.org,django/djangosnippets.org,django-de/djangosnippets.org,django-de/djangosnippets.org,django/djangosnippets.org
--- +++ @@ -1,20 +1,15 @@ from django.conf.urls import url -from haystack.views import SearchView, search_view_factory +from haystack.views import SearchView, basic_search, search_view_factory from ..forms import AdvancedSearchForm +from ..views.snippets import autocomplete search_view = search_view_factory(vi...
ce939b6f03260a57268a8371a2e05e531b36bce2
hoomd/typeparam.py
hoomd/typeparam.py
from hoomd.parameterdicts import AttachedTypeParameterDict class TypeParameter: def __init__(self, name, type_kind, param_dict): self.name = name self.type_kind = type_kind self.param_dict = param_dict def __getitem__(self, key): return self.param_dict[key] def __setitem_...
from hoomd.parameterdicts import AttachedTypeParameterDict class TypeParameter: def __init__(self, name, type_kind, param_dict): self.name = name self.type_kind = type_kind self.param_dict = param_dict def __getattr__(self, attr): try: return getattr(self.param_dic...
Allow TypeParameters to 'grap' attr from param_dict
Allow TypeParameters to 'grap' attr from param_dict
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
--- +++ @@ -6,6 +6,13 @@ self.name = name self.type_kind = type_kind self.param_dict = param_dict + + def __getattr__(self, attr): + try: + return getattr(self.param_dict, attr) + except AttributeError: + raise AttributeError("'{}' object has no attrib...
6d848c4b86913d71b986ef032348a8fa8720cfc7
src/idea/utility/state_helper.py
src/idea/utility/state_helper.py
from idea.models import State def get_first_state(): """ Get the first state for an idea. """ return State.objects.get(previous__isnull=True)
from idea.models import State def get_first_state(): """ Get the first state for an idea. """ #return State.objects.get(previous__isnull=True) # previous__isnull breaks functionality if someone creates a new state # without a previous state set. since we know the initial state # is id=1 per fixtur...
Fix add_idea when multiple States have no previous
Fix add_idea when multiple States have no previous
Python
cc0-1.0
CapeSepias/idea-box,m3brown/idea-box,geomapdev/idea-box,cmc333333/idea-box,18F/idea-box,CapeSepias/idea-box,18F/idea-box,geomapdev/idea-box,18F/idea-box,cmc333333/idea-box,CapeSepias/idea-box,m3brown/idea-box,cmc333333/idea-box,geomapdev/idea-box
--- +++ @@ -2,4 +2,8 @@ def get_first_state(): """ Get the first state for an idea. """ - return State.objects.get(previous__isnull=True) + #return State.objects.get(previous__isnull=True) + # previous__isnull breaks functionality if someone creates a new state + # without a previous state set. s...
a8d46d56890948b36726432fbcaa3bc038a0095f
txircd/modules/extra/stripcolors.py
txircd/modules/extra/stripcolors.py
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType, stripFormatting from zope.interface import implements class StripColors(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "StripColors" affectedActions = { ...
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType, stripFormatting from zope.interface import implements class StripColors(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "StripColors" affectedActions = { ...
Fix missing comparison operator in StripColors
Fix missing comparison operator in StripColors
Python
bsd-3-clause
ElementalAlchemist/txircd,Heufneutje/txircd
--- +++ @@ -25,7 +25,7 @@ return None def apply(self, actionName, channel, param, user, data): - if channel in data["targetchans"] not self.ircd.runActionUntilValue("checkexemptchanops", "stripcolor", channel, user): + if channel in data["targetchans"] and not self.ircd.runActionUntilValue("checkexemptchanop...
efc792de5225f3a21fab6d3f299fea07c63f6d0d
incident/models.py
incident/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ class Issue(models.Model): title = models.CharField(_('Title'), max_length=150) description = models.TextField(_('Description')) contract = models.ForeignKey('structure.Contract') assigned_team = models.ForeignKey('str...
from django.db import models from django.utils.translation import ugettext_lazy as _ class Issue(models.Model): title = models.CharField(_('Title'), max_length=150) description = models.TextField(_('Description')) contract = models.ForeignKey('structure.Contract') assigned_team = models.ForeignKey('str...
Add created_at to Issue model
Add created_at to Issue model
Python
bsd-3-clause
RocknRoot/LIIT
--- +++ @@ -7,3 +7,4 @@ contract = models.ForeignKey('structure.Contract') assigned_team = models.ForeignKey('structure.Team') assigned_user = models.ForeignKey('structure.User', null=True) + created_at = models.DateTimeField(auto_now_add=True)
355a3a34b9a264734c1f5f2ec365a5873f000b77
open_skin_as_project.py
open_skin_as_project.py
import os import subprocess import sublime import sublime_plugin from .path.skin_path_provider import get_cached_skin_path class RainmeterOpenSkinAsProjectCommand(sublime_plugin.ApplicationCommand): def run(self): skins_path = get_cached_skin_path() skins = os.listdir(skins_path) subli...
import os import subprocess import sublime import sublime_plugin from .path.skin_path_provider import get_cached_skin_path class RainmeterOpenSkinAsProjectCommand(sublime_plugin.ApplicationCommand): def run(self): skins_path = get_cached_skin_path() skins = os.listdir(skins_path) subli...
Handle in case user cancels open skin as project command
Handle in case user cancels open skin as project command
Python
mit
thatsIch/sublime-rainmeter
--- +++ @@ -16,6 +16,9 @@ sublime.active_window().show_quick_panel(skins, self.on_skin_selected, 0, 0, None) def on_skin_selected(self, selected_skin_id): + if selected_skin_id == -1: + return + skins_path = get_cached_skin_path() skins = os.listdir(skins_path) ...
fe217ed9436754d6f9cf01a0052091d095a6e99c
web.py
web.py
from flask import Flask, jsonify, render_template import test, stats, os app = Flask(__name__) cache = {} @app.route('/') def hello_world(): return 'Hello World!' @app.route('/r/<string:subreddit>') def episodes(subreddit): seasonsAndEpisodes = _getEpisodes(subreddit) return render_template('index.html',...
from flask import Flask, jsonify, render_template import test, stats, os app = Flask(__name__) cache = {} @app.route('/') def hello_world(): return 'Hello World!' @app.route('/r/<string:subreddit>') def episodes(subreddit): seasonsAndEpisodes = _getEpisodes(subreddit) return render_template('index.html',...
Put seasons and subreddit into a response object for the api
Put seasons and subreddit into a response object for the api
Python
apache-2.0
chasedog/EpisodeDiscussions,chasedog/EpisodeDiscussions
--- +++ @@ -16,7 +16,9 @@ @app.route('/api/r/<string:subreddit>', methods=['GET']) def get_episodes(subreddit): seasonsAndEpisodes = _getEpisodes(subreddit) - return jsonify([season.serialize() for season in seasonsAndEpisodes]) + seasons = [season.serialize() for season in seasonsAndEpisodes] + resul...
a18e6aa3647779de3963e6781afaeea3732d100e
similarities.py
similarities.py
#!/usr/bin/env python import argparse import sys from gensim.models.word2vec import Word2Vec import csv from signal import signal, SIGINT signal(SIGINT, lambda signum, frame: sys.exit(1)) parser = argparse.ArgumentParser() parser.add_argument('--sim', type=float, default=.3) parser.add_argument('w2v', type=argparse....
#!/usr/bin/env python import argparse import sys import csv from gensim.models import KeyedVectors from signal import signal, SIGINT signal(SIGINT, lambda signum, frame: sys.exit(1)) parser = argparse.ArgumentParser() parser.add_argument('--sim', type=float, default=.3) parser.add_argument('w2v', type=argparse.FileT...
Update the Gensim API usage
Update the Gensim API usage
Python
mit
dustalov/watset,dustalov/watset
--- +++ @@ -2,8 +2,8 @@ import argparse import sys -from gensim.models.word2vec import Word2Vec import csv +from gensim.models import KeyedVectors from signal import signal, SIGINT signal(SIGINT, lambda signum, frame: sys.exit(1)) @@ -13,9 +13,9 @@ parser.add_argument('w2v', type=argparse.FileType('rb')) a...
935e16c55ac9dd59b1025c5b124ca0d15eaa02f7
run-lala.py
run-lala.py
#!/usr/bin/python2 import lala import ConfigParser import sys def main(): """Main method""" config = ConfigParser.SafeConfigParser() config.read("config") lalaconfig = config._sections["lala"] if "-d" in sys.argv: debug = True else: debug = False if "nickserv_password" in la...
#!/usr/bin/python2 import lala import ConfigParser import sys def main(): """Main method""" config = ConfigParser.SafeConfigParser() config.read("config") lalaconfig = config._sections["lala"] if "-d" in sys.argv: debug = True else: debug = False nickserv_password = lalaconf...
Remove that ... awkward... code
Remove that ... awkward... code
Python
mit
mineo/lala,mineo/lala
--- +++ @@ -12,10 +12,6 @@ debug = True else: debug = False - if "nickserv_password" in lalaconfig: - nickserv_password = lalaconfig["nickserv_password"] - else: - nick nickserv_password = lalaconfig["nickserv_password"] if "nickserv_password"\ in lalaconfi...
795b661962915221ddab186b66523896316b2a79
jobs/jobs/items.py
jobs/jobs/items.py
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy def single_item_serializer(value): # values are nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) # so need to return just the fist value w...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy def single_item_serializer(value): # values are sometimes nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) # so need to return just the fi...
Fix rendering of alfred.is data to json file
Fix rendering of alfred.is data to json file
Python
apache-2.0
multiplechoice/workplace
--- +++ @@ -9,9 +9,11 @@ def single_item_serializer(value): - # values are nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) + # values are sometimes nested inside a list: (u'Viltu vaxa me\xf0 Alvogen?',) # so need to return just the fist value when serializing - return value[0] + if isinst...
06ee9c73fed7a9b8488d800859f65c28ad63eb57
angr/extern_obj.py
angr/extern_obj.py
from cle.absobj import AbsObj class AngrExternObject(AbsObj): def __init__(self, alloc_size=0x1000): super(AngrExternObject, self).__init__('##angr_externs##') self._next_addr = 0 self._lookup_table = {} self._alloc_size = alloc_size self.memory = 'please never look at this'...
from cle.absobj import AbsObj class AngrExternObject(AbsObj): def __init__(self, alloc_size=0x1000): super(AngrExternObject, self).__init__('##angr_externs##') self._next_addr = 0 self._lookup_table = {} self._alloc_size = alloc_size self.memory = 'please never look at this'...
Make the extrn object use the convention for rebased addresses
Make the extrn object use the convention for rebased addresses
Python
bsd-2-clause
angr/angr,xurantju/angr,zhuyue1314/angr,haylesr/angr,axt/angr,tyb0807/angr,terry2012/angr,avain/angr,xurantju/angr,lowks/angr,iamahuman/angr,iamahuman/angr,tyb0807/angr,iamahuman/angr,angr/angr,haylesr/angr,avain/angr,terry2012/angr,chubbymaggie/angr,cureHsu/angr,f-prettyland/angr,tyb0807/angr,schieb/angr,GuardianRG/an...
--- +++ @@ -9,10 +9,10 @@ self.memory = 'please never look at this' def get_max_addr(self): - return self._alloc_size + return self._alloc_size + self.rebase_addr def get_min_addr(self): - return 0 + return self.rebase_addr def get_pseudo_addr(self, ident): ...
20c78cc7c4e0658be01df0ba92838b605bcafdc4
pyreststore/pyreststore/__init__.py
pyreststore/pyreststore/__init__.py
# -*- coding: utf-8; mode: Python; -*- from __future__ import unicode_literals __title__ = 'Python implementation of a REST based storage' # Please use PEP 0440 version strings. # https://www.python.org/dev/peps/pep-0440/ __version__ = '0.9.0' __author__ = 'Peter Dahl Vestergaard' __license__ = 'BSD 3-Clause' __copyr...
# -*- coding: utf-8; mode: Python; -*- from __future__ import unicode_literals __title__ = 'Python implementation of a REST based storage' # Please use PEP 0440 version strings. # https://www.python.org/dev/peps/pep-0440/ __version__ = '0.9.1.dev1' __author__ = 'Peter Dahl Vestergaard' __license__ = 'BSD 3-Clause' __...
Bump version to development version
Bump version to development version
Python
bsd-3-clause
peterdv/pyreststore
--- +++ @@ -5,7 +5,7 @@ # Please use PEP 0440 version strings. # https://www.python.org/dev/peps/pep-0440/ -__version__ = '0.9.0' +__version__ = '0.9.1.dev1' __author__ = 'Peter Dahl Vestergaard' __license__ = 'BSD 3-Clause' __copyright__ = 'Copyright 2015 Peter Dahl Vestergaard'
726ebd81a592361d3e2f599d009be6d1f5a81b2c
project/utils/logger.py
project/utils/logger.py
# -*- coding: utf-8 -*- import datetime import logging import os import hashlib from utils.settings_handler import settings def set_up_logging(): """ Logger for tenhou communication and AI output """ logs_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'logs') if not ...
# -*- coding: utf-8 -*- import datetime import logging import os import hashlib from utils.settings_handler import settings def set_up_logging(): """ Logger for tenhou communication and AI output """ logs_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'logs') if not ...
Remove " " from log name
Remove " " from log name
Python
mit
MahjongRepository/tenhou-python-bot,MahjongRepository/tenhou-python-bot
--- +++ @@ -26,7 +26,7 @@ ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) - file_name = '{}_{}.log'.format(name_hash, datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S')) + file_name = '{}_{}.log'.format(name_hash, datetime.datetime.now().strftime('%Y-%m-%d_%H_%M_%S')) fh = logging.Fi...
a339ee67b9a2f1effcedf836f26657f628a842ee
employees/admin.py
employees/admin.py
from django.contrib import admin from .models import Employee, Role class RoleAdmin(admin.ModelAdmin): list_display = ("name",) class EmployeeAdmin(admin.ModelAdmin): list_display = ("username", "first_name", "last_name", "email", 'level', 'score',) fieldsets = ( (None, {'fields': ('username', '...
from django import forms from django.contrib import admin from .models import Employee, Role class UserCreationForm(forms.ModelForm): class Meta: model = Employee fields = ('username', 'password',) def save(self, commit=True): user = super(UserCreationForm, self).save(commit=False) ...
Fix employee form error about password hashing
Fix employee form error about password hashing
Python
apache-2.0
belatrix/BackendAllStars
--- +++ @@ -1,12 +1,26 @@ +from django import forms from django.contrib import admin from .models import Employee, Role + +class UserCreationForm(forms.ModelForm): + class Meta: + model = Employee + fields = ('username', 'password',) + + def save(self, commit=True): + user = super(UserC...
ebf3f4a73aaab3aa2ea3e760bb44cfcbd7ca8d7f
src/main.py
src/main.py
#!/usr/bin/python #coding=utf8 from Tkinter import * import sys from ui import Gui if __name__ == '__main__': Root = Tk() App = Gui(Root) App.pack(expand='yes',fill='both') Root.geometry('320x240+10+10') Root.title('Mid!Magic') Root.mainloop()
#!/usr/bin/python #coding=utf8 from Tkinter import * import sys from ui import Gui if __name__ == '__main__': Root = Tk() App = Gui(Root) App.pack(expand='yes',fill='both') w, h = root.winfo_screenwidth(), root.winfo_screenheight() Root.overrideredirect(1) Root.geometry("%dx%d+0+0" % (w, h...
Add support for full screen.
Add support for full screen.
Python
apache-2.0
doino-gretchenliev/Mid-Magic,doino-gretchenliev/Mid-Magic
--- +++ @@ -9,6 +9,10 @@ Root = Tk() App = Gui(Root) App.pack(expand='yes',fill='both') - Root.geometry('320x240+10+10') + w, h = root.winfo_screenwidth(), root.winfo_screenheight() + Root.overrideredirect(1) + Root.geometry("%dx%d+0+0" % (w, h)) + Root.focus_set() # <-- move focus to th...
d1d53bf2c2e719f2ff90d4260bb2521d0ee4af01
main.py
main.py
import argparse from config import app_config as cfg from libraries.database_init import DataBase from libraries.tweetimporter import TweetImporter from libraries.twitterclient import TwitterClient # Twitter API configuration consumer_key = cfg.twitter["consumer_key"] consumer_secret = cfg.twitter["consumer_secret"]...
import argparse from config import app_config as cfg from libraries.database_init import DataBase from libraries.tweetimporter import TweetImporter from libraries.twitterclient import TwitterClient # Twitter API configuration consumer_key = cfg.twitter["consumer_key"] consumer_secret = cfg.twitter["consumer_secret"]...
Add option to create/drop the database
Add option to create/drop the database
Python
mit
franckbrignoli/twitter-bot-detection
--- +++ @@ -17,6 +17,7 @@ parser = argparse.ArgumentParser(description='provide additional information to run the bot detection') parser.add_argument('specified_user', action="store", help='load tweets from the specified user') parser.add_argument('--followers', action="store_true", help="load tweets from user's f...
2b0bcbb7ce82171965b22cf657439d6263fa9d91
geojson_scraper.py
geojson_scraper.py
import json import os import urllib.request from retry import retry from urllib.error import HTTPError from common import store_history, truncate, summarise # hack to override sqlite database filename # see: https://help.morph.io/t/using-python-3-with-morph-scraperwiki-fork/148 os.environ['SCRAPERWIKI_DATABASE_NAME'] ...
import json import os import urllib.request from retry import retry from urllib.error import HTTPError from common import store_history, truncate, summarise # hack to override sqlite database filename # see: https://help.morph.io/t/using-python-3-with-morph-scraperwiki-fork/148 os.environ['SCRAPERWIKI_DATABASE_NAME'] ...
Add key param to geojson scraper
Add key param to geojson scraper Sometimes we encounter a geojson file with no 'id' attribute This allows us to specify a property to use as a key instead
Python
mit
wdiv-scrapers/dc-base-scrapers
--- +++ @@ -12,7 +12,7 @@ @retry(HTTPError, tries=2, delay=30) -def scrape(url, council_id, encoding, table): +def scrape(url, council_id, encoding, table, key=None): with urllib.request.urlopen(url) as response: @@ -28,10 +28,13 @@ # assemble record record = { - ...
78807533031cf46acb5e73b695c0e492cf2c3e20
gnsq/httpclient.py
gnsq/httpclient.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import urllib3 try: import simplejson as json except ImportError: import json # pyflakes.ignore from .errors import NSQHttpError class HTTPClient(object): base_url = None __http = None @property def http(self): if self...
# -*- coding: utf-8 -*- from __future__ import absolute_import import urllib3 try: import simplejson as json except ImportError: import json # pyflakes.ignore from .decorators import cached_property from .errors import NSQHttpError class HTTPClient(object): @cached_property def http(self): ...
Use cached property decorator connection pool.
Use cached property decorator connection pool.
Python
bsd-3-clause
hiringsolved/gnsq,wtolson/gnsq,wtolson/gnsq
--- +++ @@ -8,18 +8,14 @@ except ImportError: import json # pyflakes.ignore +from .decorators import cached_property from .errors import NSQHttpError class HTTPClient(object): - base_url = None - __http = None - - @property + @cached_property def http(self): - if self.__http is ...
f8f1dc94bc7d48bbe9a36c7b1ffa8117ba458cba
lobster/sandbox.py
lobster/sandbox.py
from itertools import imap import os import re import sys import tarfile def dontpack(fn): return '/.' in fn or '/CVS/' in fn def package(indir, outfile): try: tarball = tarfile.open(outfile, 'w:bz2') tarball.dereference = True rtname = os.path.split(os.path.normpath(indir))[1] ...
from itertools import imap import os import re import sys import tarfile def dontpack(fn): res = ('/.' in fn and not '/.SCRAM' in fn) or '/CVS/' in fn if res: return True print fn return False def package(indir, outfile): try: tarball = tarfile.open(outfile, 'w:bz2') tarbal...
Add the bits that cmsenv/cmsRun actually need.
Add the bits that cmsenv/cmsRun actually need.
Python
mit
matz-e/lobster,matz-e/lobster,matz-e/lobster
--- +++ @@ -5,7 +5,11 @@ import tarfile def dontpack(fn): - return '/.' in fn or '/CVS/' in fn + res = ('/.' in fn and not '/.SCRAM' in fn) or '/CVS/' in fn + if res: + return True + print fn + return False def package(indir, outfile): try: @@ -15,7 +19,7 @@ rtname = os.path...
b5d3b84d4d2554882632fa9b10f44bd6ffb94b40
recipyCommon/libraryversions.py
recipyCommon/libraryversions.py
import sys import pkg_resources import warnings import numbers import six def get_version(modulename): "Return a string containing the module name and the library version." version = '?' # Get the root module name (in case we have something like `recipy.open` # or `matplotlib.pyplot`) modulename...
import sys import pkg_resources import warnings import numbers import six def get_version(modulename): "Return a string containing the module name and the library version." version = '?' # Get the root module name (in case we have something like `recipy.open` # or `matplotlib.pyplot`) modulename...
Add fallback method for finding library versions
Add fallback method for finding library versions For library 'iris' the version number cannot be found in the pkg_resources working set. It is unclear why. The version number can be found using iris.__version__, so re-added the old version finding code as a fallback.
Python
apache-2.0
recipy/recipy,recipy/recipy
--- +++ @@ -15,9 +15,9 @@ modulename = modulename.split('.')[0] if modulename in sys.modules: - ws = pkg_resources.working_set - package = ws.find(pkg_resources.Requirement(modulename)) - version = package.version + version = _get_version_from_pkg_resources(modulename) + ...
85d12c7ce38c4349a98ccd09266bc3f08f511daa
tests/test_message_body.py
tests/test_message_body.py
from tddcommitmessage.messagebody import MessageBody def test_message_wrapped_in_quotes(): msg = MessageBody('forty-two') assert str(msg) == '"forty-two"' def test_message_with_double_quotes_is_wrapped_with_single(): msg = MessageBody('But what are "Birds"?') assert str(msg) == r"""'But what are "Bird...
from tddcommitmessage.messagebody import MessageBody def test_message_is_wrapped_in_quotes(): msg = MessageBody('forty-two') assert str(msg) == '"forty-two"' def test_message_with_double_quote_is_wrapped_with_single(): msg = MessageBody('But what are "Birds"?') assert str(msg) == r"""'But what are "Bi...
REFACTOR Improve test name's grammar and accuracy.
REFACTOR Improve test name's grammar and accuracy.
Python
mit
matatk/tdd-bdd-commit,matatk/tdd-bdd-commit
--- +++ @@ -1,9 +1,9 @@ from tddcommitmessage.messagebody import MessageBody -def test_message_wrapped_in_quotes(): +def test_message_is_wrapped_in_quotes(): msg = MessageBody('forty-two') assert str(msg) == '"forty-two"' -def test_message_with_double_quotes_is_wrapped_with_single(): +def test_message_...
7c0c349656e6f02be0f3f0044f5d225f3688be08
bong/parse_args.py
bong/parse_args.py
from .settings import BongSettings, DEFAULT_MESSAGE from .metadata import VERSION, SUMMARY import argparse PARSER = argparse.ArgumentParser(description=SUMMARY) PARSER.add_argument('-V', '--version', action='version', version=VERSION, help='Show version') PARSER.add_argument('-s', '--short-break', ...
from .settings import BongSettings, DEFAULT_MESSAGE from .metadata import VERSION, SUMMARY import argparse PARSER = argparse.ArgumentParser(description=SUMMARY) PARSER.add_argument('-V', '--version', action='version', version='%(prog)s {}'.format(VERSION), help='show version') P...
Clean up the argument parsing
Clean up the argument parsing
Python
mit
prophile/bong
--- +++ @@ -3,21 +3,22 @@ import argparse PARSER = argparse.ArgumentParser(description=SUMMARY) -PARSER.add_argument('-V', '--version', action='version', version=VERSION, - help='Show version') +PARSER.add_argument('-V', '--version', action='version', + version='%(prog)s {}'....
8caef330d6e69468833aa95f218390cc1e9088a5
scripts/gen/__init__.py
scripts/gen/__init__.py
import sys if sys.version_info[0] != 2 or not (5 <= sys.version_info[1] <= 7): sys.stderr.write('error: unsupported Python version (2.5-2.7 required)\n') sys.exit(1)
Add build script Python version check
Add build script Python version check
Python
bsd-2-clause
depp/sglib,depp/sglib
--- +++ @@ -0,0 +1,4 @@ +import sys +if sys.version_info[0] != 2 or not (5 <= sys.version_info[1] <= 7): + sys.stderr.write('error: unsupported Python version (2.5-2.7 required)\n') + sys.exit(1)
31f1c65d6505bc443fdb1d6ccd4849b175788f04
gargbot_3000/config.py
gargbot_3000/config.py
#! /usr/bin/env python3.6 # coding: utf-8 import os import datetime as dt from pathlib import Path import pytz from dotenv import load_dotenv env_path = Path('.') / '.env' load_dotenv(dotenv_path=env_path) slack_verification_token = os.environ["slack_verification_token"] slack_bot_user_token = os.environ["slack_bot...
#! /usr/bin/env python3.6 # coding: utf-8 import os import datetime as dt from pathlib import Path import pytz from dotenv import load_dotenv load_dotenv() slack_verification_token = os.environ["slack_verification_token"] slack_bot_user_token = os.environ["slack_bot_user_token"] bot_id = os.environ["bot_id"] bot_na...
Remove explicit path from load_dotenv call
Remove explicit path from load_dotenv call
Python
mit
eirki/gargbot_3000,eirki/gargbot_3000,eirki/gargbot_3000,eirki/gargbot_3000
--- +++ @@ -8,8 +8,7 @@ import pytz from dotenv import load_dotenv -env_path = Path('.') / '.env' -load_dotenv(dotenv_path=env_path) +load_dotenv() slack_verification_token = os.environ["slack_verification_token"] slack_bot_user_token = os.environ["slack_bot_user_token"] @@ -17,6 +16,7 @@ bot_name = os.envir...
da3b2feab201782b3468e5e39232c366e0a3ebc0
kolibri/core/discovery/serializers.py
kolibri/core/discovery/serializers.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from rest_framework import serializers from rest_framework.serializers import ValidationError from .models import NetworkLocation from .utils.network import errors from .utils.network.client import Net...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from rest_framework import serializers from rest_framework.serializers import ValidationError from .models import NetworkLocation from .utils.network import errors from .utils.network.client import Net...
Make some of the NetworkLocationSerializer fields read-only
Make some of the NetworkLocationSerializer fields read-only
Python
mit
DXCanas/kolibri,lyw07/kolibri,DXCanas/kolibri,lyw07/kolibri,indirectlylit/kolibri,lyw07/kolibri,learningequality/kolibri,lyw07/kolibri,mrpau/kolibri,DXCanas/kolibri,mrpau/kolibri,indirectlylit/kolibri,DXCanas/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,lea...
--- +++ @@ -15,6 +15,7 @@ class Meta: model = NetworkLocation fields = ('id', 'available', 'base_url', 'device_name', 'instance_id', 'added', 'last_accessed', 'operating_system', 'application', 'kolibri_version') + read_only_fields = ('available', 'instance_id', 'added', 'last_accessed',...
906f35428e36f2ece2fdb1c7fb150b979cf0457b
pyxform/tests_v1/test_whitespace.py
pyxform/tests_v1/test_whitespace.py
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase class WhitespaceTest(PyxformTestCase): def test_over_trim(self): self.assertPyxformXform( name='issue96', md=""" | survey | | | | | | type | l...
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase class WhitespaceTest(PyxformTestCase): def test_over_trim(self): self.assertPyxformXform( name='issue96', md=""" | survey | | | | | | type | l...
Rename test so it actually runs
Rename test so it actually runs
Python
bsd-2-clause
XLSForm/pyxform,XLSForm/pyxform
--- +++ @@ -14,7 +14,7 @@ '<label><output value=" /issue96/var "/> text </label>', ]) - def empty_label_squashing(self): + def test_empty_label_squashing(self): self.assertPyxformXform( name='empty_label', debug=True,
9c9127446a9c362910ea093d5a317ad0fc23e3d7
opencivicdata/admin/division.py
opencivicdata/admin/division.py
from django.contrib import admin from opencivicdata.models import division as models @admin.register(models.Division) class DivisionAdmin(admin.ModelAdmin): list_display = ('display_name', 'id') search_fields = list_display
from django.contrib import admin from opencivicdata.models import division as models @admin.register(models.Division) class DivisionAdmin(admin.ModelAdmin): list_display = ('name', 'id') search_fields = list_display
Update to reflect change of display_name --> name
Update to reflect change of display_name --> name
Python
bsd-3-clause
opencivicdata/python-opencivicdata-django,opencivicdata/python-opencivicdata-django,rshorey/python-opencivicdata-django,opencivicdata/python-opencivicdata,influence-usa/python-opencivicdata-django,rshorey/python-opencivicdata-django,mileswwatkins/python-opencivicdata-django,mileswwatkins/python-opencivicdata-django,ope...
--- +++ @@ -4,6 +4,6 @@ @admin.register(models.Division) class DivisionAdmin(admin.ModelAdmin): - list_display = ('display_name', 'id') + list_display = ('name', 'id') search_fields = list_display
6891981cd32a9dbf71346f95256f8447726672df
packages/pixman.py
packages/pixman.py
CairoGraphicsPackage ('pixman', '0.30.0')
class PixmanPackage (CairoGraphicsPackage): def __init__ (self): CairoGraphicsPackage.__init__ (self, 'pixman', '0.30.0') #This package would like to be built with fat binaries if Package.profile.m64 == True: self.fat_build = True def arch_build (self, arch): if arch == 'darwin-fat': #multi-arch build...
Enable fat binaries on pitman package
Enable fat binaries on pitman package
Python
mit
mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild
--- +++ @@ -1 +1,17 @@ -CairoGraphicsPackage ('pixman', '0.30.0') +class PixmanPackage (CairoGraphicsPackage): + def __init__ (self): + CairoGraphicsPackage.__init__ (self, 'pixman', '0.30.0') + + #This package would like to be built with fat binaries + if Package.profile.m64 == True: + self.fat_build = True +...
e81a54a5df2aaafae230084fe3b4d59c5b4f61cc
parallel/runner.py
parallel/runner.py
import Queue from parallel import worker class Runner(object): def __init__(self, num_workers=4): self.in_queue = Queue.Queue() self.out_queue = Queue.Queue() self.num_workers = num_workers self.workers = None self._start_workers() def _start_workers(self): se...
import Queue from parallel import config from parallel import worker class Runner(object): def __init__(self, num_workers=config.NUM_WORKERS): self.in_queue = Queue.Queue() self.out_queue = Queue.Queue() self.num_workers = num_workers self.workers = None self._start_worker...
Use default number of workers from config
Use default number of workers from config config does a better job at figuring out the optimal number of workers, so it will be used instead.
Python
mit
andersonvom/mparallel
--- +++ @@ -1,10 +1,11 @@ import Queue +from parallel import config from parallel import worker class Runner(object): - def __init__(self, num_workers=4): + def __init__(self, num_workers=config.NUM_WORKERS): self.in_queue = Queue.Queue() self.out_queue = Queue.Queue() self.n...
d5cd8d679b08aae6d91cad003fdd71660a85c39b
opps/images/forms.py
opps/images/forms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from .models import Image from .widgets import MultipleUpload, CropExample from redactor.widgets import RedactorEditor class ImageModelForm(forms.ModelForm): image = forms.FileField(required=True, widget=MultipleUpload()) crop_example = ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from .models import Image from .widgets import MultipleUpload, CropExample from redactor.widgets import RedactorEditor class ImageModelForm(forms.ModelForm): archive = forms.FileField(required=True, widget=MultipleUpload()) crop_example ...
Change form field image to archive
Change form field image to archive
Python
mit
williamroot/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,opps/opps,jeanmask/opps
--- +++ @@ -9,7 +9,7 @@ class ImageModelForm(forms.ModelForm): - image = forms.FileField(required=True, widget=MultipleUpload()) + archive = forms.FileField(required=True, widget=MultipleUpload()) crop_example = forms.CharField(required=False, widget=CropExample()) crop_x1 = forms.CharField(requi...
ddaf1a2b6744c9012546d6258b0378ab1b96d658
zerver/lib/i18n.py
zerver/lib/i18n.py
# -*- coding: utf-8 -*- from django.conf import settings from django.utils import translation from django.utils.translation import ugettext as _ from six import text_type from typing import Any import os import ujson def with_language(string, language): # type: (text_type, text_type) -> text_type old_languag...
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.conf import settings from django.utils import translation from django.utils.translation import ugettext as _ from six import text_type from typing import Any import os import ujson def with_language(string, language): # type: (text_type,...
Return unformatted list from get_language_list.
Return unformatted list from get_language_list.
Python
apache-2.0
grave-w-grave/zulip,amanharitsh123/zulip,kou/zulip,vikas-parashar/zulip,JPJPJPOPOP/zulip,ahmadassaf/zulip,andersk/zulip,vikas-parashar/zulip,andersk/zulip,hackerkid/zulip,kou/zulip,eeshangarg/zulip,ahmadassaf/zulip,dhcrzf/zulip,showell/zulip,punchagan/zulip,vabs22/zulip,peguin40/zulip,JPJPJPOPOP/zulip,shubhamdhama/zuli...
--- +++ @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import + from django.conf import settings from django.utils import translation from django.utils.translation import ugettext as _ @@ -26,8 +28,6 @@ for lang_info in languages['languages']: name = lang_info['name...
308f1cd155e2db37fe5ff03e158e3d9fc32d6885
lehrex/__init__.py
lehrex/__init__.py
# -*- coding: utf-8 -*- """Python package to support the research during the annual Lehrexkursion at Universität Hamburg. """ from os.path import dirname, join from . import csv from . import math from . import plots from . import utils __version__ = open(join(dirname(__file__), 'VERSION')).read().strip() __all__ =...
# -*- coding: utf-8 -*- """Python package to support the research during the annual Lehrexkursion at Universität Hamburg. """ from os.path import dirname, join from . import csv from . import math from . import plots from . import utils __version__ = open(join(dirname(__file__), 'VERSION')).read().strip() __all__ =...
Introduce Python 3.5 syntax error.
Introduce Python 3.5 syntax error.
Python
mit
lkluft/lehrex
--- +++ @@ -18,3 +18,11 @@ 'plots', 'utils', ] + + +class Test: + def foo(self): + return f"{self}" + + +Test()
b2657fd84c0d8fd4e1188a649bb2595651b83adb
kazoo/handlers/util.py
kazoo/handlers/util.py
"""Handler utilities for getting non-monkey patched std lib stuff Allows one to get an unpatched thread module, with a thread decorator that uses the unpatching OS thread. """ try: from gevent import monkey [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) except ImportError: from t...
"""Handler utilities for getting non-monkey patched std lib stuff Allows one to get an unpatched thread module, with a thread decorator that uses the unpatching OS thread. """ from __future__ import absolute_import try: from gevent._threading import start_new_thread except ImportError: from thread import sta...
Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.
Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.
Python
apache-2.0
harlowja/kazoo,pombredanne/kazoo,rockerbox/kazoo,AlexanderplUs/kazoo,harlowja/kazoo,pombredanne/kazoo,rgs1/kazoo,Asana/kazoo,jacksontj/kazoo,kormat/kazoo,rackerlabs/kazoo,bsanders/kazoo,tempbottle/kazoo,python-zk/kazoo,rockerbox/kazoo,jacksontj/kazoo,rackerlabs/kazoo,python-zk/kazoo,rgs1/kazoo,tempbottle/kazoo,Alexande...
--- +++ @@ -4,9 +4,10 @@ decorator that uses the unpatching OS thread. """ +from __future__ import absolute_import + try: - from gevent import monkey - [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) + from gevent._threading import start_new_thread except ImportError: from...
08f36c5ff17c2bdfb98bdbcaeaaaaf30a1b71b93
raxcli/__init__.py
raxcli/__init__.py
# Copyright 2012 Rackspace # # Licensed to the Apache Software Foundation (ASF) 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...
# Copyright 2013 Rackspace # # Licensed to the Apache Software Foundation (ASF) 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...
Update year in the license header.
Update year in the license header.
Python
apache-2.0
racker/python-raxcli
--- +++ @@ -1,4 +1,4 @@ -# Copyright 2012 Rackspace +# Copyright 2013 Rackspace # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with
534770cf0cc25c7aa0350570bc7a39d6239c7e05
src/data/extractor/parsehtml.py
src/data/extractor/parsehtml.py
from urllib import urlopen from bs4 import BeautifulSoup from selenium import webdriver def getBeautifulSoupObject(link): html = urlopen(link) return BeautifulSoup(html) def getDynamicContent(link): driver = webdriver.PhantomJS() driver.get(link) link = "https://www.dnainfo.com/chicago/2017-chicago-...
import requests from bs4 import BeautifulSoup from selenium import webdriver import logging logging.basicConfig(filename='scrape.log',level=20) logging.info('Initialized logger') def getBeautifulSoupObject(link): html = requests.get(link) return BeautifulSoup(html) def getDynamicContent(link): try: ...
Add logging, requests and handle exceptions
Add logging, requests and handle exceptions
Python
mit
craftbase/chicago-murders
--- +++ @@ -1,15 +1,25 @@ -from urllib import urlopen +import requests from bs4 import BeautifulSoup from selenium import webdriver +import logging +logging.basicConfig(filename='scrape.log',level=20) +logging.info('Initialized logger') + def getBeautifulSoupObject(link): - html = urlopen(link) + html = re...
55378f71e8553eaad606433ae9e871983e99bd26
pastalog/pastalog/__init__.py
pastalog/pastalog/__init__.py
''' The pastalog Log class, which simply sends a POST request to a the server. ''' import requests class Log(object): def __init__(self, url, model_name): self.url = url self.model_name = model_name def post(self, series_name, value, step): payload = {"modelName": self.model_name, ...
''' The pastalog Log class, which simply sends a POST request to a the server. ''' import requests import os class Log(object): def __init__(self, url, model_name): self.url = os.path.join(url, 'data') self.model_name = model_name def post(self, series_name, value, step): payload = {"...
Update to post to correct endpoint
Update to post to correct endpoint
Python
mit
rewonc/pastalog,rewonc/pastalog,rewonc/pastalog
--- +++ @@ -2,11 +2,12 @@ The pastalog Log class, which simply sends a POST request to a the server. ''' import requests +import os class Log(object): def __init__(self, url, model_name): - self.url = url + self.url = os.path.join(url, 'data') self.model_name = model_name de...
8e3d77675d65740776fc8f0fc93bb311cf62c632
books/models.py
books/models.py
from django.db import models from django.utils.translation import ugettext as _ from egielda import settings class BookType(models.Model): publisher = models.CharField(max_length=150) title = models.CharField(max_length=150) price = models.IntegerField() def price_string(self): return "%(pri...
from django.db import models from django.utils.translation import ugettext as _ from egielda import settings class BookType(models.Model): publisher = models.CharField(max_length=150) title = models.CharField(max_length=150) price = models.IntegerField() def price_string(self): return "%(pri...
Fix __str__ method for BookType Model
Fix __str__ method for BookType Model
Python
agpl-3.0
m4tx/egielda,m4tx/egielda,m4tx/egielda
--- +++ @@ -15,7 +15,6 @@ def __str__(self): return _( - "%(publisher)s %(title)s, Edition %(edition)d %(publication_year)d" % { + "%(publisher)s %(title)s" % { 'publisher': self.publisher, - 'title': self.title, 'edition': self.edition, - ...
580b5c48fc42f09459bcf63c0e2e239a550adb41
calexicon/calendars/tests/calendar_testing.py
calexicon/calendars/tests/calendar_testing.py
import sys if sys.hexversion < 0x02070000: import unittest2 as unittest else: import unittest from hypothesis import given, example from hypothesis.extra.datetime import datetimes from calexicon.calendars import ProlepticGregorianCalendar, JulianCalendar from calexicon.dates import DateWithCalendar, Invalid...
import sys if sys.hexversion < 0x02070000: import unittest2 as unittest else: import unittest from hypothesis import given, example from hypothesis.extra.datetime import datetimes from calexicon.calendars import ProlepticGregorianCalendar, JulianCalendar from calexicon.dates import DateWithCalendar, Invalid...
Change name of test to avoid collision
Change name of test to avoid collision This was spotted by coveralls.
Python
apache-2.0
jwg4/calexicon,jwg4/qual
--- +++ @@ -31,7 +31,7 @@ self.assertIsNotNone(dc.__str__()) @given(datetimes(timezones=[])) - def test_date_strings(self, dt): + def test_native_representation(self, dt): if self.calendar is None: return d = dt.date()
520a23caae3bd4e1db60021025b5dc3f573b0873
plugins/mediawiki.py
plugins/mediawiki.py
import ConfigParser import datetime from wikitools import wiki from wikitools import category from plugin import Plugin class MediaWiki(Plugin): def __init__(self, config=None): if config: try: self.site = wiki.Wiki(config.get('MediaWiki', 'wikiapiurl')) self.site.login(config.get('MediaWik...
import ConfigParser import datetime from wikitools import wiki from wikitools import category from plugin import Plugin class MediaWiki(Plugin): def __init__(self, config=None): if config: try: self.site = wiki.Wiki(config.get('MediaWiki', 'wikiapiurl')) self.site.login(config.get('MediaWik...
Mark wiki edits as bot edit
Mark wiki edits as bot edit
Python
mit
k4cg/Rezeptionistin
--- +++ @@ -23,4 +23,4 @@ date = now.strftime("%Y-%m-%d %H:%M") cat = category.Category(self.site, "Linklist") for article in cat.getAllMembersGen(namespaces=[0]): - print article.edit(appendtext="\n* {title} - {url} ({date}) \n".format(title=title, url=url, date=date)) + print article.edit(a...
6a9165a55d3238a40e368a348c6d7a7a7d133f34
dockci/api/base.py
dockci/api/base.py
""" Base classes and data for building the API """ from flask_restful import reqparse, Resource from .util import clean_attrs, set_attrs from dockci.server import DB AUTH_FORM_LOCATIONS = ('form', 'headers', 'json') class BaseDetailResource(Resource): """ Base resource for details API endpoints """ def han...
""" Base classes and data for building the API """ from flask_restful import reqparse, Resource from .util import clean_attrs, set_attrs from dockci.server import DB AUTH_FORM_LOCATIONS = ('form', 'headers', 'json') class BaseDetailResource(Resource): """ Base resource for details API endpoints """ # pylin...
Allow handle_write to accept data
Allow handle_write to accept data
Python
isc
RickyCook/DockCI,RickyCook/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI-Agent,sprucedev/DockCI,RickyCook/DockCI,RickyCook/DockCI,sprucedev/DockCI-Agent,sprucedev/DockCI
--- +++ @@ -10,10 +10,18 @@ class BaseDetailResource(Resource): """ Base resource for details API endpoints """ - def handle_write(self, model, parser): # pylint:disable=no-self-use + # pylint:disable=no-self-use + def handle_write(self, model, parser=None, data=None): """ Parse request arg...
4ae0fccace6a3b2b640fd58c03fbd07341578acc
gen-android-icons.py
gen-android-icons.py
__author__ = 'Maksim Dmitriev' import argparse import os if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', help='the icon to be resized', required=True) parser.add_argument('-d', '--dest', help='the directory where resized icons are saved') parser.add_...
__author__ = 'Maksim Dmitriev' import argparse import os if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', help='the icon to be resized', required=True) parser.add_argument('-d', '--dest', help='the directory where resized icons are saved') parser.add_...
Use os.path.join instead of +
Use os.path.join instead of +
Python
bsd-3-clause
MaksimDmitriev/Python-Scripts
--- +++ @@ -13,5 +13,10 @@ source_image = args.source dest_dir = args.dest if dest_dir is None: - os.makedirs(os.path.dirname(os.path.realpath(source_image)) + os.sep + 'out', exist_ok=True) + dest_dir = os.path.join(os.path.dirname(os.path.realpath(source_image)), 'out') + os.make...
77f22bd587ba2f6b1360bd5f8174e007b6028f9f
genes/debconf/set.py
genes/debconf/set.py
import os from subprocess import Popen, PIPE from genes.lib.traits import if_any from genes.ubuntu.traits import is_ubuntu from genes.debian.traits import is_debian # TODO: stop using sudo or ensure it exists # TODO: specify user to run as # TODO: utilize functools partial to handle some of the above functionality cl...
import os from subprocess import Popen, PIPE from genes.lib.traits import if_any from genes.ubuntu.traits import is_ubuntu from genes.debian.traits import is_debian # TODO: stop using sudo or ensure it exists # TODO: specify user to run as # TODO: utilize functools partial to handle some of the above functionality cl...
Change bools to functions in if_any
Change bools to functions in if_any
Python
mit
hatchery/genepool,hatchery/Genepool2
--- +++ @@ -14,7 +14,7 @@ ENV['DEBIAN_FRONTEND'] = "noninteractive" -@if_any(is_debian(), is_ubuntu()) +@if_any(is_debian, is_ubuntu) def set_selections(*selections): if selections: debconf = Popen(Config.SET_SELECTIONS, env=Config.ENV, stdin=PIPE)
25e5070a575de1ae7e20d6ede71297ab424cea87
bluegreen-example/app.py
bluegreen-example/app.py
import os from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello 0-downtime %s World!" % os.environ.get('BLUEGREEN', 'bland')
import os from flask import Flask, send_from_directory app = Flask(__name__) @app.route("/") def hello(): return "Hello 0-downtime %s World!" % os.environ.get('BLUEGREEN', 'bland') @app.route("/parrots/<path:path>") def parrot(path): return send_from_directory(os.path.join('parrots', 'parrots'), path)
Add a route to send parrot images
Add a route to send parrot images
Python
mit
dbravender/gitric
--- +++ @@ -1,9 +1,14 @@ import os -from flask import Flask +from flask import Flask, send_from_directory app = Flask(__name__) @app.route("/") def hello(): return "Hello 0-downtime %s World!" % os.environ.get('BLUEGREEN', 'bland') + + +@app.route("/parrots/<path:path>") +def parrot(path): + return ...
09b6f3e5cde6aeff69ea15fdc15c7db300ce3272
python/web_socket.py
python/web_socket.py
#!/bin/python try: import urllib.request as urlrequest except ImportError: import urllib as urlrequest import json class RESTfulApi: """ Generic REST API call """ def __init__(self): """ Constructor """ pass def request(self, url): """ Web...
#!/bin/python try: import urllib.request as urlrequest except ImportError: import urllib as urlrequest import json class RESTfulApi: """ Generic REST API call """ def __init__(self): """ Constructor """ pass def request(self, url): """ Web...
Support python 2 and 3 compatability
Support python 2 and 3 compatability
Python
apache-2.0
Aurora-Team/BitcoinExchangeFH
--- +++ @@ -24,11 +24,7 @@ :param: url: The url link :return JSON object """ - req = urlrequest.Request(url, None, headers={ - "Content-Type": "application/x-www-form-urlencoded", - "Accept": "*/*", - "User-Agent": "curl/7.24.0 (x86_64-apple-darwin12....
97a1c4979f8c46833b4ac89f6920138551ed2ee6
pyuvdata/__init__.py
pyuvdata/__init__.py
# -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """init file for pyuvdata. """ from __future__ import absolute_import, division, print_function from .uvdata import * from .telescopes import * from .uvcal import * from .uvbeam import ...
# -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """init file for pyuvdata. """ from __future__ import absolute_import, division, print_function from .uvdata import * from .telescopes import * from .uvcal import * from .uvbeam import ...
Add comment about utils import
Add comment about utils import
Python
bsd-2-clause
HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata
--- +++ @@ -11,7 +11,7 @@ from .telescopes import * from .uvcal import * from .uvbeam import * -from .utils import * +from .utils import * # consider removing this import from . import version __version__ = version.version
5f7622824ac997228f83a894b451211fac4838ed
core/data/DataTransformer.py
core/data/DataTransformer.py
""" DataTransformer :Authors: Berend Klein Haneveld """ from vtk import vtkImageReslice class DataTransformer(object): """DataTransformer is a class that can transform a given dataset""" def __init__(self): super(DataTransformer, self).__init__() def TransformImageData(self, imageData, transform): """ :t...
""" DataTransformer :Authors: Berend Klein Haneveld """ from vtk import vtkImageReslice class DataTransformer(object): """DataTransformer is a class that can transform a given dataset""" def __init__(self): super(DataTransformer, self).__init__() def TransformImageData(self, imageData, transform): """ :t...
Set the background color of the reslicer to the lowest value in the image data.
Set the background color of the reslicer to the lowest value in the image data.
Python
mit
berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop
--- +++ @@ -20,6 +20,8 @@ """ reslicer = vtkImageReslice() reslicer.SetInterpolationModeToCubic() + range = imageData.GetScalarRange() + reslicer.SetBackgroundLevel(range[0]) # reslicer.SetAutoCropOutput(1) # Not sure if this is what we want reslicer.SetInputData(imageData)
32b00e79b9204477e94adc47fae0e3a0838dc328
reviewboard/hostingsvcs/versionone.py
reviewboard/hostingsvcs/versionone.py
from django import forms from django.utils.translation import ugettext_lazy as _ from reviewboard.hostingsvcs.forms import HostingServiceForm from reviewboard.hostingsvcs.service import HostingService class VersionOneForm(HostingServiceForm): versionone_url = forms.CharField( label=_('VersionOne URL'), ...
from django import forms from django.utils.translation import ugettext_lazy as _ from reviewboard.hostingsvcs.forms import HostingServiceForm from reviewboard.hostingsvcs.service import HostingService class VersionOneForm(HostingServiceForm): versionone_url = forms.CharField( label=_('VersionOne URL'), ...
Clean up the name and spacing in the VersionOne code.
Clean up the name and spacing in the VersionOne code. The VersionOne code had some spacing and trailing whitespace problems, and also listed the service as "versionone" and not "VersionOne".
Python
mit
1tush/reviewboard,custode/reviewboard,1tush/reviewboard,1tush/reviewboard,chipx86/reviewboard,chipx86/reviewboard,KnowNo/reviewboard,KnowNo/reviewboard,brennie/reviewboard,davidt/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,beol/reviewboard,sgallagher/reviewboard,davidt/reviewboard,beol/reviewboard,bkoche...
--- +++ @@ -10,10 +10,11 @@ label=_('VersionOne URL'), max_length=64, required=True, - widget=forms.TextInput(attrs={'size': '60'})) + widget=forms.TextInput(attrs={'size': '60'})) + class VersionOne(HostingService): - name = 'versionone' + name = 'VersionOne' ...
73a9889f0e43d2b1dc94e2235a94cb888e0eda89
zeus/utils/sentry.py
zeus/utils/sentry.py
from functools import wraps from sentry_sdk import Hub def span(op, desc_or_func=None): def inner(func): @wraps(func) def wrapped(*args, **kwargs): if callable(desc_or_func): description = desc_or_func(*args, **kwargs) else: description = des...
import asyncio from contextlib import contextmanager from functools import wraps from sentry_sdk import Hub # https://stackoverflow.com/questions/44169998/how-to-create-a-python-decorator-that-can-wrap-either-coroutine-or-function def span(op, desc_or_func=None): def inner(func): @contextmanager ...
Fix span decorator to work with asyncio
Fix span decorator to work with asyncio
Python
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
--- +++ @@ -1,18 +1,35 @@ +import asyncio + +from contextlib import contextmanager from functools import wraps from sentry_sdk import Hub +# https://stackoverflow.com/questions/44169998/how-to-create-a-python-decorator-that-can-wrap-either-coroutine-or-function def span(op, desc_or_func=None): def inner(f...
3304b539e0f4105b3ad2603b0676b25d7c96b606
getconf/oldconf.py
getconf/oldconf.py
from oslo_config import cfg from oslo_config import generator as gn __all__ = ['get_conf'] def get_conf(conf_file=None, config_file=None): conf_file = '/opt/stack/barbican/etc/oslo-config-generator/barbican.conf' config_file = '/etc/barbican/barbican.conf' conf = cfg.ConfigOpts() gn.register_cli_opt...
from oslo_config import cfg from oslo_config import generator as gn __all__ = ['get_conf'] def get_conf(conf_file=None, config_file=None): conf_file = '/opt/stack/barbican/etc/oslo-config-generator/barbican.conf' config_file = '/etc/barbican/barbican.conf' conf = cfg.ConfigOpts() gn.register_cli_opt...
Add get not equal default options
Add get not equal default options
Python
apache-2.0
NguyenHoaiNam/Jump-Over-Release
--- +++ @@ -23,6 +23,8 @@ for namespace in namespaces: list_opts.extend(namespace[1]) new_conf.register_group(group) + if k == 'DEFAULT': + new_conf.register_opts(list_opts) new_conf.register_opts(list_opts, group=group) nova_args = ['--config-file', co...
4f5d0e6d16835a10a36cc57fc7e18cee91da5e2b
main.py
main.py
from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True # Note: We don't need to call run() since our application is embedded within # the App Engine WSGI application server. @app.route('/') def hello(): """Return a friendly HTTP greeting.""" return 'Hello World! 3' @app.errorhandler(404) ...
from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True # Note: We don't need to call run() since our application is embedded within # the App Engine WSGI application server. @app.route('/') #def hello(): # """Return a friendly HTTP greeting.""" def index(): return """ Upload Image <br> <...
Insert Upload function & save Google storage.
Insert Upload function & save Google storage.
Python
apache-2.0
DongjinChoi/tizen_easy_widget,DongjinChoi/tizen_easy_widget
--- +++ @@ -7,10 +7,49 @@ @app.route('/') -def hello(): - """Return a friendly HTTP greeting.""" - return 'Hello World! 3' +#def hello(): +# """Return a friendly HTTP greeting.""" +def index(): + return """ + Upload Image <br> +<form method="POST" action="/upload" enctype="multipart/form-data"> + ...
031bce223eac9eda1f856a204a07149c8e9549fd
hoomd/update/__init__.py
hoomd/update/__init__.py
from hoomd.update.box_resize import BoxResize # TODO remove when no longer necessary class _updater: pass __all__ = [BoxResize]
from hoomd.update.box_resize import BoxResize # TODO remove when no longer necessary class _updater: pass __all__ = ['BoxResize']
Fix typo in hoomd.update.__all__ quote class name
Fix typo in hoomd.update.__all__ quote class name
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
--- +++ @@ -6,4 +6,4 @@ pass -__all__ = [BoxResize] +__all__ = ['BoxResize']
f5c19e5814763235f8abebba2239f64135dc3188
python/shapes2json.py
python/shapes2json.py
import re import numpy as np infile = "shapes.txt" filt = re.compile(r'^"?([^"]*)"?$') converter = lambda x: filt.match(x.strip()).group(1) data = np.recfromcsv(infile, delimiter=',') shapes = np.array(map(int, [converter(x) for x in data["shape_id"]])) lats = np.array(map(float, [converter(x) for x in data["shape_pt_l...
import re, sys import numpy as np infile = sys.argv[1] filt = re.compile(r'^"?([^"]*)"?$') converter = lambda x: filt.match(x.strip()).group(1) data = np.recfromcsv(infile, delimiter=',') shapes = np.array(map(int, [converter(x) for x in data["shape_id"]])) lats = np.array(map(float, [converter(x) for x in data["shape_...
Print out an array of points
Print out an array of points
Python
mit
acbecker/kcmetrod3
--- +++ @@ -1,18 +1,24 @@ -import re +import re, sys import numpy as np -infile = "shapes.txt" +infile = sys.argv[1] filt = re.compile(r'^"?([^"]*)"?$') converter = lambda x: filt.match(x.strip()).group(1) data = np.recfromcsv(infile, delimiter=',') shapes = np.array(map(int, [converter(x) for x in data["shape_i...
e2924f23c48a6e39b7c6e24ac19f73bd10181167
say/say.py
say/say.py
# File: say.py # Purpose: Write a program that will take a number from 0 to 999,999,999,999 and spell out that number in English. # Programmer: Amal Shehu # Course: Exercism # Date: Wednesday 8th September 2016, 10:00 PM
# File: say.py # Purpose: 0 to 999,999,999,999 and spell out that number in English. # Programmer: Amal Shehu # Course: Exercism # Date: Wednesday 8th September 2016, 10:00 PM # #### Step 1 def say(num): num_dict = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five'...
Complete step 1 from problem Readme
Complete step 1 from problem Readme
Python
mit
amalshehu/exercism-python
--- +++ @@ -1,5 +1,26 @@ # File: say.py -# Purpose: Write a program that will take a number from 0 to 999,999,999,999 and spell out that number in English. +# Purpose: 0 to 999,999,999,999 and spell out that number in English. # Programmer: Amal Shehu # Course: Exercism # Date: Wednesd...
80dcfaa7216ed0be88eb275316d135a1089e4dbe
simplesqlite/_error.py
simplesqlite/_error.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import sqlite3 class DatabaseError(sqlite3.DatabaseError): """ Exception raised for errors that are related to the database. .. seealso:: - `sqlite3.DatabaseError <https://docs.python.org/3/library/sqlite3...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import sqlite3 from tabledata import InvalidTableNameError class DatabaseError(sqlite3.DatabaseError): """ Exception raised for errors that are related to the database. .. seealso:: - `sqlite3.DatabaseErr...
Remove a duplicate error class definition
Remove a duplicate error class definition
Python
mit
thombashi/SimpleSQLite,thombashi/SimpleSQLite
--- +++ @@ -5,6 +5,8 @@ """ import sqlite3 + +from tabledata import InvalidTableNameError class DatabaseError(sqlite3.DatabaseError): @@ -36,12 +38,6 @@ """ -class InvalidTableNameError(ValueError): - """ - Exception raised when used invalid table name for SQLite. - """ - - class InvalidAt...
79ef50191123c6e8a2e5e47efb8b15239a7acc5c
readux/__init__.py
readux/__init__.py
from django.conf import settings __version_info__ = (1, 2, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to a...
from django.conf import settings __version_info__ = (1, 2, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to a...
Drop configured annotator store uri
Drop configured annotator store uri
Python
apache-2.0
emory-libraries/readux,emory-libraries/readux,emory-libraries/readux
--- +++ @@ -22,6 +22,5 @@ 'github': 'GitHub', 'google-oauth2': 'Google', }, - 'ANNOTATOR_STORE_URI': settings.ANNOTATOR_STORE_URI }
45f33dcf98b7b20fbedf3e05ca5c575ce3cbcbb3
scripts/generate-invoice.py
scripts/generate-invoice.py
#!/usr/bin/env python3 import argparse import yaml import jinja2 import weasyprint parser = argparse.ArgumentParser() parser.add_argument('--data', help='path to data directory', required=True) parser.add_argument('--number', help='Invoice number', type=int, required=True) args = parser.parse_args() data_directory =...
#!/usr/bin/env python3 import argparse import yaml import jinja2 import weasyprint parser = argparse.ArgumentParser() parser.add_argument('--data', help='path to data directory', required=True) parser.add_argument('--number', help='Invoice number', type=int, required=True) args = parser.parse_args() data_directory =...
Move TODO items to GitHub issues
Move TODO items to GitHub issues
Python
mit
pwaring/125-accounts,pwaring/125-accounts
--- +++ @@ -21,10 +21,6 @@ invoice_data = yaml.safe_load(invoice_file.read()) invoice_file.close() -# TODO: Validation -# TODO: Sum of invoice items equals total -# TODO: Invoice number matches filename - client_file = open(data_directory + 'data/clients/' + invoice_data['client'] + '.yaml') client_data = yaml....
ad72c990051865d6c40cc0a0b3dbd1b514c5aa17
plumbium/analysis_file.py
plumbium/analysis_file.py
from checksum import file_sha1sum class AnalysisFile(object): def __init__(self, filename): self.filename = filename def checksum(self): return file_sha1sum(self.filename)
from utils import file_sha1sum class AnalysisFile(object): def __init__(self, filename): self.filename = filename def checksum(self): return file_sha1sum(self.filename)
Fix defunct import of checksum module
Fix defunct import of checksum module
Python
mit
jstutters/Plumbium
--- +++ @@ -1,4 +1,4 @@ -from checksum import file_sha1sum +from utils import file_sha1sum class AnalysisFile(object):
016c9e715350aa4a87a24cdb9d7e7ba0340589aa
login_token/models.py
login_token/models.py
import random import re from django.contrib.auth.models import User from django.db import models from instances.models import InstanceMixin NUMBER_OF_TOKEN_WORDS = 3 def generate_token(): def useful_word(w): # FIXME: should try to exclude offensive words if len(w) < 4: return False ...
import random import re from django.contrib.auth.models import User from django.db import models from instances.models import InstanceMixin NUMBER_OF_TOKEN_WORDS = 3 def generate_token(): def useful_word(w): # FIXME: should try to exclude offensive words if len(w) < 4: return False ...
Make generate_token the default token value
Make generate_token the default token value
Python
agpl-3.0
opencorato/sayit,opencorato/sayit,opencorato/sayit,opencorato/sayit
--- +++ @@ -34,4 +34,5 @@ user.''' user = models.ForeignKey(User) - token = models.TextField(max_length=255) + token = models.TextField(max_length=255, + default=generate_token)
68c048f625aa0158f0117a737d94000da193df40
astral/models/event.py
astral/models/event.py
import Queue from elixir import Field, Unicode, Entity from astral.models.base import BaseEntityMixin import logging log = logging.getLogger(__name__) EVENT_QUEUE = Queue.Queue() class Event(BaseEntityMixin, Entity): message = Field(Unicode(96)) def __init__(self, *args, **kwargs): super(Event, s...
import Queue from elixir import Field, Unicode, Entity from astral.models.base import BaseEntityMixin import logging log = logging.getLogger(__name__) EVENT_QUEUE = Queue.Queue() class Event(BaseEntityMixin, Entity): message = Field(Unicode(96)) def __init__(self, *args, **kwargs): kwargs['messag...
Convert JSON to unicode before saving to clear up a SQLAlchemy warning.
Convert JSON to unicode before saving to clear up a SQLAlchemy warning.
Python
mit
peplin/astral
--- +++ @@ -14,6 +14,7 @@ message = Field(Unicode(96)) def __init__(self, *args, **kwargs): + kwargs['message'] = unicode(kwargs['message']) super(Event, self).__init__(*args, **kwargs) EVENT_QUEUE.put(self)
117c5f19df731dd56901023e4ed29db5741617b2
tests/TestModel.py
tests/TestModel.py
#!/usr/bin/env python import unittest from PythonTemplate import Model class TestModel(unittest.TestCase): def setUp(self, use_auth=False): # TODO pass def test_do_thing(self): # do something Model.doThing() # evaluate something # TODO
#!/usr/bin/env python import unittest from PythonTemplate import Model class TestModel(unittest.TestCase): def setUp(self): # TODO pass def test_do_thing(self): # do something Model.doThing() # evaluate something # TODO
Remove hold over from copy n paste
Remove hold over from copy n paste
Python
apache-2.0
joshvillbrandt/PythonTemplate
--- +++ @@ -5,7 +5,7 @@ class TestModel(unittest.TestCase): - def setUp(self, use_auth=False): + def setUp(self): # TODO pass
f6c2f222db0f529d3f5906d5de7a7541e835ea77
litecord/api/guilds.py
litecord/api/guilds.py
''' guilds.py - All handlers under /guilds/* ''' import json import logging from ..utils import _err, _json, strip_user_data log = logging.getLogger(__name__) class GuildsEndpoint: def __init__(self, server): self.server = server async def h_post_guilds(self, request): pass
''' guilds.py - All handlers under /guilds/* ''' import json import logging from ..utils import _err, _json, strip_user_data log = logging.getLogger(__name__) class GuildsEndpoint: def __init__(self, server): self.server = server async def h_post_guilds(self, request): pass async def h_...
Add some dummy routes in GuildsEndpoint
Add some dummy routes in GuildsEndpoint
Python
mit
nullpixel/litecord,nullpixel/litecord
--- +++ @@ -14,3 +14,37 @@ async def h_post_guilds(self, request): pass + + async def h_guilds(self, request): + ''' + GuildsEndpoint.h_guilds + + Handle `GET /guilds/{guild_id}` + ''' + _error = await self.server.check_request(request) + _error_json = json...
e4e4db6c08612ba5b08224040d191eb83d27bf0d
scripts/prob_bedpe_to_bedgraph.py
scripts/prob_bedpe_to_bedgraph.py
#!/usr/bin/env python import sys import numpy as np from optparse import OptionParser parser = OptionParser() parser.add_option("-b", "--bedpe_file", dest="bedpe_file", help="BEDPE file") parser.add_option("-n", "--name", default="LUMPY BedGraph", dest="name", help="Name") (options, ar...
#!/usr/bin/env python import sys import numpy as np from optparse import OptionParser parser = OptionParser() parser.add_option("-b", "--bedpe_file", dest="bedpe_file", help="BEDPE file") parser.add_option("-n", "--name", default="LUMPY BedGraph", dest="name", help="Name") (options, ar...
Move fields for new output
Move fields for new output
Python
mit
arq5x/lumpy-sv,glebkuznetsov/lumpy-sv,hall-lab/lumpy-sv,cc2qe/lumpy-sv,hall-lab/lumpy-sv,glebkuznetsov/lumpy-sv,arq5x/lumpy-sv,glebkuznetsov/lumpy-sv,arq5x/lumpy-sv,cc2qe/lumpy-sv,hall-lab/lumpy-sv,cc2qe/lumpy-sv,glebkuznetsov/lumpy-sv,glebkuznetsov/lumpy-sv,hall-lab/lumpy-sv,arq5x/lumpy-sv,cc2qe/lumpy-sv,arq5x/lumpy-s...
--- +++ @@ -29,8 +29,8 @@ for l in f: A = l.rstrip().split('\t') - L=[float(x) for x in A[11].split()] - R=[float(x) for x in A[12].split()] + L=[float(x) for x in A[15][2:].split(',')] + R=[float(x) for x in A[16][2:].split(',')] l_chr = A[0] l_start = int(A[1])
8de10efd931e397af9c6b4c405a58af27940608a
lwr/lwr_client/util.py
lwr/lwr_client/util.py
from threading import Lock, Event class TransferEventManager(object): def __init__(self): self.events = dict() self.events_lock = Lock() def acquire_event(self, path, force_clear=False): with self.events_lock: if path in self.events: event_holder = self.ev...
from threading import Lock, Event from weakref import WeakValueDictionary class TransferEventManager(object): def __init__(self): self.events = WeakValueDictionary(dict()) self.events_lock = Lock() def acquire_event(self, path, force_clear=False): with self.events_lock: i...
Fix logic related to GC of Event references using weakref.WeakValueDictionary.
Fix logic related to GC of Event references using weakref.WeakValueDictionary.
Python
apache-2.0
galaxyproject/pulsar,galaxyproject/pulsar,jmchilton/pulsar,jmchilton/lwr,ssorgatem/pulsar,natefoo/pulsar,ssorgatem/pulsar,natefoo/pulsar,jmchilton/lwr,jmchilton/pulsar
--- +++ @@ -1,10 +1,11 @@ from threading import Lock, Event +from weakref import WeakValueDictionary class TransferEventManager(object): def __init__(self): - self.events = dict() + self.events = WeakValueDictionary(dict()) self.events_lock = Lock() def acquire_event(self, p...
90a8a55b4607e88e7e73f849250b4230185a18fd
integration-test/843-normalize-underscore.py
integration-test/843-normalize-underscore.py
# http://www.openstreetmap.org/way/219071307 assert_has_feature( 16, 10478, 25338, 'roads', { 'id': 219071307, 'kind': 'minor_road', 'service': 'drive_through' }) # http://www.openstreetmap.org/way/258020271 assert_has_feature( 16, 11077, 25458, 'roads', { 'id': 258020271, 'kind': 'aerialway', 'kind_de...
# http://www.openstreetmap.org/way/219071307 assert_has_feature( 16, 10478, 25338, 'roads', { 'id': 219071307, 'kind': 'minor_road', 'service': 'drive_through' }) # http://www.openstreetmap.org/way/258020271 assert_has_feature( 16, 11077, 25458, 'roads', { 'id': 258020271, 'kind': 'aerialway', 'kind_de...
Change test case item, as the previous one had been updated and fixed.
Change test case item, as the previous one had been updated and fixed.
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -13,7 +13,7 @@ 16, 18763, 24784, 'roads', { 'id': 256717307, 'kind': 'aerialway', 'kind_detail': 'j_bar' }) -# http://www.openstreetmap.org/way/258132198 +# http://www.openstreetmap.org/way/232074914 assert_has_feature( - 16, 10910, 25120, 'roads', - { 'id': 258132198, 'kind': 'aerialway...
e11d201c415eb86137194d93ac1fca7c20123ae9
runtests.py
runtests.py
#!/usr/bin/env python import sys from django.conf import settings if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, INSTALLED_APPS=( ...
#!/usr/bin/env python import sys from django.conf import settings if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, INSTALLED_APPS=( ...
Add explicit setup for Django 1.7
Add explicit setup for Django 1.7
Python
bsd-3-clause
caktus/django-dry-choices
--- +++ @@ -20,6 +20,14 @@ ) +# For Django 1.7. +try: + import django + django.setup() +except AttributeError: + pass + + from django.test.utils import get_runner
d1ee3578cd948c28e72bda3fbd06193be5033196
ractivate/utils/client.py
ractivate/utils/client.py
# # Copyright (c) 2010 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.rpath.com/permanent/...
# # Copyright (c) 2010 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.rpath.com/permanent/...
Make ActivationClient look for correct return code
Make ActivationClient look for correct return code
Python
apache-2.0
sassoftware/rpath-tools,sassoftware/rpath-tools
--- +++ @@ -12,25 +12,36 @@ # full details. # - +import logging import urllib import urllib2 import urlparse + +logger = logging.getLogger('activation') class Client(object): def __init__(self, url): self.url = url def request(self, data=None): - print data - return + ...
669b9c07ebca1d80778da950fc145c8cf0c6df65
skdata/__init__.py
skdata/__init__.py
try: # during the installation process this can raise an exception. from .data import SkData except: pass __author__ = 'Ivan Ogasawara' __email__ = 'ivan.ogasawara@gmail.com' __version__ = '0.1.2'
try: # during the installation process this can raise an exception. from .data import SkData except: pass __author__ = 'Ivan Ogasawara' __email__ = 'ivan.ogasawara@gmail.com' __version__ = '0.1.3'
Change pkg version to 0.1.3
Change pkg version to 0.1.3
Python
mit
xmnlab/skdata,OpenDataScienceLab/skdata
--- +++ @@ -6,5 +6,5 @@ __author__ = 'Ivan Ogasawara' __email__ = 'ivan.ogasawara@gmail.com' -__version__ = '0.1.2' +__version__ = '0.1.3'
3622a0354bc57d32c8b2e714c6b5f8533fa8f6d7
parsl/tests/configs/local_threads_globus.py
parsl/tests/configs/local_threads_globus.py
from parsl.config import Config from parsl.data_provider.scheme import GlobusScheme from parsl.executors.threads import ThreadPoolExecutor from parsl.tests.utils import get_rundir # If you are a developer running tests, make sure to update parsl/tests/configs/user_opts.py # If you are a user copying-and-pasting this a...
from parsl.config import Config from parsl.data_provider.scheme import GlobusScheme from parsl.executors.threads import ThreadPoolExecutor from parsl.tests.utils import get_rundir # If you are a developer running tests, make sure to update parsl/tests/configs/user_opts.py # If you are a user copying-and-pasting this a...
Fix storage_access in the test config
Fix storage_access in the test config
Python
apache-2.0
swift-lang/swift-e-lab,Parsl/parsl,Parsl/parsl,Parsl/parsl,swift-lang/swift-e-lab,Parsl/parsl
--- +++ @@ -17,7 +17,7 @@ storage_access=[GlobusScheme( endpoint_uuid=user_opts['globus']['endpoint'], endpoint_path=user_opts['globus']['path'] - )[, + )], working_dir=user_opts['globus']['path'] ) ],
1dc4546aa95d3adfff910430afe922bf137bf595
test/testlib/schema.py
test/testlib/schema.py
import testbase schema = None __all__ = 'Table', 'Column', table_options = {} def Table(*args, **kw): """A schema.Table wrapper/hook for dialect-specific tweaks.""" global schema if schema is None: from sqlalchemy import schema test_opts = dict([(k,kw.pop(k)) for k in kw.keys() ...
import testbase from testlib import testing schema = None __all__ = 'Table', 'Column', table_options = {} def Table(*args, **kw): """A schema.Table wrapper/hook for dialect-specific tweaks.""" global schema if schema is None: from sqlalchemy import schema test_opts = dict([(k,kw.pop(k)) for...
Apply default cascade rules for firebird self-ref ForeignKeys.
Apply default cascade rules for firebird self-ref ForeignKeys.
Python
mit
graingert/sqlalchemy,alex/sqlalchemy,WinterNis/sqlalchemy,elelianghh/sqlalchemy,bdupharm/sqlalchemy,sandan/sqlalchemy,monetate/sqlalchemy,olemis/sqlalchemy,wujuguang/sqlalchemy,ThiefMaster/sqlalchemy,brianv0/sqlalchemy,j5int/sqlalchemy,wfxiang08/sqlalchemy,wujuguang/sqlalchemy,sqlalchemy/sqlalchemy,ThiefMaster/sqlalche...
--- +++ @@ -1,4 +1,5 @@ import testbase +from testlib import testing schema = None __all__ = 'Table', 'Column', @@ -11,7 +12,7 @@ global schema if schema is None: from sqlalchemy import schema - + test_opts = dict([(k,kw.pop(k)) for k in kw.keys() if k.start...
c69da19e8316b1e1c6f55d3571917e85ba4fbf8d
src/member/admin.py
src/member/admin.py
from django.contrib import admin from member.models import (Member, Client, Contact, Address, Referencing, Route, Client_avoid_component, Client_avoid_ingredient, Option, Client_option, Restriction) admin.site.register(Member) admin.site....
from django.contrib import admin from member.models import (Member, Client, Contact, Address, Referencing, Route, Client_avoid_component, Client_avoid_ingredient, Option, Client_option, Restriction) from meal.models import Ingredient cl...
Add ingredients to avoid as a TabularInline to Client
Add ingredients to avoid as a TabularInline to Client Do not edit the ingredients to avoid directly, edit them through a tabular form from the client form
Python
agpl-3.0
savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,madmath/sous-chef
--- +++ @@ -4,14 +4,27 @@ Client_avoid_ingredient, Option, Client_option, Restriction) +from meal.models import Ingredient + + +class IngredientsToAvoidInline(admin.TabularInline): + model = Client.ingredients_to_avoid.through + + +class ClientAdmin(admin.M...
83c12d598221aac8e7173fb7d78083bc1c5ab64b
tests/test_commands.py
tests/test_commands.py
import unittest from cobe.commands import LearnIrcLogCommand class testIrcLogParsing(unittest.TestCase): def setUp(self): self.command = LearnIrcLogCommand() def testNonPubmsg(self): msg = "this is some non-pubmsg text found in a log" cmd = self.command self.assertEqual(None,...
import unittest from cobe.commands import LearnIrcLogCommand class testIrcLogParsing(unittest.TestCase): def setUp(self): self.command = LearnIrcLogCommand() def testNonPubmsg(self): msg = "this is some non-pubmsg text found in a log" cmd = self.command self.assertEqual(None,...
Add a unit test for ignored nicks in _parse_irc_message
Add a unit test for ignored nicks in _parse_irc_message
Python
mit
pteichman/cobe,wodim/cobe-ng,wodim/cobe-ng,DarkMio/cobe,tiagochiavericosta/cobe,meska/cobe,LeMagnesium/cobe,LeMagnesium/cobe,DarkMio/cobe,meska/cobe,tiagochiavericosta/cobe,pteichman/cobe
--- +++ @@ -24,5 +24,11 @@ self.assertEqual("bar baz", cmd._parse_irc_message(msg)) + def testIgnoredNickPubmsg(self): + msg = "12:00 <foo> bar baz" + cmd = self.command + + self.assertEqual(None, cmd._parse_irc_message(msg, ["foo"])) + if __name__ == '__main__': unittest.ma...
3760005cec3174b14d3f0ee20327e1b8de9ce800
ffflash/lib/container.py
ffflash/lib/container.py
from os import path from ffflash import RELEASE, log, now, timeout from ffflash.lib.clock import epoch_repr from ffflash.lib.data import merge_dicts from ffflash.lib.files import read_json_file, write_json_file class Container: def __init__(self, spec, filename): self._spec = spec self._location ...
from os import path from ffflash import RELEASE, log, now, timeout from ffflash.lib.clock import epoch_repr from ffflash.lib.data import Element from ffflash.lib.files import read_json_file, write_json_file class Container: def __init__(self, spec, filename): self._spec = spec self._location = pa...
Rewrite Container to dump/load two Elements (data,_info) into json file
Rewrite Container to dump/load two Elements (data,_info) into json file
Python
bsd-3-clause
spookey/ffflash,spookey/ffflash
--- +++ @@ -2,7 +2,7 @@ from ffflash import RELEASE, log, now, timeout from ffflash.lib.clock import epoch_repr -from ffflash.lib.data import merge_dicts +from ffflash.lib.data import Element from ffflash.lib.files import read_json_file, write_json_file @@ -10,28 +10,28 @@ def __init__(self, spec, filen...
a594c5154ca35590f2b793b89fc12e77d6b01537
accounts/management/commands/clean_expired.py
accounts/management/commands/clean_expired.py
# coding=utf-8 from django.core.management.base import BaseCommand from registration.models import RegistrationProfile class Command(BaseCommand): help = 'Cleanup expired registrations' OPT_SIMULATE = 'dry-run' def add_arguments(self, parser): parser.add_argument(''.join(['--', self.OPT_SIMULAT...
# coding=utf-8 from django.core.management.base import BaseCommand from registration.models import RegistrationProfile class Command(BaseCommand): help = 'Cleanup expired registrations' OPT_SIMULATE = 'dry-run' def add_arguments(self, parser): parser.add_argument(''.join(['--', self.OPT_SIMULAT...
Make cleanup command less verbose
Make cleanup command less verbose
Python
agpl-3.0
volunteer-planner/volunteer_planner,volunteer-planner/volunteer_planner,coders4help/volunteer_planner,pitpalme/volunteer_planner,klinger/volunteer_planner,volunteer-planner/volunteer_planner,christophmeissner/volunteer_planner,volunteer-planner/volunteer_planner,klinger/volunteer_planner,klinger/volunteer_planner,pitpa...
--- +++ @@ -17,7 +17,6 @@ help='Only print registrations that would be deleted') def handle(self, *args, **options): - self.stdout.write('Deleting expired user registrations') dry_run = True if self.OPT_SIMULATE in options and options[ self.OPT_SIMULATE...
1636757f52a553c99fb40059f4461e97485d2199
fits/make_fit_feedmes.py
fits/make_fit_feedmes.py
#!/usr/bin/env python from glob import glob import os import re def make_feedmes(): # Used to convert all the fit*.galfit files to fit*.diff ids = glob('*/') for id in ids: os.chdir(id) feedmes = glob('fit*diff') # output starting models for f in feedmes: templa...
#!/usr/bin/env python from glob import glob import os import re def make_feedmes(): # Used to convert all the fit*.galfit files to fit*.diff ids = glob('*/') for id in ids: feedmes = glob(id+'fit*diff') # output starting models for f in feedmes: template = r'.*fit(.*)(\...
Fix to work with new patch
Fix to work with new patch
Python
mit
MegaMorph/galfitm-illustrations,MegaMorph/galfitm-illustrations
--- +++ @@ -8,17 +8,15 @@ # Used to convert all the fit*.galfit files to fit*.diff ids = glob('*/') for id in ids: - os.chdir(id) - feedmes = glob('fit*diff') + feedmes = glob(id+'fit*diff') # output starting models for f in feedmes: - template = r'fit(...
07f409bb6b8d008cf473aeb33fd0833dccfba402
mm1_main.py
mm1_main.py
#!/usr/bin/env python # encoding: utf-8 import mm1 import sim ### Params # Mean interarrival rate of customers per second; # hence, 0.05 <=> 3 people/minute interarrival_rate = 0.05 # Mean service rate by the teller per second; # hence, 0.1 <=> 6 people/minute service_rate = 0.1 ### Initialize # Create new simula...
#!/usr/bin/env python # encoding: utf-8 import argparse import mm1 import sim import time ### Parse command line arguments parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Main script") parser.add_argument('sim_duration', metavar='simulation_duration', type=int, help='simul...
Add command line arguments to main script.
Add command line arguments to main script.
Python
mit
kubkon/des-in-python
--- +++ @@ -1,9 +1,21 @@ #!/usr/bin/env python # encoding: utf-8 +import argparse import mm1 import sim +import time + +### Parse command line arguments +parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Main script") +parser.add_argument('sim_duration', metavar='simulation_duration', + ...
471828d39ff256961bf48323feb43438901a4762
orges/plugins/base.py
orges/plugins/base.py
"""This module provides an abstract base class for invocation plugins""" from abc import abstractmethod, ABCMeta class BasePlugin(object): """ Abstract base class for invocation plugins. Plugin developers can either derive their objects directly from this class or from :class:`orges.plugins.dummy.D...
"""This module provides an abstract base class for invocation plugins""" from abc import abstractmethod, ABCMeta class BasePlugin(object): """ Abstract base class for invocation plugins. Plugin developers can either derive their objects directly from this class or from :class:`orges.plugins.dummy.D...
Fix broken reference in documentation
Fix broken reference in documentation
Python
bsd-3-clause
cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt
--- +++ @@ -9,7 +9,7 @@ Abstract base class for invocation plugins. Plugin developers can either derive their objects directly from this class - or from :class:`orges.plugins.dummy.DummyInvocationPlugin` to only override + or from :class:`orges.plugins.dummy.DummyPlugin` to only override method...
35409711d9976ed44e25e314486f3f703b18c068
packages/cardpay-subgraph-extraction/export.py
packages/cardpay-subgraph-extraction/export.py
from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", default='config', ) @click.option( "--database-string", default="postgresql://grap...
from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath import os @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", default="config", ) @click.option( "--database-string", default=os.envi...
Support environment variables for the extraction
Support environment variables for the extraction
Python
mit
cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack
--- +++ @@ -1,30 +1,32 @@ from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath +import os + @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", - default='config', + default="config",...
b60cfdb2b338a4f87b4ac6ba7dd03c9c1d751b37
scrapi/processing/base.py
scrapi/processing/base.py
class BaseProcessor(object): NAME = None def process_raw(self, raw_doc, **kwargs): pass # pragma: no cover def process_normalized(self, raw_doc, normalized, **kwargs): pass # pragma: no cover
import six import json from abc import abstractproperty, abstractmethod from requests.structures import CaseInsensitiveDict class BaseProcessor(object): NAME = None def process_raw(self, raw_doc, **kwargs): pass # pragma: no cover def process_normalized(self, raw_doc, normalized, **kwargs): ...
Add definition of abstract harvester model
Add definition of abstract harvester model
Python
apache-2.0
erinspace/scrapi,felliott/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,mehanig/scrapi
--- +++ @@ -1,3 +1,10 @@ +import six +import json +from abc import abstractproperty, abstractmethod + +from requests.structures import CaseInsensitiveDict + + class BaseProcessor(object): NAME = None @@ -6,3 +13,73 @@ def process_normalized(self, raw_doc, normalized, **kwargs): pass # pragma:...
a8997dad913fbc5a12def6a31931efab16efd285
{{cookiecutter.project_slug}}/search/views.py
{{cookiecutter.project_slug}}/search/views.py
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.shortcuts import render from wagtail.core.models import Page from wagtail.search.models import Query def search(request): search_query = request.GET.get('query', None) page = request.GET.get('page', 1) # Search if s...
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.shortcuts import render from wagtail.core.models import Page from wagtail.search.models import Query def search(request): search_query = request.GET.get('q', None) page = request.GET.get('page', 1) # Search if searc...
Make search parameter match template parameter name
Make search parameter match template parameter name
Python
mit
chrisdev/wagtail-cookiecutter-foundation,chrisdev/wagtail-cookiecutter-foundation,ilendl2/wagtail-cookiecutter-foundation,ilendl2/wagtail-cookiecutter-foundation,ilendl2/wagtail-cookiecutter-foundation,chrisdev/wagtail-cookiecutter-foundation
--- +++ @@ -6,7 +6,7 @@ def search(request): - search_query = request.GET.get('query', None) + search_query = request.GET.get('q', None) page = request.GET.get('page', 1) # Search
721e2ab81f78de5956c37b654a0cddf99679a20f
django/applications/catmaid/middleware.py
django/applications/catmaid/middleware.py
import json from django.http import HttpResponse from django.contrib.auth.models import User from django.conf import settings from traceback import format_exc class AnonymousAuthenticationMiddleware(object): """ This middleware class tests whether the current user is the anonymous user. If so, it replaces the...
import json from django.http import HttpResponse from django.contrib.auth.models import User from django.conf import settings from traceback import format_exc class AnonymousAuthenticationMiddleware(object): """ This middleware class tests whether the current user is the anonymous user. If so, it replaces the...
Make anonymous user distinguishable from Django's AnonymousUser
Make anonymous user distinguishable from Django's AnonymousUser Django uses a special object---the AnonymousUser---for requests that are not bound to a logged in user. Since we use guardian we replace this object with an actual user object (with the ID set in ANONYMOUS_USER_ID, usually -1) in a middleware class. So fa...
Python
agpl-3.0
htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID
--- +++ @@ -14,7 +14,7 @@ def process_request(self, request): if request.user.is_anonymous() and settings.ANONYMOUS_USER_ID: request.user = User.objects.get(id=settings.ANONYMOUS_USER_ID) - request.user.is_anonymous = lambda: True + request.user.is_anonymous = lambda: ...
61e6c21e32a481be9b2c61d71b0faef3fe731ae6
tests/rules_tests/RulesTest.py
tests/rules_tests/RulesTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 15.08.2017 15:31 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import * from .grammar import * class RulesTest(TestCase): def test_oneRules(self): class Tmp1(Rule): rules = [([NFirst], [NSecond, ...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 15.08.2017 15:31 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import * from .grammar import * class RulesTest(TestCase): def setUp(self): self.g = Grammar(terminals=[0, 1, 2, ...
Add test that check hash values of rule
Add test that check hash values of rule
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -13,13 +13,43 @@ class RulesTest(TestCase): - def test_oneRules(self): + def setUp(self): + self.g = Grammar(terminals=[0, 1, 2, + 'a', 'b', 'c', + TFirst, TSecond, TThird, + TInstFirs...
e87fc9172b9d56fe9d64cfda2fb36a3f71e69e70
tests/test_utils.py
tests/test_utils.py
# -*- coding: utf-8; -*- import re from jenkins_autojobs import main def test_filter_jobs(): class Job: def __init__(self, name): self.name = name class jenkins: pass names = ['feature-one', 'feature-two', 'release-one', 'release-two'] jenkins.jobs = [Job(i) for i in na...
# -*- coding: utf-8; -*- import re from jenkins_autojobs import main def test_filter_jobs(): class Job: def __init__(self, name): self.name = name class jenkins: @staticmethod def view_jobs(x): return { 'v1': [Job('scratch-one'), Job('scratch-...
Fix tests on Python 2
Fix tests on Python 2
Python
bsd-3-clause
gvalkov/jenkins-autojobs,gvalkov/jenkins-autojobs
--- +++ @@ -11,7 +11,12 @@ self.name = name class jenkins: - pass + @staticmethod + def view_jobs(x): + return { + 'v1': [Job('scratch-one'), Job('scratch-two')], + 'v2': [Job('release-one'), Job('maintenance-three')] + }[x] ...
1963012ba4628f1f66d495e777275243dc7248e4
.CI/trigger_conda-forge.github.io.py
.CI/trigger_conda-forge.github.io.py
""" Trigger the conda-forge.github.io Travis job to restart. """ import os import requests import six import conda_smithy.ci_register def rebuild_travis(repo_slug): headers = conda_smithy.ci_register.travis_headers() # If we don't specify the API version, we get a 404. # Also fix the accepted content...
""" Trigger the conda-forge.github.io Travis job to restart. """ import os import requests import six import conda_smithy.ci_register def rebuild_travis(repo_slug): headers = conda_smithy.ci_register.travis_headers() # If we don't specify the API version, we get a 404. # Also fix the accepted content...
Add message to webpage repo trigger
Add message to webpage repo trigger Should fix triggering builds on the webpage repo even when the most recent commit message skip the CI build. Also should make it easier to identify builds started by this trigger. [ci skip] [skip ci]
Python
bsd-3-clause
jakirkham/staged-recipes,Cashalow/staged-recipes,dschreij/staged-recipes,scopatz/staged-recipes,stuertz/staged-recipes,conda-forge/staged-recipes,guillochon/staged-recipes,hadim/staged-recipes,SylvainCorlay/staged-recipes,mcs07/staged-recipes,scopatz/staged-recipes,sodre/staged-recipes,pmlandwehr/staged-recipes,sannykr...
--- +++ @@ -24,7 +24,12 @@ url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug) response = requests.post( url, - json={"request": {"branch": "master"}}, + json={ + "request": { + "branch": "master", + "message": "Triggering b...
86e9e5a8da58b2902f5848353df9b05151bd08fa
turbustat/tests/test_cramer.py
turbustat/tests/test_cramer.py
# Licensed under an MIT open source license - see LICENSE ''' Test functions for Cramer ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import Cramer_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testCramer...
# Licensed under an MIT open source license - see LICENSE ''' Test functions for Cramer ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import Cramer_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testCramer...
Add test for Cramer with different spatial sizes
Add test for Cramer with different spatial sizes
Python
mit
Astroua/TurbuStat,e-koch/TurbuStat
--- +++ @@ -28,3 +28,13 @@ computed_data["cramer_val"]) npt.assert_almost_equal(self.tester.distance, computed_distances['cramer_distance']) + + def test_cramer_spatial_diff(self): + + small_data = dataset1["cube"][0][:, :26, :26] + + ...
05240d24f6184b015422e2e1996fb90d7f6d7654
twstock/cli/best_four_point.py
twstock/cli/best_four_point.py
import twstock def main(argv): print('四大買賣點判斷 Best Four Point') print('------------------------------') if len(argv) > 1: sids = argv[1:] for sid in sids: bfp = twstock.BestFourPoint(twstock.Stock(sid)) bfp = bfp.best_four_point() print('%s: ' % (sid), e...
import twstock def run(argv): print('四大買賣點判斷 Best Four Point') print('------------------------------') for sid in argv: bfp = twstock.BestFourPoint(twstock.Stock(sid)) bfp = bfp.best_four_point() print('%s: ' % (sid), end='') if bfp: if bfp[0]: p...
Fix best four point cli
Fix best four point cli
Python
mit
mlouielu/twstock,TCCinTaiwan/twstock
--- +++ @@ -1,19 +1,17 @@ import twstock -def main(argv): +def run(argv): print('四大買賣點判斷 Best Four Point') print('------------------------------') - if len(argv) > 1: - sids = argv[1:] - for sid in sids: - bfp = twstock.BestFourPoint(twstock.Stock(sid)) - bfp = bf...
ec2454626e22244c504bae528457fb8136c59feb
cooler/cli/__init__.py
cooler/cli/__init__.py
# -*- coding: utf-8 -*- from __future__ import division, print_function import click CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.group(context_settings=CONTEXT_SETTINGS) def cli(): pass from . import ( makebins, digest, csort, cload, load, balance, dump, ...
# -*- coding: utf-8 -*- from __future__ import division, print_function import click # Monkey patch click.core._verify_python3_env = lambda: None CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.group(context_settings=CONTEXT_SETTINGS) def cli(): pass from . import ( makebins, ...
Stop Click from aborting due to misconfigured locale
Stop Click from aborting due to misconfigured locale
Python
bsd-3-clause
mirnylab/cooler
--- +++ @@ -2,9 +2,14 @@ from __future__ import division, print_function import click +# Monkey patch +click.core._verify_python3_env = lambda: None + + CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } + @click.group(context_settings=CONTEXT_SETTINGS) def cli():
1594ab8d77e6522e0d85aa363ddc67d55d6ee81a
zc-list.py
zc-list.py
#!/usr/bin/env python import sys import argparse import client_wrap def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("-t", "--type", help="type of the cached data", default="double") parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-ca...
#!/usr/bin/env python import sys import argparse import client_wrap def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("-t", "--type", help="type of the cached data", default="double") parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-ca...
Implement the type specific values output
Implement the type specific values output
Python
agpl-3.0
ellysh/zero-cache-utils,ellysh/zero-cache-utils
--- +++ @@ -10,7 +10,8 @@ parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-cache/0") parser.add_argument("-w", "--column", help="number of columns", type=int, default=1) parser.add_argument("-l", "--log", help="log file name", default="") - args = pars...
cb2f6840d34807d2df72e8c7ed0a76576a50f392
src/brightness.py
src/brightness.py
import sys import os from workflow import Workflow def main(wf): user_input = wf.args[0] if user_input != '': try: if int(user_input) <= 100 and int(user_input) > 0: wf.add_item('%s%%' % user_input, arg='%s' % (int(user_input) / 100.0), valid=True) else: ...
import sys import os from workflow import Workflow def main(wf): user_input = wf.args[0] if user_input != '': try: if int(user_input) <= 100 and int(user_input) >= 0: wf.add_item('%s%%' % user_input, arg='%s' % (int(user_input) / 100.0), valid=True) else: ...
Allow user to input "0" as value
Allow user to input "0" as value
Python
mit
fniephaus/alfred-brightness
--- +++ @@ -7,7 +7,7 @@ user_input = wf.args[0] if user_input != '': try: - if int(user_input) <= 100 and int(user_input) > 0: + if int(user_input) <= 100 and int(user_input) >= 0: wf.add_item('%s%%' % user_input, arg='%s' % (int(user_input) / 100.0), valid=Tr...