Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix read of wrong dictionnary | # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
... | # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
... |
Add ability to get the latest TwoHeadlines tweet | # -*- utf-8 -*-
import config
import requests
from base64 import b64encode
def get_access_token():
token = config.twitter_key + ':' + config.twitter_secret
h = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
'Authorization': b'Basic ' + b64encode(bytes(token, 'utf8'))}
print(... | # -*- coding: utf-8 -*-
import config
import requests
from base64 import b64encode
def get_access_token():
token = config.twitter_key + ':' + config.twitter_secret
h = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
'Authorization': b'Basic ' + b64encode(bytes(token, 'utf8'))}
... |
Create empty PactGroup if no arguments given | from .base import PactBase
from .utils import GroupWaitPredicate
class PactGroup(PactBase):
def __init__(self, pacts):
self._pacts = list(pacts)
super(PactGroup, self).__init__()
def __iadd__(self, other):
self._pacts.append(other)
return self
def _is_finished(self):
... | from .base import PactBase
from .utils import GroupWaitPredicate
class PactGroup(PactBase):
def __init__(self, pacts=None):
self._pacts = [] if pacts is None else list(pacts)
super(PactGroup, self).__init__()
def __iadd__(self, other):
self._pacts.append(other)
return self
... |
Enable specifying the password in `config.ini` | from sqlalchemy import create_engine
import keyring
from . import config as cfg
def connection():
engine = create_engine(
"postgresql+psycopg2://{user}:{passwd}@{host}:{port}/{db}".format(
user=cfg.get("postGIS", "username"),
passwd=keyring.get_password(
cfg.get("po... | from configparser import NoOptionError as option, NoSectionError as section
from sqlalchemy import create_engine
import keyring
from . import config as cfg
def connection():
pw = keyring.get_password(cfg.get("postGIS", "database"),
cfg.get("postGIS", "username"))
if pw is None:
... |
Add some logging to generic error handler. | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
if not error.message:
error.message = "Internal Server Error"
return res... | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
import logging
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
"""
Prevents Exceptions flying all around the place.
"""... |
Work around null TfL common names | """
Usage:
./manage.py import_tfl_stops < data/tfl/bus-stops.csv
"""
import requests
from titlecase import titlecase
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from busstops.management.import_from_csv import ImportFromCSVCommand
from busstops.models import StopPoint
class C... | """
Usage:
./manage.py import_tfl_stops < data/tfl/bus-stops.csv
"""
import requests
from titlecase import titlecase
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from busstops.management.import_from_csv import ImportFromCSVCommand
from busstops.models import StopPoint
class C... |
Add teardown specific to the former TestCase class | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generate_files
-------------------
Test formerly known from a unittest residing in test_generate.py named
TestGenerateFiles.test_generate_files_nontemplated_exception
"""
import pytest
from cookiecutter import generate
from cookiecutter import exceptions
@pyte... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generate_files
-------------------
Test formerly known from a unittest residing in test_generate.py named
TestGenerateFiles.test_generate_files_nontemplated_exception
"""
from __future__ import unicode_literals
import os
import pytest
from cookiecutter import g... |
Add test for output that doesn't end in a newline | import functools
import os
from nose.tools import istest, assert_equal
import spur
def test(func):
@functools.wraps(func)
def run_test():
for shell in _create_shells():
yield func, shell
def _create_shells():
return [
spur.LocalShell(),
_cr... | import functools
import os
from nose.tools import istest, assert_equal
import spur
def test(func):
@functools.wraps(func)
def run_test():
for shell in _create_shells():
yield func, shell
def _create_shells():
return [
spur.LocalShell(),
_cr... |
Make api constrains multi to avoid error when create a company with 2 contacts | # Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2016 Tecnativa S.L. - Vicent Cubells
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, exceptions, fields, models, _
class ResPartner(models... | # Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2016 Tecnativa S.L. - Vicent Cubells
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, exceptions, fields, models, _
class ResPartner(models... |
Fix to work correctly if we are already in the directory of the lcad file. | #!/usr/bin/env python
"""
.. module:: lcad_to_ldraw
:synopsis: Generates a ldraw format file from a lcad model.
.. moduleauthor:: Hazen Babcock
"""
import os
import sys
import lcad_language.interpreter as interpreter
if (len(sys.argv)<2):
print "usage: <lcad file> <ldraw file (optional)>"
exit()
# Gener... | #!/usr/bin/env python
"""
.. module:: lcad_to_ldraw
:synopsis: Generates a ldraw format file from a lcad model.
.. moduleauthor:: Hazen Babcock
"""
import os
import sys
import lcad_language.interpreter as interpreter
if (len(sys.argv)<2):
print "usage: <lcad file> <ldraw file (optional)>"
exit()
# Gener... |
Make plugin loader more robust | class PluginLoader:
def load(self, directory):
ret = []
for plugin in directory.children:
plugin_file = plugin.find(name=plugin.name, type='py')
if not plugin_file:
continue
plugin_class = plugin_file.classes[plugin.name]
... | class PluginLoader:
def load(self, directory):
ret = []
for plugin in directory.children:
plugin_file = plugin.find(name=plugin.name, type='py')
if not plugin_file:
continue
plugin_class = plugin_file.classes.get(plugin.name)
if n... |
Test that deprecation exceptions are working differently, after suggestion by @embray | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# test helper.run_tests function
import sys
from .. import helper
from ... import _get_test_runner
from .. helper import pytest
# run_tests sho... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# test helper.run_tests function
import warnings
from .. import helper
from ... import _get_test_runner
from .. helper import pytest
# run_test... |
Add util for generating named image file | import os
from django.core.files.base import ContentFile
from imagekit.lib import Image, StringIO
from .models import Photo
import pickle
def get_image_file():
"""
See also:
http://en.wikipedia.org/wiki/Lenna
http://sipi.usc.edu/database/database.php?volume=misc&image=12
"""
path = os.path... | import os
from django.core.files.base import ContentFile
from imagekit.lib import Image, StringIO
from tempfile import NamedTemporaryFile
from .models import Photo
import pickle
def _get_image_file(file_factory):
"""
See also:
http://en.wikipedia.org/wiki/Lenna
http://sipi.usc.edu/database/database... |
Make inbetween tag releases 'dev', not 'post'. | #!/usr/bin/env python
# Source: https://github.com/Changaco/version.py
from os.path import dirname, isdir, join
import re
from subprocess import CalledProcessError, check_output
PREFIX = ''
tag_re = re.compile(r'\btag: %s([0-9][^,]*)\b' % PREFIX)
version_re = re.compile('^Version: (.+)$', re.M)
def get_version():... | #!/usr/bin/env python
# Source: https://github.com/Changaco/version.py
from os.path import dirname, isdir, join
import re
from subprocess import CalledProcessError, check_output
PREFIX = ''
tag_re = re.compile(r'\btag: %s([0-9][^,]*)\b' % PREFIX)
version_re = re.compile('^Version: (.+)$', re.M)
def get_version():... |
Change back this file name to version | from .api import * # noqa
from .data import * # noqa
from .utils import * # noqa
from ._meta import __version__ # noqa
| from .api import * # noqa
from .data import * # noqa
from .utils import * # noqa
from .version import __version__ # noqa
|
Make Watch also a context manager | import asyncio
class Watch:
"""Represents an inotify watch as added by InotifyProtocol.watch()"""
def __init__(self, watch_descriptor, callback, protocol):
"""
:param int watch_descriptor: The watch descriptor as returned by inotify_add_watch
:param callback: A function with one posit... | import asyncio
class Watch:
"""Represents an inotify watch as added by InotifyProtocol.watch()"""
def __init__(self, watch_descriptor, callback, protocol):
"""
:param int watch_descriptor: The watch descriptor as returned by inotify_add_watch
:param callback: A function with one posit... |
Update label data to point at correct spots | import pandas as pd
import subprocess
import sys
import os
source = sys.argv[1]
dest = sys.argv[2]
labels = sys.argv[3]
df = pd.read_csv(labels)
df = df.fillna('EMPTY')
subprocess.call(['mkdir', '-p', dest])
for subjects in list(set(df.Subject)):
subject_list = subjects.split(', ')
for subject in subject_list:
... | import pandas as pd
import subprocess
import sys
import os
source = sys.argv[1]
dest = sys.argv[2]
labels = sys.argv[3]
df = pd.read_csv(labels)
df = df.fillna('EMPTY')
subprocess.call(['mkdir', '-p', dest])
for subjects in list(set(df.Subject)):
subject_list = subjects.split(', ')
for subject in subject_list:
... |
Add support for Django 1.10+ | from django.conf import settings
from django.db.models.aggregates import Sum
from django.db.models.sql.aggregates import Sum as BaseSQLSum
class SQLSum(BaseSQLSum):
@property
def sql_template(self):
if settings.DATABASES['default']['ENGINE'] == \
'django.db.backends.postgresql_psycopg2... | from django.conf import settings
from django.db.models.aggregates import Sum
class SQLSum(Sum):
@property
def sql_template(self):
if settings.DATABASES['default']['ENGINE'] == \
'django.db.backends.postgresql_psycopg2':
return '%(function)s(%(field)s::int)'
return '... |
Add id tot he beacon event dataset | # -*- coding: utf-8 -*-
'''
This package contains the loader modules for the salt streams system
'''
# Import salt libs
import salt.loader
class Beacon(object):
'''
This class is used to eveluate and execute on the beacon system
'''
def __init__(self, opts):
self.opts = opts
self.beaco... | # -*- coding: utf-8 -*-
'''
This package contains the loader modules for the salt streams system
'''
# Import salt libs
import salt.loader
class Beacon(object):
'''
This class is used to eveluate and execute on the beacon system
'''
def __init__(self, opts):
self.opts = opts
self.beaco... |
Make a default tree manager importable from the package. | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
from .mixins import BaseNestedSets
__version__ = "0.0.8"
__mixins__ = [BaseNestedSets]
| #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
from sqlalchemy.orm import mapper
from .mixins import BaseNestedSets
from .events import TreesManager
__version__ = "0.0.8"
__mixins__ = [BaseNestedSets]
__a... |
Add setting to turn of search indexes. | from fluent_pages.pagetypes.flatpage.models import FlatPage
from fluent_pages.pagetypes.fluentpage.models import FluentPage
from haystack import indexes
class FluentPageIndex(indexes.SearchIndex, indexes.Indexable):
"""
Search index for a fluent page.
"""
text = indexes.CharField(document=True, use_te... | from fluent_pages.pagetypes.flatpage.models import FlatPage
from fluent_pages.pagetypes.fluentpage.models import FluentPage
from haystack import indexes
from django.conf import settings
# Optional search indexes which can be used with the default FluentPage and FlatPage models.
if getattr(settings, 'ICEKIT_USE_SEARCH... |
Fix max elements in header | import falcon
import json
import rethinkdb as r
MAX_OFFERS = 100
class OfferListResource:
def __init__(self):
self._db = r.connect('localhost', 28015)
def on_get(self, req, resp):
"""Returns all offers available"""
try:
limit, page = map(int, (req.params.get('limit', MAX_O... | import falcon
import json
import rethinkdb as r
MAX_OFFERS = 100
class OfferListResource:
def __init__(self):
self._db = r.connect('localhost', 28015)
def on_get(self, req, resp):
"""Returns all offers available"""
try:
limit, page = map(int, (req.params.get('limit', MAX_O... |
Use standard three-digits for now | """
CI tools is a collection of small configurations aimed to ease setting up
complete CI system, targettet on django apps.
"""
VERSION = (0, 0, 1, 0)
__version__ = VERSION
__versionstr__ = '.'.join(map(str, VERSION))
| """
CI tools is a collection of small configurations aimed to ease setting up
complete CI system, targettet on django apps.
"""
VERSION = (0, 1, 0)
__version__ = VERSION
__versionstr__ = '.'.join(map(str, VERSION))
|
Update for stayput master and ensure forward compatibility | from jinja2 import Environment, FileSystemLoader
from stayput import Templater
class Jinja2Templater(Templater):
def __init__(self, site, *args, **kwargs):
self.site = site
self.env = Environment(loader=FileSystemLoader(site.templates_path))
def template(self, item):
return self.env... | from jinja2 import Environment, FileSystemLoader
from stayput import Templater
class Jinja2Templater(Templater):
def __init__(self, site, *args, **kwargs):
self.site = site
self.env = Environment(loader=FileSystemLoader(site.templates_path))
def template(self, item, site, *args, **kwargs):
... |
Use sort_keys=True for the ConsoleWritter pretty printing | import json
from exporters.writers.base_writer import BaseWriter, ItemsLimitReached
class ConsoleWriter(BaseWriter):
"""
It is just a writer with testing purposes. It prints every item in console.
"""
def __init__(self, options):
super(ConsoleWriter, self).__init__(options)
self.logg... | import json
from exporters.writers.base_writer import BaseWriter, ItemsLimitReached
class ConsoleWriter(BaseWriter):
"""
It is just a writer with testing purposes. It prints every item in console.
"""
def __init__(self, options):
super(ConsoleWriter, self).__init__(options)
self.logg... |
Copy reference object example. This commit is just implemented to validate the medhod. But this is not conveniant, because reference models must not be changed. So next step is to make them private attributes. | # coding=utf-8
import types
import config
class Driver(object):
def __init__(self):
self.driver_type = self.__class__.__name__
# Get credentials from conf files for CMDB
pass
def get_driver_type(self):
return self.driver_type
def get_ci(self,ci):
pass
d... | # coding=utf-8
import types
import pprint
import config
class Driver(object):
def __init__(self):
self.driver_type = self.__class__.__name__
# Get credentials from conf files for CMDB
pass
def get_driver_type(self):
return self.driver_type
def get_ci(self,ci):
... |
Remove kwargs["input_controller"] from the Game plugin template | from serpent.game import Game
from .api.api import MyGameAPI
from serpent.utilities import Singleton
from serpent.input_controller import InputControllers
from serpent.game_launchers.web_browser_game_launcher import WebBrowser
class SerpentGame(Game, metaclass=Singleton):
def __init__(self, **kwargs):
... | from serpent.game import Game
from .api.api import MyGameAPI
from serpent.utilities import Singleton
from serpent.game_launchers.web_browser_game_launcher import WebBrowser
class SerpentGame(Game, metaclass=Singleton):
def __init__(self, **kwargs):
kwargs["platform"] = "PLATFORM"
kwargs["wind... |
Fix exception message formatting in Python3 | # -*- coding: utf-8 -*-
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPo... | # -*- coding: utf-8 -*-
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPo... |
Add another newline before author/date info | # -*- coding: utf-8 -*-
__author__ = """John Kirkham"""
__email__ = "kirkhamj@janelia.hhmi.org"
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| # -*- coding: utf-8 -*-
__author__ = """John Kirkham"""
__email__ = "kirkhamj@janelia.hhmi.org"
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
|
Add a method for getting a list of releases to fetch | from __future__ import absolute_import
from __future__ import division
from xmlrpc2 import client as xmlrpc2
class BaseProcessor(object):
def __init__(self, index, *args, **kwargs):
super(BaseProcessor, self).__init__(*args, **kwargs)
self.index = index
self.client = xmlrpc2.Client(sel... | from __future__ import absolute_import
from __future__ import division
from xmlrpc2 import client as xmlrpc2
class BaseProcessor(object):
def __init__(self, index, *args, **kwargs):
super(BaseProcessor, self).__init__(*args, **kwargs)
self.index = index
self.client = xmlrpc2.Client(sel... |
Fix error: __str__ returned non-string (type NoneType) | from django.db import models
class Position(models.Model):
class Meta:
verbose_name = "Position"
verbose_name_plural = "Positions"
title = models.CharField(u'title',
blank=False,
default='',
help_text=u'Please enter a title for this position',
max_length=64,
... | from django.db import models
class Position(models.Model):
class Meta:
verbose_name = "Position"
verbose_name_plural = "Positions"
title = models.CharField(u'title',
blank=False,
default='',
help_text=u'Please enter a title for this position',
max_length=64,
... |
Allow adjusting of RoomHistoryEntry attributes in UserFactory | # -*- coding: utf-8 -*-
# Copyright (c) 2016 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.
import factory
from factory.faker import Faker
from pycroft.model.user import User, Roo... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 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.
import factory
from factory.faker import Faker
from pycroft.model.user import User, Roo... |
Add ytid to the ChannelAdmin. | from django.contrib import admin
from .models import Channel, Thumbnail, Video
class VideoInline(admin.StackedInline):
extra = 1
model = Video
class ThumbnailInline(admin.TabularInline):
extra = 1
model = Thumbnail
class ChannelAdmin(admin.ModelAdmin):
fieldsets = (
(None, {'fields': ... | from django.contrib import admin
from .models import Channel, Thumbnail, Video
class VideoInline(admin.StackedInline):
extra = 1
model = Video
class ThumbnailInline(admin.TabularInline):
extra = 1
model = Thumbnail
class ChannelAdmin(admin.ModelAdmin):
fieldsets = (
(None, {'fields': ... |
Fix widget registry exception handling code | __all__ = ('register_widget',)
from django.utils.translation import ugettext as _
class WidgetAlreadyRegistered(Exception):
"""
An attempt was made to register a widget for Django page CMS more
than once.
"""
pass
class WidgetNotFound(Exception):
"""
The requested widget was not found
... | __all__ = ('register_widget',)
from django.utils.translation import ugettext as _
class WidgetAlreadyRegistered(Exception):
"""
An attempt was made to register a widget for Django page CMS more
than once.
"""
pass
class WidgetNotFound(Exception):
"""
The requested widget was not found
... |
Load resources by absolute path not relative | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abstract import Abstract
from json import Json
from msgpack import MsgPack
__all__ = ['Abstract', 'Json', 'MsgPack']
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygrapes.serializer.abstract import Abstract
from pygrapes.serializer.json import Json
from pygrapes.serializer.msgpack import MsgPack
__all__ = ['Abstract', 'Json', 'MsgPack']
|
Revert "sudo is required to run which <gem-exec> on arch." | from fabric.api import env, run, sudo, settings, hide
# Default system user
env.user = 'ubuntu'
# Default puppet environment
env.environment = 'prod'
# Default puppet module directory
env.puppet_module_dir = 'modules/'
# Default puppet version
# If loom_puppet_version is None, loom installs the latest version
env.l... | from fabric.api import env, run, settings, hide
# Default system user
env.user = 'ubuntu'
# Default puppet environment
env.environment = 'prod'
# Default puppet module directory
env.puppet_module_dir = 'modules/'
# Default puppet version
# If loom_puppet_version is None, loom installs the latest version
env.loom_pu... |
Use None rather than -1 for Pandas | import json
from django.db import models
from model_utils.models import TimeStampedModel
class ParsedSOPN(TimeStampedModel):
"""
A model for storing the parsed data out of a PDF
"""
sopn = models.OneToOneField(
"official_documents.OfficialDocument", on_delete=models.CASCADE
)
raw_da... | import json
from django.db import models
from model_utils.models import TimeStampedModel
class ParsedSOPN(TimeStampedModel):
"""
A model for storing the parsed data out of a PDF
"""
sopn = models.OneToOneField(
"official_documents.OfficialDocument", on_delete=models.CASCADE
)
raw_da... |
Use get_include instead of get_numpy_include. | #!/usr/bin/env python
"""Install file for example on how to use Pyrex with Numpy.
For more details, see:
http://www.scipy.org/Cookbook/Pyrex_and_NumPy
http://www.scipy.org/Cookbook/ArrayStruct_and_Pyrex
"""
from distutils.core import setup
from distutils.extension import Extension
# Make this usable by people who do... | #!/usr/bin/env python
"""Install file for example on how to use Pyrex with Numpy.
For more details, see:
http://www.scipy.org/Cookbook/Pyrex_and_NumPy
http://www.scipy.org/Cookbook/ArrayStruct_and_Pyrex
"""
from distutils.core import setup
from distutils.extension import Extension
# Make this usable by people who do... |
Raise error specific to address checksum failure | from eth_utils import (
is_address,
is_checksum_address,
is_checksum_formatted_address,
is_dict,
is_list_like,
)
def validate_abi(abi):
"""
Helper function for validating an ABI
"""
if not is_list_like(abi):
raise ValueError("'abi' is not a list")
for e in abi:
... | from eth_utils import (
is_address,
is_checksum_address,
is_checksum_formatted_address,
is_dict,
is_list_like,
)
def validate_abi(abi):
"""
Helper function for validating an ABI
"""
if not is_list_like(abi):
raise ValueError("'abi' is not a list")
for e in abi:
... |
Change syntax to drop support | from datetime import datetime
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Comm... | from datetime import datetime
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Comment(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, rel... |
Replace deprecated login/logout function-based views | """
Map puzzle URLs to views. Also maps the root URL to the latest puzzle.
"""
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from puzzle import views
from puzzle.feeds import PuzzleFeed
urlpatterns = [ #pylint: disable=invalid-name
url(r'^$', views.latest, name='lat... | """
Map puzzle URLs to views. Also maps the root URL to the latest puzzle.
"""
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from puzzle import views
from puzzle.feeds import PuzzleFeed
urlpatterns = [ #pylint: disable=invalid-name
url(r'^$', views.latest, name='lat... |
Add configparser import to avoid windows packager error | # -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui
from UI.utilities.account_manager import AccountManager
from UI.mainUI import MainUI
from UI.initial_window import InitialWindowUI
if __name__ == "__main__":
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
app = QtGui.QAppli... | # -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui
from UI.utilities.account_manager import AccountManager
from UI.mainUI import MainUI
from UI.initial_window import InitialWindowUI
import configparser # needed for Windows package builder
if __name__ == "__main__":
QtCore.QCoreApplication.setAttr... |
Change DB to ip loopback from 'localhost' which doesn't work for some reason on halstead. | from base_settings import *
DEBUG = TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['pttrack.snhc.wustl.edu']
with open(os.path.join(BASE_DIR, 'secrets/secret_key.txt')) as f:
SECRET_KEY = f.read().strip()
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
# it would be nice to enable this, but we go w... | from base_settings import *
DEBUG = TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['pttrack.snhc.wustl.edu']
with open(os.path.join(BASE_DIR, 'secrets/secret_key.txt')) as f:
SECRET_KEY = f.read().strip()
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
# it would be nice to enable this, but we go w... |
Add a little bit of demo data to show what the list_orders view does | import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
DBSession,
Order,
)
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(ex... | import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
DBSession,
Order,
)
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(ex... |
Fix Login API implementation not parsing JSON POST data | import json
from flask import Blueprint, request
from flask.ext.login import current_user, logout_user, login_user
from flask.ext.restful import Api, Resource, abort
from server.models import Lecturer, db
auth = Blueprint('auth', __name__)
api = Api(auth)
class LoginResource(Resource):
def get(self):
... | import json
from flask import Blueprint, request
from flask.ext.login import current_user, logout_user, login_user
from flask.ext.restful import Api, Resource, abort, reqparse
from server.models import Lecturer, db
auth = Blueprint('auth', __name__)
api = Api(auth)
class LoginResource(Resource):
def get(self)... |
Update history capability for "Liberty Meadows" | from comics.aggregator.crawler import CreatorsCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Liberty Meadows"
language = "en"
url = "http://www.creators.com/comics/liberty-meadows.html"
start_date = "1997-03-30"
end_date = "2001-12-31"
righ... | from comics.aggregator.crawler import CreatorsCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Liberty Meadows"
language = "en"
url = "http://www.creators.com/comics/liberty-meadows.html"
start_date = "1997-03-30"
end_date = "2001-12-31"
righ... |
Set email max_length to 254 to conform with the model | from django.forms import Form, CharField, EmailField, ValidationError
from django.contrib.auth.models import User
class UserChangeForm(Form):
username = CharField(max_length=30, label='New username')
def clean(self):
cleaned_data = super(UserChangeForm, self).clean()
if User.objects.filter(u... | from django.forms import Form, CharField, EmailField, ValidationError
from django.contrib.auth.models import User
class UserChangeForm(Form):
username = CharField(max_length=30, label='New username')
def clean(self):
cleaned_data = super(UserChangeForm, self).clean()
if User.objects.filter(u... |
Make currency choices a tuple. | import moneyed
FFXOS_ACTIVITY_NAME = 'Submit FirefoxOS device price'
def get_currency_choices():
return sorted([(currency, data.name) for currency, data in moneyed.CURRENCIES.items()])
| import moneyed
FFXOS_ACTIVITY_NAME = 'Submit FirefoxOS device price'
def get_currency_choices():
return sorted(((currency, data.name) for currency, data in moneyed.CURRENCIES.items()))
|
Move Django and South to test requirements | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
from setuptools.command.test import test
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
class mytest(test):
... | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
from setuptools.command.test import test
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
class mytest(test):
... |
Fix issue - load README.md, not .rst | from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(name='borica',
version='0.0.1',
description=u"Python integration for Borica",
... | from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(name='borica',
version='0.0.1',
description=u"Python integration for Borica",
... |
Update name of vagrant module | #!/usr/bin/env python
from setuptools import setup
setup(
name = 'nepho',
version = '0.2.0',
url = 'http://github.com/huit/nepho',
description = 'Simplified cloud orchestration tool for constructing virtual data centers',
packages = ['nepho', 'nepho.aws'],
author ... | #!/usr/bin/env python
from setuptools import setup
setup(
name = 'nepho',
version = '0.2.0',
url = 'http://github.com/huit/nepho',
description = 'Simplified cloud orchestration tool for constructing virtual data centers',
packages = ['nepho', 'nepho.aws'],
author ... |
Update description to match readme | import os
from setuptools import setup
NAME = 'archivable'
PACKAGES = ['archivable']
DESCRIPTION = 'Archivable class-decorator for django models which supports uniqueness'
URL = "https://github.com/potatolondon/archivable"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = '... | import os
from setuptools import setup
NAME = 'archivable'
PACKAGES = ['archivable']
DESCRIPTION = 'A class-decorator for archivable django-models'
URL = "https://github.com/potatolondon/archivable"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = 'Potato London Ltd.'
EXT... |
Revert Auto Version (Versioning is now managed by CI) | from setuptools import setup
import re
import os
import requests
def get_pip_version(pkginfo_url):
pkginfo = requests.get(pkginfo_url).text
for record in pkginfo.split('\n'):
if record.startswith('Version'):
current_version = str(record).split(':',1)
return (current_version[1]).... | from setuptools import setup
setup(
name='taskcat',
packages=['taskcat'],
description='An OpenSource Cloudformation Deployment Framework',
author='Tony Vattathil, Santiago Cardenas, Shivansh Singh',
author_email='tonynv@amazon.com, sancard@amazon.com, sshvans@amazon.com',
url='https://aws-quicks... |
Include udiskie-mount in binary distribution | # encoding: utf-8
from distutils.core import setup
with open('README.rst') as readme:
long_description = readme.read()
setup(
name='udiskie',
version='0.4.2',
description='Removable disk automounter for udisks',
long_description=long_description,
author='Byron Clark',
author_email='byron@t... | # encoding: utf-8
from distutils.core import setup
with open('README.rst') as readme:
long_description = readme.read()
setup(
name='udiskie',
version='0.4.2',
description='Removable disk automounter for udisks',
long_description=long_description,
author='Byron Clark',
author_email='byron@t... |
Revert "fix import loop in local installation; update mne dependency version" | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup configuration."""
from setuptools import setup, find_packages
if __name__ == "__main__":
setup(
name='ephypype',
# version=VERSION,
version='0.1.dev0',
packages=find_packages(),
author=['David Meunier',
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup configuration."""
from setuptools import setup, find_packages
import ephypype
VERSION = ephypype.__version__
if __name__ == "__main__":
setup(
name='ephypype',
version=VERSION,
packages=find_packages(),
author=['David Meunier'... |
Add a simple log file to prevent double sending | from allauth.account.utils import send_email_confirmation
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test import RequestFactory
from frontend.models import User
class Command(BaseCommand):
"""Command to resend confirmation emails to unverified users with
... | from allauth.account.utils import send_email_confirmation
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test import RequestFactory
from frontend.models import User
class Command(BaseCommand):
"""Command to resend confirmation emails to unverified users with
... |
Update of version information in preparation for release of 0.1.2 | from setuptools import setup
setup(
name="ticket_auth",
version='0.1.1',
description='Ticket authentication system similar to mod_auth_tkt used by Apache',
packages=['ticket_auth'],
author='Gnarly Chicken',
author_email='gnarlychicken@gmx.com',
test_suite='tests',
url='https://github.c... | from setuptools import setup
setup(
name="ticket_auth",
version='0.1.2',
description='Ticket authentication system similar to mod_auth_tkt used by Apache',
packages=['ticket_auth'],
author='Gnarly Chicken',
author_email='gnarlychicken@gmx.com',
test_suite='tests',
url='https://github.c... |
Add long description for upload. | from __future__ import print_function
from setuptools import setup
from os.path import join, dirname, abspath
def main():
reqs_file = join(dirname(abspath(__file__)), 'requirements.txt')
with open(reqs_file) as f:
requirements = [req.strip() for req in f.readlines()]
setup(
name='pgconten... | from __future__ import print_function
from setuptools import setup
from os.path import join, dirname, abspath
import sys
long_description = ''
if 'upload' in sys.argv or '--long-description' in sys.argv:
with open('README.rst') as f:
long_description = f.read()
def main():
reqs_file = join(dirname(... |
Use globals for major bits of package data | from setuptools import setup
setup(
name='crm114',
version='2.0.2',
author='Brian Cline',
author_email='brian.cline@gmail.com',
description=('Python wrapper classes for the CRM-114 Discriminator '
'(http://crm114.sourceforge.net/)'),
license = 'MIT',
keywords = 'crm114 tex... | from setuptools import setup
VERSION = '2.0.2'
VERSION_TAG = 'v%s' % VERSION
README_URL = ('https://github.com/briancline/crm114-python'
'/blob/%s/README.md' % VERSION_TAG)
setup(
name='crm114',
version=VERSION,
author='Brian Cline',
author_email='brian.cline@gmail.com',
description=... |
Change dependency from PyODE to bindings included with ODE source. | import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='Yet another OpenGL-with-physics simulation framework',
long_descriptio... | import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='Yet another OpenGL-with-physics simulation framework',
long_descriptio... |
Remove pandoc, PyPi accepts markdown now | #!/usr/bin/env python
import chevron.metadata
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
import pypandoc
readme = pypandoc.convert('README.md', 'rest')
except (ImportError, RuntimeError):
print('\n\n!!!\npypandoc not loaded\n!!!\n')
readme = ''... | #!/usr/bin/env python
import chevron.metadata
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as f:
readme = f.read()
setup(name='chevron',
version=chevron.metadata.version,
license='MIT',
description='Mustache templating ... |
Test case failing for python3 removed | import sys
def parseCommandLine(argv):
print 'Inside parser'
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
| import sys
def parseCommandLine(argv):
return argv[1] if len(argv) > 1 else ""
if __name__ == "__main__":
latin = parseCommandLine(sys.argv)
print(latin)
print("igpay atinlay")
|
Update validation check for paper bundles. | #!/usr/bin/python3
from random import randint
class Student:
def __init__(self, id):
self.id = id
self.papers = []
def assign_paper(self, paper):
self.papers.append(paper)
def __str__(self):
return str(self.id) + ": " + str(self.papers)
class Paper:
def __init__(self, ... | #!/usr/bin/python3
from random import randint
class Student:
def __init__(self, id):
self.id = id
self.papers = []
def assign_paper(self, paper):
self.papers.append(paper)
def __str__(self):
return str(self.id) + ": " + str(self.papers)
class Paper:
def __init__(self, ... |
Fix typo in module docstring. | """ Tests fir go_cli.main. """
from unittest import TestCase
from click.testing import CliRunner
from go_cli.main import cli
class TestCli(TestCase):
def test_help(self):
runner = CliRunner()
result = runner.invoke(cli, ['--help'])
self.assertEqual(result.exit_code, 0)
self.asse... | """ Tests for go_cli.main. """
from unittest import TestCase
from click.testing import CliRunner
from go_cli.main import cli
class TestCli(TestCase):
def test_help(self):
runner = CliRunner()
result = runner.invoke(cli, ['--help'])
self.assertEqual(result.exit_code, 0)
self.asse... |
Add the source path to the modules .pri file | QT_DECLARATIVE_VERSION = $$QT_VERSION
QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.declarative.name = QtDeclarative
QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtDeclarative
QT.de... | QT_DECLARATIVE_VERSION = $$QT_VERSION
QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.declarative.name = QtDeclarative
QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtDeclarative
QT.de... |
Add public dependencies to .pri file | # Use when a .pro file requires libmaliit
# The .pro file must define TOP_DIR to be a relative path
# to the top-level source/build directory, and include config.pri
LIBS += $$TOP_DIR/lib/$$maliitDynamicLib($${MALIIT_GLIB_LIB})
POST_TARGETDEPS += $$TOP_DIR/lib/$$maliitDynamicLib($${MALIIT_GLIB_LIB})
INCLUDEPATH += $$T... | # Use when a .pro file requires libmaliit-glib
# The .pro file must define TOP_DIR to be a relative path
# to the top-level source/build directory, and include config.pri
LIBS += $$TOP_DIR/lib/$$maliitDynamicLib($${MALIIT_GLIB_LIB})
POST_TARGETDEPS += $$TOP_DIR/lib/$$maliitDynamicLib($${MALIIT_GLIB_LIB})
INCLUDEPATH +... |
Add recognizing of mouse gestures | HEADERS += view/editorview.h \
view/editorviewscene.h \
view/editorviewmviface.h
SOURCES += view/editorview.cpp \
view/editorviewscene.cpp \
view/editorviewmviface.cpp
| HEADERS += view/editorview.h \
view/editorviewscene.h \
view/editorviewmviface.h \
view/gestures/pathcorrector.h \
view/gestures/mousemovementmanager.h \
view/gestures/levenshteindistance.h \
view/gestures/keymanager.h \
view/gestures/IKeyManager.h
SOURCES += view/editorview.cpp \
view/... |
Fix compilation if no private headers are available | HEADERS += \
$$PWD/qmlengine.h \
$$PWD/canvasframerate.h \
SOURCES += \
$$PWD/qmlengine.cpp \
$$PWD/canvasframerate.cpp \
QT += declarative
FORMS +=
RESOURCES +=
| include(../../../private_headers.pri)
exists(${QT_PRIVATE_HEADERS}/QtDeclarative/private/qdeclarativecontext_p.h) {
HEADERS += \
$$PWD/qmlengine.h \
$$PWD/canvasframerate.h \
SOURCES += \
$$PWD/qmlengine.cpp \
$$PWD/canvasframerate.cpp \
QT += declarative
}
|
Set module sources to correct path. | QTX.core.MAJOR_VERSION = 0
QTX.core.MINOR_VERSION = 0
QTX.core.PATCH_VERSION = 0
QTX.core.VERSION = $${QTX.core.MAJOR_VERSION}.$${QTX.core.MINOR_VERSION}.$${QTX.core.PATCH_VERSION}
QTX.core.name = QtxCore
QTX.core.bins = $$PWD/../bin
QTX.core.includes = $$PWD/../include
QTX.core.sources = $$PWD/../src/version
QTX.core... | QTX.core.MAJOR_VERSION = 0
QTX.core.MINOR_VERSION = 0
QTX.core.PATCH_VERSION = 0
QTX.core.VERSION = $${QTX.core.MAJOR_VERSION}.$${QTX.core.MINOR_VERSION}.$${QTX.core.PATCH_VERSION}
QTX.core.name = QtxCore
QTX.core.bins = $$PWD/../bin
QTX.core.includes = $$PWD/../include
QTX.core.sources = $$PWD/../src/core
QTX.core.li... |
Add sv translation to TRANSLATIONS variable. | # Copyright (c) 2015 Piotr Tworek. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE.YTPlayer file.
TRANSLATIONS += \
languages/de_DE.ts \
languages/en_GB.ts \
languages/nl_NL.ts \
languages/ru_RU.ts
OTHER_FILES += lang... | # Copyright (c) 2015 Piotr Tworek. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE.YTPlayer file.
TRANSLATIONS += \
languages/de_DE.ts \
languages/en_GB.ts \
languages/nl_NL.ts \
languages/ru_RU.ts \
languages/... |
Add plugin directory to the exported directories | QTC_PLUGIN_NAME = QmlDesigner
QTC_LIB_DEPENDS += \
utils \
qmljs \
qmleditorwidgets
QTC_PLUGIN_DEPENDS += \
coreplugin \
texteditor \
qmljseditor \
qtsupport \
projectexplorer
INCLUDEPATH *= \
$$PWD/../../../share/qtcreator/qml/qmlpuppet/interfaces \
$$PWD/designercore \
$$PW... | QTC_PLUGIN_NAME = QmlDesigner
QTC_LIB_DEPENDS += \
utils \
qmljs \
qmleditorwidgets
QTC_PLUGIN_DEPENDS += \
coreplugin \
texteditor \
qmljseditor \
qtsupport \
projectexplorer
INCLUDEPATH *= \
$$PWD \
$$PWD/../../../share/qtcreator/qml/qmlpuppet/interfaces \
$$PWD/designercor... |
Add Qt config in pri | # QtSsh
HEADERS += \
$$PWD/qtssh/sshtunnelout.h \
$$PWD/qtssh/sshtunnelin.h \
$$PWD/qtssh/sshprocess.h \
$$PWD/qtssh/sshchannel.h \
$$PWD/qtssh/sshclient.h \
$$PWD/qtssh/sshtunneloutsrv.h \
$$PWD/qtssh/sshscpsend.h \
$$PWD/qtssh/sshscpget.h \
$$PWD/qtssh/sshsftp.h \
$$PWD/qtssh/s... | # QtSsh
QT += core network
HEADERS += \
$$PWD/qtssh/sshtunnelout.h \
$$PWD/qtssh/sshtunnelin.h \
$$PWD/qtssh/sshprocess.h \
$$PWD/qtssh/sshchannel.h \
$$PWD/qtssh/sshclient.h \
$$PWD/qtssh/sshtunneloutsrv.h \
$$PWD/qtssh/sshscpsend.h \
$$PWD/qtssh/sshscpget.h \
$$PWD/qts... |
Fix the naming for serviceframework. | QT.serviceframework.VERSION = 5.0.0
QT.serviceframework.MAJOR_VERSION = 5
QT.serviceframework.MINOR_VERSION = 0
QT.serviceframework.PATCH_VERSION = 0
QT.serviceframework.name = QtSystemInfo
QT.serviceframework.bins = $$QT_MODULE_BIN_BASE
QT.serviceframework.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/... | QT.serviceframework.VERSION = 5.0.0
QT.serviceframework.MAJOR_VERSION = 5
QT.serviceframework.MINOR_VERSION = 0
QT.serviceframework.PATCH_VERSION = 0
QT.serviceframework.name = QtServiceFramework
QT.serviceframework.bins = $$QT_MODULE_BIN_BASE
QT.serviceframework.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE... |
Make each module refer to its own bin/ | QT_DECLARATIVE_VERSION = $$QT_VERSION
QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.declarative.name = QtDeclarative
QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtDeclarative
QT.de... | QT_DECLARATIVE_VERSION = $$QT_VERSION
QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.declarative.name = QtDeclarative
QT.declarative.bins = $$QT_MODULE_BIN_BASE
QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $... |
Fix release build from QtCreator. | linux:QMAKE_CXXFLAGS += -isystem$${PWD}/thirdparty/rapidjson/include/
INCLUDEPATH += $${PWD}/thirdparty/rapidjson/include/
CONFIG(debug, debug|release) {
OUTPUT_DIR = ../Output/Debug
} else {
OUTPUT_DIR = ../Output/Release
}
OBJECTS_DIR = $${OUTPUT_DIR}/Obj
DESTDIR = $${OUTPUT_DIR}
QMAKE_CLEAN += Makefile*
... | linux:QMAKE_CXXFLAGS += -isystem$${PWD}/thirdparty/rapidjson/include/
INCLUDEPATH += $${PWD}/thirdparty/rapidjson/include/
CONFIG(release, debug|release) {
OUTPUT_DIR = ../Output/Release
} else {
OUTPUT_DIR = ../Output/Debug
}
OBJECTS_DIR = $${OUTPUT_DIR}/Obj
DESTDIR = $${OUTPUT_DIR}
QMAKE_CLEAN += Makefile*... |
Fix ut_minputcontextplugin not finding libmaliit-qt4.so | unittest_arguments += -graphicssystem raster
qws {
unittest_arguments += -qws
}
QMAKE_EXTRA_TARGETS += check
check.target = check
check.commands = \
TESTING_IN_SANDBOX=1 \
TESTPLUGIN_PATH=../plugins \
TESTDATA_PATH=$$IN_PWD \
LD_LIBRARY_PATH=../../connection:../../maliit-plugins-quick/input-method... | unittest_arguments += -graphicssystem raster
qws {
unittest_arguments += -qws
}
QMAKE_EXTRA_TARGETS += check
check.target = check
check.commands = \
TESTING_IN_SANDBOX=1 \
TESTPLUGIN_PATH=../plugins \
TESTDATA_PATH=$$IN_PWD \
LD_LIBRARY_PATH=../../connection:../../maliit-plugins-quick/input-method... |
Add MALIIT_PLUGINS_QUICK_FACTORY to legacy defines, too | MALIIT_PLUGINS = meego-im-plugins
MALIIT_SERVER = meego-im-uiserver
MALIIT_PLUGINS_LIB = meegoimframework
MALIIT_PLUGINS_HEADER = meegoimframework
MALIIT_PLUGINS_QUICK_LIB = meegoimquick
MALIIT_PLUGINS_QUICK_HEADER = meegoimquick
MALIIT_TEST_SUITE = meego-im-framework-tests
MALIIT_PACKAGENAME = meego-im-framework
MALII... | MALIIT_PLUGINS = meego-im-plugins
MALIIT_SERVER = meego-im-uiserver
MALIIT_PLUGINS_LIB = meegoimframework
MALIIT_PLUGINS_HEADER = meegoimframework
MALIIT_PLUGINS_QUICK_LIB = meegoimquick
MALIIT_PLUGINS_QUICK_HEADER = meegoimquick
MALIIT_PLUGINS_QUICK_FACTORY = meegoimquickfactory-$${MALIIT_PLUGINS_QUICK_INTERFACE_VERSI... |
Add 'README.md' to file list. | import qbs 1.0
import cutehmi
cutehmi.Tool {
name: "cutehmi_view"
major: 1
minor: 0
micro: 0
vendor: "CuteHMI"
friendlyName: "View"
description: "Client, GUI application, which allows one to run CuteHMI project in a window."
author: "Michal Policht"
copyright: "Michal Policht"
license: "Mozilla Pub... | import qbs 1.0
import cutehmi
cutehmi.Tool {
name: "cutehmi_view"
major: 1
minor: 0
micro: 0
vendor: "CuteHMI"
friendlyName: "View"
description: "Client, GUI application, which allows one to run CuteHMI project in a window."
author: "Michal Policht"
copyright: "Michal Policht"
license: "Mozilla Pub... |
Clean up; add warning for invalid call args | import QtQuick 2.0
Item {
Component {
id: compCaller
Timer {}
}
function queueCall() {
if (!arguments)
return
// first param fn, then just run it with args if any
if (typeof arguments[0] === 'function') {
var fn = arguments[0]
va... | import QtQuick 2.0
Item {
Component {
id: compCaller
Timer {}
}
function queueCall() {
if (!arguments)
return
const len = arguments.length
// check first param fn, run it with args if any
if (typeof arguments[0] === 'function') {
va... |
Fix enableExceptions autotest on Linux. | import qbs
CppApplication {
files: ["emptymain.cpp", "empty.m", "empty.mm"]
}
| import qbs
CppApplication {
files: ["emptymain.cpp"]
Group {
condition: qbs.targetOS.contains("darwin")
files: ["empty.m", "empty.mm"]
}
}
|
Add testcase for Q.resolved and Q.rejected | import QtQuick 2.0
import QtTest 1.0
import QuickPromise 1.0
TestCase {
name : "Promise_Resolved_Rejected"
function test_resolved() {
var promise = Q.resolved("blue");
wait(50);
compare(promise.hasOwnProperty("___promiseSignature___"), true);
compare(promise.isSettled, true);
... | |
Add some comments for doc generation | Rectangle {
property Object target;
property string updatePositionProperty: "currentIndex";
width: 100;
height: 100;
color: "#fff";
function _updatePos() {
var target = this.target
var item = target.getItemPosition(target[this.updatePositionProperty])
var horizontal = target.orientation === _globals.core.... | Rectangle {
property Object target; ///< target view for highlighter
property string updatePositionProperty: "currentIndex"; ///< which property must changed to update highlighter position
width: 100;
height: 100;
color: "#fff";
///@private
function _updatePos() {
var target = this.target
var item = target.... |
Add property for setting height according its content. | Item {
property string code;
property string language;
property Font font: Font {}
clip: true;
function _update(name, value) {
switch (name) {
case 'width': this._updateSize(); break
case 'height': this._updateSize(); break
case 'code': this._code.dom.innerHTML = value; window.hljs.highlightBlock(th... | Item {
property bool fitToContent: false;
property string code;
property string language;
property Font font: Font {}
clip: true;
function _update(name, value) {
switch (name) {
case 'width': this._updateSize(); break
case 'height': this._updateSize(); break
case 'code': this._code.dom.innerHTML = ... |
Fix the animate argument semantics | import QtQuick.Controls 1.0
ApplicationWindow {
id : appWindow
// for now, we are in landscape when using Controls
property bool inPortrait : appWindow.width < appWindow.height
//property bool inPortrait : false
//property alias initialPage : pageStack.initialItem
property alias pageStack : pa... | import QtQuick.Controls 1.0
ApplicationWindow {
id : appWindow
// for now, we are in landscape when using Controls
property bool inPortrait : appWindow.width < appWindow.height
//property bool inPortrait : false
//property alias initialPage : pageStack.initialItem
property alias pageStack : pa... |
Fix old reference to yubiKey.piv_change_puk | import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
import QtQuick.Controls.Material 2.2
ChangePinView {
breadcrumbs: [{
text: qsTr("PUK")
}, {
text: qsTr("Configure PINs")
}, {
text: qsTr("PUK")
}]
codeName: qsTr("PUK")
def... | import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
import QtQuick.Controls.Material 2.2
ChangePinView {
breadcrumbs: [{
text: qsTr("PUK")
}, {
text: qsTr("Configure PINs")
}, {
text: qsTr("PUK")
}]
codeName: qsTr("PUK")
def... |
Fix combo settings using non-string values | import QtQuick 2.12
import QtQuick.Controls 2.5
import ".."
Item {
id: root
signal changed(string value)
property string name
property var options
property var values: options
property Setting setting
property string currentValue: setting.value
implicitHeight: item.implicitHeight
... | import QtQuick 2.12
import QtQuick.Controls 2.5
import ".."
Item {
id: root
signal changed(string value)
property string name
property var options
property var values: options
property Setting setting
property var currentValue: setting.value
implicitHeight: item.implicitHeight
... |
Correct import values for UniqueValueRenderer Sample | // [WriteFile Name=Unique_Value_Renderer, Category=DisplayInformation]
// [Legal]
// Copyright 2016 Esri.
// 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/L... | // [WriteFile Name=Unique_Value_Renderer, Category=DisplayInformation]
// [Legal]
// Copyright 2016 Esri.
// 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/L... |
Support an object defn; add props from defn if not in loaded object (allows forward compatibility with configured objects) | import QtQuick 2.9
Item {
property alias items: lm
property string configKey: ''
property string outputStr: ''
function setEnabled(index, val) {
lm.setProperty(index, 'enabled', val)
lm.save()
}
BaseListModel {
id: lm
onRowsMoved: save()
onRowsRemoved:... | import QtQuick 2.9
Item {
property alias items: lm
property string configKey: ''
property string outputStr: ''
property var objectDef: []
function setEnabled(index, val) {
lm.setProperty(index, 'enabled', val)
lm.save()
}
BaseListModel {
id: lm
onRowsMoved... |
Remove hard coded windows size | /****************************************************************************
**
** Copyright (C) 2014 Alexander Rössler
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser Gene... | /****************************************************************************
**
** Copyright (C) 2014 Alexander Rössler
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser Gene... |
Make identical to non-simple example. | // Here, we implement "Scale to Fit" behaviour, using the
// preserveAspect property.
//
Image {
id: Image
source: "pics/face.png"
preserveAspect: true
}
| // Here, we implement "Scale to Fit" behaviour, using the
// preserveAspect property.
//
Rect {
// default size: whole image, unscaled
width: Image.width
height: Image.height
color: "gray"
clip: true
Image {
id: Image
source: "pics/face.png"
preserveAspect: true
... |
Fix issue with checkbox not toggling in a list item | import QtQuick 2.0
import ".."
View {
id: listItem
anchors {
left: parent.left
right: parent.right
}
property int margins: units.dp(16)
property bool selected
property int dividerInset: 0
property bool showDivider: false
signal triggered()
ThinDivider {
... | import QtQuick 2.0
import ".."
View {
id: listItem
anchors {
left: parent.left
right: parent.right
}
property int margins: units.dp(16)
property bool selected
property int dividerInset: 0
property bool showDivider: false
signal triggered()
ThinDivider {
... |
Fix assetCatalog test for macOS 11.* | import qbs.Utilities
Project {
condition: {
var result = qbs.targetOS.contains("macos");
if (!result)
console.info("Skip this test");
return result;
}
property bool includeIconset
CppApplication {
Depends { name: "ib" }
files: {
var filez... | import qbs.Utilities
Project {
condition: {
var result = qbs.targetOS.contains("macos");
if (!result)
console.info("Skip this test");
return result;
}
property bool includeIconset
CppApplication {
Depends { name: "ib" }
files: {
var filez... |
Use gnu99 standard for compiling linux specific files. | import qbs 1.0
Project {
name: "cjet"
minimumQbsVersion: "1.4.0"
qbsSearchPaths: "../qbs/"
CppApplication {
name: "cjet"
Depends { name: "generateConfig" }
Depends { name: "generateVersion" }
cpp.warningLevel: "all"
cpp.treatWarningsAsErrors: true
cpp.positionIndependentCode: false
... | import qbs 1.0
Project {
name: "cjet"
minimumQbsVersion: "1.4.0"
qbsSearchPaths: "../qbs/"
CppApplication {
name: "cjet"
Depends { name: "generateConfig" }
Depends { name: "generateVersion" }
cpp.warningLevel: "all"
cpp.treatWarningsAsErrors: true
cpp.positionIndependentCode: false
... |
Use FileDialog as FolderDialog is not available on Android | import QtQuick 2.12
import QtQuick.Controls 2.5
import Qt.labs.platform 1.1
Item {
id: root
property string name
property alias settingKey: setting.settingKey
property alias settingDefault: setting.settingDefault
implicitHeight: item.implicitHeight
Setting {
id: setting
}
Se... | import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.3
Item {
id: root
property string name
property alias settingKey: setting.settingKey
property alias settingDefault: setting.settingDefault
implicitHeight: item.implicitHeight
Setting {
id: setting
}
Set... |
Improve the person data extraction | import QtQuick 1.1
import org.kde.people 0.1
import org.kde.plasma.components 0.1
import org.kde.plasma.extras 0.1
Rectangle {
width: 100
height: 100
color: "red"
ListView {
id: view
anchors {
top: parent.top
bottom: parent.bottom
left: parent.le... | import QtQuick 1.1
import org.kde.people 0.1
import org.kde.plasma.components 0.1
import org.kde.plasma.extras 0.1
Rectangle {
width: 100
height: 100
color: "red"
ListView {
id: view
anchors {
top: parent.top
bottom: parent.bottom
left: parent.le... |
Use a less intimidating color and friendlier message in the cover when nothing has been entered yet. | import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow
{
id: appw
initialPage: sailFactorComponent
cover: Qt.resolvedUrl("cover/Cover.qml")
Component {
id: sailFactorComponent
SailFactor {
id: sailfactor
Component.onCompleted: appw._sailfa... | import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow
{
id: appw
initialPage: sailFactorComponent
cover: Qt.resolvedUrl("cover/Cover.qml")
Component {
id: sailFactorComponent
SailFactor {
id: sailfactor
Component.onCompleted: appw._sailfa... |
Improve styling of Firmware update window | // Copyright (c) 2015 Ultimaker B.V.
// Cura is released under the terms of the AGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
Rectangle
{
width: 300; height: 100
ColumnLayout
{
Text
{
text: {
if (manager.progress ... | // Copyright (c) 2015 Ultimaker B.V.
// Cura is released under the terms of the AGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Window 2.1
Rectangle
{
id: base;
width: 500 * Screen.devicePixelRatio;
height: 100 * Screen.devicePixelRatio;
color: palette.window;
si... |
Remove PageStackAction.Replace for about:config dialog. Fixes JB32873 | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Siteshwar Vashisht <siteshwar AT gmail.com>
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This So... | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Siteshwar Vashisht <siteshwar AT gmail.com>
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This So... |
Move the knob description up a bit | import QtQuick 2.0
Item {
id: knob
property string label: "color"
property real percentage: 0
width: scaleIndicator.width
height: labelText.y + labelText.height - scaleIndicator.y
Image {
id: knobBase
source: "../../resources/icons/btn.png"
anchors.centerIn: scaleIndic... | import QtQuick 2.0
Item {
id: knob
property string label: "color"
property real percentage: 0
width: scaleIndicator.width
height: labelText.y + labelText.height - scaleIndicator.y
Image {
id: knobBase
source: "../../resources/icons/btn.png"
anchors.centerIn: scaleIndic... |
Add hover cursor shape to category header | // Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.0 as UM
Button {
id: base;
Layout.preferredHeight: UM.Theme.sizes.section.height;
... | // Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.0 as UM
Button {
id: base;
Layout.preferredHeight: UM.Theme.sizes.section.height;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.