1. Python / Говнокод #20301

    −31

    1. 1
    2. 2
    3. 3
    4. 4
    index = re.findall('%s([\s]*[\w\d-]+[\s]*[\w\d-]*)' % self.vendor, string)
    if not index:
        index = re.findall('([\s]*[\w\d-]+[\s]*[\w\d-]*[\s]*[\w\d-]*)', string)
    return filter(lambda x: len(x) > 3 and re.findall('\d', x), map(lambda x: x.replace(' ', '').replace('-', ''), index)) or [u'none']

    Сижу, перед уходом свой код документирую. В изумлении сижу, да.

    Запостил: kyzi007, 30 Июня 2016

    Комментарии (11) RSS

    • git gud http://www.diveintopython.net/regular_expressions/verbose.html
      Ответить
      • Тут вопрос не "что ЭТО" как какого хрена я ЭТО написала. Убила весь пакет, во избежание. Тем более что я уже не помню зачем это было надо, а если я не помню значит и никто не вспомнит)
        Ответить
        • а Вы бы комментарии в VCS писали человеческие

          я обычно там такие трактаты пишу, что через год вспомню

          там линуксоиды в ядре делают, я с них идею попер
          Ответить
      • C:\Users\guestinho>git gud
        git: 'gud' is not a git command. See 'git --help'.
        
        Did you mean this?
                gui
        Ответить
        • Работает только если написать это 100 раз подряд.
          Ответить
          • Мне гит и с первого раза такой вариант предложил.

            Кстати, подсказка гита может оказаться полезной следующему скрипту:
            https://github.com/nvbn/thefuck
            Ответить
          • Did you mean this?
            xui
            Ответить
          • чото не работает
            не подскажешь что не так?
            c:\temp>for /l %x in (1, 1, 100) do git gud
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            ----------------------вырезано потому что 2k симв.----------------------
            c:\temp>git gud
            git: 'gud' is not a git command. See 'git --help'.
            
            Did you mean this?
                    gui
            
            c:\temp>
            Ответить
            • Ничего нельзя сказать, большая часть важной информации вырезана. Полный лог нужен.
              Ответить
    • [\s] = \s
      [\w\d] = \w
      Ответить

    Добавить комментарий