id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
238,500 | CenterForOpenScience/sharepa | sharepa/analysis.py | bucket_to_dataframe | def bucket_to_dataframe(name, buckets, append_name=None):
'''A function that turns elasticsearch aggregation buckets into dataframes
:param name: The name of the bucket (will be a column in the dataframe)
:type name: str
:param bucket: a bucket from elasticsearch results
:type bucke... | python | def bucket_to_dataframe(name, buckets, append_name=None):
'''A function that turns elasticsearch aggregation buckets into dataframes
:param name: The name of the bucket (will be a column in the dataframe)
:type name: str
:param bucket: a bucket from elasticsearch results
:type bucke... | [
"def",
"bucket_to_dataframe",
"(",
"name",
",",
"buckets",
",",
"append_name",
"=",
"None",
")",
":",
"expanded_buckets",
"=",
"[",
"]",
"for",
"item",
"in",
"buckets",
":",
"if",
"type",
"(",
"item",
")",
"is",
"dict",
":",
"single_dict",
"=",
"item",
... | A function that turns elasticsearch aggregation buckets into dataframes
:param name: The name of the bucket (will be a column in the dataframe)
:type name: str
:param bucket: a bucket from elasticsearch results
:type bucket: list[dict]
:returns: pandas.DataFrame | [
"A",
"function",
"that",
"turns",
"elasticsearch",
"aggregation",
"buckets",
"into",
"dataframes"
] | 5ea69b160080f0b9c655012f17fabaa1bcc02ae0 | https://github.com/CenterForOpenScience/sharepa/blob/5ea69b160080f0b9c655012f17fabaa1bcc02ae0/sharepa/analysis.py#L4-L25 |
238,501 | CenterForOpenScience/sharepa | sharepa/analysis.py | agg_to_two_dim_dataframe | def agg_to_two_dim_dataframe(agg):
'''A function that takes an elasticsearch response with aggregation and returns the names of all bucket value pairs
:param agg: an aggregation from elasticsearch results
:type agg: elasticsearch response.aggregation.agg_name object
:returns: pandas data fr... | python | def agg_to_two_dim_dataframe(agg):
'''A function that takes an elasticsearch response with aggregation and returns the names of all bucket value pairs
:param agg: an aggregation from elasticsearch results
:type agg: elasticsearch response.aggregation.agg_name object
:returns: pandas data fr... | [
"def",
"agg_to_two_dim_dataframe",
"(",
"agg",
")",
":",
"expanded_agg",
"=",
"[",
"]",
"for",
"bucket",
"in",
"agg",
".",
"buckets",
":",
"bucket_as_dict",
"=",
"bucket",
".",
"to_dict",
"(",
")",
"if",
"dict",
"not",
"in",
"[",
"type",
"(",
"item",
"... | A function that takes an elasticsearch response with aggregation and returns the names of all bucket value pairs
:param agg: an aggregation from elasticsearch results
:type agg: elasticsearch response.aggregation.agg_name object
:returns: pandas data frame of one or two dimetions depending on i... | [
"A",
"function",
"that",
"takes",
"an",
"elasticsearch",
"response",
"with",
"aggregation",
"and",
"returns",
"the",
"names",
"of",
"all",
"bucket",
"value",
"pairs"
] | 5ea69b160080f0b9c655012f17fabaa1bcc02ae0 | https://github.com/CenterForOpenScience/sharepa/blob/5ea69b160080f0b9c655012f17fabaa1bcc02ae0/sharepa/analysis.py#L28-L55 |
238,502 | CenterForOpenScience/sharepa | sharepa/analysis.py | merge_dataframes | def merge_dataframes(*dfs):
'''A helper function for merging two dataframes that have the same indices, duplicate columns are removed
:param dfs: a list of dataframes to be merged (note: they must have the same indices)
:type dfs: list[pandas.DataFrame]
:returns: pandas.DataFrame -- a merge... | python | def merge_dataframes(*dfs):
'''A helper function for merging two dataframes that have the same indices, duplicate columns are removed
:param dfs: a list of dataframes to be merged (note: they must have the same indices)
:type dfs: list[pandas.DataFrame]
:returns: pandas.DataFrame -- a merge... | [
"def",
"merge_dataframes",
"(",
"*",
"dfs",
")",
":",
"merged_dataframe",
"=",
"pd",
".",
"concat",
"(",
"dfs",
",",
"axis",
"=",
"1",
",",
"join_axes",
"=",
"[",
"dfs",
"[",
"0",
"]",
".",
"index",
"]",
")",
"return",
"merged_dataframe",
".",
"trans... | A helper function for merging two dataframes that have the same indices, duplicate columns are removed
:param dfs: a list of dataframes to be merged (note: they must have the same indices)
:type dfs: list[pandas.DataFrame]
:returns: pandas.DataFrame -- a merged dataframe | [
"A",
"helper",
"function",
"for",
"merging",
"two",
"dataframes",
"that",
"have",
"the",
"same",
"indices",
"duplicate",
"columns",
"are",
"removed"
] | 5ea69b160080f0b9c655012f17fabaa1bcc02ae0 | https://github.com/CenterForOpenScience/sharepa/blob/5ea69b160080f0b9c655012f17fabaa1bcc02ae0/sharepa/analysis.py#L58-L66 |
238,503 | etcher-be/elib_miz | elib_miz/miz.py | Miz.decode | def decode(self):
"""Decodes the mission files into dictionaries"""
LOGGER.debug('decoding lua tables')
if not self.zip_content:
self.unzip()
LOGGER.debug('reading map resource file')
with open(str(self.map_res_file), encoding=ENCODING) as stream:
self.... | python | def decode(self):
"""Decodes the mission files into dictionaries"""
LOGGER.debug('decoding lua tables')
if not self.zip_content:
self.unzip()
LOGGER.debug('reading map resource file')
with open(str(self.map_res_file), encoding=ENCODING) as stream:
self.... | [
"def",
"decode",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'decoding lua tables'",
")",
"if",
"not",
"self",
".",
"zip_content",
":",
"self",
".",
"unzip",
"(",
")",
"LOGGER",
".",
"debug",
"(",
"'reading map resource file'",
")",
"with",
"open"... | Decodes the mission files into dictionaries | [
"Decodes",
"the",
"mission",
"files",
"into",
"dictionaries"
] | f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7 | https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/miz.py#L245-L273 |
238,504 | etcher-be/elib_miz | elib_miz/miz.py | Miz.unzip | def unzip(self, overwrite: bool = False):
"""
Flattens a MIZ file into the temp dir
Args:
overwrite: allow overwriting exiting files
"""
if self.zip_content and not overwrite:
raise FileExistsError(str(self.temp_dir))
LOGGER.debug('unzipping mi... | python | def unzip(self, overwrite: bool = False):
"""
Flattens a MIZ file into the temp dir
Args:
overwrite: allow overwriting exiting files
"""
if self.zip_content and not overwrite:
raise FileExistsError(str(self.temp_dir))
LOGGER.debug('unzipping mi... | [
"def",
"unzip",
"(",
"self",
",",
"overwrite",
":",
"bool",
"=",
"False",
")",
":",
"if",
"self",
".",
"zip_content",
"and",
"not",
"overwrite",
":",
"raise",
"FileExistsError",
"(",
"str",
"(",
"self",
".",
"temp_dir",
")",
")",
"LOGGER",
".",
"debug"... | Flattens a MIZ file into the temp dir
Args:
overwrite: allow overwriting exiting files | [
"Flattens",
"a",
"MIZ",
"file",
"into",
"the",
"temp",
"dir"
] | f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7 | https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/miz.py#L315-L356 |
238,505 | luismsgomes/stringology | src/stringology/lis.py | lis | def lis(seq, indices=False):
'''longest increasing subsequence
>>> lis([1, 2, 5, 3, 4])
[1, 2, 3, 4]
'''
if not seq:
return []
# prevs[i] is the index of the previous element in the longest subsequence
# containing element i
prevs = [None] * len(seq)
# tails[i] is the pair (... | python | def lis(seq, indices=False):
'''longest increasing subsequence
>>> lis([1, 2, 5, 3, 4])
[1, 2, 3, 4]
'''
if not seq:
return []
# prevs[i] is the index of the previous element in the longest subsequence
# containing element i
prevs = [None] * len(seq)
# tails[i] is the pair (... | [
"def",
"lis",
"(",
"seq",
",",
"indices",
"=",
"False",
")",
":",
"if",
"not",
"seq",
":",
"return",
"[",
"]",
"# prevs[i] is the index of the previous element in the longest subsequence",
"# containing element i",
"prevs",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
... | longest increasing subsequence
>>> lis([1, 2, 5, 3, 4])
[1, 2, 3, 4] | [
"longest",
"increasing",
"subsequence"
] | c627dc5a0d4c6af10946040a6463d5495d39d960 | https://github.com/luismsgomes/stringology/blob/c627dc5a0d4c6af10946040a6463d5495d39d960/src/stringology/lis.py#L4-L34 |
238,506 | roboogle/gtkmvc3 | gtkmvco/gtkmvc3/support/factories.py | ModelFactory.__fix_bases | def __fix_bases(base_classes, have_mt):
"""This function check whether base_classes contains a Model
instance. If not, choose the best fitting class for
model. Furthermore, it makes the list in a cannonical
ordering form in a way that ic can be used as memoization
key"""
... | python | def __fix_bases(base_classes, have_mt):
"""This function check whether base_classes contains a Model
instance. If not, choose the best fitting class for
model. Furthermore, it makes the list in a cannonical
ordering form in a way that ic can be used as memoization
key"""
... | [
"def",
"__fix_bases",
"(",
"base_classes",
",",
"have_mt",
")",
":",
"fixed",
"=",
"list",
"(",
"base_classes",
")",
"contains_model",
"=",
"False",
"for",
"b",
"in",
"fixed",
":",
"if",
"isinstance",
"(",
"fixed",
",",
"Model",
")",
":",
"contains_model",... | This function check whether base_classes contains a Model
instance. If not, choose the best fitting class for
model. Furthermore, it makes the list in a cannonical
ordering form in a way that ic can be used as memoization
key | [
"This",
"function",
"check",
"whether",
"base_classes",
"contains",
"a",
"Model",
"instance",
".",
"If",
"not",
"choose",
"the",
"best",
"fitting",
"class",
"for",
"model",
".",
"Furthermore",
"it",
"makes",
"the",
"list",
"in",
"a",
"cannonical",
"ordering",
... | 63405fd8d2056be26af49103b13a8d5e57fe4dff | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/support/factories.py#L38-L65 |
238,507 | roboogle/gtkmvc3 | gtkmvco/gtkmvc3/support/factories.py | ModelFactory.make | def make(base_classes=(), have_mt=False):
"""Use this static method to build a model class that
possibly derives from other classes. If have_mt is True,
then returned class will take into account multi-threading
issues when dealing with observable properties."""
good_bc = ModelF... | python | def make(base_classes=(), have_mt=False):
"""Use this static method to build a model class that
possibly derives from other classes. If have_mt is True,
then returned class will take into account multi-threading
issues when dealing with observable properties."""
good_bc = ModelF... | [
"def",
"make",
"(",
"base_classes",
"=",
"(",
")",
",",
"have_mt",
"=",
"False",
")",
":",
"good_bc",
"=",
"ModelFactory",
".",
"__fix_bases",
"(",
"base_classes",
",",
"have_mt",
")",
"print",
"\"Base classes are:\"",
",",
"good_bc",
"key",
"=",
"\"\"",
"... | Use this static method to build a model class that
possibly derives from other classes. If have_mt is True,
then returned class will take into account multi-threading
issues when dealing with observable properties. | [
"Use",
"this",
"static",
"method",
"to",
"build",
"a",
"model",
"class",
"that",
"possibly",
"derives",
"from",
"other",
"classes",
".",
"If",
"have_mt",
"is",
"True",
"then",
"returned",
"class",
"will",
"take",
"into",
"account",
"multi",
"-",
"threading",... | 63405fd8d2056be26af49103b13a8d5e57fe4dff | https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/support/factories.py#L68-L82 |
238,508 | realestate-com-au/dashmat | dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py | _authentication | def _authentication(request_fun):
"""Decorator to handle autologin and authentication errors.
*request_fun* is a function taking no arguments that needs to
be run with this ``Context`` logged into Splunk.
``_authentication``'s behavior depends on whether the
``autologin`` field of ``Context`` is s... | python | def _authentication(request_fun):
"""Decorator to handle autologin and authentication errors.
*request_fun* is a function taking no arguments that needs to
be run with this ``Context`` logged into Splunk.
``_authentication``'s behavior depends on whether the
``autologin`` field of ``Context`` is s... | [
"def",
"_authentication",
"(",
"request_fun",
")",
":",
"@",
"wraps",
"(",
"request_fun",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"token",
"is",
"_NoAuthenticationToken",
":",
"# Not yet... | Decorator to handle autologin and authentication errors.
*request_fun* is a function taking no arguments that needs to
be run with this ``Context`` logged into Splunk.
``_authentication``'s behavior depends on whether the
``autologin`` field of ``Context`` is set to ``True`` or
``False``. If it's ... | [
"Decorator",
"to",
"handle",
"autologin",
"and",
"authentication",
"errors",
"."
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py#L191-L259 |
238,509 | realestate-com-au/dashmat | dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py | Context.get | def get(self, path_segment, owner=None, app=None, sharing=None, **query):
"""Performs a GET operation from the REST path segment with the given
namespace and query.
This method is named to match the HTTP method. ``get`` makes at least
one round trip to the server, one additional round t... | python | def get(self, path_segment, owner=None, app=None, sharing=None, **query):
"""Performs a GET operation from the REST path segment with the given
namespace and query.
This method is named to match the HTTP method. ``get`` makes at least
one round trip to the server, one additional round t... | [
"def",
"get",
"(",
"self",
",",
"path_segment",
",",
"owner",
"=",
"None",
",",
"app",
"=",
"None",
",",
"sharing",
"=",
"None",
",",
"*",
"*",
"query",
")",
":",
"path",
"=",
"self",
".",
"authority",
"+",
"self",
".",
"_abspath",
"(",
"path_segme... | Performs a GET operation from the REST path segment with the given
namespace and query.
This method is named to match the HTTP method. ``get`` makes at least
one round trip to the server, one additional round trip for each 303
status returned, and at most two additional round trips if
... | [
"Performs",
"a",
"GET",
"operation",
"from",
"the",
"REST",
"path",
"segment",
"with",
"the",
"given",
"namespace",
"and",
"query",
"."
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py#L533-L587 |
238,510 | realestate-com-au/dashmat | dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py | HttpLib.post | def post(self, url, headers=None, **kwargs):
"""Sends a POST request to a URL.
:param url: The URL.
:type url: ``string``
:param headers: A list of pairs specifying the headers for the HTTP
response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``).
... | python | def post(self, url, headers=None, **kwargs):
"""Sends a POST request to a URL.
:param url: The URL.
:type url: ``string``
:param headers: A list of pairs specifying the headers for the HTTP
response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``).
... | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"[",
"]",
"headers",
".",
"append",
"(",
"(",
"\"Content-Type\"",
",",
"\"application/x-www-form... | Sends a POST request to a URL.
:param url: The URL.
:type url: ``string``
:param headers: A list of pairs specifying the headers for the HTTP
response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``).
:type headers: ``list``
:param kwargs: Ad... | [
"Sends",
"a",
"POST",
"request",
"to",
"a",
"URL",
"."
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/binding.py#L1060-L1093 |
238,511 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.create_proxy_model | def create_proxy_model(self, model):
"""Create a sort filter proxy model for the given model
:param model: the model to wrap in a proxy
:type model: :class:`QtGui.QAbstractItemModel`
:returns: a new proxy model that can be used for sorting and filtering
:rtype: :class:`QtGui.QAb... | python | def create_proxy_model(self, model):
"""Create a sort filter proxy model for the given model
:param model: the model to wrap in a proxy
:type model: :class:`QtGui.QAbstractItemModel`
:returns: a new proxy model that can be used for sorting and filtering
:rtype: :class:`QtGui.QAb... | [
"def",
"create_proxy_model",
"(",
"self",
",",
"model",
")",
":",
"proxy",
"=",
"ReftrackSortFilterModel",
"(",
"self",
")",
"proxy",
".",
"setSourceModel",
"(",
"model",
")",
"model",
".",
"rowsInserted",
".",
"connect",
"(",
"self",
".",
"sort_model",
")",... | Create a sort filter proxy model for the given model
:param model: the model to wrap in a proxy
:type model: :class:`QtGui.QAbstractItemModel`
:returns: a new proxy model that can be used for sorting and filtering
:rtype: :class:`QtGui.QAbstractItemModel`
:raises: None | [
"Create",
"a",
"sort",
"filter",
"proxy",
"model",
"for",
"the",
"given",
"model"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L89-L101 |
238,512 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.setup_filter | def setup_filter(self, ):
"""Create a checkbox for every reftrack type so one can filter them
:returns: None
:rtype: None
:raises: None
"""
types = self.refobjinter.types.keys()
for i, t in enumerate(types):
cb = QtGui.QCheckBox("%s" % t)
... | python | def setup_filter(self, ):
"""Create a checkbox for every reftrack type so one can filter them
:returns: None
:rtype: None
:raises: None
"""
types = self.refobjinter.types.keys()
for i, t in enumerate(types):
cb = QtGui.QCheckBox("%s" % t)
... | [
"def",
"setup_filter",
"(",
"self",
",",
")",
":",
"types",
"=",
"self",
".",
"refobjinter",
".",
"types",
".",
"keys",
"(",
")",
"for",
"i",
",",
"t",
"in",
"enumerate",
"(",
"types",
")",
":",
"cb",
"=",
"QtGui",
".",
"QCheckBox",
"(",
"\"%s\"",
... | Create a checkbox for every reftrack type so one can filter them
:returns: None
:rtype: None
:raises: None | [
"Create",
"a",
"checkbox",
"for",
"every",
"reftrack",
"type",
"so",
"one",
"can",
"filter",
"them"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L127-L140 |
238,513 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.switch_showfilter_icon | def switch_showfilter_icon(self, toggled):
"""Switch the icon on the showfilter_tb
:param toggled: the state of the button
:type toggled: :class:`bool`
:returns: None
:rtype: None
:raises: None
"""
at = QtCore.Qt.DownArrow if toggled else QtCore.Qt.RightA... | python | def switch_showfilter_icon(self, toggled):
"""Switch the icon on the showfilter_tb
:param toggled: the state of the button
:type toggled: :class:`bool`
:returns: None
:rtype: None
:raises: None
"""
at = QtCore.Qt.DownArrow if toggled else QtCore.Qt.RightA... | [
"def",
"switch_showfilter_icon",
"(",
"self",
",",
"toggled",
")",
":",
"at",
"=",
"QtCore",
".",
"Qt",
".",
"DownArrow",
"if",
"toggled",
"else",
"QtCore",
".",
"Qt",
".",
"RightArrow",
"self",
".",
"showfilter_tb",
".",
"setArrowType",
"(",
"at",
")"
] | Switch the icon on the showfilter_tb
:param toggled: the state of the button
:type toggled: :class:`bool`
:returns: None
:rtype: None
:raises: None | [
"Switch",
"the",
"icon",
"on",
"the",
"showfilter_tb"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L142-L152 |
238,514 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.open_addnew_win | def open_addnew_win(self, *args, **kwargs):
"""Open a new window so the use can choose to add new reftracks
:returns: None
:rtype: None
:raises: NotImplementedError
"""
if self.reftrackadderwin:
self.reftrackadderwin.close()
self.reftrackadderwin = Re... | python | def open_addnew_win(self, *args, **kwargs):
"""Open a new window so the use can choose to add new reftracks
:returns: None
:rtype: None
:raises: NotImplementedError
"""
if self.reftrackadderwin:
self.reftrackadderwin.close()
self.reftrackadderwin = Re... | [
"def",
"open_addnew_win",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"reftrackadderwin",
":",
"self",
".",
"reftrackadderwin",
".",
"close",
"(",
")",
"self",
".",
"reftrackadderwin",
"=",
"ReftrackAdderWin",
"(",
... | Open a new window so the use can choose to add new reftracks
:returns: None
:rtype: None
:raises: NotImplementedError | [
"Open",
"a",
"new",
"window",
"so",
"the",
"use",
"can",
"choose",
"to",
"add",
"new",
"reftracks"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L154-L165 |
238,515 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.update_filter | def update_filter(self, *args, **kwargs):
"""Update the filter
:returns: None
:rtype: None
:raises: NotImplementedError
"""
forbidden_statuses = []
if not self.loaded_checkb.isChecked():
forbidden_statuses.append(reftrack.Reftrack.LOADED)
if n... | python | def update_filter(self, *args, **kwargs):
"""Update the filter
:returns: None
:rtype: None
:raises: NotImplementedError
"""
forbidden_statuses = []
if not self.loaded_checkb.isChecked():
forbidden_statuses.append(reftrack.Reftrack.LOADED)
if n... | [
"def",
"update_filter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"forbidden_statuses",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"loaded_checkb",
".",
"isChecked",
"(",
")",
":",
"forbidden_statuses",
".",
"append",
"(",
"reftrack... | Update the filter
:returns: None
:rtype: None
:raises: NotImplementedError | [
"Update",
"the",
"filter"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L176-L210 |
238,516 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackWin.sort_model | def sort_model(self, *args, **kwargs):
"""Sort the proxy model
:returns: None
:rtype: None
:raises: None
"""
self.proxy.sort(17) # sort the identifier
self.proxy.sort(2) # sort the element
self.proxy.sort(1) # sort the elementgrp
self.proxy.sor... | python | def sort_model(self, *args, **kwargs):
"""Sort the proxy model
:returns: None
:rtype: None
:raises: None
"""
self.proxy.sort(17) # sort the identifier
self.proxy.sort(2) # sort the element
self.proxy.sort(1) # sort the elementgrp
self.proxy.sor... | [
"def",
"sort_model",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"proxy",
".",
"sort",
"(",
"17",
")",
"# sort the identifier",
"self",
".",
"proxy",
".",
"sort",
"(",
"2",
")",
"# sort the element",
"self",
".",
"p... | Sort the proxy model
:returns: None
:rtype: None
:raises: None | [
"Sort",
"the",
"proxy",
"model"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L212-L222 |
238,517 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwin.py | ReftrackAdderWin.add_selected | def add_selected(self, ):
"""Create a new reftrack with the selected element and type and add it to the root.
:returns: None
:rtype: None
:raises: NotImplementedError
"""
browser = self.shot_browser if self.browser_tabw.currentIndex() == 1 else self.asset_browser
... | python | def add_selected(self, ):
"""Create a new reftrack with the selected element and type and add it to the root.
:returns: None
:rtype: None
:raises: NotImplementedError
"""
browser = self.shot_browser if self.browser_tabw.currentIndex() == 1 else self.asset_browser
... | [
"def",
"add_selected",
"(",
"self",
",",
")",
":",
"browser",
"=",
"self",
".",
"shot_browser",
"if",
"self",
".",
"browser_tabw",
".",
"currentIndex",
"(",
")",
"==",
"1",
"else",
"self",
".",
"asset_browser",
"selelements",
"=",
"browser",
".",
"selected... | Create a new reftrack with the selected element and type and add it to the root.
:returns: None
:rtype: None
:raises: NotImplementedError | [
"Create",
"a",
"new",
"reftrack",
"with",
"the",
"selected",
"element",
"and",
"type",
"and",
"add",
"it",
"to",
"the",
"root",
"."
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwin.py#L341-L362 |
238,518 | rvswift/EB | EB/builder/utilities/output.py | write_ensemble | def write_ensemble(ensemble, options):
"""
Prints out the ensemble composition at each size
"""
# set output file name
size = len(ensemble)
filename = '%s_%s_queries.csv' % (options.outname, size)
file = os.path.join(os.getcwd(), filename)
f = open(file, 'w')
out = ', '.join(ensemble)
... | python | def write_ensemble(ensemble, options):
"""
Prints out the ensemble composition at each size
"""
# set output file name
size = len(ensemble)
filename = '%s_%s_queries.csv' % (options.outname, size)
file = os.path.join(os.getcwd(), filename)
f = open(file, 'w')
out = ', '.join(ensemble)
... | [
"def",
"write_ensemble",
"(",
"ensemble",
",",
"options",
")",
":",
"# set output file name",
"size",
"=",
"len",
"(",
"ensemble",
")",
"filename",
"=",
"'%s_%s_queries.csv'",
"%",
"(",
"options",
".",
"outname",
",",
"size",
")",
"file",
"=",
"os",
".",
"... | Prints out the ensemble composition at each size | [
"Prints",
"out",
"the",
"ensemble",
"composition",
"at",
"each",
"size"
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/utilities/output.py#L157-L173 |
238,519 | siemens/django-dingos | dingos/templatetags/dingos_tags.py | lookup_blob | def lookup_blob(hash_value):
"""
Combines all given arguments to create clean title-tags values.
All arguments are divided by a " " seperator and HTML tags
are to be removed.
"""
try:
blob = BlobStorage.objects.get(sha256=hash_value)
except:
return "Blob not found"
return... | python | def lookup_blob(hash_value):
"""
Combines all given arguments to create clean title-tags values.
All arguments are divided by a " " seperator and HTML tags
are to be removed.
"""
try:
blob = BlobStorage.objects.get(sha256=hash_value)
except:
return "Blob not found"
return... | [
"def",
"lookup_blob",
"(",
"hash_value",
")",
":",
"try",
":",
"blob",
"=",
"BlobStorage",
".",
"objects",
".",
"get",
"(",
"sha256",
"=",
"hash_value",
")",
"except",
":",
"return",
"\"Blob not found\"",
"return",
"blob",
".",
"content"
] | Combines all given arguments to create clean title-tags values.
All arguments are divided by a " " seperator and HTML tags
are to be removed. | [
"Combines",
"all",
"given",
"arguments",
"to",
"create",
"clean",
"title",
"-",
"tags",
"values",
".",
"All",
"arguments",
"are",
"divided",
"by",
"a",
"seperator",
"and",
"HTML",
"tags",
"are",
"to",
"be",
"removed",
"."
] | 7154f75b06d2538568e2f2455a76f3d0db0b7d70 | https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/templatetags/dingos_tags.py#L241-L251 |
238,520 | ericflo/hurricane | hurricane/handlers/comet/handler.py | CometHandler.comet_view | def comet_view(self, request):
"""
This is dumb function, it just passes everything it gets into the
message stream. Something else in the stream should be responsible
for asynchronously figuring out what to do with all these messages.
"""
request_id = self.id_for_reques... | python | def comet_view(self, request):
"""
This is dumb function, it just passes everything it gets into the
message stream. Something else in the stream should be responsible
for asynchronously figuring out what to do with all these messages.
"""
request_id = self.id_for_reques... | [
"def",
"comet_view",
"(",
"self",
",",
"request",
")",
":",
"request_id",
"=",
"self",
".",
"id_for_request",
"(",
"request",
")",
"if",
"not",
"request_id",
":",
"request",
".",
"write",
"(",
"HttpResponse",
"(",
"403",
")",
".",
"as_bytes",
"(",
")",
... | This is dumb function, it just passes everything it gets into the
message stream. Something else in the stream should be responsible
for asynchronously figuring out what to do with all these messages. | [
"This",
"is",
"dumb",
"function",
"it",
"just",
"passes",
"everything",
"it",
"gets",
"into",
"the",
"message",
"stream",
".",
"Something",
"else",
"in",
"the",
"stream",
"should",
"be",
"responsible",
"for",
"asynchronously",
"figuring",
"out",
"what",
"to",
... | c192b711b2b1c06a386d1a1a47f538b13a659cde | https://github.com/ericflo/hurricane/blob/c192b711b2b1c06a386d1a1a47f538b13a659cde/hurricane/handlers/comet/handler.py#L90-L115 |
238,521 | mlavin/argyle | argyle/base.py | sshagent_run | def sshagent_run(cmd):
"""
Helper function.
Runs a command with SSH agent forwarding enabled.
Note:: Fabric (and paramiko) can't forward your SSH agent.
This helper uses your system's ssh to do so.
"""
# Handle context manager modifications
wrapped_cmd = _prefix_commands(_prefix_env_var... | python | def sshagent_run(cmd):
"""
Helper function.
Runs a command with SSH agent forwarding enabled.
Note:: Fabric (and paramiko) can't forward your SSH agent.
This helper uses your system's ssh to do so.
"""
# Handle context manager modifications
wrapped_cmd = _prefix_commands(_prefix_env_var... | [
"def",
"sshagent_run",
"(",
"cmd",
")",
":",
"# Handle context manager modifications",
"wrapped_cmd",
"=",
"_prefix_commands",
"(",
"_prefix_env_vars",
"(",
"cmd",
")",
",",
"'remote'",
")",
"try",
":",
"host",
",",
"port",
"=",
"env",
".",
"host_string",
".",
... | Helper function.
Runs a command with SSH agent forwarding enabled.
Note:: Fabric (and paramiko) can't forward your SSH agent.
This helper uses your system's ssh to do so. | [
"Helper",
"function",
".",
"Runs",
"a",
"command",
"with",
"SSH",
"agent",
"forwarding",
"enabled",
"."
] | 92cc6e1dd9b8e7cb41c5098a79d05e14b8243d72 | https://github.com/mlavin/argyle/blob/92cc6e1dd9b8e7cb41c5098a79d05e14b8243d72/argyle/base.py#L10-L32 |
238,522 | steenzout/python-serialization-json | steenzout/serialization/json/encoders.py | as_object | def as_object(obj):
"""Return a JSON serializable type for ``o``.
Args:
obj (:py:class:`object`): the object to be serialized.
Raises:
:py:class:`AttributeError`:
when ``o`` is not a Python object.
Returns:
(dict): JSON serializable type for the given object.
"... | python | def as_object(obj):
"""Return a JSON serializable type for ``o``.
Args:
obj (:py:class:`object`): the object to be serialized.
Raises:
:py:class:`AttributeError`:
when ``o`` is not a Python object.
Returns:
(dict): JSON serializable type for the given object.
"... | [
"def",
"as_object",
"(",
"obj",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'as_object(%s)'",
",",
"obj",
")",
"if",
"isinstance",
"(",
"obj",
",",
"datetime",
".",
"date",
")",
":",
"return",
"as_date",
"(",
"obj",
")",
"elif",
"hasattr",
"(",
"obj",
",... | Return a JSON serializable type for ``o``.
Args:
obj (:py:class:`object`): the object to be serialized.
Raises:
:py:class:`AttributeError`:
when ``o`` is not a Python object.
Returns:
(dict): JSON serializable type for the given object. | [
"Return",
"a",
"JSON",
"serializable",
"type",
"for",
"o",
"."
] | 583568e14cc02ba0bf711f56b8a0a3ad142c696d | https://github.com/steenzout/python-serialization-json/blob/583568e14cc02ba0bf711f56b8a0a3ad142c696d/steenzout/serialization/json/encoders.py#L29-L61 |
238,523 | steenzout/python-serialization-json | steenzout/serialization/json/encoders.py | as_date | def as_date(dat):
"""Return the RFC3339 UTC string representation of the given date and time.
Args:
dat (:py:class:`datetime.date`): the object/type to be serialized.
Raises:
TypeError:
when ``o`` is not an instance of ``datetime.date``.
Returns:
(str) JSON seriali... | python | def as_date(dat):
"""Return the RFC3339 UTC string representation of the given date and time.
Args:
dat (:py:class:`datetime.date`): the object/type to be serialized.
Raises:
TypeError:
when ``o`` is not an instance of ``datetime.date``.
Returns:
(str) JSON seriali... | [
"def",
"as_date",
"(",
"dat",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'as_date(%s)'",
",",
"dat",
")",
"return",
"strict_rfc3339",
".",
"timestamp_to_rfc3339_utcoffset",
"(",
"calendar",
".",
"timegm",
"(",
"dat",
".",
"timetuple",
"(",
")",
")",
")"
] | Return the RFC3339 UTC string representation of the given date and time.
Args:
dat (:py:class:`datetime.date`): the object/type to be serialized.
Raises:
TypeError:
when ``o`` is not an instance of ``datetime.date``.
Returns:
(str) JSON serializable type for the given ... | [
"Return",
"the",
"RFC3339",
"UTC",
"string",
"representation",
"of",
"the",
"given",
"date",
"and",
"time",
"."
] | 583568e14cc02ba0bf711f56b8a0a3ad142c696d | https://github.com/steenzout/python-serialization-json/blob/583568e14cc02ba0bf711f56b8a0a3ad142c696d/steenzout/serialization/json/encoders.py#L64-L80 |
238,524 | mrstephenneal/looptools | looptools/chunks.py | chunks | def chunks(iterable, chunk):
"""Yield successive n-sized chunks from an iterable."""
for i in range(0, len(iterable), chunk):
yield iterable[i:i + chunk] | python | def chunks(iterable, chunk):
"""Yield successive n-sized chunks from an iterable."""
for i in range(0, len(iterable), chunk):
yield iterable[i:i + chunk] | [
"def",
"chunks",
"(",
"iterable",
",",
"chunk",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"iterable",
")",
",",
"chunk",
")",
":",
"yield",
"iterable",
"[",
"i",
":",
"i",
"+",
"chunk",
"]"
] | Yield successive n-sized chunks from an iterable. | [
"Yield",
"successive",
"n",
"-",
"sized",
"chunks",
"from",
"an",
"iterable",
"."
] | c4ef88d78e0fb672d09a18de0aa0edd31fd4db72 | https://github.com/mrstephenneal/looptools/blob/c4ef88d78e0fb672d09a18de0aa0edd31fd4db72/looptools/chunks.py#L1-L4 |
238,525 | pbrisk/mathtoolspy | mathtoolspy/integration/simplex_integrator.py | SimplexIntegrator.integrate | def integrate(self, function, lower_bound, upper_bound):
"""
Calculates the integral of the given one dimensional function
in the interval from lower_bound to upper_bound, with the simplex integration method.
"""
ret = 0.0
n = self.nsteps
xStep = (float(upper_boun... | python | def integrate(self, function, lower_bound, upper_bound):
"""
Calculates the integral of the given one dimensional function
in the interval from lower_bound to upper_bound, with the simplex integration method.
"""
ret = 0.0
n = self.nsteps
xStep = (float(upper_boun... | [
"def",
"integrate",
"(",
"self",
",",
"function",
",",
"lower_bound",
",",
"upper_bound",
")",
":",
"ret",
"=",
"0.0",
"n",
"=",
"self",
".",
"nsteps",
"xStep",
"=",
"(",
"float",
"(",
"upper_bound",
")",
"-",
"float",
"(",
"lower_bound",
")",
")",
"... | Calculates the integral of the given one dimensional function
in the interval from lower_bound to upper_bound, with the simplex integration method. | [
"Calculates",
"the",
"integral",
"of",
"the",
"given",
"one",
"dimensional",
"function",
"in",
"the",
"interval",
"from",
"lower_bound",
"to",
"upper_bound",
"with",
"the",
"simplex",
"integration",
"method",
"."
] | d0d35b45d20f346ba8a755e53ed0aa182fab43dd | https://github.com/pbrisk/mathtoolspy/blob/d0d35b45d20f346ba8a755e53ed0aa182fab43dd/mathtoolspy/integration/simplex_integrator.py#L25-L44 |
238,526 | Brazelton-Lab/bio_utils | bio_utils/iterators/sam.py | sam_iter | def sam_iter(handle, start_line=None, headers=False):
"""Iterate over SAM file and return SAM entries
Args:
handle (file): SAM file handle, can be any iterator so long as it
it returns subsequent "lines" of a SAM entry
start_line (str): Next SAM entry, if 'handle' has been partiall... | python | def sam_iter(handle, start_line=None, headers=False):
"""Iterate over SAM file and return SAM entries
Args:
handle (file): SAM file handle, can be any iterator so long as it
it returns subsequent "lines" of a SAM entry
start_line (str): Next SAM entry, if 'handle' has been partiall... | [
"def",
"sam_iter",
"(",
"handle",
",",
"start_line",
"=",
"None",
",",
"headers",
"=",
"False",
")",
":",
"# Speed tricks: reduces function calls",
"split",
"=",
"str",
".",
"split",
"strip",
"=",
"str",
".",
"strip",
"next_line",
"=",
"next",
"if",
"start_l... | Iterate over SAM file and return SAM entries
Args:
handle (file): SAM file handle, can be any iterator so long as it
it returns subsequent "lines" of a SAM entry
start_line (str): Next SAM entry, if 'handle' has been partially read
and you want to start iterating at the nex... | [
"Iterate",
"over",
"SAM",
"file",
"and",
"return",
"SAM",
"entries"
] | 5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7 | https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/sam.py#L104-L219 |
238,527 | Brazelton-Lab/bio_utils | bio_utils/iterators/sam.py | SamEntry.write | def write(self):
"""Return SAM formatted string
Returns:
str: SAM formatted string containing entire SAM entry
"""
return '{0}\t{1}\t{2}\t{3}\t{4}\t' \
'{5}\t{6}\t{7}\t{8}\t{9}\t' \
'{10}{11}'.format(self.qname,
... | python | def write(self):
"""Return SAM formatted string
Returns:
str: SAM formatted string containing entire SAM entry
"""
return '{0}\t{1}\t{2}\t{3}\t{4}\t' \
'{5}\t{6}\t{7}\t{8}\t{9}\t' \
'{10}{11}'.format(self.qname,
... | [
"def",
"write",
"(",
"self",
")",
":",
"return",
"'{0}\\t{1}\\t{2}\\t{3}\\t{4}\\t'",
"'{5}\\t{6}\\t{7}\\t{8}\\t{9}\\t'",
"'{10}{11}'",
".",
"format",
"(",
"self",
".",
"qname",
",",
"str",
"(",
"self",
".",
"flag",
")",
",",
"self",
".",
"rname",
",",
"str",
... | Return SAM formatted string
Returns:
str: SAM formatted string containing entire SAM entry | [
"Return",
"SAM",
"formatted",
"string"
] | 5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7 | https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/sam.py#L81-L101 |
238,528 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaAPI.request | def request(self, request_path, data=None, do_authentication=True, is_json=True):
"""
Core "worker" for making requests and parsing JSON responses.
If `is_json` is ``True``, `data` should be a dictionary which
will be JSON-encoded.
"""
uri = self.api_uri % request_path
... | python | def request(self, request_path, data=None, do_authentication=True, is_json=True):
"""
Core "worker" for making requests and parsing JSON responses.
If `is_json` is ``True``, `data` should be a dictionary which
will be JSON-encoded.
"""
uri = self.api_uri % request_path
... | [
"def",
"request",
"(",
"self",
",",
"request_path",
",",
"data",
"=",
"None",
",",
"do_authentication",
"=",
"True",
",",
"is_json",
"=",
"True",
")",
":",
"uri",
"=",
"self",
".",
"api_uri",
"%",
"request_path",
"request",
"=",
"urllib2",
".",
"Request"... | Core "worker" for making requests and parsing JSON responses.
If `is_json` is ``True``, `data` should be a dictionary which
will be JSON-encoded. | [
"Core",
"worker",
"for",
"making",
"requests",
"and",
"parsing",
"JSON",
"responses",
"."
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L52-L90 |
238,529 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaAPI._make_request | def _make_request(self, request):
"""
Does the magic of actually sending the request and parsing the response
"""
# TODO: I'm sure all kinds of error checking needs to go here
try:
response_raw = urllib2.urlopen(request)
except urllib2.HTTPError, e:
... | python | def _make_request(self, request):
"""
Does the magic of actually sending the request and parsing the response
"""
# TODO: I'm sure all kinds of error checking needs to go here
try:
response_raw = urllib2.urlopen(request)
except urllib2.HTTPError, e:
... | [
"def",
"_make_request",
"(",
"self",
",",
"request",
")",
":",
"# TODO: I'm sure all kinds of error checking needs to go here",
"try",
":",
"response_raw",
"=",
"urllib2",
".",
"urlopen",
"(",
"request",
")",
"except",
"urllib2",
".",
"HTTPError",
",",
"e",
":",
"... | Does the magic of actually sending the request and parsing the response | [
"Does",
"the",
"magic",
"of",
"actually",
"sending",
"the",
"request",
"and",
"parsing",
"the",
"response"
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L92-L109 |
238,530 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaGroup.add_member | def add_member(self, address, **kwargs):
"""
Add a member to a group.
All Fiesta membership options can be passed in as keyword
arguments. Some valid options include:
- `group_name`: Since each member can access a group using
their own name, you can override the `grou... | python | def add_member(self, address, **kwargs):
"""
Add a member to a group.
All Fiesta membership options can be passed in as keyword
arguments. Some valid options include:
- `group_name`: Since each member can access a group using
their own name, you can override the `grou... | [
"def",
"add_member",
"(",
"self",
",",
"address",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"'membership/%s'",
"%",
"self",
".",
"id",
"kwargs",
"[",
"\"address\"",
"]",
"=",
"address",
"if",
"\"group_name\"",
"not",
"in",
"kwargs",
"and",
"self",
... | Add a member to a group.
All Fiesta membership options can be passed in as keyword
arguments. Some valid options include:
- `group_name`: Since each member can access a group using
their own name, you can override the `group_name` in this
method. By default, the group will ... | [
"Add",
"a",
"member",
"to",
"a",
"group",
"."
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L175-L208 |
238,531 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaGroup.send_message | def send_message(self, subject=None, text=None, markdown=None, message_dict=None):
"""
Helper function to send a message to a group
"""
message = FiestaMessage(self.api, self, subject, text, markdown, message_dict)
return message.send() | python | def send_message(self, subject=None, text=None, markdown=None, message_dict=None):
"""
Helper function to send a message to a group
"""
message = FiestaMessage(self.api, self, subject, text, markdown, message_dict)
return message.send() | [
"def",
"send_message",
"(",
"self",
",",
"subject",
"=",
"None",
",",
"text",
"=",
"None",
",",
"markdown",
"=",
"None",
",",
"message_dict",
"=",
"None",
")",
":",
"message",
"=",
"FiestaMessage",
"(",
"self",
".",
"api",
",",
"self",
",",
"subject",
... | Helper function to send a message to a group | [
"Helper",
"function",
"to",
"send",
"a",
"message",
"to",
"a",
"group"
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L210-L215 |
238,532 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaGroup.add_application | def add_application(self, application_id, **kwargs):
"""
Add an application to a group.
`application_id` is the name of the application to add. Any
application options can be specified as kwargs.
"""
path = 'group/%s/application' % self.id
data = {'application_i... | python | def add_application(self, application_id, **kwargs):
"""
Add an application to a group.
`application_id` is the name of the application to add. Any
application options can be specified as kwargs.
"""
path = 'group/%s/application' % self.id
data = {'application_i... | [
"def",
"add_application",
"(",
"self",
",",
"application_id",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"'group/%s/application'",
"%",
"self",
".",
"id",
"data",
"=",
"{",
"'application_id'",
":",
"application_id",
"}",
"if",
"kwargs",
":",
"data",
"... | Add an application to a group.
`application_id` is the name of the application to add. Any
application options can be specified as kwargs. | [
"Add",
"an",
"application",
"to",
"a",
"group",
"."
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L217-L230 |
238,533 | fiesta/fiesta-python | fiesta/fiesta.py | FiestaMessage.send | def send(self, group_id=None, message_dict=None):
"""
Send this current message to a group.
`message_dict` can be a dictionary formatted according to http://docs.fiesta.cc/list-management-api.html#messages
If message is provided, this method will ignore object-level variables.
"... | python | def send(self, group_id=None, message_dict=None):
"""
Send this current message to a group.
`message_dict` can be a dictionary formatted according to http://docs.fiesta.cc/list-management-api.html#messages
If message is provided, this method will ignore object-level variables.
"... | [
"def",
"send",
"(",
"self",
",",
"group_id",
"=",
"None",
",",
"message_dict",
"=",
"None",
")",
":",
"if",
"self",
".",
"group",
"is",
"not",
"None",
"and",
"self",
".",
"group",
".",
"id",
"is",
"not",
"None",
":",
"group_id",
"=",
"self",
".",
... | Send this current message to a group.
`message_dict` can be a dictionary formatted according to http://docs.fiesta.cc/list-management-api.html#messages
If message is provided, this method will ignore object-level variables. | [
"Send",
"this",
"current",
"message",
"to",
"a",
"group",
"."
] | cfcc11e4ae4c76b1007794604c33dde877f62cfb | https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L296-L331 |
238,534 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | OptionSelector.setup_ui | def setup_ui(self, ):
"""Setup the ui
:returns: None
:rtype: None
:raises: None
"""
labels = self.reftrack.get_option_labels()
self.browser = ComboBoxBrowser(len(labels), headers=labels)
self.browser_vbox.addWidget(self.browser) | python | def setup_ui(self, ):
"""Setup the ui
:returns: None
:rtype: None
:raises: None
"""
labels = self.reftrack.get_option_labels()
self.browser = ComboBoxBrowser(len(labels), headers=labels)
self.browser_vbox.addWidget(self.browser) | [
"def",
"setup_ui",
"(",
"self",
",",
")",
":",
"labels",
"=",
"self",
".",
"reftrack",
".",
"get_option_labels",
"(",
")",
"self",
".",
"browser",
"=",
"ComboBoxBrowser",
"(",
"len",
"(",
"labels",
")",
",",
"headers",
"=",
"labels",
")",
"self",
".",
... | Setup the ui
:returns: None
:rtype: None
:raises: None | [
"Setup",
"the",
"ui"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L39-L48 |
238,535 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | OptionSelector.select | def select(self, ):
"""Store the selected taskfileinfo self.selected and accept the dialog
:returns: None
:rtype: None
:raises: None
"""
s = self.browser.selected_indexes(self.browser.get_depth()-1)
if not s:
return
i = s[0].internalPointer()
... | python | def select(self, ):
"""Store the selected taskfileinfo self.selected and accept the dialog
:returns: None
:rtype: None
:raises: None
"""
s = self.browser.selected_indexes(self.browser.get_depth()-1)
if not s:
return
i = s[0].internalPointer()
... | [
"def",
"select",
"(",
"self",
",",
")",
":",
"s",
"=",
"self",
".",
"browser",
".",
"selected_indexes",
"(",
"self",
".",
"browser",
".",
"get_depth",
"(",
")",
"-",
"1",
")",
"if",
"not",
"s",
":",
"return",
"i",
"=",
"s",
"[",
"0",
"]",
".",
... | Store the selected taskfileinfo self.selected and accept the dialog
:returns: None
:rtype: None
:raises: None | [
"Store",
"the",
"selected",
"taskfileinfo",
"self",
".",
"selected",
"and",
"accept",
"the",
"dialog"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L59-L73 |
238,536 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.setup_icons | def setup_icons(self, ):
"""Setup the icons of the ui
:returns: None
:rtype: None
:raises: None
"""
iconbtns = [("menu_border_24x24.png", self.menu_tb),
("duplicate_border_24x24.png", self.duplicate_tb),
("delete_border_24x24.png",... | python | def setup_icons(self, ):
"""Setup the icons of the ui
:returns: None
:rtype: None
:raises: None
"""
iconbtns = [("menu_border_24x24.png", self.menu_tb),
("duplicate_border_24x24.png", self.duplicate_tb),
("delete_border_24x24.png",... | [
"def",
"setup_icons",
"(",
"self",
",",
")",
":",
"iconbtns",
"=",
"[",
"(",
"\"menu_border_24x24.png\"",
",",
"self",
".",
"menu_tb",
")",
",",
"(",
"\"duplicate_border_24x24.png\"",
",",
"self",
".",
"duplicate_tb",
")",
",",
"(",
"\"delete_border_24x24.png\""... | Setup the icons of the ui
:returns: None
:rtype: None
:raises: None | [
"Setup",
"the",
"icons",
"of",
"the",
"ui"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L104-L124 |
238,537 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.set_maintext | def set_maintext(self, index):
"""Set the maintext_lb to display text information about the given reftrack
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.DisplayRole
tex... | python | def set_maintext(self, index):
"""Set the maintext_lb to display text information about the given reftrack
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.DisplayRole
tex... | [
"def",
"set_maintext",
"(",
"self",
",",
"index",
")",
":",
"dr",
"=",
"QtCore",
".",
"Qt",
".",
"DisplayRole",
"text",
"=",
"\"\"",
"model",
"=",
"index",
".",
"model",
"(",
")",
"for",
"i",
"in",
"(",
"1",
",",
"2",
",",
"3",
",",
"5",
",",
... | Set the maintext_lb to display text information about the given reftrack
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"maintext_lb",
"to",
"display",
"text",
"information",
"about",
"the",
"given",
"reftrack"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L164-L181 |
238,538 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.set_identifiertext | def set_identifiertext(self, index):
"""Set the identifier text on the identifier_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.DisplayRole
t = index.model().index(i... | python | def set_identifiertext(self, index):
"""Set the identifier text on the identifier_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.DisplayRole
t = index.model().index(i... | [
"def",
"set_identifiertext",
"(",
"self",
",",
"index",
")",
":",
"dr",
"=",
"QtCore",
".",
"Qt",
".",
"DisplayRole",
"t",
"=",
"index",
".",
"model",
"(",
")",
".",
"index",
"(",
"index",
".",
"row",
"(",
")",
",",
"17",
",",
"index",
".",
"pare... | Set the identifier text on the identifier_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"identifier",
"text",
"on",
"the",
"identifier_lb"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L183-L198 |
238,539 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.set_type_icon | def set_type_icon(self, index):
"""Set the type icon on type_icon_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
icon = index.model().index(index.row(), 0, index.parent()).data(QtCore.Qt.De... | python | def set_type_icon(self, index):
"""Set the type icon on type_icon_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
icon = index.model().index(index.row(), 0, index.parent()).data(QtCore.Qt.De... | [
"def",
"set_type_icon",
"(",
"self",
",",
"index",
")",
":",
"icon",
"=",
"index",
".",
"model",
"(",
")",
".",
"index",
"(",
"index",
".",
"row",
"(",
")",
",",
"0",
",",
"index",
".",
"parent",
"(",
")",
")",
".",
"data",
"(",
"QtCore",
".",
... | Set the type icon on type_icon_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"type",
"icon",
"on",
"type_icon_lb"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L200-L214 |
238,540 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.disable_restricted | def disable_restricted(self, ):
"""Disable the restricted buttons
:returns: None
:rtype: None
:raises: None
"""
todisable = [(self.reftrack.duplicate, self.duplicate_tb),
(self.reftrack.delete, self.delete_tb),
(self.reftrack.ref... | python | def disable_restricted(self, ):
"""Disable the restricted buttons
:returns: None
:rtype: None
:raises: None
"""
todisable = [(self.reftrack.duplicate, self.duplicate_tb),
(self.reftrack.delete, self.delete_tb),
(self.reftrack.ref... | [
"def",
"disable_restricted",
"(",
"self",
",",
")",
":",
"todisable",
"=",
"[",
"(",
"self",
".",
"reftrack",
".",
"duplicate",
",",
"self",
".",
"duplicate_tb",
")",
",",
"(",
"self",
".",
"reftrack",
".",
"delete",
",",
"self",
".",
"delete_tb",
")",... | Disable the restricted buttons
:returns: None
:rtype: None
:raises: None | [
"Disable",
"the",
"restricted",
"buttons"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L216-L229 |
238,541 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.hide_restricted | def hide_restricted(self, ):
"""Hide the restricted buttons
:returns: None
:rtype: None
:raises: None
"""
tohide = [((self.reftrack.unload, self.unload_tb),
(self.reftrack.load, self.load_tb)),
((self.reftrack.import_file, self.import... | python | def hide_restricted(self, ):
"""Hide the restricted buttons
:returns: None
:rtype: None
:raises: None
"""
tohide = [((self.reftrack.unload, self.unload_tb),
(self.reftrack.load, self.load_tb)),
((self.reftrack.import_file, self.import... | [
"def",
"hide_restricted",
"(",
"self",
",",
")",
":",
"tohide",
"=",
"[",
"(",
"(",
"self",
".",
"reftrack",
".",
"unload",
",",
"self",
".",
"unload_tb",
")",
",",
"(",
"self",
".",
"reftrack",
".",
"load",
",",
"self",
".",
"load_tb",
")",
")",
... | Hide the restricted buttons
:returns: None
:rtype: None
:raises: None | [
"Hide",
"the",
"restricted",
"buttons"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L231-L252 |
238,542 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.set_top_bar_color | def set_top_bar_color(self, index):
"""Set the color of the upper frame to the background color of the reftrack status
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.ForegroundR... | python | def set_top_bar_color(self, index):
"""Set the color of the upper frame to the background color of the reftrack status
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None
"""
dr = QtCore.Qt.ForegroundR... | [
"def",
"set_top_bar_color",
"(",
"self",
",",
"index",
")",
":",
"dr",
"=",
"QtCore",
".",
"Qt",
".",
"ForegroundRole",
"c",
"=",
"index",
".",
"model",
"(",
")",
".",
"index",
"(",
"index",
".",
"row",
"(",
")",
",",
"8",
",",
"index",
".",
"par... | Set the color of the upper frame to the background color of the reftrack status
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"color",
"of",
"the",
"upper",
"frame",
"to",
"the",
"background",
"color",
"of",
"the",
"reftrack",
"status"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L254-L267 |
238,543 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.set_menu | def set_menu(self, ):
"""Setup the menu that the menu_tb button uses
:returns: None
:rtype: None
:raises: None
"""
self.menu = QtGui.QMenu(self)
actions = self.reftrack.get_additional_actions()
self.actions = []
for a in actions:
if a.... | python | def set_menu(self, ):
"""Setup the menu that the menu_tb button uses
:returns: None
:rtype: None
:raises: None
"""
self.menu = QtGui.QMenu(self)
actions = self.reftrack.get_additional_actions()
self.actions = []
for a in actions:
if a.... | [
"def",
"set_menu",
"(",
"self",
",",
")",
":",
"self",
".",
"menu",
"=",
"QtGui",
".",
"QMenu",
"(",
"self",
")",
"actions",
"=",
"self",
".",
"reftrack",
".",
"get_additional_actions",
"(",
")",
"self",
".",
"actions",
"=",
"[",
"]",
"for",
"a",
"... | Setup the menu that the menu_tb button uses
:returns: None
:rtype: None
:raises: None | [
"Setup",
"the",
"menu",
"that",
"the",
"menu_tb",
"button",
"uses"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L301-L322 |
238,544 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.get_taskfileinfo_selection | def get_taskfileinfo_selection(self, ):
"""Return a taskfileinfo that the user chose from the available options
:returns: the chosen taskfileinfo
:rtype: :class:`jukeboxcore.filesys.TaskFileInfo`
:raises: None
"""
sel = OptionSelector(self.reftrack)
sel.exec_()
... | python | def get_taskfileinfo_selection(self, ):
"""Return a taskfileinfo that the user chose from the available options
:returns: the chosen taskfileinfo
:rtype: :class:`jukeboxcore.filesys.TaskFileInfo`
:raises: None
"""
sel = OptionSelector(self.reftrack)
sel.exec_()
... | [
"def",
"get_taskfileinfo_selection",
"(",
"self",
",",
")",
":",
"sel",
"=",
"OptionSelector",
"(",
"self",
".",
"reftrack",
")",
"sel",
".",
"exec_",
"(",
")",
"return",
"sel",
".",
"selected"
] | Return a taskfileinfo that the user chose from the available options
:returns: the chosen taskfileinfo
:rtype: :class:`jukeboxcore.filesys.TaskFileInfo`
:raises: None | [
"Return",
"a",
"taskfileinfo",
"that",
"the",
"user",
"chose",
"from",
"the",
"available",
"options"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L324-L333 |
238,545 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.reference | def reference(self, ):
"""Reference a file
:returns: None
:rtype: None
:raises: None
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.reference(tfi) | python | def reference(self, ):
"""Reference a file
:returns: None
:rtype: None
:raises: None
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.reference(tfi) | [
"def",
"reference",
"(",
"self",
",",
")",
":",
"tfi",
"=",
"self",
".",
"get_taskfileinfo_selection",
"(",
")",
"if",
"tfi",
":",
"self",
".",
"reftrack",
".",
"reference",
"(",
"tfi",
")"
] | Reference a file
:returns: None
:rtype: None
:raises: None | [
"Reference",
"a",
"file"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L371-L380 |
238,546 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.import_file | def import_file(self, ):
"""Import a file
:returns: None
:rtype: None
:raises: NotImplementedError
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.import_file(tfi) | python | def import_file(self, ):
"""Import a file
:returns: None
:rtype: None
:raises: NotImplementedError
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.import_file(tfi) | [
"def",
"import_file",
"(",
"self",
",",
")",
":",
"tfi",
"=",
"self",
".",
"get_taskfileinfo_selection",
"(",
")",
"if",
"tfi",
":",
"self",
".",
"reftrack",
".",
"import_file",
"(",
"tfi",
")"
] | Import a file
:returns: None
:rtype: None
:raises: NotImplementedError | [
"Import",
"a",
"file"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L382-L391 |
238,547 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/widgets/reftrackwidget.py | ReftrackWidget.replace | def replace(self, ):
"""Replace the current reftrack
:returns: None
:rtype: None
:raises: None
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.replace(tfi) | python | def replace(self, ):
"""Replace the current reftrack
:returns: None
:rtype: None
:raises: None
"""
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.replace(tfi) | [
"def",
"replace",
"(",
"self",
",",
")",
":",
"tfi",
"=",
"self",
".",
"get_taskfileinfo_selection",
"(",
")",
"if",
"tfi",
":",
"self",
".",
"reftrack",
".",
"replace",
"(",
"tfi",
")"
] | Replace the current reftrack
:returns: None
:rtype: None
:raises: None | [
"Replace",
"the",
"current",
"reftrack"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L402-L411 |
238,548 | rouk1/django-image-renderer | renderer/models.py | delete_renditions_if_master_has_changed | def delete_renditions_if_master_has_changed(sender, instance, **kwargs):
'''if master file as changed delete all renditions'''
try:
obj = sender.objects.get(pk=instance.pk)
except sender.DoesNotExist:
pass # Object is new, so field hasn't technically changed.
else:
if not obj.ma... | python | def delete_renditions_if_master_has_changed(sender, instance, **kwargs):
'''if master file as changed delete all renditions'''
try:
obj = sender.objects.get(pk=instance.pk)
except sender.DoesNotExist:
pass # Object is new, so field hasn't technically changed.
else:
if not obj.ma... | [
"def",
"delete_renditions_if_master_has_changed",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"obj",
"=",
"sender",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"instance",
".",
"pk",
")",
"except",
"sender",
".",
"DoesN... | if master file as changed delete all renditions | [
"if",
"master",
"file",
"as",
"changed",
"delete",
"all",
"renditions"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L157-L166 |
238,549 | rouk1/django-image-renderer | renderer/models.py | photo_post_delete_handler | def photo_post_delete_handler(sender, **kwargs):
'''delete image when rows is gone from database'''
instance = kwargs.get('instance')
instance.master.delete(save=False)
instance.delete_all_renditions() | python | def photo_post_delete_handler(sender, **kwargs):
'''delete image when rows is gone from database'''
instance = kwargs.get('instance')
instance.master.delete(save=False)
instance.delete_all_renditions() | [
"def",
"photo_post_delete_handler",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"instance",
"=",
"kwargs",
".",
"get",
"(",
"'instance'",
")",
"instance",
".",
"master",
".",
"delete",
"(",
"save",
"=",
"False",
")",
"instance",
".",
"delete_all_rend... | delete image when rows is gone from database | [
"delete",
"image",
"when",
"rows",
"is",
"gone",
"from",
"database"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L170-L174 |
238,550 | rouk1/django-image-renderer | renderer/models.py | MasterImage.get_rendition_size | def get_rendition_size(self, width=0, height=0):
'''returns real rendition URL'''
if width == 0 and height == 0:
return (self.master_width, self.master_height)
target_width = int(width)
target_height = int(height)
ratio = self.master_width / float(self.master_height... | python | def get_rendition_size(self, width=0, height=0):
'''returns real rendition URL'''
if width == 0 and height == 0:
return (self.master_width, self.master_height)
target_width = int(width)
target_height = int(height)
ratio = self.master_width / float(self.master_height... | [
"def",
"get_rendition_size",
"(",
"self",
",",
"width",
"=",
"0",
",",
"height",
"=",
"0",
")",
":",
"if",
"width",
"==",
"0",
"and",
"height",
"==",
"0",
":",
"return",
"(",
"self",
".",
"master_width",
",",
"self",
".",
"master_height",
")",
"targe... | returns real rendition URL | [
"returns",
"real",
"rendition",
"URL"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L49-L64 |
238,551 | rouk1/django-image-renderer | renderer/models.py | MasterImage.get_rendition_url | def get_rendition_url(self, width=0, height=0):
'''get the rendition URL for a specified size
if the renditions does not exists it will be created
'''
if width == 0 and height == 0:
return self.get_master_url()
target_width, target_height = self.get_rendition_size(w... | python | def get_rendition_url(self, width=0, height=0):
'''get the rendition URL for a specified size
if the renditions does not exists it will be created
'''
if width == 0 and height == 0:
return self.get_master_url()
target_width, target_height = self.get_rendition_size(w... | [
"def",
"get_rendition_url",
"(",
"self",
",",
"width",
"=",
"0",
",",
"height",
"=",
"0",
")",
":",
"if",
"width",
"==",
"0",
"and",
"height",
"==",
"0",
":",
"return",
"self",
".",
"get_master_url",
"(",
")",
"target_width",
",",
"target_height",
"=",... | get the rendition URL for a specified size
if the renditions does not exists it will be created | [
"get",
"the",
"rendition",
"URL",
"for",
"a",
"specified",
"size"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L66-L82 |
238,552 | rouk1/django-image-renderer | renderer/models.py | MasterImage.delete_all_renditions | def delete_all_renditions(self):
'''delete all renditions and rendition dict'''
if self.renditions:
for r in self.renditions.values():
default_storage.delete(r)
self.renditions = {} | python | def delete_all_renditions(self):
'''delete all renditions and rendition dict'''
if self.renditions:
for r in self.renditions.values():
default_storage.delete(r)
self.renditions = {} | [
"def",
"delete_all_renditions",
"(",
"self",
")",
":",
"if",
"self",
".",
"renditions",
":",
"for",
"r",
"in",
"self",
".",
"renditions",
".",
"values",
"(",
")",
":",
"default_storage",
".",
"delete",
"(",
"r",
")",
"self",
".",
"renditions",
"=",
"{"... | delete all renditions and rendition dict | [
"delete",
"all",
"renditions",
"and",
"rendition",
"dict"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L88-L93 |
238,553 | rouk1/django-image-renderer | renderer/models.py | MasterImage.make_rendition | def make_rendition(self, width, height):
'''build a rendition
0 x 0 -> will give master URL
only width -> will make a renditions with master's aspect ratio
width x height -> will make an image potentialy cropped
'''
image = Image.open(self.master)
format = image.... | python | def make_rendition(self, width, height):
'''build a rendition
0 x 0 -> will give master URL
only width -> will make a renditions with master's aspect ratio
width x height -> will make an image potentialy cropped
'''
image = Image.open(self.master)
format = image.... | [
"def",
"make_rendition",
"(",
"self",
",",
"width",
",",
"height",
")",
":",
"image",
"=",
"Image",
".",
"open",
"(",
"self",
".",
"master",
")",
"format",
"=",
"image",
".",
"format",
"target_w",
"=",
"float",
"(",
"width",
")",
"target_h",
"=",
"fl... | build a rendition
0 x 0 -> will give master URL
only width -> will make a renditions with master's aspect ratio
width x height -> will make an image potentialy cropped | [
"build",
"a",
"rendition"
] | 6a4326b77709601e18ee04f5626cf475c5ea0bb5 | https://github.com/rouk1/django-image-renderer/blob/6a4326b77709601e18ee04f5626cf475c5ea0bb5/renderer/models.py#L95-L153 |
238,554 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | execute_actioncollection | def execute_actioncollection(obj, actioncollection, confirm=True):
"""Execute the given actioncollection with the given object
:param obj: the object to be processed
:param actioncollection:
:type actioncollection: :class:`ActionCollection`
:param confirm: If True, ask the user to continue, if acti... | python | def execute_actioncollection(obj, actioncollection, confirm=True):
"""Execute the given actioncollection with the given object
:param obj: the object to be processed
:param actioncollection:
:type actioncollection: :class:`ActionCollection`
:param confirm: If True, ask the user to continue, if acti... | [
"def",
"execute_actioncollection",
"(",
"obj",
",",
"actioncollection",
",",
"confirm",
"=",
"True",
")",
":",
"actioncollection",
".",
"execute",
"(",
"obj",
")",
"status",
"=",
"actioncollection",
".",
"status",
"(",
")",
"if",
"status",
".",
"value",
"=="... | Execute the given actioncollection with the given object
:param obj: the object to be processed
:param actioncollection:
:type actioncollection: :class:`ActionCollection`
:param confirm: If True, ask the user to continue, if actions failed.
:type confirm: :class:`bool`
:returns: An action statu... | [
"Execute",
"the",
"given",
"actioncollection",
"with",
"the",
"given",
"object"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L281-L307 |
238,555 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.release | def release(self):
"""Create a release
1. Perform Sanity checks on work file.
2. Copy work file to releasefile location.
3. Perform cleanup actions on releasefile.
:returns: True if successfull, False if not.
:rtype: bool
:raises: None
"""
log.in... | python | def release(self):
"""Create a release
1. Perform Sanity checks on work file.
2. Copy work file to releasefile location.
3. Perform cleanup actions on releasefile.
:returns: True if successfull, False if not.
:rtype: bool
:raises: None
"""
log.in... | [
"def",
"release",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"Releasing: %s\"",
",",
"self",
".",
"_workfile",
".",
"get_fullpath",
"(",
")",
")",
"ac",
"=",
"self",
".",
"build_actions",
"(",
")",
"ac",
".",
"execute",
"(",
"self",
")",
"s",
... | Create a release
1. Perform Sanity checks on work file.
2. Copy work file to releasefile location.
3. Perform cleanup actions on releasefile.
:returns: True if successfull, False if not.
:rtype: bool
:raises: None | [
"Create",
"a",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L54-L73 |
238,556 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.build_actions | def build_actions(self):
"""Create an ActionCollection that will perform sanity checks, copy the file,
create a database entry and perform cleanup actions and in case of a failure clean everything up.
:param work: the workfile
:type work: :class:`JB_File`
:param release: the rel... | python | def build_actions(self):
"""Create an ActionCollection that will perform sanity checks, copy the file,
create a database entry and perform cleanup actions and in case of a failure clean everything up.
:param work: the workfile
:type work: :class:`JB_File`
:param release: the rel... | [
"def",
"build_actions",
"(",
"self",
")",
":",
"checkau",
"=",
"ActionUnit",
"(",
"\"Sanity Checks\"",
",",
"\"Check the workfile. If the file is not conform, ask the user to continue.\"",
",",
"self",
".",
"sanity_check",
")",
"copyau",
"=",
"ActionUnit",
"(",
"\"Copy Fi... | Create an ActionCollection that will perform sanity checks, copy the file,
create a database entry and perform cleanup actions and in case of a failure clean everything up.
:param work: the workfile
:type work: :class:`JB_File`
:param release: the releasefile
:type release: :cla... | [
"Create",
"an",
"ActionCollection",
"that",
"will",
"perform",
"sanity",
"checks",
"copy",
"the",
"file",
"create",
"a",
"database",
"entry",
"and",
"perform",
"cleanup",
"actions",
"and",
"in",
"case",
"of",
"a",
"failure",
"clean",
"everything",
"up",
"."
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L75-L124 |
238,557 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.sanity_check | def sanity_check(self, release):
"""Perform sanity checks on the workfile of the given release
This is inteded to be used in a action unit.
:param release: the release with the workfile and sanity checks
:type release: :class:`Release`
:returns: the action status of the sanity ... | python | def sanity_check(self, release):
"""Perform sanity checks on the workfile of the given release
This is inteded to be used in a action unit.
:param release: the release with the workfile and sanity checks
:type release: :class:`Release`
:returns: the action status of the sanity ... | [
"def",
"sanity_check",
"(",
"self",
",",
"release",
")",
":",
"log",
".",
"info",
"(",
"\"Performing sanity checks.\"",
")",
"return",
"execute_actioncollection",
"(",
"release",
".",
"_workfile",
",",
"actioncollection",
"=",
"release",
".",
"_checks",
",",
"co... | Perform sanity checks on the workfile of the given release
This is inteded to be used in a action unit.
:param release: the release with the workfile and sanity checks
:type release: :class:`Release`
:returns: the action status of the sanity checks
:rtype: :class:`ActionStatus`... | [
"Perform",
"sanity",
"checks",
"on",
"the",
"workfile",
"of",
"the",
"given",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L126-L138 |
238,558 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.copy | def copy(self, release):
"""Copy the workfile of the given release to the releasefile location
This is inteded to be used in a action unit.
:param release: the release with the release and workfile
:type release: :class:`Release`
:returns: an action status
:rtype: :clas... | python | def copy(self, release):
"""Copy the workfile of the given release to the releasefile location
This is inteded to be used in a action unit.
:param release: the release with the release and workfile
:type release: :class:`Release`
:returns: an action status
:rtype: :clas... | [
"def",
"copy",
"(",
"self",
",",
"release",
")",
":",
"workfp",
"=",
"release",
".",
"_workfile",
".",
"get_fullpath",
"(",
")",
"releasefp",
"=",
"release",
".",
"_releasefile",
".",
"get_fullpath",
"(",
")",
"copy_file",
"(",
"release",
".",
"_workfile",... | Copy the workfile of the given release to the releasefile location
This is inteded to be used in a action unit.
:param release: the release with the release and workfile
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
:raises: No... | [
"Copy",
"the",
"workfile",
"of",
"the",
"given",
"release",
"to",
"the",
"releasefile",
"location"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L140-L156 |
238,559 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.create_db_entry | def create_db_entry(self, release):
"""Create a db entry for releasefile of the given release
Set _releasedbentry and _commentdbentry of the given release file
This is inteded to be used in a action unit.
:param release: the release with the releasefile and comment
:type relea... | python | def create_db_entry(self, release):
"""Create a db entry for releasefile of the given release
Set _releasedbentry and _commentdbentry of the given release file
This is inteded to be used in a action unit.
:param release: the release with the releasefile and comment
:type relea... | [
"def",
"create_db_entry",
"(",
"self",
",",
"release",
")",
":",
"log",
".",
"info",
"(",
"\"Create database entry with comment: %s\"",
",",
"release",
".",
"comment",
")",
"tfi",
"=",
"release",
".",
"_releasefile",
".",
"get_obj",
"(",
")",
"tf",
",",
"not... | Create a db entry for releasefile of the given release
Set _releasedbentry and _commentdbentry of the given release file
This is inteded to be used in a action unit.
:param release: the release with the releasefile and comment
:type release: :class:`Release`
:returns: an actio... | [
"Create",
"a",
"db",
"entry",
"for",
"releasefile",
"of",
"the",
"given",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L158-L177 |
238,560 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.cleanup | def cleanup(self, release):
"""Perform cleanup actions on the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile and cleanup actions
:type release: :class:`Release`
:returns: the action status of the cl... | python | def cleanup(self, release):
"""Perform cleanup actions on the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile and cleanup actions
:type release: :class:`Release`
:returns: the action status of the cl... | [
"def",
"cleanup",
"(",
"self",
",",
"release",
")",
":",
"log",
".",
"info",
"(",
"\"Performing cleanup.\"",
")",
"return",
"execute_actioncollection",
"(",
"release",
".",
"_releasefile",
",",
"actioncollection",
"=",
"release",
".",
"_cleanup",
",",
"confirm",... | Perform cleanup actions on the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile and cleanup actions
:type release: :class:`Release`
:returns: the action status of the cleanup actions
:rtype: :class:`A... | [
"Perform",
"cleanup",
"actions",
"on",
"the",
"releasefile",
"of",
"the",
"given",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L179-L191 |
238,561 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.delete_releasefile | def delete_releasefile(self, release):
"""Delete the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
... | python | def delete_releasefile(self, release):
"""Delete the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
... | [
"def",
"delete_releasefile",
"(",
"self",
",",
"release",
")",
":",
"fp",
"=",
"release",
".",
"_releasefile",
".",
"get_fullpath",
"(",
")",
"log",
".",
"info",
"(",
"\"Deleting release file %s\"",
",",
"fp",
")",
"delete_file",
"(",
"release",
".",
"_relea... | Delete the releasefile of the given release
This is inteded to be used in a action unit.
:param release: the release with the releasefile
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
:raises: None | [
"Delete",
"the",
"releasefile",
"of",
"the",
"given",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L193-L208 |
238,562 | JukeboxPipeline/jukebox-core | src/jukeboxcore/release.py | Release.delete_db_entry | def delete_db_entry(self, release):
"""Delete the db entries for releasefile and comment of the given release
:param release: the release with the releasefile and comment db entries
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
... | python | def delete_db_entry(self, release):
"""Delete the db entries for releasefile and comment of the given release
:param release: the release with the releasefile and comment db entries
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
... | [
"def",
"delete_db_entry",
"(",
"self",
",",
"release",
")",
":",
"log",
".",
"info",
"(",
"\"Delete database entry for file.\"",
")",
"release",
".",
"_releasedbentry",
".",
"delete",
"(",
")",
"log",
".",
"info",
"(",
"\"Delete database entry for comment.\"",
")"... | Delete the db entries for releasefile and comment of the given release
:param release: the release with the releasefile and comment db entries
:type release: :class:`Release`
:returns: an action status
:rtype: :class:`ActionStatus`
:raises: None | [
"Delete",
"the",
"db",
"entries",
"for",
"releasefile",
"and",
"comment",
"of",
"the",
"given",
"release"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/release.py#L210-L224 |
238,563 | williamfzc/ConnectionTracer | ConnectionTracer/utils.py | socket_reader | def socket_reader(connection: socket, buffer_size: int = 1024):
""" read data from adb socket """
while connection is not None:
try:
buffer = connection.recv(buffer_size)
# no output
if not len(buffer):
raise ConnectionAbortedError
except Conne... | python | def socket_reader(connection: socket, buffer_size: int = 1024):
""" read data from adb socket """
while connection is not None:
try:
buffer = connection.recv(buffer_size)
# no output
if not len(buffer):
raise ConnectionAbortedError
except Conne... | [
"def",
"socket_reader",
"(",
"connection",
":",
"socket",
",",
"buffer_size",
":",
"int",
"=",
"1024",
")",
":",
"while",
"connection",
"is",
"not",
"None",
":",
"try",
":",
"buffer",
"=",
"connection",
".",
"recv",
"(",
"buffer_size",
")",
"# no output",
... | read data from adb socket | [
"read",
"data",
"from",
"adb",
"socket"
] | 190003e374d6903cb82d2d21a1378979dc419ed3 | https://github.com/williamfzc/ConnectionTracer/blob/190003e374d6903cb82d2d21a1378979dc419ed3/ConnectionTracer/utils.py#L13-L32 |
238,564 | williamfzc/ConnectionTracer | ConnectionTracer/utils.py | decode_response | def decode_response(content: bytes) -> set:
""" adb response text -> device set """
content = content[4:].decode(config.ENCODING)
if '\t' not in content and '\n' not in content:
return set()
connected_devices = set()
device_list = [i for i in content.split('\n') if i]
for each_device in... | python | def decode_response(content: bytes) -> set:
""" adb response text -> device set """
content = content[4:].decode(config.ENCODING)
if '\t' not in content and '\n' not in content:
return set()
connected_devices = set()
device_list = [i for i in content.split('\n') if i]
for each_device in... | [
"def",
"decode_response",
"(",
"content",
":",
"bytes",
")",
"->",
"set",
":",
"content",
"=",
"content",
"[",
"4",
":",
"]",
".",
"decode",
"(",
"config",
".",
"ENCODING",
")",
"if",
"'\\t'",
"not",
"in",
"content",
"and",
"'\\n'",
"not",
"in",
"con... | adb response text -> device set | [
"adb",
"response",
"text",
"-",
">",
"device",
"set"
] | 190003e374d6903cb82d2d21a1378979dc419ed3 | https://github.com/williamfzc/ConnectionTracer/blob/190003e374d6903cb82d2d21a1378979dc419ed3/ConnectionTracer/utils.py#L36-L48 |
238,565 | demosdemon/format-pipfile | format_pipfile/cli.py | main | def main(requirements_file, skip_requirements_file, pipfile, skip_pipfile):
# type: (str, bool, str, bool) -> None
"""Update the requirements.txt file and reformat the Pipfile."""
pipfile_path = path.Path(pipfile)
pf = load_pipfile(pipfile_path)
if not skip_requirements_file:
requirements_f... | python | def main(requirements_file, skip_requirements_file, pipfile, skip_pipfile):
# type: (str, bool, str, bool) -> None
"""Update the requirements.txt file and reformat the Pipfile."""
pipfile_path = path.Path(pipfile)
pf = load_pipfile(pipfile_path)
if not skip_requirements_file:
requirements_f... | [
"def",
"main",
"(",
"requirements_file",
",",
"skip_requirements_file",
",",
"pipfile",
",",
"skip_pipfile",
")",
":",
"# type: (str, bool, str, bool) -> None",
"pipfile_path",
"=",
"path",
".",
"Path",
"(",
"pipfile",
")",
"pf",
"=",
"load_pipfile",
"(",
"pipfile_p... | Update the requirements.txt file and reformat the Pipfile. | [
"Update",
"the",
"requirements",
".",
"txt",
"file",
"and",
"reformat",
"the",
"Pipfile",
"."
] | f95162c49d8fc13153080ddb11ac5a5dcd4d2e7c | https://github.com/demosdemon/format-pipfile/blob/f95162c49d8fc13153080ddb11ac5a5dcd4d2e7c/format_pipfile/cli.py#L238-L249 |
238,566 | rbarrois/django-batchform | batchform/forms.py | BaseUploadForm.clean_file | def clean_file(self):
"""Analyse the uploaded file, and return the parsed lines.
Returns:
tuple of tuples of cells content (as text).
"""
data = self.cleaned_data['file']
available_parsers = self.get_parsers()
for parser in available_parsers:
tr... | python | def clean_file(self):
"""Analyse the uploaded file, and return the parsed lines.
Returns:
tuple of tuples of cells content (as text).
"""
data = self.cleaned_data['file']
available_parsers = self.get_parsers()
for parser in available_parsers:
tr... | [
"def",
"clean_file",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"cleaned_data",
"[",
"'file'",
"]",
"available_parsers",
"=",
"self",
".",
"get_parsers",
"(",
")",
"for",
"parser",
"in",
"available_parsers",
":",
"try",
":",
"return",
"parser",
".",
... | Analyse the uploaded file, and return the parsed lines.
Returns:
tuple of tuples of cells content (as text). | [
"Analyse",
"the",
"uploaded",
"file",
"and",
"return",
"the",
"parsed",
"lines",
"."
] | f6b659a6790750285af248ccd1d4d178ecbad129 | https://github.com/rbarrois/django-batchform/blob/f6b659a6790750285af248ccd1d4d178ecbad129/batchform/forms.py#L25-L43 |
238,567 | rbarrois/django-batchform | batchform/forms.py | LineFormSet.clean | def clean(self):
"""Global cleanup."""
super(LineFormSet, self).clean()
if any(self.errors):
# Already seen errors, let's skip.
return
self.clean_unique_fields() | python | def clean(self):
"""Global cleanup."""
super(LineFormSet, self).clean()
if any(self.errors):
# Already seen errors, let's skip.
return
self.clean_unique_fields() | [
"def",
"clean",
"(",
"self",
")",
":",
"super",
"(",
"LineFormSet",
",",
"self",
")",
".",
"clean",
"(",
")",
"if",
"any",
"(",
"self",
".",
"errors",
")",
":",
"# Already seen errors, let's skip.",
"return",
"self",
".",
"clean_unique_fields",
"(",
")"
] | Global cleanup. | [
"Global",
"cleanup",
"."
] | f6b659a6790750285af248ccd1d4d178ecbad129 | https://github.com/rbarrois/django-batchform/blob/f6b659a6790750285af248ccd1d4d178ecbad129/batchform/forms.py#L59-L67 |
238,568 | rbarrois/django-batchform | batchform/forms.py | LineFormSet.clean_unique_fields | def clean_unique_fields(self):
"""Ensure 'unique fields' are unique among entered data."""
if not self.unique_fields:
return
keys = set()
duplicates = []
for form in self.forms:
key = tuple(form.cleaned_data[field] for field in self.unique_fields)
... | python | def clean_unique_fields(self):
"""Ensure 'unique fields' are unique among entered data."""
if not self.unique_fields:
return
keys = set()
duplicates = []
for form in self.forms:
key = tuple(form.cleaned_data[field] for field in self.unique_fields)
... | [
"def",
"clean_unique_fields",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"unique_fields",
":",
"return",
"keys",
"=",
"set",
"(",
")",
"duplicates",
"=",
"[",
"]",
"for",
"form",
"in",
"self",
".",
"forms",
":",
"key",
"=",
"tuple",
"(",
"form"... | Ensure 'unique fields' are unique among entered data. | [
"Ensure",
"unique",
"fields",
"are",
"unique",
"among",
"entered",
"data",
"."
] | f6b659a6790750285af248ccd1d4d178ecbad129 | https://github.com/rbarrois/django-batchform/blob/f6b659a6790750285af248ccd1d4d178ecbad129/batchform/forms.py#L69-L87 |
238,569 | rvswift/EB | EB/builder/exhaustive/exhaustive.py | run | def run(itf):
"""
Run optimize functions.
"""
if not itf:
return 1
# access user input
options = SplitInput(itf)
# read input
inputpath = os.path.abspath(options.inputpath)
print(" Reading input file ...")
molecules = csv_interface.read_csv(inputpath, options)
if not mol... | python | def run(itf):
"""
Run optimize functions.
"""
if not itf:
return 1
# access user input
options = SplitInput(itf)
# read input
inputpath = os.path.abspath(options.inputpath)
print(" Reading input file ...")
molecules = csv_interface.read_csv(inputpath, options)
if not mol... | [
"def",
"run",
"(",
"itf",
")",
":",
"if",
"not",
"itf",
":",
"return",
"1",
"# access user input",
"options",
"=",
"SplitInput",
"(",
"itf",
")",
"# read input",
"inputpath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"options",
".",
"inputpath",
")",
... | Run optimize functions. | [
"Run",
"optimize",
"functions",
"."
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/exhaustive/exhaustive.py#L19-L60 |
238,570 | rvswift/EB | EB/builder/exhaustive/exhaustive.py | optimizor | def optimizor(molecules, sort_order, ensemble_size, options):
"""
Evaluate the performance of all ensembles of fixed size.
"""
# set variables
ncpu = options.ncpu
score_field = options.score_field
# generate an exhaustive list of all possible ensembles
ensemble_list = make_ensemble_list(molec... | python | def optimizor(molecules, sort_order, ensemble_size, options):
"""
Evaluate the performance of all ensembles of fixed size.
"""
# set variables
ncpu = options.ncpu
score_field = options.score_field
# generate an exhaustive list of all possible ensembles
ensemble_list = make_ensemble_list(molec... | [
"def",
"optimizor",
"(",
"molecules",
",",
"sort_order",
",",
"ensemble_size",
",",
"options",
")",
":",
"# set variables",
"ncpu",
"=",
"options",
".",
"ncpu",
"score_field",
"=",
"options",
".",
"score_field",
"# generate an exhaustive list of all possible ensembles",... | Evaluate the performance of all ensembles of fixed size. | [
"Evaluate",
"the",
"performance",
"of",
"all",
"ensembles",
"of",
"fixed",
"size",
"."
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/exhaustive/exhaustive.py#L62-L117 |
238,571 | rvswift/EB | EB/builder/exhaustive/exhaustive.py | evaluate | def evaluate(molecules, ensemble_chunk, sort_order, options, output_queue=None):
"""
Evaluate VS performance of each ensemble in ensemble_chunk
"""
results = {} # {('receptor_1', ..., 'receptor_n') : ensemble storage object}
for ensemble in ensemble_chunk:
results[ensemble] = calculate_perfor... | python | def evaluate(molecules, ensemble_chunk, sort_order, options, output_queue=None):
"""
Evaluate VS performance of each ensemble in ensemble_chunk
"""
results = {} # {('receptor_1', ..., 'receptor_n') : ensemble storage object}
for ensemble in ensemble_chunk:
results[ensemble] = calculate_perfor... | [
"def",
"evaluate",
"(",
"molecules",
",",
"ensemble_chunk",
",",
"sort_order",
",",
"options",
",",
"output_queue",
"=",
"None",
")",
":",
"results",
"=",
"{",
"}",
"# {('receptor_1', ..., 'receptor_n') : ensemble storage object}",
"for",
"ensemble",
"in",
"ensemble_c... | Evaluate VS performance of each ensemble in ensemble_chunk | [
"Evaluate",
"VS",
"performance",
"of",
"each",
"ensemble",
"in",
"ensemble_chunk"
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/exhaustive/exhaustive.py#L119-L132 |
238,572 | rvswift/EB | EB/builder/exhaustive/exhaustive.py | make_ensemble_list | def make_ensemble_list(molecules, score_field, ensemble_size):
"""
Construct ensemble list
"""
# generate list of queries
queryList = molecules[0].scores.keys()
# nchoosek
ensemble_iterator = itertools.combinations(queryList, ensemble_size)
# list of tuples: [(query1, query2), ... (queryN-1... | python | def make_ensemble_list(molecules, score_field, ensemble_size):
"""
Construct ensemble list
"""
# generate list of queries
queryList = molecules[0].scores.keys()
# nchoosek
ensemble_iterator = itertools.combinations(queryList, ensemble_size)
# list of tuples: [(query1, query2), ... (queryN-1... | [
"def",
"make_ensemble_list",
"(",
"molecules",
",",
"score_field",
",",
"ensemble_size",
")",
":",
"# generate list of queries",
"queryList",
"=",
"molecules",
"[",
"0",
"]",
".",
"scores",
".",
"keys",
"(",
")",
"# nchoosek",
"ensemble_iterator",
"=",
"itertools"... | Construct ensemble list | [
"Construct",
"ensemble",
"list"
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/exhaustive/exhaustive.py#L166-L183 |
238,573 | rvswift/EB | EB/builder/exhaustive/exhaustive.py | chunker | def chunker(ensemble_list, ncpu):
"""
Generate successive chunks of ensemble_list.
"""
# determine sublist lengths
length = int(len(ensemble_list) / ncpu)
# generator
for i in range(0, len(ensemble_list), length):
yield ensemble_list[i:i + length] | python | def chunker(ensemble_list, ncpu):
"""
Generate successive chunks of ensemble_list.
"""
# determine sublist lengths
length = int(len(ensemble_list) / ncpu)
# generator
for i in range(0, len(ensemble_list), length):
yield ensemble_list[i:i + length] | [
"def",
"chunker",
"(",
"ensemble_list",
",",
"ncpu",
")",
":",
"# determine sublist lengths",
"length",
"=",
"int",
"(",
"len",
"(",
"ensemble_list",
")",
"/",
"ncpu",
")",
"# generator",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"ensemble_list... | Generate successive chunks of ensemble_list. | [
"Generate",
"successive",
"chunks",
"of",
"ensemble_list",
"."
] | 341880b79faf8147dc9fa6e90438531cd09fabcc | https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/exhaustive/exhaustive.py#L186-L196 |
238,574 | Brazelton-Lab/bio_utils | bio_utils/verifiers/fasta.py | fasta_verifier | def fasta_verifier(entries, ambiguous=False):
"""Raises error if invalid FASTA format detected
Args:
entries (list): A list of FastaEntry instances
ambiguous (bool): Permit ambiguous bases, i.e. permit non-ACGTU bases
Raises:
FormatError: Error when FASTA format incorrect with des... | python | def fasta_verifier(entries, ambiguous=False):
"""Raises error if invalid FASTA format detected
Args:
entries (list): A list of FastaEntry instances
ambiguous (bool): Permit ambiguous bases, i.e. permit non-ACGTU bases
Raises:
FormatError: Error when FASTA format incorrect with des... | [
"def",
"fasta_verifier",
"(",
"entries",
",",
"ambiguous",
"=",
"False",
")",
":",
"if",
"ambiguous",
":",
"regex",
"=",
"r'^>.+{0}[ACGTURYKMSWBDHVNX]+{0}$'",
".",
"format",
"(",
"os",
".",
"linesep",
")",
"else",
":",
"regex",
"=",
"r'^>.+{0}[ACGTU]+{0}$'",
"... | Raises error if invalid FASTA format detected
Args:
entries (list): A list of FastaEntry instances
ambiguous (bool): Permit ambiguous bases, i.e. permit non-ACGTU bases
Raises:
FormatError: Error when FASTA format incorrect with descriptive message
Example:
>>> from bio_u... | [
"Raises",
"error",
"if",
"invalid",
"FASTA",
"format",
"detected"
] | 5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7 | https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/verifiers/fasta.py#L46-L90 |
238,575 | s-m-i-t-a/railroad | railroad/guard.py | guard | def guard(params, guardian, error_class=GuardError, message=''):
'''
A guard function - check parameters
with guardian function on decorated function
:param tuple or string params: guarded function parameter/s
:param function guardian: verifying the conditions for the selected parameter
:param ... | python | def guard(params, guardian, error_class=GuardError, message=''):
'''
A guard function - check parameters
with guardian function on decorated function
:param tuple or string params: guarded function parameter/s
:param function guardian: verifying the conditions for the selected parameter
:param ... | [
"def",
"guard",
"(",
"params",
",",
"guardian",
",",
"error_class",
"=",
"GuardError",
",",
"message",
"=",
"''",
")",
":",
"params",
"=",
"[",
"params",
"]",
"if",
"isinstance",
"(",
"params",
",",
"string_types",
")",
"else",
"params",
"def",
"guard_de... | A guard function - check parameters
with guardian function on decorated function
:param tuple or string params: guarded function parameter/s
:param function guardian: verifying the conditions for the selected parameter
:param Exception error_class: raised class when guardian return false
:param str... | [
"A",
"guard",
"function",
"-",
"check",
"parameters",
"with",
"guardian",
"function",
"on",
"decorated",
"function"
] | ddb4afa018b8523b5d8c3a86e55388d1ea0ab37c | https://github.com/s-m-i-t-a/railroad/blob/ddb4afa018b8523b5d8c3a86e55388d1ea0ab37c/railroad/guard.py#L36-L56 |
238,576 | avanwyk/cipy | examples/pso_optimizer.py | main | def main(dimension, iterations):
""" Main function for PSO optimizer example.
Instantiate PSOOptimizer to optimize 30-dimensional spherical function.
"""
optimizer = PSOOptimizer()
solution = optimizer.minimize(sphere, -5.12, 5.12, dimension,
max_iterations(iterati... | python | def main(dimension, iterations):
""" Main function for PSO optimizer example.
Instantiate PSOOptimizer to optimize 30-dimensional spherical function.
"""
optimizer = PSOOptimizer()
solution = optimizer.minimize(sphere, -5.12, 5.12, dimension,
max_iterations(iterati... | [
"def",
"main",
"(",
"dimension",
",",
"iterations",
")",
":",
"optimizer",
"=",
"PSOOptimizer",
"(",
")",
"solution",
"=",
"optimizer",
".",
"minimize",
"(",
"sphere",
",",
"-",
"5.12",
",",
"5.12",
",",
"dimension",
",",
"max_iterations",
"(",
"iterations... | Main function for PSO optimizer example.
Instantiate PSOOptimizer to optimize 30-dimensional spherical function. | [
"Main",
"function",
"for",
"PSO",
"optimizer",
"example",
"."
] | 98450dd01767b3615c113e50dc396f135e177b29 | https://github.com/avanwyk/cipy/blob/98450dd01767b3615c113e50dc396f135e177b29/examples/pso_optimizer.py#L20-L28 |
238,577 | mapmyfitness/jtime | jtime/git_ext.py | GIT.get_last_commit_message | def get_last_commit_message(self):
"""
Gets the last commit message on the active branch
Returns None if not in a git repo
"""
# Check if we are currently in a repo
try:
branch = self.active_branch
return self.commit(branch).message
except... | python | def get_last_commit_message(self):
"""
Gets the last commit message on the active branch
Returns None if not in a git repo
"""
# Check if we are currently in a repo
try:
branch = self.active_branch
return self.commit(branch).message
except... | [
"def",
"get_last_commit_message",
"(",
"self",
")",
":",
"# Check if we are currently in a repo",
"try",
":",
"branch",
"=",
"self",
".",
"active_branch",
"return",
"self",
".",
"commit",
"(",
"branch",
")",
".",
"message",
"except",
"InvalidGitRepositoryError",
":"... | Gets the last commit message on the active branch
Returns None if not in a git repo | [
"Gets",
"the",
"last",
"commit",
"message",
"on",
"the",
"active",
"branch"
] | 402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd | https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/git_ext.py#L30-L42 |
238,578 | mapmyfitness/jtime | jtime/git_ext.py | GIT.get_last_modified_timestamp | def get_last_modified_timestamp(self):
"""
Looks at the files in a git root directory and grabs the last modified timestamp
"""
cmd = "find . -print0 | xargs -0 stat -f '%T@ %p' | sort -n | tail -1 | cut -f2- -d' '"
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stde... | python | def get_last_modified_timestamp(self):
"""
Looks at the files in a git root directory and grabs the last modified timestamp
"""
cmd = "find . -print0 | xargs -0 stat -f '%T@ %p' | sort -n | tail -1 | cut -f2- -d' '"
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stde... | [
"def",
"get_last_modified_timestamp",
"(",
"self",
")",
":",
"cmd",
"=",
"\"find . -print0 | xargs -0 stat -f '%T@ %p' | sort -n | tail -1 | cut -f2- -d' '\"",
"ps",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess"... | Looks at the files in a git root directory and grabs the last modified timestamp | [
"Looks",
"at",
"the",
"files",
"in",
"a",
"git",
"root",
"directory",
"and",
"grabs",
"the",
"last",
"modified",
"timestamp"
] | 402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd | https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/git_ext.py#L44-L51 |
238,579 | rca/cmdline | src/cmdline/config.py | find_config_root | def find_config_root(path=sys.argv[0]):
"""
Finds config root relative to the given file path
"""
dirname = os.path.dirname(path)
lastdirname = None
while dirname != lastdirname:
config_root = os.path.join(dirname, 'config')
if os.path.exists(config_root):
return con... | python | def find_config_root(path=sys.argv[0]):
"""
Finds config root relative to the given file path
"""
dirname = os.path.dirname(path)
lastdirname = None
while dirname != lastdirname:
config_root = os.path.join(dirname, 'config')
if os.path.exists(config_root):
return con... | [
"def",
"find_config_root",
"(",
"path",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"lastdirname",
"=",
"None",
"while",
"dirname",
"!=",
"lastdirname",
":",
"config_root",
"=",... | Finds config root relative to the given file path | [
"Finds",
"config",
"root",
"relative",
"to",
"the",
"given",
"file",
"path"
] | c01990aa1781c4d435c91c67962fb6ad92b7b579 | https://github.com/rca/cmdline/blob/c01990aa1781c4d435c91c67962fb6ad92b7b579/src/cmdline/config.py#L8-L20 |
238,580 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | ConfigObjModel.restore_default | def restore_default(self, index):
"""Set the value of the given index row to its default
:param index:
:type index:
:returns:
:rtype:
:raises:
"""
spec = self.get_configspec_str(index)
if spec is None or isinstance(spec, Section):
retu... | python | def restore_default(self, index):
"""Set the value of the given index row to its default
:param index:
:type index:
:returns:
:rtype:
:raises:
"""
spec = self.get_configspec_str(index)
if spec is None or isinstance(spec, Section):
retu... | [
"def",
"restore_default",
"(",
"self",
",",
"index",
")",
":",
"spec",
"=",
"self",
".",
"get_configspec_str",
"(",
"index",
")",
"if",
"spec",
"is",
"None",
"or",
"isinstance",
"(",
"spec",
",",
"Section",
")",
":",
"return",
"try",
":",
"default",
"=... | Set the value of the given index row to its default
:param index:
:type index:
:returns:
:rtype:
:raises: | [
"Set",
"the",
"value",
"of",
"the",
"given",
"index",
"row",
"to",
"its",
"default"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L135-L152 |
238,581 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | ConfigObjModel.get_value | def get_value(self, index):
""" Return the value of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The key is used on the section to return the value
:param index: The QModelIndex
:type index: QModelIndex
... | python | def get_value(self, index):
""" Return the value of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The key is used on the section to return the value
:param index: The QModelIndex
:type index: QModelIndex
... | [
"def",
"get_value",
"(",
"self",
",",
"index",
")",
":",
"p",
"=",
"index",
".",
"internalPointer",
"(",
")",
"k",
"=",
"self",
".",
"get_key",
"(",
"p",
",",
"index",
".",
"row",
"(",
")",
")",
"return",
"p",
"[",
"k",
"]"
] | Return the value of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The key is used on the section to return the value
:param index: The QModelIndex
:type index: QModelIndex
:returns: The value for the given ind... | [
"Return",
"the",
"value",
"of",
"the",
"given",
"index"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L211-L224 |
238,582 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | ConfigObjModel.get_configspec_str | def get_configspec_str(self, index):
""" Return the config spec string of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The section stores the spec in its configspec attribute
The key is used on the configspec attribut... | python | def get_configspec_str(self, index):
""" Return the config spec string of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The section stores the spec in its configspec attribute
The key is used on the configspec attribut... | [
"def",
"get_configspec_str",
"(",
"self",
",",
"index",
")",
":",
"p",
"=",
"index",
".",
"internalPointer",
"(",
")",
"if",
"p",
"is",
"None",
":",
"return",
"spec",
"=",
"p",
".",
"configspec",
"if",
"spec",
"is",
"None",
":",
"return",
"None",
"k"... | Return the config spec string of the given index
The index stores the section as internal pointer.
The row of the index determines the key.
The section stores the spec in its configspec attribute
The key is used on the configspec attribute to return the spec
:param index: The Q... | [
"Return",
"the",
"config",
"spec",
"string",
"of",
"the",
"given",
"index"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L226-L248 |
238,583 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | ConfigObjModel._val_to_str | def _val_to_str(self, value):
"""Converts the value to a string that will be handled correctly by the confobj
:param value: the value to parse
:type value: something configobj supports
:returns: str
:rtype: str
:raises: None
When the value is a list, it will be ... | python | def _val_to_str(self, value):
"""Converts the value to a string that will be handled correctly by the confobj
:param value: the value to parse
:type value: something configobj supports
:returns: str
:rtype: str
:raises: None
When the value is a list, it will be ... | [
"def",
"_val_to_str",
"(",
"self",
",",
"value",
")",
":",
"# might be a list value",
"# then represent it 'nicer' so that when we edit it, the same value will return",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"# so we have a list value. the default str(v) would p... | Converts the value to a string that will be handled correctly by the confobj
:param value: the value to parse
:type value: something configobj supports
:returns: str
:rtype: str
:raises: None
When the value is a list, it will be converted to a string that can be parsed ... | [
"Converts",
"the",
"value",
"to",
"a",
"string",
"that",
"will",
"be",
"handled",
"correctly",
"by",
"the",
"confobj"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L292-L312 |
238,584 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | InifilesModel.set_index_edited | def set_index_edited(self, index, edited):
"""Set whether the conf was edited or not.
Edited files will be displayed with a \'*\'
:param index: the index that was edited
:type index: QModelIndex
:param edited: if the file was edited, set edited to True, else False
:type... | python | def set_index_edited(self, index, edited):
"""Set whether the conf was edited or not.
Edited files will be displayed with a \'*\'
:param index: the index that was edited
:type index: QModelIndex
:param edited: if the file was edited, set edited to True, else False
:type... | [
"def",
"set_index_edited",
"(",
"self",
",",
"index",
",",
"edited",
")",
":",
"self",
".",
"__edited",
"[",
"index",
".",
"row",
"(",
")",
"]",
"=",
"edited",
"self",
".",
"dataChanged",
".",
"emit",
"(",
"index",
",",
"index",
")"
] | Set whether the conf was edited or not.
Edited files will be displayed with a \'*\'
:param index: the index that was edited
:type index: QModelIndex
:param edited: if the file was edited, set edited to True, else False
:type edited: bool
:returns: None
:rtype: N... | [
"Set",
"whether",
"the",
"conf",
"was",
"edited",
"or",
"not",
"."
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L390-L404 |
238,585 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | InifilesModel.get_edited | def get_edited(self, ):
"""Return all indices that were modified
:returns: list of indices for modified confs
:rtype: list of QModelIndex
:raises: None
"""
modified = []
for i in range(len(self.__edited)):
if self.__edited[i]:
modified... | python | def get_edited(self, ):
"""Return all indices that were modified
:returns: list of indices for modified confs
:rtype: list of QModelIndex
:raises: None
"""
modified = []
for i in range(len(self.__edited)):
if self.__edited[i]:
modified... | [
"def",
"get_edited",
"(",
"self",
",",
")",
":",
"modified",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"__edited",
")",
")",
":",
"if",
"self",
".",
"__edited",
"[",
"i",
"]",
":",
"modified",
".",
"append",
"(",
"... | Return all indices that were modified
:returns: list of indices for modified confs
:rtype: list of QModelIndex
:raises: None | [
"Return",
"all",
"indices",
"that",
"were",
"modified"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L406-L417 |
238,586 | JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/configeditor.py | InifilesModel.validate | def validate(self, index):
"""Validate the conf for the given index
:param index: the index of the model to validate
:type index: QModelIndex
:returns: True if passed and a False/True dict representing fail/pass. The structure follows the configobj. If the configobj does not have a conf... | python | def validate(self, index):
"""Validate the conf for the given index
:param index: the index of the model to validate
:type index: QModelIndex
:returns: True if passed and a False/True dict representing fail/pass. The structure follows the configobj. If the configobj does not have a conf... | [
"def",
"validate",
"(",
"self",
",",
"index",
")",
":",
"c",
"=",
"self",
".",
"__configs",
"[",
"index",
".",
"row",
"(",
")",
"]",
"if",
"c",
".",
"configspec",
"is",
"None",
":",
"return",
"True",
"else",
":",
"return",
"c",
".",
"validate",
"... | Validate the conf for the given index
:param index: the index of the model to validate
:type index: QModelIndex
:returns: True if passed and a False/True dict representing fail/pass. The structure follows the configobj. If the configobj does not have a configspec True is returned.
:rtyp... | [
"Validate",
"the",
"conf",
"for",
"the",
"given",
"index"
] | bac2280ca49940355270e4b69400ce9976ab2e6f | https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/configeditor.py#L419-L432 |
238,587 | ubernostrum/django-flashpolicies | flashpolicies/views.py | metapolicy | def metapolicy(request, permitted, domains=None):
"""
Serves a cross-domain policy which can allow other policies
to exist on the same domain.
Note that this view, if used, must be the master policy for the
domain, and so must be served from the URL ``/crossdomain.xml`` on
the domain: setting m... | python | def metapolicy(request, permitted, domains=None):
"""
Serves a cross-domain policy which can allow other policies
to exist on the same domain.
Note that this view, if used, must be the master policy for the
domain, and so must be served from the URL ``/crossdomain.xml`` on
the domain: setting m... | [
"def",
"metapolicy",
"(",
"request",
",",
"permitted",
",",
"domains",
"=",
"None",
")",
":",
"if",
"domains",
"is",
"None",
":",
"domains",
"=",
"[",
"]",
"policy",
"=",
"policies",
".",
"Policy",
"(",
"*",
"domains",
")",
"policy",
".",
"metapolicy",... | Serves a cross-domain policy which can allow other policies
to exist on the same domain.
Note that this view, if used, must be the master policy for the
domain, and so must be served from the URL ``/crossdomain.xml`` on
the domain: setting metapolicy information in other policy files
is forbidden b... | [
"Serves",
"a",
"cross",
"-",
"domain",
"policy",
"which",
"can",
"allow",
"other",
"policies",
"to",
"exist",
"on",
"the",
"same",
"domain",
"."
] | fb04693504186dde859cce97bad6e83d2b380dc6 | https://github.com/ubernostrum/django-flashpolicies/blob/fb04693504186dde859cce97bad6e83d2b380dc6/flashpolicies/views.py#L78-L110 |
238,588 | RealGeeks/batman | batman/run.py | _run_popen | def _run_popen(command, print_output=False):
"""
subprocess has the most terrible interface ever.
Envoy is an option but too heavyweight for this.
This is a convenience wrapper around subprocess.Popen.
Also, this merges STDOUT and STDERR together, since
there isn't a good way of interleaving th... | python | def _run_popen(command, print_output=False):
"""
subprocess has the most terrible interface ever.
Envoy is an option but too heavyweight for this.
This is a convenience wrapper around subprocess.Popen.
Also, this merges STDOUT and STDERR together, since
there isn't a good way of interleaving th... | [
"def",
"_run_popen",
"(",
"command",
",",
"print_output",
"=",
"False",
")",
":",
"output",
"=",
"''",
"po",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
... | subprocess has the most terrible interface ever.
Envoy is an option but too heavyweight for this.
This is a convenience wrapper around subprocess.Popen.
Also, this merges STDOUT and STDERR together, since
there isn't a good way of interleaving them without
threads. | [
"subprocess",
"has",
"the",
"most",
"terrible",
"interface",
"ever",
".",
"Envoy",
"is",
"an",
"option",
"but",
"too",
"heavyweight",
"for",
"this",
".",
"This",
"is",
"a",
"convenience",
"wrapper",
"around",
"subprocess",
".",
"Popen",
"."
] | ac61d193cbc6cc736f61ae8cf5e933a576b50698 | https://github.com/RealGeeks/batman/blob/ac61d193cbc6cc736f61ae8cf5e933a576b50698/batman/run.py#L19-L48 |
238,589 | emilydolson/avida-spatial-tools | avidaspatial/patch_analysis.py | perimeter | def perimeter(patch, world_size=(60, 60),
neighbor_func=get_rook_neighbors_toroidal):
"""
Count cell faces in patch that do not connect to part of patch.
This preserves various square geometry features that would not
be preserved by merely counting the number of cells that touch
an edg... | python | def perimeter(patch, world_size=(60, 60),
neighbor_func=get_rook_neighbors_toroidal):
"""
Count cell faces in patch that do not connect to part of patch.
This preserves various square geometry features that would not
be preserved by merely counting the number of cells that touch
an edg... | [
"def",
"perimeter",
"(",
"patch",
",",
"world_size",
"=",
"(",
"60",
",",
"60",
")",
",",
"neighbor_func",
"=",
"get_rook_neighbors_toroidal",
")",
":",
"edge",
"=",
"0",
"patch",
"=",
"set",
"(",
"[",
"tuple",
"(",
"i",
")",
"for",
"i",
"in",
"patch... | Count cell faces in patch that do not connect to part of patch.
This preserves various square geometry features that would not
be preserved by merely counting the number of cells that touch
an edge. | [
"Count",
"cell",
"faces",
"in",
"patch",
"that",
"do",
"not",
"connect",
"to",
"part",
"of",
"patch",
".",
"This",
"preserves",
"various",
"square",
"geometry",
"features",
"that",
"would",
"not",
"be",
"preserved",
"by",
"merely",
"counting",
"the",
"number... | 7beb0166ccefad5fa722215b030ac2a53d62b59e | https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/patch_analysis.py#L89-L104 |
238,590 | emilydolson/avida-spatial-tools | avidaspatial/patch_analysis.py | traverse_core | def traverse_core(core_area, world_size=(60, 60),
neighbor_func=get_moore_neighbors_toroidal):
"""
Treat cells in core_area like a graph and traverse it to
see how many connected components there are.
"""
if not core_area:
return []
core_area = [tuple(i) for i in core_... | python | def traverse_core(core_area, world_size=(60, 60),
neighbor_func=get_moore_neighbors_toroidal):
"""
Treat cells in core_area like a graph and traverse it to
see how many connected components there are.
"""
if not core_area:
return []
core_area = [tuple(i) for i in core_... | [
"def",
"traverse_core",
"(",
"core_area",
",",
"world_size",
"=",
"(",
"60",
",",
"60",
")",
",",
"neighbor_func",
"=",
"get_moore_neighbors_toroidal",
")",
":",
"if",
"not",
"core_area",
":",
"return",
"[",
"]",
"core_area",
"=",
"[",
"tuple",
"(",
"i",
... | Treat cells in core_area like a graph and traverse it to
see how many connected components there are. | [
"Treat",
"cells",
"in",
"core_area",
"like",
"a",
"graph",
"and",
"traverse",
"it",
"to",
"see",
"how",
"many",
"connected",
"components",
"there",
"are",
"."
] | 7beb0166ccefad5fa722215b030ac2a53d62b59e | https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/patch_analysis.py#L376-L406 |
238,591 | samisalkosuo/pipapp | pipapp/pipapp.py | parse_command_line_args | def parse_command_line_args():
"""parse command line args"""
parser = argparse.ArgumentParser(description='PipApp. {}'.format(DESCRIPTION))
parser.add_argument(
'-d', '--dir',
metavar='DIR',
help='Root directory where to create new project files and dirs. Default is current directory... | python | def parse_command_line_args():
"""parse command line args"""
parser = argparse.ArgumentParser(description='PipApp. {}'.format(DESCRIPTION))
parser.add_argument(
'-d', '--dir',
metavar='DIR',
help='Root directory where to create new project files and dirs. Default is current directory... | [
"def",
"parse_command_line_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'PipApp. {}'",
".",
"format",
"(",
"DESCRIPTION",
")",
")",
"parser",
".",
"add_argument",
"(",
"'-d'",
",",
"'--dir'",
",",
"metavar",... | parse command line args | [
"parse",
"command",
"line",
"args"
] | cd39e664c7c3d4d50d821ebf94f9f7836eefccb4 | https://github.com/samisalkosuo/pipapp/blob/cd39e664c7c3d4d50d821ebf94f9f7836eefccb4/pipapp/pipapp.py#L44-L62 |
238,592 | realestate-com-au/dashmat | dashmat/actions.py | requirements | def requirements(collector):
"""Just print out the requirements"""
out = sys.stdout
artifact = collector.configuration['dashmat'].artifact
if artifact not in (None, "", NotSpecified):
if isinstance(artifact, six.string_types):
out = open(artifact, 'w')
else:
out =... | python | def requirements(collector):
"""Just print out the requirements"""
out = sys.stdout
artifact = collector.configuration['dashmat'].artifact
if artifact not in (None, "", NotSpecified):
if isinstance(artifact, six.string_types):
out = open(artifact, 'w')
else:
out =... | [
"def",
"requirements",
"(",
"collector",
")",
":",
"out",
"=",
"sys",
".",
"stdout",
"artifact",
"=",
"collector",
".",
"configuration",
"[",
"'dashmat'",
"]",
".",
"artifact",
"if",
"artifact",
"not",
"in",
"(",
"None",
",",
"\"\"",
",",
"NotSpecified",
... | Just print out the requirements | [
"Just",
"print",
"out",
"the",
"requirements"
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/actions.py#L68-L80 |
238,593 | realestate-com-au/dashmat | dashmat/actions.py | run_checks | def run_checks(collector):
"""Just run the checks for our modules"""
artifact = collector.configuration["dashmat"].artifact
chosen = artifact
if chosen in (None, "", NotSpecified):
chosen = None
dashmat = collector.configuration["dashmat"]
modules = collector.configuration["__active_mod... | python | def run_checks(collector):
"""Just run the checks for our modules"""
artifact = collector.configuration["dashmat"].artifact
chosen = artifact
if chosen in (None, "", NotSpecified):
chosen = None
dashmat = collector.configuration["dashmat"]
modules = collector.configuration["__active_mod... | [
"def",
"run_checks",
"(",
"collector",
")",
":",
"artifact",
"=",
"collector",
".",
"configuration",
"[",
"\"dashmat\"",
"]",
".",
"artifact",
"chosen",
"=",
"artifact",
"if",
"chosen",
"in",
"(",
"None",
",",
"\"\"",
",",
"NotSpecified",
")",
":",
"chosen... | Just run the checks for our modules | [
"Just",
"run",
"the",
"checks",
"for",
"our",
"modules"
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/actions.py#L83-L106 |
238,594 | realestate-com-au/dashmat | dashmat/actions.py | list_npm_modules | def list_npm_modules(collector, no_print=False):
"""List the npm modules that get installed in a docker image for the react server"""
default = ReactServer().default_npm_deps()
for _, module in sorted(collector.configuration["__active_modules__"].items()):
default.update(module.npm_deps())
if n... | python | def list_npm_modules(collector, no_print=False):
"""List the npm modules that get installed in a docker image for the react server"""
default = ReactServer().default_npm_deps()
for _, module in sorted(collector.configuration["__active_modules__"].items()):
default.update(module.npm_deps())
if n... | [
"def",
"list_npm_modules",
"(",
"collector",
",",
"no_print",
"=",
"False",
")",
":",
"default",
"=",
"ReactServer",
"(",
")",
".",
"default_npm_deps",
"(",
")",
"for",
"_",
",",
"module",
"in",
"sorted",
"(",
"collector",
".",
"configuration",
"[",
"\"__a... | List the npm modules that get installed in a docker image for the react server | [
"List",
"the",
"npm",
"modules",
"that",
"get",
"installed",
"in",
"a",
"docker",
"image",
"for",
"the",
"react",
"server"
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/actions.py#L109-L117 |
238,595 | realestate-com-au/dashmat | dashmat/actions.py | collect_dashboard_js | def collect_dashboard_js(collector):
"""Generate dashboard javascript for each dashboard"""
dashmat = collector.configuration["dashmat"]
modules = collector.configuration["__active_modules__"]
compiled_static_prep = dashmat.compiled_static_prep
compiled_static_folder = dashmat.compiled_static_folde... | python | def collect_dashboard_js(collector):
"""Generate dashboard javascript for each dashboard"""
dashmat = collector.configuration["dashmat"]
modules = collector.configuration["__active_modules__"]
compiled_static_prep = dashmat.compiled_static_prep
compiled_static_folder = dashmat.compiled_static_folde... | [
"def",
"collect_dashboard_js",
"(",
"collector",
")",
":",
"dashmat",
"=",
"collector",
".",
"configuration",
"[",
"\"dashmat\"",
"]",
"modules",
"=",
"collector",
".",
"configuration",
"[",
"\"__active_modules__\"",
"]",
"compiled_static_prep",
"=",
"dashmat",
".",... | Generate dashboard javascript for each dashboard | [
"Generate",
"dashboard",
"javascript",
"for",
"each",
"dashboard"
] | 433886e52698f0ddb9956f087b76041966c3bcd1 | https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/actions.py#L120-L138 |
238,596 | koriakin/binflakes | binflakes/sexpr/read.py | read_file | def read_file(file, filename='<input>'):
"""This is a generator that yields all top-level S-expression nodes from
a given file object."""
reader = Reader(filename)
for line in file:
yield from reader.feed_line(line)
reader.finish() | python | def read_file(file, filename='<input>'):
"""This is a generator that yields all top-level S-expression nodes from
a given file object."""
reader = Reader(filename)
for line in file:
yield from reader.feed_line(line)
reader.finish() | [
"def",
"read_file",
"(",
"file",
",",
"filename",
"=",
"'<input>'",
")",
":",
"reader",
"=",
"Reader",
"(",
"filename",
")",
"for",
"line",
"in",
"file",
":",
"yield",
"from",
"reader",
".",
"feed_line",
"(",
"line",
")",
"reader",
".",
"finish",
"(",
... | This is a generator that yields all top-level S-expression nodes from
a given file object. | [
"This",
"is",
"a",
"generator",
"that",
"yields",
"all",
"top",
"-",
"level",
"S",
"-",
"expression",
"nodes",
"from",
"a",
"given",
"file",
"object",
"."
] | f059cecadf1c605802a713c62375b5bd5606d53f | https://github.com/koriakin/binflakes/blob/f059cecadf1c605802a713c62375b5bd5606d53f/binflakes/sexpr/read.py#L340-L346 |
238,597 | koriakin/binflakes | binflakes/sexpr/read.py | Reader._feed_node | def _feed_node(self, value, loc):
"""A helper method called when an S-expression has been recognized.
Like feed_line, this is a generator that yields newly recognized
top-level expressions. If the reader is currently at the top level,
simply yields the passed expression. Otherwise, it ... | python | def _feed_node(self, value, loc):
"""A helper method called when an S-expression has been recognized.
Like feed_line, this is a generator that yields newly recognized
top-level expressions. If the reader is currently at the top level,
simply yields the passed expression. Otherwise, it ... | [
"def",
"_feed_node",
"(",
"self",
",",
"value",
",",
"loc",
")",
":",
"node",
"=",
"GenericNode",
"(",
"value",
",",
"loc",
")",
"if",
"not",
"self",
".",
"stack",
":",
"yield",
"node",
"else",
":",
"top",
"=",
"self",
".",
"stack",
"[",
"-",
"1"... | A helper method called when an S-expression has been recognized.
Like feed_line, this is a generator that yields newly recognized
top-level expressions. If the reader is currently at the top level,
simply yields the passed expression. Otherwise, it appends it
to whatever is currently b... | [
"A",
"helper",
"method",
"called",
"when",
"an",
"S",
"-",
"expression",
"has",
"been",
"recognized",
".",
"Like",
"feed_line",
"this",
"is",
"a",
"generator",
"that",
"yields",
"newly",
"recognized",
"top",
"-",
"level",
"expressions",
".",
"If",
"the",
"... | f059cecadf1c605802a713c62375b5bd5606d53f | https://github.com/koriakin/binflakes/blob/f059cecadf1c605802a713c62375b5bd5606d53f/binflakes/sexpr/read.py#L309-L326 |
238,598 | pawelzny/context-loop | cl/loop.py | Loop.run_until_complete | def run_until_complete(self):
"""Run loop until all futures are done.
Schedule futures for execution and wait until all are done.
Return value from future, or list of values if multiple
futures had been passed to constructor or gather method.
All results will be in the same ord... | python | def run_until_complete(self):
"""Run loop until all futures are done.
Schedule futures for execution and wait until all are done.
Return value from future, or list of values if multiple
futures had been passed to constructor or gather method.
All results will be in the same ord... | [
"def",
"run_until_complete",
"(",
"self",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"loop",
".",
"run_until_complete",
"(",
"self",
".",
"futures",
")",
"except",
"asyncio",
".",
"futures",
".",
"CancelledError",
":",
"return",
"None",
"else",
":",... | Run loop until all futures are done.
Schedule futures for execution and wait until all are done.
Return value from future, or list of values if multiple
futures had been passed to constructor or gather method.
All results will be in the same order as order of futures passed to construc... | [
"Run",
"loop",
"until",
"all",
"futures",
"are",
"done",
"."
] | 2d3280bc4294c5e7d8590a09029c5aa2a04e8565 | https://github.com/pawelzny/context-loop/blob/2d3280bc4294c5e7d8590a09029c5aa2a04e8565/cl/loop.py#L128-L165 |
238,599 | aganezov/gos-asm | gos_asm/algo/shared/gos_asm_bg.py | get_irregular_vertex | def get_irregular_vertex(bgedge):
"""
This method is called only in irregular edges in current implementation, thus at least one edge will be irregular
"""
if not bgedge.is_irregular_edge:
raise Exception("trying to retrieve an irregular vertex from regular edge")
return bgedge.vertex1 if bg... | python | def get_irregular_vertex(bgedge):
"""
This method is called only in irregular edges in current implementation, thus at least one edge will be irregular
"""
if not bgedge.is_irregular_edge:
raise Exception("trying to retrieve an irregular vertex from regular edge")
return bgedge.vertex1 if bg... | [
"def",
"get_irregular_vertex",
"(",
"bgedge",
")",
":",
"if",
"not",
"bgedge",
".",
"is_irregular_edge",
":",
"raise",
"Exception",
"(",
"\"trying to retrieve an irregular vertex from regular edge\"",
")",
"return",
"bgedge",
".",
"vertex1",
"if",
"bgedge",
".",
"vert... | This method is called only in irregular edges in current implementation, thus at least one edge will be irregular | [
"This",
"method",
"is",
"called",
"only",
"in",
"irregular",
"edges",
"in",
"current",
"implementation",
"thus",
"at",
"least",
"one",
"edge",
"will",
"be",
"irregular"
] | 7161d80344dc32db47221a0503a43e30433f1db0 | https://github.com/aganezov/gos-asm/blob/7161d80344dc32db47221a0503a43e30433f1db0/gos_asm/algo/shared/gos_asm_bg.py#L17-L23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.