# Path: nhlscrapi/scrapr/teamnameparser.py
# def team_abbr_parser(abr):
# def team_name_parser(name):


import re
from lxml.html import fromstring
from nhlscrapi.scrapr.nhlreq import NHLCn
from nhlscrapi.scrapr import teamnameparser as TP
from abc import ABCMeta, abstractmethod
                self.matchup = self._fill_meta(lx_doc)
            return self
        except:
            return None
        
        
    @abstractmethod
    def parse(self):
        """
        Fully parses html document.
        
        :returns: ``self`` on success, ``None`` otherwise
        """
        
        return self.parse_matchup()
    
    
    def _fill_meta(self, doc):
        def team_scr(doc, t):
            xp = ''.join(['//table[@id="', t, '"]'])
            team = doc.xpath(xp)[0]
            team = [s for s in team.xpath('.//text()') if s.lower() != t.lower() and '\r\n' not in s and 'game' not in s.lower()]
      
            return team
      
        final = { }
        final['away'], at = tuple(team_scr(doc, 'Visitor'))
        final['home'], ht = tuple(team_scr(doc, 'Home'))
    
        # clean team names

# Path: nhlscrapi/scrapr/teamnameparser.py
# def team_abbr_parser(abr):
# def team_name_parser(name):


# Path: nhlscrapi/scrapr/reportloader.py
import re
from lxml.html import fromstring
from nhlscrapi.scrapr.nhlreq import NHLCn
from nhlscrapi.scrapr import teamnameparser as TP
from abc import ABCMeta, abstractmethod

                self.matchup = self._fill_meta(lx_doc)
            return self
        except:
            return None
        
        
    @abstractmethod
    def parse(self):
        """
        Fully parses html document.
        
        :returns: ``self`` on success, ``None`` otherwise
        """
        
        return self.parse_matchup()
    
    
    def _fill_meta(self, doc):
        def team_scr(doc, t):
            xp = ''.join(['//table[@id="', t, '"]'])
            team = doc.xpath(xp)[0]
            team = [s for s in team.xpath('.//text()') if s.lower() != t.lower() and '\r\n' not in s and 'game' not in s.lower()]
      
            return team
      
        final = { }
        final['away'], at = tuple(team_scr(doc, 'Visitor'))
        final['home'], ht = tuple(team_scr(doc, 'Home'))
    
        # clean team names

        away = TP.team_name_parser(at)