body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
e1e93fe5e2ca7bc9742e760e8619e8169dc4d9c47ddf31bbf36390c808f9d232 | def verify_password(self, password):
'\n 将用户输入的密码加密后与数据库对比\n '
return werkzeug.security.generate_password_hash(password) | 将用户输入的密码加密后与数据库对比 | app/orm/User.py | verify_password | sevenZz/CouponStatistic | 0 | python | def verify_password(self, password):
'\n \n '
return werkzeug.security.generate_password_hash(password) | def verify_password(self, password):
'\n \n '
return werkzeug.security.generate_password_hash(password)<|docstring|>将用户输入的密码加密后与数据库对比<|endoftext|> |
71e281791c3eb151c8fd9f23a0b89d0d85465cca3c9d7308c55b1078c9b04234 | def word_fits_in_line(pagewidth, x_pos, wordsize_w):
' Return True if a word can fit into a line. '
return (((pagewidth - x_pos) - wordsize_w) > 0) | Return True if a word can fit into a line. | tesseract_trainer/__init__.py | word_fits_in_line | kevin-dunnicliffe/tesseract-trainer | 0 | python | def word_fits_in_line(pagewidth, x_pos, wordsize_w):
' '
return (((pagewidth - x_pos) - wordsize_w) > 0) | def word_fits_in_line(pagewidth, x_pos, wordsize_w):
' '
return (((pagewidth - x_pos) - wordsize_w) > 0)<|docstring|>Return True if a word can fit into a line.<|endoftext|> |
87ff0ae7057901774509099191e370eb6e91698d6b22b459d978f22ca0e158d6 | def newline_fits_in_page(pageheight, y_pos, wordsize_h):
' Return True if a new line can be contained in a page. '
return (((pageheight - y_pos) - (2 * wordsize_h)) > 0) | Return True if a new line can be contained in a page. | tesseract_trainer/__init__.py | newline_fits_in_page | kevin-dunnicliffe/tesseract-trainer | 0 | python | def newline_fits_in_page(pageheight, y_pos, wordsize_h):
' '
return (((pageheight - y_pos) - (2 * wordsize_h)) > 0) | def newline_fits_in_page(pageheight, y_pos, wordsize_h):
' '
return (((pageheight - y_pos) - (2 * wordsize_h)) > 0)<|docstring|>Return True if a new line can be contained in a page.<|endoftext|> |
688cca1daa388294dd412e9400a660ce0b5baf33b40ffc9e5d8d584389374778 | def pil_coord_to_tesseract(pil_x, pil_y, tif_h):
' Convert PIL coordinates into Tesseract boxfile coordinates:\n in PIL, (0,0) is at the top left corner and\n in tesseract boxfile format, (0,0) is at the bottom left corner.\n '
return (pil_x, (tif_h - pil_y)) | Convert PIL coordinates into Tesseract boxfile coordinates:
in PIL, (0,0) is at the top left corner and
in tesseract boxfile format, (0,0) is at the bottom left corner. | tesseract_trainer/__init__.py | pil_coord_to_tesseract | kevin-dunnicliffe/tesseract-trainer | 0 | python | def pil_coord_to_tesseract(pil_x, pil_y, tif_h):
' Convert PIL coordinates into Tesseract boxfile coordinates:\n in PIL, (0,0) is at the top left corner and\n in tesseract boxfile format, (0,0) is at the bottom left corner.\n '
return (pil_x, (tif_h - pil_y)) | def pil_coord_to_tesseract(pil_x, pil_y, tif_h):
' Convert PIL coordinates into Tesseract boxfile coordinates:\n in PIL, (0,0) is at the top left corner and\n in tesseract boxfile format, (0,0) is at the bottom left corner.\n '
return (pil_x, (tif_h - pil_y))<|docstring|>Convert PIL coordinates... |
7ee92a1ebcb592bef4b7d8fbbc7b22c2deb63eaaf54e34a26c3caad7320f9f6b | def display_output(run, verbose):
" Display the output/error of a subprocess.Popen object\n if 'verbose' is True.\n "
(out, err) = run.communicate()
if verbose:
print(out.strip())
if err:
print(err.strip()) | Display the output/error of a subprocess.Popen object
if 'verbose' is True. | tesseract_trainer/__init__.py | display_output | kevin-dunnicliffe/tesseract-trainer | 0 | python | def display_output(run, verbose):
" Display the output/error of a subprocess.Popen object\n if 'verbose' is True.\n "
(out, err) = run.communicate()
if verbose:
print(out.strip())
if err:
print(err.strip()) | def display_output(run, verbose):
" Display the output/error of a subprocess.Popen object\n if 'verbose' is True.\n "
(out, err) = run.communicate()
if verbose:
print(out.strip())
if err:
print(err.strip())<|docstring|>Display the output/error of a subprocess.Popen obje... |
9d9b3863d9083bff45b01363f3f904a59f53a362647d24099908d99c20dd7f91 | def generate_tif(self):
' Create several individual tifs from text and merge them\n into a multi-page tif, and finally delete all individual tifs.\n '
self._fill_pages()
self._multipage_tif()
self._clean() | Create several individual tifs from text and merge them
into a multi-page tif, and finally delete all individual tifs. | tesseract_trainer/__init__.py | generate_tif | kevin-dunnicliffe/tesseract-trainer | 0 | python | def generate_tif(self):
' Create several individual tifs from text and merge them\n into a multi-page tif, and finally delete all individual tifs.\n '
self._fill_pages()
self._multipage_tif()
self._clean() | def generate_tif(self):
' Create several individual tifs from text and merge them\n into a multi-page tif, and finally delete all individual tifs.\n '
self._fill_pages()
self._multipage_tif()
self._clean()<|docstring|>Create several individual tifs from text and merge them
into a multi... |
60bb5e9ed03bb738077958c1fdfbc2775f6302b81da6f37cdf2b39fb28f2c700 | def generate_boxfile(self):
' Generate a boxfile from the multipage tif.\n The boxfile will be named {self.prefix}.box\n '
boxfile_path = (self.prefix + '.box')
if self.verbose:
print(('Generating boxfile %s' % boxfile_path))
with open(boxfile_path, 'w') as boxfile:
for... | Generate a boxfile from the multipage tif.
The boxfile will be named {self.prefix}.box | tesseract_trainer/__init__.py | generate_boxfile | kevin-dunnicliffe/tesseract-trainer | 0 | python | def generate_boxfile(self):
' Generate a boxfile from the multipage tif.\n The boxfile will be named {self.prefix}.box\n '
boxfile_path = (self.prefix + '.box')
if self.verbose:
print(('Generating boxfile %s' % boxfile_path))
with open(boxfile_path, 'w') as boxfile:
for... | def generate_boxfile(self):
' Generate a boxfile from the multipage tif.\n The boxfile will be named {self.prefix}.box\n '
boxfile_path = (self.prefix + '.box')
if self.verbose:
print(('Generating boxfile %s' % boxfile_path))
with open(boxfile_path, 'w') as boxfile:
for... |
969bbe5e9dec823931f47930c363e91f1ffd87a361621ae234b088f32a4c2431 | def _new_tif(self, color='white'):
' Create and returns a new RGB blank tif, with specified background color (default: white) '
return Image.new('L', (self.W, self.H), color=color) | Create and returns a new RGB blank tif, with specified background color (default: white) | tesseract_trainer/__init__.py | _new_tif | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _new_tif(self, color='white'):
' '
return Image.new('L', (self.W, self.H), color=color) | def _new_tif(self, color='white'):
' '
return Image.new('L', (self.W, self.H), color=color)<|docstring|>Create and returns a new RGB blank tif, with specified background color (default: white)<|endoftext|> |
def390c5d24de46aa693efa51302bbe9ff352773b3156be3ebd1322c4fcfc2c6 | def _save_tif(self, tif, page_number):
" Save the argument tif using 'page_number' argument in filename.\n The filepath will be {self.indiv_page_prefix}{self.page_number}.tif\n "
tif.save(((self.indiv_page_prefix + str(page_number)) + '.tif')) | Save the argument tif using 'page_number' argument in filename.
The filepath will be {self.indiv_page_prefix}{self.page_number}.tif | tesseract_trainer/__init__.py | _save_tif | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _save_tif(self, tif, page_number):
" Save the argument tif using 'page_number' argument in filename.\n The filepath will be {self.indiv_page_prefix}{self.page_number}.tif\n "
tif.save(((self.indiv_page_prefix + str(page_number)) + '.tif')) | def _save_tif(self, tif, page_number):
" Save the argument tif using 'page_number' argument in filename.\n The filepath will be {self.indiv_page_prefix}{self.page_number}.tif\n "
tif.save(((self.indiv_page_prefix + str(page_number)) + '.tif'))<|docstring|>Save the argument tif using 'page_numb... |
e0258435a226eb0f85d78ea6dd18e4f7e3ea23c99578d46d03297f637fb2baf2 | def _fill_pages(self):
' Fill individual tifs with text, and save them to disk.\n Each time a character is written in the tif, its coordinates will be added to the self.boxlines\n list (with the exception of white spaces).\n\n All along the process, we manage to contain the text wit... | Fill individual tifs with text, and save them to disk.
Each time a character is written in the tif, its coordinates will be added to the self.boxlines
list (with the exception of white spaces).
All along the process, we manage to contain the text within the image limits. | tesseract_trainer/__init__.py | _fill_pages | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _fill_pages(self):
' Fill individual tifs with text, and save them to disk.\n Each time a character is written in the tif, its coordinates will be added to the self.boxlines\n list (with the exception of white spaces).\n\n All along the process, we manage to contain the text wit... | def _fill_pages(self):
' Fill individual tifs with text, and save them to disk.\n Each time a character is written in the tif, its coordinates will be added to the self.boxlines\n list (with the exception of white spaces).\n\n All along the process, we manage to contain the text wit... |
bbb7fd484aef18a25e845069a324c207f6f3cec152b8792ede3a0d635a39688f | def _write_boxline(self, char, char_x0, char_y0, char_x1, char_y1, page_nb):
' Generate a boxfile line given a character coordinates, and append it to the\n self.boxlines list.\n '
(tess_char_x0, tess_char_y0) = pil_coord_to_tesseract(char_x0, char_y0, self.H)
(tess_char_x1, tess_char_y1) ... | Generate a boxfile line given a character coordinates, and append it to the
self.boxlines list. | tesseract_trainer/__init__.py | _write_boxline | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _write_boxline(self, char, char_x0, char_y0, char_x1, char_y1, page_nb):
' Generate a boxfile line given a character coordinates, and append it to the\n self.boxlines list.\n '
(tess_char_x0, tess_char_y0) = pil_coord_to_tesseract(char_x0, char_y0, self.H)
(tess_char_x1, tess_char_y1) ... | def _write_boxline(self, char, char_x0, char_y0, char_x1, char_y1, page_nb):
' Generate a boxfile line given a character coordinates, and append it to the\n self.boxlines list.\n '
(tess_char_x0, tess_char_y0) = pil_coord_to_tesseract(char_x0, char_y0, self.H)
(tess_char_x1, tess_char_y1) ... |
efa5cb62f67e8df09ae8e4af9e436a07b6de511e7948b2e27ae4eb67c4ddfa7d | def _multipage_tif(self):
' Generate a multipage tif from all the generated tifs.\n The multipage tif will be named {self.prefix}.tif\n '
cmd = ['convert']
tifs = sorted(glob.glob((self.indiv_page_prefix + '*.tif')), key=os.path.getmtime)
cmd.extend(tifs)
multitif_name = (self.pref... | Generate a multipage tif from all the generated tifs.
The multipage tif will be named {self.prefix}.tif | tesseract_trainer/__init__.py | _multipage_tif | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _multipage_tif(self):
' Generate a multipage tif from all the generated tifs.\n The multipage tif will be named {self.prefix}.tif\n '
cmd = ['convert']
tifs = sorted(glob.glob((self.indiv_page_prefix + '*.tif')), key=os.path.getmtime)
cmd.extend(tifs)
multitif_name = (self.pref... | def _multipage_tif(self):
' Generate a multipage tif from all the generated tifs.\n The multipage tif will be named {self.prefix}.tif\n '
cmd = ['convert']
tifs = sorted(glob.glob((self.indiv_page_prefix + '*.tif')), key=os.path.getmtime)
cmd.extend(tifs)
multitif_name = (self.pref... |
4f9259ac1606d33e1576cdcfca44d51309e6155546d4e1204872e44e2dcb85eb | def _clean(self):
' Remove all generated individual tifs '
if self.verbose:
print('Removing all individual tif images')
tifs = glob.glob(('%s*' % self.indiv_page_prefix))
for tif in tifs:
os.remove(tif) | Remove all generated individual tifs | tesseract_trainer/__init__.py | _clean | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _clean(self):
' '
if self.verbose:
print('Removing all individual tif images')
tifs = glob.glob(('%s*' % self.indiv_page_prefix))
for tif in tifs:
os.remove(tif) | def _clean(self):
' '
if self.verbose:
print('Removing all individual tif images')
tifs = glob.glob(('%s*' % self.indiv_page_prefix))
for tif in tifs:
os.remove(tif)<|docstring|>Remove all generated individual tifs<|endoftext|> |
1388352e121a575a908556f4302fa088fc8a292901c69f5ccc1c4276e72ab057 | def _generate_boxfile(self):
' Generate a multipage tif, filled with the training text and generate a boxfile\n from the coordinates of the characters inside it\n '
mp = MultiPageTif(self.training_text, 3500, 1024, 20, 20, self.font_name, self.font_path, self.font_size, self.exp_number, self.d... | Generate a multipage tif, filled with the training text and generate a boxfile
from the coordinates of the characters inside it | tesseract_trainer/__init__.py | _generate_boxfile | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _generate_boxfile(self):
' Generate a multipage tif, filled with the training text and generate a boxfile\n from the coordinates of the characters inside it\n '
mp = MultiPageTif(self.training_text, 3500, 1024, 20, 20, self.font_name, self.font_path, self.font_size, self.exp_number, self.d... | def _generate_boxfile(self):
' Generate a multipage tif, filled with the training text and generate a boxfile\n from the coordinates of the characters inside it\n '
mp = MultiPageTif(self.training_text, 3500, 1024, 20, 20, self.font_name, self.font_path, self.font_size, self.exp_number, self.d... |
ebb7cfab6dc09e14a30b241f41166c4eb9d1896fa546ce1ae046ddcfa2e6c19e | def _train_on_boxfile(self):
' Run tesseract on training mode, using the generated boxfiles '
cmd = 'tesseract -psm 5 {prefix}.tif {prefix} nobatch box.train'.format(prefix=self.prefix)
print(cmd)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(... | Run tesseract on training mode, using the generated boxfiles | tesseract_trainer/__init__.py | _train_on_boxfile | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _train_on_boxfile(self):
' '
cmd = 'tesseract -psm 5 {prefix}.tif {prefix} nobatch box.train'.format(prefix=self.prefix)
print(cmd)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose) | def _train_on_boxfile(self):
' '
cmd = 'tesseract -psm 5 {prefix}.tif {prefix} nobatch box.train'.format(prefix=self.prefix)
print(cmd)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose)<|docstring|>Run tesseract on training mod... |
01dac2a36cb5cd1ba933969b15aad481bf5be13ec0e39db805bb39f7261ff7b8 | def _compute_character_set(self):
" Computes the character properties set: isalpha, isdigit, isupper, islower, ispunctuation\n and encode it in the 'unicharset' data file\n\n examples:\n ';' is an punctuation character. Its properties are thus represented\n by the bin... | Computes the character properties set: isalpha, isdigit, isupper, islower, ispunctuation
and encode it in the 'unicharset' data file
examples:
';' is an punctuation character. Its properties are thus represented
by the binary number 10000 (10 in hexadecimal).
'b' is an alphabetic character and a lower case charact... | tesseract_trainer/__init__.py | _compute_character_set | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _compute_character_set(self):
" Computes the character properties set: isalpha, isdigit, isupper, islower, ispunctuation\n and encode it in the 'unicharset' data file\n\n examples:\n ';' is an punctuation character. Its properties are thus represented\n by the bin... | def _compute_character_set(self):
" Computes the character properties set: isalpha, isdigit, isupper, islower, ispunctuation\n and encode it in the 'unicharset' data file\n\n examples:\n ';' is an punctuation character. Its properties are thus represented\n by the bin... |
b4c39eabe2f4beddc89ff5b00d80098127205bc26b17a2f8ec421ab1be7a1313 | def _clustering(self):
' Cluster character features from all the training pages, and create characters prototype '
cmd = ('mftraining -F font_properties -U unicharset %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.ve... | Cluster character features from all the training pages, and create characters prototype | tesseract_trainer/__init__.py | _clustering | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _clustering(self):
' '
cmd = ('mftraining -F font_properties -U unicharset %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose) | def _clustering(self):
' '
cmd = ('mftraining -F font_properties -U unicharset %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose)<|docstring|>Cluster character features from all the training pages, and create c... |
cde46f1bd7aa918b14db83ac9db3276cc688e045efc39b18519ef146cd611d2c | def _normalize(self):
" Generate the 'normproto' data file (the character normalization sensitivity prototypes) "
cmd = ('cntraining %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose) | Generate the 'normproto' data file (the character normalization sensitivity prototypes) | tesseract_trainer/__init__.py | _normalize | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _normalize(self):
" "
cmd = ('cntraining %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose) | def _normalize(self):
" "
cmd = ('cntraining %s.tr' % self.prefix)
run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
display_output(run, self.verbose)<|docstring|>Generate the 'normproto' data file (the character normalization sensitivity prototypes)<|endoftext|> |
57d1ae5cd60216e5b87156be5008299340117ea4ac41fe4561dcdf2afe8893d2 | def _rename_files(self):
' Add the self.dictionary_name prefix to each file generated during the tesseract training process '
for generated_file in GENERATED_DURING_TRAINING:
os.rename(('%s' % generated_file), ('%s.%s' % (self.dictionary_name, generated_file))) | Add the self.dictionary_name prefix to each file generated during the tesseract training process | tesseract_trainer/__init__.py | _rename_files | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _rename_files(self):
' '
for generated_file in GENERATED_DURING_TRAINING:
os.rename(('%s' % generated_file), ('%s.%s' % (self.dictionary_name, generated_file))) | def _rename_files(self):
' '
for generated_file in GENERATED_DURING_TRAINING:
os.rename(('%s' % generated_file), ('%s.%s' % (self.dictionary_name, generated_file)))<|docstring|>Add the self.dictionary_name prefix to each file generated during the tesseract training process<|endoftext|> |
e705c4d074f9a985f5e1f19249038d824a54b752a67c797f6b468709eaf49989 | def _dictionary_data(self):
' Generate dictionaries, coded as a Directed Acyclic Word Graph (DAWG),\n from the list of frequent words if those were submitted during the Trainer initialization.\n '
if self.word_list:
cmd = ('wordlist2dawg %s %s.freq-dawg %s.unicharset' % (self.word_list... | Generate dictionaries, coded as a Directed Acyclic Word Graph (DAWG),
from the list of frequent words if those were submitted during the Trainer initialization. | tesseract_trainer/__init__.py | _dictionary_data | kevin-dunnicliffe/tesseract-trainer | 0 | python | def _dictionary_data(self):
' Generate dictionaries, coded as a Directed Acyclic Word Graph (DAWG),\n from the list of frequent words if those were submitted during the Trainer initialization.\n '
if self.word_list:
cmd = ('wordlist2dawg %s %s.freq-dawg %s.unicharset' % (self.word_list... | def _dictionary_data(self):
' Generate dictionaries, coded as a Directed Acyclic Word Graph (DAWG),\n from the list of frequent words if those were submitted during the Trainer initialization.\n '
if self.word_list:
cmd = ('wordlist2dawg %s %s.freq-dawg %s.unicharset' % (self.word_list... |
6e1c0f6637ca655535d09b11b396bdda13802b3b4f4486d1c063ec7e01651e42 | def training(self):
' Execute all training steps '
self._generate_boxfile()
self._train_on_boxfile()
self._compute_character_set()
self._clustering()
self._normalize()
self._rename_files()
self._dictionary_data()
self._combine_data()
if self.verbose:
print(('The %s.traine... | Execute all training steps | tesseract_trainer/__init__.py | training | kevin-dunnicliffe/tesseract-trainer | 0 | python | def training(self):
' '
self._generate_boxfile()
self._train_on_boxfile()
self._compute_character_set()
self._clustering()
self._normalize()
self._rename_files()
self._dictionary_data()
self._combine_data()
if self.verbose:
print(('The %s.traineddata file has been genera... | def training(self):
' '
self._generate_boxfile()
self._train_on_boxfile()
self._compute_character_set()
self._clustering()
self._normalize()
self._rename_files()
self._dictionary_data()
self._combine_data()
if self.verbose:
print(('The %s.traineddata file has been genera... |
09cca0a01a9f5a6f60e08dde637a87ada686126da548dc753824040eb6071e99 | def clean(self):
' Remove all files generated during tesseract training process '
if self.verbose:
print('cleaning...')
os.remove(('%s.tr' % self.prefix))
os.remove(('%s.txt' % self.prefix))
os.remove(('%s.box' % self.prefix))
os.remove(('%s.inttemp' % self.dictionary_name))
os.remov... | Remove all files generated during tesseract training process | tesseract_trainer/__init__.py | clean | kevin-dunnicliffe/tesseract-trainer | 0 | python | def clean(self):
' '
if self.verbose:
print('cleaning...')
os.remove(('%s.tr' % self.prefix))
os.remove(('%s.txt' % self.prefix))
os.remove(('%s.box' % self.prefix))
os.remove(('%s.inttemp' % self.dictionary_name))
os.remove(('%s.Microfeat' % self.dictionary_name))
os.remove(('%... | def clean(self):
' '
if self.verbose:
print('cleaning...')
os.remove(('%s.tr' % self.prefix))
os.remove(('%s.txt' % self.prefix))
os.remove(('%s.box' % self.prefix))
os.remove(('%s.inttemp' % self.dictionary_name))
os.remove(('%s.Microfeat' % self.dictionary_name))
os.remove(('%... |
abc9acb01ffa50f177973f582f8c80b26f658885d04041eaed1247952fc104ee | def add_trained_data(self):
' Copy the newly trained data to the tessdata/ directory '
traineddata = ('%s.traineddata' % self.dictionary_name)
if self.verbose:
print(('Copying %s to %s.' % (traineddata, self.tessdata_path)))
try:
shutil.copyfile(traineddata, join(self.tessdata_path, trai... | Copy the newly trained data to the tessdata/ directory | tesseract_trainer/__init__.py | add_trained_data | kevin-dunnicliffe/tesseract-trainer | 0 | python | def add_trained_data(self):
' '
traineddata = ('%s.traineddata' % self.dictionary_name)
if self.verbose:
print(('Copying %s to %s.' % (traineddata, self.tessdata_path)))
try:
shutil.copyfile(traineddata, join(self.tessdata_path, traineddata))
except IOError:
raise IOError(('... | def add_trained_data(self):
' '
traineddata = ('%s.traineddata' % self.dictionary_name)
if self.verbose:
print(('Copying %s to %s.' % (traineddata, self.tessdata_path)))
try:
shutil.copyfile(traineddata, join(self.tessdata_path, traineddata))
except IOError:
raise IOError(('... |
0682eb1782cec0703ed2849f39e852226b24eb8583fb1115700326164600a923 | def get_dev_risk(weight, error):
'\n :param weight: shape [N, 1], the importance weight for N source samples in the validation set\n :param error: shape [N, 1], the error value for each source sample in the validation set\n (typically 0 for correct classification and 1 for wrong classification)\n '
... | :param weight: shape [N, 1], the importance weight for N source samples in the validation set
:param error: shape [N, 1], the error value for each source sample in the validation set
(typically 0 for correct classification and 1 for wrong classification) | visda_classification/dev.py | get_dev_risk | stellaxu/MCD_DA | 0 | python | def get_dev_risk(weight, error):
'\n :param weight: shape [N, 1], the importance weight for N source samples in the validation set\n :param error: shape [N, 1], the error value for each source sample in the validation set\n (typically 0 for correct classification and 1 for wrong classification)\n '
... | def get_dev_risk(weight, error):
'\n :param weight: shape [N, 1], the importance weight for N source samples in the validation set\n :param error: shape [N, 1], the error value for each source sample in the validation set\n (typically 0 for correct classification and 1 for wrong classification)\n '
... |
b2d705f984a9b0031b93970a31da52664813e1fccc92bcf27fb61032e1fab4f5 | def get_weight(source_feature, target_feature, validation_feature):
'\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :param validation_feature: shape [N_v, d], features from validation set\n :return:\n '
(N_s... | :param source_feature: shape [N_tr, d], features from training set
:param target_feature: shape [N_te, d], features from test set
:param validation_feature: shape [N_v, d], features from validation set
:return: | visda_classification/dev.py | get_weight | stellaxu/MCD_DA | 0 | python | def get_weight(source_feature, target_feature, validation_feature):
'\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :param validation_feature: shape [N_v, d], features from validation set\n :return:\n '
(N_s... | def get_weight(source_feature, target_feature, validation_feature):
'\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :param validation_feature: shape [N_v, d], features from validation set\n :return:\n '
(N_s... |
66923da99a9e9b3e4abf015adedf2ae6df8d479c4059caa2798f8fb02c085f24 | def random_select_src(source_feature, target_feature):
'\n Select at most 2*Ntr data from source feature randomly\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :return:\n '
(N_s, d) = source_feature.shape
... | Select at most 2*Ntr data from source feature randomly
:param source_feature: shape [N_tr, d], features from training set
:param target_feature: shape [N_te, d], features from test set
:return: | visda_classification/dev.py | random_select_src | stellaxu/MCD_DA | 0 | python | def random_select_src(source_feature, target_feature):
'\n Select at most 2*Ntr data from source feature randomly\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :return:\n '
(N_s, d) = source_feature.shape
... | def random_select_src(source_feature, target_feature):
'\n Select at most 2*Ntr data from source feature randomly\n :param source_feature: shape [N_tr, d], features from training set\n :param target_feature: shape [N_te, d], features from test set\n :return:\n '
(N_s, d) = source_feature.shape
... |
f878443af25045d2e956cdb8ea7c9b5a36bc2a1b8e7012fd579b916fc0a9feea | def predict_loss(cls, y_pre):
'\n Calculate the cross entropy loss for prediction of one picture\n :param cls:\n :param y_pre:\n :return:\n '
cls_torch = np.full(1, cls)
pre_cls_torch = y_pre.double()
target = torch.from_numpy(cls_torch).cuda()
entropy = nn.CrossEntropyLoss()
retu... | Calculate the cross entropy loss for prediction of one picture
:param cls:
:param y_pre:
:return: | visda_classification/dev.py | predict_loss | stellaxu/MCD_DA | 0 | python | def predict_loss(cls, y_pre):
'\n Calculate the cross entropy loss for prediction of one picture\n :param cls:\n :param y_pre:\n :return:\n '
cls_torch = np.full(1, cls)
pre_cls_torch = y_pre.double()
target = torch.from_numpy(cls_torch).cuda()
entropy = nn.CrossEntropyLoss()
retu... | def predict_loss(cls, y_pre):
'\n Calculate the cross entropy loss for prediction of one picture\n :param cls:\n :param y_pre:\n :return:\n '
cls_torch = np.full(1, cls)
pre_cls_torch = y_pre.double()
target = torch.from_numpy(cls_torch).cuda()
entropy = nn.CrossEntropyLoss()
retu... |
a275647c19d39aa2662a4d2e713005b620e9fb36a95eddff701cbbf81c9016a9 | def get_label_list(args, target_list, feature_network_path, predict_network_path, num_layer, resize_size, crop_size, batch_size, use_gpu):
'\n Return the target list with pesudolabel\n :param target_list: list conatinging all target file path and a wrong label\n :param predict_network: network to perdict l... | Return the target list with pesudolabel
:param target_list: list conatinging all target file path and a wrong label
:param predict_network: network to perdict label for target image
:param resize_size:
:param crop_size:
:param batch_size:
:return: | visda_classification/dev.py | get_label_list | stellaxu/MCD_DA | 0 | python | def get_label_list(args, target_list, feature_network_path, predict_network_path, num_layer, resize_size, crop_size, batch_size, use_gpu):
'\n Return the target list with pesudolabel\n :param target_list: list conatinging all target file path and a wrong label\n :param predict_network: network to perdict l... | def get_label_list(args, target_list, feature_network_path, predict_network_path, num_layer, resize_size, crop_size, batch_size, use_gpu):
'\n Return the target list with pesudolabel\n :param target_list: list conatinging all target file path and a wrong label\n :param predict_network: network to perdict l... |
4fda59657d022b7e52392d1f91ef3e42608ed97a521c54515cac072eb8c63d6e | def cross_validation_loss(args, feature_network_path, predict_network_path, num_layer, src_cls_list, target_path, val_cls_list, class_num, resize_size, crop_size, batch_size, use_gpu):
'\n Main function for computing the CV loss\n :param feature_network:\n :param predict_network:\n :param src_cls_list:\... | Main function for computing the CV loss
:param feature_network:
:param predict_network:
:param src_cls_list:
:param target_path:
:param val_cls_list:
:param class_num:
:param resize_size:
:param crop_size:
:param batch_size:
:return: | visda_classification/dev.py | cross_validation_loss | stellaxu/MCD_DA | 0 | python | def cross_validation_loss(args, feature_network_path, predict_network_path, num_layer, src_cls_list, target_path, val_cls_list, class_num, resize_size, crop_size, batch_size, use_gpu):
'\n Main function for computing the CV loss\n :param feature_network:\n :param predict_network:\n :param src_cls_list:\... | def cross_validation_loss(args, feature_network_path, predict_network_path, num_layer, src_cls_list, target_path, val_cls_list, class_num, resize_size, crop_size, batch_size, use_gpu):
'\n Main function for computing the CV loss\n :param feature_network:\n :param predict_network:\n :param src_cls_list:\... |
2bfeaaa0138c84b99f59a1551db32bfcf3abc61909d9e799decb5516c2d05267 | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
self.data = None | Method: __init__
Description: Class initialization.
Arguments: | test/unit/mysql_perf/mysql_stat.py | __init__ | deepcoder42/mysql-perf | 0 | python | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
self.data = None | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
self.data = None<|docstring|>Method: __init__
Description: Class initialization.
Arguments:<|endoftext|> |
f60f3aa93c7dea41939163d8f956491a89b686cec25e8b4822b655a3554b8625 | def add_2_msg(self, data):
'Method: add_2_msg\n\n Description: Stub method holder for Mail.add_2_msg.\n\n Arguments:\n\n '
self.data = data
return True | Method: add_2_msg
Description: Stub method holder for Mail.add_2_msg.
Arguments: | test/unit/mysql_perf/mysql_stat.py | add_2_msg | deepcoder42/mysql-perf | 0 | python | def add_2_msg(self, data):
'Method: add_2_msg\n\n Description: Stub method holder for Mail.add_2_msg.\n\n Arguments:\n\n '
self.data = data
return True | def add_2_msg(self, data):
'Method: add_2_msg\n\n Description: Stub method holder for Mail.add_2_msg.\n\n Arguments:\n\n '
self.data = data
return True<|docstring|>Method: add_2_msg
Description: Stub method holder for Mail.add_2_msg.
Arguments:<|endoftext|> |
6ec11ba627a16f906adc756103779e84268ca4625e334b9ee52536be07f1ec16 | def send_mail(self, use_mailx=False):
'Method: send_mail\n\n Description: Stub method holder for Mail.send_mail.\n\n Arguments:\n (input) use_mailx -> True|False - To use mailx command.\n\n '
status = True
if use_mailx:
status = True
return status | Method: send_mail
Description: Stub method holder for Mail.send_mail.
Arguments:
(input) use_mailx -> True|False - To use mailx command. | test/unit/mysql_perf/mysql_stat.py | send_mail | deepcoder42/mysql-perf | 0 | python | def send_mail(self, use_mailx=False):
'Method: send_mail\n\n Description: Stub method holder for Mail.send_mail.\n\n Arguments:\n (input) use_mailx -> True|False - To use mailx command.\n\n '
status = True
if use_mailx:
status = True
return status | def send_mail(self, use_mailx=False):
'Method: send_mail\n\n Description: Stub method holder for Mail.send_mail.\n\n Arguments:\n (input) use_mailx -> True|False - To use mailx command.\n\n '
status = True
if use_mailx:
status = True
return status<|docstring|>Me... |
9b1b52fbfd616f70322ccc3a6d2c90b3295883f4e0793ac11e119969341badec | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
pass | Method: __init__
Description: Class initialization.
Arguments: | test/unit/mysql_perf/mysql_stat.py | __init__ | deepcoder42/mysql-perf | 0 | python | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
pass | def __init__(self):
'Method: __init__\n\n Description: Class initialization.\n\n Arguments:\n\n '
pass<|docstring|>Method: __init__
Description: Class initialization.
Arguments:<|endoftext|> |
a004d3f5f4b688006a1c840d52c595808696bd73aab8d7e0238882e16b0e19f9 | def setUp(self):
'Function: setUp\n\n Description: Initialization for unit testing.\n\n Arguments:\n\n '
self.server = Server()
self.mail = Mail()
self.args_array = {'-n': 1, '-b': 1}
self.args_array2 = {'-n': 3, '-b': 1}
self.args_array3 = {'-n': 1, '-b': 1, '-a': True}
... | Function: setUp
Description: Initialization for unit testing.
Arguments: | test/unit/mysql_perf/mysql_stat.py | setUp | deepcoder42/mysql-perf | 0 | python | def setUp(self):
'Function: setUp\n\n Description: Initialization for unit testing.\n\n Arguments:\n\n '
self.server = Server()
self.mail = Mail()
self.args_array = {'-n': 1, '-b': 1}
self.args_array2 = {'-n': 3, '-b': 1}
self.args_array3 = {'-n': 1, '-b': 1, '-a': True}
... | def setUp(self):
'Function: setUp\n\n Description: Initialization for unit testing.\n\n Arguments:\n\n '
self.server = Server()
self.mail = Mail()
self.args_array = {'-n': 1, '-b': 1}
self.args_array2 = {'-n': 3, '-b': 1}
self.args_array3 = {'-n': 1, '-b': 1, '-a': True}
... |
258589b174bf7773a40e415000c1f04d0102e155a3d8b7ac62526765632cb905 | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj_mailx(self, mock_process, mock_mail):
'Function: test_email_no_subj_mailx\n\n Description: Test with email but no subject using mailx.\n\n Arguments:\n\n '
mock_process.return_va... | Function: test_email_no_subj_mailx
Description: Test with email but no subject using mailx.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_email_no_subj_mailx | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj_mailx(self, mock_process, mock_mail):
'Function: test_email_no_subj_mailx\n\n Description: Test with email but no subject using mailx.\n\n Arguments:\n\n '
mock_process.return_va... | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj_mailx(self, mock_process, mock_mail):
'Function: test_email_no_subj_mailx\n\n Description: Test with email but no subject using mailx.\n\n Arguments:\n\n '
mock_process.return_va... |
fd3de93875e940336965d822f4ab6c5985bb4c1100aeb1ca514bf7cf95f3d4f0 | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_mailx(self, mock_process, mock_mail):
'Function: test_email_mailx\n\n Description: Test with email option set using mailx.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_... | Function: test_email_mailx
Description: Test with email option set using mailx.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_email_mailx | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_mailx(self, mock_process, mock_mail):
'Function: test_email_mailx\n\n Description: Test with email option set using mailx.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_... | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_mailx(self, mock_process, mock_mail):
'Function: test_email_mailx\n\n Description: Test with email option set using mailx.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_... |
89c8cdf686c39e6dd408dcb674a49f28d6d45043cc81b2ab885f0217f5e02d60 | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj(self, mock_process, mock_mail):
'Function: test_email_no_subj\n\n Description: Test with email but no subject in args.\n\n Arguments:\n\n '
mock_process.return_value = True
m... | Function: test_email_no_subj
Description: Test with email but no subject in args.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_email_no_subj | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj(self, mock_process, mock_mail):
'Function: test_email_no_subj\n\n Description: Test with email but no subject in args.\n\n Arguments:\n\n '
mock_process.return_value = True
m... | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email_no_subj(self, mock_process, mock_mail):
'Function: test_email_no_subj\n\n Description: Test with email but no subject in args.\n\n Arguments:\n\n '
mock_process.return_value = True
m... |
e5d00aba25a66ac799212790c3fb7c14ee9b1a1a2d383b407b019482e8660ed5 | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email(self, mock_process, mock_mail):
'Function: test_email\n\n Description: Test with email option set.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_mail.return_value = self... | Function: test_email
Description: Test with email option set.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_email | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email(self, mock_process, mock_mail):
'Function: test_email\n\n Description: Test with email option set.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_mail.return_value = self... | @mock.patch('mysql_perf.gen_class.setup_mail')
@mock.patch('mysql_perf.mysql_stat_run')
def test_email(self, mock_process, mock_mail):
'Function: test_email\n\n Description: Test with email option set.\n\n Arguments:\n\n '
mock_process.return_value = True
mock_mail.return_value = self... |
d49a66b74e3c209c2d67afe455e86382b090366872fdedb668430c120f8916c4 | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_zero(self, mock_process):
'Function: test_interval_zero\n\n Description: Test with -b option set to zero.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_arra... | Function: test_interval_zero
Description: Test with -b option set to zero.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_interval_zero | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_zero(self, mock_process):
'Function: test_interval_zero\n\n Description: Test with -b option set to zero.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_arra... | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_zero(self, mock_process):
'Function: test_interval_zero\n\n Description: Test with -b option set to zero.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_arra... |
1ed0a9f9247c0820e470bd79d60f2494e9a0981b0fe91a5ef3bfc549945963a1 | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_one(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array7)... | Function: test_interval_two
Description: Test with -b option set to one.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_interval_one | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_one(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array7)... | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_one(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array7)... |
64b4698d78c5f43a90b93772c66974b24cc19ed2dd2fa002fa03bf1873c8bf78 | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_two(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to > one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... | Function: test_interval_two
Description: Test with -b option set to > one.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_interval_two | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_two(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to > one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... | @mock.patch('mysql_perf.mysql_stat_run')
def test_interval_two(self, mock_process):
'Function: test_interval_two\n\n Description: Test with -b option set to > one.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... |
9f05ff5656ab6b592c8ea23c27c3580208246dcb035abc4c0107a3c1e6d0d718 | def test_loop_negative(self):
'Function: test_loop_negative\n\n Description: Test with -n option set to negative number.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array10)) | Function: test_loop_negative
Description: Test with -n option set to negative number.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_loop_negative | deepcoder42/mysql-perf | 0 | python | def test_loop_negative(self):
'Function: test_loop_negative\n\n Description: Test with -n option set to negative number.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array10)) | def test_loop_negative(self):
'Function: test_loop_negative\n\n Description: Test with -n option set to negative number.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array10))<|docstring|>Function: test_loop_negative
Description: Test with -n optio... |
b0dd46a65ed7cae4fa7444791a30eb17b3537e0362c26ae274041486b9b24340 | def test_zero_loop(self):
'Function: test_zero_loop\n\n Description: Test with -n option set to zero.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array5)) | Function: test_zero_loop
Description: Test with -n option set to zero.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_zero_loop | deepcoder42/mysql-perf | 0 | python | def test_zero_loop(self):
'Function: test_zero_loop\n\n Description: Test with -n option set to zero.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array5)) | def test_zero_loop(self):
'Function: test_zero_loop\n\n Description: Test with -n option set to zero.\n\n Arguments:\n\n '
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array5))<|docstring|>Function: test_zero_loop
Description: Test with -n option set to zero.
Argument... |
d4b5e209f4c819cdfdf106b6bd32b3d78cbf09ec6f99f0708ef227e6153928c7 | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_flat(self, mock_process):
'Function: test_json_flat\n\n Description: Test with flatten indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... | Function: test_json_flat
Description: Test with flatten indentation for JSON.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_json_flat | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_flat(self, mock_process):
'Function: test_json_flat\n\n Description: Test with flatten indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_flat(self, mock_process):
'Function: test_json_flat\n\n Description: Test with flatten indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array... |
16d4258d14fcb4d52587d4b64765601b0a7da7e187f8c345df61ca4553c6e4ec | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_indent(self, mock_process):
'Function: test_json_indent\n\n Description: Test with default indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_a... | Function: test_json_indent
Description: Test with default indentation for JSON.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_json_indent | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_indent(self, mock_process):
'Function: test_json_indent\n\n Description: Test with default indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_a... | @mock.patch('mysql_perf.mysql_stat_run')
def test_json_indent(self, mock_process):
'Function: test_json_indent\n\n Description: Test with default indentation for JSON.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_a... |
df75a6c780efe5bb7f36551f8e193d94cd30aa71ba864cdbbc53e5871e4fe3af | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_write(self, mock_process):
'Function: test_file_write\n\n Description: Test with setting file write.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3)) | Function: test_file_write
Description: Test with setting file write.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_file_write | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_write(self, mock_process):
'Function: test_file_write\n\n Description: Test with setting file write.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3)) | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_write(self, mock_process):
'Function: test_file_write\n\n Description: Test with setting file write.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3))<|doc... |
0d4bfb18e387fc4fe4eee8b0fa91e41aa0cc70f1634580a6c96bce977f5b8d7b | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_append(self, mock_process):
'Function: test_file_append\n\n Description: Test with setting file append.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3)) | Function: test_file_append
Description: Test with setting file append.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_file_append | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_append(self, mock_process):
'Function: test_file_append\n\n Description: Test with setting file append.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3)) | @mock.patch('mysql_perf.mysql_stat_run')
def test_file_append(self, mock_process):
'Function: test_file_append\n\n Description: Test with setting file append.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array3))<|... |
93a995e07c5f976591d44ba9afeee61c5c521a6432f3d765b3bb0a048c587e62 | @mock.patch('mysql_perf.mysql_stat_run')
def test_multi_loop(self, mock_process):
'Function: test_multi_loop\n\n Description: Test with multiple loops.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array2)) | Function: test_multi_loop
Description: Test with multiple loops.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_multi_loop | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_multi_loop(self, mock_process):
'Function: test_multi_loop\n\n Description: Test with multiple loops.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array2)) | @mock.patch('mysql_perf.mysql_stat_run')
def test_multi_loop(self, mock_process):
'Function: test_multi_loop\n\n Description: Test with multiple loops.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array2))<|docstri... |
2cd57289244804a128229fcd0f26be484d27ba1db2aa958eec90b7dbc6beaaa8 | @mock.patch('mysql_perf.mysql_stat_run')
def test_default(self, mock_process):
'Function: test_default\n\n Description: Test with default settings.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array)) | Function: test_default
Description: Test with default settings.
Arguments: | test/unit/mysql_perf/mysql_stat.py | test_default | deepcoder42/mysql-perf | 0 | python | @mock.patch('mysql_perf.mysql_stat_run')
def test_default(self, mock_process):
'Function: test_default\n\n Description: Test with default settings.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array)) | @mock.patch('mysql_perf.mysql_stat_run')
def test_default(self, mock_process):
'Function: test_default\n\n Description: Test with default settings.\n\n Arguments:\n\n '
mock_process.return_value = True
self.assertFalse(mysql_perf.mysql_stat(self.server, self.args_array))<|docstring|>F... |
8baabeab82162c9d9ed4ecea1ddef81f1f7ad671da7f40e6431aa75400a24ea1 | def update_files(data, python=True):
'Update files with new project name.'
if (len(sys.argv) != 2):
e = Exception(('Specify project name: "%s streamlit"' % sys.argv[0]))
raise e
project_name = sys.argv[1]
for (filename, regex) in data.items():
filename = os.path.join(BASE_DIR, fi... | Update files with new project name. | scripts/update_name.py | update_files | jonathan-eckel/streamlit | 19,099 | python | def update_files(data, python=True):
if (len(sys.argv) != 2):
e = Exception(('Specify project name: "%s streamlit"' % sys.argv[0]))
raise e
project_name = sys.argv[1]
for (filename, regex) in data.items():
filename = os.path.join(BASE_DIR, filename)
matched = False
... | def update_files(data, python=True):
if (len(sys.argv) != 2):
e = Exception(('Specify project name: "%s streamlit"' % sys.argv[0]))
raise e
project_name = sys.argv[1]
for (filename, regex) in data.items():
filename = os.path.join(BASE_DIR, filename)
matched = False
... |
70b5cb39a3a705af28ea47368800b566a56b5a342955660c082fff36731864c8 | def main():
'Run main loop.'
update_files(PYTHON) | Run main loop. | scripts/update_name.py | main | jonathan-eckel/streamlit | 19,099 | python | def main():
update_files(PYTHON) | def main():
update_files(PYTHON)<|docstring|>Run main loop.<|endoftext|> |
d089b627c0754bf1d568aa2f01434d8a83e0dd128fa906ced70408e68a878b9a | def deep_update(target, source):
'Update a nested dictionary with another nested dictionary.'
for (key, value) in source.items():
if isinstance(value, collections.Mapping):
target[key] = deep_update(target.get(key, {}), value)
else:
target[key] = value
return target | Update a nested dictionary with another nested dictionary. | homeassistant/components/google_assistant/smart_home.py | deep_update | ellsclytn/home-assistant | 37 | python | def deep_update(target, source):
for (key, value) in source.items():
if isinstance(value, collections.Mapping):
target[key] = deep_update(target.get(key, {}), value)
else:
target[key] = value
return target | def deep_update(target, source):
for (key, value) in source.items():
if isinstance(value, collections.Mapping):
target[key] = deep_update(target.get(key, {}), value)
else:
target[key] = value
return target<|docstring|>Update a nested dictionary with another nested di... |
9a9103819fe96ffe0e10cfade2d284c64ba3d19dfb674444a9e23ad6265f727a | async def async_handle_message(hass, config, message):
'Handle incoming API messages.'
response = (await _process(hass, config, message))
if ('errorCode' in response['payload']):
_LOGGER.error('Error handling message %s: %s', message, response['payload'])
return response | Handle incoming API messages. | homeassistant/components/google_assistant/smart_home.py | async_handle_message | ellsclytn/home-assistant | 37 | python | async def async_handle_message(hass, config, message):
response = (await _process(hass, config, message))
if ('errorCode' in response['payload']):
_LOGGER.error('Error handling message %s: %s', message, response['payload'])
return response | async def async_handle_message(hass, config, message):
response = (await _process(hass, config, message))
if ('errorCode' in response['payload']):
_LOGGER.error('Error handling message %s: %s', message, response['payload'])
return response<|docstring|>Handle incoming API messages.<|endoftext|> |
322000710b0ca04cddc40e2adca335226722013156f4c397b1bce651443bf638 | async def _process(hass, config, message):
'Process a message.'
request_id = message.get('requestId')
inputs = message.get('inputs')
if (len(inputs) != 1):
return {'requestId': request_id, 'payload': {'errorCode': ERR_PROTOCOL_ERROR}}
handler = HANDLERS.get(inputs[0].get('intent'))
if (h... | Process a message. | homeassistant/components/google_assistant/smart_home.py | _process | ellsclytn/home-assistant | 37 | python | async def _process(hass, config, message):
request_id = message.get('requestId')
inputs = message.get('inputs')
if (len(inputs) != 1):
return {'requestId': request_id, 'payload': {'errorCode': ERR_PROTOCOL_ERROR}}
handler = HANDLERS.get(inputs[0].get('intent'))
if (handler is None):
... | async def _process(hass, config, message):
request_id = message.get('requestId')
inputs = message.get('inputs')
if (len(inputs) != 1):
return {'requestId': request_id, 'payload': {'errorCode': ERR_PROTOCOL_ERROR}}
handler = HANDLERS.get(inputs[0].get('intent'))
if (handler is None):
... |
670bb4562eaef9c6fbe189f60908a600c6f7d52d68eb6ebeb5ef762704170656 | @HANDLERS.register('action.devices.SYNC')
async def async_devices_sync(hass, config, payload):
'Handle action.devices.SYNC request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
devices = []
for state in hass.states.async_all():
if (not config.should_expo... | Handle action.devices.SYNC request.
https://developers.google.com/actions/smarthome/create-app#actiondevicessync | homeassistant/components/google_assistant/smart_home.py | async_devices_sync | ellsclytn/home-assistant | 37 | python | @HANDLERS.register('action.devices.SYNC')
async def async_devices_sync(hass, config, payload):
'Handle action.devices.SYNC request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
devices = []
for state in hass.states.async_all():
if (not config.should_expo... | @HANDLERS.register('action.devices.SYNC')
async def async_devices_sync(hass, config, payload):
'Handle action.devices.SYNC request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
devices = []
for state in hass.states.async_all():
if (not config.should_expo... |
83c74fb034c6f639343ced1b1f11af34f70eac342f0b41f63d7cb63262202429 | @HANDLERS.register('action.devices.QUERY')
async def async_devices_query(hass, config, payload):
'Handle action.devices.QUERY request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
devices = {}
for device in payload.get('devices', []):
devid = device['id... | Handle action.devices.QUERY request.
https://developers.google.com/actions/smarthome/create-app#actiondevicesquery | homeassistant/components/google_assistant/smart_home.py | async_devices_query | ellsclytn/home-assistant | 37 | python | @HANDLERS.register('action.devices.QUERY')
async def async_devices_query(hass, config, payload):
'Handle action.devices.QUERY request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
devices = {}
for device in payload.get('devices', []):
devid = device['id... | @HANDLERS.register('action.devices.QUERY')
async def async_devices_query(hass, config, payload):
'Handle action.devices.QUERY request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
devices = {}
for device in payload.get('devices', []):
devid = device['id... |
7e83da98719b8a050ef49244f2090ddb1441393b34229dada12b482d843d326d | @HANDLERS.register('action.devices.EXECUTE')
async def handle_devices_execute(hass, config, payload):
'Handle action.devices.EXECUTE request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
entities = {}
results = {}
for command in payload['commands']:
... | Handle action.devices.EXECUTE request.
https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute | homeassistant/components/google_assistant/smart_home.py | handle_devices_execute | ellsclytn/home-assistant | 37 | python | @HANDLERS.register('action.devices.EXECUTE')
async def handle_devices_execute(hass, config, payload):
'Handle action.devices.EXECUTE request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
entities = {}
results = {}
for command in payload['commands']:
... | @HANDLERS.register('action.devices.EXECUTE')
async def handle_devices_execute(hass, config, payload):
'Handle action.devices.EXECUTE request.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
entities = {}
results = {}
for command in payload['commands']:
... |
a0f56b86264c0795a9f796ebd0f5f2d94cd8de19e108c01c249ce6c816b0f8f9 | @property
def entity_id(self):
'Return entity ID.'
return self.state.entity_id | Return entity ID. | homeassistant/components/google_assistant/smart_home.py | entity_id | ellsclytn/home-assistant | 37 | python | @property
def entity_id(self):
return self.state.entity_id | @property
def entity_id(self):
return self.state.entity_id<|docstring|>Return entity ID.<|endoftext|> |
4b752b11f4e6abbbf91af5f85354aae643f32141a2e9809f028bf98ffaa39ae8 | @callback
def traits(self):
'Return traits for entity.'
state = self.state
domain = state.domain
features = state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
return [Trait(state) for Trait in trait.TRAITS if Trait.supported(domain, features)] | Return traits for entity. | homeassistant/components/google_assistant/smart_home.py | traits | ellsclytn/home-assistant | 37 | python | @callback
def traits(self):
state = self.state
domain = state.domain
features = state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
return [Trait(state) for Trait in trait.TRAITS if Trait.supported(domain, features)] | @callback
def traits(self):
state = self.state
domain = state.domain
features = state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
return [Trait(state) for Trait in trait.TRAITS if Trait.supported(domain, features)]<|docstring|>Return traits for entity.<|endoftext|> |
47b46a9617ab6197ec2d99e341f6613e4f1b9f17d54b8577ee5d4d4c5d39b37a | @callback
def sync_serialize(self):
'Serialize entity for a SYNC response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return None
entity_config = self.config.entity_config.get(state.... | Serialize entity for a SYNC response.
https://developers.google.com/actions/smarthome/create-app#actiondevicessync | homeassistant/components/google_assistant/smart_home.py | sync_serialize | ellsclytn/home-assistant | 37 | python | @callback
def sync_serialize(self):
'Serialize entity for a SYNC response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return None
entity_config = self.config.entity_config.get(state.... | @callback
def sync_serialize(self):
'Serialize entity for a SYNC response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicessync\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return None
entity_config = self.config.entity_config.get(state.... |
518b8ed926439c4a987ed4d2ac159e5fe00ec9c2cf306acc8d52d347872c96f2 | @callback
def query_serialize(self):
'Serialize entity for a QUERY response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return {'online': False}
attrs = {'online': True}
for trt... | Serialize entity for a QUERY response.
https://developers.google.com/actions/smarthome/create-app#actiondevicesquery | homeassistant/components/google_assistant/smart_home.py | query_serialize | ellsclytn/home-assistant | 37 | python | @callback
def query_serialize(self):
'Serialize entity for a QUERY response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return {'online': False}
attrs = {'online': True}
for trt... | @callback
def query_serialize(self):
'Serialize entity for a QUERY response.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesquery\n '
state = self.state
if (state.state == STATE_UNAVAILABLE):
return {'online': False}
attrs = {'online': True}
for trt... |
695631e5b7398de881b4178d2d1f9fd78497a65a587540ef8719c2768a73bf31 | async def execute(self, command, params):
'Execute a command.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
executed = False
for trt in self.traits():
if trt.can_execute(command, params):
(await trt.execute(self.hass, command, param... | Execute a command.
https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute | homeassistant/components/google_assistant/smart_home.py | execute | ellsclytn/home-assistant | 37 | python | async def execute(self, command, params):
'Execute a command.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
executed = False
for trt in self.traits():
if trt.can_execute(command, params):
(await trt.execute(self.hass, command, param... | async def execute(self, command, params):
'Execute a command.\n\n https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute\n '
executed = False
for trt in self.traits():
if trt.can_execute(command, params):
(await trt.execute(self.hass, command, param... |
4ca3e5758b72311848298bb564afd3f1401d862e6c474f4117a57d9d4ccfbc31 | @callback
def async_update(self):
'Update the entity with latest info from Home Assistant.'
self.state = self.hass.states.get(self.entity_id) | Update the entity with latest info from Home Assistant. | homeassistant/components/google_assistant/smart_home.py | async_update | ellsclytn/home-assistant | 37 | python | @callback
def async_update(self):
self.state = self.hass.states.get(self.entity_id) | @callback
def async_update(self):
self.state = self.hass.states.get(self.entity_id)<|docstring|>Update the entity with latest info from Home Assistant.<|endoftext|> |
f9ba04fc5536239bcfbe0046fd8e8fa13a926308ba9c0fb2f44674f8144bf346 | def load_sample(sample_file):
'Load a single example and return it as a SquadExample tuple.'
with open(sample_file, 'rt') as handle:
sample = json.load(handle)
return SquadExample(question=sample['question'], context=sample['context'], sentence_lengths=sample['sent_lengths'], answer_sentence=sample[... | Load a single example and return it as a SquadExample tuple. | gnr.py | load_sample | baidu-research/GloballyNormalizedReader | 73 | python | def load_sample(sample_file):
with open(sample_file, 'rt') as handle:
sample = json.load(handle)
return SquadExample(question=sample['question'], context=sample['context'], sentence_lengths=sample['sent_lengths'], answer_sentence=sample['ans_sentence'], answer_start=sample['ans_start'], answer_end=... | def load_sample(sample_file):
with open(sample_file, 'rt') as handle:
sample = json.load(handle)
return SquadExample(question=sample['question'], context=sample['context'], sentence_lengths=sample['sent_lengths'], answer_sentence=sample['ans_sentence'], answer_start=sample['ans_start'], answer_end=... |
251559bd809fd7fb99c5471d3acef4acdbadc5f343bf708bb34d45f67c91ecd7 | def make_batches(samples, augmented_samples, batch_size, cycle=False):
'Convert samples from the samples generator into\n padded batches with `batch_size` as the first dimension.'
current_batch = []
while True:
if (augmented_samples is not None):
augmented = featurize.random_sample(au... | Convert samples from the samples generator into
padded batches with `batch_size` as the first dimension. | gnr.py | make_batches | baidu-research/GloballyNormalizedReader | 73 | python | def make_batches(samples, augmented_samples, batch_size, cycle=False):
'Convert samples from the samples generator into\n padded batches with `batch_size` as the first dimension.'
current_batch = []
while True:
if (augmented_samples is not None):
augmented = featurize.random_sample(au... | def make_batches(samples, augmented_samples, batch_size, cycle=False):
'Convert samples from the samples generator into\n padded batches with `batch_size` as the first dimension.'
current_batch = []
while True:
if (augmented_samples is not None):
augmented = featurize.random_sample(au... |
77735b91bb10ee61b7a2a5229eb8d2208bad0ca185cbe82ecdb8c03c220dab9d | def load_input_data(path, batch_size, validation_size, current_iteration):
'\n Load the input data from the provided directory, splitting it into\n validation batches and an infinite generator of training batches.\n\n Arguments:\n - path: Directory with one file or subdirectory per training sample.\... | Load the input data from the provided directory, splitting it into
validation batches and an infinite generator of training batches.
Arguments:
- path: Directory with one file or subdirectory per training sample.
- batch_size: Size of each training batch (per GPU).
- validation_size: Size of the validation... | gnr.py | load_input_data | baidu-research/GloballyNormalizedReader | 73 | python | def load_input_data(path, batch_size, validation_size, current_iteration):
'\n Load the input data from the provided directory, splitting it into\n validation batches and an infinite generator of training batches.\n\n Arguments:\n - path: Directory with one file or subdirectory per training sample.\... | def load_input_data(path, batch_size, validation_size, current_iteration):
'\n Load the input data from the provided directory, splitting it into\n validation batches and an infinite generator of training batches.\n\n Arguments:\n - path: Directory with one file or subdirectory per training sample.\... |
a1c65974e75d7942cdc9461aa47ba60471186b0a3a52454284cd1d57b916e1f2 | def featurize_question(model, questions, embedding_dropout, training):
'Embed the question as the final hidden state of a stack of Bi-LSTMs\n and a "passage-indenpendent" embedding from Rasor.\n\n Arguments:\n model: QA model hyperparameters.\n questions: Question word indi... | Embed the question as the final hidden state of a stack of Bi-LSTMs
and a "passage-indenpendent" embedding from Rasor.
Arguments:
model: QA model hyperparameters.
questions: Question word indices with shape `[batch, length]`.
embedding_dropout: Dropout probability for the inputs to t... | gnr.py | featurize_question | baidu-research/GloballyNormalizedReader | 73 | python | def featurize_question(model, questions, embedding_dropout, training):
'Embed the question as the final hidden state of a stack of Bi-LSTMs\n and a "passage-indenpendent" embedding from Rasor.\n\n Arguments:\n model: QA model hyperparameters.\n questions: Question word indi... | def featurize_question(model, questions, embedding_dropout, training):
'Embed the question as the final hidden state of a stack of Bi-LSTMs\n and a "passage-indenpendent" embedding from Rasor.\n\n Arguments:\n model: QA model hyperparameters.\n questions: Question word indi... |
6bd4869524474bc3e5a85cceeaf153999f4f8e03d763eaeee3d241a0a8c8f968 | def featurize_document(model, questions, documents, same_as_question, repeated_words, repeated_word_intensity, question_vector, embedding_dropout, training):
"Run a stack of Bi-LSTM's over the document.\n Arguments:\n model: QA model hyperparameters.\n documents: Document word... | Run a stack of Bi-LSTM's over the document.
Arguments:
model: QA model hyperparameters.
documents: Document word indices with shape `[batch, length]`.
same_as_question: Boolean: Does the question contain this word? with
shape `[batch, length]`
question_vec... | gnr.py | featurize_document | baidu-research/GloballyNormalizedReader | 73 | python | def featurize_document(model, questions, documents, same_as_question, repeated_words, repeated_word_intensity, question_vector, embedding_dropout, training):
"Run a stack of Bi-LSTM's over the document.\n Arguments:\n model: QA model hyperparameters.\n documents: Document word... | def featurize_document(model, questions, documents, same_as_question, repeated_words, repeated_word_intensity, question_vector, embedding_dropout, training):
"Run a stack of Bi-LSTM's over the document.\n Arguments:\n model: QA model hyperparameters.\n documents: Document word... |
8bfe7704986be9b786047bb583a556b0c47d76c35119240e066601449a4772ad | def score_sentences(model, documents_features, sentence_lengths, hidden_dropout):
'Compute logits for selecting each sentence in the document.\n\n Arguments:\n documents_features: Feature representation of the document\n with shape `[batch, length, features]`.\n sentence_... | Compute logits for selecting each sentence in the document.
Arguments:
documents_features: Feature representation of the document
with shape `[batch, length, features]`.
sentence_lengths: Length of each sentence in the document
with shape `[batch, num_sentences... | gnr.py | score_sentences | baidu-research/GloballyNormalizedReader | 73 | python | def score_sentences(model, documents_features, sentence_lengths, hidden_dropout):
'Compute logits for selecting each sentence in the document.\n\n Arguments:\n documents_features: Feature representation of the document\n with shape `[batch, length, features]`.\n sentence_... | def score_sentences(model, documents_features, sentence_lengths, hidden_dropout):
'Compute logits for selecting each sentence in the document.\n\n Arguments:\n documents_features: Feature representation of the document\n with shape `[batch, length, features]`.\n sentence_... |
e8bba8c1345c309b7fe878b906f4e8a299383448ea66e47d387a92e858ee9f6a | def slice_sentences(document_features, picks, sentence_lengths):
'Extract selected sentence spans from the document features.\n\n Arguments:\n document_features: A `[batch, length, features]` representation\n of the documents.\n picks: Sentence to extract wi... | Extract selected sentence spans from the document features.
Arguments:
document_features: A `[batch, length, features]` representation
of the documents.
picks: Sentence to extract with shape
`[batch, selections]`.
sentence_lengths: Length of e... | gnr.py | slice_sentences | baidu-research/GloballyNormalizedReader | 73 | python | def slice_sentences(document_features, picks, sentence_lengths):
'Extract selected sentence spans from the document features.\n\n Arguments:\n document_features: A `[batch, length, features]` representation\n of the documents.\n picks: Sentence to extract wi... | def slice_sentences(document_features, picks, sentence_lengths):
'Extract selected sentence spans from the document features.\n\n Arguments:\n document_features: A `[batch, length, features]` representation\n of the documents.\n picks: Sentence to extract wi... |
67dc8839cfed7df11d699842f679560dd1c3f152deb2b544f8fe988a91a3e556 | def slice_end_of_sentence(sentence_features, start_word_picks, sentence_lengths):
'Extract the final span of each sentence after the selected\n starting words.\n\n Arguments:\n sentence_features: Sentence representation with shape\n `[batch, k, words, features]`.\n st... | Extract the final span of each sentence after the selected
starting words.
Arguments:
sentence_features: Sentence representation with shape
`[batch, k, words, features]`.
start_word_picks: Starting word selections with shape
`[batch, k]`.
sentence_lengths:... | gnr.py | slice_end_of_sentence | baidu-research/GloballyNormalizedReader | 73 | python | def slice_end_of_sentence(sentence_features, start_word_picks, sentence_lengths):
'Extract the final span of each sentence after the selected\n starting words.\n\n Arguments:\n sentence_features: Sentence representation with shape\n `[batch, k, words, features]`.\n st... | def slice_end_of_sentence(sentence_features, start_word_picks, sentence_lengths):
'Extract the final span of each sentence after the selected\n starting words.\n\n Arguments:\n sentence_features: Sentence representation with shape\n `[batch, k, words, features]`.\n st... |
2018a62cb51c8b3b50fefd800c72193642e9bf21ce5a7afbfae0b402ac8a07dd | def score_start_word(model, document_embeddings, sentence_picks, sentence_lengths, hidden_dropout):
'Score each possible span spart word in a sentence by\n passing it through an MLP.\n\n Arguments:\n model: QA model hyperparameters.\n document_embeddings: Document representation wi... | Score each possible span spart word in a sentence by
passing it through an MLP.
Arguments:
model: QA model hyperparameters.
document_embeddings: Document representation with shape
`[batch, length, features]`.
sentence_picks: Selected sentences with shape
... | gnr.py | score_start_word | baidu-research/GloballyNormalizedReader | 73 | python | def score_start_word(model, document_embeddings, sentence_picks, sentence_lengths, hidden_dropout):
'Score each possible span spart word in a sentence by\n passing it through an MLP.\n\n Arguments:\n model: QA model hyperparameters.\n document_embeddings: Document representation wi... | def score_start_word(model, document_embeddings, sentence_picks, sentence_lengths, hidden_dropout):
'Score each possible span spart word in a sentence by\n passing it through an MLP.\n\n Arguments:\n model: QA model hyperparameters.\n document_embeddings: Document representation wi... |
fa12ef441529cfb51affe7c0ce563782df8cdb47348ecc35ec36e97d3b26c8b6 | def score_end_words(model, document_embeddings, sentence_picks, start_word_picks, sentence_lengths, hidden_dropout, training):
'Score each possible span end word in the sentence by\n running a Bi-LSTM over the remaining sentence span and\n passing the result through an MLP.\n\n Arguments:\n model: ... | Score each possible span end word in the sentence by
running a Bi-LSTM over the remaining sentence span and
passing the result through an MLP.
Arguments:
model: QA model hyperparameters
document_embeddings: A `[batch, length, features]`
representation of a docume... | gnr.py | score_end_words | baidu-research/GloballyNormalizedReader | 73 | python | def score_end_words(model, document_embeddings, sentence_picks, start_word_picks, sentence_lengths, hidden_dropout, training):
'Score each possible span end word in the sentence by\n running a Bi-LSTM over the remaining sentence span and\n passing the result through an MLP.\n\n Arguments:\n model: ... | def score_end_words(model, document_embeddings, sentence_picks, start_word_picks, sentence_lengths, hidden_dropout, training):
'Score each possible span end word in the sentence by\n running a Bi-LSTM over the remaining sentence span and\n passing the result through an MLP.\n\n Arguments:\n model: ... |
cb8093731a39e10e2bc1f1d13c5f4b3f67f35eb477b5cb108a035b932a523656 | def globally_normalized_loss(beam_states, labels):
'Global normalized loss with early updating.\n\n Arguments:\n beam_states: List of previous decisions and current decision scores\n for each step in the search process, as well as the final\n beam. Previous decision... | Global normalized loss with early updating.
Arguments:
beam_states: List of previous decisions and current decision scores
for each step in the search process, as well as the final
beam. Previous decisions are a tensor of indices with shape
`[batch, beam_size]` co... | gnr.py | globally_normalized_loss | baidu-research/GloballyNormalizedReader | 73 | python | def globally_normalized_loss(beam_states, labels):
'Global normalized loss with early updating.\n\n Arguments:\n beam_states: List of previous decisions and current decision scores\n for each step in the search process, as well as the final\n beam. Previous decision... | def globally_normalized_loss(beam_states, labels):
'Global normalized loss with early updating.\n\n Arguments:\n beam_states: List of previous decisions and current decision scores\n for each step in the search process, as well as the final\n beam. Previous decision... |
2ef4ef615aac27c185bcff559d33c9e8c87760c4ada2f234b6b85b30958ebb80 | def build_model(model):
'Build a Tensorflow graph for the QA model.\n Return a model.Model for training, evaluation, etc.\n '
with tf.name_scope('Inputs'):
questions = tf.placeholder(tf.int32, name='Questions', shape=[None, None])
documents = tf.placeholder(tf.int32, name='Documents', shap... | Build a Tensorflow graph for the QA model.
Return a model.Model for training, evaluation, etc. | gnr.py | build_model | baidu-research/GloballyNormalizedReader | 73 | python | def build_model(model):
'Build a Tensorflow graph for the QA model.\n Return a model.Model for training, evaluation, etc.\n '
with tf.name_scope('Inputs'):
questions = tf.placeholder(tf.int32, name='Questions', shape=[None, None])
documents = tf.placeholder(tf.int32, name='Documents', shap... | def build_model(model):
'Build a Tensorflow graph for the QA model.\n Return a model.Model for training, evaluation, etc.\n '
with tf.name_scope('Inputs'):
questions = tf.placeholder(tf.int32, name='Questions', shape=[None, None])
documents = tf.placeholder(tf.int32, name='Documents', shap... |
5fed9307280de9b498e27f459a998af6064f5cc7510414889890b8072e64689a | def __init__(self, reftrack, parent=None):
'Initialize a new OptionSelector\n\n :param reftrack: the reftrack to show options for\n :type reftrack: :class:`jukeboxcore.reftrack.Reftrack`\n :param parent: the parent widget\n :type parent: :class:`QtGui.QWidget`\n :raises: None\n ... | Initialize a new OptionSelector
:param reftrack: the reftrack to show options for
:type reftrack: :class:`jukeboxcore.reftrack.Reftrack`
:param parent: the parent widget
:type parent: :class:`QtGui.QWidget`
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | __init__ | JukeboxPipeline/jukebox-core | 2 | python | def __init__(self, reftrack, parent=None):
'Initialize a new OptionSelector\n\n :param reftrack: the reftrack to show options for\n :type reftrack: :class:`jukeboxcore.reftrack.Reftrack`\n :param parent: the parent widget\n :type parent: :class:`QtGui.QWidget`\n :raises: None\n ... | def __init__(self, reftrack, parent=None):
'Initialize a new OptionSelector\n\n :param reftrack: the reftrack to show options for\n :type reftrack: :class:`jukeboxcore.reftrack.Reftrack`\n :param parent: the parent widget\n :type parent: :class:`QtGui.QWidget`\n :raises: None\n ... |
f9abf1024ed34a31df9d81edac22a8bb2113abdbc7101bcf4c74ee31841b7ceb | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
labels = self.reftrack.get_option_labels()
self.browser = ComboBoxBrowser(len(labels), headers=labels)
self.browser_vbox.addWidget(self.browser) | Setup the ui
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | setup_ui | JukeboxPipeline/jukebox-core | 2 | python | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
labels = self.reftrack.get_option_labels()
self.browser = ComboBoxBrowser(len(labels), headers=labels)
self.browser_vbox.addWidget(self.browser) | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
labels = self.reftrack.get_option_labels()
self.browser = ComboBoxBrowser(len(labels), headers=labels)
self.browser_vbox.addWidget(self.browser)<|docstring|>Setup the ui
:returns: None
:r... |
6c256436fe778f0287dfbbd7300b6ea0b843d0fbfbefc64eedc78418e8a297ac | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.select_pb.clicked.connect(self.select) | Connect the signals with the slots to make the ui functional
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | setup_signals | JukeboxPipeline/jukebox-core | 2 | python | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.select_pb.clicked.connect(self.select) | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.select_pb.clicked.connect(self.select)<|docstring|>Connect the signals with the slots to make the ui functional
:returns: None
:rtype: No... |
b0b026189b56338debfb8054cc31958ddb8996b9c95c41f2b8ae2b5c7242ae3c | def select(self):
'Store the selected taskfileinfo self.selected and accept the dialog\n\n :returns: None\n :rtype: None\n :raises: None\n '
s = self.browser.selected_indexes((self.browser.get_depth() - 1))
if (not s):
return
i = s[0].internalPointer()
if i:
... | Store the selected taskfileinfo self.selected and accept the dialog
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | select | JukeboxPipeline/jukebox-core | 2 | python | def select(self):
'Store the selected taskfileinfo self.selected and accept the dialog\n\n :returns: None\n :rtype: None\n :raises: None\n '
s = self.browser.selected_indexes((self.browser.get_depth() - 1))
if (not s):
return
i = s[0].internalPointer()
if i:
... | def select(self):
'Store the selected taskfileinfo self.selected and accept the dialog\n\n :returns: None\n :rtype: None\n :raises: None\n '
s = self.browser.selected_indexes((self.browser.get_depth() - 1))
if (not s):
return
i = s[0].internalPointer()
if i:
... |
079ff26b0af06842889e283de3b8b37156d8befa65e9d0392d8adb54f4a9c976 | def __init__(self, parent=None):
'Initialize a new ReftrackWidget\n\n :param parent: widget parent\n :type parent: QtGui.QWidget\n :raises: None\n '
super(ReftrackWidget, self).__init__(parent)
self.setupUi(self)
self.reftrack = None
self.setup_ui()
self.setup_signals... | Initialize a new ReftrackWidget
:param parent: widget parent
:type parent: QtGui.QWidget
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | __init__ | JukeboxPipeline/jukebox-core | 2 | python | def __init__(self, parent=None):
'Initialize a new ReftrackWidget\n\n :param parent: widget parent\n :type parent: QtGui.QWidget\n :raises: None\n '
super(ReftrackWidget, self).__init__(parent)
self.setupUi(self)
self.reftrack = None
self.setup_ui()
self.setup_signals... | def __init__(self, parent=None):
'Initialize a new ReftrackWidget\n\n :param parent: widget parent\n :type parent: QtGui.QWidget\n :raises: None\n '
super(ReftrackWidget, self).__init__(parent)
self.setupUi(self)
self.reftrack = None
self.setup_ui()
self.setup_signals... |
66eebcae3e078853583412aa8f81a23316752e5e1144a13b46296a19e6156b5a | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.setup_icons() | Setup the ui
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | setup_ui | JukeboxPipeline/jukebox-core | 2 | python | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.setup_icons() | def setup_ui(self):
'Setup the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.setup_icons()<|docstring|>Setup the ui
:returns: None
:rtype: None
:raises: None<|endoftext|> |
e11571a56c1f3c5a552763d38fa3cfa628b9202732ead9767ce49e055381a0b3 | def setup_icons(self):
'Setup the icons of the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
iconbtns = [('menu_border_24x24.png', self.menu_tb), ('duplicate_border_24x24.png', self.duplicate_tb), ('delete_border_24x24.png', self.delete_tb), ('reference_border_24x24.png', ... | Setup the icons of the ui
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | setup_icons | JukeboxPipeline/jukebox-core | 2 | python | def setup_icons(self):
'Setup the icons of the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
iconbtns = [('menu_border_24x24.png', self.menu_tb), ('duplicate_border_24x24.png', self.duplicate_tb), ('delete_border_24x24.png', self.delete_tb), ('reference_border_24x24.png', ... | def setup_icons(self):
'Setup the icons of the ui\n\n :returns: None\n :rtype: None\n :raises: None\n '
iconbtns = [('menu_border_24x24.png', self.menu_tb), ('duplicate_border_24x24.png', self.duplicate_tb), ('delete_border_24x24.png', self.delete_tb), ('reference_border_24x24.png', ... |
7a65427bccabe0fffaafb524bddd62135cc348dba3ba8719e96cd22372c2dfef | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.duplicate_tb.clicked.connect(self.duplicate)
self.delete_tb.clicked.connect(self.delete)
self.load_tb.clicked.connect(self.load)
... | Connect the signals with the slots to make the ui functional
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | setup_signals | JukeboxPipeline/jukebox-core | 2 | python | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.duplicate_tb.clicked.connect(self.duplicate)
self.delete_tb.clicked.connect(self.delete)
self.load_tb.clicked.connect(self.load)
... | def setup_signals(self):
'Connect the signals with the slots to make the ui functional\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.duplicate_tb.clicked.connect(self.duplicate)
self.delete_tb.clicked.connect(self.delete)
self.load_tb.clicked.connect(self.load)
... |
e710ac01a8d8ddc3a29b0835f2773e955028c01105a54df7c6969f0537ac88d5 | def set_index(self, index):
'Display the data of the given index\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n :returns: None\n :rtype: None\n :raises: None\n '
self.index = index
self.reftrack = index.model().index(index.row(), 18, index.... | Display the data of the given index
:param index: the index to paint
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_index | JukeboxPipeline/jukebox-core | 2 | python | def set_index(self, index):
'Display the data of the given index\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n :returns: None\n :rtype: None\n :raises: None\n '
self.index = index
self.reftrack = index.model().index(index.row(), 18, index.... | def set_index(self, index):
'Display the data of the given index\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n :returns: None\n :rtype: None\n :raises: None\n '
self.index = index
self.reftrack = index.model().index(index.row(), 18, index.... |
155e8c5c846a8ce29a6e1b068bd3386893a185ab61885feacb3cdb18911efe83 | def set_maintext(self, index):
'Set the maintext_lb to display text information about the given reftrack\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
text = ''
... | Set the maintext_lb to display text information about the given reftrack
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_maintext | JukeboxPipeline/jukebox-core | 2 | python | def set_maintext(self, index):
'Set the maintext_lb to display text information about the given reftrack\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
text =
... | def set_maintext(self, index):
'Set the maintext_lb to display text information about the given reftrack\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
text =
... |
175bd29776e9be9ce93833722de50f5e14db395821e23492b75ab708756245cc | def set_identifiertext(self, index):
'Set the identifier text on the identifier_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
t = index.model().index(index.row(... | Set the identifier text on the identifier_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_identifiertext | JukeboxPipeline/jukebox-core | 2 | python | def set_identifiertext(self, index):
'Set the identifier text on the identifier_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
t = index.model().index(index.row(... | def set_identifiertext(self, index):
'Set the identifier text on the identifier_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.DisplayRole
t = index.model().index(index.row(... |
6971b2168fea57b18e338e123f7e3646a013661d48ac5a69fb435294fe71a513 | def set_type_icon(self, index):
'Set the type icon on type_icon_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
icon = index.model().index(index.row(), 0, index.parent()).data(QtCore.Qt.Decorat... | Set the type icon on type_icon_lb
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_type_icon | JukeboxPipeline/jukebox-core | 2 | python | def set_type_icon(self, index):
'Set the type icon on type_icon_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
icon = index.model().index(index.row(), 0, index.parent()).data(QtCore.Qt.Decorat... | def set_type_icon(self, index):
'Set the type icon on type_icon_lb\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
icon = index.model().index(index.row(), 0, index.parent()).data(QtCore.Qt.Decorat... |
74460d1ad04d32c9f0f66801e5939295af7f5289f6c541525c8db4dea2111eae | def disable_restricted(self):
'Disable the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
todisable = [(self.reftrack.duplicate, self.duplicate_tb), (self.reftrack.delete, self.delete_tb), (self.reftrack.reference, self.reference_tb), (self.reftrack.replace,... | Disable the restricted buttons
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | disable_restricted | JukeboxPipeline/jukebox-core | 2 | python | def disable_restricted(self):
'Disable the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
todisable = [(self.reftrack.duplicate, self.duplicate_tb), (self.reftrack.delete, self.delete_tb), (self.reftrack.reference, self.reference_tb), (self.reftrack.replace,... | def disable_restricted(self):
'Disable the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
todisable = [(self.reftrack.duplicate, self.duplicate_tb), (self.reftrack.delete, self.delete_tb), (self.reftrack.reference, self.reference_tb), (self.reftrack.replace,... |
73cb6f51220fa07ff1708387880e2877d97da0467d6a39b9f6d5e2db8047f30b | def hide_restricted(self):
'Hide the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
tohide = [((self.reftrack.unload, self.unload_tb), (self.reftrack.load, self.load_tb)), ((self.reftrack.import_file, self.importtf_tb), (self.reftrack.import_reference, self.... | Hide the restricted buttons
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | hide_restricted | JukeboxPipeline/jukebox-core | 2 | python | def hide_restricted(self):
'Hide the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
tohide = [((self.reftrack.unload, self.unload_tb), (self.reftrack.load, self.load_tb)), ((self.reftrack.import_file, self.importtf_tb), (self.reftrack.import_reference, self.... | def hide_restricted(self):
'Hide the restricted buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
tohide = [((self.reftrack.unload, self.unload_tb), (self.reftrack.load, self.load_tb)), ((self.reftrack.import_file, self.importtf_tb), (self.reftrack.import_reference, self.... |
fc4aa7e0159353f7a2a2fb4ec14661e1491ae84d5df5fff5785d8d520283d70f | def set_top_bar_color(self, index):
'Set the color of the upper frame to the background color of the reftrack status\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.ForegroundRole
... | Set the color of the upper frame to the background color of the reftrack status
:param index: the index
:type index: :class:`QtGui.QModelIndex`
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_top_bar_color | JukeboxPipeline/jukebox-core | 2 | python | def set_top_bar_color(self, index):
'Set the color of the upper frame to the background color of the reftrack status\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.ForegroundRole
... | def set_top_bar_color(self, index):
'Set the color of the upper frame to the background color of the reftrack status\n\n :param index: the index\n :type index: :class:`QtGui.QModelIndex`\n :returns: None\n :rtype: None\n :raises: None\n '
dr = QtCore.Qt.ForegroundRole
... |
598e71e9d30ea015627698285272f955984d96984519b60b521c1001bf8d3f59 | def set_status_buttons(self):
'Depending on the status of the reftrack, enable or disable\n the status buttons, for imported/alien status buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
imported = (self.reftrack.status() == self.reftrack.IMPORTED)
alien = sel... | Depending on the status of the reftrack, enable or disable
the status buttons, for imported/alien status buttons
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_status_buttons | JukeboxPipeline/jukebox-core | 2 | python | def set_status_buttons(self):
'Depending on the status of the reftrack, enable or disable\n the status buttons, for imported/alien status buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
imported = (self.reftrack.status() == self.reftrack.IMPORTED)
alien = sel... | def set_status_buttons(self):
'Depending on the status of the reftrack, enable or disable\n the status buttons, for imported/alien status buttons\n\n :returns: None\n :rtype: None\n :raises: None\n '
imported = (self.reftrack.status() == self.reftrack.IMPORTED)
alien = sel... |
5c1541f17ff19a3427972f98486f97b5222b54a42c0b41c4b0e96e61c3dacc2e | def toggle_tbstyle(self, button):
'Toogle the ToolButtonStyle of the given button between :data:`ToolButtonIconOnly` and :data:`ToolButtonTextBesideIcon`\n\n :param button: a tool button\n :type button: :class:`QtGui.QToolButton`\n :returns: None\n :rtype: None\n :raises: None\n ... | Toogle the ToolButtonStyle of the given button between :data:`ToolButtonIconOnly` and :data:`ToolButtonTextBesideIcon`
:param button: a tool button
:type button: :class:`QtGui.QToolButton`
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | toggle_tbstyle | JukeboxPipeline/jukebox-core | 2 | python | def toggle_tbstyle(self, button):
'Toogle the ToolButtonStyle of the given button between :data:`ToolButtonIconOnly` and :data:`ToolButtonTextBesideIcon`\n\n :param button: a tool button\n :type button: :class:`QtGui.QToolButton`\n :returns: None\n :rtype: None\n :raises: None\n ... | def toggle_tbstyle(self, button):
'Toogle the ToolButtonStyle of the given button between :data:`ToolButtonIconOnly` and :data:`ToolButtonTextBesideIcon`\n\n :param button: a tool button\n :type button: :class:`QtGui.QToolButton`\n :returns: None\n :rtype: None\n :raises: None\n ... |
25849cb210e83e8ff80139b7c566076d3699d27f4d9a3db51884a6b1ad338d86 | def set_menu(self):
'Setup the menu that the menu_tb button uses\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.menu = QtGui.QMenu(self)
actions = self.reftrack.get_additional_actions()
self.actions = []
for a in actions:
if a.icon:
qaction... | Setup the menu that the menu_tb button uses
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_menu | JukeboxPipeline/jukebox-core | 2 | python | def set_menu(self):
'Setup the menu that the menu_tb button uses\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.menu = QtGui.QMenu(self)
actions = self.reftrack.get_additional_actions()
self.actions = []
for a in actions:
if a.icon:
qaction... | def set_menu(self):
'Setup the menu that the menu_tb button uses\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.menu = QtGui.QMenu(self)
actions = self.reftrack.get_additional_actions()
self.actions = []
for a in actions:
if a.icon:
qaction... |
db4547a21863dddd3c5024fa658358809c6dc787785346b9890d8d52e1bb1ecd | def get_taskfileinfo_selection(self):
'Return a taskfileinfo that the user chose from the available options\n\n :returns: the chosen taskfileinfo\n :rtype: :class:`jukeboxcore.filesys.TaskFileInfo`\n :raises: None\n '
sel = OptionSelector(self.reftrack)
sel.exec_()
return sel... | Return a taskfileinfo that the user chose from the available options
:returns: the chosen taskfileinfo
:rtype: :class:`jukeboxcore.filesys.TaskFileInfo`
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | get_taskfileinfo_selection | JukeboxPipeline/jukebox-core | 2 | python | def get_taskfileinfo_selection(self):
'Return a taskfileinfo that the user chose from the available options\n\n :returns: the chosen taskfileinfo\n :rtype: :class:`jukeboxcore.filesys.TaskFileInfo`\n :raises: None\n '
sel = OptionSelector(self.reftrack)
sel.exec_()
return sel... | def get_taskfileinfo_selection(self):
'Return a taskfileinfo that the user chose from the available options\n\n :returns: the chosen taskfileinfo\n :rtype: :class:`jukeboxcore.filesys.TaskFileInfo`\n :raises: None\n '
sel = OptionSelector(self.reftrack)
sel.exec_()
return sel... |
c59e0b6bdb6f0bf2b49ed20f6cebcc260f49709d3f08f7307a8967be9a8b4533 | def duplicate(self):
'Duplicate the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.duplicate() | Duplicate the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | duplicate | JukeboxPipeline/jukebox-core | 2 | python | def duplicate(self):
'Duplicate the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.duplicate() | def duplicate(self):
'Duplicate the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.duplicate()<|docstring|>Duplicate the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext|> |
e2e83b4ac64ab8da566bcf94f225d92d57c4a9e0ca44f79c8d4e8b0c6cc434c1 | def delete(self):
'Delete the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.delete() | Delete the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | delete | JukeboxPipeline/jukebox-core | 2 | python | def delete(self):
'Delete the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.delete() | def delete(self):
'Delete the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.delete()<|docstring|>Delete the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext|> |
f3063a86137df79ed06bc54c280851872a1c9e2b7fb5dbae971a30a60105482c | def load(self):
'Load the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.load() | Load the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | load | JukeboxPipeline/jukebox-core | 2 | python | def load(self):
'Load the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.load() | def load(self):
'Load the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.load()<|docstring|>Load the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext|> |
d101663f1ee726f8152e2ed222e70477c076542a346384c12dd1754b75885dba | def unload(self):
'Unload the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.unload() | Unload the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | unload | JukeboxPipeline/jukebox-core | 2 | python | def unload(self):
'Unload the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.unload() | def unload(self):
'Unload the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.unload()<|docstring|>Unload the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext|> |
c8f1413e46f58abc095bc9d73d81d49fe54861ffbf74ab5c3dffb4a38b5bbddd | def reference(self):
'Reference a file\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.reference(tfi) | Reference a file
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | reference | JukeboxPipeline/jukebox-core | 2 | python | def reference(self):
'Reference a file\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.reference(tfi) | def reference(self):
'Reference a file\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.reference(tfi)<|docstring|>Reference a file
:returns: None
:rtype: None
:raises: None<|endoftext|> |
d7b21559fd136cbdba58dc5c1b95d90d41bd11977ee19d7859c56fa695601e96 | def import_file(self):
'Import a file\n\n :returns: None\n :rtype: None\n :raises: NotImplementedError\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.import_file(tfi) | Import a file
:returns: None
:rtype: None
:raises: NotImplementedError | src/jukeboxcore/gui/widgets/reftrackwidget.py | import_file | JukeboxPipeline/jukebox-core | 2 | python | def import_file(self):
'Import a file\n\n :returns: None\n :rtype: None\n :raises: NotImplementedError\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.import_file(tfi) | def import_file(self):
'Import a file\n\n :returns: None\n :rtype: None\n :raises: NotImplementedError\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.import_file(tfi)<|docstring|>Import a file
:returns: None
:rtype: None
:raises: NotImplementedError<|e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.