How to use the synapseclient.utils.guess_file_name function in synapseclient

To help you get started, we’ve selected a few synapseclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_tests.py View on Github external
def test_guess_file_name():
    assert_equals(utils.guess_file_name('a/b'), 'b')
    assert_equals(utils.guess_file_name('file:///a/b'), 'b')
    assert_equals(utils.guess_file_name('A:/a/b'), 'b')
    assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
    assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
    assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
    assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
    assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
    assert_equals(utils.guess_file_name('/a/b'), 'b')
    assert_equals(utils.guess_file_name('/a/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
    assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
github Sage-Bionetworks / synapsePythonClient / synapseclient / client.py View on Github external
def _createChunkedFileUploadToken(self, filepath, mimetype):
        """
        This is the first step in uploading a large file. The resulting
        ChunkedFileToken will be required for all remaining chunk file requests.

        :returns: a `ChunkedFileToken `_
        """ 
        md5 = utils.md5_for_file(filepath).hexdigest()
        fileName = utils.guess_file_name(filepath)
        return self._createChunkedUploadToken(md5, fileName, mimetype)