hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
d488d92fccf497a9766388d27c34f039b5c6b10a
dyedgreen/schroedinger
numerov/units.py
[ "MIT" ]
Python
unscaleE
<not_specific>
def unscaleE(E, m): """Retrieve the energy value in Joules @param E float (energy value in scaled units) @param m float (see scale) @return float """ return E / gammaSquared(m)
Retrieve the energy value in Joules @param E float (energy value in scaled units) @param m float (see scale) @return float
Retrieve the energy value in Joules @param E float (energy value in scaled units) @param m float @return float
[ "Retrieve", "the", "energy", "value", "in", "Joules", "@param", "E", "float", "(", "energy", "value", "in", "scaled", "units", ")", "@param", "m", "float", "@return", "float" ]
def unscaleE(E, m): return E / gammaSquared(m)
[ "def", "unscaleE", "(", "E", ",", "m", ")", ":", "return", "E", "/", "gammaSquared", "(", "m", ")" ]
Retrieve the energy value in Joules @param E float (energy value in scaled units) @param m float (see scale)
[ "Retrieve", "the", "energy", "value", "in", "Joules", "@param", "E", "float", "(", "energy", "value", "in", "scaled", "units", ")", "@param", "m", "float", "(", "see", "scale", ")" ]
[ "\"\"\"Retrieve the energy value in Joules\n\n @param E float (energy value in scaled units)\n @param m float (see scale)\n\n @return float\n \"\"\"" ]
[ { "param": "E", "type": null }, { "param": "m", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "E", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], ...
d488d92fccf497a9766388d27c34f039b5c6b10a
dyedgreen/schroedinger
numerov/units.py
[ "MIT" ]
Python
scaleL
<not_specific>
def scaleL(L, m): """Scale a length value into a nice range @param L float (length value in meters) @param m float (mass of particle involved) @return float """ return L * gamma(m)
Scale a length value into a nice range @param L float (length value in meters) @param m float (mass of particle involved) @return float
Scale a length value into a nice range @param L float (length value in meters) @param m float (mass of particle involved) @return float
[ "Scale", "a", "length", "value", "into", "a", "nice", "range", "@param", "L", "float", "(", "length", "value", "in", "meters", ")", "@param", "m", "float", "(", "mass", "of", "particle", "involved", ")", "@return", "float" ]
def scaleL(L, m): return L * gamma(m)
[ "def", "scaleL", "(", "L", ",", "m", ")", ":", "return", "L", "*", "gamma", "(", "m", ")" ]
Scale a length value into a nice range @param L float (length value in meters) @param m float (mass of particle involved)
[ "Scale", "a", "length", "value", "into", "a", "nice", "range", "@param", "L", "float", "(", "length", "value", "in", "meters", ")", "@param", "m", "float", "(", "mass", "of", "particle", "involved", ")" ]
[ "\"\"\"Scale a length value into a nice range\n\n @param L float (length value in meters)\n @param m float (mass of particle involved)\n\n @return float\n \"\"\"" ]
[ { "param": "L", "type": null }, { "param": "m", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "L", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], ...
d488d92fccf497a9766388d27c34f039b5c6b10a
dyedgreen/schroedinger
numerov/units.py
[ "MIT" ]
Python
unscaleL
<not_specific>
def unscaleL(L, m): """Retrieve the length value in meters @param L float (length value in scaled units) @param m float (see scale) @return float """ return L / gamma(m)
Retrieve the length value in meters @param L float (length value in scaled units) @param m float (see scale) @return float
Retrieve the length value in meters @param L float (length value in scaled units) @param m float @return float
[ "Retrieve", "the", "length", "value", "in", "meters", "@param", "L", "float", "(", "length", "value", "in", "scaled", "units", ")", "@param", "m", "float", "@return", "float" ]
def unscaleL(L, m): return L / gamma(m)
[ "def", "unscaleL", "(", "L", ",", "m", ")", ":", "return", "L", "/", "gamma", "(", "m", ")" ]
Retrieve the length value in meters @param L float (length value in scaled units) @param m float (see scale)
[ "Retrieve", "the", "length", "value", "in", "meters", "@param", "L", "float", "(", "length", "value", "in", "scaled", "units", ")", "@param", "m", "float", "(", "see", "scale", ")" ]
[ "\"\"\"Retrieve the length value in meters\n\n @param L float (length value in scaled units)\n @param m float (see scale)\n\n @return float\n \"\"\"" ]
[ { "param": "L", "type": null }, { "param": "m", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "L", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], ...
a4dcb68884ccb4ef1c8682fbb2adbd62d1889979
WaizungTaam/json-schema-faker
generators.py
[ "MIT" ]
Python
generate_string
<not_specific>
def generate_string(max_length=MAX_STRLEN, min_length=MIN_STRLEN, pattern=None, **kwargs): '''Generate a valid random string. Ref: https://json-schema.org/draft/2019-09/json-schema-validation.html#string Args: max_length (int): Upper ...
Generate a valid random string. Ref: https://json-schema.org/draft/2019-09/json-schema-validation.html#string Args: max_length (int): Upper limit of string length. min_length (int): Lowet limit of string length. pattern (str): A regular expression pattern. Returns: A v...
Generate a valid random string.
[ "Generate", "a", "valid", "random", "string", "." ]
def generate_string(max_length=MAX_STRLEN, min_length=MIN_STRLEN, pattern=None, **kwargs): if pattern is not None: s = exrex.getone(pattern) if len(s) < min_length: s += ' ' * (min_length - len(s)) if len(s) > max_length...
[ "def", "generate_string", "(", "max_length", "=", "MAX_STRLEN", ",", "min_length", "=", "MIN_STRLEN", ",", "pattern", "=", "None", ",", "**", "kwargs", ")", ":", "if", "pattern", "is", "not", "None", ":", "s", "=", "exrex", ".", "getone", "(", "pattern",...
Generate a valid random string.
[ "Generate", "a", "valid", "random", "string", "." ]
[ "'''Generate a valid random string.\n\n Ref:\n https://json-schema.org/draft/2019-09/json-schema-validation.html#string\n\n Args:\n max_length (int): Upper limit of string length.\n min_length (int): Lowet limit of string length.\n pattern (str): A regular expression pattern.\n\n Re...
[ { "param": "max_length", "type": null }, { "param": "min_length", "type": null }, { "param": "pattern", "type": null } ]
{ "returns": [ { "docstring": "A valid random string.", "docstring_tokens": [ "A", "valid", "random", "string", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "max_length", "type": null, "docstring"...
c63739a4aeb3685b5a5fdd163b769146a99b8be0
mauryas/DataScienceTasks
REST API - Tensorflow/server.py
[ "MIT" ]
Python
init_model
null
def init_model(): ''' Initialize the model and train it for ''' global cls cls = ImageClassifier() if TO_TRAIN: cls.train() logging.info("Train Variable Value: {}". format(TO_TRAIN)) logging.info("Straining to train model") else: cls.load_model() ...
Initialize the model and train it for
Initialize the model and train it for
[ "Initialize", "the", "model", "and", "train", "it", "for" ]
def init_model(): global cls cls = ImageClassifier() if TO_TRAIN: cls.train() logging.info("Train Variable Value: {}". format(TO_TRAIN)) logging.info("Straining to train model") else: cls.load_model() logging.info("Train Variable Value: {}". format(TO_TRAIN)) ...
[ "def", "init_model", "(", ")", ":", "global", "cls", "cls", "=", "ImageClassifier", "(", ")", "if", "TO_TRAIN", ":", "cls", ".", "train", "(", ")", "logging", ".", "info", "(", "\"Train Variable Value: {}\"", ".", "format", "(", "TO_TRAIN", ")", ")", "lo...
Initialize the model and train it for
[ "Initialize", "the", "model", "and", "train", "it", "for" ]
[ "'''\n Initialize the model and train it for \n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c63739a4aeb3685b5a5fdd163b769146a99b8be0
mauryas/DataScienceTasks
REST API - Tensorflow/server.py
[ "MIT" ]
Python
predict
<not_specific>
def predict(): ''' Read the input images from input and return the predicted class. ''' result = {'success':False} #Fetch the file # ensure an image was properly uploaded to our endpoint if flask.request.method == "POST": if flask.request.files.get("image"): # read ...
Read the input images from input and return the predicted class.
Read the input images from input and return the predicted class.
[ "Read", "the", "input", "images", "from", "input", "and", "return", "the", "predicted", "class", "." ]
def predict(): result = {'success':False} if flask.request.method == "POST": if flask.request.files.get("image"): image = flask.request.files["image"].read() image = Image.open(io.BytesIO(image)) image = np.reshape(image,(1,IMG_ROWS,IMG_COLS,1)) y_pred = c...
[ "def", "predict", "(", ")", ":", "result", "=", "{", "'success'", ":", "False", "}", "if", "flask", ".", "request", ".", "method", "==", "\"POST\"", ":", "if", "flask", ".", "request", ".", "files", ".", "get", "(", "\"image\"", ")", ":", "image", ...
Read the input images from input and return the predicted class.
[ "Read", "the", "input", "images", "from", "input", "and", "return", "the", "predicted", "class", "." ]
[ "'''\n Read the input images from input and return the predicted class.\n '''", "#Fetch the file", "# ensure an image was properly uploaded to our endpoint", "# read the image in PIL format" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c63739a4aeb3685b5a5fdd163b769146a99b8be0
mauryas/DataScienceTasks
REST API - Tensorflow/server.py
[ "MIT" ]
Python
batch_train
<not_specific>
def batch_train(): ''' Take an input batch of images and train the classifier ''' result = {'success':False} #Fetch the file if flask.request.method == "POST": """ Validate the zip file which we will receive. If the available memory is more than request file size + DNN model, t...
Take an input batch of images and train the classifier
Take an input batch of images and train the classifier
[ "Take", "an", "input", "batch", "of", "images", "and", "train", "the", "classifier" ]
def batch_train(): result = {'success':False} if flask.request.method == "POST": avl_mem = (psutil.virtual_memory().free)*1024 cls_mem = cls.get_model_memory_usage() content_length = flask.request.content_length logging.info('Mem: {}'.format(avl_mem - cls_mem -content_length)) ...
[ "def", "batch_train", "(", ")", ":", "result", "=", "{", "'success'", ":", "False", "}", "if", "flask", ".", "request", ".", "method", "==", "\"POST\"", ":", "\"\"\"\n\tValidate the zip file which we will receive. If the available memory is \n more than request file ...
Take an input batch of images and train the classifier
[ "Take", "an", "input", "batch", "of", "images", "and", "train", "the", "classifier" ]
[ "'''\n Take an input batch of images and train the classifier\n '''", "#Fetch the file", "\"\"\"\n\tValidate the zip file which we will receive. If the available memory is \n more than request file size + DNN model, then train the model. \n\t\"\"\"", "# if the file uploaded is a zip, open the fil...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
910d714cc017f0dbf90b6072be4332afcebd7252
mauryas/DataScienceTasks
Unbalanced Class Classification/Script.py
[ "MIT" ]
Python
preprocess
null
def preprocess(self): ''' Pre-processings: - remove unary features - normalize continous features - remove negative values for using Naive Bayes - Convert y into integers from alphabets ''' X = self.raw_data y = self.raw_da...
Pre-processings: - remove unary features - normalize continous features - remove negative values for using Naive Bayes - Convert y into integers from alphabets
Pre-processings: remove unary features normalize continous features remove negative values for using Naive Bayes Convert y into integers from alphabets
[ "Pre", "-", "processings", ":", "remove", "unary", "features", "normalize", "continous", "features", "remove", "negative", "values", "for", "using", "Naive", "Bayes", "Convert", "y", "into", "integers", "from", "alphabets" ]
def preprocess(self): X = self.raw_data y = self.raw_data[self.raw_data.shape[1]-1] uni_idx = [] bin_idx = [] ter_idx = [] cont_idx = [] for i in range(X.shape[1]-1): uniq_ = np.unique(X.values[:,i]) if np.shape(uniq_)[0]==1: ...
[ "def", "preprocess", "(", "self", ")", ":", "X", "=", "self", ".", "raw_data", "y", "=", "self", ".", "raw_data", "[", "self", ".", "raw_data", ".", "shape", "[", "1", "]", "-", "1", "]", "uni_idx", "=", "[", "]", "bin_idx", "=", "[", "]", "ter...
Pre-processings: remove unary features normalize continous features remove negative values for using Naive Bayes Convert y into integers from alphabets
[ "Pre", "-", "processings", ":", "remove", "unary", "features", "normalize", "continous", "features", "remove", "negative", "values", "for", "using", "Naive", "Bayes", "Convert", "y", "into", "integers", "from", "alphabets" ]
[ "'''\n Pre-processings:\n - remove unary features\n - normalize continous features\n - remove negative values for using Naive Bayes\n - Convert y into integers from alphabets\n '''", "# find indices of variables", "#Unary", "#Binary", "#Ternar...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
910d714cc017f0dbf90b6072be4332afcebd7252
mauryas/DataScienceTasks
Unbalanced Class Classification/Script.py
[ "MIT" ]
Python
cross_validate
<not_specific>
def cross_validate(self,clf): ''' Use cross-validation to train models and return their scores. input: clf : classifier output: scores : weighted F1 scores of 5 cv. ''' cv = StratifiedKFold(n_splits=5) scores = [] for trai...
Use cross-validation to train models and return their scores. input: clf : classifier output: scores : weighted F1 scores of 5 cv.
Use cross-validation to train models and return their scores. input: clf : classifier output: scores : weighted F1 scores of 5 cv.
[ "Use", "cross", "-", "validation", "to", "train", "models", "and", "return", "their", "scores", ".", "input", ":", "clf", ":", "classifier", "output", ":", "scores", ":", "weighted", "F1", "scores", "of", "5", "cv", "." ]
def cross_validate(self,clf): cv = StratifiedKFold(n_splits=5) scores = [] for train, test in cv.split(self.X,self.y): X_train = self.X[train] y_train = self.y[train] X_test = self.X[test] y_test = self.y[test] clf.fit(X_train,y_train) ...
[ "def", "cross_validate", "(", "self", ",", "clf", ")", ":", "cv", "=", "StratifiedKFold", "(", "n_splits", "=", "5", ")", "scores", "=", "[", "]", "for", "train", ",", "test", "in", "cv", ".", "split", "(", "self", ".", "X", ",", "self", ".", "y"...
Use cross-validation to train models and return their scores.
[ "Use", "cross", "-", "validation", "to", "train", "models", "and", "return", "their", "scores", "." ]
[ "'''\n Use cross-validation to train models and return their scores.\n input:\n clf : classifier\n output:\n scores : weighted F1 scores of 5 cv. \n '''", "#Train the classifier ", "#predict", "#evaluate" ]
[ { "param": "self", "type": null }, { "param": "clf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "clf", "type": null, "docstring": null, "docstring_tokens": []...
910d714cc017f0dbf90b6072be4332afcebd7252
mauryas/DataScienceTasks
Unbalanced Class Classification/Script.py
[ "MIT" ]
Python
neural_nets
<not_specific>
def neural_nets(self): ''' This method will: 1. Design a Deep Feed Forward Neural Network 2. One-hot encode y 3. train the NN model 4. evaluate the model returns: scores: F1 scores from cross validation ''' nclass = np.s...
This method will: 1. Design a Deep Feed Forward Neural Network 2. One-hot encode y 3. train the NN model 4. evaluate the model returns: scores: F1 scores from cross validation
This method will: 1. Design a Deep Feed Forward Neural Network 2. One-hot encode y 3. train the NN model 4. evaluate the model returns: scores: F1 scores from cross validation
[ "This", "method", "will", ":", "1", ".", "Design", "a", "Deep", "Feed", "Forward", "Neural", "Network", "2", ".", "One", "-", "hot", "encode", "y", "3", ".", "train", "the", "NN", "model", "4", ".", "evaluate", "the", "model", "returns", ":", "scores...
def neural_nets(self): nclass = np.shape(np.unique(self.y))[0] input_dim = self.X.shape[1] model = Sequential() model.add(Dense(256,input_shape=(input_dim,),activation='relu')) model.add(Dropout(0.5)) model.add(Dense(256,activation='relu')) model.add(Dropout(0.5))...
[ "def", "neural_nets", "(", "self", ")", ":", "nclass", "=", "np", ".", "shape", "(", "np", ".", "unique", "(", "self", ".", "y", ")", ")", "[", "0", "]", "input_dim", "=", "self", ".", "X", ".", "shape", "[", "1", "]", "model", "=", "Sequential...
This method will: 1.
[ "This", "method", "will", ":", "1", "." ]
[ "'''\n This method will:\n 1. Design a Deep Feed Forward Neural Network\n 2. One-hot encode y\n 3. train the NN model\n 4. evaluate the model\n returns:\n scores: F1 scores from cross validation\n '''", "#Design the computational graph", ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
83b5604f1e622426b2cadd09f8f91bb2d5ea4685
mauryas/DataScienceTasks
REST API - Tensorflow/model/model.py
[ "MIT" ]
Python
batch_train_online
null
def batch_train_online(self, train, label): """ Trains the model from the point it was left at previously """ self.model.fit(train, label, batch_size=BATCH_SIZE, epochs=EPOCHS, verbose=1, ...
Trains the model from the point it was left at previously
Trains the model from the point it was left at previously
[ "Trains", "the", "model", "from", "the", "point", "it", "was", "left", "at", "previously" ]
def batch_train_online(self, train, label): self.model.fit(train, label, batch_size=BATCH_SIZE, epochs=EPOCHS, verbose=1, validation_split= 0.1, callbacks= [self.best_model]) logging.info('Model Updated with new ...
[ "def", "batch_train_online", "(", "self", ",", "train", ",", "label", ")", ":", "self", ".", "model", ".", "fit", "(", "train", ",", "label", ",", "batch_size", "=", "BATCH_SIZE", ",", "epochs", "=", "EPOCHS", ",", "verbose", "=", "1", ",", "validation...
Trains the model from the point it was left at previously
[ "Trains", "the", "model", "from", "the", "point", "it", "was", "left", "at", "previously" ]
[ "\"\"\"\n Trains the model from the point it was left at previously\n \"\"\"", "#self.model.save(os.path.join(os.getcwd() ,'SAVED_MODELS', 'mnist_model.h5'))" ]
[ { "param": "self", "type": null }, { "param": "train", "type": null }, { "param": "label", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "train", "type": null, "docstring": null, "docstring_tokens": ...
b0e60ded5e8765a3e24d2dc0af2bf656f3d110fd
crypto-code/Udacity-Self-Driving-Car
augment.py
[ "MIT" ]
Python
batch_generator
null
def batch_generator(self, simulate_labels=False): """ Generator used to load images in batches as they are passed to the network, rather than loading them into memory all at once. :param simulate_labels: Set True to avoid loading images and only fill labels. Used for diagnostic purpo...
Generator used to load images in batches as they are passed to the network, rather than loading them into memory all at once. :param simulate_labels: Set True to avoid loading images and only fill labels. Used for diagnostic purposes. :return: A batch of (features, labels) as numpy ...
Generator used to load images in batches as they are passed to the network, rather than loading them into memory all at once.
[ "Generator", "used", "to", "load", "images", "in", "batches", "as", "they", "are", "passed", "to", "the", "network", "rather", "than", "loading", "them", "into", "memory", "all", "at", "once", "." ]
def batch_generator(self, simulate_labels=False): FLIP_ID = -1 SIDE_ID = -2 sample_map = list(range(self.n_raw_samples)) + \ [FLIP_ID] * self.n_flips + \ [SIDE_ID] * self.n_sidecam while True: sample_map = shuffle(sample_map) ...
[ "def", "batch_generator", "(", "self", ",", "simulate_labels", "=", "False", ")", ":", "FLIP_ID", "=", "-", "1", "SIDE_ID", "=", "-", "2", "sample_map", "=", "list", "(", "range", "(", "self", ".", "n_raw_samples", ")", ")", "+", "[", "FLIP_ID", "]", ...
Generator used to load images in batches as they are passed to the network, rather than loading them into memory all at once.
[ "Generator", "used", "to", "load", "images", "in", "batches", "as", "they", "are", "passed", "to", "the", "network", "rather", "than", "loading", "them", "into", "memory", "all", "at", "once", "." ]
[ "\"\"\"\r\n Generator used to load images in batches as they are passed to the network, rather than loading them into\r\n memory all at once.\r\n :param simulate_labels: Set True to avoid loading images and only fill labels. Used for diagnostic purposes.\r\n :return: A batch of (features...
[ { "param": "self", "type": null }, { "param": "simulate_labels", "type": null } ]
{ "returns": [ { "docstring": "A batch of (features, labels) as numpy arrays, ready to be passed to the network.", "docstring_tokens": [ "A", "batch", "of", "(", "features", "labels", ")", "as", "numpy", "arrays", ...
8e04aa3269e458b1ebd581f63649ae695f299d45
crypto-code/Udacity-Self-Driving-Car
train.py
[ "MIT" ]
Python
plot_history
null
def plot_history(fit_loss): """ Creates a plot for the training and validation loss of a keras history object. :param fit_loss: keras history object """ plt.plot(fit_loss.history['loss']) plt.plot(fit_loss.history['val_loss']) plt.title('Mean Squared Error Loss') plt.ylabel('mean...
Creates a plot for the training and validation loss of a keras history object. :param fit_loss: keras history object
Creates a plot for the training and validation loss of a keras history object.
[ "Creates", "a", "plot", "for", "the", "training", "and", "validation", "loss", "of", "a", "keras", "history", "object", "." ]
def plot_history(fit_loss): plt.plot(fit_loss.history['loss']) plt.plot(fit_loss.history['val_loss']) plt.title('Mean Squared Error Loss') plt.ylabel('mean squared error') plt.xlabel('epoch') plt.legend(['training set', 'validation set'], loc='upper right')
[ "def", "plot_history", "(", "fit_loss", ")", ":", "plt", ".", "plot", "(", "fit_loss", ".", "history", "[", "'loss'", "]", ")", "plt", ".", "plot", "(", "fit_loss", ".", "history", "[", "'val_loss'", "]", ")", "plt", ".", "title", "(", "'Mean Squared E...
Creates a plot for the training and validation loss of a keras history object.
[ "Creates", "a", "plot", "for", "the", "training", "and", "validation", "loss", "of", "a", "keras", "history", "object", "." ]
[ "\"\"\"\r\n Creates a plot for the training and validation loss of a keras history object.\r\n :param fit_loss: keras history object\r\n \"\"\"" ]
[ { "param": "fit_loss", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fit_loss", "type": null, "docstring": "keras history object", "docstring_tokens": [ "keras", "history", "object" ], "default": null, "is_optional": null } ], "outlier_params": ...
95abba99c9efb32d598462e99462615fe981034e
crypto-code/Udacity-Self-Driving-Car
simulator_reader.py
[ "MIT" ]
Python
read_sim_logs
<not_specific>
def read_sim_logs(csv_paths): """ Reads each `.csv` file and stores the image file paths and measurement values to a list of dictionaries. :param csv_paths: list of file paths to CSV files created by the simulator. :return: list of dictionaries containing image files and measurements from the simula...
Reads each `.csv` file and stores the image file paths and measurement values to a list of dictionaries. :param csv_paths: list of file paths to CSV files created by the simulator. :return: list of dictionaries containing image files and measurements from the simulator at each sample.
Reads each `.csv` file and stores the image file paths and measurement values to a list of dictionaries.
[ "Reads", "each", "`", ".", "csv", "`", "file", "and", "stores", "the", "image", "file", "paths", "and", "measurement", "values", "to", "a", "list", "of", "dictionaries", "." ]
def read_sim_logs(csv_paths): loaded_data = [] if not isinstance(csv_paths, list): csv_paths = [csv_paths] for i_path, path in enumerate(csv_paths): print('Loading data from "{}"...'.format(path)) with open(path, 'rt') as f: reader = csv.reader(f, delimiter=',') ...
[ "def", "read_sim_logs", "(", "csv_paths", ")", ":", "loaded_data", "=", "[", "]", "if", "not", "isinstance", "(", "csv_paths", ",", "list", ")", ":", "csv_paths", "=", "[", "csv_paths", "]", "for", "i_path", ",", "path", "in", "enumerate", "(", "csv_path...
Reads each `.csv` file and stores the image file paths and measurement values to a list of dictionaries.
[ "Reads", "each", "`", ".", "csv", "`", "file", "and", "stores", "the", "image", "file", "paths", "and", "measurement", "values", "to", "a", "list", "of", "dictionaries", "." ]
[ "\"\"\"\r\n Reads each `.csv` file and stores the image file paths and measurement values to a list of dictionaries.\r\n :param csv_paths: list of file paths to CSV files created by the simulator.\r\n :return: list of dictionaries containing image files and measurements from the simulator at each sample.\r...
[ { "param": "csv_paths", "type": null } ]
{ "returns": [ { "docstring": "list of dictionaries containing image files and measurements from the simulator at each sample.", "docstring_tokens": [ "list", "of", "dictionaries", "containing", "image", "files", "and", "measurements", ...
95abba99c9efb32d598462e99462615fe981034e
crypto-code/Udacity-Self-Driving-Car
simulator_reader.py
[ "MIT" ]
Python
probabilistic_drop
<not_specific>
def probabilistic_drop(samples, key, drop_rate, center, margin=0.01): """ Removes random selection of entries in `samples` for every entry where the value stored at `key` is within a margin of center. Ex: To remove 60% of samples that have an angle within 0.1 of zero probabilistic_drop(samples, ...
Removes random selection of entries in `samples` for every entry where the value stored at `key` is within a margin of center. Ex: To remove 60% of samples that have an angle within 0.1 of zero probabilistic_drop(samples, 'angle', 0.6, 0.0, 0.1) :return:
Removes random selection of entries in `samples` for every entry where the value stored at `key` is within a margin of center.
[ "Removes", "random", "selection", "of", "entries", "in", "`", "samples", "`", "for", "every", "entry", "where", "the", "value", "stored", "at", "`", "key", "`", "is", "within", "a", "margin", "of", "center", "." ]
def probabilistic_drop(samples, key, drop_rate, center, margin=0.01): assert 0 <= drop_rate <= 1.0, 'drop rate must be a fraction' assert margin >= 0, 'margin must be non-negative' drop_rate = int(drop_rate * 1000) return [sample for sample in samples if sample[key] > center + margin or samp...
[ "def", "probabilistic_drop", "(", "samples", ",", "key", ",", "drop_rate", ",", "center", ",", "margin", "=", "0.01", ")", ":", "assert", "0", "<=", "drop_rate", "<=", "1.0", ",", "'drop rate must be a fraction'", "assert", "margin", ">=", "0", ",", "'margin...
Removes random selection of entries in `samples` for every entry where the value stored at `key` is within a margin of center.
[ "Removes", "random", "selection", "of", "entries", "in", "`", "samples", "`", "for", "every", "entry", "where", "the", "value", "stored", "at", "`", "key", "`", "is", "within", "a", "margin", "of", "center", "." ]
[ "\"\"\"\r\n Removes random selection of entries in `samples` for every entry where the value stored at `key` is within a margin of center.\r\n Ex: To remove 60% of samples that have an angle within 0.1 of zero\r\n probabilistic_drop(samples, 'angle', 0.6, 0.0, 0.1)\r\n :return:\r\n \"\"\"" ]
[ { "param": "samples", "type": null }, { "param": "key", "type": null }, { "param": "drop_rate", "type": null }, { "param": "center", "type": null }, { "param": "margin", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "samples", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null...
17210d155d514cfde6b67177e2e11583e22ecc63
jesska-f/g2pg
g2pg/g2pg.py
[ "MIT" ]
Python
df_to_db
null
def df_to_db(df, table_name,schema=None, index_name='index'): """ Writes a DataFrame to a the specified table in the PostgreSQL database.\n If the table exisits, it will update the rows and insert new rows, otherwise it will create the table.\n This uses environment variables to access the DB. Make sure...
Writes a DataFrame to a the specified table in the PostgreSQL database.\n If the table exisits, it will update the rows and insert new rows, otherwise it will create the table.\n This uses environment variables to access the DB. Make sure your .env file contains the following (replace with the relevant dat...
Writes a DataFrame to a the specified table in the PostgreSQL database.\n If the table exisits, it will update the rows and insert new rows, otherwise it will create the table.\n This uses environment variables to access the DB. df : DataFrame The DataFrame to write to the db. Make sure your columns of of the dtype yo...
[ "Writes", "a", "DataFrame", "to", "a", "the", "specified", "table", "in", "the", "PostgreSQL", "database", ".", "\\", "n", "If", "the", "table", "exisits", "it", "will", "update", "the", "rows", "and", "insert", "new", "rows", "otherwise", "it", "will", ...
def df_to_db(df, table_name,schema=None, index_name='index'): try: engine = create_engine('postgresql://'+os.environ.get('DB_USER') +':'+os.environ.get('DB_PW')+'@'+os.environ.get('DB_URL')+'/'+ os.environ.get('DB_NAME')) except Exception as e: print(e) print('Could not establish connect...
[ "def", "df_to_db", "(", "df", ",", "table_name", ",", "schema", "=", "None", ",", "index_name", "=", "'index'", ")", ":", "try", ":", "engine", "=", "create_engine", "(", "'postgresql://'", "+", "os", ".", "environ", ".", "get", "(", "'DB_USER'", ")", ...
Writes a DataFrame to a the specified table in the PostgreSQL database.\n If the table exisits, it will update the rows and insert new rows, otherwise it will create the table.\n This uses environment variables to access the DB.
[ "Writes", "a", "DataFrame", "to", "a", "the", "specified", "table", "in", "the", "PostgreSQL", "database", ".", "\\", "n", "If", "the", "table", "exisits", "it", "will", "update", "the", "rows", "and", "insert", "new", "rows", "otherwise", "it", "will", ...
[ "\"\"\"\n Writes a DataFrame to a the specified table in the PostgreSQL database.\\n\n If the table exisits, it will update the rows and insert new rows, otherwise it will create the table.\\n\n This uses environment variables to access the DB. Make sure your .env file contains the following (replace with ...
[ { "param": "df", "type": null }, { "param": "table_name", "type": null }, { "param": "schema", "type": null }, { "param": "index_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table_name", "type": null, "docstring": null, "docstring_tokens...
b87022120f02d56a10e8caeb021ec987a4c00e77
rshane7/Sqlalchemy-Challenge
app.py
[ "ADSL" ]
Python
home
<not_specific>
def home(): """List all available api routes.""" return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/mostactivetobs<br/>" f"/api/v1.0/start/<start><br/>" f"/api/v1.0/start_date/end_date/<start_date>/<end_date>"...
List all available api routes.
List all available api routes.
[ "List", "all", "available", "api", "routes", "." ]
def home(): return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/mostactivetobs<br/>" f"/api/v1.0/start/<start><br/>" f"/api/v1.0/start_date/end_date/<start_date>/<end_date>" )
[ "def", "home", "(", ")", ":", "return", "(", "f\"Available Routes:<br/>\"", "f\"/api/v1.0/precipitation<br/>\"", "f\"/api/v1.0/stations<br/>\"", "f\"/api/v1.0/mostactivetobs<br/>\"", "f\"/api/v1.0/start/<start><br/>\"", "f\"/api/v1.0/start_date/end_date/<start_date>/<end_date>\"", ")" ]
List all available api routes.
[ "List", "all", "available", "api", "routes", "." ]
[ "\"\"\"List all available api routes.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b87022120f02d56a10e8caeb021ec987a4c00e77
rshane7/Sqlalchemy-Challenge
app.py
[ "ADSL" ]
Python
stations
<not_specific>
def stations(): """Return JSON API for all stations in dataset.""" print("Stations API request received.") # Create our session (link) from Python to the DB session = Session(engine) # Query all stations in the dataset. stations = session.query(Station.id, Station.station, Station.name, Statio...
Return JSON API for all stations in dataset.
Return JSON API for all stations in dataset.
[ "Return", "JSON", "API", "for", "all", "stations", "in", "dataset", "." ]
def stations(): print("Stations API request received.") session = Session(engine) stations = session.query(Station.id, Station.station, Station.name, Station.latitude, Station.longitude, Station.elevation).all() all_stations = [] for id, station, name, latitude, longitude, elevation in stations: ...
[ "def", "stations", "(", ")", ":", "print", "(", "\"Stations API request received.\"", ")", "session", "=", "Session", "(", "engine", ")", "stations", "=", "session", ".", "query", "(", "Station", ".", "id", ",", "Station", ".", "station", ",", "Station", "...
Return JSON API for all stations in dataset.
[ "Return", "JSON", "API", "for", "all", "stations", "in", "dataset", "." ]
[ "\"\"\"Return JSON API for all stations in dataset.\"\"\"", "# Create our session (link) from Python to the DB", "# Query all stations in the dataset.", "# Iterate through stations to append all key/values to station dictionary.", "# Append station dictionary to list, then return jsonify. " ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b87022120f02d56a10e8caeb021ec987a4c00e77
rshane7/Sqlalchemy-Challenge
app.py
[ "ADSL" ]
Python
calc_start_temps
<not_specific>
def calc_start_temps(start): """Return a JSON API of the minimum temperature, the average temperature, and the max temperature... for all dates greater than and equal to the start date.""" print("Calculate Start Temps. API request received.") # Create our session (link) from Python to the DB s...
Return a JSON API of the minimum temperature, the average temperature, and the max temperature... for all dates greater than and equal to the start date.
Return a JSON API of the minimum temperature, the average temperature, and the max temperature for all dates greater than and equal to the start date.
[ "Return", "a", "JSON", "API", "of", "the", "minimum", "temperature", "the", "average", "temperature", "and", "the", "max", "temperature", "for", "all", "dates", "greater", "than", "and", "equal", "to", "the", "start", "date", "." ]
def calc_start_temps(start): print("Calculate Start Temps. API request received.") session = Session(engine) start_temps = session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\ filter(Measurement.date >= start).all() all_start_calc_temps = [] for...
[ "def", "calc_start_temps", "(", "start", ")", ":", "print", "(", "\"Calculate Start Temps. API request received.\"", ")", "session", "=", "Session", "(", "engine", ")", "start_temps", "=", "session", ".", "query", "(", "func", ".", "min", "(", "Measurement", "."...
Return a JSON API of the minimum temperature, the average temperature, and the max temperature... for all dates greater than and equal to the start date.
[ "Return", "a", "JSON", "API", "of", "the", "minimum", "temperature", "the", "average", "temperature", "and", "the", "max", "temperature", "...", "for", "all", "dates", "greater", "than", "and", "equal", "to", "the", "start", "date", "." ]
[ "\"\"\"Return a JSON API of the minimum temperature, the average temperature, and the max temperature...\n for all dates greater than and equal to the start date.\"\"\"", "# Create our session (link) from Python to the DB", "# Query will accept start date in the format '%Y-%m-%d' and return the minimum, aver...
[ { "param": "start", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "start", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
help
null
def help(command): # this comes first to make it easy to spot ''' Usage: help <command> - provide some information for the command ''' for i, v in ByPy.__dict__.items(): if callable(v) and v.__doc__ and v.__name__ == command : help = v.__doc__.strip() pos = help.find(const.HelpMarker) if pos != -1: ...
Usage: help <command> - provide some information for the command
help - provide some information for the command
[ "help", "-", "provide", "some", "information", "for", "the", "command" ]
def help(command): for i, v in ByPy.__dict__.items(): if callable(v) and v.__doc__ and v.__name__ == command : help = v.__doc__.strip() pos = help.find(const.HelpMarker) if pos != -1: pr("Usage: " + help[pos + len(const.HelpMarker):].strip())
[ "def", "help", "(", "command", ")", ":", "for", "i", ",", "v", "in", "ByPy", ".", "__dict__", ".", "items", "(", ")", ":", "if", "callable", "(", "v", ")", "and", "v", ".", "__doc__", "and", "v", ".", "__name__", "==", "command", ":", "help", "...
Usage: help <command> - provide some information for the command
[ "Usage", ":", "help", "<command", ">", "-", "provide", "some", "information", "for", "the", "command" ]
[ "# this comes first to make it easy to spot", "''' Usage: help <command> - provide some information for the command '''" ]
[ { "param": "command", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "command", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
download
<not_specific>
def download(self, remotepath = '/', localpath = ''): ''' Usage: download [remotepath] [localpath] - \ download a remote directory (recursively) / file remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun localpath - local path. if not sp...
Usage: download [remotepath] [localpath] - \ download a remote directory (recursively) / file remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun localpath - local path. if not specified, it is set to the current directory
download [remotepath] [localpath] - \ download a remote directory (recursively) / file remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun localpath - local path. if not specified, it is set to the current directory
[ "download", "[", "remotepath", "]", "[", "localpath", "]", "-", "\\", "download", "a", "remote", "directory", "(", "recursively", ")", "/", "file", "remotepath", "-", "remote", "path", "at", "Baidu", "Yun", "(", "after", "app", "root", "directory", ")", ...
def download(self, remotepath = '/', localpath = ''): subr = self.get_file_info(remotepath) if const.ENoError == subr: if 'isdir' in self.__remote_json: if self.__remote_json['isdir']: return self.downdir(remotepath, localpath) else: return self.downfile(remotepath, localpath) else: perr...
[ "def", "download", "(", "self", ",", "remotepath", "=", "'/'", ",", "localpath", "=", "''", ")", ":", "subr", "=", "self", ".", "get_file_info", "(", "remotepath", ")", "if", "const", ".", "ENoError", "==", "subr", ":", "if", "'isdir'", "in", "self", ...
Usage: download [remotepath] [localpath] - \ download a remote directory (recursively) / file remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun localpath - local path.
[ "Usage", ":", "download", "[", "remotepath", "]", "[", "localpath", "]", "-", "\\", "download", "a", "remote", "directory", "(", "recursively", ")", "/", "file", "remotepath", "-", "remote", "path", "at", "Baidu", "Yun", "(", "after", "app", "root", "dir...
[ "''' Usage: download [remotepath] [localpath] - \\\ndownload a remote directory (recursively) / file\n remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun\n localpath - local path. if not specified, it is set to the current directory\n\t...
[ { "param": "self", "type": null }, { "param": "remotepath", "type": null }, { "param": "localpath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "remotepath", "type": null, "docstring": null, "docstring_toke...
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
compare
<not_specific>
def compare(self, remotedir = None, localdir = None, skip_remote_only_dirs = False): ''' Usage: compare [remotedir] [localdir] - \ compare the remote directory with the local directory remotedir - the remote directory at Baidu Yun (after app's directory). \ if not specified, it defaults to the root directory. loc...
Usage: compare [remotedir] [localdir] - \ compare the remote directory with the local directory remotedir - the remote directory at Baidu Yun (after app's directory). \ if not specified, it defaults to the root directory. localdir - the local directory, if not specified, it defaults to the current directory. ski...
compare [remotedir] [localdir] - \ compare the remote directory with the local directory remotedir - the remote directory at Baidu Yun (after app's directory). \ if not specified, it defaults to the root directory. localdir - the local directory, if not specified, it defaults to the current directory. skip_remote_only_...
[ "compare", "[", "remotedir", "]", "[", "localdir", "]", "-", "\\", "compare", "the", "remote", "directory", "with", "the", "local", "directory", "remotedir", "-", "the", "remote", "directory", "at", "Baidu", "Yun", "(", "after", "app", "'", "s", "directory...
def compare(self, remotedir = None, localdir = None, skip_remote_only_dirs = False): same, diff, local, remote = self.__compare(get_pcs_path(remotedir), localdir, str2bool(skip_remote_only_dirs)) pr("==== Same files ===") for c in same: pr("{} - {}".format(c[0], c[1])) pr("==== Different files ===") for d ...
[ "def", "compare", "(", "self", ",", "remotedir", "=", "None", ",", "localdir", "=", "None", ",", "skip_remote_only_dirs", "=", "False", ")", ":", "same", ",", "diff", ",", "local", ",", "remote", "=", "self", ".", "__compare", "(", "get_pcs_path", "(", ...
Usage: compare [remotedir] [localdir] - \ compare the remote directory with the local directory remotedir - the remote directory at Baidu Yun (after app's directory).
[ "Usage", ":", "compare", "[", "remotedir", "]", "[", "localdir", "]", "-", "\\", "compare", "the", "remote", "directory", "with", "the", "local", "directory", "remotedir", "-", "the", "remote", "directory", "at", "Baidu", "Yun", "(", "after", "app", "'", ...
[ "''' Usage: compare [remotedir] [localdir] - \\\ncompare the remote directory with the local directory\n remotedir - the remote directory at Baidu Yun (after app's directory). \\\nif not specified, it defaults to the root directory.\n localdir - the local directory, if not specified, it defaults to the current di...
[ { "param": "self", "type": null }, { "param": "remotedir", "type": null }, { "param": "localdir", "type": null }, { "param": "skip_remote_only_dirs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "remotedir", "type": null, "docstring": null, "docstring_token...
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
syncdown
<not_specific>
def syncdown(self, remotedir = '', localdir = '', deletelocal = False): ''' Usage: syncdown [remotedir] [localdir] [deletelocal] - \ sync down from the remote directory to the local directory remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \ if not specified, it defaults to the r...
Usage: syncdown [remotedir] [localdir] [deletelocal] - \ sync down from the remote directory to the local directory remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \ if not specified, it defaults to the root directory localdir - the local directory to sync to if not specified, i...
syncdown [remotedir] [localdir] [deletelocal] - \ sync down from the remote directory to the local directory remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \ if not specified, it defaults to the root directory localdir - the local directory to sync to if not specified, it defaults t...
[ "syncdown", "[", "remotedir", "]", "[", "localdir", "]", "[", "deletelocal", "]", "-", "\\", "sync", "down", "from", "the", "remote", "directory", "to", "the", "local", "directory", "remotedir", "-", "the", "remote", "directory", "at", "Baidu", "Yun", "(",...
def syncdown(self, remotedir = '', localdir = '', deletelocal = False): result = const.ENoError rpath = get_pcs_path(remotedir) compare_result = self.__compare(rpath, localdir, False) same, diff, local, remote = compare_result if Pool and self.processes > 1: subresult = self.__syncdown_multi(rpath, localdi...
[ "def", "syncdown", "(", "self", ",", "remotedir", "=", "''", ",", "localdir", "=", "''", ",", "deletelocal", "=", "False", ")", ":", "result", "=", "const", ".", "ENoError", "rpath", "=", "get_pcs_path", "(", "remotedir", ")", "compare_result", "=", "sel...
Usage: syncdown [remotedir] [localdir] [deletelocal] - \ sync down from the remote directory to the local directory remotedir - the remote directory at Baidu Yun (after app's directory) to sync from.
[ "Usage", ":", "syncdown", "[", "remotedir", "]", "[", "localdir", "]", "[", "deletelocal", "]", "-", "\\", "sync", "down", "from", "the", "remote", "directory", "to", "the", "local", "directory", "remotedir", "-", "the", "remote", "directory", "at", "Baidu...
[ "''' Usage: syncdown [remotedir] [localdir] [deletelocal] - \\\nsync down from the remote directory to the local directory\n remotedir - the remote directory at Baidu Yun (after app's directory) to sync from. \\\nif not specified, it defaults to the root directory\n localdir - the local directory to sync to if no...
[ { "param": "self", "type": null }, { "param": "remotedir", "type": null }, { "param": "localdir", "type": null }, { "param": "deletelocal", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "remotedir", "type": null, "docstring": null, "docstring_token...
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
syncup
<not_specific>
def syncup(self, localdir = '', remotedir = '', deleteremote = False): ''' Usage: syncup [localdir] [remotedir] [deleteremote] - \ sync up from the local directory to the remote directory localdir - the local directory to sync from if not specified, it defaults to the current directory. remotedir - the remote dir...
Usage: syncup [localdir] [remotedir] [deleteremote] - \ sync up from the local directory to the remote directory localdir - the local directory to sync from if not specified, it defaults to the current directory. remotedir - the remote directory at Baidu Yun (after app's directory) to sync to. \ if not specified, ...
syncup [localdir] [remotedir] [deleteremote] - \ sync up from the local directory to the remote directory localdir - the local directory to sync from if not specified, it defaults to the current directory. remotedir - the remote directory at Baidu Yun (after app's directory) to sync to. \ if not specified, it defaults ...
[ "syncup", "[", "localdir", "]", "[", "remotedir", "]", "[", "deleteremote", "]", "-", "\\", "sync", "up", "from", "the", "local", "directory", "to", "the", "remote", "directory", "localdir", "-", "the", "local", "directory", "to", "sync", "from", "if", "...
def syncup(self, localdir = '', remotedir = '', deleteremote = False): result = const.ENoError rpath = get_pcs_path(remotedir) compare_result = self.__compare(rpath, localdir, True) same, diff, local, remote = compare_result if Pool and self.processes > 1: subresult = self.__syncup_multi(localdir, rpath, c...
[ "def", "syncup", "(", "self", ",", "localdir", "=", "''", ",", "remotedir", "=", "''", ",", "deleteremote", "=", "False", ")", ":", "result", "=", "const", ".", "ENoError", "rpath", "=", "get_pcs_path", "(", "remotedir", ")", "compare_result", "=", "self...
Usage: syncup [localdir] [remotedir] [deleteremote] - \ sync up from the local directory to the remote directory localdir - the local directory to sync from if not specified, it defaults to the current directory.
[ "Usage", ":", "syncup", "[", "localdir", "]", "[", "remotedir", "]", "[", "deleteremote", "]", "-", "\\", "sync", "up", "from", "the", "local", "directory", "to", "the", "remote", "directory", "localdir", "-", "the", "local", "directory", "to", "sync", "...
[ "''' Usage: syncup [localdir] [remotedir] [deleteremote] - \\\nsync up from the local directory to the remote directory\n localdir - the local directory to sync from if not specified, it defaults to the current directory.\n remotedir - the remote directory at Baidu Yun (after app's directory) to sync to. \\\nif n...
[ { "param": "self", "type": null }, { "param": "localdir", "type": null }, { "param": "remotedir", "type": null }, { "param": "deleteremote", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "localdir", "type": null, "docstring": null, "docstring_tokens...
b3aa134c7ba3a80eca03451bf5d7a0cf5acbc2f3
eaglexmw-gmail/bypy
bypy/bypy.py
[ "MIT" ]
Python
cleancache
<not_specific>
def cleancache(self): ''' Usage: cleancache - remove invalid entries from hash cache file''' if os.path.exists(self.__hashcachepath): try: # backup first backup = self.__hashcachepath + '.lastclean' shutil.copy(self.__hashcachepath, backup) self.pd("Hash Cache file '{}' backed up as '{}".format( ...
Usage: cleancache - remove invalid entries from hash cache file
remove invalid entries from hash cache file
[ "remove", "invalid", "entries", "from", "hash", "cache", "file" ]
def cleancache(self): if os.path.exists(self.__hashcachepath): try: backup = self.__hashcachepath + '.lastclean' shutil.copy(self.__hashcachepath, backup) self.pd("Hash Cache file '{}' backed up as '{}".format( self.__hashcachepath, backup)) cached.cleancache() return const.ENoError exc...
[ "def", "cleancache", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "__hashcachepath", ")", ":", "try", ":", "backup", "=", "self", ".", "__hashcachepath", "+", "'.lastclean'", "shutil", ".", "copy", "(", "self", ".", ...
Usage: cleancache - remove invalid entries from hash cache file
[ "Usage", ":", "cleancache", "-", "remove", "invalid", "entries", "from", "hash", "cache", "file" ]
[ "''' Usage: cleancache - remove invalid entries from hash cache file'''", "# backup first" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dc6e2bcba69080809701c44c55ad97ed4a52d7d7
H2u-Hwng/CodinGame
Compete/Class of Code/attack_on_cyclops.py
[ "MIT" ]
Python
create_dict
<not_specific>
def create_dict(): ''' Create a dictionary including the roles and their damages. ''' n = int(input('Enter the number of your party members: ')) party = {} # initialize a dictionary named party for _ in range(n): # prompt the user for the role and its damage inputs = input('En...
Create a dictionary including the roles and their damages.
Create a dictionary including the roles and their damages.
[ "Create", "a", "dictionary", "including", "the", "roles", "and", "their", "damages", "." ]
def create_dict(): n = int(input('Enter the number of your party members: ')) party = {} for _ in range(n): inputs = input('Enter the role and its nominal damage (separated by a space): ').split() role = inputs[0] damage = float(inputs[1]) party[damage] = role return par...
[ "def", "create_dict", "(", ")", ":", "n", "=", "int", "(", "input", "(", "'Enter the number of your party members: '", ")", ")", "party", "=", "{", "}", "for", "_", "in", "range", "(", "n", ")", ":", "inputs", "=", "input", "(", "'Enter the role and its no...
Create a dictionary including the roles and their damages.
[ "Create", "a", "dictionary", "including", "the", "roles", "and", "their", "damages", "." ]
[ "''' Create a dictionary including the roles and their damages. '''", "# initialize a dictionary named party", "# prompt the user for the role and its damage" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d649a6a63784b0e500cdcc062a4bc9ef70a583d4
sierra-moxon/agr_loader
src/etl/gene_descriptions_etl.py
[ "MIT" ]
Python
add_neo_term_to_ontobio_ontology_if_not_exists
null
def add_neo_term_to_ontobio_ontology_if_not_exists(term_id, term_label, term_type, is_obsolete, ontology): """Add NEO Term to Ontobio Ontology If Not Exists.""" if not ontology.has_node(term_id) and term_label: if is_obsolete in ["true",...
Add NEO Term to Ontobio Ontology If Not Exists.
Add NEO Term to Ontobio Ontology If Not Exists.
[ "Add", "NEO", "Term", "to", "Ontobio", "Ontology", "If", "Not", "Exists", "." ]
def add_neo_term_to_ontobio_ontology_if_not_exists(term_id, term_label, term_type, is_obsolete, ontology): if not ontology.has_node(term_id) and term_label: if is_obsolete in ["true", "True"]: meta = {"deprecated": True, "basicPr...
[ "def", "add_neo_term_to_ontobio_ontology_if_not_exists", "(", "term_id", ",", "term_label", ",", "term_type", ",", "is_obsolete", ",", "ontology", ")", ":", "if", "not", "ontology", ".", "has_node", "(", "term_id", ")", "and", "term_label", ":", "if", "is_obsolete...
Add NEO Term to Ontobio Ontology If Not Exists.
[ "Add", "NEO", "Term", "to", "Ontobio", "Ontology", "If", "Not", "Exists", "." ]
[ "\"\"\"Add NEO Term to Ontobio Ontology If Not Exists.\"\"\"" ]
[ { "param": "term_id", "type": null }, { "param": "term_label", "type": null }, { "param": "term_type", "type": null }, { "param": "is_obsolete", "type": null }, { "param": "ontology", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "term_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "term_label", "type": null, "docstring": null, "docstring_t...
c387e732987a3927ccd61c6104099ab688ef5aff
sierra-moxon/agr_loader
src/etl/affected_genomic_model_etl.py
[ "MIT" ]
Python
genmod_process
<not_specific>
def genmod_process(self, components, agm_record): """Process affected genomic Model components.""" if agm_record.get('affectedGenomicModelComponents') is None: return for component in agm_record.get('affectedGenomicModelComponents'): component_dataset = { ...
Process affected genomic Model components.
Process affected genomic Model components.
[ "Process", "affected", "genomic", "Model", "components", "." ]
def genmod_process(self, components, agm_record): if agm_record.get('affectedGenomicModelComponents') is None: return for component in agm_record.get('affectedGenomicModelComponents'): component_dataset = { "primaryId": agm_record.get('primaryID'), ...
[ "def", "genmod_process", "(", "self", ",", "components", ",", "agm_record", ")", ":", "if", "agm_record", ".", "get", "(", "'affectedGenomicModelComponents'", ")", "is", "None", ":", "return", "for", "component", "in", "agm_record", ".", "get", "(", "'affected...
Process affected genomic Model components.
[ "Process", "affected", "genomic", "Model", "components", "." ]
[ "\"\"\"Process affected genomic Model components.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "components", "type": null }, { "param": "agm_record", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "components", "type": null, "docstring": null, "docstring_toke...
fdc5a23e8806272293b544fa0371b0e310e80e27
sierra-moxon/agr_loader
src/etl/helpers/etl_helper.py
[ "MIT" ]
Python
species_name_lookup
<not_specific>
def species_name_lookup(self, alt_key): """Lookup species name using some key. alt_key: can be things like Taxon_id, (i.e. NCBITaxon:9606 or 9606) any case mod name (i.e. Rgd, RGD), common names (i.e. rat, rno) """ species_name = None try: ...
Lookup species name using some key. alt_key: can be things like Taxon_id, (i.e. NCBITaxon:9606 or 9606) any case mod name (i.e. Rgd, RGD), common names (i.e. rat, rno)
Lookup species name using some key. alt_key: can be things like Taxon_id, any case mod name , common names
[ "Lookup", "species", "name", "using", "some", "key", ".", "alt_key", ":", "can", "be", "things", "like", "Taxon_id", "any", "case", "mod", "name", "common", "names" ]
def species_name_lookup(self, alt_key): species_name = None try: species_name = self.rdh2.get_full_name_from_key(alt_key) except KeyError: self.logger.critical("Could not find species name for %s", alt_key) return species_name
[ "def", "species_name_lookup", "(", "self", ",", "alt_key", ")", ":", "species_name", "=", "None", "try", ":", "species_name", "=", "self", ".", "rdh2", ".", "get_full_name_from_key", "(", "alt_key", ")", "except", "KeyError", ":", "self", ".", "logger", ".",...
Lookup species name using some key.
[ "Lookup", "species", "name", "using", "some", "key", "." ]
[ "\"\"\"Lookup species name using some key.\n\n alt_key: can be things like Taxon_id, (i.e. NCBITaxon:9606 or 9606)\n any case mod name (i.e. Rgd, RGD),\n common names (i.e. rat, rno)\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "alt_key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "alt_key", "type": null, "docstring": null, "docstring_tokens"...
fdc5a23e8806272293b544fa0371b0e310e80e27
sierra-moxon/agr_loader
src/etl/helpers/etl_helper.py
[ "MIT" ]
Python
add_agr_prefix_by_species_taxon
<not_specific>
def add_agr_prefix_by_species_taxon(identifier, taxon_id): """Add AGR prefix by Species Taxon.""" species_dict = { 7955: 'ZFIN:', 6239: 'WB:', 10090: '', # No MGI prefix 10116: '', # No RGD prefix 559292: 'SGD:', 4932: 'SGD:', ...
Add AGR prefix by Species Taxon.
Add AGR prefix by Species Taxon.
[ "Add", "AGR", "prefix", "by", "Species", "Taxon", "." ]
def add_agr_prefix_by_species_taxon(identifier, taxon_id): species_dict = { 7955: 'ZFIN:', 6239: 'WB:', 10090: '', 10116: '', 559292: 'SGD:', 4932: 'SGD:', 7227: 'FB:', 9606: '', 2697049: '' ...
[ "def", "add_agr_prefix_by_species_taxon", "(", "identifier", ",", "taxon_id", ")", ":", "species_dict", "=", "{", "7955", ":", "'ZFIN:'", ",", "6239", ":", "'WB:'", ",", "10090", ":", "''", ",", "10116", ":", "''", ",", "559292", ":", "'SGD:'", ",", "493...
Add AGR prefix by Species Taxon.
[ "Add", "AGR", "prefix", "by", "Species", "Taxon", "." ]
[ "\"\"\"Add AGR prefix by Species Taxon.\"\"\"", "# No MGI prefix", "# No RGD prefix", "# No HGNC prefix", "# No SARS-CoV-2 prefix" ]
[ { "param": "identifier", "type": null }, { "param": "taxon_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "identifier", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "taxon_id", "type": null, "docstring": null, "docstring_...
92904887b3a76ec89a91922d33d0d6358bf7f302
sierra-moxon/agr_loader
src/etl/bgi_etl.py
[ "MIT" ]
Python
locations_process
<not_specific>
def locations_process(self, basic_genetic_entity, chromosomes, genomic_locations): """Get chromosome and genomic location info.""" primary_id = basic_genetic_entity.get('primaryId') if 'genomeLocations' not in basic_genetic_entity: return for genome_location in basic_genetic...
Get chromosome and genomic location info.
Get chromosome and genomic location info.
[ "Get", "chromosome", "and", "genomic", "location", "info", "." ]
def locations_process(self, basic_genetic_entity, chromosomes, genomic_locations): primary_id = basic_genetic_entity.get('primaryId') if 'genomeLocations' not in basic_genetic_entity: return for genome_location in basic_genetic_entity.get('genomeLocations'): chromosome = ...
[ "def", "locations_process", "(", "self", ",", "basic_genetic_entity", ",", "chromosomes", ",", "genomic_locations", ")", ":", "primary_id", "=", "basic_genetic_entity", ".", "get", "(", "'primaryId'", ")", "if", "'genomeLocations'", "not", "in", "basic_genetic_entity"...
Get chromosome and genomic location info.
[ "Get", "chromosome", "and", "genomic", "location", "info", "." ]
[ "\"\"\"Get chromosome and genomic location info.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "basic_genetic_entity", "type": null }, { "param": "chromosomes", "type": null }, { "param": "genomic_locations", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "basic_genetic_entity", "type": null, "docstring": null, "docs...
d6d412b4ebdb8cd15d7ceaa5917fc0dc5074d1fa
bjoernrost/training-data-analyst
blogs/tf_dataflow_serving/model/inference.py
[ "Apache-2.0" ]
Python
init_predictor
null
def init_predictor(): """ Loads the TensorFlow saved model to the predictor object Returns: predictor_fn """ global predictor_fn if predictor_fn is None: logging.info("Initialising predictor...") dir_path = os.path.dirname(os.path.realpath(__file__)) export_dir = ...
Loads the TensorFlow saved model to the predictor object Returns: predictor_fn
Loads the TensorFlow saved model to the predictor object
[ "Loads", "the", "TensorFlow", "saved", "model", "to", "the", "predictor", "object" ]
def init_predictor(): global predictor_fn if predictor_fn is None: logging.info("Initialising predictor...") dir_path = os.path.dirname(os.path.realpath(__file__)) export_dir = os.path.join(dir_path, SAVED_MODEL_DIR) if os.path.exists(export_dir): predictor_fn = tf.co...
[ "def", "init_predictor", "(", ")", ":", "global", "predictor_fn", "if", "predictor_fn", "is", "None", ":", "logging", ".", "info", "(", "\"Initialising predictor...\"", ")", "dir_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "...
Loads the TensorFlow saved model to the predictor object
[ "Loads", "the", "TensorFlow", "saved", "model", "to", "the", "predictor", "object" ]
[ "\"\"\" Loads the TensorFlow saved model to the predictor object\n\n Returns:\n predictor_fn\n \"\"\"" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
d6d412b4ebdb8cd15d7ceaa5917fc0dc5074d1fa
bjoernrost/training-data-analyst
blogs/tf_dataflow_serving/model/inference.py
[ "Apache-2.0" ]
Python
estimate_local
<not_specific>
def estimate_local(instances): """ Calls the local babyweight estimator to get predictions Args: instances: list of json objects Returns: int - estimated baby weight """ init_predictor() inputs = dict((k, [v]) for k, v in instances[0].items()) for i in range(1,len(insta...
Calls the local babyweight estimator to get predictions Args: instances: list of json objects Returns: int - estimated baby weight
Calls the local babyweight estimator to get predictions
[ "Calls", "the", "local", "babyweight", "estimator", "to", "get", "predictions" ]
def estimate_local(instances): init_predictor() inputs = dict((k, [v]) for k, v in instances[0].items()) for i in range(1,len(instances)): instance = instances[i] for k, v in instance.items(): inputs[k] += [v] values = predictor_fn(inputs)['predictions'] return [value.ite...
[ "def", "estimate_local", "(", "instances", ")", ":", "init_predictor", "(", ")", "inputs", "=", "dict", "(", "(", "k", ",", "[", "v", "]", ")", "for", "k", ",", "v", "in", "instances", "[", "0", "]", ".", "items", "(", ")", ")", "for", "i", "in...
Calls the local babyweight estimator to get predictions
[ "Calls", "the", "local", "babyweight", "estimator", "to", "get", "predictions" ]
[ "\"\"\"\n Calls the local babyweight estimator to get predictions\n\n Args:\n instances: list of json objects\n Returns:\n int - estimated baby weight\n \"\"\"" ]
[ { "param": "instances", "type": null } ]
{ "returns": [ { "docstring": "estimated baby weight", "docstring_tokens": [ "estimated", "baby", "weight" ], "type": null } ], "raises": [], "params": [ { "identifier": "instances", "type": null, "docstring": "list of json objects", ...
d6d412b4ebdb8cd15d7ceaa5917fc0dc5074d1fa
bjoernrost/training-data-analyst
blogs/tf_dataflow_serving/model/inference.py
[ "Apache-2.0" ]
Python
estimate_cmle
<not_specific>
def estimate_cmle(instances): """ Calls the babyweight estimator API on CMLE to get predictions Args: instances: list of json objects Returns: int - estimated baby weight """ init_api() request_data = {'instances': instances} model_url = 'projects/{}/models/{}/versions/...
Calls the babyweight estimator API on CMLE to get predictions Args: instances: list of json objects Returns: int - estimated baby weight
Calls the babyweight estimator API on CMLE to get predictions
[ "Calls", "the", "babyweight", "estimator", "API", "on", "CMLE", "to", "get", "predictions" ]
def estimate_cmle(instances): init_api() request_data = {'instances': instances} model_url = 'projects/{}/models/{}/versions/{}'.format(PROJECT, CMLE_MODEL_NAME, CMLE_MODEL_VERSION) response = cmle_api.projects().predict(body=request_data, name=model_url).execute() values = [item["predictions"][0] f...
[ "def", "estimate_cmle", "(", "instances", ")", ":", "init_api", "(", ")", "request_data", "=", "{", "'instances'", ":", "instances", "}", "model_url", "=", "'projects/{}/models/{}/versions/{}'", ".", "format", "(", "PROJECT", ",", "CMLE_MODEL_NAME", ",", "CMLE_MOD...
Calls the babyweight estimator API on CMLE to get predictions
[ "Calls", "the", "babyweight", "estimator", "API", "on", "CMLE", "to", "get", "predictions" ]
[ "\"\"\"\n Calls the babyweight estimator API on CMLE to get predictions\n\n Args:\n instances: list of json objects\n Returns:\n int - estimated baby weight\n \"\"\"" ]
[ { "param": "instances", "type": null } ]
{ "returns": [ { "docstring": "estimated baby weight", "docstring_tokens": [ "estimated", "baby", "weight" ], "type": null } ], "raises": [], "params": [ { "identifier": "instances", "type": null, "docstring": "list of json objects", ...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
read_analogies
null
def read_analogies(self): """Reads through the analogy question file. Returns: questions: a [n, 4] numpy array containing the analogy question's word ids. questions_skipped: questions skipped due to unknown words. """ questions = [] questions_skipped = 0 with open(s...
Reads through the analogy question file. Returns: questions: a [n, 4] numpy array containing the analogy question's word ids. questions_skipped: questions skipped due to unknown words.
Reads through the analogy question file.
[ "Reads", "through", "the", "analogy", "question", "file", "." ]
def read_analogies(self): questions = [] questions_skipped = 0 with open(self._options.eval_data, "rb") as analogy_f: for line in analogy_f: if line.startswith(b":"): continue words = line.strip().lower().split(b" ") ids = [self._word2id.get(w.strip()) for w in word...
[ "def", "read_analogies", "(", "self", ")", ":", "questions", "=", "[", "]", "questions_skipped", "=", "0", "with", "open", "(", "self", ".", "_options", ".", "eval_data", ",", "\"rb\"", ")", "as", "analogy_f", ":", "for", "line", "in", "analogy_f", ":", ...
Reads through the analogy question file.
[ "Reads", "through", "the", "analogy", "question", "file", "." ]
[ "\"\"\"Reads through the analogy question file.\n\n Returns:\n questions: a [n, 4] numpy array containing the analogy question's\n word ids.\n questions_skipped: questions skipped due to unknown words.\n \"\"\"", "# Skip comments." ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "a [n, 4] numpy array containing the analogy question's\nword ids.\nquestions_skipped: questions skipped due to unknown words.", "docstring_tokens": [ "a", "[", "n", "4", "]", "numpy", "array", "containing", ...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
forward
<not_specific>
def forward(self, examples, labels): """Build the graph for the forward pass.""" opts = self._options # Declare all variables we need. # Embedding: [vocab_size, emb_dim] init_width = 0.5 / opts.emb_dim emb = tf.Variable( tf.random_uniform( [opts.vocab_size, opts.emb_dim], -i...
Build the graph for the forward pass.
Build the graph for the forward pass.
[ "Build", "the", "graph", "for", "the", "forward", "pass", "." ]
def forward(self, examples, labels): opts = self._options init_width = 0.5 / opts.emb_dim emb = tf.Variable( tf.random_uniform( [opts.vocab_size, opts.emb_dim], -init_width, init_width), name="emb") self._emb = emb sm_w_t = tf.Variable( tf.zeros([opts.vocab_size, ...
[ "def", "forward", "(", "self", ",", "examples", ",", "labels", ")", ":", "opts", "=", "self", ".", "_options", "init_width", "=", "0.5", "/", "opts", ".", "emb_dim", "emb", "=", "tf", ".", "Variable", "(", "tf", ".", "random_uniform", "(", "[", "opts...
Build the graph for the forward pass.
[ "Build", "the", "graph", "for", "the", "forward", "pass", "." ]
[ "\"\"\"Build the graph for the forward pass.\"\"\"", "# Declare all variables we need.", "# Embedding: [vocab_size, emb_dim]", "# Softmax weight: [vocab_size, emb_dim]. Transposed.", "# Softmax bias: [vocab_size].", "# Global step: scalar, i.e., shape [].", "# Nodes to compute the nce loss w/ candidate ...
[ { "param": "self", "type": null }, { "param": "examples", "type": null }, { "param": "labels", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "examples", "type": null, "docstring": null, "docstring_tokens...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
nce_loss
<not_specific>
def nce_loss(self, true_logits, sampled_logits): """Build the graph for the NCE loss.""" # cross-entropy(logits, labels) opts = self._options true_xent = tf.nn.sigmoid_cross_entropy_with_logits( labels=tf.ones_like(true_logits), logits=true_logits) sampled_xent = tf.nn.sigmoid_cross_entropy...
Build the graph for the NCE loss.
Build the graph for the NCE loss.
[ "Build", "the", "graph", "for", "the", "NCE", "loss", "." ]
def nce_loss(self, true_logits, sampled_logits): opts = self._options true_xent = tf.nn.sigmoid_cross_entropy_with_logits( labels=tf.ones_like(true_logits), logits=true_logits) sampled_xent = tf.nn.sigmoid_cross_entropy_with_logits( labels=tf.zeros_like(sampled_logits), logits=sampled_logits...
[ "def", "nce_loss", "(", "self", ",", "true_logits", ",", "sampled_logits", ")", ":", "opts", "=", "self", ".", "_options", "true_xent", "=", "tf", ".", "nn", ".", "sigmoid_cross_entropy_with_logits", "(", "labels", "=", "tf", ".", "ones_like", "(", "true_log...
Build the graph for the NCE loss.
[ "Build", "the", "graph", "for", "the", "NCE", "loss", "." ]
[ "\"\"\"Build the graph for the NCE loss.\"\"\"", "# cross-entropy(logits, labels)", "# NCE-loss is the sum of the true and noise (sampled words)", "# contributions, averaged over the batch." ]
[ { "param": "self", "type": null }, { "param": "true_logits", "type": null }, { "param": "sampled_logits", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "true_logits", "type": null, "docstring": null, "docstring_tok...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
optimize
null
def optimize(self, loss): """Build the graph to optimize the loss function.""" # Optimizer nodes. # Linear learning rate decay. opts = self._options words_to_train = float(opts.words_per_epoch * opts.epochs_to_train) lr = opts.learning_rate * tf.maximum( 0.0001, 1.0 - tf.cast(self._word...
Build the graph to optimize the loss function.
Build the graph to optimize the loss function.
[ "Build", "the", "graph", "to", "optimize", "the", "loss", "function", "." ]
def optimize(self, loss): opts = self._options words_to_train = float(opts.words_per_epoch * opts.epochs_to_train) lr = opts.learning_rate * tf.maximum( 0.0001, 1.0 - tf.cast(self._words, tf.float32) / words_to_train) self._lr = lr optimizer = tf.train.GradientDescentOptimizer(lr) train ...
[ "def", "optimize", "(", "self", ",", "loss", ")", ":", "opts", "=", "self", ".", "_options", "words_to_train", "=", "float", "(", "opts", ".", "words_per_epoch", "*", "opts", ".", "epochs_to_train", ")", "lr", "=", "opts", ".", "learning_rate", "*", "tf"...
Build the graph to optimize the loss function.
[ "Build", "the", "graph", "to", "optimize", "the", "loss", "function", "." ]
[ "\"\"\"Build the graph to optimize the loss function.\"\"\"", "# Optimizer nodes.", "# Linear learning rate decay." ]
[ { "param": "self", "type": null }, { "param": "loss", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "loss", "type": null, "docstring": null, "docstring_tokens": [...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
build_graph
null
def build_graph(self): """Build the graph for the full model.""" opts = self._options # The training data. A text file. (words, counts, words_per_epoch, self._epoch, self._words, examples, labels) = word2vec.skipgram_word2vec(filename=opts.train_data, batch...
Build the graph for the full model.
Build the graph for the full model.
[ "Build", "the", "graph", "for", "the", "full", "model", "." ]
def build_graph(self): opts = self._options (words, counts, words_per_epoch, self._epoch, self._words, examples, labels) = word2vec.skipgram_word2vec(filename=opts.train_data, batch_size=opts.batch_size, window_size=opts.wi...
[ "def", "build_graph", "(", "self", ")", ":", "opts", "=", "self", ".", "_options", "(", "words", ",", "counts", ",", "words_per_epoch", ",", "self", ".", "_epoch", ",", "self", ".", "_words", ",", "examples", ",", "labels", ")", "=", "word2vec", ".", ...
Build the graph for the full model.
[ "Build", "the", "graph", "for", "the", "full", "model", "." ]
[ "\"\"\"Build the graph for the full model.\"\"\"", "# The training data. A text file.", "# Properly initialize all variables." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
save_vocab
null
def save_vocab(self): """Save the vocabulary to a file so the model can be reloaded.""" opts = self._options with open(os.path.join(opts.save_path, "vocab.txt"), "w") as f: for i in xrange(opts.vocab_size): vocab_word = tf.compat.as_text(opts.vocab_words[i]).encode("utf-8") f.write("%s...
Save the vocabulary to a file so the model can be reloaded.
Save the vocabulary to a file so the model can be reloaded.
[ "Save", "the", "vocabulary", "to", "a", "file", "so", "the", "model", "can", "be", "reloaded", "." ]
def save_vocab(self): opts = self._options with open(os.path.join(opts.save_path, "vocab.txt"), "w") as f: for i in xrange(opts.vocab_size): vocab_word = tf.compat.as_text(opts.vocab_words[i]).encode("utf-8") f.write("%s %d\n" % (vocab_word, opts.vocab_counts[i...
[ "def", "save_vocab", "(", "self", ")", ":", "opts", "=", "self", ".", "_options", "with", "open", "(", "os", ".", "path", ".", "join", "(", "opts", ".", "save_path", ",", "\"vocab.txt\"", ")", ",", "\"w\"", ")", "as", "f", ":", "for", "i", "in", ...
Save the vocabulary to a file so the model can be reloaded.
[ "Save", "the", "vocabulary", "to", "a", "file", "so", "the", "model", "can", "be", "reloaded", "." ]
[ "\"\"\"Save the vocabulary to a file so the model can be reloaded.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
_predict
<not_specific>
def _predict(self, analogy): """Predict the top 4 answers for analogy questions.""" idx, = self._session.run([self._analogy_pred_idx], { self._analogy_a: analogy[:, 0], self._analogy_b: analogy[:, 1], self._analogy_c: analogy[:, 2] }) return idx
Predict the top 4 answers for analogy questions.
Predict the top 4 answers for analogy questions.
[ "Predict", "the", "top", "4", "answers", "for", "analogy", "questions", "." ]
def _predict(self, analogy): idx, = self._session.run([self._analogy_pred_idx], { self._analogy_a: analogy[:, 0], self._analogy_b: analogy[:, 1], self._analogy_c: analogy[:, 2] }) return idx
[ "def", "_predict", "(", "self", ",", "analogy", ")", ":", "idx", ",", "=", "self", ".", "_session", ".", "run", "(", "[", "self", ".", "_analogy_pred_idx", "]", ",", "{", "self", ".", "_analogy_a", ":", "analogy", "[", ":", ",", "0", "]", ",", "s...
Predict the top 4 answers for analogy questions.
[ "Predict", "the", "top", "4", "answers", "for", "analogy", "questions", "." ]
[ "\"\"\"Predict the top 4 answers for analogy questions.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "analogy", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "analogy", "type": null, "docstring": null, "docstring_tokens"...
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
eval
null
def eval(self): """Evaluate analogy questions and reports accuracy.""" # How many questions we get right at precision@1. correct = 0 try: total = self._analogy_questions.shape[0] except AttributeError as e: raise AttributeError("Need to read analogy questions.") start = 0 whil...
Evaluate analogy questions and reports accuracy.
Evaluate analogy questions and reports accuracy.
[ "Evaluate", "analogy", "questions", "and", "reports", "accuracy", "." ]
def eval(self): correct = 0 try: total = self._analogy_questions.shape[0] except AttributeError as e: raise AttributeError("Need to read analogy questions.") start = 0 while start < total: limit = start + 2500 sub = self._analogy_questions[start:limit, :] idx = self._pr...
[ "def", "eval", "(", "self", ")", ":", "correct", "=", "0", "try", ":", "total", "=", "self", ".", "_analogy_questions", ".", "shape", "[", "0", "]", "except", "AttributeError", "as", "e", ":", "raise", "AttributeError", "(", "\"Need to read analogy questions...
Evaluate analogy questions and reports accuracy.
[ "Evaluate", "analogy", "questions", "and", "reports", "accuracy", "." ]
[ "\"\"\"Evaluate analogy questions and reports accuracy.\"\"\"", "# How many questions we get right at precision@1.", "# Bingo! We predicted correctly. E.g., [italy, rome, france, paris].", "# We need to skip words already in the question.", "# The correct label is not the precision@1" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
16db860a5442b81beb8d58a9578b3460f79a1f0f
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/09_sequence/word2vec/word2vec.py
[ "Apache-2.0" ]
Python
nearby
null
def nearby(self, words, num=20): """Prints out nearby words given a list of words.""" ids = np.array([self._word2id.get(x, 0) for x in words]) vals, idx = self._session.run( [self._nearby_val, self._nearby_idx], {self._nearby_word: ids}) for i in xrange(len(words)): print("\n%s\n==========...
Prints out nearby words given a list of words.
Prints out nearby words given a list of words.
[ "Prints", "out", "nearby", "words", "given", "a", "list", "of", "words", "." ]
def nearby(self, words, num=20): ids = np.array([self._word2id.get(x, 0) for x in words]) vals, idx = self._session.run( [self._nearby_val, self._nearby_idx], {self._nearby_word: ids}) for i in xrange(len(words)): print("\n%s\n=====================================" % (words[i])) for (nei...
[ "def", "nearby", "(", "self", ",", "words", ",", "num", "=", "20", ")", ":", "ids", "=", "np", ".", "array", "(", "[", "self", ".", "_word2id", ".", "get", "(", "x", ",", "0", ")", "for", "x", "in", "words", "]", ")", "vals", ",", "idx", "=...
Prints out nearby words given a list of words.
[ "Prints", "out", "nearby", "words", "given", "a", "list", "of", "words", "." ]
[ "\"\"\"Prints out nearby words given a list of words.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "words", "type": null }, { "param": "num", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "words", "type": null, "docstring": null, "docstring_tokens": ...
273210a636c43c29277e2b9d6e14f39a55b069e5
bjoernrost/training-data-analyst
courses/dev-depl-windows/lb-aspnet/common/password.py
[ "Apache-2.0" ]
Python
GenerateConfig
<not_specific>
def GenerateConfig(context): """Entry function to generate the DM config.""" props = context.properties length = props.setdefault(PROPERTY_LENGTH, MIN_LENGTH) include_symbols = props.setdefault(PROPERTY_INCLUDE_SYMBOLS, False) if not isinstance(include_symbols, bool): raise InputError('%s must be a boole...
Entry function to generate the DM config.
Entry function to generate the DM config.
[ "Entry", "function", "to", "generate", "the", "DM", "config", "." ]
def GenerateConfig(context): props = context.properties length = props.setdefault(PROPERTY_LENGTH, MIN_LENGTH) include_symbols = props.setdefault(PROPERTY_INCLUDE_SYMBOLS, False) if not isinstance(include_symbols, bool): raise InputError('%s must be a boolean' % PROPERTY_INCLUDE_SYMBOLS) content = { ...
[ "def", "GenerateConfig", "(", "context", ")", ":", "props", "=", "context", ".", "properties", "length", "=", "props", ".", "setdefault", "(", "PROPERTY_LENGTH", ",", "MIN_LENGTH", ")", "include_symbols", "=", "props", ".", "setdefault", "(", "PROPERTY_INCLUDE_S...
Entry function to generate the DM config.
[ "Entry", "function", "to", "generate", "the", "DM", "config", "." ]
[ "\"\"\"Entry function to generate the DM config.\"\"\"" ]
[ { "param": "context", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
273210a636c43c29277e2b9d6e14f39a55b069e5
bjoernrost/training-data-analyst
courses/dev-depl-windows/lb-aspnet/common/password.py
[ "Apache-2.0" ]
Python
_InsertAndEnsureSatisfaction
null
def _InsertAndEnsureSatisfaction(generated, required, all_candidates): """Inserts 1 char into generated, satisfying required if not already. If the required characters are not already in the generated string, one will be inserted. If any required character is already in the generated string, a random character...
Inserts 1 char into generated, satisfying required if not already. If the required characters are not already in the generated string, one will be inserted. If any required character is already in the generated string, a random character from all_candidates will be inserted. The insertion happens at a random l...
Inserts 1 char into generated, satisfying required if not already. If the required characters are not already in the generated string, one will be inserted. If any required character is already in the generated string, a random character from all_candidates will be inserted. The insertion happens at a random location b...
[ "Inserts", "1", "char", "into", "generated", "satisfying", "required", "if", "not", "already", ".", "If", "the", "required", "characters", "are", "not", "already", "in", "the", "generated", "string", "one", "will", "be", "inserted", ".", "If", "any", "requir...
def _InsertAndEnsureSatisfaction(generated, required, all_candidates): if set(generated).isdisjoint(required): _InsertInto(generated, required) else: _InsertInto(generated, all_candidates)
[ "def", "_InsertAndEnsureSatisfaction", "(", "generated", ",", "required", ",", "all_candidates", ")", ":", "if", "set", "(", "generated", ")", ".", "isdisjoint", "(", "required", ")", ":", "_InsertInto", "(", "generated", ",", "required", ")", "else", ":", "...
Inserts 1 char into generated, satisfying required if not already.
[ "Inserts", "1", "char", "into", "generated", "satisfying", "required", "if", "not", "already", "." ]
[ "\"\"\"Inserts 1 char into generated, satisfying required if not already.\n\n If the required characters are not already in the generated string, one will\n be inserted. If any required character is already in the generated string, a\n random character from all_candidates will be inserted. The insertion happens\...
[ { "param": "generated", "type": null }, { "param": "required", "type": null }, { "param": "all_candidates", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "generated", "type": null, "docstring": "the string to be modified.", "docstring_tokens": [ "the", "string", "to", "be", "modified", "." ], "default": null, "is_...
273210a636c43c29277e2b9d6e14f39a55b069e5
bjoernrost/training-data-analyst
courses/dev-depl-windows/lb-aspnet/common/password.py
[ "Apache-2.0" ]
Python
_InsertInto
null
def _InsertInto(generated, candidates): """Inserts a random candidate into a random non-zero index of generated.""" # Avoids inserting at index 0, since the first character follows its own rule. generated.insert(random.randint(1, len(generated) - 1), random.choice(candidates))
Inserts a random candidate into a random non-zero index of generated.
Inserts a random candidate into a random non-zero index of generated.
[ "Inserts", "a", "random", "candidate", "into", "a", "random", "non", "-", "zero", "index", "of", "generated", "." ]
def _InsertInto(generated, candidates): generated.insert(random.randint(1, len(generated) - 1), random.choice(candidates))
[ "def", "_InsertInto", "(", "generated", ",", "candidates", ")", ":", "generated", ".", "insert", "(", "random", ".", "randint", "(", "1", ",", "len", "(", "generated", ")", "-", "1", ")", ",", "random", ".", "choice", "(", "candidates", ")", ")" ]
Inserts a random candidate into a random non-zero index of generated.
[ "Inserts", "a", "random", "candidate", "into", "a", "random", "non", "-", "zero", "index", "of", "generated", "." ]
[ "\"\"\"Inserts a random candidate into a random non-zero index of generated.\"\"\"", "# Avoids inserting at index 0, since the first character follows its own rule." ]
[ { "param": "generated", "type": null }, { "param": "candidates", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "generated", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "candidates", "type": null, "docstring": null, "docstring...
2e7a580cb929634549321e692819986743abba3d
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/08_image/flowersmodeltpu/trainer/preprocess.py
[ "Apache-2.0" ]
Python
_convert_to_example
<not_specific>
def _convert_to_example(filename, image_buffer, label_int, label_str, height, width): """Build an Example proto for an example. Args: filename: string, path to an image file, e.g., '/path/to/example.JPG' image_buffer: string, JPEG encoding of RGB image label_int: integer, identi...
Build an Example proto for an example. Args: filename: string, path to an image file, e.g., '/path/to/example.JPG' image_buffer: string, JPEG encoding of RGB image label_int: integer, identifier for ground truth (0-based) label_str: string, identifier for ground truth, e.g., 'daisy' height: integ...
Build an Example proto for an example.
[ "Build", "an", "Example", "proto", "for", "an", "example", "." ]
def _convert_to_example(filename, image_buffer, label_int, label_str, height, width): colorspace = 'RGB' channels = 3 image_format = 'JPEG' example = tf.train.Example( features=tf.train.Features( feature={ 'image/height': _int64_feature(height), ...
[ "def", "_convert_to_example", "(", "filename", ",", "image_buffer", ",", "label_int", ",", "label_str", ",", "height", ",", "width", ")", ":", "colorspace", "=", "'RGB'", "channels", "=", "3", "image_format", "=", "'JPEG'", "example", "=", "tf", ".", "train"...
Build an Example proto for an example.
[ "Build", "an", "Example", "proto", "for", "an", "example", "." ]
[ "\"\"\"Build an Example proto for an example.\n\n Args:\n filename: string, path to an image file, e.g., '/path/to/example.JPG'\n image_buffer: string, JPEG encoding of RGB image\n label_int: integer, identifier for ground truth (0-based)\n label_str: string, identifier for ground truth, e.g., 'daisy'\...
[ { "param": "filename", "type": null }, { "param": "image_buffer", "type": null }, { "param": "label_int", "type": null }, { "param": "label_str", "type": null }, { "param": "height", "type": null }, { "param": "width", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": "string, path to an image file, e.g., '/path/to/example.JPG'", "docstring_tok...
2e7a580cb929634549321e692819986743abba3d
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/08_image/flowersmodeltpu/trainer/preprocess.py
[ "Apache-2.0" ]
Python
_get_image_data
<not_specific>
def _get_image_data(filename, coder): """Process a single image file. Args: filename: string, path to an image file e.g., '/path/to/example.JPG'. coder: instance of ImageCoder to provide TensorFlow image coding utils. Returns: image_buffer: string, JPEG encoding of RGB image. height: integer, ima...
Process a single image file. Args: filename: string, path to an image file e.g., '/path/to/example.JPG'. coder: instance of ImageCoder to provide TensorFlow image coding utils. Returns: image_buffer: string, JPEG encoding of RGB image. height: integer, image height in pixels. width: integer, im...
Process a single image file.
[ "Process", "a", "single", "image", "file", "." ]
def _get_image_data(filename, coder): with tf.gfile.FastGFile(filename, 'r') as ifp: image_data = ifp.read() image = coder.decode_jpeg(image_data) assert len(image.shape) == 3 height = image.shape[0] width = image.shape[1] assert image.shape[2] == 3 return image_data, height, width
[ "def", "_get_image_data", "(", "filename", ",", "coder", ")", ":", "with", "tf", ".", "gfile", ".", "FastGFile", "(", "filename", ",", "'r'", ")", "as", "ifp", ":", "image_data", "=", "ifp", ".", "read", "(", ")", "image", "=", "coder", ".", "decode_...
Process a single image file.
[ "Process", "a", "single", "image", "file", "." ]
[ "\"\"\"Process a single image file.\n\n Args:\n filename: string, path to an image file e.g., '/path/to/example.JPG'.\n coder: instance of ImageCoder to provide TensorFlow image coding utils.\n Returns:\n image_buffer: string, JPEG encoding of RGB image.\n height: integer, image height in pixels.\n ...
[ { "param": "filename", "type": null }, { "param": "coder", "type": null } ]
{ "returns": [ { "docstring": "string, JPEG encoding of RGB image.\nheight: integer, image height in pixels.\nwidth: integer, image width in pixels.", "docstring_tokens": [ "string", "JPEG", "encoding", "of", "RGB", "image", ".", "height"...
2e7a580cb929634549321e692819986743abba3d
bjoernrost/training-data-analyst
courses/machine_learning/deepdive/08_image/flowersmodeltpu/trainer/preprocess.py
[ "Apache-2.0" ]
Python
convert_to_example
null
def convert_to_example(csvline, categories): """Parse a line of CSV file and convert to TF Record. Args: csvline: line from input CSV file categories: list of labels Yields: serialized TF example if the label is in categories """ filename, label = csvline.encode('ascii', 'ignore').split(',') if...
Parse a line of CSV file and convert to TF Record. Args: csvline: line from input CSV file categories: list of labels Yields: serialized TF example if the label is in categories
Parse a line of CSV file and convert to TF Record.
[ "Parse", "a", "line", "of", "CSV", "file", "and", "convert", "to", "TF", "Record", "." ]
def convert_to_example(csvline, categories): filename, label = csvline.encode('ascii', 'ignore').split(',') if label in categories: coder = ImageCoder() image_buffer, height, width = _get_image_data(filename, coder) del coder example = _convert_to_example(filename, image_buffer, ...
[ "def", "convert_to_example", "(", "csvline", ",", "categories", ")", ":", "filename", ",", "label", "=", "csvline", ".", "encode", "(", "'ascii'", ",", "'ignore'", ")", ".", "split", "(", "','", ")", "if", "label", "in", "categories", ":", "coder", "=", ...
Parse a line of CSV file and convert to TF Record.
[ "Parse", "a", "line", "of", "CSV", "file", "and", "convert", "to", "TF", "Record", "." ]
[ "\"\"\"Parse a line of CSV file and convert to TF Record.\n\n Args:\n csvline: line from input CSV file\n categories: list of labels\n Yields:\n serialized TF example if the label is in categories\n \"\"\"", "# ignore labels not in categories list" ]
[ { "param": "csvline", "type": null }, { "param": "categories", "type": null } ]
{ "returns": [ { "docstring": "serialized TF example if the label is in categories", "docstring_tokens": [ "serialized", "TF", "example", "if", "the", "label", "is", "in", "categories" ], "type": null } ], "rai...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
list_gcs_paths
<not_specific>
def list_gcs_paths(bucket, gcs_prefix, gcs_patterns=None): """list GCS blobs in a bucket starting with the gcs_prefix. Args: bucket (google.cloud.storage.Bucket): bucket gcs_prefix (string): prefix gcs_patterns (list of str): return only blobs whose name contains all these strings. Returns: ...
list GCS blobs in a bucket starting with the gcs_prefix. Args: bucket (google.cloud.storage.Bucket): bucket gcs_prefix (string): prefix gcs_patterns (list of str): return only blobs whose name contains all these strings. Returns: list of blob URLs
list GCS blobs in a bucket starting with the gcs_prefix.
[ "list", "GCS", "blobs", "in", "a", "bucket", "starting", "with", "the", "gcs_prefix", "." ]
def list_gcs_paths(bucket, gcs_prefix, gcs_patterns=None): bucket = cached_gcs_client().get_bucket(bucket) blobs = bucket.list_blobs(prefix=gcs_prefix, delimiter='/') result = [] if gcs_patterns: for b in blobs: match = True for pattern in gcs_patterns: if pattern not in b.path: ...
[ "def", "list_gcs_paths", "(", "bucket", ",", "gcs_prefix", ",", "gcs_patterns", "=", "None", ")", ":", "bucket", "=", "cached_gcs_client", "(", ")", ".", "get_bucket", "(", "bucket", ")", "blobs", "=", "bucket", ".", "list_blobs", "(", "prefix", "=", "gcs_...
list GCS blobs in a bucket starting with the gcs_prefix.
[ "list", "GCS", "blobs", "in", "a", "bucket", "starting", "with", "the", "gcs_prefix", "." ]
[ "\"\"\"list GCS blobs in a bucket starting with the gcs_prefix.\n\n Args:\n bucket (google.cloud.storage.Bucket): bucket\n gcs_prefix (string): prefix\n gcs_patterns (list of str): return only blobs whose name contains all these\n strings.\n\n Returns:\n list of blob URLs\n \"\"\"" ]
[ { "param": "bucket", "type": null }, { "param": "gcs_prefix", "type": null }, { "param": "gcs_patterns", "type": null } ]
{ "returns": [ { "docstring": "list of blob URLs", "docstring_tokens": [ "list", "of", "blob", "URLs" ], "type": null } ], "raises": [], "params": [ { "identifier": "bucket", "type": null, "docstring": null, "docstring_t...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
copy_fromgcs
<not_specific>
def copy_fromgcs(blob_path, destdir): """download GCS blobs to a local directory. Args: blob_path (string): source file, Blob.path URL destdir (string): local directory, has to exist Returns: destination filename """ bucket, object_id = parse_blobpath(blob_path) bucket = cached_gcs_client().ge...
download GCS blobs to a local directory. Args: blob_path (string): source file, Blob.path URL destdir (string): local directory, has to exist Returns: destination filename
download GCS blobs to a local directory.
[ "download", "GCS", "blobs", "to", "a", "local", "directory", "." ]
def copy_fromgcs(blob_path, destdir): bucket, object_id = parse_blobpath(blob_path) bucket = cached_gcs_client().get_bucket(bucket) blob = bucket.blob(object_id) basename = os.path.basename(object_id) logging.info('Downloading %s', basename) dest = os.path.join(destdir, basename) blob.download_to_filename...
[ "def", "copy_fromgcs", "(", "blob_path", ",", "destdir", ")", ":", "bucket", ",", "object_id", "=", "parse_blobpath", "(", "blob_path", ")", "bucket", "=", "cached_gcs_client", "(", ")", ".", "get_bucket", "(", "bucket", ")", "blob", "=", "bucket", ".", "b...
download GCS blobs to a local directory.
[ "download", "GCS", "blobs", "to", "a", "local", "directory", "." ]
[ "\"\"\"download GCS blobs to a local directory.\n\n Args:\n blob_path (string): source file, Blob.path URL\n destdir (string): local directory, has to exist\n\n Returns:\n destination filename\n \"\"\"" ]
[ { "param": "blob_path", "type": null }, { "param": "destdir", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "blob_path", "type": null, "docstring": "source file, Blob.path URL", "docstring_tokens": [ "source", ...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
create_data_grid
<not_specific>
def create_data_grid(nc, data, griddef): """Create a ndarray of the data in the netcdf file. Args: nc (NetcdfFile): file data (str): which variable to pull out griddef (pyresample.GridDefinition): output grid definition Returns: ndarray of data in specified grid """ # Subsatellite_Longitude ...
Create a ndarray of the data in the netcdf file. Args: nc (NetcdfFile): file data (str): which variable to pull out griddef (pyresample.GridDefinition): output grid definition Returns: ndarray of data in specified grid
Create a ndarray of the data in the netcdf file.
[ "Create", "a", "ndarray", "of", "the", "data", "in", "the", "netcdf", "file", "." ]
def create_data_grid(nc, data, griddef): lon_0 = nc.variables['nominal_satellite_subpoint_lon'][0] ht_0 = nc.variables['nominal_satellite_height'][0] * 1000 x = nc.variables['x'][:] * ht_0 y = nc.variables['y'][:] * ht_0 nx = len(x) ny = len(y) max_x, min_x, max_y, min_y = x.max(), x.min(), y.max(),...
[ "def", "create_data_grid", "(", "nc", ",", "data", ",", "griddef", ")", ":", "lon_0", "=", "nc", ".", "variables", "[", "'nominal_satellite_subpoint_lon'", "]", "[", "0", "]", "ht_0", "=", "nc", ".", "variables", "[", "'nominal_satellite_height'", "]", "[", ...
Create a ndarray of the data in the netcdf file.
[ "Create", "a", "ndarray", "of", "the", "data", "in", "the", "netcdf", "file", "." ]
[ "\"\"\"Create a ndarray of the data in the netcdf file.\n\n Args:\n nc (NetcdfFile): file\n data (str): which variable to pull out\n griddef (pyresample.GridDefinition): output grid definition\n\n Returns:\n ndarray of data in specified grid\n \"\"\"", "# Subsatellite_Longitude is where the GEO sat...
[ { "param": "nc", "type": null }, { "param": "data", "type": null }, { "param": "griddef", "type": null } ]
{ "returns": [ { "docstring": "ndarray of data in specified grid", "docstring_tokens": [ "ndarray", "of", "data", "in", "specified", "grid" ], "type": null } ], "raises": [], "params": [ { "identifier": "nc", "type":...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
read_ir_data
<not_specific>
def read_ir_data(blob_path, griddef): """Read satellite infrared data from Blob and fit into grid. Args: blob_path (Blob URL): netcdf file griddef (pyresample.GridDefinition): output grid definition Returns: ndarray of data in specified grid """ tmpdir = tempfile.mkdtemp() try: ir_file = c...
Read satellite infrared data from Blob and fit into grid. Args: blob_path (Blob URL): netcdf file griddef (pyresample.GridDefinition): output grid definition Returns: ndarray of data in specified grid
Read satellite infrared data from Blob and fit into grid.
[ "Read", "satellite", "infrared", "data", "from", "Blob", "and", "fit", "into", "grid", "." ]
def read_ir_data(blob_path, griddef): tmpdir = tempfile.mkdtemp() try: ir_file = copy_fromgcs(blob_path, tmpdir) with Dataset(ir_file, 'r') as irnc: rad = irnc.variables['Rad'][:] ref = (rad * np.pi * 0.3) / 663.274497 ref = np.sqrt(np.minimum(np.maximum(ref, 0.0), 1.0)) return creat...
[ "def", "read_ir_data", "(", "blob_path", ",", "griddef", ")", ":", "tmpdir", "=", "tempfile", ".", "mkdtemp", "(", ")", "try", ":", "ir_file", "=", "copy_fromgcs", "(", "blob_path", ",", "tmpdir", ")", "with", "Dataset", "(", "ir_file", ",", "'r'", ")", ...
Read satellite infrared data from Blob and fit into grid.
[ "Read", "satellite", "infrared", "data", "from", "Blob", "and", "fit", "into", "grid", "." ]
[ "\"\"\"Read satellite infrared data from Blob and fit into grid.\n\n Args:\n blob_path (Blob URL): netcdf file\n griddef (pyresample.GridDefinition): output grid definition\n\n Returns:\n ndarray of data in specified grid\n \"\"\"" ]
[ { "param": "blob_path", "type": null }, { "param": "griddef", "type": null } ]
{ "returns": [ { "docstring": "ndarray of data in specified grid", "docstring_tokens": [ "ndarray", "of", "data", "in", "specified", "grid" ], "type": null } ], "raises": [], "params": [ { "identifier": "blob_path", ...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
read_ltg_data
<not_specific>
def read_ltg_data(blob_path): """Read lightning event data from GCS Blob. Args: blob_path (Blob URL): netcdf file Returns: tuple of latitude and longitude arrays """ tmpdir = tempfile.mkdtemp() try: filename = copy_fromgcs(blob_path, tmpdir) with Dataset(filename, 'r') as nc: event_l...
Read lightning event data from GCS Blob. Args: blob_path (Blob URL): netcdf file Returns: tuple of latitude and longitude arrays
Read lightning event data from GCS Blob.
[ "Read", "lightning", "event", "data", "from", "GCS", "Blob", "." ]
def read_ltg_data(blob_path): tmpdir = tempfile.mkdtemp() try: filename = copy_fromgcs(blob_path, tmpdir) with Dataset(filename, 'r') as nc: event_lat = nc.variables['event_lat'][:] event_lon = nc.variables['event_lon'][:] print('{} events'.format(len(event_lat)), end='; ') return ev...
[ "def", "read_ltg_data", "(", "blob_path", ")", ":", "tmpdir", "=", "tempfile", ".", "mkdtemp", "(", ")", "try", ":", "filename", "=", "copy_fromgcs", "(", "blob_path", ",", "tmpdir", ")", "with", "Dataset", "(", "filename", ",", "'r'", ")", "as", "nc", ...
Read lightning event data from GCS Blob.
[ "Read", "lightning", "event", "data", "from", "GCS", "Blob", "." ]
[ "\"\"\"Read lightning event data from GCS Blob.\n\n Args:\n blob_path (Blob URL): netcdf file\n\n Returns:\n tuple of latitude and longitude arrays\n \"\"\"" ]
[ { "param": "blob_path", "type": null } ]
{ "returns": [ { "docstring": "tuple of latitude and longitude arrays", "docstring_tokens": [ "tuple", "of", "latitude", "and", "longitude", "arrays" ], "type": null } ], "raises": [], "params": [ { "identifier": "blob_pat...
d78dc709e8bafaa177a19dbf568609e6e5991e0a
bjoernrost/training-data-analyst
blogs/lightning/ltgpred/goesutil/goesio.py
[ "Apache-2.0" ]
Python
create_ltg_grid
<not_specific>
def create_ltg_grid(ltg_blob_paths, griddef, event_influence_km): """Read lightning event data from Blobs and fit into grid. Args: ltg_blob_paths (list of Blob URLs): list of netcdf file griddef (pyresample.GridDefinition): output grid definition event_influence_km (float): How far does a lightning fla...
Read lightning event data from Blobs and fit into grid. Args: ltg_blob_paths (list of Blob URLs): list of netcdf file griddef (pyresample.GridDefinition): output grid definition event_influence_km (float): How far does a lightning flash influence? Returns: ndarray of data in specified grid
Read lightning event data from Blobs and fit into grid.
[ "Read", "lightning", "event", "data", "from", "Blobs", "and", "fit", "into", "grid", "." ]
def create_ltg_grid(ltg_blob_paths, griddef, event_influence_km): ltg_lats, ltg_lons, data = np.array([0]), np.array([0]), np.array([0]) for blob_path in ltg_blob_paths: event_lat, event_lon = read_ltg_data(blob_path) ltg_lats = np.append(ltg_lats, event_lat) ltg_lons = np.append(ltg_lons, event_lon) ...
[ "def", "create_ltg_grid", "(", "ltg_blob_paths", ",", "griddef", ",", "event_influence_km", ")", ":", "ltg_lats", ",", "ltg_lons", ",", "data", "=", "np", ".", "array", "(", "[", "0", "]", ")", ",", "np", ".", "array", "(", "[", "0", "]", ")", ",", ...
Read lightning event data from Blobs and fit into grid.
[ "Read", "lightning", "event", "data", "from", "Blobs", "and", "fit", "into", "grid", "." ]
[ "\"\"\"Read lightning event data from Blobs and fit into grid.\n\n Args:\n ltg_blob_paths (list of Blob URLs): list of netcdf file\n griddef (pyresample.GridDefinition): output grid definition\n event_influence_km (float): How far does a lightning flash influence?\n\n Returns:\n ndarray of data in spe...
[ { "param": "ltg_blob_paths", "type": null }, { "param": "griddef", "type": null }, { "param": "event_influence_km", "type": null } ]
{ "returns": [ { "docstring": "ndarray of data in specified grid", "docstring_tokens": [ "ndarray", "of", "data", "in", "specified", "grid" ], "type": null } ], "raises": [], "params": [ { "identifier": "ltg_blob_paths", ...
436be0f63462d8c1af30907ae2c26ee1f3ffb421
amuraru/thrift-connection-pool
src/thriftpool/pool.py
[ "Apache-2.0" ]
Python
return_connection
<not_specific>
def return_connection(self, conn): """ return a thrift connection to the pool. """ if self._closed: self._close_thrift_connection(conn) return self._connection_queue.put(conn) self._semaphore.release()
return a thrift connection to the pool.
return a thrift connection to the pool.
[ "return", "a", "thrift", "connection", "to", "the", "pool", "." ]
def return_connection(self, conn): if self._closed: self._close_thrift_connection(conn) return self._connection_queue.put(conn) self._semaphore.release()
[ "def", "return_connection", "(", "self", ",", "conn", ")", ":", "if", "self", ".", "_closed", ":", "self", ".", "_close_thrift_connection", "(", "conn", ")", "return", "self", ".", "_connection_queue", ".", "put", "(", "conn", ")", "self", ".", "_semaphore...
return a thrift connection to the pool.
[ "return", "a", "thrift", "connection", "to", "the", "pool", "." ]
[ "\"\"\" return a thrift connection to the pool.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "conn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "conn", "type": null, "docstring": null, "docstring_tokens": [...
436be0f63462d8c1af30907ae2c26ee1f3ffb421
amuraru/thrift-connection-pool
src/thriftpool/pool.py
[ "Apache-2.0" ]
Python
release_conn
null
def release_conn(self, conn): """ call when the connect is no usable anymore """ try: self._close_thrift_connection(conn) except: pass if not self._closed: self._semaphore.release()
call when the connect is no usable anymore
call when the connect is no usable anymore
[ "call", "when", "the", "connect", "is", "no", "usable", "anymore" ]
def release_conn(self, conn): try: self._close_thrift_connection(conn) except: pass if not self._closed: self._semaphore.release()
[ "def", "release_conn", "(", "self", ",", "conn", ")", ":", "try", ":", "self", ".", "_close_thrift_connection", "(", "conn", ")", "except", ":", "pass", "if", "not", "self", ".", "_closed", ":", "self", ".", "_semaphore", ".", "release", "(", ")" ]
call when the connect is no usable anymore
[ "call", "when", "the", "connect", "is", "no", "usable", "anymore" ]
[ "\"\"\" call when the connect is no usable anymore\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "conn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "conn", "type": null, "docstring": null, "docstring_tokens": [...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
minimum
<not_specific>
def minimum(self): """ Returns the minimum temperature reading in the instance list Calls the minimum_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the lowest temperature value ...
Returns the minimum temperature reading in the instance list Calls the minimum_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the lowest temperature value
Returns the minimum temperature reading in the instance list Calls the minimum_from() function, using the instance list as an input parameter Returns float The temperature from the input list with the lowest temperature value
[ "Returns", "the", "minimum", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "minimum_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter", "Returns", "float", "The", "temperature", "from", "the...
def minimum(self): return self.minimum_from(self.temp_time_list)[0]
[ "def", "minimum", "(", "self", ")", ":", "return", "self", ".", "minimum_from", "(", "self", ".", "temp_time_list", ")", "[", "0", "]" ]
Returns the minimum temperature reading in the instance list Calls the minimum_from() function, using the instance list as an input parameter
[ "Returns", "the", "minimum", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "minimum_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter" ]
[ "\"\"\"\n Returns the minimum temperature reading in the instance list\n\n Calls the minimum_from() function, using the instance list as an input parameter\n\n Returns\n -------\n float\n The temperature from the input list with the lowest temperature value\n \"\...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
minimum_from
<not_specific>
def minimum_from(self, temp_time_list): """ Returns the minimum temperature reading in the specified list Get the minimum temperature listed from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)...
Returns the minimum temperature reading in the specified list Get the minimum temperature listed from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)] A list of (temperature, time) tuples ...
Returns the minimum temperature reading in the specified list Get the minimum temperature listed from an input list of tuples that contain temperature floats and time data Parameters temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was ...
[ "Returns", "the", "minimum", "temperature", "reading", "in", "the", "specified", "list", "Get", "the", "minimum", "temperature", "listed", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data", "Paramete...
def minimum_from(self, temp_time_list): result = temp_time_list[0] for temp, time in temp_time_list: if temp < result[0]: result = (temp, time) return result
[ "def", "minimum_from", "(", "self", ",", "temp_time_list", ")", ":", "result", "=", "temp_time_list", "[", "0", "]", "for", "temp", ",", "time", "in", "temp_time_list", ":", "if", "temp", "<", "result", "[", "0", "]", ":", "result", "=", "(", "temp", ...
Returns the minimum temperature reading in the specified list Get the minimum temperature listed from an input list of tuples that contain temperature floats and time data
[ "Returns", "the", "minimum", "temperature", "reading", "in", "the", "specified", "list", "Get", "the", "minimum", "temperature", "listed", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data" ]
[ "\"\"\"\n Returns the minimum temperature reading in the specified list\n\n Get the minimum temperature listed from an input list of tuples that contain\n temperature floats and time data\n\n Parameters\n -------\n temp_list : [(float, time)]\n A list of (temper...
[ { "param": "self", "type": null }, { "param": "temp_time_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "temp_time_list", "type": null, "docstring": null, "docstring_...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
maximum
<not_specific>
def maximum(self): """ Returns the maximum temperature reading in the instance list Calls the maximum_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the highest temperature value ...
Returns the maximum temperature reading in the instance list Calls the maximum_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the highest temperature value
Returns the maximum temperature reading in the instance list Calls the maximum_from() function, using the instance list as an input parameter Returns float The temperature from the input list with the highest temperature value
[ "Returns", "the", "maximum", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "maximum_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter", "Returns", "float", "The", "temperature", "from", "the...
def maximum(self): return self.maximum_from(self.temp_time_list)[0]
[ "def", "maximum", "(", "self", ")", ":", "return", "self", ".", "maximum_from", "(", "self", ".", "temp_time_list", ")", "[", "0", "]" ]
Returns the maximum temperature reading in the instance list Calls the maximum_from() function, using the instance list as an input parameter
[ "Returns", "the", "maximum", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "maximum_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter" ]
[ "\"\"\"\n Returns the maximum temperature reading in the instance list\n\n Calls the maximum_from() function, using the instance list as an input parameter\n\n Returns\n -------\n float\n The temperature from the input list with the highest temperature value\n \"...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
maximum_from
<not_specific>
def maximum_from(self, temp_time_list): """ Returns the maximum temperature reading in the specified list Get the maximum temperature listed from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)...
Returns the maximum temperature reading in the specified list Get the maximum temperature listed from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)] A list of (temperature, time) tuples ...
Returns the maximum temperature reading in the specified list Get the maximum temperature listed from an input list of tuples that contain temperature floats and time data Parameters temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was ...
[ "Returns", "the", "maximum", "temperature", "reading", "in", "the", "specified", "list", "Get", "the", "maximum", "temperature", "listed", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data", "Paramete...
def maximum_from(self, temp_time_list): result = temp_time_list[0] for temp, time in temp_time_list: if temp > result[0]: result = (temp, time) return result
[ "def", "maximum_from", "(", "self", ",", "temp_time_list", ")", ":", "result", "=", "temp_time_list", "[", "0", "]", "for", "temp", ",", "time", "in", "temp_time_list", ":", "if", "temp", ">", "result", "[", "0", "]", ":", "result", "=", "(", "temp", ...
Returns the maximum temperature reading in the specified list Get the maximum temperature listed from an input list of tuples that contain temperature floats and time data
[ "Returns", "the", "maximum", "temperature", "reading", "in", "the", "specified", "list", "Get", "the", "maximum", "temperature", "listed", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data" ]
[ "\"\"\"\n Returns the maximum temperature reading in the specified list\n\n Get the maximum temperature listed from an input list of tuples that contain\n temperature floats and time data\n\n Parameters\n -------\n temp_list : [(float, time)]\n A list of (temper...
[ { "param": "self", "type": null }, { "param": "temp_time_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "temp_time_list", "type": null, "docstring": null, "docstring_...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
update
null
def update(self): """ Updates the temperature readings Calculates the current temperature reading, calls the update_from() function, using the instance list as an input parameter, as well as the new temperature reading. """ cpu = CPUTemperature() new_reading = (c...
Updates the temperature readings Calculates the current temperature reading, calls the update_from() function, using the instance list as an input parameter, as well as the new temperature reading.
Updates the temperature readings Calculates the current temperature reading, calls the update_from() function, using the instance list as an input parameter, as well as the new temperature reading.
[ "Updates", "the", "temperature", "readings", "Calculates", "the", "current", "temperature", "reading", "calls", "the", "update_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter", "as", "well", "as", "the", "new", "tempe...
def update(self): cpu = CPUTemperature() new_reading = (cpu.temperature, time.localtime()) self.update_from(new_reading, self.temp_time_list)
[ "def", "update", "(", "self", ")", ":", "cpu", "=", "CPUTemperature", "(", ")", "new_reading", "=", "(", "cpu", ".", "temperature", ",", "time", ".", "localtime", "(", ")", ")", "self", ".", "update_from", "(", "new_reading", ",", "self", ".", "temp_ti...
Updates the temperature readings Calculates the current temperature reading, calls the update_from() function, using the instance list as an input parameter, as well as the new temperature reading.
[ "Updates", "the", "temperature", "readings", "Calculates", "the", "current", "temperature", "reading", "calls", "the", "update_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter", "as", "well", "as", "the", "new", "tempe...
[ "\"\"\"\n Updates the temperature readings\n\n Calculates the current temperature reading, calls the update_from() function,\n using the instance list as an input parameter, as well as the new temperature reading.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
now
<not_specific>
def now(self): """ Calculates and returns the current temperature and timestamp Returns ------- new_reading : (float, time) The current temperature and time """ cpu = CPUTemperature() new_reading = (cpu.temperature, time.localtime()) r...
Calculates and returns the current temperature and timestamp Returns ------- new_reading : (float, time) The current temperature and time
Calculates and returns the current temperature and timestamp Returns new_reading : (float, time) The current temperature and time
[ "Calculates", "and", "returns", "the", "current", "temperature", "and", "timestamp", "Returns", "new_reading", ":", "(", "float", "time", ")", "The", "current", "temperature", "and", "time" ]
def now(self): cpu = CPUTemperature() new_reading = (cpu.temperature, time.localtime()) return new_reading
[ "def", "now", "(", "self", ")", ":", "cpu", "=", "CPUTemperature", "(", ")", "new_reading", "=", "(", "cpu", ".", "temperature", ",", "time", ".", "localtime", "(", ")", ")", "return", "new_reading" ]
Calculates and returns the current temperature and timestamp Returns
[ "Calculates", "and", "returns", "the", "current", "temperature", "and", "timestamp", "Returns" ]
[ "\"\"\"\n Calculates and returns the current temperature and timestamp\n\n Returns\n -------\n new_reading : (float, time)\n The current temperature and time\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
average
<not_specific>
def average(self): """ Returns the average temperature reading in the instance list Calls the average_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the average temperature value ...
Returns the average temperature reading in the instance list Calls the average_from() function, using the instance list as an input parameter Returns ------- float The temperature from the input list with the average temperature value
Returns the average temperature reading in the instance list Calls the average_from() function, using the instance list as an input parameter Returns float The temperature from the input list with the average temperature value
[ "Returns", "the", "average", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "average_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter", "Returns", "float", "The", "temperature", "from", "the...
def average(self): return self.average_from(self.temp_time_list)
[ "def", "average", "(", "self", ")", ":", "return", "self", ".", "average_from", "(", "self", ".", "temp_time_list", ")" ]
Returns the average temperature reading in the instance list Calls the average_from() function, using the instance list as an input parameter
[ "Returns", "the", "average", "temperature", "reading", "in", "the", "instance", "list", "Calls", "the", "average_from", "()", "function", "using", "the", "instance", "list", "as", "an", "input", "parameter" ]
[ "\"\"\"\n Returns the average temperature reading in the instance list\n\n Calls the average_from() function, using the instance list as an input parameter\n\n Returns\n -------\n float\n The temperature from the input list with the average temperature value\n \"...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
average_from
<not_specific>
def average_from(self, temp_time_list): """ Returns the average temperature reading in the specified list Calculates the average temperature from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)...
Returns the average temperature reading in the specified list Calculates the average temperature from an input list of tuples that contain temperature floats and time data Parameters ------- temp_list : [(float, time)] A list of (temperature, time) tuples ...
Returns the average temperature reading in the specified list Calculates the average temperature from an input list of tuples that contain temperature floats and time data Parameters temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was ...
[ "Returns", "the", "average", "temperature", "reading", "in", "the", "specified", "list", "Calculates", "the", "average", "temperature", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data", "Parameters", ...
def average_from(self, temp_time_list): total_temp = 0.0 count = 0 for temp, time in temp_time_list: total_temp += temp count += 1 return total_temp / count
[ "def", "average_from", "(", "self", ",", "temp_time_list", ")", ":", "total_temp", "=", "0.0", "count", "=", "0", "for", "temp", ",", "time", "in", "temp_time_list", ":", "total_temp", "+=", "temp", "count", "+=", "1", "return", "total_temp", "/", "count" ...
Returns the average temperature reading in the specified list Calculates the average temperature from an input list of tuples that contain temperature floats and time data
[ "Returns", "the", "average", "temperature", "reading", "in", "the", "specified", "list", "Calculates", "the", "average", "temperature", "from", "an", "input", "list", "of", "tuples", "that", "contain", "temperature", "floats", "and", "time", "data" ]
[ "\"\"\"\n Returns the average temperature reading in the specified list\n\n Calculates the average temperature from an input list of tuples that contain\n temperature floats and time data\n\n Parameters\n -------\n temp_list : [(float, time)]\n A list of (temper...
[ { "param": "self", "type": null }, { "param": "temp_time_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "temp_time_list", "type": null, "docstring": null, "docstring_...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
count
<not_specific>
def count(self): """ Returns the number of temperature readings in the specified list Calls count_from() with the instance list as input Returns ------- int The number of temperature readings from the input list """ return self.count_from(se...
Returns the number of temperature readings in the specified list Calls count_from() with the instance list as input Returns ------- int The number of temperature readings from the input list
Returns the number of temperature readings in the specified list Calls count_from() with the instance list as input Returns int The number of temperature readings from the input list
[ "Returns", "the", "number", "of", "temperature", "readings", "in", "the", "specified", "list", "Calls", "count_from", "()", "with", "the", "instance", "list", "as", "input", "Returns", "int", "The", "number", "of", "temperature", "readings", "from", "the", "in...
def count(self): return self.count_from(self.temp_time_list)
[ "def", "count", "(", "self", ")", ":", "return", "self", ".", "count_from", "(", "self", ".", "temp_time_list", ")" ]
Returns the number of temperature readings in the specified list Calls count_from() with the instance list as input
[ "Returns", "the", "number", "of", "temperature", "readings", "in", "the", "specified", "list", "Calls", "count_from", "()", "with", "the", "instance", "list", "as", "input" ]
[ "\"\"\"\n Returns the number of temperature readings in the specified list\n\n Calls count_from() with the instance list as input\n\n Returns\n -------\n int\n The number of temperature readings from the input list\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
count_from
<not_specific>
def count_from(self, temp_time_list): """ Returns the number of temperature readings in the specified list Parameters ------- temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the readi...
Returns the number of temperature readings in the specified list Parameters ------- temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was taken Returns ------- ...
Returns the number of temperature readings in the specified list Parameters temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was taken Returns int The number of temperature readings from the input list
[ "Returns", "the", "number", "of", "temperature", "readings", "in", "the", "specified", "list", "Parameters", "temp_list", ":", "[", "(", "float", "time", ")", "]", "A", "list", "of", "(", "temperature", "time", ")", "tuples", "that", "each", "specify", "a"...
def count_from(self, temp_time_list): count = len(temp_time_list) return count
[ "def", "count_from", "(", "self", ",", "temp_time_list", ")", ":", "count", "=", "len", "(", "temp_time_list", ")", "return", "count" ]
Returns the number of temperature readings in the specified list Parameters
[ "Returns", "the", "number", "of", "temperature", "readings", "in", "the", "specified", "list", "Parameters" ]
[ "\"\"\"\n Returns the number of temperature readings in the specified list\n\n Parameters\n -------\n temp_list : [(float, time)]\n A list of (temperature, time) tuples that each specify a temperature\n readings and the time the reading was taken\n\n Returns...
[ { "param": "self", "type": null }, { "param": "temp_time_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "temp_time_list", "type": null, "docstring": null, "docstring_...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
temperatures
<not_specific>
def temperatures(self): """ Returns the temperature readings for the instance Returns ------- temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was taken """ ...
Returns the temperature readings for the instance Returns ------- temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was taken
Returns the temperature readings for the instance Returns temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a temperature readings and the time the reading was taken
[ "Returns", "the", "temperature", "readings", "for", "the", "instance", "Returns", "temp_list", ":", "[", "(", "float", "time", ")", "]", "A", "list", "of", "(", "temperature", "time", ")", "tuples", "that", "each", "specify", "a", "temperature", "readings", ...
def temperatures(self): return self.temp_time_list
[ "def", "temperatures", "(", "self", ")", ":", "return", "self", ".", "temp_time_list" ]
Returns the temperature readings for the instance Returns
[ "Returns", "the", "temperature", "readings", "for", "the", "instance", "Returns" ]
[ "\"\"\"\n Returns the temperature readings for the instance\n\n Returns\n -------\n temp_list : [(float, time)]\n A list of (temperature, time) tuples that each specify a temperature\n readings and the time the reading was taken\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
start
null
def start(self): """ Marks the start time of the temperature tracker Sets the instance time of start_timestamp to current time """ self.start_timestamp = time.localtime()
Marks the start time of the temperature tracker Sets the instance time of start_timestamp to current time
Marks the start time of the temperature tracker Sets the instance time of start_timestamp to current time
[ "Marks", "the", "start", "time", "of", "the", "temperature", "tracker", "Sets", "the", "instance", "time", "of", "start_timestamp", "to", "current", "time" ]
def start(self): self.start_timestamp = time.localtime()
[ "def", "start", "(", "self", ")", ":", "self", ".", "start_timestamp", "=", "time", ".", "localtime", "(", ")" ]
Marks the start time of the temperature tracker Sets the instance time of start_timestamp to current time
[ "Marks", "the", "start", "time", "of", "the", "temperature", "tracker", "Sets", "the", "instance", "time", "of", "start_timestamp", "to", "current", "time" ]
[ "\"\"\"\n Marks the start time of the temperature tracker\n\n Sets the instance time of start_timestamp to current time\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
stop
null
def stop(self): """ Marks the stop time of the temperature tracker Sets the instance time of stop_timestamp to current time """ self.stop_timestamp = time.localtime()
Marks the stop time of the temperature tracker Sets the instance time of stop_timestamp to current time
Marks the stop time of the temperature tracker Sets the instance time of stop_timestamp to current time
[ "Marks", "the", "stop", "time", "of", "the", "temperature", "tracker", "Sets", "the", "instance", "time", "of", "stop_timestamp", "to", "current", "time" ]
def stop(self): self.stop_timestamp = time.localtime()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "stop_timestamp", "=", "time", ".", "localtime", "(", ")" ]
Marks the stop time of the temperature tracker Sets the instance time of stop_timestamp to current time
[ "Marks", "the", "stop", "time", "of", "the", "temperature", "tracker", "Sets", "the", "instance", "time", "of", "stop_timestamp", "to", "current", "time" ]
[ "\"\"\"\n Marks the stop time of the temperature tracker\n\n Sets the instance time of stop_timestamp to current time\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
summary_from
<not_specific>
def summary_from(self, temp_time_list): """ Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, each reading in human-readable format, and the the maximum, minimum, and average temperatures. Parameters ...
Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, each reading in human-readable format, and the the maximum, minimum, and average temperatures. Parameters ------- temp_list : [(float, time)] ...
Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, each reading in human-readable format, and the the maximum, minimum, and average temperatures. Parameters temp_list : [(float, time)] A list of (temperature, time) tuples that each specify a ...
[ "Prints", "out", "a", "summary", "of", "the", "temperature", "readings", "in", "easy", "to", "read", "format", ".", "Includes", "average", "temperature", "the", "number", "of", "readings", "each", "reading", "in", "human", "-", "readable", "format", "and", "...
def summary_from(self, temp_time_list): temp_dict = {} temp_dict['average'] = self.average() temp_dict['minimum'] = self.minimum() temp_dict['maximum'] = self.maximum() temp_dict['count'] = self.count() temp_dict['start_timestamp'] = self.start_timestamp temp_dict...
[ "def", "summary_from", "(", "self", ",", "temp_time_list", ")", ":", "temp_dict", "=", "{", "}", "temp_dict", "[", "'average'", "]", "=", "self", ".", "average", "(", ")", "temp_dict", "[", "'minimum'", "]", "=", "self", ".", "minimum", "(", ")", "temp...
Prints out a summary of the temperature readings in easy to read format.
[ "Prints", "out", "a", "summary", "of", "the", "temperature", "readings", "in", "easy", "to", "read", "format", "." ]
[ "\"\"\"\n Prints out a summary of the temperature readings in easy to read format.\n\n Includes average temperature, the number of readings, each reading in\n human-readable format, and the the maximum, minimum, and average temperatures.\n\n Parameters\n -------\n temp_list...
[ { "param": "self", "type": null }, { "param": "temp_time_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "temp_time_list", "type": null, "docstring": null, "docstring_...
63960cf88d57e6e0be9dad97418f7fc7e9c25a51
alwaysai/temperature-tracker
temperature_tracker.py
[ "Apache-2.0" ]
Python
summary
<not_specific>
def summary(self): """ Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, the maximum temperature and the minimum temperature. Calls summary_from() with the instance list as input to gather summary data...
Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, the maximum temperature and the minimum temperature. Calls summary_from() with the instance list as input to gather summary data Returns ----...
Prints out a summary of the temperature readings in easy to read format. Includes average temperature, the number of readings, the maximum temperature and the minimum temperature. Calls summary_from() with the instance list as input to gather summary data Returns string A string of summary details on the temperature...
[ "Prints", "out", "a", "summary", "of", "the", "temperature", "readings", "in", "easy", "to", "read", "format", ".", "Includes", "average", "temperature", "the", "number", "of", "readings", "the", "maximum", "temperature", "and", "the", "minimum", "temperature", ...
def summary(self): return self.summary_from(self.temp_time_list)
[ "def", "summary", "(", "self", ")", ":", "return", "self", ".", "summary_from", "(", "self", ".", "temp_time_list", ")" ]
Prints out a summary of the temperature readings in easy to read format.
[ "Prints", "out", "a", "summary", "of", "the", "temperature", "readings", "in", "easy", "to", "read", "format", "." ]
[ "\"\"\"\n Prints out a summary of the temperature readings in easy to read format.\n\n Includes average temperature, the number of readings,\n the maximum temperature and the minimum temperature.\n\n Calls summary_from() with the instance list as input to gather summary data\n\n R...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b27376704b076a66852a9b24b3e58576efbe36d8
xushiyan/PowerSense-helper
location_utils.py
[ "MIT" ]
Python
gen_loc_file
str
def gen_loc_file(filein: str, dir: str = None) -> str: """ Generate location data file. Remove and print out records misplaced by timestamp. :param filein: Path to the data file generated from PowerSense. :param dir: Target directory to save location data file. :return: Path to the generated l...
Generate location data file. Remove and print out records misplaced by timestamp. :param filein: Path to the data file generated from PowerSense. :param dir: Target directory to save location data file. :return: Path to the generated location data file.
Generate location data file. Remove and print out records misplaced by timestamp.
[ "Generate", "location", "data", "file", ".", "Remove", "and", "print", "out", "records", "misplaced", "by", "timestamp", "." ]
def gen_loc_file(filein: str, dir: str = None) -> str: filename, ext = splitext(basename(filein)) if not dir: dir = os.getcwd() fileout = pathjoin(dir, '_'.join([filename, 'location' + ext])) with open(fileout, 'wt') as fout: writer = csv.writer(fout) with open(filein) as fin: ...
[ "def", "gen_loc_file", "(", "filein", ":", "str", ",", "dir", ":", "str", "=", "None", ")", "->", "str", ":", "filename", ",", "ext", "=", "splitext", "(", "basename", "(", "filein", ")", ")", "if", "not", "dir", ":", "dir", "=", "os", ".", "getc...
Generate location data file.
[ "Generate", "location", "data", "file", "." ]
[ "\"\"\"\n Generate location data file.\n\n Remove and print out records misplaced by timestamp.\n\n :param filein: Path to the data file generated from PowerSense.\n :param dir: Target directory to save location data file.\n :return: Path to the generated location data file.\n \"\"\"", "# TODO: ...
[ { "param": "filein", "type": "str" }, { "param": "dir", "type": "str" } ]
{ "returns": [ { "docstring": "Path to the generated location data file.", "docstring_tokens": [ "Path", "to", "the", "generated", "location", "data", "file", "." ], "type": null } ], "raises": [], "params": [ { ...
f2f623671ee598488f13e1431b819488d81595cd
lauraguzeljblatnik/projektna-naloga-za-OPB
baza.py
[ "MIT" ]
Python
spremenigeslo_post
<not_specific>
def spremenigeslo_post(): """Obdelaj formo za spreminjanje podatkov o uporabniku.""" # Kdo je prijavljen? username = get_user() # Staro geslo (je obvezno) password1 = password_md5(request.forms.password1) # Preverimo staro geslo cur.execute ("SELECT 1 FROM uporabnik WHERE ime=%s AND geslo=%s...
Obdelaj formo za spreminjanje podatkov o uporabniku.
Obdelaj formo za spreminjanje podatkov o uporabniku.
[ "Obdelaj", "formo", "za", "spreminjanje", "podatkov", "o", "uporabniku", "." ]
def spremenigeslo_post(): username = get_user() password1 = password_md5(request.forms.password1) cur.execute ("SELECT 1 FROM uporabnik WHERE ime=%s AND geslo=%s", [username, password1]) sporocila = [] if cur.fetchone(): password2 = request.forms.password2 password3 = ...
[ "def", "spremenigeslo_post", "(", ")", ":", "username", "=", "get_user", "(", ")", "password1", "=", "password_md5", "(", "request", ".", "forms", ".", "password1", ")", "cur", ".", "execute", "(", "\"SELECT 1 FROM uporabnik WHERE ime=%s AND geslo=%s\"", ",", "[",...
Obdelaj formo za spreminjanje podatkov o uporabniku.
[ "Obdelaj", "formo", "za", "spreminjanje", "podatkov", "o", "uporabniku", "." ]
[ "\"\"\"Obdelaj formo za spreminjanje podatkov o uporabniku.\"\"\"", "# Kdo je prijavljen?", "# Staro geslo (je obvezno)", "# Preverimo staro geslo", "# Pokazali bomo eno ali več sporočil, ki jih naberemo v seznam", "# Geslo je ok", "# spremenimo geslo", "# Preverimo, ali se gesli ujemata", "# Vstavi...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7ba94b3c140e56b101c7a8be361bb8aa24cce4c4
Tdasu-Mainframes/my_boyfriend
my_boyfriend.py
[ "MIT" ]
Python
process_messages
<not_specific>
def process_messages(preprocessing_q): """ Perform synchronous message processing steps, one message at a time. Lets us reason about our messages in order without giving up the ability to handle multiple connections. """ postprocessing_queues = {} while True: # Die if orphaned ...
Perform synchronous message processing steps, one message at a time. Lets us reason about our messages in order without giving up the ability to handle multiple connections.
Perform synchronous message processing steps, one message at a time. Lets us reason about our messages in order without giving up the ability to handle multiple connections.
[ "Perform", "synchronous", "message", "processing", "steps", "one", "message", "at", "a", "time", ".", "Lets", "us", "reason", "about", "our", "messages", "in", "order", "without", "giving", "up", "the", "ability", "to", "handle", "multiple", "connections", "."...
def process_messages(preprocessing_q): postprocessing_queues = {} while True: if os.getppid() == 1: return try: connection_id, message = preprocessing_q.get() except: print(format_error("Failed to get message\n" + traceback.format_exc()), ...
[ "def", "process_messages", "(", "preprocessing_q", ")", ":", "postprocessing_queues", "=", "{", "}", "while", "True", ":", "if", "os", ".", "getppid", "(", ")", "==", "1", ":", "return", "try", ":", "connection_id", ",", "message", "=", "preprocessing_q", ...
Perform synchronous message processing steps, one message at a time.
[ "Perform", "synchronous", "message", "processing", "steps", "one", "message", "at", "a", "time", "." ]
[ "\"\"\"\n Perform synchronous message processing steps, one message at a time. Lets us reason\n about our messages in order without giving up the ability to handle multiple\n connections.\n \"\"\"", "# Die if orphaned", "# Get a message", "# Act on special messages", "# Destroy reference to a no...
[ { "param": "preprocessing_q", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "preprocessing_q", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ba94b3c140e56b101c7a8be361bb8aa24cce4c4
Tdasu-Mainframes/my_boyfriend
my_boyfriend.py
[ "MIT" ]
Python
forward
<not_specific>
def forward(receive_sock, send_sock, processing_q, result_q, connection_id): """ Handles one direction of communication in a connection. For processing messages in order, see the process_messages() function. This implementation assumes the server is finicky and will close the connection if a message is ...
Handles one direction of communication in a connection. For processing messages in order, see the process_messages() function. This implementation assumes the server is finicky and will close the connection if a message is not promptly sent after connection - to allow you editing time, we therefore wai...
Handles one direction of communication in a connection. For processing messages in order, see the process_messages() function. This implementation assumes the server is finicky and will close the connection if a message is not promptly sent after connection - to allow you editing time, we therefore wait to open the TCP...
[ "Handles", "one", "direction", "of", "communication", "in", "a", "connection", ".", "For", "processing", "messages", "in", "order", "see", "the", "process_messages", "()", "function", ".", "This", "implementation", "assumes", "the", "server", "is", "finicky", "a...
def forward(receive_sock, send_sock, processing_q, result_q, connection_id): return_sock = False readable, writable, exception = select.select( [receive_sock], [send_sock] if send_sock is not None else [], ...
[ "def", "forward", "(", "receive_sock", ",", "send_sock", ",", "processing_q", ",", "result_q", ",", "connection_id", ")", ":", "return_sock", "=", "False", "readable", ",", "writable", ",", "exception", "=", "select", ".", "select", "(", "[", "receive_sock", ...
Handles one direction of communication in a connection.
[ "Handles", "one", "direction", "of", "communication", "in", "a", "connection", "." ]
[ "\"\"\"\n Handles one direction of communication in a connection. For processing messages\n in order, see the process_messages() function. This implementation assumes the\n server is finicky and will close the connection if a message is not promptly sent\n after connection - to allow you editing time, w...
[ { "param": "receive_sock", "type": null }, { "param": "send_sock", "type": null }, { "param": "processing_q", "type": null }, { "param": "result_q", "type": null }, { "param": "connection_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "receive_sock", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "send_sock", "type": null, "docstring": null, "docstri...
7ba94b3c140e56b101c7a8be361bb8aa24cce4c4
Tdasu-Mainframes/my_boyfriend
my_boyfriend.py
[ "MIT" ]
Python
manage_connections
<not_specific>
def manage_connections(listen_sock, processing_q, connection_id): """ Handle logic required to set up and maintain connections. The ability to hack this is the main selling point of alsanna - for instance if you need to send a plaintext message from the server to the client prior to TLS negotiation, you...
Handle logic required to set up and maintain connections. The ability to hack this is the main selling point of alsanna - for instance if you need to send a plaintext message from the server to the client prior to TLS negotiation, you can do it here. So that we can have all the protocol logic in one p...
Handle logic required to set up and maintain connections. The ability to hack this is the main selling point of alsanna - for instance if you need to send a plaintext message from the server to the client prior to TLS negotiation, you can do it here. So that we can have all the protocol logic in one place, we handle b...
[ "Handle", "logic", "required", "to", "set", "up", "and", "maintain", "connections", ".", "The", "ability", "to", "hack", "this", "is", "the", "main", "selling", "point", "of", "alsanna", "-", "for", "instance", "if", "you", "need", "to", "send", "a", "pl...
def manage_connections(listen_sock, processing_q, connection_id): q_manager = multiprocessing.Manager() c_result_q = q_manager.Queue() processing_q.put((str(connection_id) + "c", c_result_q)) s_result_q = q_manager.Queue() processing_q.put((str(connection_id) + "s", s_result_q)) with listen_sock...
[ "def", "manage_connections", "(", "listen_sock", ",", "processing_q", ",", "connection_id", ")", ":", "q_manager", "=", "multiprocessing", ".", "Manager", "(", ")", "c_result_q", "=", "q_manager", ".", "Queue", "(", ")", "processing_q", ".", "put", "(", "(", ...
Handle logic required to set up and maintain connections.
[ "Handle", "logic", "required", "to", "set", "up", "and", "maintain", "connections", "." ]
[ "\"\"\"\n Handle logic required to set up and maintain connections. The ability to hack this\n is the main selling point of alsanna - for instance if you need to send a plaintext\n message from the server to the client prior to TLS negotiation, you can do it here.\n\n So that we can have all the protoco...
[ { "param": "listen_sock", "type": null }, { "param": "processing_q", "type": null }, { "param": "connection_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "listen_sock", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "processing_q", "type": null, "docstring": null, "docst...
7ba94b3c140e56b101c7a8be361bb8aa24cce4c4
Tdasu-Mainframes/my_boyfriend
my_boyfriend.py
[ "MIT" ]
Python
main
null
def main(): """ Highest-level server logic. Sets up the synchronous message processor, sets up connections, and spins up a subprocess to handle each connection. """ processing_q = multiprocessing.Queue() message_processor = multiprocessing.Process(target=process_messages, ...
Highest-level server logic. Sets up the synchronous message processor, sets up connections, and spins up a subprocess to handle each connection.
Highest-level server logic. Sets up the synchronous message processor, sets up connections, and spins up a subprocess to handle each connection.
[ "Highest", "-", "level", "server", "logic", ".", "Sets", "up", "the", "synchronous", "message", "processor", "sets", "up", "connections", "and", "spins", "up", "a", "subprocess", "to", "handle", "each", "connection", "." ]
def main(): processing_q = multiprocessing.Queue() message_processor = multiprocessing.Process(target=process_messages, args=(processing_q,)) message_processor.daemon = True message_processor.start() connection_id = 0 connections = {} l_sock = ...
[ "def", "main", "(", ")", ":", "processing_q", "=", "multiprocessing", ".", "Queue", "(", ")", "message_processor", "=", "multiprocessing", ".", "Process", "(", "target", "=", "process_messages", ",", "args", "=", "(", "processing_q", ",", ")", ")", "message_...
Highest-level server logic.
[ "Highest", "-", "level", "server", "logic", "." ]
[ "\"\"\"\n Highest-level server logic. Sets up the synchronous message processor, sets up\n connections, and spins up a subprocess to handle each connection.\n \"\"\"", "# Allow socket to be reused quickly after quitting." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b483793b845aafebb21550136b62ea5da88758ec
dylanfinkbeiner/disentangled_bert
jiant/models.py
[ "MIT" ]
Python
build_model
<not_specific>
def build_model(args, vocab, pretrained_embs, tasks): """ Build model according to args Returns: model which has attributes set in it with the attrbutes. """ # Build embeddings. if args.input_module == "gpt": # Note: incompatible with other embedders, but logic in preprocess.py ...
Build model according to args Returns: model which has attributes set in it with the attrbutes.
Build model according to args Returns: model which has attributes set in it with the attrbutes.
[ "Build", "model", "according", "to", "args", "Returns", ":", "model", "which", "has", "attributes", "set", "in", "it", "with", "the", "attrbutes", "." ]
def build_model(args, vocab, pretrained_embs, tasks): if args.input_module == "gpt": from .openai_transformer_lm.utils import OpenAIEmbedderModule log.info("Using OpenAI transformer model.") cove_layer = None embedder = OpenAIEmbedderModule(args) d_emb = embedder.get_output_d...
[ "def", "build_model", "(", "args", ",", "vocab", ",", "pretrained_embs", ",", "tasks", ")", ":", "if", "args", ".", "input_module", "==", "\"gpt\"", ":", "from", ".", "openai_transformer_lm", ".", "utils", "import", "OpenAIEmbedderModule", "log", ".", "info", ...
Build model according to args Returns: model which has attributes set in it with the attrbutes.
[ "Build", "model", "according", "to", "args", "Returns", ":", "model", "which", "has", "attributes", "set", "in", "it", "with", "the", "attrbutes", "." ]
[ "\"\"\"\n Build model according to args\n Returns: model which has attributes set in it with the attrbutes.\n \"\"\"", "# Build embeddings.", "# Note: incompatible with other embedders, but logic in preprocess.py", "# should prevent these from being enabled anyway.", "# Here, this uses openAIEmbedd...
[ { "param": "args", "type": null }, { "param": "vocab", "type": null }, { "param": "pretrained_embs", "type": null }, { "param": "tasks", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vocab", "type": null, "docstring": null, "docstring_tokens": ...
b483793b845aafebb21550136b62ea5da88758ec
dylanfinkbeiner/disentangled_bert
jiant/models.py
[ "MIT" ]
Python
build_task_specific_modules
null
def build_task_specific_modules(task, model, d_sent, d_emb, vocab, embedder, args): """ Build task-specific components for a task and add them to model. These include decoders, linear layers for linear models. """ #XXX We need to get the input size right for the final classification layers if a...
Build task-specific components for a task and add them to model. These include decoders, linear layers for linear models.
Build task-specific components for a task and add them to model. These include decoders, linear layers for linear models.
[ "Build", "task", "-", "specific", "components", "for", "a", "task", "and", "add", "them", "to", "model", ".", "These", "include", "decoders", "linear", "layers", "for", "linear", "models", "." ]
def build_task_specific_modules(task, model, d_sent, d_emb, vocab, embedder, args): if args.special_task: if task.subspace == 'syn': if not 'adv' in task.name: d_sent = args.k_syn + args.k_shared else: d_sent = args.k_syn if task.subspace == 's...
[ "def", "build_task_specific_modules", "(", "task", ",", "model", ",", "d_sent", ",", "d_emb", ",", "vocab", ",", "embedder", ",", "args", ")", ":", "if", "args", ".", "special_task", ":", "if", "task", ".", "subspace", "==", "'syn'", ":", "if", "not", ...
Build task-specific components for a task and add them to model.
[ "Build", "task", "-", "specific", "components", "for", "a", "task", "and", "add", "them", "to", "model", "." ]
[ "\"\"\" Build task-specific components for a task and add them to model.\n These include decoders, linear layers for linear models.\n \"\"\"", "#XXX We need to get the input size right for the final classification layers", "#d_sent = args.k_syn", "#d_sent = args.k_sem", "#XXX", "# CoLA, for exa...
[ { "param": "task", "type": null }, { "param": "model", "type": null }, { "param": "d_sent", "type": null }, { "param": "d_emb", "type": null }, { "param": "vocab", "type": null }, { "param": "embedder", "type": null }, { "param": "args", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "task", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": ...
b483793b845aafebb21550136b62ea5da88758ec
dylanfinkbeiner/disentangled_bert
jiant/models.py
[ "MIT" ]
Python
build_single_sentence_module
<not_specific>
def build_single_sentence_module(task, d_inp: int, use_bert: bool, params: Params): """ Build a single sentence classifier args: - task (Task): task object, used to get the number of output classes - d_inp (int): input dimension to the module, needed for optional linear projection - use...
Build a single sentence classifier args: - task (Task): task object, used to get the number of output classes - d_inp (int): input dimension to the module, needed for optional linear projection - use_bert (bool): if using BERT, skip projection before pooling. - params (Params): Par...
Build a single sentence classifier args: task (Task): task object, used to get the number of output classes d_inp (int): input dimension to the module, needed for optional linear projection use_bert (bool): if using BERT, skip projection before pooling. params (Params): Params object with task-specific parameters Sing...
[ "Build", "a", "single", "sentence", "classifier", "args", ":", "task", "(", "Task", ")", ":", "task", "object", "used", "to", "get", "the", "number", "of", "output", "classes", "d_inp", "(", "int", ")", ":", "input", "dimension", "to", "the", "module", ...
def build_single_sentence_module(task, d_inp: int, use_bert: bool, params: Params): pooler = Pooler( project=not use_bert, d_inp=d_inp, d_proj=params["d_proj"], pool_type=params["pool_type"] ) d_out = d_inp if use_bert else params["d_proj"] classifier = Classifier.from...
[ "def", "build_single_sentence_module", "(", "task", ",", "d_inp", ":", "int", ",", "use_bert", ":", "bool", ",", "params", ":", "Params", ")", ":", "pooler", "=", "Pooler", "(", "project", "=", "not", "use_bert", ",", "d_inp", "=", "d_inp", ",", "d_proj"...
Build a single sentence classifier args: task (Task): task object, used to get the number of output classes d_inp (int): input dimension to the module, needed for optional linear projection use_bert (bool): if using BERT, skip projection before pooling.
[ "Build", "a", "single", "sentence", "classifier", "args", ":", "task", "(", "Task", ")", ":", "task", "object", "used", "to", "get", "the", "number", "of", "output", "classes", "d_inp", "(", "int", ")", ":", "input", "dimension", "to", "the", "module", ...
[ "\"\"\" Build a single sentence classifier\n\n args:\n - task (Task): task object, used to get the number of output classes\n - d_inp (int): input dimension to the module, needed for optional linear projection\n - use_bert (bool): if using BERT, skip projection before pooling.\n - par...
[ { "param": "task", "type": null }, { "param": "d_inp", "type": "int" }, { "param": "use_bert", "type": "bool" }, { "param": "params", "type": "Params" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "task", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d_inp", "type": "int", "docstring": null, "docstring_tokens":...
b483793b845aafebb21550136b62ea5da88758ec
dylanfinkbeiner/disentangled_bert
jiant/models.py
[ "MIT" ]
Python
build_pair_sentence_module
<not_specific>
def build_pair_sentence_module(task, d_inp, model, params): """ Build a pair classifier, shared if necessary """ def build_pair_attn(d_in, d_hid_attn): """ Build the pair model """ d_inp_model = 2 * d_in modeling_layer = s2s_e.by_name("lstm").from_params( Params( ...
Build a pair classifier, shared if necessary
Build a pair classifier, shared if necessary
[ "Build", "a", "pair", "classifier", "shared", "if", "necessary" ]
def build_pair_sentence_module(task, d_inp, model, params): def build_pair_attn(d_in, d_hid_attn): d_inp_model = 2 * d_in modeling_layer = s2s_e.by_name("lstm").from_params( Params( { "input_size": d_inp_model, "hidden_size": d_hid_...
[ "def", "build_pair_sentence_module", "(", "task", ",", "d_inp", ",", "model", ",", "params", ")", ":", "def", "build_pair_attn", "(", "d_in", ",", "d_hid_attn", ")", ":", "\"\"\" Build the pair model \"\"\"", "d_inp_model", "=", "2", "*", "d_in", "modeling_layer",...
Build a pair classifier, shared if necessary
[ "Build", "a", "pair", "classifier", "shared", "if", "necessary" ]
[ "\"\"\" Build a pair classifier, shared if necessary \"\"\"", "\"\"\" Build the pair model \"\"\"", "# Build the \"pooler\", which does pools a variable length sequence", "# possibly with a projection layer beforehand", "# Build an attention module if necessary", "# shared attn", "# non-shared attn", ...
[ { "param": "task", "type": null }, { "param": "d_inp", "type": null }, { "param": "model", "type": null }, { "param": "params", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "task", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d_inp", "type": null, "docstring": null, "docstring_tokens": ...
b483793b845aafebb21550136b62ea5da88758ec
dylanfinkbeiner/disentangled_bert
jiant/models.py
[ "MIT" ]
Python
forward
<not_specific>
def forward(self, task, batch, predict=False): """ Pass inputs to correct forward pass Args: - task (tasks.Task): task for which batch is drawn - batch (Dict[str:Dict[str:Tensor]]): dictionary of (field, indexing) pairs, where indexing is a dict of the ind...
Pass inputs to correct forward pass Args: - task (tasks.Task): task for which batch is drawn - batch (Dict[str:Dict[str:Tensor]]): dictionary of (field, indexing) pairs, where indexing is a dict of the index namespace and the actual indices. - predict...
Pass inputs to correct forward pass
[ "Pass", "inputs", "to", "correct", "forward", "pass" ]
def forward(self, task, batch, predict=False): if self.utilization is not None: if "input1" in batch: self.utilization(get_batch_utilization(batch["input1"])) elif "input" in batch: self.utilization(get_batch_utilization(batch["input"])) if isinsta...
[ "def", "forward", "(", "self", ",", "task", ",", "batch", ",", "predict", "=", "False", ")", ":", "if", "self", ".", "utilization", "is", "not", "None", ":", "if", "\"input1\"", "in", "batch", ":", "self", ".", "utilization", "(", "get_batch_utilization"...
Pass inputs to correct forward pass
[ "Pass", "inputs", "to", "correct", "forward", "pass" ]
[ "\"\"\"\n Pass inputs to correct forward pass\n Args:\n - task (tasks.Task): task for which batch is drawn\n - batch (Dict[str:Dict[str:Tensor]]): dictionary of (field, indexing) pairs,\n where indexing is a dict of the index namespace and the actual indices.\n ...
[ { "param": "self", "type": null }, { "param": "task", "type": null }, { "param": "batch", "type": null }, { "param": "predict", "type": null } ]
{ "returns": [ { "docstring": "dictionary containing task outputs and loss if label was in batch", "docstring_tokens": [ "dictionary", "containing", "task", "outputs", "and", "loss", "if", "label", "was", "in", "ba...
ecb7239bf5089622ee04456c4551f2b4525eafb7
dylanfinkbeiner/disentangled_bert
jiant/trainer.py
[ "MIT" ]
Python
build_trainer
<not_specific>
def build_trainer( args, task_names, model, run_dir, metric_should_decrease=True, train_type="SamplingMultiTaskTrainer", phase="pretrain", ): """Build a trainer from params. Parameters ---------- params: Trainer parameters as built by build_trainer_params. model: A modul...
Build a trainer from params. Parameters ---------- params: Trainer parameters as built by build_trainer_params. model: A module with trainable parameters. run_dir: The directory where we save the models. Returns ------- A trainer object, a trainer config object, an optimizer config obj...
Build a trainer from params. Parameters Trainer parameters as built by build_trainer_params. model: A module with trainable parameters. run_dir: The directory where we save the models. Returns A trainer object, a trainer config object, an optimizer config object, and a scheduler config object.
[ "Build", "a", "trainer", "from", "params", ".", "Parameters", "Trainer", "parameters", "as", "built", "by", "build_trainer_params", ".", "model", ":", "A", "module", "with", "trainable", "parameters", ".", "run_dir", ":", "The", "directory", "where", "we", "sa...
def build_trainer( args, task_names, model, run_dir, metric_should_decrease=True, train_type="SamplingMultiTaskTrainer", phase="pretrain", ): params = build_trainer_params(args, task_names, phase) opt_params = {"type": params["optimizer"], "lr": params["lr"]} if params["optimizer...
[ "def", "build_trainer", "(", "args", ",", "task_names", ",", "model", ",", "run_dir", ",", "metric_should_decrease", "=", "True", ",", "train_type", "=", "\"SamplingMultiTaskTrainer\"", ",", "phase", "=", "\"pretrain\"", ",", ")", ":", "params", "=", "build_trai...
Build a trainer from params.
[ "Build", "a", "trainer", "from", "params", "." ]
[ "\"\"\"Build a trainer from params.\n\n Parameters\n ----------\n params: Trainer parameters as built by build_trainer_params.\n model: A module with trainable parameters.\n run_dir: The directory where we save the models.\n\n Returns\n -------\n A trainer object, a trainer config object, an...
[ { "param": "args", "type": null }, { "param": "task_names", "type": null }, { "param": "model", "type": null }, { "param": "run_dir", "type": null }, { "param": "metric_should_decrease", "type": null }, { "param": "train_type", "type": null }, ...
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "task_names", "type": null, "docstring": null, "docstring_toke...
ecb7239bf5089622ee04456c4551f2b4525eafb7
dylanfinkbeiner/disentangled_bert
jiant/trainer.py
[ "MIT" ]
Python
_setup_training
<not_specific>
def _setup_training( self, tasks, batch_size, train_params, optimizer_params, scheduler_params, phase ): """ Set up the trainer by initializing task_infos and metric_infos, which track necessary information about the training status of each task and metric respectively. Returns: ...
Set up the trainer by initializing task_infos and metric_infos, which track necessary information about the training status of each task and metric respectively. Returns: - task_infos (Dict[str:Dict[str:???]]): dictionary containing where each task_info contains: ...
Set up the trainer by initializing task_infos and metric_infos, which track necessary information about the training status of each task and metric respectively.
[ "Set", "up", "the", "trainer", "by", "initializing", "task_infos", "and", "metric_infos", "which", "track", "necessary", "information", "about", "the", "training", "status", "of", "each", "task", "and", "metric", "respectively", "." ]
def _setup_training( self, tasks, batch_size, train_params, optimizer_params, scheduler_params, phase ): task_infos = {task.name: {} for task in tasks} for task in tasks: task_info = task_infos[task.name] if ( os.path.exists(os.path.join(self._serializ...
[ "def", "_setup_training", "(", "self", ",", "tasks", ",", "batch_size", ",", "train_params", ",", "optimizer_params", ",", "scheduler_params", ",", "phase", ")", ":", "task_infos", "=", "{", "task", ".", "name", ":", "{", "}", "for", "task", "in", "tasks",...
Set up the trainer by initializing task_infos and metric_infos, which track necessary information about the training status of each task and metric respectively.
[ "Set", "up", "the", "trainer", "by", "initializing", "task_infos", "and", "metric_infos", "which", "track", "necessary", "information", "about", "the", "training", "status", "of", "each", "task", "and", "metric", "respectively", "." ]
[ "\"\"\" Set up the trainer by initializing task_infos and metric_infos, which\n track necessary information about the training status of each task and metric respectively.\n\n Returns:\n - task_infos (Dict[str:Dict[str:???]]): dictionary containing where each task_info\n contai...
[ { "param": "self", "type": null }, { "param": "tasks", "type": null }, { "param": "batch_size", "type": null }, { "param": "train_params", "type": null }, { "param": "optimizer_params", "type": null }, { "param": "scheduler_params", "type": null ...
{ "returns": [ { "docstring": "task_infos (Dict[str:Dict[str:???]]): dictionary containing where each task_info\ncontains:\niterator: a task specific (because it uses that task's fields to dynamically\nbatch) batcher\nn_tr_batches: the number of training batches\ntr_generator: generator object that returns ...
ecb7239bf5089622ee04456c4551f2b4525eafb7
dylanfinkbeiner/disentangled_bert
jiant/trainer.py
[ "MIT" ]
Python
_calculate_validation_performance
<not_specific>
def _calculate_validation_performance( self, task, task_infos, tasks, batch_size, all_val_metrics, n_examples_overall ): """ Builds validation generator, evaluates on each task and produces validation metrics. Parameters ---------- task: current task to get validatio...
Builds validation generator, evaluates on each task and produces validation metrics. Parameters ---------- task: current task to get validation performance of task_infos: Instance of information about the task (see _setup_training for definition) tasks: list of task obj...
Builds validation generator, evaluates on each task and produces validation metrics. Parameters current task to get validation performance of task_infos: Instance of information about the task tasks: list of task objects to train on batch_size: int, batch size to use for the tasks all_val_metrics: dictionary. storing ...
[ "Builds", "validation", "generator", "evaluates", "on", "each", "task", "and", "produces", "validation", "metrics", ".", "Parameters", "current", "task", "to", "get", "validation", "performance", "of", "task_infos", ":", "Instance", "of", "information", "about", "...
def _calculate_validation_performance( self, task, task_infos, tasks, batch_size, all_val_metrics, n_examples_overall ): n_examples, batch_num = 0, 0 task_info = task_infos[task.name] if self._val_data_limit >= 0: max_data_points = min(task.n_val_examples, self._val_data_...
[ "def", "_calculate_validation_performance", "(", "self", ",", "task", ",", "task_infos", ",", "tasks", ",", "batch_size", ",", "all_val_metrics", ",", "n_examples_overall", ")", ":", "n_examples", ",", "batch_num", "=", "0", ",", "0", "task_info", "=", "task_inf...
Builds validation generator, evaluates on each task and produces validation metrics.
[ "Builds", "validation", "generator", "evaluates", "on", "each", "task", "and", "produces", "validation", "metrics", "." ]
[ "\"\"\"\n Builds validation generator, evaluates on each task and produces validation metrics.\n\n Parameters\n ----------\n task: current task to get validation performance of\n task_infos: Instance of information about the task (see _setup_training for definition)\n tasks...
[ { "param": "self", "type": null }, { "param": "task", "type": null }, { "param": "task_infos", "type": null }, { "param": "tasks", "type": null }, { "param": "batch_size", "type": null }, { "param": "all_val_metrics", "type": null }, { "par...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "task", "type": null, "docstring": null, "docstring_tokens": [...
ecb7239bf5089622ee04456c4551f2b4525eafb7
dylanfinkbeiner/disentangled_bert
jiant/trainer.py
[ "MIT" ]
Python
_save_checkpoint
null
def _save_checkpoint(self, training_state, phase="pretrain", new_best=False, tasks=None): """ Parameters ---------- training_state: An object containing trainer state (step number, etc.), to be saved. phase: Usually 'pretrain' or 'target_train'. new_best: If true, the sav...
Parameters ---------- training_state: An object containing trainer state (step number, etc.), to be saved. phase: Usually 'pretrain' or 'target_train'. new_best: If true, the saved checkpoint will be marked with .best_macro, and potentially used later when switching ...
Parameters training_state: An object containing trainer state (step number, etc.), to be saved. phase: Usually 'pretrain' or 'target_train'. new_best: If true, the saved checkpoint will be marked with .best_macro, and potentially used later when switching from pretraining to target task training.
[ "Parameters", "training_state", ":", "An", "object", "containing", "trainer", "state", "(", "step", "number", "etc", ".", ")", "to", "be", "saved", ".", "phase", ":", "Usually", "'", "pretrain", "'", "or", "'", "target_train", "'", ".", "new_best", ":", ...
def _save_checkpoint(self, training_state, phase="pretrain", new_best=False, tasks=None): if not self._serialization_dir: raise ConfigurationError( "serialization_dir not specified - cannot " "restore a model without a directory path." ) val_pass =...
[ "def", "_save_checkpoint", "(", "self", ",", "training_state", ",", "phase", "=", "\"pretrain\"", ",", "new_best", "=", "False", ",", "tasks", "=", "None", ")", ":", "if", "not", "self", ".", "_serialization_dir", ":", "raise", "ConfigurationError", "(", "\"...
Parameters training_state: An object containing trainer state (step number, etc.
[ "Parameters", "training_state", ":", "An", "object", "containing", "trainer", "state", "(", "step", "number", "etc", "." ]
[ "\"\"\"\n Parameters\n ----------\n training_state: An object containing trainer state (step number, etc.), to be saved.\n phase: Usually 'pretrain' or 'target_train'.\n new_best: If true, the saved checkpoint will be marked with .best_macro, and\n potentially used late...
[ { "param": "self", "type": null }, { "param": "training_state", "type": null }, { "param": "phase", "type": null }, { "param": "new_best", "type": null }, { "param": "tasks", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "training_state", "type": null, "docstring": null, "docstring_...
e0e0eabea10340ed531df60336756c313269197f
zopefoundation/zope.dublincore
src/zope/dublincore/creatorannotator.py
[ "ZPL-2.1" ]
Python
CreatorAnnotator
<not_specific>
def CreatorAnnotator(object, event=None): """Update Dublin-Core creator property""" if event is None: # annotator was only called the event as only argument object = object.object dc = IZopeDublinCore(object, None) # Principals that can create objects do not necessarily have # 'zope....
Update Dublin-Core creator property
Update Dublin-Core creator property
[ "Update", "Dublin", "-", "Core", "creator", "property" ]
def CreatorAnnotator(object, event=None): if event is None: object = object.object dc = IZopeDublinCore(object, None) dc = removeSecurityProxy(dc) if dc is None: return interaction = queryInteraction() if interaction is not None: for participation in interaction.participa...
[ "def", "CreatorAnnotator", "(", "object", ",", "event", "=", "None", ")", ":", "if", "event", "is", "None", ":", "object", "=", "object", ".", "object", "dc", "=", "IZopeDublinCore", "(", "object", ",", "None", ")", "dc", "=", "removeSecurityProxy", "(",...
Update Dublin-Core creator property
[ "Update", "Dublin", "-", "Core", "creator", "property" ]
[ "\"\"\"Update Dublin-Core creator property\"\"\"", "# annotator was only called the event as only argument", "# Principals that can create objects do not necessarily have", "# 'zope.app.dublincore.change' permission.", "# https://bugs.launchpad.net/zope3/+bug/98124", "# Try to find a principal for that on...
[ { "param": "object", "type": null }, { "param": "event", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "object", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": null, "docstring": null, "docstring_tokens"...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
create_pipeline
null
def create_pipeline(name, skip_config, env): """Create a new modular pipeline by providing the new pipeline name as an argument.""" try: context = load_context(Path.cwd(), env=env) except Exception as err: # pylint: disable=broad-except _handle_exception( f"Unable to load Kedro ...
Create a new modular pipeline by providing the new pipeline name as an argument.
Create a new modular pipeline by providing the new pipeline name as an argument.
[ "Create", "a", "new", "modular", "pipeline", "by", "providing", "the", "new", "pipeline", "name", "as", "an", "argument", "." ]
def create_pipeline(name, skip_config, env): try: context = load_context(Path.cwd(), env=env) except Exception as err: _handle_exception( f"Unable to load Kedro context with environment `{env}`. " f"Make sure it exists in the project configuration.\nError: {err}" ...
[ "def", "create_pipeline", "(", "name", ",", "skip_config", ",", "env", ")", ":", "try", ":", "context", "=", "load_context", "(", "Path", ".", "cwd", "(", ")", ",", "env", "=", "env", ")", "except", "Exception", "as", "err", ":", "_handle_exception", "...
Create a new modular pipeline by providing the new pipeline name as an argument.
[ "Create", "a", "new", "modular", "pipeline", "by", "providing", "the", "new", "pipeline", "name", "as", "an", "argument", "." ]
[ "\"\"\"Create a new modular pipeline by providing the new pipeline name as an argument.\"\"\"", "# pylint: disable=broad-except" ]
[ { "param": "name", "type": null }, { "param": "skip_config", "type": null }, { "param": "env", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "skip_config", "type": null, "docstring": null, "docstring_tok...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
delete_pipeline
null
def delete_pipeline(name, env, yes): """Delete a modular pipeline by providing the pipeline name as an argument.""" try: context = load_context(Path.cwd(), env=env) except Exception as err: # pylint: disable=broad-except _handle_exception( f"Unable to load Kedro context with env...
Delete a modular pipeline by providing the pipeline name as an argument.
Delete a modular pipeline by providing the pipeline name as an argument.
[ "Delete", "a", "modular", "pipeline", "by", "providing", "the", "pipeline", "name", "as", "an", "argument", "." ]
def delete_pipeline(name, env, yes): try: context = load_context(Path.cwd(), env=env) except Exception as err: _handle_exception( f"Unable to load Kedro context with environment `{env}`. " f"Make sure it exists in the project configuration.\nError: {err}" ) ...
[ "def", "delete_pipeline", "(", "name", ",", "env", ",", "yes", ")", ":", "try", ":", "context", "=", "load_context", "(", "Path", ".", "cwd", "(", ")", ",", "env", "=", "env", ")", "except", "Exception", "as", "err", ":", "_handle_exception", "(", "f...
Delete a modular pipeline by providing the pipeline name as an argument.
[ "Delete", "a", "modular", "pipeline", "by", "providing", "the", "pipeline", "name", "as", "an", "argument", "." ]
[ "\"\"\"Delete a modular pipeline by providing the pipeline name as an argument.\"\"\"", "# pylint: disable=broad-except" ]
[ { "param": "name", "type": null }, { "param": "env", "type": null }, { "param": "yes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "env", "type": null, "docstring": null, "docstring_tokens": []...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
list_pipelines
null
def list_pipelines(env): """List all pipelines defined in your pipeline.py file.""" context = load_context(Path.cwd(), env=env) project_pipelines = context.pipelines click.echo(yaml.dump(sorted(project_pipelines)))
List all pipelines defined in your pipeline.py file.
List all pipelines defined in your pipeline.py file.
[ "List", "all", "pipelines", "defined", "in", "your", "pipeline", ".", "py", "file", "." ]
def list_pipelines(env): context = load_context(Path.cwd(), env=env) project_pipelines = context.pipelines click.echo(yaml.dump(sorted(project_pipelines)))
[ "def", "list_pipelines", "(", "env", ")", ":", "context", "=", "load_context", "(", "Path", ".", "cwd", "(", ")", ",", "env", "=", "env", ")", "project_pipelines", "=", "context", ".", "pipelines", "click", ".", "echo", "(", "yaml", ".", "dump", "(", ...
List all pipelines defined in your pipeline.py file.
[ "List", "all", "pipelines", "defined", "in", "your", "pipeline", ".", "py", "file", "." ]
[ "\"\"\"List all pipelines defined in your pipeline.py file.\"\"\"" ]
[ { "param": "env", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "env", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
describe_pipeline
null
def describe_pipeline(name, env): """Describe a pipeline by providing the pipeline name as an argument.""" context = load_context(Path.cwd(), env=env) pipeline_obj = context.pipelines.get(name) if not pipeline_obj: existing_pipelines = ", ".join(sorted(context.pipelines.keys())) raise Ke...
Describe a pipeline by providing the pipeline name as an argument.
Describe a pipeline by providing the pipeline name as an argument.
[ "Describe", "a", "pipeline", "by", "providing", "the", "pipeline", "name", "as", "an", "argument", "." ]
def describe_pipeline(name, env): context = load_context(Path.cwd(), env=env) pipeline_obj = context.pipelines.get(name) if not pipeline_obj: existing_pipelines = ", ".join(sorted(context.pipelines.keys())) raise KedroCliError( f"`{name}` pipeline not found. Existing pipelines: [...
[ "def", "describe_pipeline", "(", "name", ",", "env", ")", ":", "context", "=", "load_context", "(", "Path", ".", "cwd", "(", ")", ",", "env", "=", "env", ")", "pipeline_obj", "=", "context", ".", "pipelines", ".", "get", "(", "name", ")", "if", "not"...
Describe a pipeline by providing the pipeline name as an argument.
[ "Describe", "a", "pipeline", "by", "providing", "the", "pipeline", "name", "as", "an", "argument", "." ]
[ "\"\"\"Describe a pipeline by providing the pipeline name as an argument.\"\"\"", "# pylint: disable=protected-access" ]
[ { "param": "name", "type": null }, { "param": "env", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "env", "type": null, "docstring": null, "docstring_tokens": []...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
pull_package
null
def pull_package(package_path, env, alias): """Pull a modular pipeline package, unpack it and install the files to corresponding locations. """ # pylint: disable=import-outside-toplevel import fsspec from kedro.io.core import get_protocol_and_path protocol, _ = get_protocol_and_path(package...
Pull a modular pipeline package, unpack it and install the files to corresponding locations.
Pull a modular pipeline package, unpack it and install the files to corresponding locations.
[ "Pull", "a", "modular", "pipeline", "package", "unpack", "it", "and", "install", "the", "files", "to", "corresponding", "locations", "." ]
def pull_package(package_path, env, alias): import fsspec from kedro.io.core import get_protocol_and_path protocol, _ = get_protocol_and_path(package_path) filesystem = fsspec.filesystem(protocol) with tempfile.TemporaryDirectory() as temp_dir: temp_dir_path = Path(temp_dir).resolve() ...
[ "def", "pull_package", "(", "package_path", ",", "env", ",", "alias", ")", ":", "import", "fsspec", "from", "kedro", ".", "io", ".", "core", "import", "get_protocol_and_path", "protocol", ",", "_", "=", "get_protocol_and_path", "(", "package_path", ")", "files...
Pull a modular pipeline package, unpack it and install the files to corresponding locations.
[ "Pull", "a", "modular", "pipeline", "package", "unpack", "it", "and", "install", "the", "files", "to", "corresponding", "locations", "." ]
[ "\"\"\"Pull a modular pipeline package, unpack it and install the files to corresponding\n locations.\n \"\"\"", "# pylint: disable=import-outside-toplevel", "# `--no-deps` should fetch only one wheel file, and CLI should fail if that's", "# not the case.", "# Extract package name, based on the naming...
[ { "param": "package_path", "type": null }, { "param": "env", "type": null }, { "param": "alias", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "package_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "env", "type": null, "docstring": null, "docstring_tok...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
_sync_dirs
null
def _sync_dirs(source: Path, target: Path, prefix: str = ""): """Recursively copies `source` directory into `target` directory without overwriting any existing files/directories in the target using the following rules: 1) Skip any files/directories from source have same names as files in target. ...
Recursively copies `source` directory into `target` directory without overwriting any existing files/directories in the target using the following rules: 1) Skip any files/directories from source have same names as files in target. 2) Copy all files from source to target. 3) Recursively ...
Recursively copies `source` directory into `target` directory without overwriting any existing files/directories in the target using the following rules: 1) Skip any files/directories from source have same names as files in target. 2) Copy all files from source to target. 3) Recursively copy all directories from source...
[ "Recursively", "copies", "`", "source", "`", "directory", "into", "`", "target", "`", "directory", "without", "overwriting", "any", "existing", "files", "/", "directories", "in", "the", "target", "using", "the", "following", "rules", ":", "1", ")", "Skip", "...
def _sync_dirs(source: Path, target: Path, prefix: str = ""): existing = list(target.iterdir()) if target.is_dir() else [] existing_files = {f.name for f in existing if f.is_file()} existing_folders = {f.name for f in existing if f.is_dir()} for source_path in source.iterdir(): source_name = sou...
[ "def", "_sync_dirs", "(", "source", ":", "Path", ",", "target", ":", "Path", ",", "prefix", ":", "str", "=", "\"\"", ")", ":", "existing", "=", "list", "(", "target", ".", "iterdir", "(", ")", ")", "if", "target", ".", "is_dir", "(", ")", "else", ...
Recursively copies `source` directory into `target` directory without overwriting any existing files/directories in the target using the following rules: 1) Skip any files/directories from source have same names as files in target.
[ "Recursively", "copies", "`", "source", "`", "directory", "into", "`", "target", "`", "directory", "without", "overwriting", "any", "existing", "files", "/", "directories", "in", "the", "target", "using", "the", "following", "rules", ":", "1", ")", "Skip", "...
[ "\"\"\"Recursively copies `source` directory into `target` directory without\n overwriting any existing files/directories in the target using the following\n rules:\n 1) Skip any files/directories from source have same names as files in target.\n 2) Copy all files from source to target.\n ...
[ { "param": "source", "type": "Path" }, { "param": "target", "type": "Path" }, { "param": "prefix", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "source", "type": "Path", "docstring": "A local directory to copy from, must exist.", "docstring_tokens": [ "A", "local", "directory", "to", "copy", "from", "must", ...
a537e7cac929086dceea1937c050348a35a3836c
eferm/kedro
kedro/framework/cli/pipeline.py
[ "Apache-2.0" ]
Python
_get_package_artifacts
Tuple[Path, Path, Path]
def _get_package_artifacts( source_path: Path, package_name: str ) -> Tuple[Path, Path, Path]: """From existing unpacked wheel, returns in order: source_path, tests_path, config_path""" artifacts = ( source_path / package_name, source_path / "tests", # package_data (non-python files)...
From existing unpacked wheel, returns in order: source_path, tests_path, config_path
From existing unpacked wheel, returns in order: source_path, tests_path, config_path
[ "From", "existing", "unpacked", "wheel", "returns", "in", "order", ":", "source_path", "tests_path", "config_path" ]
def _get_package_artifacts( source_path: Path, package_name: str ) -> Tuple[Path, Path, Path]: artifacts = ( source_path / package_name, source_path / "tests", source_path / package_name / "config", ) return artifacts
[ "def", "_get_package_artifacts", "(", "source_path", ":", "Path", ",", "package_name", ":", "str", ")", "->", "Tuple", "[", "Path", ",", "Path", ",", "Path", "]", ":", "artifacts", "=", "(", "source_path", "/", "package_name", ",", "source_path", "/", "\"t...
From existing unpacked wheel, returns in order: source_path, tests_path, config_path
[ "From", "existing", "unpacked", "wheel", "returns", "in", "order", ":", "source_path", "tests_path", "config_path" ]
[ "\"\"\"From existing unpacked wheel, returns in order: source_path, tests_path, config_path\"\"\"", "# package_data (non-python files) needs to live inside one of the packages" ]
[ { "param": "source_path", "type": "Path" }, { "param": "package_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "source_path", "type": "Path", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "package_name", "type": "str", "docstring": null, "do...
6b2754e83429e16a4b2470a845fd85d8d82d7954
eferm/kedro
kedro/framework/cli/cli.py
[ "Apache-2.0" ]
Python
info
null
def info(): """Get more information about kedro. """ click.secho(LOGO, fg="green") click.echo( "kedro allows teams to create analytics\n" "projects. It is developed as part of\n" "the Kedro initiative at QuantumBlack." ) plugin_versions = {} plugin_hooks = defaultdic...
Get more information about kedro.
Get more information about kedro.
[ "Get", "more", "information", "about", "kedro", "." ]
def info(): click.secho(LOGO, fg="green") click.echo( "kedro allows teams to create analytics\n" "projects. It is developed as part of\n" "the Kedro initiative at QuantumBlack." ) plugin_versions = {} plugin_hooks = defaultdict(set) for hook, group in ENTRY_POINT_GROUPS.i...
[ "def", "info", "(", ")", ":", "click", ".", "secho", "(", "LOGO", ",", "fg", "=", "\"green\"", ")", "click", ".", "echo", "(", "\"kedro allows teams to create analytics\\n\"", "\"projects. It is developed as part of\\n\"", "\"the Kedro initiative at QuantumBlack.\"", ")",...
Get more information about kedro.
[ "Get", "more", "information", "about", "kedro", "." ]
[ "\"\"\"Get more information about kedro.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6b2754e83429e16a4b2470a845fd85d8d82d7954
eferm/kedro
kedro/framework/cli/cli.py
[ "Apache-2.0" ]
Python
docs
null
def docs(): """Display the API docs and introductory tutorial in the browser, using the packaged HTML doc files.""" index_path = "file://" + os.path.realpath( os.path.join( os.path.realpath(__file__), os.pardir, os.pardir, "html", "index.html" ) ) click.echo("Opening " + ...
Display the API docs and introductory tutorial in the browser, using the packaged HTML doc files.
Display the API docs and introductory tutorial in the browser, using the packaged HTML doc files.
[ "Display", "the", "API", "docs", "and", "introductory", "tutorial", "in", "the", "browser", "using", "the", "packaged", "HTML", "doc", "files", "." ]
def docs(): index_path = "file://" + os.path.realpath( os.path.join( os.path.realpath(__file__), os.pardir, os.pardir, "html", "index.html" ) ) click.echo("Opening " + index_path) webbrowser.open(index_path)
[ "def", "docs", "(", ")", ":", "index_path", "=", "\"file://\"", "+", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ",", "os", ".", "pardir", ",", "os", ".",...
Display the API docs and introductory tutorial in the browser, using the packaged HTML doc files.
[ "Display", "the", "API", "docs", "and", "introductory", "tutorial", "in", "the", "browser", "using", "the", "packaged", "HTML", "doc", "files", "." ]
[ "\"\"\"Display the API docs and introductory tutorial in the browser,\n using the packaged HTML doc files.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6b2754e83429e16a4b2470a845fd85d8d82d7954
eferm/kedro
kedro/framework/cli/cli.py
[ "Apache-2.0" ]
Python
list_starters
<not_specific>
def list_starters(): """List all official project starters available.""" def _get_clickable_link(git_link): prefix = re.escape("git+") return re.sub(rf"^{prefix}", "", git_link) output = [ {alias: _get_clickable_link(url)} for alias, url in sorted(_STARTER_ALIASES.items()) ...
List all official project starters available.
List all official project starters available.
[ "List", "all", "official", "project", "starters", "available", "." ]
def list_starters(): def _get_clickable_link(git_link): prefix = re.escape("git+") return re.sub(rf"^{prefix}", "", git_link) output = [ {alias: _get_clickable_link(url)} for alias, url in sorted(_STARTER_ALIASES.items()) ] click.echo(yaml.safe_dump(output))
[ "def", "list_starters", "(", ")", ":", "def", "_get_clickable_link", "(", "git_link", ")", ":", "prefix", "=", "re", ".", "escape", "(", "\"git+\"", ")", "return", "re", ".", "sub", "(", "rf\"^{prefix}\"", ",", "\"\"", ",", "git_link", ")", "output", "="...
List all official project starters available.
[ "List", "all", "official", "project", "starters", "available", "." ]
[ "\"\"\"List all official project starters available.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6b2754e83429e16a4b2470a845fd85d8d82d7954
eferm/kedro
kedro/framework/cli/cli.py
[ "Apache-2.0" ]
Python
_create_project
null
def _create_project( config_path: str, verbose: bool, template_path: Path = TEMPLATE_PATH, should_prompt_for_example: bool = True, checkout: str = None, ): """Implementation of the kedro new cli command. Args: config_path: In non-interactive mode, the path of the config.yml which ...
Implementation of the kedro new cli command. Args: config_path: In non-interactive mode, the path of the config.yml which should contain the project_name, output_dir and repo_name. verbose: Extensive debug terminal logs. template_path: The path to the cookiecutter template to cr...
Implementation of the kedro new cli command.
[ "Implementation", "of", "the", "kedro", "new", "cli", "command", "." ]
def _create_project( config_path: str, verbose: bool, template_path: Path = TEMPLATE_PATH, should_prompt_for_example: bool = True, checkout: str = None, ): with _filter_deprecation_warnings(): from cookiecutter.main import cookiecutter from cookiecutter.exceptions import Reposi...
[ "def", "_create_project", "(", "config_path", ":", "str", ",", "verbose", ":", "bool", ",", "template_path", ":", "Path", "=", "TEMPLATE_PATH", ",", "should_prompt_for_example", ":", "bool", "=", "True", ",", "checkout", ":", "str", "=", "None", ",", ")", ...
Implementation of the kedro new cli command.
[ "Implementation", "of", "the", "kedro", "new", "cli", "command", "." ]
[ "\"\"\"Implementation of the kedro new cli command.\n\n Args:\n config_path: In non-interactive mode, the path of the config.yml which\n should contain the project_name, output_dir and repo_name.\n verbose: Extensive debug terminal logs.\n template_path: The path to the cookiecutt...
[ { "param": "config_path", "type": "str" }, { "param": "verbose", "type": "bool" }, { "param": "template_path", "type": "Path" }, { "param": "should_prompt_for_example", "type": "bool" }, { "param": "checkout", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config_path", "type": "str", "docstring": "In non-interactive mode, the path of the config.yml which\nshould contain the project_name, output_dir and repo_name.", "docstring_tokens": [ "In", "non", "-",...
6b2754e83429e16a4b2470a845fd85d8d82d7954
eferm/kedro
kedro/framework/cli/cli.py
[ "Apache-2.0" ]
Python
_get_user_input
Any
def _get_user_input( text: str, default: Any = None, check_input: Callable = None ) -> Any: """Get user input and validate it. Args: text: Text to display in command line prompt. default: Default value for the input. check_input: Function to apply to check user input. Returns: ...
Get user input and validate it. Args: text: Text to display in command line prompt. default: Default value for the input. check_input: Function to apply to check user input. Returns: Processed user value.
Get user input and validate it.
[ "Get", "user", "input", "and", "validate", "it", "." ]
def _get_user_input( text: str, default: Any = None, check_input: Callable = None ) -> Any: while True: value = click.prompt(text, default=default) if check_input: try: check_input(value) except KedroCliError as exc: click.secho(str(exc), f...
[ "def", "_get_user_input", "(", "text", ":", "str", ",", "default", ":", "Any", "=", "None", ",", "check_input", ":", "Callable", "=", "None", ")", "->", "Any", ":", "while", "True", ":", "value", "=", "click", ".", "prompt", "(", "text", ",", "defaul...
Get user input and validate it.
[ "Get", "user", "input", "and", "validate", "it", "." ]
[ "\"\"\"Get user input and validate it.\n\n Args:\n text: Text to display in command line prompt.\n default: Default value for the input.\n check_input: Function to apply to check user input.\n\n Returns:\n Processed user value.\n\n \"\"\"" ]
[ { "param": "text", "type": "str" }, { "param": "default", "type": "Any" }, { "param": "check_input", "type": "Callable" } ]
{ "returns": [ { "docstring": "Processed user value.", "docstring_tokens": [ "Processed", "user", "value", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "text", "type": "str", "docstring": "Text to display...