Skip to content

Commit

Permalink
Remove string.doFormat, replacing with string.format (#3365)
Browse files Browse the repository at this point in the history
* remove unecessary string.doFormat, replacing with string.format

Signed-off-by: Jeremiah Corrado <jeremiah.corrado@hpe.com>

* remove doFormat from new random-exponential functions

Signed-off-by: Jeremiah Corrado <jeremiah.corrado@hpe.com>

* fix merge conflict resolution

Signed-off-by: Jeremiah Corrado <jeremiah.corrado@hpe.com>

---------

Signed-off-by: Jeremiah Corrado <jeremiah.corrado@hpe.com>
  • Loading branch information
jeremiah-corrado authored Jun 26, 2024
1 parent 87ffc0e commit e7a863e
Show file tree
Hide file tree
Showing 62 changed files with 1,106 additions and 1,122 deletions.
18 changes: 9 additions & 9 deletions src/ArgSortMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module ArgSortMsg
deltaIV = argsortDefault(newa);
}
otherwise { throw getErrorWithContext(
msg="Unsupported DataType: %?".doFormat(dtype2str(g.dtype)),
msg="Unsupported DataType: %?".format(dtype2str(g.dtype)),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand Down Expand Up @@ -233,7 +233,7 @@ module ArgSortMsg
algorithm = algoName: SortingAlgorithm;
} catch {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".doFormat(algoName),
msg="Unrecognized sorting algorithm: %s".format(algoName),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -245,7 +245,7 @@ module ArgSortMsg
var arrNames = msgArgs.get("arr_names").getList(n);
var arrTypes = msgArgs.get("arr_types").getList(n);
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"number of arrays: %i arrNames: %?, arrTypes: %?".doFormat(n,arrNames, arrTypes));
"number of arrays: %i arrNames: %?, arrTypes: %?".format(n,arrNames, arrTypes));
var (arrSize, hasStr, allSmallStrs, extraArraysNeeded, numStrings, names, types) = validateArraysSameLength(n, arrNames, arrTypes, st);

// If there were no string arrays, merge the arrays into a single array and sort
Expand Down Expand Up @@ -329,7 +329,7 @@ module ArgSortMsg
}
otherwise {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".doFormat(algorithm:string),
msg="Unrecognized sorting algorithm: %s".format(algorithm:string),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -338,7 +338,7 @@ module ArgSortMsg
}
}
try! asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"argsort time = %i".doFormat(Time.timeSinceEpoch().totalSeconds() - t1));
"argsort time = %i".format(Time.timeSinceEpoch().totalSeconds() - t1));
return iv;
}

Expand Down Expand Up @@ -384,7 +384,7 @@ module ArgSortMsg
}
otherwise {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".doFormat(algorithm:string),
msg="Unrecognized sorting algorithm: %s".format(algorithm:string),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -393,7 +393,7 @@ module ArgSortMsg
}
}
try! asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"argsort time = %i".doFormat(Time.timeSinceEpoch().totalSeconds() - t1));
"argsort time = %i".format(Time.timeSinceEpoch().totalSeconds() - t1));
return iv;
}

Expand All @@ -412,7 +412,7 @@ module ArgSortMsg
algorithm = algoName: SortingAlgorithm;
} catch {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".doFormat(algoName),
msg="Unrecognized sorting algorithm: %s".format(algoName),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -424,7 +424,7 @@ module ArgSortMsg
const ivname = st.nextName();

asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"cmd: %s name: %s ivname: %s".doFormat(cmd, name, ivname));
"cmd: %s name: %s ivname: %s".format(cmd, name, ivname));

var objtype = msgArgs.getValueOf("objType").toUpper(): ObjType;
select objtype {
Expand Down
6 changes: 3 additions & 3 deletions src/ArraySetops.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ module ArraySetops
const totNumElemsMoved = + reduce pullLocalCount;
const percentTransfered = (totNumElemsMoved:real / allocSize)*100:int;
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"Total number of elements moved to a different locale = %i".doFormat(totNumElemsMoved));
"Total number of elements moved to a different locale = %i".format(totNumElemsMoved));
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"Percent of elements moved to a different locale = %i%%".doFormat(percentTransfered));
"Percent of elements moved to a different locale = %i%%".format(percentTransfered));

if toGiveUp || (percentTransfered > percentTransferLimit) {
// fall back to sort
Expand All @@ -217,7 +217,7 @@ module ArraySetops
}
else {
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"Falling back to sort workflow since percent of elements moved to a different locale = %i%% exceeds percentTransferLimit = %i%%".doFormat(percentTransfered, percentTransferLimit));
"Falling back to sort workflow since percent of elements moved to a different locale = %i%% exceeds percentTransferLimit = %i%%".format(percentTransfered, percentTransferLimit));
}
sortHelper(sortedIdx, permutedVals, idx1, idx2, val1, val2);
}
Expand Down
18 changes: 9 additions & 9 deletions src/AryUtil.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ module AryUtil
if (d.size == 0) {
s = ""; // Unnecessary, but left for clarity
} else if (d.size < printThresh || d.size <= 6) {
for i in 0..(d.size-2) {s += try! "%?".doFormat(A[i]) + " ";}
s += try! "%?".doFormat(A[d.size-1]);
for i in 0..(d.size-2) {s += try! "%?".format(A[i]) + " ";}
s += try! "%?".format(A[d.size-1]);
} else {
s = try! "%? %? %? ... %? %? %?".doFormat(A[0], A[1], A[2], A[d.size-3], A[d.size-2], A[d.size-1]);
s = try! "%? %? %? ... %? %? %?".format(A[0], A[1], A[2], A[d.size-3], A[d.size-2], A[d.size-1]);
}
return s;
} else {
const shape = d.shape;
var s = "%?\n".doFormat(shape),
var s = "%?\n".format(shape),
front_indices: d.rank*range,
back_indices: d.rank*range;

Expand All @@ -67,7 +67,7 @@ module AryUtil
const frontDom = {(...front_indices)},
backDom = {(...back_indices)};

s += "%? ... %?".doFormat(A[frontDom], A[backDom]);
s += "%? ... %?".format(A[frontDom], A[backDom]);

return s;
}
Expand Down Expand Up @@ -272,7 +272,7 @@ module AryUtil
proc validateArraysSameLength(n:int, names:[] string, types: [] string, st: borrowed SymTab) throws {
// Check that fields contains the stated number of arrays
if (names.size != n) {
var errorMsg = "Expected %i arrays but got %i".doFormat(n, names.size);
var errorMsg = "Expected %i arrays but got %i".format(n, names.size);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand All @@ -281,7 +281,7 @@ module AryUtil
"ArgumentError");
}
if (types.size != n) {
var errorMsg = "Expected %i types but got %i".doFormat(n, types.size);
var errorMsg = "Expected %i types but got %i".format(n, types.size);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand Down Expand Up @@ -342,7 +342,7 @@ module AryUtil
thisSize = segs.size;
}
otherwise {
var errorMsg = "Unrecognized object type: %s".doFormat(objtype);
var errorMsg = "Unrecognized object type: %s".format(objtype);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand All @@ -356,7 +356,7 @@ module AryUtil
size = thisSize;
} else {
if (thisSize != size) {
var errorMsg = "Arrays must all be same size; expected size %?, got size %?".doFormat(size, thisSize);
var errorMsg = "Arrays must all be same size; expected size %?, got size %?".format(size, thisSize);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand Down
4 changes: 2 additions & 2 deletions src/BigIntMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module BigIntMsg {
var retname = st.nextName();
st.addEntry(retname, createSymEntry(bigIntArray, max_bits));
var syment = toSymEntry(getGenericTypedArrayEntry(retname, st), bigint);
repMsg = "created %s".doFormat(st.attrib(retname));
repMsg = "created %s".format(st.attrib(retname));
biLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),repMsg);
return new MsgTuple(repMsg, MsgType.NORMAL);
}
Expand All @@ -73,7 +73,7 @@ module BigIntMsg {
low = tmp:uint;
var retname = st.nextName();
st.addEntry(retname, createSymEntry(low));
retList.pushBack("created %s".doFormat(st.attrib(retname)));
retList.pushBack("created %s".format(st.attrib(retname)));

all_zero = true;
forall t in tmp with (&& reduce all_zero) {
Expand Down
Loading

0 comments on commit e7a863e

Please sign in to comment.