-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from wikiZ/main
Kunyu Version Update V1.6.4
- Loading branch information
Showing
21 changed files
with
278 additions
and
9 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,41 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
""" | ||
@author: 风起 | ||
@contact: onlyzaliks@gmail.com | ||
@File: rule.py | ||
@Time: 2021/12/28 17:56 | ||
""" | ||
import os | ||
import yaml | ||
|
||
from rich.table import Table | ||
from rich.console import Console | ||
|
||
from kunyu.core import conf | ||
from kunyu.config.setting import RULE_INFO | ||
|
||
console = Console(color_system="auto", record=True) | ||
RULE_FILE_PATH = conf.get("rule", "path") | ||
|
||
class YamlRule: | ||
def _all_path(self, dirname): | ||
result = [] | ||
# Returns the paths to all files in the specified directory | ||
for maindir, subdir, file_name_list in os.walk(dirname): | ||
for filename in file_name_list: | ||
result.append(os.path.join(maindir, filename)) # Merge into a full path | ||
return result | ||
|
||
def _get_yaml_file(self, filename): | ||
# Read the information in the yaml file | ||
with open(filename, encoding="utf-8") as file: | ||
file_data = file.read() | ||
# Convert yaml file content to dictionary type | ||
return yaml.load(file_data, Loader=yaml.FullLoader) | ||
|
||
def get_yaml_list(self): | ||
yaml_params = [] | ||
for file in self._all_path(RULE_FILE_PATH): | ||
yaml_params.append(self._get_yaml_file(file)) | ||
return yaml_params |
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
Oops, something went wrong.