Replace `re` with `regex` (#457)

* replace `re` with `regex`

* add regex in requirements

* use regex on windows and re on linux

* update requirements.txt
pull/459/head
Jintao Lin 2020-08-03 11:45:50 +08:00 committed by GitHub
parent 66864d4abc
commit 9de04d2284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 4 deletions

View File

@ -1,8 +1,13 @@
import inspect
import re
import platform
from .registry import PLUGIN_LAYERS
if platform.system() == 'Windows':
import regex as re
else:
import re
def infer_abbr(class_type):
"""Infer abbreviation from the class name.

View File

@ -2,7 +2,6 @@
import ast
import os.path as osp
import platform
import re
import shutil
import sys
import tempfile
@ -15,6 +14,11 @@ from yapf.yapflib.yapf_api import FormatCode
from .path import check_file_exist
if platform.system() == 'Windows':
import regex as re
else:
import re
BASE_KEY = '_base_'
DELETE_KEY = '_delete_'
RESERVED_KEYS = ['filename', 'text', 'pretty_text']

View File

@ -1,4 +1,5 @@
addict
numpy
pyyaml
regex;sys_platform=='win32'
yapf

View File

@ -1,5 +1,5 @@
import logging
import re
import platform
import tempfile
from unittest.mock import patch
@ -7,6 +7,11 @@ import pytest
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.is_initialized', lambda: True)

View File

@ -1,11 +1,16 @@
import os
import re
import platform
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
if platform.system() == 'Windows':
import regex as re
else:
import re
class TestSyncBN(object):