body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
68b56bd9accbaa4e6cc9295847a10fe358973e8d59da8875a072a25825bf3475 | @useraction
def CopyFromColumn(self, table_id, src_col_id, dst_col_id, widgetOptions):
"\n CopyFromColumn involves a ModifyColumn docaction which changes the destination column's schema,\n and a BulkUpdateRecord docaction which replaces the destination col's data with the source data.\n If not None, widget... | CopyFromColumn involves a ModifyColumn docaction which changes the destination column's schema,
and a BulkUpdateRecord docaction which replaces the destination col's data with the source data.
If not None, widgetOptions may contain a JSON-string of widgetOptions to use instead of the
source column's. | sandbox/grist/useractions.py | CopyFromColumn | gristlabs/grist-core | 2,667 | python | @useraction
def CopyFromColumn(self, table_id, src_col_id, dst_col_id, widgetOptions):
"\n CopyFromColumn involves a ModifyColumn docaction which changes the destination column's schema,\n and a BulkUpdateRecord docaction which replaces the destination col's data with the source data.\n If not None, widget... | @useraction
def CopyFromColumn(self, table_id, src_col_id, dst_col_id, widgetOptions):
"\n CopyFromColumn involves a ModifyColumn docaction which changes the destination column's schema,\n and a BulkUpdateRecord docaction which replaces the destination col's data with the source data.\n If not None, widget... |
95804cc2802e4cefce4efc60fc17d8ff55edb6b7587ccaab18d5dabc87fe93ec | def maybe_copy_display_formula(self, src_col, dst_col):
'\n If src_col has a displayCol set, create an equivalent one for dst_col.\n '
if src_col.displayCol:
self.SetDisplayFormula(dst_col.parentId.tableId, None, dst_col.id, re.sub(('\\$%s\\b' % src_col.colId), ('$' + dst_col.colId), src_col.displ... | If src_col has a displayCol set, create an equivalent one for dst_col. | sandbox/grist/useractions.py | maybe_copy_display_formula | gristlabs/grist-core | 2,667 | python | def maybe_copy_display_formula(self, src_col, dst_col):
'\n \n '
if src_col.displayCol:
self.SetDisplayFormula(dst_col.parentId.tableId, None, dst_col.id, re.sub(('\\$%s\\b' % src_col.colId), ('$' + dst_col.colId), src_col.displayCol.formula)) | def maybe_copy_display_formula(self, src_col, dst_col):
'\n \n '
if src_col.displayCol:
self.SetDisplayFormula(dst_col.parentId.tableId, None, dst_col.id, re.sub(('\\$%s\\b' % src_col.colId), ('$' + dst_col.colId), src_col.displayCol.formula))<|docstring|>If src_col has a displayCol set, create an... |
6c440df88a4d471b2b9c9092e315dde3e1c8105b03ae1c6f072afc85bd4ce139 | @useraction
def RenameChoices(self, table_id, col_id, renames):
"\n Updates the data in a Choice/ChoiceList column to reflect the new choice names.\n `renames` should be a dict of {old_choice_name: new_choice_name}.\n This doesn't touch the choices configuration in widgetOptions, that must be done separate... | Updates the data in a Choice/ChoiceList column to reflect the new choice names.
`renames` should be a dict of {old_choice_name: new_choice_name}.
This doesn't touch the choices configuration in widgetOptions, that must be done separately. | sandbox/grist/useractions.py | RenameChoices | gristlabs/grist-core | 2,667 | python | @useraction
def RenameChoices(self, table_id, col_id, renames):
"\n Updates the data in a Choice/ChoiceList column to reflect the new choice names.\n `renames` should be a dict of {old_choice_name: new_choice_name}.\n This doesn't touch the choices configuration in widgetOptions, that must be done separate... | @useraction
def RenameChoices(self, table_id, col_id, renames):
"\n Updates the data in a Choice/ChoiceList column to reflect the new choice names.\n `renames` should be a dict of {old_choice_name: new_choice_name}.\n This doesn't touch the choices configuration in widgetOptions, that must be done separate... |
db8e83a3e185b8fc7917654b911ec6f6fb09254882fa66dbce9656a9b44aea43 | @useraction
def AddEmptyTable(self):
'\n Adds an empty table. Currently it makes up the next available table name, and adds three\n default columns, also picking default names for them (presumably, A, B, and C).\n '
return self.AddTable(None, [{'id': None, 'isFormula': True} for x in xrange(3)]) | Adds an empty table. Currently it makes up the next available table name, and adds three
default columns, also picking default names for them (presumably, A, B, and C). | sandbox/grist/useractions.py | AddEmptyTable | gristlabs/grist-core | 2,667 | python | @useraction
def AddEmptyTable(self):
'\n Adds an empty table. Currently it makes up the next available table name, and adds three\n default columns, also picking default names for them (presumably, A, B, and C).\n '
return self.AddTable(None, [{'id': None, 'isFormula': True} for x in xrange(3)]) | @useraction
def AddEmptyTable(self):
'\n Adds an empty table. Currently it makes up the next available table name, and adds three\n default columns, also picking default names for them (presumably, A, B, and C).\n '
return self.AddTable(None, [{'id': None, 'isFormula': True} for x in xrange(3)])<|docst... |
d414f909e1144ac529b8e22b1c3b249b5d2e2c5c1985d74211ffcf889fb30356 | def doAddTable(self, table_id, columns, summarySourceTableRef=0):
'\n Add the given table with columns without creating views.\n '
table_id = identifiers.pick_table_ident(table_id, avoid=six.viewkeys(self._engine.tables))
col_ids = [c['id'] for c in columns]
col_ids = identifiers.pick_col_ident_li... | Add the given table with columns without creating views. | sandbox/grist/useractions.py | doAddTable | gristlabs/grist-core | 2,667 | python | def doAddTable(self, table_id, columns, summarySourceTableRef=0):
'\n \n '
table_id = identifiers.pick_table_ident(table_id, avoid=six.viewkeys(self._engine.tables))
col_ids = [c['id'] for c in columns]
col_ids = identifiers.pick_col_ident_list(col_ids, avoid={'id'})
clean_colinfo = [_make_cle... | def doAddTable(self, table_id, columns, summarySourceTableRef=0):
'\n \n '
table_id = identifiers.pick_table_ident(table_id, avoid=six.viewkeys(self._engine.tables))
col_ids = [c['id'] for c in columns]
col_ids = identifiers.pick_col_ident_list(col_ids, avoid={'id'})
clean_colinfo = [_make_cle... |
ef4b6127125069ee5eed5769052e39f99ec564cf0aa43ffeb8a7d444ee5982f9 | def _fetch_table_col_recs(self, table_ref, col_refs):
'Helper that converts col_refs from table table_ref into column Records.'
try:
cols = [self._docmodel.columns.table.get_record(c) for c in col_refs]
except KeyError:
raise ValueError('Invalid column requested')
if (not all(((c.parentI... | Helper that converts col_refs from table table_ref into column Records. | sandbox/grist/useractions.py | _fetch_table_col_recs | gristlabs/grist-core | 2,667 | python | def _fetch_table_col_recs(self, table_ref, col_refs):
try:
cols = [self._docmodel.columns.table.get_record(c) for c in col_refs]
except KeyError:
raise ValueError('Invalid column requested')
if (not all(((c.parentId.id == table_ref) for c in cols))):
raise ValueError('Invalid co... | def _fetch_table_col_recs(self, table_ref, col_refs):
try:
cols = [self._docmodel.columns.table.get_record(c) for c in col_refs]
except KeyError:
raise ValueError('Invalid column requested')
if (not all(((c.parentId.id == table_ref) for c in cols))):
raise ValueError('Invalid co... |
fe26e26605f4efef650cb04f0a82b88fd5a7aa7cd93adde00290c9c98347a16e | @useraction
def CreateViewSection(self, table_ref, view_ref, section_type, groupby_colrefs):
'\n Create a new view section. If table_ref is 0, also creates a new empty table. If view_ref is\n 0, also creates a new view that will contain the new section. If groupby_colrefs is None,\n creates a plain section... | Create a new view section. If table_ref is 0, also creates a new empty table. If view_ref is
0, also creates a new view that will contain the new section. If groupby_colrefs is None,
creates a plain section; else creates a summary section grouped by those columns. | sandbox/grist/useractions.py | CreateViewSection | gristlabs/grist-core | 2,667 | python | @useraction
def CreateViewSection(self, table_ref, view_ref, section_type, groupby_colrefs):
'\n Create a new view section. If table_ref is 0, also creates a new empty table. If view_ref is\n 0, also creates a new view that will contain the new section. If groupby_colrefs is None,\n creates a plain section... | @useraction
def CreateViewSection(self, table_ref, view_ref, section_type, groupby_colrefs):
'\n Create a new view section. If table_ref is 0, also creates a new empty table. If view_ref is\n 0, also creates a new view that will contain the new section. If groupby_colrefs is None,\n creates a plain section... |
e59752df3fa1ad645c1a5cfa822e83aae773edc42695944c08be5ae49e0343f1 | @useraction
def UpdateSummaryViewSection(self, section_ref, groupby_colrefs):
'\n Update a summary section to be grouped by a different set of columns. This will update fields\n of the view section, setting their colRefs to similar columns in a different summary table.\n '
section = self._docmodel.view... | Update a summary section to be grouped by a different set of columns. This will update fields
of the view section, setting their colRefs to similar columns in a different summary table. | sandbox/grist/useractions.py | UpdateSummaryViewSection | gristlabs/grist-core | 2,667 | python | @useraction
def UpdateSummaryViewSection(self, section_ref, groupby_colrefs):
'\n Update a summary section to be grouped by a different set of columns. This will update fields\n of the view section, setting their colRefs to similar columns in a different summary table.\n '
section = self._docmodel.view... | @useraction
def UpdateSummaryViewSection(self, section_ref, groupby_colrefs):
'\n Update a summary section to be grouped by a different set of columns. This will update fields\n of the view section, setting their colRefs to similar columns in a different summary table.\n '
section = self._docmodel.view... |
716f60bb7e91c0a279f86d2cd1a6b55fc42f121edbd951ae55d909a96799c10e | @useraction
def DetachSummaryViewSection(self, section_ref):
'\n Create a real table equivalent to the given summary section, and update the section to show\n the new table instead of the summary.\n '
section = self._docmodel.view_sections.table.get_record(section_ref)
if (not section.tableRef.summ... | Create a real table equivalent to the given summary section, and update the section to show
the new table instead of the summary. | sandbox/grist/useractions.py | DetachSummaryViewSection | gristlabs/grist-core | 2,667 | python | @useraction
def DetachSummaryViewSection(self, section_ref):
'\n Create a real table equivalent to the given summary section, and update the section to show\n the new table instead of the summary.\n '
section = self._docmodel.view_sections.table.get_record(section_ref)
if (not section.tableRef.summ... | @useraction
def DetachSummaryViewSection(self, section_ref):
'\n Create a real table equivalent to the given summary section, and update the section to show\n the new table instead of the summary.\n '
section = self._docmodel.view_sections.table.get_record(section_ref)
if (not section.tableRef.summ... |
b5abe97c721d37ecbb3b029f7339fda068d14a21de44395603f6e42bcc45680a | @useraction
def AddView(self, table_id, view_type, name):
'\n Creates records for a View\n '
result = self.doAddView(table_id, view_type, name)
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
self.AddRecord('_grist_TableViews', None, {'tableRef': table_row_id, 'viewRef': ... | Creates records for a View | sandbox/grist/useractions.py | AddView | gristlabs/grist-core | 2,667 | python | @useraction
def AddView(self, table_id, view_type, name):
'\n \n '
result = self.doAddView(table_id, view_type, name)
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
self.AddRecord('_grist_TableViews', None, {'tableRef': table_row_id, 'viewRef': result['id']})
return ... | @useraction
def AddView(self, table_id, view_type, name):
'\n \n '
result = self.doAddView(table_id, view_type, name)
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
self.AddRecord('_grist_TableViews', None, {'tableRef': table_row_id, 'viewRef': result['id']})
return ... |
e660b57d204da3e406c50fdc92aeddbc6daccd2861bdf62b1b2960232a97a829 | @useraction
def RemoveView(self, view_id):
'\n Removes records for view at view_id\n '
view_rec = self._docmodel.views.table.get_record(view_id)
self._docmodel.remove([view_rec]) | Removes records for view at view_id | sandbox/grist/useractions.py | RemoveView | gristlabs/grist-core | 2,667 | python | @useraction
def RemoveView(self, view_id):
'\n \n '
view_rec = self._docmodel.views.table.get_record(view_id)
self._docmodel.remove([view_rec]) | @useraction
def RemoveView(self, view_id):
'\n \n '
view_rec = self._docmodel.views.table.get_record(view_id)
self._docmodel.remove([view_rec])<|docstring|>Removes records for view at view_id<|endoftext|> |
2ad58c5a79f9777cb5c771ae72296877f3fb92e7415d3d641013fff33c4b0cd9 | @useraction
def AddViewSection(self, title, view_section_type, view_row_id, table_id):
'\n Creates records for a viewsection\n '
table_rec = self._docmodel.get_table_rec(table_id)
view = self._docmodel.views.table.get_record(view_row_id)
section = self._docmodel.add(view.viewSections, tableRef=tab... | Creates records for a viewsection | sandbox/grist/useractions.py | AddViewSection | gristlabs/grist-core | 2,667 | python | @useraction
def AddViewSection(self, title, view_section_type, view_row_id, table_id):
'\n \n '
table_rec = self._docmodel.get_table_rec(table_id)
view = self._docmodel.views.table.get_record(view_row_id)
section = self._docmodel.add(view.viewSections, tableRef=table_rec.id, parentKey=view_section... | @useraction
def AddViewSection(self, title, view_section_type, view_row_id, table_id):
'\n \n '
table_rec = self._docmodel.get_table_rec(table_id)
view = self._docmodel.views.table.get_record(view_row_id)
section = self._docmodel.add(view.viewSections, tableRef=table_rec.id, parentKey=view_section... |
3a956d328aba52dac24f76b763f6ff61c25553261966e0018559755d4f5665ce | @useraction
def RemoveViewSection(self, view_section_id):
'\n Removes records for viewsection at viewsection_id\n '
section = self._docmodel.view_sections.table.get_record(view_section_id)
self._docmodel.remove([section]) | Removes records for viewsection at viewsection_id | sandbox/grist/useractions.py | RemoveViewSection | gristlabs/grist-core | 2,667 | python | @useraction
def RemoveViewSection(self, view_section_id):
'\n \n '
section = self._docmodel.view_sections.table.get_record(view_section_id)
self._docmodel.remove([section]) | @useraction
def RemoveViewSection(self, view_section_id):
'\n \n '
section = self._docmodel.view_sections.table.get_record(view_section_id)
self._docmodel.remove([section])<|docstring|>Removes records for viewsection at viewsection_id<|endoftext|> |
491c9744ec4dc4ef5f71072344b40fdb33d93b43eac0fcede9d4a4cfb6f93a6c | def _UpdateViews(self, table_id):
"\n Updates records for default Views to include those fields that they should include by default\n (such as all fields for the Raw View, and first 4 fields for 'list' section of List View).\n "
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
... | Updates records for default Views to include those fields that they should include by default
(such as all fields for the Raw View, and first 4 fields for 'list' section of List View). | sandbox/grist/useractions.py | _UpdateViews | gristlabs/grist-core | 2,667 | python | def _UpdateViews(self, table_id):
"\n Updates records for default Views to include those fields that they should include by default\n (such as all fields for the Raw View, and first 4 fields for 'list' section of List View).\n "
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
... | def _UpdateViews(self, table_id):
"\n Updates records for default Views to include those fields that they should include by default\n (such as all fields for the Raw View, and first 4 fields for 'list' section of List View).\n "
table_row_id = self._engine.tables['_grist_Tables'].get(tableId=table_id)
... |
e600d972ad7ac1306910b3eec7dc994b030f04812f15d8864ea740c9ece4d1a7 | def _RebuildViewFields(self, table_id, section_row_id, limit=None):
"\n Does the actual work of rebuilding ViewFields to correspond to the table's columns.\n "
section_rec = self._docmodel.view_sections.table.get_record(section_row_id)
table_rec = self._docmodel.tables.lookupOne(tableId=table_id)
... | Does the actual work of rebuilding ViewFields to correspond to the table's columns. | sandbox/grist/useractions.py | _RebuildViewFields | gristlabs/grist-core | 2,667 | python | def _RebuildViewFields(self, table_id, section_row_id, limit=None):
"\n \n "
section_rec = self._docmodel.view_sections.table.get_record(section_row_id)
table_rec = self._docmodel.tables.lookupOne(tableId=table_id)
if section_rec.fields:
self._docmodel.remove(section_rec.fields)
cols =... | def _RebuildViewFields(self, table_id, section_row_id, limit=None):
"\n \n "
section_rec = self._docmodel.view_sections.table.get_record(section_row_id)
table_rec = self._docmodel.tables.lookupOne(tableId=table_id)
if section_rec.fields:
self._docmodel.remove(section_rec.fields)
cols =... |
e073880d6f6c31f3246bdcc67dc3251f27d120f984a9e5e9360dda00cbd51a55 | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
rand_draw = np.random.randn((self.mean.shape[1] * n)).reshape((self.mean.shape[1], n))
return np.exp((self.mean.T + np.dot(... | Returns n draws from the distribution
Args:
n (int): The number of draws.
Returns
(np.array): n x len(mean) array of draws. | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
rand_draw = np.random.randn((self.mean.shape[1] * n)).reshape((self.mean.shape[1], n))
return np.exp((self.mean.T + np.dot(... | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
rand_draw = np.random.randn((self.mean.shape[1] * n)).reshape((self.mean.shape[1], n))
return np.exp((self.mean.T + np.dot(... |
706d34c9a897fbadeabea360b55915e181244f370affe49ff96bc8cbe13c1ce6 | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
n_accepted = 0
n_samp = n
keep_draws = np.zeros((n, self.mean.shape[1]))
rand_draw = np.random.randn((self.mean.sha... | Returns n draws from the distribution
Args:
n (int): The number of draws.
Returns
(np.array): n x len(mean) array of draws. | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
n_accepted = 0
n_samp = n
keep_draws = np.zeros((n, self.mean.shape[1]))
rand_draw = np.random.randn((self.mean.sha... | def __call__(self, n=1):
'Returns n draws from the distribution\n\n\t\tArgs:\n\t\t\tn (int): The number of draws.\n\n\t\tReturns\n\t\t\t(np.array): n x len(mean) array of draws.\n\t\t'
n_accepted = 0
n_samp = n
keep_draws = np.zeros((n, self.mean.shape[1]))
rand_draw = np.random.randn((self.mean.sha... |
5ba5a02d44f255d825d70206209019d2a4e76e991f9e2c6474130d05dbd03b70 | def __call__(self):
'Returns a sample of e1,e2 \n\n\t\tReturns:\n\t\t\t(float,float): samples of x-direction ellipticity \n\t\t\t\teccentricity, xy-direction ellipticity eccentricity\n\t\t'
if callable(self.q_dist):
q = self.q_dist()
else:
q = self.q_dist
if callable(self.phi_dist):
... | Returns a sample of e1,e2
Returns:
(float,float): samples of x-direction ellipticity
eccentricity, xy-direction ellipticity eccentricity | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns a sample of e1,e2 \n\n\t\tReturns:\n\t\t\t(float,float): samples of x-direction ellipticity \n\t\t\t\teccentricity, xy-direction ellipticity eccentricity\n\t\t'
if callable(self.q_dist):
q = self.q_dist()
else:
q = self.q_dist
if callable(self.phi_dist):
... | def __call__(self):
'Returns a sample of e1,e2 \n\n\t\tReturns:\n\t\t\t(float,float): samples of x-direction ellipticity \n\t\t\t\teccentricity, xy-direction ellipticity eccentricity\n\t\t'
if callable(self.q_dist):
q = self.q_dist()
else:
q = self.q_dist
if callable(self.phi_dist):
... |
6dc3026035c92119f124564d92b0708c2808454502a263fad68e4cd6070df959 | def __call__(self):
'Returns gamma1, gamma2 samples\n\n\t\tReturns:\n\t\t\t(float,float): samples of external shear coordinate values \n\t\t'
if callable(self.gamma_dist):
gamma = self.gamma_dist()
else:
gamma = self.gamma_dist
if callable(self.phi_dist):
phi = self.phi_dist()
... | Returns gamma1, gamma2 samples
Returns:
(float,float): samples of external shear coordinate values | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns gamma1, gamma2 samples\n\n\t\tReturns:\n\t\t\t(float,float): samples of external shear coordinate values \n\t\t'
if callable(self.gamma_dist):
gamma = self.gamma_dist()
else:
gamma = self.gamma_dist
if callable(self.phi_dist):
phi = self.phi_dist()
... | def __call__(self):
'Returns gamma1, gamma2 samples\n\n\t\tReturns:\n\t\t\t(float,float): samples of external shear coordinate values \n\t\t'
if callable(self.gamma_dist):
gamma = self.gamma_dist()
else:
gamma = self.gamma_dist
if callable(self.phi_dist):
phi = self.phi_dist()
... |
f396d4f0b2a78e3587f2aad0a38ab71b283d47760b16d9a2aa5cf1f6e6b7dddc | def __call__(self):
'Samples 1/(1-Kext), then maps that sample to Kext value\n\n\t\tReturns: \n\t\t\t(float): Kext sample\n\t\t'
if callable(self.n_dist):
n = self.n_dist()
else:
n = self.n_dist
return (1 - (1 / n)) | Samples 1/(1-Kext), then maps that sample to Kext value
Returns:
(float): Kext sample | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Samples 1/(1-Kext), then maps that sample to Kext value\n\n\t\tReturns: \n\t\t\t(float): Kext sample\n\t\t'
if callable(self.n_dist):
n = self.n_dist()
else:
n = self.n_dist
return (1 - (1 / n)) | def __call__(self):
'Samples 1/(1-Kext), then maps that sample to Kext value\n\n\t\tReturns: \n\t\t\t(float): Kext sample\n\t\t'
if callable(self.n_dist):
n = self.n_dist()
else:
n = self.n_dist
return (1 - (1 / n))<|docstring|>Samples 1/(1-Kext), then maps that sample to Kext value
Ret... |
ebee959ab3365f3231415088262deedca1ad6a2800f78869ff750d8d3b3b1047 | def __call__(self):
'Returns two copies of the same sample\n\n\t\tReturns\n\t\t\t(float,float): Two copies of the sample.\n\t\t'
if callable(self.dist):
samp = self.dist()
else:
samp = self.dist
return (samp, samp) | Returns two copies of the same sample
Returns
(float,float): Two copies of the sample. | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns two copies of the same sample\n\n\t\tReturns\n\t\t\t(float,float): Two copies of the sample.\n\t\t'
if callable(self.dist):
samp = self.dist()
else:
samp = self.dist
return (samp, samp) | def __call__(self):
'Returns two copies of the same sample\n\n\t\tReturns\n\t\t\t(float,float): Two copies of the sample.\n\t\t'
if callable(self.dist):
samp = self.dist()
else:
samp = self.dist
return (samp, samp)<|docstring|>Returns two copies of the same sample
Returns
(float... |
3b6298370c62811dd99f4523a9504b7d1b7e2dea013b1ce00e2cb301e6c731c1 | def __call__(self):
'Returns two copies of x,y sample\n\n\t\tReturns\n\t\t\t(float,float,float,float): Two copies of x,y sampled from x_dist\n\t\t\t\tand y_dist\n\t\t'
if callable(self.x_dist):
x = self.x_dist()
else:
x = self.x_dist
if callable(self.y_dist):
y = self.y_dist()
... | Returns two copies of x,y sample
Returns
(float,float,float,float): Two copies of x,y sampled from x_dist
and y_dist | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns two copies of x,y sample\n\n\t\tReturns\n\t\t\t(float,float,float,float): Two copies of x,y sampled from x_dist\n\t\t\t\tand y_dist\n\t\t'
if callable(self.x_dist):
x = self.x_dist()
else:
x = self.x_dist
if callable(self.y_dist):
y = self.y_dist()
... | def __call__(self):
'Returns two copies of x,y sample\n\n\t\tReturns\n\t\t\t(float,float,float,float): Two copies of x,y sampled from x_dist\n\t\t\t\tand y_dist\n\t\t'
if callable(self.x_dist):
x = self.x_dist()
else:
x = self.x_dist
if callable(self.y_dist):
y = self.y_dist()
... |
6fdfe64c82f158ccf33d3a66bcc09ffc7fe11ff4192a220eb3043dbc2489f3cd | def __call__(self):
'Returns samples of redshifts, ensuring z_source > z_lens\n\n\t\tReturns: \n\t\t\t(float,float): z_lens,z_source \n\t\t'
z_lens = self.z_lens_dist()
clip = ((z_lens - self.z_source_mean) / self.z_source_std)
if (clip > self.z_source_min):
self.z_source_min = clip
z_source... | Returns samples of redshifts, ensuring z_source > z_lens
Returns:
(float,float): z_lens,z_source | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns samples of redshifts, ensuring z_source > z_lens\n\n\t\tReturns: \n\t\t\t(float,float): z_lens,z_source \n\t\t'
z_lens = self.z_lens_dist()
clip = ((z_lens - self.z_source_mean) / self.z_source_std)
if (clip > self.z_source_min):
self.z_source_min = clip
z_source... | def __call__(self):
'Returns samples of redshifts, ensuring z_source > z_lens\n\n\t\tReturns: \n\t\t\t(float,float): z_lens,z_source \n\t\t'
z_lens = self.z_lens_dist()
clip = ((z_lens - self.z_source_mean) / self.z_source_std)
if (clip > self.z_source_min):
self.z_source_min = clip
z_source... |
ba9c3e7e6bb71229b3df0f7a6482c463b5a371eaf262f54da31128beaf32c6ae | def __call__(self):
'Returns specified # of samples from dist\n\t\t\n\t\tReturns: \n\t\t\tlist(float): |num| samples from dist\n\t\t'
return self.dist(size=self.num) | Returns specified # of samples from dist
Returns:
list(float): |num| samples from dist | paltas/Sampling/distributions.py | __call__ | swagnercarena/paltas | 5 | python | def __call__(self):
'Returns specified # of samples from dist\n\t\t\n\t\tReturns: \n\t\t\tlist(float): |num| samples from dist\n\t\t'
return self.dist(size=self.num) | def __call__(self):
'Returns specified # of samples from dist\n\t\t\n\t\tReturns: \n\t\t\tlist(float): |num| samples from dist\n\t\t'
return self.dist(size=self.num)<|docstring|>Returns specified # of samples from dist
Returns:
list(float): |num| samples from dist<|endoftext|> |
591c74d75d95bef6b9685c05f993ce98006c004056d25b4edb3a87ba68351b2d | def fails_to_deliver(other_args: List[str], ticker: str, stock: pd.DataFrame):
'Display fails-to-deliver data for a given ticker\n\n Parameters\n ----------\n other_args : List[str]\n argparse other args - ["-n", "10"]\n ticker : str\n Stock ticker\n stock : pd.DataFrame\n Stock ... | Display fails-to-deliver data for a given ticker
Parameters
----------
other_args : List[str]
argparse other args - ["-n", "10"]
ticker : str
Stock ticker
stock : pd.DataFrame
Stock data | gamestonk_terminal/due_diligence/sec_view.py | fails_to_deliver | jbhurat/GamestonkTerminal | 1 | python | def fails_to_deliver(other_args: List[str], ticker: str, stock: pd.DataFrame):
'Display fails-to-deliver data for a given ticker\n\n Parameters\n ----------\n other_args : List[str]\n argparse other args - ["-n", "10"]\n ticker : str\n Stock ticker\n stock : pd.DataFrame\n Stock ... | def fails_to_deliver(other_args: List[str], ticker: str, stock: pd.DataFrame):
'Display fails-to-deliver data for a given ticker\n\n Parameters\n ----------\n other_args : List[str]\n argparse other args - ["-n", "10"]\n ticker : str\n Stock ticker\n stock : pd.DataFrame\n Stock ... |
80185bc53bac7d79c448a344fe8f2f9398c29bce86af3919563a2ae2a4cb2157 | def default_cfg(algo='PPO', env='env', experiment='test'):
'Useful for tests.'
return parse_args(argv=[f'--algo={algo}', f'--env={env}', f'--experiment={experiment}']) | Useful for tests. | algorithms/utils/arguments.py | default_cfg | Zhehui-Huang/scalable_agent | 0 | python | def default_cfg(algo='PPO', env='env', experiment='test'):
return parse_args(argv=[f'--algo={algo}', f'--env={env}', f'--experiment={experiment}']) | def default_cfg(algo='PPO', env='env', experiment='test'):
return parse_args(argv=[f'--algo={algo}', f'--env={env}', f'--experiment={experiment}'])<|docstring|>Useful for tests.<|endoftext|> |
c63fce5692c9b711dcd5c1aa4b41aaff4dadf206f06fd4dd9d2811482fc4bee9 | def xml_safe(value):
"Replaces invalid XML characters with '?'."
return CONTROL_CHARACTERS.sub('?', value) | Replaces invalid XML characters with '?'. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | xml_safe | drwetter/autopsy | 1,473 | python | def xml_safe(value):
return CONTROL_CHARACTERS.sub('?', value) | def xml_safe(value):
return CONTROL_CHARACTERS.sub('?', value)<|docstring|>Replaces invalid XML characters with '?'.<|endoftext|> |
7cc4d051cf84d61a62368a74f3203949285bc28b66a6af9e1930c8233f99c16e | def escape_cdata(cdata):
'Escape a string for an XML CDATA section.'
return xml_safe(cdata).replace(']]>', ']]>]]><![CDATA[') | Escape a string for an XML CDATA section. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | escape_cdata | drwetter/autopsy | 1,473 | python | def escape_cdata(cdata):
return xml_safe(cdata).replace(']]>', ']]>]]><![CDATA[') | def escape_cdata(cdata):
return xml_safe(cdata).replace(']]>', ']]>]]><![CDATA[')<|docstring|>Escape a string for an XML CDATA section.<|endoftext|> |
f8725a3261a887a957628e89d69314f12f678d03e7db684c29d7fca0f2e2e860 | def init_timer(self):
'Initialize a timer before starting tests.'
self._start_time = time.time() | Initialize a timer before starting tests. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | init_timer | drwetter/autopsy | 1,473 | python | def init_timer(self):
self._start_time = time.time() | def init_timer(self):
self._start_time = time.time()<|docstring|>Initialize a timer before starting tests.<|endoftext|> |
6df09f472af9639aced3020b3d1a33ef461aab45cb893b838df67f4c6da25ca1 | def _quoteattr(self, attr):
'Escape an XML attribute. Value can be unicode.'
attr = xml_safe(attr)
if (isinstance(attr, str) and (not UNICODE_STRINGS)):
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr) | Escape an XML attribute. Value can be unicode. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | _quoteattr | drwetter/autopsy | 1,473 | python | def _quoteattr(self, attr):
attr = xml_safe(attr)
if (isinstance(attr, str) and (not UNICODE_STRINGS)):
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr) | def _quoteattr(self, attr):
attr = xml_safe(attr)
if (isinstance(attr, str) and (not UNICODE_STRINGS)):
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr)<|docstring|>Escape an XML attribute. Value can be unicode.<|endoftext|> |
2e5c54c68597b5fceba3b26ecb194c6f12ab14293108567e1beccdc3d7889457 | def report(self):
'Writes an Xunit-formatted XML file\n\n The file includes a report of test errors and failures.\n\n '
self.debug('Writing XML file to: %s', self.options.xunit_file)
xml_file = codecs.open(self.options.xunit_file, 'w', self.encoding, 'replace')
self.stats['encoding'] = sel... | Writes an Xunit-formatted XML file
The file includes a report of test errors and failures. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | report | drwetter/autopsy | 1,473 | python | def report(self):
'Writes an Xunit-formatted XML file\n\n The file includes a report of test errors and failures.\n\n '
self.debug('Writing XML file to: %s', self.options.xunit_file)
xml_file = codecs.open(self.options.xunit_file, 'w', self.encoding, 'replace')
self.stats['encoding'] = sel... | def report(self):
'Writes an Xunit-formatted XML file\n\n The file includes a report of test errors and failures.\n\n '
self.debug('Writing XML file to: %s', self.options.xunit_file)
xml_file = codecs.open(self.options.xunit_file, 'w', self.encoding, 'replace')
self.stats['encoding'] = sel... |
42010e895f8f38c4658405cf4046913f6c161d23543c16ae754d242e868e6a26 | def set_failed(self, test):
'Add failure output to Xunit report.\n '
super().set_failed(test)
stack_trace = ''
if test.stack_trace:
stack_trace = ('<![CDATA[%s]]>' % escape_cdata(test.stack_trace))
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_f... | Add failure output to Xunit report. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | set_failed | drwetter/autopsy | 1,473 | python | def set_failed(self, test):
'\n '
super().set_failed(test)
stack_trace =
if test.stack_trace:
stack_trace = ('<![CDATA[%s]]>' % escape_cdata(test.stack_trace))
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_file.write(self._forceUnicode(('<testc... | def set_failed(self, test):
'\n '
super().set_failed(test)
stack_trace =
if test.stack_trace:
stack_trace = ('<![CDATA[%s]]>' % escape_cdata(test.stack_trace))
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_file.write(self._forceUnicode(('<testc... |
5bfa201a3e38feb01d53ced9dc43efbdd5c93d7a19027648e40c6c021f449790 | def set_passed(self, test):
'Add success output to Xunit report.\n '
self.stats['passed'] += 1
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_file.write(self._forceUnicode(('<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">%(systemout)s</testcase>' %... | Add success output to Xunit report. | thirdparty/gstreamer/1.0/x86_64/lib/gst-validate-launcher/python/launcher/reporters.py | set_passed | drwetter/autopsy | 1,473 | python | def set_passed(self, test):
'\n '
self.stats['passed'] += 1
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_file.write(self._forceUnicode(('<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">%(systemout)s</testcase>' % {'cls': self._quoteattr(test.get_c... | def set_passed(self, test):
'\n '
self.stats['passed'] += 1
xml_file = codecs.open(self.tmp_xml_file.name, 'a', self.encoding, 'replace')
xml_file.write(self._forceUnicode(('<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">%(systemout)s</testcase>' % {'cls': self._quoteattr(test.get_c... |
06d86d46f1d21295c3c3ad77208c54a9f92bd91a2bd977f67ffeab115cc0e3f1 | def set_trace(frame=None):
"\n Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n "
TerminalPdb().set_trace((frame or sys._getframe().f_back)) | Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame. | venv/lib/python3.7/site-packages/IPython/terminal/debugger.py | set_trace | robertosousa1/working-missing-data-kaggle-black-friday | 445 | python | def set_trace(frame=None):
"\n Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n "
TerminalPdb().set_trace((frame or sys._getframe().f_back)) | def set_trace(frame=None):
"\n Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n "
TerminalPdb().set_trace((frame or sys._getframe().f_back))<|docstring|>Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.<|e... |
9b836b4ba74f618e5feb3ecc02210c2aed0e6c754d644b9eae854e14030888b4 | def cmdloop(self, intro=None):
'Repeatedly issue a prompt, accept input, parse an initial prefix\n off the received input, and dispatch to action methods, passing them\n the remainder of the line as argument.\n\n override the same methods from cmd.Cmd to provide prompt toolkit replacement.\n ... | Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
override the same methods from cmd.Cmd to provide prompt toolkit replacement. | venv/lib/python3.7/site-packages/IPython/terminal/debugger.py | cmdloop | robertosousa1/working-missing-data-kaggle-black-friday | 445 | python | def cmdloop(self, intro=None):
'Repeatedly issue a prompt, accept input, parse an initial prefix\n off the received input, and dispatch to action methods, passing them\n the remainder of the line as argument.\n\n override the same methods from cmd.Cmd to provide prompt toolkit replacement.\n ... | def cmdloop(self, intro=None):
'Repeatedly issue a prompt, accept input, parse an initial prefix\n off the received input, and dispatch to action methods, passing them\n the remainder of the line as argument.\n\n override the same methods from cmd.Cmd to provide prompt toolkit replacement.\n ... |
32640feb7f58bec8a10691f24ec817b2ef38791f3a93ec9a78fe02a205ceb64f | def _signal_handler(sgnal, frame):
' A custom signal handler which will raise a DelivererInterruptedError\n :raises DelivererInterruptedError:\n this exception will be raised\n '
raise DelivererInterruptedError('interrupt signal {} received while delivering'.format(sgnal)) | A custom signal handler which will raise a DelivererInterruptedError
:raises DelivererInterruptedError:
this exception will be raised | taca_ngi_pipeline/deliver/deliver.py | _signal_handler | ssjunnebo/taca-ngi-pipeline | 2 | python | def _signal_handler(sgnal, frame):
' A custom signal handler which will raise a DelivererInterruptedError\n :raises DelivererInterruptedError:\n this exception will be raised\n '
raise DelivererInterruptedError('interrupt signal {} received while delivering'.format(sgnal)) | def _signal_handler(sgnal, frame):
' A custom signal handler which will raise a DelivererInterruptedError\n :raises DelivererInterruptedError:\n this exception will be raised\n '
raise DelivererInterruptedError('interrupt signal {} received while delivering'.format(sgnal))<|docstring|>A cus... |
8dd4aff161308172d5c878dd1ad049d39dfd4d5dba36ca348c3a83a5c1adaeb9 | def _timestamp(days=None):
'Current date and time (UTC) in ISO format, with millisecond precision.\n Add the specified offset in days, if given.\n Stolen from https://github.com/NationalGenomicsInfrastructure/charon/blob/master/charon/utils.py\n '
instant = datetime.datetime.utcnow()
if days:
... | Current date and time (UTC) in ISO format, with millisecond precision.
Add the specified offset in days, if given.
Stolen from https://github.com/NationalGenomicsInfrastructure/charon/blob/master/charon/utils.py | taca_ngi_pipeline/deliver/deliver.py | _timestamp | ssjunnebo/taca-ngi-pipeline | 2 | python | def _timestamp(days=None):
'Current date and time (UTC) in ISO format, with millisecond precision.\n Add the specified offset in days, if given.\n Stolen from https://github.com/NationalGenomicsInfrastructure/charon/blob/master/charon/utils.py\n '
instant = datetime.datetime.utcnow()
if days:
... | def _timestamp(days=None):
'Current date and time (UTC) in ISO format, with millisecond precision.\n Add the specified offset in days, if given.\n Stolen from https://github.com/NationalGenomicsInfrastructure/charon/blob/master/charon/utils.py\n '
instant = datetime.datetime.utcnow()
if days:
... |
f6495c2fe6d9eb5ced1bd51a73b736fd750df97743620f9990e830b770455e12 | def __init__(self, projectid, sampleid, **kwargs):
'\n :param string projectid: id of project to deliver\n :param string sampleid: id of sample to deliver\n :param bool no_checksum: if True, skip the checksum computation\n :param string hash_algorithm: algorithm to use fo... | :param string projectid: id of project to deliver
:param string sampleid: id of sample to deliver
:param bool no_checksum: if True, skip the checksum computation
:param string hash_algorithm: algorithm to use for calculating
file checksums, defaults to sha1 | taca_ngi_pipeline/deliver/deliver.py | __init__ | ssjunnebo/taca-ngi-pipeline | 2 | python | def __init__(self, projectid, sampleid, **kwargs):
'\n :param string projectid: id of project to deliver\n :param string sampleid: id of sample to deliver\n :param bool no_checksum: if True, skip the checksum computation\n :param string hash_algorithm: algorithm to use fo... | def __init__(self, projectid, sampleid, **kwargs):
'\n :param string projectid: id of project to deliver\n :param string sampleid: id of sample to deliver\n :param bool no_checksum: if True, skip the checksum computation\n :param string hash_algorithm: algorithm to use fo... |
c14aa1dbd3cbd6f0c971fb87489d247442b5b6997563224df10977e638c1b7ca | def db_entry(self):
' Abstract method, should be implemented by subclasses '
raise NotImplementedError('This method should be implemented by subclass') | Abstract method, should be implemented by subclasses | taca_ngi_pipeline/deliver/deliver.py | db_entry | ssjunnebo/taca-ngi-pipeline | 2 | python | def db_entry(self):
' '
raise NotImplementedError('This method should be implemented by subclass') | def db_entry(self):
' '
raise NotImplementedError('This method should be implemented by subclass')<|docstring|>Abstract method, should be implemented by subclasses<|endoftext|> |
b536a553b647de9d406d682b5148c9fba9c1c6bf07eda61b780c3b5261910599 | def get_sample_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :re... | Returns the analysis status for this sample. If a sampleentry
dict is supplied, it will be used instead of fethcing from database
:params sampleentry: a database sample entry to use instead of
fetching from db
:returns: the analysis status of this sample as a string | taca_ngi_pipeline/deliver/deliver.py | get_sample_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def get_sample_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :re... | def get_sample_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :re... |
713f6621efd66e4de018e6ee4afeed6d78d17b2ec5ead8ce1d124fcc7290939b | def update_delivery_status(self, *args, **kwargs):
' Abstract method, should be implemented by subclasses '
raise NotImplementedError('This method should be implemented by subclass') | Abstract method, should be implemented by subclasses | taca_ngi_pipeline/deliver/deliver.py | update_delivery_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def update_delivery_status(self, *args, **kwargs):
' '
raise NotImplementedError('This method should be implemented by subclass') | def update_delivery_status(self, *args, **kwargs):
' '
raise NotImplementedError('This method should be implemented by subclass')<|docstring|>Abstract method, should be implemented by subclasses<|endoftext|> |
76664baead6e175442ffb395aa3fe73ec2d1e0f4ac68bddbf41e0999bb9cceaa | def get_analysis_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... | Returns the analysis status for this sample. If a sampleentry
dict is supplied, it will be used instead of fethcing from database
:params sampleentry: a database sample entry to use instead of
fetching from db
:returns: the analysis status of this sample as a string | taca_ngi_pipeline/deliver/deliver.py | get_analysis_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def get_analysis_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... | def get_analysis_status(self, dbentry=None):
' Returns the analysis status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... |
91645dde752c97b0e3e29c69a590d42a67e1315dda944757f60e73b761380527 | def get_delivery_status(self, dbentry=None):
' Returns the delivery status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... | Returns the delivery status for this sample. If a sampleentry
dict is supplied, it will be used instead of fethcing from database
:params sampleentry: a database sample entry to use instead of
fetching from db
:returns: the delivery status of this sample as a string | taca_ngi_pipeline/deliver/deliver.py | get_delivery_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def get_delivery_status(self, dbentry=None):
' Returns the delivery status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... | def get_delivery_status(self, dbentry=None):
' Returns the delivery status for this sample. If a sampleentry\n dict is supplied, it will be used instead of fethcing from database\n\n :params sampleentry: a database sample entry to use instead of\n fetching from db\n :... |
0e5fd4020130992f7a23e213917abc214ffed261dae4ff6c5e346dec140e5b32 | def gather_files(self):
" This method will locate files matching the patterns specified in\n the config and compute the checksum and construct the staging path\n according to the config.\n\n The config should contain the key 'files_to_deliver', which should\n be a list of... | This method will locate files matching the patterns specified in
the config and compute the checksum and construct the staging path
according to the config.
The config should contain the key 'files_to_deliver', which should
be a list of tuples with source path patterns and destination path
patterns. The source path ca... | taca_ngi_pipeline/deliver/deliver.py | gather_files | ssjunnebo/taca-ngi-pipeline | 2 | python | def gather_files(self):
" This method will locate files matching the patterns specified in\n the config and compute the checksum and construct the staging path\n according to the config.\n\n The config should contain the key 'files_to_deliver', which should\n be a list of... | def gather_files(self):
" This method will locate files matching the patterns specified in\n the config and compute the checksum and construct the staging path\n according to the config.\n\n The config should contain the key 'files_to_deliver', which should\n be a list of... |
70e387195fa169b78a920f01ece92aea9d3d2810878256243e94c00462582722 | def stage_delivery(self):
' Stage a delivery by symlinking source paths to destination paths\n according to the returned tuples from the gather_files function.\n Checksums will be written to a digest file in the staging path.\n Failure to stage individual files will be logged as war... | Stage a delivery by symlinking source paths to destination paths
according to the returned tuples from the gather_files function.
Checksums will be written to a digest file in the staging path.
Failure to stage individual files will be logged as warnings but will
not terminate the staging.
:raises DelivererError: if a... | taca_ngi_pipeline/deliver/deliver.py | stage_delivery | ssjunnebo/taca-ngi-pipeline | 2 | python | def stage_delivery(self):
' Stage a delivery by symlinking source paths to destination paths\n according to the returned tuples from the gather_files function.\n Checksums will be written to a digest file in the staging path.\n Failure to stage individual files will be logged as war... | def stage_delivery(self):
' Stage a delivery by symlinking source paths to destination paths\n according to the returned tuples from the gather_files function.\n Checksums will be written to a digest file in the staging path.\n Failure to stage individual files will be logged as war... |
d44d17e883d97735ac9c0bf4701a751bae35dd4dfe138f417ec6bbf020e5f0fa | def do_delivery(self):
' Deliver the staged delivery folder using rsync\n :returns: True if delivery was successful, False if unsuccessful\n :raises DelivererRsyncError: if an exception occurred during\n transfer\n '
agent = transfer.RsyncAgent(self.expand_path(self.s... | Deliver the staged delivery folder using rsync
:returns: True if delivery was successful, False if unsuccessful
:raises DelivererRsyncError: if an exception occurred during
transfer | taca_ngi_pipeline/deliver/deliver.py | do_delivery | ssjunnebo/taca-ngi-pipeline | 2 | python | def do_delivery(self):
' Deliver the staged delivery folder using rsync\n :returns: True if delivery was successful, False if unsuccessful\n :raises DelivererRsyncError: if an exception occurred during\n transfer\n '
agent = transfer.RsyncAgent(self.expand_path(self.s... | def do_delivery(self):
' Deliver the staged delivery folder using rsync\n :returns: True if delivery was successful, False if unsuccessful\n :raises DelivererRsyncError: if an exception occurred during\n transfer\n '
agent = transfer.RsyncAgent(self.expand_path(self.s... |
303c258cdb3e7518ab9f20617c89bfd7646aefd2ea9f0d2863ef48335dff7c07 | def delivered_digestfile(self):
'\n :returns: path to the file with checksums after delivery\n '
return self.expand_path(os.path.join(self.deliverypath, os.path.basename(self.staging_digestfile()))) | :returns: path to the file with checksums after delivery | taca_ngi_pipeline/deliver/deliver.py | delivered_digestfile | ssjunnebo/taca-ngi-pipeline | 2 | python | def delivered_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.deliverypath, os.path.basename(self.staging_digestfile()))) | def delivered_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.deliverypath, os.path.basename(self.staging_digestfile())))<|docstring|>:returns: path to the file with checksums after delivery<|endoftext|> |
dbc791ca2ba6657afb98f6fd2fe1c846e9158a74cd9c8f496935e3d683dd0ffa | def staging_digestfile(self):
'\n :returns: path to the file with checksums after staging\n '
return self.expand_path(os.path.join(self.stagingpath, '{}.{}'.format(self.sampleid, self.hash_algorithm))) | :returns: path to the file with checksums after staging | taca_ngi_pipeline/deliver/deliver.py | staging_digestfile | ssjunnebo/taca-ngi-pipeline | 2 | python | def staging_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, '{}.{}'.format(self.sampleid, self.hash_algorithm))) | def staging_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, '{}.{}'.format(self.sampleid, self.hash_algorithm)))<|docstring|>:returns: path to the file with checksums after staging<|endoftext|> |
7f0a1cd3a777f0d3ae7056341b3c129dc8fb14f8627276979b621e327fdf5f74 | def staging_filelist(self):
'\n :returns: path to the file with a list of files to transfer\n after staging\n '
return self.expand_path(os.path.join(self.stagingpath, '{}.lst'.format(self.sampleid))) | :returns: path to the file with a list of files to transfer
after staging | taca_ngi_pipeline/deliver/deliver.py | staging_filelist | ssjunnebo/taca-ngi-pipeline | 2 | python | def staging_filelist(self):
'\n :returns: path to the file with a list of files to transfer\n after staging\n '
return self.expand_path(os.path.join(self.stagingpath, '{}.lst'.format(self.sampleid))) | def staging_filelist(self):
'\n :returns: path to the file with a list of files to transfer\n after staging\n '
return self.expand_path(os.path.join(self.stagingpath, '{}.lst'.format(self.sampleid)))<|docstring|>:returns: path to the file with a list of files to transfer
aft... |
c2e7b9780cb84f9d8dbe01d4c15ad8ff6823ffc9d50e3cdcdd0c4a5d14553744 | def transfer_log(self):
'\n :returns: path prefix to the transfer log files. The suffixes will\n be created by the transfer command\n '
return self.expand_path(os.path.join(self.logpath, '{}_{}'.format(self.sampleid, datetime.datetime.now().strftime('%Y%m%dT%H%M%S')))) | :returns: path prefix to the transfer log files. The suffixes will
be created by the transfer command | taca_ngi_pipeline/deliver/deliver.py | transfer_log | ssjunnebo/taca-ngi-pipeline | 2 | python | def transfer_log(self):
'\n :returns: path prefix to the transfer log files. The suffixes will\n be created by the transfer command\n '
return self.expand_path(os.path.join(self.logpath, '{}_{}'.format(self.sampleid, datetime.datetime.now().strftime('%Y%m%dT%H%M%S')))) | def transfer_log(self):
'\n :returns: path prefix to the transfer log files. The suffixes will\n be created by the transfer command\n '
return self.expand_path(os.path.join(self.logpath, '{}_{}'.format(self.sampleid, datetime.datetime.now().strftime('%Y%m%dT%H%M%S'))))<|docstrin... |
06a0f3dc473257143ac9a0bd217553288844999f1e9bb5e03cfb284d6eb03ca4 | def expand_path(self, path):
' Will expand a path by replacing placeholders with correspondingly\n named attributes belonging to this Deliverer instance. Placeholders\n are specified according to the pattern \'<[A-Z]>\' and the\n corresponding attribute that will replace the placeho... | Will expand a path by replacing placeholders with correspondingly
named attributes belonging to this Deliverer instance. Placeholders
are specified according to the pattern '<[A-Z]>' and the
corresponding attribute that will replace the placeholder should be
identically named but with all lowercase letters.
For exampl... | taca_ngi_pipeline/deliver/deliver.py | expand_path | ssjunnebo/taca-ngi-pipeline | 2 | python | def expand_path(self, path):
' Will expand a path by replacing placeholders with correspondingly\n named attributes belonging to this Deliverer instance. Placeholders\n are specified according to the pattern \'<[A-Z]>\' and the\n corresponding attribute that will replace the placeho... | def expand_path(self, path):
' Will expand a path by replacing placeholders with correspondingly\n named attributes belonging to this Deliverer instance. Placeholders\n are specified according to the pattern \'<[A-Z]>\' and the\n corresponding attribute that will replace the placeho... |
d759551ec9067342de29cdbd7621b6d47416e13a91c3a5a3a93fd54044430edc | def aggregate_meta_info(self):
" A method to collect meta info about delivered files (like size, md5 value)\n Which files are interested (by default only 'fastq' and 'bam' files) can be\n controlled by setting 'files_interested' in 'aggregate_meta_info' section.\n It needs a databas... | A method to collect meta info about delivered files (like size, md5 value)
Which files are interested (by default only 'fastq' and 'bam' files) can be
controlled by setting 'files_interested' in 'aggregate_meta_info' section.
It needs a database credentials file to put the aggregated info. | taca_ngi_pipeline/deliver/deliver.py | aggregate_meta_info | ssjunnebo/taca-ngi-pipeline | 2 | python | def aggregate_meta_info(self):
" A method to collect meta info about delivered files (like size, md5 value)\n Which files are interested (by default only 'fastq' and 'bam' files) can be\n controlled by setting 'files_interested' in 'aggregate_meta_info' section.\n It needs a databas... | def aggregate_meta_info(self):
" A method to collect meta info about delivered files (like size, md5 value)\n Which files are interested (by default only 'fastq' and 'bam' files) can be\n controlled by setting 'files_interested' in 'aggregate_meta_info' section.\n It needs a databas... |
927ca8f9f69048497ae26ba5990ef54797f01dd0dfb7c03489288e92489fda2c | def all_samples_delivered(self, sampleentries=None):
' Checks the delivery status of all project samples\n\n :params sampleentries: a list of sample entry dicts to use instead\n of fetching from database\n :returns: True if all samples in this project has been successfully\n ... | Checks the delivery status of all project samples
:params sampleentries: a list of sample entry dicts to use instead
of fetching from database
:returns: True if all samples in this project has been successfully
delivered, False otherwise | taca_ngi_pipeline/deliver/deliver.py | all_samples_delivered | ssjunnebo/taca-ngi-pipeline | 2 | python | def all_samples_delivered(self, sampleentries=None):
' Checks the delivery status of all project samples\n\n :params sampleentries: a list of sample entry dicts to use instead\n of fetching from database\n :returns: True if all samples in this project has been successfully\n ... | def all_samples_delivered(self, sampleentries=None):
' Checks the delivery status of all project samples\n\n :params sampleentries: a list of sample entry dicts to use instead\n of fetching from database\n :returns: True if all samples in this project has been successfully\n ... |
e9527142a8d6d1a7f443c8d37ee8a6e4793f0f6134cd71b8306c2f480cd0e128 | def create_report(self):
' Create a final aggregate report via a system call '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, self.projectid)))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None
except AttributeError:
logprefix ... | Create a final aggregate report via a system call | taca_ngi_pipeline/deliver/deliver.py | create_report | ssjunnebo/taca-ngi-pipeline | 2 | python | def create_report(self):
' '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, self.projectid)))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None
except AttributeError:
logprefix = None
with chdir(self.expand_path(self.repor... | def create_report(self):
' '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, self.projectid)))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None
except AttributeError:
logprefix = None
with chdir(self.expand_path(self.repor... |
3f30eeed0aac15516b5d465c0605bcabe5d438b3147e137dd8bad2622180eea0 | def copy_report(self):
' Copies the aggregate report and version reports files to a specified outbox directory.\n :returns: list of the paths to the files it has successfully copied (i.e. the targets)\n '
def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to... | Copies the aggregate report and version reports files to a specified outbox directory.
:returns: list of the paths to the files it has successfully copied (i.e. the targets) | taca_ngi_pipeline/deliver/deliver.py | copy_report | ssjunnebo/taca-ngi-pipeline | 2 | python | def copy_report(self):
' Copies the aggregate report and version reports files to a specified outbox directory.\n :returns: list of the paths to the files it has successfully copied (i.e. the targets)\n '
def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to... | def copy_report(self):
' Copies the aggregate report and version reports files to a specified outbox directory.\n :returns: list of the paths to the files it has successfully copied (i.e. the targets)\n '
def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to... |
d42c179de1b719d915f709eceb0ce440aafb9d02579c93bf11c28bdeb4cb7bd9 | def db_entry(self):
" Fetch a database entry representing the instance's project\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.project_ent... | Fetch a database entry representing the instance's project
:returns: a json-formatted database entry
:raises taca_ngi_pipeline.utils.database.DatabaseError:
if an error occurred when communicating with the database | taca_ngi_pipeline/deliver/deliver.py | db_entry | ssjunnebo/taca-ngi-pipeline | 2 | python | def db_entry(self):
" Fetch a database entry representing the instance's project\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.project_ent... | def db_entry(self):
" Fetch a database entry representing the instance's project\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.project_ent... |
30d6ac85ae8fc780da0c1308b6a8378a3a3494fb5321b91e7cc01ab035688e7a | def deliver_project(self):
' Deliver all samples in a project to the destination specified by\n deliverypath\n\n :returns: True if all samples were delivered successfully, False if\n any sample was not properly delivered or ready to be delivered\n '
try:
if ge... | Deliver all samples in a project to the destination specified by
deliverypath
:returns: True if all samples were delivered successfully, False if
any sample was not properly delivered or ready to be delivered | taca_ngi_pipeline/deliver/deliver.py | deliver_project | ssjunnebo/taca-ngi-pipeline | 2 | python | def deliver_project(self):
' Deliver all samples in a project to the destination specified by\n deliverypath\n\n :returns: True if all samples were delivered successfully, False if\n any sample was not properly delivered or ready to be delivered\n '
try:
if ge... | def deliver_project(self):
' Deliver all samples in a project to the destination specified by\n deliverypath\n\n :returns: True if all samples were delivered successfully, False if\n any sample was not properly delivered or ready to be delivered\n '
try:
if ge... |
a5859a63009225ebef88034beac32850237f968d1c39e53e39bf651010709248 | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\... | Update the delivery_status field in the database to the supplied
status for the project specified by this instance
:returns: the result from the underlying api call
:raises taca_ngi_pipeline.utils.database.DatabaseError:
if an error occurred when communicating with the database | taca_ngi_pipeline/deliver/deliver.py | update_delivery_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\... | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\... |
c3982290a788d665f074201ab6bf406777712c4e46f85d8bcb47025b7114477b | def staging_digestfile(self):
'\n :returns: path to the file with checksums for miscellaneous files after staging\n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.{}'.format(self.hash_algorithm))) | :returns: path to the file with checksums for miscellaneous files after staging | taca_ngi_pipeline/deliver/deliver.py | staging_digestfile | ssjunnebo/taca-ngi-pipeline | 2 | python | def staging_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.{}'.format(self.hash_algorithm))) | def staging_digestfile(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.{}'.format(self.hash_algorithm)))<|docstring|>:returns: path to the file with checksums for miscellaneous files after staging<|endoftext|> |
af043f8cecd81f381d7b9a1ed5468542b5f807b3ebd12ebc13f001c9513933b0 | def staging_filelist(self):
'\n :returns: path to the file with a list of miscellaneous files to transfer after staging\n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.lst')) | :returns: path to the file with a list of miscellaneous files to transfer after staging | taca_ngi_pipeline/deliver/deliver.py | staging_filelist | ssjunnebo/taca-ngi-pipeline | 2 | python | def staging_filelist(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.lst')) | def staging_filelist(self):
'\n \n '
return self.expand_path(os.path.join(self.stagingpath, 'miscellaneous.lst'))<|docstring|>:returns: path to the file with a list of miscellaneous files to transfer after staging<|endoftext|> |
a1ac28904d3ca27f0390b27ad05bb698c4fbb7be0aa5a5ab732da0778b8f1e5b | def create_report(self):
' Create a sample report and an aggregate report via a system call '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, '{}-{}'.format(self.projectid, self.sampleid))))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None... | Create a sample report and an aggregate report via a system call | taca_ngi_pipeline/deliver/deliver.py | create_report | ssjunnebo/taca-ngi-pipeline | 2 | python | def create_report(self):
' '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, '{}-{}'.format(self.projectid, self.sampleid))))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None
except AttributeError:
logprefix = None
with ch... | def create_report(self):
' '
logprefix = os.path.abspath(self.expand_path(os.path.join(self.logpath, '{}-{}'.format(self.projectid, self.sampleid))))
try:
if (not create_folder(os.path.dirname(logprefix))):
logprefix = None
except AttributeError:
logprefix = None
with ch... |
2d1d1f6e0117671ea93b5b14db5886e951e9211e6b17acd1e8f63b89723ed120 | def db_entry(self):
" Fetch a database entry representing the instance's project and sample\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.... | Fetch a database entry representing the instance's project and sample
:returns: a json-formatted database entry
:raises taca_ngi_pipeline.utils.database.DatabaseError:
if an error occurred when communicating with the database | taca_ngi_pipeline/deliver/deliver.py | db_entry | ssjunnebo/taca-ngi-pipeline | 2 | python | def db_entry(self):
" Fetch a database entry representing the instance's project and sample\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.... | def db_entry(self):
" Fetch a database entry representing the instance's project and sample\n :returns: a json-formatted database entry\n :raises taca_ngi_pipeline.utils.database.DatabaseError:\n if an error occurred when communicating with the database\n "
return db.... |
43b51bb778e01bcc9c74b20f2ef4761890e2f444621df126fa8464b80a55b4da | def deliver_sample(self, sampleentry=None):
' Deliver a sample to the destination specified by the config.\n Will check if the sample has already been delivered and should not\n be delivered again or if the sample is not yet ready to be delivered.\n\n :params sampleentry: a database... | Deliver a sample to the destination specified by the config.
Will check if the sample has already been delivered and should not
be delivered again or if the sample is not yet ready to be delivered.
:params sampleentry: a database sample entry to use for delivery,
be very careful with caching the database entries t... | taca_ngi_pipeline/deliver/deliver.py | deliver_sample | ssjunnebo/taca-ngi-pipeline | 2 | python | def deliver_sample(self, sampleentry=None):
' Deliver a sample to the destination specified by the config.\n Will check if the sample has already been delivered and should not\n be delivered again or if the sample is not yet ready to be delivered.\n\n :params sampleentry: a database... | def deliver_sample(self, sampleentry=None):
' Deliver a sample to the destination specified by the config.\n Will check if the sample has already been delivered and should not\n be delivered again or if the sample is not yet ready to be delivered.\n\n :params sampleentry: a database... |
898904a086fdba5f00387ab09dd9c30fd32fa45064239d2a37c278a3cf8be18f | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project and sample specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.Data... | Update the delivery_status field in the database to the supplied
status for the project and sample specified by this instance
:returns: the result from the underlying api call
:raises taca_ngi_pipeline.utils.database.DatabaseError:
if an error occurred when communicating with the database | taca_ngi_pipeline/deliver/deliver.py | update_delivery_status | ssjunnebo/taca-ngi-pipeline | 2 | python | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project and sample specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.Data... | def update_delivery_status(self, status='DELIVERED'):
' Update the delivery_status field in the database to the supplied\n status for the project and sample specified by this instance\n :returns: the result from the underlying api call\n :raises taca_ngi_pipeline.utils.database.Data... |
bca752820f1cc9ea8e742859b06cb4fcc39ce7f5cdd4d83a93ed54c0b0999040 | def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to_deliver` for files matching the provided pattern\n :param pattern: the regex pattern to search for\n :returns: single matching file\n :raises: AssertionError if there is not strictly one mat... | Searches the nested list of `files_to_deliver` for files matching the provided pattern
:param pattern: the regex pattern to search for
:returns: single matching file
:raises: AssertionError if there is not strictly one match for the pattern | taca_ngi_pipeline/deliver/deliver.py | find_from_files_to_deliver | ssjunnebo/taca-ngi-pipeline | 2 | python | def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to_deliver` for files matching the provided pattern\n :param pattern: the regex pattern to search for\n :returns: single matching file\n :raises: AssertionError if there is not strictly one mat... | def find_from_files_to_deliver(pattern):
' Searches the nested list of `files_to_deliver` for files matching the provided pattern\n :param pattern: the regex pattern to search for\n :returns: single matching file\n :raises: AssertionError if there is not strictly one mat... |
269c231269c4853da896e90cbedba2c8ed0772cd25c995055c80fe431db4f2dc | @staticmethod
def _pop_context() -> 'IconScoreContext':
'Delete the last pushed context of the current thread\n '
context_stack: List['IconScoreContext'] = getattr(_thread_local_data, 'context_stack', None)
if ((context_stack is not None) and (len(context_stack) > 0)):
return context_stack.po... | Delete the last pushed context of the current thread | iconee/pyexec/iconscore/icon_score_context.py | _pop_context | geometry-labs/goloop | 47 | python | @staticmethod
def _pop_context() -> 'IconScoreContext':
'\n '
context_stack: List['IconScoreContext'] = getattr(_thread_local_data, 'context_stack', None)
if ((context_stack is not None) and (len(context_stack) > 0)):
return context_stack.pop()
else:
raise AssertionError('Failed t... | @staticmethod
def _pop_context() -> 'IconScoreContext':
'\n '
context_stack: List['IconScoreContext'] = getattr(_thread_local_data, 'context_stack', None)
if ((context_stack is not None) and (len(context_stack) > 0)):
return context_stack.pop()
else:
raise AssertionError('Failed t... |
02f12d9103a0ee5a09edf52f83afdd0f83c7c72e259c3de3a7df5c40cb3affc7 | def task_generator(tasks, generators) -> list:
'\n Use a list of TaskGen and a list of task templates to generate different tasks.\n\n For examples:\n\n There are 3 task templates a,b,c and 2 TaskGen A,B. A will generates 2 tasks from a template and B will generates 3 tasks from a template.\n ta... | Use a list of TaskGen and a list of task templates to generate different tasks.
For examples:
There are 3 task templates a,b,c and 2 TaskGen A,B. A will generates 2 tasks from a template and B will generates 3 tasks from a template.
task_generator([a, b, c], [A, B]) will finally generate 3*2*3 = 18 tasks.
Pa... | qlib/workflow/task/gen.py | task_generator | Ckend/qlib | 8,637 | python | def task_generator(tasks, generators) -> list:
'\n Use a list of TaskGen and a list of task templates to generate different tasks.\n\n For examples:\n\n There are 3 task templates a,b,c and 2 TaskGen A,B. A will generates 2 tasks from a template and B will generates 3 tasks from a template.\n ta... | def task_generator(tasks, generators) -> list:
'\n Use a list of TaskGen and a list of task templates to generate different tasks.\n\n For examples:\n\n There are 3 task templates a,b,c and 2 TaskGen A,B. A will generates 2 tasks from a template and B will generates 3 tasks from a template.\n ta... |
da6686cc8b7cc45527f33a8335d855b964d44a89472347cae44da22cc1371def | def handler_mod(task: dict, rolling_gen):
"\n Help to modify the handler end time when using RollingGen\n It try to handle the following case\n - Hander's data end_time is earlier than dataset's test_data's segments.\n - To handle this, handler's data's end_time is extended.\n\n If the handler's... | Help to modify the handler end time when using RollingGen
It try to handle the following case
- Hander's data end_time is earlier than dataset's test_data's segments.
- To handle this, handler's data's end_time is extended.
If the handler's end_time is None, then it is not necessary to change it's end time.
Args... | qlib/workflow/task/gen.py | handler_mod | Ckend/qlib | 8,637 | python | def handler_mod(task: dict, rolling_gen):
"\n Help to modify the handler end time when using RollingGen\n It try to handle the following case\n - Hander's data end_time is earlier than dataset's test_data's segments.\n - To handle this, handler's data's end_time is extended.\n\n If the handler's... | def handler_mod(task: dict, rolling_gen):
"\n Help to modify the handler end time when using RollingGen\n It try to handle the following case\n - Hander's data end_time is earlier than dataset's test_data's segments.\n - To handle this, handler's data's end_time is extended.\n\n If the handler's... |
801661c3a4f341cd82f7cdd6faca80c51238fa9b421a276b397ead1c937e29a9 | @abc.abstractmethod
def generate(self, task: dict) -> List[dict]:
'\n Generate different tasks based on a task template\n\n Parameters\n ----------\n task: dict\n a task template\n\n Returns\n -------\n typing.List[dict]:\n A list of tasks\n ... | Generate different tasks based on a task template
Parameters
----------
task: dict
a task template
Returns
-------
typing.List[dict]:
A list of tasks | qlib/workflow/task/gen.py | generate | Ckend/qlib | 8,637 | python | @abc.abstractmethod
def generate(self, task: dict) -> List[dict]:
'\n Generate different tasks based on a task template\n\n Parameters\n ----------\n task: dict\n a task template\n\n Returns\n -------\n typing.List[dict]:\n A list of tasks\n ... | @abc.abstractmethod
def generate(self, task: dict) -> List[dict]:
'\n Generate different tasks based on a task template\n\n Parameters\n ----------\n task: dict\n a task template\n\n Returns\n -------\n typing.List[dict]:\n A list of tasks\n ... |
8046eb6b5faac886bc3f4fc1fd439fce9c5048c9aa1f66dd3b5aa5b6a39ce36b | def __call__(self, *args, **kwargs):
'\n This is just a syntactic sugar for generate\n '
return self.generate(*args, **kwargs) | This is just a syntactic sugar for generate | qlib/workflow/task/gen.py | __call__ | Ckend/qlib | 8,637 | python | def __call__(self, *args, **kwargs):
'\n \n '
return self.generate(*args, **kwargs) | def __call__(self, *args, **kwargs):
'\n \n '
return self.generate(*args, **kwargs)<|docstring|>This is just a syntactic sugar for generate<|endoftext|> |
d04891711f9e554d78508f9307cd891ee8ed5bf78854e3c89edd22a80956afd5 | def __init__(self, step: int=40, rtype: str=ROLL_EX, ds_extra_mod_func: Union[(None, Callable)]=handler_mod):
'\n Generate tasks for rolling\n\n Parameters\n ----------\n step : int\n step to rolling\n rtype : str\n rolling type (expanding, sliding)\n ... | Generate tasks for rolling
Parameters
----------
step : int
step to rolling
rtype : str
rolling type (expanding, sliding)
ds_extra_mod_func: Callable
A method like: handler_mod(task: dict, rg: RollingGen)
Do some extra action after generating a task. For example, use ``handler_mod`` to modify the end t... | qlib/workflow/task/gen.py | __init__ | Ckend/qlib | 8,637 | python | def __init__(self, step: int=40, rtype: str=ROLL_EX, ds_extra_mod_func: Union[(None, Callable)]=handler_mod):
'\n Generate tasks for rolling\n\n Parameters\n ----------\n step : int\n step to rolling\n rtype : str\n rolling type (expanding, sliding)\n ... | def __init__(self, step: int=40, rtype: str=ROLL_EX, ds_extra_mod_func: Union[(None, Callable)]=handler_mod):
'\n Generate tasks for rolling\n\n Parameters\n ----------\n step : int\n step to rolling\n rtype : str\n rolling type (expanding, sliding)\n ... |
0bc4b4c88cd5cce627094362434d8526b0c375415a703176ca5010e9d39e2a4b | def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]:
'\n generating following rolling tasks for `task` until test_end\n\n Parameters\n ----------\n task : dict\n Qlib task format\n test_end : pd.Timestamp\n the latest rolling task ... | generating following rolling tasks for `task` until test_end
Parameters
----------
task : dict
Qlib task format
test_end : pd.Timestamp
the latest rolling task includes `test_end`
Returns
-------
List[dict]:
the following tasks of `task`(`task` itself is excluded) | qlib/workflow/task/gen.py | gen_following_tasks | Ckend/qlib | 8,637 | python | def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]:
'\n generating following rolling tasks for `task` until test_end\n\n Parameters\n ----------\n task : dict\n Qlib task format\n test_end : pd.Timestamp\n the latest rolling task ... | def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]:
'\n generating following rolling tasks for `task` until test_end\n\n Parameters\n ----------\n task : dict\n Qlib task format\n test_end : pd.Timestamp\n the latest rolling task ... |
7159c4e813d65fe9a7b868f2002d1c40fbda674419962c11af71d41855adc4ae | def generate(self, task: dict) -> List[dict]:
'\n Converting the task into a rolling task.\n\n Parameters\n ----------\n task: dict\n A dict describing a task. For example.\n\n .. code-block:: python\n\n DEFAULT_TASK = {\n "model": ... | Converting the task into a rolling task.
Parameters
----------
task: dict
A dict describing a task. For example.
.. code-block:: python
DEFAULT_TASK = {
"model": {
"class": "LGBModel",
"module_path": "qlib.contrib.model.gbdt",
},
"da... | qlib/workflow/task/gen.py | generate | Ckend/qlib | 8,637 | python | def generate(self, task: dict) -> List[dict]:
'\n Converting the task into a rolling task.\n\n Parameters\n ----------\n task: dict\n A dict describing a task. For example.\n\n .. code-block:: python\n\n DEFAULT_TASK = {\n "model": ... | def generate(self, task: dict) -> List[dict]:
'\n Converting the task into a rolling task.\n\n Parameters\n ----------\n task: dict\n A dict describing a task. For example.\n\n .. code-block:: python\n\n DEFAULT_TASK = {\n "model": ... |
0560e28f46031ec338b500ed6350c2bb2c3d4e0c934e2d150e16b2d830421876 | def __init__(self, horizon: List[int]=[5], label_leak_n=2):
'\n This task generator tries to genrate tasks for different horizons based on an existing task\n\n Parameters\n ----------\n horizon : List[int]\n the possible horizons of the tasks\n label_leak_n : int\n ... | This task generator tries to genrate tasks for different horizons based on an existing task
Parameters
----------
horizon : List[int]
the possible horizons of the tasks
label_leak_n : int
How many future days it will take to get complete label after the day making prediction
For example:
- User make pr... | qlib/workflow/task/gen.py | __init__ | Ckend/qlib | 8,637 | python | def __init__(self, horizon: List[int]=[5], label_leak_n=2):
'\n This task generator tries to genrate tasks for different horizons based on an existing task\n\n Parameters\n ----------\n horizon : List[int]\n the possible horizons of the tasks\n label_leak_n : int\n ... | def __init__(self, horizon: List[int]=[5], label_leak_n=2):
'\n This task generator tries to genrate tasks for different horizons based on an existing task\n\n Parameters\n ----------\n horizon : List[int]\n the possible horizons of the tasks\n label_leak_n : int\n ... |
3467f0b1d61f0289505fbdce736615a6e034d7e01389ddc445b6df3f55146fa5 | @abc.abstractmethod
def set_horizon(self, task: dict, hr: int):
"\n This method is designed to change the task **in place**\n\n Parameters\n ----------\n task : dict\n Qlib's task\n hr : int\n the horizon of task\n " | This method is designed to change the task **in place**
Parameters
----------
task : dict
Qlib's task
hr : int
the horizon of task | qlib/workflow/task/gen.py | set_horizon | Ckend/qlib | 8,637 | python | @abc.abstractmethod
def set_horizon(self, task: dict, hr: int):
"\n This method is designed to change the task **in place**\n\n Parameters\n ----------\n task : dict\n Qlib's task\n hr : int\n the horizon of task\n " | @abc.abstractmethod
def set_horizon(self, task: dict, hr: int):
"\n This method is designed to change the task **in place**\n\n Parameters\n ----------\n task : dict\n Qlib's task\n hr : int\n the horizon of task\n "<|docstring|>This method is designed... |
adaee936215952b666356d63abebcf388c87215cccc0f2e5fbf3ae8aaf1e9917 | def orthogonal(shape):
'Orthogonal initilaizer.'
flat_shape = (shape[0], np.prod(shape[1:]))
a = np.random.normal(0.0, 1.0, flat_shape)
(u, _, v) = np.linalg.svd(a, full_matrices=False)
q = (u if (u.shape == flat_shape) else v)
return q.reshape(shape) | Orthogonal initilaizer. | magenta/models/sketch_rnn/rnn.py | orthogonal | sandutsar/magenta | 16,143 | python | def orthogonal(shape):
flat_shape = (shape[0], np.prod(shape[1:]))
a = np.random.normal(0.0, 1.0, flat_shape)
(u, _, v) = np.linalg.svd(a, full_matrices=False)
q = (u if (u.shape == flat_shape) else v)
return q.reshape(shape) | def orthogonal(shape):
flat_shape = (shape[0], np.prod(shape[1:]))
a = np.random.normal(0.0, 1.0, flat_shape)
(u, _, v) = np.linalg.svd(a, full_matrices=False)
q = (u if (u.shape == flat_shape) else v)
return q.reshape(shape)<|docstring|>Orthogonal initilaizer.<|endoftext|> |
af8502874652738b74f1a89d126f04d4bce4ce04e7c415317c255a4f99e1d9a0 | def orthogonal_initializer(scale=1.0):
'Orthogonal initializer.'
def _initializer(shape, dtype=tf.float32, partition_info=None):
return tf.constant((orthogonal(shape) * scale), dtype)
return _initializer | Orthogonal initializer. | magenta/models/sketch_rnn/rnn.py | orthogonal_initializer | sandutsar/magenta | 16,143 | python | def orthogonal_initializer(scale=1.0):
def _initializer(shape, dtype=tf.float32, partition_info=None):
return tf.constant((orthogonal(shape) * scale), dtype)
return _initializer | def orthogonal_initializer(scale=1.0):
def _initializer(shape, dtype=tf.float32, partition_info=None):
return tf.constant((orthogonal(shape) * scale), dtype)
return _initializer<|docstring|>Orthogonal initializer.<|endoftext|> |
9f263aa8d4faf377f69410218024db5fdf4c6662111358e7c810fe315a37dae1 | def lstm_ortho_initializer(scale=1.0):
'LSTM orthogonal initializer.'
def _initializer(shape, dtype=tf.float32, partition_info=None):
size_x = shape[0]
size_h = (shape[1] // 4)
t = np.zeros(shape)
t[(:, :size_h)] = (orthogonal([size_x, size_h]) * scale)
t[(:, size_h:(siz... | LSTM orthogonal initializer. | magenta/models/sketch_rnn/rnn.py | lstm_ortho_initializer | sandutsar/magenta | 16,143 | python | def lstm_ortho_initializer(scale=1.0):
def _initializer(shape, dtype=tf.float32, partition_info=None):
size_x = shape[0]
size_h = (shape[1] // 4)
t = np.zeros(shape)
t[(:, :size_h)] = (orthogonal([size_x, size_h]) * scale)
t[(:, size_h:(size_h * 2))] = (orthogonal([size... | def lstm_ortho_initializer(scale=1.0):
def _initializer(shape, dtype=tf.float32, partition_info=None):
size_x = shape[0]
size_h = (shape[1] // 4)
t = np.zeros(shape)
t[(:, :size_h)] = (orthogonal([size_x, size_h]) * scale)
t[(:, size_h:(size_h * 2))] = (orthogonal([size... |
df2ef0fbb02e9a978950c77f93f147e41621ff1ce4d85f12813ab674e51345fc | def layer_norm_all(h, batch_size, base, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
'Layer Norm (faster version, but not using defun).'
h_reshape = tf.reshape(h, [batch_size, base, num_units])
mean = tf.reduce_mean(h_reshape, [2], keep_dims=True)
var = tf.... | Layer Norm (faster version, but not using defun). | magenta/models/sketch_rnn/rnn.py | layer_norm_all | sandutsar/magenta | 16,143 | python | def layer_norm_all(h, batch_size, base, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
h_reshape = tf.reshape(h, [batch_size, base, num_units])
mean = tf.reduce_mean(h_reshape, [2], keep_dims=True)
var = tf.reduce_mean(tf.square((h_reshape - mean)), [2], kee... | def layer_norm_all(h, batch_size, base, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
h_reshape = tf.reshape(h, [batch_size, base, num_units])
mean = tf.reduce_mean(h_reshape, [2], keep_dims=True)
var = tf.reduce_mean(tf.square((h_reshape - mean)), [2], kee... |
b610bf42c3b5e102a0b5972d8041e8afcf6ef1bc6d8d616555f727a443af8ea3 | def layer_norm(x, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
'Calculate layer norm.'
axes = [1]
mean = tf.reduce_mean(x, axes, keep_dims=True)
x_shifted = (x - mean)
var = tf.reduce_mean(tf.square(x_shifted), axes, keep_dims=True)
inv_std = tf.rsq... | Calculate layer norm. | magenta/models/sketch_rnn/rnn.py | layer_norm | sandutsar/magenta | 16,143 | python | def layer_norm(x, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
axes = [1]
mean = tf.reduce_mean(x, axes, keep_dims=True)
x_shifted = (x - mean)
var = tf.reduce_mean(tf.square(x_shifted), axes, keep_dims=True)
inv_std = tf.rsqrt((var + epsilon))
... | def layer_norm(x, num_units, scope='layer_norm', reuse=False, gamma_start=1.0, epsilon=0.001, use_bias=True):
axes = [1]
mean = tf.reduce_mean(x, axes, keep_dims=True)
x_shifted = (x - mean)
var = tf.reduce_mean(tf.square(x_shifted), axes, keep_dims=True)
inv_std = tf.rsqrt((var + epsilon))
... |
69ac0f3c8f00d3b737cd4a878f5a5ce3e182926103776125a113c4a0f861fe8d | def super_linear(x, output_size, scope=None, reuse=False, init_w='ortho', weight_start=0.0, use_bias=True, bias_start=0.0, input_size=None):
'Performs linear operation. Uses ortho init defined earlier.'
shape = x.get_shape().as_list()
with tf.variable_scope((scope or 'linear')):
if reuse:
... | Performs linear operation. Uses ortho init defined earlier. | magenta/models/sketch_rnn/rnn.py | super_linear | sandutsar/magenta | 16,143 | python | def super_linear(x, output_size, scope=None, reuse=False, init_w='ortho', weight_start=0.0, use_bias=True, bias_start=0.0, input_size=None):
shape = x.get_shape().as_list()
with tf.variable_scope((scope or 'linear')):
if reuse:
tf.get_variable_scope().reuse_variables()
w_init = ... | def super_linear(x, output_size, scope=None, reuse=False, init_w='ortho', weight_start=0.0, use_bias=True, bias_start=0.0, input_size=None):
shape = x.get_shape().as_list()
with tf.variable_scope((scope or 'linear')):
if reuse:
tf.get_variable_scope().reuse_variables()
w_init = ... |
96fa6fd5e923435b730841919fbd593555302fad3cf8ae516da1939838ce11d4 | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9):
'Initialize the Layer Norm LSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cell.\n forget_bias: float, The bias added to forget gates (default 1.0).\n use_recurrent_dropout: W... | Initialize the Layer Norm LSTM cell.
Args:
num_units: int, The number of units in the LSTM cell.
forget_bias: float, The bias added to forget gates (default 1.0).
use_recurrent_dropout: Whether to use Recurrent Dropout (default False)
dropout_keep_prob: float, dropout keep probability (default 0.90) | magenta/models/sketch_rnn/rnn.py | __init__ | sandutsar/magenta | 16,143 | python | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9):
'Initialize the Layer Norm LSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cell.\n forget_bias: float, The bias added to forget gates (default 1.0).\n use_recurrent_dropout: W... | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9):
'Initialize the Layer Norm LSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cell.\n forget_bias: float, The bias added to forget gates (default 1.0).\n use_recurrent_dropout: W... |
4a9a79cf09352d4bd585eb7b2589ae2cc3eb05ba50b96518412667ffda31f2cb | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9, use_layer_norm=True, hyper_num_units=256, hyper_embedding_size=32, hyper_use_recurrent_dropout=False):
'Initialize the Layer Norm HyperLSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cel... | Initialize the Layer Norm HyperLSTM cell.
Args:
num_units: int, The number of units in the LSTM cell.
forget_bias: float, The bias added to forget gates (default 1.0).
use_recurrent_dropout: Whether to use Recurrent Dropout (default False)
dropout_keep_prob: float, dropout keep probability (default 0.90)
use... | magenta/models/sketch_rnn/rnn.py | __init__ | sandutsar/magenta | 16,143 | python | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9, use_layer_norm=True, hyper_num_units=256, hyper_embedding_size=32, hyper_use_recurrent_dropout=False):
'Initialize the Layer Norm HyperLSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cel... | def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9, use_layer_norm=True, hyper_num_units=256, hyper_embedding_size=32, hyper_use_recurrent_dropout=False):
'Initialize the Layer Norm HyperLSTM cell.\n\n Args:\n num_units: int, The number of units in the LSTM cel... |
1ac9d407c931f74ca6f51313f43f64006f32cb9f8d891c32e75c1be5a5452665 | def generate_parse_fn_annotation(annotation):
'Return value parser base on annotation.'
callee = generate_parse_fn_annotation
parse_fn = None
if isinstance(annotation, str):
annotation = annotation.strip("'").strip('"')
special = {}
if (annotation in special):
raise N... | Return value parser base on annotation. | fire/parser_annotations.py | generate_parse_fn_annotation | loynoir/python-fire | 0 | python | def generate_parse_fn_annotation(annotation):
callee = generate_parse_fn_annotation
parse_fn = None
if isinstance(annotation, str):
annotation = annotation.strip("'").strip('"')
special = {}
if (annotation in special):
raise NotImplementedError('SpecialAnnotationType... | def generate_parse_fn_annotation(annotation):
callee = generate_parse_fn_annotation
parse_fn = None
if isinstance(annotation, str):
annotation = annotation.strip("'").strip('"')
special = {}
if (annotation in special):
raise NotImplementedError('SpecialAnnotationType... |
098fa9de13b97945a99029c7bf0040a13797f7426608a76ffd0c4d52813fef0d | def test_login_required(self):
'Test that login is required for retrieving ingredient.'
res = self.client.get(INGREDIENTS_URL)
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED) | Test that login is required for retrieving ingredient. | app/recipe/tests/test_ingredient.py | test_login_required | danielotieno/recipe-app-api | 0 | python | def test_login_required(self):
res = self.client.get(INGREDIENTS_URL)
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED) | def test_login_required(self):
res = self.client.get(INGREDIENTS_URL)
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)<|docstring|>Test that login is required for retrieving ingredient.<|endoftext|> |
83fb78015e315329e01a19a47bfb7d7a9262aa926b0dd21294381f2e887f73be | def test_retrieve_ingredient_list(self):
'Test retrieving ingredient list.'
Ingredient.objects.create(user=self.user, name='Cucumber')
Ingredient.objects.create(user=self.user, name='Salt')
res = self.client.get(INGREDIENTS_URL)
ingredients = Ingredient.objects.all().order_by('-name')
serializer... | Test retrieving ingredient list. | app/recipe/tests/test_ingredient.py | test_retrieve_ingredient_list | danielotieno/recipe-app-api | 0 | python | def test_retrieve_ingredient_list(self):
Ingredient.objects.create(user=self.user, name='Cucumber')
Ingredient.objects.create(user=self.user, name='Salt')
res = self.client.get(INGREDIENTS_URL)
ingredients = Ingredient.objects.all().order_by('-name')
serializer = IngredientSerializer(ingredient... | def test_retrieve_ingredient_list(self):
Ingredient.objects.create(user=self.user, name='Cucumber')
Ingredient.objects.create(user=self.user, name='Salt')
res = self.client.get(INGREDIENTS_URL)
ingredients = Ingredient.objects.all().order_by('-name')
serializer = IngredientSerializer(ingredient... |
69aabd0417c07e3542a81ffd388af27d972a00ad1d74405dacee42d63f218c85 | def test_ingredients_limted_to_user(self):
'Test that ingredients return are for authenticated user.'
user2 = get_user_model().objects.create_user('example@example.com', 'userpassword')
Ingredient.objects.create(user=user2, name='Vineger')
ingredient = Ingredient.objects.create(user=self.user, name='Tum... | Test that ingredients return are for authenticated user. | app/recipe/tests/test_ingredient.py | test_ingredients_limted_to_user | danielotieno/recipe-app-api | 0 | python | def test_ingredients_limted_to_user(self):
user2 = get_user_model().objects.create_user('example@example.com', 'userpassword')
Ingredient.objects.create(user=user2, name='Vineger')
ingredient = Ingredient.objects.create(user=self.user, name='Tumeric')
res = self.client.get(INGREDIENTS_URL)
self... | def test_ingredients_limted_to_user(self):
user2 = get_user_model().objects.create_user('example@example.com', 'userpassword')
Ingredient.objects.create(user=user2, name='Vineger')
ingredient = Ingredient.objects.create(user=self.user, name='Tumeric')
res = self.client.get(INGREDIENTS_URL)
self... |
943fdfeb0232b20fe388d3fe957fe598b76544177fb21ac56eea1104114d6375 | def test_create_ingredient_successful(self):
'Test creating a new ingredient.'
payload = {'name': 'Test Ingredient'}
self.client.post(INGREDIENTS_URL, payload)
exists = Ingredient.objects.filter(user=self.user, name=payload['name']).exists()
self.assertTrue(exists) | Test creating a new ingredient. | app/recipe/tests/test_ingredient.py | test_create_ingredient_successful | danielotieno/recipe-app-api | 0 | python | def test_create_ingredient_successful(self):
payload = {'name': 'Test Ingredient'}
self.client.post(INGREDIENTS_URL, payload)
exists = Ingredient.objects.filter(user=self.user, name=payload['name']).exists()
self.assertTrue(exists) | def test_create_ingredient_successful(self):
payload = {'name': 'Test Ingredient'}
self.client.post(INGREDIENTS_URL, payload)
exists = Ingredient.objects.filter(user=self.user, name=payload['name']).exists()
self.assertTrue(exists)<|docstring|>Test creating a new ingredient.<|endoftext|> |
867878fce044eb318a7584bac854bed2a3e89e3b62105eb79eacaca60227050f | def test_create_ingredient_invalid(self):
'Test creating a new ingredient with invalid payload.'
payload = {'name': ''}
res = self.client.post(INGREDIENTS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | Test creating a new ingredient with invalid payload. | app/recipe/tests/test_ingredient.py | test_create_ingredient_invalid | danielotieno/recipe-app-api | 0 | python | def test_create_ingredient_invalid(self):
payload = {'name': }
res = self.client.post(INGREDIENTS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | def test_create_ingredient_invalid(self):
payload = {'name': }
res = self.client.post(INGREDIENTS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)<|docstring|>Test creating a new ingredient with invalid payload.<|endoftext|> |
01f86ab4ff90a01d8a7017c078af7290ebf2537095b7ff096733e4c9197d9d2a | def test_retrieve_ingredients_assigned_to_recipes(self):
'Test filtering ingredients by those assigned to recipes.'
ingredient1 = Ingredient.objects.create(user=self.user, name='Apples')
ingredient2 = Ingredient.objects.create(user=self.user, name='Turkey')
recipe = Recipe.objects.create(title='Apple Cr... | Test filtering ingredients by those assigned to recipes. | app/recipe/tests/test_ingredient.py | test_retrieve_ingredients_assigned_to_recipes | danielotieno/recipe-app-api | 0 | python | def test_retrieve_ingredients_assigned_to_recipes(self):
ingredient1 = Ingredient.objects.create(user=self.user, name='Apples')
ingredient2 = Ingredient.objects.create(user=self.user, name='Turkey')
recipe = Recipe.objects.create(title='Apple Crumble', time_minutes=20.0, price=48.0, user=self.user)
... | def test_retrieve_ingredients_assigned_to_recipes(self):
ingredient1 = Ingredient.objects.create(user=self.user, name='Apples')
ingredient2 = Ingredient.objects.create(user=self.user, name='Turkey')
recipe = Recipe.objects.create(title='Apple Crumble', time_minutes=20.0, price=48.0, user=self.user)
... |
98b19d05c5b019d134e502342c85c5f7657ce43369a4f72f50c1b291d58286ab | def test_artifacttype_list_not_logged_in(self):
' test list view '
destination = ('/login/?next=' + urllib.parse.quote('/artifacts/artifacttype/', safe=''))
response = self.client.get('/artifacts/artifacttype/', follow=True)
self.assertRedirects(response, destination, status_code=302, target_status_code... | test list view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_list_not_logged_in | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_list_not_logged_in(self):
' '
destination = ('/login/?next=' + urllib.parse.quote('/artifacts/artifacttype/', safe=))
response = self.client.get('/artifacts/artifacttype/', follow=True)
self.assertRedirects(response, destination, status_code=302, target_status_code=200) | def test_artifacttype_list_not_logged_in(self):
' '
destination = ('/login/?next=' + urllib.parse.quote('/artifacts/artifacttype/', safe=))
response = self.client.get('/artifacts/artifacttype/', follow=True)
self.assertRedirects(response, destination, status_code=302, target_status_code=200)<|docstring... |
81548fb12fc669c660cfacc9d046da8dfd35f04d874528fcc7b6c2846715db42 | def test_artifacttype_list_logged_in(self):
' test list view '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(response.status_code, 200) | test list view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_list_logged_in | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_list_logged_in(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(response.status_code, 200) | def test_artifacttype_list_logged_in(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(response.status_code, 200)<|docstring|>test list view<|endoftext|> |
ddc28cf6f976869da89cd3afb674017c87e71f75016f86486879b8cbbf183730 | def test_artifacttype_list_template(self):
' test list view '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertTemplateUsed(response, 'dfirtrack_artifacts/artifacttype/artifacttype_list.html') | test list view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_list_template | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_list_template(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertTemplateUsed(response, 'dfirtrack_artifacts/artifacttype/artifacttype_list.html') | def test_artifacttype_list_template(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertTemplateUsed(response, 'dfirtrack_artifacts/artifacttype/artifacttype_list.html')<|docstring|>test list v... |
f57a081f5572f7029e7106d7c9aea1d894e3a295b8c00805fee5d677f9ee0431 | def test_artifacttype_list_get_user_context(self):
' test list view '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(str(response.context['user']), 'testuser_artifacttype') | test list view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_list_get_user_context | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_list_get_user_context(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(str(response.context['user']), 'testuser_artifacttype') | def test_artifacttype_list_get_user_context(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get('/artifacts/artifacttype/')
self.assertEqual(str(response.context['user']), 'testuser_artifacttype')<|docstring|>test list view<|endofte... |
bf39db68215cafcc2f881100b6aceb2545dae46b564747e94d85563fe2dcbfb1 | def test_artifacttype_list_redirect(self):
' test list view '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote('/artifacts/artifacttype/', safe='/')
response = self.client.get('/artifacts/artifacttype', follow=True)
self.assertRedi... | test list view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_list_redirect | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_list_redirect(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote('/artifacts/artifacttype/', safe='/')
response = self.client.get('/artifacts/artifacttype', follow=True)
self.assertRedirects(response... | def test_artifacttype_list_redirect(self):
' '
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote('/artifacts/artifacttype/', safe='/')
response = self.client.get('/artifacts/artifacttype', follow=True)
self.assertRedirects(response... |
523919dce5644b362d966ccc43590accb31a46ac6d9fb5d658d78d6e65b5b1f0 | def test_artifacttype_detail_not_logged_in(self):
' test detail view '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
destination = ('/login/?next=' + urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifacttype_id)) + '/'), safe=''))
response =... | test detail view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_detail_not_logged_in | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_detail_not_logged_in(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
destination = ('/login/?next=' + urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifacttype_id)) + '/'), safe=))
response = self.client.get((... | def test_artifacttype_detail_not_logged_in(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
destination = ('/login/?next=' + urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifacttype_id)) + '/'), safe=))
response = self.client.get((... |
4d246ecac2d8b4e93ed8f45c9d3df73dbf7aaf14e543c8ad797698b5ed2a4dca | def test_artifacttype_detail_logged_in(self):
' test detail view '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artif... | test detail view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_detail_logged_in | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_detail_logged_in(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifa... | def test_artifacttype_detail_logged_in(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifa... |
bbfc8b881412b75409fa7865f72e9f8c06c951f9486ac6bb70b10124a7634a7c | def test_artifacttype_detail_template(self):
' test detail view '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifa... | test detail view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_detail_template | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_detail_template(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifac... | def test_artifacttype_detail_template(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1.artifac... |
68b03135d2529cceb52a2b2ae41c3391a31e19b55fb2c6aa0121b84b45803ade | def test_artifacttype_detail_get_user_context(self):
' test detail view '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + st... | test detail view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_detail_get_user_context | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_detail_get_user_context(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1... | def test_artifacttype_detail_get_user_context(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
response = self.client.get((('/artifacts/artifacttype/detail/' + str(artifacttype_1... |
8db7d1504e72101cd874d7900260c46605dc9c47cf998fb2a5bef128dda52f0e | def test_artifacttype_detail_redirect(self):
' test detail view '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(... | test detail view | dfirtrack_artifacts/tests/artifacttype/test_artifacttype_views.py | test_artifacttype_detail_redirect | FabFaeb/dfirtrack | 1 | python | def test_artifacttype_detail_redirect(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(artifacttype_1.a... | def test_artifacttype_detail_redirect(self):
' '
artifacttype_1 = Artifacttype.objects.get(artifacttype_name='artifacttype_1')
self.client.login(username='testuser_artifacttype', password='5HxLPaA1wWbphTcd2C3S')
destination = urllib.parse.quote((('/artifacts/artifacttype/detail/' + str(artifacttype_1.a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.