mirror of https://github.com/Ciphey/Ciphey.git
Updated What to check before a pull request (markdown)
parent
2a7ebf0580
commit
5bd1315433
|
@ -17,4 +17,44 @@ So for example (taken from a PR):
|
|||
`unquote` will never fail, so it will always return _something_. We have had to implement our own check to see if unquote did anything, this way we can return None.
|
||||
|
||||
# Dictionaries or Lists
|
||||
If your code requires a dictionary or list of letters or alphabets or the likes, it should go into CipheyDists.
|
||||
If your code requires a dictionary or list of letters or alphabets or the likes, it should go into CipheyDists.
|
||||
|
||||
[https://github.com/Ciphey/CipheyDists](https://github.com/Ciphey/CipheyDists)
|
||||
|
||||
CipheyDists contains all the dictionaries / alphabets required by decoders.
|
||||
|
||||
If you have a list in your code that's rather quite long, place it in the [lists directory](https://github.com/Ciphey/CipheyDists/tree/master/cipheydists/list) as a JSON file with an appropriate name.
|
||||
|
||||
If you have a dictionary, place it in [translate](https://github.com/Ciphey/CipheyDists/tree/master/cipheydists/translate) with an appropriate name.
|
||||
|
||||
Now you can call your dictionary / list.
|
||||
|
||||
Your first step is to change the `__init__` of yourr code. Let's look at Galactic Decoder as an example.
|
||||
|
||||
```python
|
||||
def __init__(self, config: Config):
|
||||
super().__init__(config)
|
||||
self.GALACTIC_DICT = config.get_resource(self._params()["dict"], Translation)
|
||||
```
|
||||
|
||||
You don't have to change much here. Just add in this variable and name it something appropriate.
|
||||
|
||||
The next part requires some code. Change the `gatParams` method to look like this:
|
||||
|
||||
```python
|
||||
@staticmethod
|
||||
def getParams() -> Optional[Dict[str, ParamSpec]]:
|
||||
return {
|
||||
"dict": ParamSpec(
|
||||
desc="The galactic alphabet dictionary to use",
|
||||
req=False,
|
||||
default="cipheydists::translate::galactic",
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
Fill out the description (what it is you're getting from CipheyDists), whether or not it is required for your program to run, and the location of it.
|
||||
|
||||
In this case, the Galactic dictionary is in CipheyDists, it is in the translate subdirectory and it is called "galactic". If we look at the [code](https://github.com/Ciphey/CipheyDists/blob/master/cipheydists/translate/galactic.json) we can see this is true.
|
||||
|
||||
This is our [resource loader](https://github.com/Ciphey/Ciphey/wiki/Extending-Ciphey#resourceloader). You don't need to know much about it, other than it allows you to select resources without memorising weird file paths.
|
Loading…
Reference in New Issue