body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def all_subclasses(cls: Any) -> List[Any]:
'Returns all known (imported) subclasses of a class.'
classes = (cls.__subclasses__() + [g for s in cls.__subclasses__() for g in all_subclasses(s)])
return [subclass for subclass in classes if (not inspect.isabstract(subclass))] | 4,921,096,479,315,253,000 | Returns all known (imported) subclasses of a class. | rasa/shared/utils/common.py | all_subclasses | GCES-2021-1/rasa | python | def all_subclasses(cls: Any) -> List[Any]:
classes = (cls.__subclasses__() + [g for s in cls.__subclasses__() for g in all_subclasses(s)])
return [subclass for subclass in classes if (not inspect.isabstract(subclass))] |
def module_path_from_instance(inst: Any) -> Text:
"Return the module path of an instance's class."
return ((inst.__module__ + '.') + inst.__class__.__name__) | -4,999,740,613,213,153,000 | Return the module path of an instance's class. | rasa/shared/utils/common.py | module_path_from_instance | GCES-2021-1/rasa | python | def module_path_from_instance(inst: Any) -> Text:
return ((inst.__module__ + '.') + inst.__class__.__name__) |
def sort_list_of_dicts_by_first_key(dicts: List[Dict]) -> List[Dict]:
'Sorts a list of dictionaries by their first key.'
return sorted(dicts, key=(lambda d: list(d.keys())[0])) | 2,533,327,906,987,913,700 | Sorts a list of dictionaries by their first key. | rasa/shared/utils/common.py | sort_list_of_dicts_by_first_key | GCES-2021-1/rasa | python | def sort_list_of_dicts_by_first_key(dicts: List[Dict]) -> List[Dict]:
return sorted(dicts, key=(lambda d: list(d.keys())[0])) |
def lazy_property(function: Callable) -> Any:
'Allows to avoid recomputing a property over and over.\n\n The result gets stored in a local var. Computation of the property\n will happen once, on the first call of the property. All\n succeeding calls will use the value stored in the private property.'
a... | 5,812,940,276,335,911,000 | Allows to avoid recomputing a property over and over.
The result gets stored in a local var. Computation of the property
will happen once, on the first call of the property. All
succeeding calls will use the value stored in the private property. | rasa/shared/utils/common.py | lazy_property | GCES-2021-1/rasa | python | def lazy_property(function: Callable) -> Any:
'Allows to avoid recomputing a property over and over.\n\n The result gets stored in a local var. Computation of the property\n will happen once, on the first call of the property. All\n succeeding calls will use the value stored in the private property.'
a... |
def cached_method(f: Callable[(..., Any)]) -> Callable[(..., Any)]:
"Caches method calls based on the call's `args` and `kwargs`.\n\n Works for `async` and `sync` methods. Don't apply this to functions.\n\n Args:\n f: The decorated method whose return value should be cached.\n\n Returns:\n Th... | -4,378,592,147,679,460,400 | Caches method calls based on the call's `args` and `kwargs`.
Works for `async` and `sync` methods. Don't apply this to functions.
Args:
f: The decorated method whose return value should be cached.
Returns:
The return value which the method gives for the first call with the given
arguments. | rasa/shared/utils/common.py | cached_method | GCES-2021-1/rasa | python | def cached_method(f: Callable[(..., Any)]) -> Callable[(..., Any)]:
"Caches method calls based on the call's `args` and `kwargs`.\n\n Works for `async` and `sync` methods. Don't apply this to functions.\n\n Args:\n f: The decorated method whose return value should be cached.\n\n Returns:\n Th... |
def transform_collection_to_sentence(collection: Collection[Text]) -> Text:
"Transforms e.g. a list like ['A', 'B', 'C'] into a sentence 'A, B and C'."
x = list(collection)
if (len(x) >= 2):
return ((', '.join(map(str, x[:(- 1)])) + ' and ') + x[(- 1)])
return ''.join(collection) | -8,276,903,017,728,746,000 | Transforms e.g. a list like ['A', 'B', 'C'] into a sentence 'A, B and C'. | rasa/shared/utils/common.py | transform_collection_to_sentence | GCES-2021-1/rasa | python | def transform_collection_to_sentence(collection: Collection[Text]) -> Text:
x = list(collection)
if (len(x) >= 2):
return ((', '.join(map(str, x[:(- 1)])) + ' and ') + x[(- 1)])
return .join(collection) |
def minimal_kwargs(kwargs: Dict[(Text, Any)], func: Callable, excluded_keys: Optional[List]=None) -> Dict[(Text, Any)]:
'Returns only the kwargs which are required by a function. Keys, contained in\n the exception list, are not included.\n\n Args:\n kwargs: All available kwargs.\n func: The func... | -4,158,038,673,499,428,000 | Returns only the kwargs which are required by a function. Keys, contained in
the exception list, are not included.
Args:
kwargs: All available kwargs.
func: The function which should be called.
excluded_keys: Keys to exclude from the result.
Returns:
Subset of kwargs which are accepted by `func`. | rasa/shared/utils/common.py | minimal_kwargs | GCES-2021-1/rasa | python | def minimal_kwargs(kwargs: Dict[(Text, Any)], func: Callable, excluded_keys: Optional[List]=None) -> Dict[(Text, Any)]:
'Returns only the kwargs which are required by a function. Keys, contained in\n the exception list, are not included.\n\n Args:\n kwargs: All available kwargs.\n func: The func... |
def mark_as_experimental_feature(feature_name: Text) -> None:
'Warns users that they are using an experimental feature.'
logger.warning(f'The {feature_name} is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (https://forum.rasa.com) to help us... | -9,208,751,186,646,962,000 | Warns users that they are using an experimental feature. | rasa/shared/utils/common.py | mark_as_experimental_feature | GCES-2021-1/rasa | python | def mark_as_experimental_feature(feature_name: Text) -> None:
logger.warning(f'The {feature_name} is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (https://forum.rasa.com) to help us make this feature ready for production.') |
def arguments_of(func: Callable) -> List[Text]:
'Return the parameters of the function `func` as a list of names.'
import inspect
return list(inspect.signature(func).parameters.keys()) | -8,161,593,928,677,645,000 | Return the parameters of the function `func` as a list of names. | rasa/shared/utils/common.py | arguments_of | GCES-2021-1/rasa | python | def arguments_of(func: Callable) -> List[Text]:
import inspect
return list(inspect.signature(func).parameters.keys()) |
def prepare_roidb(imdb):
"Enrich the imdb's roidb by adding some derived quantities that\n are useful for training. This function precomputes the maximum\n overlap, taken over ground-truth boxes, between each ROI and\n each ground-truth box. The class with maximum overlap is also\n recorded.\n "
... | -8,867,570,319,704,350,000 | Enrich the imdb's roidb by adding some derived quantities that
are useful for training. This function precomputes the maximum
overlap, taken over ground-truth boxes, between each ROI and
each ground-truth box. The class with maximum overlap is also
recorded. | lib/roi_data_layer/roidb.py | prepare_roidb | sx14/hierarchical-relationship | python | def prepare_roidb(imdb):
"Enrich the imdb's roidb by adding some derived quantities that\n are useful for training. This function precomputes the maximum\n overlap, taken over ground-truth boxes, between each ROI and\n each ground-truth box. The class with maximum overlap is also\n recorded.\n "
... |
def add_bbox_regression_targets(roidb):
'Add information needed to train bounding-box regressors.'
assert (len(roidb) > 0)
assert ('max_classes' in roidb[0]), 'Did you call prepare_roidb first?'
num_images = len(roidb)
num_classes = roidb[0]['gt_overlaps'].shape[1]
for im_i in xrange(num_images)... | -6,998,400,248,771,317,000 | Add information needed to train bounding-box regressors. | lib/roi_data_layer/roidb.py | add_bbox_regression_targets | sx14/hierarchical-relationship | python | def add_bbox_regression_targets(roidb):
assert (len(roidb) > 0)
assert ('max_classes' in roidb[0]), 'Did you call prepare_roidb first?'
num_images = len(roidb)
num_classes = roidb[0]['gt_overlaps'].shape[1]
for im_i in xrange(num_images):
rois = roidb[im_i]['boxes']
max_overlaps... |
def _compute_targets(rois, overlaps, labels):
'Compute bounding-box regression targets for an image.'
rois = rois.astype(np.float, copy=False)
gt_inds = np.where((overlaps == 1))[0]
ex_inds = np.where((overlaps >= cfg.TRAIN.BBOX_THRESH))[0]
ex_gt_overlaps = utils.cython_bbox.bbox_overlaps(rois[ex_in... | 4,698,837,056,146,223,000 | Compute bounding-box regression targets for an image. | lib/roi_data_layer/roidb.py | _compute_targets | sx14/hierarchical-relationship | python | def _compute_targets(rois, overlaps, labels):
rois = rois.astype(np.float, copy=False)
gt_inds = np.where((overlaps == 1))[0]
ex_inds = np.where((overlaps >= cfg.TRAIN.BBOX_THRESH))[0]
ex_gt_overlaps = utils.cython_bbox.bbox_overlaps(rois[ex_inds, :], rois[gt_inds, :])
gt_assignment = ex_gt_ove... |
def get_rmse_log(net, X_train, y_train):
'Gets root mse between the logarithms of the prediction and the truth.'
num_train = X_train.shape[0]
clipped_preds = nd.clip(net(X_train), 1, float('inf'))
return np.sqrt(((2 * nd.sum(square_loss(nd.log(clipped_preds), nd.log(y_train))).asscalar()) / num_train)) | -7,092,342,962,797,382,000 | Gets root mse between the logarithms of the prediction and the truth. | example/gluon/kaggle_k_fold_cross_validation.py | get_rmse_log | ABAPPLO/Mxnetonspark | python | def get_rmse_log(net, X_train, y_train):
num_train = X_train.shape[0]
clipped_preds = nd.clip(net(X_train), 1, float('inf'))
return np.sqrt(((2 * nd.sum(square_loss(nd.log(clipped_preds), nd.log(y_train))).asscalar()) / num_train)) |
def get_net():
'Gets a neural network. Better results are obtained with modifications.'
net = gluon.nn.Sequential()
with net.name_scope():
net.add(gluon.nn.Dense(50, activation='relu'))
net.add(gluon.nn.Dense(1))
net.initialize()
return net | 1,806,053,854,338,454,500 | Gets a neural network. Better results are obtained with modifications. | example/gluon/kaggle_k_fold_cross_validation.py | get_net | ABAPPLO/Mxnetonspark | python | def get_net():
net = gluon.nn.Sequential()
with net.name_scope():
net.add(gluon.nn.Dense(50, activation='relu'))
net.add(gluon.nn.Dense(1))
net.initialize()
return net |
def train(net, X_train, y_train, epochs, verbose_epoch, learning_rate, weight_decay, batch_size):
'Trains the model.'
dataset_train = gluon.data.ArrayDataset(X_train, y_train)
data_iter_train = gluon.data.DataLoader(dataset_train, batch_size, shuffle=True)
trainer = gluon.Trainer(net.collect_params(), '... | -3,094,733,623,772,374,500 | Trains the model. | example/gluon/kaggle_k_fold_cross_validation.py | train | ABAPPLO/Mxnetonspark | python | def train(net, X_train, y_train, epochs, verbose_epoch, learning_rate, weight_decay, batch_size):
dataset_train = gluon.data.ArrayDataset(X_train, y_train)
data_iter_train = gluon.data.DataLoader(dataset_train, batch_size, shuffle=True)
trainer = gluon.Trainer(net.collect_params(), 'adam', {'learning_r... |
def k_fold_cross_valid(k, epochs, verbose_epoch, X_train, y_train, learning_rate, weight_decay, batch_size):
'Conducts k-fold cross validation for the model.'
assert (k > 1)
fold_size = (X_train.shape[0] // k)
train_loss_sum = 0.0
test_loss_sum = 0.0
for test_idx in range(k):
X_val_test ... | 6,129,740,340,677,521,000 | Conducts k-fold cross validation for the model. | example/gluon/kaggle_k_fold_cross_validation.py | k_fold_cross_valid | ABAPPLO/Mxnetonspark | python | def k_fold_cross_valid(k, epochs, verbose_epoch, X_train, y_train, learning_rate, weight_decay, batch_size):
assert (k > 1)
fold_size = (X_train.shape[0] // k)
train_loss_sum = 0.0
test_loss_sum = 0.0
for test_idx in range(k):
X_val_test = X_train[(test_idx * fold_size):((test_idx + 1) ... |
def learn(epochs, verbose_epoch, X_train, y_train, test, learning_rate, weight_decay, batch_size):
'Trains the model and predicts on the test data set.'
net = get_net()
_ = train(net, X_train, y_train, epochs, verbose_epoch, learning_rate, weight_decay, batch_size)
preds = net(X_test).asnumpy()
test... | 8,761,738,220,094,372,000 | Trains the model and predicts on the test data set. | example/gluon/kaggle_k_fold_cross_validation.py | learn | ABAPPLO/Mxnetonspark | python | def learn(epochs, verbose_epoch, X_train, y_train, test, learning_rate, weight_decay, batch_size):
net = get_net()
_ = train(net, X_train, y_train, epochs, verbose_epoch, learning_rate, weight_decay, batch_size)
preds = net(X_test).asnumpy()
test['SalePrice'] = pd.Series(preds.reshape(1, (- 1))[0])... |
def create_game(gm):
'\n Configure and create a game.\n\n Creates a game with base settings equivalent to one of the default presets.\n Allows user to customize the settings before starting the game.\n\n Parameters\n ----------\n gm : int\n Game type to replicate:\n 0: Normal mod... | 8,096,551,393,933,726,000 | Configure and create a game.
Creates a game with base settings equivalent to one of the default presets.
Allows user to customize the settings before starting the game.
Parameters
----------
gm : int
Game type to replicate:
0: Normal mode.
1: Advanced mode.
Returns
-------
BattleshipGame
Game... | battleship.py | create_game | GamrCorps/STEMExpoBattleship | python | def create_game(gm):
'\n Configure and create a game.\n\n Creates a game with base settings equivalent to one of the default presets.\n Allows user to customize the settings before starting the game.\n\n Parameters\n ----------\n gm : int\n Game type to replicate:\n 0: Normal mod... |
@staticmethod
def box_string(string, min_width=(- 1), print_string=False):
"\n Place a string into an ASCII box.\n\n The result is placed inside of a ASCII box consisting of '+' characters for the corners and '-' characters for the edges.\n\n Parameters\n ----------\n string : str... | 7,150,828,423,301,797,000 | Place a string into an ASCII box.
The result is placed inside of a ASCII box consisting of '+' characters for the corners and '-' characters for the edges.
Parameters
----------
string : str
String to be boxed.
min_width : int, optional
Specifies that the box be of a certain minimum width. Defaults to input s... | battleship.py | box_string | GamrCorps/STEMExpoBattleship | python | @staticmethod
def box_string(string, min_width=(- 1), print_string=False):
"\n Place a string into an ASCII box.\n\n The result is placed inside of a ASCII box consisting of '+' characters for the corners and '-' characters for the edges.\n\n Parameters\n ----------\n string : str... |
@staticmethod
def num_input(question, *choices):
'\n Take user input based on several different options.\n\n The input question will be repeated until valid input is given.\n The choices will be displayed in order with a number next to them indicating their id.\n Responses can be given a... | -2,361,384,523,999,038,500 | Take user input based on several different options.
The input question will be repeated until valid input is given.
The choices will be displayed in order with a number next to them indicating their id.
Responses can be given as the choice id or the full choice name.
Parameters
----------
question : str
String to... | battleship.py | num_input | GamrCorps/STEMExpoBattleship | python | @staticmethod
def num_input(question, *choices):
'\n Take user input based on several different options.\n\n The input question will be repeated until valid input is given.\n The choices will be displayed in order with a number next to them indicating their id.\n Responses can be given a... |
@staticmethod
def string_input(question, condition='.+'):
'\n Take string-based user input.\n\n The input question will be repeated until valid input is given, determined by the condition regex.\n\n Parameters\n ----------\n question : str\n String to be displayed as th... | -8,818,709,648,197,799,000 | Take string-based user input.
The input question will be repeated until valid input is given, determined by the condition regex.
Parameters
----------
question : str
String to be displayed as the input question. Will be boxed with Utils#box_string before printing.
condition : r-string, optional
Regex to test ... | battleship.py | string_input | GamrCorps/STEMExpoBattleship | python | @staticmethod
def string_input(question, condition='.+'):
'\n Take string-based user input.\n\n The input question will be repeated until valid input is given, determined by the condition regex.\n\n Parameters\n ----------\n question : str\n String to be displayed as th... |
@staticmethod
def print_settings(settings):
'\n Pretty-print a settings dictionary.\n\n Parameters\n ----------\n settings : dict\n The settings dictionary to pretty-print.\n\n Returns\n -------\n None\n '
Utils.box_string('Current Settings'... | -2,943,421,785,673,365,000 | Pretty-print a settings dictionary.
Parameters
----------
settings : dict
The settings dictionary to pretty-print.
Returns
-------
None | battleship.py | print_settings | GamrCorps/STEMExpoBattleship | python | @staticmethod
def print_settings(settings):
'\n Pretty-print a settings dictionary.\n\n Parameters\n ----------\n settings : dict\n The settings dictionary to pretty-print.\n\n Returns\n -------\n None\n '
Utils.box_string('Current Settings'... |
@staticmethod
def grid_pos_input(height, width, question='Enter a Position:'):
"\n Take user-input in coordinate form.\n\n The input question will be repeated until valid input is given.\n The input must be a valid coordinate in battleship form (r'[A-Z]\\d+').\n The input coordinate must... | -2,679,898,343,304,835,600 | Take user-input in coordinate form.
The input question will be repeated until valid input is given.
The input must be a valid coordinate in battleship form (r'[A-Z]\d+').
The input coordinate must be inside of the grid defined by height and width.
Parameters
----------
height : int
Specifies the height of the gri... | battleship.py | grid_pos_input | GamrCorps/STEMExpoBattleship | python | @staticmethod
def grid_pos_input(height, width, question='Enter a Position:'):
"\n Take user-input in coordinate form.\n\n The input question will be repeated until valid input is given.\n The input must be a valid coordinate in battleship form (r'[A-Z]\\d+').\n The input coordinate must... |
def __init__(self, settings):
'\n Constructor for the BattleshipGame class.\n\n Parameters\n ----------\n settings : dict\n Settings to create the game based off of.\n '
self.settings = settings
self.height = settings['height']
self.width = settings['width']... | -5,138,271,308,075,073,000 | Constructor for the BattleshipGame class.
Parameters
----------
settings : dict
Settings to create the game based off of. | battleship.py | __init__ | GamrCorps/STEMExpoBattleship | python | def __init__(self, settings):
'\n Constructor for the BattleshipGame class.\n\n Parameters\n ----------\n settings : dict\n Settings to create the game based off of.\n '
self.settings = settings
self.height = settings['height']
self.width = settings['width']... |
def update_board(self, player):
"\n Update both grids for a player.\n\n Adds new ships and puts them into the right locations.\n\n Parameters\n ----------\n player : int\n Determines which player's grids to print. Zero-indexed.\n "
if (player == 0):
b... | -1,463,448,551,345,982,700 | Update both grids for a player.
Adds new ships and puts them into the right locations.
Parameters
----------
player : int
Determines which player's grids to print. Zero-indexed. | battleship.py | update_board | GamrCorps/STEMExpoBattleship | python | def update_board(self, player):
"\n Update both grids for a player.\n\n Adds new ships and puts them into the right locations.\n\n Parameters\n ----------\n player : int\n Determines which player's grids to print. Zero-indexed.\n "
if (player == 0):
b... |
def print_board(self, player):
"\n Pretty-print the current boards of a player.\n\n Prints both boards for a player, along with coordinate references, titles, and boxes around the grids.\n\n Parameters\n ----------\n player : int\n Determines which player's grids to pri... | 5,454,646,643,821,010,000 | Pretty-print the current boards of a player.
Prints both boards for a player, along with coordinate references, titles, and boxes around the grids.
Parameters
----------
player : int
Determines which player's grids to print. Zero-indexed.
Returns
-------
str
Same as the string that is printed. | battleship.py | print_board | GamrCorps/STEMExpoBattleship | python | def print_board(self, player):
"\n Pretty-print the current boards of a player.\n\n Prints both boards for a player, along with coordinate references, titles, and boxes around the grids.\n\n Parameters\n ----------\n player : int\n Determines which player's grids to pri... |
def setup_ship(self, pos, direction, player, count, size):
'\n Create a ship.\n\n Creates a ship dictionary based on positional, directional, player, and size data and tests if placement is legal.\n\n Parameters\n ----------\n pos : tuple\n (y,x) coordinate pair of top-... | -2,972,751,348,295,731,000 | Create a ship.
Creates a ship dictionary based on positional, directional, player, and size data and tests if placement is legal.
Parameters
----------
pos : tuple
(y,x) coordinate pair of top-left corner of the ship.
direction : int
Determines the direction of the ship:
0: Horizontal.
1: Vert... | battleship.py | setup_ship | GamrCorps/STEMExpoBattleship | python | def setup_ship(self, pos, direction, player, count, size):
'\n Create a ship.\n\n Creates a ship dictionary based on positional, directional, player, and size data and tests if placement is legal.\n\n Parameters\n ----------\n pos : tuple\n (y,x) coordinate pair of top-... |
def setup_ships(self, size, player, count):
'\n Setup all the ships of a particular size for a certain player.\n\n Sets up all of the length-n size ships for a player.\n Count is not updated in-place.\n\n Parameters\n ----------\n size : int\n Length of the ships... | 7,149,102,928,931,009,000 | Setup all the ships of a particular size for a certain player.
Sets up all of the length-n size ships for a player.
Count is not updated in-place.
Parameters
----------
size : int
Length of the ships.
player : int
Determines which player to assign the ships to. Zero-indexed.
count : int
Current ship count... | battleship.py | setup_ships | GamrCorps/STEMExpoBattleship | python | def setup_ships(self, size, player, count):
'\n Setup all the ships of a particular size for a certain player.\n\n Sets up all of the length-n size ships for a player.\n Count is not updated in-place.\n\n Parameters\n ----------\n size : int\n Length of the ships... |
def p1_turn(self):
"\n Execute a turn for Player 1.\n\n Handles input and output for the turn and updates both player's grids.\n\n Returns\n -------\n bool\n True if game ends after the move, False otherwise\n "
print(('\n' * PAD_AMOUNT))
Utils.box_string... | -6,425,654,261,485,334,000 | Execute a turn for Player 1.
Handles input and output for the turn and updates both player's grids.
Returns
-------
bool
True if game ends after the move, False otherwise | battleship.py | p1_turn | GamrCorps/STEMExpoBattleship | python | def p1_turn(self):
"\n Execute a turn for Player 1.\n\n Handles input and output for the turn and updates both player's grids.\n\n Returns\n -------\n bool\n True if game ends after the move, False otherwise\n "
print(('\n' * PAD_AMOUNT))
Utils.box_string... |
def p2_turn(self):
"\n Execute a turn for Player 2.\n\n Handles input and output for the turn and updates both player's grids.\n\n Returns\n -------\n bool\n True if game ends after the move, False otherwise\n "
print(('\n' * PAD_AMOUNT))
Utils.box_string... | 8,144,884,848,283,960,000 | Execute a turn for Player 2.
Handles input and output for the turn and updates both player's grids.
Returns
-------
bool
True if game ends after the move, False otherwise | battleship.py | p2_turn | GamrCorps/STEMExpoBattleship | python | def p2_turn(self):
"\n Execute a turn for Player 2.\n\n Handles input and output for the turn and updates both player's grids.\n\n Returns\n -------\n bool\n True if game ends after the move, False otherwise\n "
print(('\n' * PAD_AMOUNT))
Utils.box_string... |
def start_game(self):
"\n Start a new game.\n\n Starts a game with the settings provided in the constructor.\n All game code is contained here, with relevant helper methods also called here.\n Every game has two stages: Setup and Play.\n\n Returns\n -------\n int\n ... | -4,259,161,377,121,769,000 | Start a new game.
Starts a game with the settings provided in the constructor.
All game code is contained here, with relevant helper methods also called here.
Every game has two stages: Setup and Play.
Returns
-------
int
Winning player's number. Zero-indexed. | battleship.py | start_game | GamrCorps/STEMExpoBattleship | python | def start_game(self):
"\n Start a new game.\n\n Starts a game with the settings provided in the constructor.\n All game code is contained here, with relevant helper methods also called here.\n Every game has two stages: Setup and Play.\n\n Returns\n -------\n int\n ... |
def recipe_url(id):
'Construct URL for a single recipe based on its ID'
return reverse('recipe:recipe-detail', args=[id]) | -6,700,030,570,248,506,000 | Construct URL for a single recipe based on its ID | app/recipe/tests/test_recipe_api.py | recipe_url | jamie-chapman/django-exercise-recipe-app | python | def recipe_url(id):
return reverse('recipe:recipe-detail', args=[id]) |
def create_sample_recipe(**params):
'Helper function to create a user'
return Recipe.objects.create(**params) | 1,824,730,974,099,778,800 | Helper function to create a user | app/recipe/tests/test_recipe_api.py | create_sample_recipe | jamie-chapman/django-exercise-recipe-app | python | def create_sample_recipe(**params):
return Recipe.objects.create(**params) |
def test_create_recipe_with_ingredients(self):
'Test creating a recipe including ingredients'
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom wellington with vegetables and gravy.', 'ingredients': [{'name': 'carrots'}, {'name': 'potatoes'}, {'name': 'mushrooms'}]}
resp... | -6,914,610,480,633,387,000 | Test creating a recipe including ingredients | app/recipe/tests/test_recipe_api.py | test_create_recipe_with_ingredients | jamie-chapman/django-exercise-recipe-app | python | def test_create_recipe_with_ingredients(self):
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom wellington with vegetables and gravy.', 'ingredients': [{'name': 'carrots'}, {'name': 'potatoes'}, {'name': 'mushrooms'}]}
response = self.client.post(RECIPE_URL, payload, f... |
def test_get_recipes(self):
'Test retrieving a recipe'
create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
create_sample_recipe(name='Beans on Toast', description='Just the best.')
response = self.client.get(RECIPE_URL)
recipes = Recipe.ob... | 7,578,667,835,455,517,000 | Test retrieving a recipe | app/recipe/tests/test_recipe_api.py | test_get_recipes | jamie-chapman/django-exercise-recipe-app | python | def test_get_recipes(self):
create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
create_sample_recipe(name='Beans on Toast', description='Just the best.')
response = self.client.get(RECIPE_URL)
recipes = Recipe.objects.all().order_by('-nam... |
def test_get_recipe(self):
'Test retrieving a single recipe using name as filter'
test_recipe_name = 'Beans on Toast'
create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
create_sample_recipe(name=test_recipe_name, description='Just the best re... | -466,724,916,212,570,050 | Test retrieving a single recipe using name as filter | app/recipe/tests/test_recipe_api.py | test_get_recipe | jamie-chapman/django-exercise-recipe-app | python | def test_get_recipe(self):
test_recipe_name = 'Beans on Toast'
create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
create_sample_recipe(name=test_recipe_name, description='Just the best recipe.')
response = self.client.get(RECIPE_URL, {'n... |
def test_update_recipe(self):
'Test updating a recipe'
self.recipe = create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom wellington with vegetables and gravy.'}... | -701,737,544,240,572,800 | Test updating a recipe | app/recipe/tests/test_recipe_api.py | test_update_recipe | jamie-chapman/django-exercise-recipe-app | python | def test_update_recipe(self):
self.recipe = create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom wellington with vegetables and gravy.'}
response = self.cli... |
def test_delete_recipe(self):
'Test deleting a recipe'
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
response = self.client.delete(recipe_url(self.recipe.id), format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
sel... | 3,177,215,768,312,454,700 | Test deleting a recipe | app/recipe/tests/test_recipe_api.py | test_delete_recipe | jamie-chapman/django-exercise-recipe-app | python | def test_delete_recipe(self):
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
response = self.client.delete(recipe_url(self.recipe.id), format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertFalse(Recipe.obj... |
def test_get_recipes_with_ingredients(self):
'Test retrieving a recipe including ingredients'
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
Ingredient.objects.create(name='Carrots', recipe=self.recipe)
Ingredient.objects.create(name='Icing Sugar', ... | 8,490,206,641,993,368,000 | Test retrieving a recipe including ingredients | app/recipe/tests/test_recipe_api.py | test_get_recipes_with_ingredients | jamie-chapman/django-exercise-recipe-app | python | def test_get_recipes_with_ingredients(self):
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
Ingredient.objects.create(name='Carrots', recipe=self.recipe)
Ingredient.objects.create(name='Icing Sugar', recipe=self.recipe)
response = self.client.g... |
def test_update_recipe_ingredients(self):
'Test updating a recipe with ingredients included'
self.recipe = create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom w... | -4,634,634,642,258,830,000 | Test updating a recipe with ingredients included | app/recipe/tests/test_recipe_api.py | test_update_recipe_ingredients | jamie-chapman/django-exercise-recipe-app | python | def test_update_recipe_ingredients(self):
self.recipe = create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
payload = {'name': 'Vegan Roast Dinner', 'description': 'Roasted potatoes and mushroom wellington with vegetables and gravy.', 'ingredient... |
def test_delete_recipe_with_ingredients(self):
'Test deleting a recipe with ingredients included'
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
Ingredient.objects.create(name='Carrots', recipe=self.recipe)
Ingredient.objects.create(name='Icing Suga... | 8,174,779,375,099,401,000 | Test deleting a recipe with ingredients included | app/recipe/tests/test_recipe_api.py | test_delete_recipe_with_ingredients | jamie-chapman/django-exercise-recipe-app | python | def test_delete_recipe_with_ingredients(self):
self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
Ingredient.objects.create(name='Carrots', recipe=self.recipe)
Ingredient.objects.create(name='Icing Sugar', recipe=self.recipe)
response = self.client... |
def get_application_gateway(application_gateway_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetApplicationGatewayResult:
'\n Application gateway resource.\n\n\n :param str application_gateway_name: The name of the application gatewa... | -5,472,037,904,466,801,000 | Application gateway resource.
:param str application_gateway_name: The name of the application gateway.
:param str resource_group_name: The name of the resource group. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | get_application_gateway | pulumi/pulumi-azure-nextgen | python | def get_application_gateway(application_gateway_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetApplicationGatewayResult:
'\n Application gateway resource.\n\n\n :param str application_gateway_name: The name of the application gatewa... |
@property
@pulumi.getter(name='authenticationCertificates')
def authentication_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayAuthenticationCertificateResponse']]:
'\n Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](htt... | -4,062,952,323,035,735,000 | Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | authentication_certificates | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='authenticationCertificates')
def authentication_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayAuthenticationCertificateResponse']]:
'\n \n '
return pulumi.get(self, 'authentication_certificates') |
@property
@pulumi.getter(name='autoscaleConfiguration')
def autoscale_configuration(self) -> Optional['outputs.ApplicationGatewayAutoscaleConfigurationResponse']:
'\n Autoscale Configuration.\n '
return pulumi.get(self, 'autoscale_configuration') | 8,419,954,442,239,702,000 | Autoscale Configuration. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | autoscale_configuration | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='autoscaleConfiguration')
def autoscale_configuration(self) -> Optional['outputs.ApplicationGatewayAutoscaleConfigurationResponse']:
'\n \n '
return pulumi.get(self, 'autoscale_configuration') |
@property
@pulumi.getter(name='backendAddressPools')
def backend_address_pools(self) -> Optional[Sequence['outputs.ApplicationGatewayBackendAddressPoolResponse']]:
'\n Backend address pool of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azu... | 6,395,664,438,994,776,000 | Backend address pool of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | backend_address_pools | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='backendAddressPools')
def backend_address_pools(self) -> Optional[Sequence['outputs.ApplicationGatewayBackendAddressPoolResponse']]:
'\n \n '
return pulumi.get(self, 'backend_address_pools') |
@property
@pulumi.getter(name='backendHttpSettingsCollection')
def backend_http_settings_collection(self) -> Optional[Sequence['outputs.ApplicationGatewayBackendHttpSettingsResponse']]:
'\n Backend http settings of the application gateway resource. For default limits, see [Application Gateway limits](https:/... | 7,237,127,856,813,792,000 | Backend http settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | backend_http_settings_collection | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='backendHttpSettingsCollection')
def backend_http_settings_collection(self) -> Optional[Sequence['outputs.ApplicationGatewayBackendHttpSettingsResponse']]:
'\n \n '
return pulumi.get(self, 'backend_http_settings_collection') |
@property
@pulumi.getter(name='customErrorConfigurations')
def custom_error_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayCustomErrorResponse']]:
'\n Custom error configurations of the application gateway resource.\n '
return pulumi.get(self, 'custom_error_configurations') | -7,995,323,122,653,976,000 | Custom error configurations of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | custom_error_configurations | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='customErrorConfigurations')
def custom_error_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayCustomErrorResponse']]:
'\n \n '
return pulumi.get(self, 'custom_error_configurations') |
@property
@pulumi.getter(name='enableFips')
def enable_fips(self) -> Optional[bool]:
'\n Whether FIPS is enabled on the application gateway resource.\n '
return pulumi.get(self, 'enable_fips') | 3,620,545,089,823,313,000 | Whether FIPS is enabled on the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | enable_fips | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='enableFips')
def enable_fips(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'enable_fips') |
@property
@pulumi.getter(name='enableHttp2')
def enable_http2(self) -> Optional[bool]:
'\n Whether HTTP2 is enabled on the application gateway resource.\n '
return pulumi.get(self, 'enable_http2') | -2,189,973,886,906,387,700 | Whether HTTP2 is enabled on the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | enable_http2 | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='enableHttp2')
def enable_http2(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'enable_http2') |
@property
@pulumi.getter
def etag(self) -> str:
'\n A unique read-only string that changes whenever the resource is updated.\n '
return pulumi.get(self, 'etag') | -4,757,010,955,465,940,000 | A unique read-only string that changes whenever the resource is updated. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | etag | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def etag(self) -> str:
'\n \n '
return pulumi.get(self, 'etag') |
@property
@pulumi.getter(name='firewallPolicy')
def firewall_policy(self) -> Optional['outputs.SubResourceResponse']:
'\n Reference to the FirewallPolicy resource.\n '
return pulumi.get(self, 'firewall_policy') | -2,060,557,808,174,617,600 | Reference to the FirewallPolicy resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | firewall_policy | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='firewallPolicy')
def firewall_policy(self) -> Optional['outputs.SubResourceResponse']:
'\n \n '
return pulumi.get(self, 'firewall_policy') |
@property
@pulumi.getter(name='forceFirewallPolicyAssociation')
def force_firewall_policy_association(self) -> Optional[bool]:
'\n If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config.\n '
return pulumi.get(self, 'force_firewal... | -6,839,923,985,103,754,000 | If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | force_firewall_policy_association | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='forceFirewallPolicyAssociation')
def force_firewall_policy_association(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'force_firewall_policy_association') |
@property
@pulumi.getter(name='frontendIPConfigurations')
def frontend_ip_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayFrontendIPConfigurationResponse']]:
'\n Frontend IP addresses of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.m... | -4,878,596,659,314,971,000 | Frontend IP addresses of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | frontend_ip_configurations | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='frontendIPConfigurations')
def frontend_ip_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayFrontendIPConfigurationResponse']]:
'\n \n '
return pulumi.get(self, 'frontend_ip_configurations') |
@property
@pulumi.getter(name='frontendPorts')
def frontend_ports(self) -> Optional[Sequence['outputs.ApplicationGatewayFrontendPortResponse']]:
'\n Frontend ports of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-ser... | 590,217,953,051,457,900 | Frontend ports of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | frontend_ports | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='frontendPorts')
def frontend_ports(self) -> Optional[Sequence['outputs.ApplicationGatewayFrontendPortResponse']]:
'\n \n '
return pulumi.get(self, 'frontend_ports') |
@property
@pulumi.getter(name='gatewayIPConfigurations')
def gateway_ip_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayIPConfigurationResponse']]:
'\n Subnets of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure... | 6,526,835,487,889,182,000 | Subnets of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | gateway_ip_configurations | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='gatewayIPConfigurations')
def gateway_ip_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayIPConfigurationResponse']]:
'\n \n '
return pulumi.get(self, 'gateway_ip_configurations') |
@property
@pulumi.getter(name='httpListeners')
def http_listeners(self) -> Optional[Sequence['outputs.ApplicationGatewayHttpListenerResponse']]:
'\n Http listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-ser... | 5,704,017,451,908,833,000 | Http listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | http_listeners | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='httpListeners')
def http_listeners(self) -> Optional[Sequence['outputs.ApplicationGatewayHttpListenerResponse']]:
'\n \n '
return pulumi.get(self, 'http_listeners') |
@property
@pulumi.getter
def id(self) -> Optional[str]:
'\n Resource ID.\n '
return pulumi.get(self, 'id') | 6,887,155,523,158,811,000 | Resource ID. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | id | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def id(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'id') |
@property
@pulumi.getter
def identity(self) -> Optional['outputs.ManagedServiceIdentityResponse']:
'\n The identity of the application gateway, if configured.\n '
return pulumi.get(self, 'identity') | 3,779,855,874,785,179,000 | The identity of the application gateway, if configured. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | identity | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def identity(self) -> Optional['outputs.ManagedServiceIdentityResponse']:
'\n \n '
return pulumi.get(self, 'identity') |
@property
@pulumi.getter
def location(self) -> Optional[str]:
'\n Resource location.\n '
return pulumi.get(self, 'location') | 8,841,543,228,718,414,000 | Resource location. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | location | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def location(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> str:
'\n Resource name.\n '
return pulumi.get(self, 'name') | -2,625,941,459,458,898,000 | Resource name. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | name | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter(name='operationalState')
def operational_state(self) -> str:
'\n Operational state of the application gateway resource.\n '
return pulumi.get(self, 'operational_state') | -3,974,465,468,316,918,000 | Operational state of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | operational_state | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='operationalState')
def operational_state(self) -> str:
'\n \n '
return pulumi.get(self, 'operational_state') |
@property
@pulumi.getter(name='privateEndpointConnections')
def private_endpoint_connections(self) -> Sequence['outputs.ApplicationGatewayPrivateEndpointConnectionResponse']:
'\n Private Endpoint connections on application gateway.\n '
return pulumi.get(self, 'private_endpoint_connections') | 6,080,750,852,872,518,000 | Private Endpoint connections on application gateway. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | private_endpoint_connections | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='privateEndpointConnections')
def private_endpoint_connections(self) -> Sequence['outputs.ApplicationGatewayPrivateEndpointConnectionResponse']:
'\n \n '
return pulumi.get(self, 'private_endpoint_connections') |
@property
@pulumi.getter(name='privateLinkConfigurations')
def private_link_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayPrivateLinkConfigurationResponse']]:
'\n PrivateLink configurations on application gateway.\n '
return pulumi.get(self, 'private_link_configurations') | 293,996,003,584,253,440 | PrivateLink configurations on application gateway. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | private_link_configurations | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='privateLinkConfigurations')
def private_link_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayPrivateLinkConfigurationResponse']]:
'\n \n '
return pulumi.get(self, 'private_link_configurations') |
@property
@pulumi.getter
def probes(self) -> Optional[Sequence['outputs.ApplicationGatewayProbeResponse']]:
'\n Probes of the application gateway resource.\n '
return pulumi.get(self, 'probes') | -5,541,267,534,319,744,000 | Probes of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | probes | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def probes(self) -> Optional[Sequence['outputs.ApplicationGatewayProbeResponse']]:
'\n \n '
return pulumi.get(self, 'probes') |
@property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n The provisioning state of the application gateway resource.\n '
return pulumi.get(self, 'provisioning_state') | 6,226,561,025,582,350,000 | The provisioning state of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | provisioning_state | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n \n '
return pulumi.get(self, 'provisioning_state') |
@property
@pulumi.getter(name='redirectConfigurations')
def redirect_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayRedirectConfigurationResponse']]:
'\n Redirect configurations of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.micros... | -1,933,333,427,948,408,300 | Redirect configurations of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | redirect_configurations | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='redirectConfigurations')
def redirect_configurations(self) -> Optional[Sequence['outputs.ApplicationGatewayRedirectConfigurationResponse']]:
'\n \n '
return pulumi.get(self, 'redirect_configurations') |
@property
@pulumi.getter(name='requestRoutingRules')
def request_routing_rules(self) -> Optional[Sequence['outputs.ApplicationGatewayRequestRoutingRuleResponse']]:
'\n Request routing rules of the application gateway resource.\n '
return pulumi.get(self, 'request_routing_rules') | -7,748,220,298,369,710,000 | Request routing rules of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | request_routing_rules | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='requestRoutingRules')
def request_routing_rules(self) -> Optional[Sequence['outputs.ApplicationGatewayRequestRoutingRuleResponse']]:
'\n \n '
return pulumi.get(self, 'request_routing_rules') |
@property
@pulumi.getter(name='resourceGuid')
def resource_guid(self) -> str:
'\n The resource GUID property of the application gateway resource.\n '
return pulumi.get(self, 'resource_guid') | -8,059,144,296,912,127,000 | The resource GUID property of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | resource_guid | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='resourceGuid')
def resource_guid(self) -> str:
'\n \n '
return pulumi.get(self, 'resource_guid') |
@property
@pulumi.getter(name='rewriteRuleSets')
def rewrite_rule_sets(self) -> Optional[Sequence['outputs.ApplicationGatewayRewriteRuleSetResponse']]:
'\n Rewrite rules for the application gateway resource.\n '
return pulumi.get(self, 'rewrite_rule_sets') | -334,078,002,078,932,540 | Rewrite rules for the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | rewrite_rule_sets | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='rewriteRuleSets')
def rewrite_rule_sets(self) -> Optional[Sequence['outputs.ApplicationGatewayRewriteRuleSetResponse']]:
'\n \n '
return pulumi.get(self, 'rewrite_rule_sets') |
@property
@pulumi.getter
def sku(self) -> Optional['outputs.ApplicationGatewaySkuResponse']:
'\n SKU of the application gateway resource.\n '
return pulumi.get(self, 'sku') | 6,988,512,906,409,414,000 | SKU of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | sku | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def sku(self) -> Optional['outputs.ApplicationGatewaySkuResponse']:
'\n \n '
return pulumi.get(self, 'sku') |
@property
@pulumi.getter(name='sslCertificates')
def ssl_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewaySslCertificateResponse']]:
'\n SSL certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscrip... | -7,759,993,510,776,709,000 | SSL certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | ssl_certificates | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='sslCertificates')
def ssl_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewaySslCertificateResponse']]:
'\n \n '
return pulumi.get(self, 'ssl_certificates') |
@property
@pulumi.getter(name='sslPolicy')
def ssl_policy(self) -> Optional['outputs.ApplicationGatewaySslPolicyResponse']:
'\n SSL policy of the application gateway resource.\n '
return pulumi.get(self, 'ssl_policy') | 8,010,652,428,415,810,000 | SSL policy of the application gateway resource. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | ssl_policy | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='sslPolicy')
def ssl_policy(self) -> Optional['outputs.ApplicationGatewaySslPolicyResponse']:
'\n \n '
return pulumi.get(self, 'ssl_policy') |
@property
@pulumi.getter(name='sslProfiles')
def ssl_profiles(self) -> Optional[Sequence['outputs.ApplicationGatewaySslProfileResponse']]:
'\n SSL profiles of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-lim... | -6,316,934,473,019,740,000 | SSL profiles of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | ssl_profiles | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='sslProfiles')
def ssl_profiles(self) -> Optional[Sequence['outputs.ApplicationGatewaySslProfileResponse']]:
'\n \n '
return pulumi.get(self, 'ssl_profiles') |
@property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n Resource tags.\n '
return pulumi.get(self, 'tags') | 562,229,697,900,116,900 | Resource tags. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | tags | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter(name='trustedClientCertificates')
def trusted_client_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayTrustedClientCertificateResponse']]:
'\n Trusted client certificates of the application gateway resource. For default limits, see [Application Gateway limits](https... | 6,098,422,283,827,539,000 | Trusted client certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | trusted_client_certificates | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='trustedClientCertificates')
def trusted_client_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayTrustedClientCertificateResponse']]:
'\n \n '
return pulumi.get(self, 'trusted_client_certificates') |
@property
@pulumi.getter(name='trustedRootCertificates')
def trusted_root_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayTrustedRootCertificateResponse']]:
'\n Trusted Root certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.... | 2,609,331,369,265,081,300 | Trusted Root certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | trusted_root_certificates | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='trustedRootCertificates')
def trusted_root_certificates(self) -> Optional[Sequence['outputs.ApplicationGatewayTrustedRootCertificateResponse']]:
'\n \n '
return pulumi.get(self, 'trusted_root_certificates') |
@property
@pulumi.getter
def type(self) -> str:
'\n Resource type.\n '
return pulumi.get(self, 'type') | -5,079,398,349,541,291,000 | Resource type. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | type | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type') |
@property
@pulumi.getter(name='urlPathMaps')
def url_path_maps(self) -> Optional[Sequence['outputs.ApplicationGatewayUrlPathMapResponse']]:
'\n URL path map of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-li... | -4,925,109,192,802,691,000 | URL path map of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | url_path_maps | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='urlPathMaps')
def url_path_maps(self) -> Optional[Sequence['outputs.ApplicationGatewayUrlPathMapResponse']]:
'\n \n '
return pulumi.get(self, 'url_path_maps') |
@property
@pulumi.getter(name='webApplicationFirewallConfiguration')
def web_application_firewall_configuration(self) -> Optional['outputs.ApplicationGatewayWebApplicationFirewallConfigurationResponse']:
'\n Web application firewall configuration.\n '
return pulumi.get(self, 'web_application_firew... | -955,775,498,257,793,900 | Web application firewall configuration. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | web_application_firewall_configuration | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='webApplicationFirewallConfiguration')
def web_application_firewall_configuration(self) -> Optional['outputs.ApplicationGatewayWebApplicationFirewallConfigurationResponse']:
'\n \n '
return pulumi.get(self, 'web_application_firewall_configuration') |
@property
@pulumi.getter
def zones(self) -> Optional[Sequence[str]]:
'\n A list of availability zones denoting where the resource needs to come from.\n '
return pulumi.get(self, 'zones') | 2,416,209,700,606,667,300 | A list of availability zones denoting where the resource needs to come from. | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | zones | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def zones(self) -> Optional[Sequence[str]]:
'\n \n '
return pulumi.get(self, 'zones') |
def is_good_response_json(resp):
'\n Returns True if the response seems to be HTML, False otherwise.\n '
content_type = resp.headers['Content-Type'].lower()
return ((resp.status_code == 200) and (content_type is not None) and (content_type.find('json') > (- 1))) | 615,579,723,312,468,100 | Returns True if the response seems to be HTML, False otherwise. | Pulling data/apiv2_pull.py | is_good_response_json | GBruening/succes_predictor | python | def is_good_response_json(resp):
'\n \n '
content_type = resp.headers['Content-Type'].lower()
return ((resp.status_code == 200) and (content_type is not None) and (content_type.find('json') > (- 1))) |
def windows_msvc(context, force=False):
'Bootstrapper for MSVC building on Windows.'
deps_dir = os.path.join(context.sharedir, 'msvc-dependencies')
deps_url = 'https://servo-deps-2.s3.amazonaws.com/msvc-deps/'
def version(package):
return packages.WINDOWS_MSVC[package]
def package_dir(pack... | -3,342,560,424,296,585,700 | Bootstrapper for MSVC building on Windows. | python/servo/bootstrap.py | windows_msvc | Florian-Schoenherr/servo | python | def windows_msvc(context, force=False):
deps_dir = os.path.join(context.sharedir, 'msvc-dependencies')
deps_url = 'https://servo-deps-2.s3.amazonaws.com/msvc-deps/'
def version(package):
return packages.WINDOWS_MSVC[package]
def package_dir(package):
return os.path.join(deps_dir, ... |
def bootstrap(context, force=False, specific=None):
'Dispatches to the right bootstrapping function for the OS.'
bootstrapper = None
if ('windows-msvc' in host_triple()):
bootstrapper = windows_msvc
elif ('linux-gnu' in host_triple()):
(distrib, version) = get_linux_distribution()
... | -8,758,505,369,750,413,000 | Dispatches to the right bootstrapping function for the OS. | python/servo/bootstrap.py | bootstrap | Florian-Schoenherr/servo | python | def bootstrap(context, force=False, specific=None):
bootstrapper = None
if ('windows-msvc' in host_triple()):
bootstrapper = windows_msvc
elif ('linux-gnu' in host_triple()):
(distrib, version) = get_linux_distribution()
if (distrib.lower() == 'nixos'):
print('NixOS ... |
def test_sctp_abort_after_smc(self):
' testing Sctp Abort after Security Mode Command for a single UE '
self._s1ap_wrapper.configUEDevice(1)
req = self._s1ap_wrapper.ue_req
print('************************* Running Sctp Abort after Security Mode Command for a single UE for UE id ', req.ue_id)
attach_... | 8,980,921,758,346,578,000 | testing Sctp Abort after Security Mode Command for a single UE | lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py | test_sctp_abort_after_smc | 119Vik/magma-1 | python | def test_sctp_abort_after_smc(self):
' '
self._s1ap_wrapper.configUEDevice(1)
req = self._s1ap_wrapper.ue_req
print('************************* Running Sctp Abort after Security Mode Command for a single UE for UE id ', req.ue_id)
attach_req = s1ap_types.ueAttachRequest_t()
attach_req.ue_Id = re... |
@defer.inlineCallbacks
def image(self):
'\n Get an image from the camera.\n \n Returns an Image object.\n '
try:
(flag, img_array) = (yield threads.deferToThread(self.camera.read))
except SystemError:
return
if (flag is False):
print('No image')
... | -6,829,252,595,344,101,000 | Get an image from the camera.
Returns an Image object. | src/octopus/image/source.py | image | gar-syn/congo-lab | python | @defer.inlineCallbacks
def image(self):
'\n Get an image from the camera.\n \n Returns an Image object.\n '
try:
(flag, img_array) = (yield threads.deferToThread(self.camera.read))
except SystemError:
return
if (flag is False):
print('No image')
... |
def dataReceived(self, data: bytes):
'\n Byte 1: command\n Byte 2-5: length\n Byte 6+: data\n '
self._buffer += data
if (len(self._buffer) > 5):
command = chr(self._buffer[0])
length = int.from_bytes(self._buffer[1:5], byteorder='big')
if (len(self._buffer... | -6,403,001,168,901,691,000 | Byte 1: command
Byte 2-5: length
Byte 6+: data | src/octopus/image/source.py | dataReceived | gar-syn/congo-lab | python | def dataReceived(self, data: bytes):
'\n Byte 1: command\n Byte 2-5: length\n Byte 6+: data\n '
self._buffer += data
if (len(self._buffer) > 5):
command = chr(self._buffer[0])
length = int.from_bytes(self._buffer[1:5], byteorder='big')
if (len(self._buffer... |
@defer.inlineCallbacks
def image(self):
'\n Get an image from the camera.\n \n Returns a SimpleCV Image.\n '
try:
img_array = (yield self._protocol.requestImage())
except Exception as e:
print('Exception fetching image', e)
return
defer.returnValue(Ima... | 5,561,012,379,729,677,000 | Get an image from the camera.
Returns a SimpleCV Image. | src/octopus/image/source.py | image | gar-syn/congo-lab | python | @defer.inlineCallbacks
def image(self):
'\n Get an image from the camera.\n \n Returns a SimpleCV Image.\n '
try:
img_array = (yield self._protocol.requestImage())
except Exception as e:
print('Exception fetching image', e)
return
defer.returnValue(Ima... |
def f_regression_block(fun, X, y, blocksize=None, **args):
'\n runs f_regression for each block separately (saves memory).\n\n -------------------------\n fun : method that returns statistics,pval\n X : {array-like, sparse matrix} shape = (n_samples, n_features)\n The set of regressors that wi... | 1,460,409,536,140,639,200 | runs f_regression for each block separately (saves memory).
-------------------------
fun : method that returns statistics,pval
X : {array-like, sparse matrix} shape = (n_samples, n_features)
The set of regressors that will tested sequentially.
y : array of shape(n_samples).
The data matrix
block... | fastlmm/inference/linear_regression.py | f_regression_block | HealthML/FaST-LMM | python | def f_regression_block(fun, X, y, blocksize=None, **args):
'\n runs f_regression for each block separately (saves memory).\n\n -------------------------\n fun : method that returns statistics,pval\n X : {array-like, sparse matrix} shape = (n_samples, n_features)\n The set of regressors that wi... |
def f_regression_cov_alt(X, y, C):
'\n Implementation as derived in tex document\n\n See pg 12 of following document for definition of F-statistic\n http://www-stat.stanford.edu/~jtaylo/courses/stats191/notes/simple_diagnostics.pdf\n\n Parameters\n ----------\n X : {array-like, sparse matrix} sha... | 8,574,460,787,851,393,000 | Implementation as derived in tex document
See pg 12 of following document for definition of F-statistic
http://www-stat.stanford.edu/~jtaylo/courses/stats191/notes/simple_diagnostics.pdf
Parameters
----------
X : {array-like, sparse matrix} shape = (n_samples, n_features)
The set of regressors that will tested s... | fastlmm/inference/linear_regression.py | f_regression_cov_alt | HealthML/FaST-LMM | python | def f_regression_cov_alt(X, y, C):
'\n Implementation as derived in tex document\n\n See pg 12 of following document for definition of F-statistic\n http://www-stat.stanford.edu/~jtaylo/courses/stats191/notes/simple_diagnostics.pdf\n\n Parameters\n ----------\n X : {array-like, sparse matrix} sha... |
def f_regression_cov(X, y, C):
'Univariate linear regression tests\n\n Quick linear model for testing the effect of a single regressor,\n sequentially for many regressors.\n\n This is done in 3 steps:\n 1. the regressor of interest and the data are orthogonalized\n wrt constant regressors\n 2. the... | -1,825,297,868,363,056,400 | Univariate linear regression tests
Quick linear model for testing the effect of a single regressor,
sequentially for many regressors.
This is done in 3 steps:
1. the regressor of interest and the data are orthogonalized
wrt constant regressors
2. the cross correlation between data and regressors is computed
3. it is ... | fastlmm/inference/linear_regression.py | f_regression_cov | HealthML/FaST-LMM | python | def f_regression_cov(X, y, C):
'Univariate linear regression tests\n\n Quick linear model for testing the effect of a single regressor,\n sequentially for many regressors.\n\n This is done in 3 steps:\n 1. the regressor of interest and the data are orthogonalized\n wrt constant regressors\n 2. the... |
def test_bias():
'\n make sure we get the same result for setting C=unitvec\n '
(S, y) = get_example_data()
C = np.ones((len(y), 1))
from sklearn.feature_selection import f_regression
(F1, pval1) = f_regression(S, y, center=True)
(F2, pval2) = f_regression_cov(S, C, y)
(F3, pval3) = f_... | 1,822,580,387,070,520,300 | make sure we get the same result for setting C=unitvec | fastlmm/inference/linear_regression.py | test_bias | HealthML/FaST-LMM | python | def test_bias():
'\n \n '
(S, y) = get_example_data()
C = np.ones((len(y), 1))
from sklearn.feature_selection import f_regression
(F1, pval1) = f_regression(S, y, center=True)
(F2, pval2) = f_regression_cov(S, C, y)
(F3, pval3) = f_regression_cov_alt(S, C, y)
np.testing.assert_arra... |
def test_cov():
'\n compare different implementations, make sure results are the same\n '
(S, y) = get_example_data()
C = S[:, 0:10]
S = S[:, 10:]
(F1, pval1) = f_regression_cov(S, C, y)
(F2, pval2) = f_regression_cov_alt(S, C, y)
np.testing.assert_array_almost_equal(F1, F2)
np.tes... | -5,899,294,841,173,599,000 | compare different implementations, make sure results are the same | fastlmm/inference/linear_regression.py | test_cov | HealthML/FaST-LMM | python | def test_cov():
'\n \n '
(S, y) = get_example_data()
C = S[:, 0:10]
S = S[:, 10:]
(F1, pval1) = f_regression_cov(S, C, y)
(F2, pval2) = f_regression_cov_alt(S, C, y)
np.testing.assert_array_almost_equal(F1, F2)
np.testing.assert_array_almost_equal(pval1, pval2) |
def fit(self, X=None, y=None, K0_train=None, K1_train=None, h2=None, mixing=None, count_A1=None):
'\n Method for training a :class:`FastLMM` predictor. If the examples in X, y, K0_train, K1_train are not the same, they will be reordered and intersected.\n\n :param X: training covariate information, op... | 2,439,679,434,466,574,300 | Method for training a :class:`FastLMM` predictor. If the examples in X, y, K0_train, K1_train are not the same, they will be reordered and intersected.
:param X: training covariate information, optional:
If you give a string, it should be the file name of a PLINK phenotype-formatted file.
:type X: a PySnpTools `Snp... | fastlmm/inference/linear_regression.py | fit | HealthML/FaST-LMM | python | def fit(self, X=None, y=None, K0_train=None, K1_train=None, h2=None, mixing=None, count_A1=None):
'\n Method for training a :class:`FastLMM` predictor. If the examples in X, y, K0_train, K1_train are not the same, they will be reordered and intersected.\n\n :param X: training covariate information, op... |
def predict(self, X=None, K0_whole_test=None, K1_whole_test=None, iid_if_none=None, count_A1=None):
'\n Method for predicting from a fitted :class:`FastLMM` predictor.\n If the examples in X, K0_whole_test, K1_whole_test are not the same, they will be reordered and intersected.\n\n :param X: te... | -5,795,757,412,969,956,000 | Method for predicting from a fitted :class:`FastLMM` predictor.
If the examples in X, K0_whole_test, K1_whole_test are not the same, they will be reordered and intersected.
:param X: testing covariate information, optional:
If you give a string, it should be the file name of a PLINK phenotype-formatted file.
:type ... | fastlmm/inference/linear_regression.py | predict | HealthML/FaST-LMM | python | def predict(self, X=None, K0_whole_test=None, K1_whole_test=None, iid_if_none=None, count_A1=None):
'\n Method for predicting from a fitted :class:`FastLMM` predictor.\n If the examples in X, K0_whole_test, K1_whole_test are not the same, they will be reordered and intersected.\n\n :param X: te... |
def score(self, X=None, y=None, K0_whole_test=None, K1_whole_test=None, iid_if_none=None, return_mse_too=False, count_A1=None):
'\n Method for calculating the negative log likelihood of testing examples.\n If the examples in X,y, K0_whole_test, K1_whole_test are not the same, they will be reordered a... | -425,445,694,898,426,050 | Method for calculating the negative log likelihood of testing examples.
If the examples in X,y, K0_whole_test, K1_whole_test are not the same, they will be reordered and intersected.
:param X: testing covariate information, optional:
If you give a string, it should be the file name of a PLINK phenotype-formatted f... | fastlmm/inference/linear_regression.py | score | HealthML/FaST-LMM | python | def score(self, X=None, y=None, K0_whole_test=None, K1_whole_test=None, iid_if_none=None, return_mse_too=False, count_A1=None):
'\n Method for calculating the negative log likelihood of testing examples.\n If the examples in X,y, K0_whole_test, K1_whole_test are not the same, they will be reordered a... |
def fake_edtf_level_0():
'Generates a fake publication_date string.'
def fake_date(end_date=None):
fake = Faker()
date_pattern = ['%Y', '%m', '%d']
if random.choice([True, False]):
date_pattern.pop()
if random.choice([True, False]):
date_pattern.p... | 3,227,993,622,139,514,400 | Generates a fake publication_date string. | invenio_rdm_records/fixtures/demo.py | fake_edtf_level_0 | Pineirin/invenio-rdm-records | python | def fake_edtf_level_0():
def fake_date(end_date=None):
fake = Faker()
date_pattern = ['%Y', '%m', '%d']
if random.choice([True, False]):
date_pattern.pop()
if random.choice([True, False]):
date_pattern.pop()
return fake.date('-'.join(date... |
def create_fake_record():
'Create records for demo purposes.'
fake = Faker()
data_to_use = {'access': {'record': 'public', 'files': 'public'}, 'files': {'enabled': False}, 'pids': {}, 'metadata': {'resource_type': CachedVocabularies.fake_resource_type(), 'creators': [{'person_or_org': {'family_name': fake.l... | 3,656,507,691,640,930,300 | Create records for demo purposes. | invenio_rdm_records/fixtures/demo.py | create_fake_record | Pineirin/invenio-rdm-records | python | def create_fake_record():
fake = Faker()
data_to_use = {'access': {'record': 'public', 'files': 'public'}, 'files': {'enabled': False}, 'pids': {}, 'metadata': {'resource_type': CachedVocabularies.fake_resource_type(), 'creators': [{'person_or_org': {'family_name': fake.last_name(), 'given_name': fake.firs... |
@classmethod
def fake_resource_type(cls):
'Generate a random resource_type.'
if (not cls._resource_type_ids):
cls._resource_type_ids = []
dir_ = Path(__file__).parent
res_types = cls._read_vocabulary('resource_types')
for res in res_types:
cls._resource_type_ids.appen... | -7,887,511,485,965,187,000 | Generate a random resource_type. | invenio_rdm_records/fixtures/demo.py | fake_resource_type | Pineirin/invenio-rdm-records | python | @classmethod
def fake_resource_type(cls):
if (not cls._resource_type_ids):
cls._resource_type_ids = []
dir_ = Path(__file__).parent
res_types = cls._read_vocabulary('resource_types')
for res in res_types:
cls._resource_type_ids.append(res['id'])
random_id = rando... |
@classmethod
def fake_subjects(cls):
'Generate random subjects.'
if (not cls._subject_ids):
subjects = cls._read_vocabulary('subjects')
for subj in subjects:
cls._subject_ids.append(subj['id'])
if (not cls._subject_ids):
return []
n = random.choice([0, 1, 2])
rand... | -5,945,701,269,691,416,000 | Generate random subjects. | invenio_rdm_records/fixtures/demo.py | fake_subjects | Pineirin/invenio-rdm-records | python | @classmethod
def fake_subjects(cls):
if (not cls._subject_ids):
subjects = cls._read_vocabulary('subjects')
for subj in subjects:
cls._subject_ids.append(subj['id'])
if (not cls._subject_ids):
return []
n = random.choice([0, 1, 2])
random_ids = random.sample(cls.... |
@classmethod
def fake_language(cls):
'Generate a random resource_type.'
random_id = random.choice(['eng', 'aah', 'aag'])
return {'id': random_id} | 6,489,719,817,623,931,000 | Generate a random resource_type. | invenio_rdm_records/fixtures/demo.py | fake_language | Pineirin/invenio-rdm-records | python | @classmethod
def fake_language(cls):
random_id = random.choice(['eng', 'aah', 'aag'])
return {'id': random_id} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.