Skip to content

Commit 40e3f86

Browse files
authored
Upgrade scripts to Python3 (#44)
1 parent e422685 commit 40e3f86

22 files changed

+40
-35
lines changed

Tests/ApiExceptionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Aspose.BarCode.Cloud.Sdk.Api;
1+
using Aspose.BarCode.Cloud.Sdk.Api;
22
using Aspose.BarCode.Cloud.Sdk.Model;
33
using Aspose.BarCode.Cloud.Sdk.Model.Requests;
44
using NUnit.Framework;

Tests/ConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.IO;
33
using Aspose.BarCode.Cloud.Sdk.Api;
44
using Newtonsoft.Json;

Tests/GenerateAndThenRecognize.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using System.Linq;
33
using Aspose.BarCode.Cloud.Sdk.Api;
44
using Aspose.BarCode.Cloud.Sdk.Interfaces;

Tests/JWTRequestHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.IO;
33
using System.Linq;
44
using System.Net;

Tests/RecognizeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using Aspose.BarCode.Cloud.Sdk.Api;
33
using Aspose.BarCode.Cloud.Sdk.Interfaces;
44
using Aspose.BarCode.Cloud.Sdk.Model;

Tests/TestsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Text;

scripts/insert-examples.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,46 @@
22

33
import argparse
44
import os
5+
import typing
56

67

7-
def read_text(filename):
8-
with open(filename, 'rt') as rf:
8+
def read_text(filename: str) -> str:
9+
with open(filename, "rt") as rf:
910
text = rf.read()
10-
return text.decode('utf-8')
11+
return text
1112

1213

13-
def save_text(fobj, text):
14-
fobj.write(text.replace('\r', ''))
14+
def save_text(writable_f: typing.TextIO, text: str) -> None:
15+
writable_f.write(text.replace("\r", ""))
1516

1617

17-
def format_text(text, **kwargs):
18+
def format_text(text: str, **kwargs) -> str:
1819
for k, v in kwargs.items():
19-
to_replace = '%{0}%'.format(k)
20+
to_replace = "%{0}%".format(k)
2021
text = text.replace(to_replace, v)
2122
return text
2223

2324

24-
def main(template, destination):
25-
generate_qr_example = read_text(os.path.join("examples", "GenerateQR", "Program.cs"))
25+
def main(template: typing.TextIO, destination: typing.TextIO) -> None:
26+
generate_qr_example = read_text(
27+
os.path.join("examples", "GenerateQR", "Program.cs")
28+
)
2629
read_qr_example = read_text(os.path.join("examples", "ReadQR", "Program.cs"))
2730

2831
text = template.read()
29-
formatted = format_text(text, GenerateQRExample=generate_qr_example, ReadQRExample=read_qr_example)
32+
formatted = format_text(
33+
text, GenerateQRExample=generate_qr_example, ReadQRExample=read_qr_example
34+
)
3035
save_text(destination, formatted)
3136

3237

33-
def parse_args():
38+
def parse_args() -> typing.Dict[str, typing.Any]:
3439
parser = argparse.ArgumentParser()
35-
parser.add_argument('template', type=argparse.FileType('rt'))
36-
parser.add_argument('destination', type=argparse.FileType('wt'))
40+
parser.add_argument("template", type=argparse.FileType("rt"))
41+
parser.add_argument("destination", type=argparse.FileType("wt"))
3742
kwargs = vars(parser.parse_args())
3843
return kwargs
3944

4045

41-
if __name__ == '__main__':
46+
if __name__ == "__main__":
4247
main(**parse_args())

src/Api/AuthType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Aspose.BarCode.Cloud.Sdk.Api
1+
namespace Aspose.BarCode.Cloud.Sdk.Api
22
{
33
/// <summary>
44
/// Supported types of authentication.

src/Interfaces/IBarcodeApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using Aspose.BarCode.Cloud.Sdk.Model;
33
using Aspose.BarCode.Cloud.Sdk.Model.Requests;
44

src/Interfaces/IFileApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using Aspose.BarCode.Cloud.Sdk.Model;
33
using Aspose.BarCode.Cloud.Sdk.Model.Requests;
44

0 commit comments

Comments
 (0)