Отчистка кода

This commit is contained in:
2025-04-15 09:20:54 +04:00
parent 9668807b46
commit 578bb077da
10 changed files with 23 additions and 35 deletions
@@ -1,5 +1,4 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.Compendium;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry
@@ -1,6 +1,4 @@
using LinqToDB.DataProvider.SapHana;
using Newtonsoft.Json.Linq;
using Npgsql;
using Newtonsoft.Json.Linq;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder
{
@@ -1,6 +1,4 @@
using System.Reflection;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder
{
[AttributeUsage(AttributeTargets.Class)]
internal class Pf2eTypeProcessor(string type) : Attribute
@@ -2,7 +2,6 @@
using Pf2eDataScrapper.Model;
using Pf2eDataScrapper.Model.Enum;
using Slugify;
using static LinqToDB.Common.Configuration;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder.Processors
{
@@ -1,5 +1,4 @@
using Konsole;
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.Compendium;
using Pf2eDataScrapper.SchemaBuilder;
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.SchemaBuilder;
using Pf2eDataScrapper.SchemaBuilder.Types;
+5 -7
View File
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using LinqToDB.SqlQuery;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Pf2eDataScrapper.Model;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel;
using System.Reflection;
namespace Pf2eDataScrapper;
@@ -103,7 +100,8 @@ public partial class Pf2eTestContext : DbContext
public virtual DbSet<Trait> Traits { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql(EnvSettings.DatabaseConnection,
builder =>
{
+4 -3
View File
@@ -139,7 +139,8 @@ namespace Pf2eDataScrapper.SchemaBuilder
/// <returns>Строковое представление элемента.</returns>
public override string ToString()
{
var result = new Dictionary<string, string>() {
var result = new Dictionary<string, string>()
{
["type"] = GetTypeName(),
["path"] = Path,
["is_null"] = IsNullable ? "true" : "false",
@@ -204,7 +205,7 @@ namespace Pf2eDataScrapper.SchemaBuilder
/// </summary>
/// <param name="input">Словарь данных.</param>
/// <returns>Строка форматированных данных</returns>
public static string FormatYaml(params Dictionary<string, string>[] input)
public static string FormatYaml(params List<Dictionary<string, string>> input)
{
var result = "";
@@ -218,7 +219,7 @@ namespace Pf2eDataScrapper.SchemaBuilder
return result.Trim();
}
public static Dictionary<string, string> MergeDictionaries(params Dictionary<string, string>[] input)
public static Dictionary<string, string> MergeDictionaries(params List<Dictionary<string, string>> input)
{
var result = new Dictionary<string, string>();
@@ -114,7 +114,8 @@ namespace Pf2eDataScrapper.SchemaBuilder.Types
/// <returns>Словарь данных</returns>
public override Dictionary<string, string> GetYamlData()
{
return new() {
return new()
{
["schema"] = SchemaNode.FormatYaml(GetSchemaYaml())
};
}
@@ -1,5 +1,4 @@
using System.Linq.Expressions;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
namespace Pf2eDataScrapper.SchemaBuilder.Types
{
@@ -91,7 +90,8 @@ namespace Pf2eDataScrapper.SchemaBuilder.Types
}
}
return new() {
return new()
{
["different_values"] = count.ToString() +
((count == Root.Values) ? " (all different)" : "") +
((count == 1) ? " (all same)" : ""),