# Buggy code
def __init__(self, tokens, settings):
    self.settings = settings
    self.tokens = list(tokens)
    self.filtered_tokens = [t for t in self.tokens if t[1] <= 1]

    self.unset_tokens = []

    self.day = None
    self.month = None
    self.year = None
    self.time = None

    self.auto_order = []

    self._token_day = None
    self._token_month = None
    self._token_year = None
    self._token_time = None

    self.ordered_num_directives = OrderedDict(
        (k, self.num_directives[k])
        for k in (resolve_date_order(settings.DATE_ORDER, lst=True))
    )

    skip_index = []
    skip_component = None
    for index, token_type in enumerate(self.filtered_tokens):
        if index in skip_index:
            continue

        token, type = token_type

        if token in settings.SKIP_TOKENS_PARSER:
            continue

        if self.time is None:
            try:
                microsecond = MICROSECOND.search(
                    self.filtered_tokens[index + 1][0]
                ).group()
                _is_after_time_token = token.index(":")
                _is_after_period = self.tokens[self.tokens.index((token, 0)) + 1][
                    0
                ].index(".")
            except:
                microsecond = None

            if microsecond:
                mindex = index + 2
            else:
                mindex = index + 1

            try:
                meridian = MERIDIAN.search(self.filtered_tokens[mindex][0]).group()
            except:
                meridian = None

            if any([":" in token, meridian, microsecond]):
                if meridian and not microsecond:
                    self._token_time = "%s %s" % (token, meridian)
                    skip_index.append(mindex)
                elif microsecond and not meridian:
                    self._token_time = "%s.%s" % (token, microsecond)
                    skip_index.append(index + 1)
                elif meridian and microsecond:
                    self._token_time = "%s.%s %s" % (token, microsecond, meridian)
                    skip_index.append(index + 1)
                    skip_index.append(mindex)
                else:
                    self._token_time = token
                self.time = lambda: time_parser(self._token_time)
                continue

        results = self._parse(
            type, token, settings.FUZZY, skip_component=skip_component
        )
        for res in results:
            if len(token) == 4 and res[0] == "year":
                skip_component = "year"
            setattr(self, *res)

    known, unknown = get_unresolved_attrs(self)
    params = {}
    for attr in known:
        params.update({attr: getattr(self, attr)})
    for attr in unknown:
        for token, type, _ in self.unset_tokens:
            if type == 0:
                params.update({attr: int(token)})
                datetime(**params)
                setattr(self, "_token_%s" % attr, token)
                setattr(self, attr, int(token))


# Traceback (TypeError)
Python 3.6.2 (default, Jul 17 2017, 23:14:31)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
import dateparser
dateparser.__version__
'0.6.0'
dateparser.parse('+38 (0352)')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/conf.py", line 84, in wrapper
return f(*args, **kwargs)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/__init__.py", line 40, in parse
data = parser.get_date_data(date_string, date_formats)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 371, in get_date_data
language, date_string, date_formats, settings=self._settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 168, in parse
return instance._parse()
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 178, in _parse
date_obj = parser()
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 199, in _try_parser
self._get_translated_date(), settings=self._settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/conf.py", line 84, in wrapper
return f(*args, **kwargs)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date_parser.py", line 26, in parse
date_obj, period = parse(date_string, settings=settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 84, in parse
raise exceptions.pop(-1)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 78, in parse
res = parser(datestring, settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 454, in parse
po = cls(tokens.tokenize(), settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 288, in __init__
datetime(**params)
TypeError: Required argument 'day' (pos 3) not found
dateparser.parse('+38 0352')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/conf.py", line 84, in wrapper
return f(*args, **kwargs)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/__init__.py", line 40, in parse
data = parser.get_date_data(date_string, date_formats)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 371, in get_date_data
language, date_string, date_formats, settings=self._settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 168, in parse
return instance._parse()
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 178, in _parse
date_obj = parser()
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date.py", line 199, in _try_parser
self._get_translated_date(), settings=self._settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/conf.py", line 84, in wrapper
return f(*args, **kwargs)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/date_parser.py", line 26, in parse
date_obj, period = parse(date_string, settings=settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 84, in parse
raise exceptions.pop(-1)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 78, in parse
res = parser(datestring, settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 454, in parse
po = cls(tokens.tokenize(), settings)
File "/home/amorgun/env3.6/lib/python3.6/site-packages/dateparser/parser.py", line 288, in __init__
datetime(**params)
TypeError: Required argument 'day' (pos 3) not found

# Fixed code
def __init__(self, tokens, settings):
    self.settings = settings
    self.tokens = list(tokens)
    self.filtered_tokens = [t for t in self.tokens if t[1] <= 1]

    self.unset_tokens = []

    self.day = None
    self.month = None
    self.year = None
    self.time = None

    self.auto_order = []

    self._token_day = None
    self._token_month = None
    self._token_year = None
    self._token_time = None

    self.ordered_num_directives = OrderedDict(
        (k, self.num_directives[k])
        for k in (resolve_date_order(settings.DATE_ORDER, lst=True))
    )

    skip_index = []
    skip_component = None
    for index, token_type in enumerate(self.filtered_tokens):
        if index in skip_index:
            continue

        token, type = token_type

        if token in settings.SKIP_TOKENS_PARSER:
            continue

        if self.time is None:
            try:
                microsecond = MICROSECOND.search(
                    self.filtered_tokens[index + 1][0]
                ).group()
                _is_after_time_token = token.index(":")
                _is_after_period = self.tokens[self.tokens.index((token, 0)) + 1][
                    0
                ].index(".")
            except:
                microsecond = None

            if microsecond:
                mindex = index + 2
            else:
                mindex = index + 1

            try:
                meridian = MERIDIAN.search(self.filtered_tokens[mindex][0]).group()
            except:
                meridian = None

            if any([":" in token, meridian, microsecond]):
                if meridian and not microsecond:
                    self._token_time = "%s %s" % (token, meridian)
                    skip_index.append(mindex)
                elif microsecond and not meridian:
                    self._token_time = "%s.%s" % (token, microsecond)
                    skip_index.append(index + 1)
                elif meridian and microsecond:
                    self._token_time = "%s.%s %s" % (token, microsecond, meridian)
                    skip_index.append(index + 1)
                    skip_index.append(mindex)
                else:
                    self._token_time = token
                self.time = lambda: time_parser(self._token_time)
                continue

        results = self._parse(
            type, token, settings.FUZZY, skip_component=skip_component
        )
        for res in results:
            if len(token) == 4 and res[0] == "year":
                skip_component = "year"
            setattr(self, *res)

    known, unknown = get_unresolved_attrs(self)
    params = {}
    for attr in known:
        params.update({attr: getattr(self, attr)})
    for attr in unknown:
        for token, type, _ in self.unset_tokens:
            if type == 0:
                params.update({attr: int(token)})
                setattr(self, "_token_%s" % attr, token)
                setattr(self, attr, int(token))