FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MBPython/MBPython/method.py at master · lochen88/MBPython · GitHub
lochen88
/
MBPython
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
62
Code
Issues
3
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MBPython
/
MBPython
/
method.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (16 loc) · 570 Bytes
Breadcrumbs
MBPython
/
MBPython
/
method.py
Copy path
File metadata and controls
16 lines (16 loc) · 570 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding:utf-8 -*-
def
method
(
prototype
):
class
MethodDescriptor
(
object
):
__slots__
=
[
'func'
,
'bound_funcs'
]
def
__init__
(
self
,
func
):
self
.
func
=
func
self
.
bound_funcs
=
{}
def
__get__
(
self
,
obj
,
type
=
None
):
if
obj
!=
None
:
try
:
return
self
.
bound_funcs
[
obj
,
type
]
except
:
ret
=
self
.
bound_funcs
[
obj
,
type
]
=
prototype
(
self
.
func
.
__get__
(
obj
,
type
))
return
ret
return
MethodDescriptor
Back
|
FazBrowse Home
|
New Git URL