delete some unused file
This commit is contained in:
@@ -1,827 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "726843f4-99a4-41bc-8d93-af525dc038a3",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:01:53.459031800Z",
|
||||
"start_time": "2023-06-15T08:01:53.428235200Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "'Clay'"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "2023"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<bound method Golem.say_hi of <__main__.Golem object at 0x000001CA0C48C2D0>>"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hi!\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "__main__.Golem"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "str"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "int"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "method"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "method"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
"g = Golem('Clay')\n",
|
||||
"g.name\n",
|
||||
"g.built_year\n",
|
||||
"g.say_hi\n",
|
||||
"g.say_hi()\n",
|
||||
"type(g)\n",
|
||||
"type(g.name)\n",
|
||||
"type(g.built_year)\n",
|
||||
"type(g.__init__)\n",
|
||||
"type(g.say_hi)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<bound method Running_Golem.run of <__main__.Running_Golem object at 0x000001CA0CF9A210>>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Can't you see? I'm running...\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "'Clay'"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "2023"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hi!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
"class Running_Golem(Golem):\n",
|
||||
"\n",
|
||||
" def run(self):\n",
|
||||
" print(\"Can't you see? I'm running...\")\n",
|
||||
"\n",
|
||||
"rg = Running_Golem('Clay')\n",
|
||||
"\n",
|
||||
"rg.run\n",
|
||||
"rg.run()\n",
|
||||
"rg.name\n",
|
||||
"rg.built_year\n",
|
||||
"rg.say_hi()"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:06:54.529442700Z",
|
||||
"start_time": "2023-06-15T08:06:54.509561100Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<bound method Running_Golem.run of <__main__.Running_Golem object at 0x000001CA0CFC7790>>"
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Can't you see? I'm running...\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "'Clay'"
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "2023"
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hi! Nice day, Huh?\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
"class Running_Golem(Golem):\n",
|
||||
"\n",
|
||||
" def run(self):\n",
|
||||
" print(\"Can't you see? I'm running...\")\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi! Nice day, Huh?')\n",
|
||||
"\n",
|
||||
"rg = Running_Golem('Clay')\n",
|
||||
"\n",
|
||||
"rg.run\n",
|
||||
"rg.run()\n",
|
||||
"rg.name\n",
|
||||
"rg.built_year\n",
|
||||
"rg.say_hi()"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:08:02.232573600Z",
|
||||
"start_time": "2023-06-15T08:08:02.142092Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Help on Running_Golem in module __main__ object:\n",
|
||||
"\n",
|
||||
"class Running_Golem(Golem)\n",
|
||||
" | Running_Golem(name=None)\n",
|
||||
" | \n",
|
||||
" | Method resolution order:\n",
|
||||
" | Running_Golem\n",
|
||||
" | Golem\n",
|
||||
" | builtins.object\n",
|
||||
" | \n",
|
||||
" | Methods defined here:\n",
|
||||
" | \n",
|
||||
" | run(self)\n",
|
||||
" | \n",
|
||||
" | say_hi(self)\n",
|
||||
" | \n",
|
||||
" | ----------------------------------------------------------------------\n",
|
||||
" | Methods inherited from Golem:\n",
|
||||
" | \n",
|
||||
" | __init__(self, name=None)\n",
|
||||
" | Initialize self. See help(type(self)) for accurate signature.\n",
|
||||
" | \n",
|
||||
" | ----------------------------------------------------------------------\n",
|
||||
" | Data descriptors inherited from Golem:\n",
|
||||
" | \n",
|
||||
" | __dict__\n",
|
||||
" | dictionary for instance variables (if defined)\n",
|
||||
" | \n",
|
||||
" | __weakref__\n",
|
||||
" | list of weak references to the object (if defined)\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "['__class__',\n '__delattr__',\n '__dict__',\n '__dir__',\n '__doc__',\n '__eq__',\n '__format__',\n '__ge__',\n '__getattribute__',\n '__getstate__',\n '__gt__',\n '__hash__',\n '__init__',\n '__init_subclass__',\n '__le__',\n '__lt__',\n '__module__',\n '__ne__',\n '__new__',\n '__reduce__',\n '__reduce_ex__',\n '__repr__',\n '__setattr__',\n '__sizeof__',\n '__str__',\n '__subclasshook__',\n '__weakref__',\n 'built_year',\n 'name',\n 'run',\n 'say_hi']"
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "{'name': 'Clay', 'built_year': 2023}"
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "True"
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
"class Running_Golem(Golem):\n",
|
||||
"\n",
|
||||
" def run(self):\n",
|
||||
" print('Can\\'t you see? I\\'m running...')\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi! Nice day, Huh?')\n",
|
||||
"\n",
|
||||
"rg = Running_Golem('Clay')\n",
|
||||
"\n",
|
||||
"help(rg)\n",
|
||||
"dir(rg)\n",
|
||||
"rg.__dict__\n",
|
||||
"hasattr(rg, 'built_year')"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:09:48.581157600Z",
|
||||
"start_time": "2023-06-15T08:09:48.562887800Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "True"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "True"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "False"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "False"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "False"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "1"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "10"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "11"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "10"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "10"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "True"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
" population = 0\n",
|
||||
" __life_span = 10\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
" self.__active = True\n",
|
||||
" Golem.population += 1\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
" def cease(self):\n",
|
||||
" self.__active = False\n",
|
||||
" Golem.population -= 1\n",
|
||||
"\n",
|
||||
" def is_active(self):\n",
|
||||
" if datetime.date.today().year - self.built_year >= Golem.__life_span:\n",
|
||||
" self.cease()\n",
|
||||
" return self.__active\n",
|
||||
"\n",
|
||||
"g = Golem()\n",
|
||||
"hasattr(Golem, 'population')\n",
|
||||
"hasattr(g, 'population')\n",
|
||||
"hasattr(Golem, '__life_span')\n",
|
||||
"hasattr(g, '__life_span')\n",
|
||||
"hasattr(g, '__active')\n",
|
||||
"Golem.population\n",
|
||||
"setattr(Golem, 'population', 10)\n",
|
||||
"Golem.population\n",
|
||||
"x = Golem()\n",
|
||||
"Golem.population\n",
|
||||
"x.cease()\n",
|
||||
"Golem.population\n",
|
||||
"getattr(g, 'population')\n",
|
||||
"g.is_active()"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:18:02.767773400Z",
|
||||
"start_time": "2023-06-15T08:18:02.712793300Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<bound method Golem.population of <__main__.Golem object at 0x000001CA0D02D5D0>>"
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "1"
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
" __population = 0\n",
|
||||
" __life_span = 10\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
" self.__active = True\n",
|
||||
" Golem.__population += 1\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
" def cease(self):\n",
|
||||
" self.__active = False\n",
|
||||
" Golem.__population -= 1\n",
|
||||
"\n",
|
||||
" def is_active(self):\n",
|
||||
" if datetime.date.today().year - self.built_year >= Golem.__life_span:\n",
|
||||
" self.cease()\n",
|
||||
" return self.__active\n",
|
||||
"\n",
|
||||
" def population(self):\n",
|
||||
" return Golem.__population\n",
|
||||
"\n",
|
||||
"g = Golem('Clay')\n",
|
||||
"g.population\n",
|
||||
"g.population()"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:24:16.538713500Z",
|
||||
"start_time": "2023-06-15T08:24:16.524642600Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<property at 0x1ca0d0484f0>"
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
" __population = 0\n",
|
||||
" __life_span = 10\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
" self.__active = True\n",
|
||||
" Golem.__population += 1\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
" def cease(self):\n",
|
||||
" self.__active = False\n",
|
||||
" Golem.population -= 1\n",
|
||||
"\n",
|
||||
" def is_active(self):\n",
|
||||
" if datetime.date.today().year - self.built_year >= Golem.__life_span:\n",
|
||||
" self.cease()\n",
|
||||
" return self.__active\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def population(self):\n",
|
||||
" return Golem.population\n",
|
||||
"\n",
|
||||
"g = Golem('Clay')\n",
|
||||
"g.population\n",
|
||||
"# g.population = 100"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:29:09.532026600Z",
|
||||
"start_time": "2023-06-15T08:29:09.478366200Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<property at 0x1ca0c1d13f0>"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<property at 0x1ca0c1d13f0>"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<property at 0x1ca0c1d13f0>"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Help on class Golem in module __main__:\n",
|
||||
"\n",
|
||||
"class Golem(builtins.object)\n",
|
||||
" | Golem(name=None)\n",
|
||||
" | \n",
|
||||
" | Methods defined here:\n",
|
||||
" | \n",
|
||||
" | __init__(self, name=None)\n",
|
||||
" | Initialize self. See help(type(self)) for accurate signature.\n",
|
||||
" | \n",
|
||||
" | cease(self)\n",
|
||||
" | \n",
|
||||
" | is_active(self)\n",
|
||||
" | \n",
|
||||
" | say_hi(self)\n",
|
||||
" | \n",
|
||||
" | ----------------------------------------------------------------------\n",
|
||||
" | Data descriptors defined here:\n",
|
||||
" | \n",
|
||||
" | __dict__\n",
|
||||
" | dictionary for instance variables (if defined)\n",
|
||||
" | \n",
|
||||
" | __weakref__\n",
|
||||
" | list of weak references to the object (if defined)\n",
|
||||
" | \n",
|
||||
" | population\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "mappingproxy({'__module__': '__main__',\n '_Golem__population': 101,\n '_Golem__life_span': 10,\n '__init__': <function __main__.Golem.__init__(self, name=None)>,\n 'say_hi': <function __main__.Golem.say_hi(self)>,\n 'cease': <function __main__.Golem.cease(self)>,\n 'is_active': <function __main__.Golem.is_active(self)>,\n 'population': <property at 0x1ca0c1d13f0>,\n '__dict__': <attribute '__dict__' of 'Golem' objects>,\n '__weakref__': <attribute '__weakref__' of 'Golem' objects>,\n '__doc__': None})"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "{'name': 'Clay', 'built_year': 2023, '_Golem__active': True}"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "True"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<property at 0x1ca0c1d13f0>"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "10000"
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||
"import datetime\n",
|
||||
"\n",
|
||||
"class Golem:\n",
|
||||
" __population = 0\n",
|
||||
" __life_span = 10\n",
|
||||
"\n",
|
||||
" def __init__(self, name=None):\n",
|
||||
" self.name = name\n",
|
||||
" self.built_year = datetime.date.today().year\n",
|
||||
" self.__active = True\n",
|
||||
" Golem.__population += 1\n",
|
||||
"\n",
|
||||
" def say_hi(self):\n",
|
||||
" print('Hi!')\n",
|
||||
"\n",
|
||||
" def cease(self):\n",
|
||||
" self.__active = False\n",
|
||||
" Golem.__population -= 1\n",
|
||||
"\n",
|
||||
" def is_active(self):\n",
|
||||
" if datetime.date.today().year - self.built_year >= Golem.__life_span:\n",
|
||||
" self.cease()\n",
|
||||
" return self.__active\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def population(self):\n",
|
||||
" return Golem.population\n",
|
||||
"\n",
|
||||
" @population.setter\n",
|
||||
" def population(self, value):\n",
|
||||
" Golem.__population = value\n",
|
||||
"\n",
|
||||
"g = Golem('Clay')\n",
|
||||
"g.population\n",
|
||||
"g.population = 100\n",
|
||||
"ga = Golem('New')\n",
|
||||
"g.population\n",
|
||||
"ga.population\n",
|
||||
"help(Golem)\n",
|
||||
"Golem.__dict__\n",
|
||||
"g.__dict__\n",
|
||||
"hasattr(Golem, 'population')\n",
|
||||
"getattr(Golem, 'population')\n",
|
||||
"setattr(Golem, 'population', 10000)\n",
|
||||
"g.population"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-06-15T08:29:27.143013600Z",
|
||||
"start_time": "2023-06-15T08:29:27.066281400Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
4
course_preview.py
Normal file
4
course_preview.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class CourseMetadata:
|
||||
def __init__(self, name, score):
|
||||
self.name = name
|
||||
self.score = score
|
||||
1
database/.back_定投课堂/T20230721233700.pdma.json
Normal file
1
database/.back_定投课堂/T20230721233700.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234148.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234148.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234445.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234445.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234647.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234647.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234658.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234658.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234804.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234804.pdma.json
Normal file
File diff suppressed because one or more lines are too long
1
database/.back_定投课堂/T20230721234856.pdma.json
Normal file
1
database/.back_定投课堂/T20230721234856.pdma.json
Normal file
File diff suppressed because one or more lines are too long
2517
database/定投课堂.pdma.json
Normal file
2517
database/定投课堂.pdma.json
Normal file
File diff suppressed because one or more lines are too long
94
requests_get_data.ipynb
Normal file
94
requests_get_data.ipynb
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-07-21T14:15:19.727737100Z",
|
||||
"start_time": "2023-07-21T14:15:19.256727800Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"200\n",
|
||||
"{'id': 7899, 'title': '1.1-思考的真相-定义', 'description': '', 'topic': '', 'speaker_ids': ['b76e0418-2d94-4b36-a6dd-497933b79923'], 'is_published': True, 'is_open': False, 'is_charge': False, 'poster_url': '', 'started_at': '2023-07-21T05:04:41.357289Z', 'finished_at': '2023-07-21T05:04:41.357289Z', 'record_type': 'prerecorded', 'open_comment': False, 'tags': [], 'speakers': [{'user_id': 'b76e0418-2d94-4b36-a6dd-497933b79923', 'group_id': '7000102069', 'version': 1485, 'full_name': '笑来', 'bio': '', 'identity_number': 26806, 'avatar_url': 'https://mixin-images.zeromesh.net/3kCJbGHrViT3ARf3VVYvKEiOao5Kyh8cW3XaJa_GlHYNE2bqvzDlpbExFC_lkNGQNaX3scVaRMQeJelHQT4Qb2pU=s256', 'state': 'paid', 'blocked': 0, 'active_at': '2023-07-21T09:38:05.392813Z', 'subscribed_at': '2020-12-03T03:14:33.146439Z', 'expired_at': '2123-07-03T12:34:56.0001Z', 'created_at': '2019-06-24T11:15:22Z', 'uiam_id': 37498, 'joined_at': '2019-07-21T04:28:46.952Z', 'divided_to': '7000103435', 'divided_at': '2020-06-10T20:15:19.641593Z', 'role': '', 'token': '', 'refresh_token': '', 'provider': '', 'policies': None, 'privacy_user': None}], 'message_count': 0, 'group_id': '7000102069', 'product_id': 0, 'course_albums': [], 'is_favored': False}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"headers = {\n",
|
||||
" 'authority': 'xuexi-courses-api.songy.info',\n",
|
||||
" 'accept': 'application/json, text/plain, */*',\n",
|
||||
" 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',\n",
|
||||
" 'authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiI5MTU3NSIsImV4cCI6MTY5MDU1MDIzNywianRpIjoiOWJhNzZjZDgtZTgxMi00YzA2LWE2Y2UtMTIxY2IxNmYyYjMyIiwiaWF0IjoxNjg5OTQ1NDM3LCJpc3MiOiIzMDAyMiIsInN1YiI6IjcwMDAxMDIwNjkiLCJ1aWQiOiIyOTFmZjQzNC1iOGQyLTQyNzUtYWUzZi1lNzNlYWEwMzU0ODQiLCJtb2RlIjoiY2xpZW50IiwidHlwIjoiYXBwdXNlciIsIm9hcCI6Im1peGluIiwic2lkIjoiYTU0YmRhOGQyNDIwNDczZTgwOGEzM2ZlZmQ0Y2U1ZjIifQ.m4hjlbZz7a--rwRfn_vRNU6TTuXg-_r0c6N6eKiika0',\n",
|
||||
" 'dnt': '1',\n",
|
||||
" 'origin': 'https://xuexi-courses.firesbox.com',\n",
|
||||
" 'referer': 'https://xuexi-courses.firesbox.com/',\n",
|
||||
" 'sec-ch-ua': '\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Microsoft Edge\";v=\"114\"',\n",
|
||||
" 'sec-ch-ua-mobile': '?0',\n",
|
||||
" 'sec-ch-ua-platform': '\"Windows\"',\n",
|
||||
" 'sec-fetch-dest': 'empty',\n",
|
||||
" 'sec-fetch-mode': 'cors',\n",
|
||||
" 'sec-fetch-site': 'cross-site',\n",
|
||||
" 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82',\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"params = {\n",
|
||||
" 'nonce': 'af674e65-49d8-4c2c-8437-a4053a7c7b47',\n",
|
||||
" 'q': '',\n",
|
||||
" 'offset': '0',\n",
|
||||
" 'limit': '20',\n",
|
||||
" 'sort': 'newest-first',\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"response = requests.get('https://xuexi-courses-api.songy.info/v1/courses/', params=params, headers=headers)\n",
|
||||
"\n",
|
||||
"print(response.status_code)\n",
|
||||
"# print(response.text)\n",
|
||||
"\n",
|
||||
"courses_date = json.loads(response.text)\n",
|
||||
"\n",
|
||||
"courses = courses_date['courses']\n",
|
||||
"print(courses[1])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
28
self_message.json
Normal file
28
self_message.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"user_id": "291ff434-b8d2-4275-ae3f-e73eaa035484",
|
||||
"group_id": "7000102069",
|
||||
"version": 77,
|
||||
"full_name": "lostecho",
|
||||
"bio": "",
|
||||
"identity_number": 37375063,
|
||||
"avatar_url": "https://mixin-images.zeromesh.net/YlK2Q6t3mcJAcUXWfKMtCJL5KBwE4T84rUkZKA0FjpwWVxPP8xv9XdnK4Jm-E3IVLLF-cvHWgginGrMBLlQvXZ__IFlkNAK-2XT9Zg=s256",
|
||||
"state": "paid",
|
||||
"blocked": 0,
|
||||
"active_at": "2023-07-21T13:17:17.463351Z",
|
||||
"subscribed_at": "2021-05-05T08:06:51.016168Z",
|
||||
"expired_at": "2028-02-24T08:34:52.054296Z",
|
||||
"created_at": "2020-12-04T10:23:48.678745Z",
|
||||
"uiam_id": 91575,
|
||||
"joined_at": "2021-02-25T08:34:52.054296Z",
|
||||
"divided_to": "7000103419",
|
||||
"divided_at": "2021-02-25T08:34:55.399069Z",
|
||||
"role": "user",
|
||||
"token": "",
|
||||
"refresh_token": "",
|
||||
"invitation_code": "MDVQMALY9K",
|
||||
"provider": "mixin",
|
||||
"policies": [],
|
||||
"privacy_user": null,
|
||||
"phone_code": "86",
|
||||
"phone_number": "182*****339"
|
||||
}
|
||||
Reference in New Issue
Block a user