Skip to content

Commit 31d9306

Browse files
authored
Merge pull request #1 from upsidetravel/fix/legal-docs
updated legal docs
2 parents d91c75e + c7b4f98 commit 31d9306

File tree

6 files changed

+43
-31
lines changed

6 files changed

+43
-31
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ You will need:
55

66
## Getting started
77

8-
To get your development environment setup, run:
8+
To get your development environment set up, run:
99

1010
```sh
1111
pip install -e .[dev]
1212
```
1313

14-
This will install the repo version of `graphene-pydantic` and then install the
15-
development dependencies. Once that has completed, you can start developing.
14+
in an activated virtual environment. This will install the repo version of
15+
`graphene-pydantic` and then install the development dependencies. Once that
16+
has completed, you can start developing.
1617

1718
## Contributor License Agreement
1819

20+
1921
We require all contributors to sign the [Upside CLA](./CONTRIBUTOR_LICENSE_AGREEMENT.md).
2022

2123
In simple terms, the CLA affirms that the work you're contributing is original,
@@ -30,5 +32,5 @@ businesses, republish modified source, and more. Please reference the license of
3032
this project to learn more.
3133

3234
To sign the CLA, open a pull request as usual. If you haven't signed the CLA
33-
yet. We cannot merge any pull request until the CLA is signed. You only need to
35+
yet, we cannot merge any pull request until the CLA is signed. You only need to
3436
sign the CLA once.

CONTRIBUTOR_LICENSE_AGREEMENT.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,29 @@
11
# Human-Friendly Summary
22

3-
This is a human-readable summary of (and not a substitute for) the full agreement. This highlights only some of key terms of the CLA. It has no legal value and you should carefully review all the terms of the actual CLA before agreeing.
4-
Grant of copyright license. You give Upside permission to use your copyrighted work in commercial products.
5-
Grant of patent license. If your contributed work uses a patent, you give Upside a license to use that patent including within commercial products. You also agree that you have permission to grant this license.
6-
No Warranty or Support Obligations. By making a contribution, you are not obligating yourself to provide support for the contribution, and you are not taking on any warranty obligations or providing any assurances about how it will perform.
7-
The CLA does not change the terms of the standard open source license used by our software such as Apache. You are still free to use our projects within your own projects or businesses, republish modified source, and more. Please reference the appropriate license for the project you're contributing to learn more.
3+
This is a human-readable summary of (and not a substitute for) the full agreement. This highlights only some of key terms of the CLA. It has no legal value and you should carefully review all the terms of the actual CLA before agreeing. Grant of copyright license. You give Upside permission to use your copyrighted work in commercial products. Grant of patent license. If your contributed work uses a patent, you give Upside a license to use that patent including within commercial products. You also agree that you have permission to grant this license. No Warranty or Support Obligations. By making a contribution, you are not obligating yourself to provide support for the contribution, and you are not taking on any warranty obligations or providing any assurances about how it will perform. The CLA does not change the terms of the standard open source license used by our software such as Apache. You are still free to use our projects within your own projects or businesses, republish modified source, and more. Please reference the appropriate license for the project you’re contributing to learn more.
84

95
# Upside Individual Contributor License Agreement
106

11-
In order to clarify the intellectual property license granted with Contributions from any person or entity, The Upside Travel Company, LLC ("Upside") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Upside; it does not change your rights to use your own Contributions for any other purpose.
7+
In order to clarify the intellectual property license granted with Contributions from any person or entity, The Upside Travel Company, LLC (Upside) must have a Contributor License Agreement (CLA) on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Upside; it does not change your rights to use your own Contributions for any other purpose.
128

139
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Upside. Except for the license granted herein to Upside and recipients of software distributed by Upside, You reserve all right, title, and interest in and to Your Contributions.
1410

1511
1. Definitions.
1612

17-
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Upside. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
13+
You (or Your) shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Upside. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, control means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
1814

19-
"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Upside for inclusion in, or documentation of, any of the products owned or managed by Upside (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Upside or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Upside for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
15+
Contribution shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Upside for inclusion in, or documentation of, any of the products owned or managed by Upside (the Work). For the purposes of this definition, submitted means any form of electronic, verbal, or written communication sent to Upside or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Upside for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as Not a Contribution.
2016

17+
2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Upside and to recipients of software distributed by Upside a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
2118

22-
2. Grant of Copyright License.
23-
24-
Subject to the terms and conditions of this Agreement, You hereby grant to Upside and to recipients of software distributed by Upside a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
25-
26-
27-
3. Grant of Patent License.
28-
29-
Subject to the terms and conditions of this Agreement, You hereby grant to Upside and to recipients of software distributed by Upside a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
30-
19+
3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Upside and to recipients of software distributed by Upside a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
3120

3221
4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Upside, or that your employer has executed a separate Corporate CLA with Upside.
3322

34-
3523
5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
3624

25+
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
3726

38-
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
39-
40-
41-
7. Should You wish to submit work that is not Your original creation, You may submit it to Upside separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
42-
27+
7. Should You wish to submit work that is not Your original creation, You may submit it to Upside separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as “Submitted on behalf of a third-party: [named here]”.
4328

4429
8. You agree to notify Upside of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ Please see [the examples directory](./examples) for more.
7070

7171
This project is under the [Apache License](./LICENSE.md).
7272

73+
### Third Party Code
74+
75+
This project depends on third-party code which is subject to the licenses set forth in [Third Party Licenses](./THIRD_PARTY_LICENSES.md).
76+
7377
### Contributing
7478

7579
Please see the [Contributing Guide](./CONTRIBUTING.md). Note that you must sign the [CLA](./CONTRIBUTOR_LICENSE_AGREEMENT.md).
File renamed without changes.

graphene_pydantic/converters.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from collections import OrderedDict
2+
from collections.abc import Mapping, Sequence
13
import typing as T
24
import uuid
35
import datetime
@@ -149,10 +151,19 @@ def convert_generic_type(type_, field, registry=None):
149151
# Python functions like `isinstance()` don't work
150152
if origin == T.Union:
151153
return convert_union_type(type_, field, registry)
152-
elif origin in (T.Dict, T.OrderedDict, T.Mapping):
154+
elif origin in (T.Dict, T.OrderedDict, T.Mapping, dict, OrderedDict) or issubclass(
155+
origin, Mapping
156+
):
153157
raise ConversionError("Don't know how to handle mappings in Graphene")
154-
elif origin in (T.List, T.Set, T.Collection, T.Iterable):
155-
return List(to_graphene_type(type_, field, registry))
158+
elif origin in (T.List, T.Set, T.Collection, T.Iterable, list, set) or issubclass(
159+
origin, Sequence
160+
):
161+
wrapped_types = getattr(type_, "__args__", [])
162+
if not wrapped_types:
163+
raise ConversionError(
164+
f"Don't know how to handle {type_} (generic: {origin})"
165+
)
166+
return List(to_graphene_type(wrapped_types[0], field, registry))
156167
else:
157168
raise ConversionError(f"Don't know how to handle {type_} (generic: {origin})")
158169

graphene_pydantic/types.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@ def construct_fields(
3131
Currently simply fetches all the attributes from the Pydantic model's __fields__. In
3232
the future we hope to implement field-level overrides that we'll have to merge in.
3333
"""
34+
excluded: typing.Tuple[str, ...] = ()
35+
if exclude_fields:
36+
excluded = exclude_fields
37+
elif only_fields:
38+
excluded = tuple(k for k in model.__fields__ if k not in only_fields)
39+
40+
fields_to_convert = (
41+
(k, v) for k, v in model.__fields__.items() if k not in excluded
42+
)
43+
3444
fields = {}
35-
for name, field in model.__fields__.items():
45+
for name, field in fields_to_convert:
3646
converted = convert_pydantic_field(field, registry)
3747
registry.register_orm_field(obj_type, name, field)
3848
fields[name] = converted

0 commit comments

Comments
 (0)