repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
mwouts/jupytext
jupytext/cell_metadata.py
double_percent_options_to_metadata
def double_percent_options_to_metadata(options): """Parse double percent options""" matches = _PERCENT_CELL.findall('# %%' + options) # Fail safe when regexp matching fails #116 # (occurs e.g. if square brackets are found in the title) if not matches: return {'title': options.strip()} ...
python
def double_percent_options_to_metadata(options): """Parse double percent options""" matches = _PERCENT_CELL.findall('# %%' + options) # Fail safe when regexp matching fails #116 # (occurs e.g. if square brackets are found in the title) if not matches: return {'title': options.strip()} ...
[ "def", "double_percent_options_to_metadata", "(", "options", ")", ":", "matches", "=", "_PERCENT_CELL", ".", "findall", "(", "'# %%'", "+", "options", ")", "# Fail safe when regexp matching fails #116", "# (occurs e.g. if square brackets are found in the title)", "if", "not", ...
Parse double percent options
[ "Parse", "double", "percent", "options" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_metadata.py#L359-L395
train
Parse double percent options and return metadata dict.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_metadata.py
metadata_to_double_percent_options
def metadata_to_double_percent_options(metadata): """Metadata to double percent lines""" options = [] if 'cell_depth' in metadata: options.append('%' * metadata.pop('cell_depth')) if 'title' in metadata: options.append(metadata.pop('title')) if 'cell_type' in metadata: option...
python
def metadata_to_double_percent_options(metadata): """Metadata to double percent lines""" options = [] if 'cell_depth' in metadata: options.append('%' * metadata.pop('cell_depth')) if 'title' in metadata: options.append(metadata.pop('title')) if 'cell_type' in metadata: option...
[ "def", "metadata_to_double_percent_options", "(", "metadata", ")", ":", "options", "=", "[", "]", "if", "'cell_depth'", "in", "metadata", ":", "options", ".", "append", "(", "'%'", "*", "metadata", ".", "pop", "(", "'cell_depth'", ")", ")", "if", "'title'", ...
Metadata to double percent lines
[ "Metadata", "to", "double", "percent", "lines" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_metadata.py#L398-L410
train
Metadata to double percent lines
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_metadata.py
ParsingContext.in_global_expression
def in_global_expression(self): """Currently inside an expression""" return (self.parenthesis_count == 0 and self.curly_bracket_count == 0 and self.square_bracket_count == 0 and not self.in_single_quote and not self.in_double_quote)
python
def in_global_expression(self): """Currently inside an expression""" return (self.parenthesis_count == 0 and self.curly_bracket_count == 0 and self.square_bracket_count == 0 and not self.in_single_quote and not self.in_double_quote)
[ "def", "in_global_expression", "(", "self", ")", ":", "return", "(", "self", ".", "parenthesis_count", "==", "0", "and", "self", ".", "curly_bracket_count", "==", "0", "and", "self", ".", "square_bracket_count", "==", "0", "and", "not", "self", ".", "in_sing...
Currently inside an expression
[ "Currently", "inside", "an", "expression" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_metadata.py#L129-L133
train
Currently inside an expression
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_metadata.py
ParsingContext.count_special_chars
def count_special_chars(self, char, prev_char): """Update parenthesis counters""" if char == '(': self.parenthesis_count += 1 elif char == ')': self.parenthesis_count -= 1 if self.parenthesis_count < 0: raise RMarkdownOptionParsingError( ...
python
def count_special_chars(self, char, prev_char): """Update parenthesis counters""" if char == '(': self.parenthesis_count += 1 elif char == ')': self.parenthesis_count -= 1 if self.parenthesis_count < 0: raise RMarkdownOptionParsingError( ...
[ "def", "count_special_chars", "(", "self", ",", "char", ",", "prev_char", ")", ":", "if", "char", "==", "'('", ":", "self", ".", "parenthesis_count", "+=", "1", "elif", "char", "==", "')'", ":", "self", ".", "parenthesis_count", "-=", "1", "if", "self", ...
Update parenthesis counters
[ "Update", "parenthesis", "counters" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_metadata.py#L135-L164
train
Update parentheses counters and square brackets counters and special characters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
get_format_implementation
def get_format_implementation(ext, format_name=None): """Return the implementation for the desired format""" # remove pre-extension if any ext = '.' + ext.split('.')[-1] formats_for_extension = [] for fmt in JUPYTEXT_FORMATS: if fmt.extension == ext: if fmt.format_name == format...
python
def get_format_implementation(ext, format_name=None): """Return the implementation for the desired format""" # remove pre-extension if any ext = '.' + ext.split('.')[-1] formats_for_extension = [] for fmt in JUPYTEXT_FORMATS: if fmt.extension == ext: if fmt.format_name == format...
[ "def", "get_format_implementation", "(", "ext", ",", "format_name", "=", "None", ")", ":", "# remove pre-extension if any", "ext", "=", "'.'", "+", "ext", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "formats_for_extension", "=", "[", "]", "for", "fm...
Return the implementation for the desired format
[ "Return", "the", "implementation", "for", "the", "desired", "format" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L151-L170
train
Returns the implementation for the desired format
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
read_metadata
def read_metadata(text, ext): """Return the header metadata""" ext = '.' + ext.split('.')[-1] lines = text.splitlines() if ext in ['.md', '.Rmd']: comment = '' else: comment = _SCRIPT_EXTENSIONS.get(ext, {}).get('comment', '#') metadata, _, _, _ = header_to_metadata_and_cell(li...
python
def read_metadata(text, ext): """Return the header metadata""" ext = '.' + ext.split('.')[-1] lines = text.splitlines() if ext in ['.md', '.Rmd']: comment = '' else: comment = _SCRIPT_EXTENSIONS.get(ext, {}).get('comment', '#') metadata, _, _, _ = header_to_metadata_and_cell(li...
[ "def", "read_metadata", "(", "text", ",", "ext", ")", ":", "ext", "=", "'.'", "+", "ext", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "lines", "=", "text", ".", "splitlines", "(", ")", "if", "ext", "in", "[", "'.md'", ",", "'.Rmd'", "]",...
Return the header metadata
[ "Return", "the", "header", "metadata" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L173-L187
train
Return the header metadata
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
read_format_from_metadata
def read_format_from_metadata(text, ext): """Return the format of the file, when that information is available from the metadata""" metadata = read_metadata(text, ext) rearrange_jupytext_metadata(metadata) return format_name_for_ext(metadata, ext, explicit_default=False)
python
def read_format_from_metadata(text, ext): """Return the format of the file, when that information is available from the metadata""" metadata = read_metadata(text, ext) rearrange_jupytext_metadata(metadata) return format_name_for_ext(metadata, ext, explicit_default=False)
[ "def", "read_format_from_metadata", "(", "text", ",", "ext", ")", ":", "metadata", "=", "read_metadata", "(", "text", ",", "ext", ")", "rearrange_jupytext_metadata", "(", "metadata", ")", "return", "format_name_for_ext", "(", "metadata", ",", "ext", ",", "explic...
Return the format of the file, when that information is available from the metadata
[ "Return", "the", "format", "of", "the", "file", "when", "that", "information", "is", "available", "from", "the", "metadata" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L190-L194
train
Return the format of the file when that information is available from the metadata
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
guess_format
def guess_format(text, ext): """Guess the format and format options of the file, given its extension and content""" lines = text.splitlines() metadata = read_metadata(text, ext) if ('jupytext' in metadata and set(metadata['jupytext']) .difference(['encoding', 'executable', 'main_language']...
python
def guess_format(text, ext): """Guess the format and format options of the file, given its extension and content""" lines = text.splitlines() metadata = read_metadata(text, ext) if ('jupytext' in metadata and set(metadata['jupytext']) .difference(['encoding', 'executable', 'main_language']...
[ "def", "guess_format", "(", "text", ",", "ext", ")", ":", "lines", "=", "text", ".", "splitlines", "(", ")", "metadata", "=", "read_metadata", "(", "text", ",", "ext", ")", "if", "(", "'jupytext'", "in", "metadata", "and", "set", "(", "metadata", "[", ...
Guess the format and format options of the file, given its extension and content
[ "Guess", "the", "format", "and", "format", "options", "of", "the", "file", "given", "its", "extension", "and", "content" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L197-L276
train
Guess the format and format options of the file given its extension and content
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
divine_format
def divine_format(text): """Guess the format of the notebook, based on its content #148""" try: nbformat.reads(text, as_version=4) return 'ipynb' except nbformat.reader.NotJSONError: pass lines = text.splitlines() for comment in ['', '#'] + _COMMENT_CHARS: metadata, ...
python
def divine_format(text): """Guess the format of the notebook, based on its content #148""" try: nbformat.reads(text, as_version=4) return 'ipynb' except nbformat.reader.NotJSONError: pass lines = text.splitlines() for comment in ['', '#'] + _COMMENT_CHARS: metadata, ...
[ "def", "divine_format", "(", "text", ")", ":", "try", ":", "nbformat", ".", "reads", "(", "text", ",", "as_version", "=", "4", ")", "return", "'ipynb'", "except", "nbformat", ".", "reader", ".", "NotJSONError", ":", "pass", "lines", "=", "text", ".", "...
Guess the format of the notebook, based on its content #148
[ "Guess", "the", "format", "of", "the", "notebook", "based", "on", "its", "content", "#148" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L279-L299
train
Guess the format of the notebook based on its content.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
check_file_version
def check_file_version(notebook, source_path, outputs_path): """Raise if file version in source file would override outputs""" if not insert_or_test_version_number(): return _, ext = os.path.splitext(source_path) if ext.endswith('.ipynb'): return version = notebook.metadata.get('jup...
python
def check_file_version(notebook, source_path, outputs_path): """Raise if file version in source file would override outputs""" if not insert_or_test_version_number(): return _, ext = os.path.splitext(source_path) if ext.endswith('.ipynb'): return version = notebook.metadata.get('jup...
[ "def", "check_file_version", "(", "notebook", ",", "source_path", ",", "outputs_path", ")", ":", "if", "not", "insert_or_test_version_number", "(", ")", ":", "return", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "source_path", ")", "if", ...
Raise if file version in source file would override outputs
[ "Raise", "if", "file", "version", "in", "source", "file", "would", "override", "outputs" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L302-L333
train
Raise if file version in source file would override outputs
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
format_name_for_ext
def format_name_for_ext(metadata, ext, cm_default_formats=None, explicit_default=True): """Return the format name for that extension""" # Is the format information available in the text representation? text_repr = metadata.get('jupytext', {}).get('text_representation', {}) if text_repr.get('extension', ...
python
def format_name_for_ext(metadata, ext, cm_default_formats=None, explicit_default=True): """Return the format name for that extension""" # Is the format information available in the text representation? text_repr = metadata.get('jupytext', {}).get('text_representation', {}) if text_repr.get('extension', ...
[ "def", "format_name_for_ext", "(", "metadata", ",", "ext", ",", "cm_default_formats", "=", "None", ",", "explicit_default", "=", "True", ")", ":", "# Is the format information available in the text representation?", "text_repr", "=", "metadata", ".", "get", "(", "'jupyt...
Return the format name for that extension
[ "Return", "the", "format", "name", "for", "that", "extension" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L336-L354
train
Return the format name for the given extension
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
identical_format_path
def identical_format_path(fmt1, fmt2): """Do the two (long representation) of formats target the same file?""" for key in ['extension', 'prefix', 'suffix']: if fmt1.get(key) != fmt2.get(key): return False return True
python
def identical_format_path(fmt1, fmt2): """Do the two (long representation) of formats target the same file?""" for key in ['extension', 'prefix', 'suffix']: if fmt1.get(key) != fmt2.get(key): return False return True
[ "def", "identical_format_path", "(", "fmt1", ",", "fmt2", ")", ":", "for", "key", "in", "[", "'extension'", ",", "'prefix'", ",", "'suffix'", "]", ":", "if", "fmt1", ".", "get", "(", "key", ")", "!=", "fmt2", ".", "get", "(", "key", ")", ":", "retu...
Do the two (long representation) of formats target the same file?
[ "Do", "the", "two", "(", "long", "representation", ")", "of", "formats", "target", "the", "same", "file?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L357-L362
train
Return True if two formats target the same file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
update_jupytext_formats_metadata
def update_jupytext_formats_metadata(metadata, new_format): """Update the jupytext_format metadata in the Jupyter notebook""" new_format = long_form_one_format(new_format) formats = long_form_multiple_formats(metadata.get('jupytext', {}).get('formats', '')) if not formats: return for fmt in...
python
def update_jupytext_formats_metadata(metadata, new_format): """Update the jupytext_format metadata in the Jupyter notebook""" new_format = long_form_one_format(new_format) formats = long_form_multiple_formats(metadata.get('jupytext', {}).get('formats', '')) if not formats: return for fmt in...
[ "def", "update_jupytext_formats_metadata", "(", "metadata", ",", "new_format", ")", ":", "new_format", "=", "long_form_one_format", "(", "new_format", ")", "formats", "=", "long_form_multiple_formats", "(", "metadata", ".", "get", "(", "'jupytext'", ",", "{", "}", ...
Update the jupytext_format metadata in the Jupyter notebook
[ "Update", "the", "jupytext_format", "metadata", "in", "the", "Jupyter", "notebook" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L365-L377
train
Update the jupytext_format metadata in the Jupyter notebook
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
rearrange_jupytext_metadata
def rearrange_jupytext_metadata(metadata): """Convert the jupytext_formats metadata entry to jupytext/formats, etc. See #91""" # Backward compatibility with nbrmd for key in ['nbrmd_formats', 'nbrmd_format_version']: if key in metadata: metadata[key.replace('nbrmd', 'jupytext')] = metad...
python
def rearrange_jupytext_metadata(metadata): """Convert the jupytext_formats metadata entry to jupytext/formats, etc. See #91""" # Backward compatibility with nbrmd for key in ['nbrmd_formats', 'nbrmd_format_version']: if key in metadata: metadata[key.replace('nbrmd', 'jupytext')] = metad...
[ "def", "rearrange_jupytext_metadata", "(", "metadata", ")", ":", "# Backward compatibility with nbrmd", "for", "key", "in", "[", "'nbrmd_formats'", ",", "'nbrmd_format_version'", "]", ":", "if", "key", "in", "metadata", ":", "metadata", "[", "key", ".", "replace", ...
Convert the jupytext_formats metadata entry to jupytext/formats, etc. See #91
[ "Convert", "the", "jupytext_formats", "metadata", "entry", "to", "jupytext", "/", "formats", "etc", ".", "See", "#91" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L380-L422
train
Convert the jupytext_formats metadata entry to jupytext format and formats etc. See #91
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
long_form_one_format
def long_form_one_format(jupytext_format, metadata=None, update=None): """Parse 'sfx.py:percent' into {'suffix':'sfx', 'extension':'py', 'format_name':'percent'}""" if isinstance(jupytext_format, dict): if update: jupytext_format.update(update) return validate_one_format(jupytext_for...
python
def long_form_one_format(jupytext_format, metadata=None, update=None): """Parse 'sfx.py:percent' into {'suffix':'sfx', 'extension':'py', 'format_name':'percent'}""" if isinstance(jupytext_format, dict): if update: jupytext_format.update(update) return validate_one_format(jupytext_for...
[ "def", "long_form_one_format", "(", "jupytext_format", ",", "metadata", "=", "None", ",", "update", "=", "None", ")", ":", "if", "isinstance", "(", "jupytext_format", ",", "dict", ")", ":", "if", "update", ":", "jupytext_format", ".", "update", "(", "update"...
Parse 'sfx.py:percent' into {'suffix':'sfx', 'extension':'py', 'format_name':'percent'}
[ "Parse", "sfx", ".", "py", ":", "percent", "into", "{", "suffix", ":", "sfx", "extension", ":", "py", "format_name", ":", "percent", "}" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L425-L467
train
Parse a Jupytext format into a list of dictionaries.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
long_form_multiple_formats
def long_form_multiple_formats(jupytext_formats, metadata=None): """Convert a concise encoding of jupytext.formats to a list of formats, encoded as dictionaries""" if not jupytext_formats: return [] if not isinstance(jupytext_formats, list): jupytext_formats = [fmt for fmt in jupytext_forma...
python
def long_form_multiple_formats(jupytext_formats, metadata=None): """Convert a concise encoding of jupytext.formats to a list of formats, encoded as dictionaries""" if not jupytext_formats: return [] if not isinstance(jupytext_formats, list): jupytext_formats = [fmt for fmt in jupytext_forma...
[ "def", "long_form_multiple_formats", "(", "jupytext_formats", ",", "metadata", "=", "None", ")", ":", "if", "not", "jupytext_formats", ":", "return", "[", "]", "if", "not", "isinstance", "(", "jupytext_formats", ",", "list", ")", ":", "jupytext_formats", "=", ...
Convert a concise encoding of jupytext.formats to a list of formats, encoded as dictionaries
[ "Convert", "a", "concise", "encoding", "of", "jupytext", ".", "formats", "to", "a", "list", "of", "formats", "encoded", "as", "dictionaries" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L470-L480
train
Convert a concise encoding of jupytext. formats to a list of formats encoded as dictionaries
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
short_form_one_format
def short_form_one_format(jupytext_format): """Represent one jupytext format as a string""" if not isinstance(jupytext_format, dict): return jupytext_format fmt = jupytext_format['extension'] if 'suffix' in jupytext_format: fmt = jupytext_format['suffix'] + fmt elif fmt.startswith('....
python
def short_form_one_format(jupytext_format): """Represent one jupytext format as a string""" if not isinstance(jupytext_format, dict): return jupytext_format fmt = jupytext_format['extension'] if 'suffix' in jupytext_format: fmt = jupytext_format['suffix'] + fmt elif fmt.startswith('....
[ "def", "short_form_one_format", "(", "jupytext_format", ")", ":", "if", "not", "isinstance", "(", "jupytext_format", ",", "dict", ")", ":", "return", "jupytext_format", "fmt", "=", "jupytext_format", "[", "'extension'", "]", "if", "'suffix'", "in", "jupytext_forma...
Represent one jupytext format as a string
[ "Represent", "one", "jupytext", "format", "as", "a", "string" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L483-L500
train
Represent one jupytext format as a string
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
short_form_multiple_formats
def short_form_multiple_formats(jupytext_formats): """Convert jupytext formats, represented as a list of dictionaries, to a comma separated list""" if not isinstance(jupytext_formats, list): return jupytext_formats jupytext_formats = [short_form_one_format(fmt) for fmt in jupytext_formats] retu...
python
def short_form_multiple_formats(jupytext_formats): """Convert jupytext formats, represented as a list of dictionaries, to a comma separated list""" if not isinstance(jupytext_formats, list): return jupytext_formats jupytext_formats = [short_form_one_format(fmt) for fmt in jupytext_formats] retu...
[ "def", "short_form_multiple_formats", "(", "jupytext_formats", ")", ":", "if", "not", "isinstance", "(", "jupytext_formats", ",", "list", ")", ":", "return", "jupytext_formats", "jupytext_formats", "=", "[", "short_form_one_format", "(", "fmt", ")", "for", "fmt", ...
Convert jupytext formats, represented as a list of dictionaries, to a comma separated list
[ "Convert", "jupytext", "formats", "represented", "as", "a", "list", "of", "dictionaries", "to", "a", "comma", "separated", "list" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L503-L509
train
Convert jupytext formats represented as a list of dictionaries to a comma separated list
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/formats.py
validate_one_format
def validate_one_format(jupytext_format): """Validate extension and options for the given format""" if not isinstance(jupytext_format, dict): raise JupytextFormatError('Jupytext format should be a dictionary') for key in jupytext_format: if key not in _VALID_FORMAT_INFO + _VALID_FORMAT_OPTI...
python
def validate_one_format(jupytext_format): """Validate extension and options for the given format""" if not isinstance(jupytext_format, dict): raise JupytextFormatError('Jupytext format should be a dictionary') for key in jupytext_format: if key not in _VALID_FORMAT_INFO + _VALID_FORMAT_OPTI...
[ "def", "validate_one_format", "(", "jupytext_format", ")", ":", "if", "not", "isinstance", "(", "jupytext_format", ",", "dict", ")", ":", "raise", "JupytextFormatError", "(", "'Jupytext format should be a dictionary'", ")", "for", "key", "in", "jupytext_format", ":", ...
Validate extension and options for the given format
[ "Validate", "extension", "and", "options", "for", "the", "given", "format" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/formats.py#L517-L538
train
Validate that the given format is valid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/combine.py
black_invariant
def black_invariant(text, chars=None): """Remove characters that may be changed when reformatting the text with black""" if chars is None: chars = [' ', '\t', '\n', ',', "'", '"', '(', ')', '\\'] for char in chars: text = text.replace(char, '') return text
python
def black_invariant(text, chars=None): """Remove characters that may be changed when reformatting the text with black""" if chars is None: chars = [' ', '\t', '\n', ',', "'", '"', '(', ')', '\\'] for char in chars: text = text.replace(char, '') return text
[ "def", "black_invariant", "(", "text", ",", "chars", "=", "None", ")", ":", "if", "chars", "is", "None", ":", "chars", "=", "[", "' '", ",", "'\\t'", ",", "'\\n'", ",", "','", ",", "\"'\"", ",", "'\"'", ",", "'('", ",", "')'", ",", "'\\\\'", "]",...
Remove characters that may be changed when reformatting the text with black
[ "Remove", "characters", "that", "may", "be", "changed", "when", "reformatting", "the", "text", "with", "black" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/combine.py#L13-L20
train
Remove characters that may be changed when reformatting the text with black
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/combine.py
combine_inputs_with_outputs
def combine_inputs_with_outputs(nb_source, nb_outputs, fmt=None): """Copy outputs of the second notebook into the first one, for cells that have matching inputs""" output_code_cells = [cell for cell in nb_outputs.cells if cell.cell_type == 'code'] output_other_cells = [cell for cell in nb_outputs.cells...
python
def combine_inputs_with_outputs(nb_source, nb_outputs, fmt=None): """Copy outputs of the second notebook into the first one, for cells that have matching inputs""" output_code_cells = [cell for cell in nb_outputs.cells if cell.cell_type == 'code'] output_other_cells = [cell for cell in nb_outputs.cells...
[ "def", "combine_inputs_with_outputs", "(", "nb_source", ",", "nb_outputs", ",", "fmt", "=", "None", ")", ":", "output_code_cells", "=", "[", "cell", "for", "cell", "in", "nb_outputs", ".", "cells", "if", "cell", ".", "cell_type", "==", "'code'", "]", "output...
Copy outputs of the second notebook into the first one, for cells that have matching inputs
[ "Copy", "outputs", "of", "the", "second", "notebook", "into", "the", "first", "one", "for", "cells", "that", "have", "matching", "inputs" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/combine.py#L28-L101
train
Combine outputs of the second notebook into the first notebook.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
kernelspec_from_language
def kernelspec_from_language(language): """Return the kernel specification for the first kernel with a matching language""" try: for name in find_kernel_specs(): kernel_specs = get_kernel_spec(name) if kernel_specs.language == language or (language == 'c++' and kernel_specs.langu...
python
def kernelspec_from_language(language): """Return the kernel specification for the first kernel with a matching language""" try: for name in find_kernel_specs(): kernel_specs = get_kernel_spec(name) if kernel_specs.language == language or (language == 'c++' and kernel_specs.langu...
[ "def", "kernelspec_from_language", "(", "language", ")", ":", "try", ":", "for", "name", "in", "find_kernel_specs", "(", ")", ":", "kernel_specs", "=", "get_kernel_spec", "(", "name", ")", "if", "kernel_specs", ".", "language", "==", "language", "or", "(", "...
Return the kernel specification for the first kernel with a matching language
[ "Return", "the", "kernel", "specification", "for", "the", "first", "kernel", "with", "a", "matching", "language" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L33-L42
train
Return the kernel specification for the first kernel with a matching language
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
preferred_format
def preferred_format(incomplete_format, preferred_formats): """Return the preferred format for the given extension""" incomplete_format = long_form_one_format(incomplete_format) if 'format_name' in incomplete_format: return incomplete_format for fmt in long_form_multiple_formats(preferred_forma...
python
def preferred_format(incomplete_format, preferred_formats): """Return the preferred format for the given extension""" incomplete_format = long_form_one_format(incomplete_format) if 'format_name' in incomplete_format: return incomplete_format for fmt in long_form_multiple_formats(preferred_forma...
[ "def", "preferred_format", "(", "incomplete_format", ",", "preferred_formats", ")", ":", "incomplete_format", "=", "long_form_one_format", "(", "incomplete_format", ")", "if", "'format_name'", "in", "incomplete_format", ":", "return", "incomplete_format", "for", "fmt", ...
Return the preferred format for the given extension
[ "Return", "the", "preferred", "format", "for", "the", "given", "extension" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L45-L60
train
Return the preferred format for the given extension
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.drop_paired_notebook
def drop_paired_notebook(self, path): """Remove the current notebook from the list of paired notebooks""" if path not in self.paired_notebooks: return fmt, formats = self.paired_notebooks.pop(path) prev_paired_paths = paired_paths(path, fmt, formats) for alt_path, _ ...
python
def drop_paired_notebook(self, path): """Remove the current notebook from the list of paired notebooks""" if path not in self.paired_notebooks: return fmt, formats = self.paired_notebooks.pop(path) prev_paired_paths = paired_paths(path, fmt, formats) for alt_path, _ ...
[ "def", "drop_paired_notebook", "(", "self", ",", "path", ")", ":", "if", "path", "not", "in", "self", ".", "paired_notebooks", ":", "return", "fmt", ",", "formats", "=", "self", ".", "paired_notebooks", ".", "pop", "(", "path", ")", "prev_paired_paths", "=...
Remove the current notebook from the list of paired notebooks
[ "Remove", "the", "current", "notebook", "from", "the", "list", "of", "paired", "notebooks" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L162-L171
train
Remove the current notebook from the list of paired notebooks
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.update_paired_notebooks
def update_paired_notebooks(self, path, fmt, formats): """Update the list of paired notebooks to include/update the current pair""" if not formats: self.drop_paired_notebook(path) return new_paired_paths = paired_paths(path, fmt, formats) for alt_path, _ in new_p...
python
def update_paired_notebooks(self, path, fmt, formats): """Update the list of paired notebooks to include/update the current pair""" if not formats: self.drop_paired_notebook(path) return new_paired_paths = paired_paths(path, fmt, formats) for alt_path, _ in new_p...
[ "def", "update_paired_notebooks", "(", "self", ",", "path", ",", "fmt", ",", "formats", ")", ":", "if", "not", "formats", ":", "self", ".", "drop_paired_notebook", "(", "path", ")", "return", "new_paired_paths", "=", "paired_paths", "(", "path", ",", "fmt", ...
Update the list of paired notebooks to include/update the current pair
[ "Update", "the", "list", "of", "paired", "notebooks", "to", "include", "/", "update", "the", "current", "pair" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L173-L189
train
Update the list of paired notebooks to include or update the current pair
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.set_default_format_options
def set_default_format_options(self, format_options, read=False): """Set default format option""" if self.default_notebook_metadata_filter: format_options.setdefault('notebook_metadata_filter', self.default_notebook_metadata_filter) if self.default_cell_metadata_filter: f...
python
def set_default_format_options(self, format_options, read=False): """Set default format option""" if self.default_notebook_metadata_filter: format_options.setdefault('notebook_metadata_filter', self.default_notebook_metadata_filter) if self.default_cell_metadata_filter: f...
[ "def", "set_default_format_options", "(", "self", ",", "format_options", ",", "read", "=", "False", ")", ":", "if", "self", ".", "default_notebook_metadata_filter", ":", "format_options", ".", "setdefault", "(", "'notebook_metadata_filter'", ",", "self", ".", "defau...
Set default format option
[ "Set", "default", "format", "option" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L191-L204
train
Set default format option
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.default_formats
def default_formats(self, path): """Return the default formats, if they apply to the current path #157""" formats = long_form_multiple_formats(self.default_jupytext_formats) for fmt in formats: try: base_path(path, fmt) return self.default_jupytext_for...
python
def default_formats(self, path): """Return the default formats, if they apply to the current path #157""" formats = long_form_multiple_formats(self.default_jupytext_formats) for fmt in formats: try: base_path(path, fmt) return self.default_jupytext_for...
[ "def", "default_formats", "(", "self", ",", "path", ")", ":", "formats", "=", "long_form_multiple_formats", "(", "self", ".", "default_jupytext_formats", ")", "for", "fmt", "in", "formats", ":", "try", ":", "base_path", "(", "path", ",", "fmt", ")", "return"...
Return the default formats, if they apply to the current path #157
[ "Return", "the", "default", "formats", "if", "they", "apply", "to", "the", "current", "path", "#157" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L206-L216
train
Return the default formats for the current path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.create_prefix_dir
def create_prefix_dir(self, path, fmt): """Create the prefix dir, if missing""" create_prefix_dir(self._get_os_path(path.strip('/')), fmt)
python
def create_prefix_dir(self, path, fmt): """Create the prefix dir, if missing""" create_prefix_dir(self._get_os_path(path.strip('/')), fmt)
[ "def", "create_prefix_dir", "(", "self", ",", "path", ",", "fmt", ")", ":", "create_prefix_dir", "(", "self", ".", "_get_os_path", "(", "path", ".", "strip", "(", "'/'", ")", ")", ",", "fmt", ")" ]
Create the prefix dir, if missing
[ "Create", "the", "prefix", "dir", "if", "missing" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L218-L220
train
Create the prefix dir if missing
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.save
def save(self, model, path=''): """Save the file model and return the model with no content.""" if model['type'] != 'notebook': return super(TextFileContentsManager, self).save(model, path) nbk = model['content'] try: metadata = nbk.get('metadata') re...
python
def save(self, model, path=''): """Save the file model and return the model with no content.""" if model['type'] != 'notebook': return super(TextFileContentsManager, self).save(model, path) nbk = model['content'] try: metadata = nbk.get('metadata') re...
[ "def", "save", "(", "self", ",", "model", ",", "path", "=", "''", ")", ":", "if", "model", "[", "'type'", "]", "!=", "'notebook'", ":", "return", "super", "(", "TextFileContentsManager", ",", "self", ")", ".", "save", "(", "model", ",", "path", ")", ...
Save the file model and return the model with no content.
[ "Save", "the", "file", "model", "and", "return", "the", "model", "with", "no", "content", "." ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L222-L293
train
Save the file model and return the model with no content.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.get
def get(self, path, content=True, type=None, format=None, load_alternative_format=True): """ Takes a path for an entity and returns its model""" path = path.strip('/') ext = os.path.splitext(path)[1] # Not a notebook? if not self.exists(path) or (type != 'notebook' if type else ...
python
def get(self, path, content=True, type=None, format=None, load_alternative_format=True): """ Takes a path for an entity and returns its model""" path = path.strip('/') ext = os.path.splitext(path)[1] # Not a notebook? if not self.exists(path) or (type != 'notebook' if type else ...
[ "def", "get", "(", "self", ",", "path", ",", "content", "=", "True", ",", "type", "=", "None", ",", "format", "=", "None", ",", "load_alternative_format", "=", "True", ")", ":", "path", "=", "path", ".", "strip", "(", "'/'", ")", "ext", "=", "os", ...
Takes a path for an entity and returns its model
[ "Takes", "a", "path", "for", "an", "entity", "and", "returns", "its", "model" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L295-L426
train
Returns a specific notebook or file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.trust_notebook
def trust_notebook(self, path): """Trust the current notebook""" if path.endswith('.ipynb') or path not in self.paired_notebooks: super(TextFileContentsManager, self).trust_notebook(path) return fmt, formats = self.paired_notebooks[path] for alt_path, alt_fmt in ...
python
def trust_notebook(self, path): """Trust the current notebook""" if path.endswith('.ipynb') or path not in self.paired_notebooks: super(TextFileContentsManager, self).trust_notebook(path) return fmt, formats = self.paired_notebooks[path] for alt_path, alt_fmt in ...
[ "def", "trust_notebook", "(", "self", ",", "path", ")", ":", "if", "path", ".", "endswith", "(", "'.ipynb'", ")", "or", "path", "not", "in", "self", ".", "paired_notebooks", ":", "super", "(", "TextFileContentsManager", ",", "self", ")", ".", "trust_notebo...
Trust the current notebook
[ "Trust", "the", "current", "notebook" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L428-L437
train
Trust the current notebook
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/contentsmanager.py
TextFileContentsManager.rename_file
def rename_file(self, old_path, new_path): """Rename the current notebook, as well as its alternative representations""" if old_path not in self.paired_notebooks: try: # we do not know yet if this is a paired notebook (#190) # -> to get this information we ope...
python
def rename_file(self, old_path, new_path): """Rename the current notebook, as well as its alternative representations""" if old_path not in self.paired_notebooks: try: # we do not know yet if this is a paired notebook (#190) # -> to get this information we ope...
[ "def", "rename_file", "(", "self", ",", "old_path", ",", "new_path", ")", ":", "if", "old_path", "not", "in", "self", ".", "paired_notebooks", ":", "try", ":", "# we do not know yet if this is a paired notebook (#190)", "# -> to get this information we open the notebook", ...
Rename the current notebook, as well as its alternative representations
[ "Rename", "the", "current", "notebook", "as", "well", "as", "its", "alternative", "representations" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/contentsmanager.py#L439-L468
train
Rename the current notebook as well as its alternative representations.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pep8.py
next_instruction_is_function_or_class
def next_instruction_is_function_or_class(lines): """Is the first non-empty, non-commented line of the cell either a function or a class?""" for i, line in enumerate(lines): if not line.strip(): # empty line if i > 0 and not lines[i - 1].strip(): return False con...
python
def next_instruction_is_function_or_class(lines): """Is the first non-empty, non-commented line of the cell either a function or a class?""" for i, line in enumerate(lines): if not line.strip(): # empty line if i > 0 and not lines[i - 1].strip(): return False con...
[ "def", "next_instruction_is_function_or_class", "(", "lines", ")", ":", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "not", "line", ".", "strip", "(", ")", ":", "# empty line", "if", "i", ">", "0", "and", "not", "lines", "[...
Is the first non-empty, non-commented line of the cell either a function or a class?
[ "Is", "the", "first", "non", "-", "empty", "non", "-", "commented", "line", "of", "the", "cell", "either", "a", "function", "or", "a", "class?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L5-L18
train
Is the first non - empty line of the cell either a function or a class?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pep8.py
cell_ends_with_function_or_class
def cell_ends_with_function_or_class(lines): """Does the last line of the cell belong to an indented code?""" non_quoted_lines = [] parser = StringParser('python') for line in lines: if not parser.is_quoted(): non_quoted_lines.append(line) parser.read_line(line) # find t...
python
def cell_ends_with_function_or_class(lines): """Does the last line of the cell belong to an indented code?""" non_quoted_lines = [] parser = StringParser('python') for line in lines: if not parser.is_quoted(): non_quoted_lines.append(line) parser.read_line(line) # find t...
[ "def", "cell_ends_with_function_or_class", "(", "lines", ")", ":", "non_quoted_lines", "=", "[", "]", "parser", "=", "StringParser", "(", "'python'", ")", "for", "line", "in", "lines", ":", "if", "not", "parser", ".", "is_quoted", "(", ")", ":", "non_quoted_...
Does the last line of the cell belong to an indented code?
[ "Does", "the", "last", "line", "of", "the", "cell", "belong", "to", "an", "indented", "code?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L21-L44
train
Does the last line of the cell belong to an indented code?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pep8.py
cell_ends_with_code
def cell_ends_with_code(lines): """Is the last line of the cell a line with code?""" if not lines: return False if not lines[-1].strip(): return False if lines[-1].startswith('#'): return False return True
python
def cell_ends_with_code(lines): """Is the last line of the cell a line with code?""" if not lines: return False if not lines[-1].strip(): return False if lines[-1].startswith('#'): return False return True
[ "def", "cell_ends_with_code", "(", "lines", ")", ":", "if", "not", "lines", ":", "return", "False", "if", "not", "lines", "[", "-", "1", "]", ".", "strip", "(", ")", ":", "return", "False", "if", "lines", "[", "-", "1", "]", ".", "startswith", "(",...
Is the last line of the cell a line with code?
[ "Is", "the", "last", "line", "of", "the", "cell", "a", "line", "with", "code?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L47-L55
train
Is the last line of the cell a line with code?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pep8.py
cell_has_code
def cell_has_code(lines): """Is there any code in this cell?""" for i, line in enumerate(lines): stripped_line = line.strip() if stripped_line.startswith('#'): continue # Two consecutive blank lines? if not stripped_line: if i > 0 and not lines[i - 1].str...
python
def cell_has_code(lines): """Is there any code in this cell?""" for i, line in enumerate(lines): stripped_line = line.strip() if stripped_line.startswith('#'): continue # Two consecutive blank lines? if not stripped_line: if i > 0 and not lines[i - 1].str...
[ "def", "cell_has_code", "(", "lines", ")", ":", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "stripped_line", "=", "line", ".", "strip", "(", ")", "if", "stripped_line", ".", "startswith", "(", "'#'", ")", ":", "continue", "# Two...
Is there any code in this cell?
[ "Is", "there", "any", "code", "in", "this", "cell?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L58-L73
train
Is there any code in this cell?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pep8.py
pep8_lines_between_cells
def pep8_lines_between_cells(prev_lines, next_lines, ext): """How many blank lines should be added between the two python paragraphs to make them pep8?""" if not next_lines: return 1 if not prev_lines: return 0 if ext != '.py': return 1 if cell_ends_with_function_or_class(pre...
python
def pep8_lines_between_cells(prev_lines, next_lines, ext): """How many blank lines should be added between the two python paragraphs to make them pep8?""" if not next_lines: return 1 if not prev_lines: return 0 if ext != '.py': return 1 if cell_ends_with_function_or_class(pre...
[ "def", "pep8_lines_between_cells", "(", "prev_lines", ",", "next_lines", ",", "ext", ")", ":", "if", "not", "next_lines", ":", "return", "1", "if", "not", "prev_lines", ":", "return", "0", "if", "ext", "!=", "'.py'", ":", "return", "1", "if", "cell_ends_wi...
How many blank lines should be added between the two python paragraphs to make them pep8?
[ "How", "many", "blank", "lines", "should", "be", "added", "between", "the", "two", "python", "paragraphs", "to", "make", "them", "pep8?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L76-L88
train
How many blank lines should be added between two python paragraphs?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/compare.py
filtered_cell
def filtered_cell(cell, preserve_outputs, cell_metadata_filter): """Cell type, metadata and source from given cell""" metadata = copy(cell.metadata) filter_metadata(metadata, cell_metadata_filter, _IGNORE_CELL_METADATA) filtered = {'cell_type': cell.cell_type, 'source': cell.source, ...
python
def filtered_cell(cell, preserve_outputs, cell_metadata_filter): """Cell type, metadata and source from given cell""" metadata = copy(cell.metadata) filter_metadata(metadata, cell_metadata_filter, _IGNORE_CELL_METADATA) filtered = {'cell_type': cell.cell_type, 'source': cell.source, ...
[ "def", "filtered_cell", "(", "cell", ",", "preserve_outputs", ",", "cell_metadata_filter", ")", ":", "metadata", "=", "copy", "(", "cell", ".", "metadata", ")", "filter_metadata", "(", "metadata", ",", "cell_metadata_filter", ",", "_IGNORE_CELL_METADATA", ")", "fi...
Cell type, metadata and source from given cell
[ "Cell", "type", "metadata", "and", "source", "from", "given", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/compare.py#L16-L30
train
Returns a filtered version of the given cell.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/compare.py
filtered_notebook_metadata
def filtered_notebook_metadata(notebook): """Notebook metadata, filtered for metadata added by Jupytext itself""" metadata = copy(notebook.metadata) metadata = filter_metadata(metadata, notebook.metadata.get('jupytext', {}).get('notebook_metadata_filter'), ...
python
def filtered_notebook_metadata(notebook): """Notebook metadata, filtered for metadata added by Jupytext itself""" metadata = copy(notebook.metadata) metadata = filter_metadata(metadata, notebook.metadata.get('jupytext', {}).get('notebook_metadata_filter'), ...
[ "def", "filtered_notebook_metadata", "(", "notebook", ")", ":", "metadata", "=", "copy", "(", "notebook", ".", "metadata", ")", "metadata", "=", "filter_metadata", "(", "metadata", ",", "notebook", ".", "metadata", ".", "get", "(", "'jupytext'", ",", "{", "}...
Notebook metadata, filtered for metadata added by Jupytext itself
[ "Notebook", "metadata", "filtered", "for", "metadata", "added", "by", "Jupytext", "itself" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/compare.py#L33-L41
train
Notebook metadata filtered for metadata added by Jupytext itself
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/compare.py
same_content
def same_content(ref_source, test_source, allow_removed_final_blank_line): """Is the content of two cells the same, except for an optional final blank line?""" if ref_source == test_source: return True if not allow_removed_final_blank_line: return False # Is ref identical to test, plus...
python
def same_content(ref_source, test_source, allow_removed_final_blank_line): """Is the content of two cells the same, except for an optional final blank line?""" if ref_source == test_source: return True if not allow_removed_final_blank_line: return False # Is ref identical to test, plus...
[ "def", "same_content", "(", "ref_source", ",", "test_source", ",", "allow_removed_final_blank_line", ")", ":", "if", "ref_source", "==", "test_source", ":", "return", "True", "if", "not", "allow_removed_final_blank_line", ":", "return", "False", "# Is ref identical to t...
Is the content of two cells the same, except for an optional final blank line?
[ "Is", "the", "content", "of", "two", "cells", "the", "same", "except", "for", "an", "optional", "final", "blank", "line?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/compare.py#L48-L66
train
Returns True if the content of two cells are the same.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/compare.py
compare_notebooks
def compare_notebooks(notebook_expected, notebook_actual, fmt=None, allow_expected_differences=True, raise_on_first_difference=True, compare_outputs=False): """Compare the two notebooks, and raise with a me...
python
def compare_notebooks(notebook_expected, notebook_actual, fmt=None, allow_expected_differences=True, raise_on_first_difference=True, compare_outputs=False): """Compare the two notebooks, and raise with a me...
[ "def", "compare_notebooks", "(", "notebook_expected", ",", "notebook_actual", ",", "fmt", "=", "None", ",", "allow_expected_differences", "=", "True", ",", "raise_on_first_difference", "=", "True", ",", "compare_outputs", "=", "False", ")", ":", "fmt", "=", "long_...
Compare the two notebooks, and raise with a meaningful message that explains the differences, if any
[ "Compare", "the", "two", "notebooks", "and", "raise", "with", "a", "meaningful", "message", "that", "explains", "the", "differences", "if", "any" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/compare.py#L69-L218
train
Compare two notebooks and raise a meaningful message if they differ.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
cell_source
def cell_source(cell): """Return the source of the current cell, as an array of lines""" source = cell.source if source == '': return [''] if source.endswith('\n'): return source.splitlines() + [''] return source.splitlines()
python
def cell_source(cell): """Return the source of the current cell, as an array of lines""" source = cell.source if source == '': return [''] if source.endswith('\n'): return source.splitlines() + [''] return source.splitlines()
[ "def", "cell_source", "(", "cell", ")", ":", "source", "=", "cell", ".", "source", "if", "source", "==", "''", ":", "return", "[", "''", "]", "if", "source", ".", "endswith", "(", "'\\n'", ")", ":", "return", "source", ".", "splitlines", "(", ")", ...
Return the source of the current cell, as an array of lines
[ "Return", "the", "source", "of", "the", "current", "cell", "as", "an", "array", "of", "lines" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L17-L24
train
Return the source of the current cell as an array of lines
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
endofcell_marker
def endofcell_marker(source, comment): """Issues #31 #38: does the cell contain a blank line? In that case we add an end-of-cell marker""" endofcell = '-' while True: endofcell_re = re.compile(r'^{}( )'.format(comment) + endofcell + r'\s*$') if list(filter(endofcell_re.match, source)): ...
python
def endofcell_marker(source, comment): """Issues #31 #38: does the cell contain a blank line? In that case we add an end-of-cell marker""" endofcell = '-' while True: endofcell_re = re.compile(r'^{}( )'.format(comment) + endofcell + r'\s*$') if list(filter(endofcell_re.match, source)): ...
[ "def", "endofcell_marker", "(", "source", ",", "comment", ")", ":", "endofcell", "=", "'-'", "while", "True", ":", "endofcell_re", "=", "re", ".", "compile", "(", "r'^{}( )'", ".", "format", "(", "comment", ")", "+", "endofcell", "+", "r'\\s*$'", ")", "i...
Issues #31 #38: does the cell contain a blank line? In that case we add an end-of-cell marker
[ "Issues", "#31", "#38", ":", "does", "the", "cell", "contain", "a", "blank", "line?", "In", "that", "case", "we", "add", "an", "end", "-", "of", "-", "cell", "marker" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L182-L191
train
Issues #31 #38 : does the cell contain a blank line? In that case we add an end - of - cell marker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
BaseCellExporter.is_code
def is_code(self): """Is this cell a code cell?""" if self.cell_type == 'code': return True if self.cell_type == 'raw' and 'active' in self.metadata: return True return False
python
def is_code(self): """Is this cell a code cell?""" if self.cell_type == 'code': return True if self.cell_type == 'raw' and 'active' in self.metadata: return True return False
[ "def", "is_code", "(", "self", ")", ":", "if", "self", ".", "cell_type", "==", "'code'", ":", "return", "True", "if", "self", ".", "cell_type", "==", "'raw'", "and", "'active'", "in", "self", ".", "metadata", ":", "return", "True", "return", "False" ]
Is this cell a code cell?
[ "Is", "this", "cell", "a", "code", "cell?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L66-L72
train
Is this cell a code cell?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
BaseCellExporter.cell_to_text
def cell_to_text(self): """Return the text representation for the cell""" if self.is_code(): return self.code_to_text() source = copy(self.source) if not self.comment: escape_code_start(source, self.ext, None) return self.markdown_to_text(source)
python
def cell_to_text(self): """Return the text representation for the cell""" if self.is_code(): return self.code_to_text() source = copy(self.source) if not self.comment: escape_code_start(source, self.ext, None) return self.markdown_to_text(source)
[ "def", "cell_to_text", "(", "self", ")", ":", "if", "self", ".", "is_code", "(", ")", ":", "return", "self", ".", "code_to_text", "(", ")", "source", "=", "copy", "(", "self", ".", "source", ")", "if", "not", "self", ".", "comment", ":", "escape_code...
Return the text representation for the cell
[ "Return", "the", "text", "representation", "for", "the", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L74-L82
train
Return the text representation of the cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
BaseCellExporter.markdown_to_text
def markdown_to_text(self, source): """Escape the given source, for a markdown cell""" if self.comment and self.comment != "#'": source = copy(source) comment_magic(source, self.language, self.comment_magics) return comment_lines(source, self.comment)
python
def markdown_to_text(self, source): """Escape the given source, for a markdown cell""" if self.comment and self.comment != "#'": source = copy(source) comment_magic(source, self.language, self.comment_magics) return comment_lines(source, self.comment)
[ "def", "markdown_to_text", "(", "self", ",", "source", ")", ":", "if", "self", ".", "comment", "and", "self", ".", "comment", "!=", "\"#'\"", ":", "source", "=", "copy", "(", "source", ")", "comment_magic", "(", "source", ",", "self", ".", "language", ...
Escape the given source, for a markdown cell
[ "Escape", "the", "given", "source", "for", "a", "markdown", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L84-L90
train
Escape the given source for a markdown cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
MarkdownCellExporter.cell_to_text
def cell_to_text(self): """Return the text representation of a cell""" if self.cell_type == 'markdown': # Is an explicit region required? if self.metadata or self.cell_reader(self.fmt).read(self.source)[1] < len(self.source): if self.metadata: ...
python
def cell_to_text(self): """Return the text representation of a cell""" if self.cell_type == 'markdown': # Is an explicit region required? if self.metadata or self.cell_reader(self.fmt).read(self.source)[1] < len(self.source): if self.metadata: ...
[ "def", "cell_to_text", "(", "self", ")", ":", "if", "self", ".", "cell_type", "==", "'markdown'", ":", "# Is an explicit region required?", "if", "self", ".", "metadata", "or", "self", ".", "cell_reader", "(", "self", ".", "fmt", ")", ".", "read", "(", "se...
Return the text representation of a cell
[ "Return", "the", "text", "representation", "of", "a", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L116-L134
train
Return the text representation of a cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
MarkdownCellExporter.code_to_text
def code_to_text(self): """Return the text representation of a code cell""" source = copy(self.source) comment_magic(source, self.language, self.comment_magics) options = [] if self.cell_type == 'code' and self.language: options.append(self.language) filtere...
python
def code_to_text(self): """Return the text representation of a code cell""" source = copy(self.source) comment_magic(source, self.language, self.comment_magics) options = [] if self.cell_type == 'code' and self.language: options.append(self.language) filtere...
[ "def", "code_to_text", "(", "self", ")", ":", "source", "=", "copy", "(", "self", ".", "source", ")", "comment_magic", "(", "source", ",", "self", ".", "language", ",", "self", ".", "comment_magics", ")", "options", "=", "[", "]", "if", "self", ".", ...
Return the text representation of a code cell
[ "Return", "the", "text", "representation", "of", "a", "code", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L136-L151
train
Return the text representation of a code cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
LightScriptCellExporter.code_to_text
def code_to_text(self): """Return the text representation of a code cell""" active = is_active(self.ext, self.metadata) if self.language != self.default_language and 'active' not in self.metadata: active = False source = copy(self.source) escape_code_start(source, se...
python
def code_to_text(self): """Return the text representation of a code cell""" active = is_active(self.ext, self.metadata) if self.language != self.default_language and 'active' not in self.metadata: active = False source = copy(self.source) escape_code_start(source, se...
[ "def", "code_to_text", "(", "self", ")", ":", "active", "=", "is_active", "(", "self", ".", "ext", ",", "self", ".", "metadata", ")", "if", "self", ".", "language", "!=", "self", ".", "default_language", "and", "'active'", "not", "in", "self", ".", "me...
Return the text representation of a code cell
[ "Return", "the", "text", "representation", "of", "a", "code", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L218-L255
train
Return the text representation of a code cell.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
LightScriptCellExporter.explicit_start_marker
def explicit_start_marker(self, source): """Does the python representation of this cell requires an explicit start of cell marker?""" if not self.use_cell_markers: return False if self.metadata: return True if self.cell_marker_start: start_code...
python
def explicit_start_marker(self, source): """Does the python representation of this cell requires an explicit start of cell marker?""" if not self.use_cell_markers: return False if self.metadata: return True if self.cell_marker_start: start_code...
[ "def", "explicit_start_marker", "(", "self", ",", "source", ")", ":", "if", "not", "self", ".", "use_cell_markers", ":", "return", "False", "if", "self", ".", "metadata", ":", "return", "True", "if", "self", ".", "cell_marker_start", ":", "start_code_re", "=...
Does the python representation of this cell requires an explicit start of cell marker?
[ "Does", "the", "python", "representation", "of", "this", "cell", "requires", "an", "explicit", "start", "of", "cell", "marker?" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L257-L275
train
Does the python representation of this cell require an explicit start of cell marker?
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
LightScriptCellExporter.remove_eoc_marker
def remove_eoc_marker(self, text, next_text): """Remove end of cell marker when next cell has an explicit start marker""" if self.cell_marker_start: return text if self.is_code() and text[-1] == self.comment + ' -': # remove end of cell marker when redundant with next ex...
python
def remove_eoc_marker(self, text, next_text): """Remove end of cell marker when next cell has an explicit start marker""" if self.cell_marker_start: return text if self.is_code() and text[-1] == self.comment + ' -': # remove end of cell marker when redundant with next ex...
[ "def", "remove_eoc_marker", "(", "self", ",", "text", ",", "next_text", ")", ":", "if", "self", ".", "cell_marker_start", ":", "return", "text", "if", "self", ".", "is_code", "(", ")", "and", "text", "[", "-", "1", "]", "==", "self", ".", "comment", ...
Remove end of cell marker when next cell has an explicit start marker
[ "Remove", "end", "of", "cell", "marker", "when", "next", "cell", "has", "an", "explicit", "start", "marker" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L277-L300
train
Remove end of cell marker when next cell has an explicit start marker
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
LightScriptCellExporter.simplify_soc_marker
def simplify_soc_marker(self, text, prev_text): """Simplify start of cell marker when previous line is blank""" if self.cell_marker_start: return text if self.is_code() and text and text[0] == self.comment + ' + {}': if not prev_text or not prev_text[-1].strip(): ...
python
def simplify_soc_marker(self, text, prev_text): """Simplify start of cell marker when previous line is blank""" if self.cell_marker_start: return text if self.is_code() and text and text[0] == self.comment + ' + {}': if not prev_text or not prev_text[-1].strip(): ...
[ "def", "simplify_soc_marker", "(", "self", ",", "text", ",", "prev_text", ")", ":", "if", "self", ".", "cell_marker_start", ":", "return", "text", "if", "self", ".", "is_code", "(", ")", "and", "text", "and", "text", "[", "0", "]", "==", "self", ".", ...
Simplify start of cell marker when previous line is blank
[ "Simplify", "start", "of", "cell", "marker", "when", "previous", "line", "is", "blank" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L302-L311
train
Simplify start of cell marker when previous line is blank
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
RScriptCellExporter.code_to_text
def code_to_text(self): """Return the text representation of a code cell""" active = is_active(self.ext, self.metadata) source = copy(self.source) escape_code_start(source, self.ext, self.language) if active: comment_magic(source, self.language, self.comment_magics) ...
python
def code_to_text(self): """Return the text representation of a code cell""" active = is_active(self.ext, self.metadata) source = copy(self.source) escape_code_start(source, self.ext, self.language) if active: comment_magic(source, self.language, self.comment_magics) ...
[ "def", "code_to_text", "(", "self", ")", ":", "active", "=", "is_active", "(", "self", ".", "ext", ",", "self", ".", "metadata", ")", "source", "=", "copy", "(", "self", ".", "source", ")", "escape_code_start", "(", "source", ",", "self", ".", "ext", ...
Return the text representation of a code cell
[ "Return", "the", "text", "representation", "of", "a", "code", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L327-L346
train
Return the text representation of a code cell.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
DoublePercentCellExporter.cell_to_text
def cell_to_text(self): """Return the text representation for the cell""" if self.cell_type != 'code': self.metadata['cell_type'] = self.cell_type active = is_active('py', self.metadata) if self.language != self.default_language and 'active' not in self.metadata: ...
python
def cell_to_text(self): """Return the text representation for the cell""" if self.cell_type != 'code': self.metadata['cell_type'] = self.cell_type active = is_active('py', self.metadata) if self.language != self.default_language and 'active' not in self.metadata: ...
[ "def", "cell_to_text", "(", "self", ")", ":", "if", "self", ".", "cell_type", "!=", "'code'", ":", "self", ".", "metadata", "[", "'cell_type'", "]", "=", "self", ".", "cell_type", "active", "=", "is_active", "(", "'py'", ",", "self", ".", "metadata", "...
Return the text representation for the cell
[ "Return", "the", "text", "representation", "for", "the", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L354-L378
train
Return the text representation of the cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/cell_to_text.py
SphinxGalleryCellExporter.cell_to_text
def cell_to_text(self): """Return the text representation for the cell""" if self.cell_type == 'code': source = copy(self.source) return comment_magic(source, self.language, self.comment_magics) if 'cell_marker' in self.metadata: cell_marker = self.metadata.p...
python
def cell_to_text(self): """Return the text representation for the cell""" if self.cell_type == 'code': source = copy(self.source) return comment_magic(source, self.language, self.comment_magics) if 'cell_marker' in self.metadata: cell_marker = self.metadata.p...
[ "def", "cell_to_text", "(", "self", ")", ":", "if", "self", ".", "cell_type", "==", "'code'", ":", "source", "=", "copy", "(", "self", ".", "source", ")", "return", "comment_magic", "(", "source", ",", "self", ".", "language", ",", "self", ".", "commen...
Return the text representation for the cell
[ "Return", "the", "text", "representation", "for", "the", "cell" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_to_text.py#L406-L424
train
Return the text representation of the cell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pandoc.py
pandoc
def pandoc(args, filein=None, fileout=None): """Execute pandoc with the given arguments""" cmd = [u'pandoc'] if filein: cmd.append(filein) if fileout: cmd.append('-o') cmd.append(fileout) cmd.extend(args.split()) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) ...
python
def pandoc(args, filein=None, fileout=None): """Execute pandoc with the given arguments""" cmd = [u'pandoc'] if filein: cmd.append(filein) if fileout: cmd.append('-o') cmd.append(fileout) cmd.extend(args.split()) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) ...
[ "def", "pandoc", "(", "args", ",", "filein", "=", "None", ",", "fileout", "=", "None", ")", ":", "cmd", "=", "[", "u'pandoc'", "]", "if", "filein", ":", "cmd", ".", "append", "(", "filein", ")", "if", "fileout", ":", "cmd", ".", "append", "(", "'...
Execute pandoc with the given arguments
[ "Execute", "pandoc", "with", "the", "given", "arguments" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pandoc.py#L15-L32
train
Execute pandoc with the given arguments
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pandoc.py
pandoc_version
def pandoc_version(): """Pandoc's version number""" version = pandoc(u'--version').splitlines()[0].split()[1] if parse_version(version) < parse_version('2.7.2'): raise PandocError('Please install pandoc>=2.7.2 (found version {})'.format(version)) return version
python
def pandoc_version(): """Pandoc's version number""" version = pandoc(u'--version').splitlines()[0].split()[1] if parse_version(version) < parse_version('2.7.2'): raise PandocError('Please install pandoc>=2.7.2 (found version {})'.format(version)) return version
[ "def", "pandoc_version", "(", ")", ":", "version", "=", "pandoc", "(", "u'--version'", ")", ".", "splitlines", "(", ")", "[", "0", "]", ".", "split", "(", ")", "[", "1", "]", "if", "parse_version", "(", "version", ")", "<", "parse_version", "(", "'2....
Pandoc's version number
[ "Pandoc", "s", "version", "number" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pandoc.py#L44-L50
train
Pandoc s version number
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pandoc.py
md_to_notebook
def md_to_notebook(text): """Convert a Markdown text to a Jupyter notebook, using Pandoc""" tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(text.encode('utf-8')) tmp_file.close() pandoc(u'--from markdown --to ipynb -s --atx-headers --wrap=preserve --preserve-tabs', tmp_file.name...
python
def md_to_notebook(text): """Convert a Markdown text to a Jupyter notebook, using Pandoc""" tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(text.encode('utf-8')) tmp_file.close() pandoc(u'--from markdown --to ipynb -s --atx-headers --wrap=preserve --preserve-tabs', tmp_file.name...
[ "def", "md_to_notebook", "(", "text", ")", ":", "tmp_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", "tmp_file", ".", "write", "(", "text", ".", "encode", "(", "'utf-8'", ")", ")", "tmp_file", ".", "close", "(", ")", ...
Convert a Markdown text to a Jupyter notebook, using Pandoc
[ "Convert", "a", "Markdown", "text", "to", "a", "Jupyter", "notebook", "using", "Pandoc" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pandoc.py#L53-L65
train
Convert a Markdown text to a Jupyter notebook using Pandoc
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mwouts/jupytext
jupytext/pandoc.py
notebook_to_md
def notebook_to_md(notebook): """Convert a notebook to its Markdown representation, using Pandoc""" tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(ipynb_writes(notebook).encode('utf-8')) tmp_file.close() pandoc(u'--from ipynb --to markdown -s --atx-headers --wrap=preserve --pre...
python
def notebook_to_md(notebook): """Convert a notebook to its Markdown representation, using Pandoc""" tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(ipynb_writes(notebook).encode('utf-8')) tmp_file.close() pandoc(u'--from ipynb --to markdown -s --atx-headers --wrap=preserve --pre...
[ "def", "notebook_to_md", "(", "notebook", ")", ":", "tmp_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", "tmp_file", ".", "write", "(", "ipynb_writes", "(", "notebook", ")", ".", "encode", "(", "'utf-8'", ")", ")", "tmp...
Convert a notebook to its Markdown representation, using Pandoc
[ "Convert", "a", "notebook", "to", "its", "Markdown", "representation", "using", "Pandoc" ]
eb7d6aee889f80ad779cfc53441c648f0db9246d
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pandoc.py#L68-L80
train
Convert a notebook to its Markdown representation using Pandoc
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/pybser.py
_int_size
def _int_size(x): """Return the smallest size int that can store the value""" if -0x80 <= x <= 0x7F: return 1 elif -0x8000 <= x <= 0x7FFF: return 2 elif -0x80000000 <= x <= 0x7FFFFFFF: return 4 elif long(-0x8000000000000000) <= x <= long(0x7FFFFFFFFFFFFFFF): return 8 ...
python
def _int_size(x): """Return the smallest size int that can store the value""" if -0x80 <= x <= 0x7F: return 1 elif -0x8000 <= x <= 0x7FFF: return 2 elif -0x80000000 <= x <= 0x7FFFFFFF: return 4 elif long(-0x8000000000000000) <= x <= long(0x7FFFFFFFFFFFFFFF): return 8 ...
[ "def", "_int_size", "(", "x", ")", ":", "if", "-", "0x80", "<=", "x", "<=", "0x7F", ":", "return", "1", "elif", "-", "0x8000", "<=", "x", "<=", "0x7FFF", ":", "return", "2", "elif", "-", "0x80000000", "<=", "x", "<=", "0x7FFFFFFF", ":", "return", ...
Return the smallest size int that can store the value
[ "Return", "the", "smallest", "size", "int", "that", "can", "store", "the", "value" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/pybser.py#L75-L86
train
Return the smallest size int that can store the value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/pybser.py
loads
def loads(buf, mutable=True, value_encoding=None, value_errors=None): """Deserialize a BSER-encoded blob. @param buf: The buffer to deserialize. @type buf: bytes @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode value...
python
def loads(buf, mutable=True, value_encoding=None, value_errors=None): """Deserialize a BSER-encoded blob. @param buf: The buffer to deserialize. @type buf: bytes @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode value...
[ "def", "loads", "(", "buf", ",", "mutable", "=", "True", ",", "value_encoding", "=", "None", ",", "value_errors", "=", "None", ")", ":", "info", "=", "_pdu_info_helper", "(", "buf", ")", "expected_len", "=", "info", "[", "2", "]", "pos", "=", "info", ...
Deserialize a BSER-encoded blob. @param buf: The buffer to deserialize. @type buf: bytes @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode values. If unspecified or None, return values as bytest...
[ "Deserialize", "a", "BSER", "-", "encoded", "blob", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/pybser.py#L498-L530
train
Deserialize a BSER - encoded blob into a tuple of bytestrings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/utils.py
run_command
def run_command(*cmd, **kwargs): 'The stdout of most fbcode_builder utilities is meant to be parsed.' logging.debug('Running: {0} with {1}'.format(cmd, kwargs)) kwargs['stdout'] = sys.stderr subprocess.check_call(cmd, **kwargs)
python
def run_command(*cmd, **kwargs): 'The stdout of most fbcode_builder utilities is meant to be parsed.' logging.debug('Running: {0} with {1}'.format(cmd, kwargs)) kwargs['stdout'] = sys.stderr subprocess.check_call(cmd, **kwargs)
[ "def", "run_command", "(", "*", "cmd", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "debug", "(", "'Running: {0} with {1}'", ".", "format", "(", "cmd", ",", "kwargs", ")", ")", "kwargs", "[", "'stdout'", "]", "=", "sys", ".", "stderr", "subproces...
The stdout of most fbcode_builder utilities is meant to be parsed.
[ "The", "stdout", "of", "most", "fbcode_builder", "utilities", "is", "meant", "to", "be", "parsed", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/utils.py#L26-L30
train
The stdout of most fbcode_builder utilities is meant to be parsed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/utils.py
_inner_read_config
def _inner_read_config(path): ''' Helper to read a named config file. The grossness with the global is a workaround for this python bug: https://bugs.python.org/issue21591 The bug prevents us from defining either a local function or a lambda in the scope of read_fbcode_builder_config below. ...
python
def _inner_read_config(path): ''' Helper to read a named config file. The grossness with the global is a workaround for this python bug: https://bugs.python.org/issue21591 The bug prevents us from defining either a local function or a lambda in the scope of read_fbcode_builder_config below. ...
[ "def", "_inner_read_config", "(", "path", ")", ":", "global", "_project_dir", "full_path", "=", "os", ".", "path", ".", "join", "(", "_project_dir", ",", "path", ")", "return", "read_fbcode_builder_config", "(", "full_path", ")" ]
Helper to read a named config file. The grossness with the global is a workaround for this python bug: https://bugs.python.org/issue21591 The bug prevents us from defining either a local function or a lambda in the scope of read_fbcode_builder_config below.
[ "Helper", "to", "read", "a", "named", "config", "file", ".", "The", "grossness", "with", "the", "global", "is", "a", "workaround", "for", "this", "python", "bug", ":", "https", ":", "//", "bugs", ".", "python", ".", "org", "/", "issue21591", "The", "bu...
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/utils.py#L42-L52
train
Internal helper to read a named config file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/utils.py
steps_for_spec
def steps_for_spec(builder, spec, processed_modules=None): ''' Sets `builder` configuration, and returns all the builder steps necessary to build `spec` and its dependencies. Traverses the dependencies in depth-first order, honoring the sequencing in each 'depends_on' list. ''' if processed...
python
def steps_for_spec(builder, spec, processed_modules=None): ''' Sets `builder` configuration, and returns all the builder steps necessary to build `spec` and its dependencies. Traverses the dependencies in depth-first order, honoring the sequencing in each 'depends_on' list. ''' if processed...
[ "def", "steps_for_spec", "(", "builder", ",", "spec", ",", "processed_modules", "=", "None", ")", ":", "if", "processed_modules", "is", "None", ":", "processed_modules", "=", "set", "(", ")", "steps", "=", "[", "]", "for", "module", "in", "spec", ".", "g...
Sets `builder` configuration, and returns all the builder steps necessary to build `spec` and its dependencies. Traverses the dependencies in depth-first order, honoring the sequencing in each 'depends_on' list.
[ "Sets", "builder", "configuration", "and", "returns", "all", "the", "builder", "steps", "necessary", "to", "build", "spec", "and", "its", "dependencies", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/utils.py#L70-L90
train
Returns all the builder steps needed to build a given spec.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
getdeps.py
vcpkg_dir
def vcpkg_dir(): """ Figure out where vcpkg is installed. vcpkg-exported is populated in some flavors of FB internal builds. C:/tools/vcpkg is the appveyor location. C:/open/vcpkg is my local location. """ for p in ["vcpkg-exported", "C:/tools/vcpkg", "C:/open/vcpkg"]: if os.path.isdir(p...
python
def vcpkg_dir(): """ Figure out where vcpkg is installed. vcpkg-exported is populated in some flavors of FB internal builds. C:/tools/vcpkg is the appveyor location. C:/open/vcpkg is my local location. """ for p in ["vcpkg-exported", "C:/tools/vcpkg", "C:/open/vcpkg"]: if os.path.isdir(p...
[ "def", "vcpkg_dir", "(", ")", ":", "for", "p", "in", "[", "\"vcpkg-exported\"", ",", "\"C:/tools/vcpkg\"", ",", "\"C:/open/vcpkg\"", "]", ":", "if", "os", ".", "path", ".", "isdir", "(", "p", ")", ":", "return", "os", ".", "path", ".", "realpath", "(",...
Figure out where vcpkg is installed. vcpkg-exported is populated in some flavors of FB internal builds. C:/tools/vcpkg is the appveyor location. C:/open/vcpkg is my local location.
[ "Figure", "out", "where", "vcpkg", "is", "installed", ".", "vcpkg", "-", "exported", "is", "populated", "in", "some", "flavors", "of", "FB", "internal", "builds", ".", "C", ":", "/", "tools", "/", "vcpkg", "is", "the", "appveyor", "location", ".", "C", ...
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/getdeps.py#L285-L294
train
Figure out where vcpkg is installed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/capabilities.py
synthesize
def synthesize(vers, opts): """ Synthesize a capability enabled version response This is a very limited emulation for relatively recent feature sets """ parsed_version = parse_version(vers["version"]) vers["capabilities"] = {} for name in opts["optional"]: vers["capabilities"][name] ...
python
def synthesize(vers, opts): """ Synthesize a capability enabled version response This is a very limited emulation for relatively recent feature sets """ parsed_version = parse_version(vers["version"]) vers["capabilities"] = {} for name in opts["optional"]: vers["capabilities"][name] ...
[ "def", "synthesize", "(", "vers", ",", "opts", ")", ":", "parsed_version", "=", "parse_version", "(", "vers", "[", "\"version\"", "]", ")", "vers", "[", "\"capabilities\"", "]", "=", "{", "}", "for", "name", "in", "opts", "[", "\"optional\"", "]", ":", ...
Synthesize a capability enabled version response This is a very limited emulation for relatively recent feature sets
[ "Synthesize", "a", "capability", "enabled", "version", "response", "This", "is", "a", "very", "limited", "emulation", "for", "relatively", "recent", "feature", "sets" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/capabilities.py#L59-L77
train
Synthesize a capability enabled version response
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/shell_quoting.py
shell_quote
def shell_quote(s): 'Quotes a string if it is not already quoted' return s if isinstance(s, ShellQuoted) \ else ShellQuoted("'" + str(s).replace("'", "'\\''") + "'")
python
def shell_quote(s): 'Quotes a string if it is not already quoted' return s if isinstance(s, ShellQuoted) \ else ShellQuoted("'" + str(s).replace("'", "'\\''") + "'")
[ "def", "shell_quote", "(", "s", ")", ":", "return", "s", "if", "isinstance", "(", "s", ",", "ShellQuoted", ")", "else", "ShellQuoted", "(", "\"'\"", "+", "str", "(", "s", ")", ".", "replace", "(", "\"'\"", ",", "\"'\\\\''\"", ")", "+", "\"'\"", ")" ]
Quotes a string if it is not already quoted
[ "Quotes", "a", "string", "if", "it", "is", "not", "already", "quoted" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L69-L72
train
Quotes a string if it is not already quoted
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/shell_quoting.py
raw_shell
def raw_shell(s): 'Not a member of ShellQuoted so we get a useful error for raw strings' if isinstance(s, ShellQuoted): return s.do_not_use_raw_str raise RuntimeError('{0} should have been ShellQuoted'.format(s))
python
def raw_shell(s): 'Not a member of ShellQuoted so we get a useful error for raw strings' if isinstance(s, ShellQuoted): return s.do_not_use_raw_str raise RuntimeError('{0} should have been ShellQuoted'.format(s))
[ "def", "raw_shell", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "ShellQuoted", ")", ":", "return", "s", ".", "do_not_use_raw_str", "raise", "RuntimeError", "(", "'{0} should have been ShellQuoted'", ".", "format", "(", "s", ")", ")" ]
Not a member of ShellQuoted so we get a useful error for raw strings
[ "Not", "a", "member", "of", "ShellQuoted", "so", "we", "get", "a", "useful", "error", "for", "raw", "strings" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L75-L79
train
Not a member of ShellQuoted so we get a useful error for raw strings
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/shell_quoting.py
shell_join
def shell_join(delim, it): 'Joins an iterable of ShellQuoted with a delimiter between each two' return ShellQuoted(delim.join(raw_shell(s) for s in it))
python
def shell_join(delim, it): 'Joins an iterable of ShellQuoted with a delimiter between each two' return ShellQuoted(delim.join(raw_shell(s) for s in it))
[ "def", "shell_join", "(", "delim", ",", "it", ")", ":", "return", "ShellQuoted", "(", "delim", ".", "join", "(", "raw_shell", "(", "s", ")", "for", "s", "in", "it", ")", ")" ]
Joins an iterable of ShellQuoted with a delimiter between each two
[ "Joins", "an", "iterable", "of", "ShellQuoted", "with", "a", "delimiter", "between", "each", "two" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L82-L84
train
Joins an iterable of ShellQuoted with a delimiter between each two
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/shell_quoting.py
path_join
def path_join(*args): 'Joins ShellQuoted and raw pieces of paths to make a shell-quoted path' return ShellQuoted(os.path.join(*[ raw_shell(shell_quote(s)) for s in args ]))
python
def path_join(*args): 'Joins ShellQuoted and raw pieces of paths to make a shell-quoted path' return ShellQuoted(os.path.join(*[ raw_shell(shell_quote(s)) for s in args ]))
[ "def", "path_join", "(", "*", "args", ")", ":", "return", "ShellQuoted", "(", "os", ".", "path", ".", "join", "(", "*", "[", "raw_shell", "(", "shell_quote", "(", "s", ")", ")", "for", "s", "in", "args", "]", ")", ")" ]
Joins ShellQuoted and raw pieces of paths to make a shell-quoted path
[ "Joins", "ShellQuoted", "and", "raw", "pieces", "of", "paths", "to", "make", "a", "shell", "-", "quoted", "path" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L87-L91
train
Joins ShellQuoted and raw pieces of paths to make a shell - quoted path
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/shell_quoting.py
shell_comment
def shell_comment(c): 'Do not shell-escape raw strings in comments, but do handle line breaks.' return ShellQuoted('# {c}').format(c=ShellQuoted( (raw_shell(c) if isinstance(c, ShellQuoted) else c) .replace('\n', '\n# ') ))
python
def shell_comment(c): 'Do not shell-escape raw strings in comments, but do handle line breaks.' return ShellQuoted('# {c}').format(c=ShellQuoted( (raw_shell(c) if isinstance(c, ShellQuoted) else c) .replace('\n', '\n# ') ))
[ "def", "shell_comment", "(", "c", ")", ":", "return", "ShellQuoted", "(", "'# {c}'", ")", ".", "format", "(", "c", "=", "ShellQuoted", "(", "(", "raw_shell", "(", "c", ")", "if", "isinstance", "(", "c", ",", "ShellQuoted", ")", "else", "c", ")", ".",...
Do not shell-escape raw strings in comments, but do handle line breaks.
[ "Do", "not", "shell", "-", "escape", "raw", "strings", "in", "comments", "but", "do", "handle", "line", "breaks", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L94-L99
train
Do not shell - escape raw strings in comments but do handle line breaks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
winbuild/copy-dyn-deps.py
State.resolve_dep
def resolve_dep(self, depname): """ Locate dep in the search path; if found, return its path. If not found in the search path, and the dep is not a system-provided dep, raise an error """ for d in self._search_path: name = os.path.join(d, depname) if self._mock: ...
python
def resolve_dep(self, depname): """ Locate dep in the search path; if found, return its path. If not found in the search path, and the dep is not a system-provided dep, raise an error """ for d in self._search_path: name = os.path.join(d, depname) if self._mock: ...
[ "def", "resolve_dep", "(", "self", ",", "depname", ")", ":", "for", "d", "in", "self", ".", "_search_path", ":", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "depname", ")", "if", "self", ".", "_mock", ":", "return", "name", "if", ...
Locate dep in the search path; if found, return its path. If not found in the search path, and the dep is not a system-provided dep, raise an error
[ "Locate", "dep", "in", "the", "search", "path", ";", "if", "found", "return", "its", "path", ".", "If", "not", "found", "in", "the", "search", "path", "and", "the", "dep", "is", "not", "a", "system", "-", "provided", "dep", "raise", "an", "error" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/winbuild/copy-dyn-deps.py#L147-L166
train
Locate a dep in the search path and return its path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
winbuild/copy-dyn-deps.py
State.resolve_dep_from_path
def resolve_dep_from_path(self, depname): """ If we can find the dep in the PATH, then we consider it to be a system dependency that we should not bundle in the package """ if is_system_dep(depname): return True for d in self._path: name = os.path.join(d, depname...
python
def resolve_dep_from_path(self, depname): """ If we can find the dep in the PATH, then we consider it to be a system dependency that we should not bundle in the package """ if is_system_dep(depname): return True for d in self._path: name = os.path.join(d, depname...
[ "def", "resolve_dep_from_path", "(", "self", ",", "depname", ")", ":", "if", "is_system_dep", "(", "depname", ")", ":", "return", "True", "for", "d", "in", "self", ".", "_path", ":", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "depnam...
If we can find the dep in the PATH, then we consider it to be a system dependency that we should not bundle in the package
[ "If", "we", "can", "find", "the", "dep", "in", "the", "PATH", "then", "we", "consider", "it", "to", "be", "a", "system", "dependency", "that", "we", "should", "not", "bundle", "in", "the", "package" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/winbuild/copy-dyn-deps.py#L168-L179
train
Resolve a dependency from the path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AsyncBserCodec._loads
def _loads(self, response): """ Parse the BSER packet """ return bser.loads( response, True, value_encoding=encoding.get_local_encoding(), value_errors=encoding.default_local_errors, )
python
def _loads(self, response): """ Parse the BSER packet """ return bser.loads( response, True, value_encoding=encoding.get_local_encoding(), value_errors=encoding.default_local_errors, )
[ "def", "_loads", "(", "self", ",", "response", ")", ":", "return", "bser", ".", "loads", "(", "response", ",", "True", ",", "value_encoding", "=", "encoding", ".", "get_local_encoding", "(", ")", ",", "value_errors", "=", "encoding", ".", "default_local_erro...
Parse the BSER packet
[ "Parse", "the", "BSER", "packet" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L191-L198
train
Parse the response from the BSER packet and return the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.receive_bilateral_response
async def receive_bilateral_response(self): """Receive the response to a request made to the Watchman service.""" self._check_receive_loop() resp = await self.bilateral_response_queue.get() self._check_error(resp) return resp
python
async def receive_bilateral_response(self): """Receive the response to a request made to the Watchman service.""" self._check_receive_loop() resp = await self.bilateral_response_queue.get() self._check_error(resp) return resp
[ "async", "def", "receive_bilateral_response", "(", "self", ")", ":", "self", ".", "_check_receive_loop", "(", ")", "resp", "=", "await", "self", ".", "bilateral_response_queue", ".", "get", "(", ")", "self", ".", "_check_error", "(", "resp", ")", "return", "...
Receive the response to a request made to the Watchman service.
[ "Receive", "the", "response", "to", "a", "request", "made", "to", "the", "Watchman", "service", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L240-L246
train
Receive the response from the bilateral service.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.query
async def query(self, *args): """Send a query to the Watchman service and return the response.""" self._check_receive_loop() try: await self.connection.send(args) return await self.receive_bilateral_response() except CommandError as ex: ex.setCommand(...
python
async def query(self, *args): """Send a query to the Watchman service and return the response.""" self._check_receive_loop() try: await self.connection.send(args) return await self.receive_bilateral_response() except CommandError as ex: ex.setCommand(...
[ "async", "def", "query", "(", "self", ",", "*", "args", ")", ":", "self", ".", "_check_receive_loop", "(", ")", "try", ":", "await", "self", ".", "connection", ".", "send", "(", "args", ")", "return", "await", "self", ".", "receive_bilateral_response", "...
Send a query to the Watchman service and return the response.
[ "Send", "a", "query", "to", "the", "Watchman", "service", "and", "return", "the", "response", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L248-L257
train
Send a query to the Watchman service and return the response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.capability_check
async def capability_check(self, optional=None, required=None): """Perform a server capability check.""" self._check_receive_loop() # If the returned response is an error, self.query will raise an error await self.query( "version", {"optional": optional or [], "required": re...
python
async def capability_check(self, optional=None, required=None): """Perform a server capability check.""" self._check_receive_loop() # If the returned response is an error, self.query will raise an error await self.query( "version", {"optional": optional or [], "required": re...
[ "async", "def", "capability_check", "(", "self", ",", "optional", "=", "None", ",", "required", "=", "None", ")", ":", "self", ".", "_check_receive_loop", "(", ")", "# If the returned response is an error, self.query will raise an error", "await", "self", ".", "query"...
Perform a server capability check.
[ "Perform", "a", "server", "capability", "check", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L259-L266
train
Perform a server capability check.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.get_subscription
async def get_subscription(self, name, root): """ Retrieve the data associated with a named subscription Returns None if there is no data associated with `name` If root is not None, then only return the subscription data that matches both root and name. When used in this way, ...
python
async def get_subscription(self, name, root): """ Retrieve the data associated with a named subscription Returns None if there is no data associated with `name` If root is not None, then only return the subscription data that matches both root and name. When used in this way, ...
[ "async", "def", "get_subscription", "(", "self", ",", "name", ",", "root", ")", ":", "self", ".", "_check_receive_loop", "(", ")", "self", ".", "_ensure_subscription_queue_exists", "(", "name", ",", "root", ")", "res", "=", "await", "self", ".", "sub_by_root...
Retrieve the data associated with a named subscription Returns None if there is no data associated with `name` If root is not None, then only return the subscription data that matches both root and name. When used in this way, remove processing impacts both the unscoped and scoped sto...
[ "Retrieve", "the", "data", "associated", "with", "a", "named", "subscription" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L268-L282
train
Get the data associated with a named subscription.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.pop_log
async def pop_log(self): """Get one log from the log queue.""" self._check_receive_loop() res = self.log_queue.get() self._check_error(res) return res
python
async def pop_log(self): """Get one log from the log queue.""" self._check_receive_loop() res = self.log_queue.get() self._check_error(res) return res
[ "async", "def", "pop_log", "(", "self", ")", ":", "self", ".", "_check_receive_loop", "(", ")", "res", "=", "self", ".", "log_queue", ".", "get", "(", ")", "self", ".", "_check_error", "(", "res", ")", "return", "res" ]
Get one log from the log queue.
[ "Get", "one", "log", "from", "the", "log", "queue", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L284-L289
train
Get one log from the log queue.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.close
def close(self): """Close the underlying connection.""" self._closed = True if self.receive_task: self.receive_task.cancel() if self.connection: self.connection.close()
python
def close(self): """Close the underlying connection.""" self._closed = True if self.receive_task: self.receive_task.cancel() if self.connection: self.connection.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "_closed", "=", "True", "if", "self", ".", "receive_task", ":", "self", ".", "receive_task", ".", "cancel", "(", ")", "if", "self", ".", "connection", ":", "self", ".", "connection", ".", "close", "...
Close the underlying connection.
[ "Close", "the", "underlying", "connection", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L291-L297
train
Close the underlying connection.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.enable_receiving
def enable_receiving(self, loop=None): """Schedules the receive loop to run on the given loop.""" self.receive_task = asyncio.ensure_future(self._receive_loop(), loop=loop) def do_if_done(fut): try: fut.result() except asyncio.CancelledError: ...
python
def enable_receiving(self, loop=None): """Schedules the receive loop to run on the given loop.""" self.receive_task = asyncio.ensure_future(self._receive_loop(), loop=loop) def do_if_done(fut): try: fut.result() except asyncio.CancelledError: ...
[ "def", "enable_receiving", "(", "self", ",", "loop", "=", "None", ")", ":", "self", ".", "receive_task", "=", "asyncio", ".", "ensure_future", "(", "self", ".", "_receive_loop", "(", ")", ",", "loop", "=", "loop", ")", "def", "do_if_done", "(", "fut", ...
Schedules the receive loop to run on the given loop.
[ "Schedules", "the", "receive", "loop", "to", "run", "on", "the", "given", "loop", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L299-L312
train
Schedules the receive loop to run on the given loop.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient.from_socket
async def from_socket(cls, sockname: typing.Optional[str] = None) -> "AIOClient": """Create a new AIOClient using Unix transport and BSER Codec connecting to the specified socket. If the specified socket is None, then resolve the socket path automatically. This method also schedules the...
python
async def from_socket(cls, sockname: typing.Optional[str] = None) -> "AIOClient": """Create a new AIOClient using Unix transport and BSER Codec connecting to the specified socket. If the specified socket is None, then resolve the socket path automatically. This method also schedules the...
[ "async", "def", "from_socket", "(", "cls", ",", "sockname", ":", "typing", ".", "Optional", "[", "str", "]", "=", "None", ")", "->", "\"AIOClient\"", ":", "if", "not", "sockname", ":", "sockname", "=", "await", "_resolve_sockname", "(", ")", "transport", ...
Create a new AIOClient using Unix transport and BSER Codec connecting to the specified socket. If the specified socket is None, then resolve the socket path automatically. This method also schedules the receive loop to run on the event loop. This method is a coroutine.
[ "Create", "a", "new", "AIOClient", "using", "Unix", "transport", "and", "BSER", "Codec", "connecting", "to", "the", "specified", "socket", ".", "If", "the", "specified", "socket", "is", "None", "then", "resolve", "the", "socket", "path", "automatically", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L315-L330
train
Create an AIOClient from a Unix socket.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman_aio/__init__.py
AIOClient._receive_loop
async def _receive_loop(self): """Receive the response to a request made to the Watchman service. Note that when trying to receive a PDU from the Watchman service, we might get a unilateral response to a subscription or log, so these are processed and queued up for later retrieval. This...
python
async def _receive_loop(self): """Receive the response to a request made to the Watchman service. Note that when trying to receive a PDU from the Watchman service, we might get a unilateral response to a subscription or log, so these are processed and queued up for later retrieval. This...
[ "async", "def", "_receive_loop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "response", "=", "await", "self", ".", "connection", ".", "receive", "(", ")", "if", "self", ".", "_is_unilateral", "(", "response", ")", ":", "await", "self", "....
Receive the response to a request made to the Watchman service. Note that when trying to receive a PDU from the Watchman service, we might get a unilateral response to a subscription or log, so these are processed and queued up for later retrieval. This function only returns when a non-...
[ "Receive", "the", "response", "to", "a", "request", "made", "to", "the", "Watchman", "service", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman_aio/__init__.py#L332-L351
train
Receive the response from the Watchman service.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
_win32_strerror
def _win32_strerror(err): """ expand a win32 error code into a human readable message """ # FormatMessage will allocate memory and assign it here buf = ctypes.c_char_p() FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, ...
python
def _win32_strerror(err): """ expand a win32 error code into a human readable message """ # FormatMessage will allocate memory and assign it here buf = ctypes.c_char_p() FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, ...
[ "def", "_win32_strerror", "(", "err", ")", ":", "# FormatMessage will allocate memory and assign it here", "buf", "=", "ctypes", ".", "c_char_p", "(", ")", "FormatMessage", "(", "FORMAT_MESSAGE_FROM_SYSTEM", "|", "FORMAT_MESSAGE_ALLOCATE_BUFFER", "|", "FORMAT_MESSAGE_IGNORE_I...
expand a win32 error code into a human readable message
[ "expand", "a", "win32", "error", "code", "into", "a", "human", "readable", "message" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L211-L230
train
expand a win32 error code into a human readable message
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
_get_overlapped_result_ex_impl
def _get_overlapped_result_ex_impl(pipe, olap, nbytes, millis, alertable): """ Windows 7 and earlier does not support GetOverlappedResultEx. The alternative is to use GetOverlappedResult and wait for read or write operation to complete. This is done be using CreateEvent and WaitForSingleObjectEx. Create...
python
def _get_overlapped_result_ex_impl(pipe, olap, nbytes, millis, alertable): """ Windows 7 and earlier does not support GetOverlappedResultEx. The alternative is to use GetOverlappedResult and wait for read or write operation to complete. This is done be using CreateEvent and WaitForSingleObjectEx. Create...
[ "def", "_get_overlapped_result_ex_impl", "(", "pipe", ",", "olap", ",", "nbytes", ",", "millis", ",", "alertable", ")", ":", "log", "(", "\"Preparing to wait for maximum %dms\"", ",", "millis", ")", "if", "millis", "!=", "0", ":", "waitReturnCode", "=", "WaitFor...
Windows 7 and earlier does not support GetOverlappedResultEx. The alternative is to use GetOverlappedResult and wait for read or write operation to complete. This is done be using CreateEvent and WaitForSingleObjectEx. CreateEvent, WaitForSingleObjectEx and GetOverlappedResult are all part of Windows AP...
[ "Windows", "7", "and", "earlier", "does", "not", "support", "GetOverlappedResultEx", ".", "The", "alternative", "is", "to", "use", "GetOverlappedResult", "and", "wait", "for", "read", "or", "write", "operation", "to", "complete", ".", "This", "is", "done", "be...
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L397-L434
train
Get the result of an overlapped IO operation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
Transport.readLine
def readLine(self): """ read a line Maintains its own buffer, callers of the transport should not mix calls to readBytes and readLine. """ if self.buf is None: self.buf = [] # Buffer may already have a line if we've received unilateral # response(s) f...
python
def readLine(self): """ read a line Maintains its own buffer, callers of the transport should not mix calls to readBytes and readLine. """ if self.buf is None: self.buf = [] # Buffer may already have a line if we've received unilateral # response(s) f...
[ "def", "readLine", "(", "self", ")", ":", "if", "self", ".", "buf", "is", "None", ":", "self", ".", "buf", "=", "[", "]", "# Buffer may already have a line if we've received unilateral", "# response(s) from the server", "if", "len", "(", "self", ".", "buf", ")",...
read a line Maintains its own buffer, callers of the transport should not mix calls to readBytes and readLine.
[ "read", "a", "line", "Maintains", "its", "own", "buffer", "callers", "of", "the", "transport", "should", "not", "mix", "calls", "to", "readBytes", "and", "readLine", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L311-L333
train
read a line from the transport
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
WindowsNamedPipeTransport.readBytes
def readBytes(self, size): """ A read can block for an unbounded amount of time, even if the kernel reports that the pipe handle is signalled, so we need to always perform our reads asynchronously """ # try to satisfy the read from any buffered data if self._iobu...
python
def readBytes(self, size): """ A read can block for an unbounded amount of time, even if the kernel reports that the pipe handle is signalled, so we need to always perform our reads asynchronously """ # try to satisfy the read from any buffered data if self._iobu...
[ "def", "readBytes", "(", "self", ",", "size", ")", ":", "# try to satisfy the read from any buffered data", "if", "self", ".", "_iobuf", ":", "if", "size", ">=", "len", "(", "self", ".", "_iobuf", ")", ":", "res", "=", "self", ".", "_iobuf", "self", ".", ...
A read can block for an unbounded amount of time, even if the kernel reports that the pipe handle is signalled, so we need to always perform our reads asynchronously
[ "A", "read", "can", "block", "for", "an", "unbounded", "amount", "of", "time", "even", "if", "the", "kernel", "reports", "that", "the", "pipe", "handle", "is", "signalled", "so", "we", "need", "to", "always", "perform", "our", "reads", "asynchronously" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L496-L562
train
Read a byte from the pipe and return it as a string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client._connect
def _connect(self): """ establish transport connection """ if self.recvConn: if self.pid != os.getpid(): raise UseAfterFork( "do not re-use a connection after fork; open a new client instead" ) return if self.sockpath ...
python
def _connect(self): """ establish transport connection """ if self.recvConn: if self.pid != os.getpid(): raise UseAfterFork( "do not re-use a connection after fork; open a new client instead" ) return if self.sockpath ...
[ "def", "_connect", "(", "self", ")", ":", "if", "self", ".", "recvConn", ":", "if", "self", ".", "pid", "!=", "os", ".", "getpid", "(", ")", ":", "raise", "UseAfterFork", "(", "\"do not re-use a connection after fork; open a new client instead\"", ")", "return",...
establish transport connection
[ "establish", "transport", "connection" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L980-L1000
train
establish transport connection
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client.receive
def receive(self): """ receive the next PDU from the watchman service If the client has activated subscriptions or logs then this PDU may be a unilateral PDU sent by the service to inform the client of a log event or subscription change. It may also simply be the response porti...
python
def receive(self): """ receive the next PDU from the watchman service If the client has activated subscriptions or logs then this PDU may be a unilateral PDU sent by the service to inform the client of a log event or subscription change. It may also simply be the response porti...
[ "def", "receive", "(", "self", ")", ":", "self", ".", "_connect", "(", ")", "result", "=", "self", ".", "recvConn", ".", "receive", "(", ")", "if", "self", ".", "_hasprop", "(", "result", ",", "\"error\"", ")", ":", "raise", "CommandError", "(", "res...
receive the next PDU from the watchman service If the client has activated subscriptions or logs then this PDU may be a unilateral PDU sent by the service to inform the client of a log event or subscription change. It may also simply be the response portion of a request initiat...
[ "receive", "the", "next", "PDU", "from", "the", "watchman", "service" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L1019-L1056
train
receive the next PDU from the watchman service
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client.getLog
def getLog(self, remove=True): """ Retrieve buffered log data If remove is true the data will be removed from the buffer. Otherwise it will be left in the buffer """ res = self.logs if remove: self.logs = [] return res
python
def getLog(self, remove=True): """ Retrieve buffered log data If remove is true the data will be removed from the buffer. Otherwise it will be left in the buffer """ res = self.logs if remove: self.logs = [] return res
[ "def", "getLog", "(", "self", ",", "remove", "=", "True", ")", ":", "res", "=", "self", ".", "logs", "if", "remove", ":", "self", ".", "logs", "=", "[", "]", "return", "res" ]
Retrieve buffered log data If remove is true the data will be removed from the buffer. Otherwise it will be left in the buffer
[ "Retrieve", "buffered", "log", "data" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L1067-L1076
train
Retrieve buffered log data
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client.getSubscription
def getSubscription(self, name, remove=True, root=None): """ Retrieve the data associated with a named subscription If remove is True (the default), the subscription data is removed from the buffer. Otherwise the data is returned but left in the buffer. Returns None if there i...
python
def getSubscription(self, name, remove=True, root=None): """ Retrieve the data associated with a named subscription If remove is True (the default), the subscription data is removed from the buffer. Otherwise the data is returned but left in the buffer. Returns None if there i...
[ "def", "getSubscription", "(", "self", ",", "name", ",", "remove", "=", "True", ",", "root", "=", "None", ")", ":", "if", "root", "is", "not", "None", ":", "root", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "normcase", ...
Retrieve the data associated with a named subscription If remove is True (the default), the subscription data is removed from the buffer. Otherwise the data is returned but left in the buffer. Returns None if there is no data associated with `name` If root is not None, then o...
[ "Retrieve", "the", "data", "associated", "with", "a", "named", "subscription" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L1078-L1111
train
Retrieve the data associated with a named subscription.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client.query
def query(self, *args): """ Send a query to the watchman service and return the response This call will block until the response is returned. If any unilateral responses are sent by the service in between the request-response they will be buffered up in the client object and NOT...
python
def query(self, *args): """ Send a query to the watchman service and return the response This call will block until the response is returned. If any unilateral responses are sent by the service in between the request-response they will be buffered up in the client object and NOT...
[ "def", "query", "(", "self", ",", "*", "args", ")", ":", "log", "(", "\"calling client.query\"", ")", "self", ".", "_connect", "(", ")", "try", ":", "self", ".", "sendConn", ".", "send", "(", "args", ")", "res", "=", "self", ".", "receive", "(", ")...
Send a query to the watchman service and return the response This call will block until the response is returned. If any unilateral responses are sent by the service in between the request-response they will be buffered up in the client object and NOT returned via this method.
[ "Send", "a", "query", "to", "the", "watchman", "service", "and", "return", "the", "response" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L1113-L1143
train
Send a query to the watchman service and return the response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/__init__.py
client.capabilityCheck
def capabilityCheck(self, optional=None, required=None): """ Perform a server capability check """ res = self.query( "version", {"optional": optional or [], "required": required or []} ) if not self._hasprop(res, "capabilities"): # Server doesn't support capabili...
python
def capabilityCheck(self, optional=None, required=None): """ Perform a server capability check """ res = self.query( "version", {"optional": optional or [], "required": required or []} ) if not self._hasprop(res, "capabilities"): # Server doesn't support capabili...
[ "def", "capabilityCheck", "(", "self", ",", "optional", "=", "None", ",", "required", "=", "None", ")", ":", "res", "=", "self", ".", "query", "(", "\"version\"", ",", "{", "\"optional\"", ":", "optional", "or", "[", "]", ",", "\"required\"", ":", "req...
Perform a server capability check
[ "Perform", "a", "server", "capability", "check" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/__init__.py#L1145-L1158
train
Perform a server capability check
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/load.py
_read_bytes
def _read_bytes(fp, buf): """Read bytes from a file-like object @param fp: File-like object that implements read(int) @type fp: file @param buf: Buffer to read into @type buf: bytes @return: buf """ # Do the first read without resizing the input buffer offset = 0 remaining = ...
python
def _read_bytes(fp, buf): """Read bytes from a file-like object @param fp: File-like object that implements read(int) @type fp: file @param buf: Buffer to read into @type buf: bytes @return: buf """ # Do the first read without resizing the input buffer offset = 0 remaining = ...
[ "def", "_read_bytes", "(", "fp", ",", "buf", ")", ":", "# Do the first read without resizing the input buffer", "offset", "=", "0", "remaining", "=", "len", "(", "buf", ")", "while", "remaining", ">", "0", ":", "l", "=", "fp", ".", "readinto", "(", "(", "c...
Read bytes from a file-like object @param fp: File-like object that implements read(int) @type fp: file @param buf: Buffer to read into @type buf: bytes @return: buf
[ "Read", "bytes", "from", "a", "file", "-", "like", "object" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/load.py#L44-L65
train
Read bytes from a file - like object that implements read
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
python/pywatchman/load.py
load
def load(fp, mutable=True, value_encoding=None, value_errors=None): """Deserialize a BSER-encoded blob. @param fp: The file-object to deserialize. @type file: @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode values. ...
python
def load(fp, mutable=True, value_encoding=None, value_errors=None): """Deserialize a BSER-encoded blob. @param fp: The file-object to deserialize. @type file: @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode values. ...
[ "def", "load", "(", "fp", ",", "mutable", "=", "True", ",", "value_encoding", "=", "None", ",", "value_errors", "=", "None", ")", ":", "buf", "=", "ctypes", ".", "create_string_buffer", "(", "8192", ")", "SNIFF_BUFFER_SIZE", "=", "len", "(", "EMPTY_HEADER"...
Deserialize a BSER-encoded blob. @param fp: The file-object to deserialize. @type file: @param mutable: Whether to return mutable results. @type mutable: bool @param value_encoding: Optional codec to use to decode values. If unspecified or None, return values as bytestr...
[ "Deserialize", "a", "BSER", "-", "encoded", "blob", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/python/pywatchman/load.py#L68-L107
train
Deserialize a BSER - encoded blob into a tuple of base64 - encoded bytestrings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/make_docker_context.py
make_docker_context
def make_docker_context( get_steps_fn, github_project, opts=None, default_context_dir=None ): ''' Returns a path to the Docker context directory. See parse_args.py. Helper for making a command-line utility that writes your project's Dockerfile and associated data into a (temporary) directory. Your...
python
def make_docker_context( get_steps_fn, github_project, opts=None, default_context_dir=None ): ''' Returns a path to the Docker context directory. See parse_args.py. Helper for making a command-line utility that writes your project's Dockerfile and associated data into a (temporary) directory. Your...
[ "def", "make_docker_context", "(", "get_steps_fn", ",", "github_project", ",", "opts", "=", "None", ",", "default_context_dir", "=", "None", ")", ":", "if", "opts", "is", "None", ":", "opts", "=", "{", "}", "valid_versions", "=", "(", "(", "'ubuntu:16.04'", ...
Returns a path to the Docker context directory. See parse_args.py. Helper for making a command-line utility that writes your project's Dockerfile and associated data into a (temporary) directory. Your main program might look something like this: print(make_docker_context( lambda build...
[ "Returns", "a", "path", "to", "the", "Docker", "context", "directory", ".", "See", "parse_args", ".", "py", "." ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/make_docker_context.py#L27-L164
train
Create a Docker context directory for the given project.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/fbcode_builder.py
FBCodeBuilder.diagnostics
def diagnostics(self): 'Log some system diagnostics before/after setup for ease of debugging' # The builder's repr is not used in a command to avoid pointlessly # invalidating Docker's build cache. return self.step('Diagnostics', [ self.comment('Builder {0}'.format(repr(self)...
python
def diagnostics(self): 'Log some system diagnostics before/after setup for ease of debugging' # The builder's repr is not used in a command to avoid pointlessly # invalidating Docker's build cache. return self.step('Diagnostics', [ self.comment('Builder {0}'.format(repr(self)...
[ "def", "diagnostics", "(", "self", ")", ":", "# The builder's repr is not used in a command to avoid pointlessly", "# invalidating Docker's build cache.", "return", "self", ".", "step", "(", "'Diagnostics'", ",", "[", "self", ".", "comment", "(", "'Builder {0}'", ".", "fo...
Log some system diagnostics before/after setup for ease of debugging
[ "Log", "some", "system", "diagnostics", "before", "/", "after", "setup", "for", "ease", "of", "debugging" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/fbcode_builder.py#L151-L161
train
Log some system diagnostics before / after setup for ease of debugging
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
facebook/watchman
build/fbcode_builder/fbcode_builder.py
FBCodeBuilder.fb_github_project_workdir
def fb_github_project_workdir(self, project_and_path, github_org='facebook'): 'This helper lets Facebook-internal CI special-cases FB projects' project, path = project_and_path.split('/', 1) return self.github_project_workdir(github_org + '/' + project, path)
python
def fb_github_project_workdir(self, project_and_path, github_org='facebook'): 'This helper lets Facebook-internal CI special-cases FB projects' project, path = project_and_path.split('/', 1) return self.github_project_workdir(github_org + '/' + project, path)
[ "def", "fb_github_project_workdir", "(", "self", ",", "project_and_path", ",", "github_org", "=", "'facebook'", ")", ":", "project", ",", "path", "=", "project_and_path", ".", "split", "(", "'/'", ",", "1", ")", "return", "self", ".", "github_project_workdir", ...
This helper lets Facebook-internal CI special-cases FB projects
[ "This", "helper", "lets", "Facebook", "-", "internal", "CI", "special", "-", "cases", "FB", "projects" ]
d416c249dd8f463dc69fc2691d0f890598c045a9
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/fbcode_builder.py#L293-L296
train
This helper lets Facebook - internal CI special - cases FB projects
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
HIPS/autograd
examples/gaussian_process.py
make_gp_funs
def make_gp_funs(cov_func, num_cov_params): """Functions that perform Gaussian process regression. cov_func has signature (cov_params, x, x')""" def unpack_kernel_params(params): mean = params[0] cov_params = params[2:] noise_scale = np.exp(params[1]) + 0.0001 ret...
python
def make_gp_funs(cov_func, num_cov_params): """Functions that perform Gaussian process regression. cov_func has signature (cov_params, x, x')""" def unpack_kernel_params(params): mean = params[0] cov_params = params[2:] noise_scale = np.exp(params[1]) + 0.0001 ret...
[ "def", "make_gp_funs", "(", "cov_func", ",", "num_cov_params", ")", ":", "def", "unpack_kernel_params", "(", "params", ")", ":", "mean", "=", "params", "[", "0", "]", "cov_params", "=", "params", "[", "2", ":", "]", "noise_scale", "=", "np", ".", "exp", ...
Functions that perform Gaussian process regression. cov_func has signature (cov_params, x, x')
[ "Functions", "that", "perform", "Gaussian", "process", "regression", ".", "cov_func", "has", "signature", "(", "cov_params", "x", "x", ")" ]
e3b525302529d7490769d5c0bcfc7457e24e3b3e
https://github.com/HIPS/autograd/blob/e3b525302529d7490769d5c0bcfc7457e24e3b3e/examples/gaussian_process.py#L13-L40
train
Returns a list of functions that perform Gaussian process regression.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
HIPS/autograd
autograd/core.py
def_linear
def def_linear(fun): """Flags that a function is linear wrt all args""" defjvp_argnum(fun, lambda argnum, g, ans, args, kwargs: fun(*subval(args, argnum, g), **kwargs))
python
def def_linear(fun): """Flags that a function is linear wrt all args""" defjvp_argnum(fun, lambda argnum, g, ans, args, kwargs: fun(*subval(args, argnum, g), **kwargs))
[ "def", "def_linear", "(", "fun", ")", ":", "defjvp_argnum", "(", "fun", ",", "lambda", "argnum", ",", "g", ",", "ans", ",", "args", ",", "kwargs", ":", "fun", "(", "*", "subval", "(", "args", ",", "argnum", ",", "g", ")", ",", "*", "*", "kwargs",...
Flags that a function is linear wrt all args
[ "Flags", "that", "a", "function", "is", "linear", "wrt", "all", "args" ]
e3b525302529d7490769d5c0bcfc7457e24e3b3e
https://github.com/HIPS/autograd/blob/e3b525302529d7490769d5c0bcfc7457e24e3b3e/autograd/core.py#L151-L154
train
Flags that a function is linear wrt all args
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...