Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2017 03:11
Show Gist options
  • Save anonymous/2db6c2943edc3ee94f53fd54ad1adc9c to your computer and use it in GitHub Desktop.
Save anonymous/2db6c2943edc3ee94f53fd54ad1adc9c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{"nbformat":4,"nbformat_minor":2,"cells":[{"source":"from fidget import *\nfrom plumbum import local\nimport pandas\nfrom IPython import display","execution_count":1,"outputs":[],"cell_type":"code","metadata":{"collapsed":false}},{"source":"_untitled_ = (\n _x\n - local['ls']\n - str.splitlines\n - _x \/ (\n _x[\n x_('Untitled')[str.startswith],\n _x.contains('.')\n ][all]\n )\n - list\n) @ x_('.')[str.split].first()","execution_count":49,"outputs":[],"cell_type":"code","metadata":{"collapsed":false}},{"source":"_untitled_ & [{\n 'artifacts': (\n _x.valmap(len)[dict.items].groupby(_x.second()).valmap(_x.count())[dict.items][list][\n _x(columns=['# of artifacts', 'notebooks'])[pandas.DataFrame][\n lambda df: df.set_index('# of artifacts')\n ]\n ] << (\n this.to_html()[display.HTML][display.display]\n )\n ),\n 'copies': _x[dict.keys].filter(_x.contains('Copy')).count(),\n 'total': len\n}]","execution_count":50,"outputs":[{"output_type":"execute_result","data":{"text\/plain":"(LocalCommand(\/bin\/ls), <method 'splitlines' of 'str' objects>, (functools.partial(<class 'filter'>, (((<method 'startswith' of 'str' objects>,), (functools.partial(<function flip at 0x106488a60>, '.'),)), <built-in function all>)),), <class 'list'>, functools.partial(<function groupby at 0x106454a60>, (<method 'split' of 'str' objects>, <function first at 0x1064760d0>)), [{'artifacts': (functools.partial(<function valmap at 0x1066829d8>, <built-in function len>), <method 'items' of 'dict' objects>, functools.partial(<function groupby at 0x106454a60>, (<function second at 0x106476158>,)), functools.partial(<function valmap at 0x1066829d8>, (<function count at 0x1064769d8>,)), <method 'items' of 'dict' objects>, <class 'list'>, (<class 'pandas.core.frame.DataFrame'>, <function <lambda> at 0x1148ea268>), <function do.<locals>.caller at 0x1148eaa60>), 'copies': (<method 'keys' of 'dict' objects>, functools.partial(<class 'filter'>, (functools.partial(<function flip at 0x106488a60>, 'Copy'),)), <function count at 0x1064769d8>), 'total': <built-in function len>}])"},"metadata":{},"execution_count":50}],"cell_type":"code","metadata":{"collapsed":false}},{"source":"_untitled_('.')","execution_count":51,"outputs":[{"output_type":"display_data","data":{"text\/html":"<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th><\/th>\n <th>notebooks<\/th>\n <\/tr>\n <tr>\n <th># of artifacts<\/th>\n <th><\/th>\n <\/tr>\n <\/thead>\n <tbody>\n <tr>\n <th>1<\/th>\n <td>55<\/td>\n <\/tr>\n <tr>\n <th>2<\/th>\n <td>78<\/td>\n <\/tr>\n <tr>\n <th>3<\/th>\n <td>12<\/td>\n <\/tr>\n <tr>\n <th>4<\/th>\n <td>1<\/td>\n <\/tr>\n <\/tbody>\n<\/table>","text\/plain":"<IPython.core.display.HTML object>"},"metadata":{}},{"output_type":"execute_result","data":{"text\/plain":"[{'artifacts': notebooks\n # of artifacts \n 1 55\n 2 78\n 3 12\n 4 1, 'copies': 26, 'total': 146}]"},"metadata":{},"execution_count":51}],"cell_type":"code","metadata":{"collapsed":false}},{"source":"_untitled_('fidget\/')","execution_count":52,"outputs":[{"output_type":"display_data","data":{"text\/html":"<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th><\/th>\n <th>notebooks<\/th>\n <\/tr>\n <tr>\n <th># of artifacts<\/th>\n <th><\/th>\n <\/tr>\n <\/thead>\n <tbody>\n <tr>\n <th>2<\/th>\n <td>2<\/td>\n <\/tr>\n <\/tbody>\n<\/table>","text\/plain":"<IPython.core.display.HTML object>"},"metadata":{}},{"output_type":"execute_result","data":{"text\/plain":"[{'artifacts': notebooks\n # of artifacts \n 2 2, 'copies': 0, 'total': 2}]"},"metadata":{},"execution_count":52}],"cell_type":"code","metadata":{"collapsed":false}}],"metadata":{"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","pygments_lexer":"ipython3","nbconvert_exporter":"python","name":"python","mimetype":"text\/x-python","version":"3.5.2"},"kernelspec":{"display_name":"root","name":"root","language":"python"},"anaconda-cloud":{}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment