├── .github
├── CODEOWNERS
├── dependabot.yml
├── linters
│ └── .jscpd.json
├── senzing-corporate-contributor-license-agreement.pdf
├── senzing-individual-contributor-license-agreement.pdf
└── workflows
│ ├── add-labels-standardized.yaml
│ ├── add-to-project-senzing-dependabot.yaml
│ ├── add-to-project-senzing.yaml
│ ├── dependabot-approve-and-merge.yaml
│ ├── lint-workflows.yaml
│ ├── move-pr-to-done-dependabot.yaml
│ └── pylint.yaml
├── .gitignore
├── .project
├── .pydevproject
├── .pylintrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── awesome.py
└── dependabot-approve-and-merge.yaml
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Default code owner
2 |
3 | * @Senzing/senzing-community
4 |
5 | /.github/ @Senzing/senzing-devsecops
6 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "github-actions"
4 | directory: "/"
5 | schedule:
6 | interval: "daily"
7 |
--------------------------------------------------------------------------------
/.github/linters/.jscpd.json:
--------------------------------------------------------------------------------
1 | {
2 | "threshold": 7
3 | }
--------------------------------------------------------------------------------
/.github/senzing-corporate-contributor-license-agreement.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Senzing/awesome/837ac255b2ca1eef95f9b5090f1e7115077a473f/.github/senzing-corporate-contributor-license-agreement.pdf
--------------------------------------------------------------------------------
/.github/senzing-individual-contributor-license-agreement.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Senzing/awesome/837ac255b2ca1eef95f9b5090f1e7115077a473f/.github/senzing-individual-contributor-license-agreement.pdf
--------------------------------------------------------------------------------
/.github/workflows/add-labels-standardized.yaml:
--------------------------------------------------------------------------------
1 | name: add labels standardized
2 |
3 | on:
4 | issues:
5 | types:
6 | - opened
7 | - reopened
8 |
9 | permissions:
10 | issues: write
11 |
12 | jobs:
13 | add-issue-labels:
14 | secrets:
15 | ORG_MEMBERSHIP_TOKEN: ${{ secrets.ORG_MEMBERSHIP_TOKEN }}
16 | SENZING_MEMBERS: ${{ secrets.SENZING_MEMBERS }}
17 | uses: senzing-factory/build-resources/.github/workflows/add-labels-to-issue.yaml@v2
18 |
19 | slack-notification:
20 | needs: [add-issue-labels]
21 | if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.add-issue-labels.outputs.job-status) }}
22 | secrets:
23 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
24 | uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v2
25 | with:
26 | job-status: ${{ needs.add-issue-labels.outputs.job-status }}
27 |
--------------------------------------------------------------------------------
/.github/workflows/add-to-project-senzing-dependabot.yaml:
--------------------------------------------------------------------------------
1 | name: add to project senzing github organization dependabot
2 |
3 | on:
4 | pull_request:
5 | branches: [main]
6 |
7 | permissions:
8 | repository-projects: write
9 |
10 | jobs:
11 | add-to-project-dependabot:
12 | secrets:
13 | SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }}
14 | uses: senzing-factory/build-resources/.github/workflows/add-to-project-dependabot.yaml@v2
15 | with:
16 | project: ${{ vars.SENZING_GITHUB_ORGANIZATION_PROJECT }}
17 |
18 | slack-notification:
19 | needs: [add-to-project-dependabot]
20 | if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.add-to-project-dependabot.outputs.job-status) }}
21 | secrets:
22 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
23 | uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v2
24 | with:
25 | job-status: ${{ needs.add-to-project-dependabot.outputs.job-status }}
26 |
--------------------------------------------------------------------------------
/.github/workflows/add-to-project-senzing.yaml:
--------------------------------------------------------------------------------
1 | name: add to project senzing github organization
2 |
3 | on:
4 | issues:
5 | types:
6 | - opened
7 | - reopened
8 |
9 | permissions:
10 | repository-projects: write
11 |
12 | jobs:
13 | add-to-project:
14 | secrets:
15 | SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }}
16 | uses: senzing-factory/build-resources/.github/workflows/add-to-project.yaml@v2
17 | with:
18 | classic: false
19 | project-number: ${{ vars.SENZING_GITHUB_ORGANIZATION_PROJECT }}
20 | org: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }}
21 |
22 | slack-notification:
23 | needs: [add-to-project]
24 | if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.add-to-project.outputs.job-status) }}
25 | secrets:
26 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
27 | uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v2
28 | with:
29 | job-status: ${{ needs.add-to-project.outputs.job-status }}
30 |
--------------------------------------------------------------------------------
/.github/workflows/dependabot-approve-and-merge.yaml:
--------------------------------------------------------------------------------
1 | name: Dependabot approve and merge
2 |
3 | on:
4 | pull_request:
5 | branches: [main]
6 |
7 | permissions:
8 | contents: write
9 | pull-requests: write
10 |
11 | jobs:
12 | dependabot-approve-and-merge:
13 | secrets:
14 | SENZING_GITHUB_CODEOWNER_PR_RW_TOKEN: ${{ secrets.SENZING_GITHUB_CODEOWNER_PR_RW_TOKEN }}
15 | uses: senzing-factory/build-resources/.github/workflows/dependabot-approve-and-merge.yaml@v2
16 |
--------------------------------------------------------------------------------
/.github/workflows/lint-workflows.yaml:
--------------------------------------------------------------------------------
1 | name: lint workflows
2 |
3 | on:
4 | push:
5 | branches-ignore: [main]
6 | pull_request:
7 | branches: [main]
8 |
9 | permissions:
10 | contents: read
11 | packages: read
12 | pull-requests: read
13 | statuses: write
14 |
15 | jobs:
16 | lint-workflows:
17 | uses: senzing-factory/build-resources/.github/workflows/lint-workflows.yaml@v2
18 |
--------------------------------------------------------------------------------
/.github/workflows/move-pr-to-done-dependabot.yaml:
--------------------------------------------------------------------------------
1 | name: move pr to done dependabot
2 |
3 | on:
4 | pull_request:
5 | branches: [main]
6 | types: [closed]
7 |
8 | permissions:
9 | repository-projects: write
10 |
11 | jobs:
12 | move-pr-to-done-dependabot:
13 | secrets:
14 | SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }}
15 | uses: senzing-factory/build-resources/.github/workflows/move-pr-to-done-dependabot.yaml@v2
16 | with:
17 | project: ${{ vars.SENZING_GITHUB_ORGANIZATION_PROJECT }}
18 |
--------------------------------------------------------------------------------
/.github/workflows/pylint.yaml:
--------------------------------------------------------------------------------
1 | name: pylint
2 |
3 | on: [push]
4 |
5 | permissions:
6 | contents: read
7 |
8 | jobs:
9 | pylint:
10 | outputs:
11 | status: ${{ job.status }}
12 | runs-on: ubuntu-latest
13 | strategy:
14 | matrix:
15 | python-version: ["3.8", "3.9", "3.10"]
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 |
20 | - name: set up Python ${{ matrix.python-version }}
21 | uses: actions/setup-python@v5
22 | with:
23 | python-version: ${{ matrix.python-version }}
24 |
25 | - name: install dependencies
26 | run: |
27 | python -m pip install --upgrade pip
28 | pip install pylint
29 |
30 | - name: analysing the code with pylint
31 | run: |
32 | # shellcheck disable=SC2046
33 | pylint $(git ls-files '*.py')
34 |
35 | slack-notification:
36 | needs: [pylint]
37 | if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.pylint.outputs.status ) && github.ref_name == github.event.repository.default_branch }}
38 | secrets:
39 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
40 | uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v2
41 | with:
42 | job-status: ${{ needs.pylint.outputs.status }}
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .history
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | awesome
4 |
5 |
6 |
7 |
8 |
9 | org.python.pydev.PyDevBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.python.pydev.pythonNature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.pydevproject:
--------------------------------------------------------------------------------
1 |
2 |
3 | Default
4 | python interpreter
5 |
6 |
--------------------------------------------------------------------------------
/.pylintrc:
--------------------------------------------------------------------------------
1 | [pylint]
2 | disable=
3 | broad-except,
4 | consider-iterating-dictionary,
5 | consider-using-f-string,
6 | import-error,
7 | invalid-name,
8 | len-as-condition,
9 | line-too-long,
10 | missing-function-docstring,
11 | missing-module-docstring,
12 | no-else-continue,
13 | possibly-used-before-assignment,
14 | redefined-builtin,
15 | redefined-outer-name,
16 | too-many-branches,
17 | too-many-locals,
18 | undefined-variable,
19 | unnecessary-dict-index-lookup,
20 | unused-argument,
21 | unused-import,
22 | unused-variable,
23 | used-before-assignment,
24 | good-names=
25 | template-python
26 | ignore=
27 | __init__.py,
28 | notes=
29 | FIXME,
30 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | [markdownlint](https://dlaa.me/markdownlint/),
7 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8 |
9 | ## [1.0.0] - 2021-01-08
10 |
11 | ### Added to 1.0.0
12 |
13 | - Base functionality in `awesome.py`
14 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@senzing.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Welcome to the project!
4 |
5 | We encourage contribution in a manner consistent with the [Code of Conduct](CODE_OF_CONDUCT.md).
6 | The following will guide you through the process.
7 |
8 | There are a number of ways you can contribute:
9 |
10 | 1. [Asking questions](#questions)
11 | 1. [Requesting features](#feature-requests)
12 | 1. [Reporting bugs](#bug-reporting)
13 | 1. [Contributing code or documentation](#contributing-code-or-documentation)
14 |
15 | ## License Agreements
16 |
17 | If your contribution modifies the git repository, the following agreements must be established.
18 |
19 | *Note:* License agreements are only needed for adding, modifying, and deleting artifacts kept within the repository.
20 | In simple terms, license agreements are needed before pull requests can be accepted.
21 | A license agreement is not needed for submitting feature request, bug reporting, or other project management.
22 |
23 | ### Individual Contributor License Agreement
24 |
25 | In order to contribute to this repository, an
26 | [Individual Contributor License Agreement (ICLA)](.github/senzing-individual-contributor-license-agreement.pdf)
27 | must be completed, submitted and accepted.
28 |
29 | ### Corporate Contributor License Agreement
30 |
31 | If the contribution to this repository is on behalf of a company, a
32 | [Corporate Contributor License Agreement (CCLA)](.github/senzing-corporate-contributor-license-agreement.pdf)
33 | must also be completed, submitted and accepted.
34 |
35 | ### Project License Agreement
36 |
37 | The license agreement for this repository is stated in the
38 | [LICENSE](LICENSE) file.
39 |
40 | ## Questions
41 |
42 | Please do not use the GitHub issue tracker to submit questions.
43 |
44 | TODO: Instead, use ???
45 |
46 | 1. ??? Slack ???
47 | 1. ??? stackoverflow.com ???
48 |
49 | ## Feature Requests
50 |
51 | All feature requests are "GitHub issues".
52 | To request a feature, create a
53 | [GitHub issue](https://help.github.com/articles/creating-an-issue/)
54 | in this repository.
55 |
56 | When creating an issue, there will be a choice to create a "Bug report" or a "Feature request".
57 | Choose "Feature request".
58 |
59 | ## Bug Reporting
60 |
61 | All bug reports are "GitHub issues".
62 | Before reporting on a bug, check to see if it has
63 | [already been reported](https://github.com/search?q=+is%3Aissue+user%3Asenzing).
64 | To report a bug, create a
65 | [GitHub issue](https://help.github.com/articles/creating-an-issue/)
66 | in this repository.
67 |
68 | When creating an issue, there will be a choice to create a "Bug report" or a "Feature request".
69 | Choose "Bug report".
70 |
71 | ## Contributing code or documentation
72 |
73 | To contribute code or documentation to the repository, you must have
74 | [License Agreements](#license-agreements) in place.
75 | This needs to be complete before a [Pull Request](#pull-requests) can be accepted.
76 |
77 | ### Setting up a development environment
78 |
79 | #### Set Environment variables
80 |
81 | These variables may be modified, but do not need to be modified.
82 | The variables are used throughout the installation procedure.
83 |
84 | ```console
85 | export GIT_ACCOUNT=senzing
86 | export GIT_REPOSITORY=awesome
87 | ```
88 |
89 | Synthesize environment variables.
90 |
91 | ```console
92 | export GIT_ACCOUNT_DIR=~/${GIT_ACCOUNT}.git
93 | export GIT_REPOSITORY_DIR="${GIT_ACCOUNT_DIR}/${GIT_REPOSITORY}"
94 | export GIT_REPOSITORY_URL="git@github.com:${GIT_ACCOUNT}/${GIT_REPOSITORY}.git"
95 | ```
96 |
97 | #### Clone repository
98 |
99 | Get repository.
100 |
101 | ```console
102 | mkdir --parents ${GIT_ACCOUNT_DIR}
103 | cd ${GIT_ACCOUNT_DIR}
104 | git clone ${GIT_REPOSITORY_URL}
105 | cd ${GIT_REPOSITORY_DIR}
106 | ```
107 |
108 | ### Coding conventions
109 |
110 | TODO:
111 |
112 | ### Testing
113 |
114 | TODO:
115 |
116 | ### Pull Requests
117 |
118 | Code in the main branch is modified via GitHub pull request.
119 | Follow GitHub's
120 | [Creating a pull request from a branch](https://help.github.com/articles/creating-a-pull-request/)
121 | or
122 | [Creating a pull request from a fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) instructions.
123 |
124 | Accepting pull requests will be at the discretion of Senzing, Inc. and the repository owner(s).
125 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # awesome
2 |
3 | Curated list of awesome Senzing software and resources.
4 | Inspired by [other awesome sites](#other-awesome-sites).
5 |
6 | ## Contents
7 |
8 | 1. [Documentation](#documentation)
9 | 1. [Mapper](#mapper)
10 | 1. [Resources](#resources)
11 | 1. [Features and bugs](#features-and-bugs)
12 | 1. [Other awesome sites](#other-awesome-sites)
13 |
14 | ## Documentation
15 |
16 | *Documentation on Senzing usage.*
17 |
18 | 1. [Promoted articles](https://senzing.zendesk.com/hc/en-us) - Promoted articles.
19 | 1. [Senzing API for Developers](https://senzing.zendesk.com/hc/en-us/categories/360000120514-Senzing-API-for-Developers-) - Senzing API for Developers.
20 | 1. [postgresql-performance](https://github.com/Senzing/postgresql-performance) - Tweaks to PostgreSQL and the Senzing DDL
21 | 1. [rabbitmq-performance](https://github.com/Senzing/rabbitmq-performance) - Tweeks to RabbitMQ
22 | 1. [video](https://github.com/Senzing/video) - Videos available at
23 |
24 | ## Mapper
25 |
26 | *Convert industry standard formats to Senzing-ready format.*
27 |
28 | 1. [mapper-base](https://github.com/Senzing/mapper-base) - Base functions used to map a variety of formats to a Senzing-acceptable format.
29 | 1. [mapper-csv](https://github.com/Senzing/mapper-csv) - Exemplar artifacts (files) that can be used in other Senzing repositories.
30 | 1. [mapper-dnb](https://github.com/Senzing/mapper-dnb) - Map DNB format into Senzing format.
31 | 1. [mapper-dowjones](https://github.com/Senzing/mapper-dowjones) - Map Dow Jones Watchlist format into Senzing format.
32 | 1. [mapper-icij](https://github.com/Senzing/mapper-icij) - Map ICIJ format into Senzing format.
33 | 1. [mapper-leie](https://github.com/Senzing/mapper-leie) - Map US HHS LEIE into Senzing format.
34 | 1. [mapper-nomino](https://github.com/Senzing/mapper-nomino) - Map Nomino format into Senzing format.
35 | 1. [mapper-npi](https://github.com/Senzing/mapper-npi) - Map NPPES NPI Registry into Senzing format.
36 | 1. [mapper-ofac](https://github.com/Senzing/mapper-ofac) - Map OFAC into Senzing format.
37 | 1. [mapper-openc](https://github.com/Senzing/mapper-openc) - Map Open Corporate into Senzing format.
38 | 1. [mapper-opensanctions](https://github.com/Senzing/mapper-opensanctions) - Map Open Sanctions into Senzing format.
39 | 1. [mapper-sayari-spark](https://github.com/Senzing/mapper-sayari-spark) - Map Sayari's global corporate data into Senzing format.
40 | 1. [mapper-spire](https://github.com/Senzing/mapper-spire) - Map Spire vessel master and owners into Senzing format.
41 |
42 | ## Resources
43 |
44 | *Non-code information.*
45 |
46 | 1. [awesome](https://github.com/Senzing/awesome) - Curated list of awesome software and resources for Senzing, The First Real-Time AI for Entity Resolution.
47 | 1. [senzing-entity-specification](https://github.com/Senzing/senzing-entity-specification) - Complete Senzing Entity Specification and Attribute Dictionary.
48 | 1. [senzing.github.io](https://github.com/Senzing/senzing.github.io) - Organization site at
49 |
50 | ## Features and bugs
51 |
52 | *How to request new features and bug fixes.*
53 |
54 | 1. [Request bug fix](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-bug-fix.md)
55 | 1. [Request new feature in existing repository](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-new-feature-in-existing-repository.md)
56 | 1. [Request new feature](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-new-feature.md)
57 |
58 | ## Other awesome sites
59 |
60 | *Our thanks to those who blazed the 'awesome' trail before us.*
61 |
62 | - General:
63 | [sindresorhus/awesome](https://github.com/sindresorhus/awesome),
64 | - GoLang:
65 | [avelino/awesome-go](https://github.com/avelino/awesome-go)
66 | - Java:
67 | [java-lang/awesome-java](https://github.com/java-lang/awesome-java),
68 | [akullpp/awesome-java](https://github.com/akullpp/awesome-java),
69 | [awesome-java](https://github.com/uhub/awesome-java)
70 | - JavaScript:
71 | [sorrycc/awesome-javascript](https://github.com/sorrycc/awesome-javascript),
72 | [uhub/awesome-javascript](https://github.com/uhub/awesome-javascript)
73 | - PHP:
74 | [https://github.com/uhub/awesome-php](https://github.com/uhub/awesome-php),
75 | [ziadoz/awesome-php](https://github.com/ziadoz/awesome-php)
76 | - Python:
77 | [vinta/awesome-python](https://github.com/vinta/awesome-python)
78 |
--------------------------------------------------------------------------------
/awesome.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # -----------------------------------------------------------------------------
4 | # awesome.py
5 | #
6 | # References:
7 | # - GitHub
8 | # - https://github.com/PyGithub/PyGithub
9 | # - https://pygithub.readthedocs.io/
10 | # - https://pygithub.readthedocs.io/en/latest/github_objects.html
11 | # -----------------------------------------------------------------------------
12 |
13 | import argparse
14 | import json
15 | import linecache
16 | import logging
17 | import os
18 | import signal
19 | import sys
20 | import time
21 | from github import Github
22 | import github
23 |
24 | __all__ = []
25 | __version__ = "1.0.0" # See https://www.python.org/dev/peps/pep-0396/
26 | __date__ = '2020-06-30'
27 | __updated__ = '2022-06-20'
28 |
29 | PRODUCT_ID = "5016"
30 | log_format = '%(asctime)s %(message)s'
31 |
32 | # The "configuration_locator" describes where configuration variables are in:
33 | # 1) Command line options, 2) Environment variables, 3) Configuration files, 4) Default values
34 |
35 | configuration_locator = {
36 | "debug": {
37 | "default": False,
38 | "env": "GITHUB_DEBUG",
39 | "cli": "debug"
40 | },
41 | "github_access_token": {
42 | "default": None,
43 | "env": "GITHUB_ACCESS_TOKEN",
44 | "cli": "github-access-token"
45 | },
46 | "organization": {
47 | "default": "Senzing",
48 | "env": "GITHUB_ORGANIZATION",
49 | "cli": "organization"
50 | },
51 | "subcommand": {
52 | "default": None,
53 | "env": "GITHUB_SUBCOMMAND",
54 | }
55 | }
56 |
57 | # Enumerate keys in 'configuration_locator' that should not be printed to the log.
58 |
59 | keys_to_redact = [
60 | "github_access_token",
61 | ]
62 |
63 | # -----------------------------------------------------------------------------
64 | # Name mapping.
65 | # -----------------------------------------------------------------------------
66 |
67 | awesome_topics = {
68 | "top-pick": {
69 | "title": "Senzing's Top Picks",
70 | "description": "Recommended projects from the team at Senzing.",
71 | "members": []
72 | },
73 | "documentation": {
74 | "title": "Documentation",
75 | "description": "Documentation on Senzing usage.",
76 | "members": [
77 | {
78 | "name": "Promoted articles",
79 | "url": "https://senzing.zendesk.com/hc/en-us",
80 | "description": "Promoted articles."
81 | }, {
82 | "name": "Senzing API for Developers",
83 | "url": "https://senzing.zendesk.com/hc/en-us/categories/360000120514-Senzing-API-for-Developers-",
84 | "description": "Senzing API for Developers."
85 | }, {
86 | "name": "Tags used in GitHub",
87 | "url": "https://github.com/Senzing/knowledge-base/blob/main/lists/github-tags-used.md",
88 | "description": "GitHub tags for Senzing artifacts."
89 | }
90 | ]
91 | },
92 | "demonstration": {
93 | "title": "Demonstrations",
94 | "description": "Step-by-step instructions demonstrating use of Senzing.",
95 | "members": []
96 | },
97 | "dockerfile": {
98 | "title": "Dockerfiles",
99 | "description": "Repositories with Dockerfiles.",
100 | "members": []
101 | },
102 | "docker-hub": {
103 | "title": "DockerHub",
104 | "description": "Git repositories with Docker images on [DockerHub](https://hub.docker.com/r/senzing/).",
105 | "members": []
106 | },
107 | "docker-compose": {
108 | "title": "docker-compose",
109 | "description": "Docker formations using docker-compose.",
110 | "members": []
111 | },
112 | "g2tool": {
113 | "title": "G2Tools",
114 | "description": "G2Tools distributed with Senzing API package.",
115 | "members": []
116 | },
117 | "kubernetes": {
118 | "title": "Kubernetes",
119 | "description": "Step-by-step instructions demonstrating use of Senzing on kubernetes-based systems.",
120 | "members": []
121 | },
122 | "helm-chart": {
123 | "title": "Helm Charts",
124 | "description": "Git repositories with Helm Charts for Senzing on kubernetes-based systems.",
125 | "members": []
126 | },
127 | "aws-environment": {
128 | "title": "AWS Environment",
129 | "description": "Projects specific to Amazon Web Services environment.",
130 | "members": []
131 | },
132 | "azure-environment": {
133 | "title": "Azure Environment",
134 | "description": "Projects specific to Microsoft's Azure environment.",
135 | "members": []
136 | },
137 | "example": {
138 | "title": "Examples",
139 | "description": "Code that shows how to perform a task.",
140 | "members": []
141 | },
142 | "mapper": {
143 | "title": "Mapper",
144 | "description": "Convert industry standard formats to Senzing-ready format.",
145 | "members": []
146 | },
147 | "resource": {
148 | "title": "Resources",
149 | "description": "Non-code information.",
150 | "members": []
151 | },
152 | "sdk": {
153 | "title": "SDKs",
154 | "description": "Software development kits for various platforms.",
155 | "members": []
156 | },
157 | "ui-component": {
158 | "title": "User Interface",
159 | "description": "User interfaces for Senzing.",
160 | "members": []
161 | },
162 | "utility": {
163 | "title": "Utilities",
164 | "description": "Tools for working with Senzing.",
165 | "members": []
166 | },
167 | "under-construction": {
168 | "title": "Under construction",
169 | "description": "Being worked on. a.k.a. Fresh meat.",
170 | "members": []
171 | },
172 | }
173 |
174 | prolog_lines = [
175 | "# awesome",
176 | "",
177 | "Curated list of awesome Senzing software and resources.",
178 | "Inspired by [other awesome sites](#other-awesome-sites).",
179 | "",
180 | "## Contents",
181 | "",
182 | "1. [Senzing's Top Picks](#senzings-top-picks)",
183 | "1. [Documentation](#documentation)",
184 | "1. [Demonstrations](#demonstrations)",
185 | "1. Docker",
186 | " 1. [Dockerfiles](#dockerfiles)",
187 | " 1. [DockerHub](#dockerhub)",
188 | " 1. [docker-compose](#docker-compose)",
189 | " 1. [Kubernetes](#kubernetes)",
190 | " 1. [Helm Charts](#helm-charts)",
191 | "1. Environment",
192 | " 1. [AWS environment](#aws-environment)",
193 | " 1. [Azure environment](#azure-environment)",
194 | "1. [Mapper](#mapper)",
195 | "1. [Resources](#resources)",
196 | "1. [User Interface](#user-interface)",
197 | "1. [Utilities](#utilities)",
198 | " 1. [G2Tools](#g2tools)",
199 | "1. [Under construction](#under-construction)",
200 | "1. [Features and bugs](#features-and-bugs)",
201 | "1. [Other awesome sites](#other-awesome-sites)",
202 | ]
203 |
204 | epilog_lines = [
205 | "",
206 | "## Features and bugs",
207 | "",
208 | "*How to request new features and bug fixes.*",
209 | "",
210 | "1. [Request bug fix](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-bug-fix.md)",
211 | "1. [Request new feature in existing repository](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-new-feature-in-existing-repository.md)",
212 | "1. [Request new feature](https://github.com/Senzing/knowledge-base/blob/main/HOWTO/request-new-feature.md)",
213 | "",
214 | "## Other awesome sites",
215 | "",
216 | "*Our thanks to those who blazed the 'awesome' trail before us.*",
217 | "",
218 | "- General:",
219 | " [sindresorhus/awesome](https://github.com/sindresorhus/awesome),",
220 | "- GoLang:",
221 | " [avelino/awesome-go](https://github.com/avelino/awesome-go)",
222 | "- Java:",
223 | " [java-lang/awesome-java](https://github.com/java-lang/awesome-java),",
224 | " [akullpp/awesome-java](https://github.com/akullpp/awesome-java),",
225 | " [awesome-java](https://github.com/uhub/awesome-java)",
226 | "- JavaScript:",
227 | " [sorrycc/awesome-javascript](https://github.com/sorrycc/awesome-javascript),",
228 | " [uhub/awesome-javascript](https://github.com/uhub/awesome-javascript)",
229 | "- PHP:",
230 | " [https://github.com/uhub/awesome-php](https://github.com/uhub/awesome-php),",
231 | " [ziadoz/awesome-php](https://github.com/ziadoz/awesome-php)",
232 | "- Python:",
233 | " [vinta/awesome-python](https://github.com/vinta/awesome-python)",
234 | ]
235 |
236 | # -----------------------------------------------------------------------------
237 | # Define argument parser
238 | # -----------------------------------------------------------------------------
239 |
240 |
241 | def get_parser():
242 | ''' Parse commandline arguments. '''
243 |
244 | subcommands = {
245 | 'awesome-groups': {
246 | "help": 'Print awesome groups.',
247 | "argument_aspects": ["github"],
248 | },
249 | 'awesome-page': {
250 | "help": 'Create the awesome page.',
251 | "argument_aspects": ["github"],
252 | },
253 | 'awesome-page-excluded': {
254 | "help": 'List repositories that are not on Awesome page.',
255 | "argument_aspects": ["github"],
256 | },
257 | 'version': {
258 | "help": 'Print version of program.',
259 | },
260 | }
261 |
262 | # Define argument_aspects.
263 |
264 | argument_aspects = {
265 | "github": {
266 | "--github-access-token": {
267 | "dest": "github_access_token",
268 | "metavar": "GITHUB_ACCESS_TOKEN",
269 | "help": "GitHub Personal Access token. See https://github.com/settings/tokens"
270 | },
271 | "--debug": {
272 | "dest": "debug",
273 | "action": "store_true",
274 | "help": "Enable debugging. (GITHUB_DEBUG) Default: False"
275 | },
276 | "--organization": {
277 | "dest": "organization",
278 | "metavar": "GITHUB_ORGANIZATION",
279 | "help": "GitHub account/organization name. Default: Senzing"
280 | },
281 | },
282 | }
283 |
284 | # Augment "subcommands" variable with arguments specified by aspects.
285 |
286 | for subcommand, subcommand_value in subcommands.items():
287 | if 'argument_aspects' in subcommand_value:
288 | for aspect in subcommand_value['argument_aspects']:
289 | if 'arguments' not in subcommands[subcommand]:
290 | subcommands[subcommand]['arguments'] = {}
291 | arguments = argument_aspects.get(aspect, {})
292 | for argument, argument_value in arguments.items():
293 | subcommands[subcommand]['arguments'][argument] = argument_value
294 |
295 | parser = argparse.ArgumentParser(prog="github-tasks.py", description="Reports from GitHub.")
296 | subparsers = parser.add_subparsers(dest='subcommand', help='Subcommands (GITHUB_SUBCOMMAND):')
297 |
298 | for subcommand_key, subcommand_values in subcommands.items():
299 | subcommand_help = subcommand_values.get('help', "")
300 | subcommand_arguments = subcommand_values.get('arguments', {})
301 | subparser = subparsers.add_parser(subcommand_key, help=subcommand_help)
302 | for argument_key, argument_values in subcommand_arguments.items():
303 | subparser.add_argument(argument_key, **argument_values)
304 |
305 | return parser
306 |
307 | # -----------------------------------------------------------------------------
308 | # Message handling
309 | # -----------------------------------------------------------------------------
310 |
311 | # 1xx Informational (i.e. logging.info())
312 | # 3xx Warning (i.e. logging.warning())
313 | # 5xx User configuration issues (either logging.warning() or logging.err() for Client errors)
314 | # 7xx Internal error (i.e. logging.error for Server errors)
315 | # 9xx Debugging (i.e. logging.debug())
316 |
317 |
318 | MESSAGE_INFO = 100
319 | MESSAGE_WARN = 300
320 | MESSAGE_ERROR = 700
321 | MESSAGE_DEBUG = 900
322 |
323 | message_dictionary = {
324 | "100": "github-" + PRODUCT_ID + "{0:04d}I",
325 | "101": "Added Repository: {0} Label: {1}",
326 | "102": "Updated Repository: {0} Label: {1}",
327 | "103": "Deleted Repository: {0} Label: {1}",
328 | "104": "Repository '{0}' has been archived. Not modifying its labels.",
329 | "293": "For information on warnings and errors, see https://github.com/docktermj/python-github",
330 | "295": "Sleeping infinitely.",
331 | "296": "Sleeping {0} seconds.",
332 | "297": "Enter {0}",
333 | "298": "Exit {0}",
334 | "299": "{0}",
335 | "300": "github-" + PRODUCT_ID + "{0:04d}W",
336 | "499": "{0}",
337 | "500": "github-" + PRODUCT_ID + "{0:04d}E",
338 | "696": "Bad GITHUB_SUBCOMMAND: {0}.",
339 | "697": "No processing done.",
340 | "698": "Program terminated with error.",
341 | "699": "{0}",
342 | "700": "github-" + PRODUCT_ID + "{0:04d}E",
343 | "701": "GITHUB_ACCESS_TOKEN is required",
344 | "899": "{0}",
345 | "900": "github-" + PRODUCT_ID + "{0:04d}D",
346 | "999": "{0}",
347 | }
348 |
349 |
350 | def message(index, *args):
351 | index_string = str(index)
352 | template = message_dictionary.get(index_string, "No message for index {0}.".format(index_string))
353 | return template.format(*args)
354 |
355 |
356 | def message_generic(generic_index, index, *args):
357 | index_string = str(index)
358 | return "{0} {1}".format(message(generic_index, index), message(index, *args))
359 |
360 |
361 | def message_info(index, *args):
362 | return message_generic(MESSAGE_INFO, index, *args)
363 |
364 |
365 | def message_warning(index, *args):
366 | return message_generic(MESSAGE_WARN, index, *args)
367 |
368 |
369 | def message_error(index, *args):
370 | return message_generic(MESSAGE_ERROR, index, *args)
371 |
372 |
373 | def message_debug(index, *args):
374 | return message_generic(MESSAGE_DEBUG, index, *args)
375 |
376 |
377 | def get_exception():
378 | ''' Get details about an exception. '''
379 | exception_type, exception_object, traceback = sys.exc_info()
380 | frame = traceback.tb_frame
381 | line_number = traceback.tb_lineno
382 | filename = frame.f_code.co_filename
383 | linecache.checkcache(filename)
384 | line = linecache.getline(filename, line_number, frame.f_globals)
385 | return {
386 | "filename": filename,
387 | "line_number": line_number,
388 | "line": line.strip(),
389 | "exception": exception_object,
390 | "type": exception_type,
391 | "traceback": traceback,
392 | }
393 |
394 | # -----------------------------------------------------------------------------
395 | # Configuration
396 | # -----------------------------------------------------------------------------
397 |
398 |
399 | def get_configuration(args):
400 | ''' Order of precedence: CLI, OS environment variables, INI file, default. '''
401 | result = {}
402 |
403 | # Copy default values into configuration dictionary.
404 |
405 | for key, value in list(configuration_locator.items()):
406 | result[key] = value.get('default', None)
407 |
408 | # "Prime the pump" with command line args. This will be done again as the last step.
409 |
410 | for key, value in list(args.__dict__.items()):
411 | new_key = key.format(subcommand.replace('-', '_'))
412 | if value:
413 | result[new_key] = value
414 |
415 | # Copy OS environment variables into configuration dictionary.
416 |
417 | for key, value in list(configuration_locator.items()):
418 | os_env_var = value.get('env', None)
419 | if os_env_var:
420 | os_env_value = os.getenv(os_env_var, None)
421 | if os_env_value:
422 | result[key] = os_env_value
423 |
424 | # Copy 'args' into configuration dictionary.
425 |
426 | for key, value in list(args.__dict__.items()):
427 | new_key = key.format(subcommand.replace('-', '_'))
428 | if value:
429 | result[new_key] = value
430 |
431 | # Special case: subcommand from command-line
432 |
433 | if args.subcommand:
434 | result['subcommand'] = args.subcommand
435 |
436 | # Special case: Change boolean strings to booleans.
437 |
438 | booleans = [
439 | 'debug',
440 | ]
441 | for boolean in booleans:
442 | boolean_value = result.get(boolean)
443 | if isinstance(boolean_value, str):
444 | boolean_value_lower_case = boolean_value.lower()
445 | if boolean_value_lower_case in ['true', '1', 't', 'y', 'yes']:
446 | result[boolean] = True
447 | else:
448 | result[boolean] = False
449 |
450 | # Special case: Change integer strings to integers.
451 |
452 | integers = []
453 | for integer in integers:
454 | integer_string = result.get(integer)
455 | result[integer] = int(integer_string)
456 |
457 | return result
458 |
459 |
460 | def validate_configuration(config):
461 | ''' Check aggregate configuration from commandline options, environment variables, config files, and defaults. '''
462 |
463 | user_warning_messages = []
464 | user_error_messages = []
465 |
466 | # Perform subcommand specific checking.
467 |
468 | subcommand = config.get('subcommand')
469 |
470 | if subcommand in ['comments']:
471 |
472 | if not config.get('github_access_token'):
473 | user_error_messages.append(message_error(701))
474 |
475 | # Log warning messages.
476 |
477 | for user_warning_message in user_warning_messages:
478 | logging.warning(user_warning_message)
479 |
480 | # Log error messages.
481 |
482 | for user_error_message in user_error_messages:
483 | logging.error(user_error_message)
484 |
485 | # Log where to go for help.
486 |
487 | if len(user_warning_messages) > 0 or len(user_error_messages) > 0:
488 | logging.info(message_info(293))
489 |
490 | # If there are error messages, exit.
491 |
492 | if len(user_error_messages) > 0:
493 | exit_error(697)
494 |
495 |
496 | def redact_configuration(config):
497 | ''' Return a shallow copy of config with certain keys removed. '''
498 | result = config.copy()
499 | for key in keys_to_redact:
500 | result.pop(key)
501 | return result
502 |
503 | # -----------------------------------------------------------------------------
504 | # Utility functions
505 | # -----------------------------------------------------------------------------
506 |
507 |
508 | def create_signal_handler_function(args):
509 | ''' Tricky code. Uses currying technique. Create a function for signal handling.
510 | that knows about "args".
511 | '''
512 |
513 | def result_function(signal_number, frame):
514 | logging.info(message_info(298, args))
515 | sys.exit(0)
516 |
517 | return result_function
518 |
519 |
520 | def bootstrap_signal_handler(signal, frame):
521 | sys.exit(0)
522 |
523 |
524 | def entry_template(config):
525 | ''' Format of entry message. '''
526 | debug = config.get("debug", False)
527 | config['start_time'] = time.time()
528 | if debug:
529 | final_config = config
530 | else:
531 | final_config = redact_configuration(config)
532 | config_json = json.dumps(final_config, sort_keys=True)
533 | return message_info(297, config_json)
534 |
535 |
536 | def exit_template(config):
537 | ''' Format of exit message. '''
538 | debug = config.get("debug", False)
539 | stop_time = time.time()
540 | config['stop_time'] = stop_time
541 | config['elapsed_time'] = stop_time - config.get('start_time', stop_time)
542 | if debug:
543 | final_config = config
544 | else:
545 | final_config = redact_configuration(config)
546 | config_json = json.dumps(final_config, sort_keys=True)
547 | return message_info(298, config_json)
548 |
549 |
550 | def exit_error(index, *args):
551 | ''' Log error message and exit program. '''
552 | logging.error(message_error(index, *args))
553 | logging.error(message_error(698))
554 | sys.exit(1)
555 |
556 |
557 | def exit_silently():
558 | ''' Exit program. '''
559 | sys.exit(1)
560 |
561 |
562 | def key_member_name(object):
563 | return object.get("name")
564 |
565 | # -----------------------------------------------------------------------------
566 | # do_* functions
567 | # Common function signature: do_XXX(args)
568 | # -----------------------------------------------------------------------------
569 |
570 |
571 | def do_awesome_groups(args):
572 | ''' Do a task. '''
573 |
574 | # Get context from CLI, environment variables, and ini files.
575 |
576 | config = get_configuration(args)
577 |
578 | # Prolog.
579 |
580 | logging.info(entry_template(config))
581 |
582 | # Validate input.
583 |
584 | validate_configuration(config)
585 |
586 | # Pull variables from config.
587 |
588 | github_access_token = config.get("github_access_token")
589 | organization = config.get("organization")
590 |
591 | # Log into GitHub.
592 |
593 | github = Github(github_access_token)
594 |
595 | # Iterate through all repositories.
596 |
597 | github_organization = github.get_organization(organization)
598 | for repo in github_organization.get_repos():
599 |
600 | # Get topics for the repository.
601 |
602 | topics = repo.get_topics()
603 |
604 | # Black-listed topics.
605 |
606 | if "deprecated" in topics:
607 | continue
608 | if "obsolete" in topics:
609 | continue
610 | if "archived" in topics:
611 | continue
612 |
613 | # Process only specified topics.
614 |
615 | for topic in topics:
616 | if topic in awesome_topics.keys():
617 | member = {
618 | "name": repo.name,
619 | "url": repo.html_url,
620 | "description": repo.description
621 | }
622 | awesome_topics.get(topic, []).get("members", []).append(member)
623 |
624 | # Print groups.
625 |
626 | for topic_key, topic_value in awesome_topics.items():
627 | print("\n## {0}".format(topic_value.get("title", "Unknown")))
628 | print("\n*{0}*\n".format(topic_value.get("description", "Unknown")))
629 |
630 | # Print members in alphabetical order.
631 |
632 | members = sorted(topic_value.get("members", []), key=key_member_name)
633 | for member in members:
634 | print("1. [{0}]({1}) - {2}".format(member.get("name"), member.get("url"), member.get("description", "")))
635 |
636 | # Epilog.
637 |
638 | logging.info(exit_template(config))
639 |
640 |
641 | def do_awesome_page(args):
642 | ''' Do a task. '''
643 |
644 | # Get context from CLI, environment variables, and ini files.
645 |
646 | config = get_configuration(args)
647 |
648 | # Validate input.
649 |
650 | validate_configuration(config)
651 |
652 | # Pull variables from config.
653 |
654 | github_access_token = config.get("github_access_token")
655 | organization = config.get("organization")
656 |
657 | # Log into GitHub.
658 |
659 | github = Github(github_access_token)
660 |
661 | # Iterate through all repositories.
662 |
663 | github_organization = github.get_organization(organization)
664 | for repo in github_organization.get_repos():
665 |
666 | # Get topics for the repository.
667 |
668 | topics = repo.get_topics()
669 |
670 | # Black-listed topics.
671 |
672 | if "archived" in topics:
673 | continue
674 |
675 | elif "deprecated" in topics:
676 | continue
677 |
678 | elif "not-in-awesome" in topics:
679 | continue
680 |
681 | # Separate out "obsolete" repositories.
682 |
683 | elif "obsolete" in topics:
684 | continue
685 |
686 | # Separate out "obsolete" repositories.
687 |
688 | elif "under-construction" in topics:
689 | member = {
690 | "name": repo.name,
691 | "url": repo.html_url,
692 | "description": repo.description
693 | }
694 | awesome_topics.get("under-construction", []).get("members", []).append(member)
695 |
696 | # After passing the "guards" (obsolete, deprecated, archived), process repository.
697 |
698 | else:
699 |
700 | # Process only specified topics.
701 |
702 | for topic in topics:
703 | if topic in awesome_topics.keys():
704 | member = {
705 | "name": repo.name,
706 | "url": repo.html_url,
707 | "description": repo.description
708 | }
709 | awesome_topics.get(topic, []).get("members", []).append(member)
710 |
711 | # Print prolog.
712 |
713 | for prolog_line in prolog_lines:
714 | print(prolog_line)
715 |
716 | # Print groups.
717 |
718 | for topic_key, topic_value in awesome_topics.items():
719 | print("\n## {0}".format(topic_value.get("title", "Unknown")))
720 | print("\n*{0}*\n".format(topic_value.get("description", "Unknown")))
721 |
722 | # Print members in alphabetical order.
723 |
724 | members = sorted(topic_value.get("members", []), key=key_member_name)
725 | for member in members:
726 | print("1. [{0}]({1}) - {2}".format(member.get("name"), member.get("url"), member.get("description", "")))
727 |
728 | # Print epilog.
729 |
730 | for epilog_line in epilog_lines:
731 | print(epilog_line)
732 |
733 |
734 | def do_awesome_page_excluded(args):
735 | ''' Do a task. '''
736 |
737 | # Get context from CLI, environment variables, and ini files.
738 |
739 | config = get_configuration(args)
740 |
741 | # Validate input.
742 |
743 | validate_configuration(config)
744 |
745 | # Pull variables from config.
746 |
747 | github_access_token = config.get("github_access_token")
748 | organization = config.get("organization")
749 |
750 | # Log into GitHub.
751 |
752 | github = Github(github_access_token)
753 |
754 | # Iterate through all repositories.
755 |
756 | github_organization = github.get_organization(organization)
757 | for repo in github_organization.get_repos():
758 |
759 | # Get topics for the repository.
760 |
761 | topics = repo.get_topics()
762 |
763 | # Black-listed topics.
764 |
765 | if "archived" in topics:
766 | print(" Archived: {}".format(repo.name))
767 | elif "deprecated" in topics:
768 | print("Deprecated: {}".format(repo.name))
769 | elif "not-in-awesome" in topics:
770 | print(" Excluded: {}".format(repo.name))
771 | elif len(topics) == 0:
772 | print("No topics: {}".format(repo.name))
773 | else:
774 | found = False
775 | for topic in topics:
776 | if topic in awesome_topics.keys():
777 | found = True
778 | if not found:
779 | print("Not found: {}".format(repo.name))
780 |
781 |
782 | def do_version(args):
783 | ''' Log version information. '''
784 |
785 | logging.info(message_info(294, __version__, __updated__))
786 |
787 | # -----------------------------------------------------------------------------
788 | # Main
789 | # -----------------------------------------------------------------------------
790 |
791 |
792 | if __name__ == "__main__":
793 |
794 | # Configure logging. See https://docs.python.org/2/library/logging.html#levels
795 |
796 | log_level_map = {
797 | "notset": logging.NOTSET,
798 | "debug": logging.DEBUG,
799 | "info": logging.INFO,
800 | "fatal": logging.FATAL,
801 | "warning": logging.WARNING,
802 | "error": logging.ERROR,
803 | "critical": logging.CRITICAL
804 | }
805 |
806 | log_level_parameter = os.getenv("GITHUB_LOG_LEVEL", "info").lower()
807 | log_level = log_level_map.get(log_level_parameter, logging.INFO)
808 | logging.basicConfig(format=log_format, level=log_level)
809 |
810 | # Trap signals temporarily until args are parsed.
811 |
812 | signal.signal(signal.SIGTERM, bootstrap_signal_handler)
813 | signal.signal(signal.SIGINT, bootstrap_signal_handler)
814 |
815 | # Parse the command line arguments.
816 |
817 | subcommand = os.getenv("GITHUB_SUBCOMMAND", None)
818 | parser = get_parser()
819 | if len(sys.argv) > 1:
820 | args = parser.parse_args()
821 | subcommand = args.subcommand
822 | elif subcommand:
823 | args = argparse.Namespace(subcommand=subcommand)
824 | else:
825 | parser.print_help()
826 | if len(os.getenv("GITHUB_DOCKER_LAUNCHED", "")):
827 | subcommand = "sleep"
828 | args = argparse.Namespace(subcommand=subcommand)
829 | do_sleep(args)
830 | exit_silently()
831 |
832 | # Catch interrupts. Tricky code: Uses currying.
833 |
834 | signal_handler = create_signal_handler_function(args)
835 | signal.signal(signal.SIGINT, signal_handler)
836 | signal.signal(signal.SIGTERM, signal_handler)
837 |
838 | # Transform subcommand from CLI parameter to function name string.
839 |
840 | subcommand_function_name = "do_{0}".format(subcommand.replace('-', '_'))
841 |
842 | # Test to see if function exists in the code.
843 |
844 | if subcommand_function_name not in globals():
845 | logging.warning(message_warning(596, subcommand))
846 | parser.print_help()
847 | exit_silently()
848 |
849 | # Tricky code for calling function based on string.
850 |
851 | globals()[subcommand_function_name](args)
852 |
--------------------------------------------------------------------------------
/dependabot-approve-and-merge.yaml:
--------------------------------------------------------------------------------
1 | name: Dependabot approve and merge
2 |
3 | on:
4 | pull_request:
5 | branches: [main]
6 |
7 | permissions:
8 | contents: write
9 | pull-requests: write
10 |
11 | jobs:
12 | dependabot-approve-and-merge:
13 | secrets:
14 | SENZING_GITHUB_CODEOWNER_PR_RW_TOKEN: ${{ secrets.SENZING_GITHUB_CODEOWNER_PR_RW_TOKEN }}
15 | uses: senzing-factory/build-resources/.github/workflows/dependabot-approve-and-merge.yaml@v2
16 |
--------------------------------------------------------------------------------