• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SwissDataScienceCenter / renku-python / 4145649460

pending completion
4145649460

push

github-actions

GitHub
Merge branch 'develop' into allow-ref-target-for-release-action

25096 of 28903 relevant lines covered (86.83%)

4.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.86
/renku/ui/service/utils/json_encoder.py
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright 2020 - Swiss Data Science Center (SDSC)
4
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
5
# Eidgenössische Technische Hochschule Zürich (ETHZ).
6
#
7
# Licensed under the Apache License, Version 2.0 (the "License");
8
# you may not use this file except in compliance with the License.
9
# You may obtain a copy of the License at
10
#
11
#     http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS,
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
# See the License for the specific language governing permissions and
17
# limitations under the License.
18
"""Renku service response json encoder."""
4✔
19
from datetime import datetime
4✔
20

21
from flask.json import JSONEncoder
4✔
22
from marshmallow.utils import isoformat
4✔
23

24

25
class SvcJSONEncoder(JSONEncoder):
4✔
26
    """Custom service json encoder."""
27

28
    def default(self, obj):
4✔
29
        """Overrides default json encoder with datetime iso format."""
30
        try:
×
31
            if isinstance(obj, datetime):
×
32
                return isoformat(obj)
×
33
            iterable = iter(obj)
×
34
        except TypeError:
×
35
            pass
×
36
        else:
37
            return list(iterable)
×
38
        return JSONEncoder.default(self, obj)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc