-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It would output the `as` clause after the `if` clauses, which isn't syntactically valid. Apparently no one has ever had a conditional import with as prefix because this was a bug in both the old and new formatters and has been a bug in the old formatter forever. Fix #1544.
- Loading branch information
1 parent
1101f65
commit 953ecbc
Showing
7 changed files
with
219 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
>>> | ||
import 'package:archive/archive.dart' as archive | ||
if (dart.library.io) 'package:archive/archive_io.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:fuzzy/web/e621/e621.dart'; | ||
import 'package:fuzzy/web/e621/models/tag_d_b.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:j_util/e621.dart' as e621; | ||
import 'package:fuzzy/log_management.dart' as lm; | ||
import 'package:j_util/j_util_full.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
// #region Logger | ||
lm.Printer get _print => lRecord.print; | ||
lm.FileLogger get _logger => lRecord.logger; | ||
// ignore: unnecessary_late | ||
late final lRecord = lm.generateLogger("TagDbImport"); | ||
// #endregion Logger | ||
const bool DO_NOT_USE_TAG_DB = true; | ||
final tagDb = LateFinal<TagDB>(); | ||
Future<TagDB> _core(String vf) { | ||
_print("Tag Database Decompressed!"); | ||
return TagDB.makeFromCsvString(vf); | ||
} | ||
Future<TagDB> _androidCallback(http.StreamedResponse value) { | ||
return decompressGzPlainTextStream(value).then(_core); | ||
} | ||
Future<TagDB> _webCallback(ByteData data) { | ||
return http.ByteStream.fromBytes( | ||
archive.GZipDecoder().decodeBuffer(archive.InputStream(data))) | ||
.bytesToString() | ||
.then(_core); | ||
} | ||
final LazyInitializer<TagDB> tagDbLazy = LazyInitializer(() async { | ||
if (Platform.isWeb) { | ||
var data = await rootBundle.load("assets/tags-2024-06-05.csv.gz"); | ||
_print("Tag Database Loaded!"); | ||
return compute(_webCallback, data); | ||
} else { | ||
return | ||
E621.sendRequest(e621.Api.initDbExportRequest()) | ||
.then((value) => compute(_androidCallback, value)); | ||
// E621ApiEndpoints.dbExportTags | ||
// .getMoreData() | ||
// .sendRequest() | ||
// .then((value) => compute(_androidCallback, value)); | ||
} | ||
}); | ||
<<< | ||
import 'package:archive/archive.dart' as archive | ||
if (dart.library.io) 'package:archive/archive_io.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:fuzzy/web/e621/e621.dart'; | ||
import 'package:fuzzy/web/e621/models/tag_d_b.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:j_util/e621.dart' as e621; | ||
import 'package:fuzzy/log_management.dart' as lm; | ||
import 'package:j_util/j_util_full.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
// #region Logger | ||
lm.Printer get _print => lRecord.print; | ||
lm.FileLogger get _logger => lRecord.logger; | ||
// ignore: unnecessary_late | ||
late final lRecord = lm.generateLogger("TagDbImport"); | ||
// #endregion Logger | ||
const bool DO_NOT_USE_TAG_DB = true; | ||
final tagDb = LateFinal<TagDB>(); | ||
Future<TagDB> _core(String vf) { | ||
_print("Tag Database Decompressed!"); | ||
return TagDB.makeFromCsvString(vf); | ||
} | ||
|
||
Future<TagDB> _androidCallback(http.StreamedResponse value) { | ||
return decompressGzPlainTextStream(value).then(_core); | ||
} | ||
|
||
Future<TagDB> _webCallback(ByteData data) { | ||
return http.ByteStream.fromBytes( | ||
archive.GZipDecoder().decodeBuffer(archive.InputStream(data))) | ||
.bytesToString() | ||
.then(_core); | ||
} | ||
|
||
final LazyInitializer<TagDB> tagDbLazy = LazyInitializer(() async { | ||
if (Platform.isWeb) { | ||
var data = await rootBundle.load("assets/tags-2024-06-05.csv.gz"); | ||
_print("Tag Database Loaded!"); | ||
return compute(_webCallback, data); | ||
} else { | ||
return E621 | ||
.sendRequest(e621.Api.initDbExportRequest()) | ||
.then((value) => compute(_androidCallback, value)); | ||
// E621ApiEndpoints.dbExportTags | ||
// .getMoreData() | ||
// .sendRequest() | ||
// .then((value) => compute(_androidCallback, value)); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
>>> | ||
import 'package:archive/archive.dart' as archive | ||
if (dart.library.io) 'package:archive/archive_io.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:fuzzy/web/e621/e621.dart'; | ||
import 'package:fuzzy/web/e621/models/tag_d_b.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:j_util/e621.dart' as e621; | ||
import 'package:fuzzy/log_management.dart' as lm; | ||
import 'package:j_util/j_util_full.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
// #region Logger | ||
lm.Printer get _print => lRecord.print; | ||
lm.FileLogger get _logger => lRecord.logger; | ||
// ignore: unnecessary_late | ||
late final lRecord = lm.generateLogger("TagDbImport"); | ||
// #endregion Logger | ||
const bool DO_NOT_USE_TAG_DB = true; | ||
final tagDb = LateFinal<TagDB>(); | ||
Future<TagDB> _core(String vf) { | ||
_print("Tag Database Decompressed!"); | ||
return TagDB.makeFromCsvString(vf); | ||
} | ||
Future<TagDB> _androidCallback(http.StreamedResponse value) { | ||
return decompressGzPlainTextStream(value).then(_core); | ||
} | ||
Future<TagDB> _webCallback(ByteData data) { | ||
return http.ByteStream.fromBytes( | ||
archive.GZipDecoder().decodeBuffer(archive.InputStream(data))) | ||
.bytesToString() | ||
.then(_core); | ||
} | ||
final LazyInitializer<TagDB> tagDbLazy = LazyInitializer(() async { | ||
if (Platform.isWeb) { | ||
var data = await rootBundle.load("assets/tags-2024-06-05.csv.gz"); | ||
_print("Tag Database Loaded!"); | ||
return compute(_webCallback, data); | ||
} else { | ||
return | ||
E621.sendRequest(e621.Api.initDbExportRequest()) | ||
.then((value) => compute(_androidCallback, value)); | ||
// E621ApiEndpoints.dbExportTags | ||
// .getMoreData() | ||
// .sendRequest() | ||
// .then((value) => compute(_androidCallback, value)); | ||
} | ||
}); | ||
<<< | ||
import 'package:archive/archive.dart' | ||
as archive | ||
if (dart.library.io) 'package:archive/archive_io.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:fuzzy/web/e621/e621.dart'; | ||
import 'package:fuzzy/web/e621/models/tag_d_b.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:j_util/e621.dart' as e621; | ||
import 'package:fuzzy/log_management.dart' as lm; | ||
import 'package:j_util/j_util_full.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
// #region Logger | ||
lm.Printer get _print => lRecord.print; | ||
lm.FileLogger get _logger => lRecord.logger; | ||
// ignore: unnecessary_late | ||
late final lRecord = lm.generateLogger("TagDbImport"); | ||
// #endregion Logger | ||
const bool DO_NOT_USE_TAG_DB = true; | ||
final tagDb = LateFinal<TagDB>(); | ||
Future<TagDB> _core(String vf) { | ||
_print("Tag Database Decompressed!"); | ||
return TagDB.makeFromCsvString(vf); | ||
} | ||
|
||
Future<TagDB> _androidCallback(http.StreamedResponse value) { | ||
return decompressGzPlainTextStream(value).then(_core); | ||
} | ||
|
||
Future<TagDB> _webCallback(ByteData data) { | ||
return http.ByteStream.fromBytes( | ||
archive.GZipDecoder().decodeBuffer(archive.InputStream(data)), | ||
).bytesToString().then(_core); | ||
} | ||
|
||
final LazyInitializer<TagDB> tagDbLazy = LazyInitializer(() async { | ||
if (Platform.isWeb) { | ||
var data = await rootBundle.load("assets/tags-2024-06-05.csv.gz"); | ||
_print("Tag Database Loaded!"); | ||
return compute(_webCallback, data); | ||
} else { | ||
return E621 | ||
.sendRequest(e621.Api.initDbExportRequest()) | ||
.then((value) => compute(_androidCallback, value)); | ||
// E621ApiEndpoints.dbExportTags | ||
// .getMoreData() | ||
// .sendRequest() | ||
// .then((value) => compute(_androidCallback, value)); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters