Skip to content

Commit

Permalink
Merge pull request #49 from Emantor/fix/deprecation
Browse files Browse the repository at this point in the history
Fix DepreactionWarning for warn method
  • Loading branch information
tehmaze committed Jan 3, 2021
2 parents 435661b + 318896c commit a9d8514
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xmodem/__init__.py
Expand Up @@ -360,7 +360,7 @@ def callback(total_packets, success_count, error_count)
self.log.error('send error: expected ACK; got %r', char)
error_count += 1
if error_count > retry:
self.log.warn('EOT was not ACKd, aborting transfer')
self.log.warning('EOT was not ACKd, aborting transfer')
self.abort(timeout=timeout)
return False

Expand Down Expand Up @@ -442,7 +442,7 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):

char = self.getc(1, timeout)
if char is None:
self.log.warn('recv error: getc timeout in start sequence')
self.log.warning('recv error: getc timeout in start sequence')
error_count += 1
continue
elif char == SOH:
Expand Down Expand Up @@ -501,7 +501,7 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
'got {0!r}'.format(char))
if not quiet:
print(err_msg, file=sys.stderr)
self.log.warn(err_msg)
self.log.warning(err_msg)
error_count += 1
if error_count > retry:
self.log.info('error_count reached %d, aborting.',
Expand All @@ -515,13 +515,13 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
self.log.debug('recv: data block %d', sequence)
seq1 = self.getc(1, timeout)
if seq1 is None:
self.log.warn('getc failed to get first sequence byte')
self.log.warning('getc failed to get first sequence byte')
seq2 = None
else:
seq1 = ord(seq1)
seq2 = self.getc(1, timeout)
if seq2 is None:
self.log.warn('getc failed to get second sequence byte')
self.log.warning('getc failed to get second sequence byte')
else:
# second byte is the same as first as 1's complement
seq2 = 0xff - ord(seq2)
Expand Down Expand Up @@ -551,7 +551,7 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
continue

# something went wrong, request retransmission
self.log.warn('recv error: purge, requesting retransmission (NAK)')
self.log.warning('recv error: purge, requesting retransmission (NAK)')
while True:
# When the receiver wishes to <nak>, it should call a "PURGE"
# subroutine, to wait for the line to clear. Recall the sender
Expand All @@ -578,7 +578,7 @@ def _verify_recv_checksum(self, crc_mode, data):
our_sum = self.calc_crc(data)
valid = bool(their_sum == our_sum)
if not valid:
self.log.warn('recv error: checksum fail '
self.log.warning('recv error: checksum fail '
'(theirs=%04x, ours=%04x), ',
their_sum, our_sum)
else:
Expand All @@ -589,7 +589,7 @@ def _verify_recv_checksum(self, crc_mode, data):
our_sum = self.calc_checksum(data)
valid = their_sum == our_sum
if not valid:
self.log.warn('recv error: checksum fail '
self.log.warning('recv error: checksum fail '
'(theirs=%02x, ours=%02x)',
their_sum, our_sum)
return valid, data
Expand Down

0 comments on commit a9d8514

Please sign in to comment.