desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Announce torrent info to tracker(s)'
| def announce(self):
| m = rtorrent.rpc.Multicall(self)
self.multicall_add(m, 'd.tracker_announce')
return m.call()[(-1)]
|
'Get custom value
@param key: the index for the custom field (between 1-5)
@type key: int
@rtype: str'
| def get_custom(self, key):
| self._assert_custom_key_valid(key)
m = rtorrent.rpc.Multicall(self)
field = 'custom{0}'.format(key)
self.multicall_add(m, 'd.get_{0}'.format(field))
setattr(self, field, m.call()[(-1)])
return getattr(self, field)
|
'Set custom value
@param key: the index for the custom field (between 1-5)
@type key: int
@param value: the value to be stored
@type value: str
@return: if successful, value will be returned
@rtype: str'
| def set_custom(self, key, value):
| self._assert_custom_key_valid(key)
m = rtorrent.rpc.Multicall(self)
self.multicall_add(m, 'd.set_custom{0}'.format(key), value)
return m.call()[(-1)]
|
'Only checks instance variables, shouldn\'t be called directly'
| def _is_hash_checking_queued(self):
| self.hash_checking_queued = ((self.hashing == 3) and (self.hash_checking is False))
return self.hash_checking_queued
|
'Check if torrent is waiting to be hash checked
@note: Variable where the result for this method is stored Torrent.hash_checking_queued'
| def is_hash_checking_queued(self):
| m = rtorrent.rpc.Multicall(self)
self.multicall_add(m, 'd.get_hashing')
self.multicall_add(m, 'd.is_hash_checking')
results = m.call()
setattr(self, 'hashing', results[0])
setattr(self, 'hash_checking', results[1])
return self._is_hash_checking_queued()
|
'Only checks instance variables, shouldn\'t be called directly'
| def _is_paused(self):
| self.paused = (self.state == 0)
return self.paused
|
'Check if torrent is paused
@note: Variable where the result for this method is stored: Torrent.paused'
| def is_paused(self):
| self.get_state()
return self._is_paused()
|
'Only checks instance variables, shouldn\'t be called directly'
| def _is_started(self):
| self.started = (self.state == 1)
return self.started
|
'Check if torrent is started
@note: Variable where the result for this method is stored: Torrent.started'
| def is_started(self):
| self.get_state()
return self._is_started()
|
'Delegate a debug call to the underlying logger.'
| def debug(self, msg, *args, **kwargs):
| self.log(logging.DEBUG, msg, *args, **kwargs)
|
'Delegate an info call to the underlying logger.'
| def info(self, msg, *args, **kwargs):
| self.log(logging.INFO, msg, *args, **kwargs)
|
'Delegate a warning call to the underlying logger.'
| def warning(self, msg, *args, **kwargs):
| self.log(logging.WARNING, msg, *args, **kwargs)
|
'Delegate an error call to the underlying logger.'
| def error(self, msg, *args, **kwargs):
| self.log(logging.ERROR, msg, *args, **kwargs)
|
'Delegate an exception call to the underlying logger.'
| def exception(self, msg, *args, **kwargs):
| kwargs['exc_info'] = 1
self.log(logging.ERROR, msg, *args, **kwargs)
|
'Delegate a critical call to the underlying logger.'
| def critical(self, msg, *args, **kwargs):
| self.log(logging.CRITICAL, msg, *args, **kwargs)
|
'Delegate a log call to the underlying logger.
The level here is determined by the echo
flag as well as that of the underlying logger, and
logger._log() is called directly.'
| def log(self, level, msg, *args, **kwargs):
| if (self.logger.manager.disable >= level):
return
selected_level = self._echo_map[self.echo]
if (selected_level == logging.NOTSET):
selected_level = self.logger.getEffectiveLevel()
if (level >= selected_level):
self.logger._log(level, msg, args, **kwargs)
|
'Is this logger enabled for level \'level\'?'
| def isEnabledFor(self, level):
| if (self.logger.manager.disable >= level):
return False
return (level >= self.getEffectiveLevel())
|
'What\'s the effective level for this logger?'
| def getEffectiveLevel(self):
| level = self._echo_map[self.echo]
if (level == logging.NOTSET):
level = self.logger.getEffectiveLevel()
return level
|
'Sniff out the character set in use for connection results.'
| def _detect_charset(self, connection):
| try:
cset_name = connection.connection.character_set_name
except AttributeError:
util.warn("No 'character_set_name' can be detected with this MySQL-Python version; please upgrade to a recent version of MySQL-Python. Assuming latin1.")
... |
'Import mxODBC exception classes into the module namespace,
as if they had been imported normally. This is done here
to avoid requiring all SQLAlchemy users to install mxODBC.'
| @classmethod
def _load_mx_exceptions(cls):
| global InterfaceError, ProgrammingError
from mx.ODBC import InterfaceError
from mx.ODBC import ProgrammingError
|
'Return a handler that adjusts mxODBC\'s raised Warnings to
emit Python standard warnings.'
| def _error_handler(self):
| from mx.ODBC.Error import Warning as MxOdbcWarning
def error_handler(connection, cursor, errorclass, errorvalue):
if issubclass(errorclass, MxOdbcWarning):
errorclass.__bases__ = (Warning,)
warnings.warn(message=str(errorvalue), category=errorclass, stacklevel=2)
else:
... |
'Return a tuple of *args,**kwargs for creating a connection.
The mxODBC 3.x connection constructor looks like this:
connect(dsn, user=\'\', password=\'\',
clear_auto_commit=1, errorhandler=None)
This method translates the values in the provided uri
into args and kwargs needed to instantiate an mxODBC Connection.
The ar... | def create_connect_args(self, url):
| opts = url.translate_connect_args(username='user')
opts.update(url.query)
args = opts.pop('host')
opts.pop('port', None)
opts.pop('database', None)
return ((args,), opts)
|
'Return kw arg dict to be sent to connect().'
| def _driver_kwargs(self):
| return {}
|
'Create a JDBC url from a :class:`~sqlalchemy.engine.url.URL`'
| def _create_jdbc_url(self, url):
| return ('jdbc:%s://%s%s/%s' % (self.jdbc_db_name, url.host, (((url.port is not None) and (':%s' % url.port)) or ''), url.database))
|
'target platform can emit basic CreateTable DDL.'
| @property
def create_table(self):
| return exclusions.open()
|
'target platform can emit basic DropTable DDL.'
| @property
def drop_table(self):
| return exclusions.open()
|
'Target database must support foreign keys.'
| @property
def foreign_keys(self):
| return exclusions.open()
|
'"target database must support ON UPDATE..CASCADE behavior in
foreign keys.'
| @property
def on_update_cascade(self):
| return exclusions.open()
|
'target database must *not* support ON UPDATE..CASCADE behavior in
foreign keys.'
| @property
def non_updating_cascade(self):
| return exclusions.closed()
|
'Target database must support self-referential foreign keys.'
| @property
def self_referential_foreign_keys(self):
| return exclusions.open()
|
'Target database must support the DDL phrases for FOREIGN KEY.'
| @property
def foreign_key_ddl(self):
| return exclusions.open()
|
'target database must support names for constraints.'
| @property
def named_constraints(self):
| return exclusions.open()
|
'Target database must support subqueries.'
| @property
def subqueries(self):
| return exclusions.open()
|
'target database can render OFFSET, or an equivalent, in a SELECT.'
| @property
def offset(self):
| return exclusions.open()
|
'Target database must support boolean expressions as columns'
| @property
def boolean_col_expressions(self):
| return exclusions.closed()
|
'Target backends that support nulls ordering.'
| @property
def nullsordering(self):
| return exclusions.closed()
|
'target database/driver supports bound parameters as column expressions
without being in the context of a typed column.'
| @property
def standalone_binds(self):
| return exclusions.closed()
|
'Target database must support INTERSECT or equivalent.'
| @property
def intersect(self):
| return exclusions.closed()
|
'Target database must support EXCEPT or equivalent (i.e. MINUS).'
| @property
def except_(self):
| return exclusions.closed()
|
'Target database must support window functions.'
| @property
def window_functions(self):
| return exclusions.closed()
|
'target platform generates new surrogate integer primary key values
when insert() is executed, excluding the pk column.'
| @property
def autoincrement_insert(self):
| return exclusions.open()
|
'target platform will allow cursor.fetchone() to proceed after a
COMMIT.
Typically this refers to an INSERT statement with RETURNING which
is invoked within "autocommit". If the row can be returned
after the autocommit, then this rule can be open.'
| @property
def fetch_rows_post_commit(self):
| return exclusions.open()
|
'target platform supports INSERT with no values, i.e.
INSERT DEFAULT VALUES or equivalent.'
| @property
def empty_inserts(self):
| return exclusions.only_if((lambda config: (config.db.dialect.supports_empty_insert or config.db.dialect.supports_default_values)), 'empty inserts not supported')
|
'target platform supports INSERT from a SELECT.'
| @property
def insert_from_select(self):
| return exclusions.open()
|
'target platform supports RETURNING.'
| @property
def returning(self):
| return exclusions.only_if((lambda config: config.db.dialect.implicit_returning), "'returning' not supported by database")
|
'target platform supports a SELECT statement that has
the same name repeated more than once in the columns list.'
| @property
def duplicate_names_in_cursor_description(self):
| return exclusions.open()
|
'Target database must have \'denormalized\', i.e.
UPPERCASE as case insensitive names.'
| @property
def denormalized_names(self):
| return exclusions.skip_if((lambda config: (not config.db.dialect.requires_name_normalize)), 'Backend does not require denormalized names.')
|
'target database must support multiple VALUES clauses in an
INSERT statement.'
| @property
def multivalues_inserts(self):
| return exclusions.skip_if((lambda config: (not config.db.dialect.supports_multivalues_insert)), 'Backend does not support multirow inserts.')
|
'"target dialect implements the executioncontext.get_lastrowid()
method without reliance on RETURNING.'
| @property
def implements_get_lastrowid(self):
| return exclusions.open()
|
'"target dialect retrieves cursor.lastrowid, or fetches
from a database-side function after an insert() construct executes,
within the get_lastrowid() method.
Only dialects that "pre-execute", or need RETURNING to get last
inserted id, would return closed/fail/skip for this.'
| @property
def emulated_lastrowid(self):
| return exclusions.closed()
|
'"target platform includes a \'lastrowid\' accessor on the DBAPI
cursor object.'
| @property
def dbapi_lastrowid(self):
| return exclusions.closed()
|
'Target database must support VIEWs.'
| @property
def views(self):
| return exclusions.closed()
|
'Target database must support external schemas, and have one
named \'test_schema\'.'
| @property
def schemas(self):
| return exclusions.closed()
|
'Target database must support SEQUENCEs.'
| @property
def sequences(self):
| return exclusions.only_if([(lambda config: config.db.dialect.supports_sequences)], 'no sequence support')
|
'Target database supports sequences, but also optionally
as a means of generating new PK values.'
| @property
def sequences_optional(self):
| return exclusions.only_if([(lambda config: (config.db.dialect.supports_sequences and config.db.dialect.sequences_optional))], 'no sequence support, or sequences not optional')
|
'target database must support retrieval of the columns in a view,
similarly to how a table is inspected.
This does not include the full CREATE VIEW definition.'
| @property
def view_column_reflection(self):
| return self.views
|
'target database must support inspection of the full CREATE VIEW definition.'
| @property
def view_reflection(self):
| return self.views
|
'target dialect supports reflection of unique constraints'
| @property
def unique_constraint_reflection(self):
| return exclusions.open()
|
'Target database must support VARCHAR with no length'
| @property
def unbounded_varchar(self):
| return exclusions.open()
|
'Target database/dialect must support Python unicode objects with
non-ASCII characters represented, delivered as bound parameters
as well as in result rows.'
| @property
def unicode_data(self):
| return exclusions.open()
|
'Target driver must support some degree of non-ascii symbol names.'
| @property
def unicode_ddl(self):
| return exclusions.closed()
|
'target dialect supports rendering of a date, time, or datetime as a
literal string, e.g. via the TypeEngine.literal_processor() method.'
| @property
def datetime_literals(self):
| return exclusions.closed()
|
'target dialect supports representation of Python
datetime.datetime() objects.'
| @property
def datetime(self):
| return exclusions.open()
|
'target dialect supports representation of Python
datetime.datetime() with microsecond objects.'
| @property
def datetime_microseconds(self):
| return exclusions.open()
|
'target dialect supports representation of Python
datetime.datetime() objects with historic (pre 1970) values.'
| @property
def datetime_historic(self):
| return exclusions.closed()
|
'target dialect supports representation of Python
datetime.date() objects.'
| @property
def date(self):
| return exclusions.open()
|
'target dialect accepts a datetime object as the target
of a date column.'
| @property
def date_coerces_from_datetime(self):
| return exclusions.open()
|
'target dialect supports representation of Python
datetime.datetime() objects with historic (pre 1970) values.'
| @property
def date_historic(self):
| return exclusions.closed()
|
'target dialect supports representation of Python
datetime.time() objects.'
| @property
def time(self):
| return exclusions.open()
|
'target dialect supports representation of Python
datetime.time() with microsecond objects.'
| @property
def time_microseconds(self):
| return exclusions.open()
|
'target database/driver can allow BLOB/BINARY fields to be compared
against a bound parameter value.'
| @property
def binary_comparisons(self):
| return exclusions.open()
|
'target backend supports simple binary literals, e.g. an
expression like::
SELECT CAST(\'foo\' AS BINARY)
Where ``BINARY`` is the type emitted from :class:`.LargeBinary`,
e.g. it could be ``BLOB`` or similar.
Basically fails on Oracle.'
| @property
def binary_literals(self):
| return exclusions.open()
|
'target backend has general support for moderately high-precision
numerics.'
| @property
def precision_numerics_general(self):
| return exclusions.open()
|
'target backend supports Decimal() objects using E notation
to represent very small values.'
| @property
def precision_numerics_enotation_small(self):
| return exclusions.closed()
|
'target backend supports Decimal() objects using E notation
to represent very large values.'
| @property
def precision_numerics_enotation_large(self):
| return exclusions.closed()
|
'target backend supports values with many digits on both sides,
such as 319438950232418390.273596, 87673.594069654243'
| @property
def precision_numerics_many_significant_digits(self):
| return exclusions.closed()
|
'A precision numeric type will return empty significant digits,
i.e. a value such as 10.000 will come back in Decimal form with
the .000 maintained.'
| @property
def precision_numerics_retains_significant_digits(self):
| return exclusions.closed()
|
'target backend will return native floating point numbers with at
least seven decimal places when using the generic Float type.'
| @property
def precision_generic_float_type(self):
| return exclusions.open()
|
'target backend can return a floating-point number with four
significant digits (such as 15.7563) accurately
(i.e. without FP inaccuracies, such as 15.75629997253418).'
| @property
def floats_to_four_decimals(self):
| return exclusions.open()
|
'target backend doesn\'t crash when you try to select a NUMERIC
value that has a value of NULL.
Added to support Pyodbc bug #351.'
| @property
def fetch_null_from_numeric(self):
| return exclusions.open()
|
'Target database must support an unbounded Text() "
"type such as TEXT or CLOB'
| @property
def text_type(self):
| return exclusions.open()
|
'target database can persist/return an empty string with a
varchar.'
| @property
def empty_strings_varchar(self):
| return exclusions.open()
|
'target database can persist/return an empty string with an
unbounded text.'
| @property
def empty_strings_text(self):
| return exclusions.open()
|
'target driver must support the literal statement \'select 1\''
| @property
def selectone(self):
| return exclusions.open()
|
'Target database must support savepoints.'
| @property
def savepoints(self):
| return exclusions.closed()
|
'Target database must support two-phase transactions.'
| @property
def two_phase_transactions(self):
| return exclusions.closed()
|
'Target must support UPDATE..FROM syntax'
| @property
def update_from(self):
| return exclusions.closed()
|
'Target must support UPDATE where the same table is present in a
subquery in the WHERE clause.
This is an ANSI-standard syntax that apparently MySQL can\'t handle,
such as:
UPDATE documents SET flag=1 WHERE documents.title IN
(SELECT max(documents.title) AS title
FROM documents GROUP BY documents.user_id'
| @property
def update_where_target_in_subquery(self):
| return exclusions.open()
|
'target database must use a plain percent \'%\' as the \'modulus\'
operator.'
| @property
def mod_operator_as_percent_sign(self):
| return exclusions.closed()
|
'target backend supports weird identifiers with percent signs
in them, e.g. \'some % column\'.
this is a very weird use case but often has problems because of
DBAPIs that use python formatting. It\'s not a critical use
case either.'
| @property
def percent_schema_names(self):
| return exclusions.closed()
|
'target backend supports ORDER BY a column label within an
expression.
Basically this::
select data as foo from test order by foo || \'bar\'
Lots of databases including Postgresql don\'t support this,
so this is off by default.'
| @property
def order_by_label_with_expression(self):
| return exclusions.closed()
|
'Target driver must support non-ASCII characters being passed at all.'
| @property
def unicode_connections(self):
| return exclusions.open()
|
'Catchall for a large variety of MySQL on Windows failures'
| @property
def skip_mysql_on_windows(self):
| return exclusions.open()
|
'Test environment must allow ad-hoc engine/connection creation.
DBs that scale poorly for many connections, even when closed, i.e.
Oracle, may use the "--low-connections" option which flags this requirement
as not present.'
| @property
def ad_hoc_engines(self):
| return exclusions.skip_if((lambda config: config.options.low_connections))
|
'As assert_result, but the order of objects is not considered.
The algorithm is very expensive but not a big deal for the small
numbers of rows that the test suite manipulates.'
| def assert_unordered_result(self, result, cls, *expected):
| class immutabledict(dict, ):
def __hash__(self):
return id(self)
found = util.IdentitySet(result)
expected = set([immutabledict(e) for e in expected])
for wrong in util.itertools_filterfalse((lambda o: (type(o) == cls)), found):
fail(('Unexpected type "%s", expected ... |
'add a config as one of the global configs.
If there are no configs set up yet, this config also
gets set as the "_current".'
| @classmethod
def register(cls, db, db_opts, options, file_config, namespace):
| cfg = Config(db, db_opts, options, file_config)
global _current
if (not _current):
cls.set_as_current(cfg, namespace)
cls._configs[cfg.db.name] = cfg
cls._configs[(cfg.db.name, cfg.db.dialect)] = cfg
cls._configs[cfg.db] = cfg
|
'test that \'autoincrement\' is reflected according to sqla\'s policy.
Don\'t mark this test as unsupported for any backend !
(technically it fails with MySQL InnoDB since "id" comes before "id2")
A backend is better off not returning "autoincrement" at all,
instead of potentially returning "False" for an auto-incremen... | @testing.requires.table_reflection
@testing.provide_metadata
def test_autoincrement_col(self):
| meta = self.metadata
insp = inspect(meta.bind)
for (tname, cname) in [('users', 'user_id'), ('email_addresses', 'address_id'), ('dingalings', 'dingaling_id')]:
cols = insp.get_columns(tname)
id_ = dict(((c['name'], c) for c in cols))[cname]
assert id_.get('autoincrement', True)
|
'test literal rendering'
| @testing.provide_metadata
def _literal_round_trip(self, type_, input_, output, filter_=None):
| t = Table('t', self.metadata, Column('x', type_))
t.create()
for value in input_:
ins = t.insert().values(x=literal(value)).compile(dialect=testing.db.dialect, compile_kwargs=dict(literal_binds=True))
testing.db.execute(ins)
for row in t.select().execute():
value = row[0]
... |
'test exceedingly small decimals.
Decimal reports values with E notation when the exponent
is greater than 6.'
| @testing.requires.precision_numerics_enotation_large
def test_enotation_decimal(self):
| numbers = set([decimal.Decimal('1E-2'), decimal.Decimal('1E-3'), decimal.Decimal('1E-4'), decimal.Decimal('1E-5'), decimal.Decimal('1E-6'), decimal.Decimal('1E-7'), decimal.Decimal('1E-8'), decimal.Decimal('0.01000005940696'), decimal.Decimal('0.00000005940696'), decimal.Decimal('0.00000000000696'), decimal.Decimal... |
'test exceedingly large decimals.'
| @testing.requires.precision_numerics_enotation_large
def test_enotation_decimal_large(self):
| numbers = set([decimal.Decimal('4E+8'), decimal.Decimal('5748E+15'), decimal.Decimal('1.521E+15'), decimal.Decimal('00000000000000.1E+12')])
self._do_test(Numeric(precision=25, scale=2), numbers, numbers)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.