mirror of https://github.com/open-mmlab/mmcv.git
Replace `re` with `regex` (#457)
* replace `re` with `regex` * add regex in requirements * use regex on windows and re on linux * update requirements.txtpull/459/head
parent
66864d4abc
commit
9de04d2284
|
@ -1,8 +1,13 @@
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import platform
|
||||||
|
|
||||||
from .registry import PLUGIN_LAYERS
|
from .registry import PLUGIN_LAYERS
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
import regex as re
|
||||||
|
else:
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def infer_abbr(class_type):
|
def infer_abbr(class_type):
|
||||||
"""Infer abbreviation from the class name.
|
"""Infer abbreviation from the class name.
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import ast
|
import ast
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
import platform
|
import platform
|
||||||
import re
|
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -15,6 +14,11 @@ from yapf.yapflib.yapf_api import FormatCode
|
||||||
|
|
||||||
from .path import check_file_exist
|
from .path import check_file_exist
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
import regex as re
|
||||||
|
else:
|
||||||
|
import re
|
||||||
|
|
||||||
BASE_KEY = '_base_'
|
BASE_KEY = '_base_'
|
||||||
DELETE_KEY = '_delete_'
|
DELETE_KEY = '_delete_'
|
||||||
RESERVED_KEYS = ['filename', 'text', 'pretty_text']
|
RESERVED_KEYS = ['filename', 'text', 'pretty_text']
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
addict
|
addict
|
||||||
numpy
|
numpy
|
||||||
pyyaml
|
pyyaml
|
||||||
|
regex;sys_platform=='win32'
|
||||||
yapf
|
yapf
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import re
|
import platform
|
||||||
import tempfile
|
import tempfile
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
@ -7,6 +7,11 @@ import pytest
|
||||||
|
|
||||||
from mmcv import get_logger, print_log
|
from mmcv import get_logger, print_log
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
import regex as re
|
||||||
|
else:
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
@patch('torch.distributed.get_rank', lambda: 0)
|
@patch('torch.distributed.get_rank', lambda: 0)
|
||||||
@patch('torch.distributed.is_initialized', lambda: True)
|
@patch('torch.distributed.is_initialized', lambda: True)
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import platform
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
import torch.distributed as dist
|
import torch.distributed as dist
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
import regex as re
|
||||||
|
else:
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class TestSyncBN(object):
|
class TestSyncBN(object):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue