1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
Description: fix invalid argument in open mode past python3.11.
Since python3, the universal newline mode 'U' has no effects.
Since python3.11, that mode is obsolete and its use raises:
Command: scoary.py -g scoary/exampledata/Gene_presence_absence.csv -t scoary/exa
mpledata/Tetracycline_resistance.csv -o Test1 --no-time
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/scoary.py", line 25, in <module>
methods.main()
File "/<<PKGBUILDDIR>>/scoary/methods.py", line 184, in main
with open(args.genes, "rU") as genes, \
^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
Author: Étienne Mollier <emollier@debian.org>
Forwarded: https://github.com/AdmiralenOla/Scoary/pull/106
Last-Update: 2022-12-07
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
@@ -181,15 +181,15 @@
cutoffs.pop(m,None)
# Start analysis
- with open(args.genes, "rU") as genes, \
- open(args.traits, "rU") as traits:
+ with open(args.genes, "r") as genes, \
+ open(args.traits, "r") as traits:
if args.restrict_to is not None:
# Note: Despite being a dictionary, the values of
# allowed_isolates are not currently used, only the keys
allowed_isolates = {isolate : "all"
for line in
- open(args.restrict_to,"rU")
+ open(args.restrict_to,"r")
for isolate in line.rstrip().split(",")}
else:
# Despite the confusing name
@@ -343,7 +343,7 @@
if writereducedset:
file = open(ReduceSet(genefile,delimiter, grabcols, startcol,
- allowed_isolates,time,outdir),"rU")
+ allowed_isolates,time,outdir),"r")
csvfile = csv.reader(file, skipinitialspace=True,
delimiter=delimiter)
else:
@@ -100,7 +100,7 @@
if not os.path.isfile(args.vcf):
sys.exit("Unable to locate input file %s" % args.vcf)
- with open(args.vcf,'rU') as vcffile, open(args.out,'w') as outfile:
+ with open(args.vcf,'r') as vcffile, open(args.out,'w') as outfile:
lines = csv.reader(vcffile, delimiter='\t', quotechar='"')
metainfo = {"##INFO" : {},
"##FILTER" : {},
@@ -20,7 +20,7 @@
for Test in ["1","2","4"]:
- with open(os.getcwd() + "/Test" + Test + "/Tetracycline_resistance.results.csv" ,"rU") as resfile:
+ with open(os.getcwd() + "/Test" + Test + "/Tetracycline_resistance.results.csv" ,"r") as resfile:
tab = csv.reader(resfile, delimiter=",")
for i in range(2):
if i == 0:
@@ -120,7 +120,7 @@
print("Not equal at Test %s col 17: %s %s" % (Test, data[17], str(reference[17])))
sys.exit(-1)
-with open(os.getcwd() + "/mutations_presence_absence.csv" ,"rU") as vcfresfile:
+with open(os.getcwd() + "/mutations_presence_absence.csv" ,"r") as vcfresfile:
tab = csv.reader(vcfresfile, delimiter=",")
for i in range(2):
if i == 0:
|