#!/usr/bin/env python # coding: utf-8 # In[3]: from jupyterhub.app import JupyterHub # In[4]: JupyterHub.base_url # In[9]: JupyterHub # In[12]: type(JupyterHub.base_url) # In[13]: from traitlets import * # In[14]: get_ipython().run_line_magic('pinfo', 'Integer.error') # In[27]: class EvenInteger(Integer): def validate(self, obj, value): if value % 2: raise ValueError(f"{value} is not even!") self.error(obj, value) class C(HasTraits): x = Integer() @validate('x') def _x_must_be_even(self, proposal): if proposal.value % 2: raise ValueError("x must b even!") y = EvenInteger() # In[30]: c = C() # In[31]: c.x = 5 # In[45]: from jupyterhub.traitlets import URLPrefix, ByteSpecification class C(HasTraits): prefix = URLPrefix('/') mem = ByteSpecification() c = C() # In[47]: c.mem = '2G' c.mem # In[34]: c.prefix # In[35]: c.prefix = '/hub' c.prefix # In[36]: c.prefix = 'prefix' c.prefix # In[37]: from subprocess import Popen # In[38]: Popen(['echo', 'hi']) # In[40]: os.system("echo hi") # In[41]: from jupyterhub.spawner import Spawner # In[ ]: ['jupyterhub-singleuser'] # In[ ]: from jupyterhub.proxy import ConfigurableHTTPProxy ConfigurableHTTPProxy.c # In[26]: c.y = 6 # In[16]: Even # In[ ]: