<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging
import re
import time
import urllib.parse
from datetime import date, datetime, timedelta

import certifi
import telegram
import urllib3
import xmltodict
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater

logger = logging.getLogger(__name__)


class FritzCallsDuringAbsense():

	def __init__(self, connection, prefs):
		self.prefs = prefs
		self.areaCode = (connection.call_action('X_VoIP', 'GetVoIPCommonAreaCode'))['NewVoIPAreaCode']
		self.http = urllib3.PoolManager()
		callURLList = connection.call_action('X_AVM-DE_OnTel', 'GetCallList')
		self.response = self.http.request('GET', callURLList['NewCallListURL']+'&max=2')
		entries = re.search("sid=(.*)$", callURLList['NewCallListURL'])
		self.sid = entries.group(0)

	def get_sid(self):
		return self.sid

	def get_fullCode(self, code):
		if code == None or code[:1] == '0':
			return code
		else:
			return self.areaCode + code

	def get_unresolved(self):  # get list of callers not listed with their name
		calldict = xmltodict.parse(self.response.data)['root']
		callentry = calldict['Call'][0]
		callentry['CalledNumber'] = self.get_fullCode(callentry['CalledNumber'])
		callentry['Caller'] = self.get_fullCode(callentry['Caller'])<commit_msg>caller list not refreshed<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging
import re
import time
import urllib.parse
from datetime import date, datetime, timedelta

import certifi
import telegram
import urllib3
import xmltodict
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater

logger = logging.getLogger(__name__)


class FritzCallsDuringAbsense():

	def __init__(self, connection, prefs):
		self.prefs = prefs
		self.areaCode = (connection.call_action('X_VoIP', 'GetVoIPCommonAreaCode'))['NewVoIPAreaCode']
		self.http = urllib3.PoolManager()
		self.callURLList = connection.call_action('X_AVM-DE_OnTel', 'GetCallList')
		entries = re.search("sid=(.*)$", self.callURLList['NewCallListURL'])
		self.sid = entries.group(0)

	def get_sid(self):
		return self.sid

	def get_fullCode(self, code):
		if code == None or code[:1] == '0':
			return code
		else:
			return self.areaCode + code

	def get_unresolved(self):  # get list of callers not listed with their name
		response = self.http.request('GET', self.callURLList['NewCallListURL'] + '&max=2')
		calldict = xmltodict.parse(response.data)['root']
		callentry = calldict['Call'][0]
		callentry['CalledNumber'] = self.get_fullCode(callentry['CalledNumber'])
		callentry['Caller'] = self.get_fullCode(callentry['Caller'])
{'fraction_non_alphanumeric': 0.1336124857251618, 'fraction_numerical': 0.006090597639893415, 'mean_word_length': 5.619647355163728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4907676', 'n_tokens_mistral': 929, 'n_tokens_neox': 887, 'n_words': 197}