зеркало из
				https://github.com/ssciwr/AMMICO.git
				synced 2025-10-30 05:26:05 +02:00 
			
		
		
		
	add color table to package data (#124)
* add color table to package data * added importlib-resources to puproject.toml --------- Co-authored-by: Petr Andriushchenko <pitandmind@gmail.com>
Этот коммит содержится в:
		
							родитель
							
								
									ceec46a91c
								
							
						
					
					
						Коммит
						75e9f49370
					
				| @ -36,3 +36,22 @@ def test_dump_df(get_path): | |||||||
|     df = ut.dump_df(outdict) |     df = ut.dump_df(outdict) | ||||||
|     out_df = pd.read_csv(get_path + "example_dump_df.csv", index_col=[0]) |     out_df = pd.read_csv(get_path + "example_dump_df.csv", index_col=[0]) | ||||||
|     pd.testing.assert_frame_equal(df, out_df) |     pd.testing.assert_frame_equal(df, out_df) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def test_is_interactive(): | ||||||
|  |     assert ut.is_interactive | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def test_get_color_table(): | ||||||
|  |     colors = ut.get_color_table() | ||||||
|  |     assert colors["Pink"] == { | ||||||
|  |         "ColorName": [ | ||||||
|  |             "Pink", | ||||||
|  |             "LightPink", | ||||||
|  |             "HotPink", | ||||||
|  |             "DeepPink", | ||||||
|  |             "PaleVioletRed", | ||||||
|  |             "MediumVioletRed", | ||||||
|  |         ], | ||||||
|  |         "HEX": ["#FFC0CB", "#FFB6C1", "#FF69B4", "#FF1493", "#DB7093", "#C71585"], | ||||||
|  |     } | ||||||
|  | |||||||
| @ -2,6 +2,10 @@ import glob | |||||||
| import os | import os | ||||||
| from pandas import DataFrame, read_csv | from pandas import DataFrame, read_csv | ||||||
| import pooch | import pooch | ||||||
|  | import importlib_resources | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | pkg = importlib_resources.files("ammico") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class DownloadResource: | class DownloadResource: | ||||||
| @ -110,8 +114,9 @@ def is_interactive(): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_color_table(): | def get_color_table(): | ||||||
|  |     path_tables = pkg / "data" / "Color_tables.csv" | ||||||
|     df_colors = read_csv( |     df_colors = read_csv( | ||||||
|         os.path.join(os.path.dirname(__file__), "data", "Color_tables.csv"), |         path_tables, | ||||||
|         delimiter=";", |         delimiter=";", | ||||||
|         dtype=str, |         dtype=str, | ||||||
|         encoding="UTF-8", |         encoding="UTF-8", | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" | |||||||
| 
 | 
 | ||||||
| [project] | [project] | ||||||
| name = "ammico" | name = "ammico" | ||||||
| version = "0.0.1" | version = "0.1.0" | ||||||
| description = "AI Media and Misinformation Content Analysis Tool" | description = "AI Media and Misinformation Content Analysis Tool" | ||||||
| readme = "README.md" | readme = "README.md" | ||||||
| maintainers = [ | maintainers = [ | ||||||
| @ -31,6 +31,7 @@ dependencies = [ | |||||||
|     "google-cloud-vision", |     "google-cloud-vision", | ||||||
|     "grpcio", |     "grpcio", | ||||||
|     "importlib_metadata", |     "importlib_metadata", | ||||||
|  |     "importlib_resources", | ||||||
|     "ipython", |     "ipython", | ||||||
|     "jupyter_dash", |     "jupyter_dash", | ||||||
|     "matplotlib", |     "matplotlib", | ||||||
| @ -71,7 +72,6 @@ documentation = "https://ssciwr.github.io/AMMICO/build/html/index.html" | |||||||
| packages = ["ammico"] | packages = ["ammico"] | ||||||
| 
 | 
 | ||||||
| [tool.setuptools.package-data] | [tool.setuptools.package-data] | ||||||
| # Include any png files found in the "data" subdirectory of "ammico" | # Include any png and csv files found in the "data" subdirectory of "ammico" | ||||||
| "ammico.data" = ["*.png"] | "ammico.data" = ["*.png", "*.csv"] | ||||||
| mypkg = [ "*.csv"] |  | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Загрузка…
	
	
			
			x
			
			
		
	
		Ссылка в новой задаче
	
	Block a user
	 Inga Ulusoy
						Inga Ulusoy