def __init__(self, file_obj=None): ''' init function :param file_obj: could be a string or file object :return: None ''' self.logger = PyLogger.getLogger(self.__class__.__name__) self.exif_obj = {} if file_obj is not None: self.parse_file(file_obj)
#!usr/bin/python # -*- coding: utf-8 -*- # # file_name: my_ping # description: # author: libo # Histort: # first created: 2015/11/25 __author__ = 'libo' import os, sys, socket, struct, select, time import PyLogger logger = PyLogger.getLogger("PyPing") if sys.platform == "win32": # On Windows, the best timer is time.clock() default_timer = time.clock else: # On most other platforms the best timer is time.time() default_timer = time.time # From /usr/include/linux/icmp.h; your milage may vary. ICMP_ECHO_REQUEST = 8 # Seems to be the same on Solaris. def checksum(source_string): """ I'm not too confident that this is right but testing seems