Created
April 24, 2014 07:25
-
-
Save hachibeeDI/11244859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import (print_function, division, absolute_import, unicode_literals, ) | |
def _snake_to_camel(text): | |
letters = list(text) | |
def _conv(l1, l2): | |
if l1[-1] == '_': | |
return l1.replace('_', '') + l2.upper() | |
return l1 + l2 | |
return ''.join( | |
reduce(_conv, letters) | |
) | |
class _Hoge(object): | |
def getHogeResult(self): | |
return 'hoge' | |
class Hoge(object): | |
def __init__(self, *args, **kwargs): | |
self._this = _Hoge(*args, **kwargs) | |
def __getattr__(self, name): | |
return getattr(self._this, _snake_to_camel(name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment