Browse files

fix uses of not in conditionals

  • Loading branch information...
1 parent 6508248 commit 09195721fa11b17fda92f42cdc37091b7393810c @jmhodges committed Dec 2, 2012
View
4 lib/rchardet/charsetgroupprober.rb
@@ -51,9 +51,9 @@ def reset
end
def get_charset_name
- if not @bestGuessProber
+ if !@bestGuessProber
get_confidence()
- if not @bestGuessProber
+ if !@bestGuessProber
return nil
end
end
View
2 lib/rchardet/escprober.rb
@@ -42,7 +42,7 @@ def initialize
def reset
super()
for codingSM in @codingSM
- next if not codingSM
+ next if !codingSM
codingSM.active = true
codingSM.reset()
end
View
3 lib/rchardet/jpcntx.rb
@@ -181,10 +181,9 @@ def get_order(aStr)
end
end
-
class SJISContextAnalysis < JapaneseContextAnalysis
def get_order(aStr)
- return -1, 1 if not aStr
+ return -1, 1 if aStr.nil? || aStr == ""
# find out current char's byte length
first = aStr[0, 1]
if ((first >= "\x81") and (first <= "\x9F")) or ((first >= "\xE0") and (first <= "\xFC"))
View
6 lib/rchardet/sbcharsetprober.rb
@@ -64,11 +64,11 @@ def get_charset_name
end
def feed(aBuf)
- if not @model['keepEnglishLetter']
+ if !@model['keepEnglishLetter']
aBuf = filter_without_english_letters(aBuf)
end
aLen = aBuf.length
- if not aLen
+ if aLen != 0
return get_state()
end
aBuf.each_byte do |b|
@@ -81,7 +81,7 @@ def feed(aBuf)
@freqChar += 1
if @lastOrder < SAMPLE_SIZE
@totalSeqs += 1
- if not @reversed
+ if !@reversed
@seqCounters[@model['precedenceMatrix'][(@lastOrder * SAMPLE_SIZE) + order]] += 1
else # reverse the order of the letters in the lookup
@seqCounters[@model['precedenceMatrix'][(order * SAMPLE_SIZE) + @lastOrder]] += 1
View
8 lib/rchardet/universaldetector.rb
@@ -105,7 +105,7 @@ def feed(aBuf)
@lastChar = aBuf[-1, 1]
if @inputState == EEscAscii
- if not @escCharSetProber
+ if !@escCharSetProber
@escCharSetProber = EscCharSetProber.new()
end
if @escCharSetProber.feed(aBuf) == EFoundIt
@@ -115,7 +115,7 @@ def feed(aBuf)
@done = true
end
elsif @inputState == EHighbyte
- if not @charSetProbers or @charSetProbers.empty?
+ if @charSetProbers.nil? || @charSetProbers.empty?
@charSetProbers = [MBCSGroupProber.new(), SBCSGroupProber.new(), Latin1Prober.new()]
end
for prober in @charSetProbers
@@ -132,7 +132,7 @@ def feed(aBuf)
def close
return if @done
- if not @gotData
+ if !@gotData
$stderr << "no data received!\n" if $debug
return
end
@@ -157,7 +157,7 @@ def close
if $debug
$stderr << "no probers hit minimum threshhold\n" if $debug
for prober in @charSetProbers[0]._mProbers
- next if not prober
+ next if !prober
$stderr << "#{prober.get_charset_name} confidence = #{prober.get_confidence}\n" if $debug
end
end

0 comments on commit 0919572

Please sign in to comment.