repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
PmagPy/PmagPy
dialogs/grid_frame3.py
GridBuilder.save_grid_data
def save_grid_data(self): """ Save grid data in the data object """ if not self.grid.changes: print('-I- No changes to save') return starred_cols = self.grid.remove_starred_labels() # locks in value in cell currently edited self.grid.SaveE...
python
def save_grid_data(self): """ Save grid data in the data object """ if not self.grid.changes: print('-I- No changes to save') return starred_cols = self.grid.remove_starred_labels() # locks in value in cell currently edited self.grid.SaveE...
[ "def", "save_grid_data", "(", "self", ")", ":", "if", "not", "self", ".", "grid", ".", "changes", ":", "print", "(", "'-I- No changes to save'", ")", "return", "starred_cols", "=", "self", ".", "grid", ".", "remove_starred_labels", "(", ")", "# locks in value ...
Save grid data in the data object
[ "Save", "grid", "data", "in", "the", "data", "object" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame3.py#L1094-L1138
PmagPy/PmagPy
dialogs/grid_frame3.py
GridBuilder.fill_defaults
def fill_defaults(self): """ Fill in self.grid with default values in certain columns. Only fill in new values if grid is missing those values. """ defaults = {'result_quality': 'g', 'result_type': 'i', 'orientation_quality': 'g', ...
python
def fill_defaults(self): """ Fill in self.grid with default values in certain columns. Only fill in new values if grid is missing those values. """ defaults = {'result_quality': 'g', 'result_type': 'i', 'orientation_quality': 'g', ...
[ "def", "fill_defaults", "(", "self", ")", ":", "defaults", "=", "{", "'result_quality'", ":", "'g'", ",", "'result_type'", ":", "'i'", ",", "'orientation_quality'", ":", "'g'", ",", "'citations'", ":", "'This study'", "}", "for", "col_name", "in", "defaults", ...
Fill in self.grid with default values in certain columns. Only fill in new values if grid is missing those values.
[ "Fill", "in", "self", ".", "grid", "with", "default", "values", "in", "certain", "columns", ".", "Only", "fill", "in", "new", "values", "if", "grid", "is", "missing", "those", "values", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame3.py#L1140-L1177
PmagPy/PmagPy
dialogs/grid_frame3.py
GridBuilder.get_result_children
def get_result_children(self, result_data): """ takes in dict in form of {'er_specimen_names': 'name1:name2:name3'} and so forth. returns lists of specimens, samples, sites, and locations """ specimens, samples, sites, locations = "", "", "", "" children = {'speci...
python
def get_result_children(self, result_data): """ takes in dict in form of {'er_specimen_names': 'name1:name2:name3'} and so forth. returns lists of specimens, samples, sites, and locations """ specimens, samples, sites, locations = "", "", "", "" children = {'speci...
[ "def", "get_result_children", "(", "self", ",", "result_data", ")", ":", "specimens", ",", "samples", ",", "sites", ",", "locations", "=", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", "children", "=", "{", "'specimen'", ":", "specimens", ",", "'sample'",...
takes in dict in form of {'er_specimen_names': 'name1:name2:name3'} and so forth. returns lists of specimens, samples, sites, and locations
[ "takes", "in", "dict", "in", "form", "of", "{", "er_specimen_names", ":", "name1", ":", "name2", ":", "name3", "}", "and", "so", "forth", ".", "returns", "lists", "of", "specimens", "samples", "sites", "and", "locations" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame3.py#L1179-L1195
PmagPy/PmagPy
programs/deprecated/specimens_results_magic.py
main
def main(): """ NAME specimens_results_magic.py DESCRIPTION combines pmag_specimens.txt file with age, location, acceptance criteria and outputs pmag_results table along with other MagIC tables necessary for uploading to the database SYNTAX specimens_results_magic.py [command line opti...
python
def main(): """ NAME specimens_results_magic.py DESCRIPTION combines pmag_specimens.txt file with age, location, acceptance criteria and outputs pmag_results table along with other MagIC tables necessary for uploading to the database SYNTAX specimens_results_magic.py [command line opti...
[ "def", "main", "(", ")", ":", "# set defaults", "Comps", "=", "[", "]", "# list of components", "version_num", "=", "pmag", ".", "get_version", "(", ")", "args", "=", "sys", ".", "argv", "DefaultAge", "=", "[", "\"none\"", "]", "skipdirs", ",", "coord", ...
NAME specimens_results_magic.py DESCRIPTION combines pmag_specimens.txt file with age, location, acceptance criteria and outputs pmag_results table along with other MagIC tables necessary for uploading to the database SYNTAX specimens_results_magic.py [command line options] OPTIONS -h...
[ "NAME", "specimens_results_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/specimens_results_magic.py#L8-L660
PmagPy/PmagPy
programs/eqarea_magic.py
main
def main(): """ NAME eqarea_magic.py DESCRIPTION makes equal area projections from declination/inclination data SYNTAX eqarea_magic.py [command line options] INPUT takes magic formatted sites, samples, specimens, or measurements OPTIONS -h prints help me...
python
def main(): """ NAME eqarea_magic.py DESCRIPTION makes equal area projections from declination/inclination data SYNTAX eqarea_magic.py [command line options] INPUT takes magic formatted sites, samples, specimens, or measurements OPTIONS -h prints help me...
[ "def", "main", "(", ")", ":", "# extract arguments from sys.argv", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "dir_path", "=", "pmag", ".", "get_named_arg", "(", "\"-WD\"", ",", ...
NAME eqarea_magic.py DESCRIPTION makes equal area projections from declination/inclination data SYNTAX eqarea_magic.py [command line options] INPUT takes magic formatted sites, samples, specimens, or measurements OPTIONS -h prints help message and quits ...
[ "NAME", "eqarea_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/eqarea_magic.py#L18-L98
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.InitUI
def InitUI(self): """ initialize window """ self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.init_grid_headers() self.grid_builder = GridBuilder(self.er_magic, self.grid_type, self.grid_headers, self.panel, self.parent_type) ...
python
def InitUI(self): """ initialize window """ self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.init_grid_headers() self.grid_builder = GridBuilder(self.er_magic, self.grid_type, self.grid_headers, self.panel, self.parent_type) ...
[ "def", "InitUI", "(", "self", ")", ":", "self", ".", "main_sizer", "=", "wx", ".", "BoxSizer", "(", "wx", ".", "VERTICAL", ")", "self", ".", "init_grid_headers", "(", ")", "self", ".", "grid_builder", "=", "GridBuilder", "(", "self", ".", "er_magic", "...
initialize window
[ "initialize", "window" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L66-L257
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.do_fit
def do_fit(self, event): """ Re-fit the window to the size of the content. """ #self.grid.ShowScrollbars(wx.SHOW_SB_NEVER, wx.SHOW_SB_NEVER) if event: event.Skip() self.main_sizer.Fit(self) disp_size = wx.GetDisplaySize() actual_size = self.Get...
python
def do_fit(self, event): """ Re-fit the window to the size of the content. """ #self.grid.ShowScrollbars(wx.SHOW_SB_NEVER, wx.SHOW_SB_NEVER) if event: event.Skip() self.main_sizer.Fit(self) disp_size = wx.GetDisplaySize() actual_size = self.Get...
[ "def", "do_fit", "(", "self", ",", "event", ")", ":", "#self.grid.ShowScrollbars(wx.SHOW_SB_NEVER, wx.SHOW_SB_NEVER)", "if", "event", ":", "event", ".", "Skip", "(", ")", "self", ".", "main_sizer", ".", "Fit", "(", "self", ")", "disp_size", "=", "wx", ".", "...
Re-fit the window to the size of the content.
[ "Re", "-", "fit", "the", "window", "to", "the", "size", "of", "the", "content", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L269-L284
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.toggle_ages
def toggle_ages(self, event): """ Switch the type of grid between site/sample (Users may add ages at either level) """ if self.grid.changes: self.onSave(None) label = event.GetEventObject().Label self.er_magic.age_type = label self.grid.Destr...
python
def toggle_ages(self, event): """ Switch the type of grid between site/sample (Users may add ages at either level) """ if self.grid.changes: self.onSave(None) label = event.GetEventObject().Label self.er_magic.age_type = label self.grid.Destr...
[ "def", "toggle_ages", "(", "self", ",", "event", ")", ":", "if", "self", ".", "grid", ".", "changes", ":", "self", ".", "onSave", "(", "None", ")", "label", "=", "event", ".", "GetEventObject", "(", ")", ".", "Label", "self", ".", "er_magic", ".", ...
Switch the type of grid between site/sample (Users may add ages at either level)
[ "Switch", "the", "type", "of", "grid", "between", "site", "/", "sample", "(", "Users", "may", "add", "ages", "at", "either", "level", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L318-L357
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.remove_col_label
def remove_col_label(self, event):#, include_pmag=True): """ check to see if column is required if it is not, delete it from grid """ er_possible_headers = self.grid_headers[self.grid_type]['er'][2] pmag_possible_headers = self.grid_headers[self.grid_type]['pmag'][2] ...
python
def remove_col_label(self, event):#, include_pmag=True): """ check to see if column is required if it is not, delete it from grid """ er_possible_headers = self.grid_headers[self.grid_type]['er'][2] pmag_possible_headers = self.grid_headers[self.grid_type]['pmag'][2] ...
[ "def", "remove_col_label", "(", "self", ",", "event", ")", ":", "#, include_pmag=True):", "er_possible_headers", "=", "self", ".", "grid_headers", "[", "self", ".", "grid_type", "]", "[", "'er'", "]", "[", "2", "]", "pmag_possible_headers", "=", "self", ".", ...
check to see if column is required if it is not, delete it from grid
[ "check", "to", "see", "if", "column", "is", "required", "if", "it", "is", "not", "delete", "it", "from", "grid" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L364-L399
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.on_add_cols
def on_add_cols(self, event): """ Show simple dialog that allows user to add a new column name """ col_labels = self.grid.col_labels # do not list headers that are already column labels in the grid er_items = [head for head in self.grid_headers[self.grid_type]['er'][2] if...
python
def on_add_cols(self, event): """ Show simple dialog that allows user to add a new column name """ col_labels = self.grid.col_labels # do not list headers that are already column labels in the grid er_items = [head for head in self.grid_headers[self.grid_type]['er'][2] if...
[ "def", "on_add_cols", "(", "self", ",", "event", ")", ":", "col_labels", "=", "self", ".", "grid", ".", "col_labels", "# do not list headers that are already column labels in the grid", "er_items", "=", "[", "head", "for", "head", "in", "self", ".", "grid_headers", ...
Show simple dialog that allows user to add a new column name
[ "Show", "simple", "dialog", "that", "allows", "user", "to", "add", "a", "new", "column", "name" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L401-L442
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.add_new_grid_headers
def add_new_grid_headers(self, new_headers, er_items, pmag_items): """ Add in all user-added headers. If those new headers depend on other headers, add the other headers too. """ def add_pmag_reqd_headers(): if self.grid_type == 'result': return [] ...
python
def add_new_grid_headers(self, new_headers, er_items, pmag_items): """ Add in all user-added headers. If those new headers depend on other headers, add the other headers too. """ def add_pmag_reqd_headers(): if self.grid_type == 'result': return [] ...
[ "def", "add_new_grid_headers", "(", "self", ",", "new_headers", ",", "er_items", ",", "pmag_items", ")", ":", "def", "add_pmag_reqd_headers", "(", ")", ":", "if", "self", ".", "grid_type", "==", "'result'", ":", "return", "[", "]", "add_in", "=", "[", "]",...
Add in all user-added headers. If those new headers depend on other headers, add the other headers too.
[ "Add", "in", "all", "user", "-", "added", "headers", ".", "If", "those", "new", "headers", "depend", "on", "other", "headers", "add", "the", "other", "headers", "too", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L444-L493
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.on_remove_cols
def on_remove_cols(self, event): """ enter 'remove columns' mode """ # open the help message self.toggle_help(event=None, mode='open') # first unselect any selected cols/cells self.remove_cols_mode = True self.grid.ClearSelection() self.remove_cols...
python
def on_remove_cols(self, event): """ enter 'remove columns' mode """ # open the help message self.toggle_help(event=None, mode='open') # first unselect any selected cols/cells self.remove_cols_mode = True self.grid.ClearSelection() self.remove_cols...
[ "def", "on_remove_cols", "(", "self", ",", "event", ")", ":", "# open the help message", "self", ".", "toggle_help", "(", "event", "=", "None", ",", "mode", "=", "'open'", ")", "# first unselect any selected cols/cells", "self", ".", "remove_cols_mode", "=", "True...
enter 'remove columns' mode
[ "enter", "remove", "columns", "mode" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L495-L519
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.on_remove_row
def on_remove_row(self, event, row_num=-1): """ Remove specified grid row. If no row number is given, remove the last row. """ if row_num == -1: default = (255, 255, 255, 255) # unhighlight any selected rows: for row in self.selected_rows: ...
python
def on_remove_row(self, event, row_num=-1): """ Remove specified grid row. If no row number is given, remove the last row. """ if row_num == -1: default = (255, 255, 255, 255) # unhighlight any selected rows: for row in self.selected_rows: ...
[ "def", "on_remove_row", "(", "self", ",", "event", ",", "row_num", "=", "-", "1", ")", ":", "if", "row_num", "==", "-", "1", ":", "default", "=", "(", "255", ",", "255", ",", "255", ",", "255", ")", "# unhighlight any selected rows:", "for", "row", "...
Remove specified grid row. If no row number is given, remove the last row.
[ "Remove", "specified", "grid", "row", ".", "If", "no", "row", "number", "is", "given", "remove", "the", "last", "row", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L535-L573
PmagPy/PmagPy
dialogs/grid_frame2.py
GridFrame.exit_col_remove_mode
def exit_col_remove_mode(self, event): """ go back from 'remove cols' mode to normal """ # close help messge self.toggle_help(event=None, mode='close') # update mode self.remove_cols_mode = False # re-enable all buttons for btn in [self.add_cols_bu...
python
def exit_col_remove_mode(self, event): """ go back from 'remove cols' mode to normal """ # close help messge self.toggle_help(event=None, mode='close') # update mode self.remove_cols_mode = False # re-enable all buttons for btn in [self.add_cols_bu...
[ "def", "exit_col_remove_mode", "(", "self", ",", "event", ")", ":", "# close help messge", "self", ".", "toggle_help", "(", "event", "=", "None", ",", "mode", "=", "'close'", ")", "# update mode", "self", ".", "remove_cols_mode", "=", "False", "# re-enable all b...
go back from 'remove cols' mode to normal
[ "go", "back", "from", "remove", "cols", "mode", "to", "normal" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L575-L597
PmagPy/PmagPy
dialogs/grid_frame2.py
GridBuilder.make_grid
def make_grid(self, incl_pmag=True): """ return grid """ if incl_pmag and self.grid_type in self.er_magic.incl_pmag_data: incl_pmag = True else: incl_pmag = False er_header = self.grid_headers[self.grid_type]['er'][0] if incl_pmag: ...
python
def make_grid(self, incl_pmag=True): """ return grid """ if incl_pmag and self.grid_type in self.er_magic.incl_pmag_data: incl_pmag = True else: incl_pmag = False er_header = self.grid_headers[self.grid_type]['er'][0] if incl_pmag: ...
[ "def", "make_grid", "(", "self", ",", "incl_pmag", "=", "True", ")", ":", "if", "incl_pmag", "and", "self", ".", "grid_type", "in", "self", ".", "er_magic", ".", "incl_pmag_data", ":", "incl_pmag", "=", "True", "else", ":", "incl_pmag", "=", "False", "er...
return grid
[ "return", "grid" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L765-L837
PmagPy/PmagPy
dialogs/grid_frame2.py
GridBuilder.save_grid_data
def save_grid_data(self): """ Save grid data in the data object """ if not self.grid.changes: print('-I- No changes to save') return if self.grid_type == 'age': age_data_type = self.er_magic.age_type self.er_magic.write_ages = True...
python
def save_grid_data(self): """ Save grid data in the data object """ if not self.grid.changes: print('-I- No changes to save') return if self.grid_type == 'age': age_data_type = self.er_magic.age_type self.er_magic.write_ages = True...
[ "def", "save_grid_data", "(", "self", ")", ":", "if", "not", "self", ".", "grid", ".", "changes", ":", "print", "(", "'-I- No changes to save'", ")", "return", "if", "self", ".", "grid_type", "==", "'age'", ":", "age_data_type", "=", "self", ".", "er_magic...
Save grid data in the data object
[ "Save", "grid", "data", "in", "the", "data", "object" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/grid_frame2.py#L890-L1000
PmagPy/PmagPy
programs/hysteresis_magic2.py
main
def main(): """ NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in rmag_hystereis format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits ...
python
def main(): """ NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in rmag_hystereis format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits ...
[ "def", "main", "(", ")", ":", "args", "=", "sys", ".", "argv", "PLT", "=", "1", "plots", "=", "0", "user", ",", "meas_file", ",", "rmag_out", ",", "rmag_file", "=", "\"\"", ",", "\"agm_measurements.txt\"", ",", "\"rmag_hysteresis.txt\"", ",", "\"\"", "pl...
NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in rmag_hystereis format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits -usr USER: identify...
[ "NAME", "hysteresis_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/hysteresis_magic2.py#L11-L332
PmagPy/PmagPy
programs/mst_magic.py
main
def main(): """ NAME mst_magic.py DESCRIPTION converts MsT data (T,M) to measurements format files SYNTAX mst_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, default is "" -f FILE: specify T...
python
def main(): """ NAME mst_magic.py DESCRIPTION converts MsT data (T,M) to measurements format files SYNTAX mst_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, default is "" -f FILE: specify T...
[ "def", "main", "(", ")", ":", "#", "# get command line arguments", "#", "args", "=", "sys", ".", "argv", "if", "\"-h\"", "in", "args", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "dir_path", "=", "pmag", ".", "get_na...
NAME mst_magic.py DESCRIPTION converts MsT data (T,M) to measurements format files SYNTAX mst_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, default is "" -f FILE: specify T,M format input file, r...
[ "NAME", "mst_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/mst_magic.py#L7-L78
PmagPy/PmagPy
programs/deprecated/parse_measurements.py
main
def main(): """ NAME parse_measurements.py DESCRIPTION takes measurments file and creates specimen and instrument files SYNTAX parse_measurements.py [command line options] OPTIONS -h prints help message and quits -f FILE magic_measurements input file, defau...
python
def main(): """ NAME parse_measurements.py DESCRIPTION takes measurments file and creates specimen and instrument files SYNTAX parse_measurements.py [command line options] OPTIONS -h prints help message and quits -f FILE magic_measurements input file, defau...
[ "def", "main", "(", ")", ":", "infile", "=", "'magic_measurements.txt'", "sitefile", "=", "\"\"", "specout", "=", "\"er_specimens.txt\"", "instout", "=", "\"magic_instruments.txt\"", "# get command line stuff", "if", "\"-h\"", "in", "sys", ".", "argv", ":", "print",...
NAME parse_measurements.py DESCRIPTION takes measurments file and creates specimen and instrument files SYNTAX parse_measurements.py [command line options] OPTIONS -h prints help message and quits -f FILE magic_measurements input file, default is "magic_measurement...
[ "NAME", "parse_measurements", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/parse_measurements.py#L9-L59
PmagPy/PmagPy
programs/conversion_scripts2/utrecht_magic2.py
main
def main(command_line=True, **kwargs): """ NAME utrecht_magic.py DESCRIPTION converts Utrecht magnetometer data files to magic_measurements files SYNTAX utrecht_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify ...
python
def main(command_line=True, **kwargs): """ NAME utrecht_magic.py DESCRIPTION converts Utrecht magnetometer data files to magic_measurements files SYNTAX utrecht_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify ...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# initialize some stuff", "sample_lat", "=", "0.0", "sample_lon", "=", "0.0", "noave", "=", "0", "er_location_name", "=", "\"unknown\"", "args", "=", "sys", ".", "argv", "...
NAME utrecht_magic.py DESCRIPTION converts Utrecht magnetometer data files to magic_measurements files SYNTAX utrecht_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify input file, or -F FILE: specify output fil...
[ "NAME", "utrecht_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/utrecht_magic2.py#L12-L397
PmagPy/PmagPy
dialogs/pmag_gui_dialogs2.py
convert_HUJI_files_to_MagIC.on_okButton
def on_okButton(self, event): """ grab user input values, format them, and run huji_magic.py with the appropriate flags """ os.chdir(self.WD) options = {} HUJI_file = self.bSizer0.return_value() if not HUJI_file: pw.simple_warning("You must select a HU...
python
def on_okButton(self, event): """ grab user input values, format them, and run huji_magic.py with the appropriate flags """ os.chdir(self.WD) options = {} HUJI_file = self.bSizer0.return_value() if not HUJI_file: pw.simple_warning("You must select a HU...
[ "def", "on_okButton", "(", "self", ",", "event", ")", ":", "os", ".", "chdir", "(", "self", ".", "WD", ")", "options", "=", "{", "}", "HUJI_file", "=", "self", ".", "bSizer0", ".", "return_value", "(", ")", "if", "not", "HUJI_file", ":", "pw", ".",...
grab user input values, format them, and run huji_magic.py with the appropriate flags
[ "grab", "user", "input", "values", "format", "them", "and", "run", "huji_magic", ".", "py", "with", "the", "appropriate", "flags" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs2.py#L1158-L1231
PmagPy/PmagPy
dialogs/pmag_gui_dialogs2.py
convert_Utrecht_files_to_MagIC.on_okButton
def on_okButton(self, event): """ Complies information input in GUI into a kwargs dictionary which can be passed into the utrecht_magic script and run to output magic files """ os.chdir(self.WD) options_dict = {} wd = self.WD options_dict['dir_path'] = wd ...
python
def on_okButton(self, event): """ Complies information input in GUI into a kwargs dictionary which can be passed into the utrecht_magic script and run to output magic files """ os.chdir(self.WD) options_dict = {} wd = self.WD options_dict['dir_path'] = wd ...
[ "def", "on_okButton", "(", "self", ",", "event", ")", ":", "os", ".", "chdir", "(", "self", ".", "WD", ")", "options_dict", "=", "{", "}", "wd", "=", "self", ".", "WD", "options_dict", "[", "'dir_path'", "]", "=", "wd", "full_file", "=", "self", "....
Complies information input in GUI into a kwargs dictionary which can be passed into the utrecht_magic script and run to output magic files
[ "Complies", "information", "input", "in", "GUI", "into", "a", "kwargs", "dictionary", "which", "can", "be", "passed", "into", "the", "utrecht_magic", "script", "and", "run", "to", "output", "magic", "files" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs2.py#L2275-L2345
PmagPy/PmagPy
dialogs/pmag_gui_dialogs2.py
OrientFrameGrid3.on_m_calc_orient
def on_m_calc_orient(self,event): ''' This fucntion does exactly what the 'import orientation' fuction does in MagIC.py after some dialog boxes the function calls orientation_magic.py ''' # first see if demag_orient.txt self.on_m_save_file(None) orient_convention_...
python
def on_m_calc_orient(self,event): ''' This fucntion does exactly what the 'import orientation' fuction does in MagIC.py after some dialog boxes the function calls orientation_magic.py ''' # first see if demag_orient.txt self.on_m_save_file(None) orient_convention_...
[ "def", "on_m_calc_orient", "(", "self", ",", "event", ")", ":", "# first see if demag_orient.txt", "self", ".", "on_m_save_file", "(", "None", ")", "orient_convention_dia", "=", "orient_convention", "(", "None", ")", "orient_convention_dia", ".", "Center", "(", ")",...
This fucntion does exactly what the 'import orientation' fuction does in MagIC.py after some dialog boxes the function calls orientation_magic.py
[ "This", "fucntion", "does", "exactly", "what", "the", "import", "orientation", "fuction", "does", "in", "MagIC", ".", "py", "after", "some", "dialog", "boxes", "the", "function", "calls", "orientation_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs2.py#L2697-L2782
PmagPy/PmagPy
programs/eigs_s.py
main
def main(): """ NAME eigs_s.py DESCRIPTION converts eigenparamters format data to s format SYNTAX eigs_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows interactive file name entry -f FILE, specifies input file name ...
python
def main(): """ NAME eigs_s.py DESCRIPTION converts eigenparamters format data to s format SYNTAX eigs_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows interactive file name entry -f FILE, specifies input file name ...
[ "def", "main", "(", ")", ":", "file", "=", "\"\"", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "elif", "'-i'", "in", "sys", ".", "argv", ":", "file", "=", "input", "(", ...
NAME eigs_s.py DESCRIPTION converts eigenparamters format data to s format SYNTAX eigs_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows interactive file name entry -f FILE, specifies input file name -F FILE, specifies...
[ "NAME", "eigs_s", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/eigs_s.py#L8-L66
PmagPy/PmagPy
programs/ani_depthplot.py
main
def main(): """ NAME ani_depthplot.py DESCRIPTION plots tau, V3_inc, V1_dec, P and chi versus core_depth SYNTAX ani_depthplot.py [command line optins] # or, for Anaconda users: ani_depthplot_anaconda [command line options] OPTIONS -h prints help me...
python
def main(): """ NAME ani_depthplot.py DESCRIPTION plots tau, V3_inc, V1_dec, P and chi versus core_depth SYNTAX ani_depthplot.py [command line optins] # or, for Anaconda users: ani_depthplot_anaconda [command line options] OPTIONS -h prints help me...
[ "def", "main", "(", ")", ":", "args", "=", "sys", ".", "argv", "if", "'-h'", "in", "args", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "dataframe", "=", "extractor", ".", "command_line_dataframe", "(", "[", "[", "'...
NAME ani_depthplot.py DESCRIPTION plots tau, V3_inc, V1_dec, P and chi versus core_depth SYNTAX ani_depthplot.py [command line optins] # or, for Anaconda users: ani_depthplot_anaconda [command line options] OPTIONS -h prints help message and quits ...
[ "NAME", "ani_depthplot", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/ani_depthplot.py#L16-L119
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_numpy_dtype
def get_numpy_dtype(obj): """Return NumPy data type associated to obj Return None if NumPy is not available or if obj is not a NumPy array or scalar""" if ndarray is not FakeObject: # NumPy is available import numpy as np if isinstance(obj, np.generic) or isinstance(obj, np.ndarr...
python
def get_numpy_dtype(obj): """Return NumPy data type associated to obj Return None if NumPy is not available or if obj is not a NumPy array or scalar""" if ndarray is not FakeObject: # NumPy is available import numpy as np if isinstance(obj, np.generic) or isinstance(obj, np.ndarr...
[ "def", "get_numpy_dtype", "(", "obj", ")", ":", "if", "ndarray", "is", "not", "FakeObject", ":", "# NumPy is available", "import", "numpy", "as", "np", "if", "isinstance", "(", "obj", ",", "np", ".", "generic", ")", "or", "isinstance", "(", "obj", ",", "...
Return NumPy data type associated to obj Return None if NumPy is not available or if obj is not a NumPy array or scalar
[ "Return", "NumPy", "data", "type", "associated", "to", "obj", "Return", "None", "if", "NumPy", "is", "not", "available", "or", "if", "obj", "is", "not", "a", "NumPy", "array", "or", "scalar" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L50-L67
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
address
def address(obj): """Return object address as a string: '<classname @ address>'""" return "<%s @ %s>" % (obj.__class__.__name__, hex(id(obj)).upper().replace('X', 'x'))
python
def address(obj): """Return object address as a string: '<classname @ address>'""" return "<%s @ %s>" % (obj.__class__.__name__, hex(id(obj)).upper().replace('X', 'x'))
[ "def", "address", "(", "obj", ")", ":", "return", "\"<%s @ %s>\"", "%", "(", "obj", ".", "__class__", ".", "__name__", ",", "hex", "(", "id", "(", "obj", ")", ")", ".", "upper", "(", ")", ".", "replace", "(", "'X'", ",", "'x'", ")", ")" ]
Return object address as a string: '<classname @ address>
[ "Return", "object", "address", "as", "a", "string", ":", "<classname" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L102-L105
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_size
def get_size(item): """Return size of an item of arbitrary type""" if isinstance(item, (list, set, tuple, dict)): return len(item) elif isinstance(item, (ndarray, MaskedArray)): return item.shape elif isinstance(item, Image): return item.size if isinstance(item, (DataFrame, I...
python
def get_size(item): """Return size of an item of arbitrary type""" if isinstance(item, (list, set, tuple, dict)): return len(item) elif isinstance(item, (ndarray, MaskedArray)): return item.shape elif isinstance(item, Image): return item.size if isinstance(item, (DataFrame, I...
[ "def", "get_size", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "(", "list", ",", "set", ",", "tuple", ",", "dict", ")", ")", ":", "return", "len", "(", "item", ")", "elif", "isinstance", "(", "item", ",", "(", "ndarray", ",", "Ma...
Return size of an item of arbitrary type
[ "Return", "size", "of", "an", "item", "of", "arbitrary", "type" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L116-L127
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_object_attrs
def get_object_attrs(obj): """ Get the attributes of an object using dir. This filters protected attributes """ attrs = [k for k in dir(obj) if not k.startswith('__')] if not attrs: attrs = dir(obj) return attrs
python
def get_object_attrs(obj): """ Get the attributes of an object using dir. This filters protected attributes """ attrs = [k for k in dir(obj) if not k.startswith('__')] if not attrs: attrs = dir(obj) return attrs
[ "def", "get_object_attrs", "(", "obj", ")", ":", "attrs", "=", "[", "k", "for", "k", "in", "dir", "(", "obj", ")", "if", "not", "k", ".", "startswith", "(", "'__'", ")", "]", "if", "not", "attrs", ":", "attrs", "=", "dir", "(", "obj", ")", "ret...
Get the attributes of an object using dir. This filters protected attributes
[ "Get", "the", "attributes", "of", "an", "object", "using", "dir", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L130-L139
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
str_to_timedelta
def str_to_timedelta(value): """Convert a string to a datetime.timedelta value. The following strings are accepted: - 'datetime.timedelta(1, 5, 12345)' - 'timedelta(1, 5, 12345)' - '(1, 5, 12345)' - '1, 5, 12345' - '1' if there are less then three parameters, the m...
python
def str_to_timedelta(value): """Convert a string to a datetime.timedelta value. The following strings are accepted: - 'datetime.timedelta(1, 5, 12345)' - 'timedelta(1, 5, 12345)' - '(1, 5, 12345)' - '1, 5, 12345' - '1' if there are less then three parameters, the m...
[ "def", "str_to_timedelta", "(", "value", ")", ":", "m", "=", "re", ".", "match", "(", "r'^(?:(?:datetime\\.)?timedelta)?'", "r'\\(?'", "r'([^)]*)'", "r'\\)?$'", ",", "value", ")", "if", "not", "m", ":", "raise", "ValueError", "(", "'Invalid string for datetime.tim...
Convert a string to a datetime.timedelta value. The following strings are accepted: - 'datetime.timedelta(1, 5, 12345)' - 'timedelta(1, 5, 12345)' - '(1, 5, 12345)' - '1, 5, 12345' - '1' if there are less then three parameters, the missing parameters are assumed to...
[ "Convert", "a", "string", "to", "a", "datetime", ".", "timedelta", "value", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L163-L188
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_color_name
def get_color_name(value): """Return color name depending on value type""" if not is_known_type(value): return CUSTOM_TYPE_COLOR for typ, name in list(COLORS.items()): if isinstance(value, typ): return name else: np_dtype = get_numpy_dtype(value) if np_dtype i...
python
def get_color_name(value): """Return color name depending on value type""" if not is_known_type(value): return CUSTOM_TYPE_COLOR for typ, name in list(COLORS.items()): if isinstance(value, typ): return name else: np_dtype = get_numpy_dtype(value) if np_dtype i...
[ "def", "get_color_name", "(", "value", ")", ":", "if", "not", "is_known_type", "(", "value", ")", ":", "return", "CUSTOM_TYPE_COLOR", "for", "typ", ",", "name", "in", "list", "(", "COLORS", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "va...
Return color name depending on value type
[ "Return", "color", "name", "depending", "on", "value", "type" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L217-L231
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
sort_against
def sort_against(list1, list2, reverse=False): """ Arrange items of list1 in the same order as sorted(list2). In other words, apply to list1 the permutation which takes list2 to sorted(list2, reverse). """ try: return [item for _, item in sorted(zip(list2, list1), key=...
python
def sort_against(list1, list2, reverse=False): """ Arrange items of list1 in the same order as sorted(list2). In other words, apply to list1 the permutation which takes list2 to sorted(list2, reverse). """ try: return [item for _, item in sorted(zip(list2, list1), key=...
[ "def", "sort_against", "(", "list1", ",", "list2", ",", "reverse", "=", "False", ")", ":", "try", ":", "return", "[", "item", "for", "_", ",", "item", "in", "sorted", "(", "zip", "(", "list2", ",", "list1", ")", ",", "key", "=", "lambda", "x", ":...
Arrange items of list1 in the same order as sorted(list2). In other words, apply to list1 the permutation which takes list2 to sorted(list2, reverse).
[ "Arrange", "items", "of", "list1", "in", "the", "same", "order", "as", "sorted", "(", "list2", ")", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L243-L254
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
default_display
def default_display(value, with_module=True): """Default display for unknown objects.""" object_type = type(value) try: name = object_type.__name__ module = object_type.__module__ if with_module: return name + ' object of ' + module + ' module' else: r...
python
def default_display(value, with_module=True): """Default display for unknown objects.""" object_type = type(value) try: name = object_type.__name__ module = object_type.__module__ if with_module: return name + ' object of ' + module + ' module' else: r...
[ "def", "default_display", "(", "value", ",", "with_module", "=", "True", ")", ":", "object_type", "=", "type", "(", "value", ")", "try", ":", "name", "=", "object_type", ".", "__name__", "module", "=", "object_type", ".", "__module__", "if", "with_module", ...
Default display for unknown objects.
[ "Default", "display", "for", "unknown", "objects", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L265-L277
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
collections_display
def collections_display(value, level): """Display for collections (i.e. list, set, tuple and dict).""" is_dict = isinstance(value, dict) is_set = isinstance(value, set) # Get elements if is_dict: elements = iteritems(value) else: elements = value # Truncate values trunc...
python
def collections_display(value, level): """Display for collections (i.e. list, set, tuple and dict).""" is_dict = isinstance(value, dict) is_set = isinstance(value, set) # Get elements if is_dict: elements = iteritems(value) else: elements = value # Truncate values trunc...
[ "def", "collections_display", "(", "value", ",", "level", ")", ":", "is_dict", "=", "isinstance", "(", "value", ",", "dict", ")", "is_set", "=", "isinstance", "(", "value", ",", "set", ")", "# Get elements", "if", "is_dict", ":", "elements", "=", "iteritem...
Display for collections (i.e. list, set, tuple and dict).
[ "Display", "for", "collections", "(", "i", ".", "e", ".", "list", "set", "tuple", "and", "dict", ")", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L280-L325
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
value_to_display
def value_to_display(value, minmax=False, level=0): """Convert value for display purpose""" # To save current Numpy printoptions np_printoptions = FakeObject try: numeric_numpy_types = (int64, int32, int16, int8, uint64, uint32, uint16, uint8, ...
python
def value_to_display(value, minmax=False, level=0): """Convert value for display purpose""" # To save current Numpy printoptions np_printoptions = FakeObject try: numeric_numpy_types = (int64, int32, int16, int8, uint64, uint32, uint16, uint8, ...
[ "def", "value_to_display", "(", "value", ",", "minmax", "=", "False", ",", "level", "=", "0", ")", ":", "# To save current Numpy printoptions", "np_printoptions", "=", "FakeObject", "try", ":", "numeric_numpy_types", "=", "(", "int64", ",", "int32", ",", "int16"...
Convert value for display purpose
[ "Convert", "value", "for", "display", "purpose" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L328-L458
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
display_to_value
def display_to_value(value, default_value, ignore_errors=True): """Convert back to value""" from qtpy.compat import from_qvariant value = from_qvariant(value, to_text_string) try: np_dtype = get_numpy_dtype(default_value) if isinstance(default_value, bool): # We must test for...
python
def display_to_value(value, default_value, ignore_errors=True): """Convert back to value""" from qtpy.compat import from_qvariant value = from_qvariant(value, to_text_string) try: np_dtype = get_numpy_dtype(default_value) if isinstance(default_value, bool): # We must test for...
[ "def", "display_to_value", "(", "value", ",", "default_value", ",", "ignore_errors", "=", "True", ")", ":", "from", "qtpy", ".", "compat", "import", "from_qvariant", "value", "=", "from_qvariant", "(", "value", ",", "to_text_string", ")", "try", ":", "np_dtype...
Convert back to value
[ "Convert", "back", "to", "value" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L461-L507
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_type_string
def get_type_string(item): """Return type string of an object.""" if isinstance(item, DataFrame): return "DataFrame" if isinstance(item, Index): return type(item).__name__ if isinstance(item, Series): return "Series" found = re.findall(r"<(?:type|class) '(\S*)'>", ...
python
def get_type_string(item): """Return type string of an object.""" if isinstance(item, DataFrame): return "DataFrame" if isinstance(item, Index): return type(item).__name__ if isinstance(item, Series): return "Series" found = re.findall(r"<(?:type|class) '(\S*)'>", ...
[ "def", "get_type_string", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "DataFrame", ")", ":", "return", "\"DataFrame\"", "if", "isinstance", "(", "item", ",", "Index", ")", ":", "return", "type", "(", "item", ")", ".", "__name__", "if", ...
Return type string of an object.
[ "Return", "type", "string", "of", "an", "object", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L513-L524
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_human_readable_type
def get_human_readable_type(item): """Return human-readable type string of an item""" if isinstance(item, (ndarray, MaskedArray)): return item.dtype.name elif isinstance(item, Image): return "Image" else: text = get_type_string(item) if text is None: text = to...
python
def get_human_readable_type(item): """Return human-readable type string of an item""" if isinstance(item, (ndarray, MaskedArray)): return item.dtype.name elif isinstance(item, Image): return "Image" else: text = get_type_string(item) if text is None: text = to...
[ "def", "get_human_readable_type", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "(", "ndarray", ",", "MaskedArray", ")", ")", ":", "return", "item", ".", "dtype", ".", "name", "elif", "isinstance", "(", "item", ",", "Image", ")", ":", "r...
Return human-readable type string of an item
[ "Return", "human", "-", "readable", "type", "string", "of", "an", "item" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L533-L544
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
is_supported
def is_supported(value, check_all=False, filters=None, iterate=False): """Return True if the value is supported, False otherwise""" assert filters is not None if value is None: return True if not is_editable_type(value): return False elif not isinstance(value, filters): retur...
python
def is_supported(value, check_all=False, filters=None, iterate=False): """Return True if the value is supported, False otherwise""" assert filters is not None if value is None: return True if not is_editable_type(value): return False elif not isinstance(value, filters): retur...
[ "def", "is_supported", "(", "value", ",", "check_all", "=", "False", ",", "filters", "=", "None", ",", "iterate", "=", "False", ")", ":", "assert", "filters", "is", "not", "None", "if", "value", "is", "None", ":", "return", "True", "if", "not", "is_edi...
Return True if the value is supported, False otherwise
[ "Return", "True", "if", "the", "value", "is", "supported", "False", "otherwise" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L551-L577
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
globalsfilter
def globalsfilter(input_dict, check_all=False, filters=None, exclude_private=None, exclude_capitalized=None, exclude_uppercase=None, exclude_unsupported=None, excluded_names=None): """Keep only objects that can be pickled""" output_dict = {} for key, val...
python
def globalsfilter(input_dict, check_all=False, filters=None, exclude_private=None, exclude_capitalized=None, exclude_uppercase=None, exclude_unsupported=None, excluded_names=None): """Keep only objects that can be pickled""" output_dict = {} for key, val...
[ "def", "globalsfilter", "(", "input_dict", ",", "check_all", "=", "False", ",", "filters", "=", "None", ",", "exclude_private", "=", "None", ",", "exclude_capitalized", "=", "None", ",", "exclude_uppercase", "=", "None", ",", "exclude_unsupported", "=", "None", ...
Keep only objects that can be pickled
[ "Keep", "only", "objects", "that", "can", "be", "pickled" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L580-L597
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_supported_types
def get_supported_types(): """ Return a dictionnary containing types lists supported by the namespace browser. Note: If you update this list, don't forget to update variablexplorer.rst in spyder-docs """ from datetime import date, timedelta editable_types = [int, float, complex, lis...
python
def get_supported_types(): """ Return a dictionnary containing types lists supported by the namespace browser. Note: If you update this list, don't forget to update variablexplorer.rst in spyder-docs """ from datetime import date, timedelta editable_types = [int, float, complex, lis...
[ "def", "get_supported_types", "(", ")", ":", "from", "datetime", "import", "date", ",", "timedelta", "editable_types", "=", "[", "int", ",", "float", ",", "complex", ",", "list", ",", "set", ",", "dict", ",", "tuple", ",", "date", ",", "timedelta", "]", ...
Return a dictionnary containing types lists supported by the namespace browser. Note: If you update this list, don't forget to update variablexplorer.rst in spyder-docs
[ "Return", "a", "dictionnary", "containing", "types", "lists", "supported", "by", "the", "namespace", "browser", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L608-L636
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
get_remote_data
def get_remote_data(data, settings, mode, more_excluded_names=None): """ Return globals according to filter described in *settings*: * data: data to be filtered (dictionary) * settings: variable explorer settings (dictionary) * mode (string): 'editable' or 'picklable' * more_excl...
python
def get_remote_data(data, settings, mode, more_excluded_names=None): """ Return globals according to filter described in *settings*: * data: data to be filtered (dictionary) * settings: variable explorer settings (dictionary) * mode (string): 'editable' or 'picklable' * more_excl...
[ "def", "get_remote_data", "(", "data", ",", "settings", ",", "mode", ",", "more_excluded_names", "=", "None", ")", ":", "supported_types", "=", "get_supported_types", "(", ")", "assert", "mode", "in", "list", "(", "supported_types", ".", "keys", "(", ")", ")...
Return globals according to filter described in *settings*: * data: data to be filtered (dictionary) * settings: variable explorer settings (dictionary) * mode (string): 'editable' or 'picklable' * more_excluded_names: additional excluded names (list)
[ "Return", "globals", "according", "to", "filter", "described", "in", "*", "settings", "*", ":", "*", "data", ":", "data", "to", "be", "filtered", "(", "dictionary", ")", "*", "settings", ":", "variable", "explorer", "settings", "(", "dictionary", ")", "*",...
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L639-L658
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
make_remote_view
def make_remote_view(data, settings, more_excluded_names=None): """ Make a remote view of dictionary *data* -> globals explorer """ data = get_remote_data(data, settings, mode='editable', more_excluded_names=more_excluded_names) remote = {} for key, value in list(d...
python
def make_remote_view(data, settings, more_excluded_names=None): """ Make a remote view of dictionary *data* -> globals explorer """ data = get_remote_data(data, settings, mode='editable', more_excluded_names=more_excluded_names) remote = {} for key, value in list(d...
[ "def", "make_remote_view", "(", "data", ",", "settings", ",", "more_excluded_names", "=", "None", ")", ":", "data", "=", "get_remote_data", "(", "data", ",", "settings", ",", "mode", "=", "'editable'", ",", "more_excluded_names", "=", "more_excluded_names", ")",...
Make a remote view of dictionary *data* -> globals explorer
[ "Make", "a", "remote", "view", "of", "dictionary", "*", "data", "*", "-", ">", "globals", "explorer" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L661-L675
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._pdb_frame
def _pdb_frame(self): """Return current Pdb frame if there is any""" if self._pdb_obj is not None and self._pdb_obj.curframe is not None: return self._pdb_obj.curframe
python
def _pdb_frame(self): """Return current Pdb frame if there is any""" if self._pdb_obj is not None and self._pdb_obj.curframe is not None: return self._pdb_obj.curframe
[ "def", "_pdb_frame", "(", "self", ")", ":", "if", "self", ".", "_pdb_obj", "is", "not", "None", "and", "self", ".", "_pdb_obj", ".", "curframe", "is", "not", "None", ":", "return", "self", ".", "_pdb_obj", ".", "curframe" ]
Return current Pdb frame if there is any
[ "Return", "current", "Pdb", "frame", "if", "there", "is", "any" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L47-L50
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.get_namespace_view
def get_namespace_view(self): """ Return the namespace view This is a dictionary with the following structure {'a': {'color': '#800000', 'size': 1, 'type': 'str', 'view': '1'}} Here: * 'a' is the variable name * 'color' is the color used to show it * 's...
python
def get_namespace_view(self): """ Return the namespace view This is a dictionary with the following structure {'a': {'color': '#800000', 'size': 1, 'type': 'str', 'view': '1'}} Here: * 'a' is the variable name * 'color' is the color used to show it * 's...
[ "def", "get_namespace_view", "(", "self", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "nsview", "import", "make_remote_view", "settings", "=", "self", ".", "namespace_view_settings", "if", "settings", ":", "ns", "=", "self", ".", "_get_current_namespace...
Return the namespace view This is a dictionary with the following structure {'a': {'color': '#800000', 'size': 1, 'type': 'str', 'view': '1'}} Here: * 'a' is the variable name * 'color' is the color used to show it * 'size' and 'type' are self-evident * and'vie...
[ "Return", "the", "namespace", "view" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L65-L87
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.get_var_properties
def get_var_properties(self): """ Get some properties of the variables in the current namespace """ from spyder_kernels.utils.nsview import get_remote_data settings = self.namespace_view_settings if settings: ns = self._get_current_namespace() ...
python
def get_var_properties(self): """ Get some properties of the variables in the current namespace """ from spyder_kernels.utils.nsview import get_remote_data settings = self.namespace_view_settings if settings: ns = self._get_current_namespace() ...
[ "def", "get_var_properties", "(", "self", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "nsview", "import", "get_remote_data", "settings", "=", "self", ".", "namespace_view_settings", "if", "settings", ":", "ns", "=", "self", ".", "_get_current_namespace"...
Get some properties of the variables in the current namespace
[ "Get", "some", "properties", "of", "the", "variables", "in", "the", "current", "namespace" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L89-L119
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.send_spyder_msg
def send_spyder_msg(self, spyder_msg_type, content=None, data=None): """ Publish custom messages to the Spyder frontend. Parameters ---------- spyder_msg_type: str The spyder message type content: dict The (JSONable) content of the message ...
python
def send_spyder_msg(self, spyder_msg_type, content=None, data=None): """ Publish custom messages to the Spyder frontend. Parameters ---------- spyder_msg_type: str The spyder message type content: dict The (JSONable) content of the message ...
[ "def", "send_spyder_msg", "(", "self", ",", "spyder_msg_type", ",", "content", "=", "None", ",", "data", "=", "None", ")", ":", "import", "cloudpickle", "if", "content", "is", "None", ":", "content", "=", "{", "}", "content", "[", "'spyder_msg_type'", "]",...
Publish custom messages to the Spyder frontend. Parameters ---------- spyder_msg_type: str The spyder message type content: dict The (JSONable) content of the message data: any Any object that is serializable by cloudpickle (should be most ...
[ "Publish", "custom", "messages", "to", "the", "Spyder", "frontend", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L121-L148
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.get_value
def get_value(self, name): """Get the value of a variable""" ns = self._get_current_namespace() value = ns[name] try: self.send_spyder_msg('data', data=value) except: # * There is no need to inform users about # these errors. # * ...
python
def get_value(self, name): """Get the value of a variable""" ns = self._get_current_namespace() value = ns[name] try: self.send_spyder_msg('data', data=value) except: # * There is no need to inform users about # these errors. # * ...
[ "def", "get_value", "(", "self", ",", "name", ")", ":", "ns", "=", "self", ".", "_get_current_namespace", "(", ")", "value", "=", "ns", "[", "name", "]", "try", ":", "self", ".", "send_spyder_msg", "(", "'data'", ",", "data", "=", "value", ")", "exce...
Get the value of a variable
[ "Get", "the", "value", "of", "a", "variable" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L150-L162
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.set_value
def set_value(self, name, value, PY2_frontend): """Set the value of a variable""" import cloudpickle ns = self._get_reference_namespace(name) # We send serialized values in a list of one element # from Spyder to the kernel, to be able to send them # at all in Python 2 ...
python
def set_value(self, name, value, PY2_frontend): """Set the value of a variable""" import cloudpickle ns = self._get_reference_namespace(name) # We send serialized values in a list of one element # from Spyder to the kernel, to be able to send them # at all in Python 2 ...
[ "def", "set_value", "(", "self", ",", "name", ",", "value", ",", "PY2_frontend", ")", ":", "import", "cloudpickle", "ns", "=", "self", ".", "_get_reference_namespace", "(", "name", ")", "# We send serialized values in a list of one element", "# from Spyder to the kernel...
Set the value of a variable
[ "Set", "the", "value", "of", "a", "variable" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L164-L182
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.remove_value
def remove_value(self, name): """Remove a variable""" ns = self._get_reference_namespace(name) ns.pop(name)
python
def remove_value(self, name): """Remove a variable""" ns = self._get_reference_namespace(name) ns.pop(name)
[ "def", "remove_value", "(", "self", ",", "name", ")", ":", "ns", "=", "self", ".", "_get_reference_namespace", "(", "name", ")", "ns", ".", "pop", "(", "name", ")" ]
Remove a variable
[ "Remove", "a", "variable" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L184-L187
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.copy_value
def copy_value(self, orig_name, new_name): """Copy a variable""" ns = self._get_reference_namespace(orig_name) ns[new_name] = ns[orig_name]
python
def copy_value(self, orig_name, new_name): """Copy a variable""" ns = self._get_reference_namespace(orig_name) ns[new_name] = ns[orig_name]
[ "def", "copy_value", "(", "self", ",", "orig_name", ",", "new_name", ")", ":", "ns", "=", "self", ".", "_get_reference_namespace", "(", "orig_name", ")", "ns", "[", "new_name", "]", "=", "ns", "[", "orig_name", "]" ]
Copy a variable
[ "Copy", "a", "variable" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L189-L192
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.load_data
def load_data(self, filename, ext): """Load data from filename""" from spyder_kernels.utils.iofuncs import iofunctions from spyder_kernels.utils.misc import fix_reference_name glbs = self._mglobals() load_func = iofunctions.load_funcs[ext] data, error_message = load_fun...
python
def load_data(self, filename, ext): """Load data from filename""" from spyder_kernels.utils.iofuncs import iofunctions from spyder_kernels.utils.misc import fix_reference_name glbs = self._mglobals() load_func = iofunctions.load_funcs[ext] data, error_message = load_fun...
[ "def", "load_data", "(", "self", ",", "filename", ",", "ext", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "iofuncs", "import", "iofunctions", "from", "spyder_kernels", ".", "utils", ".", "misc", "import", "fix_reference_name", "glbs", "=", "self", ...
Load data from filename
[ "Load", "data", "from", "filename" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L194-L217
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.save_namespace
def save_namespace(self, filename): """Save namespace into filename""" from spyder_kernels.utils.nsview import get_remote_data from spyder_kernels.utils.iofuncs import iofunctions ns = self._get_current_namespace() settings = self.namespace_view_settings data = get_remot...
python
def save_namespace(self, filename): """Save namespace into filename""" from spyder_kernels.utils.nsview import get_remote_data from spyder_kernels.utils.iofuncs import iofunctions ns = self._get_current_namespace() settings = self.namespace_view_settings data = get_remot...
[ "def", "save_namespace", "(", "self", ",", "filename", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "nsview", "import", "get_remote_data", "from", "spyder_kernels", ".", "utils", ".", "iofuncs", "import", "iofunctions", "ns", "=", "self", ".", "_get_...
Save namespace into filename
[ "Save", "namespace", "into", "filename" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L219-L228
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.publish_pdb_state
def publish_pdb_state(self): """ Publish Variable Explorer state and Pdb step through send_spyder_msg. """ if self._pdb_obj and self._do_publish_pdb_state: state = dict(namespace_view = self.get_namespace_view(), var_properties = self.get_var_...
python
def publish_pdb_state(self): """ Publish Variable Explorer state and Pdb step through send_spyder_msg. """ if self._pdb_obj and self._do_publish_pdb_state: state = dict(namespace_view = self.get_namespace_view(), var_properties = self.get_var_...
[ "def", "publish_pdb_state", "(", "self", ")", ":", "if", "self", ".", "_pdb_obj", "and", "self", ".", "_do_publish_pdb_state", ":", "state", "=", "dict", "(", "namespace_view", "=", "self", ".", "get_namespace_view", "(", ")", ",", "var_properties", "=", "se...
Publish Variable Explorer state and Pdb step through send_spyder_msg.
[ "Publish", "Variable", "Explorer", "state", "and", "Pdb", "step", "through", "send_spyder_msg", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L231-L241
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.is_defined
def is_defined(self, obj, force_import=False): """Return True if object is defined in current namespace""" from spyder_kernels.utils.dochelpers import isdefined ns = self._get_current_namespace(with_magics=True) return isdefined(obj, force_import=force_import, namespace=ns)
python
def is_defined(self, obj, force_import=False): """Return True if object is defined in current namespace""" from spyder_kernels.utils.dochelpers import isdefined ns = self._get_current_namespace(with_magics=True) return isdefined(obj, force_import=force_import, namespace=ns)
[ "def", "is_defined", "(", "self", ",", "obj", ",", "force_import", "=", "False", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "dochelpers", "import", "isdefined", "ns", "=", "self", ".", "_get_current_namespace", "(", "with_magics", "=", "True", ")...
Return True if object is defined in current namespace
[ "Return", "True", "if", "object", "is", "defined", "in", "current", "namespace" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L254-L259
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.get_doc
def get_doc(self, objtxt): """Get object documentation dictionary""" try: import matplotlib matplotlib.rcParams['docstring.hardcopy'] = True except: pass from spyder_kernels.utils.dochelpers import getdoc obj, valid = self._eval(objtxt) ...
python
def get_doc(self, objtxt): """Get object documentation dictionary""" try: import matplotlib matplotlib.rcParams['docstring.hardcopy'] = True except: pass from spyder_kernels.utils.dochelpers import getdoc obj, valid = self._eval(objtxt) ...
[ "def", "get_doc", "(", "self", ",", "objtxt", ")", ":", "try", ":", "import", "matplotlib", "matplotlib", ".", "rcParams", "[", "'docstring.hardcopy'", "]", "=", "True", "except", ":", "pass", "from", "spyder_kernels", ".", "utils", ".", "dochelpers", "impor...
Get object documentation dictionary
[ "Get", "object", "documentation", "dictionary" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L261-L272
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel.get_source
def get_source(self, objtxt): """Get object source""" from spyder_kernels.utils.dochelpers import getsource obj, valid = self._eval(objtxt) if valid: return getsource(obj)
python
def get_source(self, objtxt): """Get object source""" from spyder_kernels.utils.dochelpers import getsource obj, valid = self._eval(objtxt) if valid: return getsource(obj)
[ "def", "get_source", "(", "self", ",", "objtxt", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "dochelpers", "import", "getsource", "obj", ",", "valid", "=", "self", ".", "_eval", "(", "objtxt", ")", "if", "valid", ":", "return", "getsource", "(...
Get object source
[ "Get", "object", "source" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L274-L280
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._get_current_namespace
def _get_current_namespace(self, with_magics=False): """ Return current namespace This is globals() if not debugging, or a dictionary containing both locals() and globals() for current frame when debugging """ ns = {} glbs = self._mglobals() if self._pdb...
python
def _get_current_namespace(self, with_magics=False): """ Return current namespace This is globals() if not debugging, or a dictionary containing both locals() and globals() for current frame when debugging """ ns = {} glbs = self._mglobals() if self._pdb...
[ "def", "_get_current_namespace", "(", "self", ",", "with_magics", "=", "False", ")", ":", "ns", "=", "{", "}", "glbs", "=", "self", ".", "_mglobals", "(", ")", "if", "self", ".", "_pdb_frame", "is", "None", ":", "ns", ".", "update", "(", "glbs", ")",...
Return current namespace This is globals() if not debugging, or a dictionary containing both locals() and globals() for current frame when debugging
[ "Return", "current", "namespace" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L310-L334
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._get_reference_namespace
def _get_reference_namespace(self, name): """ Return namespace where reference name is defined It returns the globals() if reference has not yet been defined """ glbs = self._mglobals() if self._pdb_frame is None: return glbs else: lcls = ...
python
def _get_reference_namespace(self, name): """ Return namespace where reference name is defined It returns the globals() if reference has not yet been defined """ glbs = self._mglobals() if self._pdb_frame is None: return glbs else: lcls = ...
[ "def", "_get_reference_namespace", "(", "self", ",", "name", ")", ":", "glbs", "=", "self", ".", "_mglobals", "(", ")", "if", "self", ".", "_pdb_frame", "is", "None", ":", "return", "glbs", "else", ":", "lcls", "=", "self", ".", "_pdb_locals", "if", "n...
Return namespace where reference name is defined It returns the globals() if reference has not yet been defined
[ "Return", "namespace", "where", "reference", "name", "is", "defined" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L336-L350
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._mglobals
def _mglobals(self): """Return current globals -- handles Pdb frames""" if self._pdb_frame is not None: return self._pdb_frame.f_globals else: return self.shell.user_ns
python
def _mglobals(self): """Return current globals -- handles Pdb frames""" if self._pdb_frame is not None: return self._pdb_frame.f_globals else: return self.shell.user_ns
[ "def", "_mglobals", "(", "self", ")", ":", "if", "self", ".", "_pdb_frame", "is", "not", "None", ":", "return", "self", ".", "_pdb_frame", ".", "f_globals", "else", ":", "return", "self", ".", "shell", ".", "user_ns" ]
Return current globals -- handles Pdb frames
[ "Return", "current", "globals", "--", "handles", "Pdb", "frames" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L352-L357
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._is_image
def _is_image(self, var): """Return True if variable is a PIL.Image image""" try: from PIL import Image return isinstance(var, Image.Image) except: return False
python
def _is_image(self, var): """Return True if variable is a PIL.Image image""" try: from PIL import Image return isinstance(var, Image.Image) except: return False
[ "def", "_is_image", "(", "self", ",", "var", ")", ":", "try", ":", "from", "PIL", "import", "Image", "return", "isinstance", "(", "var", ",", "Image", ".", "Image", ")", "except", ":", "return", "False" ]
Return True if variable is a PIL.Image image
[ "Return", "True", "if", "variable", "is", "a", "PIL", ".", "Image", "image" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L374-L380
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._set_spyder_breakpoints
def _set_spyder_breakpoints(self, breakpoints): """Set all Spyder breakpoints in an active pdb session""" if not self._pdb_obj: return # Breakpoints come serialized from Spyder. We send them # in a list of one element to be able to send them at all # in Python 2 ...
python
def _set_spyder_breakpoints(self, breakpoints): """Set all Spyder breakpoints in an active pdb session""" if not self._pdb_obj: return # Breakpoints come serialized from Spyder. We send them # in a list of one element to be able to send them at all # in Python 2 ...
[ "def", "_set_spyder_breakpoints", "(", "self", ",", "breakpoints", ")", ":", "if", "not", "self", ".", "_pdb_obj", ":", "return", "# Breakpoints come serialized from Spyder. We send them", "# in a list of one element to be able to send them at all", "# in Python 2", "serialized_b...
Set all Spyder breakpoints in an active pdb session
[ "Set", "all", "Spyder", "breakpoints", "in", "an", "active", "pdb", "session" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L423-L434
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._eval
def _eval(self, text): """ Evaluate text and return (obj, valid) where *obj* is the object represented by *text* and *valid* is True if object evaluation did not raise any exception """ from spyder_kernels.py3compat import is_text_string assert is_text_string(tex...
python
def _eval(self, text): """ Evaluate text and return (obj, valid) where *obj* is the object represented by *text* and *valid* is True if object evaluation did not raise any exception """ from spyder_kernels.py3compat import is_text_string assert is_text_string(tex...
[ "def", "_eval", "(", "self", ",", "text", ")", ":", "from", "spyder_kernels", ".", "py3compat", "import", "is_text_string", "assert", "is_text_string", "(", "text", ")", "ns", "=", "self", ".", "_get_current_namespace", "(", "with_magics", "=", "True", ")", ...
Evaluate text and return (obj, valid) where *obj* is the object represented by *text* and *valid* is True if object evaluation did not raise any exception
[ "Evaluate", "text", "and", "return", "(", "obj", "valid", ")", "where", "*", "obj", "*", "is", "the", "object", "represented", "by", "*", "text", "*", "and", "*", "valid", "*", "is", "True", "if", "object", "evaluation", "did", "not", "raise", "any", ...
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L441-L454
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._set_mpl_backend
def _set_mpl_backend(self, backend, pylab=False): """ Set a backend for Matplotlib. backend: A parameter that can be passed to %matplotlib (e.g. 'inline' or 'tk'). """ import traceback from IPython.core.getipython import get_ipython generic_erro...
python
def _set_mpl_backend(self, backend, pylab=False): """ Set a backend for Matplotlib. backend: A parameter that can be passed to %matplotlib (e.g. 'inline' or 'tk'). """ import traceback from IPython.core.getipython import get_ipython generic_erro...
[ "def", "_set_mpl_backend", "(", "self", ",", "backend", ",", "pylab", "=", "False", ")", ":", "import", "traceback", "from", "IPython", ".", "core", ".", "getipython", "import", "get_ipython", "generic_error", "=", "(", "\"\\n\"", "+", "\"=\"", "*", "73", ...
Set a backend for Matplotlib. backend: A parameter that can be passed to %matplotlib (e.g. 'inline' or 'tk').
[ "Set", "a", "backend", "for", "Matplotlib", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L457-L503
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._load_autoreload_magic
def _load_autoreload_magic(self): """Load %autoreload magic.""" from IPython.core.getipython import get_ipython try: get_ipython().run_line_magic('reload_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') except Exception: pass
python
def _load_autoreload_magic(self): """Load %autoreload magic.""" from IPython.core.getipython import get_ipython try: get_ipython().run_line_magic('reload_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') except Exception: pass
[ "def", "_load_autoreload_magic", "(", "self", ")", ":", "from", "IPython", ".", "core", ".", "getipython", "import", "get_ipython", "try", ":", "get_ipython", "(", ")", ".", "run_line_magic", "(", "'reload_ext'", ",", "'autoreload'", ")", "get_ipython", "(", "...
Load %autoreload magic.
[ "Load", "%autoreload", "magic", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L511-L518
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
SpyderKernel._load_wurlitzer
def _load_wurlitzer(self): """Load wurlitzer extension.""" # Wurlitzer has no effect on Windows if not os.name == 'nt': from IPython.core.getipython import get_ipython # Enclose this in a try/except because if it fails the # console will be totally unusable. ...
python
def _load_wurlitzer(self): """Load wurlitzer extension.""" # Wurlitzer has no effect on Windows if not os.name == 'nt': from IPython.core.getipython import get_ipython # Enclose this in a try/except because if it fails the # console will be totally unusable. ...
[ "def", "_load_wurlitzer", "(", "self", ")", ":", "# Wurlitzer has no effect on Windows", "if", "not", "os", ".", "name", "==", "'nt'", ":", "from", "IPython", ".", "core", ".", "getipython", "import", "get_ipython", "# Enclose this in a try/except because if it fails th...
Load wurlitzer extension.
[ "Load", "wurlitzer", "extension", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L520-L531
spyder-ide/spyder-kernels
spyder_kernels/console/start.py
import_spydercustomize
def import_spydercustomize(): """Import our customizations into the kernel.""" here = osp.dirname(__file__) parent = osp.dirname(here) customize_dir = osp.join(parent, 'customize') # Remove current directory from sys.path to prevent kernel # crashes when people name Python files or modules with...
python
def import_spydercustomize(): """Import our customizations into the kernel.""" here = osp.dirname(__file__) parent = osp.dirname(here) customize_dir = osp.join(parent, 'customize') # Remove current directory from sys.path to prevent kernel # crashes when people name Python files or modules with...
[ "def", "import_spydercustomize", "(", ")", ":", "here", "=", "osp", ".", "dirname", "(", "__file__", ")", "parent", "=", "osp", ".", "dirname", "(", "here", ")", "customize_dir", "=", "osp", ".", "join", "(", "parent", ",", "'customize'", ")", "# Remove ...
Import our customizations into the kernel.
[ "Import", "our", "customizations", "into", "the", "kernel", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/start.py#L24-L45
spyder-ide/spyder-kernels
spyder_kernels/console/start.py
kernel_config
def kernel_config(): """Create a config object with IPython kernel options.""" import ipykernel from IPython.core.application import get_ipython_dir from traitlets.config.loader import Config, load_pyconfig_files # ---- IPython config ---- try: profile_path = osp.join(get_ipython_dir(),...
python
def kernel_config(): """Create a config object with IPython kernel options.""" import ipykernel from IPython.core.application import get_ipython_dir from traitlets.config.loader import Config, load_pyconfig_files # ---- IPython config ---- try: profile_path = osp.join(get_ipython_dir(),...
[ "def", "kernel_config", "(", ")", ":", "import", "ipykernel", "from", "IPython", ".", "core", ".", "application", "import", "get_ipython_dir", "from", "traitlets", ".", "config", ".", "loader", "import", "Config", ",", "load_pyconfig_files", "# ---- IPython config -...
Create a config object with IPython kernel options.
[ "Create", "a", "config", "object", "with", "IPython", "kernel", "options", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/start.py#L78-L250
spyder-ide/spyder-kernels
spyder_kernels/console/start.py
varexp
def varexp(line): """ Spyder's variable explorer magic Used to generate plots, histograms and images of the variables displayed on it. """ ip = get_ipython() #analysis:ignore funcname, name = line.split() try: import guiqwt.pyplot as pyplot except: import matpl...
python
def varexp(line): """ Spyder's variable explorer magic Used to generate plots, histograms and images of the variables displayed on it. """ ip = get_ipython() #analysis:ignore funcname, name = line.split() try: import guiqwt.pyplot as pyplot except: import matpl...
[ "def", "varexp", "(", "line", ")", ":", "ip", "=", "get_ipython", "(", ")", "#analysis:ignore", "funcname", ",", "name", "=", "line", ".", "split", "(", ")", "try", ":", "import", "guiqwt", ".", "pyplot", "as", "pyplot", "except", ":", "import", "matpl...
Spyder's variable explorer magic Used to generate plots, histograms and images of the variables displayed on it.
[ "Spyder", "s", "variable", "explorer", "magic" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/start.py#L253-L269
spyder-ide/spyder-kernels
spyder_kernels/utils/misc.py
fix_reference_name
def fix_reference_name(name, blacklist=None): """Return a syntax-valid Python reference name from an arbitrary name""" name = "".join(re.split(r'[^0-9a-zA-Z_]', name)) while name and not re.match(r'([a-zA-Z]+[0-9a-zA-Z_]*)$', name): if not re.match(r'[a-zA-Z]', name[0]): name = name[1:] ...
python
def fix_reference_name(name, blacklist=None): """Return a syntax-valid Python reference name from an arbitrary name""" name = "".join(re.split(r'[^0-9a-zA-Z_]', name)) while name and not re.match(r'([a-zA-Z]+[0-9a-zA-Z_]*)$', name): if not re.match(r'[a-zA-Z]', name[0]): name = name[1:] ...
[ "def", "fix_reference_name", "(", "name", ",", "blacklist", "=", "None", ")", ":", "name", "=", "\"\"", ".", "join", "(", "re", ".", "split", "(", "r'[^0-9a-zA-Z_]'", ",", "name", ")", ")", "while", "name", "and", "not", "re", ".", "match", "(", "r'(...
Return a syntax-valid Python reference name from an arbitrary name
[ "Return", "a", "syntax", "-", "valid", "Python", "reference", "name", "from", "an", "arbitrary", "name" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/misc.py#L13-L29
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
user_return
def user_return(self, frame, return_value): """This function is called when a return trap is set here.""" # This is useful when debugging in an active interpreter (otherwise, # the debugger will stop before reaching the target file) if self._wait_for_mainpyfile: if (self.mainpyfile != self.canon...
python
def user_return(self, frame, return_value): """This function is called when a return trap is set here.""" # This is useful when debugging in an active interpreter (otherwise, # the debugger will stop before reaching the target file) if self._wait_for_mainpyfile: if (self.mainpyfile != self.canon...
[ "def", "user_return", "(", "self", ",", "frame", ",", "return_value", ")", ":", "# This is useful when debugging in an active interpreter (otherwise,", "# the debugger will stop before reaching the target file)", "if", "self", ".", "_wait_for_mainpyfile", ":", "if", "(", "self"...
This function is called when a return trap is set here.
[ "This", "function", "is", "called", "when", "a", "return", "trap", "is", "set", "here", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L424-L433
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
post_mortem_excepthook
def post_mortem_excepthook(type, value, tb): """ For post mortem exception handling, print a banner and enable post mortem debugging. """ clear_post_mortem() ipython_shell = get_ipython() ipython_shell.showtraceback((type, value, tb)) p = pdb.Pdb(ipython_shell.colors) if not type ==...
python
def post_mortem_excepthook(type, value, tb): """ For post mortem exception handling, print a banner and enable post mortem debugging. """ clear_post_mortem() ipython_shell = get_ipython() ipython_shell.showtraceback((type, value, tb)) p = pdb.Pdb(ipython_shell.colors) if not type ==...
[ "def", "post_mortem_excepthook", "(", "type", ",", "value", ",", "tb", ")", ":", "clear_post_mortem", "(", ")", "ipython_shell", "=", "get_ipython", "(", ")", "ipython_shell", ".", "showtraceback", "(", "(", "type", ",", "value", ",", "tb", ")", ")", "p", ...
For post mortem exception handling, print a banner and enable post mortem debugging.
[ "For", "post", "mortem", "exception", "handling", "print", "a", "banner", "and", "enable", "post", "mortem", "debugging", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L731-L758
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
set_post_mortem
def set_post_mortem(): """ Enable the post mortem debugging excepthook. """ def ipython_post_mortem_debug(shell, etype, evalue, tb, tb_offset=None): post_mortem_excepthook(etype, evalue, tb) ipython_shell = get_ipython() ipython_shell.set_custom_exc((Exception,), ipython_p...
python
def set_post_mortem(): """ Enable the post mortem debugging excepthook. """ def ipython_post_mortem_debug(shell, etype, evalue, tb, tb_offset=None): post_mortem_excepthook(etype, evalue, tb) ipython_shell = get_ipython() ipython_shell.set_custom_exc((Exception,), ipython_p...
[ "def", "set_post_mortem", "(", ")", ":", "def", "ipython_post_mortem_debug", "(", "shell", ",", "etype", ",", "evalue", ",", "tb", ",", "tb_offset", "=", "None", ")", ":", "post_mortem_excepthook", "(", "etype", ",", "evalue", ",", "tb", ")", "ipython_shell"...
Enable the post mortem debugging excepthook.
[ "Enable", "the", "post", "mortem", "debugging", "excepthook", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L761-L769
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
runfile
def runfile(filename, args=None, wdir=None, namespace=None, post_mortem=False): """ Run filename args: command line arguments (string) wdir: working directory post_mortem: boolean, whether to enter post-mortem mode on error """ try: filename = filename.decode('utf-8') except (Uni...
python
def runfile(filename, args=None, wdir=None, namespace=None, post_mortem=False): """ Run filename args: command line arguments (string) wdir: working directory post_mortem: boolean, whether to enter post-mortem mode on error """ try: filename = filename.decode('utf-8') except (Uni...
[ "def", "runfile", "(", "filename", ",", "args", "=", "None", ",", "wdir", "=", "None", ",", "namespace", "=", "None", ",", "post_mortem", "=", "False", ")", ":", "try", ":", "filename", "=", "filename", ".", "decode", "(", "'utf-8'", ")", "except", "...
Run filename args: command line arguments (string) wdir: working directory post_mortem: boolean, whether to enter post-mortem mode on error
[ "Run", "filename", "args", ":", "command", "line", "arguments", "(", "string", ")", "wdir", ":", "working", "directory", "post_mortem", ":", "boolean", "whether", "to", "enter", "post", "-", "mortem", "mode", "on", "error" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L786-L836
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
runcell
def runcell(cellname, filename): """ Run a code cell from an editor as a file. Currently looks for code in an `ipython` property called `cell_code`. This property must be set by the editor prior to calling this function. This function deletes the contents of `cell_code` upon completion. Parame...
python
def runcell(cellname, filename): """ Run a code cell from an editor as a file. Currently looks for code in an `ipython` property called `cell_code`. This property must be set by the editor prior to calling this function. This function deletes the contents of `cell_code` upon completion. Parame...
[ "def", "runcell", "(", "cellname", ",", "filename", ")", ":", "try", ":", "filename", "=", "filename", ".", "decode", "(", "'utf-8'", ")", "except", "(", "UnicodeError", ",", "TypeError", ",", "AttributeError", ")", ":", "# UnicodeError, TypeError --> eventually...
Run a code cell from an editor as a file. Currently looks for code in an `ipython` property called `cell_code`. This property must be set by the editor prior to calling this function. This function deletes the contents of `cell_code` upon completion. Parameters ---------- cellname : str ...
[ "Run", "a", "code", "cell", "from", "an", "editor", "as", "a", "file", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L842-L881
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
debugfile
def debugfile(filename, args=None, wdir=None, post_mortem=False): """ Debug filename args: command line arguments (string) wdir: working directory post_mortem: boolean, included for compatiblity with runfile """ debugger = pdb.Pdb() filename = debugger.canonic(filename) debugger._wai...
python
def debugfile(filename, args=None, wdir=None, post_mortem=False): """ Debug filename args: command line arguments (string) wdir: working directory post_mortem: boolean, included for compatiblity with runfile """ debugger = pdb.Pdb() filename = debugger.canonic(filename) debugger._wai...
[ "def", "debugfile", "(", "filename", ",", "args", "=", "None", ",", "wdir", "=", "None", ",", "post_mortem", "=", "False", ")", ":", "debugger", "=", "pdb", ".", "Pdb", "(", ")", "filename", "=", "debugger", ".", "canonic", "(", "filename", ")", "deb...
Debug filename args: command line arguments (string) wdir: working directory post_mortem: boolean, included for compatiblity with runfile
[ "Debug", "filename", "args", ":", "command", "line", "arguments", "(", "string", ")", "wdir", ":", "working", "directory", "post_mortem", ":", "boolean", "included", "for", "compatiblity", "with", "runfile" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L887-L901
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
UserModuleReloader.create_pathlist
def create_pathlist(self, initial_pathlist): """ Add to pathlist Python library paths to be skipped from module reloading. """ # Get standard installation paths try: paths = sysconfig.get_paths() standard_paths = [paths['stdlib'], ...
python
def create_pathlist(self, initial_pathlist): """ Add to pathlist Python library paths to be skipped from module reloading. """ # Get standard installation paths try: paths = sysconfig.get_paths() standard_paths = [paths['stdlib'], ...
[ "def", "create_pathlist", "(", "self", ",", "initial_pathlist", ")", ":", "# Get standard installation paths", "try", ":", "paths", "=", "sysconfig", ".", "get_paths", "(", ")", "standard_paths", "=", "[", "paths", "[", "'stdlib'", "]", ",", "paths", "[", "'pu...
Add to pathlist Python library paths to be skipped from module reloading.
[ "Add", "to", "pathlist", "Python", "library", "paths", "to", "be", "skipped", "from", "module", "reloading", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L573-L605
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
UserModuleReloader.is_module_reloadable
def is_module_reloadable(self, module, modname): """Decide if a module is reloadable or not.""" if self.has_cython: # Don't return cached inline compiled .PYX files return False else: if (self.is_module_in_pathlist(module) or self.is_module...
python
def is_module_reloadable(self, module, modname): """Decide if a module is reloadable or not.""" if self.has_cython: # Don't return cached inline compiled .PYX files return False else: if (self.is_module_in_pathlist(module) or self.is_module...
[ "def", "is_module_reloadable", "(", "self", ",", "module", ",", "modname", ")", ":", "if", "self", ".", "has_cython", ":", "# Don't return cached inline compiled .PYX files", "return", "False", "else", ":", "if", "(", "self", ".", "is_module_in_pathlist", "(", "mo...
Decide if a module is reloadable or not.
[ "Decide", "if", "a", "module", "is", "reloadable", "or", "not", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L607-L617
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
UserModuleReloader.is_module_in_pathlist
def is_module_in_pathlist(self, module): """Decide if a module can be reloaded or not according to its path.""" modpath = getattr(module, '__file__', None) # Skip module according to different criteria if modpath is None: # *module* is a C module that is statically linked in...
python
def is_module_in_pathlist(self, module): """Decide if a module can be reloaded or not according to its path.""" modpath = getattr(module, '__file__', None) # Skip module according to different criteria if modpath is None: # *module* is a C module that is statically linked in...
[ "def", "is_module_in_pathlist", "(", "self", ",", "module", ")", ":", "modpath", "=", "getattr", "(", "module", ",", "'__file__'", ",", "None", ")", "# Skip module according to different criteria", "if", "modpath", "is", "None", ":", "# *module* is a C module that is ...
Decide if a module can be reloaded or not according to its path.
[ "Decide", "if", "a", "module", "can", "be", "reloaded", "or", "not", "according", "to", "its", "path", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L623-L656
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
UserModuleReloader.activate_cython
def activate_cython(self): """ Activate Cython support. We need to run this here because if the support is active, we don't to run the UMR at all. """ run_cython = os.environ.get("SPY_RUN_CYTHON") == "True" if run_cython: try: __impor...
python
def activate_cython(self): """ Activate Cython support. We need to run this here because if the support is active, we don't to run the UMR at all. """ run_cython = os.environ.get("SPY_RUN_CYTHON") == "True" if run_cython: try: __impor...
[ "def", "activate_cython", "(", "self", ")", ":", "run_cython", "=", "os", ".", "environ", ".", "get", "(", "\"SPY_RUN_CYTHON\"", ")", "==", "\"True\"", "if", "run_cython", ":", "try", ":", "__import__", "(", "'Cython'", ")", "self", ".", "has_cython", "=",...
Activate Cython support. We need to run this here because if the support is active, we don't to run the UMR at all.
[ "Activate", "Cython", "support", "." ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L658-L689
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
UserModuleReloader.run
def run(self): """ Delete user modules to force Python to deeply reload them Do not del modules which are considered as system modules, i.e. modules installed in subdirectories of Python interpreter's binary Do not del C modules """ self.modnames_to_reload = [] ...
python
def run(self): """ Delete user modules to force Python to deeply reload them Do not del modules which are considered as system modules, i.e. modules installed in subdirectories of Python interpreter's binary Do not del C modules """ self.modnames_to_reload = [] ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "modnames_to_reload", "=", "[", "]", "for", "modname", ",", "module", "in", "list", "(", "sys", ".", "modules", ".", "items", "(", ")", ")", ":", "if", "modname", "not", "in", "self", ".", "previous...
Delete user modules to force Python to deeply reload them Do not del modules which are considered as system modules, i.e. modules installed in subdirectories of Python interpreter's binary Do not del C modules
[ "Delete", "user", "modules", "to", "force", "Python", "to", "deeply", "reload", "them" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L691-L713
spyder-ide/spyder-kernels
spyder_kernels/utils/iofuncs.py
get_matlab_value
def get_matlab_value(val): """ Extract a value from a Matlab file From the oct2py project, see https://pythonhosted.org/oct2py/conversions.html """ import numpy as np # Extract each item of a list. if isinstance(val, list): return [get_matlab_value(v) for v in val] # Ignor...
python
def get_matlab_value(val): """ Extract a value from a Matlab file From the oct2py project, see https://pythonhosted.org/oct2py/conversions.html """ import numpy as np # Extract each item of a list. if isinstance(val, list): return [get_matlab_value(v) for v in val] # Ignor...
[ "def", "get_matlab_value", "(", "val", ")", ":", "import", "numpy", "as", "np", "# Extract each item of a list.", "if", "isinstance", "(", "val", ",", "list", ")", ":", "return", "[", "get_matlab_value", "(", "v", ")", "for", "v", "in", "val", "]", "# Igno...
Extract a value from a Matlab file From the oct2py project, see https://pythonhosted.org/oct2py/conversions.html
[ "Extract", "a", "value", "from", "a", "Matlab", "file" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/iofuncs.py#L106-L156
spyder-ide/spyder-kernels
spyder_kernels/utils/iofuncs.py
load_pickle
def load_pickle(filename): """Load a pickle file as a dictionary""" try: if pd: return pd.read_pickle(filename), None else: with open(filename, 'rb') as fid: data = pickle.load(fid) return data, None except Exception as err: return ...
python
def load_pickle(filename): """Load a pickle file as a dictionary""" try: if pd: return pd.read_pickle(filename), None else: with open(filename, 'rb') as fid: data = pickle.load(fid) return data, None except Exception as err: return ...
[ "def", "load_pickle", "(", "filename", ")", ":", "try", ":", "if", "pd", ":", "return", "pd", ".", "read_pickle", "(", "filename", ")", ",", "None", "else", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fid", ":", "data", "=", "pic...
Load a pickle file as a dictionary
[ "Load", "a", "pickle", "file", "as", "a", "dictionary" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/iofuncs.py#L260-L270
spyder-ide/spyder-kernels
spyder_kernels/utils/iofuncs.py
load_json
def load_json(filename): """Load a json file as a dictionary""" try: if PY2: args = 'rb' else: args = 'r' with open(filename, args) as fid: data = json.load(fid) return data, None except Exception as err: return None, str(err)
python
def load_json(filename): """Load a json file as a dictionary""" try: if PY2: args = 'rb' else: args = 'r' with open(filename, args) as fid: data = json.load(fid) return data, None except Exception as err: return None, str(err)
[ "def", "load_json", "(", "filename", ")", ":", "try", ":", "if", "PY2", ":", "args", "=", "'rb'", "else", ":", "args", "=", "'r'", "with", "open", "(", "filename", ",", "args", ")", "as", "fid", ":", "data", "=", "json", ".", "load", "(", "fid", ...
Load a json file as a dictionary
[ "Load", "a", "json", "file", "as", "a", "dictionary" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/iofuncs.py#L273-L284
spyder-ide/spyder-kernels
spyder_kernels/utils/iofuncs.py
save_dictionary
def save_dictionary(data, filename): """Save dictionary in a single file .spydata file""" filename = osp.abspath(filename) old_cwd = getcwd() os.chdir(osp.dirname(filename)) error_message = None skipped_keys = [] data_copy = {} try: # Copy dictionary before modifying it to fix #...
python
def save_dictionary(data, filename): """Save dictionary in a single file .spydata file""" filename = osp.abspath(filename) old_cwd = getcwd() os.chdir(osp.dirname(filename)) error_message = None skipped_keys = [] data_copy = {} try: # Copy dictionary before modifying it to fix #...
[ "def", "save_dictionary", "(", "data", ",", "filename", ")", ":", "filename", "=", "osp", ".", "abspath", "(", "filename", ")", "old_cwd", "=", "getcwd", "(", ")", "os", ".", "chdir", "(", "osp", ".", "dirname", "(", "filename", ")", ")", "error_messag...
Save dictionary in a single file .spydata file
[ "Save", "dictionary", "in", "a", "single", "file", ".", "spydata", "file" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/iofuncs.py#L287-L389
spyder-ide/spyder-kernels
spyder_kernels/utils/iofuncs.py
load_dictionary
def load_dictionary(filename): """Load dictionary from .spydata file""" filename = osp.abspath(filename) old_cwd = getcwd() tmp_folder = tempfile.mkdtemp() os.chdir(tmp_folder) data = None error_message = None try: with tarfile.open(filename, "r") as tar: tar.extracta...
python
def load_dictionary(filename): """Load dictionary from .spydata file""" filename = osp.abspath(filename) old_cwd = getcwd() tmp_folder = tempfile.mkdtemp() os.chdir(tmp_folder) data = None error_message = None try: with tarfile.open(filename, "r") as tar: tar.extracta...
[ "def", "load_dictionary", "(", "filename", ")", ":", "filename", "=", "osp", ".", "abspath", "(", "filename", ")", "old_cwd", "=", "getcwd", "(", ")", "tmp_folder", "=", "tempfile", ".", "mkdtemp", "(", ")", "os", ".", "chdir", "(", "tmp_folder", ")", ...
Load dictionary from .spydata file
[ "Load", "dictionary", "from", ".", "spydata", "file" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/iofuncs.py#L392-L432
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getobj
def getobj(txt, last=False): """Return the last valid object name in string""" txt_end = "" for startchar, endchar in ["[]", "()"]: if txt.endswith(endchar): pos = txt.rfind(startchar) if pos: txt_end = txt[pos:] txt = txt[:pos] tokens = re...
python
def getobj(txt, last=False): """Return the last valid object name in string""" txt_end = "" for startchar, endchar in ["[]", "()"]: if txt.endswith(endchar): pos = txt.rfind(startchar) if pos: txt_end = txt[pos:] txt = txt[:pos] tokens = re...
[ "def", "getobj", "(", "txt", ",", "last", "=", "False", ")", ":", "txt_end", "=", "\"\"", "for", "startchar", ",", "endchar", "in", "[", "\"[]\"", ",", "\"()\"", "]", ":", "if", "txt", ".", "endswith", "(", "endchar", ")", ":", "pos", "=", "txt", ...
Return the last valid object name in string
[ "Return", "the", "last", "valid", "object", "name", "in", "string" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L25-L51
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getdoc
def getdoc(obj): """ Return text documentation from an object. This comes in a form of dictionary with four keys: name: The name of the inspected object argspec: It's argspec note: A phrase describing the type of object (function or method) we are inspecting, and the mod...
python
def getdoc(obj): """ Return text documentation from an object. This comes in a form of dictionary with four keys: name: The name of the inspected object argspec: It's argspec note: A phrase describing the type of object (function or method) we are inspecting, and the mod...
[ "def", "getdoc", "(", "obj", ")", ":", "docstring", "=", "inspect", ".", "getdoc", "(", "obj", ")", "or", "inspect", ".", "getcomments", "(", "obj", ")", "or", "''", "# Most of the time doc will only contain ascii characters, but there are", "# some docstrings that co...
Return text documentation from an object. This comes in a form of dictionary with four keys: name: The name of the inspected object argspec: It's argspec note: A phrase describing the type of object (function or method) we are inspecting, and the module it belongs to. docstr...
[ "Return", "text", "documentation", "from", "an", "object", ".", "This", "comes", "in", "a", "form", "of", "dictionary", "with", "four", "keys", ":" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L63-L157
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getsource
def getsource(obj): """Wrapper around inspect.getsource""" try: try: src = to_text_string(inspect.getsource(obj)) except TypeError: if hasattr(obj, '__class__'): src = to_text_string(inspect.getsource(obj.__class__)) else: # Bin...
python
def getsource(obj): """Wrapper around inspect.getsource""" try: try: src = to_text_string(inspect.getsource(obj)) except TypeError: if hasattr(obj, '__class__'): src = to_text_string(inspect.getsource(obj.__class__)) else: # Bin...
[ "def", "getsource", "(", "obj", ")", ":", "try", ":", "try", ":", "src", "=", "to_text_string", "(", "inspect", ".", "getsource", "(", "obj", ")", ")", "except", "TypeError", ":", "if", "hasattr", "(", "obj", ",", "'__class__'", ")", ":", "src", "=",...
Wrapper around inspect.getsource
[ "Wrapper", "around", "inspect", ".", "getsource" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L160-L173
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getsignaturefromtext
def getsignaturefromtext(text, objname): """Get object signatures from text (object documentation) Return a list containing a single string in most cases Example of multiple signatures: PyQt5 objects""" if isinstance(text, dict): text = text.get('docstring', '') # Regexps oneline_re = ob...
python
def getsignaturefromtext(text, objname): """Get object signatures from text (object documentation) Return a list containing a single string in most cases Example of multiple signatures: PyQt5 objects""" if isinstance(text, dict): text = text.get('docstring', '') # Regexps oneline_re = ob...
[ "def", "getsignaturefromtext", "(", "text", ",", "objname", ")", ":", "if", "isinstance", "(", "text", ",", "dict", ")", ":", "text", "=", "text", ".", "get", "(", "'docstring'", ",", "''", ")", "# Regexps", "oneline_re", "=", "objname", "+", "r'\\([^\\)...
Get object signatures from text (object documentation) Return a list containing a single string in most cases Example of multiple signatures: PyQt5 objects
[ "Get", "object", "signatures", "from", "text", "(", "object", "documentation", ")", "Return", "a", "list", "containing", "a", "single", "string", "in", "most", "cases", "Example", "of", "multiple", "signatures", ":", "PyQt5", "objects" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L176-L197
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getargspecfromtext
def getargspecfromtext(text): """ Try to get the formatted argspec of a callable from the first block of its docstring This will return something like '(foo, bar, k=1)' """ blocks = text.split("\n\n") first_block = blocks[0].strip() return getsignaturefromtext(first_block, '')
python
def getargspecfromtext(text): """ Try to get the formatted argspec of a callable from the first block of its docstring This will return something like '(foo, bar, k=1)' """ blocks = text.split("\n\n") first_block = blocks[0].strip() return getsignaturefromtext(first_block, '')
[ "def", "getargspecfromtext", "(", "text", ")", ":", "blocks", "=", "text", ".", "split", "(", "\"\\n\\n\"", ")", "first_block", "=", "blocks", "[", "0", "]", ".", "strip", "(", ")", "return", "getsignaturefromtext", "(", "first_block", ",", "''", ")" ]
Try to get the formatted argspec of a callable from the first block of its docstring This will return something like '(foo, bar, k=1)'
[ "Try", "to", "get", "the", "formatted", "argspec", "of", "a", "callable", "from", "the", "first", "block", "of", "its", "docstring", "This", "will", "return", "something", "like", "(", "foo", "bar", "k", "=", "1", ")" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L204-L214
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getargsfromtext
def getargsfromtext(text, objname): """Get arguments from text (object documentation)""" signature = getsignaturefromtext(text, objname) if signature: argtxt = signature[signature.find('(')+1:-1] return argtxt.split(',')
python
def getargsfromtext(text, objname): """Get arguments from text (object documentation)""" signature = getsignaturefromtext(text, objname) if signature: argtxt = signature[signature.find('(')+1:-1] return argtxt.split(',')
[ "def", "getargsfromtext", "(", "text", ",", "objname", ")", ":", "signature", "=", "getsignaturefromtext", "(", "text", ",", "objname", ")", "if", "signature", ":", "argtxt", "=", "signature", "[", "signature", ".", "find", "(", "'('", ")", "+", "1", ":"...
Get arguments from text (object documentation)
[ "Get", "arguments", "from", "text", "(", "object", "documentation", ")" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L217-L222
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getargs
def getargs(obj): """Get the names and default values of a function's arguments""" if inspect.isfunction(obj) or inspect.isbuiltin(obj): func_obj = obj elif inspect.ismethod(obj): func_obj = get_meth_func(obj) elif inspect.isclass(obj) and hasattr(obj, '__init__'): func_obj = get...
python
def getargs(obj): """Get the names and default values of a function's arguments""" if inspect.isfunction(obj) or inspect.isbuiltin(obj): func_obj = obj elif inspect.ismethod(obj): func_obj = get_meth_func(obj) elif inspect.isclass(obj) and hasattr(obj, '__init__'): func_obj = get...
[ "def", "getargs", "(", "obj", ")", ":", "if", "inspect", ".", "isfunction", "(", "obj", ")", "or", "inspect", ".", "isbuiltin", "(", "obj", ")", ":", "func_obj", "=", "obj", "elif", "inspect", ".", "ismethod", "(", "obj", ")", ":", "func_obj", "=", ...
Get the names and default values of a function's arguments
[ "Get", "the", "names", "and", "default", "values", "of", "a", "function", "s", "arguments" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L231-L267
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
getargtxt
def getargtxt(obj, one_arg_per_line=True): """ Get the names and default values of a function's arguments Return list with separators (', ') formatted for calltips """ args = getargs(obj) if args: sep = ', ' textlist = None for i_arg, arg in enumerate(args): i...
python
def getargtxt(obj, one_arg_per_line=True): """ Get the names and default values of a function's arguments Return list with separators (', ') formatted for calltips """ args = getargs(obj) if args: sep = ', ' textlist = None for i_arg, arg in enumerate(args): i...
[ "def", "getargtxt", "(", "obj", ",", "one_arg_per_line", "=", "True", ")", ":", "args", "=", "getargs", "(", "obj", ")", "if", "args", ":", "sep", "=", "', '", "textlist", "=", "None", "for", "i_arg", ",", "arg", "in", "enumerate", "(", "args", ")", ...
Get the names and default values of a function's arguments Return list with separators (', ') formatted for calltips
[ "Get", "the", "names", "and", "default", "values", "of", "a", "function", "s", "arguments", "Return", "list", "with", "separators", "(", ")", "formatted", "for", "calltips" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L270-L292
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
isdefined
def isdefined(obj, force_import=False, namespace=None): """Return True if object is defined in namespace If namespace is None --> namespace = locals()""" if namespace is None: namespace = locals() attr_list = obj.split('.') base = attr_list.pop(0) if len(base) == 0: return False ...
python
def isdefined(obj, force_import=False, namespace=None): """Return True if object is defined in namespace If namespace is None --> namespace = locals()""" if namespace is None: namespace = locals() attr_list = obj.split('.') base = attr_list.pop(0) if len(base) == 0: return False ...
[ "def", "isdefined", "(", "obj", ",", "force_import", "=", "False", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "is", "None", ":", "namespace", "=", "locals", "(", ")", "attr_list", "=", "obj", ".", "split", "(", "'.'", ")", "base", "=...
Return True if object is defined in namespace If namespace is None --> namespace = locals()
[ "Return", "True", "if", "object", "is", "defined", "in", "namespace", "If", "namespace", "is", "None", "--", ">", "namespace", "=", "locals", "()" ]
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L295-L329
swift-nav/libsbp
python/sbp/client/drivers/file_driver.py
FileDriver.read
def read(self, size): """ Read wrapper. Parameters ---------- size : int Number of bytes to read. """ return_val = self.handle.read(size) if not return_val: raise IOError else: return return_val
python
def read(self, size): """ Read wrapper. Parameters ---------- size : int Number of bytes to read. """ return_val = self.handle.read(size) if not return_val: raise IOError else: return return_val
[ "def", "read", "(", "self", ",", "size", ")", ":", "return_val", "=", "self", ".", "handle", ".", "read", "(", "size", ")", "if", "not", "return_val", ":", "raise", "IOError", "else", ":", "return", "return_val" ]
Read wrapper. Parameters ---------- size : int Number of bytes to read.
[ "Read", "wrapper", "." ]
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/file_driver.py#L25-L38
swift-nav/libsbp
generator/sbpg/targets/latex.py
escape_tex
def escape_tex(value): """ Make text tex safe """ newval = value for pattern, replacement in LATEX_SUBS: newval = pattern.sub(replacement, newval) return newval
python
def escape_tex(value): """ Make text tex safe """ newval = value for pattern, replacement in LATEX_SUBS: newval = pattern.sub(replacement, newval) return newval
[ "def", "escape_tex", "(", "value", ")", ":", "newval", "=", "value", "for", "pattern", ",", "replacement", "in", "LATEX_SUBS", ":", "newval", "=", "pattern", ".", "sub", "(", "replacement", ",", "newval", ")", "return", "newval" ]
Make text tex safe
[ "Make", "text", "tex", "safe" ]
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/latex.py#L55-L62
swift-nav/libsbp
generator/sbpg/targets/latex.py
classnameify
def classnameify(s): """ Makes a classname """ return ''.join(w if w in ACRONYMS else w.title() for w in s.split('_'))
python
def classnameify(s): """ Makes a classname """ return ''.join(w if w in ACRONYMS else w.title() for w in s.split('_'))
[ "def", "classnameify", "(", "s", ")", ":", "return", "''", ".", "join", "(", "w", "if", "w", "in", "ACRONYMS", "else", "w", ".", "title", "(", ")", "for", "w", "in", "s", ".", "split", "(", "'_'", ")", ")" ]
Makes a classname
[ "Makes", "a", "classname" ]
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/latex.py#L64-L68
swift-nav/libsbp
generator/sbpg/targets/latex.py
packagenameify
def packagenameify(s): """ Makes a package name """ return ''.join(w if w in ACRONYMS else w.title() for w in s.split('.')[-1:])
python
def packagenameify(s): """ Makes a package name """ return ''.join(w if w in ACRONYMS else w.title() for w in s.split('.')[-1:])
[ "def", "packagenameify", "(", "s", ")", ":", "return", "''", ".", "join", "(", "w", "if", "w", "in", "ACRONYMS", "else", "w", ".", "title", "(", ")", "for", "w", "in", "s", ".", "split", "(", "'.'", ")", "[", "-", "1", ":", "]", ")" ]
Makes a package name
[ "Makes", "a", "package", "name" ]
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/latex.py#L73-L77
swift-nav/libsbp
generator/sbpg/targets/latex.py
handle_fields
def handle_fields(definitions, fields, prefix, offset, multiplier): """ Helper for handling naming and sizing of fields. It's terrible. """ items = [] for f in fields: if f.type_id == "array" and f.options['fill'].value in CONSTRUCT_CODE: prefix_name = '.'.join([prefix, f.identifier]) if prefix else...
python
def handle_fields(definitions, fields, prefix, offset, multiplier): """ Helper for handling naming and sizing of fields. It's terrible. """ items = [] for f in fields: if f.type_id == "array" and f.options['fill'].value in CONSTRUCT_CODE: prefix_name = '.'.join([prefix, f.identifier]) if prefix else...
[ "def", "handle_fields", "(", "definitions", ",", "fields", ",", "prefix", ",", "offset", ",", "multiplier", ")", ":", "items", "=", "[", "]", "for", "f", "in", "fields", ":", "if", "f", ".", "type_id", "==", "\"array\"", "and", "f", ".", "options", "...
Helper for handling naming and sizing of fields. It's terrible.
[ "Helper", "for", "handling", "naming", "and", "sizing", "of", "fields", ".", "It", "s", "terrible", "." ]
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/latex.py#L168-L253