1- #!/usr/bin/env python2.7
1+ # ***********************************************************************
2+ # ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
3+ # ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
4+ #
5+ # (c) 2022. (c) 2022.
6+ # Government of Canada Gouvernement du Canada
7+ # National Research Council Conseil national de recherches
8+ # Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
9+ # All rights reserved Tous droits réservés
10+ #
11+ # NRC disclaims any warranties, Le CNRC dénie toute garantie
12+ # expressed, implied, or énoncée, implicite ou légale,
13+ # statutory, of any kind with de quelque nature que ce
14+ # respect to the software, soit, concernant le logiciel,
15+ # including without limitation y compris sans restriction
16+ # any warranty of merchantability toute garantie de valeur
17+ # or fitness for a particular marchande ou de pertinence
18+ # purpose. NRC shall not be pour un usage particulier.
19+ # liable in any event for any Le CNRC ne pourra en aucun cas
20+ # damages, whether direct or être tenu responsable de tout
21+ # indirect, special or general, dommage, direct ou indirect,
22+ # consequential or incidental, particulier ou général,
23+ # arising from the use of the accessoire ou fortuit, résultant
24+ # software. Neither the name de l'utilisation du logiciel. Ni
25+ # of the National Research le nom du Conseil National de
26+ # Council of Canada nor the Recherches du Canada ni les noms
27+ # names of its contributors may de ses participants ne peuvent
28+ # be used to endorse or promote être utilisés pour approuver ou
29+ # products derived from this promouvoir les produits dérivés
30+ # software without specific prior de ce logiciel sans autorisation
31+ # written permission. préalable et particulière
32+ # par écrit.
33+ #
34+ # This file is part of the Ce fichier fait partie du projet
35+ # OpenCADC project. OpenCADC.
36+ #
37+ # OpenCADC is free software: OpenCADC est un logiciel libre ;
38+ # you can redistribute it and/or vous pouvez le redistribuer ou le
39+ # modify it under the terms of modifier suivant les termes de
40+ # the GNU Affero General Public la “GNU Affero General Public
41+ # License as published by the License” telle que publiée
42+ # Free Software Foundation, par la Free Software Foundation
43+ # either version 3 of the : soit la version 3 de cette
44+ # License, or (at your option) licence, soit (à votre gré)
45+ # any later version. toute version ultérieure.
46+ #
47+ # OpenCADC is distributed in the OpenCADC est distribué
48+ # hope that it will be useful, dans l’espoir qu’il vous
49+ # but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE
50+ # without even the implied GARANTIE : sans même la garantie
51+ # warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ
52+ # or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF
53+ # PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence
54+ # General Public License for Générale Publique GNU Affero
55+ # more details. pour plus de détails.
56+ #
57+ # You should have received Vous devriez avoir reçu une
58+ # a copy of the GNU Affero copie de la Licence Générale
59+ # General Public License along Publique GNU Affero avec
60+ # with OpenCADC. If not, see OpenCADC ; si ce n’est
61+ # <http://www.gnu.org/licenses/>. pas le cas, consultez :
62+ # <http://www.gnu.org/licenses/>.
63+ #
64+ # $Revision: 4 $
65+ #
66+ # ***********************************************************************
67+ #
68+
269
370import os
471import optparse
@@ -21,7 +88,7 @@ def parseCmdLine():
2188 help = 'File to read.' )
2289 Main .opt , args = op .parse_args ()
2390 if ( Main .opt .fileName == '-' ):
24- print "ERROR: Filename must be provided."
91+ print ( "ERROR: Filename must be provided." )
2592 op .print_help ()
2693 exit ( - 1 )
2794
@@ -30,12 +97,12 @@ def parseCmdLine():
3097 statinfo = os .stat (Main .opt .fileName )
3198 maxValue = ( statinfo .st_size / 1024 ) - Main .opt .size
3299 Main .opt .offsets = " " .join ( str (w ) for w in \
33- random .sample ( xrange (maxValue ), Main .opt .random ) )
34- print Main .opt .offsets
100+ random .sample ( range (maxValue ), Main .opt .random ) )
101+ print ( Main .opt .offsets )
35102 else :
36103 for offset in Main .opt .offsets .split ():
37104 if ( not offset .isdigit () ):
38- print "ERROR: Offsets must be integers"
105+ print ( "ERROR: Offsets must be integers" )
39106 op .print_help ()
40107 exit ( - 1 )
41108
@@ -66,7 +133,7 @@ def mainMethod():
66133 timming .append ( end - start )
67134
68135 for atime in timming :
69- print "{0} " .format ( int ( atime * 1000000 ) ),
70- print
136+ print ( "{0} " .format ( int ( atime * 1000000 ) ) ),
137+ print ( '' )
71138
72139Main .mainMethod ()
0 commit comments