Skip to content

Commit

Permalink
清理无用的行尾空格
Browse files Browse the repository at this point in the history
  • Loading branch information
Cat7373 committed Nov 20, 2015
1 parent 922c6c1 commit 71b981f
Show file tree
Hide file tree
Showing 56 changed files with 390 additions and 391 deletions.
2 changes: 1 addition & 1 deletion gae_proxy/local/connect_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def get_ssl_connection(self, host=''):
ssl_sock = None
break

if time.time() - ssl_sock.last_use_time < self.keep_alive+1:
if time.time() - ssl_sock.last_use_time < self.keep_alive+1:
xlog.debug("host_conn_pool %s get:%s handshake:%d", host, ssl_sock.ip, handshake_time)
break
else:
Expand Down
8 changes: 4 additions & 4 deletions gae_proxy/local/gae_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def handler(method, url, headers, body, wfile):

if response.status == 206:
return RangeFetch(method, url, headers, body, response, wfile).fetch()

try:
wfile.write("HTTP/1.1 %d %s\r\n" % (response.status, response.reason))
response_headers = {}
Expand Down Expand Up @@ -429,11 +429,11 @@ def handler(method, url, headers, body, wfile):
speed = body_length / (time_finished - time_response)


xlog.info("GAE %d|%s|%d t:%d s:%d hs:%d Spd:%d %d %s",
response.ssl_sock.fd, response.ssl_sock.ip, response.ssl_sock.received_size, (time_finished-time_request)*1000,
xlog.info("GAE %d|%s|%d t:%d s:%d hs:%d Spd:%d %d %s",
response.ssl_sock.fd, response.ssl_sock.ip, response.ssl_sock.received_size, (time_finished-time_request)*1000,
length, response.ssl_sock.handshake_time, int(speed), response.status, url)
else:
xlog.info("GAE %d|%s|%d t:%d s:%d hs:%d %d %s",
xlog.info("GAE %d|%s|%d t:%d s:%d hs:%d %d %s",
response.ssl_sock.fd, response.ssl_sock.ip, response.ssl_sock.received_size, (time_finished-time_request)*1000,
length, response.ssl_sock.handshake_time, response.status, url)

Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/local/generate_ip_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def filter_ip_range(good_range, bad_range):
PRINT("cut bad ip case 5:%s - %s" % (ip_utils.ip_num_to_string(good_begin), ip_utils.ip_num_to_string(good_end)))
break
else:
PRINT("any case? good:%s-%s bad:%s-%s" % (ip_utils.ip_num_to_string(good_begin), ip_utils.ip_num_to_string(good_end),
PRINT("any case? good:%s-%s bad:%s-%s" % (ip_utils.ip_num_to_string(good_begin), ip_utils.ip_num_to_string(good_end),
ip_utils.ip_num_to_string(bad_begin), ip_utils.ip_num_to_string(bad_end)))
assert( False )

Expand Down
10 changes: 5 additions & 5 deletions gae_proxy/local/google_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
class Check_ip():
trafic_control = 0
ncount_lock = threading.Lock()

remove_ip_thread_num = 0
remove_ip_thread_num_lock = threading.Lock()

ip_lock = threading.Lock()

def __init__(self):
Expand Down Expand Up @@ -71,7 +71,7 @@ def reset(self):
self.ip_dict = {}

# gererate from ip_dict, sort by handshake_time, when get_batch_ip
self.gws_ip_list = []
self.gws_ip_list = []
self.to_remove_ip_list = Queue.Queue()
self.ip_lock.release()

Expand Down Expand Up @@ -100,7 +100,7 @@ def load_config(self):

self.good_ip_file = os.path.abspath( os.path.join(config.DATA_PATH, good_ip_file_name))
self.default_good_ip_file = os.path.join(current_path, default_good_ip_file_name)

self.scan_ip_thread_num = self.max_scan_ip_thread_num
self.max_good_ip_num = config.CONFIG.getint("google_ip", "max_good_ip_num") #3000 # stop scan ip when enough
self.ip_connect_interval = config.CONFIG.getint("google_ip", "ip_connect_interval") #5,10
Expand Down Expand Up @@ -463,7 +463,7 @@ def report_connect_fail(self, ip_str, force_remove=False):
return

self.ip_dict[ip_str]['links'] -= 1

# ignore if system network is disconnected.
if not force_remove:
if not check_ip.network_is_ok():
Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/local/ip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def is_valid_ipv6(ip):
| (?<!:) #
| (?<=:) (?<!::) : #
) # OR
| # A v4 address with NO leading zeros
| # A v4 address with NO leading zeros
(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)
(?: \.
(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)
Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/local/openssl_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def context_builder(ca_certs=None, cipher_suites=('ALL:!RC4-SHA:!ECDHE-RSA-RC4-S

if sys.platform == "darwin":
ssl_version = "TLSv1"

# freenas openssl support fix from twitter user "himanzero"
# https://twitter.com/himanzero/status/645231724318748672
if sys.platform == "freebsd9":
Expand Down
3 changes: 1 addition & 2 deletions gae_proxy/local/simple_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,10 @@ def main(data_path="."):
data_path = sys.argv[1]
else:
data_path = "."

try:
main(data_path=data_path)
except Exception:
traceback.print_exc(file=sys.stdout)
except KeyboardInterrupt:
sys.exit()

2 changes: 1 addition & 1 deletion gae_proxy/server/lib/yaml/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def construct_yaml_binary(self, node):
return str(value).decode('base64')
except (binascii.Error, UnicodeEncodeError), exc:
raise ConstructorError(None, None,
"failed to decode base64 data: %s" % exc, node.start_mark)
"failed to decode base64 data: %s" % exc, node.start_mark)

timestamp_regexp = re.compile(
ur'''^(?P<year>[0-9][0-9][0-9][0-9])
Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/server/lib/yaml/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def analyze_scalar(self, scalar):

if index == 0:
# Leading indicators are special characters.
if ch in u'#,[]{}&*!|>\'\"%@`':
if ch in u'#,[]{}&*!|>\'\"%@`':
flow_indicators = True
block_indicators = True
if ch in u'?:':
Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/server/lib/yaml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def parse_flow_sequence_entry(self, first=False):
token = self.peek_token()
raise ParserError("while parsing a flow sequence", self.marks[-1],
"expected ',' or ']', but got %r" % token.id, token.start_mark)

if self.check_token(KeyToken):
token = self.peek_token()
event = MappingStartEvent(None, None, True,
Expand Down
18 changes: 9 additions & 9 deletions gae_proxy/server/lib/yaml/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def remove_possible_simple_key(self):
# Remove the saved possible key position at the current flow level.
if self.flow_level in self.possible_simple_keys:
key = self.possible_simple_keys[self.flow_level]

if key.required:
raise ScannerError("while scanning a simple key", key.mark,
"could not found expected ':'", self.get_mark())
Expand Down Expand Up @@ -363,11 +363,11 @@ def fetch_stream_start(self):

# Read the token.
mark = self.get_mark()

# Add STREAM-START.
self.tokens.append(StreamStartToken(mark, mark,
encoding=self.encoding))


def fetch_stream_end(self):

Expand All @@ -380,15 +380,15 @@ def fetch_stream_end(self):

# Read the token.
mark = self.get_mark()

# Add STREAM-END.
self.tokens.append(StreamEndToken(mark, mark))

# The steam is finished.
self.done = True

def fetch_directive(self):

# Set the current intendation to -1.
self.unwind_indent(-1)

Expand Down Expand Up @@ -515,7 +515,7 @@ def fetch_block_entry(self):
self.tokens.append(BlockEntryToken(start_mark, end_mark))

def fetch_key(self):

# Block context needs additional checks.
if not self.flow_level:

Expand Down Expand Up @@ -565,7 +565,7 @@ def fetch_value(self):

# It must be a part of a complex key.
else:

# Block context needs additional checks.
# (Do we really need them? They will be catched by the parser
# anyway.)
Expand Down Expand Up @@ -1023,14 +1023,14 @@ def scan_block_scalar(self, style):
# Unfortunately, folding rules are ambiguous.
#
# This is the folding according to the specification:

if folded and line_break == u'\n' \
and leading_non_space and self.peek() not in u' \t':
if not breaks:
chunks.append(u' ')
else:
chunks.append(line_break)

# This is Clark Evans's interpretation (also in the spec
# examples):
#
Expand Down
4 changes: 2 additions & 2 deletions gae_proxy/web_ui/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
if ( !isAdvancedOptionsShown ) {
$('i.icon', this).removeClass('icon-chevron-right');
$('i.icon', this).addClass('icon-chevron-down');
$('#advanced-options').slideDown();
$('#advanced-options').slideDown();
} else {
$('i.icon', this).removeClass('icon-chevron-down');
$('i.icon', this).addClass('icon-chevron-right');
Expand Down Expand Up @@ -219,7 +219,7 @@
error: function(){
tip('读取设置失败.', 'error');
}
});
});
});
</script>
<script type="text/javascript">
Expand Down
4 changes: 2 additions & 2 deletions gae_proxy/web_ui/deploy.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2>部署XX-Net至GAE</h2>
if ( !isAdvancedOptionsShown ) {
$('i.icon', this).removeClass('icon-chevron-right');
$('i.icon', this).addClass('icon-chevron-down');
$('#advanced-options').slideDown();
$('#advanced-options').slideDown();
} else {
$('i.icon', this).removeClass('icon-chevron-down');
$('i.icon', this).addClass('icon-chevron-right');
Expand Down Expand Up @@ -246,7 +246,7 @@ <h2>部署XX-Net至GAE</h2>
if ( errorMessage.length != 0 ) {
$('.alert').removeClass('alert-info');
$('.alert').addClass('alert-error');

$('.alert').html(errorMessage);
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion gae_proxy/web_ui/ipconfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
$('option[value=1]').css('display', '');
$('option[value=2]').css('display', '');
$('option[value=3]').css('display', 'none');

if( $('#ip-format').val() == 3 ) {
$('#ip-format').val("1");
}
Expand Down
4 changes: 2 additions & 2 deletions launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_xxnet_url_version(readme_file):
try:
fd = open(readme_file, "r")
lines = fd.readlines()
p = re.compile(r'https://codeload.github.com/XX-net/XX-Net/zip/([0-9]+)\.([0-9]+)\.([0-9]+)')
p = re.compile(r'https://codeload.github.com/XX-net/XX-Net/zip/([0-9]+)\.([0-9]+)\.([0-9]+)')
for line in lines:
m = p.match(line)
if m:
Expand All @@ -66,7 +66,7 @@ def get_xxnet_url_version(readme_file):
xxnet_url, xxnet_version = get_xxnet_url_version(readme_targe)
xxnet_unzip_path = os.path.join(download_path, "XX-Net-%s" % xxnet_version)
xxnet_zip_file = os.path.join(download_path, "XX-Net-%s.zip" % xxnet_version)


if not download_file(xxnet_url, xxnet_zip_file):
raise "download xxnet zip fail:" % download_path
Expand Down
2 changes: 1 addition & 1 deletion launcher/web_ui/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ html, body {
}

button,
input,
input,
select,
textarea {
font-family: "Segoe UI", "Microsoft YaHei" !important;
Expand Down
4 changes: 2 additions & 2 deletions launcher/web_ui/js/jquery.timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

;(function($) {
$.timer = function(func, time, autostart) {
$.timer = function(func, time, autostart) {
this.set = function(func, time, autostart) {
this.init = true;
if(typeof func == 'object') {
Expand Down Expand Up @@ -100,7 +100,7 @@
this.setTimer();
}
};

if(this.init) {
return new $.timer(func, time, autostart);
} else {
Expand Down
Loading

0 comments on commit 71b981f

Please sign in to comment.