
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
Instances share objects after copy or created from unpacking a dict Β· Issue #249 Β· pydantic/pydantic
Description:
This is related to #154 and I'm using pydantic v0.12.1 Here is a simple example to show what I mean. >>> class Model(pydantic.BaseModel): ... my_dict: dict ... >>> model1 = Mo...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Photography
- Style & Fashion
- Crafts
Content Management System {π}
What CMS is github.com built with?
Github.com utilizes WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,000,019 visitors per month in the current month.
However, some sources were not loaded, we suggest to reload the page to get complete results.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 4,989,889 paying customers.
The estimated monthly recurring revenue (MRR) is $20,957,532.
The estimated annual recurring revenues (ARR) are $251,490,385.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
model, copy, mydictmylist, samuelcolvin, dict, issue, gangefors, commented, pydantic, data, add, sign, share, created, modelmydict, create, deepcopy, member, case, dont, method, test, objects, unpacking, mydict, mylist, modelmydictmylist, basemodeldict, user, make, agree, deep, cases, contributor, author, navigation, issues, pull, requests, actions, security, instances, closed, class, modelcopy, dictionary, copies, correctly, true, support,
Topics {βοΈ}
async def my_view comment metadata assignees gangefors mentioned deep=false argument samuelcolvin closed add keyword arguments verified 895ddb0 sign class method model base data model support deepcopy operations create copies correctly issues user created classes objects terms docs referenced issue deep copy pydantic v0 share work correctly shallow copies base data {'my_list' significantly slower roughtly aiohttp web framework raise badrequesterror markdown link initial problem add support assigned labels labels type type projects projects milestone milestone relationships my_dict {'my_dict' my_dict input data true copy unpacked dictionary await request unit test test emptied github make sense converting dict model1 nuanced case
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
- Do you want to change the way copy() works or should we add a deepcopy() method to seperate the two?
- Does that make sense?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:Instances share objects after copy or created from unpacking a dict
articleBody:This is related to #154 and I'm using pydantic v0.12.1
Here is a simple example to show what I mean.
```python
>>> class Model(pydantic.BaseModel):
... my_dict: dict
...
>>> model1 = Model(**{'my_dict': {'my_list': [1,2,3]}})
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = model1.copy()
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model2
<Model my_dict={'my_list': []}>
>>> model1
<Model my_dict={'my_list': []}>
```
Another example when created by unpacking a dictionary.
```python
>>> my_dict = {'my_dict': {'my_list': [1,2,3]}}
>>> model1 = Model(**my_dict)
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = Model(**my_dict)
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model1
<Model my_dict={'my_list': []}>
>>> model2
<Model my_dict={'my_list': []}>
```
BaseModel.dict() seems to create copies correctly and can be used instead of .copy() to create a new object as seen with model3 in this example.
```python
>>> model1 = Model(**{'my_dict': {'my_list': [1,2,3]}})
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = model1.copy()
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model3 = Model(**model1.dict())
>>> model3
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model1
<Model my_dict={'my_list': []}>
>>> model2
<Model my_dict={'my_list': []}>
>>> model3
<Model my_dict={'my_list': [1, 2, 3]}>
```
I think this is quite serious since you can't know if you are working with a true copy of a model or not.
I see two things that need to be fixed.
.copy() should create a deepcopy that doesn't share any objects with the model it was copied from. User created classes have to support deepcopy operations to work correctly.
BaseModel(**dict) need to make sure that all items in the dict are deepcopied from the unpacked dictionary.
author:
url:https://github.com/gangefors
type:Person
name:gangefors
datePublished:2018-08-25T12:42:51.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:7
url:https://github.com/249/pydantic/issues/249
context:https://schema.org
headline:Instances share objects after copy or created from unpacking a dict
articleBody:This is related to #154 and I'm using pydantic v0.12.1
Here is a simple example to show what I mean.
```python
>>> class Model(pydantic.BaseModel):
... my_dict: dict
...
>>> model1 = Model(**{'my_dict': {'my_list': [1,2,3]}})
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = model1.copy()
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model2
<Model my_dict={'my_list': []}>
>>> model1
<Model my_dict={'my_list': []}>
```
Another example when created by unpacking a dictionary.
```python
>>> my_dict = {'my_dict': {'my_list': [1,2,3]}}
>>> model1 = Model(**my_dict)
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = Model(**my_dict)
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model1
<Model my_dict={'my_list': []}>
>>> model2
<Model my_dict={'my_list': []}>
```
BaseModel.dict() seems to create copies correctly and can be used instead of .copy() to create a new object as seen with model3 in this example.
```python
>>> model1 = Model(**{'my_dict': {'my_list': [1,2,3]}})
>>> model1
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2 = model1.copy()
>>> model2
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model3 = Model(**model1.dict())
>>> model3
<Model my_dict={'my_list': [1, 2, 3]}>
>>> model2.my_dict['my_list'] = []
>>> model1
<Model my_dict={'my_list': []}>
>>> model2
<Model my_dict={'my_list': []}>
>>> model3
<Model my_dict={'my_list': [1, 2, 3]}>
```
I think this is quite serious since you can't know if you are working with a true copy of a model or not.
I see two things that need to be fixed.
.copy() should create a deepcopy that doesn't share any objects with the model it was copied from. User created classes have to support deepcopy operations to work correctly.
BaseModel(**dict) need to make sure that all items in the dict are deepcopied from the unpacked dictionary.
author:
url:https://github.com/gangefors
type:Person
name:gangefors
datePublished:2018-08-25T12:42:51.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:7
url:https://github.com/249/pydantic/issues/249
Person:
url:https://github.com/gangefors
name:gangefors
url:https://github.com/gangefors
name:gangefors
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:7
interactionType:https://schema.org/CommentAction
userInteractionCount:7
External Links {π}(2)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net