commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
4b340e0712956ea44eace7382dd743890958a0fd
widgets/card.py
widgets/card.py
# -*- coding: utf-8 -*- from flask import render_template from models.person import Person def card(person_or_id, detailed=False, small=False): if isinstance(person_or_id, Person): person = person_or_id else: person = Person.query.filter_by(id=person_or_id).first() return render_templa...
# -*- coding: utf-8 -*- from flask import render_template from models.person import Person def card(person_or_id, **kwargs): if isinstance(person_or_id, Person): person = person_or_id else: person = Person.query.filter_by(id=person_or_id).first() return render_template('widgets/card.ht...
Revert "Fix a bug in caching"
Revert "Fix a bug in caching" This reverts commit 2565df456ecb290f620ce4dadca19c76b0eeb1af. Conflicts: widgets/card.py
Python
apache-2.0
teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr
fa75cdb0114d86b626a77ea19897abd532fd4aeb
src/hack4lt/forms.py
src/hack4lt/forms.py
from django import forms from django.contrib.auth import authenticate from django.utils.translation import ugettext_lazy as _ from hack4lt.models import Hacker class RegistrationForm(forms.ModelForm): class Meta: model = Hacker fields = ('username', 'first_name', 'last_name', 'email', 'reposito...
from django import forms from django.contrib.auth import authenticate from django.utils.translation import ugettext_lazy as _ from django.forms.util import ErrorList from hack4lt.models import Hacker class RegistrationForm(forms.ModelForm): password = forms.CharField(label=_('Password'), max_length=128, min_len...
Add password and password_repeat fields to registration form.
Add password and password_repeat fields to registration form.
Python
bsd-3-clause
niekas/Hack4LT
467e8e4d8113a8f6473d7f82d86d5401053362b8
scripts/gen-release-notes.py
scripts/gen-release-notes.py
""" Generates the release notes for the latest release, in Markdown. Convert CHANGELOG.rst to Markdown, and extracts just the latest release. Writes to ``scripts/latest-release-notes.md``, which can be used with https://github.com/softprops/action-gh-release. """ from pathlib import Path import pypandoc this_dir = ...
""" Generates the release notes for the latest release, in Markdown. Convert CHANGELOG.rst to Markdown, and extracts just the latest release. Writes to ``scripts/latest-release-notes.md``, which can be used with https://github.com/softprops/action-gh-release. """ from pathlib import Path import pypandoc this_dir = ...
Remove release title from the GitHub release notes body
Remove release title from the GitHub release notes body
Python
mit
pytest-dev/pytest-mock
ac33c7fcee74053dae6edfdd4596bfe03098711d
waptpkg.py
waptpkg.py
# -*- coding: utf-8 -*- import os import waptpackage from waptcrypto import SSLCABundle,SSLCertificate,SSLPrivateKey def download(remote, path, pkg): """Downloads package""" if not pkg.package: return False res = remote.download_packages(pkg, path) if res['errors']: return False ...
# -*- coding: utf-8 -*- import os import waptpackage from waptcrypto import SSLCABundle,SSLCertificate,SSLPrivateKey def download(remote, path, pkg): """Downloads package""" if not pkg.package: return False res = remote.download_packages(pkg, path) if res['errors']: return False ...
Include locale in package hash
Include locale in package hash
Python
mit
jf-guillou/wapt-scripts
13ba6bf5c12c46aa43c0060d40458fe453df9c33
ydf/yaml_ext.py
ydf/yaml_ext.py
""" ydf/yaml_ext ~~~~~~~~~~~~ Contains extensions to existing YAML functionality. """ import collections from ruamel import yaml from ruamel.yaml import resolver class OrderedLoader(yaml.Loader): """ Extends the default YAML loader to use :class:`~collections.OrderedDict` for mapping types....
""" ydf/yaml_ext ~~~~~~~~~~~~ Contains extensions to existing YAML functionality. """ import collections from ruamel import yaml from ruamel.yaml import resolver class OrderedRoundTripLoader(yaml.RoundTripLoader): """ Extends the default round trip YAML loader to use :class:`~collections.Ordere...
Switch to round trip loader to support multiple documents.
Switch to round trip loader to support multiple documents.
Python
apache-2.0
ahawker/ydf
9b586b953bfe3c94adb40d0a804de3d46fca1887
httpie/config.py
httpie/config.py
import os __author__ = 'jakub' CONFIG_DIR = os.path.expanduser('~/.httpie')
import os from requests.compat import is_windows __author__ = 'jakub' CONFIG_DIR = (os.path.expanduser('~/.httpie') if not is_windows else os.path.expandvars(r'%APPDATA%\\httpie'))
Use %APPDATA% for data on Windows.
Use %APPDATA% for data on Windows.
Python
bsd-3-clause
codingjoe/httpie,konopski/httpie,Bogon/httpie,fontenele/httpie,aredo/httpie,GrimDerp/httpie,vietlq/httpie,paran0ids0ul/httpie,gnagel/httpie,fontenele/httpie,lingtalfi/httpie,rschmidtz/httpie,alexeikabak/httpie,konopski/httpie,PKRoma/httpie,GrimDerp/httpie,PKRoma/httpie,bright-sparks/httpie,marklap/httpie,fritaly/httpie...
085edf28b2e70552789407e16ca83faf78313672
version.py
version.py
major = 0 minor=0 patch=0 branch="dev" timestamp=1376579871.17
major = 0 minor=0 patch=25 branch="master" timestamp=1376610207.69
Tag commit for v0.0.25-master generated by gitmake.py
Tag commit for v0.0.25-master generated by gitmake.py
Python
mit
ryansturmer/gitmake
09d85cf39fd8196b26b357ee3f0b9fbb67770014
flask_jq.py
flask_jq.py
from flask import Flask, jsonify, render_template, request app = Flask(__name__) @app.route('/_add_numbers') def add_numbers(): ''' Because numbers must be added server side ''' a = request.args.get('a', 0, type=int) b = request.args.get('b', 0, type=int) return jsonify(result=a + b) @app.route('/')...
from flask import Flask, jsonify, render_template, request app = Flask(__name__) @app.route('/_add_numbers') def add_numbers(): ''' Because numbers must be added server side ''' a = request.args.get('a', 0, type=int) b = request.args.get('b', 0, type=int) return jsonify(result=a + b) @app.route('/')...
Add app run on main
Add app run on main
Python
mit
avidas/flask-jquery,avidas/flask-jquery,avidas/flask-jquery
c5ba874987b2e788ae905a1a84e7f2575ff9f991
conman/redirects/models.py
conman/redirects/models.py
from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ from conman.routes.models import Route from . import views class RouteRedirect(Route): """ When `route` is browsed to, browser should be redirected to `target`. This mo...
from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ from conman.routes.models import Route from . import views class RouteRedirect(Route): """ When `route` is browsed to, browser should be redirected to `target`. This mo...
Remove explicit default from BooleanField
Remove explicit default from BooleanField
Python
bsd-2-clause
Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman
f5d56b0c54af414f02721a1a02a0eaf80dbba898
client/python/unrealcv/util.py
client/python/unrealcv/util.py
import numpy as np import PIL from io import BytesIO # StringIO module is removed in python3, use io module def read_png(res): import PIL.Image img = PIL.Image.open(BytesIO(res)) return np.asarray(img) def read_npy(res): # res is a binary buffer return np.load(BytesIO(res))
import numpy as np import PIL.Image from io import BytesIO # StringIO module is removed in python3, use io module def read_png(res): img = None try: PIL_img = PIL.Image.open(BytesIO(res)) img = np.asarray(PIL_img) except: print('Read png can not parse response %s' % str(res[:20])) ...
Handle exceptions in read_png and read_npy.
Handle exceptions in read_png and read_npy.
Python
mit
unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv
95f0ae5e04df6e5ce454b15551133caacfd44536
services/netflix.py
services/netflix.py
import foauth.providers class Netflix(foauth.providers.OAuth1): # General info about the provider provider_url = 'https://www.netflix.com/' docs_url = 'http://developer.netflix.com/docs' # URLs to interact with the API request_token_url = 'http://api.netflix.com/oauth/request_token' authorize...
import foauth.providers from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY class Netflix(foauth.providers.OAuth1): # General info about the provider provider_url = 'https://www.netflix.com/' docs_url = 'http://developer.netflix.com/docs' # URLs to interact with the API request_token_url = '...
Fix token retrieval for Netflix
Fix token retrieval for Netflix
Python
bsd-3-clause
foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org,foauth/foauth.org
3093941ebed1f9c726a88776819ee181cdb0b869
piper/db/core.py
piper/db/core.py
import logbook # Let's name this DatabaseBase. 'tis a silly name. class DatabaseBase(object): """ Abstract class representing a persistance layer """ def __init__(self): self.log = logbook.Logger(self.__class__.__name__) def init(self, ns, config): raise NotImplementedError() ...
import logbook class LazyDatabaseMixin(object): """ A mixin class that gives the subclass lazy access to the database layer The lazy attribute self.db is added, and the database class is gotten from self.config, and an instance is made and returned. """ _db = None @property def db(...
Add first iteration of LazyDatabaseMixin()
Add first iteration of LazyDatabaseMixin()
Python
mit
thiderman/piper
4de82c9a0737c079634a87d0ea358fba7840a419
sesame/test_settings.py
sesame/test_settings.py
from __future__ import unicode_literals AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", "sesame.backends.ModelBackend", ] CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}} DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}} INSTALLED_AP...
from __future__ import unicode_literals AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", "sesame.backends.ModelBackend", ] CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}} DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}} INSTALLED_AP...
Use a fast password hasher for tests.
Use a fast password hasher for tests. Speed is obviously more important than security in tests.
Python
bsd-3-clause
aaugustin/django-sesame,aaugustin/django-sesame
cdae77dee9888d6d6094566747650bf80d631f03
station.py
station.py
"""Creates the station class""" #import ask_user from ask_user #import int_check from int_check #import reasonable_check from reasonable_check class Station: """ Each train station is an instance of the Station class. Methods: __init__: creates a new stations total_station_pop: calculates total...
"""Creates the station class""" #import request_integer_in_range from request_integer_in_range class Station: """ Each train station is an instance of the Station class. Methods: __init__: creates a new stations request_integer_in_range : requests an integer in a range """ def __...
Integrate integer test function into instantiation
Integrate integer test function into instantiation Ref #23
Python
mit
ForestPride/rail-problem
fff0b4af89e02ff834221ef056b7dcb979dc6cd7
webpay/webpay.py
webpay/webpay.py
from .api import Account, Charges, Customers import requests class WebPay: def __init__(self, key, api_base = 'https://api.webpay.jp/v1'): self.key = key self.api_base = api_base self.account = Account(self) self.charges = Charges(self) self.customers = Customers(self) ...
from .api import Account, Charges, Customers import requests import json class WebPay: def __init__(self, key, api_base = 'https://api.webpay.jp/v1'): self.key = key self.api_base = api_base self.account = Account(self) self.charges = Charges(self) self.customers = Customers...
Use JSON for other than GET request
Use JSON for other than GET request Because internal dict parameters is not handled as expected. >>> payload = {'key1': 'value1', 'key2': 'value2', 'set': {'a': 'x', 'b': 'y'}} >>> r = requests.post("http://httpbin.org/post", data=payload) >>> r.json() {... 'form': {'key2': 'value2', 'key1': '...
Python
mit
yamaneko1212/webpay-python
b67617abe1e8530523da7231a9d74283935a1bb7
htext/ja/utils.py
htext/ja/utils.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import six BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]') WHITESPACE_RE = re.compile("[\s]+", re.UNICODE) def force_text(value): if isinstance(value, six.text_type): return value elif isinstance(value, six.string_types): ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import six BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]') WHITESPACE_RE = re.compile("[\s]+", re.UNICODE) def force_text(value): if isinstance(value, six.text_type): return value elif isinstance(value, six.string_types): ...
Fix UnicodeDecodeError on the environments where the default encoding is ascii
Fix UnicodeDecodeError on the environments where the default encoding is ascii
Python
mit
hunza/htext
68aefd4c1bc682dc04721f5572ab21b609e1818f
manage.py
manage.py
import os from app import create_app, db from app.models import User, Category from flask_script import Manager from flask_migrate import Migrate, MigrateCommand app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) #pyli...
import os from app import create_app, db from app.models import User, Category from flask_script import Manager from flask_migrate import Migrate, MigrateCommand app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) #pyli...
Add name_en field due to 'not null' constraint on the Category table
Add name_en field due to 'not null' constraint on the Category table
Python
mit
finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is
c563c0deb99d3364df3650321c914164d99d32cf
been/source/markdowndirectory.py
been/source/markdowndirectory.py
from been.core import DirectorySource, source_registry from hashlib import sha1 import re import unicodedata import time import markdown def slugify(value): value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore') value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) return ...
from been.core import DirectorySource, source_registry from hashlib import sha1 import re import unicodedata import time import markdown # slugify from Django source (BSD license) def slugify(value): value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore') value = unicode(re.sub('[^\w\s-...
Add attribution to slugify function.
Add attribution to slugify function.
Python
bsd-3-clause
chromakode/been
8f41ff94ecfceedf14cea03e7f2ca08df380edb0
weight/models.py
weight/models.py
# -*- coding: utf-8 -*- # This file is part of Workout Manager. # # Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ver...
# -*- coding: utf-8 -*- # This file is part of Workout Manager. # # Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ver...
Make the verbose name for weight entries more user friendly
Make the verbose name for weight entries more user friendly
Python
agpl-3.0
rolandgeider/wger,petervanderdoes/wger,DeveloperMal/wger,petervanderdoes/wger,kjagoo/wger_stark,rolandgeider/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger,kjagoo/wger_stark,DeveloperMal/wger,kjagoo/wger_stark,wger-project/wger,wger-project/wger,rolandgeider/wger,DeveloperMal/wger,DeveloperMal/wger,kjago...
1b0a5388c246dba1707f768e9be08b3a63503a31
samples/python/topology/tweepy/app.py
samples/python/topology/tweepy/app.py
from streamsx.topology.topology import * import streamsx.topology.context import sys import tweets # # Continually stream tweets that contain # the terms passed on the command line. # # python3 app.py Food GlutenFree # def main(): terms = sys.argv[1:] topo = Topology("TweetsUsingTweepy") # Event based source st...
from streamsx.topology.topology import * import streamsx.topology.context import sys import tweets # # Continually stream tweets that contain # the terms passed on the command line. # # python3 app.py Food GlutenFree # # # Requires tweepy to be installed # # pip3 install tweepy # # http://www.tweepy.org/ # # You must ...
Add some info about tweepy
Add some info about tweepy
Python
apache-2.0
IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,wmarshall484/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,IBMStreams/streamsx.topology,IBMStreams/streamsx.topology,ibmkendrick/streamsx.topology,ddebrunner/streamsx.topology,ibmkendrick/streamsx.to...
14f2161efbd9c8377e6ff3675c48aba1ac0c47d5
API/chat/forms.py
API/chat/forms.py
import time from django import forms from .models import Message from .utils import timestamp_to_datetime, datetime_to_timestamp class MessageForm(forms.Form): text = forms.CharField(widget=forms.Textarea) typing = forms.BooleanField(required=False) class MessageCreationForm(MessageForm): username = f...
import time from django import forms from .models import Message from .utils import timestamp_to_datetime, datetime_to_timestamp class MessageForm(forms.Form): text = forms.CharField(widget=forms.Textarea) typing = forms.BooleanField(required=False) message_type = forms.CharField(widget=forms.Textarea) ...
Add message_type as CharField in form
Add message_type as CharField in form
Python
mit
gtklocker/ting,gtklocker/ting,mbalamat/ting,mbalamat/ting,mbalamat/ting,gtklocker/ting,dionyziz/ting,gtklocker/ting,dionyziz/ting,dionyziz/ting,dionyziz/ting,mbalamat/ting
5733c800c10a7546228ec4562e40b2bd06c77c7e
models.py
models.py
from django.db import models # Create your models here.
from django.db import models from django.utils import timezone import datetime class Poll(models.Model): question = models.CharField(max_length=255) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def was_published_recently(self): return self.pub_date >= timezone....
Improve database model and apperance for admin site
Improve database model and apperance for admin site
Python
mit
egel/polls
c0633bc60dda6b81e623795f2c65a1eb0ba5933d
blinkytape/blinkyplayer.py
blinkytape/blinkyplayer.py
import time class BlinkyPlayer(object): FOREVER = -1 def __init__(self, blinkytape): self._blinkytape = blinkytape def play(self, animation, num_cycles = FOREVER): finished = self._make_finished_predicate(animation, num_cycles) animation.begin() while not finished(): ...
import time class BlinkyPlayer(object): FOREVER = -1 def __init__(self, blinkytape): self._blinkytape = blinkytape def play(self, animation, num_cycles = FOREVER): finished = self._finished_predicate(animation, num_cycles) animation.begin() while not finished(): ...
Clean up BlinkyPlayer a little
Clean up BlinkyPlayer a little
Python
mit
jonspeicher/blinkyfun
027e78f3e88a17e05881259d1f29d472b02d0d3a
doc/source/scripts/titles.py
doc/source/scripts/titles.py
import shutil import os import re work = os.getcwd() found = [] regex = re.compile(r'pydarkstar\.(.*)\.rst') for root, dirs, files in os.walk(work): for f in files: m = regex.match(f) if m: found.append((root, f)) for root, f in found: path = os.path.join(root, f) with open(pat...
import shutil import os import re work = os.getcwd() found = [] regex = re.compile(r'pydarkstar\.(.*)\.rst') for root, dirs, files in os.walk(work): for f in files: m = regex.match(f) if m: found.append((root, f)) for root, f in found: path = os.path.join(root, f) with open(pat...
Change to 3 spaces in front of toctree elements
Change to 3 spaces in front of toctree elements
Python
mit
AdamGagorik/pydarkstar
72f28cfa2723faaa7f7ed2b165fd99b214bc67c9
MeetingMinutes.py
MeetingMinutes.py
import sublime, sublime_plugin import os import re from .mistune import markdown class CreateMinuteCommand(sublime_plugin.TextCommand): def run(self, edit): region = sublime.Region(0, self.view.size()) md_source = self.view.substr(region) md_source.encode(encoding='UTF-8',errors='strict') html_source = '<!D...
import sublime, sublime_plugin import os import re from .mistune import markdown HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>' HTML_END = '</body></html>' class CreateMinuteCommand(sublime_plugin.TextCommand): def run(self, edit): region = sublime.Region(0, self.view.size()) md_s...
Create variables for HTML start and end.
Create variables for HTML start and end.
Python
mit
Txarli/sublimetext-meeting-minutes,Txarli/sublimetext-meeting-minutes
5ede88c91f61b4aeb3a1e9b55e6b7836cf805255
django_filepicker/utils.py
django_filepicker/utils.py
import re import urllib from os.path import basename from django.core.files import File class FilepickerFile(object): filepicker_url_regex = re.compile( r'https?:\/\/www.filepicker.io\/api\/file\/.*') def __init__(self, url): if not self.filepicker_url_regex.match(url): raise...
import re import urllib import os from django.core.files import File class FilepickerFile(object): filepicker_url_regex = re.compile( r'https?:\/\/www.filepicker.io\/api\/file\/.*') def __init__(self, url): if not self.filepicker_url_regex.match(url): raise ValueError('Not a ...
Add context manager and destructor for cleanup
Add context manager and destructor for cleanup When exiting the context or calling cleanup() explicitly, the temporary file created after downloading is removed and any open files closed.
Python
mit
FundedByMe/filepicker-django,FundedByMe/filepicker-django,filepicker/filepicker-django,filepicker/filepicker-django
13d0b4b50b2eaaf5c557576b7b45a378d901c49c
src/zeit/cms/testcontenttype/interfaces.py
src/zeit/cms/testcontenttype/interfaces.py
# Copyright (c) 2007-2011 gocept gmbh & co. kg # See also LICENSE.txt # $Id$ """Interface definitions for the test content type.""" import zope.interface class ITestContentType(zope.interface.Interface): """A type for testing.""" ITestContentType.setTaggedValue('zeit.cms.type', 'testcontenttype')
# Copyright (c) 2007-2011 gocept gmbh & co. kg # See also LICENSE.txt # $Id$ """Interface definitions for the test content type.""" import zope.interface class ITestContentType(zope.interface.Interface): """A type for testing."""
Remove superfluous type annotation, it's done by the TypeGrokker now
Remove superfluous type annotation, it's done by the TypeGrokker now
Python
bsd-3-clause
ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms
8f993412a0110085fee10331daecfb3d36973518
__init__.py
__init__.py
### # Copyright (c) 2012, spline # All rights reserved. # # ### """ Add a description of the plugin (to be presented to the user inside the wizard) here. This should describe *what* the plugin does. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CV...
### # Copyright (c) 2012, spline # All rights reserved. # # ### """ Add a description of the plugin (to be presented to the user inside the wizard) here. This should describe *what* the plugin does. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CV...
Add reload to init for config
Add reload to init for config
Python
mit
reticulatingspline/Scores,cottongin/Scores
f447e8fa50770d133d53e69477292b3925203c64
modular_blocks/models.py
modular_blocks/models.py
from django.db import models from .fields import ListTextField class TwoModularColumnsMixin(models.Model): sidebar_left = ListTextField() sidebar_right = ListTextField() class Meta: abstract = True
from django.db import models from .fields import ListTextField class TwoModularColumnsMixin(models.Model): sidebar_left = ListTextField( blank=True, null=True, ) sidebar_right = ListTextField( lank=True, null=True, ) class Meta: abstract = True
Add null and blank to sidebars
Add null and blank to sidebars
Python
agpl-3.0
rezometz/django-modular-blocks,rezometz/django-modular-blocks,rezometz/django-modular-blocks
b63b22678a005baa6195854b65cc1828061febba
vx/mode.py
vx/mode.py
import vx import os.path def mode_from_filename(file): root, ext = os.path.splitext(file) ext = ext if ext else root mode = None if ext == '.c': return c_mode class mode: def __init__(self, window): self.breaks = ('_', ' ', '\n', '\t') self.keywords = () class python_mod...
import vx import os.path def mode_from_filename(file): root, ext = os.path.splitext(file) ext = ext if ext else root mode = None if ext == '.c': return c_mode elif ext == '.py': return python_mode class mode: def __init__(self, window): self.breaks = ('_', ' ', '\n', ...
Add .py extension handling and more python keywords
Add .py extension handling and more python keywords
Python
mit
philipdexter/vx,philipdexter/vx
f62980f99654b22930cac6716410b145b590221f
Lib/lib-tk/FixTk.py
Lib/lib-tk/FixTk.py
import sys, os v = os.path.join(sys.prefix, "tcl", "tcl8.3") if os.path.exists(os.path.join(v, "init.tcl")): os.environ["TCL_LIBRARY"] = v
import sys, os, _tkinter ver = str(_tkinter.TCL_VERSION) v = os.path.join(sys.prefix, "tcl", "tcl"+ver) if os.path.exists(os.path.join(v, "init.tcl")): os.environ["TCL_LIBRARY"] = v
Work the Tcl version number in the path we search for.
Work the Tcl version number in the path we search for.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
1c43affbd82f68ed8956cd407c494ff46dab9203
examples/IPLoM_example.py
examples/IPLoM_example.py
from pygraphc.misc.IPLoM import * from pygraphc.evaluation.ExternalEvaluation import * # set input path ip_address = '161.166.232.17' standard_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1/' + ip_address standard_file = standard_path + 'auth.log.anon.labeled' analyzed_file = 'auth.log.anon' pre...
from pygraphc.misc.IPLoM import * from pygraphc.evaluation.ExternalEvaluation import * # set input path dataset_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1_perday/' groundtruth_file = dataset_path + 'Dec 1.log.labeled' analyzed_file = 'Dec 1.log' OutputPath = '/home/hudan/Git/pygraphc/result/...
Edit path and external evaluation
Edit path and external evaluation
Python
mit
studiawan/pygraphc
6e1126fe9a8269ff4489ee338000afc852bce922
oidc_apis/id_token.py
oidc_apis/id_token.py
import inspect from .scopes import get_userinfo_by_scopes def process_id_token(payload, user, scope=None): if scope is None: # HACK: Steal the scope argument from the locals dictionary of # the caller, since it was not passed to us scope = inspect.stack()[1][0].f_locals.get('scope', []) ...
import inspect from .scopes import get_userinfo_by_scopes def process_id_token(payload, user, scope=None): if scope is None: # HACK: Steal the scope argument from the locals dictionary of # the caller, since it was not passed to us scope = inspect.stack()[1][0].f_locals.get('scope', []) ...
Add username to ID Token
Add username to ID Token
Python
mit
mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo
b47e3677120b9b2d64d38b48b0382dc7986a1b82
opps/core/__init__.py
opps/core/__init__.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from django.conf import settings trans_app_label = _('Opps') settings.INSTALLED_APPS += ('opps.article', 'opps.image', 'opps.channel', 'opps.source', 'redactor', 'tagging',) settings.REDACTOR_OPTI...
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ trans_app_label = _('Opps')
Remove installed app on init opps core
Remove installed app on init opps core
Python
mit
YACOWS/opps,williamroot/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,opps/opps,YACOWS/opps
52d15d09ed079d1b8598f314524066b56273af3d
addie/_version.py
addie/_version.py
# This file was generated by 'versioneer.py' (0.15) from # revision-control system data, or from the parent directory name of an # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. import json import sys version_json = ''' { "dirty": false, "error": null, "full-revisionid...
# This file was generated by 'versioneer.py' (0.15) from # revision-control system data, or from the parent directory name of an # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. import json version_json = ''' { "dirty": false, "error": null, "full-revisionid": "aaeac97...
Remove sys import in versioneer file
Remove sys import in versioneer file
Python
mit
neutrons/FastGR,neutrons/FastGR,neutrons/FastGR
25a97de30fcc9cddd7f58cd25584fd726f0cc8e4
guild/commands/packages_list.py
guild/commands/packages_list.py
# Copyright 2017-2020 TensorHub, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# Copyright 2017-2020 TensorHub, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Clarify meaning of --all option for packages command
Clarify meaning of --all option for packages command
Python
apache-2.0
guildai/guild,guildai/guild,guildai/guild,guildai/guild
ccdeb23eb54191913a97b48907e0738f6969ce58
tests/factories/config.py
tests/factories/config.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from factory import SubFactory from pycroft.model.config import Config from .base impor...
# -*- coding: utf-8 -*- # Copyright (c) 2018 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from factory import SubFactory from pycroft.model.config import Config from .base impor...
Add correct properties for payment_in_default test group
Add correct properties for payment_in_default test group
Python
apache-2.0
agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft
fb9c56381d259de7d1765ca0e058f82d61e4e975
examples/ellipses_FreeCAD.py
examples/ellipses_FreeCAD.py
from __future__ import division import numpy as np import FreeCAD as FC import Part import Draft import os doc = FC.newDocument("ellipses") folder = os.path.dirname(__file__) + ".\.." fname = folder + "/vor_ellipses.txt" data = np.loadtxt(fname) shapes = [] area = 0 for ellipse in data: cx, cy, b, a, ang = ellips...
from __future__ import division import numpy as np import FreeCAD as FC import Part import Draft import os doc = FC.newDocument("ellipses") folder = os.path.dirname(__file__) #+ "/.." fname = folder + "/vor_ellipses.txt" data = np.loadtxt(fname) shapes = [] area = 0 radii = [] for ellipse in data: cx, cy, b, a, a...
Add radii mean and standard deviation
Add radii mean and standard deviation
Python
mit
nicoguaro/ellipse_packing
08de3f0bf326e8625462d9dbdb7297d8749bc416
examples/joystick_example.py
examples/joystick_example.py
#!/usr/bin/env python3 """This example shows how to use the Joystick Click wrapper of the LetMeCreate. It continuously reads the position of the joystick, prints it in the terminal and displays a pattern on the LED's based on the x coordinate. The Joystick Click must be inserted in Mikrobus 1 before running this prog...
#!/usr/bin/env python3 """This example shows how to use the Joystick Click wrapper of the LetMeCreate. It continuously reads the position of the joystick, prints it in the terminal and displays a pattern on the LED's based on the x coordinate. The Joystick Click must be inserted in Mikrobus 1 before running this prog...
Replace tabs by space in example
joystick: Replace tabs by space in example Signed-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr>
Python
bsd-3-clause
francois-berder/PyLetMeCreate
98a4cd76ce9ecb81675ebaa29b249a8d80347e0d
zc-list.py
zc-list.py
#!/usr/bin/env python import client_wrap KEY_LONG = "key1" DATA_LONG = 1024 KEY_DOUBLE = "key2" DATA_DOUBLE = 100.53 KEY_STRING = "key3" DATA_STRING = "test data" def init_data(client): client.WriteLong(KEY_LONG, DATA_LONG) client.WriteDouble(KEY_DOUBLE, DATA_DOUBLE) client.WriteString(KEY_STRING, DATA...
#!/usr/bin/env python import client_wrap def main(): client = client_wrap.ClientWrap("get_test.log", "ipc:///var/run/zero-cache/0", 0) key_str = client.GetKeys() keys = key_str.split (';') del keys[-1] if len(keys) == 0: return print keys if __name__ == "__main__": main()
Implement displaying of the current key list
Implement displaying of the current key list
Python
agpl-3.0
ellysh/zero-cache-utils,ellysh/zero-cache-utils
2049be18b864fe2dab61ca6258b2295b3270d5c2
setup.py
setup.py
import distutils.core # Uploading to PyPI # ================= # $ python setup.py register -r pypi # $ python setup.py sdist upload -r pypi version = '0.0' distutils.core.setup( name='kxg', version=version, author='Kale Kundert and Alex Mitchell', url='https://github.com/kxgames/GameEn...
import distutils.core # Uploading to PyPI # ================= # $ python setup.py register -r pypi # $ python setup.py sdist upload -r pypi version = '0.0' distutils.core.setup( name='kxg', version=version, author='Kale Kundert and Alex Mitchell', url='https://github.com/kxgames/GameEn...
Add pytest as a dependency
Add pytest as a dependency
Python
mit
kxgames/kxg
a61386cbbcbe3e68bcdf0a98c23547117a496fec
zerver/views/webhooks/github_dispatcher.py
zerver/views/webhooks/github_dispatcher.py
from __future__ import absolute_import from django.http import HttpRequest, HttpResponse from .github_webhook import api_github_webhook from .github import api_github_landing def api_github_webhook_dispatch(request): # type: (HttpRequest) -> HttpResponse if request.META.get('HTTP_X_GITHUB_EVENT'): ret...
from __future__ import absolute_import from django.http import HttpRequest, HttpResponse from django.views.decorators.csrf import csrf_exempt from .github_webhook import api_github_webhook from .github import api_github_landing # Since this dispatcher is an API-style endpoint, it needs to be # explicitly marked as CSR...
Fix GitHub integration CSRF issue.
github: Fix GitHub integration CSRF issue. The new GitHub dispatcher integration was apparently totally broken, because we hadn't tagged the new dispatcher endpoint as exempt from CSRF checking. I'm not sure why the test suite didn't catch this.
Python
apache-2.0
AZtheAsian/zulip,dhcrzf/zulip,JPJPJPOPOP/zulip,christi3k/zulip,hackerkid/zulip,verma-varsha/zulip,j831/zulip,Diptanshu8/zulip,dhcrzf/zulip,ryanbackman/zulip,shubhamdhama/zulip,Galexrt/zulip,hackerkid/zulip,andersk/zulip,amyliu345/zulip,j831/zulip,mahim97/zulip,brainwane/zulip,SmartPeople/zulip,ryanbackman/zulip,Galexrt...
a7c49480e1eb530aa4df494709ec1f7edd875e1a
devito/ir/clusters/analysis.py
devito/ir/clusters/analysis.py
from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTOR, TILABLE, WRAPPABLE) __all__ = ['analyze'] def analyze(clusters): return clusters
from collections import OrderedDict from devito.ir.clusters.queue import Queue from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTOR, TILABLE, WRAPPABLE) from devito.tools import timed_pass __all__ = ['analyze'] class State(object): def __init__(self): ...
Add machinery to detect Cluster properties
ir: Add machinery to detect Cluster properties
Python
mit
opesci/devito,opesci/devito
b362e6060abe631f25e5227664df4e1670f4d630
registration/admin.py
registration/admin.py
from django.contrib import admin from registration.models import RegistrationProfile class RegistrationAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'activation_key_expired') search_fields = ('user__username', 'user__first_name') admin.site.register(RegistrationProfile, RegistrationAdmin)
from django.contrib import admin from registration.models import RegistrationProfile class RegistrationAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'activation_key_expired') raw_id_fields = ['user'] search_fields = ('user__username', 'user__first_name') admin.site.register(RegistrationProfil...
Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users.
Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users.
Python
bsd-3-clause
arpitremarkable/django-registration,sergafts/django-registration,wy123123/django-registration,wda-hb/test,furious-luke/django-registration,imgmix/django-registration,matejkloska/django-registration,PetrDlouhy/django-registration,pando85/django-registration,yorkedork/django-registration,pando85/django-registration,perci...
d60b0ee8c212728721f47cc57303ae24888cc387
models.py
models.py
import datetime import math from flask import Markup from peewee import Model, TextField, DateTimeField from app import db class Quote(Model): content = TextField() timestamp = DateTimeField(default=datetime.datetime.now) class Meta: database = db def html(self): return Markup(self...
import datetime import math from flask import Markup from peewee import Model, TextField, DateTimeField from app import db class Quote(Model): content = TextField() timestamp = DateTimeField(default=datetime.datetime.now) class Meta: database = db def html(self): return Markup(self...
Add support for carriage returns
Add support for carriage returns
Python
apache-2.0
agateau/tmc2,agateau/tmc2
37333506e6866e7d0859c5068f115a3e1b9dec3a
test/test_coordinate.py
test/test_coordinate.py
import unittest from src import coordinate class TestRules(unittest.TestCase): """ Tests for the coordinate module """ def test_get_x_board(self): board_location = coordinate.Coordinate(4, 6) expected_result = 4 actual_result = board_location.get_x_board() self.assertEqual(actu...
import unittest from src import coordinate class TestRules(unittest.TestCase): """ Tests for the coordinate module """ def test_get_x_board(self): board_location = coordinate.Coordinate(4, 6) expected_result = 4 actual_result = board_location.get_x_board() self.assertEqual(actu...
Add unit tests for fail fast logic in convertCharToInt()
Add unit tests for fail fast logic in convertCharToInt()
Python
mit
blairck/jaeger
4622c1d2623468503b5d51683f953b82ca611b35
vumi/demos/tests/test_static_reply.py
vumi/demos/tests/test_static_reply.py
from twisted.internet.defer import inlineCallbacks from vumi.application.tests.utils import ApplicationTestCase from vumi.demos.static_reply import StaticReplyApplication class TestStaticReplyApplication(ApplicationTestCase): application_class = StaticReplyApplication @inlineCallbacks def test_receive_m...
from twisted.internet.defer import inlineCallbacks from vumi.application.tests.helpers import ApplicationHelper from vumi.demos.static_reply import StaticReplyApplication from vumi.tests.helpers import VumiTestCase class TestStaticReplyApplication(VumiTestCase): def setUp(self): self.app_helper = Applica...
Switch static_reply tests to new helpers.
Switch static_reply tests to new helpers.
Python
bsd-3-clause
vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,harrissoerja/vumi
bb04512cdf264a3ef87f3d0093db9fe10723a668
core/wsgi.py
core/wsgi.py
""" WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS...
""" WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os, sys, site site.addsitedir('/usr/local/share/virtualenvs/guhema/lib/python3.4/site-package...
Add pathts for apache deployment
Add pathts for apache deployment
Python
mit
n2o/guhema,n2o/guhema
1c1f2cab677ead5f3cf3aa59c5094a741378e5bc
dame/dame.py
dame/dame.py
__author__ = "Richard Lindsley" import sys import sip sip.setapi('QDate', 2) sip.setapi('QDateTime', 2) sip.setapi('QString', 2) sip.setapi('QTextStream', 2) sip.setapi('QTime', 2) sip.setapi('QUrl', 2) sip.setapi('QVariant', 2) from PyQt4 import Qt def main(): qt_app = Qt.QApplication(sys.argv) label = Qt.Q...
__author__ = "Richard Lindsley" import sys #import sip #sip.setapi('QDate', 2) #sip.setapi('QDateTime', 2) #sip.setapi('QString', 2) #sip.setapi('QTextStream', 2) #sip.setapi('QTime', 2) #sip.setapi('QUrl', 2) #sip.setapi('QVariant', 2) #from PyQt4 import Qt from PySide.QtCore import * from PySide.QtGui import * d...
Use pyside instead of pyqt4
Use pyside instead of pyqt4
Python
mit
richli/dame
06542afc4becb4cf3cf96dd15ab240ab4353bf2b
ca/views.py
ca/views.py
from flask import request, render_template from ca import app, db from ca.forms import RequestForm from ca.models import Request @app.route('/', methods=['GET']) def index(): return render_template('index.html') @app.route('/', methods=['POST']) def post_request(): form = RequestForm(request.form) if f...
from flask import request, render_template from ca import app, db from ca.forms import RequestForm from ca.models import Request @app.route('/', methods=['GET']) def index(): form = RequestForm() return render_template('index.html', form=form) @app.route('/', methods=['POST']) def post_request(): form ...
Create form on index view
Create form on index view - Need to always pass a form to the view - make sure to create on for the `GET` view - Fixes #33
Python
mit
freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net
a621a7803d177e4851d229973586d9b114b0f84c
__init__.py
__init__.py
# -*- coding: utf-8 -*- from flask import Flask from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface import configparser app = Flask(__name__) # Security WTF_CSRF_ENABLED = True app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR' # App Config config = configparser.ConfigParser() config.read('config/conf...
# -*- coding: utf-8 -*- from flask import Flask, render_template from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface import configparser app = Flask(__name__) # Security WTF_CSRF_ENABLED = True app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR' # App Config config = configparser.ConfigParser() config....
Create a catch-all route and route to the homepage.
Create a catch-all route and route to the homepage. Signed-off-by: Robert Dempsey <715b5a941e732be1613fdd9d94dfd8e50c02b187@gmail.com>
Python
mit
rdempsey/weight-tracker,rdempsey/weight-tracker,rdempsey/weight-tracker
01b511b1f337f00eb72530692eec202611599c5a
tilequeue/queue/file.py
tilequeue/queue/file.py
from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage import threading class OutputFileQueue(object): def __init__(self, fp): self.fp = fp self.lock = threading.RLock() def enqueue(self, coord): with self.lock: payload = serialize_coord(coord) ...
from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage import threading class OutputFileQueue(object): def __init__(self, fp): self.fp = fp self.lock = threading.RLock() def enqueue(self, coord): with self.lock: payload = serialize_coord(coord) ...
Fix a bug in OutputFileQueue.close().
Fix a bug in OutputFileQueue.close(). tilequeue/queue/file.py -01a8fcb made `OutputFileQueue.read()` use `readline()` instead of `next()`, but didn't update `OutputFileQueue.close()`, which uses a list comprehension to grab the rest of the file. Since `.read()` no longer uses the iteration protocol, `.close()` wil...
Python
mit
mapzen/tilequeue,tilezen/tilequeue
8d02d9cf5e07951a80bf424334ba59af92cfd6cc
test/suite/out/long_lines.py
test/suite/out/long_lines.py
if True: if True: if True: self.__heap.sort( ) # pylint: builtin sort probably faster than O(n)-time heapify if True: foo = '( ' + \ array[0] + ' '
if True: if True: if True: self.__heap.sort( ) # pylint: builtin sort probably faster than O(n)-time heapify if True: foo = '( ' + array[0] + ' '
Update due to logical line changes
Update due to logical line changes
Python
mit
vauxoo-dev/autopep8,SG345/autopep8,MeteorAdminz/autopep8,Vauxoo/autopep8,SG345/autopep8,hhatto/autopep8,Vauxoo/autopep8,MeteorAdminz/autopep8,hhatto/autopep8,vauxoo-dev/autopep8
45c7e910f13a43427359801782eef7ce537d6f5f
delayed_assert/__init__.py
delayed_assert/__init__.py
from delayed_assert.delayed_assert import expect, assert_expectations
import sys if sys.version_info > (3, 0): # Python 3 and above from delayed_assert.delayed_assert import expect, assert_expectations else: # for Python 2 from delayed_assert import expect, assert_expectations
Support for python 2 and 3
Support for python 2 and 3
Python
unlicense
pr4bh4sh/python-delayed-assert
8154b206160cde249c474f5905a60b9a8086c910
conftest.py
conftest.py
# Copyright (c) 2016,2019 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Configure pytest for metpy.""" import os import matplotlib import matplotlib.pyplot import numpy import pandas import pytest import scipy import xarray import metpy.calc ...
# Copyright (c) 2016,2019 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Configure pytest for metpy.""" import os import matplotlib import matplotlib.pyplot import numpy import pandas import pooch import pytest import scipy import traitlets impo...
Print out all dependency versions at the start of pytest
TST: Print out all dependency versions at the start of pytest
Python
bsd-3-clause
Unidata/MetPy,dopplershift/MetPy,Unidata/MetPy,dopplershift/MetPy
f7fa8b72b8d8d1b7bfcd6c738520fc87cd20e320
ixdjango/tests/__init__.py
ixdjango/tests/__init__.py
""" Hook into the test runner """ import subprocess from django.test.simple import DjangoTestSuiteRunner from django.utils import unittest from ixdjango.test_suite.utils import (CoreUtilsTests) class TestRunner(DjangoTestSuiteRunner): """ Place where we hook into DjangoTestSuiteRunner """ def setu...
""" Hook into the test runner """ import subprocess try: from django.test.runner import DiscoverRunner as BaseTestRunner except ImportError: from django.test.simple import DjangoTestSuiteRunner as BaseTestRunner from django.utils import unittest from ixdjango.test_suite.utils import (CoreUtilsTests) class ...
Use DiscoverRunner from Django 1.6 if available
Use DiscoverRunner from Django 1.6 if available
Python
mit
infoxchange/ixdjango
ee03f3ae0d0501568cec87d8d4d7114441c19776
conftest.py
conftest.py
collect_ignore = ["setup.py"]
import tempfile import shutil import jedi collect_ignore = ["setup.py"] # The following hooks (pytest_configure, pytest_unconfigure) are used # to modify `jedi.settings.cache_directory` because `clean_jedi_cache` # has no effect during doctests. Without these hooks, doctests uses # user's cache (e.g., ~/.cache/je...
Use pytest_(un)configure to setup cache_directory
Use pytest_(un)configure to setup cache_directory
Python
mit
jonashaag/jedi,jonashaag/jedi,flurischt/jedi,WoLpH/jedi,tjwei/jedi,mfussenegger/jedi,mfussenegger/jedi,tjwei/jedi,dwillmer/jedi,WoLpH/jedi,flurischt/jedi,dwillmer/jedi
62ad2eb82c037350f25d3e575e59f16740365159
pies/ast.py
pies/ast.py
from __future__ import absolute_import from ast import * from .version_info import PY2 if PY2: Try = TryExcept def argument_names(node): return [isinstance(arg, Name) and arg.id or None for arg in node.args.args] def kw_only_argument_names(node): return [] def kw_only_default_count...
from __future__ import absolute_import import sys from ast import * from .version_info import PY2 if PY2 or sys.version_info[1] <= 2: Try = TryExcept else: TryFinally = () if PY2: def argument_names(node): return [isinstance(arg, Name) and arg.id or None for arg in node.args.args] def kw_on...
Fix small incompatibility with Python 3.2
Fix small incompatibility with Python 3.2
Python
mit
lisongmin/pies,AbsoluteMSTR/pies,timothycrosley/pies,AbsoluteMSTR/pies,timothycrosley/pies,lisongmin/pies
99bcbd8795f3e2b1a10ac8fa81dd69d1cad7c022
yunity/api/serializers.py
yunity/api/serializers.py
def user(model): if not model.is_authenticated(): return {} return { 'id': model.id, 'display_name': model.display_name, 'first_name': model.first_name, 'last_name': model.last_name, } def category(model): return { 'id': model.id, 'name': model....
def user(model): if not model.is_authenticated(): return {} return { 'id': model.id, 'display_name': model.display_name, 'first_name': model.first_name, 'last_name': model.last_name, } def category(model): return { 'id': model.id, 'name': model....
Allow empty conversations to be serialized
Allow empty conversations to be serialized A conversation may exist without any content. The serializer then returns an empty message value.
Python
agpl-3.0
yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core
d6f2b132844d1923932447c0ce67c581f723f433
wagtail/wagtailadmin/menu.py
wagtail/wagtailadmin/menu.py
from __future__ import unicode_literals from six import text_type from django.utils.text import slugify from django.utils.html import format_html class MenuItem(object): def __init__(self, label, url, name=None, classnames='', order=1000): self.label = label self.url = url self.classname...
from __future__ import unicode_literals from six import text_type try: # renamed util -> utils in Django 1.7; try the new name first from django.forms.utils import flatatt except ImportError: from django.forms.util import flatatt from django.utils.text import slugify from django.utils.html import format_...
Support passing html attributes into MenuItem
Support passing html attributes into MenuItem
Python
bsd-3-clause
JoshBarr/wagtail,m-sanders/wagtail,hamsterbacke23/wagtail,benemery/wagtail,jordij/wagtail,nutztherookie/wagtail,mixxorz/wagtail,nutztherookie/wagtail,dresiu/wagtail,serzans/wagtail,mixxorz/wagtail,bjesus/wagtail,nrsimha/wagtail,nilnvoid/wagtail,inonit/wagtail,torchbox/wagtail,wagtail/wagtail,dresiu/wagtail,davecranwell...
a056c630a197a070e55cce9f76124d56ba781e52
app/views/main.py
app/views/main.py
from flask import Blueprint, render_template from flask_login import login_required main = Blueprint("main", __name__) @main.route("/") @main.route("/index") @login_required def index(): return "Logged in" @main.route("/login") def login(): return render_template("login.html")
from flask import Blueprint, render_template, g, redirect, url_for from flask_login import login_required, current_user, logout_user main = Blueprint("main", __name__) @main.route("/") @main.route("/index") @login_required def index(): return "Logged in" @main.route("/login") def login(): if g.user.is_auth...
Add logout and auth checks
Add logout and auth checks
Python
mit
Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary
9c07f8fdb9c955f49cf6ff92a25b1c0629157811
assembler6502.py
assembler6502.py
#! /usr/bin/env python import sys import assembler6502_tokenizer as tokenizer import assembler6502_parser as parser def output_byte(hexcode): sys.stdout.write(hexcode) #sys.stdout.write(chr(int(hexcode, 16))) def main(): code = """ ; sample code beginning: sty $44,X """ for line in code.split...
#! /usr/bin/env python import sys import assembler6502_tokenizer as tokenizer import assembler6502_parser as parser def output_byte(hexcode): sys.stdout.write(hexcode + "\n") #sys.stdout.write(chr(int(hexcode, 16))) def main(): code = sys.stdin.read() for line in code.split("\n"): hexcodes = ...
Use stdin for assembler input
Use stdin for assembler input
Python
mit
technetia/project-tdm,technetia/project-tdm,technetia/project-tdm
391ff28186e40bee9ba7966b739090d67d61b2a6
APITaxi/models/security.py
APITaxi/models/security.py
# -*- coding: utf8 -*- from flask.ext.security import UserMixin, RoleMixin from ..models import db roles_users = db.Table('roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')), db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))) class Role(db.Model, RoleMixin): id =...
# -*- coding: utf8 -*- from flask.ext.security import UserMixin, RoleMixin from ..models import db from uuid import uuid4 roles_users = db.Table('roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')), db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))) class Role(db.Mod...
Add apikey when creating a user
Add apikey when creating a user
Python
agpl-3.0
odtvince/APITaxi,l-vincent-l/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,odtvince/APITaxi,odtvince/APITaxi,odtvince/APITaxi,openmaraude/APITaxi
8090fa9c072656497ff383e9b76d49af2955e420
examples/hopv/hopv_graph_conv.py
examples/hopv/hopv_graph_conv.py
""" Script that trains graph-conv models on HOPV dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from models import GraphConvTensorGraph np.random.seed(123) import tensorflow as tf tf.set_random_seed(123) import deepchem as...
""" Script that trains graph-conv models on HOPV dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from models import GraphConvModel np.random.seed(123) import tensorflow as tf tf.set_random_seed(123) import deepchem as dc fr...
Fix GraphConvTensorGraph to GraphConvModel in hopv example
Fix GraphConvTensorGraph to GraphConvModel in hopv example
Python
mit
Agent007/deepchem,lilleswing/deepchem,lilleswing/deepchem,Agent007/deepchem,peastman/deepchem,miaecle/deepchem,peastman/deepchem,ktaneishi/deepchem,miaecle/deepchem,Agent007/deepchem,deepchem/deepchem,ktaneishi/deepchem,deepchem/deepchem,ktaneishi/deepchem,miaecle/deepchem,lilleswing/deepchem
66f06164a5654f2925fb16a1ce28638fd57e3a9e
issue_tracker/accounts/urls.py
issue_tracker/accounts/urls.py
from django.conf.urls.defaults import * from django.contrib.auth.views import logout_then_login, login from django.contrib.auth.forms import AuthenticationForm urlpatterns = patterns('', (r'^login/$', login, {}, 'login' ), (r'^logout/$', logout_then_login, {}, 'logout'), )
from django.conf.urls.defaults import * from django.contrib.auth.views import logout_then_login, login from accounts.views import register from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.forms import AuthenticationForm urlpatterns = patterns('', (r'^register/$', register, {}, 'regis...
Add url mapping to register.
Add url mapping to register.
Python
mit
hfrequency/django-issue-tracker
fb1422c22e570da21279edee0ea79605e74f7a92
crispy/__init__.py
crispy/__init__.py
import logging logging.basicConfig(level=logging.WARNING)
import logging # These are required to activate the cx_Freeze hooks import matplotlib import matplotlib.backends.backend_qt5agg import PyQt5.QtPrintSupport logging.basicConfig(level=logging.WARNING)
Add imports imports to trigger cx_Freeze hooks
Add imports imports to trigger cx_Freeze hooks
Python
mit
mretegan/crispy,mretegan/crispy
d6a03fad6c9280981ae3beee24de89bd6361bcc9
dumbrepl.py
dumbrepl.py
if __name__ == "__main__": import pycket.test.testhelper as th th.dumb_repl()
if __name__ == "__main__": import pycket.values import pycket.config from pycket.env import w_global_config #w_global_config.set_linklet_mode_off() import pycket.test.testhelper as th th.dumb_repl()
Make sure things are loaded right.
Make sure things are loaded right.
Python
mit
samth/pycket,pycket/pycket,pycket/pycket,samth/pycket,samth/pycket,pycket/pycket
bd69ad0bf57876cef01cc8f7cdce49a301eb2444
bin/remotePush.py
bin/remotePush.py
import json,httplib config_data = json.load(open('conf/net/ext_service/parse.json')) silent_push_msg = { "where": { "deviceType": "ios" }, "data": { # "alert": "The Mets scored! The game is now tied 1-1.", "content-available": 1, "sound": "", } } parse_headers = { "X-Parse-Applicat...
import json,httplib import sys config_data = json.load(open('conf/net/ext_service/parse.json')) interval = sys.argv[1] print "pushing for interval %s" % interval silent_push_msg = { "where": { "deviceType": "ios" }, "channels": [ interval ], "data": { # "alert": "The Mets scored! The ga...
Make the remote push script take in the interval as an argument
Make the remote push script take in the interval as an argument We will use the interval as the channel
Python
bsd-3-clause
shankari/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-ser...
3794fe611e5fbbe55506a7d2e59b2f3f872d8733
backend/controllers/file_controller.py
backend/controllers/file_controller.py
import os from werkzeug.utils import secure_filename import config from flask_restful import Resource from flask import request, abort def allowed_file(filename): return ('.' in filename and filename.rsplit('.', 1)[1].lower() in config.ALLOWED_EXTENSIONS) class File(Resource): def post(self): ...
import os from werkzeug.utils import secure_filename import config from flask_restful import Resource from flask import request, abort def allowed_file(filename): return ('.' in filename and filename.rsplit('.', 1)[1].lower() in config.ALLOWED_EXTENSIONS) class File(Resource): def post(self): ...
Change status codes and messages
Change status codes and messages
Python
apache-2.0
googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer
123875153e81253a44d0e8b2d8de5abee195362a
backend/shmitter/tweets/serializers.py
backend/shmitter/tweets/serializers.py
from rest_framework import serializers from shmitter.likes import services as likes_services from .models import Tweet from . import services as tweets_services class TweetSerializer(serializers.ModelSerializer): owner = serializers.ReadOnlyField(source='owner.username') is_fan = serializers.SerializerMetho...
from rest_framework import serializers from shmitter.likes import services as likes_services from .models import Tweet from . import services as tweets_services class TweetSerializer(serializers.ModelSerializer): owner = serializers.ReadOnlyField(source='owner.username') is_fan = serializers.SerializerMetho...
Add total retweets to the serializer
Add total retweets to the serializer
Python
mit
apirobot/shmitter,apirobot/shmitter,apirobot/shmitter
28a4f4ab9d6b7c3ea14d48c002273acfe05d7246
bumblebee/util.py
bumblebee/util.py
import shlex import exceptions import subprocess def bytefmt(num): for unit in [ "", "Ki", "Mi", "Gi" ]: if num < 1024.0: return "{:.2f}{}B".format(num, unit) num /= 1024.0 return "{:05.2f%}{}GiB".format(num) def durationfmt(duration): minutes, seconds = divmod(duration, 60) ...
import shlex import subprocess try: from exceptions import RuntimeError except ImportError: # Python3 doesn't require this anymore pass def bytefmt(num): for unit in [ "", "Ki", "Mi", "Gi" ]: if num < 1024.0: return "{:.2f}{}B".format(num, unit) num /= 1024.0 return "{:0...
Fix import error for Python3
[core] Fix import error for Python3 Import exceptions module only for Python2. fixes #22
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
81b7089633b9d43b05566a1e23f93fb59678fe1e
plugins/unicode_plugin.py
plugins/unicode_plugin.py
import string import textwrap import binascii from veryprettytable import VeryPrettyTable from plugins import BasePlugin __author__ = 'peter' class DecodeHexPlugin(BasePlugin): short_description = 'Decode hex string to encodings:' default = True description = textwrap.dedent(''' This plugin tries to ...
import string import textwrap import binascii import unicodedata from veryprettytable import VeryPrettyTable from plugins import BasePlugin __author__ = 'peter' class DecodeHexPlugin(BasePlugin): short_description = 'Decode hex string to encodings:' default = True description = textwrap.dedent(''' Th...
Remove control characters from printed string to prevent terminal breakage
Remove control characters from printed string to prevent terminal breakage
Python
mit
Sakartu/stringinfo
c0596310d9281fc07d4db6e6fd2ed8433335edb9
examples/build_examples.py
examples/build_examples.py
#!/usr/bin/env python import glob import os import platform import subprocess import sys cx_path = sys.argv[1] if len(sys.argv) > 1 else "cx" os.chdir(os.path.dirname(__file__)) for file in glob.glob("*.cx"): if platform.system() == "Windows" and file == "tree.cx": continue extension = ".out" if pl...
#!/usr/bin/env python import glob import os import platform import subprocess import sys cx_path = sys.argv[1] if len(sys.argv) > 1 else "cx" os.chdir(os.path.dirname(__file__)) for file in glob.glob("*.cx"): if platform.system() == "Windows" and file == "tree.cx": continue extension = ".out" if pl...
Use -Werror for code examples
Use -Werror for code examples
Python
mit
delta-lang/delta,delta-lang/delta,delta-lang/delta,delta-lang/delta
19326b0b96e053c4b4fab402a379a03c39fbe46d
apps/homepage/templatetags/homepage_tags.py
apps/homepage/templatetags/homepage_tags.py
from django import template from homepage.models import Tab register = template.Library() @register.tag(name="get_tabs") def get_tabs(parser, token): return GetElementNode() class GetElementNode(template.Node): def __init__(self): pass def render(self, cont...
from django import template from homepage.models import Tab register = template.Library() @register.tag(name="get_tabs") def get_tabs(parser, token): return GetElementNode() class GetElementNode(template.Node): def __init__(self): pass def render(self, cont...
Reduce queries on all pages by using select_related in the get_tabs template tag.
Reduce queries on all pages by using select_related in the get_tabs template tag.
Python
mit
cartwheelweb/packaginator,nanuxbe/djangopackages,miketheman/opencomparison,audreyr/opencomparison,audreyr/opencomparison,cartwheelweb/packaginator,QLGu/djangopackages,pydanny/djangopackages,cartwheelweb/packaginator,benracine/opencomparison,nanuxbe/djangopackages,pydanny/djangopackages,pydanny/djangopackages,QLGu/djang...
5aff8defb8baf83176ea861b03de04a9d6ac8a31
bundles/views.py
bundles/views.py
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginate_by = 25 class Bundle...
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginate_by = 25 class Bundle...
Make bundle view accessible to anyone
Make bundle view accessible to anyone
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
b3391187cb87ae33d4b8dd6e55f5edfdb695ea53
mapbox_vector_tile/__init__.py
mapbox_vector_tile/__init__.py
from . import encoder from . import decoder def decode(tile, y_coord_down=False): vector_tile = decoder.TileData() message = vector_tile.getMessage(tile, y_coord_down) return message def encode(layers, quantize_bounds=None, y_coord_down=False, extents=4096, on_invalid_geometry=None, round_fn=...
from . import encoder from . import decoder # Enable Shapely "speedups" if available # http://toblerity.org/shapely/manual.html#performance from shapely import speedups if speedups.available: speedups.enable() def decode(tile, y_coord_down=False): vector_tile = decoder.TileData() message = vector_tile.g...
Enable Shapely speedups when available.
Enable Shapely speedups when available. http://toblerity.org/shapely/manual.html#performance
Python
mit
mapzen/mapbox-vector-tile
e53e214b97a9a4c7ad2dbca88b01798dcc614b6a
auth0/v2/authentication/social.py
auth0/v2/authentication/social.py
from .base import AuthenticationBase class Social(AuthenticationBase): def __init__(self, domain): self.domain = domain def login(self, client_id, access_token, connection): """Login using a social provider's access token Given the social provider's access_token and the connection s...
from .base import AuthenticationBase class Social(AuthenticationBase): """Social provider's endpoints. Args: domain (str): Your auth0 domain (e.g: username.auth0.com) """ def __init__(self, domain): self.domain = domain def login(self, client_id, access_token, connection): ...
Add class docstring to Social
Add class docstring to Social
Python
mit
auth0/auth0-python,auth0/auth0-python
1608134ea633c0fe8cd4636b11dc5a931d02e024
intercom.py
intercom.py
import configparser import time import RPIO as GPIO from client import MumbleClient class InterCom: def __init__(self): config = configparser.ConfigParser() config.read('intercom.ini') self.mumble_client = MumbleClient(config['mumbleclient']) self.exit = False self.send_in...
import configparser import time import RPi.GPIO as GPIO from client import MumbleClient class InterCom: def __init__(self): config = configparser.ConfigParser() config.read('intercom.ini') self.mumble_client = MumbleClient(config['mumbleclient']) self.exit = False self.sen...
Change to rpio and add clean
Change to rpio and add clean
Python
mit
pkronstrom/intercom
05e568571c2f6891ed7be6198b8cf5e4e540d674
dev_tools/run_tests.py
dev_tools/run_tests.py
#!/usr/bin/env python3 """Run tests under a consistent environment... Whether run from the terminal, in CI or from the editor this file makes sure the tests are run in a consistent environment. """ #------------------------------------------------------------------------------ # Py2C - A Python to C++ compiler # Copy...
#!/usr/bin/env python3 """Run tests under a consistent environment... Whether run from the terminal, in CI or from the editor this file makes sure the tests are run in a consistent environment. """ #------------------------------------------------------------------------------ # Py2C - A Python to C++ compiler # Copy...
Move all imports to top-of-module, don't hide cleanup output.
[RUN_TESTS] Move all imports to top-of-module, don't hide cleanup output.
Python
bsd-3-clause
pradyunsg/Py2C,pradyunsg/Py2C
0fe30bb04e9b3d981cd1f6264485d98ca56a2fb8
events/migrations/0035_add_n_events_to_keyword.py
events/migrations/0035_add_n_events_to_keyword.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.11 on 2016-12-02 15:46 from __future__ import unicode_literals from django.db import migrations, models def forward(apps, schema_editor): Keyword = apps.get_model('events', 'Keyword') for keyword in Keyword.objects.exclude(events=None) | Keyword.objects.exclu...
# -*- coding: utf-8 -*- # Generated by Django 1.9.11 on 2016-12-02 15:46 from __future__ import unicode_literals from django.db import migrations, models def forward(apps, schema_editor): Keyword = apps.get_model('events', 'Keyword') for keyword in Keyword.objects.exclude(events=None) | Keyword.objects.exclu...
Add logging to keyword data migration
Add logging to keyword data migration
Python
mit
City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents
887597d31dec7fe1f49402e44691c1e745d22968
cellcounter/wsgi.py
cellcounter/wsgi.py
""" WSGI config for cellcounter project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATIO...
""" WSGI config for cellcounter project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATIO...
Improve WSGI file for apache deployment/database configuration management
Improve WSGI file for apache deployment/database configuration management
Python
mit
cellcounter/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,oghm2/hackdayoxford,oghm2/hackdayoxford,haematologic/cellcounter,haematologic/cellcounter,haematologic/cellcounter,cellcounter/cellcounter
25712b9c94062f41c50a8611c5b7069bde7e1c8f
ibmcnx/cnx/VersionStamp.py
ibmcnx/cnx/VersionStamp.py
###### # Set the Version Stamp to actual time and date # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # print "\nSet Version Stamp in LotusConnec...
###### # Set the Version Stamp to actual time and date # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # import ibmcnx.functions print "\nSet Ver...
Add option to get temppath from properties file
Add option to get temppath from properties file
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
e5656674eab83f7005c70d901187fd89027efeba
allaccess/management/commands/migrate_social_providers.py
allaccess/management/commands/migrate_social_providers.py
from __future__ import unicode_literals from django.core.management.base import NoArgsCommand, CommandError from allaccess.models import Provider class Command(NoArgsCommand): "Convert existing providers from django-social-auth to django-all-access." def handle_noargs(self, **options): verbosity =...
from __future__ import unicode_literals from django.core.management.base import NoArgsCommand, CommandError from allaccess.models import Provider class Command(NoArgsCommand): "Convert existing providers from django-social-auth to django-all-access." def handle_noargs(self, **options): verbosity =...
Remove force_load which was added in later versions.
Remove force_load which was added in later versions.
Python
bsd-2-clause
iXioN/django-all-access,vyscond/django-all-access,dpoirier/django-all-access,dpoirier/django-all-access,mlavin/django-all-access,iXioN/django-all-access,vyscond/django-all-access,mlavin/django-all-access
3faf3a9debc0fad175ca032f3eb0880defbd0cdb
akaudit/clidriver.py
akaudit/clidriver.py
#!/usr/bin/env python import sys import argparse from akaudit.audit import Auditer def main(argv = sys.argv, log = sys.stderr): parser = argparse.ArgumentParser(description='Audit who has access to your homes.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-l', '--log', default='info...
#!/usr/bin/env python import sys import argparse from akaudit.audit import Auditer def main(argv = sys.argv, log = sys.stderr): parser = argparse.ArgumentParser(description='Audit who has access to your homes.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-l', '--log', default='info...
Add argument option for --interactive.
Add argument option for --interactive.
Python
apache-2.0
flaccid/akaudit
572a84ae4fe7ce464fe66b6462a80b09b20f8f1c
fireplace/cards/gvg/neutral_epic.py
fireplace/cards/gvg/neutral_epic.py
from ..utils import * ## # Minions # Hobgoblin class GVG_104: def OWN_CARD_PLAYED(self, card): if card.type == CardType.MINION and card.atk == 1: return [Buff(card, "GVG_104a")]
from ..utils import * ## # Minions # Hobgoblin class GVG_104: def OWN_CARD_PLAYED(self, card): if card.type == CardType.MINION and card.atk == 1: return [Buff(card, "GVG_104a")] # Piloted Sky Golem class GVG_105: def deathrattle(self): return [Summon(CONTROLLER, randomCollectible(type=CardType.MINION, cos...
Implement Piloted Sky Golem, Junkbot and Enhance-o Mechano
Implement Piloted Sky Golem, Junkbot and Enhance-o Mechano
Python
agpl-3.0
NightKev/fireplace,Ragowit/fireplace,liujimj/fireplace,Meerkov/fireplace,smallnamespace/fireplace,amw2104/fireplace,oftc-ftw/fireplace,beheh/fireplace,smallnamespace/fireplace,oftc-ftw/fireplace,butozerca/fireplace,Meerkov/fireplace,jleclanche/fireplace,amw2104/fireplace,butozerca/fireplace,Ragowit/fireplace,liujimj/fi...
1d6984d31aaa87b5ed781e188b8b42221602cd3f
tests/conftest.py
tests/conftest.py
# -*- coding: utf-8 -*- pytest_plugins = 'pytester'
# -*- coding: utf-8 -*- import os import warnings import pytest pytest_plugins = 'pytester' @pytest.fixture(scope='session', autouse=True) def verify_target_path(): import pytest_testdox current_path_root = os.path.dirname( os.path.dirname(os.path.realpath(__file__)) ) if current_path_root ...
Add warning on running repository's tests with pytest-testdox installed
Add warning on running repository's tests with pytest-testdox installed Fix #13
Python
mit
renanivo/pytest-testdox
dc1cedc1720886dcc3c3bd3da02c7aff58e5eb90
tests/runTests.py
tests/runTests.py
import os import os.path import configparser import shutil import subprocess # Setup print("Setting up...") if os.path.isfile("../halite.ini"): shutil.copyfile("../halite.ini", "temp.ini") shutil.copyfile("tests.ini", "../halite.ini") parser = configparser.ConfigParser() parser.read("../halite.ini") # Website te...
import os import os.path import configparser import shutil import subprocess # Setup print("Setting up...") if os.path.isfile("../halite.ini"): shutil.copyfile("../halite.ini", "temp.ini") shutil.copyfile("tests.ini", "../halite.ini") parser = configparser.ConfigParser() parser.read("../halite.ini") # Website te...
Make test runner work with blank mysql password
Make test runner work with blank mysql password
Python
mit
HaliteChallenge/Halite,lanyudhy/Halite-II,HaliteChallenge/Halite-II,yangle/HaliteIO,HaliteChallenge/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halite,HaliteChallenge/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halite-II,yangle/HaliteIO,yangle/HaliteIO,HaliteChallenge/Halite,lanyudhy/Halite-II,lanyudhy/Halite...
a69e8d0d179f12fd42eadd85eca8e0c968d67c91
tests/runTests.py
tests/runTests.py
import os import os.path import configparser import shutil import subprocess # Setup print("Setting up...") if os.path.isfile("../halite.ini"): shutil.copyfile("../halite.ini", "temp.ini") shutil.copyfile("tests.ini", "../halite.ini") parser = configparser.ConfigParser() parser.read("../halite.ini") # Website te...
import os import os.path import configparser import shutil import subprocess # Setup print("Setting up...") if os.path.isfile("../halite.ini"): shutil.copyfile("../halite.ini", "temp.ini") shutil.copyfile("tests.ini", "../halite.ini") parser = configparser.ConfigParser() parser.read("../halite.ini") # Website te...
Make test runner work with blank mysql password
Make test runner work with blank mysql password
Python
mit
HaliteChallenge/Halite-II,yangle/HaliteIO,yangle/HaliteIO,HaliteChallenge/Halite,HaliteChallenge/Halite,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite-II,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite-II,HaliteChal...
7172962abf0d5d5aad02c632944ed8cb33ca9bae
django/books/admin.py
django/books/admin.py
from django.contrib import admin from .models import Author, Book, Note, Tag, Section @admin.register(Author) class AuthorAdmin(admin.ModelAdmin): list_display = ['name', 'goodreads_id'] prepopulated_fields = {'slug': ('name',), } @admin.register(Section) class SectionAdmin(admin.ModelAdmin): list_disp...
from django.contrib import admin from .models import Author, Book, Note, Tag, Section @admin.register(Author) class AuthorAdmin(admin.ModelAdmin): list_display = ['name', 'goodreads_id'] prepopulated_fields = {'slug': ('name',), } search_fields = ['name'] @admin.register(Section) class SectionAdmin(adm...
Allow searching by name in AuthorAdmin
Allow searching by name in AuthorAdmin
Python
mit
dellsystem/bookmarker,dellsystem/bookmarker,dellsystem/bookmarker
23f404b61f2c9b89bb631ad0e60edf4416500f28
django_split/utils.py
django_split/utils.py
def overlapping(interval_a, interval_b): al, ah = interval_a bl, bh = interval_b if al > ah: raise ValueError("Interval A bounds are inverted") if bl > bh: raise ValueError("Interval B bounds are inverted") return ah >= bl and bh >= al
from __future__ import division import scipy import scipy.stats def overlapping(interval_a, interval_b): al, ah = interval_a bl, bh = interval_b if al > ah: raise ValueError("Interval A bounds are inverted") if bl > bh: raise ValueError("Interval B bounds are inverted") return a...
Add utilities for computing metrics
Add utilities for computing metrics
Python
mit
prophile/django_split
dd269cea5623450c3c608d10b8ddce1ae6c9e84a
project_one/project_one.py
project_one/project_one.py
# System imports first import sys # Module (local) imports from import_data import import_data from process import process_data, normalize, rotate_data from output import plot_data def main(argv=None): """ Main function, executed when running 'project_one'. """ # Read the data data = import_data('data.tx...
# System imports first import sys import argparse # Module (local) imports from import_data import import_data from process import process_data, normalize, rotate_data from output import plot_data def main(argv=None): """ Main function, executed when running 'project_one'. """ # Parse command-line arguments,...
Use command-line argument to specify data.
Use command-line argument to specify data.
Python
bsd-3-clause
dokterbob/slf-project-one
2c05dba69c838cfd3808d8e03dbea3cc56d4f6d2
pyinfra_kubernetes/__init__.py
pyinfra_kubernetes/__init__.py
from .configure import configure_kubeconfig, configure_kubernetes_component from .install import install_kubernetes def deploy_kubernetes_master(etcd_nodes): # Install server components install_kubernetes(components=( 'kube-apiserver', 'kube-scheduler', 'kube-controller-manager', )) # Configu...
from pyinfra.api import deploy from .configure import configure_kubeconfig, configure_kubernetes_component from .install import install_kubernetes @deploy('Deploy Kubernetes master') def deploy_kubernetes_master( state, host, etcd_nodes, ): # Install server components install_kubernetes(components=( ...
Make helper functions full `@deploy`s so they support global pyinfra kwargs.
Make helper functions full `@deploy`s so they support global pyinfra kwargs.
Python
mit
EDITD/pyinfra-kubernetes,EDITD/pyinfra-kubernetes
de3f84934d86e48bf89822828df3eb9c3bd8e1e1
test/test_examples.py
test/test_examples.py
import glob from libmproxy import utils, script from libmproxy.proxy import config import tservers def test_load_scripts(): example_dir = utils.Data("libmproxy").path("../examples") scripts = glob.glob("%s/*.py" % example_dir) tmaster = tservers.TestMaster(config.ProxyConfig()) for f in scripts: ...
import glob from libmproxy import utils, script from libmproxy.proxy import config import tservers def test_load_scripts(): example_dir = utils.Data("libmproxy").path("../examples") scripts = glob.glob("%s/*.py" % example_dir) tmaster = tservers.TestMaster(config.ProxyConfig()) for f in scripts: ...
Test suite should pass even if example dependencies are not present
Test suite should pass even if example dependencies are not present
Python
mit
ryoqun/mitmproxy,ryoqun/mitmproxy,xaxa89/mitmproxy,guiquanz/mitmproxy,ccccccccccc/mitmproxy,ADemonisis/mitmproxy,jpic/mitmproxy,pombredanne/mitmproxy,noikiy/mitmproxy,xaxa89/mitmproxy,fimad/mitmproxy,onlywade/mitmproxy,dxq-git/mitmproxy,inscriptionweb/mitmproxy,sethp-jive/mitmproxy,ParthGanatra/mitmproxy,cortesi/mitmpr...
c55243d591793a9213d27126a3c240bb47c5f82b
cartoframes/core/cartodataframe.py
cartoframes/core/cartodataframe.py
from geopandas import GeoDataFrame from ..utils.geom_utils import generate_index, generate_geometry class CartoDataFrame(GeoDataFrame): def __init__(self, *args, **kwargs): super(CartoDataFrame, self).__init__(*args, **kwargs) @staticmethod def from_carto(*args, **kwargs): from ..io.car...
from geopandas import GeoDataFrame from ..utils.geom_utils import generate_index, generate_geometry class CartoDataFrame(GeoDataFrame): def __init__(self, *args, **kwargs): super(CartoDataFrame, self).__init__(*args, **kwargs) @staticmethod def from_carto(*args, **kwargs): from ..io.car...
Rename visualize to viz in CDF
Rename visualize to viz in CDF
Python
bsd-3-clause
CartoDB/cartoframes,CartoDB/cartoframes
fc5ae93998045f340e44e267f409a7bdf534c756
website_slides/__init__.py
website_slides/__init__.py
# -*- coding: utf-8 -*- # ############################################################################## # # Odoo, Open Source Management Solution # Copyright (C) 2014-TODAY Odoo SA (<https://www.odoo.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import controllers import models
Use global LICENSE/COPYRIGHT files, remove boilerplate text
[LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text - Preserved explicit 3rd-party copyright notices - Explicit boilerplate should not be necessary - copyright law applies automatically in all countries thanks to Berne Convention + WTO rules, and a reference to the applicable license is clear enoug...
Python
agpl-3.0
Endika/website,Yajo/website,kaerdsar/website,brain-tec/website,kaerdsar/website,gfcapalbo/website,pedrobaeza/website,Antiun/website,open-synergy/website,LasLabs/website,open-synergy/website,brain-tec/website,nuobit/website,acsone/website,nuobit/website,xpansa/website,acsone/website,Antiun/website,Antiun/website,pedroba...
ee6f71ba0e548fdb08a3f1b065cd081b2431caa6
lc0222_count_complete_tree_nodes.py
lc0222_count_complete_tree_nodes.py
"""Leetcode 222. Count Complete Tree Nodes Medium URL: https://leetcode.com/problems/count-complete-tree-nodes/ Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completely filled, a...
"""Leetcode 222. Count Complete Tree Nodes Medium URL: https://leetcode.com/problems/count-complete-tree-nodes/ Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completely filled, a...
Complete preorder recur sol w/ time/space complexity
Complete preorder recur sol w/ time/space complexity
Python
bsd-2-clause
bowen0701/algorithms_data_structures
8c819a1cb9df54c00b7246a07e2ba832b763876d
stream_django/templatetags/activity_tags.py
stream_django/templatetags/activity_tags.py
from django import template from django.template import Context, loader from stream_django.exceptions import MissingDataException import logging logger = logging.getLogger(__name__) register = template.Library() LOG = 'warn' IGNORE = 'ignore' FAIL = 'fail' missing_data_policies = [LOG, IGNORE, FAIL] def handle_no...
from django import template from django.template import loader from stream_django.exceptions import MissingDataException import logging logger = logging.getLogger(__name__) register = template.Library() LOG = 'warn' IGNORE = 'ignore' FAIL = 'fail' missing_data_policies = [LOG, IGNORE, FAIL] def handle_not_enriche...
Use dict as a context object for Django 1.11 compatibility
Use dict as a context object for Django 1.11 compatibility Django’s template rendering in 1.11 needs a dictionary as the context instead of the object Context, otherwise the following error is raised: context must be a dict rather than Context.
Python
bsd-3-clause
GetStream/stream-django,GetStream/stream-django
6727bb98c91f1185042d08f3ff2a4c5ef625cae4
mjstat/languages/__init__.py
mjstat/languages/__init__.py
# -*- coding: utf-8 -*- """__init__.py: Language-dependent features. """ module_cache = {} def get_language(lang_code): """Return module with language localizations. This is a poor copy of the language framework of Docutils. """ if lang_code in module_cache: return module_cache[lang_code] ...
# -*- coding: utf-8 -*- """__init__.py: Language-dependent features. """ from importlib import import_module module_cache = {} def get_language(lang_code): """Return module with language localizations. This is a revamped version of function docutils.languages.get_language. """ if lang_code in modul...
Use importlib.import_module instead of built-in __import__.
Use importlib.import_module instead of built-in __import__.
Python
mit
showa-yojyo/bin,showa-yojyo/bin
030d425bb2b9b552516957277aebb22806bfc699
bills/redis_queue.py
bills/redis_queue.py
# -*- coding: utf-8 -*- import redis class RedisQueue(object): """Simple Queue with Redis Backend""" def __init__(self, name, namespace='queue', **redis_kwargs): """The default connection parameters are: host='localhost', port=6379, db=0""" self.db = redis.Redis(**redis_kwargs) self.ke...
# -*- coding: utf-8 -*- import redis class RedisQueue(object): """Simple Queue with Redis Backend""" def __init__(self, name, namespace='queue', **redis_kwargs): """The default connection parameters are: host='localhost', port=6379, db=0""" self.db = redis.Redis(**redis_kwargs) self.ke...
Fix a bug in redis queue
Fix a bug in redis queue
Python
agpl-3.0
teampopong/crawlers,majorika/crawlers,majorika/crawlers,lexifdev/crawlers,lexifdev/crawlers,teampopong/crawlers
6a1d9a327ebf64acba9bd02330bfa047e8137337
bmi_live/__init__.py
bmi_live/__init__.py
"""BMI Live clinic""" import os pkg_directory = os.path.dirname(__file__) data_directory = os.path.join(pkg_directory, 'data')
"""BMI Live clinic""" import os from .diffusion import Diffusion from .bmi_diffusion import BmiDiffusion __all__ = ['Diffusion', 'BmiDiffusion'] pkg_directory = os.path.dirname(__file__) data_directory = os.path.join(pkg_directory, 'data')
Include classes in package definition
Include classes in package definition
Python
mit
csdms/bmi-live,csdms/bmi-live