partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
walk_dirs
Recursive helper for walk.
pgcontents/utils/sync.py
def walk_dirs(mgr, dirs): """ Recursive helper for walk. """ for directory in dirs: children = mgr.get( directory, content=True, type='directory', )['content'] dirs, files = map(sorted, _separate_dirs_files(children)) yield directory, d...
def walk_dirs(mgr, dirs): """ Recursive helper for walk. """ for directory in dirs: children = mgr.get( directory, content=True, type='directory', )['content'] dirs, files = map(sorted, _separate_dirs_files(children)) yield directory, d...
[ "Recursive", "helper", "for", "walk", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L53-L67
[ "def", "walk_dirs", "(", "mgr", ",", "dirs", ")", ":", "for", "directory", "in", "dirs", ":", "children", "=", "mgr", ".", "get", "(", "directory", ",", "content", "=", "True", ",", "type", "=", "'directory'", ",", ")", "[", "'content'", "]", "dirs",...
ed36268b7917332d16868208e1e565742a8753e1
test
walk_files
Iterate over all files visible to ``mgr``.
pgcontents/utils/sync.py
def walk_files(mgr): """ Iterate over all files visible to ``mgr``. """ for dir_, subdirs, files in walk_files(mgr): for file_ in files: yield file_
def walk_files(mgr): """ Iterate over all files visible to ``mgr``. """ for dir_, subdirs, files in walk_files(mgr): for file_ in files: yield file_
[ "Iterate", "over", "all", "files", "visible", "to", "mgr", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L70-L76
[ "def", "walk_files", "(", "mgr", ")", ":", "for", "dir_", ",", "subdirs", ",", "files", "in", "walk_files", "(", "mgr", ")", ":", "for", "file_", "in", "files", ":", "yield", "file_" ]
ed36268b7917332d16868208e1e565742a8753e1
test
walk_files_with_content
Iterate over the contents of all files visible to ``mgr``.
pgcontents/utils/sync.py
def walk_files_with_content(mgr): """ Iterate over the contents of all files visible to ``mgr``. """ for _, _, files in walk(mgr): for f in files: yield mgr.get(f, content=True)
def walk_files_with_content(mgr): """ Iterate over the contents of all files visible to ``mgr``. """ for _, _, files in walk(mgr): for f in files: yield mgr.get(f, content=True)
[ "Iterate", "over", "the", "contents", "of", "all", "files", "visible", "to", "mgr", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L79-L85
[ "def", "walk_files_with_content", "(", "mgr", ")", ":", "for", "_", ",", "_", ",", "files", "in", "walk", "(", "mgr", ")", ":", "for", "f", "in", "files", ":", "yield", "mgr", ".", "get", "(", "f", ",", "content", "=", "True", ")" ]
ed36268b7917332d16868208e1e565742a8753e1
test
reencrypt_all_users
Re-encrypt data for all users. This function is idempotent, meaning that it should be possible to apply the same re-encryption process multiple times without having any effect on the database. Idempotency is achieved by first attempting to decrypt with the old crypto and falling back to the new crypto...
pgcontents/utils/sync.py
def reencrypt_all_users(engine, old_crypto_factory, new_crypto_factory, logger): """ Re-encrypt data for all users. This function is idempotent, meaning that it should be possible to apply the same re-encryption process multiple ti...
def reencrypt_all_users(engine, old_crypto_factory, new_crypto_factory, logger): """ Re-encrypt data for all users. This function is idempotent, meaning that it should be possible to apply the same re-encryption process multiple ti...
[ "Re", "-", "encrypt", "data", "for", "all", "users", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L96-L148
[ "def", "reencrypt_all_users", "(", "engine", ",", "old_crypto_factory", ",", "new_crypto_factory", ",", "logger", ")", ":", "logger", ".", "info", "(", "\"Beginning re-encryption for all users.\"", ")", "for", "user_id", "in", "all_user_ids", "(", "engine", ")", ":"...
ed36268b7917332d16868208e1e565742a8753e1
test
reencrypt_single_user
Re-encrypt all files and checkpoints for a single user.
pgcontents/utils/sync.py
def reencrypt_single_user(engine, user_id, old_crypto, new_crypto, logger): """ Re-encrypt all files and checkpoints for a single user. """ # Use FallbackCrypto so that we're re-entrant if we halt partway through. crypto = FallbackCrypto([new_crypto, old_crypto]) reencrypt_user_content( ...
def reencrypt_single_user(engine, user_id, old_crypto, new_crypto, logger): """ Re-encrypt all files and checkpoints for a single user. """ # Use FallbackCrypto so that we're re-entrant if we halt partway through. crypto = FallbackCrypto([new_crypto, old_crypto]) reencrypt_user_content( ...
[ "Re", "-", "encrypt", "all", "files", "and", "checkpoints", "for", "a", "single", "user", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L151-L164
[ "def", "reencrypt_single_user", "(", "engine", ",", "user_id", ",", "old_crypto", ",", "new_crypto", ",", "logger", ")", ":", "# Use FallbackCrypto so that we're re-entrant if we halt partway through.", "crypto", "=", "FallbackCrypto", "(", "[", "new_crypto", ",", "old_cr...
ed36268b7917332d16868208e1e565742a8753e1
test
unencrypt_all_users
Unencrypt data for all users. Parameters ---------- engine : SQLAlchemy.engine Engine encapsulating database connections. old_crypto_factory : function[str -> Any] A function from user_id to an object providing the interface required by PostgresContentsManager.crypto. Results o...
pgcontents/utils/sync.py
def unencrypt_all_users(engine, old_crypto_factory, logger): """ Unencrypt data for all users. Parameters ---------- engine : SQLAlchemy.engine Engine encapsulating database connections. old_crypto_factory : function[str -> Any] A function from user_id to an object providing the...
def unencrypt_all_users(engine, old_crypto_factory, logger): """ Unencrypt data for all users. Parameters ---------- engine : SQLAlchemy.engine Engine encapsulating database connections. old_crypto_factory : function[str -> Any] A function from user_id to an object providing the...
[ "Unencrypt", "data", "for", "all", "users", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L167-L190
[ "def", "unencrypt_all_users", "(", "engine", ",", "old_crypto_factory", ",", "logger", ")", ":", "logger", ".", "info", "(", "\"Beginning re-encryption for all users.\"", ")", "for", "user_id", "in", "all_user_ids", "(", "engine", ")", ":", "unencrypt_single_user", ...
ed36268b7917332d16868208e1e565742a8753e1
test
unencrypt_single_user
Unencrypt all files and checkpoints for a single user.
pgcontents/utils/sync.py
def unencrypt_single_user(engine, user_id, old_crypto, logger): """ Unencrypt all files and checkpoints for a single user. """ reencrypt_user_content( engine=engine, user_id=user_id, old_decrypt_func=old_crypto.decrypt, new_encrypt_func=lambda s: s, logger=logger,...
def unencrypt_single_user(engine, user_id, old_crypto, logger): """ Unencrypt all files and checkpoints for a single user. """ reencrypt_user_content( engine=engine, user_id=user_id, old_decrypt_func=old_crypto.decrypt, new_encrypt_func=lambda s: s, logger=logger,...
[ "Unencrypt", "all", "files", "and", "checkpoints", "for", "a", "single", "user", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/sync.py#L193-L203
[ "def", "unencrypt_single_user", "(", "engine", ",", "user_id", ",", "old_crypto", ",", "logger", ")", ":", "reencrypt_user_content", "(", "engine", "=", "engine", ",", "user_id", "=", "user_id", ",", "old_decrypt_func", "=", "old_crypto", ".", "decrypt", ",", ...
ed36268b7917332d16868208e1e565742a8753e1
test
temp_alembic_ini
Temporarily write an alembic.ini file for use with alembic migration scripts.
pgcontents/utils/migrate.py
def temp_alembic_ini(alembic_dir_location, sqlalchemy_url): """ Temporarily write an alembic.ini file for use with alembic migration scripts. """ with TemporaryDirectory() as tempdir: alembic_ini_filename = join(tempdir, 'temp_alembic.ini') with open(alembic_ini_filename, 'w') as f: ...
def temp_alembic_ini(alembic_dir_location, sqlalchemy_url): """ Temporarily write an alembic.ini file for use with alembic migration scripts. """ with TemporaryDirectory() as tempdir: alembic_ini_filename = join(tempdir, 'temp_alembic.ini') with open(alembic_ini_filename, 'w') as f: ...
[ "Temporarily", "write", "an", "alembic", ".", "ini", "file", "for", "use", "with", "alembic", "migration", "scripts", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/migrate.py#L17-L31
[ "def", "temp_alembic_ini", "(", "alembic_dir_location", ",", "sqlalchemy_url", ")", ":", "with", "TemporaryDirectory", "(", ")", "as", "tempdir", ":", "alembic_ini_filename", "=", "join", "(", "tempdir", ",", "'temp_alembic.ini'", ")", "with", "open", "(", "alembi...
ed36268b7917332d16868208e1e565742a8753e1
test
upgrade
Upgrade the given database to revision.
pgcontents/utils/migrate.py
def upgrade(db_url, revision): """ Upgrade the given database to revision. """ with temp_alembic_ini(ALEMBIC_DIR_LOCATION, db_url) as alembic_ini: subprocess.check_call( ['alembic', '-c', alembic_ini, 'upgrade', revision] )
def upgrade(db_url, revision): """ Upgrade the given database to revision. """ with temp_alembic_ini(ALEMBIC_DIR_LOCATION, db_url) as alembic_ini: subprocess.check_call( ['alembic', '-c', alembic_ini, 'upgrade', revision] )
[ "Upgrade", "the", "given", "database", "to", "revision", "." ]
quantopian/pgcontents
python
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/utils/migrate.py#L34-L41
[ "def", "upgrade", "(", "db_url", ",", "revision", ")", ":", "with", "temp_alembic_ini", "(", "ALEMBIC_DIR_LOCATION", ",", "db_url", ")", "as", "alembic_ini", ":", "subprocess", ".", "check_call", "(", "[", "'alembic'", ",", "'-c'", ",", "alembic_ini", ",", "...
ed36268b7917332d16868208e1e565742a8753e1
test
AuthorMixin.get_author_string
Returns list of authors as a comma-separated string (with 'and' before last author).
dispatch/modules/content/mixins.py
def get_author_string(self, links=False): saved_args = locals() saved_args = saved_args['links'] """Returns list of authors as a comma-separated string (with 'and' before last author).""" def format_author(author): if links and author.person.slug: ret...
def get_author_string(self, links=False): saved_args = locals() saved_args = saved_args['links'] """Returns list of authors as a comma-separated string (with 'and' before last author).""" def format_author(author): if links and author.person.slug: ret...
[ "Returns", "list", "of", "authors", "as", "a", "comma", "-", "separated", "string", "(", "with", "and", "before", "last", "author", ")", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/mixins.py#L27-L49
[ "def", "get_author_string", "(", "self", ",", "links", "=", "False", ")", ":", "saved_args", "=", "locals", "(", ")", "saved_args", "=", "saved_args", "[", "'links'", "]", "def", "format_author", "(", "author", ")", ":", "if", "links", "and", "author", "...
8da6084fe61726f20e9cf675190480cfc45ee764
test
AuthorMixin.get_author_type_string
Returns list of authors as a comma-separated string sorted by author type (with 'and' before last author).
dispatch/modules/content/mixins.py
def get_author_type_string(self): """Returns list of authors as a comma-separated string sorted by author type (with 'and' before last author).""" authorTypeString = '' aStringA = '' aStringB = '' aStringC = '' aStringD = '' authors = dict((k, list(v)) f...
def get_author_type_string(self): """Returns list of authors as a comma-separated string sorted by author type (with 'and' before last author).""" authorTypeString = '' aStringA = '' aStringB = '' aStringC = '' aStringD = '' authors = dict((k, list(v)) f...
[ "Returns", "list", "of", "authors", "as", "a", "comma", "-", "separated", "string", "sorted", "by", "author", "type", "(", "with", "and", "before", "last", "author", ")", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/mixins.py#L51-L79
[ "def", "get_author_type_string", "(", "self", ")", ":", "authorTypeString", "=", "''", "aStringA", "=", "''", "aStringB", "=", "''", "aStringC", "=", "''", "aStringD", "=", "''", "authors", "=", "dict", "(", "(", "k", ",", "list", "(", "v", ")", ")", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ContentSerializer.sanitize_block
Santizes the data for the given block. If block has a matching embed serializer, use the `to_internal_value` method.
dispatch/api/serializers.py
def sanitize_block(self, block): """Santizes the data for the given block. If block has a matching embed serializer, use the `to_internal_value` method.""" embed_type = block.get('type', None) data = block.get('data', {}) serializer = self.serializers.get(embed_type, None) ...
def sanitize_block(self, block): """Santizes the data for the given block. If block has a matching embed serializer, use the `to_internal_value` method.""" embed_type = block.get('type', None) data = block.get('data', {}) serializer = self.serializers.get(embed_type, None) ...
[ "Santizes", "the", "data", "for", "the", "given", "block", ".", "If", "block", "has", "a", "matching", "embed", "serializer", "use", "the", "to_internal_value", "method", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L449-L462
[ "def", "sanitize_block", "(", "self", ",", "block", ")", ":", "embed_type", "=", "block", ".", "get", "(", "'type'", ",", "None", ")", "data", "=", "block", ".", "get", "(", "'data'", ",", "{", "}", ")", "serializer", "=", "self", ".", "serializers",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ContentSerializer.queue_instance
Queue an instance to be fetched from the database.
dispatch/api/serializers.py
def queue_instance(self, embed_type, data): """Queue an instance to be fetched from the database.""" serializer = self.serializers.get(embed_type, None) if serializer is None: return instance_id = serializer.get_id(data) if embed_type not in self.ids: ...
def queue_instance(self, embed_type, data): """Queue an instance to be fetched from the database.""" serializer = self.serializers.get(embed_type, None) if serializer is None: return instance_id = serializer.get_id(data) if embed_type not in self.ids: ...
[ "Queue", "an", "instance", "to", "be", "fetched", "from", "the", "database", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L464-L477
[ "def", "queue_instance", "(", "self", ",", "embed_type", ",", "data", ")", ":", "serializer", "=", "self", ".", "serializers", ".", "get", "(", "embed_type", ",", "None", ")", "if", "serializer", "is", "None", ":", "return", "instance_id", "=", "serializer...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ContentSerializer.load_instances
Fetch all queued instances of type `embed_type`, save results to `self.instances`
dispatch/api/serializers.py
def load_instances(self, embed_type, ids): """Fetch all queued instances of type `embed_type`, save results to `self.instances`""" serializer = self.serializers.get(embed_type, None) if serializer is None: return self.instances[embed_type] = serializer.fetch(ids)
def load_instances(self, embed_type, ids): """Fetch all queued instances of type `embed_type`, save results to `self.instances`""" serializer = self.serializers.get(embed_type, None) if serializer is None: return self.instances[embed_type] = serializer.fetch(ids)
[ "Fetch", "all", "queued", "instances", "of", "type", "embed_type", "save", "results", "to", "self", ".", "instances" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L479-L488
[ "def", "load_instances", "(", "self", ",", "embed_type", ",", "ids", ")", ":", "serializer", "=", "self", ".", "serializers", ".", "get", "(", "embed_type", ",", "None", ")", "if", "serializer", "is", "None", ":", "return", "self", ".", "instances", "[",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ContentSerializer.insert_instance
Insert a fetched instance into embed block.
dispatch/api/serializers.py
def insert_instance(self, block): """Insert a fetched instance into embed block.""" embed_type = block.get('type', None) data = block.get('data', {}) serializer = self.serializers.get(embed_type, None) if serializer is None: return block try: in...
def insert_instance(self, block): """Insert a fetched instance into embed block.""" embed_type = block.get('type', None) data = block.get('data', {}) serializer = self.serializers.get(embed_type, None) if serializer is None: return block try: in...
[ "Insert", "a", "fetched", "instance", "into", "embed", "block", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L490-L509
[ "def", "insert_instance", "(", "self", ",", "block", ")", ":", "embed_type", "=", "block", ".", "get", "(", "'type'", ",", "None", ")", "data", "=", "block", ".", "get", "(", "'data'", ",", "{", "}", ")", "serializer", "=", "self", ".", "serializers"...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ContentSerializer.load_data
Load data in bulk for each embed block.
dispatch/api/serializers.py
def load_data(self): """Load data in bulk for each embed block.""" for embed_type in self.ids.keys(): self.load_instances(embed_type, self.ids[embed_type])
def load_data(self): """Load data in bulk for each embed block.""" for embed_type in self.ids.keys(): self.load_instances(embed_type, self.ids[embed_type])
[ "Load", "data", "in", "bulk", "for", "each", "embed", "block", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L517-L521
[ "def", "load_data", "(", "self", ")", ":", "for", "embed_type", "in", "self", ".", "ids", ".", "keys", "(", ")", ":", "self", ".", "load_instances", "(", "embed_type", ",", "self", ".", "ids", "[", "embed_type", "]", ")" ]
8da6084fe61726f20e9cf675190480cfc45ee764
test
ZoneSerializer.validate
Perform validation of the widget data
dispatch/api/serializers.py
def validate(self, data): """Perform validation of the widget data""" from dispatch.theme import ThemeManager errors = {} if data.get('widget') is not None: try: widget = ThemeManager.Widgets.get(data['widget']) except WidgetNotFound as e: ...
def validate(self, data): """Perform validation of the widget data""" from dispatch.theme import ThemeManager errors = {} if data.get('widget') is not None: try: widget = ThemeManager.Widgets.get(data['widget']) except WidgetNotFound as e: ...
[ "Perform", "validation", "of", "the", "widget", "data" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/serializers.py#L889-L918
[ "def", "validate", "(", "self", ",", "data", ")", ":", "from", "dispatch", ".", "theme", "import", "ThemeManager", "errors", "=", "{", "}", "if", "data", ".", "get", "(", "'widget'", ")", "is", "not", "None", ":", "try", ":", "widget", "=", "ThemeMan...
8da6084fe61726f20e9cf675190480cfc45ee764
test
admin
Render HTML entry point for manager app.
dispatch/admin/urls.py
def admin(request): """Render HTML entry point for manager app.""" context = { 'api_url': settings.API_URL, 'app_js_bundle': 'manager-%s.js' % dispatch.__version__, 'app_css_bundle': 'manager-%s.css' % dispatch.__version__ } return render_to_response('manager/index.html', co...
def admin(request): """Render HTML entry point for manager app.""" context = { 'api_url': settings.API_URL, 'app_js_bundle': 'manager-%s.js' % dispatch.__version__, 'app_css_bundle': 'manager-%s.css' % dispatch.__version__ } return render_to_response('manager/index.html', co...
[ "Render", "HTML", "entry", "point", "for", "manager", "app", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/admin/urls.py#L8-L16
[ "def", "admin", "(", "request", ")", ":", "context", "=", "{", "'api_url'", ":", "settings", ".", "API_URL", ",", "'app_js_bundle'", ":", "'manager-%s.js'", "%", "dispatch", ".", "__version__", ",", "'app_css_bundle'", ":", "'manager-%s.css'", "%", "dispatch", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Template.to_json
Return JSON representation for this template
dispatch/theme/templates.py
def to_json(self): """Return JSON representation for this template""" result = {} for field in self.fields: result[field.name] = field.to_json(self.data.get(field.name)) return result
def to_json(self): """Return JSON representation for this template""" result = {} for field in self.fields: result[field.name] = field.to_json(self.data.get(field.name)) return result
[ "Return", "JSON", "representation", "for", "this", "template" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/templates.py#L14-L21
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "{", "}", "for", "field", "in", "self", ".", "fields", ":", "result", "[", "field", ".", "name", "]", "=", "field", ".", "to_json", "(", "self", ".", "data", ".", "get", "(", "field", ".", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
DispatchModelSerializer.hide_authenticated_fields
Hides authenticated_fields if request context is missing or user is not authenticated
dispatch/api/mixins.py
def hide_authenticated_fields(self): """Hides authenticated_fields if request context is missing or user is not authenticated""" authenticated_fields = getattr(self.Meta, 'authenticated_fields', []) if not self.is_authenticated(): for field in authenticated_fields: ...
def hide_authenticated_fields(self): """Hides authenticated_fields if request context is missing or user is not authenticated""" authenticated_fields = getattr(self.Meta, 'authenticated_fields', []) if not self.is_authenticated(): for field in authenticated_fields: ...
[ "Hides", "authenticated_fields", "if", "request", "context", "is", "missing", "or", "user", "is", "not", "authenticated" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/mixins.py#L98-L105
[ "def", "hide_authenticated_fields", "(", "self", ")", ":", "authenticated_fields", "=", "getattr", "(", "self", ".", "Meta", ",", "'authenticated_fields'", ",", "[", "]", ")", "if", "not", "self", ".", "is_authenticated", "(", ")", ":", "for", "field", "in",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
DispatchModelSerializer.exclude_fields
Excludes fields that are included in the queryparameters
dispatch/api/mixins.py
def exclude_fields(self): """Excludes fields that are included in the queryparameters""" request = self.context.get('request') if request: exclude = request.query_params.get('exclude', None) if exclude is None: return excluded_fields = exclude...
def exclude_fields(self): """Excludes fields that are included in the queryparameters""" request = self.context.get('request') if request: exclude = request.query_params.get('exclude', None) if exclude is None: return excluded_fields = exclude...
[ "Excludes", "fields", "that", "are", "included", "in", "the", "queryparameters" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/mixins.py#L107-L116
[ "def", "exclude_fields", "(", "self", ")", ":", "request", "=", "self", ".", "context", ".", "get", "(", "'request'", ")", "if", "request", ":", "exclude", "=", "request", ".", "query_params", ".", "get", "(", "'exclude'", ",", "None", ")", "if", "excl...
8da6084fe61726f20e9cf675190480cfc45ee764
test
PublishableManager.get
Get the latest article with the given primary key.
dispatch/modules/content/managers.py
def get(self, *args, **kwargs): """Get the latest article with the given primary key.""" if 'pk' in kwargs: kwargs['parent'] = kwargs['pk'] kwargs['head'] = True del kwargs['pk'] """If the url requested includes the querystring parameters 'version' and 'previ...
def get(self, *args, **kwargs): """Get the latest article with the given primary key.""" if 'pk' in kwargs: kwargs['parent'] = kwargs['pk'] kwargs['head'] = True del kwargs['pk'] """If the url requested includes the querystring parameters 'version' and 'previ...
[ "Get", "the", "latest", "article", "with", "the", "given", "primary", "key", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/managers.py#L6-L31
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'pk'", "in", "kwargs", ":", "kwargs", "[", "'parent'", "]", "=", "kwargs", "[", "'pk'", "]", "kwargs", "[", "'head'", "]", "=", "True", "del", "kwargs", "[", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
ArticleViewSet.get_queryset
Optionally restricts the returned articles by filtering against a `topic` query parameter in the URL.
dispatch/api/views.py
def get_queryset(self): """Optionally restricts the returned articles by filtering against a `topic` query parameter in the URL.""" # Get base queryset from DispatchPublishableMixin queryset = self.get_publishable_queryset() # Optimize queries by prefetching related data ...
def get_queryset(self): """Optionally restricts the returned articles by filtering against a `topic` query parameter in the URL.""" # Get base queryset from DispatchPublishableMixin queryset = self.get_publishable_queryset() # Optimize queries by prefetching related data ...
[ "Optionally", "restricts", "the", "returned", "articles", "by", "filtering", "against", "a", "topic", "query", "parameter", "in", "the", "URL", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/views.py#L76-L112
[ "def", "get_queryset", "(", "self", ")", ":", "# Get base queryset from DispatchPublishableMixin", "queryset", "=", "self", ".", "get_publishable_queryset", "(", ")", "# Optimize queries by prefetching related data", "queryset", "=", "queryset", ".", "select_related", "(", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
PageViewSet.get_queryset
Only display unpublished content to authenticated users, filter by query parameter if present.
dispatch/api/views.py
def get_queryset(self): """Only display unpublished content to authenticated users, filter by query parameter if present.""" # Get base queryset from DispatchPublishableMixin queryset = self.get_publishable_queryset() queryset = queryset.order_by('-updated_at') # Optio...
def get_queryset(self): """Only display unpublished content to authenticated users, filter by query parameter if present.""" # Get base queryset from DispatchPublishableMixin queryset = self.get_publishable_queryset() queryset = queryset.order_by('-updated_at') # Optio...
[ "Only", "display", "unpublished", "content", "to", "authenticated", "users", "filter", "by", "query", "parameter", "if", "present", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/views.py#L138-L153
[ "def", "get_queryset", "(", "self", ")", ":", "# Get base queryset from DispatchPublishableMixin", "queryset", "=", "self", ".", "get_publishable_queryset", "(", ")", "queryset", "=", "queryset", ".", "order_by", "(", "'-updated_at'", ")", "# Optionally filter by a query ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
NullBooleanField.get_attribute
Overrides the default get_attribute method to convert None values to False.
dispatch/api/fields.py
def get_attribute(self, instance): """Overrides the default get_attribute method to convert None values to False.""" attr = super(NullBooleanField, self).get_attribute(instance) return True if attr else False
def get_attribute(self, instance): """Overrides the default get_attribute method to convert None values to False.""" attr = super(NullBooleanField, self).get_attribute(instance) return True if attr else False
[ "Overrides", "the", "default", "get_attribute", "method", "to", "convert", "None", "values", "to", "False", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/fields.py#L16-L20
[ "def", "get_attribute", "(", "self", ",", "instance", ")", ":", "attr", "=", "super", "(", "NullBooleanField", ",", "self", ")", ".", "get_attribute", "(", "instance", ")", "return", "True", "if", "attr", "else", "False" ]
8da6084fe61726f20e9cf675190480cfc45ee764
test
validate_widget
Checks that the given widget contains the required fields
dispatch/theme/validators.py
def validate_widget(widget): """Checks that the given widget contains the required fields""" if not has_valid_id(widget): raise InvalidWidget("%s must contain a valid 'id' attribute" % widget.__name__) if not has_valid_name(widget): raise InvalidWidget("%s must contain a valid 'name' attri...
def validate_widget(widget): """Checks that the given widget contains the required fields""" if not has_valid_id(widget): raise InvalidWidget("%s must contain a valid 'id' attribute" % widget.__name__) if not has_valid_name(widget): raise InvalidWidget("%s must contain a valid 'name' attri...
[ "Checks", "that", "the", "given", "widget", "contains", "the", "required", "fields" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/validators.py#L20-L33
[ "def", "validate_widget", "(", "widget", ")", ":", "if", "not", "has_valid_id", "(", "widget", ")", ":", "raise", "InvalidWidget", "(", "\"%s must contain a valid 'id' attribute\"", "%", "widget", ".", "__name__", ")", "if", "not", "has_valid_name", "(", "widget",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
validate_zone
Checks that the given zone contains the required fields
dispatch/theme/validators.py
def validate_zone(zone): """Checks that the given zone contains the required fields""" if not has_valid_id(zone): raise InvalidZone("%s must contain a valid 'id' attribute" % zone.__name__) if not has_valid_name(zone): raise InvalidZone("%s must contain a valid 'name' attribute" % zone.__n...
def validate_zone(zone): """Checks that the given zone contains the required fields""" if not has_valid_id(zone): raise InvalidZone("%s must contain a valid 'id' attribute" % zone.__name__) if not has_valid_name(zone): raise InvalidZone("%s must contain a valid 'name' attribute" % zone.__n...
[ "Checks", "that", "the", "given", "zone", "contains", "the", "required", "fields" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/validators.py#L35-L42
[ "def", "validate_zone", "(", "zone", ")", ":", "if", "not", "has_valid_id", "(", "zone", ")", ":", "raise", "InvalidZone", "(", "\"%s must contain a valid 'id' attribute\"", "%", "zone", ".", "__name__", ")", "if", "not", "has_valid_name", "(", "zone", ")", ":...
8da6084fe61726f20e9cf675190480cfc45ee764
test
is_valid_uuid
Return True if id is a valid UUID, False otherwise.
dispatch/theme/validators.py
def is_valid_uuid(id): """Return True if id is a valid UUID, False otherwise.""" if not isinstance(id, basestring): return False try: val = UUID(id, version=4) except ValueError: return False return True
def is_valid_uuid(id): """Return True if id is a valid UUID, False otherwise.""" if not isinstance(id, basestring): return False try: val = UUID(id, version=4) except ValueError: return False return True
[ "Return", "True", "if", "id", "is", "a", "valid", "UUID", "False", "otherwise", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/validators.py#L49-L59
[ "def", "is_valid_uuid", "(", "id", ")", ":", "if", "not", "isinstance", "(", "id", ",", "basestring", ")", ":", "return", "False", "try", ":", "val", "=", "UUID", "(", "id", ",", "version", "=", "4", ")", "except", "ValueError", ":", "return", "False...
8da6084fe61726f20e9cf675190480cfc45ee764
test
User.get_permissions
Returns the user's permissions.
dispatch/modules/auth/models.py
def get_permissions(self): """Returns the user's permissions.""" permissions = '' if self.groups.filter(name='Admin').exists() or self.is_superuser: permissions = 'admin' return permissions
def get_permissions(self): """Returns the user's permissions.""" permissions = '' if self.groups.filter(name='Admin').exists() or self.is_superuser: permissions = 'admin' return permissions
[ "Returns", "the", "user", "s", "permissions", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/auth/models.py#L48-L55
[ "def", "get_permissions", "(", "self", ")", ":", "permissions", "=", "''", "if", "self", ".", "groups", ".", "filter", "(", "name", "=", "'Admin'", ")", ".", "exists", "(", ")", "or", "self", ".", "is_superuser", ":", "permissions", "=", "'admin'", "re...
8da6084fe61726f20e9cf675190480cfc45ee764
test
User.modify_permissions
Modify the user's permissions.
dispatch/modules/auth/models.py
def modify_permissions(self, permissions): """Modify the user's permissions.""" group = Group.objects.get(name='Admin') if permissions == 'admin': self.groups.add(group) else: self.groups.remove(group)
def modify_permissions(self, permissions): """Modify the user's permissions.""" group = Group.objects.get(name='Admin') if permissions == 'admin': self.groups.add(group) else: self.groups.remove(group)
[ "Modify", "the", "user", "s", "permissions", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/auth/models.py#L57-L65
[ "def", "modify_permissions", "(", "self", ",", "permissions", ")", ":", "group", "=", "Group", ".", "objects", ".", "get", "(", "name", "=", "'Admin'", ")", "if", "permissions", "==", "'admin'", ":", "self", ".", "groups", ".", "add", "(", "group", ")"...
8da6084fe61726f20e9cf675190480cfc45ee764
test
AuthorValidator
Raise a ValidationError if data does not match the author format.
dispatch/api/validators.py
def AuthorValidator(data): """Raise a ValidationError if data does not match the author format.""" if not isinstance(data, list): # Convert single instance to a list data = [data] for author in data: if 'person' not in author: raise ValidationError('An author must contai...
def AuthorValidator(data): """Raise a ValidationError if data does not match the author format.""" if not isinstance(data, list): # Convert single instance to a list data = [data] for author in data: if 'person' not in author: raise ValidationError('An author must contai...
[ "Raise", "a", "ValidationError", "if", "data", "does", "not", "match", "the", "author", "format", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/api/validators.py#L89-L100
[ "def", "AuthorValidator", "(", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "list", ")", ":", "# Convert single instance to a list", "data", "=", "[", "data", "]", "for", "author", "in", "data", ":", "if", "'person'", "not", "in", "author...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Zone.save
Save widget data for this zone.
dispatch/theme/widgets.py
def save(self, validated_data): """Save widget data for this zone.""" (zone, created) = ZoneModel.objects.get_or_create(zone_id=self.id) zone.widget_id = validated_data['widget'] zone.data = validated_data['data'] # Call widget before-save hook on nested widgets for ke...
def save(self, validated_data): """Save widget data for this zone.""" (zone, created) = ZoneModel.objects.get_or_create(zone_id=self.id) zone.widget_id = validated_data['widget'] zone.data = validated_data['data'] # Call widget before-save hook on nested widgets for ke...
[ "Save", "widget", "data", "for", "this", "zone", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L76-L92
[ "def", "save", "(", "self", ",", "validated_data", ")", ":", "(", "zone", ",", "created", ")", "=", "ZoneModel", ".", "objects", ".", "get_or_create", "(", "zone_id", "=", "self", ".", "id", ")", "zone", ".", "widget_id", "=", "validated_data", "[", "'...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Widget.get_data
Returns data from each field.
dispatch/theme/widgets.py
def get_data(self): """Returns data from each field.""" result = {} for field in self.fields: result[field.name] = self.data.get(field.name) return result
def get_data(self): """Returns data from each field.""" result = {} for field in self.fields: result[field.name] = self.data.get(field.name) return result
[ "Returns", "data", "from", "each", "field", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L114-L121
[ "def", "get_data", "(", "self", ")", ":", "result", "=", "{", "}", "for", "field", "in", "self", ".", "fields", ":", "result", "[", "field", ".", "name", "]", "=", "self", ".", "data", ".", "get", "(", "field", ".", "name", ")", "return", "result...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Widget.prepare_data
Prepare widget data for template.
dispatch/theme/widgets.py
def prepare_data(self): """Prepare widget data for template.""" result = {} for field in self.fields: data = self.data.get(field.name) result[field.name] = field.prepare_data(data) return result
def prepare_data(self): """Prepare widget data for template.""" result = {} for field in self.fields: data = self.data.get(field.name) result[field.name] = field.prepare_data(data) return result
[ "Prepare", "widget", "data", "for", "template", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L132-L140
[ "def", "prepare_data", "(", "self", ")", ":", "result", "=", "{", "}", "for", "field", "in", "self", ".", "fields", ":", "data", "=", "self", ".", "data", ".", "get", "(", "field", ".", "name", ")", "result", "[", "field", ".", "name", "]", "=", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Widget.render
Renders the widget as HTML.
dispatch/theme/widgets.py
def render(self, data=None, add_context=None): """Renders the widget as HTML.""" template = loader.get_template(self.template) if not data: data = self.context(self.prepare_data()) if add_context is not None: for key, value in add_context.iteritems(): ...
def render(self, data=None, add_context=None): """Renders the widget as HTML.""" template = loader.get_template(self.template) if not data: data = self.context(self.prepare_data()) if add_context is not None: for key, value in add_context.iteritems(): ...
[ "Renders", "the", "widget", "as", "HTML", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/theme/widgets.py#L142-L154
[ "def", "render", "(", "self", ",", "data", "=", "None", ",", "add_context", "=", "None", ")", ":", "template", "=", "loader", ".", "get_template", "(", "self", ".", "template", ")", "if", "not", "data", ":", "data", "=", "self", ".", "context", "(", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
content_to_html
Returns artilce/page content as HTML
dispatch/modules/content/render.py
def content_to_html(content, article_id): """Returns artilce/page content as HTML""" def render_node(html, node, index): """Renders node as HTML""" if node['type'] == 'paragraph': return html + '<p>%s</p>' % node['data'] else: if node['type'] == 'ad': ...
def content_to_html(content, article_id): """Returns artilce/page content as HTML""" def render_node(html, node, index): """Renders node as HTML""" if node['type'] == 'paragraph': return html + '<p>%s</p>' % node['data'] else: if node['type'] == 'ad': ...
[ "Returns", "artilce", "/", "page", "content", "as", "HTML" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/render.py#L5-L38
[ "def", "content_to_html", "(", "content", ",", "article_id", ")", ":", "def", "render_node", "(", "html", ",", "node", ",", "index", ")", ":", "\"\"\"Renders node as HTML\"\"\"", "if", "node", "[", "'type'", "]", "==", "'paragraph'", ":", "return", "html", "...
8da6084fe61726f20e9cf675190480cfc45ee764
test
content_to_json
Returns article/page content as JSON
dispatch/modules/content/render.py
def content_to_json(content): """Returns article/page content as JSON""" def render_node(node): """Renders node as JSON""" if node['type'] == 'paragraph': return node else: return { 'type': node['type'], 'data': embeds.to_json(nod...
def content_to_json(content): """Returns article/page content as JSON""" def render_node(node): """Renders node as JSON""" if node['type'] == 'paragraph': return node else: return { 'type': node['type'], 'data': embeds.to_json(nod...
[ "Returns", "article", "/", "page", "content", "as", "JSON" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/render.py#L40-L54
[ "def", "content_to_json", "(", "content", ")", ":", "def", "render_node", "(", "node", ")", ":", "\"\"\"Renders node as JSON\"\"\"", "if", "node", "[", "'type'", "]", "==", "'paragraph'", ":", "return", "node", "else", ":", "return", "{", "'type'", ":", "nod...
8da6084fe61726f20e9cf675190480cfc45ee764
test
BaseIntegration.get_settings
Retrieves the settings for this integration as a dictionary. Removes all hidden fields if show_hidden=False
dispatch/modules/integrations/integrations.py
def get_settings(cls, show_hidden=False): """ Retrieves the settings for this integration as a dictionary. Removes all hidden fields if show_hidden=False """ settings = Integration.objects.get_settings(cls.ID) if not show_hidden: for field in cls.HIDDEN_FIEL...
def get_settings(cls, show_hidden=False): """ Retrieves the settings for this integration as a dictionary. Removes all hidden fields if show_hidden=False """ settings = Integration.objects.get_settings(cls.ID) if not show_hidden: for field in cls.HIDDEN_FIEL...
[ "Retrieves", "the", "settings", "for", "this", "integration", "as", "a", "dictionary", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/integrations/integrations.py#L44-L56
[ "def", "get_settings", "(", "cls", ",", "show_hidden", "=", "False", ")", ":", "settings", "=", "Integration", ".", "objects", ".", "get_settings", "(", "cls", ".", "ID", ")", "if", "not", "show_hidden", ":", "for", "field", "in", "cls", ".", "HIDDEN_FIE...
8da6084fe61726f20e9cf675190480cfc45ee764
test
FacebookInstantArticlesIntegration.callback
Receive OAuth callback request from Facebook.
dispatch/modules/integrations/integrations.py
def callback(cls, user, query): """Receive OAuth callback request from Facebook.""" # Get settings for this integration settings = cls.get_settings(show_hidden=True) fb = Facebook() payload = { 'client_id': settings['client_id'], 'client_secret': settin...
def callback(cls, user, query): """Receive OAuth callback request from Facebook.""" # Get settings for this integration settings = cls.get_settings(show_hidden=True) fb = Facebook() payload = { 'client_id': settings['client_id'], 'client_secret': settin...
[ "Receive", "OAuth", "callback", "request", "from", "Facebook", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/integrations/integrations.py#L91-L119
[ "def", "callback", "(", "cls", ",", "user", ",", "query", ")", ":", "# Get settings for this integration", "settings", "=", "cls", ".", "get_settings", "(", "show_hidden", "=", "True", ")", "fb", "=", "Facebook", "(", ")", "payload", "=", "{", "'client_id'",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
IntegrationManager.get_settings
Return settings for given integration as a dictionary.
dispatch/modules/integrations/managers.py
def get_settings(self, integration_id): """Return settings for given integration as a dictionary.""" try: integration = self.get(integration_id=integration_id) return json.loads(integration.settings) except (self.model.DoesNotExist, ValueError): return {}
def get_settings(self, integration_id): """Return settings for given integration as a dictionary.""" try: integration = self.get(integration_id=integration_id) return json.loads(integration.settings) except (self.model.DoesNotExist, ValueError): return {}
[ "Return", "settings", "for", "given", "integration", "as", "a", "dictionary", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/integrations/managers.py#L7-L14
[ "def", "get_settings", "(", "self", ",", "integration_id", ")", ":", "try", ":", "integration", "=", "self", ".", "get", "(", "integration_id", "=", "integration_id", ")", "return", "json", ".", "loads", "(", "integration", ".", "settings", ")", "except", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
IntegrationManager.update_settings
Updates settings for given integration.
dispatch/modules/integrations/managers.py
def update_settings(self, integration_id, settings): """Updates settings for given integration.""" (integration, created) = self.get_or_create(integration_id=integration_id) try: current_settings = json.loads(integration.settings) except ValueError: current_sett...
def update_settings(self, integration_id, settings): """Updates settings for given integration.""" (integration, created) = self.get_or_create(integration_id=integration_id) try: current_settings = json.loads(integration.settings) except ValueError: current_sett...
[ "Updates", "settings", "for", "given", "integration", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/integrations/managers.py#L16-L30
[ "def", "update_settings", "(", "self", ",", "integration_id", ",", "settings", ")", ":", "(", "integration", ",", "created", ")", "=", "self", ".", "get_or_create", "(", "integration_id", "=", "integration_id", ")", "try", ":", "current_settings", "=", "json",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
signup
Handles requests to the user signup page.
dispatch/admin/views.py
def signup(request, uuid=None): """Handles requests to the user signup page.""" invite = get_object_or_404(Invite.objects.all(), id=uuid) if invite.expiration_date < timezone.now(): invite.delete() raise Http404('This page does not exist.') if request.method == 'POST': form = ...
def signup(request, uuid=None): """Handles requests to the user signup page.""" invite = get_object_or_404(Invite.objects.all(), id=uuid) if invite.expiration_date < timezone.now(): invite.delete() raise Http404('This page does not exist.') if request.method == 'POST': form = ...
[ "Handles", "requests", "to", "the", "user", "signup", "page", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/admin/views.py#L14-L60
[ "def", "signup", "(", "request", ",", "uuid", "=", "None", ")", ":", "invite", "=", "get_object_or_404", "(", "Invite", ".", "objects", ".", "all", "(", ")", ",", "id", "=", "uuid", ")", "if", "invite", ".", "expiration_date", "<", "timezone", ".", "...
8da6084fe61726f20e9cf675190480cfc45ee764
test
maptag
Returns the HTML produced from enclosing each item in `contents` in a tag of type `tagname`
dispatch/modules/content/embeds.py
def maptag(tagname, contents): """Returns the HTML produced from enclosing each item in `contents` in a tag of type `tagname`""" return u''.join(tag(tagname, item) for item in contents)
def maptag(tagname, contents): """Returns the HTML produced from enclosing each item in `contents` in a tag of type `tagname`""" return u''.join(tag(tagname, item) for item in contents)
[ "Returns", "the", "HTML", "produced", "from", "enclosing", "each", "item", "in", "contents", "in", "a", "tag", "of", "type", "tagname" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/embeds.py#L31-L34
[ "def", "maptag", "(", "tagname", ",", "contents", ")", ":", "return", "u''", ".", "join", "(", "tag", "(", "tagname", ",", "item", ")", "for", "item", "in", "contents", ")" ]
8da6084fe61726f20e9cf675190480cfc45ee764
test
zone
Renders the contents of the zone with given zone_id.
dispatch/templatetags/dispatch_tags.py
def zone(zone_id, **kwargs): """Renders the contents of the zone with given zone_id.""" try: zone = ThemeManager.Zones.get(zone_id) except ZoneNotFound: return '' try: return zone.widget.render(add_context=kwargs) except (WidgetNotFound, AttributeError): pass r...
def zone(zone_id, **kwargs): """Renders the contents of the zone with given zone_id.""" try: zone = ThemeManager.Zones.get(zone_id) except ZoneNotFound: return '' try: return zone.widget.render(add_context=kwargs) except (WidgetNotFound, AttributeError): pass r...
[ "Renders", "the", "contents", "of", "the", "zone", "with", "given", "zone_id", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/templatetags/dispatch_tags.py#L10-L23
[ "def", "zone", "(", "zone_id", ",", "*", "*", "kwargs", ")", ":", "try", ":", "zone", "=", "ThemeManager", ".", "Zones", ".", "get", "(", "zone_id", ")", "except", "ZoneNotFound", ":", "return", "''", "try", ":", "return", "zone", ".", "widget", ".",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Publishable.save
Handles the saving/updating of a Publishable instance. Arguments: revision - if True, a new version of this Publishable will be created.
dispatch/modules/content/models.py
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...
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...
[ "Handles", "the", "saving", "/", "updating", "of", "a", "Publishable", "instance", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L170-L222
[ "def", "save", "(", "self", ",", "revision", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "revision", ":", "# If this is a revision, set it to be the head of the list and increment the revision id", "self", ".", "head", "=", "True", "sel...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Publishable.save_featured_image
Handles saving the featured image. If data is None, the featured image will be removed. `data` should be dictionary with the following format: { 'image_id': int, 'caption': str, 'credit': str }
dispatch/modules/content/models.py
def save_featured_image(self, data): """ Handles saving the featured image. If data is None, the featured image will be removed. `data` should be dictionary with the following format: { 'image_id': int, 'caption': str, 'credit': str ...
def save_featured_image(self, data): """ Handles saving the featured image. If data is None, the featured image will be removed. `data` should be dictionary with the following format: { 'image_id': int, 'caption': str, 'credit': str ...
[ "Handles", "saving", "the", "featured", "image", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L231-L274
[ "def", "save_featured_image", "(", "self", ",", "data", ")", ":", "attachment", "=", "self", ".", "featured_image", "if", "data", "is", "None", ":", "if", "attachment", ":", "attachment", ".", "delete", "(", ")", "self", ".", "featured_image", "=", "None",...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Article.save_subsection
Save the subsection to the parent article
dispatch/modules/content/models.py
def save_subsection(self, subsection_id): """ Save the subsection to the parent article """ Article.objects.filter(parent_id=self.parent.id).update(subsection_id=subsection_id)
def save_subsection(self, subsection_id): """ Save the subsection to the parent article """ Article.objects.filter(parent_id=self.parent.id).update(subsection_id=subsection_id)
[ "Save", "the", "subsection", "to", "the", "parent", "article" ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L407-L409
[ "def", "save_subsection", "(", "self", ",", "subsection_id", ")", ":", "Article", ".", "objects", ".", "filter", "(", "parent_id", "=", "self", ".", "parent", ".", "id", ")", ".", "update", "(", "subsection_id", "=", "subsection_id", ")" ]
8da6084fe61726f20e9cf675190480cfc45ee764
test
Image.get_extension
Returns the file extension.
dispatch/modules/content/models.py
def get_extension(self): """Returns the file extension.""" ext = os.path.splitext(self.img.name)[1] if ext: # Remove period from extension return ext[1:] return ext
def get_extension(self): """Returns the file extension.""" ext = os.path.splitext(self.img.name)[1] if ext: # Remove period from extension return ext[1:] return ext
[ "Returns", "the", "file", "extension", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L497-L503
[ "def", "get_extension", "(", "self", ")", ":", "ext", "=", "os", ".", "path", ".", "splitext", "(", "self", ".", "img", ".", "name", ")", "[", "1", "]", "if", "ext", ":", "# Remove period from extension", "return", "ext", "[", "1", ":", "]", "return"...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Image.get_medium_url
Returns the medium size image URL.
dispatch/modules/content/models.py
def get_medium_url(self): """Returns the medium size image URL.""" if self.is_gif(): return self.get_absolute_url() return '%s%s-%s.jpg' % (settings.MEDIA_URL, self.get_name(), 'medium')
def get_medium_url(self): """Returns the medium size image URL.""" if self.is_gif(): return self.get_absolute_url() return '%s%s-%s.jpg' % (settings.MEDIA_URL, self.get_name(), 'medium')
[ "Returns", "the", "medium", "size", "image", "URL", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L509-L513
[ "def", "get_medium_url", "(", "self", ")", ":", "if", "self", ".", "is_gif", "(", ")", ":", "return", "self", ".", "get_absolute_url", "(", ")", "return", "'%s%s-%s.jpg'", "%", "(", "settings", ".", "MEDIA_URL", ",", "self", ".", "get_name", "(", ")", ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Image.save
Custom save method to process thumbnails and save image dimensions.
dispatch/modules/content/models.py
def save(self, **kwargs): """Custom save method to process thumbnails and save image dimensions.""" is_new = self.pk is None if is_new: # Make filenames lowercase self.img.name = self.img.name.lower() # Call super method super(Image, self).save(*...
def save(self, **kwargs): """Custom save method to process thumbnails and save image dimensions.""" is_new = self.pk is None if is_new: # Make filenames lowercase self.img.name = self.img.name.lower() # Call super method super(Image, self).save(*...
[ "Custom", "save", "method", "to", "process", "thumbnails", "and", "save", "image", "dimensions", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L520-L547
[ "def", "save", "(", "self", ",", "*", "*", "kwargs", ")", ":", "is_new", "=", "self", ".", "pk", "is", "None", "if", "is_new", ":", "# Make filenames lowercase", "self", ".", "img", ".", "name", "=", "self", ".", "img", ".", "name", ".", "lower", "...
8da6084fe61726f20e9cf675190480cfc45ee764
test
Image.save_thumbnail
Processes and saves a resized thumbnail version of the image.
dispatch/modules/content/models.py
def save_thumbnail(self, image, size, name, label, file_type): """Processes and saves a resized thumbnail version of the image.""" width, height = size (imw, imh) = image.size # If image is larger than thumbnail size, resize image if (imw > width) or (imh > height): ...
def save_thumbnail(self, image, size, name, label, file_type): """Processes and saves a resized thumbnail version of the image.""" width, height = size (imw, imh) = image.size # If image is larger than thumbnail size, resize image if (imw > width) or (imh > height): ...
[ "Processes", "and", "saves", "a", "resized", "thumbnail", "version", "of", "the", "image", "." ]
ubyssey/dispatch
python
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/models.py#L549-L573
[ "def", "save_thumbnail", "(", "self", ",", "image", ",", "size", ",", "name", ",", "label", ",", "file_type", ")", ":", "width", ",", "height", "=", "size", "(", "imw", ",", "imh", ")", "=", "image", ".", "size", "# If image is larger than thumbnail size, ...
8da6084fe61726f20e9cf675190480cfc45ee764
test
MySQL.init_app
Initialize the `app` for use with this :class:`~flask_mysqldb.MySQL` class. This is called automatically if `app` is passed to :meth:`~MySQL.__init__`. :param flask.Flask app: the application to configure for use with this :class:`~flask_mysqldb.MySQL` class.
flask_mysqldb/__init__.py
def init_app(self, app): """Initialize the `app` for use with this :class:`~flask_mysqldb.MySQL` class. This is called automatically if `app` is passed to :meth:`~MySQL.__init__`. :param flask.Flask app: the application to configure for use with this :class:`~flask_m...
def init_app(self, app): """Initialize the `app` for use with this :class:`~flask_mysqldb.MySQL` class. This is called automatically if `app` is passed to :meth:`~MySQL.__init__`. :param flask.Flask app: the application to configure for use with this :class:`~flask_m...
[ "Initialize", "the", "app", "for", "use", "with", "this", ":", "class", ":", "~flask_mysqldb", ".", "MySQL", "class", ".", "This", "is", "called", "automatically", "if", "app", "is", "passed", "to", ":", "meth", ":", "~MySQL", ".", "__init__", "." ]
admiralobvious/flask-mysqldb
python
https://github.com/admiralobvious/flask-mysqldb/blob/418c794e9b031addd026f29312865403baea55a0/flask_mysqldb/__init__.py#L13-L37
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "app", ".", "config", ".", "setdefault", "(", "'MYSQL_HOST'", ",", "'localhost'", ")", "app", ".", "config", ".", "setdefault", "(", "'MYSQL_USER'", ",", "None", ")", "app", ".", "config", ".", "set...
418c794e9b031addd026f29312865403baea55a0
test
MySQL.connection
Attempts to connect to the MySQL server. :return: Bound MySQL connection object if successful or ``None`` if unsuccessful.
flask_mysqldb/__init__.py
def connection(self): """Attempts to connect to the MySQL server. :return: Bound MySQL connection object if successful or ``None`` if unsuccessful. """ ctx = _app_ctx_stack.top if ctx is not None: if not hasattr(ctx, 'mysql_db'): ctx.mysq...
def connection(self): """Attempts to connect to the MySQL server. :return: Bound MySQL connection object if successful or ``None`` if unsuccessful. """ ctx = _app_ctx_stack.top if ctx is not None: if not hasattr(ctx, 'mysql_db'): ctx.mysq...
[ "Attempts", "to", "connect", "to", "the", "MySQL", "server", "." ]
admiralobvious/flask-mysqldb
python
https://github.com/admiralobvious/flask-mysqldb/blob/418c794e9b031addd026f29312865403baea55a0/flask_mysqldb/__init__.py#L84-L95
[ "def", "connection", "(", "self", ")", ":", "ctx", "=", "_app_ctx_stack", ".", "top", "if", "ctx", "is", "not", "None", ":", "if", "not", "hasattr", "(", "ctx", ",", "'mysql_db'", ")", ":", "ctx", ".", "mysql_db", "=", "self", ".", "connect", "return...
418c794e9b031addd026f29312865403baea55a0
test
BandwidthLimiter.get_bandwith_limited_stream
Wraps a fileobj in a bandwidth limited stream wrapper :type fileobj: file-like obj :param fileobj: The file-like obj to wrap :type transfer_coordinator: s3transfer.futures.TransferCoordinator param transfer_coordinator: The coordinator for the general transfer that the wrap...
s3transfer/bandwidth.py
def get_bandwith_limited_stream(self, fileobj, transfer_coordinator, enabled=True): """Wraps a fileobj in a bandwidth limited stream wrapper :type fileobj: file-like obj :param fileobj: The file-like obj to wrap :type transfer_coordinator: s3transfer...
def get_bandwith_limited_stream(self, fileobj, transfer_coordinator, enabled=True): """Wraps a fileobj in a bandwidth limited stream wrapper :type fileobj: file-like obj :param fileobj: The file-like obj to wrap :type transfer_coordinator: s3transfer...
[ "Wraps", "a", "fileobj", "in", "a", "bandwidth", "limited", "stream", "wrapper" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L78-L97
[ "def", "get_bandwith_limited_stream", "(", "self", ",", "fileobj", ",", "transfer_coordinator", ",", "enabled", "=", "True", ")", ":", "stream", "=", "BandwidthLimitedStream", "(", "fileobj", ",", "self", ".", "_leaky_bucket", ",", "transfer_coordinator", ",", "se...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
BandwidthLimitedStream.read
Read a specified amount Reads will only be throttled if bandwidth limiting is enabled.
s3transfer/bandwidth.py
def read(self, amount): """Read a specified amount Reads will only be throttled if bandwidth limiting is enabled. """ if not self._bandwidth_limiting_enabled: return self._fileobj.read(amount) # We do not want to be calling consume on every read as the read ...
def read(self, amount): """Read a specified amount Reads will only be throttled if bandwidth limiting is enabled. """ if not self._bandwidth_limiting_enabled: return self._fileobj.read(amount) # We do not want to be calling consume on every read as the read ...
[ "Read", "a", "specified", "amount" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L138-L156
[ "def", "read", "(", "self", ",", "amount", ")", ":", "if", "not", "self", ".", "_bandwidth_limiting_enabled", ":", "return", "self", ".", "_fileobj", ".", "read", "(", "amount", ")", "# We do not want to be calling consume on every read as the read", "# amounts can be...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
LeakyBucket.consume
Consume an a requested amount :type amt: int :param amt: The amount of bytes to request to consume :type request_token: RequestToken :param request_token: The token associated to the consumption request that is used to identify the request. So if a RequestExceed...
s3transfer/bandwidth.py
def consume(self, amt, request_token): """Consume an a requested amount :type amt: int :param amt: The amount of bytes to request to consume :type request_token: RequestToken :param request_token: The token associated to the consumption request that is used to ident...
def consume(self, amt, request_token): """Consume an a requested amount :type amt: int :param amt: The amount of bytes to request to consume :type request_token: RequestToken :param request_token: The token associated to the consumption request that is used to ident...
[ "Consume", "an", "a", "requested", "amount" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L237-L264
[ "def", "consume", "(", "self", ",", "amt", ",", "request_token", ")", ":", "with", "self", ".", "_lock", ":", "time_now", "=", "self", ".", "_time_utils", ".", "time", "(", ")", "if", "self", ".", "_consumption_scheduler", ".", "is_scheduled", "(", "requ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
ConsumptionScheduler.schedule_consumption
Schedules a wait time to be able to consume an amount :type amt: int :param amt: The amount of bytes scheduled to be consumed :type token: RequestToken :param token: The token associated to the consumption request that is used to identify the request. :type time_to...
s3transfer/bandwidth.py
def schedule_consumption(self, amt, token, time_to_consume): """Schedules a wait time to be able to consume an amount :type amt: int :param amt: The amount of bytes scheduled to be consumed :type token: RequestToken :param token: The token associated to the consumption ...
def schedule_consumption(self, amt, token, time_to_consume): """Schedules a wait time to be able to consume an amount :type amt: int :param amt: The amount of bytes scheduled to be consumed :type token: RequestToken :param token: The token associated to the consumption ...
[ "Schedules", "a", "wait", "time", "to", "be", "able", "to", "consume", "an", "amount" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L303-L327
[ "def", "schedule_consumption", "(", "self", ",", "amt", ",", "token", ",", "time_to_consume", ")", ":", "self", ".", "_total_wait", "+=", "time_to_consume", "self", ".", "_tokens_to_scheduled_consumption", "[", "token", "]", "=", "{", "'wait_duration'", ":", "se...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
ConsumptionScheduler.process_scheduled_consumption
Processes a scheduled consumption request that has completed :type token: RequestToken :param token: The token associated to the consumption request that is used to identify the request.
s3transfer/bandwidth.py
def process_scheduled_consumption(self, token): """Processes a scheduled consumption request that has completed :type token: RequestToken :param token: The token associated to the consumption request that is used to identify the request. """ scheduled_retry = self._t...
def process_scheduled_consumption(self, token): """Processes a scheduled consumption request that has completed :type token: RequestToken :param token: The token associated to the consumption request that is used to identify the request. """ scheduled_retry = self._t...
[ "Processes", "a", "scheduled", "consumption", "request", "that", "has", "completed" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L329-L338
[ "def", "process_scheduled_consumption", "(", "self", ",", "token", ")", ":", "scheduled_retry", "=", "self", ".", "_tokens_to_scheduled_consumption", ".", "pop", "(", "token", ")", "self", ".", "_total_wait", "=", "max", "(", "self", ".", "_total_wait", "-", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
BandwidthRateTracker.get_projected_rate
Get the projected rate using a provided amount and time :type amt: int :param amt: The proposed amount to consume :type time_at_consumption: float :param time_at_consumption: The proposed time to consume at :rtype: float :returns: The consumption rate if that amt and t...
s3transfer/bandwidth.py
def get_projected_rate(self, amt, time_at_consumption): """Get the projected rate using a provided amount and time :type amt: int :param amt: The proposed amount to consume :type time_at_consumption: float :param time_at_consumption: The proposed time to consume at :rt...
def get_projected_rate(self, amt, time_at_consumption): """Get the projected rate using a provided amount and time :type amt: int :param amt: The proposed amount to consume :type time_at_consumption: float :param time_at_consumption: The proposed time to consume at :rt...
[ "Get", "the", "projected", "rate", "using", "a", "provided", "amount", "and", "time" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L369-L384
[ "def", "get_projected_rate", "(", "self", ",", "amt", ",", "time_at_consumption", ")", ":", "if", "self", ".", "_last_time", "is", "None", ":", "return", "0.0", "return", "self", ".", "_calculate_exponential_moving_average_rate", "(", "amt", ",", "time_at_consumpt...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
BandwidthRateTracker.record_consumption_rate
Record the consumption rate based off amount and time point :type amt: int :param amt: The amount that got consumed :type time_at_consumption: float :param time_at_consumption: The time at which the amount was consumed
s3transfer/bandwidth.py
def record_consumption_rate(self, amt, time_at_consumption): """Record the consumption rate based off amount and time point :type amt: int :param amt: The amount that got consumed :type time_at_consumption: float :param time_at_consumption: The time at which the amount was cons...
def record_consumption_rate(self, amt, time_at_consumption): """Record the consumption rate based off amount and time point :type amt: int :param amt: The amount that got consumed :type time_at_consumption: float :param time_at_consumption: The time at which the amount was cons...
[ "Record", "the", "consumption", "rate", "based", "off", "amount", "and", "time", "point" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/bandwidth.py#L386-L401
[ "def", "record_consumption_rate", "(", "self", ",", "amt", ",", "time_at_consumption", ")", ":", "if", "self", ".", "_last_time", "is", "None", ":", "self", ".", "_last_time", "=", "time_at_consumption", "self", ".", "_current_rate", "=", "0.0", "return", "sel...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
ProcessPoolDownloader.download_file
Downloads the object's contents to a file :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type filename: str :param filename: The name of a file to download to. :type ext...
s3transfer/processpool.py
def download_file(self, bucket, key, filename, extra_args=None, expected_size=None): """Downloads the object's contents to a file :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to dow...
def download_file(self, bucket, key, filename, extra_args=None, expected_size=None): """Downloads the object's contents to a file :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to dow...
[ "Downloads", "the", "object", "s", "contents", "to", "a", "file" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/processpool.py#L321-L364
[ "def", "download_file", "(", "self", ",", "bucket", ",", "key", ",", "filename", ",", "extra_args", "=", "None", ",", "expected_size", "=", "None", ")", ":", "self", ".", "_start_if_needed", "(", ")", "if", "extra_args", "is", "None", ":", "extra_args", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferMonitor.poll_for_result
Poll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failure.
s3transfer/processpool.py
def poll_for_result(self, transfer_id): """Poll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failur...
def poll_for_result(self, transfer_id): """Poll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failur...
[ "Poll", "for", "the", "result", "of", "a", "transfer" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/processpool.py#L596-L608
[ "def", "poll_for_result", "(", "self", ",", "transfer_id", ")", ":", "self", ".", "_transfer_states", "[", "transfer_id", "]", ".", "wait_till_done", "(", ")", "exception", "=", "self", ".", "_transfer_states", "[", "transfer_id", "]", ".", "exception", "if", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
calculate_range_parameter
Calculate the range parameter for multipart downloads/copies :type part_size: int :param part_size: The size of the part :type part_index: int :param part_index: The index for which this parts starts. This index starts at zero :type num_parts: int :param num_parts: The total number of...
s3transfer/utils.py
def calculate_range_parameter(part_size, part_index, num_parts, total_size=None): """Calculate the range parameter for multipart downloads/copies :type part_size: int :param part_size: The size of the part :type part_index: int :param part_index: The index for which t...
def calculate_range_parameter(part_size, part_index, num_parts, total_size=None): """Calculate the range parameter for multipart downloads/copies :type part_size: int :param part_size: The size of the part :type part_index: int :param part_index: The index for which t...
[ "Calculate", "the", "range", "parameter", "for", "multipart", "downloads", "/", "copies" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L69-L95
[ "def", "calculate_range_parameter", "(", "part_size", ",", "part_index", ",", "num_parts", ",", "total_size", "=", "None", ")", ":", "# Used to calculate the Range parameter", "start_range", "=", "part_index", "*", "part_size", "if", "part_index", "==", "num_parts", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
get_callbacks
Retrieves callbacks from a subscriber :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future the subscriber is associated to. :type callback_type: str :param callback_type: The type of callback to retrieve from the subscriber. Valid types i...
s3transfer/utils.py
def get_callbacks(transfer_future, callback_type): """Retrieves callbacks from a subscriber :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future the subscriber is associated to. :type callback_type: str :param callback_type: The type of callb...
def get_callbacks(transfer_future, callback_type): """Retrieves callbacks from a subscriber :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future the subscriber is associated to. :type callback_type: str :param callback_type: The type of callb...
[ "Retrieves", "callbacks", "from", "a", "subscriber" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L98-L125
[ "def", "get_callbacks", "(", "transfer_future", ",", "callback_type", ")", ":", "callbacks", "=", "[", "]", "for", "subscriber", "in", "transfer_future", ".", "meta", ".", "call_args", ".", "subscribers", ":", "callback_name", "=", "'on_'", "+", "callback_type",...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
get_filtered_dict
Gets a dictionary filtered by whitelisted keys :param original_dict: The original dictionary of arguments to source keys and values. :param whitelisted_key: A list of keys to include in the filtered dictionary. :returns: A dictionary containing key/values from the original dictionary ...
s3transfer/utils.py
def get_filtered_dict(original_dict, whitelisted_keys): """Gets a dictionary filtered by whitelisted keys :param original_dict: The original dictionary of arguments to source keys and values. :param whitelisted_key: A list of keys to include in the filtered dictionary. :returns: A dict...
def get_filtered_dict(original_dict, whitelisted_keys): """Gets a dictionary filtered by whitelisted keys :param original_dict: The original dictionary of arguments to source keys and values. :param whitelisted_key: A list of keys to include in the filtered dictionary. :returns: A dict...
[ "Gets", "a", "dictionary", "filtered", "by", "whitelisted", "keys" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L144-L159
[ "def", "get_filtered_dict", "(", "original_dict", ",", "whitelisted_keys", ")", ":", "filtered_dict", "=", "{", "}", "for", "key", ",", "value", "in", "original_dict", ".", "items", "(", ")", ":", "if", "key", "in", "whitelisted_keys", ":", "filtered_dict", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
CountCallbackInvoker.decrement
Decrement the count by one
s3transfer/utils.py
def decrement(self): """Decrement the count by one""" with self._lock: if self._count == 0: raise RuntimeError( 'Counter is at zero. It cannot dip below zero') self._count -= 1 if self._is_finalized and self._count == 0: ...
def decrement(self): """Decrement the count by one""" with self._lock: if self._count == 0: raise RuntimeError( 'Counter is at zero. It cannot dip below zero') self._count -= 1 if self._is_finalized and self._count == 0: ...
[ "Decrement", "the", "count", "by", "one" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L219-L227
[ "def", "decrement", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_count", "==", "0", ":", "raise", "RuntimeError", "(", "'Counter is at zero. It cannot dip below zero'", ")", "self", ".", "_count", "-=", "1", "if", "self", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
CountCallbackInvoker.finalize
Finalize the counter Once finalized, the counter never be incremented and the callback can be invoked once the count reaches zero
s3transfer/utils.py
def finalize(self): """Finalize the counter Once finalized, the counter never be incremented and the callback can be invoked once the count reaches zero """ with self._lock: self._is_finalized = True if self._count == 0: self._callback()
def finalize(self): """Finalize the counter Once finalized, the counter never be incremented and the callback can be invoked once the count reaches zero """ with self._lock: self._is_finalized = True if self._count == 0: self._callback()
[ "Finalize", "the", "counter" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L229-L238
[ "def", "finalize", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_is_finalized", "=", "True", "if", "self", ".", "_count", "==", "0", ":", "self", ".", "_callback", "(", ")" ]
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
OSUtils.is_special_file
Checks to see if a file is a special UNIX file. It checks if the file is a character special device, block special device, FIFO, or socket. :param filename: Name of the file :returns: True if the file is a special file. False, if is not.
s3transfer/utils.py
def is_special_file(cls, filename): """Checks to see if a file is a special UNIX file. It checks if the file is a character special device, block special device, FIFO, or socket. :param filename: Name of the file :returns: True if the file is a special file. False, if is not. ...
def is_special_file(cls, filename): """Checks to see if a file is a special UNIX file. It checks if the file is a character special device, block special device, FIFO, or socket. :param filename: Name of the file :returns: True if the file is a special file. False, if is not. ...
[ "Checks", "to", "see", "if", "a", "file", "is", "a", "special", "UNIX", "file", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L273-L300
[ "def", "is_special_file", "(", "cls", ",", "filename", ")", ":", "# If it does not exist, it must be a new file so it cannot be", "# a special file.", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "return", "False", "mode", "=", "os", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
ReadFileChunk.from_filename
Convenience factory function to create from a filename. :type start_byte: int :param start_byte: The first byte from which to start reading. :type chunk_size: int :param chunk_size: The max chunk size to read. Trying to read pass the end of the chunk size will behave like ...
s3transfer/utils.py
def from_filename(cls, filename, start_byte, chunk_size, callbacks=None, enable_callbacks=True): """Convenience factory function to create from a filename. :type start_byte: int :param start_byte: The first byte from which to start reading. :type chunk_size: int ...
def from_filename(cls, filename, start_byte, chunk_size, callbacks=None, enable_callbacks=True): """Convenience factory function to create from a filename. :type start_byte: int :param start_byte: The first byte from which to start reading. :type chunk_size: int ...
[ "Convenience", "factory", "function", "to", "create", "from", "a", "filename", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L432-L462
[ "def", "from_filename", "(", "cls", ",", "filename", ",", "start_byte", ",", "chunk_size", ",", "callbacks", "=", "None", ",", "enable_callbacks", "=", "True", ")", ":", "f", "=", "open", "(", "filename", ",", "'rb'", ")", "f", ".", "seek", "(", "start...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TaskSemaphore.acquire
Acquire the semaphore :param tag: A tag identifying what is acquiring the semaphore. Note that this is not really needed to directly use this class but is needed for API compatibility with the SlidingWindowSemaphore implementation. :param block: If True, block until ...
s3transfer/utils.py
def acquire(self, tag, blocking=True): """Acquire the semaphore :param tag: A tag identifying what is acquiring the semaphore. Note that this is not really needed to directly use this class but is needed for API compatibility with the SlidingWindowSemaphore implement...
def acquire(self, tag, blocking=True): """Acquire the semaphore :param tag: A tag identifying what is acquiring the semaphore. Note that this is not really needed to directly use this class but is needed for API compatibility with the SlidingWindowSemaphore implement...
[ "Acquire", "the", "semaphore" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L562-L576
[ "def", "acquire", "(", "self", ",", "tag", ",", "blocking", "=", "True", ")", ":", "logger", ".", "debug", "(", "\"Acquiring %s\"", ",", "tag", ")", "if", "not", "self", ".", "_semaphore", ".", "acquire", "(", "blocking", ")", ":", "raise", "NoResource...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TaskSemaphore.release
Release the semaphore :param tag: A tag identifying what is releasing the semaphore :param acquire_token: The token returned from when the semaphore was acquired. Note that this is not really needed to directly use this class but is needed for API compatibility with the ...
s3transfer/utils.py
def release(self, tag, acquire_token): """Release the semaphore :param tag: A tag identifying what is releasing the semaphore :param acquire_token: The token returned from when the semaphore was acquired. Note that this is not really needed to directly use this class bu...
def release(self, tag, acquire_token): """Release the semaphore :param tag: A tag identifying what is releasing the semaphore :param acquire_token: The token returned from when the semaphore was acquired. Note that this is not really needed to directly use this class bu...
[ "Release", "the", "semaphore" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L578-L588
[ "def", "release", "(", "self", ",", "tag", ",", "acquire_token", ")", ":", "logger", ".", "debug", "(", "\"Releasing acquire %s/%s\"", "%", "(", "tag", ",", "acquire_token", ")", ")", "self", ".", "_semaphore", ".", "release", "(", ")" ]
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
ChunksizeAdjuster.adjust_chunksize
Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size of the file to upload. This might be None if the object being ...
s3transfer/utils.py
def adjust_chunksize(self, current_chunksize, file_size=None): """Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size ...
def adjust_chunksize(self, current_chunksize, file_size=None): """Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size ...
[ "Get", "a", "chunksize", "close", "to", "current", "that", "fits", "within", "all", "S3", "limits", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L693-L708
[ "def", "adjust_chunksize", "(", "self", ",", "current_chunksize", ",", "file_size", "=", "None", ")", ":", "chunksize", "=", "current_chunksize", "if", "file_size", "is", "not", "None", ":", "chunksize", "=", "self", ".", "_adjust_for_max_parts", "(", "chunksize...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
DownloadOutputManager.queue_file_io_task
Queue IO write for submission to the IO executor. This method accepts an IO executor and information about the downloaded data, and handles submitting this to the IO executor. This method may defer submission to the IO executor if necessary.
s3transfer/download.py
def queue_file_io_task(self, fileobj, data, offset): """Queue IO write for submission to the IO executor. This method accepts an IO executor and information about the downloaded data, and handles submitting this to the IO executor. This method may defer submission to the IO executor if...
def queue_file_io_task(self, fileobj, data, offset): """Queue IO write for submission to the IO executor. This method accepts an IO executor and information about the downloaded data, and handles submitting this to the IO executor. This method may defer submission to the IO executor if...
[ "Queue", "IO", "write", "for", "submission", "to", "the", "IO", "executor", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L91-L103
[ "def", "queue_file_io_task", "(", "self", ",", "fileobj", ",", "data", ",", "offset", ")", ":", "self", ".", "_transfer_coordinator", ".", "submit", "(", "self", ".", "_io_executor", ",", "self", ".", "get_io_write_task", "(", "fileobj", ",", "data", ",", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
DownloadOutputManager.get_io_write_task
Get an IO write task for the requested set of data This task can be ran immediately or be submitted to the IO executor for it to run. :type fileobj: file-like object :param fileobj: The file-like object to write to :type data: bytes :param data: The data to write out ...
s3transfer/download.py
def get_io_write_task(self, fileobj, data, offset): """Get an IO write task for the requested set of data This task can be ran immediately or be submitted to the IO executor for it to run. :type fileobj: file-like object :param fileobj: The file-like object to write to ...
def get_io_write_task(self, fileobj, data, offset): """Get an IO write task for the requested set of data This task can be ran immediately or be submitted to the IO executor for it to run. :type fileobj: file-like object :param fileobj: The file-like object to write to ...
[ "Get", "an", "IO", "write", "task", "for", "the", "requested", "set", "of", "data" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L105-L129
[ "def", "get_io_write_task", "(", "self", ",", "fileobj", ",", "data", ",", "offset", ")", ":", "return", "IOWriteTask", "(", "self", ".", "_transfer_coordinator", ",", "main_kwargs", "=", "{", "'fileobj'", ":", "fileobj", ",", "'data'", ":", "data", ",", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
DownloadSubmissionTask._get_download_output_manager_cls
Retrieves a class for managing output for a download :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :type osutil: s3transfer.utils.OSUtils :param osutil: The os utility associated to the transfer :rtype: cla...
s3transfer/download.py
def _get_download_output_manager_cls(self, transfer_future, osutil): """Retrieves a class for managing output for a download :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :type osutil: s3transfer.utils.OSUtils ...
def _get_download_output_manager_cls(self, transfer_future, osutil): """Retrieves a class for managing output for a download :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :type osutil: s3transfer.utils.OSUtils ...
[ "Retrieves", "a", "class", "for", "managing", "output", "for", "a", "download" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L283-L309
[ "def", "_get_download_output_manager_cls", "(", "self", ",", "transfer_future", ",", "osutil", ")", ":", "download_manager_resolver_chain", "=", "[", "DownloadSpecialFilenameOutputManager", ",", "DownloadFilenameOutputManager", ",", "DownloadSeekableOutputManager", ",", "Downlo...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
DownloadSubmissionTask._submit
:param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associated with the transfer manager :type osutil: s3transfer.utils.OSUtil :param osutil: The os utility associated to the trans...
s3transfer/download.py
def _submit(self, client, config, osutil, request_executor, io_executor, transfer_future, bandwidth_limiter=None): """ :param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associ...
def _submit(self, client, config, osutil, request_executor, io_executor, transfer_future, bandwidth_limiter=None): """ :param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associ...
[ ":", "param", "client", ":", "The", "client", "associated", "with", "the", "transfer", "manager" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L311-L363
[ "def", "_submit", "(", "self", ",", "client", ",", "config", ",", "osutil", ",", "request_executor", ",", "io_executor", ",", "transfer_future", ",", "bandwidth_limiter", "=", "None", ")", ":", "if", "transfer_future", ".", "meta", ".", "size", "is", "None",...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
GetObjectTask._main
Downloads an object and places content into io queue :param client: The client to use when calling GetObject :param bucket: The bucket to download from :param key: The key to download from :param fileobj: The file handle to write content to :param exta_args: Any extra arguements...
s3transfer/download.py
def _main(self, client, bucket, key, fileobj, extra_args, callbacks, max_attempts, download_output_manager, io_chunksize, start_index=0, bandwidth_limiter=None): """Downloads an object and places content into io queue :param client: The client to use when calling GetObject ...
def _main(self, client, bucket, key, fileobj, extra_args, callbacks, max_attempts, download_output_manager, io_chunksize, start_index=0, bandwidth_limiter=None): """Downloads an object and places content into io queue :param client: The client to use when calling GetObject ...
[ "Downloads", "an", "object", "and", "places", "content", "into", "io", "queue" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L488-L547
[ "def", "_main", "(", "self", ",", "client", ",", "bucket", ",", "key", ",", "fileobj", ",", "extra_args", ",", "callbacks", ",", "max_attempts", ",", "download_output_manager", ",", "io_chunksize", ",", "start_index", "=", "0", ",", "bandwidth_limiter", "=", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
IOWriteTask._main
Pulls off an io queue to write contents to a file :param fileobj: The file handle to write content to :param data: The data to write :param offset: The offset to write the data to.
s3transfer/download.py
def _main(self, fileobj, data, offset): """Pulls off an io queue to write contents to a file :param fileobj: The file handle to write content to :param data: The data to write :param offset: The offset to write the data to. """ fileobj.seek(offset) fileobj.write(...
def _main(self, fileobj, data, offset): """Pulls off an io queue to write contents to a file :param fileobj: The file handle to write content to :param data: The data to write :param offset: The offset to write the data to. """ fileobj.seek(offset) fileobj.write(...
[ "Pulls", "off", "an", "io", "queue", "to", "write", "contents", "to", "a", "file" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L566-L574
[ "def", "_main", "(", "self", ",", "fileobj", ",", "data", ",", "offset", ")", ":", "fileobj", ".", "seek", "(", "offset", ")", "fileobj", ".", "write", "(", "data", ")" ]
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
DeferQueue.request_writes
Request any available writes given new incoming data. You call this method by providing new data along with the offset associated with the data. If that new data unlocks any contiguous writes that can now be submitted, this method will return all applicable writes. This is don...
s3transfer/download.py
def request_writes(self, offset, data): """Request any available writes given new incoming data. You call this method by providing new data along with the offset associated with the data. If that new data unlocks any contiguous writes that can now be submitted, this method will...
def request_writes(self, offset, data): """Request any available writes given new incoming data. You call this method by providing new data along with the offset associated with the data. If that new data unlocks any contiguous writes that can now be submitted, this method will...
[ "Request", "any", "available", "writes", "given", "new", "incoming", "data", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L680-L712
[ "def", "request_writes", "(", "self", ",", "offset", ",", "data", ")", ":", "if", "offset", "<", "self", ".", "_next_offset", ":", "# This is a request for a write that we've already", "# seen. This can happen in the event of a retry", "# where if we retry at at offset N/2, we...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
seekable
Backwards compat function to determine if a fileobj is seekable :param fileobj: The file-like object to determine if seekable :returns: True, if seekable. False, otherwise.
s3transfer/compat.py
def seekable(fileobj): """Backwards compat function to determine if a fileobj is seekable :param fileobj: The file-like object to determine if seekable :returns: True, if seekable. False, otherwise. """ # If the fileobj has a seekable attr, try calling the seekable() # method on it. if has...
def seekable(fileobj): """Backwards compat function to determine if a fileobj is seekable :param fileobj: The file-like object to determine if seekable :returns: True, if seekable. False, otherwise. """ # If the fileobj has a seekable attr, try calling the seekable() # method on it. if has...
[ "Backwards", "compat", "function", "to", "determine", "if", "a", "fileobj", "is", "seekable" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/compat.py#L57-L78
[ "def", "seekable", "(", "fileobj", ")", ":", "# If the fileobj has a seekable attr, try calling the seekable()", "# method on it.", "if", "hasattr", "(", "fileobj", ",", "'seekable'", ")", ":", "return", "fileobj", ".", "seekable", "(", ")", "# If there is no seekable att...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferManager.upload
Uploads a file to S3 :type fileobj: str or seekable file-like object :param fileobj: The name of a file to upload or a seekable file-like object to upload. It is recommended to use a filename because file-like objects may result in higher memory usage. :type bucket: str...
s3transfer/manager.py
def upload(self, fileobj, bucket, key, extra_args=None, subscribers=None): """Uploads a file to S3 :type fileobj: str or seekable file-like object :param fileobj: The name of a file to upload or a seekable file-like object to upload. It is recommended to use a filename because ...
def upload(self, fileobj, bucket, key, extra_args=None, subscribers=None): """Uploads a file to S3 :type fileobj: str or seekable file-like object :param fileobj: The name of a file to upload or a seekable file-like object to upload. It is recommended to use a filename because ...
[ "Uploads", "a", "file", "to", "S3" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L264-L303
[ "def", "upload", "(", "self", ",", "fileobj", ",", "bucket", ",", "key", ",", "extra_args", "=", "None", ",", "subscribers", "=", "None", ")", ":", "if", "extra_args", "is", "None", ":", "extra_args", "=", "{", "}", "if", "subscribers", "is", "None", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferManager.download
Downloads a file from S3 :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type fileobj: str or seekable file-like object :param fileobj: The name of a file to download or a seekabl...
s3transfer/manager.py
def download(self, bucket, key, fileobj, extra_args=None, subscribers=None): """Downloads a file from S3 :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type file...
def download(self, bucket, key, fileobj, extra_args=None, subscribers=None): """Downloads a file from S3 :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type file...
[ "Downloads", "a", "file", "from", "S3" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L305-L345
[ "def", "download", "(", "self", ",", "bucket", ",", "key", ",", "fileobj", ",", "extra_args", "=", "None", ",", "subscribers", "=", "None", ")", ":", "if", "extra_args", "is", "None", ":", "extra_args", "=", "{", "}", "if", "subscribers", "is", "None",...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferManager.copy
Copies a file in S3 :type copy_source: dict :param copy_source: The name of the source bucket, key name of the source object, and optional version ID of the source object. The dictionary format is: ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId': 'id'}``. Note ...
s3transfer/manager.py
def copy(self, copy_source, bucket, key, extra_args=None, subscribers=None, source_client=None): """Copies a file in S3 :type copy_source: dict :param copy_source: The name of the source bucket, key name of the source object, and optional version ID of the source object...
def copy(self, copy_source, bucket, key, extra_args=None, subscribers=None, source_client=None): """Copies a file in S3 :type copy_source: dict :param copy_source: The name of the source bucket, key name of the source object, and optional version ID of the source object...
[ "Copies", "a", "file", "in", "S3" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L347-L395
[ "def", "copy", "(", "self", ",", "copy_source", ",", "bucket", ",", "key", ",", "extra_args", "=", "None", ",", "subscribers", "=", "None", ",", "source_client", "=", "None", ")", ":", "if", "extra_args", "is", "None", ":", "extra_args", "=", "{", "}",...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferManager.delete
Delete an S3 object. :type bucket: str :param bucket: The name of the bucket. :type key: str :param key: The name of the S3 object to delete. :type extra_args: dict :param extra_args: Extra arguments that may be passed to the DeleteObject call. :ty...
s3transfer/manager.py
def delete(self, bucket, key, extra_args=None, subscribers=None): """Delete an S3 object. :type bucket: str :param bucket: The name of the bucket. :type key: str :param key: The name of the S3 object to delete. :type extra_args: dict :param extra_args: Extra ar...
def delete(self, bucket, key, extra_args=None, subscribers=None): """Delete an S3 object. :type bucket: str :param bucket: The name of the bucket. :type key: str :param key: The name of the S3 object to delete. :type extra_args: dict :param extra_args: Extra ar...
[ "Delete", "an", "S3", "object", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L397-L428
[ "def", "delete", "(", "self", ",", "bucket", ",", "key", ",", "extra_args", "=", "None", ",", "subscribers", "=", "None", ")", ":", "if", "extra_args", "is", "None", ":", "extra_args", "=", "{", "}", "if", "subscribers", "is", "None", ":", "subscribers...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferManager.shutdown
Shutdown the TransferManager It will wait till all transfers complete before it completely shuts down. :type cancel: boolean :param cancel: If True, calls TransferFuture.cancel() for all in-progress in transfers. This is useful if you want the shutdown to happen...
s3transfer/manager.py
def shutdown(self, cancel=False, cancel_msg=''): """Shutdown the TransferManager It will wait till all transfers complete before it completely shuts down. :type cancel: boolean :param cancel: If True, calls TransferFuture.cancel() for all in-progress in transfers. T...
def shutdown(self, cancel=False, cancel_msg=''): """Shutdown the TransferManager It will wait till all transfers complete before it completely shuts down. :type cancel: boolean :param cancel: If True, calls TransferFuture.cancel() for all in-progress in transfers. T...
[ "Shutdown", "the", "TransferManager" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L531-L546
[ "def", "shutdown", "(", "self", ",", "cancel", "=", "False", ",", "cancel_msg", "=", "''", ")", ":", "self", ".", "_shutdown", "(", "cancel", ",", "cancel", ",", "cancel_msg", ")" ]
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinatorController.cancel
Cancels all inprogress transfers This cancels the inprogress transfers by calling cancel() on all tracked transfer coordinators. :param msg: The message to pass on to each transfer coordinator that gets cancelled. :param exc_type: The type of exception to set for the cance...
s3transfer/manager.py
def cancel(self, msg='', exc_type=CancelledError): """Cancels all inprogress transfers This cancels the inprogress transfers by calling cancel() on all tracked transfer coordinators. :param msg: The message to pass on to each transfer coordinator that gets cancelled. ...
def cancel(self, msg='', exc_type=CancelledError): """Cancels all inprogress transfers This cancels the inprogress transfers by calling cancel() on all tracked transfer coordinators. :param msg: The message to pass on to each transfer coordinator that gets cancelled. ...
[ "Cancels", "all", "inprogress", "transfers" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L615-L627
[ "def", "cancel", "(", "self", ",", "msg", "=", "''", ",", "exc_type", "=", "CancelledError", ")", ":", "for", "transfer_coordinator", "in", "self", ".", "tracked_transfer_coordinators", ":", "transfer_coordinator", ".", "cancel", "(", "msg", ",", "exc_type", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinatorController.wait
Wait until there are no more inprogress transfers This will not stop when failures are encountered and not propogate any of these errors from failed transfers, but it can be interrupted with a KeyboardInterrupt.
s3transfer/manager.py
def wait(self): """Wait until there are no more inprogress transfers This will not stop when failures are encountered and not propogate any of these errors from failed transfers, but it can be interrupted with a KeyboardInterrupt. """ try: transfer_coordinato...
def wait(self): """Wait until there are no more inprogress transfers This will not stop when failures are encountered and not propogate any of these errors from failed transfers, but it can be interrupted with a KeyboardInterrupt. """ try: transfer_coordinato...
[ "Wait", "until", "there", "are", "no", "more", "inprogress", "transfers" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/manager.py#L629-L655
[ "def", "wait", "(", "self", ")", ":", "try", ":", "transfer_coordinator", "=", "None", "for", "transfer_coordinator", "in", "self", ".", "tracked_transfer_coordinators", ":", "transfer_coordinator", ".", "result", "(", ")", "except", "KeyboardInterrupt", ":", "log...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
UploadNonSeekableInputManager._read
Reads a specific amount of data from a stream and returns it. If there is any data in initial_data, that will be popped out first. :type fileobj: A file-like object that implements read :param fileobj: The stream to read from. :type amount: int :param amount: The number of byte...
s3transfer/upload.py
def _read(self, fileobj, amount, truncate=True): """ Reads a specific amount of data from a stream and returns it. If there is any data in initial_data, that will be popped out first. :type fileobj: A file-like object that implements read :param fileobj: The stream to read from....
def _read(self, fileobj, amount, truncate=True): """ Reads a specific amount of data from a stream and returns it. If there is any data in initial_data, that will be popped out first. :type fileobj: A file-like object that implements read :param fileobj: The stream to read from....
[ "Reads", "a", "specific", "amount", "of", "data", "from", "a", "stream", "and", "returns", "it", ".", "If", "there", "is", "any", "data", "in", "initial_data", "that", "will", "be", "popped", "out", "first", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L421-L461
[ "def", "_read", "(", "self", ",", "fileobj", ",", "amount", ",", "truncate", "=", "True", ")", ":", "# If the the initial data is empty, we simply read from the fileobj", "if", "len", "(", "self", ".", "_initial_data", ")", "==", "0", ":", "return", "fileobj", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
UploadNonSeekableInputManager._wrap_data
Wraps data with the interrupt reader and the file chunk reader. :type data: bytes :param data: The data to wrap. :type callbacks: list :param callbacks: The callbacks associated with the transfer future. :type close_callbacks: list :param close_callbacks: The callbacks...
s3transfer/upload.py
def _wrap_data(self, data, callbacks, close_callbacks): """ Wraps data with the interrupt reader and the file chunk reader. :type data: bytes :param data: The data to wrap. :type callbacks: list :param callbacks: The callbacks associated with the transfer future. ...
def _wrap_data(self, data, callbacks, close_callbacks): """ Wraps data with the interrupt reader and the file chunk reader. :type data: bytes :param data: The data to wrap. :type callbacks: list :param callbacks: The callbacks associated with the transfer future. ...
[ "Wraps", "data", "with", "the", "interrupt", "reader", "and", "the", "file", "chunk", "reader", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L463-L482
[ "def", "_wrap_data", "(", "self", ",", "data", ",", "callbacks", ",", "close_callbacks", ")", ":", "fileobj", "=", "self", ".", "_wrap_fileobj", "(", "six", ".", "BytesIO", "(", "data", ")", ")", "return", "self", ".", "_osutil", ".", "open_file_chunk_read...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
UploadSubmissionTask._get_upload_input_manager_cls
Retrieves a class for managing input for an upload based on file type :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :rtype: class of UploadInputManager :returns: The appropriate class to use for managing a specific ...
s3transfer/upload.py
def _get_upload_input_manager_cls(self, transfer_future): """Retrieves a class for managing input for an upload based on file type :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :rtype: class of UploadInputManager ...
def _get_upload_input_manager_cls(self, transfer_future): """Retrieves a class for managing input for an upload based on file type :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :rtype: class of UploadInputManager ...
[ "Retrieves", "a", "class", "for", "managing", "input", "for", "an", "upload", "based", "on", "file", "type" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L499-L521
[ "def", "_get_upload_input_manager_cls", "(", "self", ",", "transfer_future", ")", ":", "upload_manager_resolver_chain", "=", "[", "UploadFilenameInputManager", ",", "UploadSeekableInputManager", ",", "UploadNonSeekableInputManager", "]", "fileobj", "=", "transfer_future", "."...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
UploadSubmissionTask._submit
:param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associated with the transfer manager :type osutil: s3transfer.utils.OSUtil :param osutil: The os utility associated to the trans...
s3transfer/upload.py
def _submit(self, client, config, osutil, request_executor, transfer_future, bandwidth_limiter=None): """ :param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associated with the...
def _submit(self, client, config, osutil, request_executor, transfer_future, bandwidth_limiter=None): """ :param client: The client associated with the transfer manager :type config: s3transfer.manager.TransferConfig :param config: The transfer config associated with the...
[ ":", "param", "client", ":", "The", "client", "associated", "with", "the", "transfer", "manager" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L523-L560
[ "def", "_submit", "(", "self", ",", "client", ",", "config", ",", "osutil", ",", "request_executor", ",", "transfer_future", ",", "bandwidth_limiter", "=", "None", ")", ":", "upload_input_manager", "=", "self", ".", "_get_upload_input_manager_cls", "(", "transfer_...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
PutObjectTask._main
:param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to upload to :param extra_args: A dictionary of any extra arguments that may be used in the upload.
s3transfer/upload.py
def _main(self, client, fileobj, bucket, key, extra_args): """ :param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to upload to :param extra_args: A ...
def _main(self, client, fileobj, bucket, key, extra_args): """ :param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to upload to :param extra_args: A ...
[ ":", "param", "client", ":", "The", "client", "to", "use", "when", "calling", "PutObject", ":", "param", "fileobj", ":", "The", "file", "to", "upload", ".", ":", "param", "bucket", ":", "The", "name", "of", "the", "bucket", "to", "upload", "to", ":", ...
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L682-L692
[ "def", "_main", "(", "self", ",", "client", ",", "fileobj", ",", "bucket", ",", "key", ",", "extra_args", ")", ":", "with", "fileobj", "as", "body", ":", "client", ".", "put_object", "(", "Bucket", "=", "bucket", ",", "Key", "=", "key", ",", "Body", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
UploadPartTask._main
:param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to upload to :param upload_id: The id of the upload :param part_number: The number representing the part ...
s3transfer/upload.py
def _main(self, client, fileobj, bucket, key, upload_id, part_number, extra_args): """ :param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to u...
def _main(self, client, fileobj, bucket, key, upload_id, part_number, extra_args): """ :param client: The client to use when calling PutObject :param fileobj: The file to upload. :param bucket: The name of the bucket to upload to :param key: The name of the key to u...
[ ":", "param", "client", ":", "The", "client", "to", "use", "when", "calling", "PutObject", ":", "param", "fileobj", ":", "The", "file", "to", "upload", ".", ":", "param", "bucket", ":", "The", "name", "of", "the", "bucket", "to", "upload", "to", ":", ...
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/upload.py#L697-L724
[ "def", "_main", "(", "self", ",", "client", ",", "fileobj", ",", "bucket", ",", "key", ",", "upload_id", ",", "part_number", ",", "extra_args", ")", ":", "with", "fileobj", "as", "body", ":", "response", "=", "client", ".", "upload_part", "(", "Bucket", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferFuture.set_exception
Sets the exception on the future.
s3transfer/futures.py
def set_exception(self, exception): """Sets the exception on the future.""" if not self.done(): raise TransferNotDoneError( 'set_exception can only be called once the transfer is ' 'complete.') self._coordinator.set_exception(exception, override=True)
def set_exception(self, exception): """Sets the exception on the future.""" if not self.done(): raise TransferNotDoneError( 'set_exception can only be called once the transfer is ' 'complete.') self._coordinator.set_exception(exception, override=True)
[ "Sets", "the", "exception", "on", "the", "future", "." ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L114-L120
[ "def", "set_exception", "(", "self", ",", "exception", ")", ":", "if", "not", "self", ".", "done", "(", ")", ":", "raise", "TransferNotDoneError", "(", "'set_exception can only be called once the transfer is '", "'complete.'", ")", "self", ".", "_coordinator", ".", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.set_result
Set a result for the TransferFuture Implies that the TransferFuture succeeded. This will always set a result because it is invoked on the final task where there is only ever one final task and it is ran at the very end of a transfer process. So if a result is being set for this final ta...
s3transfer/futures.py
def set_result(self, result): """Set a result for the TransferFuture Implies that the TransferFuture succeeded. This will always set a result because it is invoked on the final task where there is only ever one final task and it is ran at the very end of a transfer process. So i...
def set_result(self, result): """Set a result for the TransferFuture Implies that the TransferFuture succeeded. This will always set a result because it is invoked on the final task where there is only ever one final task and it is ran at the very end of a transfer process. So i...
[ "Set", "a", "result", "for", "the", "TransferFuture" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L221-L234
[ "def", "set_result", "(", "self", ",", "result", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_exception", "=", "None", "self", ".", "_result", "=", "result", "self", ".", "_status", "=", "'success'" ]
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.set_exception
Set an exception for the TransferFuture Implies the TransferFuture failed. :param exception: The exception that cause the transfer to fail. :param override: If True, override any existing state.
s3transfer/futures.py
def set_exception(self, exception, override=False): """Set an exception for the TransferFuture Implies the TransferFuture failed. :param exception: The exception that cause the transfer to fail. :param override: If True, override any existing state. """ with self._lock:...
def set_exception(self, exception, override=False): """Set an exception for the TransferFuture Implies the TransferFuture failed. :param exception: The exception that cause the transfer to fail. :param override: If True, override any existing state. """ with self._lock:...
[ "Set", "an", "exception", "for", "the", "TransferFuture" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L236-L247
[ "def", "set_exception", "(", "self", ",", "exception", ",", "override", "=", "False", ")", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "done", "(", ")", "or", "override", ":", "self", ".", "_exception", "=", "exception", "self", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.result
Waits until TransferFuture is done and returns the result If the TransferFuture succeeded, it will return the result. If the TransferFuture failed, it will raise the exception associated to the failure.
s3transfer/futures.py
def result(self): """Waits until TransferFuture is done and returns the result If the TransferFuture succeeded, it will return the result. If the TransferFuture failed, it will raise the exception associated to the failure. """ # Doing a wait() with no timeout cannot be ...
def result(self): """Waits until TransferFuture is done and returns the result If the TransferFuture succeeded, it will return the result. If the TransferFuture failed, it will raise the exception associated to the failure. """ # Doing a wait() with no timeout cannot be ...
[ "Waits", "until", "TransferFuture", "is", "done", "and", "returns", "the", "result" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L249-L266
[ "def", "result", "(", "self", ")", ":", "# Doing a wait() with no timeout cannot be interrupted in python2 but", "# can be interrupted in python3 so we just wait with the largest", "# possible value integer value, which is on the scale of billions of", "# years...", "self", ".", "_done_event...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.cancel
Cancels the TransferFuture :param msg: The message to attach to the cancellation :param exc_type: The type of exception to set for the cancellation
s3transfer/futures.py
def cancel(self, msg='', exc_type=CancelledError): """Cancels the TransferFuture :param msg: The message to attach to the cancellation :param exc_type: The type of exception to set for the cancellation """ with self._lock: if not self.done(): should_a...
def cancel(self, msg='', exc_type=CancelledError): """Cancels the TransferFuture :param msg: The message to attach to the cancellation :param exc_type: The type of exception to set for the cancellation """ with self._lock: if not self.done(): should_a...
[ "Cancels", "the", "TransferFuture" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L268-L283
[ "def", "cancel", "(", "self", ",", "msg", "=", "''", ",", "exc_type", "=", "CancelledError", ")", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "done", "(", ")", ":", "should_announce_done", "=", "False", "logger", ".", "debug", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.submit
Submits a task to a provided executor :type executor: s3transfer.futures.BoundedExecutor :param executor: The executor to submit the callable to :type task: s3transfer.tasks.Task :param task: The task to submit to the executor :type tag: s3transfer.futures.TaskTag :par...
s3transfer/futures.py
def submit(self, executor, task, tag=None): """Submits a task to a provided executor :type executor: s3transfer.futures.BoundedExecutor :param executor: The executor to submit the callable to :type task: s3transfer.tasks.Task :param task: The task to submit to the executor ...
def submit(self, executor, task, tag=None): """Submits a task to a provided executor :type executor: s3transfer.futures.BoundedExecutor :param executor: The executor to submit the callable to :type task: s3transfer.tasks.Task :param task: The task to submit to the executor ...
[ "Submits", "a", "task", "to", "a", "provided", "executor" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L301-L326
[ "def", "submit", "(", "self", ",", "executor", ",", "task", ",", "tag", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Submitting task %s to executor %s for transfer request: %s.\"", "%", "(", "task", ",", "executor", ",", "self", ".", "transfer_id", "...
2aead638c8385d8ae0b1756b2de17e8fad45fffa
test
TransferCoordinator.add_done_callback
Add a done callback to be invoked when transfer is done
s3transfer/futures.py
def add_done_callback(self, function, *args, **kwargs): """Add a done callback to be invoked when transfer is done""" with self._done_callbacks_lock: self._done_callbacks.append( FunctionContainer(function, *args, **kwargs) )
def add_done_callback(self, function, *args, **kwargs): """Add a done callback to be invoked when transfer is done""" with self._done_callbacks_lock: self._done_callbacks.append( FunctionContainer(function, *args, **kwargs) )
[ "Add", "a", "done", "callback", "to", "be", "invoked", "when", "transfer", "is", "done" ]
boto/s3transfer
python
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L346-L351
[ "def", "add_done_callback", "(", "self", ",", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "_done_callbacks_lock", ":", "self", ".", "_done_callbacks", ".", "append", "(", "FunctionContainer", "(", "function", ",", ...
2aead638c8385d8ae0b1756b2de17e8fad45fffa