Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
refscrub
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Public
PASSOFT
refscrub
Commits
37a07337
Commit
37a07337
authored
6 years ago
by
Michael Love
Browse files
Options
Downloads
Patches
Plain Diff
Clean up global variables.
parent
40c461f5
No related branches found
No related tags found
1 merge request
!2
Resolve "Python 3"
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
HISTORY.rst
+1
-1
1 addition, 1 deletion
HISTORY.rst
refscrub/__init__.py
+1
-1
1 addition, 1 deletion
refscrub/__init__.py
refscrub/refscrub.py
+13
-18
13 additions, 18 deletions
refscrub/refscrub.py
setup.cfg
+1
-1
1 addition, 1 deletion
setup.cfg
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
17 additions
and
22 deletions
HISTORY.rst
+
1
−
1
View file @
37a07337
...
@@ -17,7 +17,7 @@ History
...
@@ -17,7 +17,7 @@ History
* Minor fixes of global variables
* Minor fixes of global variables
2018.22
7
(2018-09-1
6
)
2018.22
8
(2018-09-1
7
)
------------------
------------------
* Python 2.7 & 3.6 compatiblity.
* Python 2.7 & 3.6 compatiblity.
...
...
This diff is collapsed.
Click to expand it.
refscrub/__init__.py
+
1
−
1
View file @
37a07337
...
@@ -4,4 +4,4 @@
...
@@ -4,4 +4,4 @@
__author__
=
"""
IRIS PASSCAL
"""
__author__
=
"""
IRIS PASSCAL
"""
__email__
=
'
software-support@passcal.nmt.edu
'
__email__
=
'
software-support@passcal.nmt.edu
'
__version__
=
'
2018.22
7
'
__version__
=
'
2018.22
8
'
This diff is collapsed.
Click to expand it.
refscrub/refscrub.py
+
13
−
18
View file @
37a07337
...
@@ -12,6 +12,7 @@ Michael Love
...
@@ -12,6 +12,7 @@ Michael Love
August 2018
August 2018
Updates to work on both Python 2 & 3.
Updates to work on both Python 2 & 3.
Code cleanup to match PEP 8.
Code cleanup to match PEP 8.
Cleanup global vars.
"""
"""
from
__future__
import
(
print_function
,
with_statement
)
from
__future__
import
(
print_function
,
with_statement
)
from
os.path
import
join
,
basename
,
getsize
from
os.path
import
join
,
basename
,
getsize
...
@@ -19,12 +20,11 @@ import sys
...
@@ -19,12 +20,11 @@ import sys
import
struct
import
struct
USAGE
=
'
usage: %prog [options] infile1 [ infile2 ... infileN]
'
USAGE
=
'
usage: %prog [options] infile1 [ infile2 ... infileN]
'
PROG_VERSION
=
'
2018.22
7
'
PROG_VERSION
=
'
2018.22
8
'
VERBOSE
=
False
VERBOSE
=
False
EXTRACT
=
False
EXTRACT
=
False
SUMMARY_FILE
=
'
scrubsum.txt
'
SUMMARY_FILE
=
'
scrubsum.txt
'
PREFIX
=
""
PREFIX
=
""
INFILE
=
""
FILESIZE
=
0
FILESIZE
=
0
TABS
=
"
\t\t\t\t
"
TABS
=
"
\t\t\t\t
"
...
@@ -181,18 +181,18 @@ class RTPacket:
...
@@ -181,18 +181,18 @@ class RTPacket:
return
True
return
True
def
readfile
(
file
name
):
def
readfile
(
in
file
):
ticker
=
1
ticker
=
1
# speedup local vars
# speedup local vars
global
VERBOSE
global
VERBOSE
global
EXTRACT
global
EXTRACT
tell
=
file
name
.
tell
tell
=
in
file
.
tell
read
=
file
name
.
read
read
=
in
file
.
read
seek
=
file
name
.
seek
seek
=
in
file
.
seek
while
True
:
while
True
:
ticker
+=
1
ticker
+=
1
if
VERBOSE
is
False
and
ticker
==
10000
:
if
VERBOSE
is
False
and
ticker
==
10000
:
print
(
summary
())
print
(
summary
(
infile
))
ticker
=
1
ticker
=
1
if
VERBOSE
:
if
VERBOSE
:
print
(
"
OFFSET: %12d
"
%
tell
())
print
(
"
OFFSET: %12d
"
%
tell
())
...
@@ -226,16 +226,15 @@ def readfile(filename):
...
@@ -226,16 +226,15 @@ def readfile(filename):
print
(
TABS
+
"
>>>>>>>>
"
)
print
(
TABS
+
"
>>>>>>>>
"
)
seek
(
-
1023
,
1
)
seek
(
-
1023
,
1
)
print
(
summary
())
print
(
summary
(
infile
))
# commented out as when run with many files as input like a cf dir the closed fh's need to be written to and isn't
# commented out as when run with many files as input like a cf dir the closed fh's need to be written to and isn't
# smart enough to be opened RTPacket.seen.close_fhs()
# smart enough to be opened RTPacket.seen.close_fhs()
def
summary
():
def
summary
(
infile
):
global
INFILE
global
FILESIZE
global
FILESIZE
offstring
=
"
%6s: %12d
\n
"
offstring
=
"
%6s: %12d
\n
"
s
=
offstring
%
(
"
OFFSET
"
,
INFILE
.
tell
())
s
=
offstring
%
(
"
OFFSET
"
,
infile
.
tell
())
s
+=
offstring
%
(
"
OF
"
,
FILESIZE
)
s
+=
offstring
%
(
"
OF
"
,
FILESIZE
)
s
+=
"
Good packets: %d = %8.2fMB
\n
"
%
(
RTPacket
.
goodpkts
,
RTPacket
.
goodpkts
/
1024.0
)
s
+=
"
Good packets: %d = %8.2fMB
\n
"
%
(
RTPacket
.
goodpkts
,
RTPacket
.
goodpkts
/
1024.0
)
s
+=
"
IOErrors: %d
\n
"
%
RTPacket
.
IOErrorCount
s
+=
"
IOErrors: %d
\n
"
%
RTPacket
.
IOErrorCount
...
@@ -247,7 +246,6 @@ def main():
...
@@ -247,7 +246,6 @@ def main():
global
VERBOSE
global
VERBOSE
global
EXTRACT
global
EXTRACT
global
PREFIX
global
PREFIX
global
INFILE
global
FILESIZE
global
FILESIZE
summaryfh
=
None
summaryfh
=
None
from
optparse
import
OptionParser
from
optparse
import
OptionParser
...
@@ -275,14 +273,11 @@ def main():
...
@@ -275,14 +273,11 @@ def main():
PREFIX
=
basename
(
infilename
)
PREFIX
=
basename
(
infilename
)
print
(
"
Using prefix %s
"
%
PREFIX
)
print
(
"
Using prefix %s
"
%
PREFIX
)
FILESIZE
=
getsize
(
infilename
)
FILESIZE
=
getsize
(
infilename
)
with
open
(
infilename
)
as
filename
:
with
open
(
infilename
)
as
infile
:
# with open( filename.name + 'scrub.ref')) as outfile:
readfile
(
infile
)
# import profile
# profile.run('readfile(filename)')
readfile
(
filename
)
if
options
.
SUMMARY
:
if
options
.
SUMMARY
:
summaryfh
.
write
(
infilename
+
'
,
'
+
PREFIX
+
'
\n
'
)
summaryfh
.
write
(
infilename
+
'
,
'
+
PREFIX
+
'
\n
'
)
summaryfh
.
write
(
summary
())
summaryfh
.
write
(
summary
(
infile
))
print
(
"
----------------------------------------
"
)
print
(
"
----------------------------------------
"
)
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
1
−
1
View file @
37a07337
[bumpversion]
[bumpversion]
current_version
= 2018.22
7
current_version
= 2018.22
8
commit
= True
commit
= True
tag
= True
tag
= True
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
37a07337
...
@@ -51,6 +51,6 @@ setup(
...
@@ -51,6 +51,6 @@ setup(
packages
=
find_packages
(
include
=
[
'
refscrub
'
]),
packages
=
find_packages
(
include
=
[
'
refscrub
'
]),
test_suite
=
'
tests
'
,
test_suite
=
'
tests
'
,
url
=
'
https://git.passcal.nmt.edu/passoft/refscrub
'
,
url
=
'
https://git.passcal.nmt.edu/passoft/refscrub
'
,
version
=
'
2018.22
7
'
,
version
=
'
2018.22
8
'
,
zip_safe
=
False
,
zip_safe
=
False
,
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment