repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
alphagov/notifications-python-client | notifications_python_client/authentication.py | create_jwt_token | def create_jwt_token(secret, client_id):
"""
Create JWT token for GOV.UK Notify
Tokens have standard header:
{
"typ": "JWT",
"alg": "HS256"
}
Claims consist of:
iss: identifier for the client
iat: issued at in epoch seconds (UTC)
:param secret: Application signing ... | python | def create_jwt_token(secret, client_id):
"""
Create JWT token for GOV.UK Notify
Tokens have standard header:
{
"typ": "JWT",
"alg": "HS256"
}
Claims consist of:
iss: identifier for the client
iat: issued at in epoch seconds (UTC)
:param secret: Application signing ... | [
"def",
"create_jwt_token",
"(",
"secret",
",",
"client_id",
")",
":",
"assert",
"secret",
",",
"\"Missing secret key\"",
"assert",
"client_id",
",",
"\"Missing client id\"",
"headers",
"=",
"{",
"\"typ\"",
":",
"__type__",
",",
"\"alg\"",
":",
"__algorithm__",
"}"... | Create JWT token for GOV.UK Notify
Tokens have standard header:
{
"typ": "JWT",
"alg": "HS256"
}
Claims consist of:
iss: identifier for the client
iat: issued at in epoch seconds (UTC)
:param secret: Application signing secret
:param client_id: Identifier for the clien... | [
"Create",
"JWT",
"token",
"for",
"GOV",
".",
"UK",
"Notify"
] | train | https://github.com/alphagov/notifications-python-client/blob/b397aed212acf15b1b1e049da2654d9a230f72d2/notifications_python_client/authentication.py#L25-L56 |
alphagov/notifications-python-client | notifications_python_client/authentication.py | get_token_issuer | def get_token_issuer(token):
"""
Issuer of a token is the identifier used to recover the secret
Need to extract this from token to ensure we can proceed to the signature validation stage
Does not check validity of the token
:param token: signed JWT token
:return issuer: iss field of the JWT toke... | python | def get_token_issuer(token):
"""
Issuer of a token is the identifier used to recover the secret
Need to extract this from token to ensure we can proceed to the signature validation stage
Does not check validity of the token
:param token: signed JWT token
:return issuer: iss field of the JWT toke... | [
"def",
"get_token_issuer",
"(",
"token",
")",
":",
"try",
":",
"unverified",
"=",
"decode_token",
"(",
"token",
")",
"if",
"'iss'",
"not",
"in",
"unverified",
":",
"raise",
"TokenIssuerError",
"return",
"unverified",
".",
"get",
"(",
"'iss'",
")",
"except",
... | Issuer of a token is the identifier used to recover the secret
Need to extract this from token to ensure we can proceed to the signature validation stage
Does not check validity of the token
:param token: signed JWT token
:return issuer: iss field of the JWT token
:raises TokenIssuerError: if iss fi... | [
"Issuer",
"of",
"a",
"token",
"is",
"the",
"identifier",
"used",
"to",
"recover",
"the",
"secret",
"Need",
"to",
"extract",
"this",
"from",
"token",
"to",
"ensure",
"we",
"can",
"proceed",
"to",
"the",
"signature",
"validation",
"stage",
"Does",
"not",
"ch... | train | https://github.com/alphagov/notifications-python-client/blob/b397aed212acf15b1b1e049da2654d9a230f72d2/notifications_python_client/authentication.py#L59-L77 |
alphagov/notifications-python-client | notifications_python_client/authentication.py | decode_jwt_token | def decode_jwt_token(token, secret):
"""
Validates and decodes the JWT token
Token checked for
- signature of JWT token
- token issued date is valid
:param token: jwt token
:param secret: client specific secret
:return boolean: True if valid token, False otherwise
:raises To... | python | def decode_jwt_token(token, secret):
"""
Validates and decodes the JWT token
Token checked for
- signature of JWT token
- token issued date is valid
:param token: jwt token
:param secret: client specific secret
:return boolean: True if valid token, False otherwise
:raises To... | [
"def",
"decode_jwt_token",
"(",
"token",
",",
"secret",
")",
":",
"try",
":",
"# check signature of the token",
"decoded_token",
"=",
"jwt",
".",
"decode",
"(",
"token",
",",
"key",
"=",
"secret",
".",
"encode",
"(",
")",
",",
"verify",
"=",
"True",
",",
... | Validates and decodes the JWT token
Token checked for
- signature of JWT token
- token issued date is valid
:param token: jwt token
:param secret: client specific secret
:return boolean: True if valid token, False otherwise
:raises TokenIssuerError: if iss field not present
:rai... | [
"Validates",
"and",
"decodes",
"the",
"JWT",
"token",
"Token",
"checked",
"for",
"-",
"signature",
"of",
"JWT",
"token",
"-",
"token",
"issued",
"date",
"is",
"valid"
] | train | https://github.com/alphagov/notifications-python-client/blob/b397aed212acf15b1b1e049da2654d9a230f72d2/notifications_python_client/authentication.py#L80-L121 |
apertium/streamparser | streamparser.py | parse | def parse(stream, with_text=False): # type: (Iterator[str], bool) -> Iterator[Union[Tuple[str, LexicalUnit], LexicalUnit]]
"""Generates lexical units from a character stream.
Args:
stream (Iterator[str]): A character stream containing lexical units, superblanks and other text.
with_text (Optio... | python | def parse(stream, with_text=False): # type: (Iterator[str], bool) -> Iterator[Union[Tuple[str, LexicalUnit], LexicalUnit]]
"""Generates lexical units from a character stream.
Args:
stream (Iterator[str]): A character stream containing lexical units, superblanks and other text.
with_text (Optio... | [
"def",
"parse",
"(",
"stream",
",",
"with_text",
"=",
"False",
")",
":",
"# type: (Iterator[str], bool) -> Iterator[Union[Tuple[str, LexicalUnit], LexicalUnit]]",
"buffer",
"=",
"''",
"text_buffer",
"=",
"''",
"in_lexical_unit",
"=",
"False",
"in_superblank",
"=",
"False"... | Generates lexical units from a character stream.
Args:
stream (Iterator[str]): A character stream containing lexical units, superblanks and other text.
with_text (Optional[bool]): A boolean defining whether to output preceding text with each lexical unit.
Yields:
:class:`LexicalUnit`: ... | [
"Generates",
"lexical",
"units",
"from",
"a",
"character",
"stream",
"."
] | train | https://github.com/apertium/streamparser/blob/dd9d1566af47b8b2babbc172b42706579d52e422/streamparser.py#L187-L239 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.to_gnuplot_datafile | def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be writt... | python | def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be writt... | [
"def",
"to_gnuplot_datafile",
"(",
"self",
",",
"datafilepath",
")",
":",
"try",
":",
"datafile",
"=",
"file",
"(",
"datafilepath",
",",
"\"wb\"",
")",
"except",
"Exception",
":",
"return",
"False",
"if",
"self",
".",
"_timestampFormat",
"is",
"None",
":",
... | Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be written, :py:const:`False` otherwise.
:rtype: bool... | [
"Dumps",
"the",
"TimeSeries",
"into",
"a",
"gnuplot",
"compatible",
"data",
"file",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L103-L131 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.from_twodim_list | def from_twodim_list(cls, datalist, tsformat=None):
"""Creates a new TimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used as timestamp in the predefine... | python | def from_twodim_list(cls, datalist, tsformat=None):
"""Creates a new TimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used as timestamp in the predefine... | [
"def",
"from_twodim_list",
"(",
"cls",
",",
"datalist",
",",
"tsformat",
"=",
"None",
")",
":",
"# create and fill the given TimeSeries",
"ts",
"=",
"TimeSeries",
"(",
")",
"ts",
".",
"set_timeformat",
"(",
"tsformat",
")",
"for",
"entry",
"in",
"datalist",
":... | Creates a new TimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used as timestamp in the predefined format,
the second represents the value. All othe... | [
"Creates",
"a",
"new",
"TimeSeries",
"instance",
"from",
"the",
"data",
"stored",
"inside",
"a",
"two",
"dimensional",
"list",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L170-L194 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.initialize_from_sql_cursor | def initialize_from_sql_cursor(self, sqlcursor):
"""Initializes the TimeSeries's data from the given SQL cursor.
You need to set the time stamp format using :py:meth:`TimeSeries.set_timeformat`.
:param SQLCursor sqlcursor: Cursor that was holds the SQL result for any given
"SELE... | python | def initialize_from_sql_cursor(self, sqlcursor):
"""Initializes the TimeSeries's data from the given SQL cursor.
You need to set the time stamp format using :py:meth:`TimeSeries.set_timeformat`.
:param SQLCursor sqlcursor: Cursor that was holds the SQL result for any given
"SELE... | [
"def",
"initialize_from_sql_cursor",
"(",
"self",
",",
"sqlcursor",
")",
":",
"# initialize the result",
"tuples",
"=",
"0",
"# add the SQL result to the time series",
"data",
"=",
"sqlcursor",
".",
"fetchmany",
"(",
")",
"while",
"0",
"<",
"len",
"(",
"data",
")"... | Initializes the TimeSeries's data from the given SQL cursor.
You need to set the time stamp format using :py:meth:`TimeSeries.set_timeformat`.
:param SQLCursor sqlcursor: Cursor that was holds the SQL result for any given
"SELECT timestamp, value, ... FROM ..." SQL query.
On... | [
"Initializes",
"the",
"TimeSeries",
"s",
"data",
"from",
"the",
"given",
"SQL",
"cursor",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L196-L223 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.convert_timestamp_to_epoch | def convert_timestamp_to_epoch(cls, timestamp, tsformat):
"""Converts the given timestamp into a float representing UNIX-epochs.
:param string timestamp: Timestamp in the defined format.
:param string tsformat: Format of the given timestamp. This is used to convert the
timestamp ... | python | def convert_timestamp_to_epoch(cls, timestamp, tsformat):
"""Converts the given timestamp into a float representing UNIX-epochs.
:param string timestamp: Timestamp in the defined format.
:param string tsformat: Format of the given timestamp. This is used to convert the
timestamp ... | [
"def",
"convert_timestamp_to_epoch",
"(",
"cls",
",",
"timestamp",
",",
"tsformat",
")",
":",
"return",
"time",
".",
"mktime",
"(",
"time",
".",
"strptime",
"(",
"timestamp",
",",
"tsformat",
")",
")"
] | Converts the given timestamp into a float representing UNIX-epochs.
:param string timestamp: Timestamp in the defined format.
:param string tsformat: Format of the given timestamp. This is used to convert the
timestamp into UNIX epochs. For valid examples take a look into
the... | [
"Converts",
"the",
"given",
"timestamp",
"into",
"a",
"float",
"representing",
"UNIX",
"-",
"epochs",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L323-L335 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.convert_epoch_to_timestamp | def convert_epoch_to_timestamp(cls, timestamp, tsformat):
"""Converts the given float representing UNIX-epochs into an actual timestamp.
:param float timestamp: Timestamp as UNIX-epochs.
:param string tsformat: Format of the given timestamp. This is used to convert the
timesta... | python | def convert_epoch_to_timestamp(cls, timestamp, tsformat):
"""Converts the given float representing UNIX-epochs into an actual timestamp.
:param float timestamp: Timestamp as UNIX-epochs.
:param string tsformat: Format of the given timestamp. This is used to convert the
timesta... | [
"def",
"convert_epoch_to_timestamp",
"(",
"cls",
",",
"timestamp",
",",
"tsformat",
")",
":",
"return",
"time",
".",
"strftime",
"(",
"tsformat",
",",
"time",
".",
"gmtime",
"(",
"timestamp",
")",
")"
] | Converts the given float representing UNIX-epochs into an actual timestamp.
:param float timestamp: Timestamp as UNIX-epochs.
:param string tsformat: Format of the given timestamp. This is used to convert the
timestamp from UNIX epochs. For valid examples take a look into the
... | [
"Converts",
"the",
"given",
"float",
"representing",
"UNIX",
"-",
"epochs",
"into",
"an",
"actual",
"timestamp",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L338-L349 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.add_entry | def add_entry(self, timestamp, data):
"""Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param numeric data: Actua... | python | def add_entry(self, timestamp, data):
"""Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param numeric data: Actua... | [
"def",
"add_entry",
"(",
"self",
",",
"timestamp",
",",
"data",
")",
":",
"self",
".",
"_normalized",
"=",
"self",
".",
"_predefinedNormalized",
"self",
".",
"_sorted",
"=",
"self",
".",
"_predefinedSorted",
"tsformat",
"=",
"self",
".",
"_timestampFormat",
... | Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param numeric data: Actual data value. | [
"Adds",
"a",
"new",
"data",
"entry",
"to",
"the",
"TimeSeries",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L351-L366 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.sort_timeseries | def sort_timeseries(self, ascending=True):
"""Sorts the data points within the TimeSeries according to their occurrence inline.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending or
descending. If this is set to descending once, the ordered parameter defined in... | python | def sort_timeseries(self, ascending=True):
"""Sorts the data points within the TimeSeries according to their occurrence inline.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending or
descending. If this is set to descending once, the ordered parameter defined in... | [
"def",
"sort_timeseries",
"(",
"self",
",",
"ascending",
"=",
"True",
")",
":",
"# the time series is sorted by default",
"if",
"ascending",
"and",
"self",
".",
"_sorted",
":",
"return",
"sortorder",
"=",
"1",
"if",
"not",
"ascending",
":",
"sortorder",
"=",
"... | Sorts the data points within the TimeSeries according to their occurrence inline.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending or
descending. If this is set to descending once, the ordered parameter defined in
:py:meth:`TimeSeries.__init__` will be se... | [
"Sorts",
"the",
"data",
"points",
"within",
"the",
"TimeSeries",
"according",
"to",
"their",
"occurrence",
"inline",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L368-L391 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.sorted_timeseries | def sorted_timeseries(self, ascending=True):
"""Returns a sorted copy of the TimeSeries, preserving the original one.
As an assumption this new TimeSeries is not ordered anymore if a new value is added.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending
... | python | def sorted_timeseries(self, ascending=True):
"""Returns a sorted copy of the TimeSeries, preserving the original one.
As an assumption this new TimeSeries is not ordered anymore if a new value is added.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending
... | [
"def",
"sorted_timeseries",
"(",
"self",
",",
"ascending",
"=",
"True",
")",
":",
"sortorder",
"=",
"1",
"if",
"not",
"ascending",
":",
"sortorder",
"=",
"-",
"1",
"data",
"=",
"sorted",
"(",
"self",
".",
"_timeseriesData",
",",
"key",
"=",
"lambda",
"... | Returns a sorted copy of the TimeSeries, preserving the original one.
As an assumption this new TimeSeries is not ordered anymore if a new value is added.
:param boolean ascending: Determines if the TimeSeries will be ordered ascending
or descending.
:return: Returns a new T... | [
"Returns",
"a",
"sorted",
"copy",
"of",
"the",
"TimeSeries",
"preserving",
"the",
"original",
"one",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L393-L416 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.normalize | def normalize(self, normalizationLevel="minute", fusionMethod="mean", interpolationMethod="linear"):
"""Normalizes the TimeSeries data points.
If this function is called, the TimeSeries gets ordered ascending
automatically. The new timestamps will represent the center of each time
bucke... | python | def normalize(self, normalizationLevel="minute", fusionMethod="mean", interpolationMethod="linear"):
"""Normalizes the TimeSeries data points.
If this function is called, the TimeSeries gets ordered ascending
automatically. The new timestamps will represent the center of each time
bucke... | [
"def",
"normalize",
"(",
"self",
",",
"normalizationLevel",
"=",
"\"minute\"",
",",
"fusionMethod",
"=",
"\"mean\"",
",",
"interpolationMethod",
"=",
"\"linear\"",
")",
":",
"# do not normalize the TimeSeries if it is already normalized, either by",
"# definition or a prior cal... | Normalizes the TimeSeries data points.
If this function is called, the TimeSeries gets ordered ascending
automatically. The new timestamps will represent the center of each time
bucket. Within a normalized TimeSeries, the temporal distance between two consecutive data points is constant.
... | [
"Normalizes",
"the",
"TimeSeries",
"data",
"points",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L418-L529 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries._check_normalization | def _check_normalization(self):
"""Checks, if the TimeSeries is normalized.
:return: Returns :py:const:`True` if all data entries of the TimeSeries have an equal temporal
distance, :py:const:`False` otherwise.
"""
lastDistance = None
distance = None
fo... | python | def _check_normalization(self):
"""Checks, if the TimeSeries is normalized.
:return: Returns :py:const:`True` if all data entries of the TimeSeries have an equal temporal
distance, :py:const:`False` otherwise.
"""
lastDistance = None
distance = None
fo... | [
"def",
"_check_normalization",
"(",
"self",
")",
":",
"lastDistance",
"=",
"None",
"distance",
"=",
"None",
"for",
"idx",
"in",
"xrange",
"(",
"len",
"(",
"self",
")",
"-",
"1",
")",
":",
"distance",
"=",
"self",
"[",
"idx",
"+",
"1",
"]",
"[",
"0"... | Checks, if the TimeSeries is normalized.
:return: Returns :py:const:`True` if all data entries of the TimeSeries have an equal temporal
distance, :py:const:`False` otherwise. | [
"Checks",
"if",
"the",
"TimeSeries",
"is",
"normalized",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L542-L563 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.apply | def apply(self, method):
"""Applies the given ForecastingAlgorithm or SmoothingMethod from the :py:mod:`pycast.methods`
module to the TimeSeries.
:param BaseMethod method: Method that should be used with the TimeSeries.
For more information about the methods take a look into their c... | python | def apply(self, method):
"""Applies the given ForecastingAlgorithm or SmoothingMethod from the :py:mod:`pycast.methods`
module to the TimeSeries.
:param BaseMethod method: Method that should be used with the TimeSeries.
For more information about the methods take a look into their c... | [
"def",
"apply",
"(",
"self",
",",
"method",
")",
":",
"# check, if the methods requirements are fullfilled",
"if",
"method",
".",
"has_to_be_normalized",
"(",
")",
"and",
"not",
"self",
".",
"_normalized",
":",
"raise",
"StandardError",
"(",
"\"method requires a norma... | Applies the given ForecastingAlgorithm or SmoothingMethod from the :py:mod:`pycast.methods`
module to the TimeSeries.
:param BaseMethod method: Method that should be used with the TimeSeries.
For more information about the methods take a look into their corresponding documentation.
... | [
"Applies",
"the",
"given",
"ForecastingAlgorithm",
"or",
"SmoothingMethod",
"from",
"the",
":",
"py",
":",
"mod",
":",
"pycast",
".",
"methods",
"module",
"to",
"the",
"TimeSeries",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L573-L590 |
T-002/pycast | pycast/common/timeseries.py | TimeSeries.sample | def sample(self, percentage):
"""Samples with replacement from the TimeSeries. Returns the sample and the remaining timeseries.
The original timeseries is not changed.
:param float percentage: How many percent of the original timeseries should be in the sample
:return: A tuple conta... | python | def sample(self, percentage):
"""Samples with replacement from the TimeSeries. Returns the sample and the remaining timeseries.
The original timeseries is not changed.
:param float percentage: How many percent of the original timeseries should be in the sample
:return: A tuple conta... | [
"def",
"sample",
"(",
"self",
",",
"percentage",
")",
":",
"if",
"not",
"(",
"0.0",
"<",
"percentage",
"<",
"1.0",
")",
":",
"raise",
"ValueError",
"(",
"\"Parameter percentage has to be in (0.0, 1.0).\"",
")",
"cls",
"=",
"self",
".",
"__class__",
"value_coun... | Samples with replacement from the TimeSeries. Returns the sample and the remaining timeseries.
The original timeseries is not changed.
:param float percentage: How many percent of the original timeseries should be in the sample
:return: A tuple containing (sample, rest) as two TimeSeries.
... | [
"Samples",
"with",
"replacement",
"from",
"the",
"TimeSeries",
".",
"Returns",
"the",
"sample",
"and",
"the",
"remaining",
"timeseries",
".",
"The",
"original",
"timeseries",
"is",
"not",
"changed",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L592-L618 |
T-002/pycast | pycast/common/timeseries.py | MultiDimensionalTimeSeries.add_entry | def add_entry(self, timestamp, data):
"""Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param list data: A list c... | python | def add_entry(self, timestamp, data):
"""Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param list data: A list c... | [
"def",
"add_entry",
"(",
"self",
",",
"timestamp",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"data",
"=",
"[",
"data",
"]",
"if",
"len",
"(",
"data",
")",
"!=",
"self",
".",
"_dimensionCount",
":",
"raise... | Adds a new data entry to the TimeSeries.
:param timestamp: Time stamp of the data.
This has either to be a float representing the UNIX epochs
or a string containing a timestamp in the given format.
:param list data: A list containing the actual dimension values.
:... | [
"Adds",
"a",
"new",
"data",
"entry",
"to",
"the",
"TimeSeries",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L656-L680 |
T-002/pycast | pycast/common/timeseries.py | MultiDimensionalTimeSeries.to_twodim_list | def to_twodim_list(self):
"""Serializes the MultiDimensionalTimeSeries data into a two dimensional list of [timestamp, [values]] pairs.
:return: Returns a two dimensional list containing [timestamp, [values]] pairs.
:rtype: list
"""
if self._timestampFormat is None:
... | python | def to_twodim_list(self):
"""Serializes the MultiDimensionalTimeSeries data into a two dimensional list of [timestamp, [values]] pairs.
:return: Returns a two dimensional list containing [timestamp, [values]] pairs.
:rtype: list
"""
if self._timestampFormat is None:
... | [
"def",
"to_twodim_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"_timestampFormat",
"is",
"None",
":",
"return",
"self",
".",
"_timeseriesData",
"datalist",
"=",
"[",
"]",
"append",
"=",
"datalist",
".",
"append",
"convert",
"=",
"TimeSeries",
".",
"con... | Serializes the MultiDimensionalTimeSeries data into a two dimensional list of [timestamp, [values]] pairs.
:return: Returns a two dimensional list containing [timestamp, [values]] pairs.
:rtype: list | [
"Serializes",
"the",
"MultiDimensionalTimeSeries",
"data",
"into",
"a",
"two",
"dimensional",
"list",
"of",
"[",
"timestamp",
"[",
"values",
"]]",
"pairs",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L707-L722 |
T-002/pycast | pycast/common/timeseries.py | MultiDimensionalTimeSeries.from_twodim_list | def from_twodim_list(cls, datalist, tsformat=None, dimensions=1):
"""Creates a new MultiDimensionalTimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used... | python | def from_twodim_list(cls, datalist, tsformat=None, dimensions=1):
"""Creates a new MultiDimensionalTimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used... | [
"def",
"from_twodim_list",
"(",
"cls",
",",
"datalist",
",",
"tsformat",
"=",
"None",
",",
"dimensions",
"=",
"1",
")",
":",
"# create and fill the given TimeSeries",
"ts",
"=",
"MultiDimensionalTimeSeries",
"(",
"dimensions",
"=",
"dimensions",
")",
"ts",
".",
... | Creates a new MultiDimensionalTimeSeries instance from the data stored inside a two dimensional list.
:param list datalist: List containing multiple iterables with at least two values.
The first item will always be used as timestamp in the predefined format,
the second is a list, con... | [
"Creates",
"a",
"new",
"MultiDimensionalTimeSeries",
"instance",
"from",
"the",
"data",
"stored",
"inside",
"a",
"two",
"dimensional",
"list",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L725-L750 |
T-002/pycast | pycast/common/timeseries.py | MultiDimensionalTimeSeries.to_gnuplot_datafile | def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be writt... | python | def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be writt... | [
"def",
"to_gnuplot_datafile",
"(",
"self",
",",
"datafilepath",
")",
":",
"try",
":",
"datafile",
"=",
"file",
"(",
"datafilepath",
",",
"\"wb\"",
")",
"except",
"Exception",
":",
"return",
"False",
"if",
"self",
".",
"_timestampFormat",
"is",
"None",
":",
... | Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be written, :py:const:`False` otherwise.
:rtype: boolean | [
"Dumps",
"the",
"TimeSeries",
"into",
"a",
"gnuplot",
"compatible",
"data",
"file",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L850-L879 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | FileFilter.include | def include(self, filename, is_file):
"""
Determines if a file should be included in a project for uploading.
If file_exclude_regex is empty it will include everything.
:param filename: str: filename to match it should not include directory
:param is_file: bool: is this a file if... | python | def include(self, filename, is_file):
"""
Determines if a file should be included in a project for uploading.
If file_exclude_regex is empty it will include everything.
:param filename: str: filename to match it should not include directory
:param is_file: bool: is this a file if... | [
"def",
"include",
"(",
"self",
",",
"filename",
",",
"is_file",
")",
":",
"if",
"self",
".",
"exclude_regex",
"and",
"is_file",
":",
"if",
"self",
".",
"exclude_regex",
".",
"match",
"(",
"filename",
")",
":",
"return",
"False",
"return",
"True",
"else",... | Determines if a file should be included in a project for uploading.
If file_exclude_regex is empty it will include everything.
:param filename: str: filename to match it should not include directory
:param is_file: bool: is this a file if not this will always return true
:return: boolean... | [
"Determines",
"if",
"a",
"file",
"should",
"be",
"included",
"in",
"a",
"project",
"for",
"uploading",
".",
"If",
"file_exclude_regex",
"is",
"empty",
"it",
"will",
"include",
"everything",
".",
":",
"param",
"filename",
":",
"str",
":",
"filename",
"to",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L24-L37 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | FilenamePatternList.add_filename_pattern | def add_filename_pattern(self, dir_name, pattern):
"""
Adds a Unix shell-style wildcard pattern underneath the specified directory
:param dir_name: str: directory that contains the pattern
:param pattern: str: Unix shell-style wildcard pattern
"""
full_pattern = '{}{}{}'.... | python | def add_filename_pattern(self, dir_name, pattern):
"""
Adds a Unix shell-style wildcard pattern underneath the specified directory
:param dir_name: str: directory that contains the pattern
:param pattern: str: Unix shell-style wildcard pattern
"""
full_pattern = '{}{}{}'.... | [
"def",
"add_filename_pattern",
"(",
"self",
",",
"dir_name",
",",
"pattern",
")",
":",
"full_pattern",
"=",
"'{}{}{}'",
".",
"format",
"(",
"dir_name",
",",
"os",
".",
"sep",
",",
"pattern",
")",
"filename_regex",
"=",
"fnmatch",
".",
"translate",
"(",
"fu... | Adds a Unix shell-style wildcard pattern underneath the specified directory
:param dir_name: str: directory that contains the pattern
:param pattern: str: Unix shell-style wildcard pattern | [
"Adds",
"a",
"Unix",
"shell",
"-",
"style",
"wildcard",
"pattern",
"underneath",
"the",
"specified",
"directory",
":",
"param",
"dir_name",
":",
"str",
":",
"directory",
"that",
"contains",
"the",
"pattern",
":",
"param",
"pattern",
":",
"str",
":",
"Unix",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L47-L55 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | FilenamePatternList.include | def include(self, path):
"""
Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path
"""
for regex_item in self.regex_list:
if regex_item.match(path):
return Fa... | python | def include(self, path):
"""
Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path
"""
for regex_item in self.regex_list:
if regex_item.match(path):
return Fa... | [
"def",
"include",
"(",
"self",
",",
"path",
")",
":",
"for",
"regex_item",
"in",
"self",
".",
"regex_list",
":",
"if",
"regex_item",
".",
"match",
"(",
"path",
")",
":",
"return",
"False",
"return",
"True"
] | Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path | [
"Returns",
"False",
"if",
"any",
"pattern",
"matches",
"the",
"path",
":",
"param",
"path",
":",
"str",
":",
"filename",
"path",
"to",
"test",
":",
"return",
":",
"boolean",
":",
"True",
"if",
"we",
"should",
"include",
"this",
"path"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L57-L66 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | IgnoreFilePatterns.load_directory | def load_directory(self, top_path, followlinks):
"""
Traverse top_path directory and save patterns in any .ddsignore files found.
:param top_path: str: directory name we should traverse looking for ignore files
:param followlinks: boolean: should we traverse symbolic links
"""
... | python | def load_directory(self, top_path, followlinks):
"""
Traverse top_path directory and save patterns in any .ddsignore files found.
:param top_path: str: directory name we should traverse looking for ignore files
:param followlinks: boolean: should we traverse symbolic links
"""
... | [
"def",
"load_directory",
"(",
"self",
",",
"top_path",
",",
"followlinks",
")",
":",
"for",
"dir_name",
",",
"child_dirs",
",",
"child_files",
"in",
"os",
".",
"walk",
"(",
"top_path",
",",
"followlinks",
"=",
"followlinks",
")",
":",
"for",
"child_filename"... | Traverse top_path directory and save patterns in any .ddsignore files found.
:param top_path: str: directory name we should traverse looking for ignore files
:param followlinks: boolean: should we traverse symbolic links | [
"Traverse",
"top_path",
"directory",
"and",
"save",
"patterns",
"in",
"any",
".",
"ddsignore",
"files",
"found",
".",
":",
"param",
"top_path",
":",
"str",
":",
"directory",
"name",
"we",
"should",
"traverse",
"looking",
"for",
"ignore",
"files",
":",
"param... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L77-L87 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | IgnoreFilePatterns.add_patterns | def add_patterns(self, dir_name, pattern_lines):
"""
Add patterns the should apply below dir_name
:param dir_name: str: directory that contained the patterns
:param pattern_lines: [str]: array of patterns
"""
for pattern_line in pattern_lines:
self.pattern_lis... | python | def add_patterns(self, dir_name, pattern_lines):
"""
Add patterns the should apply below dir_name
:param dir_name: str: directory that contained the patterns
:param pattern_lines: [str]: array of patterns
"""
for pattern_line in pattern_lines:
self.pattern_lis... | [
"def",
"add_patterns",
"(",
"self",
",",
"dir_name",
",",
"pattern_lines",
")",
":",
"for",
"pattern_line",
"in",
"pattern_lines",
":",
"self",
".",
"pattern_list",
".",
"add_filename_pattern",
"(",
"dir_name",
",",
"pattern_line",
")"
] | Add patterns the should apply below dir_name
:param dir_name: str: directory that contained the patterns
:param pattern_lines: [str]: array of patterns | [
"Add",
"patterns",
"the",
"should",
"apply",
"below",
"dir_name",
":",
"param",
"dir_name",
":",
"str",
":",
"directory",
"that",
"contained",
"the",
"patterns",
":",
"param",
"pattern_lines",
":",
"[",
"str",
"]",
":",
"array",
"of",
"patterns"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L89-L96 |
Duke-GCB/DukeDSClient | ddsc/core/ignorefile.py | IgnoreFilePatterns.include | def include(self, path, is_file):
"""
Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path
"""
return self.pattern_list.include(path) and self.file_filter.include(os.path.basename(path)... | python | def include(self, path, is_file):
"""
Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path
"""
return self.pattern_list.include(path) and self.file_filter.include(os.path.basename(path)... | [
"def",
"include",
"(",
"self",
",",
"path",
",",
"is_file",
")",
":",
"return",
"self",
".",
"pattern_list",
".",
"include",
"(",
"path",
")",
"and",
"self",
".",
"file_filter",
".",
"include",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")... | Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path | [
"Returns",
"False",
"if",
"any",
"pattern",
"matches",
"the",
"path",
":",
"param",
"path",
":",
"str",
":",
"filename",
"path",
"to",
"test",
":",
"return",
":",
"boolean",
":",
"True",
"if",
"we",
"should",
"include",
"this",
"path"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ignorefile.py#L105-L111 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.create_project | def create_project(self, name, description):
"""
Create a project with the specified name and description
:param name: str: unique name for this project
:param description: str: long description of this project
:return: str: name of the project
"""
self._cache_pro... | python | def create_project(self, name, description):
"""
Create a project with the specified name and description
:param name: str: unique name for this project
:param description: str: long description of this project
:return: str: name of the project
"""
self._cache_pro... | [
"def",
"create_project",
"(",
"self",
",",
"name",
",",
"description",
")",
":",
"self",
".",
"_cache_project_list_once",
"(",
")",
"if",
"name",
"in",
"[",
"project",
".",
"name",
"for",
"project",
"in",
"self",
".",
"projects",
"]",
":",
"raise",
"Dupl... | Create a project with the specified name and description
:param name: str: unique name for this project
:param description: str: long description of this project
:return: str: name of the project | [
"Create",
"a",
"project",
"with",
"the",
"specified",
"name",
"and",
"description",
":",
"param",
"name",
":",
"str",
":",
"unique",
"name",
"for",
"this",
"project",
":",
"param",
"description",
":",
"str",
":",
"long",
"description",
"of",
"this",
"proje... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L98-L110 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.delete_project | def delete_project(self, project_name):
"""
Delete a project with the specified name. Raises ItemNotFound if no such project exists
:param project_name: str: name of the project to delete
:return:
"""
project = self._get_project_for_name(project_name)
project.dele... | python | def delete_project(self, project_name):
"""
Delete a project with the specified name. Raises ItemNotFound if no such project exists
:param project_name: str: name of the project to delete
:return:
"""
project = self._get_project_for_name(project_name)
project.dele... | [
"def",
"delete_project",
"(",
"self",
",",
"project_name",
")",
":",
"project",
"=",
"self",
".",
"_get_project_for_name",
"(",
"project_name",
")",
"project",
".",
"delete",
"(",
")",
"self",
".",
"clear_project_cache",
"(",
")"
] | Delete a project with the specified name. Raises ItemNotFound if no such project exists
:param project_name: str: name of the project to delete
:return: | [
"Delete",
"a",
"project",
"with",
"the",
"specified",
"name",
".",
"Raises",
"ItemNotFound",
"if",
"no",
"such",
"project",
"exists",
":",
"param",
"project_name",
":",
"str",
":",
"name",
"of",
"the",
"project",
"to",
"delete",
":",
"return",
":"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L112-L120 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.list_files | def list_files(self, project_name):
"""
Return a list of file paths that make up project_name
:param project_name: str: specifies the name of the project to list contents of
:return: [str]: returns a list of remote paths for all files part of the specified project qq
"""
... | python | def list_files(self, project_name):
"""
Return a list of file paths that make up project_name
:param project_name: str: specifies the name of the project to list contents of
:return: [str]: returns a list of remote paths for all files part of the specified project qq
"""
... | [
"def",
"list_files",
"(",
"self",
",",
"project_name",
")",
":",
"project",
"=",
"self",
".",
"_get_project_for_name",
"(",
"project_name",
")",
"file_path_dict",
"=",
"self",
".",
"_get_file_path_dict_for_project",
"(",
"project",
")",
"return",
"list",
"(",
"f... | Return a list of file paths that make up project_name
:param project_name: str: specifies the name of the project to list contents of
:return: [str]: returns a list of remote paths for all files part of the specified project qq | [
"Return",
"a",
"list",
"of",
"file",
"paths",
"that",
"make",
"up",
"project_name",
":",
"param",
"project_name",
":",
"str",
":",
"specifies",
"the",
"name",
"of",
"the",
"project",
"to",
"list",
"contents",
"of",
":",
"return",
":",
"[",
"str",
"]",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L122-L130 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.download_file | def download_file(self, project_name, remote_path, local_path=None):
"""
Download a file from a project
When local_path is None the file will be downloaded to the base filename
:param project_name: str: name of the project to download a file from
:param remote_path: str: remote p... | python | def download_file(self, project_name, remote_path, local_path=None):
"""
Download a file from a project
When local_path is None the file will be downloaded to the base filename
:param project_name: str: name of the project to download a file from
:param remote_path: str: remote p... | [
"def",
"download_file",
"(",
"self",
",",
"project_name",
",",
"remote_path",
",",
"local_path",
"=",
"None",
")",
":",
"project",
"=",
"self",
".",
"_get_project_for_name",
"(",
"project_name",
")",
"file",
"=",
"project",
".",
"get_child_for_path",
"(",
"rem... | Download a file from a project
When local_path is None the file will be downloaded to the base filename
:param project_name: str: name of the project to download a file from
:param remote_path: str: remote path specifying which file to download
:param local_path: str: optional argument t... | [
"Download",
"a",
"file",
"from",
"a",
"project",
"When",
"local_path",
"is",
"None",
"the",
"file",
"will",
"be",
"downloaded",
"to",
"the",
"base",
"filename",
":",
"param",
"project_name",
":",
"str",
":",
"name",
"of",
"the",
"project",
"to",
"download"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L132-L142 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.upload_file | def upload_file(self, project_name, local_path, remote_path=None):
"""
Upload a file into project creating a new version if it already exists.
Will also create project and parent folders if they do not exist.
:param project_name: str: name of the project to upload a file to
:para... | python | def upload_file(self, project_name, local_path, remote_path=None):
"""
Upload a file into project creating a new version if it already exists.
Will also create project and parent folders if they do not exist.
:param project_name: str: name of the project to upload a file to
:para... | [
"def",
"upload_file",
"(",
"self",
",",
"project_name",
",",
"local_path",
",",
"remote_path",
"=",
"None",
")",
":",
"project",
"=",
"self",
".",
"_get_or_create_project",
"(",
"project_name",
")",
"file_upload",
"=",
"FileUpload",
"(",
"project",
",",
"remot... | Upload a file into project creating a new version if it already exists.
Will also create project and parent folders if they do not exist.
:param project_name: str: name of the project to upload a file to
:param local_path: str: path to download the file into
:param remote_path: str: remo... | [
"Upload",
"a",
"file",
"into",
"project",
"creating",
"a",
"new",
"version",
"if",
"it",
"already",
"exists",
".",
"Will",
"also",
"create",
"project",
"and",
"parent",
"folders",
"if",
"they",
"do",
"not",
"exist",
".",
":",
"param",
"project_name",
":",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L144-L154 |
Duke-GCB/DukeDSClient | ddsc/sdk/dukeds.py | Session.delete_file | def delete_file(self, project_name, remote_path):
"""
Delete a file or folder from a project
:param project_name: str: name of the project containing a file we will delete
:param remote_path: str: remote path specifying file to delete
"""
project = self._get_or_create_pro... | python | def delete_file(self, project_name, remote_path):
"""
Delete a file or folder from a project
:param project_name: str: name of the project containing a file we will delete
:param remote_path: str: remote path specifying file to delete
"""
project = self._get_or_create_pro... | [
"def",
"delete_file",
"(",
"self",
",",
"project_name",
",",
"remote_path",
")",
":",
"project",
"=",
"self",
".",
"_get_or_create_project",
"(",
"project_name",
")",
"remote_file",
"=",
"project",
".",
"get_child_for_path",
"(",
"remote_path",
")",
"remote_file",... | Delete a file or folder from a project
:param project_name: str: name of the project containing a file we will delete
:param remote_path: str: remote path specifying file to delete | [
"Delete",
"a",
"file",
"or",
"folder",
"from",
"a",
"project",
":",
"param",
"project_name",
":",
"str",
":",
"name",
"of",
"the",
"project",
"containing",
"a",
"file",
"we",
"will",
"delete",
":",
"param",
"remote_path",
":",
"str",
":",
"remote",
"path... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/dukeds.py#L190-L198 |
twisted/txaws | txaws/client/_producers.py | FileBodyProducer._determineLength | def _determineLength(self, fObj):
"""
Determine how many bytes can be read out of C{fObj} (assuming it is not
modified from this point on). If the determination cannot be made,
return C{UNKNOWN_LENGTH}.
"""
try:
seek = fObj.seek
tell = fObj.tell
... | python | def _determineLength(self, fObj):
"""
Determine how many bytes can be read out of C{fObj} (assuming it is not
modified from this point on). If the determination cannot be made,
return C{UNKNOWN_LENGTH}.
"""
try:
seek = fObj.seek
tell = fObj.tell
... | [
"def",
"_determineLength",
"(",
"self",
",",
"fObj",
")",
":",
"try",
":",
"seek",
"=",
"fObj",
".",
"seek",
"tell",
"=",
"fObj",
".",
"tell",
"except",
"AttributeError",
":",
"return",
"UNKNOWN_LENGTH",
"originalPosition",
"=",
"tell",
"(",
")",
"seek",
... | Determine how many bytes can be read out of C{fObj} (assuming it is not
modified from this point on). If the determination cannot be made,
return C{UNKNOWN_LENGTH}. | [
"Determine",
"how",
"many",
"bytes",
"can",
"be",
"read",
"out",
"of",
"C",
"{",
"fObj",
"}",
"(",
"assuming",
"it",
"is",
"not",
"modified",
"from",
"this",
"point",
"on",
")",
".",
"If",
"the",
"determination",
"cannot",
"be",
"made",
"return",
"C",
... | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/_producers.py#L47-L62 |
twisted/txaws | txaws/client/_producers.py | FileBodyProducer.startProducing | def startProducing(self, consumer):
"""
Start a cooperative task which will read bytes from the input file and
write them to C{consumer}. Return a L{Deferred} which fires after all
bytes have been written.
@param consumer: Any L{IConsumer} provider
"""
self._tas... | python | def startProducing(self, consumer):
"""
Start a cooperative task which will read bytes from the input file and
write them to C{consumer}. Return a L{Deferred} which fires after all
bytes have been written.
@param consumer: Any L{IConsumer} provider
"""
self._tas... | [
"def",
"startProducing",
"(",
"self",
",",
"consumer",
")",
":",
"self",
".",
"_task",
"=",
"self",
".",
"_cooperate",
"(",
"self",
".",
"_writeloop",
"(",
"consumer",
")",
")",
"d",
"=",
"self",
".",
"_task",
".",
"whenDone",
"(",
")",
"def",
"maybe... | Start a cooperative task which will read bytes from the input file and
write them to C{consumer}. Return a L{Deferred} which fires after all
bytes have been written.
@param consumer: Any L{IConsumer} provider | [
"Start",
"a",
"cooperative",
"task",
"which",
"will",
"read",
"bytes",
"from",
"the",
"input",
"file",
"and",
"write",
"them",
"to",
"C",
"{",
"consumer",
"}",
".",
"Return",
"a",
"L",
"{",
"Deferred",
"}",
"which",
"fires",
"after",
"all",
"bytes",
"h... | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/_producers.py#L74-L90 |
twisted/txaws | txaws/client/_producers.py | FileBodyProducer._writeloop | def _writeloop(self, consumer):
"""
Return an iterator which reads one chunk of bytes from the input file
and writes them to the consumer for each time it is iterated.
"""
while True:
bytes = self._inputFile.read(self._readSize)
if not bytes:
... | python | def _writeloop(self, consumer):
"""
Return an iterator which reads one chunk of bytes from the input file
and writes them to the consumer for each time it is iterated.
"""
while True:
bytes = self._inputFile.read(self._readSize)
if not bytes:
... | [
"def",
"_writeloop",
"(",
"self",
",",
"consumer",
")",
":",
"while",
"True",
":",
"bytes",
"=",
"self",
".",
"_inputFile",
".",
"read",
"(",
"self",
".",
"_readSize",
")",
"if",
"not",
"bytes",
":",
"self",
".",
"_inputFile",
".",
"close",
"(",
")",... | Return an iterator which reads one chunk of bytes from the input file
and writes them to the consumer for each time it is iterated. | [
"Return",
"an",
"iterator",
"which",
"reads",
"one",
"chunk",
"of",
"bytes",
"from",
"the",
"input",
"file",
"and",
"writes",
"them",
"to",
"the",
"consumer",
"for",
"each",
"time",
"it",
"is",
"iterated",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/_producers.py#L93-L104 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ProjectUpload._count_differences | def _count_differences(self):
"""
Count how many things we will be sending.
:param local_project: LocalProject project we will send data from
:return: LocalOnlyCounter contains counts for various items
"""
different_items = LocalOnlyCounter(self.config.upload_bytes_per_ch... | python | def _count_differences(self):
"""
Count how many things we will be sending.
:param local_project: LocalProject project we will send data from
:return: LocalOnlyCounter contains counts for various items
"""
different_items = LocalOnlyCounter(self.config.upload_bytes_per_ch... | [
"def",
"_count_differences",
"(",
"self",
")",
":",
"different_items",
"=",
"LocalOnlyCounter",
"(",
"self",
".",
"config",
".",
"upload_bytes_per_chunk",
")",
"different_items",
".",
"walk_project",
"(",
"self",
".",
"local_project",
")",
"return",
"different_items... | Count how many things we will be sending.
:param local_project: LocalProject project we will send data from
:return: LocalOnlyCounter contains counts for various items | [
"Count",
"how",
"many",
"things",
"we",
"will",
"be",
"sending",
".",
":",
"param",
"local_project",
":",
"LocalProject",
"project",
"we",
"will",
"send",
"data",
"from",
":",
"return",
":",
"LocalOnlyCounter",
"contains",
"counts",
"for",
"various",
"items"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L36-L44 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ProjectUpload.run | def run(self):
"""
Upload different items within local_project to remote store showing a progress bar.
"""
progress_printer = ProgressPrinter(self.different_items.total_items(), msg_verb='sending')
upload_settings = UploadSettings(self.config, self.remote_store.data_service, prog... | python | def run(self):
"""
Upload different items within local_project to remote store showing a progress bar.
"""
progress_printer = ProgressPrinter(self.different_items.total_items(), msg_verb='sending')
upload_settings = UploadSettings(self.config, self.remote_store.data_service, prog... | [
"def",
"run",
"(",
"self",
")",
":",
"progress_printer",
"=",
"ProgressPrinter",
"(",
"self",
".",
"different_items",
".",
"total_items",
"(",
")",
",",
"msg_verb",
"=",
"'sending'",
")",
"upload_settings",
"=",
"UploadSettings",
"(",
"self",
".",
"config",
... | Upload different items within local_project to remote store showing a progress bar. | [
"Upload",
"different",
"items",
"within",
"local_project",
"to",
"remote",
"store",
"showing",
"a",
"progress",
"bar",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L53-L62 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ProjectUpload.dry_run_report | def dry_run_report(self):
"""
Returns text displaying the items that need to be uploaded or a message saying there are no files/folders
to upload.
:return: str: report text
"""
project_uploader = ProjectUploadDryRun()
project_uploader.run(self.local_project)
... | python | def dry_run_report(self):
"""
Returns text displaying the items that need to be uploaded or a message saying there are no files/folders
to upload.
:return: str: report text
"""
project_uploader = ProjectUploadDryRun()
project_uploader.run(self.local_project)
... | [
"def",
"dry_run_report",
"(",
"self",
")",
":",
"project_uploader",
"=",
"ProjectUploadDryRun",
"(",
")",
"project_uploader",
".",
"run",
"(",
"self",
".",
"local_project",
")",
"items",
"=",
"project_uploader",
".",
"upload_items",
"if",
"not",
"items",
":",
... | Returns text displaying the items that need to be uploaded or a message saying there are no files/folders
to upload.
:return: str: report text | [
"Returns",
"text",
"displaying",
"the",
"items",
"that",
"need",
"to",
"be",
"uploaded",
"or",
"a",
"message",
"saying",
"there",
"are",
"no",
"files",
"/",
"folders",
"to",
"upload",
".",
":",
"return",
":",
"str",
":",
"report",
"text"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L64-L80 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ProjectUpload.get_upload_report | def get_upload_report(self):
"""
Generate and print a report onto stdout.
"""
project = self.remote_store.fetch_remote_project(self.project_name_or_id,
must_exist=True,
inclu... | python | def get_upload_report(self):
"""
Generate and print a report onto stdout.
"""
project = self.remote_store.fetch_remote_project(self.project_name_or_id,
must_exist=True,
inclu... | [
"def",
"get_upload_report",
"(",
"self",
")",
":",
"project",
"=",
"self",
".",
"remote_store",
".",
"fetch_remote_project",
"(",
"self",
".",
"project_name_or_id",
",",
"must_exist",
"=",
"True",
",",
"include_children",
"=",
"False",
")",
"report",
"=",
"Upl... | Generate and print a report onto stdout. | [
"Generate",
"and",
"print",
"a",
"report",
"onto",
"stdout",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L89-L98 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ProjectUpload.get_url_msg | def get_url_msg(self):
"""
Print url to view the project via dds portal.
"""
msg = 'URL to view project'
project_id = self.local_project.remote_id
url = '{}: https://{}/#/project/{}'.format(msg, self.config.get_portal_url_base(), project_id)
return url | python | def get_url_msg(self):
"""
Print url to view the project via dds portal.
"""
msg = 'URL to view project'
project_id = self.local_project.remote_id
url = '{}: https://{}/#/project/{}'.format(msg, self.config.get_portal_url_base(), project_id)
return url | [
"def",
"get_url_msg",
"(",
"self",
")",
":",
"msg",
"=",
"'URL to view project'",
"project_id",
"=",
"self",
".",
"local_project",
".",
"remote_id",
"url",
"=",
"'{}: https://{}/#/project/{}'",
".",
"format",
"(",
"msg",
",",
"self",
".",
"config",
".",
"get_p... | Print url to view the project via dds portal. | [
"Print",
"url",
"to",
"view",
"the",
"project",
"via",
"dds",
"portal",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L100-L107 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | LocalOnlyCounter.visit_file | def visit_file(self, item, parent):
"""
Increments counter if item needs to be sent.
:param item: LocalFile
:param parent: LocalFolder/LocalProject
"""
if item.need_to_send:
self.files += 1
self.chunks += item.count_chunks(self.bytes_per_chunk) | python | def visit_file(self, item, parent):
"""
Increments counter if item needs to be sent.
:param item: LocalFile
:param parent: LocalFolder/LocalProject
"""
if item.need_to_send:
self.files += 1
self.chunks += item.count_chunks(self.bytes_per_chunk) | [
"def",
"visit_file",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"item",
".",
"need_to_send",
":",
"self",
".",
"files",
"+=",
"1",
"self",
".",
"chunks",
"+=",
"item",
".",
"count_chunks",
"(",
"self",
".",
"bytes_per_chunk",
")"
] | Increments counter if item needs to be sent.
:param item: LocalFile
:param parent: LocalFolder/LocalProject | [
"Increments",
"counter",
"if",
"item",
"needs",
"to",
"be",
"sent",
".",
":",
"param",
"item",
":",
"LocalFile",
":",
"param",
"parent",
":",
"LocalFolder",
"/",
"LocalProject"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L146-L154 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | LocalOnlyCounter.result_str | def result_str(self):
"""
Return a string representing the totals contained herein.
:return: str counts/types string
"""
return '{}, {}, {}'.format(LocalOnlyCounter.plural_fmt('project', self.projects),
LocalOnlyCounter.plural_fmt('folder', self... | python | def result_str(self):
"""
Return a string representing the totals contained herein.
:return: str counts/types string
"""
return '{}, {}, {}'.format(LocalOnlyCounter.plural_fmt('project', self.projects),
LocalOnlyCounter.plural_fmt('folder', self... | [
"def",
"result_str",
"(",
"self",
")",
":",
"return",
"'{}, {}, {}'",
".",
"format",
"(",
"LocalOnlyCounter",
".",
"plural_fmt",
"(",
"'project'",
",",
"self",
".",
"projects",
")",
",",
"LocalOnlyCounter",
".",
"plural_fmt",
"(",
"'folder'",
",",
"self",
".... | Return a string representing the totals contained herein.
:return: str counts/types string | [
"Return",
"a",
"string",
"representing",
"the",
"totals",
"contained",
"herein",
".",
":",
"return",
":",
"str",
"counts",
"/",
"types",
"string"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L163-L170 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | LocalOnlyCounter.plural_fmt | def plural_fmt(name, cnt):
"""
pluralize name if necessary and combine with cnt
:param name: str name of the item type
:param cnt: int number items of this type
:return: str name and cnt joined
"""
if cnt == 1:
return '{} {}'.format(cnt, name)
... | python | def plural_fmt(name, cnt):
"""
pluralize name if necessary and combine with cnt
:param name: str name of the item type
:param cnt: int number items of this type
:return: str name and cnt joined
"""
if cnt == 1:
return '{} {}'.format(cnt, name)
... | [
"def",
"plural_fmt",
"(",
"name",
",",
"cnt",
")",
":",
"if",
"cnt",
"==",
"1",
":",
"return",
"'{} {}'",
".",
"format",
"(",
"cnt",
",",
"name",
")",
"else",
":",
"return",
"'{} {}s'",
".",
"format",
"(",
"cnt",
",",
"name",
")"
] | pluralize name if necessary and combine with cnt
:param name: str name of the item type
:param cnt: int number items of this type
:return: str name and cnt joined | [
"pluralize",
"name",
"if",
"necessary",
"and",
"combine",
"with",
"cnt",
":",
"param",
"name",
":",
"str",
"name",
"of",
"the",
"item",
"type",
":",
"param",
"cnt",
":",
"int",
"number",
"items",
"of",
"this",
"type",
":",
"return",
":",
"str",
"name",... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L173-L183 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | UploadReport.visit_folder | def visit_folder(self, item, parent):
"""
Add folder to the report if it was sent.
:param item: LocalFolder folder to possibly add
:param parent: LocalFolder/LocalContent not used here
"""
if item.sent_to_remote:
self._add_report_item(item.path, item.remote_id... | python | def visit_folder(self, item, parent):
"""
Add folder to the report if it was sent.
:param item: LocalFolder folder to possibly add
:param parent: LocalFolder/LocalContent not used here
"""
if item.sent_to_remote:
self._add_report_item(item.path, item.remote_id... | [
"def",
"visit_folder",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"item",
".",
"sent_to_remote",
":",
"self",
".",
"_add_report_item",
"(",
"item",
".",
"path",
",",
"item",
".",
"remote_id",
")"
] | Add folder to the report if it was sent.
:param item: LocalFolder folder to possibly add
:param parent: LocalFolder/LocalContent not used here | [
"Add",
"folder",
"to",
"the",
"report",
"if",
"it",
"was",
"sent",
".",
":",
"param",
"item",
":",
"LocalFolder",
"folder",
"to",
"possibly",
"add",
":",
"param",
"parent",
":",
"LocalFolder",
"/",
"LocalContent",
"not",
"used",
"here"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L218-L225 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | UploadReport.visit_file | def visit_file(self, item, parent):
"""
Add file to the report if it was sent.
:param item: LocalFile file to possibly add.
:param parent: LocalFolder/LocalContent not used here
"""
if item.sent_to_remote:
self._add_report_item(item.path, item.remote_id, item.... | python | def visit_file(self, item, parent):
"""
Add file to the report if it was sent.
:param item: LocalFile file to possibly add.
:param parent: LocalFolder/LocalContent not used here
"""
if item.sent_to_remote:
self._add_report_item(item.path, item.remote_id, item.... | [
"def",
"visit_file",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"item",
".",
"sent_to_remote",
":",
"self",
".",
"_add_report_item",
"(",
"item",
".",
"path",
",",
"item",
".",
"remote_id",
",",
"item",
".",
"size",
",",
"item",
".",
"g... | Add file to the report if it was sent.
:param item: LocalFile file to possibly add.
:param parent: LocalFolder/LocalContent not used here | [
"Add",
"file",
"to",
"the",
"report",
"if",
"it",
"was",
"sent",
".",
":",
"param",
"item",
":",
"LocalFile",
"file",
"to",
"possibly",
"add",
".",
":",
"param",
"parent",
":",
"LocalFolder",
"/",
"LocalContent",
"not",
"used",
"here"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L227-L234 |
Duke-GCB/DukeDSClient | ddsc/core/upload.py | ReportItem.str_with_sizes | def str_with_sizes(self, max_name, max_remote_id, max_size):
"""
Create string for report based on internal properties using sizes to line up columns.
:param max_name: int width of the name column
:param max_remote_id: int width of the remote_id column
:return: str info from this... | python | def str_with_sizes(self, max_name, max_remote_id, max_size):
"""
Create string for report based on internal properties using sizes to line up columns.
:param max_name: int width of the name column
:param max_remote_id: int width of the remote_id column
:return: str info from this... | [
"def",
"str_with_sizes",
"(",
"self",
",",
"max_name",
",",
"max_remote_id",
",",
"max_size",
")",
":",
"name_str",
"=",
"self",
".",
"name",
".",
"ljust",
"(",
"max_name",
")",
"remote_id_str",
"=",
"self",
".",
"remote_id",
".",
"ljust",
"(",
"max_remote... | Create string for report based on internal properties using sizes to line up columns.
:param max_name: int width of the name column
:param max_remote_id: int width of the remote_id column
:return: str info from this report item | [
"Create",
"string",
"for",
"report",
"based",
"on",
"internal",
"properties",
"using",
"sizes",
"to",
"line",
"up",
"columns",
".",
":",
"param",
"max_name",
":",
"int",
"width",
"of",
"the",
"name",
"column",
":",
"param",
"max_remote_id",
":",
"int",
"wi... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/upload.py#L272-L282 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | upload_async | def upload_async(data_service_auth_data, config, upload_id,
filename, index, num_chunks_to_send, progress_queue):
"""
Method run in another process called from ParallelChunkProcessor.make_and_start_process.
:param data_service_auth_data: tuple of auth data for rebuilding DataServiceAuth
... | python | def upload_async(data_service_auth_data, config, upload_id,
filename, index, num_chunks_to_send, progress_queue):
"""
Method run in another process called from ParallelChunkProcessor.make_and_start_process.
:param data_service_auth_data: tuple of auth data for rebuilding DataServiceAuth
... | [
"def",
"upload_async",
"(",
"data_service_auth_data",
",",
"config",
",",
"upload_id",
",",
"filename",
",",
"index",
",",
"num_chunks_to_send",
",",
"progress_queue",
")",
":",
"auth",
"=",
"DataServiceAuth",
"(",
"config",
")",
"auth",
".",
"set_auth_data",
"(... | Method run in another process called from ParallelChunkProcessor.make_and_start_process.
:param data_service_auth_data: tuple of auth data for rebuilding DataServiceAuth
:param config: dds.Config configuration settings to use during upload
:param upload_id: uuid unique id of the 'upload' we are uploading ch... | [
"Method",
"run",
"in",
"another",
"process",
"called",
"from",
"ParallelChunkProcessor",
".",
"make_and_start_process",
".",
":",
"param",
"data_service_auth_data",
":",
"tuple",
"of",
"auth",
"data",
"for",
"rebuilding",
"DataServiceAuth",
":",
"param",
"config",
"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L318-L339 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploader.upload | def upload(self, project_id, parent_kind, parent_id):
"""
Upload file contents to project within a specified parent.
:param project_id: str project uuid
:param parent_kind: str type of parent ('dds-project' or 'dds-folder')
:param parent_id: str uuid of parent
:return: st... | python | def upload(self, project_id, parent_kind, parent_id):
"""
Upload file contents to project within a specified parent.
:param project_id: str project uuid
:param parent_kind: str type of parent ('dds-project' or 'dds-folder')
:param parent_id: str uuid of parent
:return: st... | [
"def",
"upload",
"(",
"self",
",",
"project_id",
",",
"parent_kind",
",",
"parent_id",
")",
":",
"path_data",
"=",
"self",
".",
"local_file",
".",
"get_path_data",
"(",
")",
"hash_data",
"=",
"path_data",
".",
"get_hash",
"(",
")",
"self",
".",
"upload_id"... | Upload file contents to project within a specified parent.
:param project_id: str project uuid
:param parent_kind: str type of parent ('dds-project' or 'dds-folder')
:param parent_id: str uuid of parent
:return: str uuid of the newly uploaded file | [
"Upload",
"file",
"contents",
"to",
"project",
"within",
"a",
"specified",
"parent",
".",
":",
"param",
"project_id",
":",
"str",
"project",
"uuid",
":",
"param",
"parent_kind",
":",
"str",
"type",
"of",
"parent",
"(",
"dds",
"-",
"project",
"or",
"dds",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L46-L64 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations._create_upload | def _create_upload(self, project_id, path_data, hash_data, remote_filename=None, storage_provider_id=None,
chunked=True):
"""
Create upload for uploading multiple chunks or the non-chunked variety (includes upload url).
:param project_id: str: uuid of the project
:... | python | def _create_upload(self, project_id, path_data, hash_data, remote_filename=None, storage_provider_id=None,
chunked=True):
"""
Create upload for uploading multiple chunks or the non-chunked variety (includes upload url).
:param project_id: str: uuid of the project
:... | [
"def",
"_create_upload",
"(",
"self",
",",
"project_id",
",",
"path_data",
",",
"hash_data",
",",
"remote_filename",
"=",
"None",
",",
"storage_provider_id",
"=",
"None",
",",
"chunked",
"=",
"True",
")",
":",
"if",
"not",
"remote_filename",
":",
"remote_filen... | Create upload for uploading multiple chunks or the non-chunked variety (includes upload url).
:param project_id: str: uuid of the project
:param path_data: PathData: holds file system data about the file we are uploading
:param hash_data: HashData: contains hash alg and value for the file we are... | [
"Create",
"upload",
"for",
"uploading",
"multiple",
"chunks",
"or",
"the",
"non",
"-",
"chunked",
"variety",
"(",
"includes",
"upload",
"url",
")",
".",
":",
"param",
"project_id",
":",
"str",
":",
"uuid",
"of",
"the",
"project",
":",
"param",
"path_data",... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L100-L124 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations.create_upload | def create_upload(self, project_id, path_data, hash_data, remote_filename=None, storage_provider_id=None):
"""
Create a chunked upload id to pass to create_file_chunk_url to create upload urls.
:param project_id: str: uuid of the project
:param path_data: PathData: holds file system data... | python | def create_upload(self, project_id, path_data, hash_data, remote_filename=None, storage_provider_id=None):
"""
Create a chunked upload id to pass to create_file_chunk_url to create upload urls.
:param project_id: str: uuid of the project
:param path_data: PathData: holds file system data... | [
"def",
"create_upload",
"(",
"self",
",",
"project_id",
",",
"path_data",
",",
"hash_data",
",",
"remote_filename",
"=",
"None",
",",
"storage_provider_id",
"=",
"None",
")",
":",
"upload_response",
"=",
"self",
".",
"_create_upload",
"(",
"project_id",
",",
"... | Create a chunked upload id to pass to create_file_chunk_url to create upload urls.
:param project_id: str: uuid of the project
:param path_data: PathData: holds file system data about the file we are uploading
:param hash_data: HashData: contains hash alg and value for the file we are uploading
... | [
"Create",
"a",
"chunked",
"upload",
"id",
"to",
"pass",
"to",
"create_file_chunk_url",
"to",
"create",
"upload",
"urls",
".",
":",
"param",
"project_id",
":",
"str",
":",
"uuid",
"of",
"the",
"project",
":",
"param",
"path_data",
":",
"PathData",
":",
"hol... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L126-L138 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations.create_upload_and_chunk_url | def create_upload_and_chunk_url(self, project_id, path_data, hash_data, remote_filename=None,
storage_provider_id=None):
"""
Create an non-chunked upload that returns upload id and upload url. This type of upload doesn't allow
additional upload urls. For singl... | python | def create_upload_and_chunk_url(self, project_id, path_data, hash_data, remote_filename=None,
storage_provider_id=None):
"""
Create an non-chunked upload that returns upload id and upload url. This type of upload doesn't allow
additional upload urls. For singl... | [
"def",
"create_upload_and_chunk_url",
"(",
"self",
",",
"project_id",
",",
"path_data",
",",
"hash_data",
",",
"remote_filename",
"=",
"None",
",",
"storage_provider_id",
"=",
"None",
")",
":",
"upload_response",
"=",
"self",
".",
"_create_upload",
"(",
"project_i... | Create an non-chunked upload that returns upload id and upload url. This type of upload doesn't allow
additional upload urls. For single chunk files this method is more efficient than
create_upload/create_file_chunk_url.
:param project_id: str: uuid of the project
:param path_data: PathD... | [
"Create",
"an",
"non",
"-",
"chunked",
"upload",
"that",
"returns",
"upload",
"id",
"and",
"upload",
"url",
".",
"This",
"type",
"of",
"upload",
"doesn",
"t",
"allow",
"additional",
"upload",
"urls",
".",
"For",
"single",
"chunk",
"files",
"this",
"method"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L140-L155 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations.create_file_chunk_url | def create_file_chunk_url(self, upload_id, chunk_num, chunk):
"""
Create a url for uploading a particular chunk to the datastore.
:param upload_id: str: uuid of the upload this chunk is for
:param chunk_num: int: where in the file does this chunk go (0-based index)
:param chunk: ... | python | def create_file_chunk_url(self, upload_id, chunk_num, chunk):
"""
Create a url for uploading a particular chunk to the datastore.
:param upload_id: str: uuid of the upload this chunk is for
:param chunk_num: int: where in the file does this chunk go (0-based index)
:param chunk: ... | [
"def",
"create_file_chunk_url",
"(",
"self",
",",
"upload_id",
",",
"chunk_num",
",",
"chunk",
")",
":",
"chunk_len",
"=",
"len",
"(",
"chunk",
")",
"hash_data",
"=",
"HashData",
".",
"create_from_chunk",
"(",
"chunk",
")",
"one_based_index",
"=",
"chunk_num",... | Create a url for uploading a particular chunk to the datastore.
:param upload_id: str: uuid of the upload this chunk is for
:param chunk_num: int: where in the file does this chunk go (0-based index)
:param chunk: bytes: data we are going to upload
:return: | [
"Create",
"a",
"url",
"for",
"uploading",
"a",
"particular",
"chunk",
"to",
"the",
"datastore",
".",
":",
"param",
"upload_id",
":",
"str",
":",
"uuid",
"of",
"the",
"upload",
"this",
"chunk",
"is",
"for",
":",
"param",
"chunk_num",
":",
"int",
":",
"w... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L157-L174 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations.send_file_external | def send_file_external(self, url_json, chunk):
"""
Send chunk to external store specified in url_json.
Raises ValueError on upload failure.
:param data_service: data service to use for sending chunk
:param url_json: dict contains where/how to upload chunk
:param chunk: da... | python | def send_file_external(self, url_json, chunk):
"""
Send chunk to external store specified in url_json.
Raises ValueError on upload failure.
:param data_service: data service to use for sending chunk
:param url_json: dict contains where/how to upload chunk
:param chunk: da... | [
"def",
"send_file_external",
"(",
"self",
",",
"url_json",
",",
"chunk",
")",
":",
"http_verb",
"=",
"url_json",
"[",
"'http_verb'",
"]",
"host",
"=",
"url_json",
"[",
"'host'",
"]",
"url",
"=",
"url_json",
"[",
"'url'",
"]",
"http_headers",
"=",
"url_json... | Send chunk to external store specified in url_json.
Raises ValueError on upload failure.
:param data_service: data service to use for sending chunk
:param url_json: dict contains where/how to upload chunk
:param chunk: data to be uploaded | [
"Send",
"chunk",
"to",
"external",
"store",
"specified",
"in",
"url_json",
".",
"Raises",
"ValueError",
"on",
"upload",
"failure",
".",
":",
"param",
"data_service",
":",
"data",
"service",
"to",
"use",
"for",
"sending",
"chunk",
":",
"param",
"url_json",
":... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L176-L190 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations._send_file_external_with_retry | def _send_file_external_with_retry(self, http_verb, host, url, http_headers, chunk):
"""
Send chunk to host, url using http_verb. If http_verb is PUT and a connection error occurs
retry a few times. Pauses between retries. Raises if unsuccessful.
"""
count = 0
retry_times... | python | def _send_file_external_with_retry(self, http_verb, host, url, http_headers, chunk):
"""
Send chunk to host, url using http_verb. If http_verb is PUT and a connection error occurs
retry a few times. Pauses between retries. Raises if unsuccessful.
"""
count = 0
retry_times... | [
"def",
"_send_file_external_with_retry",
"(",
"self",
",",
"http_verb",
",",
"host",
",",
"url",
",",
"http_headers",
",",
"chunk",
")",
":",
"count",
"=",
"0",
"retry_times",
"=",
"1",
"if",
"http_verb",
"==",
"'PUT'",
":",
"retry_times",
"=",
"SEND_EXTERNA... | Send chunk to host, url using http_verb. If http_verb is PUT and a connection error occurs
retry a few times. Pauses between retries. Raises if unsuccessful. | [
"Send",
"chunk",
"to",
"host",
"url",
"using",
"http_verb",
".",
"If",
"http_verb",
"is",
"PUT",
"and",
"a",
"connection",
"error",
"occurs",
"retry",
"a",
"few",
"times",
".",
"Pauses",
"between",
"retries",
".",
"Raises",
"if",
"unsuccessful",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L192-L212 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations._show_retry_warning | def _show_retry_warning(host):
"""
Displays a message on stderr that we lost connection to a host and will retry.
:param host: str: name of the host we are trying to communicate with
"""
sys.stderr.write("\nConnection to {} failed. Retrying.\n".format(host))
sys.stderr.fl... | python | def _show_retry_warning(host):
"""
Displays a message on stderr that we lost connection to a host and will retry.
:param host: str: name of the host we are trying to communicate with
"""
sys.stderr.write("\nConnection to {} failed. Retrying.\n".format(host))
sys.stderr.fl... | [
"def",
"_show_retry_warning",
"(",
"host",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"\\nConnection to {} failed. Retrying.\\n\"",
".",
"format",
"(",
"host",
")",
")",
"sys",
".",
"stderr",
".",
"flush",
"(",
")"
] | Displays a message on stderr that we lost connection to a host and will retry.
:param host: str: name of the host we are trying to communicate with | [
"Displays",
"a",
"message",
"on",
"stderr",
"that",
"we",
"lost",
"connection",
"to",
"a",
"host",
"and",
"will",
"retry",
".",
":",
"param",
"host",
":",
"str",
":",
"name",
"of",
"the",
"host",
"we",
"are",
"trying",
"to",
"communicate",
"with"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L215-L221 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | FileUploadOperations.finish_upload | def finish_upload(self, upload_id, hash_data, parent_data, remote_file_id):
"""
Complete the upload and create or update the file.
:param upload_id: str: uuid of the upload we are completing
:param hash_data: HashData: hash info about the file
:param parent_data: ParentData: info... | python | def finish_upload(self, upload_id, hash_data, parent_data, remote_file_id):
"""
Complete the upload and create or update the file.
:param upload_id: str: uuid of the upload we are completing
:param hash_data: HashData: hash info about the file
:param parent_data: ParentData: info... | [
"def",
"finish_upload",
"(",
"self",
",",
"upload_id",
",",
"hash_data",
",",
"parent_data",
",",
"remote_file_id",
")",
":",
"self",
".",
"data_service",
".",
"complete_upload",
"(",
"upload_id",
",",
"hash_data",
".",
"value",
",",
"hash_data",
".",
"alg",
... | Complete the upload and create or update the file.
:param upload_id: str: uuid of the upload we are completing
:param hash_data: HashData: hash info about the file
:param parent_data: ParentData: info about the parent of this file
:param remote_file_id: str: uuid of this file if it alrea... | [
"Complete",
"the",
"upload",
"and",
"create",
"or",
"update",
"the",
"file",
".",
":",
"param",
"upload_id",
":",
"str",
":",
"uuid",
"of",
"the",
"upload",
"we",
"are",
"completing",
":",
"param",
"hash_data",
":",
"HashData",
":",
"hash",
"info",
"abou... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L223-L238 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ParallelChunkProcessor.run | def run(self):
"""
Sends contents of a local file to a remote data service.
"""
processes = []
progress_queue = ProgressQueue(Queue())
num_chunks = ParallelChunkProcessor.determine_num_chunks(self.config.upload_bytes_per_chunk,
... | python | def run(self):
"""
Sends contents of a local file to a remote data service.
"""
processes = []
progress_queue = ProgressQueue(Queue())
num_chunks = ParallelChunkProcessor.determine_num_chunks(self.config.upload_bytes_per_chunk,
... | [
"def",
"run",
"(",
"self",
")",
":",
"processes",
"=",
"[",
"]",
"progress_queue",
"=",
"ProgressQueue",
"(",
"Queue",
"(",
")",
")",
"num_chunks",
"=",
"ParallelChunkProcessor",
".",
"determine_num_chunks",
"(",
"self",
".",
"config",
".",
"upload_bytes_per_c... | Sends contents of a local file to a remote data service. | [
"Sends",
"contents",
"of",
"a",
"local",
"file",
"to",
"a",
"remote",
"data",
"service",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L256-L267 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ParallelChunkProcessor.determine_num_chunks | def determine_num_chunks(chunk_size, file_size):
"""
Figure out how many pieces we are sending the file in.
NOTE: duke-data-service requires an empty chunk to be uploaded for empty files.
"""
if file_size == 0:
return 1
return int(math.ceil(float(file_size) / ... | python | def determine_num_chunks(chunk_size, file_size):
"""
Figure out how many pieces we are sending the file in.
NOTE: duke-data-service requires an empty chunk to be uploaded for empty files.
"""
if file_size == 0:
return 1
return int(math.ceil(float(file_size) / ... | [
"def",
"determine_num_chunks",
"(",
"chunk_size",
",",
"file_size",
")",
":",
"if",
"file_size",
"==",
"0",
":",
"return",
"1",
"return",
"int",
"(",
"math",
".",
"ceil",
"(",
"float",
"(",
"file_size",
")",
"/",
"float",
"(",
"chunk_size",
")",
")",
"... | Figure out how many pieces we are sending the file in.
NOTE: duke-data-service requires an empty chunk to be uploaded for empty files. | [
"Figure",
"out",
"how",
"many",
"pieces",
"we",
"are",
"sending",
"the",
"file",
"in",
".",
"NOTE",
":",
"duke",
"-",
"data",
"-",
"service",
"requires",
"an",
"empty",
"chunk",
"to",
"be",
"uploaded",
"for",
"empty",
"files",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L270-L277 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ParallelChunkProcessor.make_work_parcels | def make_work_parcels(upload_workers, num_chunks):
"""
Make groups so we can split up num_chunks into similar sizes.
Rounds up trying to keep work evenly split so sometimes it will not use all workers.
For very small numbers it can result in (upload_workers-1) total workers.
For ... | python | def make_work_parcels(upload_workers, num_chunks):
"""
Make groups so we can split up num_chunks into similar sizes.
Rounds up trying to keep work evenly split so sometimes it will not use all workers.
For very small numbers it can result in (upload_workers-1) total workers.
For ... | [
"def",
"make_work_parcels",
"(",
"upload_workers",
",",
"num_chunks",
")",
":",
"chunks_per_worker",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"float",
"(",
"num_chunks",
")",
"/",
"float",
"(",
"upload_workers",
")",
")",
")",
"return",
"ParallelChunkProcess... | Make groups so we can split up num_chunks into similar sizes.
Rounds up trying to keep work evenly split so sometimes it will not use all workers.
For very small numbers it can result in (upload_workers-1) total workers.
For example if there are two few items to distribute.
:param upload... | [
"Make",
"groups",
"so",
"we",
"can",
"split",
"up",
"num_chunks",
"into",
"similar",
"sizes",
".",
"Rounds",
"up",
"trying",
"to",
"keep",
"work",
"evenly",
"split",
"so",
"sometimes",
"it",
"will",
"not",
"use",
"all",
"workers",
".",
"For",
"very",
"sm... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L280-L291 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ParallelChunkProcessor.divide_work | def divide_work(list_of_indexes, batch_size):
"""
Given a sequential list of indexes split them into num_parts.
:param list_of_indexes: [int] list of indexes to be divided up
:param batch_size: number of items to put in batch(not exact obviously)
:return: [(int,int)] list of (ind... | python | def divide_work(list_of_indexes, batch_size):
"""
Given a sequential list of indexes split them into num_parts.
:param list_of_indexes: [int] list of indexes to be divided up
:param batch_size: number of items to put in batch(not exact obviously)
:return: [(int,int)] list of (ind... | [
"def",
"divide_work",
"(",
"list_of_indexes",
",",
"batch_size",
")",
":",
"grouped_indexes",
"=",
"[",
"list_of_indexes",
"[",
"i",
":",
"i",
"+",
"batch_size",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"list_of_indexes",
")",
",",
"bat... | Given a sequential list of indexes split them into num_parts.
:param list_of_indexes: [int] list of indexes to be divided up
:param batch_size: number of items to put in batch(not exact obviously)
:return: [(int,int)] list of (index, num_items) to be processed | [
"Given",
"a",
"sequential",
"list",
"of",
"indexes",
"split",
"them",
"into",
"num_parts",
".",
":",
"param",
"list_of_indexes",
":",
"[",
"int",
"]",
"list",
"of",
"indexes",
"to",
"be",
"divided",
"up",
":",
"param",
"batch_size",
":",
"number",
"of",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L294-L302 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ParallelChunkProcessor.make_and_start_process | def make_and_start_process(self, index, num_items, progress_queue):
"""
Create and start a process to upload num_items chunks from our file starting at index.
:param index: int offset into file(must be multiplied by upload_bytes_per_chunk to get actual location)
:param num_items: int num... | python | def make_and_start_process(self, index, num_items, progress_queue):
"""
Create and start a process to upload num_items chunks from our file starting at index.
:param index: int offset into file(must be multiplied by upload_bytes_per_chunk to get actual location)
:param num_items: int num... | [
"def",
"make_and_start_process",
"(",
"self",
",",
"index",
",",
"num_items",
",",
"progress_queue",
")",
":",
"process",
"=",
"Process",
"(",
"target",
"=",
"upload_async",
",",
"args",
"=",
"(",
"self",
".",
"data_service",
".",
"auth",
".",
"get_auth_data... | Create and start a process to upload num_items chunks from our file starting at index.
:param index: int offset into file(must be multiplied by upload_bytes_per_chunk to get actual location)
:param num_items: int number chunks to send
:param progress_queue: ProgressQueue queue to send notificati... | [
"Create",
"and",
"start",
"a",
"process",
"to",
"upload",
"num_items",
"chunks",
"from",
"our",
"file",
"starting",
"at",
"index",
".",
":",
"param",
"index",
":",
"int",
"offset",
"into",
"file",
"(",
"must",
"be",
"multiplied",
"by",
"upload_bytes_per_chun... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L304-L315 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ChunkSender.send | def send(self):
"""
For each chunk we need to send, create upload url and send bytes. Raises exception on error.
"""
sent_chunks = 0
chunk_num = self.index
with open(self.filename, 'rb') as infile:
infile.seek(self.index * self.chunk_size)
while se... | python | def send(self):
"""
For each chunk we need to send, create upload url and send bytes. Raises exception on error.
"""
sent_chunks = 0
chunk_num = self.index
with open(self.filename, 'rb') as infile:
infile.seek(self.index * self.chunk_size)
while se... | [
"def",
"send",
"(",
"self",
")",
":",
"sent_chunks",
"=",
"0",
"chunk_num",
"=",
"self",
".",
"index",
"with",
"open",
"(",
"self",
".",
"filename",
",",
"'rb'",
")",
"as",
"infile",
":",
"infile",
".",
"seek",
"(",
"self",
".",
"index",
"*",
"self... | For each chunk we need to send, create upload url and send bytes. Raises exception on error. | [
"For",
"each",
"chunk",
"we",
"need",
"to",
"send",
"create",
"upload",
"url",
"and",
"send",
"bytes",
".",
"Raises",
"exception",
"on",
"error",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L369-L382 |
Duke-GCB/DukeDSClient | ddsc/core/fileuploader.py | ChunkSender._send_chunk | def _send_chunk(self, chunk, chunk_num):
"""
Send a single chunk to the remote service.
:param chunk: bytes data we are uploading
:param chunk_num: int number associated with this chunk
"""
url_info = self.upload_operations.create_file_chunk_url(self.upload_id, chunk_num,... | python | def _send_chunk(self, chunk, chunk_num):
"""
Send a single chunk to the remote service.
:param chunk: bytes data we are uploading
:param chunk_num: int number associated with this chunk
"""
url_info = self.upload_operations.create_file_chunk_url(self.upload_id, chunk_num,... | [
"def",
"_send_chunk",
"(",
"self",
",",
"chunk",
",",
"chunk_num",
")",
":",
"url_info",
"=",
"self",
".",
"upload_operations",
".",
"create_file_chunk_url",
"(",
"self",
".",
"upload_id",
",",
"chunk_num",
",",
"chunk",
")",
"self",
".",
"upload_operations",
... | Send a single chunk to the remote service.
:param chunk: bytes data we are uploading
:param chunk_num: int number associated with this chunk | [
"Send",
"a",
"single",
"chunk",
"to",
"the",
"remote",
"service",
".",
":",
"param",
"chunk",
":",
"bytes",
"data",
"we",
"are",
"uploading",
":",
"param",
"chunk_num",
":",
"int",
"number",
"associated",
"with",
"this",
"chunk"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/fileuploader.py#L384-L391 |
T-002/pycast | pycast/methods/basemethod.py | BaseMethod._in_valid_interval | def _in_valid_interval(self, parameter, value):
"""Returns if the parameter is within its valid interval.
:param string parameter: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter.
:return: Returns :py:const:`True` it the value for t... | python | def _in_valid_interval(self, parameter, value):
"""Returns if the parameter is within its valid interval.
:param string parameter: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter.
:return: Returns :py:const:`True` it the value for t... | [
"def",
"_in_valid_interval",
"(",
"self",
",",
"parameter",
",",
"value",
")",
":",
"# return True, if not interval is defined for the parameter",
"if",
"parameter",
"not",
"in",
"self",
".",
"_parameterIntervals",
":",
"return",
"True",
"interval",
"=",
"self",
".",
... | Returns if the parameter is within its valid interval.
:param string parameter: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter.
:return: Returns :py:const:`True` it the value for the given parameter is valid,
:py:const:`False` ... | [
"Returns",
"if",
"the",
"parameter",
"is",
"within",
"its",
"valid",
"interval",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L118-L144 |
T-002/pycast | pycast/methods/basemethod.py | BaseMethod._get_value_error_message_for_invalid_prarameter | def _get_value_error_message_for_invalid_prarameter(self, parameter, value):
"""Returns the ValueError message for the given parameter.
:param string parameter: Name of the parameter the message has to be created for.
:param numeric value: Value outside the parameters interval.
:... | python | def _get_value_error_message_for_invalid_prarameter(self, parameter, value):
"""Returns the ValueError message for the given parameter.
:param string parameter: Name of the parameter the message has to be created for.
:param numeric value: Value outside the parameters interval.
:... | [
"def",
"_get_value_error_message_for_invalid_prarameter",
"(",
"self",
",",
"parameter",
",",
"value",
")",
":",
"# return if not interval is defined for the parameter",
"if",
"parameter",
"not",
"in",
"self",
".",
"_parameterIntervals",
":",
"return",
"interval",
"=",
"s... | Returns the ValueError message for the given parameter.
:param string parameter: Name of the parameter the message has to be created for.
:param numeric value: Value outside the parameters interval.
:return: Returns a string containing hte message.
:rtype: string | [
"Returns",
"the",
"ValueError",
"message",
"for",
"the",
"given",
"parameter",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L146-L166 |
T-002/pycast | pycast/methods/basemethod.py | BaseMethod.set_parameter | def set_parameter(self, name, value):
"""Sets a parameter for the BaseMethod.
:param string name: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter.
"""
if not self._in_valid_interval(name, value):
raise ValueError(sel... | python | def set_parameter(self, name, value):
"""Sets a parameter for the BaseMethod.
:param string name: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter.
"""
if not self._in_valid_interval(name, value):
raise ValueError(sel... | [
"def",
"set_parameter",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"_in_valid_interval",
"(",
"name",
",",
"value",
")",
":",
"raise",
"ValueError",
"(",
"self",
".",
"_get_value_error_message_for_invalid_prarameter",
"(",
"nam... | Sets a parameter for the BaseMethod.
:param string name: Name of the parameter that has to be checked.
:param numeric value: Value of the parameter. | [
"Sets",
"a",
"parameter",
"for",
"the",
"BaseMethod",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L168-L180 |
T-002/pycast | pycast/methods/basemethod.py | BaseMethod.can_be_executed | def can_be_executed(self):
"""Returns if the method can already be executed.
:return: Returns :py:const:`True` if all required parameters where already set, False otherwise.
:rtype: boolean
"""
missingParams = filter(lambda rp: rp not in self._parameters, self._requiredParame... | python | def can_be_executed(self):
"""Returns if the method can already be executed.
:return: Returns :py:const:`True` if all required parameters where already set, False otherwise.
:rtype: boolean
"""
missingParams = filter(lambda rp: rp not in self._parameters, self._requiredParame... | [
"def",
"can_be_executed",
"(",
"self",
")",
":",
"missingParams",
"=",
"filter",
"(",
"lambda",
"rp",
":",
"rp",
"not",
"in",
"self",
".",
"_parameters",
",",
"self",
".",
"_requiredParameters",
")",
"return",
"len",
"(",
"missingParams",
")",
"==",
"0"
] | Returns if the method can already be executed.
:return: Returns :py:const:`True` if all required parameters where already set, False otherwise.
:rtype: boolean | [
"Returns",
"if",
"the",
"method",
"can",
"already",
"be",
"executed",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L210-L217 |
T-002/pycast | pycast/methods/basemethod.py | BaseForecastingMethod.set_parameter | def set_parameter(self, name, value):
"""Sets a parameter for the BaseForecastingMethod.
:param string name: Name of the parameter.
:param numeric value: Value of the parameter.
"""
# set the furecast until variable to None if necessary
if name == "valuesToForecast... | python | def set_parameter(self, name, value):
"""Sets a parameter for the BaseForecastingMethod.
:param string name: Name of the parameter.
:param numeric value: Value of the parameter.
"""
# set the furecast until variable to None if necessary
if name == "valuesToForecast... | [
"def",
"set_parameter",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"# set the furecast until variable to None if necessary",
"if",
"name",
"==",
"\"valuesToForecast\"",
":",
"self",
".",
"_forecastUntil",
"=",
"None",
"# continue with the parents implementation",
"... | Sets a parameter for the BaseForecastingMethod.
:param string name: Name of the parameter.
:param numeric value: Value of the parameter. | [
"Sets",
"a",
"parameter",
"for",
"the",
"BaseForecastingMethod",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L272-L283 |
T-002/pycast | pycast/methods/basemethod.py | BaseForecastingMethod.forecast_until | def forecast_until(self, timestamp, tsformat=None):
"""Sets the forecasting goal (timestamp wise).
This function enables the automatic determination of valuesToForecast.
:param timestamp: timestamp containing the end date of the forecast.
:param string tsformat: Format of the tim... | python | def forecast_until(self, timestamp, tsformat=None):
"""Sets the forecasting goal (timestamp wise).
This function enables the automatic determination of valuesToForecast.
:param timestamp: timestamp containing the end date of the forecast.
:param string tsformat: Format of the tim... | [
"def",
"forecast_until",
"(",
"self",
",",
"timestamp",
",",
"tsformat",
"=",
"None",
")",
":",
"if",
"tsformat",
"is",
"not",
"None",
":",
"timestamp",
"=",
"TimeSeries",
".",
"convert_timestamp_to_epoch",
"(",
"timestamp",
",",
"tsformat",
")",
"self",
"."... | Sets the forecasting goal (timestamp wise).
This function enables the automatic determination of valuesToForecast.
:param timestamp: timestamp containing the end date of the forecast.
:param string tsformat: Format of the timestamp. This is used to convert the
timestamp from ... | [
"Sets",
"the",
"forecasting",
"goal",
"(",
"timestamp",
"wise",
")",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L285-L298 |
T-002/pycast | pycast/methods/basemethod.py | BaseForecastingMethod._calculate_values_to_forecast | def _calculate_values_to_forecast(self, timeSeries):
"""Calculates the number of values, that need to be forecasted to match the goal set in forecast_until.
This sets the parameter "valuesToForecast" and should be called at the beginning of the :py:meth:`BaseMethod.execute` implementation.
:pa... | python | def _calculate_values_to_forecast(self, timeSeries):
"""Calculates the number of values, that need to be forecasted to match the goal set in forecast_until.
This sets the parameter "valuesToForecast" and should be called at the beginning of the :py:meth:`BaseMethod.execute` implementation.
:pa... | [
"def",
"_calculate_values_to_forecast",
"(",
"self",
",",
"timeSeries",
")",
":",
"# do not set anything, if it is not required",
"if",
"self",
".",
"_forecastUntil",
"is",
"None",
":",
"return",
"# check the TimeSeries for correctness",
"if",
"not",
"timeSeries",
".",
"i... | Calculates the number of values, that need to be forecasted to match the goal set in forecast_until.
This sets the parameter "valuesToForecast" and should be called at the beginning of the :py:meth:`BaseMethod.execute` implementation.
:param TimeSeries timeSeries: Should be a sorted and normalized ... | [
"Calculates",
"the",
"number",
"of",
"values",
"that",
"need",
"to",
"be",
"forecasted",
"to",
"match",
"the",
"goal",
"set",
"in",
"forecast_until",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/basemethod.py#L300-L322 |
T-002/pycast | pycast/methods/simplemovingaverage.py | SimpleMovingAverage.execute | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the SMA values for the predefined windowsize.
:param TimeSeries timeSeries: The TimeSeries used to calculate the simple moving average values.
:return: TimeSeries object containing the smooth moving average.
:r... | python | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the SMA values for the predefined windowsize.
:param TimeSeries timeSeries: The TimeSeries used to calculate the simple moving average values.
:return: TimeSeries object containing the smooth moving average.
:r... | [
"def",
"execute",
"(",
"self",
",",
"timeSeries",
")",
":",
"windowsize",
"=",
"self",
".",
"_parameters",
"[",
"\"windowsize\"",
"]",
"if",
"len",
"(",
"timeSeries",
")",
"<",
"windowsize",
":",
"raise",
"ValueError",
"(",
"\"windowsize is larger than the numbe... | Creates a new TimeSeries containing the SMA values for the predefined windowsize.
:param TimeSeries timeSeries: The TimeSeries used to calculate the simple moving average values.
:return: TimeSeries object containing the smooth moving average.
:rtype: TimeSeries
:raise: Ra... | [
"Creates",
"a",
"new",
"TimeSeries",
"containing",
"the",
"SMA",
"values",
"for",
"the",
"predefined",
"windowsize",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/simplemovingaverage.py#L79-L111 |
twisted/txaws | txaws/wsdl.py | NodeSchema.add | def add(self, child, min_occurs=1):
"""Add a child node.
@param child: The schema for the child node.
@param min_occurs: The minimum number of times the child node must
occur, if C{None} is given the default is 1.
"""
if not min_occurs in (0, 1):
raise Ru... | python | def add(self, child, min_occurs=1):
"""Add a child node.
@param child: The schema for the child node.
@param min_occurs: The minimum number of times the child node must
occur, if C{None} is given the default is 1.
"""
if not min_occurs in (0, 1):
raise Ru... | [
"def",
"add",
"(",
"self",
",",
"child",
",",
"min_occurs",
"=",
"1",
")",
":",
"if",
"not",
"min_occurs",
"in",
"(",
"0",
",",
"1",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Unexpected min bound for node schema\"",
")",
"self",
".",
"children",
"[",
"c... | Add a child node.
@param child: The schema for the child node.
@param min_occurs: The minimum number of times the child node must
occur, if C{None} is given the default is 1. | [
"Add",
"a",
"child",
"node",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L145-L156 |
twisted/txaws | txaws/wsdl.py | NodeItem._create_child | def _create_child(self, tag):
"""Create a new child element with the given tag."""
return etree.SubElement(self._root, self._get_namespace_tag(tag)) | python | def _create_child(self, tag):
"""Create a new child element with the given tag."""
return etree.SubElement(self._root, self._get_namespace_tag(tag)) | [
"def",
"_create_child",
"(",
"self",
",",
"tag",
")",
":",
"return",
"etree",
".",
"SubElement",
"(",
"self",
".",
"_root",
",",
"self",
".",
"_get_namespace_tag",
"(",
"tag",
")",
")"
] | Create a new child element with the given tag. | [
"Create",
"a",
"new",
"child",
"element",
"with",
"the",
"given",
"tag",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L243-L245 |
twisted/txaws | txaws/wsdl.py | NodeItem._find_child | def _find_child(self, tag):
"""Find the child C{etree.Element} with the matching C{tag}.
@raises L{WSDLParseError}: If more than one such elements are found.
"""
tag = self._get_namespace_tag(tag)
children = self._root.findall(tag)
if len(children) > 1:
raise... | python | def _find_child(self, tag):
"""Find the child C{etree.Element} with the matching C{tag}.
@raises L{WSDLParseError}: If more than one such elements are found.
"""
tag = self._get_namespace_tag(tag)
children = self._root.findall(tag)
if len(children) > 1:
raise... | [
"def",
"_find_child",
"(",
"self",
",",
"tag",
")",
":",
"tag",
"=",
"self",
".",
"_get_namespace_tag",
"(",
"tag",
")",
"children",
"=",
"self",
".",
"_root",
".",
"findall",
"(",
"tag",
")",
"if",
"len",
"(",
"children",
")",
">",
"1",
":",
"rais... | Find the child C{etree.Element} with the matching C{tag}.
@raises L{WSDLParseError}: If more than one such elements are found. | [
"Find",
"the",
"child",
"C",
"{",
"etree",
".",
"Element",
"}",
"with",
"the",
"matching",
"C",
"{",
"tag",
"}",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L247-L258 |
twisted/txaws | txaws/wsdl.py | NodeItem._check_value | def _check_value(self, tag, value):
"""Ensure that the element matching C{tag} can have the given C{value}.
@param tag: The tag to consider.
@param value: The value to check
@return: The unchanged L{value}, if valid.
@raises L{WSDLParseError}: If the value is invalid.
""... | python | def _check_value(self, tag, value):
"""Ensure that the element matching C{tag} can have the given C{value}.
@param tag: The tag to consider.
@param value: The value to check
@return: The unchanged L{value}, if valid.
@raises L{WSDLParseError}: If the value is invalid.
""... | [
"def",
"_check_value",
"(",
"self",
",",
"tag",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"if",
"self",
".",
"_schema",
".",
"children_min_occurs",
"[",
"tag",
"]",
">",
"0",
":",
"raise",
"WSDLParseError",
"(",
"\"Missing tag '%s'\"",
"%... | Ensure that the element matching C{tag} can have the given C{value}.
@param tag: The tag to consider.
@param value: The value to check
@return: The unchanged L{value}, if valid.
@raises L{WSDLParseError}: If the value is invalid. | [
"Ensure",
"that",
"the",
"element",
"matching",
"C",
"{",
"tag",
"}",
"can",
"have",
"the",
"given",
"C",
"{",
"value",
"}",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L260-L272 |
twisted/txaws | txaws/wsdl.py | NodeItem._get_tag | def _get_tag(self, name):
"""Get the L{NodeItem} attribute name for the given C{tag}."""
if name.endswith("_"):
if name[:-1] in self._schema.reserved:
return name[:-1]
return name | python | def _get_tag(self, name):
"""Get the L{NodeItem} attribute name for the given C{tag}."""
if name.endswith("_"):
if name[:-1] in self._schema.reserved:
return name[:-1]
return name | [
"def",
"_get_tag",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
".",
"endswith",
"(",
"\"_\"",
")",
":",
"if",
"name",
"[",
":",
"-",
"1",
"]",
"in",
"self",
".",
"_schema",
".",
"reserved",
":",
"return",
"name",
"[",
":",
"-",
"1",
"]",
... | Get the L{NodeItem} attribute name for the given C{tag}. | [
"Get",
"the",
"L",
"{",
"NodeItem",
"}",
"attribute",
"name",
"for",
"the",
"given",
"C",
"{",
"tag",
"}",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L274-L279 |
twisted/txaws | txaws/wsdl.py | NodeItem._get_namespace_tag | def _get_namespace_tag(self, tag):
"""Return the given C{tag} with the namespace prefix added, if any."""
if self._namespace is not None:
tag = "{%s}%s" % (self._namespace, tag)
return tag | python | def _get_namespace_tag(self, tag):
"""Return the given C{tag} with the namespace prefix added, if any."""
if self._namespace is not None:
tag = "{%s}%s" % (self._namespace, tag)
return tag | [
"def",
"_get_namespace_tag",
"(",
"self",
",",
"tag",
")",
":",
"if",
"self",
".",
"_namespace",
"is",
"not",
"None",
":",
"tag",
"=",
"\"{%s}%s\"",
"%",
"(",
"self",
".",
"_namespace",
",",
"tag",
")",
"return",
"tag"
] | Return the given C{tag} with the namespace prefix added, if any. | [
"Return",
"the",
"given",
"C",
"{",
"tag",
"}",
"with",
"the",
"namespace",
"prefix",
"added",
"if",
"any",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L281-L285 |
twisted/txaws | txaws/wsdl.py | NodeItem._get_schema | def _get_schema(self, tag):
"""Return the child schema for the given C{tag}.
@raises L{WSDLParseError}: If the tag doesn't belong to the schema.
"""
schema = self._schema.children.get(tag)
if not schema:
raise WSDLParseError("Unknown tag '%s'" % tag)
return s... | python | def _get_schema(self, tag):
"""Return the child schema for the given C{tag}.
@raises L{WSDLParseError}: If the tag doesn't belong to the schema.
"""
schema = self._schema.children.get(tag)
if not schema:
raise WSDLParseError("Unknown tag '%s'" % tag)
return s... | [
"def",
"_get_schema",
"(",
"self",
",",
"tag",
")",
":",
"schema",
"=",
"self",
".",
"_schema",
".",
"children",
".",
"get",
"(",
"tag",
")",
"if",
"not",
"schema",
":",
"raise",
"WSDLParseError",
"(",
"\"Unknown tag '%s'\"",
"%",
"tag",
")",
"return",
... | Return the child schema for the given C{tag}.
@raises L{WSDLParseError}: If the tag doesn't belong to the schema. | [
"Return",
"the",
"child",
"schema",
"for",
"the",
"given",
"C",
"{",
"tag",
"}",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L287-L295 |
twisted/txaws | txaws/wsdl.py | SequenceSchema.create | def create(self, root=None, namespace=None):
"""Create a sequence element with the given root.
@param root: The C{etree.Element} to root the sequence at, if C{None} a
new one will be created..
@result: A L{SequenceItem} with the given root.
@raises L{ECResponseError}: If the... | python | def create(self, root=None, namespace=None):
"""Create a sequence element with the given root.
@param root: The C{etree.Element} to root the sequence at, if C{None} a
new one will be created..
@result: A L{SequenceItem} with the given root.
@raises L{ECResponseError}: If the... | [
"def",
"create",
"(",
"self",
",",
"root",
"=",
"None",
",",
"namespace",
"=",
"None",
")",
":",
"if",
"root",
"is",
"not",
"None",
":",
"tag",
"=",
"root",
".",
"tag",
"if",
"root",
".",
"nsmap",
":",
"namespace",
"=",
"root",
".",
"nsmap",
"[",... | Create a sequence element with the given root.
@param root: The C{etree.Element} to root the sequence at, if C{None} a
new one will be created..
@result: A L{SequenceItem} with the given root.
@raises L{ECResponseError}: If the given C{root} has a bad tag. | [
"Create",
"a",
"sequence",
"element",
"with",
"the",
"given",
"root",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L316-L332 |
twisted/txaws | txaws/wsdl.py | SequenceSchema.set | def set(self, child, min_occurs=1, max_occurs=1):
"""Set the schema for the sequence children.
@param child: The schema that children must match.
@param min_occurs: The minimum number of children the sequence
must have.
@param max_occurs: The maximum number of children the s... | python | def set(self, child, min_occurs=1, max_occurs=1):
"""Set the schema for the sequence children.
@param child: The schema that children must match.
@param min_occurs: The minimum number of children the sequence
must have.
@param max_occurs: The maximum number of children the s... | [
"def",
"set",
"(",
"self",
",",
"child",
",",
"min_occurs",
"=",
"1",
",",
"max_occurs",
"=",
"1",
")",
":",
"if",
"isinstance",
"(",
"child",
",",
"LeafSchema",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Sequence can't have leaf children\"",
")",
"if",
"s... | Set the schema for the sequence children.
@param child: The schema that children must match.
@param min_occurs: The minimum number of children the sequence
must have.
@param max_occurs: The maximum number of children the sequence
can have. | [
"Set",
"the",
"schema",
"for",
"the",
"sequence",
"children",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L341-L364 |
twisted/txaws | txaws/wsdl.py | SequenceItem.append | def append(self):
"""Append a new item to the sequence, appending it to the end.
@return: The newly created item.
@raises L{WSDLParseError}: If the operation would result in having
more child elements than the allowed max.
"""
tag = self._schema.tag
children... | python | def append(self):
"""Append a new item to the sequence, appending it to the end.
@return: The newly created item.
@raises L{WSDLParseError}: If the operation would result in having
more child elements than the allowed max.
"""
tag = self._schema.tag
children... | [
"def",
"append",
"(",
"self",
")",
":",
"tag",
"=",
"self",
".",
"_schema",
".",
"tag",
"children",
"=",
"self",
".",
"_root",
".",
"getchildren",
"(",
")",
"if",
"len",
"(",
"children",
")",
">=",
"self",
".",
"_schema",
".",
"max_occurs",
":",
"r... | Append a new item to the sequence, appending it to the end.
@return: The newly created item.
@raises L{WSDLParseError}: If the operation would result in having
more child elements than the allowed max. | [
"Append",
"a",
"new",
"item",
"to",
"the",
"sequence",
"appending",
"it",
"to",
"the",
"end",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L397-L413 |
twisted/txaws | txaws/wsdl.py | SequenceItem.remove | def remove(self, item):
"""Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found.
"""
for index, child in enumerate(self._roo... | python | def remove(self, item):
"""Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found.
"""
for index, child in enumerate(self._roo... | [
"def",
"remove",
"(",
"self",
",",
"item",
")",
":",
"for",
"index",
",",
"child",
"in",
"enumerate",
"(",
"self",
".",
"_root",
".",
"getchildren",
"(",
")",
")",
":",
"if",
"child",
"is",
"item",
".",
"_root",
":",
"del",
"self",
"[",
"index",
... | Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found. | [
"Remove",
"the",
"given",
"C",
"{",
"item",
"}",
"from",
"the",
"sequence",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L428-L440 |
twisted/txaws | txaws/wsdl.py | SequenceItem._get_child | def _get_child(self, children, index):
"""Return the child with the given index."""
try:
return children[index]
except IndexError:
raise WSDLParseError("Non existing item in tag '%s'" %
self._schema.tag) | python | def _get_child(self, children, index):
"""Return the child with the given index."""
try:
return children[index]
except IndexError:
raise WSDLParseError("Non existing item in tag '%s'" %
self._schema.tag) | [
"def",
"_get_child",
"(",
"self",
",",
"children",
",",
"index",
")",
":",
"try",
":",
"return",
"children",
"[",
"index",
"]",
"except",
"IndexError",
":",
"raise",
"WSDLParseError",
"(",
"\"Non existing item in tag '%s'\"",
"%",
"self",
".",
"_schema",
".",
... | Return the child with the given index. | [
"Return",
"the",
"child",
"with",
"the",
"given",
"index",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L452-L458 |
twisted/txaws | txaws/wsdl.py | WSDLParser.parse | def parse(self, wsdl):
"""Parse the given C{wsdl} data and build the associated schemas.
@param wdsl: A string containing the raw xml of the WDSL definition
to parse.
@return: A C{dict} mapping response type names to their schemas.
"""
parser = etree.XMLParser(remove... | python | def parse(self, wsdl):
"""Parse the given C{wsdl} data and build the associated schemas.
@param wdsl: A string containing the raw xml of the WDSL definition
to parse.
@return: A C{dict} mapping response type names to their schemas.
"""
parser = etree.XMLParser(remove... | [
"def",
"parse",
"(",
"self",
",",
"wsdl",
")",
":",
"parser",
"=",
"etree",
".",
"XMLParser",
"(",
"remove_blank_text",
"=",
"True",
",",
"remove_comments",
"=",
"True",
")",
"root",
"=",
"etree",
".",
"fromstring",
"(",
"wsdl",
",",
"parser",
"=",
"pa... | Parse the given C{wsdl} data and build the associated schemas.
@param wdsl: A string containing the raw xml of the WDSL definition
to parse.
@return: A C{dict} mapping response type names to their schemas. | [
"Parse",
"the",
"given",
"C",
"{",
"wsdl",
"}",
"data",
"and",
"build",
"the",
"associated",
"schemas",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L467-L500 |
twisted/txaws | txaws/wsdl.py | WSDLParser._parse_type | def _parse_type(self, element, types):
"""Parse a 'complexType' element.
@param element: The top-level complexType element
@param types: A map of the elements of all available complexType's.
@return: The schema for the complexType.
"""
name = element.attrib["name"]
... | python | def _parse_type(self, element, types):
"""Parse a 'complexType' element.
@param element: The top-level complexType element
@param types: A map of the elements of all available complexType's.
@return: The schema for the complexType.
"""
name = element.attrib["name"]
... | [
"def",
"_parse_type",
"(",
"self",
",",
"element",
",",
"types",
")",
":",
"name",
"=",
"element",
".",
"attrib",
"[",
"\"name\"",
"]",
"type",
"=",
"element",
".",
"attrib",
"[",
"\"type\"",
"]",
"if",
"not",
"type",
".",
"startswith",
"(",
"\"tns:\""... | Parse a 'complexType' element.
@param element: The top-level complexType element
@param types: A map of the elements of all available complexType's.
@return: The schema for the complexType. | [
"Parse",
"a",
"complexType",
"element",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L508-L562 |
twisted/txaws | txaws/wsdl.py | WSDLParser._parse_child | def _parse_child(self, child):
"""Parse a single child element.
@param child: The child C{etree.Element} to parse.
@return: A tuple C{(name, type, min_occurs, max_occurs)} with the
details about the given child.
"""
if set(child.attrib) - set(["name", "type", "minOcc... | python | def _parse_child(self, child):
"""Parse a single child element.
@param child: The child C{etree.Element} to parse.
@return: A tuple C{(name, type, min_occurs, max_occurs)} with the
details about the given child.
"""
if set(child.attrib) - set(["name", "type", "minOcc... | [
"def",
"_parse_child",
"(",
"self",
",",
"child",
")",
":",
"if",
"set",
"(",
"child",
".",
"attrib",
")",
"-",
"set",
"(",
"[",
"\"name\"",
",",
"\"type\"",
",",
"\"minOccurs\"",
",",
"\"maxOccurs\"",
"]",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Un... | Parse a single child element.
@param child: The child C{etree.Element} to parse.
@return: A tuple C{(name, type, min_occurs, max_occurs)} with the
details about the given child. | [
"Parse",
"a",
"single",
"child",
"element",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L564-L584 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Api.get_existing_item | def get_existing_item(self, item):
"""
Lookup item in remote service based on keys.
:param item: D4S2Item data contains keys we will use for lookup.
:return: requests.Response containing the successful result
"""
params = {
'project_id': item.project_id,
... | python | def get_existing_item(self, item):
"""
Lookup item in remote service based on keys.
:param item: D4S2Item data contains keys we will use for lookup.
:return: requests.Response containing the successful result
"""
params = {
'project_id': item.project_id,
... | [
"def",
"get_existing_item",
"(",
"self",
",",
"item",
")",
":",
"params",
"=",
"{",
"'project_id'",
":",
"item",
".",
"project_id",
",",
"'from_user_id'",
":",
"item",
".",
"from_user_id",
",",
"'to_user_id'",
":",
"item",
".",
"to_user_id",
",",
"}",
"res... | Lookup item in remote service based on keys.
:param item: D4S2Item data contains keys we will use for lookup.
:return: requests.Response containing the successful result | [
"Lookup",
"item",
"in",
"remote",
"service",
"based",
"on",
"keys",
".",
":",
"param",
"item",
":",
"D4S2Item",
"data",
"contains",
"keys",
"we",
"will",
"use",
"for",
"lookup",
".",
":",
"return",
":",
"requests",
".",
"Response",
"containing",
"the",
"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L100-L113 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Api.create_item | def create_item(self, item):
"""
Create a new item in D4S2 service for item at the specified destination.
:param item: D4S2Item data to use for creating a D4S2 item
:return: requests.Response containing the successful result
"""
item_dict = {
'project_id': ite... | python | def create_item(self, item):
"""
Create a new item in D4S2 service for item at the specified destination.
:param item: D4S2Item data to use for creating a D4S2 item
:return: requests.Response containing the successful result
"""
item_dict = {
'project_id': ite... | [
"def",
"create_item",
"(",
"self",
",",
"item",
")",
":",
"item_dict",
"=",
"{",
"'project_id'",
":",
"item",
".",
"project_id",
",",
"'from_user_id'",
":",
"item",
".",
"from_user_id",
",",
"'to_user_id'",
":",
"item",
".",
"to_user_id",
",",
"'role'",
":... | Create a new item in D4S2 service for item at the specified destination.
:param item: D4S2Item data to use for creating a D4S2 item
:return: requests.Response containing the successful result | [
"Create",
"a",
"new",
"item",
"in",
"D4S2",
"service",
"for",
"item",
"at",
"the",
"specified",
"destination",
".",
":",
"param",
"item",
":",
"D4S2Item",
"data",
"to",
"use",
"for",
"creating",
"a",
"D4S2",
"item",
":",
"return",
":",
"requests",
".",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L115-L133 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Api.send_item | def send_item(self, destination, item_id, force_send):
"""
Run send method for item_id at destination.
:param destination: str which type of operation are we doing (SHARE_DESTINATION or DELIVER_DESTINATION)
:param item_id: str D4S2 service id representing the item we want to send
... | python | def send_item(self, destination, item_id, force_send):
"""
Run send method for item_id at destination.
:param destination: str which type of operation are we doing (SHARE_DESTINATION or DELIVER_DESTINATION)
:param item_id: str D4S2 service id representing the item we want to send
... | [
"def",
"send_item",
"(",
"self",
",",
"destination",
",",
"item_id",
",",
"force_send",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"'force'",
":",
"force_send",
",",
"}",
")",
"url_suffix",
"=",
"\"{}/send/\"",
".",
"format",
"(",
"item_id",
... | Run send method for item_id at destination.
:param destination: str which type of operation are we doing (SHARE_DESTINATION or DELIVER_DESTINATION)
:param item_id: str D4S2 service id representing the item we want to send
:param force_send: bool it's ok to email the item again
:return: r... | [
"Run",
"send",
"method",
"for",
"item_id",
"at",
"destination",
".",
":",
"param",
"destination",
":",
"str",
"which",
"type",
"of",
"operation",
"are",
"we",
"doing",
"(",
"SHARE_DESTINATION",
"or",
"DELIVER_DESTINATION",
")",
":",
"param",
"item_id",
":",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L135-L149 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Api.check_response | def check_response(self, response):
"""
Raises error if the response isn't successful.
:param response: requests.Response response to be checked
"""
if response.status_code == 401:
raise D4S2Error(UNAUTHORIZED_MESSAGE)
if not 200 <= response.status_code < 300:... | python | def check_response(self, response):
"""
Raises error if the response isn't successful.
:param response: requests.Response response to be checked
"""
if response.status_code == 401:
raise D4S2Error(UNAUTHORIZED_MESSAGE)
if not 200 <= response.status_code < 300:... | [
"def",
"check_response",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"401",
":",
"raise",
"D4S2Error",
"(",
"UNAUTHORIZED_MESSAGE",
")",
"if",
"not",
"200",
"<=",
"response",
".",
"status_code",
"<",
"300",
":",
"rai... | Raises error if the response isn't successful.
:param response: requests.Response response to be checked | [
"Raises",
"error",
"if",
"the",
"response",
"isn",
"t",
"successful",
".",
":",
"param",
"response",
":",
"requests",
".",
"Response",
"response",
"to",
"be",
"checked"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L151-L160 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Item.send | def send(self, api, force_send):
"""
Send this item using api.
:param api: D4S2Api sends messages to D4S2
:param force_send: bool should we send even if the item already exists
"""
item_id = self.get_existing_item_id(api)
if not item_id:
item_id = self... | python | def send(self, api, force_send):
"""
Send this item using api.
:param api: D4S2Api sends messages to D4S2
:param force_send: bool should we send even if the item already exists
"""
item_id = self.get_existing_item_id(api)
if not item_id:
item_id = self... | [
"def",
"send",
"(",
"self",
",",
"api",
",",
"force_send",
")",
":",
"item_id",
"=",
"self",
".",
"get_existing_item_id",
"(",
"api",
")",
"if",
"not",
"item_id",
":",
"item_id",
"=",
"self",
".",
"create_item_returning_id",
"(",
"api",
")",
"api",
".",
... | Send this item using api.
:param api: D4S2Api sends messages to D4S2
:param force_send: bool should we send even if the item already exists | [
"Send",
"this",
"item",
"using",
"api",
".",
":",
"param",
"api",
":",
"D4S2Api",
"sends",
"messages",
"to",
"D4S2",
":",
"param",
"force_send",
":",
"bool",
"should",
"we",
"send",
"even",
"if",
"the",
"item",
"already",
"exists"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L189-L205 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Item.get_existing_item_id | def get_existing_item_id(self, api):
"""
Lookup the id for this item via the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str id of this item or None if not found
"""
resp = api.get_existing_item(self)
items = resp.json()
... | python | def get_existing_item_id(self, api):
"""
Lookup the id for this item via the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str id of this item or None if not found
"""
resp = api.get_existing_item(self)
items = resp.json()
... | [
"def",
"get_existing_item_id",
"(",
"self",
",",
"api",
")",
":",
"resp",
"=",
"api",
".",
"get_existing_item",
"(",
"self",
")",
"items",
"=",
"resp",
".",
"json",
"(",
")",
"num_items",
"=",
"len",
"(",
"items",
")",
"if",
"num_items",
"==",
"0",
"... | Lookup the id for this item via the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str id of this item or None if not found | [
"Lookup",
"the",
"id",
"for",
"this",
"item",
"via",
"the",
"D4S2",
"service",
".",
":",
"param",
"api",
":",
"D4S2Api",
"object",
"who",
"communicates",
"with",
"D4S2",
"server",
".",
":",
"return",
"str",
"id",
"of",
"this",
"item",
"or",
"None",
"if... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L207-L219 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Item.create_item_returning_id | def create_item_returning_id(self, api):
"""
Create this item in the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str newly created id for this item
"""
resp = api.create_item(self)
item = resp.json()
return item['id'... | python | def create_item_returning_id(self, api):
"""
Create this item in the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str newly created id for this item
"""
resp = api.create_item(self)
item = resp.json()
return item['id'... | [
"def",
"create_item_returning_id",
"(",
"self",
",",
"api",
")",
":",
"resp",
"=",
"api",
".",
"create_item",
"(",
"self",
")",
"item",
"=",
"resp",
".",
"json",
"(",
")",
"return",
"item",
"[",
"'id'",
"]"
] | Create this item in the D4S2 service.
:param api: D4S2Api object who communicates with D4S2 server.
:return str newly created id for this item | [
"Create",
"this",
"item",
"in",
"the",
"D4S2",
"service",
".",
":",
"param",
"api",
":",
"D4S2Api",
"object",
"who",
"communicates",
"with",
"D4S2",
"server",
".",
":",
"return",
"str",
"newly",
"created",
"id",
"for",
"this",
"item"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L221-L229 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project.share | def share(self, project, to_user, force_send, auth_role, user_message):
"""
Send mail and give user specified access to the project.
:param project: RemoteProject project to share
:param to_user: RemoteUser user to receive email/access
:param auth_role: str project role eg 'proje... | python | def share(self, project, to_user, force_send, auth_role, user_message):
"""
Send mail and give user specified access to the project.
:param project: RemoteProject project to share
:param to_user: RemoteUser user to receive email/access
:param auth_role: str project role eg 'proje... | [
"def",
"share",
"(",
"self",
",",
"project",
",",
"to_user",
",",
"force_send",
",",
"auth_role",
",",
"user_message",
")",
":",
"if",
"self",
".",
"_is_current_user",
"(",
"to_user",
")",
":",
"raise",
"ShareWithSelfError",
"(",
"SHARE_WITH_SELF_MESSAGE",
"."... | Send mail and give user specified access to the project.
:param project: RemoteProject project to share
:param to_user: RemoteUser user to receive email/access
:param auth_role: str project role eg 'project_admin' to give to the user
:param user_message: str message to be sent with the s... | [
"Send",
"mail",
"and",
"give",
"user",
"specified",
"access",
"to",
"the",
"project",
".",
":",
"param",
"project",
":",
"RemoteProject",
"project",
"to",
"share",
":",
"param",
"to_user",
":",
"RemoteUser",
"user",
"to",
"receive",
"email",
"/",
"access",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L251-L265 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project.set_user_project_permission | def set_user_project_permission(self, project, user, auth_role):
"""
Give user access permissions for a project.
:param project: RemoteProject project to update permissions on
:param user: RemoteUser user to receive permissions
:param auth_role: str project role eg 'project_admin... | python | def set_user_project_permission(self, project, user, auth_role):
"""
Give user access permissions for a project.
:param project: RemoteProject project to update permissions on
:param user: RemoteUser user to receive permissions
:param auth_role: str project role eg 'project_admin... | [
"def",
"set_user_project_permission",
"(",
"self",
",",
"project",
",",
"user",
",",
"auth_role",
")",
":",
"self",
".",
"remote_store",
".",
"set_user_project_permission",
"(",
"project",
",",
"user",
",",
"auth_role",
")"
] | Give user access permissions for a project.
:param project: RemoteProject project to update permissions on
:param user: RemoteUser user to receive permissions
:param auth_role: str project role eg 'project_admin' | [
"Give",
"user",
"access",
"permissions",
"for",
"a",
"project",
".",
":",
"param",
"project",
":",
"RemoteProject",
"project",
"to",
"update",
"permissions",
"on",
":",
"param",
"user",
":",
"RemoteUser",
"user",
"to",
"receive",
"permissions",
":",
"param",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L267-L274 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project.deliver | def deliver(self, project, new_project_name, to_user, share_users, force_send, path_filter, user_message):
"""
Remove access to project_name for to_user, copy to new_project_name if not None,
send message to service to email user so they can have access.
:param project: RemoteProject pre... | python | def deliver(self, project, new_project_name, to_user, share_users, force_send, path_filter, user_message):
"""
Remove access to project_name for to_user, copy to new_project_name if not None,
send message to service to email user so they can have access.
:param project: RemoteProject pre... | [
"def",
"deliver",
"(",
"self",
",",
"project",
",",
"new_project_name",
",",
"to_user",
",",
"share_users",
",",
"force_send",
",",
"path_filter",
",",
"user_message",
")",
":",
"if",
"self",
".",
"_is_current_user",
"(",
"to_user",
")",
":",
"raise",
"Share... | Remove access to project_name for to_user, copy to new_project_name if not None,
send message to service to email user so they can have access.
:param project: RemoteProject pre-existing project to be delivered
:param new_project_name: str name of non-existing project to copy project_name to, if... | [
"Remove",
"access",
"to",
"project_name",
"for",
"to_user",
"copy",
"to",
"new_project_name",
"if",
"not",
"None",
"send",
"message",
"to",
"service",
"to",
"email",
"user",
"so",
"they",
"can",
"have",
"access",
".",
":",
"param",
"project",
":",
"RemotePro... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L276-L297 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project._share_project | def _share_project(self, destination, project, to_user, force_send, auth_role='', user_message='',
share_users=None):
"""
Send message to remote service to email/share project with to_user.
:param destination: str which type of sharing we are doing (SHARE_DESTINATION or DE... | python | def _share_project(self, destination, project, to_user, force_send, auth_role='', user_message='',
share_users=None):
"""
Send message to remote service to email/share project with to_user.
:param destination: str which type of sharing we are doing (SHARE_DESTINATION or DE... | [
"def",
"_share_project",
"(",
"self",
",",
"destination",
",",
"project",
",",
"to_user",
",",
"force_send",
",",
"auth_role",
"=",
"''",
",",
"user_message",
"=",
"''",
",",
"share_users",
"=",
"None",
")",
":",
"from_user",
"=",
"self",
".",
"remote_stor... | Send message to remote service to email/share project with to_user.
:param destination: str which type of sharing we are doing (SHARE_DESTINATION or DELIVER_DESTINATION)
:param project: RemoteProject project we are sharing
:param to_user: RemoteUser user we are sharing with
:param auth_r... | [
"Send",
"message",
"to",
"remote",
"service",
"to",
"email",
"/",
"share",
"project",
"with",
"to_user",
".",
":",
"param",
"destination",
":",
"str",
"which",
"type",
"of",
"sharing",
"we",
"are",
"doing",
"(",
"SHARE_DESTINATION",
"or",
"DELIVER_DESTINATION"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L307-L332 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project._copy_project | def _copy_project(self, project, new_project_name, path_filter):
"""
Copy pre-existing project with name project_name to non-existing project new_project_name.
:param project: remotestore.RemoteProject project to copy from
:param new_project_name: str project to copy to
:param pa... | python | def _copy_project(self, project, new_project_name, path_filter):
"""
Copy pre-existing project with name project_name to non-existing project new_project_name.
:param project: remotestore.RemoteProject project to copy from
:param new_project_name: str project to copy to
:param pa... | [
"def",
"_copy_project",
"(",
"self",
",",
"project",
",",
"new_project_name",
",",
"path_filter",
")",
":",
"temp_directory",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"new_project_name_or_id",
"=",
"ProjectNameOrId",
".",
"create_from_name",
"(",
"new_project_name... | Copy pre-existing project with name project_name to non-existing project new_project_name.
:param project: remotestore.RemoteProject project to copy from
:param new_project_name: str project to copy to
:param path_filter: PathFilter: filters what files are shared
:return: RemoteProject n... | [
"Copy",
"pre",
"-",
"existing",
"project",
"with",
"name",
"project_name",
"to",
"non",
"-",
"existing",
"project",
"new_project_name",
".",
":",
"param",
"project",
":",
"remotestore",
".",
"RemoteProject",
"project",
"to",
"copy",
"from",
":",
"param",
"new_... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L334-L352 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project._download_project | def _download_project(self, activity, project, temp_directory, path_filter):
"""
Download the project with project_name to temp_directory.
:param activity: CopyActivity: info about the copy activity are downloading for
:param project: remotestore.RemoteProject project to download
... | python | def _download_project(self, activity, project, temp_directory, path_filter):
"""
Download the project with project_name to temp_directory.
:param activity: CopyActivity: info about the copy activity are downloading for
:param project: remotestore.RemoteProject project to download
... | [
"def",
"_download_project",
"(",
"self",
",",
"activity",
",",
"project",
",",
"temp_directory",
",",
"path_filter",
")",
":",
"self",
".",
"print_func",
"(",
"\"Downloading a copy of '{}'.\"",
".",
"format",
"(",
"project",
".",
"name",
")",
")",
"project_downl... | Download the project with project_name to temp_directory.
:param activity: CopyActivity: info about the copy activity are downloading for
:param project: remotestore.RemoteProject project to download
:param temp_directory: str path to directory we can download into
:param path_filter: Pa... | [
"Download",
"the",
"project",
"with",
"project_name",
"to",
"temp_directory",
".",
":",
"param",
"activity",
":",
"CopyActivity",
":",
"info",
"about",
"the",
"copy",
"activity",
"are",
"downloading",
"for",
":",
"param",
"project",
":",
"remotestore",
".",
"R... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L354-L365 |
Duke-GCB/DukeDSClient | ddsc/core/d4s2.py | D4S2Project._upload_project | def _upload_project(self, activity, project_name, temp_directory):
"""
Upload the contents of temp_directory into project_name
:param activity: CopyActivity: info about the copy activity are uploading for
:param project_name: str project name we will upload files to
:param temp_d... | python | def _upload_project(self, activity, project_name, temp_directory):
"""
Upload the contents of temp_directory into project_name
:param activity: CopyActivity: info about the copy activity are uploading for
:param project_name: str project name we will upload files to
:param temp_d... | [
"def",
"_upload_project",
"(",
"self",
",",
"activity",
",",
"project_name",
",",
"temp_directory",
")",
":",
"self",
".",
"print_func",
"(",
"\"Uploading to '{}'.\"",
".",
"format",
"(",
"project_name",
")",
")",
"items_to_send",
"=",
"[",
"os",
".",
"path",
... | Upload the contents of temp_directory into project_name
:param activity: CopyActivity: info about the copy activity are uploading for
:param project_name: str project name we will upload files to
:param temp_directory: str path to directory who's files we will upload | [
"Upload",
"the",
"contents",
"of",
"temp_directory",
"into",
"project_name",
":",
"param",
"activity",
":",
"CopyActivity",
":",
"info",
"about",
"the",
"copy",
"activity",
"are",
"uploading",
"for",
":",
"param",
"project_name",
":",
"str",
"project",
"name",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L367-L379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.