Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2285

Fix formatting issues following the upgrade to Black 20.8b1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.4.4
    • Fix Version/s: 4.4.5
    • Component/s: Framework

      Description

      Fox formatting issues following the upgrade to Black 20.8b1:

      2020-08-27T09:34:49.0475576Z style run-test: commands[1] | python -m black --check --diff nxdrive
      2020-08-27T09:34:49.6025909Z --- nxdrive/client/local/darwin.py	2020-08-27 09:33:58.836281 +0000
      2020-08-27T09:34:49.6026787Z +++ nxdrive/client/local/darwin.py	2020-08-27 09:34:49.589684 +0000
      2020-08-27T09:34:49.6027266Z @@ -68,15 +68,15 @@
      2020-08-27T09:34:49.6027589Z              if exc.errno not in (errno.ENODATA, errno.EPROTONOSUPPORT):
      2020-08-27T09:34:49.6027884Z                  raise exc
      2020-08-27T09:34:49.6028144Z  
      2020-08-27T09:34:49.6028622Z      def set_folder_icon(self, ref: Path, icon: Path) -> None:
      2020-08-27T09:34:49.6029158Z          """Create a special file to customize the folder icon.
      2020-08-27T09:34:49.6029665Z -            1. Read the com.apple.ResourceFork extended attribute from the icon file
      2020-08-27T09:34:49.6030202Z -            2. Set the com.apple.FinderInfo extended attribute with folder icon flag
      2020-08-27T09:34:49.6030735Z -            3. Create a Icon file (name: Icon\r) inside the target folder
      2020-08-27T09:34:49.6031309Z -            4. Set extended attributes com.apple.FinderInfo & com.apple.ResourceFork for icon file (name: Icon\r)
      2020-08-27T09:34:49.6031806Z -            5. Hide the icon file (name: Icon\r)
      2020-08-27T09:34:49.6032109Z +        1. Read the com.apple.ResourceFork extended attribute from the icon file
      2020-08-27T09:34:49.6032397Z +        2. Set the com.apple.FinderInfo extended attribute with folder icon flag
      2020-08-27T09:34:49.6032682Z +        3. Create a Icon file (name: Icon\r) inside the target folder
      2020-08-27T09:34:49.6032980Z +        4. Set extended attributes com.apple.FinderInfo & com.apple.ResourceFork for icon file (name: Icon\r)
      2020-08-27T09:34:49.6033267Z +        5. Hide the icon file (name: Icon\r)
      2020-08-27T09:34:49.6033534Z          """
      2020-08-27T09:34:49.6033808Z          log.debug(f"Setting the folder icon of {ref!r} using {icon!r}")
      2020-08-27T09:34:49.6034358Z  
      2020-08-27T09:34:49.6034625Z          target_folder = self.abspath(ref)
      2020-08-27T09:34:49.6034876Z  
      2020-08-27T09:34:49.6035349Z would reformat nxdrive/client/local/darwin.py
      2020-08-27T09:34:50.0347016Z --- nxdrive/client/uploader/direct_transfer.py	2020-08-27 09:33:58.836281 +0000
      2020-08-27T09:34:50.0347834Z +++ nxdrive/client/uploader/direct_transfer.py	2020-08-27 09:34:50.032000 +0000
      2020-08-27T09:34:50.0349110Z @@ -107,8 +107,9 @@
      2020-08-27T09:34:50.0349321Z          return item
      2020-08-27T09:34:50.0349469Z  
      2020-08-27T09:34:50.0350079Z      def upload_folder(self, **kwargs: Any) -> Dict[str, Any]:
      2020-08-27T09:34:50.0368654Z          """Create a folder using the FileManager."""
      2020-08-27T09:34:50.0369020Z          res: Dict[str, Any] = self.remote.execute(
      2020-08-27T09:34:50.0369720Z -            command="FileManager.CreateFolder", **kwargs,
      2020-08-27T09:34:50.0370009Z +            command="FileManager.CreateFolder",
      2020-08-27T09:34:50.0370219Z +            **kwargs,
      2020-08-27T09:34:50.0370367Z          )
      2020-08-27T09:34:50.0370627Z          return res
      2020-08-27T09:34:50.0370810Z would reformat nxdrive/client/uploader/direct_transfer.py
      2020-08-27T09:34:52.6099290Z --- nxdrive/feature.py	2020-08-27 09:33:58.852281 +0000
      2020-08-27T09:34:52.6099998Z +++ nxdrive/feature.py	2020-08-27 09:34:52.606887 +0000
      2020-08-27T09:34:52.6100299Z @@ -21,11 +21,14 @@
      2020-08-27T09:34:52.6100567Z  """
      2020-08-27T09:34:52.6100736Z  from types import SimpleNamespace
      2020-08-27T09:34:52.6101337Z  from typing import List
      2020-08-27T09:34:52.6101790Z  
      2020-08-27T09:34:52.6101987Z  Feature = SimpleNamespace(
      2020-08-27T09:34:52.6102749Z -    auto_update=True, direct_edit=True, direct_transfer=False, s3=False,
      2020-08-27T09:34:52.6102917Z +    auto_update=True,
      2020-08-27T09:34:52.6103080Z +    direct_edit=True,
      2020-08-27T09:34:52.6103202Z +    direct_transfer=False,
      2020-08-27T09:34:52.6103339Z +    s3=False,
      2020-08-27T09:34:52.6103469Z  )
      2020-08-27T09:34:52.6103626Z  
      2020-08-27T09:34:52.6103762Z  Beta: List[str] = ["direct_transfer", "s3"]
      2020-08-27T09:34:52.6103900Z  
      2020-08-27T09:34:52.6104034Z  DisabledFeatures: List[str] = []
      2020-08-27T09:34:52.6113219Z would reformat nxdrive/feature.py
      2020-08-27T09:34:53.6470587Z --- nxdrive/gui/api.py	2020-08-27 09:33:58.852281 +0000
      2020-08-27T09:34:53.6471440Z +++ nxdrive/gui/api.py	2020-08-27 09:34:53.643416 +0000
      2020-08-27T09:34:53.6475358Z @@ -505,13 +505,13 @@
      2020-08-27T09:34:53.6475713Z      @pyqtSlot(str, str, int, result=list)
      2020-08-27T09:34:53.6475984Z      def get_disk_space_info_to_width(
      2020-08-27T09:34:53.6476269Z          self, uid: str, path: str, width: int
      2020-08-27T09:34:53.6476690Z      ) -> List[float]:
      2020-08-27T09:34:53.6476969Z          """Return a list:
      2020-08-27T09:34:53.6477450Z -            - Size of free space converted to percentage of the width.
      2020-08-27T09:34:53.6478001Z -            - Size of space used by other applications converted to percentage of the width.
      2020-08-27T09:34:53.6478562Z -            - Global size of synchronized files converted to percentage of the width.
      2020-08-27T09:34:53.6479063Z +        - Size of free space converted to percentage of the width.
      2020-08-27T09:34:53.6479594Z +        - Size of space used by other applications converted to percentage of the width.
      2020-08-27T09:34:53.6480220Z +        - Global size of synchronized files converted to percentage of the width.
      2020-08-27T09:34:53.6480807Z          """
      2020-08-27T09:34:53.6481011Z          engine = self._manager.engines.get(uid)
      2020-08-27T09:34:53.6481163Z  
      2020-08-27T09:34:53.6481365Z          synced = engine.dao.get_global_size() if engine else 0
      2020-08-27T09:34:53.6481531Z          used, free = disk_space(path)
      2020-08-27T09:34:53.6481658Z would reformat nxdrive/gui/api.py
      2020-08-27T09:34:54.7822832Z --- nxdrive/manager.py	2020-08-27 09:33:58.852281 +0000
      2020-08-27T09:34:54.7823787Z +++ nxdrive/manager.py	2020-08-27 09:34:54.778763 +0000
      2020-08-27T09:34:54.7824336Z @@ -221,11 +221,13 @@
      2020-08-27T09:34:54.7825004Z          self.notification_service.init_signals()
      2020-08-27T09:34:54.7825349Z          self.load()
      2020-08-27T09:34:54.7825672Z  
      2020-08-27T09:34:54.7826131Z          # [this worker will control next workers, so keep it first]
      2020-08-27T09:34:54.7826751Z          # Create the server's configuration getter verification thread
      2020-08-27T09:34:54.7827359Z -        self.server_config_updater: ServerOptionsUpdater = self._create_server_config_updater()
      2020-08-27T09:34:54.7827749Z +        self.server_config_updater: ServerOptionsUpdater = (
      2020-08-27T09:34:54.7828097Z +            self._create_server_config_updater()
      2020-08-27T09:34:54.7828428Z +        )
      2020-08-27T09:34:54.7828745Z  
      2020-08-27T09:34:54.7829074Z          # Create Direct Edit
      2020-08-27T09:34:54.7829417Z          self.autolock_service = self._create_autolock_service()
      2020-08-27T09:34:54.7829773Z          self.direct_edit = self._create_direct_edit()
      2020-08-27T09:34:54.7830101Z  
      2020-08-27T09:34:54.7837464Z would reformat nxdrive/manager.py
      2020-08-27T09:34:54.8898481Z --- nxdrive/osi/darwin/pyNotificationCenter.py	2020-08-27 09:33:58.856282 +0000
      2020-08-27T09:34:54.8899468Z +++ nxdrive/osi/darwin/pyNotificationCenter.py	2020-08-27 09:34:54.888405 +0000
      2020-08-27T09:34:54.8900030Z @@ -59,18 +59,18 @@
      2020-08-27T09:34:54.8900401Z      info_text: str,
      2020-08-27T09:34:54.8900742Z      delay: int = 0,
      2020-08-27T09:34:54.8901078Z      sound: bool = False,
      2020-08-27T09:34:54.8901487Z      user_info: Dict[str, str] = None,
      2020-08-27T09:34:54.8901976Z  ) -> None:
      2020-08-27T09:34:54.8902553Z -    """ Python method to show a desktop notification on Mountain Lion. Where:
      2020-08-27T09:34:54.8903107Z -        title: Title of notification
      2020-08-27T09:34:54.8903646Z -        subtitle: Subtitle of notification
      2020-08-27T09:34:54.8904200Z -        info_text: Informative text of notification
      2020-08-27T09:34:54.8904774Z -        delay: Delay (in seconds) before showing the notification
      2020-08-27T09:34:54.8905315Z -        sound: Play the default notification sound
      2020-08-27T09:34:54.8905931Z -        userInfo: a dictionary that can be used to handle clicks in your
      2020-08-27T09:34:54.8906536Z -                  app's applicationDidFinishLaunching:aNotification method
      2020-08-27T09:34:54.8906925Z +    """Python method to show a desktop notification on Mountain Lion. Where:
      2020-08-27T09:34:54.8907277Z +    title: Title of notification
      2020-08-27T09:34:54.8907612Z +    subtitle: Subtitle of notification
      2020-08-27T09:34:54.8907951Z +    info_text: Informative text of notification
      2020-08-27T09:34:54.8908293Z +    delay: Delay (in seconds) before showing the notification
      2020-08-27T09:34:54.8908636Z +    sound: Play the default notification sound
      2020-08-27T09:34:54.8908983Z +    userInfo: a dictionary that can be used to handle clicks in your
      2020-08-27T09:34:54.8909549Z +              app's applicationDidFinishLaunching:aNotification method
      2020-08-27T09:34:54.8909917Z      """
      2020-08-27T09:34:54.8910257Z      notification = NSUserNotification.alloc().init()
      2020-08-27T09:34:54.8910605Z      notification.setTitle_(title)
      2020-08-27T09:34:54.8910932Z      notification.setSubtitle_(subtitle)
      2020-08-27T09:34:54.8911278Z      notification.setInformativeText_(info_text)
      2020-08-27T09:34:54.8920812Z would reformat nxdrive/osi/darwin/pyNotificationCenter.py
      2020-08-27T09:34:55.8319785Z --- nxdrive/osi/linux/linux.py	2020-08-27 09:33:58.856282 +0000
      2020-08-27T09:34:55.8321571Z +++ nxdrive/osi/linux/linux.py	2020-08-27 09:34:55.071174 +0000
      2020-08-27T09:34:55.8322067Z @@ -151,12 +151,12 @@
      2020-08-27T09:34:55.8322353Z          except Exception:
      2020-08-27T09:34:55.8322651Z              log.warning(f"Could not set the {emblem} emblem on {path!r}", exc_info=True)
      2020-08-27T09:34:55.8322943Z  
      2020-08-27T09:34:55.8323392Z      def _icons_to_emblems(self) -> None:
      2020-08-27T09:34:55.8323675Z          """
      2020-08-27T09:34:55.8324140Z -            Copy nuxeo overlay icons to linux local icons folder.
      2020-08-27T09:34:55.8324614Z -            Previous local icons will be replaced.
      2020-08-27T09:34:55.8325191Z +        Copy nuxeo overlay icons to linux local icons folder.
      2020-08-27T09:34:55.8325565Z +        Previous local icons will be replaced.
      2020-08-27T09:34:55.8325996Z          """
      2020-08-27T09:34:55.8326215Z          shared_icons = Path.home() / ".local/share/icons"
      2020-08-27T09:34:55.8326402Z          shared_icons.mkdir(parents=True, exist_ok=True)
      2020-08-27T09:34:55.8326558Z  
      2020-08-27T09:34:55.8326708Z          statuses = ["synced", "syncing", "conflicted", "error", "locked", "unsynced"]
      2020-08-27T09:34:55.8326886Z would reformat nxdrive/osi/linux/linux.py
      2020-08-27T09:34:55.8327518Z Oh no! 💥 💔 💥
      2020-08-27T09:34:55.8327678Z 7 files would be reformatted, 70 files would be left unchanged.
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 10 minutes
                  10m