body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def _get_latest_log_files(name, testing=False) -> List[str]:
'Returns a list with the paths of all available logfiles for `name` sorted by latest first.'
log_dir = dirs.get_log_dir(name)
files = filter((lambda filename: (name in filename)), os.listdir(log_dir))
files = filter((lambda filename: (('testin... | 2,716,176,745,821,204,000 | Returns a list with the paths of all available logfiles for `name` sorted by latest first. | aw_core/log.py | _get_latest_log_files | minhlt9196/activeseconds-aw-core | python | def _get_latest_log_files(name, testing=False) -> List[str]:
log_dir = dirs.get_log_dir(name)
files = filter((lambda filename: (name in filename)), os.listdir(log_dir))
files = filter((lambda filename: (('testing' in filename) if testing else ('testing' not in filename))), files)
return [os.path.jo... |
def get_latest_log_file(name, testing=False) -> Optional[str]:
'\n Returns the filename of the last logfile with `name`.\n Useful when you want to read the logfile of another TimeBench service.\n '
last_logs = _get_latest_log_files(name, testing=testing)
return (last_logs[0] if last_logs else None) | -1,499,907,841,220,113,000 | Returns the filename of the last logfile with `name`.
Useful when you want to read the logfile of another TimeBench service. | aw_core/log.py | get_latest_log_file | minhlt9196/activeseconds-aw-core | python | def get_latest_log_file(name, testing=False) -> Optional[str]:
'\n Returns the filename of the last logfile with `name`.\n Useful when you want to read the logfile of another TimeBench service.\n '
last_logs = _get_latest_log_files(name, testing=testing)
return (last_logs[0] if last_logs else None) |
def log_format(x):
'Used to give JsonFormatter proper parameter format'
return ['%({0:s})'.format(i) for i in x] | 4,862,817,577,818,626,000 | Used to give JsonFormatter proper parameter format | aw_core/log.py | log_format | minhlt9196/activeseconds-aw-core | python | def log_format(x):
return ['%({0:s})'.format(i) for i in x] |
def fib_sum(limit):
'\n Считает сумму положительных чисел Фибаначи, которые меньше указанного значения\n '
u1 = 1
u2 = 2
summ = 2
_u = (u1 + u2)
while (_u < limit):
if ((_u % 2) == 0):
summ += _u
u1 = u2
u2 = _u
_u = (u1 + u2)
return summ | -7,042,709,406,166,169,000 | Считает сумму положительных чисел Фибаначи, которые меньше указанного значения | t002-fibanatchi.py | fib_sum | z1365/euler | python | def fib_sum(limit):
'\n \n '
u1 = 1
u2 = 2
summ = 2
_u = (u1 + u2)
while (_u < limit):
if ((_u % 2) == 0):
summ += _u
u1 = u2
u2 = _u
_u = (u1 + u2)
return summ |
def test_angular_momentum_and_linear_momentum():
"A rod with length 2l, centroidal inertia I, and mass M along with a\n particle of mass m fixed to the end of the rod rotate with an angular rate\n of omega about point O which is fixed to the non-particle end of the rod.\n The rod's reference frame is A and... | -4,550,189,536,131,389,400 | A rod with length 2l, centroidal inertia I, and mass M along with a
particle of mass m fixed to the end of the rod rotate with an angular rate
of omega about point O which is fixed to the non-particle end of the rod.
The rod's reference frame is A and the inertial frame is N. | sympy/physics/mechanics/tests/test_functions.py | test_angular_momentum_and_linear_momentum | Abhi58/sympy | python | def test_angular_momentum_and_linear_momentum():
"A rod with length 2l, centroidal inertia I, and mass M along with a\n particle of mass m fixed to the end of the rod rotate with an angular rate\n of omega about point O which is fixed to the non-particle end of the rod.\n The rod's reference frame is A and... |
def to_timedelta(arg, unit=None, errors='raise'):
'\n Convert argument to timedelta.\n\n Timedeltas are absolute differences in times, expressed in difference\n units (e.g. days, hours, minutes, seconds). This method converts\n an argument from a recognized timedelta format / value into\n a Timedelta... | -4,619,909,879,631,674,000 | Convert argument to timedelta.
Timedeltas are absolute differences in times, expressed in difference
units (e.g. days, hours, minutes, seconds). This method converts
an argument from a recognized timedelta format / value into
a Timedelta type.
Parameters
----------
arg : str, timedelta, list-like or Series
The da... | pandas/core/tools/timedeltas.py | to_timedelta | cdeil/pandas | python | def to_timedelta(arg, unit=None, errors='raise'):
'\n Convert argument to timedelta.\n\n Timedeltas are absolute differences in times, expressed in difference\n units (e.g. days, hours, minutes, seconds). This method converts\n an argument from a recognized timedelta format / value into\n a Timedelta... |
def _coerce_scalar_to_timedelta_type(r, unit='ns', errors='raise'):
"Convert string 'r' to a timedelta object."
try:
result = Timedelta(r, unit)
except ValueError:
if (errors == 'raise'):
raise
elif (errors == 'ignore'):
return r
result = NaT
retur... | -6,240,162,069,825,605,000 | Convert string 'r' to a timedelta object. | pandas/core/tools/timedeltas.py | _coerce_scalar_to_timedelta_type | cdeil/pandas | python | def _coerce_scalar_to_timedelta_type(r, unit='ns', errors='raise'):
try:
result = Timedelta(r, unit)
except ValueError:
if (errors == 'raise'):
raise
elif (errors == 'ignore'):
return r
result = NaT
return result |
def _convert_listlike(arg, unit=None, errors='raise', name=None):
'Convert a list of objects to a timedelta index object.'
if (isinstance(arg, (list, tuple)) or (not hasattr(arg, 'dtype'))):
arg = np.array(list(arg), dtype=object)
try:
value = sequence_to_td64ns(arg, unit=unit, errors=errors... | 6,420,085,564,580,702,000 | Convert a list of objects to a timedelta index object. | pandas/core/tools/timedeltas.py | _convert_listlike | cdeil/pandas | python | def _convert_listlike(arg, unit=None, errors='raise', name=None):
if (isinstance(arg, (list, tuple)) or (not hasattr(arg, 'dtype'))):
arg = np.array(list(arg), dtype=object)
try:
value = sequence_to_td64ns(arg, unit=unit, errors=errors, copy=False)[0]
except ValueError:
if (erro... |
def __init__(self, mrns: Optional[Set[str]]=None, dimensions: Optional[Set[str]]=None, clause=None, data_columns=None, **kwargs):
'\n Args:\n mrns: Set of MRN-Strings for which the condition is true.\n children: List of child conditions which were combined with an\n opera... | 6,810,422,015,448,396,000 | Args:
mrns: Set of MRN-Strings for which the condition is true.
children: List of child conditions which were combined with an
operator.
operator: String representing the combination of the child
condition (e.g. ``_BaseCondition.AND``)
dimensions: A set of tables that need to be joined o... | fiber/condition/database.py | __init__ | hpi-dhc/fiber | python | def __init__(self, mrns: Optional[Set[str]]=None, dimensions: Optional[Set[str]]=None, clause=None, data_columns=None, **kwargs):
'\n Args:\n mrns: Set of MRN-Strings for which the condition is true.\n children: List of child conditions which were combined with an\n opera... |
@property
def base_table(self) -> Table:
'\n Must be set by subclasses to the database table which the class uses to\n select patients and data. This is also used to optimize queries on the\n same table.\n '
raise NotImplementedError | -9,211,096,098,496,574,000 | Must be set by subclasses to the database table which the class uses to
select patients and data. This is also used to optimize queries on the
same table. | fiber/condition/database.py | base_table | hpi-dhc/fiber | python | @property
def base_table(self) -> Table:
'\n Must be set by subclasses to the database table which the class uses to\n select patients and data. This is also used to optimize queries on the\n same table.\n '
raise NotImplementedError |
@property
def _default_columns(self):
'\n Must be set by subclasses.\n\n This should return an array of columns which are in the result table of\n ``._create_query()``. These columns will be returned by default when\n ``.get_data()`` is called.\n '
raise NotImplementedError | 8,196,578,915,108,377,000 | Must be set by subclasses.
This should return an array of columns which are in the result table of
``._create_query()``. These columns will be returned by default when
``.get_data()`` is called. | fiber/condition/database.py | _default_columns | hpi-dhc/fiber | python | @property
def _default_columns(self):
'\n Must be set by subclasses.\n\n This should return an array of columns which are in the result table of\n ``._create_query()``. These columns will be returned by default when\n ``.get_data()`` is called.\n '
raise NotImplementedError |
@property
def mrn_column(self):
'\n Must be set by subclasses.\n\n This is used to specify the column in the result table of\n ``._create_query()`` which is holding the MRNs.\n '
raise NotImplementedError | -4,138,846,600,661,252,600 | Must be set by subclasses.
This is used to specify the column in the result table of
``._create_query()`` which is holding the MRNs. | fiber/condition/database.py | mrn_column | hpi-dhc/fiber | python | @property
def mrn_column(self):
'\n Must be set by subclasses.\n\n This is used to specify the column in the result table of\n ``._create_query()`` which is holding the MRNs.\n '
raise NotImplementedError |
@property
def age_column(self):
'\n Must be set by subclasses.\n\n This is used to specify the column in the result table of\n ``._create_query()`` which is holding the age in days.\n '
raise NotImplementedError | -211,457,758,802,844,300 | Must be set by subclasses.
This is used to specify the column in the result table of
``._create_query()`` which is holding the age in days. | fiber/condition/database.py | age_column | hpi-dhc/fiber | python | @property
def age_column(self):
'\n Must be set by subclasses.\n\n This is used to specify the column in the result table of\n ``._create_query()`` which is holding the age in days.\n '
raise NotImplementedError |
@property
def data_columns(self):
'\n Returns columns which are in the result table of\n ``._create_query()``. These columns will be returned when\n ``.get_data()`` is called.\n '
return [str(col) for col in (self._specified_columns or self._default_columns)] | -1,208,874,599,390,524,400 | Returns columns which are in the result table of
``._create_query()``. These columns will be returned when
``.get_data()`` is called. | fiber/condition/database.py | data_columns | hpi-dhc/fiber | python | @property
def data_columns(self):
'\n Returns columns which are in the result table of\n ``._create_query()``. These columns will be returned when\n ``.get_data()`` is called.\n '
return [str(col) for col in (self._specified_columns or self._default_columns)] |
@property
def clause(self):
'\n Returns the clause of the current condition or runs\n ``._create_clause()`` to create it.\n '
if (not isinstance(self._clause, sql.elements.True_)):
return self._clause
else:
return self._create_clause() | -8,420,029,666,076,889,000 | Returns the clause of the current condition or runs
``._create_clause()`` to create it. | fiber/condition/database.py | clause | hpi-dhc/fiber | python | @property
def clause(self):
'\n Returns the clause of the current condition or runs\n ``._create_clause()`` to create it.\n '
if (not isinstance(self._clause, sql.elements.True_)):
return self._clause
else:
return self._create_clause() |
def _create_clause(self):
'\n Should be overwritten by subclasses to create a SQLAlchemy clause based\n on the defined condition. It is used to select the correct patients.\n '
return sql.true() | -2,366,013,195,273,496,600 | Should be overwritten by subclasses to create a SQLAlchemy clause based
on the defined condition. It is used to select the correct patients. | fiber/condition/database.py | _create_clause | hpi-dhc/fiber | python | def _create_clause(self):
'\n Should be overwritten by subclasses to create a SQLAlchemy clause based\n on the defined condition. It is used to select the correct patients.\n '
return sql.true() |
def _create_query(self) -> orm.Query:
'\n Must be implemented by subclasses to return an instance of a SQLAlchemy\n query which only returns MRNs.\n\n This query should yield all medical record numbers in the\n ``base_table`` of the condition. It uses the ``.clause`` to select\n t... | 4,027,134,133,308,272,600 | Must be implemented by subclasses to return an instance of a SQLAlchemy
query which only returns MRNs.
This query should yield all medical record numbers in the
``base_table`` of the condition. It uses the ``.clause`` to select
the relevant patients.
This query is also used by other function which change the selected... | fiber/condition/database.py | _create_query | hpi-dhc/fiber | python | def _create_query(self) -> orm.Query:
'\n Must be implemented by subclasses to return an instance of a SQLAlchemy\n query which only returns MRNs.\n\n This query should yield all medical record numbers in the\n ``base_table`` of the condition. It uses the ``.clause`` to select\n t... |
def _fetch_mrns(self, limit: Optional[int]=None):
'Fetches MRNs from the results of ``._create_query()``.'
q = self._create_query()
if limit:
q = q.limit(limit)
mrn_df = read_with_progress(q.statement, self.engine)
if mrn_df.empty:
mrn_df = pd.DataFrame(columns=['medical_record_numbe... | -8,381,494,308,814,900,000 | Fetches MRNs from the results of ``._create_query()``. | fiber/condition/database.py | _fetch_mrns | hpi-dhc/fiber | python | def _fetch_mrns(self, limit: Optional[int]=None):
q = self._create_query()
if limit:
q = q.limit(limit)
mrn_df = read_with_progress(q.statement, self.engine)
if mrn_df.empty:
mrn_df = pd.DataFrame(columns=['medical_record_number'])
assert (len(mrn_df.columns) == 1), '_create_que... |
def _fetch_data(self, included_mrns: Optional[Set]=None, limit: Optional[int]=None):
'\n Fetches the data defined with ``.data_columns`` for each patient\n defined by this condition and via ``included_mrns`` from the results of\n ``._create_query()``.\n '
q = self._create_query()
... | 5,996,257,617,156,554,000 | Fetches the data defined with ``.data_columns`` for each patient
defined by this condition and via ``included_mrns`` from the results of
``._create_query()``. | fiber/condition/database.py | _fetch_data | hpi-dhc/fiber | python | def _fetch_data(self, included_mrns: Optional[Set]=None, limit: Optional[int]=None):
'\n Fetches the data defined with ``.data_columns`` for each patient\n defined by this condition and via ``included_mrns`` from the results of\n ``._create_query()``.\n '
q = self._create_query()
... |
def example_values(self):
"\n Returns ten values of the current condition.\n\n Example:\n >>> Patient(gender='Female', religion='Hindu').example_values()\n "
return self.get_data(limit=10) | 1,292,491,153,136,693,200 | Returns ten values of the current condition.
Example:
>>> Patient(gender='Female', religion='Hindu').example_values() | fiber/condition/database.py | example_values | hpi-dhc/fiber | python | def example_values(self):
"\n Returns ten values of the current condition.\n\n Example:\n >>> Patient(gender='Female', religion='Hindu').example_values()\n "
return self.get_data(limit=10) |
def values_per(self, *columns: Set[str]):
'\n Counts occurence of unique values in the specified columns.\n '
return self._grouped_count('*', *columns, label='values') | -8,414,278,900,176,086,000 | Counts occurence of unique values in the specified columns. | fiber/condition/database.py | values_per | hpi-dhc/fiber | python | def values_per(self, *columns: Set[str]):
'\n \n '
return self._grouped_count('*', *columns, label='values') |
def patients_per(self, *columns: Set[str]):
'\n Counts distinct patients for unique values in the specified columns.\n '
return self._grouped_count(self.mrn_column.distinct(), *columns, label='patients') | 1,264,087,047,943,287,300 | Counts distinct patients for unique values in the specified columns. | fiber/condition/database.py | patients_per | hpi-dhc/fiber | python | def patients_per(self, *columns: Set[str]):
'\n \n '
return self._grouped_count(self.mrn_column.distinct(), *columns, label='patients') |
def distinct(self, *columns: Set[str]):
'Returns distinct values based on the specified ``columns``'
if (not columns):
raise ValueError('Supply one or multiple columns as arguments.')
q = self._create_query()
q = q.with_entities(*columns).distinct()
return read_with_progress(q.statement, sel... | 3,780,552,309,333,347,300 | Returns distinct values based on the specified ``columns`` | fiber/condition/database.py | distinct | hpi-dhc/fiber | python | def distinct(self, *columns: Set[str]):
if (not columns):
raise ValueError('Supply one or multiple columns as arguments.')
q = self._create_query()
q = q.with_entities(*columns).distinct()
return read_with_progress(q.statement, self.engine) |
def __or__(self, other: _BaseCondition):
'\n The _DatabaseCondition optimizes the SQL statements for ``|`` by\n combining the clauses of condition which run on the same database\n table. This is done via the ``.base_table`` attribute.\n '
if ((self.base_table == other.base_table) and... | -943,715,415,913,724,000 | The _DatabaseCondition optimizes the SQL statements for ``|`` by
combining the clauses of condition which run on the same database
table. This is done via the ``.base_table`` attribute. | fiber/condition/database.py | __or__ | hpi-dhc/fiber | python | def __or__(self, other: _BaseCondition):
'\n The _DatabaseCondition optimizes the SQL statements for ``|`` by\n combining the clauses of condition which run on the same database\n table. This is done via the ``.base_table`` attribute.\n '
if ((self.base_table == other.base_table) and... |
def __repr__(self):
'Shows the running query or the resulting MRNs'
if self._mrns:
return f'{self.__class__.__name__}: {len(self.get_mrns())} mrns'
else:
clause = (compile_sqla(self.clause, self.engine) if fiber.config.VERBOSE else '...')
return f'{self.__class__.__name__} ({clause})... | 8,681,375,925,406,334,000 | Shows the running query or the resulting MRNs | fiber/condition/database.py | __repr__ | hpi-dhc/fiber | python | def __repr__(self):
if self._mrns:
return f'{self.__class__.__name__}: {len(self.get_mrns())} mrns'
else:
clause = (compile_sqla(self.clause, self.engine) if fiber.config.VERBOSE else '...')
return f'{self.__class__.__name__} ({clause})' |
def get_netmask(ip, subnet):
'Returns the netmask appropriate for injection into a guest.'
if (ip['version'] == 4):
return str(subnet.as_netaddr().netmask)
return subnet.as_netaddr()._prefixlen | 3,273,456,509,661,132,000 | Returns the netmask appropriate for injection into a guest. | nova/network/model.py | get_netmask | Alex-Sizov/nova | python | def get_netmask(ip, subnet):
if (ip['version'] == 4):
return str(subnet.as_netaddr().netmask)
return subnet.as_netaddr()._prefixlen |
def get_meta(self, key, default=None):
"calls get(key, default) on self['meta']."
return self['meta'].get(key, default) | 950,897,229,093,025,500 | calls get(key, default) on self['meta']. | nova/network/model.py | get_meta | Alex-Sizov/nova | python | def get_meta(self, key, default=None):
return self['meta'].get(key, default) |
def as_netaddr(self):
'Convenient function to get cidr as a netaddr object.'
return netaddr.IPNetwork(self['cidr']) | -1,883,720,367,734,164,000 | Convenient function to get cidr as a netaddr object. | nova/network/model.py | as_netaddr | Alex-Sizov/nova | python | def as_netaddr(self):
return netaddr.IPNetwork(self['cidr']) |
def labeled_ips(self):
"Returns the list of all IPs\n\n The return value looks like this flat structure::\n\n {'network_label': 'my_network',\n 'network_id': 'n8v29837fn234782f08fjxk3ofhb84',\n 'ips': [{'address': '0.0.0.0',\n 'version': 4,\n ... | 3,862,719,527,362,788,000 | Returns the list of all IPs
The return value looks like this flat structure::
{'network_label': 'my_network',
'network_id': 'n8v29837fn234782f08fjxk3ofhb84',
'ips': [{'address': '0.0.0.0',
'version': 4,
'type: 'fixed',
'meta': {...}},
{'address': '0... | nova/network/model.py | labeled_ips | Alex-Sizov/nova | python | def labeled_ips(self):
"Returns the list of all IPs\n\n The return value looks like this flat structure::\n\n {'network_label': 'my_network',\n 'network_id': 'n8v29837fn234782f08fjxk3ofhb84',\n 'ips': [{'address': '0.0.0.0',\n 'version': 4,\n ... |
def fixed_ips(self):
'Returns all fixed_ips without floating_ips attached.'
return [ip for vif in self for ip in vif.fixed_ips()] | -4,682,522,704,627,597,000 | Returns all fixed_ips without floating_ips attached. | nova/network/model.py | fixed_ips | Alex-Sizov/nova | python | def fixed_ips(self):
return [ip for vif in self for ip in vif.fixed_ips()] |
def floating_ips(self):
'Returns all floating_ips.'
return [ip for vif in self for ip in vif.floating_ips()] | -8,499,458,769,679,128,000 | Returns all floating_ips. | nova/network/model.py | floating_ips | Alex-Sizov/nova | python | def floating_ips(self):
return [ip for vif in self for ip in vif.floating_ips()] |
def wait(self, do_raise=True):
'Wait for asynchronous call to finish.'
pass | 1,854,355,436,926,017,300 | Wait for asynchronous call to finish. | nova/network/model.py | wait | Alex-Sizov/nova | python | def wait(self, do_raise=True):
pass |
def _sync_wrapper(self, wrapped, *args, **kwargs):
'Synchronize the model before running a method.'
self.wait()
return wrapped(*args, **kwargs) | -5,115,433,604,785,415,000 | Synchronize the model before running a method. | nova/network/model.py | _sync_wrapper | Alex-Sizov/nova | python | def _sync_wrapper(self, wrapped, *args, **kwargs):
self.wait()
return wrapped(*args, **kwargs) |
def wait(self, do_raise=True):
'Wait for asynchronous call to finish.'
if (self._gt is not None):
try:
self[:] = self._gt.wait()
except Exception:
if do_raise:
raise
finally:
self._gt = None | 1,603,477,702,000,076,500 | Wait for asynchronous call to finish. | nova/network/model.py | wait | Alex-Sizov/nova | python | def wait(self, do_raise=True):
if (self._gt is not None):
try:
self[:] = self._gt.wait()
except Exception:
if do_raise:
raise
finally:
self._gt = None |
def phrase_extractor(doc_sents):
'\n doc_sents is a list where each element is a list with elements corresponding to individual sentences of a document\n '
Phraser = models.phrases.Phraser
Phrases = models.phrases.Phrases
sentence_stream = sum(doc_sents, [])
common_terms = ['of', 'with', 'with... | 7,986,132,740,859,710,000 | doc_sents is a list where each element is a list with elements corresponding to individual sentences of a document | src/scraping/read_and_parse.py | phrase_extractor | avbatchelor/insight-articles-project | python | def phrase_extractor(doc_sents):
'\n \n '
Phraser = models.phrases.Phraser
Phrases = models.phrases.Phrases
sentence_stream = sum(doc_sents, [])
common_terms = ['of', 'with', 'without', 'and', 'or', 'the', 'a', 'as']
phrases = Phrases(sentence_stream, common_terms=common_terms)
bigram ... |
@property
def height(self):
'\n The effective height of this placeholder shape; its directly-applied\n height if it has one, otherwise the height of its parent layout\n placeholder.\n '
return self._effective_value('height') | 7,468,113,242,768,823,000 | The effective height of this placeholder shape; its directly-applied
height if it has one, otherwise the height of its parent layout
placeholder. | pptx/shapes/placeholder.py | height | Adriyst/python-pptx | python | @property
def height(self):
'\n The effective height of this placeholder shape; its directly-applied\n height if it has one, otherwise the height of its parent layout\n placeholder.\n '
return self._effective_value('height') |
@property
def left(self):
'\n The effective left of this placeholder shape; its directly-applied\n left if it has one, otherwise the left of its parent layout\n placeholder.\n '
return self._effective_value('left') | -6,564,549,180,737,365,000 | The effective left of this placeholder shape; its directly-applied
left if it has one, otherwise the left of its parent layout
placeholder. | pptx/shapes/placeholder.py | left | Adriyst/python-pptx | python | @property
def left(self):
'\n The effective left of this placeholder shape; its directly-applied\n left if it has one, otherwise the left of its parent layout\n placeholder.\n '
return self._effective_value('left') |
@property
def shape_type(self):
'\n Member of :ref:`MsoShapeType` specifying the type of this shape.\n Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.\n Read-only.\n '
return MSO_SHAPE_TYPE.PLACEHOLDER | -2,477,442,499,677,329,000 | Member of :ref:`MsoShapeType` specifying the type of this shape.
Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.
Read-only. | pptx/shapes/placeholder.py | shape_type | Adriyst/python-pptx | python | @property
def shape_type(self):
'\n Member of :ref:`MsoShapeType` specifying the type of this shape.\n Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.\n Read-only.\n '
return MSO_SHAPE_TYPE.PLACEHOLDER |
@property
def top(self):
'\n The effective top of this placeholder shape; its directly-applied\n top if it has one, otherwise the top of its parent layout\n placeholder.\n '
return self._effective_value('top') | -2,393,262,479,391,269,400 | The effective top of this placeholder shape; its directly-applied
top if it has one, otherwise the top of its parent layout
placeholder. | pptx/shapes/placeholder.py | top | Adriyst/python-pptx | python | @property
def top(self):
'\n The effective top of this placeholder shape; its directly-applied\n top if it has one, otherwise the top of its parent layout\n placeholder.\n '
return self._effective_value('top') |
@property
def width(self):
'\n The effective width of this placeholder shape; its directly-applied\n width if it has one, otherwise the width of its parent layout\n placeholder.\n '
return self._effective_value('width') | -1,524,664,289,232,801,500 | The effective width of this placeholder shape; its directly-applied
width if it has one, otherwise the width of its parent layout
placeholder. | pptx/shapes/placeholder.py | width | Adriyst/python-pptx | python | @property
def width(self):
'\n The effective width of this placeholder shape; its directly-applied\n width if it has one, otherwise the width of its parent layout\n placeholder.\n '
return self._effective_value('width') |
@property
def _base_placeholder(self):
'\n Return the layout or master placeholder shape this placeholder\n inherits from. Not to be confused with an instance of\n |BasePlaceholder| (necessarily).\n '
raise NotImplementedError('Must be implemented by all subclasses.') | 3,763,772,925,094,577,000 | Return the layout or master placeholder shape this placeholder
inherits from. Not to be confused with an instance of
|BasePlaceholder| (necessarily). | pptx/shapes/placeholder.py | _base_placeholder | Adriyst/python-pptx | python | @property
def _base_placeholder(self):
'\n Return the layout or master placeholder shape this placeholder\n inherits from. Not to be confused with an instance of\n |BasePlaceholder| (necessarily).\n '
raise NotImplementedError('Must be implemented by all subclasses.') |
def _effective_value(self, attr_name):
'\n The effective value of *attr_name* on this placeholder shape; its\n directly-applied value if it has one, otherwise the value on the\n layout placeholder it inherits from.\n '
directly_applied_value = getattr(super(_InheritsDimensions, self)... | 3,257,120,458,678,706,700 | The effective value of *attr_name* on this placeholder shape; its
directly-applied value if it has one, otherwise the value on the
layout placeholder it inherits from. | pptx/shapes/placeholder.py | _effective_value | Adriyst/python-pptx | python | def _effective_value(self, attr_name):
'\n The effective value of *attr_name* on this placeholder shape; its\n directly-applied value if it has one, otherwise the value on the\n layout placeholder it inherits from.\n '
directly_applied_value = getattr(super(_InheritsDimensions, self)... |
def _inherited_value(self, attr_name):
"\n Return the attribute value, e.g. 'width' of the base placeholder this\n placeholder inherits from.\n "
base_placeholder = self._base_placeholder
if (base_placeholder is None):
return None
inherited_value = getattr(base_placeholder, ... | -3,245,702,123,604,787,700 | Return the attribute value, e.g. 'width' of the base placeholder this
placeholder inherits from. | pptx/shapes/placeholder.py | _inherited_value | Adriyst/python-pptx | python | def _inherited_value(self, attr_name):
"\n Return the attribute value, e.g. 'width' of the base placeholder this\n placeholder inherits from.\n "
base_placeholder = self._base_placeholder
if (base_placeholder is None):
return None
inherited_value = getattr(base_placeholder, ... |
@property
def is_placeholder(self):
'\n Boolean indicating whether this shape is a placeholder.\n Unconditionally |True| in this case.\n '
return True | -5,988,402,684,897,886,000 | Boolean indicating whether this shape is a placeholder.
Unconditionally |True| in this case. | pptx/shapes/placeholder.py | is_placeholder | Adriyst/python-pptx | python | @property
def is_placeholder(self):
'\n Boolean indicating whether this shape is a placeholder.\n Unconditionally |True| in this case.\n '
return True |
@property
def shape_type(self):
'\n Member of :ref:`MsoShapeType` specifying the type of this shape.\n Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.\n Read-only.\n '
return MSO_SHAPE_TYPE.PLACEHOLDER | -2,477,442,499,677,329,000 | Member of :ref:`MsoShapeType` specifying the type of this shape.
Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.
Read-only. | pptx/shapes/placeholder.py | shape_type | Adriyst/python-pptx | python | @property
def shape_type(self):
'\n Member of :ref:`MsoShapeType` specifying the type of this shape.\n Unconditionally ``MSO_SHAPE_TYPE.PLACEHOLDER`` in this case.\n Read-only.\n '
return MSO_SHAPE_TYPE.PLACEHOLDER |
@property
def _base_placeholder(self):
'\n Return the layout placeholder this slide placeholder inherits from.\n Not to be confused with an instance of |BasePlaceholder|\n (necessarily).\n '
(layout, idx) = (self.part.slide_layout, self._element.ph_idx)
return layout.placeholders... | -6,442,858,045,183,785,000 | Return the layout placeholder this slide placeholder inherits from.
Not to be confused with an instance of |BasePlaceholder|
(necessarily). | pptx/shapes/placeholder.py | _base_placeholder | Adriyst/python-pptx | python | @property
def _base_placeholder(self):
'\n Return the layout placeholder this slide placeholder inherits from.\n Not to be confused with an instance of |BasePlaceholder|\n (necessarily).\n '
(layout, idx) = (self.part.slide_layout, self._element.ph_idx)
return layout.placeholders... |
def _replace_placeholder_with(self, element):
"\n Substitute *element* for this placeholder element in the shapetree.\n This placeholder's `._element` attribute is set to |None| and its\n original element is free for garbage collection. Any attribute access\n (including a method call) on... | 119,120,443,463,842,640 | Substitute *element* for this placeholder element in the shapetree.
This placeholder's `._element` attribute is set to |None| and its
original element is free for garbage collection. Any attribute access
(including a method call) on this placeholder after this call raises
|AttributeError|. | pptx/shapes/placeholder.py | _replace_placeholder_with | Adriyst/python-pptx | python | def _replace_placeholder_with(self, element):
"\n Substitute *element* for this placeholder element in the shapetree.\n This placeholder's `._element` attribute is set to |None| and its\n original element is free for garbage collection. Any attribute access\n (including a method call) on... |
@property
def idx(self):
"\n Integer placeholder 'idx' attribute, e.g. 0\n "
return self._sp.ph_idx | -5,393,356,322,313,205,000 | Integer placeholder 'idx' attribute, e.g. 0 | pptx/shapes/placeholder.py | idx | Adriyst/python-pptx | python | @property
def idx(self):
"\n \n "
return self._sp.ph_idx |
@property
def orient(self):
'\n Placeholder orientation, e.g. ST_Direction.HORZ\n '
return self._sp.ph_orient | -7,293,633,352,992,293,000 | Placeholder orientation, e.g. ST_Direction.HORZ | pptx/shapes/placeholder.py | orient | Adriyst/python-pptx | python | @property
def orient(self):
'\n \n '
return self._sp.ph_orient |
@property
def ph_type(self):
'\n Placeholder type, e.g. PP_PLACEHOLDER.CENTER_TITLE\n '
return self._sp.ph_type | 6,022,595,088,119,431,000 | Placeholder type, e.g. PP_PLACEHOLDER.CENTER_TITLE | pptx/shapes/placeholder.py | ph_type | Adriyst/python-pptx | python | @property
def ph_type(self):
'\n \n '
return self._sp.ph_type |
@property
def sz(self):
"\n Placeholder 'sz' attribute, e.g. ST_PlaceholderSize.FULL\n "
return self._sp.ph_sz | 574,434,602,822,876,800 | Placeholder 'sz' attribute, e.g. ST_PlaceholderSize.FULL | pptx/shapes/placeholder.py | sz | Adriyst/python-pptx | python | @property
def sz(self):
"\n \n "
return self._sp.ph_sz |
@property
def _base_placeholder(self):
'\n Return the master placeholder this layout placeholder inherits from.\n '
base_ph_type = {PP_PLACEHOLDER.BODY: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CHART: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.BITMAP: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CENTER_TITLE: PP_PLACE... | -8,909,599,504,009,577,000 | Return the master placeholder this layout placeholder inherits from. | pptx/shapes/placeholder.py | _base_placeholder | Adriyst/python-pptx | python | @property
def _base_placeholder(self):
'\n \n '
base_ph_type = {PP_PLACEHOLDER.BODY: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CHART: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.BITMAP: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CENTER_TITLE: PP_PLACEHOLDER.TITLE, PP_PLACEHOLDER.ORG_CHART: PP_PLACEHOLDER.BODY, PP_PLAC... |
@property
def _base_placeholder(self):
'\n Return the notes master placeholder this notes slide placeholder\n inherits from, or |None| if no placeholder of the matching type is\n present.\n '
notes_master = self.part.notes_master
ph_type = self.element.ph_type
return notes_ma... | -3,631,829,249,761,758,700 | Return the notes master placeholder this notes slide placeholder
inherits from, or |None| if no placeholder of the matching type is
present. | pptx/shapes/placeholder.py | _base_placeholder | Adriyst/python-pptx | python | @property
def _base_placeholder(self):
'\n Return the notes master placeholder this notes slide placeholder\n inherits from, or |None| if no placeholder of the matching type is\n present.\n '
notes_master = self.part.notes_master
ph_type = self.element.ph_type
return notes_ma... |
def insert_chart(self, chart_type, chart_data):
'\n Return a |PlaceholderGraphicFrame| object containing a new chart of\n *chart_type* depicting *chart_data* and having the same position and\n size as this placeholder. *chart_type* is one of the\n :ref:`XlChartType` enumeration values. *... | -5,297,237,133,140,146,000 | Return a |PlaceholderGraphicFrame| object containing a new chart of
*chart_type* depicting *chart_data* and having the same position and
size as this placeholder. *chart_type* is one of the
:ref:`XlChartType` enumeration values. *chart_data* is a |ChartData|
object populated with the categories and series values for th... | pptx/shapes/placeholder.py | insert_chart | Adriyst/python-pptx | python | def insert_chart(self, chart_type, chart_data):
'\n Return a |PlaceholderGraphicFrame| object containing a new chart of\n *chart_type* depicting *chart_data* and having the same position and\n size as this placeholder. *chart_type* is one of the\n :ref:`XlChartType` enumeration values. *... |
def _new_chart_graphicFrame(self, rId, x, y, cx, cy):
'\n Return a newly created `p:graphicFrame` element having the specified\n position and size and containing the chart identified by *rId*.\n '
(id_, name) = (self.shape_id, self.name)
return CT_GraphicalObjectFrame.new_chart_graphicF... | 3,742,909,272,327,434,000 | Return a newly created `p:graphicFrame` element having the specified
position and size and containing the chart identified by *rId*. | pptx/shapes/placeholder.py | _new_chart_graphicFrame | Adriyst/python-pptx | python | def _new_chart_graphicFrame(self, rId, x, y, cx, cy):
'\n Return a newly created `p:graphicFrame` element having the specified\n position and size and containing the chart identified by *rId*.\n '
(id_, name) = (self.shape_id, self.name)
return CT_GraphicalObjectFrame.new_chart_graphicF... |
def insert_picture(self, image_file):
'Return a |PlaceholderPicture| object depicting the image in `image_file`.\n\n `image_file` may be either a path (string) or a file-like object. The image is\n cropped to fill the entire space of the placeholder. A |PlaceholderPicture|\n object has all the ... | -7,307,511,244,919,935,000 | Return a |PlaceholderPicture| object depicting the image in `image_file`.
`image_file` may be either a path (string) or a file-like object. The image is
cropped to fill the entire space of the placeholder. A |PlaceholderPicture|
object has all the properties and methods of a |Picture| shape except that the
value of it... | pptx/shapes/placeholder.py | insert_picture | Adriyst/python-pptx | python | def insert_picture(self, image_file):
'Return a |PlaceholderPicture| object depicting the image in `image_file`.\n\n `image_file` may be either a path (string) or a file-like object. The image is\n cropped to fill the entire space of the placeholder. A |PlaceholderPicture|\n object has all the ... |
def _new_placeholder_pic(self, image_file):
'\n Return a new `p:pic` element depicting the image in *image_file*,\n suitable for use as a placeholder. In particular this means not\n having an `a:xfrm` element, allowing its extents to be inherited from\n its layout placeholder.\n '... | -1,111,839,340,163,950,600 | Return a new `p:pic` element depicting the image in *image_file*,
suitable for use as a placeholder. In particular this means not
having an `a:xfrm` element, allowing its extents to be inherited from
its layout placeholder. | pptx/shapes/placeholder.py | _new_placeholder_pic | Adriyst/python-pptx | python | def _new_placeholder_pic(self, image_file):
'\n Return a new `p:pic` element depicting the image in *image_file*,\n suitable for use as a placeholder. In particular this means not\n having an `a:xfrm` element, allowing its extents to be inherited from\n its layout placeholder.\n '... |
def _get_or_add_image(self, image_file):
'\n Return an (rId, description, image_size) 3-tuple identifying the\n related image part containing *image_file* and describing the image.\n '
(image_part, rId) = self.part.get_or_add_image_part(image_file)
(desc, image_size) = (image_part.desc,... | 1,590,408,181,353,432,800 | Return an (rId, description, image_size) 3-tuple identifying the
related image part containing *image_file* and describing the image. | pptx/shapes/placeholder.py | _get_or_add_image | Adriyst/python-pptx | python | def _get_or_add_image(self, image_file):
'\n Return an (rId, description, image_size) 3-tuple identifying the\n related image part containing *image_file* and describing the image.\n '
(image_part, rId) = self.part.get_or_add_image_part(image_file)
(desc, image_size) = (image_part.desc,... |
@property
def is_placeholder(self):
'\n Boolean indicating whether this shape is a placeholder.\n Unconditionally |True| in this case.\n '
return True | -5,988,402,684,897,886,000 | Boolean indicating whether this shape is a placeholder.
Unconditionally |True| in this case. | pptx/shapes/placeholder.py | is_placeholder | Adriyst/python-pptx | python | @property
def is_placeholder(self):
'\n Boolean indicating whether this shape is a placeholder.\n Unconditionally |True| in this case.\n '
return True |
@property
def _base_placeholder(self):
'\n Return the layout placeholder this picture placeholder inherits from.\n '
(layout, idx) = (self.part.slide_layout, self._element.ph_idx)
return layout.placeholders.get(idx=idx) | -4,162,995,238,305,199,000 | Return the layout placeholder this picture placeholder inherits from. | pptx/shapes/placeholder.py | _base_placeholder | Adriyst/python-pptx | python | @property
def _base_placeholder(self):
'\n \n '
(layout, idx) = (self.part.slide_layout, self._element.ph_idx)
return layout.placeholders.get(idx=idx) |
def insert_table(self, rows, cols):
'Return |PlaceholderGraphicFrame| object containing a `rows` by `cols` table.\n\n The position and width of the table are those of the placeholder and its height\n is proportional to the number of rows. A |PlaceholderGraphicFrame| object has\n all the propert... | -2,900,114,170,172,023,000 | Return |PlaceholderGraphicFrame| object containing a `rows` by `cols` table.
The position and width of the table are those of the placeholder and its height
is proportional to the number of rows. A |PlaceholderGraphicFrame| object has
all the properties and methods of a |GraphicFrame| shape except that the value
of it... | pptx/shapes/placeholder.py | insert_table | Adriyst/python-pptx | python | def insert_table(self, rows, cols):
'Return |PlaceholderGraphicFrame| object containing a `rows` by `cols` table.\n\n The position and width of the table are those of the placeholder and its height\n is proportional to the number of rows. A |PlaceholderGraphicFrame| object has\n all the propert... |
def _new_placeholder_table(self, rows, cols):
"\n Return a newly added `p:graphicFrame` element containing an empty\n table with *rows* rows and *cols* columns, positioned at the location\n of this placeholder and having its same width. The table's height is\n determined by the number of... | -2,623,100,528,436,390,000 | Return a newly added `p:graphicFrame` element containing an empty
table with *rows* rows and *cols* columns, positioned at the location
of this placeholder and having its same width. The table's height is
determined by the number of rows. | pptx/shapes/placeholder.py | _new_placeholder_table | Adriyst/python-pptx | python | def _new_placeholder_table(self, rows, cols):
"\n Return a newly added `p:graphicFrame` element containing an empty\n table with *rows* rows and *cols* columns, positioned at the location\n of this placeholder and having its same width. The table's height is\n determined by the number of... |
def get_asymmetry(arr):
'\n Returns asymmetry of an array.\n \n Parameters\n ----------\n arr : ndarray\n an array to find asymmetry\n\n Returns\n -------\n ndarray\n an array capturing asymmetry of original array\n '
arr_rev = arr[::(- 1), ::(- 1), ::(- 1)]
denom = ... | 4,152,776,174,522,038,300 | Returns asymmetry of an array.
Parameters
----------
arr : ndarray
an array to find asymmetry
Returns
-------
ndarray
an array capturing asymmetry of original array | scripts/alien_tools.py | get_asymmetry | AdvancedPhotonSource/cdisupp | python | def get_asymmetry(arr):
'\n Returns asymmetry of an array.\n \n Parameters\n ----------\n arr : ndarray\n an array to find asymmetry\n\n Returns\n -------\n ndarray\n an array capturing asymmetry of original array\n '
arr_rev = arr[::(- 1), ::(- 1), ::(- 1)]
denom = ... |
def analyze_clusters(arr, labels, nz):
'\n Analyzes clusters and returns characteristics in arrays.\n \n Parameters\n ----------\n arr : ndarray\n the analyzed array\n labels: arr\n cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.\n ... | -8,017,559,099,873,137,000 | Analyzes clusters and returns characteristics in arrays.
Parameters
----------
arr : ndarray
the analyzed array
labels: arr
cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.
nz : tuple
tuple of arrays, each array containing indices of elements in arr that ar... | scripts/alien_tools.py | analyze_clusters | AdvancedPhotonSource/cdisupp | python | def analyze_clusters(arr, labels, nz):
'\n Analyzes clusters and returns characteristics in arrays.\n \n Parameters\n ----------\n arr : ndarray\n the analyzed array\n labels: arr\n cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.\n ... |
def crop_center(arr):
'\n Finds max element in array and crops the array to be symetrical with regard to this point in each direction.\n \n Parameters\n ----------\n arr : ndarray\n an array\n\n Returns\n -------\n centered : ndarray\n an array symetrical in all dimensions arou... | -1,185,450,012,814,468,600 | Finds max element in array and crops the array to be symetrical with regard to this point in each direction.
Parameters
----------
arr : ndarray
an array
Returns
-------
centered : ndarray
an array symetrical in all dimensions around the max element of input array | scripts/alien_tools.py | crop_center | AdvancedPhotonSource/cdisupp | python | def crop_center(arr):
'\n Finds max element in array and crops the array to be symetrical with regard to this point in each direction.\n \n Parameters\n ----------\n arr : ndarray\n an array\n\n Returns\n -------\n centered : ndarray\n an array symetrical in all dimensions arou... |
def save_arr(arr, dir, fname):
"\n Saves an array in 'tif' format file.\n \n Parameters\n ----------\n arr : ndarray\n an array to save\n dir : str\n directory to save the file to\n fname : str\n file name\n\n Returns\n -------\n nothing\n "
if (dir is not N... | 6,513,454,682,440,310,000 | Saves an array in 'tif' format file.
Parameters
----------
arr : ndarray
an array to save
dir : str
directory to save the file to
fname : str
file name
Returns
-------
nothing | scripts/alien_tools.py | save_arr | AdvancedPhotonSource/cdisupp | python | def save_arr(arr, dir, fname):
"\n Saves an array in 'tif' format file.\n \n Parameters\n ----------\n arr : ndarray\n an array to save\n dir : str\n directory to save the file to\n fname : str\n file name\n\n Returns\n -------\n nothing\n "
if (dir is not N... |
def save_arrays(arrs, iter, thresh, eps, dir):
"\n Saves multiple arrays in 'tif' format files. Determines file name from given parameters: iteration, threshold, and eps.\n \n Parameters\n ----------\n arr : tuple\n a tuple of arrays to save\n iter, thresh, eps : str, str, str\n para... | 7,043,521,248,600,779,000 | Saves multiple arrays in 'tif' format files. Determines file name from given parameters: iteration, threshold, and eps.
Parameters
----------
arr : tuple
a tuple of arrays to save
iter, thresh, eps : str, str, str
parameters: iteration, threshold, and eps, to deliver file name from
dir : str
directory to s... | scripts/alien_tools.py | save_arrays | AdvancedPhotonSource/cdisupp | python | def save_arrays(arrs, iter, thresh, eps, dir):
"\n Saves multiple arrays in 'tif' format files. Determines file name from given parameters: iteration, threshold, and eps.\n \n Parameters\n ----------\n arr : tuple\n a tuple of arrays to save\n iter, thresh, eps : str, str, str\n para... |
def auto_alien1(data, config, data_dir=None):
"\n Removes aliens from experimental CDI data using iterative algorithm and returns the result.\n \n The algorithm follows the steps:\n 1. Initialization:\n - initialize variables with the configuration parameters\n - crop the data array around maximum... | 1,125,620,878,779,161,500 | Removes aliens from experimental CDI data using iterative algorithm and returns the result.
The algorithm follows the steps:
1. Initialization:
- initialize variables with the configuration parameters
- crop the data array around maximum element to it's biggest size
- sets points below threshold value to 0
- finds non... | scripts/alien_tools.py | auto_alien1 | AdvancedPhotonSource/cdisupp | python | def auto_alien1(data, config, data_dir=None):
"\n Removes aliens from experimental CDI data using iterative algorithm and returns the result.\n \n The algorithm follows the steps:\n 1. Initialization:\n - initialize variables with the configuration parameters\n - crop the data array around maximum... |
def remove_blocks(data, config_map):
'\n Sets to zero given alien blocks in the data array.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to configuration parameters\n\n Returns\n -------\... | -1,441,866,952,189,308,200 | Sets to zero given alien blocks in the data array.
Parameters
----------
data : ndarray
an array with experiment data
config : Object
configuration object providing access to configuration parameters
Returns
-------
data : ndarray
data array with zeroed out aliens | scripts/alien_tools.py | remove_blocks | AdvancedPhotonSource/cdisupp | python | def remove_blocks(data, config_map):
'\n Sets to zero given alien blocks in the data array.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to configuration parameters\n\n Returns\n -------\... |
def filter_aliens(data, config_map):
'\n Sets to zero points in the data array defined by a file.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to configuration parameters\n\n Returns\n --... | 8,194,168,656,737,036,000 | Sets to zero points in the data array defined by a file.
Parameters
----------
data : ndarray
an array with experiment data
config : Object
configuration object providing access to configuration parameters
Returns
-------
data : ndarray
data array with zeroed out aliens | scripts/alien_tools.py | filter_aliens | AdvancedPhotonSource/cdisupp | python | def filter_aliens(data, config_map):
'\n Sets to zero points in the data array defined by a file.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to configuration parameters\n\n Returns\n --... |
def remove_aliens(data, config_map, data_dir=None):
"\n Finds which algorithm is cofigured to remove the aliens and applies it to clean the data.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to... | 6,373,080,184,290,245,000 | Finds which algorithm is cofigured to remove the aliens and applies it to clean the data.
Parameters
----------
data : ndarray
an array with experiment data
config : Object
configuration object providing access to configuration parameters
data_dir : str
a directory where 'alien_analysis' subdirectory will ... | scripts/alien_tools.py | remove_aliens | AdvancedPhotonSource/cdisupp | python | def remove_aliens(data, config_map, data_dir=None):
"\n Finds which algorithm is cofigured to remove the aliens and applies it to clean the data.\n \n Parameters\n ----------\n data : ndarray\n an array with experiment data\n config : Object\n configuration object providing access to... |
def print_current_status(status):
'\n Prints the current status\n :param status:\n :return:\n '
print(status)
for i in range((str(status).count('\n') + 1)):
sys.stdout.write('\x1b[F') | 4,987,133,255,887,730,000 | Prints the current status
:param status:
:return: | nodes/gnss_status_viewer_node.py | print_current_status | naoki-mizuno/gnss_status_viewer | python | def print_current_status(status):
'\n Prints the current status\n :param status:\n :return:\n '
print(status)
for i in range((str(status).count('\n') + 1)):
sys.stdout.write('\x1b[F') |
def ensemble_negative_log_likelihood(labels, logits):
"Negative log-likelihood for ensemble.\n\n For each datapoint (x,y), the ensemble's negative log-likelihood is:\n\n ```\n -log p(y|x) = -log sum_{m=1}^{ensemble_size} exp(log p(y|x,theta_m)) +\n log ensemble_size.\n ```\n\n Args:\n labels:... | 4,068,252,308,176,723,500 | Negative log-likelihood for ensemble.
For each datapoint (x,y), the ensemble's negative log-likelihood is:
```
-log p(y|x) = -log sum_{m=1}^{ensemble_size} exp(log p(y|x,theta_m)) +
log ensemble_size.
```
Args:
labels: tf.Tensor of shape [...].
logits: tf.Tensor of shape [ensemble_size, ..., num_cl... | baselines/imagenet/ensemble.py | ensemble_negative_log_likelihood | mhavasi/edward2 | python | def ensemble_negative_log_likelihood(labels, logits):
"Negative log-likelihood for ensemble.\n\n For each datapoint (x,y), the ensemble's negative log-likelihood is:\n\n ```\n -log p(y|x) = -log sum_{m=1}^{ensemble_size} exp(log p(y|x,theta_m)) +\n log ensemble_size.\n ```\n\n Args:\n labels:... |
def gibbs_cross_entropy(labels, logits):
"Average cross entropy for ensemble members (Gibbs cross entropy).\n\n For each datapoint (x,y), the ensemble's Gibbs cross entropy is:\n\n ```\n GCE = - (1/ensemble_size) sum_{m=1}^ensemble_size log p(y|x,theta_m).\n ```\n\n The Gibbs cross entropy approximates the ave... | 5,129,305,994,803,191,000 | Average cross entropy for ensemble members (Gibbs cross entropy).
For each datapoint (x,y), the ensemble's Gibbs cross entropy is:
```
GCE = - (1/ensemble_size) sum_{m=1}^ensemble_size log p(y|x,theta_m).
```
The Gibbs cross entropy approximates the average cross entropy of a single
model drawn from the (Gibbs) ense... | baselines/imagenet/ensemble.py | gibbs_cross_entropy | mhavasi/edward2 | python | def gibbs_cross_entropy(labels, logits):
"Average cross entropy for ensemble members (Gibbs cross entropy).\n\n For each datapoint (x,y), the ensemble's Gibbs cross entropy is:\n\n ```\n GCE = - (1/ensemble_size) sum_{m=1}^ensemble_size log p(y|x,theta_m).\n ```\n\n The Gibbs cross entropy approximates the ave... |
@pytest.fixture(scope='session')
def app(app_settings):
' WSGI application level functional testing. '
return main({}, **app_settings) | -9,000,578,610,465,128,000 | WSGI application level functional testing. | src/encoded/tests/conftest.py | app | dbmi-bgm/cgap-portal | python | @pytest.fixture(scope='session')
def app(app_settings):
' '
return main({}, **app_settings) |
@pytest.fixture(scope='session')
def es_app(es_app_settings, **kwargs):
'\n App that uses both Postgres and ES - pass this as "app" argument to TestApp.\n Pass all kwargs onto create_mapping\n '
app = main({}, **es_app_settings)
create_mapping.run(app, **kwargs)
return app | -7,586,295,019,175,009,000 | App that uses both Postgres and ES - pass this as "app" argument to TestApp.
Pass all kwargs onto create_mapping | src/encoded/tests/conftest.py | es_app | dbmi-bgm/cgap-portal | python | @pytest.fixture(scope='session')
def es_app(es_app_settings, **kwargs):
'\n App that uses both Postgres and ES - pass this as "app" argument to TestApp.\n Pass all kwargs onto create_mapping\n '
app = main({}, **es_app_settings)
create_mapping.run(app, **kwargs)
return app |
@pytest.fixture
def anontestapp(app):
'TestApp for anonymous user (i.e., no user specified), accepting JSON data.'
environ = {'HTTP_ACCEPT': 'application/json'}
return webtest.TestApp(app, environ) | 7,349,053,589,448,217,000 | TestApp for anonymous user (i.e., no user specified), accepting JSON data. | src/encoded/tests/conftest.py | anontestapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def anontestapp(app):
environ = {'HTTP_ACCEPT': 'application/json'}
return webtest.TestApp(app, environ) |
@pytest.fixture
def anonhtmltestapp(app):
'TestApp for anonymous (not logged in) user, accepting text/html content.'
environ = {'HTTP_ACCEPT': 'text/html'}
test_app = webtest.TestApp(app, environ)
return test_app | 8,208,020,015,496,335,000 | TestApp for anonymous (not logged in) user, accepting text/html content. | src/encoded/tests/conftest.py | anonhtmltestapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def anonhtmltestapp(app):
environ = {'HTTP_ACCEPT': 'text/html'}
test_app = webtest.TestApp(app, environ)
return test_app |
@pytest.fixture
def anon_es_testapp(es_app):
' TestApp simulating a bare Request entering the application (with ES enabled) '
environ = {'HTTP_ACCEPT': 'application/json'}
return webtest.TestApp(es_app, environ) | -720,368,871,870,829,800 | TestApp simulating a bare Request entering the application (with ES enabled) | src/encoded/tests/conftest.py | anon_es_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def anon_es_testapp(es_app):
' '
environ = {'HTTP_ACCEPT': 'application/json'}
return webtest.TestApp(es_app, environ) |
@pytest.fixture
def anon_html_es_testapp(es_app):
'TestApp with ES + Postgres for anonymous (not logged in) user, accepting text/html content.'
environ = {'HTTP_ACCEPT': 'text/html'}
return webtest.TestApp(es_app, environ) | -607,309,052,424,212,100 | TestApp with ES + Postgres for anonymous (not logged in) user, accepting text/html content. | src/encoded/tests/conftest.py | anon_html_es_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def anon_html_es_testapp(es_app):
environ = {'HTTP_ACCEPT': 'text/html'}
return webtest.TestApp(es_app, environ) |
@pytest.fixture(scope='session')
def testapp(app):
'TestApp for username TEST, accepting JSON data.'
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(app, environ) | -9,211,947,515,465,539,000 | TestApp for username TEST, accepting JSON data. | src/encoded/tests/conftest.py | testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture(scope='session')
def testapp(app):
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(app, environ) |
@pytest.fixture
def htmltestapp(app):
'TestApp for TEST user, accepting text/html content.'
environ = {'HTTP_ACCEPT': 'text/html', 'REMOTE_USER': 'TEST'}
test_app = webtest.TestApp(app, environ)
return test_app | 6,502,149,716,404,919,000 | TestApp for TEST user, accepting text/html content. | src/encoded/tests/conftest.py | htmltestapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def htmltestapp(app):
environ = {'HTTP_ACCEPT': 'text/html', 'REMOTE_USER': 'TEST'}
test_app = webtest.TestApp(app, environ)
return test_app |
@pytest.fixture(scope='session')
def es_testapp(es_app):
' TestApp with ES + Postgres. Must be imported where it is needed. '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(es_app, environ) | -4,503,890,784,941,239,000 | TestApp with ES + Postgres. Must be imported where it is needed. | src/encoded/tests/conftest.py | es_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture(scope='session')
def es_testapp(es_app):
' '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(es_app, environ) |
@pytest.fixture
def html_es_testapp(es_app):
'TestApp with ES + Postgres for TEST user, accepting text/html content.'
environ = {'HTTP_ACCEPT': 'text/html', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(es_app, environ) | -6,523,108,449,352,916,000 | TestApp with ES + Postgres for TEST user, accepting text/html content. | src/encoded/tests/conftest.py | html_es_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def html_es_testapp(es_app):
environ = {'HTTP_ACCEPT': 'text/html', 'REMOTE_USER': 'TEST'}
return webtest.TestApp(es_app, environ) |
@pytest.fixture
def authenticated_testapp(app):
'TestApp for an authenticated, non-admin user (TEST_AUTHENTICATED), accepting JSON data.'
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_AUTHENTICATED'}
return webtest.TestApp(app, environ) | 3,389,445,688,238,822,000 | TestApp for an authenticated, non-admin user (TEST_AUTHENTICATED), accepting JSON data. | src/encoded/tests/conftest.py | authenticated_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def authenticated_testapp(app):
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_AUTHENTICATED'}
return webtest.TestApp(app, environ) |
@pytest.fixture
def authenticated_es_testapp(es_app):
' TestApp for authenticated non-admin user with ES '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_AUTHENTICATED'}
return webtest.TestApp(es_app, environ) | 2,806,828,281,893,692,000 | TestApp for authenticated non-admin user with ES | src/encoded/tests/conftest.py | authenticated_es_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def authenticated_es_testapp(es_app):
' '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_AUTHENTICATED'}
return webtest.TestApp(es_app, environ) |
@pytest.fixture
def submitter_testapp(app):
'TestApp for a non-admin user (TEST_SUBMITTER), accepting JSON data.'
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_SUBMITTER'}
return webtest.TestApp(app, environ) | 3,713,334,603,033,996,300 | TestApp for a non-admin user (TEST_SUBMITTER), accepting JSON data. | src/encoded/tests/conftest.py | submitter_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def submitter_testapp(app):
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'TEST_SUBMITTER'}
return webtest.TestApp(app, environ) |
@pytest.fixture
def indexer_testapp(es_app):
' Indexer testapp, meant for manually triggering indexing runs by posting to /index.\n Always uses the ES app (obviously, but not so obvious previously) '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'INDEXER'}
return webtest.TestApp(es_app... | -5,551,315,579,333,300,000 | Indexer testapp, meant for manually triggering indexing runs by posting to /index.
Always uses the ES app (obviously, but not so obvious previously) | src/encoded/tests/conftest.py | indexer_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def indexer_testapp(es_app):
' Indexer testapp, meant for manually triggering indexing runs by posting to /index.\n Always uses the ES app (obviously, but not so obvious previously) '
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'INDEXER'}
return webtest.TestApp(es_app... |
@pytest.fixture
def embed_testapp(app):
'TestApp for user EMBED, accepting JSON data.'
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'EMBED'}
return webtest.TestApp(app, environ) | 4,015,416,991,047,454,000 | TestApp for user EMBED, accepting JSON data. | src/encoded/tests/conftest.py | embed_testapp | dbmi-bgm/cgap-portal | python | @pytest.fixture
def embed_testapp(app):
environ = {'HTTP_ACCEPT': 'application/json', 'REMOTE_USER': 'EMBED'}
return webtest.TestApp(app, environ) |
@pytest.fixture
def wsgi_app(wsgi_server):
'TestApp for WSGI server.'
return webtest.TestApp(wsgi_server) | -7,219,069,910,056,173,000 | TestApp for WSGI server. | src/encoded/tests/conftest.py | wsgi_app | dbmi-bgm/cgap-portal | python | @pytest.fixture
def wsgi_app(wsgi_server):
return webtest.TestApp(wsgi_server) |
@pytest.fixture(scope='session')
def workbook(es_app):
" Loads a bunch of data (tests/data/workbook-inserts) into the system on first run\n (session scope doesn't work). "
WorkbookCache.initialize_if_needed(es_app) | -6,721,380,994,656,458,000 | Loads a bunch of data (tests/data/workbook-inserts) into the system on first run
(session scope doesn't work). | src/encoded/tests/conftest.py | workbook | dbmi-bgm/cgap-portal | python | @pytest.fixture(scope='session')
def workbook(es_app):
" Loads a bunch of data (tests/data/workbook-inserts) into the system on first run\n (session scope doesn't work). "
WorkbookCache.initialize_if_needed(es_app) |
@distributed_trace
def get_method_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... | -2,154,966,697,742,777,000 | Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError | test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py | get_method_local_valid | Azure/autorest.python | python | @distributed_trace
def get_method_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... |
@distributed_trace
def get_method_local_null(self, api_version=None, **kwargs):
'Get method with api-version modeled in the method. pass in api-version = null to succeed.\n\n :param api_version: This should appear as a method parameter, use value null, this should\n result in no serialized parameter... | -1,328,737,055,622,945,000 | Get method with api-version modeled in the method. pass in api-version = null to succeed.
:param api_version: This should appear as a method parameter, use value null, this should
result in no serialized parameter.
:type api_version: str
:keyword callable cls: A custom type or function that will be passed the direct... | test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py | get_method_local_null | Azure/autorest.python | python | @distributed_trace
def get_method_local_null(self, api_version=None, **kwargs):
'Get method with api-version modeled in the method. pass in api-version = null to succeed.\n\n :param api_version: This should appear as a method parameter, use value null, this should\n result in no serialized parameter... |
@distributed_trace
def get_path_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... | -1,937,686,304,681,717,200 | Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError | test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py | get_path_local_valid | Azure/autorest.python | python | @distributed_trace
def get_path_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... |
@distributed_trace
def get_swagger_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... | 889,666,015,888,593,800 | Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError | test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py | get_swagger_local_valid | Azure/autorest.python | python | @distributed_trace
def get_swagger_local_valid(self, **kwargs):
"Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed.\n\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: None, or the result of cls(response)\n ... |
@app.template_filter()
def friendly_time(dt, past_='ago', future_='from now', default='just now'):
'\n Returns string representing "time since"\n or "time until" e.g.\n 3 days ago, 5 hours from now etc.\n '
if (dt is None):
return ''
if isinstance(dt, basestring):
dt = iso8601.pa... | 5,157,354,521,017,599,000 | Returns string representing "time since"
or "time until" e.g.
3 days ago, 5 hours from now etc. | app.py | friendly_time | codeforamerica/srtracker | python | @app.template_filter()
def friendly_time(dt, past_='ago', future_='from now', default='just now'):
'\n Returns string representing "time since"\n or "time until" e.g.\n 3 days ago, 5 hours from now etc.\n '
if (dt is None):
return
if isinstance(dt, basestring):
dt = iso8601.pars... |
@app.template_filter()
def title_address(address):
'Slightly improved title() method for address strings\n Makes sure state abbreviations are upper-case.'
titled = address.title()
titled = state_pattern.sub((lambda match: (match.group(1).upper() + (match.group(2) or ''))), titled)
return titled | 5,237,181,232,790,722,000 | Slightly improved title() method for address strings
Makes sure state abbreviations are upper-case. | app.py | title_address | codeforamerica/srtracker | python | @app.template_filter()
def title_address(address):
'Slightly improved title() method for address strings\n Makes sure state abbreviations are upper-case.'
titled = address.title()
titled = state_pattern.sub((lambda match: (match.group(1).upper() + (match.group(2) or ))), titled)
return titled |
def render_app_template(template, **kwargs):
'Add some goodies to all templates.'
if ('config' not in kwargs):
kwargs['config'] = app.config
if ('__version__' not in kwargs):
kwargs['__version__'] = __version__
return render_template(template, **kwargs) | 7,080,468,876,659,081,000 | Add some goodies to all templates. | app.py | render_app_template | codeforamerica/srtracker | python | def render_app_template(template, **kwargs):
if ('config' not in kwargs):
kwargs['config'] = app.config
if ('__version__' not in kwargs):
kwargs['__version__'] = __version__
return render_template(template, **kwargs) |
def fixup_sr(sr, request_id=None):
"\n Fix up an SR to try and ensure some basic info.\n (In Chicago's API, any field can be missing, even if it's required.)\n "
remove_blacklisted_fields(sr)
if ('service_request_id' not in sr):
sr['service_request_id'] = (request_id or sr.get('token', 'UNK... | -3,728,430,768,534,553,000 | Fix up an SR to try and ensure some basic info.
(In Chicago's API, any field can be missing, even if it's required.) | app.py | fixup_sr | codeforamerica/srtracker | python | def fixup_sr(sr, request_id=None):
"\n Fix up an SR to try and ensure some basic info.\n (In Chicago's API, any field can be missing, even if it's required.)\n "
remove_blacklisted_fields(sr)
if ('service_request_id' not in sr):
sr['service_request_id'] = (request_id or sr.get('token', 'UNK... |
def _css_select(soup, css_selector):
' Returns the content of the element pointed by the CSS selector,\n or an empty string if not found '
selection = soup.select(css_selector)
if (len(selection) > 0):
if hasattr(selection[0], 'text'):
retour = selection[0].text.strip()
el... | 6,685,540,123,375,371,000 | Returns the content of the element pointed by the CSS selector,
or an empty string if not found | precisionmapper/__init__.py | _css_select | tducret/precisionmapper-python | python | def _css_select(soup, css_selector):
' Returns the content of the element pointed by the CSS selector,\n or an empty string if not found '
selection = soup.select(css_selector)
if (len(selection) > 0):
if hasattr(selection[0], 'text'):
retour = selection[0].text.strip()
el... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.