Esempio n. 1
0
 def get_join_pt_values(self, d, name):
     s1 = ut.clean(
         d("th[abbr='%s']" % name).next("td").next("td").next("td").text())
     s2 = ut.clean(
         d("th[abbr='%s']" %
           name).next("td").next("td").next("td").next("td").text())
     i1 = float(ut.clear_unit(s1))
     i2 = float(ut.clear_unit(s2))
     return str(i1 + i2)
Esempio n. 2
0
 def get_parse_meal_price(self, d, name):
     s = ut.clean(self._get(d, name))
     launch = None
     for price in ut.parse_price(s):
         launch = price if len(price) < 4 and (not launch or max(launch, price) == price) else launch 
     snack = None
     for price in ut.parse_price(s):
         snack = price if launch and launch != price and len(price) < 4 and int(price) < 300 and (not snack or max(snack, price) == price) else snack 
     return (launch, snack)
Esempio n. 3
0
 def get_business_time(self, d, title, name):
     times = ut.clean(self._get(d, name)) if self._get(d, name) else ""
     if times == "":
         self.record.append("")
         self.record.append("")
         return
     t = times.replace('時','').replace('分','').replace('~','-').split("-")
     self.record.append("" if t[0] == "0" or t[0] == "00" or t[0] == "000" or t[0] == "0000" else t[0])
     self.record.append("" if t[1] == "0" or t[1] == "00" or t[1] == "000" or t[1] == "0000" else t[1])
Esempio n. 4
0
 def get_name(self):
     name = self.ds('th[abbr="事業所名"]').parent('tr').next('tr>td').text()
     clean_name = ut.hiragana(name)
     if clean_name:
         n = self.get(self.dd, "(ふりがな)")
         env.logging.info('%sがひらがなで構成されているため不正です。調整します。→%s' % (clean_name, n))
         print('%sがひらがなで構成されているため不正です。調整します。→%s' % (clean_name, n))
         return n
     return ut.clean(name).replace("-", "ー").replace("~", "~") 
Esempio n. 5
0
 def get_name(self):
     name = self.ds('th[abbr="事業所名"]').parent('tr').next('tr>td').text()
     clean_name = ut.hiragana(name)
     if clean_name:
         n = self.get(self.dd, "(ふりがな)")
         env.logging.info('%sがひらがなで構成されているため不正です。調整します。→%s' %
                          (clean_name, n))
         print('%sがひらがなで構成されているため不正です。調整します。→%s' % (clean_name, n))
         return n
     return ut.clean(name).replace("-", "ー").replace("~", "~")
Esempio n. 6
0
 def get_business_time(self, d, title, name):
     times = ut.clean(self._get(d, name)) if self._get(d, name) else ""
     if times == "":
         self.record.append("")
         self.record.append("")
         return
     t = times.replace('時', '').replace('分', '').replace('~',
                                                         '-').split("-")
     self.record.append("" if t[0] == "0" or t[0] == "00" or t[0] == "000"
                        or t[0] == "0000" else t[0])
     self.record.append("" if t[1] == "0" or t[1] == "00" or t[1] == "000"
                        or t[1] == "0000" else t[1])
Esempio n. 7
0
 def get_parse_meal_price(self, d, name):
     s = ut.clean(self._get(d, name))
     launch = None
     for price in ut.parse_price(s):
         launch = price if len(price) < 4 and (
             not launch or max(launch, price) == price) else launch
     snack = None
     for price in ut.parse_price(s):
         snack = price if launch and launch != price and len(
             price) < 4 and int(price) < 300 and (
                 not snack or max(snack, price) == price) else snack
     return (launch, snack)
Esempio n. 8
0
    def get_company(self):
        com_name = self.dd('th[abbr="名称"]').parent('tr').next('tr>td').text()
        com = ut.parse_company(com_name)
        if com:
            return com
        raw_com_name = com_name
        if "かぶしきがいしゃ" in com_name or "かぶしきかいしゃ" in com_name:
            com_name = ""

        com_name = ut.clean(com_name).replace("(医)", "").replace("(株)",
                                                                 "").replace(
                                                                     "(有)", "")
        com = ut.parse_company(self.dd('th[abbr="法人等の種類"]~td').text())
        com_other = ut.parse_company(
            self.dd('th[abbr="(その他の場合、その名称)"]~td').text())

        if com and ("株式会社" in com or "農協" in com):
            return ut.clean(com + " " + com_name)
        if com_other and "株式会社" in com_other:
            return ut.clean(com_other + " " + com_name)
        if com:
            return ut.clean(com + " " + com_name)
        if com_other:
            return ut.clean(com_other + " " + com_name)
        com_huri = ut.parse_company(self.dd('th[abbr="(ふりがな)"]~td').text())
        if com_huri:
            return com_huri
        return ut.clean(raw_com_name)
Esempio n. 9
0
    def get_company(self):
        com_name = self.dd('th[abbr="名称"]').parent('tr').next('tr>td').text()
        com = ut.parse_company(com_name)
        if com:
            return com
        raw_com_name = com_name
        if "かぶしきがいしゃ" in com_name or "かぶしきかいしゃ" in com_name:
            com_name = ""

        com_name = ut.clean(com_name).replace("(医)", "").replace("(株)", "").replace("(有)", "")
        com = ut.parse_company(self.dd('th[abbr="法人等の種類"]~td').text())
        com_other = ut.parse_company(self.dd('th[abbr="(その他の場合、その名称)"]~td').text())

        if com and ("株式会社" in com or "農協" in com):
            return ut.clean(com + " " + com_name)
        if com_other and "株式会社" in com_other:
            return ut.clean(com_other + " " + com_name)
        if com:
            return ut.clean(com + " " + com_name)
        if com_other:
            return ut.clean(com_other + " " + com_name)
        com_huri = ut.parse_company(self.dd('th[abbr="(ふりがな)"]~td').text())
        if com_huri:
            return com_huri
        return ut.clean(raw_com_name)
Esempio n. 10
0
 def get_split(self, d, name, index):
     return ut.clean(re.split(r'<br.*?>', d('th[abbr="%s"]' % name).next('td').html())[index]) 
Esempio n. 11
0
 def get_pt_value(self, d, name):
     s = ut.clean(d("th[abbr='%s']" % name).next("td").next("td").text())
     return ut.clear_unit(s)
Esempio n. 12
0
 def get_2_th(self, d, n1, n2):
     return ut.clean(
         d("th[abbr='%s']" % n1).parents("tr").find("th[abbr='%s']" %
                                                    n2).next("td").text())
Esempio n. 13
0
 def get_2_column(self, d, name):
     s1 = ut.clean(d('th[abbr="%s"]' % name).next('td').text())
     s2 = ut.clean(d('th[abbr="%s"]' % name).next('td').next('td').text())
     return (s1, s2)
Esempio n. 14
0
 def get(self, d, name):
     return ut.clean(self._get(d, name)) if self._get(d, name) else ""
Esempio n. 15
0
 def get_split(self, d, name, index):
     return ut.clean(
         re.split(r'<br.*?>',
                  d('th[abbr="%s"]' % name).next('td').html())[index])
Esempio n. 16
0
 def get(self, d, name):
     return ut.clean(self._get(d, name)) if self._get(d, name) else ""
Esempio n. 17
0
 def get_join_pt_values(self, d, name):
     s1 = ut.clean(d("th[abbr='%s']" % name).next("td").next("td").next("td").text())
     s2 = ut.clean(d("th[abbr='%s']" % name).next("td").next("td").next("td").next("td").text())
     i1 = float(ut.clear_unit(s1))
     i2 = float(ut.clear_unit(s2))
     return str(i1+ i2)
Esempio n. 18
0
 def get_pt_value(self, d, name):
     s = ut.clean(d("th[abbr='%s']" % name).next("td").next("td").text())
     return ut.clear_unit(s)
Esempio n. 19
0
 def get_2_th(self, d, n1, n2):
     return ut.clean(d("th[abbr='%s']" % n1).parents("tr").find("th[abbr='%s']" % n2).next("td").text())
Esempio n. 20
0
 def get_2_column(self, d, name):
     s1 = ut.clean(d('th[abbr="%s"]' % name).next('td').text())
     s2 = ut.clean(d('th[abbr="%s"]' % name).next('td').next('td').text())
     return (s1, s2)