Python UML class Diagram

工具

  • Java

pyreverse

  • 类图制作工具

异常解决

Max Recursion Error 异常

  • 错误提示

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    ....
      File "/home/sawyer/miniconda3/envs/cde2/lib/python3.7/site-packages/astroid/decorators.py", line 111, in wrapped
        for res in _func(node, context, **kwargs):
      File "/home/sawyer/miniconda3/envs/cde2/lib/python3.7/site-packages/astroid/inference.py", line 481, in _filter_operation_errors
        for result in infer_callable(self, context):
      File "/home/sawyer/miniconda3/envs/cde2/lib/python3.7/site-packages/astroid/inference.py", line 769, in _infer_binop
        lhs_context = copy_context(context)
      File "/home/sawyer/miniconda3/envs/cde2/lib/python3.7/site-packages/astroid/context.py", line 188, in copy_context
        return context.clone()
    RecursionError: maximum recursion depth exceeded
  • 解决方法

    • 提高 递归限制

      • 修改文件 ~/miniconda/envs/py38/bin/pyreverse
      • 添加代码

lsp -- Emacs lsp client usage

lsp-java

  • jdtls 安装

    1. lsp-install-server 命令
    2. 手动安装

  • eglot 配置

    • M-x eglot
    • 输入 jdtls 项目根目录

      • eg: e:/programs/jdtls/
    • 我的配置

      • eg:

         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        
        (use-package eglot
          :ensure t
          :config
          (defconst my/jdtls-project-root (expand-file-name (concat user-emacs-directory ".cache/lsp/eclipse.jdt.ls/")))
          (defconst my/jdtls-jar-file-pattern "^org\.eclipse\.equinox\.launcher_[1-9].*\.jar$")
        
          (defun my/jdtls-find-executable-jar-file (dir file-pattern)
            (car (directory-files-recursively dir file-pattern)))
        
          (defun my/eclipse-jdt-contact (interactive)
            (let ((cp (getenv "CLASSPATH"))
                  (path_seprator ":"))
              (if (eq system-type 'windows-nt)
                  (setq path_seprator ";"))
              (setenv "CLASSPATH" (concat cp path_seprator (my/jdtls-find-executable-jar-file my/jdtls-project-root my/jdtls-jar-file-pattern)))
              (message (getenv "CLASSPATH"))
              (unwind-protect
                  (eglot--eclipse-jdt-contact nil)
                (setenv "CLASSPATH" cp))))
        
          (setcdr (assq 'java-mode eglot-server-programs) #'my/eclipse-jdt-contact)
          (add-hook 'java-mode-hook 'eglot-ensure)
          )
  • lsp-mode 配置

Efficient Cpp

unordered_map

查找

  • map.find(key) != map.end() 快于 map.get(key)

Efficient Python

dict

查找

  • 速度

    • key in our_dict > our_dict[key] > our_dict.get(key)
      • in: 查找 key 更快
      • [] 下标索引 优于 dict.get() 索引
      • dic.get() 具有安全保护,背后逻辑更耗时