We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ProductCreate weight mutation

![p1](https://user-images.githubusercontent.com/36409853/79555939-f2032000-80d2-11ea-88cc-5e1809e51ec5.PNG)
![p2](https://user-images.githubusercontent.com/36409853/79556174-4b6b4f00-80d3-11ea-96d7-f06ee76bf1ee.PNG)


productCreate mutation

I followed the "amount unit" as said in the comment, but returns a "'StringValue(value='10.00 kg')' value must be a float."
Sorry just a beginner

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `saleor/graphql/core/scalars.py`
Content:
```
1 import decimal
2 
3 import graphene
4 from measurement.measures import Weight
5 
6 from ...core.weight import convert_weight, get_default_weight_unit
7 
8 
9 class Decimal(graphene.Float):
10     """Custom Decimal implementation.
11 
12     Returns Decimal as a float in the API,
13     parses float to the Decimal on the way back.
14     """
15 
16     @staticmethod
17     def parse_literal(node):
18         try:
19             return decimal.Decimal(node.value)
20         except decimal.DecimalException:
21             return None
22 
23     @staticmethod
24     def parse_value(value):
25         try:
26             # Converting the float to str before parsing it to Decimal is
27             # necessary to keep the decimal places as typed
28             value = str(value)
29             return decimal.Decimal(value)
30         except decimal.DecimalException:
31             return None
32 
33 
34 class WeightScalar(graphene.Scalar):
35     @staticmethod
36     def parse_value(value):
37         # Expects value to be a string "amount unit" separated by a single
38         # space.
39         try:
40             value = decimal.Decimal(value)
41         except decimal.DecimalException:
42             return None
43         default_unit = get_default_weight_unit()
44         return Weight(**{default_unit: value})
45 
46     @staticmethod
47     def serialize(weight):
48         if isinstance(weight, Weight):
49             default_unit = get_default_weight_unit()
50             if weight.unit != default_unit:
51                 weight = convert_weight(weight, default_unit)
52             return str(weight)
53         return None
54 
55     @staticmethod
56     def parse_literal(node):
57         return node
58
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/saleor/graphql/core/scalars.py b/saleor/graphql/core/scalars.py
--- a/saleor/graphql/core/scalars.py
+++ b/saleor/graphql/core/scalars.py
@@ -1,6 +1,8 @@
 import decimal
 
 import graphene
+from graphql.language import ast
+from graphql.error import GraphQLError
 from measurement.measures import Weight
 
 from ...core.weight import convert_weight, get_default_weight_unit
@@ -34,14 +36,14 @@
 class WeightScalar(graphene.Scalar):
     @staticmethod
     def parse_value(value):
-        # Expects value to be a string "amount unit" separated by a single
-        # space.
-        try:
-            value = decimal.Decimal(value)
-        except decimal.DecimalException:
-            return None
-        default_unit = get_default_weight_unit()
-        return Weight(**{default_unit: value})
+        weight = None
+        if isinstance(value, dict):
+            weight = Weight(**{value["unit"]: value["value"]})
+        else:
+            weight = WeightScalar.parse_decimal(value)
+        if not weight:
+            raise GraphQLError(f"Unsupported value: {value}")
+        return weight
 
     @staticmethod
     def serialize(weight):
@@ -54,4 +56,35 @@
 
     @staticmethod
     def parse_literal(node):
-        return node
+        weight = None
+        if isinstance(node, ast.ObjectValue):
+            weight = WeightScalar.parse_literal_object(node)
+        else:
+            weight = WeightScalar.parse_decimal(node.value)
+        if not weight:
+            raise GraphQLError(f"Unsupported value: {node.value}")
+        return weight
+
+    @staticmethod
+    def parse_decimal(value):
+        try:
+            value = decimal.Decimal(value)
+        except decimal.DecimalException:
+            return None
+        default_unit = get_default_weight_unit()
+        return Weight(**{default_unit: value})
+
+    @staticmethod
+    def parse_literal_object(node):
+        value = 0
+        unit = get_default_weight_unit()
+
+        for field in node.fields:
+            if field.name.value == "value":
+                try:
+                    value = decimal.Decimal(field.value.value)
+                except decimal.DecimalException:
+                    raise GraphQLError(f"Unsupported value: {field.value.value}")
+            if field.name.value == "unit":
+                unit = field.value.value
+        return Weight(**{unit: value})

{"golden_diff": "diff --git a/saleor/graphql/core/scalars.py b/saleor/graphql/core/scalars.py\n--- a/saleor/graphql/core/scalars.py\n+++ b/saleor/graphql/core/scalars.py\n@@ -1,6 +1,8 @@\n import decimal\n \n import graphene\n+from graphql.language import ast\n+from graphql.error import GraphQLError\n from measurement.measures import Weight\n \n from ...core.weight import convert_weight, get_default_weight_unit\n@@ -34,14 +36,14 @@\n class WeightScalar(graphene.Scalar):\n     @staticmethod\n     def parse_value(value):\n-        # Expects value to be a string \"amount unit\" separated by a single\n-        # space.\n-        try:\n-            value = decimal.Decimal(value)\n-        except decimal.DecimalException:\n-            return None\n-        default_unit = get_default_weight_unit()\n-        return Weight(**{default_unit: value})\n+        weight = None\n+        if isinstance(value, dict):\n+            weight = Weight(**{value[\"unit\"]: value[\"value\"]})\n+        else:\n+            weight = WeightScalar.parse_decimal(value)\n+        if not weight:\n+            raise GraphQLError(f\"Unsupported value: {value}\")\n+        return weight\n \n     @staticmethod\n     def serialize(weight):\n@@ -54,4 +56,35 @@\n \n     @staticmethod\n     def parse_literal(node):\n-        return node\n+        weight = None\n+        if isinstance(node, ast.ObjectValue):\n+            weight = WeightScalar.parse_literal_object(node)\n+        else:\n+            weight = WeightScalar.parse_decimal(node.value)\n+        if not weight:\n+            raise GraphQLError(f\"Unsupported value: {node.value}\")\n+        return weight\n+\n+    @staticmethod\n+    def parse_decimal(value):\n+        try:\n+            value = decimal.Decimal(value)\n+        except decimal.DecimalException:\n+            return None\n+        default_unit = get_default_weight_unit()\n+        return Weight(**{default_unit: value})\n+\n+    @staticmethod\n+    def parse_literal_object(node):\n+        value = 0\n+        unit = get_default_weight_unit()\n+\n+        for field in node.fields:\n+            if field.name.value == \"value\":\n+                try:\n+                    value = decimal.Decimal(field.value.value)\n+                except decimal.DecimalException:\n+                    raise GraphQLError(f\"Unsupported value: {field.value.value}\")\n+            if field.name.value == \"unit\":\n+                unit = field.value.value\n+        return Weight(**{unit: value})\n", "issue": "ProductCreate weight mutation\n\r\n![p1](https://user-images.githubusercontent.com/36409853/79555939-f2032000-80d2-11ea-88cc-5e1809e51ec5.PNG)\r\n![p2](https://user-images.githubusercontent.com/36409853/79556174-4b6b4f00-80d3-11ea-96d7-f06ee76bf1ee.PNG)\r\n\r\n\r\nproductCreate mutation\r\n\r\nI followed the \"amount unit\" as said in the comment, but returns a \"'StringValue(value='10.00 kg')' value must be a float.\"\r\nSorry just a beginner\n", "before_files": [{"content": "import decimal\n\nimport graphene\nfrom measurement.measures import Weight\n\nfrom ...core.weight import convert_weight, get_default_weight_unit\n\n\nclass Decimal(graphene.Float):\n    \"\"\"Custom Decimal implementation.\n\n    Returns Decimal as a float in the API,\n    parses float to the Decimal on the way back.\n    \"\"\"\n\n    @staticmethod\n    def parse_literal(node):\n        try:\n            return decimal.Decimal(node.value)\n        except decimal.DecimalException:\n            return None\n\n    @staticmethod\n    def parse_value(value):\n        try:\n            # Converting the float to str before parsing it to Decimal is\n            # necessary to keep the decimal places as typed\n            value = str(value)\n            return decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n\n\nclass WeightScalar(graphene.Scalar):\n    @staticmethod\n    def parse_value(value):\n        # Expects value to be a string \"amount unit\" separated by a single\n        # space.\n        try:\n            value = decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n        default_unit = get_default_weight_unit()\n        return Weight(**{default_unit: value})\n\n    @staticmethod\n    def serialize(weight):\n        if isinstance(weight, Weight):\n            default_unit = get_default_weight_unit()\n            if weight.unit != default_unit:\n                weight = convert_weight(weight, default_unit)\n            return str(weight)\n        return None\n\n    @staticmethod\n    def parse_literal(node):\n        return node\n", "path": "saleor/graphql/core/scalars.py"}], "after_files": [{"content": "import decimal\n\nimport graphene\nfrom graphql.language import ast\nfrom graphql.error import GraphQLError\nfrom measurement.measures import Weight\n\nfrom ...core.weight import convert_weight, get_default_weight_unit\n\n\nclass Decimal(graphene.Float):\n    \"\"\"Custom Decimal implementation.\n\n    Returns Decimal as a float in the API,\n    parses float to the Decimal on the way back.\n    \"\"\"\n\n    @staticmethod\n    def parse_literal(node):\n        try:\n            return decimal.Decimal(node.value)\n        except decimal.DecimalException:\n            return None\n\n    @staticmethod\n    def parse_value(value):\n        try:\n            # Converting the float to str before parsing it to Decimal is\n            # necessary to keep the decimal places as typed\n            value = str(value)\n            return decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n\n\nclass WeightScalar(graphene.Scalar):\n    @staticmethod\n    def parse_value(value):\n        weight = None\n        if isinstance(value, dict):\n            weight = Weight(**{value[\"unit\"]: value[\"value\"]})\n        else:\n            weight = WeightScalar.parse_decimal(value)\n        if not weight:\n            raise GraphQLError(f\"Unsupported value: {value}\")\n        return weight\n\n    @staticmethod\n    def serialize(weight):\n        if isinstance(weight, Weight):\n            default_unit = get_default_weight_unit()\n            if weight.unit != default_unit:\n                weight = convert_weight(weight, default_unit)\n            return str(weight)\n        return None\n\n    @staticmethod\n    def parse_literal(node):\n        weight = None\n        if isinstance(node, ast.ObjectValue):\n            weight = WeightScalar.parse_literal_object(node)\n        else:\n            weight = WeightScalar.parse_decimal(node.value)\n        if not weight:\n            raise GraphQLError(f\"Unsupported value: {node.value}\")\n        return weight\n\n    @staticmethod\n    def parse_decimal(value):\n        try:\n            value = decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n        default_unit = get_default_weight_unit()\n        return Weight(**{default_unit: value})\n\n    @staticmethod\n    def parse_literal_object(node):\n        value = 0\n        unit = get_default_weight_unit()\n\n        for field in node.fields:\n            if field.name.value == \"value\":\n                try:\n                    value = decimal.Decimal(field.value.value)\n                except decimal.DecimalException:\n                    raise GraphQLError(f\"Unsupported value: {field.value.value}\")\n            if field.name.value == \"unit\":\n                unit = field.value.value\n        return Weight(**{unit: value})\n", "path": "saleor/graphql/core/scalars.py"}]}