What is wrong with my JSON? - json

{
“id”: 0,
“isfname”: null,
“islname”: null,
“csfname”: null,
“cslname”: null,
“snf”: null,
“dateadmit”: null,
“csaddress”: null,
“cscsz”: null,
“cstelephone”: null,
“csemail”: null,
“datemaneed”: null,
“csownrent”: null,
“csage”: 0,
“isage”: 0,
“isincome”: [
{
“type”: null,
“gross”: 0,
“deducts”: 0,
“net”: 0
}
],
“csincome”: [
{
“type”: null,
“gross”: 0,
“deducts”: 0,
“net”: 0
}
],
“banks”: [
{
“type”: null,
“desc”: null,
“owner”: null,
“amt”: 0
}
],
“inv”: [
{
“type”: null,
“desc”: null,
“owner”: null,
“amt”: 0
}
],
“csira”: 0,
“isira”: 0,
“csli”: [
{
“type”: null,
“desc”: null,
“cv”: 0,
“fv”: 0
}
],
“isli”: [
{
“type”: null,
“desc”: null,
“cv”: 0,
“fv”: 0
}
],
“veh”: [
{
“type”: null,
“makemodel”: null,
“amt”: 0
}
],
“realty”: [
{
“desc”: null,
“home”: true,
“amt”: 0
}
],
“totals”: [
{
“banks”: 0,
“inv”: 0,
“csli”: 0,
“isli”: 0,
“veh”: 0,
“realty”: 0,
“exemptli”: 0,
“exemptira”: 0,
“exempthome”: 0,
“totalgross”: 0,
“totalexempt”: 0,
“totalcountable”: 0,
“csra”: 0,
“isretained”: 0,
“totalretained”: 0,
“totalspenddown”: 0
}
],
“shelters”: {
“rent”: 0,
“mortgage”: 0,
“retaxes”: 0,
“hoins”: 0,
“sua”: 0,
“shelterstd”: 0
},
“ismedins”: 0,
“isincavail”: 0,
“isinctosnf”: 0,
“isinctocs”: 0,
“spenddown”: {
“snfbill”: 0,
“legal”: 0,
“mortgage”: 0,
“ppf”: 0,
“newvehicle”: 0,
“repairs”: 0
},
“otherspenddown”: [
{
“annuity”: 0,
“other”: null
}
],
“manos”: {
“minmmna”: 0,
“maxmmna”: 0,
“mincsra”: 0,
“maxcsra”: 0,
“pna”: 0,
“incomelimit”: 0
}
}

The quotes are all wrong:
“islname”
Should be
"islname"
Did you copy it from MS Word document or something? Don't do that.

according to JSON parser: Unrecognized token '?'
http://json.parser.online.fr
Bad quotes.

Related

Two different nodes giving same call to same MYSQL Database giving different responses

I have my first NodeJS API running. I have two API's now running (TEST and PROD).
These files are DIRECT copies of each other and running via App Manager in Cpanel.
Weirdly, one of the calls (Prod) is giving incorrect information on some of the calls... like it is giving 'old' data.
eg. a record was changed for an 'order' and a locationID was added to the database.
I have checked the database and it was added.
The test call:
https://www.myAPI.com.au/TEST/orders/myOrders/1709
Response:
{
"Result": true,
"order": {
"orderID": 1709,
"chemOrderID": 1243,
"firstName": "test",
"lastName": "test",
"phone": "04123456",
"email": null,
"prefContact": 1,
"itemName": "KN95 Box Of 30 ",
"itemQuantity": 1,
"plu": null,
"modelNumber": null,
"colour": null,
"itemDetails": null,
"supplier": "avacare",
"itemSize": null,
"amountPaid": 0,
"receiptNumber": "00",
"quotedPrice": 69.99,
"orderComments": null,
"reorder": 0,
"isNDIS": 0,
"isNDISPaid": 0,
"onHold": 0,
"requestedBy": 35,
"orderedBy": 35,
"receivedBy": 35,
"finalisedBy": 0,
"overdueBy": 0,
"NDISBy": 0,
"deletedBy": 0,
"requestedByName": "Jac",
"orderedByName": "Jac",
"receivedByName": "Jac",
"finalisedByName": null,
"overdueByName": null,
"deletedByName": null,
"requestedDateShort": "18 Jan",
"orderedDateShort": "18 Jan",
"receivedDateShort": "18 Jan",
"finalisedDateShort": null,
"overdueDateShort": null,
"deletedDateShort": null,
"requestedDate": "2022-01-18T09:40:21",
"orderedDate": "2022-01-18T09:50:33",
"receivedDate": "2022-01-18T12:21:41",
"finalisedDate": null,
"overdueDate": null,
"deletedDate": null,
"etaMaxDateShort": "Thu, 20 Jan",
"etaCode": 2,
"locationID": 199,
"supplierRef": null,
"locationOther": null,
"categoryID": 5,
"categoryName": "GENERAL SHOP"
}
}
Now this is correct. The locationID is updated, the receivedDate, recivedByName and receivedBy are all correct and updated.
The same call on copied API: (same mysql user login. literally a duplicate of the api)
Call:
https://www.myAPI.com.au/prod/orders/myOrders/1709
Response:
{
"Result": true,
"order": {
"orderID": 1709,
"chemOrderID": 1243,
"firstName": "test",
"lastName": "test",
"phone": "04123456",
"email": null,
"prefContact": 1,
"itemName": "KN95 Box Of 30 ",
"itemQuantity": 1,
"plu": null,
"modelNumber": null,
"colour": null,
"itemDetails": null,
"supplier": "avacare",
"itemSize": null,
"amountPaid": 0,
"receiptNumber": "00",
"quotedPrice": 69.99,
"orderComments": null,
"reorder": 0,
"isNDIS": 0,
"isNDISPaid": 0,
"onHold": 0,
"requestedBy": 35,
"orderedBy": 35,
"receivedBy": 0,
"finalisedBy": 0,
"overdueBy": 0,
"NDISBy": 0,
"deletedBy": 0,
"requestedByName": "Jac",
"orderedByName": "Jac",
"receivedByName": null,
"finalisedByName": null,
"overdueByName": null,
"deletedByName": null,
"requestedDateShort": "18 Jan",
"orderedDateShort": "18 Jan",
"receivedDateShort": null,
"finalisedDateShort": null,
"overdueDateShort": null,
"deletedDateShort": null,
"requestedDate": "2022-01-18T09:40:21",
"orderedDate": "2022-01-18T09:50:33",
"receivedDate": null,
"finalisedDate": null,
"overdueDate": null,
"deletedDate": null,
"etaMaxDateShort": "Thu, 20 Jan",
"etaCode": 2,
"locationID": null,
"supplierRef": null,
"locationOther": null,
"categoryID": 5,
"categoryName": "GENERAL SHOP"
}
}
As can be seen, the aforementioned fields aren't filled!?
It's like the call is getting an old version of the database or something...
I can't understand this at all.
There is only one DB, i haven't created a test db, in reality this whole thing is testing (even the prod version), as I am learning and trying to understand how I will go about everything once it is actually live.

How to add an option column in MySQL (Xampp 8.0.0)

I want to modify the table users adding the column crypto
Trying to execute this query but I'm getting an error:
ALTER TABLE `users` ADD COLUMN `crypto` VARCHAR(255) NULL '{"bitcoin": 0, "ethereum": 0, "bitcoin-cash": 0, "bitcoin-sv": 0, "litecoin": 0, "binance-coin": 0, "monero": 0, "dash": 0, "zcash": 0, "maker": 0}';
This is the error: You have an error in your SQL syntax
If I try to create the column manually and setting the default values I get the same error.
Declare a column DEFAULT value with the DEFAULT keyword.
ALTER TABLE `users` ADD COLUMN `crypto` VARCHAR(255) NULL DEFAULT '{"bitcoin": 0, "ethereum": 0, "bitcoin-cash": 0, "bitcoin-sv": 0, "litecoin": 0, "binance-coin": 0, "monero": 0, "dash": 0, "zcash": 0, "maker": 0}';
You just forget DEFAULT in your query:
ALTER TABLE `users` ADD COLUMN `crypto` VARCHAR(255) NULL DEFAULT '{"bitcoin": 0, "ethereum": 0, "bitcoin-cash": 0, "bitcoin-sv": 0, "litecoin": 0, "binance-coin": 0, "monero": 0, "dash": 0, "zcash": 0, "maker": 0}';

how to group by two fileds in datatable in vb.net

I have a sql statment I get the data from it to the datatable but what I need is filtering the data by dataview and create group y with sum the quantity for each group:
SELECT
FatoraReso as xAcc,
AccName AS xAccName,
FatoraDate AS xDate,
FatoraProduct as xProdID,
ProductName AS xProdName,
FatoraPurPrice as xPrice,
sum(FatoraQuan) as xQuan,
COUNT(FatoraID) AS xCarCount
from tblfatora
INNER JOIN tblaccounts ON tblaccounts.AccID = tblfatora.FatoraReso
INNER JOIN tblproducts ON tblproducts.ProductID = tblfatora.FatoraProduct
GROUP BY xAcc,xDate,xProdID,xPrice
UNION ALL
SELECT
FatoraCustomer as xAcc,
AccName AS xAccName,
FatoraDate AS xDate,
FatoraProduct as xProdID,
ProductName AS xProdName,
FatoraSalePrice as xPrice,
sum(FatoraQuan) as xQuan,
COUNT(FatoraID) AS xCarCount
from tblfatora
INNER JOIN tblaccounts ON tblaccounts.AccID = tblfatora.FatoraCustomer
INNER JOIN tblproducts ON tblproducts.ProductID = tblfatora.FatoraProduct
GROUP BY xAcc,xDate,xProdID,xPrice
ORDER BY xProdID,xPrice
I made a filter by the xAcc and xDate and then I didn't know how to apply group by with get the sum for each group.
I saw some solutions about using The LINQ but really I don't anything about LINQ.
so can help me please.
the final table that I want is:
+---------+--------+-------+-----------+
| xProdID | xPrice | xQuan | xCarCount |
+---------+--------+-------+-----------+
| 1 | 55 | 10 | 2 |
+---------+--------+-------+-----------+
| 1 | 60 | 15 | 1 |
+---------+--------+-------+-----------+
| 2 | 150 | 12 | 3 |
+---------+--------+-------+-----------+
| 2 | 155 | 11 | 2 |
+---------+--------+-------+-----------+
tblfatora:
CREATE TABLE `tblfatora` (
`FatoraID` bigint(20) NOT NULL,
`FatoraRef` bigint(20) NOT NULL,
`FatoraCode` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`FatoraDate` date NOT NULL,
`FatoraProduct` int(11) NOT NULL,
`FatoraQuan` double NOT NULL DEFAULT '0',
`FatoraReso` int(11) NOT NULL,
`FatoraPurPrice` double NOT NULL DEFAULT '0',
`FatoraPurTotal` double NOT NULL DEFAULT '0',
`FatoraCustomer` int(11) NOT NULL,
`FatoraSalePrice` double NOT NULL DEFAULT '0',
`FatoraDis` double NOT NULL DEFAULT '0',
`FatoraPlus` double NOT NULL DEFAULT '0',
`FatoraSaleTotal` double NOT NULL DEFAULT '0',
`FatoraDriverPayStatus` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`FatoraDriver` int(11) NOT NULL,
`FatoraCarNo` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`FatoraDriverCost` double NOT NULL DEFAULT '0',
`FatoraDriverCostTotal1` double NOT NULL DEFAULT '0',
`FatoraDriverCostTotal2` double NOT NULL DEFAULT '0',
`FatoraDriverPrice` double NOT NULL DEFAULT '0',
`FatoraDetails1` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`FatoraDetails2` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`FatoraDetails3` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`FatoraPalletQuan` double NOT NULL DEFAULT '0',
`FatoraPalletPrice` double NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT;
tblFatoraData:
INSERT INTO `tblfatora` (`FatoraID`, `FatoraRef`, `FatoraCode`, `FatoraDate`,
`FatoraProduct`, `FatoraQuan`, `FatoraReso`, `FatoraPurPrice`,
`FatoraPurTotal`, `FatoraCustomer`, `FatoraSalePrice`, `FatoraDis`,
`FatoraPlus`, `FatoraSaleTotal`, `FatoraDriverPayStatus`, `FatoraDriver`,
`FatoraCarNo`, `FatoraDriverCost`, `FatoraDriverCostTotal1`,
`FatoraDriverCostTotal2`, `Fato`raDriverPrice`, `FatoraDetails1`,
`FatoraDetails2`, `FatoraDetails3`, `FatoraPalletQuan`, `FatoraPalletPrice`)
VALUES
(1, 202010180304112, '', '2020-10-01', 41, 31, 112, 71, 2201, 93, 71, 0, 0,
2201, 'Paid', 128, '135538', 0, 0, 0, 1, '', '', '', 0, 0),
(2, 202010180720343, '', '2020-10-01', 43, 40, 112, 61, 2440, 83, 68000, 0,
0, 2720000, 'Paid', 129, '', 0, 0, 0, 1, '', '', '', 0, 0),
(3, 202010180807273, '', '2020-10-01', 43, 34, 112, 61, 2074, 341, 72000, 0,
0, 2448000, 'Paid', 130, '8142', 0, 0, 0, 1, '', '', '', 0, 0),
(4, 202010180819273, '', '2020-10-01', 50, 40, 114, 70, 2800, 76, 70, 0, 0,
2800, 'Paid', 131, '', 0, 0, 0, 1250, '', '', '', 0, 0),
(5, 202010180821373, '', '2020-10-01', 55, 39.22, 114, 66, 2588.52, 55, 66,
0, 0, 2588.52, 'Paid', 132, '', 0, 0, 0, 1250, '', '', '', 0, 0),
(6, 202010180823183, '', '2020-10-01', 50, 38, 114, 70, 2660, 360, 70, 0, 0,
2660, 'Paid', 133, '', 0, 0, 0, 1, '', '', '', 0, 0),
(7, 202010180825173, '', '2020-10-01', 50, 39, 114, 70, 2730, 67, 64, 0, 14,
2510, 'Paid', 134, '', 0, 0, 0, 1250, '', '', '', 0, 0),
(8, 202010180832333, '', '2020-10-02', 48, 31, 113, 63, 1953, 64, 56, 0, 0,
1736, 'Paid', 135, '', 0, 0, 0, 1240, '', '', '', 0, 0),
(9, 202010180833593, '', '2020-10-01', 48, 35, 113, 63, 2205, 82, 63, 0, 0,
2205,
'Paid', 136, '', 0, 0, 0, 1, '', '1', '', 0, 0),
(10, 202010180838003, '', '2020-10-01', 35, 35.46, 115, 57, 2021.22, 53, 56,
0, 0, 1985.76, 'Paid', 137, '135280', 0, 0, 0, 1240, '', '', '', 0, 0),
(11, 202010180841213, '', '2020-10-02', 43, 33, 112, 61, 2013, 79, 58, 0, 0,
1914, 'Paid', 138, '', 0, 0, 0, 1240, '', '', '', 0, 0),
(12, 202010180843373, '', '2020-10-02', 43, 39, 112, 61, 2379, 84, 70000, 0,
0, 2730000, 'Paid', 139, '10978', 0, 0, 0, 1, '', '', '', 0, 0),
(13, 202010180846253, '', '2020-10-02', 43, 39, 112, 61, 2379, 225, 56, 0, 0,
2184, 'Paid', 140, '9705', 0, 0, 0, 1240, '', '', '', 0, 0),
(14, 202010180847593, '', '2020-10-02', 43, 40, 112, 61, 2440, 344, 61, 0, 0,
2440, 'Paid', 141, '97464', 0, 0, 0, 1, '', '', '', 0, 0),
(15, 202010180849563, '', '2020-10-02', 43, 36, 112, 61, 2196, 73, 57, 0, 0,
2052, 'Paid', 142, '', 0, 0, 0, 1240, '', '', '', 0, 0),
(16, 202010180852113, '', '2020-10-02', 43, 39, 112, 61, 2379, 357, 61, 0, 0,
2379, 'Paid', 143, '151957', 0, 0, 0, 1, '', '', '', 0, 0)
You can use every Query as basis (subquery) too do more calculations
SELECT
xProdID,
xPrice,
xProdName,
SUM(xQuan) AS xQuan,
SUM(xCarCount) AS xCarCount
FROM (SELECT
FatoraReso AS xAcc,
AccName AS xAccName,
FatoraDate AS xDate,
FatoraProduct AS xProdID,
ProductName AS xProdName,
FatoraPurPrice AS xPrice,
SUM(FatoraQuan) AS xQuan,
COUNT(FatoraID) AS xCarCount
FROM
tblfatora
INNER JOIN
tblaccounts ON tblaccounts.AccID = tblfatora.FatoraReso
INNER JOIN
tblproducts ON tblproducts.ProductID = tblfatora.FatoraProduct
GROUP BY xAcc , xDate , xProdID , xPrice
UNION ALL SELECT
FatoraCustomer AS xAcc,
AccName AS xAccName,
FatoraDate AS xDate,
FatoraProduct AS xProdID,
ProductName AS xProdName,
FatoraSalePrice AS xPrice,
SUM(FatoraQuan) AS xQuan,
COUNT(FatoraID) AS xCarCount
FROM
tblfatora
INNER JOIN
tblaccounts ON tblaccounts.AccID = tblfatora.FatoraCustomer
INNER JOIN
tblproducts ON tblproducts.ProductID = tblfatora.FatoraProduct
GROUP BY xAcc , xDate , xProdID , xPrice) t1
GROUP BY
xProdID , xPrice
ORDER BY xProdID , xPrice
As i wrote in my comment.
''Isee two possibility to get only the dates for one or more date.
The selection depends whetger you have a fast connection and a fast server.
Solution 1;:
You get all data into a table and have a dataview t filter your wanted dates.
then have a Sub which sums up the data according to xProdID , xPrice.
That is suitable if you a slow connection or a slow database server, so that the computer does it all on client side.
Solution 2
You send to the server a new SELECT as posted abouve only you add a where clause which only selects the appropriate dates before the final GROUP BY and SUM.
this works just fine, when all is quite fast.
The aggregation functions lose data, because it has only the max date, this may be enugh, but i don#t believe that it will suffice

How to compare rows from JSON file in angular?

I have this items in a JSON file that I need to compare wherever I have Curr or Prev values and compare if they are equals. this algorithm is with angular 5 but I'm being unable to do this, I did the load function with httpClient
Example :
[{
"id": 1,
"comparisonDate": "2017-06-22",
"milestone": "CURR_PREV",
"udDomain": "BASIS",
"udIdentifier": "332A251000.01",
"rpt": "D70",
"approvedCurr": true,
"approvedPrev": null,
"commercialReferenceCurr": "BASIS - 01.01.2007",
"commercialReferencePrev": null,
"customizationImpactCurr": null,
"customizationImpactPrev": null,
"deliveryTypeCurr": null,
"deliveryTypePrev": null,
"aircraftId": 184,
"aircraftSapId": "580652",
"aircraftName": "BUL 011",
"aircraftSerialNumber": "02713",
"quantityCurr": "1",
"quantityPrev": null,
"statusCurr": "O",
"statusPrev": null,
"typeModification": "CREATION",
"validityCurr": "V",
"validityPrev": null
}, {
"id": 2,
"comparisonDate": "2017-06-22",
"milestone": "CURR_PREV",
"udDomain": "BASIS",
"udIdentifier": "332A270028.01",
"rpt": "E15",
"approvedCurr": true,
"approvedPrev": null,
"commercialReferenceCurr": "BASIS - 01.01.2007",
"commercialReferencePrev": null,
"customizationImpactCurr": null,
"customizationImpactPrev": null,
"deliveryTypeCurr": null,
"deliveryTypePrev": null,
"aircraftId": 184,
"aircraftSapId": "580652",
"aircraftName": "BUL 011",
"aircraftSerialNumber": "02713",
"quantityCurr": "1",
"quantityPrev": null,
"statusCurr": "O",
"statusPrev": null,
"typeModification": "CREATION",
"validityCurr": "V",
"validityPrev": null
}]
this should be with using lodash.
i assume your want something like this
for each object in your array
filter keys that end with "Curr"
for each get Prev property
compare it with curr property
let obj = [{
"id": 1,
"comparisonDate": "2017-06-22",
"milestone": "CURR_PREV",
"udDomain": "BASIS",
"udIdentifier": "332A251000.01",
"rpt": "D70",
"approvedCurr": true,
"approvedPrev": null,
"commercialReferenceCurr": "BASIS - 01.01.2007",
"commercialReferencePrev": null,
"customizationImpactCurr": null,
"customizationImpactPrev": null,
"deliveryTypeCurr": null,
"deliveryTypePrev": null,
"aircraftId": 184,
"aircraftSapId": "580652",
"aircraftName": "BUL 011",
"aircraftSerialNumber": "02713",
"quantityCurr": "1",
"quantityPrev": null,
"statusCurr": "O",
"statusPrev": null,
"typeModification": "CREATION",
"validityCurr": "V",
"validityPrev": null
}, {
"id": 2,
"comparisonDate": "2017-06-22",
"milestone": "CURR_PREV",
"udDomain": "BASIS",
"udIdentifier": "332A270028.01",
"rpt": "E15",
"approvedCurr": true,
"approvedPrev": null,
"commercialReferenceCurr": "BASIS - 01.01.2007",
"commercialReferencePrev": null,
"customizationImpactCurr": null,
"customizationImpactPrev": null,
"deliveryTypeCurr": null,
"deliveryTypePrev": null,
"aircraftId": 184,
"aircraftSapId": "580652",
"aircraftName": "BUL 011",
"aircraftSerialNumber": "02713",
"quantityCurr": "1",
"quantityPrev": null,
"statusCurr": "O",
"statusPrev": null,
"typeModification": "CREATION",
"validityCurr": "V",
"validityPrev": null
}];
obj.forEach(x=>{
Object.keys(x)
.filter(y=>y.endsWith("Curr"))
.forEach(y=>{
let prevProp = y.replace("Curr", "Prev")
console.log(y, x[y]);
console.log(prevProp ,x[prevProp ]);
if(x[y]===x[prevProp ]){
//equal
}else{
//not equal
}
})
})
you could use lodash's _.forEach, _.Keys, _.filter but i think there is not much point on this.

What's the difference between the .width and .w attribute of a Pygame Rect object?

The official pygame documentation states that there are several virtual attributes which can be used to move and align a pygame.Rect instance:
Until now I used myRect.w respectively myRect.h to determine the width or height of an pygame.Rect object. But to complete this graphic I came across the .width and .height attributes.
The interesting thing is that both attributes seem to provide us the same date, as you can see in following code listing:
>>> myRect = pygame.Rect((10, 20), (200,100)) #create a new Rect instance
>>> myRect.w
200
>>> myRect.width
200
>>> myRect.size
(200, 100)
What´s now the difference between these two attribute pairs?
There's no difference. You can take a look at the source of the Rect class:
static PyGetSetDef rect_getsets[] = {
{ "x", (getter)rect_getleft, (setter)rect_setleft, NULL, NULL },
{ "y", (getter)rect_gettop, (setter)rect_settop, NULL, NULL },
{ "w", (getter)rect_getwidth, (setter)rect_setwidth, NULL, NULL },
{ "h", (getter)rect_getheight, (setter)rect_setheight, NULL, NULL },
{ "width", (getter)rect_getwidth, (setter)rect_setwidth, NULL, NULL },
{ "height", (getter)rect_getheight, (setter)rect_setheight, NULL, NULL },
{ "top", (getter)rect_gettop, (setter)rect_settop, NULL, NULL },
{ "left", (getter)rect_getleft, (setter)rect_setleft, NULL, NULL },
{ "bottom", (getter)rect_getbottom, (setter)rect_setbottom, NULL, NULL },
{ "right", (getter)rect_getright, (setter)rect_setright, NULL, NULL },
{ "centerx", (getter)rect_getcenterx, (setter)rect_setcenterx, NULL, NULL },
{ "centery", (getter)rect_getcentery, (setter)rect_setcentery, NULL, NULL },
{ "topleft", (getter)rect_gettopleft, (setter)rect_settopleft, NULL, NULL },
{ "topright", (getter)rect_gettopright, (setter)rect_settopright, NULL,
NULL },
{ "bottomleft", (getter)rect_getbottomleft, (setter)rect_setbottomleft,
NULL, NULL },
{ "bottomright", (getter)rect_getbottomright, (setter)rect_setbottomright,
NULL, NULL },
{ "midtop", (getter)rect_getmidtop, (setter)rect_setmidtop, NULL, NULL },
{ "midleft", (getter)rect_getmidleft, (setter)rect_setmidleft, NULL, NULL },
{ "midbottom", (getter)rect_getmidbottom, (setter)rect_setmidbottom, NULL,
NULL },
{ "midright", (getter)rect_getmidright, (setter)rect_setmidright, NULL,
NULL },
{ "size", (getter)rect_getsize, (setter)rect_setsize, NULL, NULL },
{ "center", (getter)rect_getcenter, (setter)rect_setcenter, NULL, NULL },
{ "__safe_for_unpickling__", (getter)rect_getsafepickle, NULL, NULL, NULL },
{ NULL, 0, NULL, NULL, NULL } /* Sentinel */
};
You can see e.g. that both w and width call rect_getwidth:
/*width*/
static PyObject*
rect_getwidth (PyRectObject *self, void *closure)
{
return PyInt_FromLong (self->r.w);
}
I would still recommend using width/height instead of w/h for readability.