Skip to content

Instantly share code, notes, and snippets.

@hachibeeDI
Created April 24, 2014 07:25
Show Gist options
  • Save hachibeeDI/11244859 to your computer and use it in GitHub Desktop.
Save hachibeeDI/11244859 to your computer and use it in GitHub Desktop.
# -*- 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