body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
3b98f559db1ea58165f30a3ac7778a52f0ef13d8e0486cd210c6e49d792bdef2 | def load_roi_data(roi_trace_path):
'\n load_roi_data(roi_trace_path)\n\n Returns ROI data from ROI data file. \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ... | load_roi_data(roi_trace_path)
Returns ROI data from ROI data file.
Required args:
- roi_trace_path (Path): full path name of the ROI data file
Returns:
- roi_ids (list) : ROI IDs
- nrois (int) : total number of ROIs
- tot_twop_fr (int): total number of two-photon frames recorded | sess_util/sess_trace_util.py | load_roi_data | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def load_roi_data(roi_trace_path):
'\n load_roi_data(roi_trace_path)\n\n Returns ROI data from ROI data file. \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ... | def load_roi_data(roi_trace_path):
'\n load_roi_data(roi_trace_path)\n\n Returns ROI data from ROI data file. \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ... |
eef42d2465078e695163bd765c02d114a829b2e9c1e0f42809a5264729a689d7 | def get_roi_locations(roi_extract_dict):
'\n get_roi_locations(roi_extract_dict)\n\n Returns ROI locations, extracted from ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns \n - roi_locations (pd DataFrame): ROI locations dataf... | get_roi_locations(roi_extract_dict)
Returns ROI locations, extracted from ROI extraction dictionary.
Required args:
- roi_extract_dict (dict): ROI extraction dictionary
Returns
- roi_locations (pd DataFrame): ROI locations dataframe | sess_util/sess_trace_util.py | get_roi_locations | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_roi_locations(roi_extract_dict):
'\n get_roi_locations(roi_extract_dict)\n\n Returns ROI locations, extracted from ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns \n - roi_locations (pd DataFrame): ROI locations dataf... | def get_roi_locations(roi_extract_dict):
'\n get_roi_locations(roi_extract_dict)\n\n Returns ROI locations, extracted from ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns \n - roi_locations (pd DataFrame): ROI locations dataf... |
1f94ad7bce4a29b4551145d5ea2c3a3fdc4bc0cfd8d3d7c6af0982246f02d825 | def add_cell_specimen_ids_to_roi_metrics(roi_metrics, roi_locations):
'\n Returns ROI metrics dataframe with ROI IDs added.\n\n Required args:\n - roi_metrics (pd DataFrame) : ROI metrics dataframe\n - roi_locations (pd DataFrame): ROI locations dataframe\n \n Returns:\n - roi_metr... | Returns ROI metrics dataframe with ROI IDs added.
Required args:
- roi_metrics (pd DataFrame) : ROI metrics dataframe
- roi_locations (pd DataFrame): ROI locations dataframe
Returns:
- roi_metrics (pd DataFrame): ROI metrics dataframe updated with
locations information | sess_util/sess_trace_util.py | add_cell_specimen_ids_to_roi_metrics | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def add_cell_specimen_ids_to_roi_metrics(roi_metrics, roi_locations):
'\n Returns ROI metrics dataframe with ROI IDs added.\n\n Required args:\n - roi_metrics (pd DataFrame) : ROI metrics dataframe\n - roi_locations (pd DataFrame): ROI locations dataframe\n \n Returns:\n - roi_metr... | def add_cell_specimen_ids_to_roi_metrics(roi_metrics, roi_locations):
'\n Returns ROI metrics dataframe with ROI IDs added.\n\n Required args:\n - roi_metrics (pd DataFrame) : ROI metrics dataframe\n - roi_locations (pd DataFrame): ROI locations dataframe\n \n Returns:\n - roi_metr... |
94b2ec0ab57be35268ee6051479d751202d21615b89a3fd844f2c35006a923d1 | def get_motion_border(roi_extract_dict):
'\n get_motion_border(roi_extract_dict)\n\n Returns motion border for motion corrected stack.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns:\n - motion border (list): motion border values for [x0, x1, y1, y0]\... | get_motion_border(roi_extract_dict)
Returns motion border for motion corrected stack.
Required args:
- roi_extract_dict (dict): ROI extraction dictionary
Returns:
- motion border (list): motion border values for [x0, x1, y1, y0]
(right, left, down, up shifts) | sess_util/sess_trace_util.py | get_motion_border | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_motion_border(roi_extract_dict):
'\n get_motion_border(roi_extract_dict)\n\n Returns motion border for motion corrected stack.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns:\n - motion border (list): motion border values for [x0, x1, y1, y0]\... | def get_motion_border(roi_extract_dict):
'\n get_motion_border(roi_extract_dict)\n\n Returns motion border for motion corrected stack.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n\n Returns:\n - motion border (list): motion border values for [x0, x1, y1, y0]\... |
f4c5bc7ce1d7145bc42dce668daedf8f4c2272d03a51379980455bf309f98d7e | def get_roi_metrics(roi_extract_dict, objectlist_txt):
'\n get_roi_metrics(roi_extract_dict, objectlist_txt)\n\n Returns ROI metrics loaded from object list file and updated based on \n ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n -... | get_roi_metrics(roi_extract_dict, objectlist_txt)
Returns ROI metrics loaded from object list file and updated based on
ROI extraction dictionary.
Required args:
- roi_extract_dict (dict): ROI extraction dictionary
- objectlist_txt (Path) : path to object list containing ROI metrics
Returns:
- roi_metr... | sess_util/sess_trace_util.py | get_roi_metrics | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_roi_metrics(roi_extract_dict, objectlist_txt):
'\n get_roi_metrics(roi_extract_dict, objectlist_txt)\n\n Returns ROI metrics loaded from object list file and updated based on \n ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n -... | def get_roi_metrics(roi_extract_dict, objectlist_txt):
'\n get_roi_metrics(roi_extract_dict, objectlist_txt)\n\n Returns ROI metrics loaded from object list file and updated based on \n ROI extraction dictionary.\n\n Required args:\n - roi_extract_dict (dict): ROI extraction dictionary\n -... |
07ec2e9a107aa62450364dc1ec7e354731b66f7cb6817e2f2f621db383d707a7 | def get_tracked_rois(nway_match_path, idx_after_rem_bad=False):
'\n get_tracked_rois(nway_match_path)\n\n Returns ROI tracking indices.\n\n Required args:\n - nway_match_path (Path): path to nway matching file\n \n Optional args:\n - idx_after_rem_bad (bool): if True, the ROI indice... | get_tracked_rois(nway_match_path)
Returns ROI tracking indices.
Required args:
- nway_match_path (Path): path to nway matching file
Optional args:
- idx_after_rem_bad (bool): if True, the ROI indices are shifted to
as if bad ROIs did not exist
... | sess_util/sess_trace_util.py | get_tracked_rois | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_tracked_rois(nway_match_path, idx_after_rem_bad=False):
'\n get_tracked_rois(nway_match_path)\n\n Returns ROI tracking indices.\n\n Required args:\n - nway_match_path (Path): path to nway matching file\n \n Optional args:\n - idx_after_rem_bad (bool): if True, the ROI indice... | def get_tracked_rois(nway_match_path, idx_after_rem_bad=False):
'\n get_tracked_rois(nway_match_path)\n\n Returns ROI tracking indices.\n\n Required args:\n - nway_match_path (Path): path to nway matching file\n \n Optional args:\n - idx_after_rem_bad (bool): if True, the ROI indice... |
a60e170ecaff86cc091e4d6b4eeb764562fa1dd6932eb6ef37035e36bdffb378 | def get_tracked_rois_nwb(sess_files):
'\n get_tracked_rois_nwb(sess_files)\n\n Returns ROI tracking indices.\n\n Required args:\n - sess_files (list): full path names of the session files\n \n Returns:\n - tracked_rois (1D array): ordered indices of tracked ROIs\n '
ophys_fil... | get_tracked_rois_nwb(sess_files)
Returns ROI tracking indices.
Required args:
- sess_files (list): full path names of the session files
Returns:
- tracked_rois (1D array): ordered indices of tracked ROIs | sess_util/sess_trace_util.py | get_tracked_rois_nwb | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_tracked_rois_nwb(sess_files):
'\n get_tracked_rois_nwb(sess_files)\n\n Returns ROI tracking indices.\n\n Required args:\n - sess_files (list): full path names of the session files\n \n Returns:\n - tracked_rois (1D array): ordered indices of tracked ROIs\n '
ophys_fil... | def get_tracked_rois_nwb(sess_files):
'\n get_tracked_rois_nwb(sess_files)\n\n Returns ROI tracking indices.\n\n Required args:\n - sess_files (list): full path names of the session files\n \n Returns:\n - tracked_rois (1D array): ordered indices of tracked ROIs\n '
ophys_fil... |
cba4452201bbe7cbeab0a0a7ae1801a8444a682d9f14e6cb91e243aaadb83878 | def process_roi_masks(roi_masks, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n process_roi_masks(roi_masks)\n\n Required args:\n - roi_masks (3D): ROI masks (ROI x hei x wid)\n\n Optional args:\n - mask_threshold (float): minimum value in non-boolean mask to\n ... | process_roi_masks(roi_masks)
Required args:
- roi_masks (3D): ROI masks (ROI x hei x wid)
Optional args:
- mask_threshold (float): minimum value in non-boolean mask to
retain a pixel in an ROI mask
default: MASK_THRESHOLD
- min_n_pix (int) ... | sess_util/sess_trace_util.py | process_roi_masks | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def process_roi_masks(roi_masks, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n process_roi_masks(roi_masks)\n\n Required args:\n - roi_masks (3D): ROI masks (ROI x hei x wid)\n\n Optional args:\n - mask_threshold (float): minimum value in non-boolean mask to\n ... | def process_roi_masks(roi_masks, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n process_roi_masks(roi_masks)\n\n Required args:\n - roi_masks (3D): ROI masks (ROI x hei x wid)\n\n Optional args:\n - mask_threshold (float): minimum value in non-boolean mask to\n ... |
1af509f9d743762f1e36f95c535fa8ca059ee48a745fcf9d83aca1311d463e7d | def get_roi_masks_nwb(sess_files, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks_nwb(sess_files)\n\n Returns tracked ROIs, optionally converted to boolean.\n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Optional args:\n ... | get_roi_masks_nwb(sess_files)
Returns tracked ROIs, optionally converted to boolean.
Required args:
- sess_files (Path): full path names of the session files
Optional args:
- mask_threshold (float): minimum value in non-boolean mask to
retain a pixel in an ROI mask
... | sess_util/sess_trace_util.py | get_roi_masks_nwb | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_roi_masks_nwb(sess_files, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks_nwb(sess_files)\n\n Returns tracked ROIs, optionally converted to boolean.\n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Optional args:\n ... | def get_roi_masks_nwb(sess_files, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks_nwb(sess_files)\n\n Returns tracked ROIs, optionally converted to boolean.\n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Optional args:\n ... |
759afbaf5aa541dbfa354f880241002b1186e8845f47e8b3b2f6f5bc8a756480 | def get_roi_masks(mask_file=None, roi_extract_json=None, objectlist_txt=None, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks()\n\n Returns ROI masks, loaded either from an h5 or json file, and optionally \n converted to boolean.\n\n NOTE: If masks are loaded from ... | get_roi_masks()
Returns ROI masks, loaded either from an h5 or json file, and optionally
converted to boolean.
NOTE: If masks are loaded from roi_extract_json, they are already boolean.
Optional args:
- mask_file (Path) : ROI mask h5. If None, roi_extract_json and
objectlis... | sess_util/sess_trace_util.py | get_roi_masks | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_roi_masks(mask_file=None, roi_extract_json=None, objectlist_txt=None, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks()\n\n Returns ROI masks, loaded either from an h5 or json file, and optionally \n converted to boolean.\n\n NOTE: If masks are loaded from ... | def get_roi_masks(mask_file=None, roi_extract_json=None, objectlist_txt=None, mask_threshold=MASK_THRESHOLD, min_n_pix=MIN_N_PIX, make_bool=True):
'\n get_roi_masks()\n\n Returns ROI masks, loaded either from an h5 or json file, and optionally \n converted to boolean.\n\n NOTE: If masks are loaded from ... |
fbcba9b966ba57897b0968f8cdcbf8b460e307905e0391bc4be9e6ef17eb5397 | def get_valid_mask(roi_objs, neuropil_trace=None):
'\n validate_masks(roi_objs)\n\n Returns a boolean mask for valid ROIs using the following exclusion \n criteria: duplicate, empty, motion_border, union, empty_neuropil (optional).\n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... | validate_masks(roi_objs)
Returns a boolean mask for valid ROIs using the following exclusion
criteria: duplicate, empty, motion_border, union, empty_neuropil (optional).
Required args:
- roi_objs (ROI objects): ROI objects
Optional args:
- neuropil_traces (list) : neuropil traces from which to infer empty
... | sess_util/sess_trace_util.py | get_valid_mask | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_valid_mask(roi_objs, neuropil_trace=None):
'\n validate_masks(roi_objs)\n\n Returns a boolean mask for valid ROIs using the following exclusion \n criteria: duplicate, empty, motion_border, union, empty_neuropil (optional).\n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... | def get_valid_mask(roi_objs, neuropil_trace=None):
'\n validate_masks(roi_objs)\n\n Returns a boolean mask for valid ROIs using the following exclusion \n criteria: duplicate, empty, motion_border, union, empty_neuropil (optional).\n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... |
065bcc20abb6c81e28a1bd706e340d3452e0f7b8c8020afa26b952bd276c0f4c | def validate_masks(roi_objs, neuropil_traces=None):
'\n validate_masks(roi_objs)\n\n Returns a dictionary with exclusion ROI masks for each exclusion criterion \n ("duplicate", "empty", "motion_border", "union", "empty_neuropil"). \n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... | validate_masks(roi_objs)
Returns a dictionary with exclusion ROI masks for each exclusion criterion
("duplicate", "empty", "motion_border", "union", "empty_neuropil").
Required args:
- roi_objs (ROI objects): ROI objects
Optional args:
- neuropil_traces (list) : neuropil traces from which to infer empty
... | sess_util/sess_trace_util.py | validate_masks | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def validate_masks(roi_objs, neuropil_traces=None):
'\n validate_masks(roi_objs)\n\n Returns a dictionary with exclusion ROI masks for each exclusion criterion \n ("duplicate", "empty", "motion_border", "union", "empty_neuropil"). \n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... | def validate_masks(roi_objs, neuropil_traces=None):
'\n validate_masks(roi_objs)\n\n Returns a dictionary with exclusion ROI masks for each exclusion criterion \n ("duplicate", "empty", "motion_border", "union", "empty_neuropil"). \n\n Required args:\n - roi_objs (ROI objects): ROI objects\n\n ... |
5b93d20afaa1ff790d6659941b973d5b38b4fa488781dae0811b68008f1d9b18 | def label_unions_and_duplicates(roi_objs, masks=None, duplicate_threshold=0.9, union_threshold=0.7, max_dist=10, set_size=2):
'\n \n Modified from allensdk.internal.brain_observatory.roi_filter.py\n \n Returns ROI objects with unions and duplicates labelled.\n\n Required args:\n - roi_objs (RO... | Modified from allensdk.internal.brain_observatory.roi_filter.py
Returns ROI objects with unions and duplicates labelled.
Required args:
- roi_objs (ROI objects): ROI objects
Optional args:
- masks (3D array) : ROI mask arrays. If None provided, they
are recreated... | sess_util/sess_trace_util.py | label_unions_and_duplicates | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def label_unions_and_duplicates(roi_objs, masks=None, duplicate_threshold=0.9, union_threshold=0.7, max_dist=10, set_size=2):
'\n \n Modified from allensdk.internal.brain_observatory.roi_filter.py\n \n Returns ROI objects with unions and duplicates labelled.\n\n Required args:\n - roi_objs (RO... | def label_unions_and_duplicates(roi_objs, masks=None, duplicate_threshold=0.9, union_threshold=0.7, max_dist=10, set_size=2):
'\n \n Modified from allensdk.internal.brain_observatory.roi_filter.py\n \n Returns ROI objects with unions and duplicates labelled.\n\n Required args:\n - roi_objs (RO... |
c9ff21420a7fe966101b65cefb6f9bd9f95e4e39fec3c0c75ca2bab187f6c5e8 | def create_mask_objects(masks, motion_border, roi_ids, union_threshold=0.7):
'\n create_mask_objects(masks, motion_border, roi_ids)\n\n Returns mask objects, labeled for overlapping the motion border, as well\n as for labels, duplicates and being empty.\n\n Required args:\n - masks (3D array) ... | create_mask_objects(masks, motion_border, roi_ids)
Returns mask objects, labeled for overlapping the motion border, as well
as for labels, duplicates and being empty.
Required args:
- masks (3D array) : ROI masks, structured as ROI x height x width
- motion border (list): motion border values for [x0, x1, ... | sess_util/sess_trace_util.py | create_mask_objects | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def create_mask_objects(masks, motion_border, roi_ids, union_threshold=0.7):
'\n create_mask_objects(masks, motion_border, roi_ids)\n\n Returns mask objects, labeled for overlapping the motion border, as well\n as for labels, duplicates and being empty.\n\n Required args:\n - masks (3D array) ... | def create_mask_objects(masks, motion_border, roi_ids, union_threshold=0.7):
'\n create_mask_objects(masks, motion_border, roi_ids)\n\n Returns mask objects, labeled for overlapping the motion border, as well\n as for labels, duplicates and being empty.\n\n Required args:\n - masks (3D array) ... |
78afc3173c45dbcdb6931a2a89450182e9ea37b60ed98c943a6b9134a68fd1ba | def save_roi_dataset(data, save_path, roi_names, data_name='data', excl_dict=None, replace=True, compression=None):
'\n save_roi_dataset(save_path, roi_names)\n\n Saves ROI dataset.\n\n Required args:\n - data (nd array) : ROI data, where first dimension are ROIs\n - save_path (Path) ... | save_roi_dataset(save_path, roi_names)
Saves ROI dataset.
Required args:
- data (nd array) : ROI data, where first dimension are ROIs
- save_path (Path) : path for saving the dataset
- roi_names (array-like): list of names for each ROI
Optional args:
- data_name (str) : main dataset name
... | sess_util/sess_trace_util.py | save_roi_dataset | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def save_roi_dataset(data, save_path, roi_names, data_name='data', excl_dict=None, replace=True, compression=None):
'\n save_roi_dataset(save_path, roi_names)\n\n Saves ROI dataset.\n\n Required args:\n - data (nd array) : ROI data, where first dimension are ROIs\n - save_path (Path) ... | def save_roi_dataset(data, save_path, roi_names, data_name='data', excl_dict=None, replace=True, compression=None):
'\n save_roi_dataset(save_path, roi_names)\n\n Saves ROI dataset.\n\n Required args:\n - data (nd array) : ROI data, where first dimension are ROIs\n - save_path (Path) ... |
c1632101b19836ad579cce27ce59adf72f0ee79fb46a832c818c3d9e9d3a4979 | def demix_rois(raw_traces, h5path, masks, excl_dict, verbose=False):
'\n demix_rois(raw_traces, h5path, masks, excl_dict)\n Returns time-dependent demixed traces (modified from allensdk, demixer.py, \n demix_time_dep_masks to allow partial loading of the stack).\n\n Required args:\n - raw_traces ... | demix_rois(raw_traces, h5path, masks, excl_dict)
Returns time-dependent demixed traces (modified from allensdk, demixer.py,
demix_time_dep_masks to allow partial loading of the stack).
Required args:
- raw_traces (2D array): extracted traces, structured as ROI x frames
- h5path (Path) : path to full mo... | sess_util/sess_trace_util.py | demix_rois | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def demix_rois(raw_traces, h5path, masks, excl_dict, verbose=False):
'\n demix_rois(raw_traces, h5path, masks, excl_dict)\n Returns time-dependent demixed traces (modified from allensdk, demixer.py, \n demix_time_dep_masks to allow partial loading of the stack).\n\n Required args:\n - raw_traces ... | def demix_rois(raw_traces, h5path, masks, excl_dict, verbose=False):
'\n demix_rois(raw_traces, h5path, masks, excl_dict)\n Returns time-dependent demixed traces (modified from allensdk, demixer.py, \n demix_time_dep_masks to allow partial loading of the stack).\n\n Required args:\n - raw_traces ... |
02f220288d731c52e5870697a1c3bd516399bc45378574513341df5b54cd0af9 | def get_neuropil_subtracted_traces(roi_traces, neuropil_traces):
'\n get_neuropil_subtracted_traces(roi_traces, neuropil_traces)\n\n Returns ROI traces with neuropil subtracted, as well as the contamination \n ratio for each ROI.\n\n Required args:\n - roi_traces (2D array) : ROI traces, stru... | get_neuropil_subtracted_traces(roi_traces, neuropil_traces)
Returns ROI traces with neuropil subtracted, as well as the contamination
ratio for each ROI.
Required args:
- roi_traces (2D array) : ROI traces, structured as ROI x frame
- neuropil_traces (2D array): neuropil traces, structured as ROI x frame... | sess_util/sess_trace_util.py | get_neuropil_subtracted_traces | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def get_neuropil_subtracted_traces(roi_traces, neuropil_traces):
'\n get_neuropil_subtracted_traces(roi_traces, neuropil_traces)\n\n Returns ROI traces with neuropil subtracted, as well as the contamination \n ratio for each ROI.\n\n Required args:\n - roi_traces (2D array) : ROI traces, stru... | def get_neuropil_subtracted_traces(roi_traces, neuropil_traces):
'\n get_neuropil_subtracted_traces(roi_traces, neuropil_traces)\n\n Returns ROI traces with neuropil subtracted, as well as the contamination \n ratio for each ROI.\n\n Required args:\n - roi_traces (2D array) : ROI traces, stru... |
ac56faaa027a28d8af7bf6ba40031caccd5d811c3448bdea4f7411546fa5b775 | def create_traces_from_masks(datadir, sessid, runtype='prod', h5dir=None, savedir='trace_proc_dir', dendritic=False, mask_threshold=0.1, min_n_pix=3, compression=None):
'\n create_traces_from_masks(datadir, sessid)\n\n Extracts traces from masks, applies correction (neuropil traces, demixed \n traces, corr... | create_traces_from_masks(datadir, sessid)
Extracts traces from masks, applies correction (neuropil traces, demixed
traces, corrected traces, dF/F traces) and saves them.
WARNING: Will replace any existing files.
Required args:
- datadir (Path): name of the data directory
- sessid (int) : session ID (9 dig... | sess_util/sess_trace_util.py | create_traces_from_masks | AllenInstitute/OpenScope_CA_Analysis | 0 | python | def create_traces_from_masks(datadir, sessid, runtype='prod', h5dir=None, savedir='trace_proc_dir', dendritic=False, mask_threshold=0.1, min_n_pix=3, compression=None):
'\n create_traces_from_masks(datadir, sessid)\n\n Extracts traces from masks, applies correction (neuropil traces, demixed \n traces, corr... | def create_traces_from_masks(datadir, sessid, runtype='prod', h5dir=None, savedir='trace_proc_dir', dendritic=False, mask_threshold=0.1, min_n_pix=3, compression=None):
'\n create_traces_from_masks(datadir, sessid)\n\n Extracts traces from masks, applies correction (neuropil traces, demixed \n traces, corr... |
2eef3f2fe998868ce47fd63709789d965d6be67ccaedc0989bf9968f75e843db | def differential_to_unicycle(left_motor_velocity: Real, right_motor_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert differential steering commands into unicycle steering commands.\n\n :param left_motor_velocity: [cm / s]\n :param right_motor_velocity: [cm / s]\n :return: A tuple containing (linear_v... | Convert differential steering commands into unicycle steering commands.
:param left_motor_velocity: [cm / s]
:param right_motor_velocity: [cm / s]
:return: A tuple containing (linear_velocity [cm / s], angular_velocity [deg / s]) | src/python/drive_motor_control.py | differential_to_unicycle | SaltyHash/BWO | 2 | python | def differential_to_unicycle(left_motor_velocity: Real, right_motor_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert differential steering commands into unicycle steering commands.\n\n :param left_motor_velocity: [cm / s]\n :param right_motor_velocity: [cm / s]\n :return: A tuple containing (linear_v... | def differential_to_unicycle(left_motor_velocity: Real, right_motor_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert differential steering commands into unicycle steering commands.\n\n :param left_motor_velocity: [cm / s]\n :param right_motor_velocity: [cm / s]\n :return: A tuple containing (linear_v... |
f85c5b8ab2a4426d89334d220f54e78b4f4bc1d2e9a3c259e4f2d7fd9605bcca | def unicycle_to_differential(linear_velocity: Real, angular_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert unicycle steering commands into differential steering commands.\n\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [... | Convert unicycle steering commands into differential steering commands.
:param linear_velocity: How fast the robot should travel [cm / s]
:param angular_velocity: How fast the robot should rotate [deg / s]
:return: A tuple containing (left_motor_velocity, right_motor_velocity) [cm / s] | src/python/drive_motor_control.py | unicycle_to_differential | SaltyHash/BWO | 2 | python | def unicycle_to_differential(linear_velocity: Real, angular_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert unicycle steering commands into differential steering commands.\n\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [... | def unicycle_to_differential(linear_velocity: Real, angular_velocity: Real) -> Tuple[(Real, Real)]:
'\n Convert unicycle steering commands into differential steering commands.\n\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [... |
0815e55d27f331a30ab6180af0513a6c627e073033672d11a849b2d5caecf1e2 | def ticks_to_distance(ticks: int) -> Real:
'\n Convert encoder ticks into distance [cm].\n\n :param ticks: Number of encoder ticks.\n :return: Distance that number of ticks represents [cm].\n '
return (ticks * WHEEL_CM_PER_TICK) | Convert encoder ticks into distance [cm].
:param ticks: Number of encoder ticks.
:return: Distance that number of ticks represents [cm]. | src/python/drive_motor_control.py | ticks_to_distance | SaltyHash/BWO | 2 | python | def ticks_to_distance(ticks: int) -> Real:
'\n Convert encoder ticks into distance [cm].\n\n :param ticks: Number of encoder ticks.\n :return: Distance that number of ticks represents [cm].\n '
return (ticks * WHEEL_CM_PER_TICK) | def ticks_to_distance(ticks: int) -> Real:
'\n Convert encoder ticks into distance [cm].\n\n :param ticks: Number of encoder ticks.\n :return: Distance that number of ticks represents [cm].\n '
return (ticks * WHEEL_CM_PER_TICK)<|docstring|>Convert encoder ticks into distance [cm].
:param ticks: Nu... |
78bcf9c0a206e7e608e920b41edcc5d0357a76b2eb623549f1e9dc62fc5edd05 | def distance_to_ticks(distance: Real) -> int:
'\n Convert distance [cm] into encoder ticks.\n\n :param distance: [cm]\n :return: Number of encoder ticks (rounded) that distance represents.\n '
return int(round((distance * WHEEL_TICK_PER_CM))) | Convert distance [cm] into encoder ticks.
:param distance: [cm]
:return: Number of encoder ticks (rounded) that distance represents. | src/python/drive_motor_control.py | distance_to_ticks | SaltyHash/BWO | 2 | python | def distance_to_ticks(distance: Real) -> int:
'\n Convert distance [cm] into encoder ticks.\n\n :param distance: [cm]\n :return: Number of encoder ticks (rounded) that distance represents.\n '
return int(round((distance * WHEEL_TICK_PER_CM))) | def distance_to_ticks(distance: Real) -> int:
'\n Convert distance [cm] into encoder ticks.\n\n :param distance: [cm]\n :return: Number of encoder ticks (rounded) that distance represents.\n '
return int(round((distance * WHEEL_TICK_PER_CM)))<|docstring|>Convert distance [cm] into encoder ticks.
:p... |
53cb09bc40c94822bd5d0d1bbdcaed76275daae609eae5ba209ea24075d4a1e8 | def set_acceleration(self, acceleration: int=8000) -> None:
'\n Sets the controller acceleration.\n\n :param acceleration: How quickly the controller should accelerate to a new velocity [ticks / s^2].\n If set to 0, acceleration is instant.\n '
if (acceleration < 0):
rais... | Sets the controller acceleration.
:param acceleration: How quickly the controller should accelerate to a new velocity [ticks / s^2].
If set to 0, acceleration is instant. | src/python/drive_motor_control.py | set_acceleration | SaltyHash/BWO | 2 | python | def set_acceleration(self, acceleration: int=8000) -> None:
'\n Sets the controller acceleration.\n\n :param acceleration: How quickly the controller should accelerate to a new velocity [ticks / s^2].\n If set to 0, acceleration is instant.\n '
if (acceleration < 0):
rais... | def set_acceleration(self, acceleration: int=8000) -> None:
'\n Sets the controller acceleration.\n\n :param acceleration: How quickly the controller should accelerate to a new velocity [ticks / s^2].\n If set to 0, acceleration is instant.\n '
if (acceleration < 0):
rais... |
311431f668b2568b558829ff480f9b1e85a15d913e7f4eeba69e5e0548db4abe | def set_pid_tunings(self, p: float=0.05, i: float=0.5, d: float=0.0) -> None:
'\n Good default tunings: ``(0.05, 0.5, 0)``\n '
if ((p < 0) or (i < 0) or (d < 0)):
raise ValueError(f'All tunings must be non-negative. Given tunings: p={p}, i={i}, d={d}')
self._send_command(self._SET_PID_... | Good default tunings: ``(0.05, 0.5, 0)`` | src/python/drive_motor_control.py | set_pid_tunings | SaltyHash/BWO | 2 | python | def set_pid_tunings(self, p: float=0.05, i: float=0.5, d: float=0.0) -> None:
'\n \n '
if ((p < 0) or (i < 0) or (d < 0)):
raise ValueError(f'All tunings must be non-negative. Given tunings: p={p}, i={i}, d={d}')
self._send_command(self._SET_PID_TUNINGS_SEND_STRUCT.pack(self._SET_PID_T... | def set_pid_tunings(self, p: float=0.05, i: float=0.5, d: float=0.0) -> None:
'\n \n '
if ((p < 0) or (i < 0) or (d < 0)):
raise ValueError(f'All tunings must be non-negative. Given tunings: p={p}, i={i}, d={d}')
self._send_command(self._SET_PID_TUNINGS_SEND_STRUCT.pack(self._SET_PID_T... |
7e0e5c88882827297879596eab4734386c099ce262d1a13268748346b2999e95 | def set_velocity_unicycle(self, linear_velocity: Real, angular_velocity: Real) -> DriveMotorState:
'\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [deg / s]\n '
return self.set_velocity_differential(*unicycle_... | :param linear_velocity: How fast the robot should travel [cm / s]
:param angular_velocity: How fast the robot should rotate [deg / s] | src/python/drive_motor_control.py | set_velocity_unicycle | SaltyHash/BWO | 2 | python | def set_velocity_unicycle(self, linear_velocity: Real, angular_velocity: Real) -> DriveMotorState:
'\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [deg / s]\n '
return self.set_velocity_differential(*unicycle_... | def set_velocity_unicycle(self, linear_velocity: Real, angular_velocity: Real) -> DriveMotorState:
'\n :param linear_velocity: How fast the robot should travel [cm / s]\n :param angular_velocity: How fast the robot should rotate [deg / s]\n '
return self.set_velocity_differential(*unicycle_... |
8b1d35c7398d0f0a5210eee469fd08b76b277e80be9e0c67dceb27a07f368e3e | def _send_command(self, data: bytes) -> bytes:
'\n Sends the command data, receives a response packet, makes sure the 0th byte of the response is an ACK (i.e.\n that it matches the 0th byte of the data, which is the command byte), and then returns the part of the response\n that comes after the... | Sends the command data, receives a response packet, makes sure the 0th byte of the response is an ACK (i.e.
that it matches the 0th byte of the data, which is the command byte), and then returns the part of the response
that comes after the ACK (0th) byte.
:param data: The command data to send.
:return: The response by... | src/python/drive_motor_control.py | _send_command | SaltyHash/BWO | 2 | python | def _send_command(self, data: bytes) -> bytes:
'\n Sends the command data, receives a response packet, makes sure the 0th byte of the response is an ACK (i.e.\n that it matches the 0th byte of the data, which is the command byte), and then returns the part of the response\n that comes after the... | def _send_command(self, data: bytes) -> bytes:
'\n Sends the command data, receives a response packet, makes sure the 0th byte of the response is an ACK (i.e.\n that it matches the 0th byte of the data, which is the command byte), and then returns the part of the response\n that comes after the... |
515632bcd3e3496e68a672451acd6dc09c715628d360a5f1abfd13549fa4e6f1 | def _get_task_config(product, task):
'Get the effective telstate config for a task.\n\n This also looks for nodes whose name indicates that they are parents\n (and hence whose telstate config will be picked up by\n katsdpservices.argparse).\n '
by_name = {t.logical_node.name: t for t in product.phys... | Get the effective telstate config for a task.
This also looks for nodes whose name indicates that they are parents
(and hence whose telstate config will be picked up by
katsdpservices.argparse). | katsdpcontroller/dashboard.py | _get_task_config | ska-sa/katsdpcontroller | 0 | python | def _get_task_config(product, task):
'Get the effective telstate config for a task.\n\n This also looks for nodes whose name indicates that they are parents\n (and hence whose telstate config will be picked up by\n katsdpservices.argparse).\n '
by_name = {t.logical_node.name: t for t in product.phys... | def _get_task_config(product, task):
'Get the effective telstate config for a task.\n\n This also looks for nodes whose name indicates that they are parents\n (and hence whose telstate config will be picked up by\n katsdpservices.argparse).\n '
by_name = {t.logical_node.name: t for t in product.phys... |
433b430cdafe1749f18a608da6987db91b9a3da9be0152cb47e631f9961cc34b | @property
def instance(self) -> int:
'Return Instance.'
return self.data.get('Instance') | Return Instance. | openzwavemqtt/models/node_instance.py | instance | quinnhosler/python-openzwave-mqtt | 0 | python | @property
def instance(self) -> int:
return self.data.get('Instance') | @property
def instance(self) -> int:
return self.data.get('Instance')<|docstring|>Return Instance.<|endoftext|> |
6c39e8e4e5bf5aed107e403cd4610ad64cf70ac8e132e79e1cfef9bbb1a8c29c | @property
def time_stamp(self) -> int:
'Return TimeStamp.'
return self.data.get('TimeStamp') | Return TimeStamp. | openzwavemqtt/models/node_instance.py | time_stamp | quinnhosler/python-openzwave-mqtt | 0 | python | @property
def time_stamp(self) -> int:
return self.data.get('TimeStamp') | @property
def time_stamp(self) -> int:
return self.data.get('TimeStamp')<|docstring|>Return TimeStamp.<|endoftext|> |
375a1d7f6f34ea7d7745d50730c2f655a37a087fd9c1e163147391ac44c20b2f | def create_collections(self):
'Create collections that Node supports.'
return {'commandclass': ItemCollection(OZWCommandClass)} | Create collections that Node supports. | openzwavemqtt/models/node_instance.py | create_collections | quinnhosler/python-openzwave-mqtt | 0 | python | def create_collections(self):
return {'commandclass': ItemCollection(OZWCommandClass)} | def create_collections(self):
return {'commandclass': ItemCollection(OZWCommandClass)}<|docstring|>Create collections that Node supports.<|endoftext|> |
3b08a8b8fab04cf37e3c6c3b3444e1b439d6705b0b6814a7a12528789cf38beb | def fpicker(artist, event):
'\n an artist picker that works for clicks outside the axes. ie. artist\n that are not clipped\n '
logger.debug('fpicker: {}', artist)
if (event.button != 1):
logger.debug('wrong button!')
return (False, {})
tf = artist.contains(event)
logger.debu... | an artist picker that works for clicks outside the axes. ie. artist
that are not clipped | src/scrawl/moves/machinery.py | fpicker | astromancer/graphical | 0 | python | def fpicker(artist, event):
'\n an artist picker that works for clicks outside the axes. ie. artist\n that are not clipped\n '
logger.debug('fpicker: {}', artist)
if (event.button != 1):
logger.debug('wrong button!')
return (False, {})
tf = artist.contains(event)
logger.debu... | def fpicker(artist, event):
'\n an artist picker that works for clicks outside the axes. ie. artist\n that are not clipped\n '
logger.debug('fpicker: {}', artist)
if (event.button != 1):
logger.debug('wrong button!')
return (False, {})
tf = artist.contains(event)
logger.debu... |
4b22b48a36010a994befd5ad8b21d3ea96776920e8d6855b0965cd9f5949bfe4 | def add(self, func, *args, **kws):
'\n Add an observer function.\n\n When the artist is moved / picked, *func* will be called with the new\n coordinate position as arguments. *func* should return any artists\n that it changes. These will be drawn if blitting is enabled.\n The sig... | Add an observer function.
When the artist is moved / picked, *func* will be called with the new
coordinate position as arguments. *func* should return any artists
that it changes. These will be drawn if blitting is enabled.
The signature of *func* is therefor:
draw_list = func(x, y, *args, **kws)`
Parameters
--... | src/scrawl/moves/machinery.py | add | astromancer/graphical | 0 | python | def add(self, func, *args, **kws):
'\n Add an observer function.\n\n When the artist is moved / picked, *func* will be called with the new\n coordinate position as arguments. *func* should return any artists\n that it changes. These will be drawn if blitting is enabled.\n The sig... | def add(self, func, *args, **kws):
'\n Add an observer function.\n\n When the artist is moved / picked, *func* will be called with the new\n coordinate position as arguments. *func* should return any artists\n that it changes. These will be drawn if blitting is enabled.\n The sig... |
e116d120975ef21e7da7e0684a97adc59997f713fbcf4107fe5fa3ef5cc37726 | def activate(self, fun_or_id):
"\n Reactivate a non-active observer. This method is useful for toggling\n the active state of an observer function without removing and re-adding\n it (and it's parameters) to the dict of functions. The function will use\n parameters and keywords (if any)... | Reactivate a non-active observer. This method is useful for toggling
the active state of an observer function without removing and re-adding
it (and it's parameters) to the dict of functions. The function will use
parameters and keywords (if any) that were initially passed when it was
added.
Parameters
----------
fun... | src/scrawl/moves/machinery.py | activate | astromancer/graphical | 0 | python | def activate(self, fun_or_id):
"\n Reactivate a non-active observer. This method is useful for toggling\n the active state of an observer function without removing and re-adding\n it (and it's parameters) to the dict of functions. The function will use\n parameters and keywords (if any)... | def activate(self, fun_or_id):
"\n Reactivate a non-active observer. This method is useful for toggling\n the active state of an observer function without removing and re-adding\n it (and it's parameters) to the dict of functions. The function will use\n parameters and keywords (if any)... |
6ccfb9e9fe5bbb70d78f7cfb2eba305d7fe5dc0defde98022355ee6b665e8e0f | def deactivate(self, fun_or_id):
'\n Deactivate an active observer. \n\n Parameters\n ----------\n fun_or_id: callable, int\n The function (or its identifier) that will be activated \n '
self._set_active(fun_or_id, False) | Deactivate an active observer.
Parameters
----------
fun_or_id: callable, int
The function (or its identifier) that will be activated | src/scrawl/moves/machinery.py | deactivate | astromancer/graphical | 0 | python | def deactivate(self, fun_or_id):
'\n Deactivate an active observer. \n\n Parameters\n ----------\n fun_or_id: callable, int\n The function (or its identifier) that will be activated \n '
self._set_active(fun_or_id, False) | def deactivate(self, fun_or_id):
'\n Deactivate an active observer. \n\n Parameters\n ----------\n fun_or_id: callable, int\n The function (or its identifier) that will be activated \n '
self._set_active(fun_or_id, False)<|docstring|>Deactivate an active observer.
... |
0d057793d0891883843d54ffb8669cc177552cdb1a157463242a92c85c609bff | def __call__(self, x, y):
'\n Run all active observers for current data point\n\n Parameters\n ----------\n x, y\n\n Returns\n -------\n Artists that need to be drawn\n '
artists = []
for (_, (func, args, kws)) in self.funcs.items():
if (not se... | Run all active observers for current data point
Parameters
----------
x, y
Returns
-------
Artists that need to be drawn | src/scrawl/moves/machinery.py | __call__ | astromancer/graphical | 0 | python | def __call__(self, x, y):
'\n Run all active observers for current data point\n\n Parameters\n ----------\n x, y\n\n Returns\n -------\n Artists that need to be drawn\n '
artists = []
for (_, (func, args, kws)) in self.funcs.items():
if (not se... | def __call__(self, x, y):
'\n Run all active observers for current data point\n\n Parameters\n ----------\n x, y\n\n Returns\n -------\n Artists that need to be drawn\n '
artists = []
for (_, (func, args, kws)) in self.funcs.items():
if (not se... |
178ea54b772e37c97b3c0b1fd6a072ebdb7704d17a149919c57aa86f0b64959f | def __init__(self, artist, offset=(0.0, 0.0), annotate=False, haunted=False, trapped=False, **kws):
'\n\n Parameters\n ----------\n artist\n offset\n annotate\n haunted\n trapped\n kws\n '
self.artist = artist
self._original_transform = artist.g... | Parameters
----------
artist
offset
annotate
haunted
trapped
kws | src/scrawl/moves/machinery.py | __init__ | astromancer/graphical | 0 | python | def __init__(self, artist, offset=(0.0, 0.0), annotate=False, haunted=False, trapped=False, **kws):
'\n\n Parameters\n ----------\n artist\n offset\n annotate\n haunted\n trapped\n kws\n '
self.artist = artist
self._original_transform = artist.g... | def __init__(self, artist, offset=(0.0, 0.0), annotate=False, haunted=False, trapped=False, **kws):
'\n\n Parameters\n ----------\n artist\n offset\n annotate\n haunted\n trapped\n kws\n '
self.artist = artist
self._original_transform = artist.g... |
b422ce6a024ccf778aaf4b4cafebfade9a96dcf8eb9b84c81da8d778102d96fc | def lock(self, which):
'Lock movement for x or y coordinate'
ix = 'xy'.index(which.lower())
self._locked_at[ix] = self.offset[ix] | Lock movement for x or y coordinate | src/scrawl/moves/machinery.py | lock | astromancer/graphical | 0 | python | def lock(self, which):
ix = 'xy'.index(which.lower())
self._locked_at[ix] = self.offset[ix] | def lock(self, which):
ix = 'xy'.index(which.lower())
self._locked_at[ix] = self.offset[ix]<|docstring|>Lock movement for x or y coordinate<|endoftext|> |
4e8cde462ed20e10b654d0bcc4068670ea3b442021a9803e3c33bb91a46c350b | def free(self, which):
'Release movement lock for x or y coordinate'
ix = 'xy'.index(which.lower())
self._locked_at[ix] = None | Release movement lock for x or y coordinate | src/scrawl/moves/machinery.py | free | astromancer/graphical | 0 | python | def free(self, which):
ix = 'xy'.index(which.lower())
self._locked_at[ix] = None | def free(self, which):
ix = 'xy'.index(which.lower())
self._locked_at[ix] = None<|docstring|>Release movement lock for x or y coordinate<|endoftext|> |
2c73bcb4dbe30877c6f87bdd8064c309948fcc6820da8979f9fc3cbeadc44f14 | def lock_x(self):
'Lock x coordinate at current position'
self.lock('x') | Lock x coordinate at current position | src/scrawl/moves/machinery.py | lock_x | astromancer/graphical | 0 | python | def lock_x(self):
self.lock('x') | def lock_x(self):
self.lock('x')<|docstring|>Lock x coordinate at current position<|endoftext|> |
7a247ee9882bba03003306ec8a86912f3b6a60f1214c13038758a046f191f72e | def free_x(self):
'Release x coordinate lock'
self.free('x') | Release x coordinate lock | src/scrawl/moves/machinery.py | free_x | astromancer/graphical | 0 | python | def free_x(self):
self.free('x') | def free_x(self):
self.free('x')<|docstring|>Release x coordinate lock<|endoftext|> |
fd16957a1253447eed5b6d78bc8bb6dd40032c96332712ffcb9e59e79d8b359c | def lock_y(self):
'Lock y coordinate at current position'
self.lock('y') | Lock y coordinate at current position | src/scrawl/moves/machinery.py | lock_y | astromancer/graphical | 0 | python | def lock_y(self):
self.lock('y') | def lock_y(self):
self.lock('y')<|docstring|>Lock y coordinate at current position<|endoftext|> |
83852913dcf20b5f16512673a0d4bade61b77527de1db9df5a23cd72de81af45 | def free_y(self):
'Release y coordinate lock'
self.free('y') | Release y coordinate lock | src/scrawl/moves/machinery.py | free_y | astromancer/graphical | 0 | python | def free_y(self):
self.free('y') | def free_y(self):
self.free('y')<|docstring|>Release y coordinate lock<|endoftext|> |
d038a84908b912d67cb42b6d468f05d45767bfda9582338f90a8fd9c653d9a9e | def limit(self, xb=None, yb=None):
'\n Restrict movement of the artist to a particular interval / box\n\n Parameters\n ----------\n xb\n yb\n\n Returns\n -------\n\n '
if ((xb is None) and (yb is None)):
raise ValueError('Need either x, or y limits... | Restrict movement of the artist to a particular interval / box
Parameters
----------
xb
yb
Returns
------- | src/scrawl/moves/machinery.py | limit | astromancer/graphical | 0 | python | def limit(self, xb=None, yb=None):
'\n Restrict movement of the artist to a particular interval / box\n\n Parameters\n ----------\n xb\n yb\n\n Returns\n -------\n\n '
if ((xb is None) and (yb is None)):
raise ValueError('Need either x, or y limits... | def limit(self, xb=None, yb=None):
'\n Restrict movement of the artist to a particular interval / box\n\n Parameters\n ----------\n xb\n yb\n\n Returns\n -------\n\n '
if ((xb is None) and (yb is None)):
raise ValueError('Need either x, or y limits... |
866fcd7d8ca9e491212d0c22bda3653ce11fb159f2f7900313f6d9b3dab6ada3 | def link(self, *artists):
'\n Link another artist or artist to this one to make them co-moving\n\n Parameters\n ----------\n artists: a sequence of artists that will be linked to this one\n\n Returns\n -------\n\n '
linked = []
for drg in artists:
if ... | Link another artist or artist to this one to make them co-moving
Parameters
----------
artists: a sequence of artists that will be linked to this one
Returns
------- | src/scrawl/moves/machinery.py | link | astromancer/graphical | 0 | python | def link(self, *artists):
'\n Link another artist or artist to this one to make them co-moving\n\n Parameters\n ----------\n artists: a sequence of artists that will be linked to this one\n\n Returns\n -------\n\n '
linked = []
for drg in artists:
if ... | def link(self, *artists):
'\n Link another artist or artist to this one to make them co-moving\n\n Parameters\n ----------\n artists: a sequence of artists that will be linked to this one\n\n Returns\n -------\n\n '
linked = []
for drg in artists:
if ... |
f9ba109333b569a2c64cd769267913e1e71585cb093b872cda0c90a30cb50414 | def move_to(self, x, y):
'\n Shift the artist to the position (x, y) in data coordinates. Note\n the input position will be changed before applying the shift if the\n draggable is restricted\n\n Parameters\n ----------\n x\n y\n\n Returns\n -------\n\n... | Shift the artist to the position (x, y) in data coordinates. Note
the input position will be changed before applying the shift if the
draggable is restricted
Parameters
----------
x
y
Returns
------- | src/scrawl/moves/machinery.py | move_to | astromancer/graphical | 0 | python | def move_to(self, x, y):
'\n Shift the artist to the position (x, y) in data coordinates. Note\n the input position will be changed before applying the shift if the\n draggable is restricted\n\n Parameters\n ----------\n x\n y\n\n Returns\n -------\n\n... | def move_to(self, x, y):
'\n Shift the artist to the position (x, y) in data coordinates. Note\n the input position will be changed before applying the shift if the\n draggable is restricted\n\n Parameters\n ----------\n x\n y\n\n Returns\n -------\n\n... |
9cf12c01d4ad9f7b1e73701584d09a5270bf51b7fed96ffbb2247b10661948ff | def move_by(self, offset):
'\n move the artist by offsetting from initial position\n\n Parameters\n ----------\n offset\n\n Returns\n -------\n\n '
self.offset = offset
self.logger.debug('moving: {} {}', self, offset)
offset_trans = Affine2D().translate(*... | move the artist by offsetting from initial position
Parameters
----------
offset
Returns
------- | src/scrawl/moves/machinery.py | move_by | astromancer/graphical | 0 | python | def move_by(self, offset):
'\n move the artist by offsetting from initial position\n\n Parameters\n ----------\n offset\n\n Returns\n -------\n\n '
self.offset = offset
self.logger.debug('moving: {} {}', self, offset)
offset_trans = Affine2D().translate(*... | def move_by(self, offset):
'\n move the artist by offsetting from initial position\n\n Parameters\n ----------\n offset\n\n Returns\n -------\n\n '
self.offset = offset
self.logger.debug('moving: {} {}', self, offset)
offset_trans = Affine2D().translate(*... |
71d07b4208bf5d11f8a076f39e215c5c3d89609fe2a264ee910a7406f233c3ba | def set_animated(self, b=None):
'set animation state for all linked artists'
if (b is None):
b = (not self.artist.get_animated())
self.artist.set_animated(b)
for drg in self.linked:
drg.set_animated(b) | set animation state for all linked artists | src/scrawl/moves/machinery.py | set_animated | astromancer/graphical | 0 | python | def set_animated(self, b=None):
if (b is None):
b = (not self.artist.get_animated())
self.artist.set_animated(b)
for drg in self.linked:
drg.set_animated(b) | def set_animated(self, b=None):
if (b is None):
b = (not self.artist.get_animated())
self.artist.set_animated(b)
for drg in self.linked:
drg.set_animated(b)<|docstring|>set animation state for all linked artists<|endoftext|> |
91b811665ea2e78218c127deebdd37f3b616923ea3c186672987330cecf39112 | def __init__(self, artists=None, offsets=None, annotate=True, haunted=False, auto_legend=True, use_blit=True, **legendkw):
'\n\n\n Parameters\n ----------\n artists\n offsets\n annotate\n linked\n haunted\n auto_legend\n use_blit\n legendkw\n ... | Parameters
----------
artists
offsets
annotate
linked
haunted
auto_legend
use_blit
legendkw | src/scrawl/moves/machinery.py | __init__ | astromancer/graphical | 0 | python | def __init__(self, artists=None, offsets=None, annotate=True, haunted=False, auto_legend=True, use_blit=True, **legendkw):
'\n\n\n Parameters\n ----------\n artists\n offsets\n annotate\n linked\n haunted\n auto_legend\n use_blit\n legendkw\n ... | def __init__(self, artists=None, offsets=None, annotate=True, haunted=False, auto_legend=True, use_blit=True, **legendkw):
'\n\n\n Parameters\n ----------\n artists\n offsets\n annotate\n linked\n haunted\n auto_legend\n use_blit\n legendkw\n ... |
13af0efe347c46900c2cb945b8e6b5ed84f378054a368a6de0c5f67367ac09d7 | def __getitem__(self, key):
'hack for quick indexing'
return self.draggable[key] | hack for quick indexing | src/scrawl/moves/machinery.py | __getitem__ | astromancer/graphical | 0 | python | def __getitem__(self, key):
return self.draggable[key] | def __getitem__(self, key):
return self.draggable[key]<|docstring|>hack for quick indexing<|endoftext|> |
f95660cf19b78a6b9d420a25f45eea07c2e46d194d3f584d9056137a7628698b | def add_artist(self, artist, offset=(0, 0), annotate=True, haunted=False, **kws):
'add a draggable artist'
(key, drg) = self.artist_factory(artist, offset=offset, annotate=annotate, haunted=haunted, **kws)
self.draggable[key] = drg
self._original_offsets = np.r_[('0,2', self._original_offsets, offset)]
... | add a draggable artist | src/scrawl/moves/machinery.py | add_artist | astromancer/graphical | 0 | python | def add_artist(self, artist, offset=(0, 0), annotate=True, haunted=False, **kws):
(key, drg) = self.artist_factory(artist, offset=offset, annotate=annotate, haunted=haunted, **kws)
self.draggable[key] = drg
self._original_offsets = np.r_[('0,2', self._original_offsets, offset)]
return drg | def add_artist(self, artist, offset=(0, 0), annotate=True, haunted=False, **kws):
(key, drg) = self.artist_factory(artist, offset=offset, annotate=annotate, haunted=haunted, **kws)
self.draggable[key] = drg
self._original_offsets = np.r_[('0,2', self._original_offsets, offset)]
return drg<|docstrin... |
bd055a2b78392a50949cdce7b488eac3b494d66e2c66f3766f2cb55b2d58f380 | def lock(self, which):
'\n Lock movement along a certain axis so the artist will online move in\n a line.\n '
for (art, drg) in self.draggable.items():
drg.lock(which) | Lock movement along a certain axis so the artist will online move in
a line. | src/scrawl/moves/machinery.py | lock | astromancer/graphical | 0 | python | def lock(self, which):
'\n Lock movement along a certain axis so the artist will online move in\n a line.\n '
for (art, drg) in self.draggable.items():
drg.lock(which) | def lock(self, which):
'\n Lock movement along a certain axis so the artist will online move in\n a line.\n '
for (art, drg) in self.draggable.items():
drg.lock(which)<|docstring|>Lock movement along a certain axis so the artist will online move in
a line.<|endoftext|> |
969d984d0c5839d8ab947c5f515cf0fd16cdbba5f561fa0ed7124854265856de | def free(self, which):
'\n Free motion along an axis for all artists.\n '
for (art, drg) in self.draggable.items():
drg.free(which) | Free motion along an axis for all artists. | src/scrawl/moves/machinery.py | free | astromancer/graphical | 0 | python | def free(self, which):
'\n \n '
for (art, drg) in self.draggable.items():
drg.free(which) | def free(self, which):
'\n \n '
for (art, drg) in self.draggable.items():
drg.free(which)<|docstring|>Free motion along an axis for all artists.<|endoftext|> |
da0d81d813c45a586475e5b2b548e350bfdaa4b5ff8b7622b00c83e798c1e47f | def lock_x(self):
'Lock x position'
self.lock('x') | Lock x position | src/scrawl/moves/machinery.py | lock_x | astromancer/graphical | 0 | python | def lock_x(self):
self.lock('x') | def lock_x(self):
self.lock('x')<|docstring|>Lock x position<|endoftext|> |
22f4837f83bfb89616f6b70ae6a7fa84aa05d917bee954001d8e53c23cf0ca94 | def free_x(self):
'Free x motion'
self.free('x') | Free x motion | src/scrawl/moves/machinery.py | free_x | astromancer/graphical | 0 | python | def free_x(self):
self.free('x') | def free_x(self):
self.free('x')<|docstring|>Free x motion<|endoftext|> |
cc8d248b3b9294cf1abf096ac892888cb0ae413dc61ca0405c8e6d550057424a | def lock_y(self):
'Lock y position'
self.lock('y') | Lock y position | src/scrawl/moves/machinery.py | lock_y | astromancer/graphical | 0 | python | def lock_y(self):
self.lock('y') | def lock_y(self):
self.lock('y')<|docstring|>Lock y position<|endoftext|> |
dc26784011bae672bf21b9644cca8d09b6a968a634e5342b635ff9919d71a60c | def free_y(self):
'Free y motion'
self.free('y') | Free y motion | src/scrawl/moves/machinery.py | free_y | astromancer/graphical | 0 | python | def free_y(self):
self.free('y') | def free_y(self):
self.free('y')<|docstring|>Free y motion<|endoftext|> |
e994ce10a52b74d0ea3f64faa4dda69de1ddced6f82047f34f320645865830d6 | def limit(self, x=None, y=None):
'\n Set x and/or y limits for all draggable artists.\n\n Parameters\n ----------\n x\n y\n\n '
self.logger.debug('limit {}, {}', x, y)
for (art, drg) in self.draggable.items():
drg.limit(x, y) | Set x and/or y limits for all draggable artists.
Parameters
----------
x
y | src/scrawl/moves/machinery.py | limit | astromancer/graphical | 0 | python | def limit(self, x=None, y=None):
'\n Set x and/or y limits for all draggable artists.\n\n Parameters\n ----------\n x\n y\n\n '
self.logger.debug('limit {}, {}', x, y)
for (art, drg) in self.draggable.items():
drg.limit(x, y) | def limit(self, x=None, y=None):
'\n Set x and/or y limits for all draggable artists.\n\n Parameters\n ----------\n x\n y\n\n '
self.logger.debug('limit {}, {}', x, y)
for (art, drg) in self.draggable.items():
drg.limit(x, y)<|docstring|>Set x and/or y limit... |
5f361e6d4094e18670c2a5e5da3dc4ce03a86568fd64e9746ed95928c9d0bb4b | def reset(self):
'reset the plot positions to original'
self.logger.debug('resetting!')
for (draggable, off) in zip(self.draggable.values(), self._original_offsets):
self.update(draggable, draggable.ref_point) | reset the plot positions to original | src/scrawl/moves/machinery.py | reset | astromancer/graphical | 0 | python | def reset(self):
self.logger.debug('resetting!')
for (draggable, off) in zip(self.draggable.values(), self._original_offsets):
self.update(draggable, draggable.ref_point) | def reset(self):
self.logger.debug('resetting!')
for (draggable, off) in zip(self.draggable.values(), self._original_offsets):
self.update(draggable, draggable.ref_point)<|docstring|>reset the plot positions to original<|endoftext|> |
2766914ee7daa432b09a219250be9f54389876da32da5f0115296857f8d5ef76 | @mpl_connect('button_press_event')
def on_click(self, event):
'reset plot on middle mouse'
if (event.button == 2):
self.reset()
else:
return | reset plot on middle mouse | src/scrawl/moves/machinery.py | on_click | astromancer/graphical | 0 | python | @mpl_connect('button_press_event')
def on_click(self, event):
if (event.button == 2):
self.reset()
else:
return | @mpl_connect('button_press_event')
def on_click(self, event):
if (event.button == 2):
self.reset()
else:
return<|docstring|>reset plot on middle mouse<|endoftext|> |
c1dcaed197ea2f3985ac2d338ad745948d3b338eb55a49d58a36884283c27c53 | def _ignore_pick(self, event):
'Filter pick events'
if (event.mouseevent.button != 1):
return True
if (event.artist not in self.draggable):
return True
if self.selection:
self.logger.debug('Multiple picks! ignoring: {}', event.artist)
return True
return False | Filter pick events | src/scrawl/moves/machinery.py | _ignore_pick | astromancer/graphical | 0 | python | def _ignore_pick(self, event):
if (event.mouseevent.button != 1):
return True
if (event.artist not in self.draggable):
return True
if self.selection:
self.logger.debug('Multiple picks! ignoring: {}', event.artist)
return True
return False | def _ignore_pick(self, event):
if (event.mouseevent.button != 1):
return True
if (event.artist not in self.draggable):
return True
if self.selection:
self.logger.debug('Multiple picks! ignoring: {}', event.artist)
return True
return False<|docstring|>Filter pick even... |
8c02f61da01850c503656a809588e8e20cc22927cd809b605063040f546a165e | @mpl_connect('pick_event')
def on_pick(self, event):
'Pick event handler.'
if self._ignore_pick(event):
return
self.logger.debug('picked: {!r}: {}', event.artist, vars(event))
self.selection = event.artist
draggable = self.draggable[self.selection]
xy_disp = (event.mouseevent.x, event.mo... | Pick event handler. | src/scrawl/moves/machinery.py | on_pick | astromancer/graphical | 0 | python | @mpl_connect('pick_event')
def on_pick(self, event):
if self._ignore_pick(event):
return
self.logger.debug('picked: {!r}: {}', event.artist, vars(event))
self.selection = event.artist
draggable = self.draggable[self.selection]
xy_disp = (event.mouseevent.x, event.mouseevent.y)
xy_da... | @mpl_connect('pick_event')
def on_pick(self, event):
if self._ignore_pick(event):
return
self.logger.debug('picked: {!r}: {}', event.artist, vars(event))
self.selection = event.artist
draggable = self.draggable[self.selection]
xy_disp = (event.mouseevent.x, event.mouseevent.y)
xy_da... |
e3a88597832719b598bf3f7cd41f3c3d85964e5bb409ad34669391136aab2f2c | def on_motion(self, event):
'\n Handle movement of the selected artist by the mouse.\n '
if (event.button != 1):
return
if self.selection:
self.logger.debug('dragging: {}', self.selection)
draggable = self.draggable[self.selection]
xy_disp = (event.x, event.y)
... | Handle movement of the selected artist by the mouse. | src/scrawl/moves/machinery.py | on_motion | astromancer/graphical | 0 | python | def on_motion(self, event):
'\n \n '
if (event.button != 1):
return
if self.selection:
self.logger.debug('dragging: {}', self.selection)
draggable = self.draggable[self.selection]
xy_disp = (event.x, event.y)
xy_data = (x, y) = self.ax.transData.inverted... | def on_motion(self, event):
'\n \n '
if (event.button != 1):
return
if self.selection:
self.logger.debug('dragging: {}', self.selection)
draggable = self.draggable[self.selection]
xy_disp = (event.x, event.y)
xy_data = (x, y) = self.ax.transData.inverted... |
bb5a5f37836f4bbee822db3458d5eeaaca3ca1124645a93570ce630b2df84c2a | @mpl_connect('resize_event')
def on_resize(self, event):
'Save the background for blit after canvas resize'
self.save_background() | Save the background for blit after canvas resize | src/scrawl/moves/machinery.py | on_resize | astromancer/graphical | 0 | python | @mpl_connect('resize_event')
def on_resize(self, event):
self.save_background() | @mpl_connect('resize_event')
def on_resize(self, event):
self.save_background()<|docstring|>Save the background for blit after canvas resize<|endoftext|> |
cbd4947322ea2913de2d75536d43fc93864f641d6b2d088c27d927899a38bf6b | def update(self, draggable, xy_data, draw_on=True):
'\n Draw all artists that where changed by the motion\n\n Parameters\n ----------\n draggable\n xy_data\n draw_on\n\n Returns\n -------\n list of artists\n '
draw_list = draggable.update(*xy... | Draw all artists that where changed by the motion
Parameters
----------
draggable
xy_data
draw_on
Returns
-------
list of artists | src/scrawl/moves/machinery.py | update | astromancer/graphical | 0 | python | def update(self, draggable, xy_data, draw_on=True):
'\n Draw all artists that where changed by the motion\n\n Parameters\n ----------\n draggable\n xy_data\n draw_on\n\n Returns\n -------\n list of artists\n '
draw_list = draggable.update(*xy... | def update(self, draggable, xy_data, draw_on=True):
'\n Draw all artists that where changed by the motion\n\n Parameters\n ----------\n draggable\n xy_data\n draw_on\n\n Returns\n -------\n list of artists\n '
draw_list = draggable.update(*xy... |
f39c9c1ac12829cc6af4cebd85f24b7f5b1aa6ab62a984d380a2d2129c18baad | def blit_setup(self, artists=()):
'\n Setup canvas for blitting. First make all the artists in the list\n invisible, then redraw the canvas and save, then redraw all the artists.\n '
fig = self.figure
artists = list(filter_non_artist(artists))
for art in artists:
art.set_ani... | Setup canvas for blitting. First make all the artists in the list
invisible, then redraw the canvas and save, then redraw all the artists. | src/scrawl/moves/machinery.py | blit_setup | astromancer/graphical | 0 | python | def blit_setup(self, artists=()):
'\n Setup canvas for blitting. First make all the artists in the list\n invisible, then redraw the canvas and save, then redraw all the artists.\n '
fig = self.figure
artists = list(filter_non_artist(artists))
for art in artists:
art.set_ani... | def blit_setup(self, artists=()):
'\n Setup canvas for blitting. First make all the artists in the list\n invisible, then redraw the canvas and save, then redraw all the artists.\n '
fig = self.figure
artists = list(filter_non_artist(artists))
for art in artists:
art.set_ani... |
6636859b46ce149f57cf75be0e67ee80a3c7de8519a002eb564fc995f4f3cfda | def finalize_children(self):
'\n Sort the children (if any), and set properties for easy checking\n # they are at the beginning or end of the line.\n '
self.children = {k: v for (k, v) in sorted(self._children.items(), key=self._sorting)}
if self.children:
keys = list(self.child... | Sort the children (if any), and set properties for easy checking
# they are at the beginning or end of the line. | sanic_routing/tree.py | finalize_children | wochinge/sanic-routing | 8 | python | def finalize_children(self):
'\n Sort the children (if any), and set properties for easy checking\n # they are at the beginning or end of the line.\n '
self.children = {k: v for (k, v) in sorted(self._children.items(), key=self._sorting)}
if self.children:
keys = list(self.child... | def finalize_children(self):
'\n Sort the children (if any), and set properties for easy checking\n # they are at the beginning or end of the line.\n '
self.children = {k: v for (k, v) in sorted(self._children.items(), key=self._sorting)}
if self.children:
keys = list(self.child... |
0c5e93216dc2bbcfb6ecbdc460ef1b1228e88e022702929d7f305bb454af7512 | def display(self) -> None:
'\n Visual display of the tree of nodes\n '
logger.info((((' ' * 4) * self.level) + str(self)))
for child in self.children.values():
child.display() | Visual display of the tree of nodes | sanic_routing/tree.py | display | wochinge/sanic-routing | 8 | python | def display(self) -> None:
'\n \n '
logger.info((((' ' * 4) * self.level) + str(self)))
for child in self.children.values():
child.display() | def display(self) -> None:
'\n \n '
logger.info((((' ' * 4) * self.level) + str(self)))
for child in self.children.values():
child.display()<|docstring|>Visual display of the tree of nodes<|endoftext|> |
5718551a9e9e91c44ffa9c39f94bd078b362b460d96fa2fe35e7c68a7f8d5362 | def _inject_param_check(self, location, indent, idx):
'\n Try and cast relevant path segments.\n '
lines = [Line('try:', indent), Line(f"basket['__matches__'][{idx}] = {self.param.cast.__name__}(parts[{idx}])", (indent + 1)), Line('except ValueError:', indent), Line('pass', (indent + 1)), Line('el... | Try and cast relevant path segments. | sanic_routing/tree.py | _inject_param_check | wochinge/sanic-routing | 8 | python | def _inject_param_check(self, location, indent, idx):
'\n \n '
lines = [Line('try:', indent), Line(f"basket['__matches__'][{idx}] = {self.param.cast.__name__}(parts[{idx}])", (indent + 1)), Line('except ValueError:', indent), Line('pass', (indent + 1)), Line('else:', indent)]
if self.unquote:
... | def _inject_param_check(self, location, indent, idx):
'\n \n '
lines = [Line('try:', indent), Line(f"basket['__matches__'][{idx}] = {self.param.cast.__name__}(parts[{idx}])", (indent + 1)), Line('except ValueError:', indent), Line('pass', (indent + 1)), Line('else:', indent)]
if self.unquote:
... |
c8c8634d07f963ab3992f1d42645d891b8e515ab6dc0613bfaccb35cf49578f8 | @staticmethod
def _inject_method_check(location, indent, group):
'\n Sometimes we need to check the routing methods inside the generated src\n '
for (i, route) in enumerate(group.routes):
if_stmt = ('if' if (i == 0) else 'elif')
location.extend([Line(f'{if_stmt} method in {route.me... | Sometimes we need to check the routing methods inside the generated src | sanic_routing/tree.py | _inject_method_check | wochinge/sanic-routing | 8 | python | @staticmethod
def _inject_method_check(location, indent, group):
'\n \n '
for (i, route) in enumerate(group.routes):
if_stmt = ('if' if (i == 0) else 'elif')
location.extend([Line(f'{if_stmt} method in {route.methods}:', indent), Line(f'route_idx = {i}', (indent + 1))])
locatio... | @staticmethod
def _inject_method_check(location, indent, group):
'\n \n '
for (i, route) in enumerate(group.routes):
if_stmt = ('if' if (i == 0) else 'elif')
location.extend([Line(f'{if_stmt} method in {route.methods}:', indent), Line(f'route_idx = {i}', (indent + 1))])
locatio... |
425d740d36b9b6fcc7799f7a22762558ba8c4c4b077aa27e7c6b8b40d9cc57ee | def _inject_return(self, location, indent, route_idx, group):
'\n The return statement for the node if needed\n '
routes = ('regex_routes' if group.regex else 'dynamic_routes')
route_return = ('' if group.router.stacking else f'[{route_idx}]')
location.extend([Line(f'# Return {self.ident}'... | The return statement for the node if needed | sanic_routing/tree.py | _inject_return | wochinge/sanic-routing | 8 | python | def _inject_return(self, location, indent, route_idx, group):
'\n \n '
routes = ('regex_routes' if group.regex else 'dynamic_routes')
route_return = ( if group.router.stacking else f'[{route_idx}]')
location.extend([Line(f'# Return {self.ident}', indent), Line(f'return router.{routes}[{gro... | def _inject_return(self, location, indent, route_idx, group):
'\n \n '
routes = ('regex_routes' if group.regex else 'dynamic_routes')
route_return = ( if group.router.stacking else f'[{route_idx}]')
location.extend([Line(f'# Return {self.ident}', indent), Line(f'return router.{routes}[{gro... |
ba95f5f6870ae8edd9878c3c93e750d2f271e893cf058c10b59abf901f3937ea | def _inject_requirements(self, location, indent, group):
'\n Check any extra checks needed for a route. In path routing, for exampe,\n this is used for matching vhosts.\n '
for (k, route) in enumerate(group):
conditional = ('if' if (k == 0) else 'elif')
location.extend([Line... | Check any extra checks needed for a route. In path routing, for exampe,
this is used for matching vhosts. | sanic_routing/tree.py | _inject_requirements | wochinge/sanic-routing | 8 | python | def _inject_requirements(self, location, indent, group):
'\n Check any extra checks needed for a route. In path routing, for exampe,\n this is used for matching vhosts.\n '
for (k, route) in enumerate(group):
conditional = ('if' if (k == 0) else 'elif')
location.extend([Line... | def _inject_requirements(self, location, indent, group):
'\n Check any extra checks needed for a route. In path routing, for exampe,\n this is used for matching vhosts.\n '
for (k, route) in enumerate(group):
conditional = ('if' if (k == 0) else 'elif')
location.extend([Line... |
ea61de95fb9b24af9e72444ee9ce0bd8008ad61040bc57a03b659f939e18f924 | def _inject_regex(self, location, indent, group):
'\n For any path matching that happens in the course of the tree (anything\n that has a path matching--<path:path>--or similar matching with regex\n delimiter)\n '
location.extend([Line(f'match = router.matchers[{group.pattern_idx}].m... | For any path matching that happens in the course of the tree (anything
that has a path matching--<path:path>--or similar matching with regex
delimiter) | sanic_routing/tree.py | _inject_regex | wochinge/sanic-routing | 8 | python | def _inject_regex(self, location, indent, group):
'\n For any path matching that happens in the course of the tree (anything\n that has a path matching--<path:path>--or similar matching with regex\n delimiter)\n '
location.extend([Line(f'match = router.matchers[{group.pattern_idx}].m... | def _inject_regex(self, location, indent, group):
'\n For any path matching that happens in the course of the tree (anything\n that has a path matching--<path:path>--or similar matching with regex\n delimiter)\n '
location.extend([Line(f'match = router.matchers[{group.pattern_idx}].m... |
438343ba202e5d289d91cd4e4b3ab111a8a9ca88df96c52043dc239538fe5f4a | def _sorting(self, item) -> t.Tuple[(bool, bool, int, int, int, bool, str)]:
'\n Primarily use to sort nodes to determine the order of the nested tree\n '
(key, child) = item
type_ = 0
if child.dynamic:
type_ = child.param.priority
return (bool(child.groups), child.dynamic, (ty... | Primarily use to sort nodes to determine the order of the nested tree | sanic_routing/tree.py | _sorting | wochinge/sanic-routing | 8 | python | def _sorting(self, item) -> t.Tuple[(bool, bool, int, int, int, bool, str)]:
'\n \n '
(key, child) = item
type_ = 0
if child.dynamic:
type_ = child.param.priority
return (bool(child.groups), child.dynamic, (type_ * (- 1)), (child.depth * (- 1)), len(child._children), (not bool(... | def _sorting(self, item) -> t.Tuple[(bool, bool, int, int, int, bool, str)]:
'\n \n '
(key, child) = item
type_ = 0
if child.dynamic:
type_ = child.param.priority
return (bool(child.groups), child.dynamic, (type_ * (- 1)), (child.depth * (- 1)), len(child._children), (not bool(... |
9bd18b25892b462040b7998911e16006225ceda573e2c5e6ad618cdc24525dc8 | def _group_sorting(self, item) -> t.Tuple[(int, ...)]:
'\n When multiple RouteGroups terminate on the same node, we want to\n evaluate them based upon the priority of the param matching types\n '
def get_type(segment):
type_ = 0
if segment.startswith('<'):
key =... | When multiple RouteGroups terminate on the same node, we want to
evaluate them based upon the priority of the param matching types | sanic_routing/tree.py | _group_sorting | wochinge/sanic-routing | 8 | python | def _group_sorting(self, item) -> t.Tuple[(int, ...)]:
'\n When multiple RouteGroups terminate on the same node, we want to\n evaluate them based upon the priority of the param matching types\n '
def get_type(segment):
type_ = 0
if segment.startswith('<'):
key =... | def _group_sorting(self, item) -> t.Tuple[(int, ...)]:
'\n When multiple RouteGroups terminate on the same node, we want to\n evaluate them based upon the priority of the param matching types\n '
def get_type(segment):
type_ = 0
if segment.startswith('<'):
key =... |
090ad79231c5db1504d2677adfe44f5a08c956c4de230ab3d9b21f586b4ad30c | def generate(self, groups: t.Iterable[RouteGroup]) -> None:
'\n Arrange RouteGroups into hierarchical nodes and arrange them into\n a tree\n '
for group in groups:
current = self.root
for (level, part) in enumerate(group.parts):
param = None
dynamic =... | Arrange RouteGroups into hierarchical nodes and arrange them into
a tree | sanic_routing/tree.py | generate | wochinge/sanic-routing | 8 | python | def generate(self, groups: t.Iterable[RouteGroup]) -> None:
'\n Arrange RouteGroups into hierarchical nodes and arrange them into\n a tree\n '
for group in groups:
current = self.root
for (level, part) in enumerate(group.parts):
param = None
dynamic =... | def generate(self, groups: t.Iterable[RouteGroup]) -> None:
'\n Arrange RouteGroups into hierarchical nodes and arrange them into\n a tree\n '
for group in groups:
current = self.root
for (level, part) in enumerate(group.parts):
param = None
dynamic =... |
eb12e1a307aa17dfdd1086928786b458f75c1b9af8e32f3d6d39eaebc5c44e7a | def display(self) -> None:
'\n Debug tool to output visual of the tree\n '
self.root.display() | Debug tool to output visual of the tree | sanic_routing/tree.py | display | wochinge/sanic-routing | 8 | python | def display(self) -> None:
'\n \n '
self.root.display() | def display(self) -> None:
'\n \n '
self.root.display()<|docstring|>Debug tool to output visual of the tree<|endoftext|> |
1555e8df4c6a0c00436ad76741db6a2d5c5431a0a7126d7b43dce29492b36136 | def summon_blocks(board):
'Place 1-8 circles in random places on the speed board'
for _ in range(random.randint(1, 8)):
x = random.randint(0, 4)
y = random.randint(0, 4)
while (board[x][y] != 'g'):
x = random.randint(0, 4)
y = random.randint(0, 4)
board[x]... | Place 1-8 circles in random places on the speed board | src/main.py | summon_blocks | andrewthederp/Documatic-Hackathon | 1 | python | def summon_blocks(board):
for _ in range(random.randint(1, 8)):
x = random.randint(0, 4)
y = random.randint(0, 4)
while (board[x][y] != 'g'):
x = random.randint(0, 4)
y = random.randint(0, 4)
board[x][y] = 'b'
return board | def summon_blocks(board):
for _ in range(random.randint(1, 8)):
x = random.randint(0, 4)
y = random.randint(0, 4)
while (board[x][y] != 'g'):
x = random.randint(0, 4)
y = random.randint(0, 4)
board[x][y] = 'b'
return board<|docstring|>Place 1-8 circle... |
1cab39249bdcbbc794b17a55fb3dd80c1bf256dfd0194835e8e777e7496d93ac | def convert(coordinates):
'Convert the speed coordinates into x, y coordinates, this way you could do both "a1" or "1a'
for coor in coordinates.split(' '):
if (len(coor) != 2):
continue
coor = coor.lower()
if coor[0].isalpha():
digit = coor[1:]
letter ... | Convert the speed coordinates into x, y coordinates, this way you could do both "a1" or "1a | src/main.py | convert | andrewthederp/Documatic-Hackathon | 1 | python | def convert(coordinates):
for coor in coordinates.split(' '):
if (len(coor) != 2):
continue
coor = coor.lower()
if coor[0].isalpha():
digit = coor[1:]
letter = coor[0]
else:
digit = coor[:(- 1)]
letter = coor[(- 1)]
... | def convert(coordinates):
for coor in coordinates.split(' '):
if (len(coor) != 2):
continue
coor = coor.lower()
if coor[0].isalpha():
digit = coor[1:]
letter = coor[0]
else:
digit = coor[:(- 1)]
letter = coor[(- 1)]
... |
3088f4669f1596894bf1a77ded1311b44b7d524a684f119a2602740048ed49d6 | def format_board(board):
'A nested list formater, uses a dict to turn letters into emojis'
lst = []
dct = {'g': '⬛', 'G': '🟩', 'q': '🟦', 'p': '😳', 'L': '📍', 'z': '🧟', 'e': random.choice(['🌎', '🌍', '🌏']), 'B': '💥', 's': '🚀', 'a': '👾', 'o': '💣', 'w': '🟥', 'x': '❌', ' ': '⬛', 'u': '⏫', 'l': '⏪', '... | A nested list formater, uses a dict to turn letters into emojis | src/main.py | format_board | andrewthederp/Documatic-Hackathon | 1 | python | def format_board(board):
lst = []
dct = {'g': '⬛', 'G': '🟩', 'q': '🟦', 'p': '😳', 'L': '📍', 'z': '🧟', 'e': random.choice(['🌎', '🌍', '🌏']), 'B': '💥', 's': '🚀', 'a': '👾', 'o': '💣', 'w': '🟥', 'x': '❌', ' ': '⬛', 'u': '⏫', 'l': '⏪', 'r': '⏩', 'd': '⏬', 'b': '🔲'}
for row in board:
lst.a... | def format_board(board):
lst = []
dct = {'g': '⬛', 'G': '🟩', 'q': '🟦', 'p': '😳', 'L': '📍', 'z': '🧟', 'e': random.choice(['🌎', '🌍', '🌏']), 'B': '💥', 's': '🚀', 'a': '👾', 'o': '💣', 'w': '🟥', 'x': '❌', ' ': '⬛', 'u': '⏫', 'l': '⏪', 'r': '⏩', 'd': '⏬', 'b': '🔲'}
for row in board:
lst.a... |
a3ad8a7d9d34f698f61e6a1e65522e9a5be73bcd6ad8f776d09cfc8485b0ed9f | def format_speed_board(board):
'Speed board requires coordinates a boarder so i made a different function for it'
dct = {'g': '⬛', 'b': 'b'}
for i in range(1, 6):
dct[i] = f'{i}️⃣'
lst = [f':stop_button::regional_indicator_a::regional_indicator_b::regional_indicator_c::regional_indicator_d::regi... | Speed board requires coordinates a boarder so i made a different function for it | src/main.py | format_speed_board | andrewthederp/Documatic-Hackathon | 1 | python | def format_speed_board(board):
dct = {'g': '⬛', 'b': 'b'}
for i in range(1, 6):
dct[i] = f'{i}️⃣'
lst = [f':stop_button::regional_indicator_a::regional_indicator_b::regional_indicator_c::regional_indicator_d::regional_indicator_e:']
for (num, row) in enumerate(board, start=1):
lst.a... | def format_speed_board(board):
dct = {'g': '⬛', 'b': 'b'}
for i in range(1, 6):
dct[i] = f'{i}️⃣'
lst = [f':stop_button::regional_indicator_a::regional_indicator_b::regional_indicator_c::regional_indicator_d::regional_indicator_e:']
for (num, row) in enumerate(board, start=1):
lst.a... |
1e9f510237a3f5ea9a35bacfeee7983bae5c2fc323484efac564335d927e6398 | def check_zombie_collides(board, bullets, enemies, score):
'Check if a zombie collided with a bullet'
for enemy in enemies:
for bullet in bullets:
collide = False
try:
if (bullet.index == enemy.index):
board[bullet.index[0]][bullet.index[1]] = ... | Check if a zombie collided with a bullet | src/main.py | check_zombie_collides | andrewthederp/Documatic-Hackathon | 1 | python | def check_zombie_collides(board, bullets, enemies, score):
for enemy in enemies:
for bullet in bullets:
collide = False
try:
if (bullet.index == enemy.index):
board[bullet.index[0]][bullet.index[1]] = 'G'
collide = True
... | def check_zombie_collides(board, bullets, enemies, score):
for enemy in enemies:
for bullet in bullets:
collide = False
try:
if (bullet.index == enemy.index):
board[bullet.index[0]][bullet.index[1]] = 'G'
collide = True
... |
faa05081c46625772a60a7f7f29ef16d9b3847225536704e07d904872c101ddc | async def scene_1(ctx, msg):
'Scene 1, played when you use the zombie command'
embed = discord.Embed(title='Chapter 1: What happened', description=f'**???:** *WAKE UP KID*', color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(1))
embed.description += f'''
**{ctx.auth... | Scene 1, played when you use the zombie command | src/main.py | scene_1 | andrewthederp/Documatic-Hackathon | 1 | python | async def scene_1(ctx, msg):
embed = discord.Embed(title='Chapter 1: What happened', description=f'**???:** *WAKE UP KID*', color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(1))
embed.description += f'
**{ctx.author.display_name}:** *what's happening... wait Rapha... | async def scene_1(ctx, msg):
embed = discord.Embed(title='Chapter 1: What happened', description=f'**???:** *WAKE UP KID*', color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(1))
embed.description += f'
**{ctx.author.display_name}:** *what's happening... wait Rapha... |
17eb199e9b26c8c715410e05f3c7695f15b3b809f04191cf936a12145fd991df | async def scene_2(ctx, msg):
'Scene 2, played when you use the spaceshooter command'
embed = discord.Embed(title='Chapter 2: The spaceship', description='', color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(0.5))
embed.description = '**John:** *THERE ARE SO MANY ZO... | Scene 2, played when you use the spaceshooter command | src/main.py | scene_2 | andrewthederp/Documatic-Hackathon | 1 | python | async def scene_2(ctx, msg):
embed = discord.Embed(title='Chapter 2: The spaceship', description=, color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(0.5))
embed.description = '**John:** *THERE ARE SO MANY ZOMBIES, WE NEED TO GO NOW*'
(await msg.edit(embed=embe... | async def scene_2(ctx, msg):
embed = discord.Embed(title='Chapter 2: The spaceship', description=, color=discord.Color.dark_theme())
(await msg.edit(embed=embed))
(await asyncio.sleep(0.5))
embed.description = '**John:** *THERE ARE SO MANY ZOMBIES, WE NEED TO GO NOW*'
(await msg.edit(embed=embe... |
386a457b944abe25ec9a65d1b7e536087d66df8c823aa056cbb5b393a43940da | async def scene_3(ctx):
'Scene 3, played when you hit 50 score in spaceshooter'
embed = discord.Embed(title='Chapter 3: The Crew', description='', color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += "**???**: *Hey, i didn't introduce myself*"
(await msg.edit(em... | Scene 3, played when you hit 50 score in spaceshooter | src/main.py | scene_3 | andrewthederp/Documatic-Hackathon | 1 | python | async def scene_3(ctx):
embed = discord.Embed(title='Chapter 3: The Crew', description=, color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += "**???**: *Hey, i didn't introduce myself*"
(await msg.edit(embed=embed))
(await asyncio.sleep(1))
embed.descri... | async def scene_3(ctx):
embed = discord.Embed(title='Chapter 3: The Crew', description=, color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += "**???**: *Hey, i didn't introduce myself*"
(await msg.edit(embed=embed))
(await asyncio.sleep(1))
embed.descri... |
94c16e4047a54ab87c378c3852ce084c7f46493bed13f7da3337cb0670b0c0a5 | async def scene_4(ctx):
'Scene 4, played when you use the maze command on storyline mode'
embed = discord.Embed(title='Chapter 4: The Crash', description='', color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += '*Siren noises*\n**Raphael:** *EVERYBODY WAKE UP, WE NE... | Scene 4, played when you use the maze command on storyline mode | src/main.py | scene_4 | andrewthederp/Documatic-Hackathon | 1 | python | async def scene_4(ctx):
embed = discord.Embed(title='Chapter 4: The Crash', description=, color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += '*Siren noises*\n**Raphael:** *EVERYBODY WAKE UP, WE NEED TO GO NOW*'
(await msg.edit(embed=embed))
(await asyncio... | async def scene_4(ctx):
embed = discord.Embed(title='Chapter 4: The Crash', description=, color=discord.Color.dark_theme())
msg = (await ctx.send(embed=embed))
embed.description += '*Siren noises*\n**Raphael:** *EVERYBODY WAKE UP, WE NEED TO GO NOW*'
(await msg.edit(embed=embed))
(await asyncio... |
e920848506739e14c35db573de1e0810611dc291e8fe0a1ad4e4e0624d48432b | def get_player(lst):
'Returns the x, y coordinates of the player on the board'
for (x, row) in enumerate(lst):
for (y, column) in enumerate(row):
if (column == 'p'):
return (x, y) | Returns the x, y coordinates of the player on the board | src/main.py | get_player | andrewthederp/Documatic-Hackathon | 1 | python | def get_player(lst):
for (x, row) in enumerate(lst):
for (y, column) in enumerate(row):
if (column == 'p'):
return (x, y) | def get_player(lst):
for (x, row) in enumerate(lst):
for (y, column) in enumerate(row):
if (column == 'p'):
return (x, y)<|docstring|>Returns the x, y coordinates of the player on the board<|endoftext|> |
d41c4aa9973a15228c8f80a34c7bc735885ee45be38d95a074a9a1065fc8c8aa | def go_direction(lst, direction, player_index):
"Moves the player into a direction and makes sure the player isn't in an infinite loop/off screen"
(x, y) = player_index
moves = 0
while True:
moves += 1
x += direction[0]
y += direction[1]
if ((x < 0) or (y < 0)):
... | Moves the player into a direction and makes sure the player isn't in an infinite loop/off screen | src/main.py | go_direction | andrewthederp/Documatic-Hackathon | 1 | python | def go_direction(lst, direction, player_index):
(x, y) = player_index
moves = 0
while True:
moves += 1
x += direction[0]
y += direction[1]
if ((x < 0) or (y < 0)):
return (None, 'Dead')
try:
if (lst[x][y] == 'w'):
x -= dire... | def go_direction(lst, direction, player_index):
(x, y) = player_index
moves = 0
while True:
moves += 1
x += direction[0]
y += direction[1]
if ((x < 0) or (y < 0)):
return (None, 'Dead')
try:
if (lst[x][y] == 'w'):
x -= dire... |
dd72e986d01bc3bb79e1567c8f514364e872b7793a38d7eb818009e57e819deb | def save_maze(maze):
'Saves the player made maze, only saves it if the player was able to beat it to prove that the maze was actually possible'
if (not ('levels.txt' in os.listdir())):
f = open('levels.txt', mode='x')
f.write((maze + '\n'))
else:
f = open('levels.txt', mode='a')
... | Saves the player made maze, only saves it if the player was able to beat it to prove that the maze was actually possible | src/main.py | save_maze | andrewthederp/Documatic-Hackathon | 1 | python | def save_maze(maze):
if (not ('levels.txt' in os.listdir())):
f = open('levels.txt', mode='x')
f.write((maze + '\n'))
else:
f = open('levels.txt', mode='a')
f.write((maze + '\n')) | def save_maze(maze):
if (not ('levels.txt' in os.listdir())):
f = open('levels.txt', mode='x')
f.write((maze + '\n'))
else:
f = open('levels.txt', mode='a')
f.write((maze + '\n'))<|docstring|>Saves the player made maze, only saves it if the player was able to beat it to prov... |
0cc5dbd44e4f900110da7cd0396836d9aa15e2e24bfa75f59eed281a63e6cabf | async def score_db():
'Creates "scores.db" which saves the scores for the leaderboard command'
(await bot.wait_until_ready())
bot.db = (await aiosqlite.connect('scores.db'))
(await bot.db.execute('CREATE TABLE IF NOT EXISTS scores (author_id int, score int, command_name text)')) | Creates "scores.db" which saves the scores for the leaderboard command | src/main.py | score_db | andrewthederp/Documatic-Hackathon | 1 | python | async def score_db():
(await bot.wait_until_ready())
bot.db = (await aiosqlite.connect('scores.db'))
(await bot.db.execute('CREATE TABLE IF NOT EXISTS scores (author_id int, score int, command_name text)')) | async def score_db():
(await bot.wait_until_ready())
bot.db = (await aiosqlite.connect('scores.db'))
(await bot.db.execute('CREATE TABLE IF NOT EXISTS scores (author_id int, score int, command_name text)'))<|docstring|>Creates "scores.db" which saves the scores for the leaderboard command<|endoftext|> |
25a6411f56675c67c805cd4b9d4d9832c8fda8e659cd201ea9077b83763f3695 | async def save_score(ctx, score):
'Adds the player score into scores.db'
cursor = (await bot.db.execute('SELECT score from scores WHERE author_id = ? AND command_name = ?', (ctx.author.id, ctx.command.name)))
data = (await cursor.fetchone())
if data:
if (data[0] < score):
(await bot.... | Adds the player score into scores.db | src/main.py | save_score | andrewthederp/Documatic-Hackathon | 1 | python | async def save_score(ctx, score):
cursor = (await bot.db.execute('SELECT score from scores WHERE author_id = ? AND command_name = ?', (ctx.author.id, ctx.command.name)))
data = (await cursor.fetchone())
if data:
if (data[0] < score):
(await bot.db.execute(f'UPDATE scores SET score =... | async def save_score(ctx, score):
cursor = (await bot.db.execute('SELECT score from scores WHERE author_id = ? AND command_name = ?', (ctx.author.id, ctx.command.name)))
data = (await cursor.fetchone())
if data:
if (data[0] < score):
(await bot.db.execute(f'UPDATE scores SET score =... |
9c55bfea8e08b34d34bb394c23eb3db92d49fa09649da0f0035f59151433ad21 | @bot.event
async def on_ready():
'on_ready'
print('Online!') | on_ready | src/main.py | on_ready | andrewthederp/Documatic-Hackathon | 1 | python | @bot.event
async def ():
print('Online!') | @bot.event
async def ():
print('Online!')<|docstring|>on_ready<|endoftext|> |
8d1b29affe6e1ff83d7f75a6ad46d845f761a061076c4ffbcdab8f24708fc1b4 | @bot.command()
async def zombies(ctx):
"You're surrounded by zombies!!! don't worry tho, you have a gun. React to the reaction pointing in the direction you want *don't miss*"
board_copy = copy.deepcopy(board)
update_cache(ctx)
bullets = []
zombies = []
score = 0
alive = True
msg = (awai... | You're surrounded by zombies!!! don't worry tho, you have a gun. React to the reaction pointing in the direction you want *don't miss* | src/main.py | zombies | andrewthederp/Documatic-Hackathon | 1 | python | @bot.command()
async def zombies(ctx):
board_copy = copy.deepcopy(board)
update_cache(ctx)
bullets = []
zombies = []
score = 0
alive = True
msg = (await ctx.send(embed=discord.Embed(title='Chapter 1: What happened', color=discord.Color.dark_theme())))
(await scene_1(ctx, msg))
e... | @bot.command()
async def zombies(ctx):
board_copy = copy.deepcopy(board)
update_cache(ctx)
bullets = []
zombies = []
score = 0
alive = True
msg = (await ctx.send(embed=discord.Embed(title='Chapter 1: What happened', color=discord.Color.dark_theme())))
(await scene_1(ctx, msg))
e... |
ce2434e5ac250f88865cf2dbd09c1ca894321acee1157195ece30f9e0191b5a4 | @bot.command()
async def spaceshooter(ctx):
"You're in a spaceship now. move the spaceship to avoid and shoot at the aliens for score and make sure to net get hit"
update_cache(ctx)
msg = (await ctx.send(embed=discord.Embed(title='Chapter 2: The spaceship', color=discord.Color.dark_theme())))
(await sce... | You're in a spaceship now. move the spaceship to avoid and shoot at the aliens for score and make sure to net get hit | src/main.py | spaceshooter | andrewthederp/Documatic-Hackathon | 1 | python | @bot.command()
async def spaceshooter(ctx):
update_cache(ctx)
msg = (await ctx.send(embed=discord.Embed(title='Chapter 2: The spaceship', color=discord.Color.dark_theme())))
(await scene_2(ctx, msg))
bord = [(['g'] * 5) for i in range(7)]
emojis = ['⬅', '🏳', '➡']
for emoji in emojis:
... | @bot.command()
async def spaceshooter(ctx):
update_cache(ctx)
msg = (await ctx.send(embed=discord.Embed(title='Chapter 2: The spaceship', color=discord.Color.dark_theme())))
(await scene_2(ctx, msg))
bord = [(['g'] * 5) for i in range(7)]
emojis = ['⬅', '🏳', '➡']
for emoji in emojis:
... |
8fbbcf478fdcd2e09f94a4c01cea220d5482b19eb658d1ad4e1060b0f6429fbe | @bot.group(invoke_without_command=True)
async def maze(ctx, mode='storyline'):
'good and bad news, the bad news are that the spaceship is now destroyed the good news you\'re all on a planet with your space suits, the planet\'s gravity is messed up tho. Try to get to the :x: in the storyline mode" or play user made ... | good and bad news, the bad news are that the spaceship is now destroyed the good news you're all on a planet with your space suits, the planet's gravity is messed up tho. Try to get to the :x: in the storyline mode" or play user made mazes in the usermade mode | src/main.py | maze | andrewthederp/Documatic-Hackathon | 1 | python | @bot.group(invoke_without_command=True)
async def maze(ctx, mode='storyline'):
'good and bad news, the bad news are that the spaceship is now destroyed the good news you\'re all on a planet with your space suits, the planet\'s gravity is messed up tho. Try to get to the :x: in the storyline mode" or play user made ... | @bot.group(invoke_without_command=True)
async def maze(ctx, mode='storyline'):
'good and bad news, the bad news are that the spaceship is now destroyed the good news you\'re all on a planet with your space suits, the planet\'s gravity is messed up tho. Try to get to the :x: in the storyline mode" or play user made ... |
d575b53abc258efdebc0bad1e19c5d78e44c981ea2e443660de312c0bb98a8f9 | @maze.command()
async def add(ctx, *, maze):
'A way to add your very own maze'
maze = maze.lower()
if (maze.startswith('```') and maze.endswith('```')):
maze = '\n'.join(maze.split('\n')[1:])[:3]
if ('p' not in maze):
return (await ctx.send('There is no player'))
elif ('x' not in maz... | A way to add your very own maze | src/main.py | add | andrewthederp/Documatic-Hackathon | 1 | python | @maze.command()
async def add(ctx, *, maze):
maze = maze.lower()
if (maze.startswith('```') and maze.endswith('```')):
maze = '\n'.join(maze.split('\n')[1:])[:3]
if ('p' not in maze):
return (await ctx.send('There is no player'))
elif ('x' not in maze):
return (await ctx.sen... | @maze.command()
async def add(ctx, *, maze):
maze = maze.lower()
if (maze.startswith('```') and maze.endswith('```')):
maze = '\n'.join(maze.split('\n')[1:])[:3]
if ('p' not in maze):
return (await ctx.send('There is no player'))
elif ('x' not in maze):
return (await ctx.sen... |
700e67af1653aa06d77c56c5dc0b94d007a0435333615448c330756654c167cc | @bot.command()
async def speed(ctx, member: discord.Member=None):
'A simple game where you have 5 seconds to send the coordinates of the colored circles, if a member is selected it\'s a race to 30 points, otherwise it goes on until you send "end"/"stop"/"cancel"'
if member:
if (member.bot or (member == ... | A simple game where you have 5 seconds to send the coordinates of the colored circles, if a member is selected it's a race to 30 points, otherwise it goes on until you send "end"/"stop"/"cancel" | src/main.py | speed | andrewthederp/Documatic-Hackathon | 1 | python | @bot.command()
async def speed(ctx, member: discord.Member=None):
'A simple game where you have 5 seconds to send the coordinates of the colored circles, if a member is selected it\'s a race to 30 points, otherwise it goes on until you send "end"/"stop"/"cancel"'
if member:
if (member.bot or (member == ... | @bot.command()
async def speed(ctx, member: discord.Member=None):
'A simple game where you have 5 seconds to send the coordinates of the colored circles, if a member is selected it\'s a race to 30 points, otherwise it goes on until you send "end"/"stop"/"cancel"'
if member:
if (member.bot or (member == ... |
569952ed8765faae8185a8296c16496d391f9519643c62e6bd6f0052a6ee15c2 | @bot.command(aliases=['botinfo', 'about'])
async def info(ctx):
'Some generic info'
embed = discord.Embed(title='Bot Info', description=f'I am a discord bot made by andreawthaderp#3031 for the documatic hackathon', color=discord.Color.dark_theme())
(await ctx.send(embed=embed)) | Some generic info | src/main.py | info | andrewthederp/Documatic-Hackathon | 1 | python | @bot.command(aliases=['botinfo', 'about'])
async def info(ctx):
embed = discord.Embed(title='Bot Info', description=f'I am a discord bot made by andreawthaderp#3031 for the documatic hackathon', color=discord.Color.dark_theme())
(await ctx.send(embed=embed)) | @bot.command(aliases=['botinfo', 'about'])
async def info(ctx):
embed = discord.Embed(title='Bot Info', description=f'I am a discord bot made by andreawthaderp#3031 for the documatic hackathon', color=discord.Color.dark_theme())
(await ctx.send(embed=embed))<|docstring|>Some generic info<|endoftext|> |
cdd524b725851a64178d227b4e02f2e2d29cb2ef8749ea2a323bfabd1f92cb9a | @bot.command(aliases=['lb'])
@commands.guild_only()
async def leaderboard(ctx, command_name, entries=5):
'a way to see the top x scores of a certain game'
cmd = bot.get_command(command_name)
if (not cmd):
return (await ctx.send(f'The command {command_name} does not exist'))
embed = discord.Embed... | a way to see the top x scores of a certain game | src/main.py | leaderboard | andrewthederp/Documatic-Hackathon | 1 | python | @bot.command(aliases=['lb'])
@commands.guild_only()
async def leaderboard(ctx, command_name, entries=5):
cmd = bot.get_command(command_name)
if (not cmd):
return (await ctx.send(f'The command {command_name} does not exist'))
embed = discord.Embed(title=f'Leaderboard', description=f'Top {entries... | @bot.command(aliases=['lb'])
@commands.guild_only()
async def leaderboard(ctx, command_name, entries=5):
cmd = bot.get_command(command_name)
if (not cmd):
return (await ctx.send(f'The command {command_name} does not exist'))
embed = discord.Embed(title=f'Leaderboard', description=f'Top {entries... |
dff94f256d13ac00c01a28270eeed576d337dbedcb2a1880b1c46ae193a5ebc7 | @classmethod
def create_from_document(cls, document):
'Create a Relat from a document\n\n Arguments:\n document (dict): dict used for creating the document\n\n Returns:\n a Relat instance\n\n '
story = Story(**document)
instance = cls(story.title)
instance.stor... | Create a Relat from a document
Arguments:
document (dict): dict used for creating the document
Returns:
a Relat instance | relaty/relat.py | create_from_document | PaPablo/relaty | 0 | python | @classmethod
def create_from_document(cls, document):
'Create a Relat from a document\n\n Arguments:\n document (dict): dict used for creating the document\n\n Returns:\n a Relat instance\n\n '
story = Story(**document)
instance = cls(story.title)
instance.stor... | @classmethod
def create_from_document(cls, document):
'Create a Relat from a document\n\n Arguments:\n document (dict): dict used for creating the document\n\n Returns:\n a Relat instance\n\n '
story = Story(**document)
instance = cls(story.title)
instance.stor... |
2f3d0d0c5789d405498f552a1131a9b490de09b32227fa00487e8f01909270e7 | @property
def get_number_endings(self):
'Obtain the number of endings of the story\n\n Since any story in Relaty is represented in the shape\n of a tree, and ending is just a leaf.\n\n Returns:\n number of endings in the story\n '
return self.story.get_number_endings | Obtain the number of endings of the story
Since any story in Relaty is represented in the shape
of a tree, and ending is just a leaf.
Returns:
number of endings in the story | relaty/relat.py | get_number_endings | PaPablo/relaty | 0 | python | @property
def get_number_endings(self):
'Obtain the number of endings of the story\n\n Since any story in Relaty is represented in the shape\n of a tree, and ending is just a leaf.\n\n Returns:\n number of endings in the story\n '
return self.story.get_number_endings | @property
def get_number_endings(self):
'Obtain the number of endings of the story\n\n Since any story in Relaty is represented in the shape\n of a tree, and ending is just a leaf.\n\n Returns:\n number of endings in the story\n '
return self.story.get_number_endings<|docs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.