Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG-37774 Remove Python 2 #19

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
- id: trailing-whitespace
# Leave black at the bottom so all touchups are done before it is run.
- repo: https://github.com/ambv/black
rev: 19.10b0
rev: 22.3.0
hooks:
- id: black
language_version: python3
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![VFX Platform](https://img.shields.io/badge/vfxplatform-2024%20%7C%202023%20%7C%202022%20%7C%202021-blue.svg)](http://www.vfxplatform.com/)
[![Python](https://img.shields.io/badge/python-3.11%20%7C%203.10%20%7C%203.9%20%7C%203.7-blue.svg)](https://www.python.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Linting](https://img.shields.io/badge/PEP8%20by-Hound%20CI-a873d1.svg)](https://houndci.com)

## Documentation
This repository is a part of the Flow Production Tracking Toolkit.
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ variables:
jobs:
- template: build-pipeline.yml@templates
parameters:
has_unit_tests: false
has_unit_tests: true
4 changes: 2 additions & 2 deletions python/edl/edl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EditProcessor(object):
"""

def __init__(self, shot_regexp=None):
super(EditProcessor, self).__init__()
super().__init__()
self._previous_edit = None
self._shot_regexp = shot_regexp

Expand Down Expand Up @@ -579,7 +579,7 @@ def read_cmx_edl(self, path, fps=24, visitor=None):
self._edits = []
# And read the file
self.__logger.info("Parsing EDL %s" % path)
with open(path, "rU") as handle:
with open(path, "r", encoding="utf-8") as handle:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it fails on CI Windows.

edit = None
id_offset = 0
try:
Expand Down
14 changes: 5 additions & 9 deletions python/edl/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def __init__(self, frame_value, frame_rate, *args, **kwargs):
:param frame_rate: An integer, the frame rate for which the frame value
caused the error.
"""
super(BadFrameRateError, self).__init__(
self.__ERROR_MSG % (frame_value, frame_rate), *args, **kwargs
)
super().__init__(self.__ERROR_MSG % (frame_value, frame_rate), *args, **kwargs)
# Store value internally, in case some apps want to retrieve them
self._frame_value = frame_value
self._frame_rate = frame_rate
Expand Down Expand Up @@ -80,7 +78,7 @@ def __init__(self, timecode_str, drop_frame, valid_delimiters, *args, **kwargs):
with timecode string format.
:param valid_delimiters: List of valid delimiters for drop frame notation.
"""
super(BadDropFrameError, self).__init__(
super().__init__(
self.__ERROR_MSG % (timecode_str, drop_frame, valid_delimiters),
*args,
**kwargs
Expand Down Expand Up @@ -133,9 +131,7 @@ def __init__(self, edl_name, *args, **kwargs):

:param edl_name: A string, the EDL file name.
"""
super(UnsupportedEDLFeature, self).__init__(
self._error_message() % edl_name, *args, **kwargs
)
super().__init__(self._error_message() % edl_name, *args, **kwargs)

def _error_message(self):
"""
Expand All @@ -157,7 +153,7 @@ class BadBLError(UnsupportedEDLFeature):
"""

def _error_message(self):
""""
"""
Return a standard error message to use as the exception message.

:returns: A string
Expand All @@ -172,7 +168,7 @@ class BadFCMError(UnsupportedEDLFeature):
"""

def _error_message(self):
""""
"""
Return a standard error message to use as the exception message.

:returns: A string
Expand Down
2 changes: 1 addition & 1 deletion python/edl/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, framework, *args, **kwargs):

:param framework: A Toolkit framework
"""
super(FrameworkLogHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._framework = framework

def emit(self, record):
Expand Down
2 changes: 0 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Readme for Editorial framework tests

Required packages
-----------------
* unittest2
* mock
* coverage (only if coverage option is used)

Running the test suite
Expand Down
7 changes: 3 additions & 4 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
from __future__ import print_function
import sys
import os
from optparse import OptionParser
import unittest2 as unittest
import unittest
import logging

logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -38,9 +37,9 @@ def __init__(self):
def setup_suite(self, test_name):
# args used to specify specific module.TestCase.test
if test_name:
self.suite = unittest.loader.TestLoader().loadTestsFromName(test_name)
self.suite = unittest.TestLoader().loadTestsFromName(test_name)
else:
self.suite = unittest.loader.TestLoader().discover(self.test_path)
self.suite = unittest.TestLoader().discover(self.test_path)

def run_tests_with_coverage(self, test_name):
import coverage
Expand Down
23 changes: 16 additions & 7 deletions tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
import os
import decimal
import unittest2 as unittest
import os
import sys
import unittest
import logging
import re

repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, os.path.join(repo_root, "python"))
carlos-villavicencio-adsk marked this conversation as resolved.
Show resolved Hide resolved

from edl import edl
from edl import (
timecode,
Expand All @@ -16,13 +23,11 @@
BadFrameRateError,
BadFCMError,
)
import logging
import re


class TestRead(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestRead, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._edl_examples = []
self._unsupported_examples = []
self._resources_dir = None
Expand Down Expand Up @@ -152,7 +157,10 @@ def test_advanced_visitor(self):
# Check we are able to extract expected information from a well known
# example
path = os.path.join(self._multiple_tests_dir, "scan_request_test.edl")
tc = edl.EditList(file_path=path, visitor=self.advanced_visitor,)
tc = edl.EditList(
file_path=path,
visitor=self.advanced_visitor,
)
for edit in tc.edits:
self.assertIsNotNone(edit._shot_name)
self.assertIsNotNone(edit._name)
Expand Down Expand Up @@ -302,7 +310,8 @@ def test_accessor_overrides(self):
with self.assertRaises(AttributeError) as cm:
for f in self._edl_examples:
edl.EditList(
file_path=f, visitor=self.failing_property_override,
file_path=f,
visitor=self.failing_property_override,
)

def test_tc_round_trip(self):
Expand Down