repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
iskandr/knnimpute | knnimpute/common.py | knn_initialize | def knn_initialize(
X,
missing_mask,
verbose=False,
min_dist=1e-6,
max_dist_multiplier=1e6):
"""
Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid... | python | def knn_initialize(
X,
missing_mask,
verbose=False,
min_dist=1e-6,
max_dist_multiplier=1e6):
"""
Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid... | [
"def",
"knn_initialize",
"(",
"X",
",",
"missing_mask",
",",
"verbose",
"=",
"False",
",",
"min_dist",
"=",
"1e-6",
",",
"max_dist_multiplier",
"=",
"1e6",
")",
":",
"X_row_major",
"=",
"X",
".",
"copy",
"(",
"\"C\"",
")",
"if",
"missing_mask",
".",
"sum... | Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid out in row-major, the distance matrix,
and an "effective infinity" which is larger than any entry of the
distance matrix. | [
"Fill",
"X",
"with",
"NaN",
"values",
"if",
"necessary",
"construct",
"the",
"n_samples",
"x",
"n_samples",
"distance",
"matrix",
"and",
"set",
"the",
"self",
"-",
"distance",
"of",
"each",
"row",
"to",
"infinity",
"."
] | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/common.py#L20-L50 | train |
iskandr/knnimpute | knnimpute/optimistic.py | knn_impute_optimistic | def knn_impute_optimistic(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weight... | python | def knn_impute_optimistic(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weight... | [
"def",
"knn_impute_optimistic",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"start_t",
"=",
"time",
".",
"time",
"(",
")",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"X_row_m... | Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weighted average of a row's k-nearest neighbors
and checks afterward whether it was valid (due to possible missing values).
Has been... | [
"Fill",
"in",
"the",
"given",
"incomplete",
"matrix",
"using",
"k",
"-",
"nearest",
"neighbor",
"imputation",
"."
] | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/optimistic.py#L21-L152 | train |
iskandr/knnimpute | knnimpute/normalized_distance.py | all_pairs_normalized_distances | def all_pairs_normalized_distances(X):
"""
We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
tw... | python | def all_pairs_normalized_distances(X):
"""
We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
tw... | [
"def",
"all_pairs_normalized_distances",
"(",
"X",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"# matrix of mean squared difference between between samples",
"D",
"=",
"np",
".",
"ones",
"(",
"(",
"n_rows",
",",
"n_rows",
")",
",",
"dtype",
"=",
... | We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
two vectors have in common. If two vectors have no fe... | [
"We",
"can",
"t",
"really",
"compute",
"distances",
"over",
"incomplete",
"data",
"since",
"rows",
"are",
"missing",
"different",
"numbers",
"of",
"entries",
".",
"The",
"next",
"best",
"thing",
"is",
"the",
"mean",
"squared",
"difference",
"between",
"two",
... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L18-L84 | train |
iskandr/knnimpute | knnimpute/normalized_distance.py | all_pairs_normalized_distances_reference | def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
n_samples, n_cols = X.shape
# matrix of mean squared difference between between samples
D = np.ones((n... | python | def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
n_samples, n_cols = X.shape
# matrix of mean squared difference between between samples
D = np.ones((n... | [
"def",
"all_pairs_normalized_distances_reference",
"(",
"X",
")",
":",
"n_samples",
",",
"n_cols",
"=",
"X",
".",
"shape",
"# matrix of mean squared difference between between samples",
"D",
"=",
"np",
".",
"ones",
"(",
"(",
"n_samples",
",",
"n_samples",
")",
",",
... | Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence. | [
"Reference",
"implementation",
"of",
"normalized",
"all",
"-",
"pairs",
"distance",
"used",
"for",
"testing",
"the",
"more",
"efficient",
"implementation",
"above",
"for",
"equivalence",
"."
] | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L87-L103 | train |
iskandr/knnimpute | knnimpute/argpartition.py | knn_impute_with_argpartition | def knn_impute_with_argpartition(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for... | python | def knn_impute_with_argpartition(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for... | [
"def",
"knn_impute_with_argpartition",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"start_t",
"=",
"time",
".",
"time",
"(",
")",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"... | Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for many (but not all) dataset sizes, particularly
when most of the columns are missing in any given row. The crucial
bottleneck is the c... | [
"Fill",
"in",
"the",
"given",
"incomplete",
"matrix",
"using",
"k",
"-",
"nearest",
"neighbor",
"imputation",
"."
] | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/argpartition.py#L22-L98 | train |
iskandr/knnimpute | knnimpute/reference.py | knn_impute_reference | def knn_impute_reference(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Reference implementation of kNN imputation logic.
"""
n_rows, n_cols = X.shape
X_result, D, effective_infinity = \
knn_initialize(X, missing_mask, verbose=verbose)
... | python | def knn_impute_reference(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Reference implementation of kNN imputation logic.
"""
n_rows, n_cols = X.shape
X_result, D, effective_infinity = \
knn_initialize(X, missing_mask, verbose=verbose)
... | [
"def",
"knn_impute_reference",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"X_result",
",",
"D",
",",
"effective_infinity",
"=",
"knn... | Reference implementation of kNN imputation logic. | [
"Reference",
"implementation",
"of",
"kNN",
"imputation",
"logic",
"."
] | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/reference.py#L20-L55 | train |
bruth/django-tracking2 | tracking/managers.py | VisitorManager.active | def active(self, registered_only=True):
"Returns all active users, e.g. not logged and non-expired session."
visitors = self.filter(
expiry_time__gt=timezone.now(),
end_time=None
)
if registered_only:
visitors = visitors.filter(user__isnull=False)
... | python | def active(self, registered_only=True):
"Returns all active users, e.g. not logged and non-expired session."
visitors = self.filter(
expiry_time__gt=timezone.now(),
end_time=None
)
if registered_only:
visitors = visitors.filter(user__isnull=False)
... | [
"def",
"active",
"(",
"self",
",",
"registered_only",
"=",
"True",
")",
":",
"visitors",
"=",
"self",
".",
"filter",
"(",
"expiry_time__gt",
"=",
"timezone",
".",
"now",
"(",
")",
",",
"end_time",
"=",
"None",
")",
"if",
"registered_only",
":",
"visitors... | Returns all active users, e.g. not logged and non-expired session. | [
"Returns",
"all",
"active",
"users",
"e",
".",
"g",
".",
"not",
"logged",
"and",
"non",
"-",
"expired",
"session",
"."
] | e029f35907e65ca38e0783f6bdbe9f481d946ddb | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L13-L21 | train |
bruth/django-tracking2 | tracking/managers.py | VisitorManager.stats | def stats(self, start_date, end_date, registered_only=False):
"""Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered use... | python | def stats(self, start_date, end_date, registered_only=False):
"""Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered use... | [
"def",
"stats",
"(",
"self",
",",
"start_date",
",",
"end_date",
",",
"registered_only",
"=",
"False",
")",
":",
"visitors",
"=",
"self",
".",
"filter",
"(",
"start_time__gte",
"=",
"start_date",
",",
"start_time__lt",
"=",
"end_date",
")",
"stats",
"=",
"... | Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered users and guests. | [
"Returns",
"a",
"dictionary",
"of",
"visits",
"including",
":"
] | e029f35907e65ca38e0783f6bdbe9f481d946ddb | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L29-L151 | train |
bruth/django-tracking2 | tracking/managers.py | PageviewManager.stats | def stats(self, start_date=None, end_date=None, registered_only=False):
"""Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests.
"""
pageviews = self.filter(
visitor__start_time__lt=end_date,
visit... | python | def stats(self, start_date=None, end_date=None, registered_only=False):
"""Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests.
"""
pageviews = self.filter(
visitor__start_time__lt=end_date,
visit... | [
"def",
"stats",
"(",
"self",
",",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"registered_only",
"=",
"False",
")",
":",
"pageviews",
"=",
"self",
".",
"filter",
"(",
"visitor__start_time__lt",
"=",
"end_date",
",",
"visitor__start_time__gte"... | Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests. | [
"Returns",
"a",
"dictionary",
"of",
"pageviews",
"including",
":"
] | e029f35907e65ca38e0783f6bdbe9f481d946ddb | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L189-L247 | train |
bruth/django-tracking2 | tracking/views.py | dashboard | def dashboard(request):
"Counts, aggregations and more!"
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
en... | python | def dashboard(request):
"Counts, aggregations and more!"
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
en... | [
"def",
"dashboard",
"(",
"request",
")",
":",
"end_time",
"=",
"now",
"(",
")",
"start_time",
"=",
"end_time",
"-",
"timedelta",
"(",
"days",
"=",
"7",
")",
"defaults",
"=",
"{",
"'start'",
":",
"start_time",
",",
"'end'",
":",
"end_time",
"}",
"form",... | Counts, aggregations and more! | [
"Counts",
"aggregations",
"and",
"more!"
] | e029f35907e65ca38e0783f6bdbe9f481d946ddb | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/views.py#L31-L68 | train |
bruth/django-tracking2 | tracking/models.py | Visitor.geoip_data | def geoip_data(self):
"""Attempt to retrieve MaxMind GeoIP data based on visitor's IP."""
if not HAS_GEOIP or not TRACK_USING_GEOIP:
return
if not hasattr(self, '_geoip_data'):
self._geoip_data = None
try:
gip = GeoIP(cache=GEOIP_CACHE_TYPE)
... | python | def geoip_data(self):
"""Attempt to retrieve MaxMind GeoIP data based on visitor's IP."""
if not HAS_GEOIP or not TRACK_USING_GEOIP:
return
if not hasattr(self, '_geoip_data'):
self._geoip_data = None
try:
gip = GeoIP(cache=GEOIP_CACHE_TYPE)
... | [
"def",
"geoip_data",
"(",
"self",
")",
":",
"if",
"not",
"HAS_GEOIP",
"or",
"not",
"TRACK_USING_GEOIP",
":",
"return",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_geoip_data'",
")",
":",
"self",
".",
"_geoip_data",
"=",
"None",
"try",
":",
"gip",
"=",
... | Attempt to retrieve MaxMind GeoIP data based on visitor's IP. | [
"Attempt",
"to",
"retrieve",
"MaxMind",
"GeoIP",
"data",
"based",
"on",
"visitor",
"s",
"IP",
"."
] | e029f35907e65ca38e0783f6bdbe9f481d946ddb | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/models.py#L62-L77 | train |
syrusakbary/pyjade | pyjade/runtime.py | escape | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
if isinstance(s, six.bi... | python | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
if isinstance(s, six.bi... | [
"def",
"escape",
"(",
"s",
")",
":",
"if",
"hasattr",
"(",
"s",
",",
"'__html__'",
")",
":",
"return",
"s",
".",
"__html__",
"(",
")",
"if",
"isinstance",
"(",
"s",
",",
"six",
".",
"binary_type",
")",
":",
"s",
"=",
"six",
".",
"text_type",
"(",... | Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string. | [
"Convert",
"the",
"characters",
"&",
"<",
">",
"and",
"in",
"string",
"s",
"to",
"HTML",
"-",
"safe",
"sequences",
".",
"Use",
"this",
"if",
"you",
"need",
"to",
"display",
"text",
"that",
"might",
"contain",
"such",
"characters",
"in",
"HTML",
".",
"M... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L28-L48 | train |
syrusakbary/pyjade | pyjade/runtime.py | iteration | def iteration(obj, num_keys):
"""
Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it... | python | def iteration(obj, num_keys):
"""
Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it... | [
"def",
"iteration",
"(",
"obj",
",",
"num_keys",
")",
":",
"# If the object is a mapping type, return it as-is",
"if",
"is_mapping",
"(",
"obj",
")",
":",
"return",
"obj",
"_marker",
"=",
"[",
"]",
"iter_obj",
"=",
"iter",
"(",
"obj",
")",
"head",
"=",
"next... | Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it as-is, and assume
the caller has... | [
"Jade",
"iteration",
"supports",
"for",
"value",
"[",
"key",
"]",
"?",
"iteration",
"only",
".",
"PyJade",
"has",
"implicitly",
"supported",
"value",
"unpacking",
"instead",
"without",
"the",
"list",
"indexes",
".",
"Trying",
"to",
"not",
"break",
"existing",
... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L89-L135 | train |
syrusakbary/pyjade | pyjade/ext/django/templatetags.py | do_evaluate | def do_evaluate(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Evaluator(code) | python | def do_evaluate(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Evaluator(code) | [
"def",
"do_evaluate",
"(",
"parser",
",",
"token",
")",
":",
"code",
"=",
"token",
".",
"contents",
"firstspace",
"=",
"code",
".",
"find",
"(",
"' '",
")",
"if",
"firstspace",
">=",
"0",
":",
"code",
"=",
"code",
"[",
"firstspace",
"+",
"1",
":",
... | Calls an arbitrary method on an object. | [
"Calls",
"an",
"arbitrary",
"method",
"on",
"an",
"object",
"."
] | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L24-L30 | train |
syrusakbary/pyjade | pyjade/ext/django/templatetags.py | do_set | def do_set(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Setter(code) | python | def do_set(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Setter(code) | [
"def",
"do_set",
"(",
"parser",
",",
"token",
")",
":",
"code",
"=",
"token",
".",
"contents",
"firstspace",
"=",
"code",
".",
"find",
"(",
"' '",
")",
"if",
"firstspace",
">=",
"0",
":",
"code",
"=",
"code",
"[",
"firstspace",
"+",
"1",
":",
"]",
... | Calls an arbitrary method on an object. | [
"Calls",
"an",
"arbitrary",
"method",
"on",
"an",
"object",
"."
] | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L50-L56 | train |
syrusakbary/pyjade | pyjade/ext/django/templatetags.py | Evaluator.render | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
'pyjade': __import__('pyjade')
}
context['false'] = False
context['true'] = True
try:
return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context))
except NameE... | python | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
'pyjade': __import__('pyjade')
}
context['false'] = False
context['true'] = True
try:
return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context))
except NameE... | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"modules",
"=",
"{",
"'pyjade'",
":",
"__import__",
"(",
"'pyjade'",
")",
"}",
"context",
"[",
"'false'",
"]",
"=",
"False",
"context",
"[",
"'true'",
"]",
"=",
"True",
"try",
":",
"return",
"si... | Evaluates the code in the page and returns the result | [
"Evaluates",
"the",
"code",
"in",
"the",
"page",
"and",
"returns",
"the",
"result"
] | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L37-L47 | train |
syrusakbary/pyjade | pyjade/ext/django/templatetags.py | Setter.render | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
}
context['false'] = False
context['true'] = True
new_ctx = eval('dict(%s)'%self.code,modules,context)
context.update(new_ctx)
return '' | python | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
}
context['false'] = False
context['true'] = True
new_ctx = eval('dict(%s)'%self.code,modules,context)
context.update(new_ctx)
return '' | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"modules",
"=",
"{",
"}",
"context",
"[",
"'false'",
"]",
"=",
"False",
"context",
"[",
"'true'",
"]",
"=",
"True",
"new_ctx",
"=",
"eval",
"(",
"'dict(%s)'",
"%",
"self",
".",
"code",
",",
"m... | Evaluates the code in the page and returns the result | [
"Evaluates",
"the",
"code",
"in",
"the",
"page",
"and",
"returns",
"the",
"result"
] | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L63-L71 | train |
PokeAPI/pokebase | pokebase/common.py | sprite_filepath_build | def sprite_filepath_build(sprite_type, sprite_id, **kwargs):
"""returns the filepath of the sprite *relative to SPRITE_CACHE*"""
options = parse_sprite_options(sprite_type, **kwargs)
filename = '.'.join([str(sprite_id), SPRITE_EXT])
filepath = os.path.join(sprite_type, *options, filename)
return ... | python | def sprite_filepath_build(sprite_type, sprite_id, **kwargs):
"""returns the filepath of the sprite *relative to SPRITE_CACHE*"""
options = parse_sprite_options(sprite_type, **kwargs)
filename = '.'.join([str(sprite_id), SPRITE_EXT])
filepath = os.path.join(sprite_type, *options, filename)
return ... | [
"def",
"sprite_filepath_build",
"(",
"sprite_type",
",",
"sprite_id",
",",
"*",
"*",
"kwargs",
")",
":",
"options",
"=",
"parse_sprite_options",
"(",
"sprite_type",
",",
"*",
"*",
"kwargs",
")",
"filename",
"=",
"'.'",
".",
"join",
"(",
"[",
"str",
"(",
... | returns the filepath of the sprite *relative to SPRITE_CACHE* | [
"returns",
"the",
"filepath",
"of",
"the",
"sprite",
"*",
"relative",
"to",
"SPRITE_CACHE",
"*"
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/common.py#L72-L80 | train |
PokeAPI/pokebase | pokebase/interface.py | _make_obj | def _make_obj(obj):
"""Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the... | python | def _make_obj(obj):
"""Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the... | [
"def",
"_make_obj",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"if",
"'url'",
"in",
"obj",
".",
"keys",
"(",
")",
":",
"url",
"=",
"obj",
"[",
"'url'",
"]",
"id_",
"=",
"int",
"(",
"url",
".",
"split",
"(",
"... | Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the input value is simply retu... | [
"Takes",
"an",
"object",
"and",
"returns",
"a",
"corresponding",
"API",
"class",
"."
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L7-L29 | train |
PokeAPI/pokebase | pokebase/interface.py | APIResource._load | def _load(self):
"""Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None
"""
data = get_... | python | def _load(self):
"""Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None
"""
data = get_... | [
"def",
"_load",
"(",
"self",
")",
":",
"data",
"=",
"get_data",
"(",
"self",
".",
"endpoint",
",",
"self",
".",
"id_",
",",
"force_lookup",
"=",
"self",
".",
"__force_lookup",
")",
"# Make our custom objects from the data.",
"for",
"key",
",",
"val",
"in",
... | Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None | [
"Function",
"to",
"collect",
"reference",
"data",
"and",
"connect",
"it",
"to",
"the",
"instance",
"as",
"attributes",
"."
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L126-L158 | train |
PokeAPI/pokebase | pokebase/cache.py | safe_make_dirs | def safe_make_dirs(path, mode=0o777):
"""Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: direc... | python | def safe_make_dirs(path, mode=0o777):
"""Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: direc... | [
"def",
"safe_make_dirs",
"(",
"path",
",",
"mode",
"=",
"0o777",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
",",
"mode",
")",
"except",
"OSError",
"as",
"error",
":",
"if",
"error",
".",
"errno",
"!=",
"17",
":",
"# File exists",
"rais... | Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: directory permissions in octal
:return: The ne... | [
"Create",
"a",
"leaf",
"directory",
"and",
"all",
"intermediate",
"ones",
"in",
"a",
"safe",
"way",
"."
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L76-L92 | train |
PokeAPI/pokebase | pokebase/cache.py | get_default_cache | def get_default_cache():
"""Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path
"""
xdg_cache_home = os.environ.get('XDG_CACH... | python | def get_default_cache():
"""Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path
"""
xdg_cache_home = os.environ.get('XDG_CACH... | [
"def",
"get_default_cache",
"(",
")",
":",
"xdg_cache_home",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'XDG_CACHE_HOME'",
")",
"or",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
",",
"'.cache'",
")",
... | Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path | [
"Get",
"the",
"default",
"cache",
"location",
"."
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L95-L107 | train |
PokeAPI/pokebase | pokebase/cache.py | set_cache | def set_cache(new_path=None):
"""Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache direc... | python | def set_cache(new_path=None):
"""Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache direc... | [
"def",
"set_cache",
"(",
"new_path",
"=",
"None",
")",
":",
"global",
"CACHE_DIR",
",",
"API_CACHE",
",",
"SPRITE_CACHE",
"if",
"new_path",
"is",
"None",
":",
"new_path",
"=",
"get_default_cache",
"(",
")",
"CACHE_DIR",
"=",
"safe_make_dirs",
"(",
"os",
".",... | Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache directory, this function should be
cal... | [
"Simple",
"function",
"to",
"change",
"the",
"cache",
"location",
"."
] | e7d695662037811f3956ed4ea817ffee70b12e33 | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L117-L142 | train |
emc-openstack/storops | storops/unity/resource/host.py | UnityHost.attach | def attach(self, lun_or_snap, skip_hlu_0=False):
""" Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number... | python | def attach(self, lun_or_snap, skip_hlu_0=False):
""" Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number... | [
"def",
"attach",
"(",
"self",
",",
"lun_or_snap",
",",
"skip_hlu_0",
"=",
"False",
")",
":",
"# `UnityResourceAlreadyAttachedError` check was removed due to there",
"# is a host cache existing in Cinder driver. If the lun was attached to",
"# the host and the info was stored in the cache... | Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number | [
"Attaches",
"lun",
"snap",
"or",
"member",
"snap",
"of",
"cg",
"snap",
"to",
"host",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L259-L289 | train |
emc-openstack/storops | storops/unity/resource/host.py | UnityHost.has_hlu | def has_hlu(self, lun_or_snap, cg_member=None):
"""Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lu... | python | def has_hlu(self, lun_or_snap, cg_member=None):
"""Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lu... | [
"def",
"has_hlu",
"(",
"self",
",",
"lun_or_snap",
",",
"cg_member",
"=",
"None",
")",
":",
"hlu",
"=",
"self",
".",
"get_hlu",
"(",
"lun_or_snap",
",",
"cg_member",
"=",
"cg_member",
")",
"return",
"hlu",
"is",
"not",
"None"
] | Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lun_or_snap` is attached, otherwise False. | [
"Returns",
"True",
"if",
"lun_or_snap",
"is",
"attached",
"to",
"the",
"host",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L310-L319 | train |
emc-openstack/storops | storops/unity/resource/host.py | UnityHost.get_host_lun | def get_host_lun(self, lun_or_snap, cg_member=None):
"""Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg sna... | python | def get_host_lun(self, lun_or_snap, cg_member=None):
"""Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg sna... | [
"def",
"get_host_lun",
"(",
"self",
",",
"lun_or_snap",
",",
"cg_member",
"=",
"None",
")",
":",
"import",
"storops",
".",
"unity",
".",
"resource",
".",
"lun",
"as",
"lun_module",
"import",
"storops",
".",
"unity",
".",
"resource",
".",
"snap",
"as",
"s... | Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: the host lun object. | [
"Gets",
"the",
"host",
"lun",
"of",
"a",
"lun",
"lun",
"snap",
"cg",
"snap",
"or",
"a",
"member",
"snap",
"of",
"cg",
"snap",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L329-L358 | train |
emc-openstack/storops | storops/unity/resource/host.py | UnityHost.get_hlu | def get_hlu(self, resource, cg_member=None):
"""Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
... | python | def get_hlu(self, resource, cg_member=None):
"""Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
... | [
"def",
"get_hlu",
"(",
"self",
",",
"resource",
",",
"cg_member",
"=",
"None",
")",
":",
"host_lun",
"=",
"self",
".",
"get_host_lun",
"(",
"resource",
",",
"cg_member",
"=",
"cg_member",
")",
"return",
"host_lun",
"if",
"host_lun",
"is",
"None",
"else",
... | Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: the hlu number. | [
"Gets",
"the",
"hlu",
"number",
"of",
"a",
"lun",
"lun",
"snap",
"cg",
"snap",
"or",
"a",
"member",
"snap",
"of",
"cg",
"snap",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L360-L370 | train |
emc-openstack/storops | storops/unity/resource/host.py | UnityHost.update_initiators | def update_initiators(self, iqns=None, wwns=None):
"""Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed.
"""
# First get current iqns
iqns = set(iqns) if iqns else set()
current_iqns = set()
if self.iscsi_host_initiators:
cu... | python | def update_initiators(self, iqns=None, wwns=None):
"""Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed.
"""
# First get current iqns
iqns = set(iqns) if iqns else set()
current_iqns = set()
if self.iscsi_host_initiators:
cu... | [
"def",
"update_initiators",
"(",
"self",
",",
"iqns",
"=",
"None",
",",
"wwns",
"=",
"None",
")",
":",
"# First get current iqns",
"iqns",
"=",
"set",
"(",
"iqns",
")",
"if",
"iqns",
"else",
"set",
"(",
")",
"current_iqns",
"=",
"set",
"(",
")",
"if",
... | Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed. | [
"Primarily",
"for",
"puppet",
"-",
"unity",
"use",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L435-L454 | train |
rstoneback/pysat | pysat/instruments/nasa_cdaweb_methods.py | list_files | def list_files(tag=None, sat_id=None, data_path=None, format_str=None,
supported_tags=None, fake_daily_files_from_monthly=False,
two_digit_year_break=None):
"""Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrume... | python | def list_files(tag=None, sat_id=None, data_path=None, format_str=None,
supported_tags=None, fake_daily_files_from_monthly=False,
two_digit_year_break=None):
"""Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrume... | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
",",
"supported_tags",
"=",
"None",
",",
"fake_daily_files_from_monthly",
"=",
"False",
",",
"two_digit_year_break",
"=",
... | Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are <tag strings>... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L15-L85 | train |
rstoneback/pysat | pysat/instruments/nasa_cdaweb_methods.py | load | def load(fnames, tag=None, sat_id=None,
fake_daily_files_from_monthly=False,
flatten_twod=True):
"""Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (... | python | def load(fnames, tag=None, sat_id=None,
fake_daily_files_from_monthly=False,
flatten_twod=True):
"""Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (... | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"fake_daily_files_from_monthly",
"=",
"False",
",",
"flatten_twod",
"=",
"True",
")",
":",
"import",
"pysatCDF",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"r... | Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str... | [
"Load",
"NASA",
"CDAWeb",
"CDF",
"files",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L87-L157 | train |
rstoneback/pysat | pysat/instruments/nasa_cdaweb_methods.py | download | def download(supported_tags, date_array, tag, sat_id,
ftp_site='cdaweb.gsfc.nasa.gov',
data_path=None, user=None, password=None,
fake_daily_files_from_monthly=False):
"""Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrumen... | python | def download(supported_tags, date_array, tag, sat_id,
ftp_site='cdaweb.gsfc.nasa.gov',
data_path=None, user=None, password=None,
fake_daily_files_from_monthly=False):
"""Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrumen... | [
"def",
"download",
"(",
"supported_tags",
",",
"date_array",
",",
"tag",
",",
"sat_id",
",",
"ftp_site",
"=",
"'cdaweb.gsfc.nasa.gov'",
",",
"data_path",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"fake_daily_files_from_monthly",
... | Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
-----------
supported_tags : dict
dict of dicts. Keys are supported tag names for download. Value is
a dict with 'd... | [
"Routine",
"to",
"download",
"NASA",
"CDAWeb",
"CDF",
"data",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L159-L261 | train |
emc-openstack/storops | storops/connection/exceptions.py | from_response | def from_response(response, method, url):
"""Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request
"""
req_id = response.headers.get("x-opensta... | python | def from_response(response, method, url):
"""Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request
"""
req_id = response.headers.get("x-opensta... | [
"def",
"from_response",
"(",
"response",
",",
"method",
",",
"url",
")",
":",
"req_id",
"=",
"response",
".",
"headers",
".",
"get",
"(",
"\"x-openstack-request-id\"",
")",
"# NOTE(hdd) true for older versions of nova and cinder",
"if",
"not",
"req_id",
":",
"req_id... | Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request | [
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"HttpError",
"or",
"subclass",
"based",
"on",
"response",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/exceptions.py#L84-L132 | train |
emc-openstack/storops | storops/unity/resource/system.py | UnitySystem.create_pool | def create_pool(self, name, raid_groups, description=None, **kwargs):
"""Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system ... | python | def create_pool(self, name, raid_groups, description=None, **kwargs):
"""Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system ... | [
"def",
"create_pool",
"(",
"self",
",",
"name",
",",
"raid_groups",
",",
"description",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"UnityPool",
".",
"create",
"(",
"self",
".",
"_cli",
",",
"name",
"=",
"name",
",",
"description",
"=",
... | Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system will generate
alerts about the free space in the pool, specified a... | [
"Create",
"pool",
"based",
"on",
"RaidGroupParameter",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L122-L160 | train |
emc-openstack/storops | storops/unity/resource/system.py | UnitySystem.get_file_port | def get_file_port(self):
"""Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports.
"""
eths = self.get_ethernet_port(bond=False)
las = self.get_link_aggregation()
return eths + las | python | def get_file_port(self):
"""Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports.
"""
eths = self.get_ethernet_port(bond=False)
las = self.get_link_aggregation()
return eths + las | [
"def",
"get_file_port",
"(",
"self",
")",
":",
"eths",
"=",
"self",
".",
"get_ethernet_port",
"(",
"bond",
"=",
"False",
")",
"las",
"=",
"self",
".",
"get_link_aggregation",
"(",
")",
"return",
"eths",
"+",
"las"
] | Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports. | [
"Returns",
"ports",
"list",
"can",
"be",
"used",
"by",
"File"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L209-L216 | train |
emc-openstack/storops | storops/unity/resource/system.py | UnitySystem.create_remote_system | def create_remote_system(self, management_address,
local_username=None, local_password=None,
remote_username=None, remote_password=None,
connection_type=None):
"""
Configures a remote system for remote replication.
... | python | def create_remote_system(self, management_address,
local_username=None, local_password=None,
remote_username=None, remote_password=None,
connection_type=None):
"""
Configures a remote system for remote replication.
... | [
"def",
"create_remote_system",
"(",
"self",
",",
"management_address",
",",
"local_username",
"=",
"None",
",",
"local_password",
"=",
"None",
",",
"remote_username",
"=",
"None",
",",
"remote_password",
"=",
"None",
",",
"connection_type",
"=",
"None",
")",
":"... | Configures a remote system for remote replication.
:param management_address: the management IP address of the remote
system.
:param local_username: administrative username of local system.
:param local_password: administrative password of local system.
:param remote_usernam... | [
"Configures",
"a",
"remote",
"system",
"for",
"remote",
"replication",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L512-L534 | train |
emc-openstack/storops | storops/unity/resource/system.py | UnitySystem.create_replication_interface | def create_replication_interface(self, sp, ip_port, ip_address,
netmask=None, v6_prefix_length=None,
gateway=None, vlan_id=None):
"""
Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage pro... | python | def create_replication_interface(self, sp, ip_port, ip_address,
netmask=None, v6_prefix_length=None,
gateway=None, vlan_id=None):
"""
Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage pro... | [
"def",
"create_replication_interface",
"(",
"self",
",",
"sp",
",",
"ip_port",
",",
"ip_address",
",",
"netmask",
"=",
"None",
",",
"v6_prefix_length",
"=",
"None",
",",
"gateway",
"=",
"None",
",",
"vlan_id",
"=",
"None",
")",
":",
"return",
"UnityReplicati... | Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage processor on which
the replication interface is running.
:param ip_port: `UnityIpPort` object. Physical port or link aggregation
on the storage processor on which the interface is running.
... | [
"Creates",
"a",
"replication",
"interface",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L544-L567 | train |
rstoneback/pysat | demo/cosmic_and_ivm_demo.py | geo2mag | def geo2mag(incoord):
"""geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one po... | python | def geo2mag(incoord):
"""geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one po... | [
"def",
"geo2mag",
"(",
"incoord",
")",
":",
"from",
"numpy",
"import",
"pi",
",",
"cos",
",",
"sin",
",",
"arctan2",
",",
"sqrt",
",",
"dot",
"# SOME 'constants' for location of northern mag pole",
"lat",
"=",
"80.08",
"#79.3",
"lon",
"=",
"-",
"72.211",
"+"... | geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one point it is [[glat,glon]]).
... | [
"geographic",
"coordinate",
"to",
"magnetic",
"coordinate",
"(",
"coarse",
")",
":"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/demo/cosmic_and_ivm_demo.py#L13-L104 | train |
emc-openstack/storops | storops/vnx/resource/snap.py | VNXSnap.restore | def restore(self, res_id, backup_snap=None):
"""
Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring.
"""
name = ... | python | def restore(self, res_id, backup_snap=None):
"""
Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring.
"""
name = ... | [
"def",
"restore",
"(",
"self",
",",
"res_id",
",",
"backup_snap",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_get_name",
"(",
")",
"out",
"=",
"self",
".",
"_cli",
".",
"restore_snap",
"(",
"name",
",",
"res_id",
",",
"backup_snap",
")",
"ex",... | Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring. | [
"Restores",
"a",
"snapshot",
".",
":",
"param",
"res_id",
":",
"the",
"LUN",
"number",
"of",
"primary",
"LUN",
"or",
"snapshot",
"mount",
"point",
"to",
"be",
"restored",
".",
":",
"param",
"backup_snap",
":",
"the",
"name",
"of",
"a",
"backup",
"snapsho... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/snap.py#L104-L115 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | list_files | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magne... | python | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magne... | [
"def",
"list_files",
"(",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"if",
"format_str",
"is",
"None",
"and",
"data_path",
"is",
"not",
"None",
":",
"file_base",
"=",
"'superma... | Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (default='')
sat_id : (string or NoneType)
... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"SuperMAG",
"data"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L62-L128 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | load | def load(fnames, tag='', sat_id=None):
""" Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (d... | python | def load(fnames, tag='', sat_id=None):
""" Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (d... | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
")",
":",
"# Ensure that there are files to load",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"return",
"pysat",
".",
"DataFrame",
"(",
"None",
")",
",",
"pysat",
".... | Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (default='')
sat_id : (str or NoneType)
... | [
"Load",
"the",
"SuperMAG",
"files"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L131-L195 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | load_csv_data | def load_csv_data(fname, tag):
"""Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurement... | python | def load_csv_data(fname, tag):
"""Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurement... | [
"def",
"load_csv_data",
"(",
"fname",
",",
"tag",
")",
":",
"import",
"re",
"if",
"tag",
"==",
"\"stations\"",
":",
"# Because there may be multiple operators, the default pandas reader",
"# cannot be used.",
"ddict",
"=",
"dict",
"(",
")",
"dkeys",
"=",
"list",
"("... | Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements).
Returns
--------
data... | [
"Load",
"data",
"from",
"a",
"comma",
"separated",
"SuperMAG",
"file"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L197-L259 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | load_ascii_data | def load_ascii_data(fname, tag):
"""Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer m... | python | def load_ascii_data(fname, tag):
"""Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer m... | [
"def",
"load_ascii_data",
"(",
"fname",
",",
"tag",
")",
":",
"import",
"re",
"ndata",
"=",
"{",
"\"indices\"",
":",
"2",
",",
"\"\"",
":",
"4",
",",
"\"all\"",
":",
"4",
",",
"\"stations\"",
":",
"8",
"}",
"dkeys",
"=",
"{",
"'stations'",
":",
"li... | Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements).
Returns
--------
... | [
"Load",
"data",
"from",
"a",
"self",
"-",
"documenting",
"ASCII",
"SuperMAG",
"file"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L261-L414 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | update_smag_metadata | def update_smag_metadata(col_name):
"""Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data
"""
smag_units = {'IAGA':'non... | python | def update_smag_metadata(col_name):
"""Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data
"""
smag_units = {'IAGA':'non... | [
"def",
"update_smag_metadata",
"(",
"col_name",
")",
":",
"smag_units",
"=",
"{",
"'IAGA'",
":",
"'none'",
",",
"'N'",
":",
"'nT'",
",",
"'E'",
":",
"'nT'",
",",
"'Z'",
":",
"'nT'",
",",
"'MLT'",
":",
"'hours'",
",",
"'MLAT'",
":",
"'degrees'",
",",
... | Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data | [
"Update",
"SuperMAG",
"metadata"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L416-L483 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | format_baseline_list | def format_baseline_list(baseline_list):
"""Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
--... | python | def format_baseline_list(baseline_list):
"""Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
--... | [
"def",
"format_baseline_list",
"(",
"baseline_list",
")",
":",
"uniq_base",
"=",
"dict",
"(",
")",
"uniq_delta",
"=",
"dict",
"(",
")",
"for",
"bline",
"in",
"baseline_list",
":",
"bsplit",
"=",
"bline",
".",
"split",
"(",
")",
"bdate",
"=",
"\" \"",
"."... | Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
---------
base_string : (str)
Single s... | [
"Format",
"the",
"list",
"of",
"baseline",
"information",
"from",
"the",
"loaded",
"files",
"into",
"a",
"cohesive",
"informative",
"string"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L485-L544 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | download | def download(date_array, tag, sat_id='', data_path=None, user=None,
password=None, baseline='all', delta='none', options='all',
file_fmt='ascii'):
"""Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : stri... | python | def download(date_array, tag, sat_id='', data_path=None, user=None,
password=None, baseline='all', delta='none', options='all',
file_fmt='ascii'):
"""Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : stri... | [
"def",
"download",
"(",
"date_array",
",",
"tag",
",",
"sat_id",
"=",
"''",
",",
"data_path",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"baseline",
"=",
"'all'",
",",
"delta",
"=",
"'none'",
",",
"options",
"=",
"'all'... | Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : string
String denoting the type of file to load, accepted values are 'indices',
'all', 'stations', and '' (for only magnetometer data)
sat_id : string
Not u... | [
"Routine",
"to",
"download",
"SuperMAG",
"data"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L551-L767 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | append_data | def append_data(file_strings, file_fmt, tag):
""" Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String ... | python | def append_data(file_strings, file_fmt, tag):
""" Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String ... | [
"def",
"append_data",
"(",
"file_strings",
",",
"file_fmt",
",",
"tag",
")",
":",
"# Determine the right appending routine for the file type",
"if",
"file_fmt",
".",
"lower",
"(",
")",
"==",
"\"csv\"",
":",
"return",
"append_csv_data",
"(",
"file_strings",
")",
"els... | Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String denoting the type of file to load, accepted values are... | [
"Load",
"the",
"SuperMAG",
"files"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L769-L792 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | append_ascii_data | def append_ascii_data(file_strings, tag):
""" Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, acce... | python | def append_ascii_data(file_strings, tag):
""" Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, acce... | [
"def",
"append_ascii_data",
"(",
"file_strings",
",",
"tag",
")",
":",
"import",
"re",
"# Start with data from the first list element",
"out_lines",
"=",
"file_strings",
"[",
"0",
"]",
".",
"split",
"(",
"'\\n'",
")",
"iparam",
"=",
"-",
"1",
"# Index for the para... | Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, accepted values are 'indices',
'all', 'station... | [
"Append",
"data",
"from",
"multiple",
"files",
"for",
"the",
"same",
"time",
"period"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L794-L902 | train |
rstoneback/pysat | pysat/instruments/supermag_magnetometer.py | append_csv_data | def append_csv_data(file_strings):
""" Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all d... | python | def append_csv_data(file_strings):
""" Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all d... | [
"def",
"append_csv_data",
"(",
"file_strings",
")",
":",
"# Start with data from the first list element",
"out_lines",
"=",
"list",
"(",
")",
"head_line",
"=",
"None",
"# Cycle through the lists of file strings, creating a list of line strings",
"for",
"fstrings",
"in",
"file_s... | Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all data, ready for output to a file | [
"Append",
"data",
"from",
"multiple",
"csv",
"files",
"for",
"the",
"same",
"time",
"period"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L904-L946 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | init | def init(self):
"""
Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, add... | python | def init(self):
"""
Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, add... | [
"def",
"init",
"(",
"self",
")",
":",
"self",
".",
"custom",
".",
"add",
"(",
"add_quasi_dipole_coordinates",
",",
"'modify'",
")",
"self",
".",
"custom",
".",
"add",
"(",
"add_aacgm_coordinates",
",",
"'modify'",
")",
"self",
".",
"custom",
".",
"add",
... | Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, adds ionospheric parameters fro... | [
"Adds",
"custom",
"calculations",
"to",
"orbit",
"simulation",
".",
"This",
"routine",
"is",
"run",
"once",
"and",
"only",
"once",
"upon",
"instantiation",
".",
"Adds",
"quasi",
"-",
"dipole",
"coordiantes",
"velocity",
"calculation",
"in",
"ECEF",
"coords",
"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L35-L67 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | load | def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0.,
TLE1=None, TLE2=None):
"""
Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directl... | python | def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0.,
TLE1=None, TLE2=None):
"""
Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directl... | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"obs_long",
"=",
"0.",
",",
"obs_lat",
"=",
"0.",
",",
"obs_alt",
"=",
"0.",
",",
"TLE1",
"=",
"None",
",",
"TLE2",
"=",
"None",
")",
":",
"import",
"sgp4",
... | Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directly called by pysat and not the user.
Parameters
----------
fnames : list-like collection
File name that contains date in its name. ... | [
"Returns",
"data",
"and",
"metadata",
"in",
"the",
"format",
"required",
"by",
"pysat",
".",
"Finds",
"position",
"of",
"satellite",
"in",
"both",
"ECI",
"and",
"ECEF",
"co",
"-",
"ordinates",
".",
"Routine",
"is",
"directly",
"called",
"by",
"pysat",
"and... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L69-L205 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | list_files | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Produce a fake list of files spanning a year"""
index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1))
# file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo... | python | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Produce a fake list of files spanning a year"""
index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1))
# file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo... | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"index",
"=",
"pds",
".",
"date_range",
"(",
"pysat",
".",
"datetime",
"(",
"2017",
",",
"12",
",",
"... | Produce a fake list of files spanning a year | [
"Produce",
"a",
"fake",
"list",
"of",
"files",
"spanning",
"a",
"year"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L255-L261 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_sc_attitude_vectors | def add_sc_attitude_vectors(inst):
"""
Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
... | python | def add_sc_attitude_vectors(inst):
"""
Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
... | [
"def",
"add_sc_attitude_vectors",
"(",
"inst",
")",
":",
"import",
"pysatMagVect",
"# ram pointing is along velocity vector",
"inst",
"[",
"'sc_xhat_ecef_x'",
"]",
",",
"inst",
"[",
"'sc_xhat_ecef_y'",
"]",
",",
"inst",
"[",
"'sc_xhat_ecef_z'",
"]",
"=",
"pysatMagVect... | Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
Notes
-----
Expects velocity and positi... | [
"Add",
"attitude",
"vectors",
"for",
"spacecraft",
"assuming",
"ram",
"pointing",
".",
"Presumes",
"spacecraft",
"is",
"pointed",
"along",
"the",
"velocity",
"vector",
"(",
"x",
")",
"z",
"is",
"generally",
"nadir",
"pointing",
"(",
"positive",
"towards",
"Ear... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L269-L361 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | calculate_ecef_velocity | def calculate_ecef_velocity(inst):
"""
Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should b... | python | def calculate_ecef_velocity(inst):
"""
Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should b... | [
"def",
"calculate_ecef_velocity",
"(",
"inst",
")",
":",
"x",
"=",
"inst",
"[",
"'position_ecef_x'",
"]",
"vel_x",
"=",
"(",
"x",
".",
"values",
"[",
"2",
":",
"]",
"-",
"x",
".",
"values",
"[",
"0",
":",
"-",
"2",
"]",
")",
"/",
"2.",
"y",
"="... | Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should be run using pysat data padding feature
to c... | [
"Calculates",
"spacecraft",
"velocity",
"in",
"ECEF",
"frame",
".",
"Presumes",
"that",
"the",
"spacecraft",
"velocity",
"in",
"ECEF",
"is",
"in",
"the",
"input",
"instrument",
"object",
"as",
"position_ecef_",
"*",
".",
"Uses",
"a",
"symmetric",
"difference",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L363-L405 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_quasi_dipole_coordinates | def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomag... | python | def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomag... | [
"def",
"add_quasi_dipole_coordinates",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"apexpy",
"ap",
"=",
"apexpy",
".",
"Apex",
"(",
"date",
"=",
"inst",
".",
"date",... | Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomagnetic field to calculate the latitude, longitude, and local time
of the spacecraft with respect to the geomagnetic field.
This system is ... | [
"Uses",
"Apexpy",
"package",
"to",
"add",
"quasi",
"-",
"dipole",
"coordinates",
"to",
"instrument",
"object",
".",
"The",
"Quasi",
"-",
"Dipole",
"coordinate",
"system",
"includes",
"both",
"the",
"tilt",
"and",
"offset",
"of",
"the",
"geomagnetic",
"field",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L407-L462 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_aacgm_coordinates | def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitud... | python | def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitud... | [
"def",
"add_aacgm_coordinates",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"aacgmv2",
"aalat",
"=",
"[",
"]",
"aalon",
"=",
"[",
"]",
"mlt",
"=",
"[",
"]",
"for... | Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitude, longitude, and local time
of the spacecraft with respect to the geomagnetic field.
Example
-------
# function added... | [
"Uses",
"AACGMV2",
"package",
"to",
"add",
"AACGM",
"coordinates",
"to",
"instrument",
"object",
".",
"The",
"Altitude",
"Adjusted",
"Corrected",
"Geomagnetic",
"Coordinates",
"library",
"is",
"used",
"to",
"calculate",
"the",
"latitude",
"longitude",
"and",
"loca... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L464-L516 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_iri_thermal_plasma | def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
... | python | def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
... | [
"def",
"add_iri_thermal_plasma",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"iri_params",
"=",
"[",
"]",... | Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_i... | [
"Uses",
"IRI",
"(",
"International",
"Reference",
"Ionosphere",
")",
"model",
"to",
"simulate",
"an",
"ionosphere",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"IRI",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L519-L582 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_hwm_winds_and_ecef_vectors | def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
m... | python | def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
m... | [
"def",
"add_hwm_winds_and_ecef_vectors",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"import",
"pysatMagVect",
"hwm_params",
"=",
"[",
"]",
"for",
"time",
",",... | Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_hwm_winds... | [
"Uses",
"HWM",
"(",
"Horizontal",
"Wind",
"Model",
")",
"model",
"to",
"obtain",
"neutral",
"wind",
"details",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"HWM",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L585-L681 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_igrf | def add_igrf(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
... | python | def add_igrf(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
... | [
"def",
"add_igrf",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"import",
"pysatMagVect",
"igrf_params",
"... | Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
ins... | [
"Uses",
"International",
"Geomagnetic",
"Reference",
"Field",
"(",
"IGRF",
")",
"model",
"to",
"obtain",
"geomagnetic",
"field",
"values",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"IGRF",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"t... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L684-L765 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | add_msis | def add_msis(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# f... | python | def add_msis(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# f... | [
"def",
"add_msis",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"msis_params",
"=",
"[",
"]",
"# print '... | Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_msis, 'modify', glat_label='cus... | [
"Uses",
"MSIS",
"model",
"to",
"obtain",
"thermospheric",
"values",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"MSIS",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".",
"Example",
"-------",
"#",
"function",
"adde... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L768-L843 | train |
rstoneback/pysat | pysat/instruments/pysat_sgp4.py | project_ecef_vector_onto_sc | def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label,
new_x_label, new_y_label, new_z_label,
meta=None):
"""Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
... | python | def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label,
new_x_label, new_y_label, new_z_label,
meta=None):
"""Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
... | [
"def",
"project_ecef_vector_onto_sc",
"(",
"inst",
",",
"x_label",
",",
"y_label",
",",
"z_label",
",",
"new_x_label",
",",
"new_y_label",
",",
"new_z_label",
",",
"meta",
"=",
"None",
")",
":",
"import",
"pysatMagVect",
"x",
",",
"y",
",",
"z",
"=",
"pysa... | Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
Parameters
----------
x_label : string
Label used to get ECEF-X component of vector to be projected
y_label : string
Label used to get ECEF-Y component of... | [
"Express",
"input",
"vector",
"using",
"s",
"/",
"c",
"attitude",
"directions",
"x",
"-",
"ram",
"pointing",
"y",
"-",
"generally",
"southward",
"z",
"-",
"generally",
"nadir",
"Parameters",
"----------",
"x_label",
":",
"string",
"Label",
"used",
"to",
"get... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L845-L887 | train |
rstoneback/pysat | pysat/ssnl/plot.py | scatterplot | def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None):
"""Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : s... | python | def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None):
"""Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : s... | [
"def",
"scatterplot",
"(",
"inst",
",",
"labelx",
",",
"labely",
",",
"data_label",
",",
"datalim",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
")",
":",
"# interactive plotting off",
"plt",
".",
"ioff",
"(",
")",
"# create figures for plotting",
"fi... | Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : string, array-like of strings
data product(s) to be scatter plotted
datalim : ... | [
"Return",
"scatterplot",
"of",
"data_label",
"(",
"s",
")",
"as",
"functions",
"of",
"labelx",
"y",
"over",
"a",
"season",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/plot.py#L9-L92 | train |
emc-openstack/storops | storops/__init__.py | enable_log | def enable_log(level=logging.DEBUG):
"""Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG
"""
logger = logging.getLogger(__name__)
logger.setLevel(level)
if not logger.handlers:
logger.info('enabling logging to console... | python | def enable_log(level=logging.DEBUG):
"""Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG
"""
logger = logging.getLogger(__name__)
logger.setLevel(level)
if not logger.handlers:
logger.info('enabling logging to console... | [
"def",
"enable_log",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"setLevel",
"(",
"level",
")",
"if",
"not",
"logger",
".",
"handlers",
":",
"logger",
".",
"info... | Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG | [
"Enable",
"console",
"logging",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/__init__.py#L30-L40 | train |
rstoneback/pysat | pysat/instruments/cosmic2013_gps.py | list_files | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary d... | python | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary d... | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"import",
"sys",
"#if tag == 'ionprf':",
"# # from_os constructor currently doesn't work because of the variable ",
"#... | Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary data type (ascii) is loaded.
(default=None)
sat_id : (string or None... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L57-L122 | train |
rstoneback/pysat | pysat/instruments/cosmic2013_gps.py | load_files | def load_files(files, tag=None, sat_id=None, altitude_bin=None):
'''Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file.
'''
output = [None]*len(files)
drop_idx = []
for (i,file) in enumerate(files):
try:
#data = net... | python | def load_files(files, tag=None, sat_id=None, altitude_bin=None):
'''Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file.
'''
output = [None]*len(files)
drop_idx = []
for (i,file) in enumerate(files):
try:
#data = net... | [
"def",
"load_files",
"(",
"files",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"altitude_bin",
"=",
"None",
")",
":",
"output",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"files",
")",
"drop_idx",
"=",
"[",
"]",
"for",
"(",
"i",
",",
... | Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file. | [
"Loads",
"a",
"list",
"of",
"COSMIC",
"data",
"files",
"supplied",
"by",
"user",
".",
"Returns",
"a",
"list",
"of",
"dicts",
"a",
"dict",
"for",
"each",
"file",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L172-L224 | train |
emc-openstack/storops | storops/vnx/calculator.py | round_60 | def round_60(value):
""" round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment... | python | def round_60(value):
""" round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment... | [
"def",
"round_60",
"(",
"value",
")",
":",
"t",
"=",
"60",
"if",
"value",
"is",
"not",
"None",
":",
"r",
"=",
"value",
"%",
"t",
"if",
"r",
">",
"t",
"/",
"2",
":",
"ret",
"=",
"value",
"+",
"(",
"t",
"-",
"r",
")",
"else",
":",
"ret",
"=... | round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment on
VNX is always 1 minut... | [
"round",
"the",
"number",
"to",
"the",
"multiple",
"of",
"60"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L85-L108 | train |
emc-openstack/storops | storops/vnx/calculator.py | utilization | def utilization(prev, curr, counters):
""" calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ti... | python | def utilization(prev, curr, counters):
""" calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ti... | [
"def",
"utilization",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"busy_prop",
",",
"idle_prop",
"=",
"counters",
"pb",
"=",
"getattr",
"(",
"prev",
",",
"busy_prop",
")",
"pi",
"=",
"getattr",
"(",
"prev",
",",
"idle_prop",
")",
"cb",
"=",
... | calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ticks and idle ticks
:return: value, NaN if i... | [
"calculate",
"the",
"utilization"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L138-L161 | train |
emc-openstack/storops | storops/vnx/calculator.py | delta_ps | def delta_ps(prev, curr, counters):
""" calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid.
"""
co... | python | def delta_ps(prev, curr, counters):
""" calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid.
"""
co... | [
"def",
"delta_ps",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"counter",
"=",
"get_counter",
"(",
"counters",
")",
"pv",
"=",
"getattr",
"(",
"prev",
",",
"counter",
")",
"cv",
"=",
"getattr",
"(",
"curr",
",",
"counter",
")",
"return",
"mi... | calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid. | [
"calculate",
"the",
"delta",
"per",
"second",
"of",
"one",
"counter"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L170-L183 | train |
emc-openstack/storops | storops/vnx/calculator.py | io_size_kb | def io_size_kb(prev, curr, counters):
""" calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value,... | python | def io_size_kb(prev, curr, counters):
""" calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value,... | [
"def",
"io_size_kb",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"bw_stats",
",",
"io_stats",
"=",
"counters",
"size_mb",
"=",
"div",
"(",
"getattr",
"(",
"curr",
",",
"bw_stats",
")",
",",
"getattr",
"(",
"curr",
",",
"io_stats",
")",
")",
... | calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value, NaN if invalid | [
"calculate",
"the",
"io",
"size",
"based",
"on",
"bandwidth",
"and",
"throughput"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L187-L198 | train |
rstoneback/pysat | pysat/instruments/champ_star.py | list_files | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary dat... | python | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary dat... | [
"def",
"list_files",
"(",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"if",
"format_str",
"is",
"None",
"and",
"tag",
"is",
"not",
"None",
":",
"if",
"tag",
"==",
"''",
"or"... | Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary data type (ascii) is loaded.
(default='')
sat_id : (string or NoneTy... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L39-L75 | train |
rstoneback/pysat | pysat/instruments/champ_star.py | load | def load(fnames, tag=None, sat_id=None):
"""Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-----... | python | def load(fnames, tag=None, sat_id=None):
"""Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-----... | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
")",
":",
"import",
"re",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"return",
"pysat",
".",
"DataFrame",
"(",
"None",
")",
",",
"pysat",
".",
"Meta",
"(",
... | Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
---------
data : (pandas.DataFrame)
Objec... | [
"Load",
"CHAMP",
"STAR",
"files"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L78-L193 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._assign_funcs | def _assign_funcs(self, by_name=False, inst_module=None):
"""Assign all external science instrument methods to Instrument object.
"""
import importlib
# set defaults
self._list_rtn = self._pass_func
self._load_rtn = self._pass_func
self._default_rtn = self... | python | def _assign_funcs(self, by_name=False, inst_module=None):
"""Assign all external science instrument methods to Instrument object.
"""
import importlib
# set defaults
self._list_rtn = self._pass_func
self._load_rtn = self._pass_func
self._default_rtn = self... | [
"def",
"_assign_funcs",
"(",
"self",
",",
"by_name",
"=",
"False",
",",
"inst_module",
"=",
"None",
")",
":",
"import",
"importlib",
"# set defaults",
"self",
".",
"_list_rtn",
"=",
"self",
".",
"_pass_func",
"self",
".",
"_load_rtn",
"=",
"self",
".",
"_p... | Assign all external science instrument methods to Instrument object. | [
"Assign",
"all",
"external",
"science",
"instrument",
"methods",
"to",
"Instrument",
"object",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L452-L515 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._load_data | def _load_data(self, date=None, fid=None):
"""
Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
... | python | def _load_data(self, date=None, fid=None):
"""
Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
... | [
"def",
"_load_data",
"(",
"self",
",",
"date",
"=",
"None",
",",
"fid",
"=",
"None",
")",
":",
"if",
"fid",
"is",
"not",
"None",
":",
"# get filename based off of index value",
"fname",
"=",
"self",
".",
"files",
"[",
"fid",
":",
"fid",
"+",
"1",
"]",
... | Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
Returns
--------
data : (pds.DataFrame)
... | [
"Load",
"data",
"for",
"an",
"instrument",
"on",
"given",
"date",
"or",
"fid",
"dependng",
"upon",
"input",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L592-L664 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._load_next | def _load_next(self):
"""Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag.
... | python | def _load_next(self):
"""Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag.
... | [
"def",
"_load_next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_load_by_date",
":",
"next_date",
"=",
"self",
".",
"date",
"+",
"pds",
".",
"DateOffset",
"(",
"days",
"=",
"1",
")",
"return",
"self",
".",
"_load_data",
"(",
"date",
"=",
"next_date",
... | Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag. | [
"Load",
"the",
"next",
"days",
"data",
"(",
"or",
"file",
")",
"without",
"incrementing",
"the",
"date",
".",
"Repeated",
"calls",
"will",
"not",
"advance",
"date",
"/",
"file",
"and",
"will",
"produce",
"the",
"same",
"data",
"Uses",
"info",
"stored",
"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L666-L678 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._load_prev | def _load_prev(self):
"""Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. ... | python | def _load_prev(self):
"""Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. ... | [
"def",
"_load_prev",
"(",
"self",
")",
":",
"if",
"self",
".",
"_load_by_date",
":",
"prev_date",
"=",
"self",
".",
"date",
"-",
"pds",
".",
"DateOffset",
"(",
"days",
"=",
"1",
")",
"return",
"self",
".",
"_load_data",
"(",
"date",
"=",
"prev_date",
... | Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. | [
"Load",
"the",
"next",
"days",
"data",
"(",
"or",
"file",
")",
"without",
"decrementing",
"the",
"date",
".",
"Repeated",
"calls",
"will",
"not",
"decrement",
"date",
"/",
"file",
"and",
"will",
"produce",
"the",
"same",
"data",
"Uses",
"info",
"stored",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L680-L694 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument.load | def load(self, yr=None, doy=None, date=None, fname=None, fid=None,
verifyPad=False):
"""Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : date... | python | def load(self, yr=None, doy=None, date=None, fname=None, fid=None,
verifyPad=False):
"""Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : date... | [
"def",
"load",
"(",
"self",
",",
"yr",
"=",
"None",
",",
"doy",
"=",
"None",
",",
"date",
"=",
"None",
",",
"fname",
"=",
"None",
",",
"fid",
"=",
"None",
",",
"verifyPad",
"=",
"False",
")",
":",
"# set options used by loading routine based upon user inpu... | Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : datetime object
date to load
fname : 'string'
filename to be loaded
verify... | [
"Load",
"instrument",
"data",
"into",
"Instrument",
"object",
".",
"data",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L709-L916 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument.download | def download(self, start, stop, freq='D', user=None, password=None,
**kwargs):
"""Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
... | python | def download(self, start, stop, freq='D', user=None, password=None,
**kwargs):
"""Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
... | [
"def",
"download",
"(",
"self",
",",
"start",
",",
"stop",
",",
"freq",
"=",
"'D'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"errno",
"# make sure directories are there, otherwise create them",
"try... | Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
stop date to download data
freq : string
Stepsize between dates for season, ... | [
"Download",
"data",
"for",
"given",
"Instrument",
"object",
"from",
"start",
"to",
"stop",
".",
"Parameters",
"----------",
"start",
":",
"pandas",
".",
"datetime",
"start",
"date",
"to",
"download",
"data",
"stop",
":",
"pandas",
".",
"datetime",
"stop",
"d... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L918-L980 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument.next | def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first... | python | def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first... | [
"def",
"next",
"(",
"self",
",",
"verifyPad",
"=",
"False",
")",
":",
"if",
"self",
".",
"_iter_type",
"==",
"'date'",
":",
"if",
"self",
".",
"date",
"is",
"not",
"None",
":",
"idx",
",",
"=",
"np",
".",
"where",
"(",
"self",
".",
"_iter_list",
... | Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first day(default)/file will be loaded. | [
"Manually",
"iterate",
"through",
"the",
"data",
"loaded",
"in",
"Instrument",
"object",
".",
"Bounds",
"of",
"iteration",
"and",
"iteration",
"type",
"(",
"day",
"/",
"file",
")",
"are",
"set",
"by",
"bounds",
"attribute",
".",
"Note",
"----",
"If",
"ther... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1132-L1168 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._get_var_type_code | def _get_var_type_code(self, coltype):
'''Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given ... | python | def _get_var_type_code(self, coltype):
'''Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given ... | [
"def",
"_get_var_type_code",
"(",
"self",
",",
"coltype",
")",
":",
"if",
"type",
"(",
"coltype",
")",
"is",
"np",
".",
"dtype",
":",
"var_type",
"=",
"coltype",
".",
"kind",
"+",
"str",
"(",
"coltype",
".",
"itemsize",
")",
"return",
"var_type",
"else... | Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given type | [
"Determines",
"the",
"two",
"-",
"character",
"type",
"code",
"for",
"a",
"given",
"variable",
"type"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1208-L1248 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._get_data_info | def _get_data_info(self, data, file_format):
"""Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
... | python | def _get_data_info(self, data, file_format):
"""Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
... | [
"def",
"_get_data_info",
"(",
"self",
",",
"data",
",",
"file_format",
")",
":",
"# get type of data",
"data_type",
"=",
"data",
".",
"dtype",
"# check if older file_format",
"# if file_format[:7] == 'NETCDF3':",
"if",
"file_format",
"!=",
"'NETCDF4'",
":",
"old_format"... | Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
-------
data_flag, datetime_flag, old_for... | [
"Support",
"file",
"writing",
"by",
"determiniing",
"data",
"type",
"and",
"other",
"options"
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1252-L1303 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument._filter_netcdf4_metadata | def _filter_netcdf4_metadata(self, mdata_dict, coltype, remove=False):
"""Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dic... | python | def _filter_netcdf4_metadata(self, mdata_dict, coltype, remove=False):
"""Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dic... | [
"def",
"_filter_netcdf4_metadata",
"(",
"self",
",",
"mdata_dict",
",",
"coltype",
",",
"remove",
"=",
"False",
")",
":",
"# Coerce boolean types to integers",
"for",
"key",
"in",
"mdata_dict",
":",
"if",
"type",
"(",
"mdata_dict",
"[",
"key",
"]",
")",
"==",
... | Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dict
Dictionary equivalent to Meta object info
coltype : type
... | [
"Filter",
"metadata",
"properties",
"to",
"be",
"consistent",
"with",
"netCDF4",
".",
"Notes",
"-----",
"removed",
"forced",
"to",
"True",
"if",
"coltype",
"consistent",
"with",
"a",
"string",
"type",
"Parameters",
"----------",
"mdata_dict",
":",
"dict",
"Dicti... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1305-L1346 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument.generic_meta_translator | def generic_meta_translator(self, meta_to_translate):
'''Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dic... | python | def generic_meta_translator(self, meta_to_translate):
'''Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dic... | [
"def",
"generic_meta_translator",
"(",
"self",
",",
"meta_to_translate",
")",
":",
"export_dict",
"=",
"{",
"}",
"if",
"self",
".",
"_meta_translation_table",
"is",
"not",
"None",
":",
"# Create a translation table for the actual values of the meta labels.",
"# The instrume... | Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dict
A dictionary of the metadata for each variable of a... | [
"Translates",
"the",
"metadate",
"contained",
"in",
"an",
"object",
"into",
"a",
"dictionary",
"suitable",
"for",
"export",
"."
] | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1348-L1406 | train |
rstoneback/pysat | pysat/_instrument.py | Instrument.to_netcdf4 | def to_netcdf4(self, fname=None, base_instrument=None, epoch_name='Epoch',
zlib=False, complevel=4, shuffle=True):
"""Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_i... | python | def to_netcdf4(self, fname=None, base_instrument=None, epoch_name='Epoch',
zlib=False, complevel=4, shuffle=True):
"""Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_i... | [
"def",
"to_netcdf4",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"base_instrument",
"=",
"None",
",",
"epoch_name",
"=",
"'Epoch'",
",",
"zlib",
"=",
"False",
",",
"complevel",
"=",
"4",
",",
"shuffle",
"=",
"True",
")",
":",
"import",
"netCDF4",
"imp... | Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_instrument : pysat.Instrument
used as a comparison, only attributes that are present with
self and not on base_instrument ... | [
"Stores",
"loaded",
"data",
"into",
"a",
"netCDF4",
"file",
".",
"Parameters",
"----------",
"fname",
":",
"string",
"full",
"path",
"to",
"save",
"instrument",
"object",
"to",
"base_instrument",
":",
"pysat",
".",
"Instrument",
"used",
"as",
"a",
"comparison"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1409-L1823 | train |
emc-openstack/storops | storops/lib/converter.py | to_alu_hlu_map | def to_alu_hlu_map(input_str):
"""Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands... | python | def to_alu_hlu_map(input_str):
"""Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands... | [
"def",
"to_alu_hlu_map",
"(",
"input_str",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"input_str",
"is",
"not",
"None",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\s*(\\d+)'",
")",
"for",
"line",
"in",
"input_str",
".",
"split",
"(",
"'\\n'",
... | Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands for host LUN number
:param input_... | [
"Converter",
"for",
"alu",
"hlu",
"map"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L126-L158 | train |
emc-openstack/storops | storops/lib/converter.py | to_disk_indices | def to_disk_indices(value):
"""Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indic... | python | def to_disk_indices(value):
"""Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indic... | [
"def",
"to_disk_indices",
"(",
"value",
")",
":",
"ret",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'Bus\\s+(\\w+)\\s+Enclosure\\s+(\\w+)\\s+Disk\\s+(\\w+)'",
")",
"if",
"value",
"is",
"not",
"None",
":",
"for",
"line",
"in",
"value",
".",
"split"... | Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indices in list | [
"Convert",
"following",
"input",
"to",
"disk",
"indices"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L161-L190 | train |
emc-openstack/storops | storops/lib/converter.py | url_to_host | def url_to_host(url):
"""convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name
"""
regex_url = r"([a-z][a-z0-9+\-.]*://)?" + \
r"([a... | python | def url_to_host(url):
"""convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name
"""
regex_url = r"([a-z][a-z0-9+\-.]*://)?" + \
r"([a... | [
"def",
"url_to_host",
"(",
"url",
")",
":",
"regex_url",
"=",
"r\"([a-z][a-z0-9+\\-.]*://)?\"",
"+",
"r\"([a-z0-9\\-._~%!$&'()*+,;=]+@)?\"",
"+",
"r\"([a-z0-9\\-._~%]+\"",
"+",
"r\"|\\[[a-z0-9\\-._~%!$&'()*+,;=:]+\\])?\"",
"+",
"r\"(:(?P<port>[0-9]+))?\"",
"m",
"=",
"re",
"."... | convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name | [
"convert",
"a",
"url",
"to",
"a",
"host",
"(",
"ip",
"or",
"domain",
")"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L235-L254 | train |
emc-openstack/storops | storops/lib/converter.py | parse_host_address | def parse_host_address(addr):
"""
parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net m... | python | def parse_host_address(addr):
"""
parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net m... | [
"def",
"parse_host_address",
"(",
"addr",
")",
":",
"if",
"addr",
".",
"startswith",
"(",
"'['",
")",
"and",
"addr",
".",
"endswith",
"(",
"']'",
")",
":",
"addr",
"=",
"addr",
"[",
"1",
":",
"-",
"1",
"]",
"parts",
"=",
"addr",
".",
"split",
"("... | parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net mask code string if there is
:rtype: (s... | [
"parse",
"host",
"address",
"to",
"get",
"domain",
"name",
"or",
"ipv4",
"/",
"v6",
"address",
"cidr",
"prefix",
"and",
"net",
"mask",
"code",
"string",
"if",
"given",
"a",
"subnet",
"address"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L257-L286 | train |
emc-openstack/storops | storops/lib/converter.py | ipv4_prefix_to_mask | def ipv4_prefix_to_mask(prefix):
"""
ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str
"""
if prefix > 32 or prefix < 0:
raise ValueError("invalid cidr prefix for i... | python | def ipv4_prefix_to_mask(prefix):
"""
ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str
"""
if prefix > 32 or prefix < 0:
raise ValueError("invalid cidr prefix for i... | [
"def",
"ipv4_prefix_to_mask",
"(",
"prefix",
")",
":",
"if",
"prefix",
">",
"32",
"or",
"prefix",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"invalid cidr prefix for ipv4\"",
")",
"else",
":",
"mask",
"=",
"(",
"(",
"1",
"<<",
"32",
")",
"-",
"1",
")... | ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str | [
"ipv4",
"cidr",
"prefix",
"to",
"net",
"mask"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L289-L309 | train |
emc-openstack/storops | storops/lib/converter.py | ipv6_prefix_to_mask | def ipv6_prefix_to_mask(prefix):
"""
ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str
"""
if prefix > 128 or prefix < 0:
r... | python | def ipv6_prefix_to_mask(prefix):
"""
ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str
"""
if prefix > 128 or prefix < 0:
r... | [
"def",
"ipv6_prefix_to_mask",
"(",
"prefix",
")",
":",
"if",
"prefix",
">",
"128",
"or",
"prefix",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"invalid cidr prefix for ipv6\"",
")",
"else",
":",
"mask",
"=",
"(",
"(",
"1",
"<<",
"128",
")",
"-",
"1",
... | ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str | [
"ipv6",
"cidr",
"prefix",
"to",
"net",
"mask"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L312-L333 | train |
emc-openstack/storops | storops/unity/resource/lun.py | UnityLun.expand | def expand(self, new_size):
""" expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size
"""
ret = self.size_total
resp = self.modify(size=new_size)
resp.raise_if_err()
return ret | python | def expand(self, new_size):
""" expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size
"""
ret = self.size_total
resp = self.modify(size=new_size)
resp.raise_if_err()
return ret | [
"def",
"expand",
"(",
"self",
",",
"new_size",
")",
":",
"ret",
"=",
"self",
".",
"size_total",
"resp",
"=",
"self",
".",
"modify",
"(",
"size",
"=",
"new_size",
")",
"resp",
".",
"raise_if_err",
"(",
")",
"return",
"ret"
] | expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size | [
"expand",
"the",
"LUN",
"to",
"a",
"new",
"size"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L195-L204 | train |
emc-openstack/storops | storops/unity/resource/lun.py | UnityLun.update_hosts | def update_hosts(self, host_names):
"""Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN.
"""
if self.host_access:
curr_hosts = [access.host.name for access in self.host_access]
... | python | def update_hosts(self, host_names):
"""Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN.
"""
if self.host_access:
curr_hosts = [access.host.name for access in self.host_access]
... | [
"def",
"update_hosts",
"(",
"self",
",",
"host_names",
")",
":",
"if",
"self",
".",
"host_access",
":",
"curr_hosts",
"=",
"[",
"access",
".",
"host",
".",
"name",
"for",
"access",
"in",
"self",
".",
"host_access",
"]",
"else",
":",
"curr_hosts",
"=",
... | Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN. | [
"Primarily",
"for",
"puppet",
"-",
"unity",
"use",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L314-L340 | train |
emc-openstack/storops | storops/unity/resource/lun.py | UnityLun.replicate | def replicate(self, dst_lun_id, max_time_out_of_sync,
replication_name=None, replicate_existing_snaps=None,
remote_system=None):
"""
Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_ti... | python | def replicate(self, dst_lun_id, max_time_out_of_sync,
replication_name=None, replicate_existing_snaps=None,
remote_system=None):
"""
Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_ti... | [
"def",
"replicate",
"(",
"self",
",",
"dst_lun_id",
",",
"max_time_out_of_sync",
",",
"replication_name",
"=",
"None",
",",
"replicate_existing_snaps",
"=",
"None",
",",
"remote_system",
"=",
"None",
")",
":",
"return",
"UnityReplicationSession",
".",
"create",
"(... | Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_time_out_of_sync: maximum time to wait before syncing the
source and destination. Value `-1` means the automatic sync is not
performed. `0` means it is a sync repl... | [
"Creates",
"a",
"replication",
"session",
"with",
"a",
"existing",
"lun",
"as",
"destination",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L415-L437 | train |
emc-openstack/storops | storops/unity/resource/lun.py | UnityLun.replicate_with_dst_resource_provisioning | def replicate_with_dst_resource_provisioning(self, max_time_out_of_sync,
dst_pool_id,
dst_lun_name=None,
remote_system=None,
... | python | def replicate_with_dst_resource_provisioning(self, max_time_out_of_sync,
dst_pool_id,
dst_lun_name=None,
remote_system=None,
... | [
"def",
"replicate_with_dst_resource_provisioning",
"(",
"self",
",",
"max_time_out_of_sync",
",",
"dst_pool_id",
",",
"dst_lun_name",
"=",
"None",
",",
"remote_system",
"=",
"None",
",",
"replication_name",
"=",
"None",
",",
"dst_size",
"=",
"None",
",",
"dst_sp",
... | Creates a replication session with destination lun provisioning.
:param max_time_out_of_sync: maximum time to wait before syncing the
source and destination. Value `-1` means the automatic sync is not
performed. `0` means it is a sync replication.
:param dst_pool_id: id of pool ... | [
"Creates",
"a",
"replication",
"session",
"with",
"destination",
"lun",
"provisioning",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L439-L480 | train |
emc-openstack/storops | storops/unity/resource/port.py | UnityIpPort.get_physical_port | def get_physical_port(self):
"""Returns the link aggregation object or the ethernet port object."""
obj = None
if self.is_link_aggregation():
obj = UnityLinkAggregation.get(self._cli, self.get_id())
else:
obj = UnityEthernetPort.get(self._cli, self.get_id())
... | python | def get_physical_port(self):
"""Returns the link aggregation object or the ethernet port object."""
obj = None
if self.is_link_aggregation():
obj = UnityLinkAggregation.get(self._cli, self.get_id())
else:
obj = UnityEthernetPort.get(self._cli, self.get_id())
... | [
"def",
"get_physical_port",
"(",
"self",
")",
":",
"obj",
"=",
"None",
"if",
"self",
".",
"is_link_aggregation",
"(",
")",
":",
"obj",
"=",
"UnityLinkAggregation",
".",
"get",
"(",
"self",
".",
"_cli",
",",
"self",
".",
"get_id",
"(",
")",
")",
"else",... | Returns the link aggregation object or the ethernet port object. | [
"Returns",
"the",
"link",
"aggregation",
"object",
"or",
"the",
"ethernet",
"port",
"object",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/port.py#L51-L58 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityResourceConfig.to_embedded | def to_embedded(pool_id=None, is_thin_enabled=None,
is_deduplication_enabled=None, is_compression_enabled=None,
is_backup_only=None, size=None, tiering_policy=None,
request_id=None, src_id=None, name=None, default_sp=None,
replication_resou... | python | def to_embedded(pool_id=None, is_thin_enabled=None,
is_deduplication_enabled=None, is_compression_enabled=None,
is_backup_only=None, size=None, tiering_policy=None,
request_id=None, src_id=None, name=None, default_sp=None,
replication_resou... | [
"def",
"to_embedded",
"(",
"pool_id",
"=",
"None",
",",
"is_thin_enabled",
"=",
"None",
",",
"is_deduplication_enabled",
"=",
"None",
",",
"is_compression_enabled",
"=",
"None",
",",
"is_backup_only",
"=",
"None",
",",
"size",
"=",
"None",
",",
"tiering_policy",... | Constructs an embeded object of `UnityResourceConfig`.
:param pool_id: storage pool of the resource.
:param is_thin_enabled: is thin type or not.
:param is_deduplication_enabled: is deduplication enabled or not.
:param is_compression_enabled: is in-line compression (ILC) enabled or
... | [
"Constructs",
"an",
"embeded",
"object",
"of",
"UnityResourceConfig",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L56-L88 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.create | def create(cls, cli, src_resource_id, dst_resource_id,
max_time_out_of_sync, name=None, members=None,
auto_initiate=None, hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
replicate_existing_snaps=None, remote_system=None,
... | python | def create(cls, cli, src_resource_id, dst_resource_id,
max_time_out_of_sync, name=None, members=None,
auto_initiate=None, hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
replicate_existing_snaps=None, remote_system=None,
... | [
"def",
"create",
"(",
"cls",
",",
"cli",
",",
"src_resource_id",
",",
"dst_resource_id",
",",
"max_time_out_of_sync",
",",
"name",
"=",
"None",
",",
"members",
"=",
"None",
",",
"auto_initiate",
"=",
"None",
",",
"hourly_snap_replication_policy",
"=",
"None",
... | Creates a replication session.
:param cli: the rest cli.
:param src_resource_id: id of the replication source, could be
lun/fs/cg.
:param dst_resource_id: id of the replication destination.
:param max_time_out_of_sync: maximum time to wait before syncing the
sour... | [
"Creates",
"a",
"replication",
"session",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L94-L156 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.create_with_dst_resource_provisioning | def create_with_dst_resource_provisioning(
cls, cli, src_resource_id, dst_resource_config,
max_time_out_of_sync, name=None, remote_system=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None,
dst_resource_element... | python | def create_with_dst_resource_provisioning(
cls, cli, src_resource_id, dst_resource_config,
max_time_out_of_sync, name=None, remote_system=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None,
dst_resource_element... | [
"def",
"create_with_dst_resource_provisioning",
"(",
"cls",
",",
"cli",
",",
"src_resource_id",
",",
"dst_resource_config",
",",
"max_time_out_of_sync",
",",
"name",
"=",
"None",
",",
"remote_system",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb... | Create a replication session along with destination resource
provisioning.
:param cli: the rest cli.
:param src_resource_id: id of the replication source, could be
lun/fs/cg.
:param dst_resource_config: `UnityResourceConfig` object. The user
chosen config for des... | [
"Create",
"a",
"replication",
"session",
"along",
"with",
"destination",
"resource",
"provisioning",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L159-L236 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.modify | def modify(self, max_time_out_of_sync=None, name=None,
hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Modifies proper... | python | def modify(self, max_time_out_of_sync=None, name=None,
hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Modifies proper... | [
"def",
"modify",
"(",
"self",
",",
"max_time_out_of_sync",
"=",
"None",
",",
"name",
"=",
"None",
",",
"hourly_snap_replication_policy",
"=",
"None",
",",
"daily_snap_replication_policy",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb_interface",
... | Modifies properties of a replication session.
:param max_time_out_of_sync: same as the one in `create` method.
:param name: same as the one in `create` method.
:param hourly_snap_replication_policy: same as the one in `create`
method.
:param daily_snap_replication_policy: sa... | [
"Modifies",
"properties",
"of",
"a",
"replication",
"session",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L238-L268 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.resume | def resume(self, force_full_copy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as... | python | def resume(self, force_full_copy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as... | [
"def",
"resume",
"(",
"self",
",",
"force_full_copy",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb_interface",
"=",
"None",
",",
"dst_spa_interface",
"=",
"None",
",",
"dst_spb_interface",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
... | Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as Failed over, or Paused.
:param force_full_copy: needed when replication session goes out of
sync due to a fault.
True - replicate all data.
... | [
"Resumes",
"a",
"replication",
"session",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L270-L296 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.failover | def failover(self, sync=None, force=None):
"""
Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication ses... | python | def failover(self, sync=None, force=None):
"""
Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication ses... | [
"def",
"failover",
"(",
"self",
",",
"sync",
"=",
"None",
",",
"force",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
".",
"_cli",
".",
"make_body",
"(",
"sync",
"=",
"sync",
",",
"force",
"=",
"force",
")",
"resp",
"=",
"self",
".",
"action",
... | Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication session.
False - don't sync.
:param force: Tru... | [
"Fails",
"over",
"a",
"replication",
"session",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L319-L335 | train |
emc-openstack/storops | storops/unity/resource/replication_session.py | UnityReplicationSession.failback | def failback(self, force_full_copy=None):
"""
Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direct... | python | def failback(self, force_full_copy=None):
"""
Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direct... | [
"def",
"failback",
"(",
"self",
",",
"force_full_copy",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
".",
"_cli",
".",
"make_body",
"(",
"forceFullCopy",
"=",
"force_full_copy",
")",
"resp",
"=",
"self",
".",
"action",
"(",
"'failback'",
",",
"*",
"*"... | Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direction of
session.
:param force_full_copy: indic... | [
"Fails",
"back",
"a",
"replication",
"session",
"."
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L337-L354 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.