query
stringlengths
9
60
language
stringclasses
1 value
code
stringlengths
105
25.7k
url
stringlengths
91
217
save list to file
python
def save_list(lst, path): """ Save items from list to the file. """ with open(path, 'wb') as out: lines = [] for item in lst: if isinstance(item, (six.text_type, six.binary_type)): lines.append(make_str(item)) else: lines.append(ma...
https://github.com/lorien/grab/blob/8b301db2a08c830245b61c589e58af6234f4db79/grab/script/crawl.py#L57-L69
save list to file
python
def save(self, filename, content): """ default is to save a file from list of lines """ with open(filename, "w") as f: if hasattr(content, '__iter__'): f.write('\n'.join([row for row in content])) else: print('WRINGI CONTWETESWREWR'...
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_datatable.py#L230-L239
save list to file
python
def save_filelist(self, opFile, opFormat, delim=',', qu='"'): """ uses a List of files and collects meta data on them and saves to an text file as a list or with metadata depending on opFormat. """ op_folder = os.path.dirname(opFile) if op_folder is not None: # ...
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L192-L228
save list to file
python
def save(self, list_file): """Saves the current list of annotations to the given file. **Parameters:** ``list_file`` : str The name of a list file to write the currently stored list into """ bob.io.base.create_directories_safe(os.path.dirname(list_file)) with open(list_file, 'w') as f: ...
https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L79-L93
save list to file
python
def _save_history_to_file(history, path, size=-1): """Save a history list to a file for later loading (possibly in another session). :param history: the history list to save :type history: list(str) :param path: the path to the file where to save the history :param size:...
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/ui.py#L773-L797
save list to file
python
def save_to_name_list(dest, name_parts, value): """ Util to save some name sequence to a dict. For instance, `("location","query")` would save to dest["location"]["query"]. """ if len(name_parts) > 1: for part in name_parts[:-1]: if part not in dest: dest[part] = ...
https://github.com/tiffon/take/blob/907a2c4a72f5cbd357eadd4837fa4cae23647096/take/utils.py#L22-L32
save list to file
python
def _save_file(self, data, path): """Save an file to the specified path. :param data: binary data of the file :param path: path to save the file to """ with open(path, 'wb') as tfile: for chunk in data: tfile.write(chunk)
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/restclient.py#L1001-L1008
save list to file
python
def save_file(self, path=None, filters='*.dat', force_extension=None, force_overwrite=False, header_only=False, delimiter='use current', binary=None): """ This will save all the header info and columns to an ascii file with the specified path. Parameters ---------- path=...
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L462-L612
save list to file
python
def save( project: 'projects.Project', write_list: typing.List[tuple] = None ) -> typing.List[tuple]: """ Computes the file write list for the current state of the project if no write_list was specified in the arguments, and then writes each entry in that list to disk. :param projec...
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/session/writing/__init__.py#L14-L45
save list to file
python
def save(self, filename): '''save settings to a file. Return True/False on success/failure''' try: f = open(filename, mode='w') except Exception: return False for k in self.list(): f.write("%s=%s\n" % (k, self.get(k))) f.close() return ...
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_settings.py#L175-L184
save list to file
python
def save_file(self): """Write the file out to disk.""" l = [] walk = self.walker for edit in walk.lines: # collect the text already stored in edit widgets if edit.original_text.expandtabs() == edit.edit_text: l.append(edit.original_text) ...
https://github.com/cwoebker/pen/blob/996dfcdc018f2fc14a376835a2622fb4a7230a2f/pen/edit.py#L152-L184
save list to file
python
def save(self): '''Save current property list representation to the original file.''' with open(self.filename, 'w') as plist_file: plist_file.write(str(self.soup))
https://github.com/vedvyas/doxytag2zealdb/blob/8b07a88af6794248f8cfdabb0fda9dd61c777127/doxytag2zealdb/propertylist.py#L112-L115
save list to file
python
def save(self, filename, wildcard='*', verbose=False): '''save parameters to a file''' f = open(filename, mode='w') k = list(self.keys()) k.sort() count = 0 for p in k: if p and fnmatch.fnmatch(str(p).upper(), wildcard.upper()): f.write("%-16.1...
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavparm.py#L39-L51
save list to file
python
def do_save(self, fp=None): """Save to file. Parameters ---------- fp : `file` or `str`, optional Output file (default: stdout). """ if fp is None: fp = sys.stdout data = { 'settings': self.settings, 'nodes': self.n...
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/storage/json.py#L193-L208
save list to file
python
def save(fname, data): """Saves a list of arrays or a dict of str->array to file. Examples of filenames: - ``/path/to/file`` - ``s3://my-bucket/path/to/file`` (if compiled with AWS S3 supports) - ``hdfs://path/to/file`` (if compiled with HDFS supports) Parameters ---------- fname : st...
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/utils.py#L222-L273
save list to file
python
def save(self, filething=None): """Save changes to a file. If no filename is given, the one most recently loaded is used. Tags are always written at the end of the file, and include a header and a footer. """ fileobj = filething.fileobj data = _APEv2Data(fileo...
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/apev2.py#L427-L485
save list to file
python
def savetofile(self, filelike, sortkey = True): """ Save configurations to a file-like object which supports `writelines` """ filelike.writelines(k + '=' + repr(v) + '\n' for k,v in self.config_items(sortkey))
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/config/config.py#L281-L285
save list to file
python
def save(self, file_tag='2016', add_header='N'): """ save table to folder in appropriate files NOTE - ONLY APPEND AT THIS STAGE - THEN USE DATABASE """ fname = self.get_filename(file_tag) with open(fname, 'a') as f: if add_header == 'Y': f.writ...
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L320-L331
save list to file
python
def saveFiles(fileName1, fileName2, songs, artist, album, trackNum): """Save songs to files""" songs[0].export(fileName1, format=detectFormat(fileName1), tags={'artist': artist, 'album': album, 'track': trackNum}) songs[1].export(fileName2, format=detectFormat(fileName2), tags={'artist': artist, 'album': al...
https://github.com/benfb/dars/blob/66778de8314f7dcec50ef706abcea84a9b3d9c7e/dars/__init__.py#L57-L60
save list to file
python
def save(self, filename=None): """Save changes to a file. If no filename is given, the one most recently loaded is used. Tags are always written at the end of the file, and include a header and a footer. """ filename = filename or self.filename try: ...
https://github.com/LordSputnik/mutagen/blob/38e62c8dc35c72b16554f5dbe7c0fde91acc3411/mutagen/apev2.py#L386-L432
save list to file
python
def file_save(self, name, filename=None, folder="", keep_ext=True) -> bool: """ Easy save of a file """ if name in self.files: file_object = self.files[name] clean_filename = secure_filename(file_object.filename) if filename is not None and keep_ext: ...
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/form_data.py#L48-L61
save list to file
python
def save(self, filething=None, v1=1, v2_version=4, v23_sep='/', padding=None): """save(filething=None, v1=1, v2_version=4, v23_sep='/', padding=None) Save changes to a file. Args: filething (filething): Filename to save the tag to. If no filename is giv...
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/id3/_file.py#L223-L274
save list to file
python
def save(self): """ Save the state to a file. """ with open(self.path, 'w') as f: f.write(yaml.dump(dict(self.d)))
https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/state.py#L54-L59
save list to file
python
def save_to(self, file): """Save data to file. Will copy by either writing out the data or using :func:`shutil.copyfileobj`. :param file: A file-like object (with a ``write`` method) or a filename.""" dest = file if hasattr(dest, 'write'): ...
https://github.com/mbr/data/blob/f326938502defb4af93e97ed1212a71575641e77/data/__init__.py#L203-L231
save list to file
python
def _save(file, data, mode='w+'): """ Write all data to created file. Also overwrite previous file. """ with open(file, mode) as fh: fh.write(data)
https://github.com/xgvargas/js-css-min-django/blob/29300bef0d72b523c41deb72ef19bb1d24a619bb/jscssmin.py#L32-L37
save list to file
python
def save_varlist(filename, varnames, varlist): """ Valid extensions '.pyshelf', '.mat', '.hdf5' or '.h5' @param filename: string @param varnames: list of strings Names of the variables @param varlist: list of objects The objects to be saved """ ...
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/storage.py#L158-L174
save list to file
python
def _save_file(self, data): """Attempt to atomically save file by saving and then moving into position The goal is to make it difficult for a crash to corrupt our data file since the move operation can be made atomic if needed on mission critical filesystems. """ if platform.sy...
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L60-L79
save list to file
python
def saveFiles(fileName1, fileName2, songs): """Save songs to files""" songs[0].export(fileName1, format=detectFormat(fileName1)) songs[1].export(fileName2, format=detectFormat(fileName2))
https://github.com/benfb/dars/blob/66778de8314f7dcec50ef706abcea84a9b3d9c7e/dars/__init__.py#L52-L55
save list to file
python
def OnMacroListSave(self, event): """Macro list save event handler""" # Get filepath from user wildcards = get_filetypes2wildcards(["py", "all"]).values() wildcard = "|".join(wildcards) message = _("Choose macro file.") style = wx.SAVE filepath, filterindex =...
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_main_window.py#L1489-L1513
save list to file
python
def save(self, filename, addnormalised=False): """Save a frequency list to file, can be loaded later using the load method""" f = io.open(filename,'w',encoding='utf-8') for line in self.output("\t", addnormalised): f.write(line + '\n') f.close()
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/statistics.py#L64-L69
save list to file
python
def save(self): """ Deletes the selected files from storage """ storage = get_media_storage() for storage_name in self.cleaned_data['selected_files']: full_path = storage.path(storage_name) try: storage.delete(storage_name) ...
https://github.com/samluescher/django-media-tree/blob/3eb6345faaf57e2fbe35ca431d4d133f950f2b5f/media_tree/admin/actions/forms.py#L204-L215
save list to file
python
def save(self, data, fname, header=None): """ Save data on fname. :param data: numpy array or list of lists :param fname: path name :param header: header to use """ write_csv(fname, data, self.sep, self.fmt, header) self.fnames.add(getattr(fname, 'name', ...
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/writers.py#L265-L274
save list to file
python
def _save_vocab_file(vocab_file, subtoken_list): """Save subtokens to file.""" with tf.gfile.Open(vocab_file, mode="w") as f: for subtoken in subtoken_list: f.write("'%s'\n" % _unicode_to_native(subtoken))
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/utils/tokenizer.py#L185-L189
save list to file
python
def save_file_list(key, *files_refs): """Convert the given parameters to a special JSON object. Each parameter is a file-refs specification of the form: <file-path>:<reference1>,<reference2>, ..., where the colon ':' and the list of references are optional. JSON object is of the form: { key: {...
https://github.com/genialis/resolwe-runtime-utils/blob/5657d7cf981972a5259b9b475eae220479401001/resolwe_runtime_utils.py#L101-L143
save list to file
python
def save(self, name, file): """ Saves new content to the file specified by name. The content should be a proper File object or any python file-like object, ready to be read from the beginning. """ # Get the proper name for the file, as it will actually be saved. i...
https://github.com/logston/py3s3/blob/1910ca60c53a53d839d6f7b09c05b555f3bfccf4/py3s3/storage.py#L50-L67
save list to file
python
def save_to_file(destination_filename, append=False): """ Save the output value to file. """ def decorator_fn(f): @wraps(f) def wrapper_fn(*args, **kwargs): res = f(*args, **kwargs) makedirs(os.path.dirname(destination_filename)) mode = "a" if append...
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/task/task_decorator.py#L48-L67
save list to file
python
def save(self): """Write changed .pth file back to disk""" if not self.dirty: return data = '\n'.join(map(self.make_relative, self.paths)) if data: log.debug("Saving %s", self.filename) data = ( "import sys; sys.__plen = len(sys.path)\...
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1528-L1555
save list to file
python
def save_all(self): """Save all opened files. Iterate through self.data and call save() on any modified files. """ for index in range(self.get_stack_count()): if self.data[index].editor.document().isModified(): self.save(index)
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L1897-L1904
save list to file
python
def saveToFile(self): """ Save the current text to file """ filename = self.codeEditor.dialog.getSaveFileName() if filename and filename != '.': with open(filename, 'w') as f: f.write(self.toPlainText()) print('saved script under %s' % file...
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/CodeEditor.py#L306-L314
save list to file
python
def save(self, *args, **kwargs): """save(filething=None, padding=None)""" super(MP4, self).save(*args, **kwargs)
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/mp4/__init__.py#L1086-L1089
save list to file
python
def save_to_file(self, fname): """ saves a characters data to file """ with open(fname, 'w') as f: f.write(str(self))
https://github.com/acutesoftware/virtual-AI-simulator/blob/57de679a5b1a58c38fefe6aea58af1f3a7e79c58/vais/character.py#L236-L241
save list to file
python
def save(self, mode='all'): """Saves to the file specified by :attr:`~SR850.filename`. :param mode: Defines what to save. ======= ================================================ Value Description ======= ================================================ ...
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/srs/sr850.py#L730-L752
save list to file
python
def save(self, filename): """ Save document to a file. Parameters ---------- filename : str The output string filename """ self.doc.save(os.path.expanduser(filename))
https://github.com/shapiromatron/bmds/blob/395c6ce84ad82876fd9fa4a89a3497fb61616de0/bmds/reporter.py#L159-L169
save list to file
python
def save_to_file(self, text, filename, name=None): ''' Adds an utterance to speak to the event queue. @param text: Text to sepak @type text: unicode @param filename: the name of file to save. @param name: Name to associate with this utterance. Included in not...
https://github.com/nateshmbhat/pyttsx3/blob/0f304bff4812d50937393f1e3d7f89c9862a1623/pyttsx3/engine.py#L108-L119
save list to file
python
def save_file(self, filename, text): """Save the given text under the given control filename and the current path.""" if not filename.endswith('.py'): filename += '.py' path = os.path.join(self.currentpath, filename) with open(path, 'w', encoding="utf-8") as file_: ...
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L873-L880
save list to file
python
def saveAs(self, event=None): """ Save the parameter settings to a user-specified file. Any changes here must be coordinated with the corresponding tpar save_as function. """ self.debug('Clicked Save as...') # On Linux Pers..Dlg causes the cwd to change, so get a copy of curren...
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1122-L1190
save list to file
python
def save(self, filename): """ saves the instance of the script to a file using pickle Args: filename: target filename """ if filename is None: filename = self.filename('.b26s') # if len(filename.split('\\\\?\\')) == 1: # filename = '\...
https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/core/scripts.py#L746-L759
save list to file
python
def batch_save(self, *documents): """ Inserts or updates every document specified in documents. :param documents: Array of documents to save as dictionaries :type documents: ``array`` of ``dict`` :return: Results of update operation as overall stats :rtype: ``dict`` ...
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L3715-L3730
save list to file
python
def save_to_file(filename, content): """ Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc """ ...
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L55-L68
save list to file
python
def save_as(self, index=None): """Save file as... Args: index: self.data index for the file to save. Returns: False if no file name was selected or if save() was unsuccessful. True is save() was successful. Gets the new file name from sele...
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L1790-L1844
save list to file
python
def save(self, filething=None, padding=None): """save(filething=None, padding=None) Save a tag to a file. If no filename is given, the one most recently loaded is used. Args: filething (filething) padding (:obj:`mutagen.PaddingFunction`) Raises: ...
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/ogg.py#L570-L589
save list to file
python
def save(self, filename): """Save the configuration to a file""" filename = pathlib.Path(filename) out = [] keys = sorted(list(self.keys())) for key in keys: out.append("[{}]".format(key)) section = self[key] ikeys = list(section.keys()) ...
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/rtdc_dataset/config.py#L160-L179
save list to file
python
def save_list(self, list_name, emails): """ Upload a list. The list import job is queued and will happen shortly after the API request. http://docs.sailthru.com/api/list @param list: list name @param emails: List of email values or comma separated string """ data ...
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L356-L365
save list to file
python
def save( self, copypath=None): """*save the content of the document back to the file* **Key Arguments:** - ``copypath`` -- the path to a new file if you want to make a copy of the document instead of saving it to the original filepath. Default *None* **Usa...
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/tastic.py#L1327-L1362
save list to file
python
def save(self, name, content): """ Saves new content to the file specified by name. The content should be a proper File object, ready to be read from the beginning. """ # Get the proper name for the file, as it will actually be saved. if name is None: name = c...
https://github.com/dstufft/storages/blob/0d893afc1db32cd83eaf8e2ad4ed51b37933d5f0/storages/core.py#L55-L68
save list to file
python
def _save_file(self, filename, contents): """write the html file contents to disk""" with open(filename, 'w') as f: f.write(contents)
https://github.com/tlatsas/wigiki/blob/baf9c5a6523a9b90db7572330d04e3e199391273/wigiki/generator.py#L49-L52
save list to file
python
def save(file_name, content): """Save content to a file""" with open(file_name, "w", encoding="utf-8") as output_file: output_file.write(content) return output_file.name
https://github.com/vividvilla/csvtotable/blob/d894dca1fcc1071c9a52260a9194f8cc3b327905/csvtotable/convert.py#L71-L75
save list to file
python
def save_to_file(self, fp, sep='\n'): """ Read all messages from the queue and persist them to file-like object. Messages are written to the file and the 'sep' string is written in between messages. Messages are deleted from the queue after being written to the file. Ret...
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sqs/queue.py#L320-L337
save list to file
python
def file_to_list(in_file): ''' Reads file into list ''' lines = [] for line in in_file: # Strip new line line = line.strip('\n') # Ignore empty lines if line != '': # Ignore comments if line[0] != '#': lines.append(line) return li...
https://github.com/totalgood/nlpia/blob/efa01126275e9cd3c3a5151a644f1c798a9ec53f/src/nlpia/scripts/hunspell_to_json.py#L39-L52
save list to file
python
def tplot_save(names, filename=None): """ This function will save tplot variables into a single file by using the python "pickle" function. This file can then be "restored" using tplot_restore. This is useful if you want to end the pytplot session, but save all of your data/options. All variables and ...
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/tplot_save.py#L9-L65
save list to file
python
def save(self, to_save, manipulate=True, check_keys=True, **kwargs): """Save a document in this collection. **DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead. .. versionchanged:: 3.0 Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write ...
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2456-L2482
save list to file
python
def save_copy_as(self, index=None): """Save copy of file as... Args: index: self.data index for the file to save. Returns: False if no file name was selected or if save() was unsuccessful. True is save() was successful. Gets the new file n...
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L1846-L1895
save list to file
python
def save_files(self, nodes): """ Saves user defined files using give nodes. :param nodes: Nodes. :type nodes: list :return: Method success. :rtype: bool """ metrics = {"Opened": 0, "Cached": 0} for node in nodes: file = node.file ...
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/components/factory/script_editor/search_in_files.py#L1405-L1443
save list to file
python
def save(self, fname): """Saves symbol to a file. You can also use pickle to do the job if you only work on python. The advantage of `load`/`save` functions is that the file contents are language agnostic. This means the model saved by one language binding can be loaded by a different ...
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/symbol/symbol.py#L1278-L1302
save list to file
python
def save(self, event): """Saves a file that is specified in event.attr Parameters ---------- event.attr: Dict \tkey filepath contains file path of file to be saved """ filepath = event.attr["filepath"] try: filetype = event.attr["filetype"]...
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_actions.py#L606-L662
save list to file
python
def file_list(self): """list files on the device""" log.info('Listing files') res = self.__exchange(LIST_FILES) res = res.split('\r\n') # skip first and last lines res = res[1:-1] files = [] for line in res: files.append(line.split('\t')) ...
https://github.com/kmpm/nodemcu-uploader/blob/557a25f37b1fb4e31a745719e237e42fff192834/nodemcu_uploader/uploader.py#L408-L418
save list to file
python
def save(self, outpath): """Save this command file as an ascii file. Agrs: outpath (str): The output path to save. """ with open(outpath, "w") as outfile: outfile.write(self.dump())
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/command_file.py#L49-L57
save list to file
python
def save(self): """ Saves the settings contents """ content = self.dumps() fileutils.save_text_to_file(content, self.file_path)
https://github.com/MisterY/gnucash-portfolio/blob/bfaad8345a5479d1cd111acee1939e25c2a638c2/gnucash_portfolio/lib/settings.py#L53-L56
save list to file
python
def save(self, p_todolist): """ Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is clo...
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L96-L119
save list to file
python
def save(variable, filename): """Save variable on given path using Pickle Args: variable: what to save path (str): path of the output """ fileObj = open(filename, 'wb') pickle.dump(variable, fileObj) fileObj.close()
https://github.com/tallero/trovotutto/blob/7afcfacf2bb3b642654153630c1ab7447ab10fae/trovotutto/__init__.py#L45-L54
save list to file
python
def save(self, filename, callback=_noop_callback): """Save this file. :param filename: the file to which to save the .sav file :type filename: str :param callback: a progress callback function :type callback: function """ with open(filename, 'wb') as fp: ...
https://github.com/alexras/pylsdj/blob/1c45a7919dd324e941f76b315558b9647892e4d5/pylsdj/savfile.py#L312-L321
save list to file
python
def _save(self): """ save the cache index, in case it was modified. Saves the index table and the file name repository in the file `index.dat` """ if self.__modified_flag: self.__filename_rep.update_id_counter() indexfilename = os.path.join(self....
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L245-L261
save list to file
python
def save(self, revision=True, *args, **kwargs): """ Handles the saving/updating of a Publishable instance. Arguments: revision - if True, a new version of this Publishable will be created. """ if revision: # If this is a revision, set it to be the head of th...
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L170-L222
save list to file
python
def save(self): """Write the store dict to a file specified by store_file_path""" with open(self.store_file_path, 'w') as fh: fh.write(json.dumps(self.store, indent=4))
https://github.com/LLNL/certipy/blob/8705a8ba32655e12021d2893cf1c3c98c697edd7/certipy/certipy.py#L253-L257
save list to file
python
def saveParList(self, *args, **kw): """Write parameter data to filename (string or filehandle)""" if 'filename' in kw: filename = kw['filename'] if not filename: filename = self.getFilename() if not filename: raise ValueError("No filename specified to ...
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/cfgpars.py#L752-L790
save list to file
python
def save(self, fp=None): """Save to file. Parameters ---------- fp : `file`, optional Output file. """ self.storage.settings['markov'] = self.get_settings_json() self.storage.save(fp)
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/base.py#L115-L124
save list to file
python
def save(self, path): """ Save the file to the specified path """ # remember and restore file position pos = self.tell() self.seek(0) with fopen(path, 'wb') as output: output.truncate(self.length) for chunk in iter(lambda: self.read(1024),...
https://github.com/ValvePython/vpk/blob/cc522fc7febbf53efa5d58fcd1ad2103dae37ac8/vpk/__init__.py#L454-L467
save list to file
python
def save(self): """Store config back to file.""" try: os.makedirs(os.path.dirname(self._configfile)) except: pass with open(self._configfile, 'w') as f: self._config.write(f)
https://github.com/aitjcize/cppman/blob/7b48e81b2cd3baa912d73dfe977ecbaff945a93c/cppman/config.py#L80-L88
save list to file
python
def save(store, *args, **kwargs): """Convenience function to save an array or group of arrays to the local file system. Parameters ---------- store : MutableMapping or string Store or path to directory in file system or name of zip file. args : ndarray NumPy arrays with data to save...
https://github.com/zarr-developers/zarr/blob/fb8e6d5ea6bc26e451e5cf0eaaee36977556d5b5/zarr/convenience.py#L222-L299
save list to file
python
def save(self, content): """ Save any given content to the instance file. :param content: (str or bytes) :return: (None) """ # backup existing file if needed if os.path.exists(self.file_path) and not self.assume_yes: message = "Overwrite existing {}? (...
https://github.com/cuducos/getgist/blob/c70a0a9353eca43360b82c759d1e1514ec265d3b/getgist/local.py#L23-L41
save list to file
python
def save(self, filename): """ Saves the data for this settings instance to the given filename. :param filename | <str> """ dirname = os.path.dirname(filename) if not os.path.exists(dirname): os.makedirs(dirname) try: ...
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xsettings.py#L434-L458
save list to file
python
def save(self, file, contents, name=None, overwrite=False): """Save contents into a file. The format name can be specified explicitly or inferred from the file extension.""" if name is None: name = self.format_from_extension(op.splitext(file)[1]) file_format = self.file_type(...
https://github.com/rossant/ipymd/blob/d87c9ebc59d67fe78b0139ee00e0e5307682e303/ipymd/core/format_manager.py#L183-L201
save list to file
python
def save_playlist_file(self, stationFile=''): """ Save a playlist Create a txt file and write stations in it. Then rename it to final target return 0: All ok -1: Error writing file -2: Error renaming file """ if self._playlist_format_...
https://github.com/coderholic/pyradio/blob/c5219d350bccbccd49dbd627c1f886a952ea1963/pyradio/config.py#L258-L306
save list to file
python
def save_file(self, srcfile): """ Save a (raw) file to the store. """ filehash = digest_file(srcfile) if not os.path.exists(self.object_path(filehash)): # Copy the file to a temporary location first, then move, to make sure we don't end up with # truncated...
https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/store.py#L501-L513
save list to file
python
def save(self, savefile): """Do the TTS API request and write result to file. Args: savefile (string): The path and file name to save the ``mp3`` to. Raises: :class:`gTTSError`: When there's an error with the API request. """ with open(str(savefile), 'w...
https://github.com/pndurette/gTTS/blob/b01ac4eb22d40c6241202e202d0418ccf4f98460/gtts/tts.py#L238-L250
save list to file
python
def save_file(path, data, readable=False): """ Save to file :param path: File path to save :type path: str | unicode :param data: Data to save :type data: None | int | float | str | unicode | list | dict :param readable: Format file to be human readable (default: False) :type readable: ...
https://github.com/the01/python-flotils/blob/5954712776bb590107e5b2f4362d010bf74f77a1/flotils/loadable.py#L352-L383
save list to file
python
def save(self, filename=None): """Save the document to file. Arguments: * filename (str): The filename to save to. If not set (``None``, default), saves to the same file as loaded from. """ if not filename: filename = self.filename if not filename: ...
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6547-L6568
save list to file
python
def save_to_file(self, file_path, labels=None, predict_proba=True, show_predicted_value=True, **kwargs): """Saves html explanation to file. . Params: file_path: file to save explanations...
https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L202-L221
save list to file
python
def xmlrpc_save2file(self, filename): """ Save results and own state into file. """ savefile = open(filename,'wb') try: pickle.dump({'scheduled':self.scheduled_tasks, 'reschedule':self.reschedule},savefile) except pickle.PicklingError...
https://github.com/nwilming/ocupy/blob/a0bd64f822576feaa502939d6bafd1183b237d16/ocupy/parallel.py#L114-L125
save list to file
python
def save_to_filename(self, file_name, sep='\n'): """ Read all messages from the queue and persist them to local file. Messages are written to the file and the 'sep' string is written in between messages. Messages are deleted from the queue after being written to the file. ...
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sqs/queue.py#L339-L350
save list to file
python
def save(self, fname=''): """ Save the list of items to AIKIF core and optionally to local file fname """ if fname != '': with open(fname, 'w') as f: for i in self.lstPrograms: f.write(self.get_file_info_line(i, ',')) # sa...
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L88-L112
save list to file
python
def save_to_file_like(self, flo, format=None, **kwargs): """ Save the object to a given file like object in the given format. """ format = self.format if format is None else format save = getattr(self, "save_%s" % format, None) if save is None: raise ValueError("Unkno...
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/util.py#L65-L72
save list to file
python
def save(self, path=None, filter_name=None): """ Saves this document to a local file system. The optional first argument defaults to the document's path. Accept optional second argument which defines type of the saved file. Use one of FILTER_* constants or see list of ...
https://github.com/mila/pyoo/blob/1e024999f608c87ea72cd443e39c89eb0ba3cc62/pyoo.py#L1698-L1730
save list to file
python
def save(self, output=''): """Save the document. If no output is provided the file will be saved in the same location. Otherwise output can determine a target directory or file. """ self.file = self._get_output_file(output) with open(self.file, 'w', encoding='utf-8') as f...
https://github.com/glut23/webvtt-py/blob/7b4da0123c2e2afaf31402107528721eb1d3d481/webvtt/webvtt.py#L84-L91
save list to file
python
def save_to(self, destination, name=None, overwrite=False, delete_on_failure=True): """ To save the object in a local path :param destination: str - The directory to save the object to :param name: str - To rename the file name. Do not add extesion :param overwrite: :para...
https://github.com/mardix/flask-cloudy/blob/8085d8fbbafec6c358f0d307bfcb795de50d4acb/flask_cloudy.py#L605-L624
save list to file
python
def save(self, incoming_stream, size_limit=None, size=None, chunk_size=None, progress_callback=None): """Save file in the file system.""" fp = self.open(mode='wb') try: bytes_written, checksum = self._write_stream( incoming_stream, fp, chunk_size=chunk_si...
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/storage/pyfs.py#L96-L114
save list to file
python
def save(self, path): """ Saving stored files at a given path (relative paths are added). Args: path (str): root path where to save the files. """ for relative_path_and_filename, content in self.files.items(): full_path_and_filename = os.path.join(path, r...
https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/memfiles.py#L57-L72
save list to file
python
def save_to_file(self, text, filename, name): ''' Called by the engine to push a say command onto the queue. @param text: Text to speak @type text: unicode @param name: Name to associate with the utterance @type name: str ''' self._push(self._driver.save_...
https://github.com/nateshmbhat/pyttsx3/blob/0f304bff4812d50937393f1e3d7f89c9862a1623/pyttsx3/driver.py#L178-L187
save list to file
python
def save(self): """Persist config changes""" with open(self._config_file_path, 'w') as file: self._config_parser.write(file)
https://github.com/datadotworld/data.world-py/blob/ffaeb115f358731ab0b805b0c43b7ff2e3cf0a77/datadotworld/config.py#L140-L143
save list to file
python
def save_to_file(self, script_file): """ Save filter script to an mlx file """ # TODO: rasie exception here instead? if not self.filters: print('WARNING: no filters to save to file!') script_file_descriptor = open(script_file, 'w') script_file_descriptor.write(''.join...
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/mlx.py#L201-L208