|
2 | 2 |
|
3 | 3 | from smodels.experiment.databaseObj import Database |
4 | 4 | from smodels.base.physicsUnits import GeV |
5 | | -from smodels.tools.caching import Cache |
6 | 5 | import socket, atexit, time, os, sys, copy |
7 | 6 | from smodels.statistics.basicStats import observed, apriori, aposteriori, NllEvalType |
8 | 7 | import unum |
@@ -37,7 +36,7 @@ def __init__ ( self, dbpath, servername = None, port = None, verbose = "info", |
37 | 36 | port = 31770 |
38 | 37 | while self.is_port_in_use ( port ): |
39 | 38 | port += 1 |
40 | | - self.pprint ( "using first free port %d" % port ) |
| 39 | + self.pprint ( f"using first free port {port}" ) |
41 | 40 | if servername == None: |
42 | 41 | servername = socket.gethostname() |
43 | 42 | self.pprint ( f"determined servername as '{servername}'" ) |
@@ -120,7 +119,7 @@ def parseData ( self, data ): |
120 | 119 | def lookUpResult ( self, data ): |
121 | 120 | self.nlookups += 1 |
122 | 121 | if self.nlookups % 20000 == 0: |
123 | | - self.pprint ( "looked up %dth result" % self.nlookups ) |
| 122 | + self.pprint ( f"looked up {self.nlookups}th result" ) |
124 | 123 | tokens = data.split(":") |
125 | 124 | anaId = tokens[1] |
126 | 125 | dType = ":". join ( tokens[2:-2] ) |
@@ -199,19 +198,16 @@ def pprint ( self, *args ): |
199 | 198 |
|
200 | 199 | def initialize( self ): |
201 | 200 | self.setStatus ( "initialized" ) |
202 | | - Cache.n_stored = 20000 ## crank up the caching |
203 | 201 | self.db = Database ( self.dbpath ) |
204 | 202 | self.expResults = self.db.expResultList |
205 | 203 | self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
206 | 204 | self.server_address = ( self.servername, self.port ) |
207 | 205 | self.pprint ( 'starting up on %s port %s' % self.server_address ) |
208 | | - self.pprint ( 'I will be serving database %s at %s' % \ |
209 | | - (self.db.databaseVersion, self.dbpath ) ) |
| 206 | + self.pprint ( f'I will be serving database {self.db.databaseVersion} at {self.dbpath}' ) |
210 | 207 | try: |
211 | 208 | self.sock.bind( self.server_address ) |
212 | 209 | except OSError as e: |
213 | | - self.pprint ( "exception %s. is host ''%s'' reachable?" % \ |
214 | | - ( e, self.server_address ) ) |
| 210 | + self.pprint ( f"exception {e}. is host ''{self.server_address}'' reachable?" ) |
215 | 211 | sys.exit(-1) |
216 | 212 | # Listen for incoming connections |
217 | 213 | self.sock.listen(1) |
|
0 commit comments