code
stringlengths
3
6.57k
fhandle.read(1)
ord(byte)
struct.unpack('>H', fhandle.read(2)
ValueError("Invalid JPEG file")
head.startswith(b'\x00\x00\x00\x0cjP \r\n\x87\n')
fhandle.seek(32)
struct.unpack('>L', fhandle.read(4)
fhandle.seek(4, 1)
fhandle.read(8)
struct.unpack('>L', boxHeader[:4])
fhandle.seek(boxSize - 8, 1)
fhandle.read(8)
struct.unpack(">HHBB", fhandle.read(10)
_convertToDPI(xDensity, xUnit)
_convertToDPI(yDensity, yUnit)
struct.unpack('>L', boxHeader[:4])
fhandle.seek(boxSize - 8, 1)
ValueError("Invalid JPEG2000 file")
digest_target(target)
digest_element(target)
Subsample(self, indicator, labels)
SubsampleWeights(self, weights, labels)
subsample_indicator(indicator, num_samples)
input (indicator)
tf.where(indicator)
tf.random.shuffle(indices)
tf.reshape(indices, [-1])
tf.minimum(tf.size(indices)
tf.slice(indices, [0], tf.reshape(num_samples, [1])
ops.indices_to_dense_vector(selected_indices, tf.shape(indicator)
tf.equal(selected_indicator, 1)
sample_balanced_positive_negative(indicator, sample_size, labels, positive_fraction=0.5)
positive(=True)
negative (=False)
examples (scalar in [0,1])
tf.logical_not(labels)
tf.logical_and(labels, indicator)
tf.logical_and(negative_idx, indicator)
tf.reduce_sum(tf.cast(positive_idx, dtype=tf.int32)
int(positive_fraction * sample_size)
subsample_indicator(positive_idx, max_num_pos)
tf.reduce_sum(tf.cast(sampled_pos_idx, tf.int32)
tf.cast(negative_positive_ratio * tf.cast(num_sampled_pos, dtype=tf.float32)
subsample_indicator(negative_idx, max_num_neg)
tf.logical_or(sampled_pos_idx, sampled_neg_idx)
positive(=True)
negative (=False)
examples (scalar in [0,1])
_minibatch_subsample_fn(inputs)
sample_balanced_positive_negative(tf.cast(indicators, tf.bool)
tf.cast(targets, tf.bool)
re.compile(r"/\*.*?\*/", re.DOTALL)
__init__(self, main_path=None, user_path=None)
__getitem__(self, key)
__len__(self)
len(self._cfg_dict)
_load_json(self, path)
os.path.exists(path)
open(path)
read()
reg_cmnt.sub("", txt)
json.loads(txt)
_set_default(self, cfg)
cfg.get("path_to_dict", "dict.json")
cfg.get("path_to_stat", "statistic.json")
int(cfg.get("words_per_lesson", 5)
int(cfg.get("CntStudyWords", 50)
float(cfg.get("MinPercent", 97.0)
int(cfg.get("MinSuccessCnt", 10)
int(cfg.get("retry_time", 1800)
cfg.get("hide_transcription", "no")
int(cfg.get("start_time_delay", 1)
int(cfg.get("stat_count_row", 200)
float(cfg.get("right_answer_percent", 10.0)
float(cfg.get("wrong_answer_percent", 40.0)
cfg.get("empty_answer_is_error", "no")
create_default_user_config(self)
os.path.isfile(self._user_path)
open(self._user_path, "wt")
write(txt)
reload(self)
self._cfg_dict.update(self._load_json(self._main_path)
self._cfg_dict.update(self._load_json(self._user_path)
self._set_default(self._cfg_dict)
get_dict(self)
ConfigTestCase(unittest.TestCase)
setUp(self)
os.path.isfile("test_config_user.json")
os.remove("test_config_user.json")
tearDown(self)
os.path.isfile("test_config_user.json")
os.remove("test_config_user.json")
equal_cfg(self, cfg, test_dict)
test_dict.items()
self.assertEqual(cfg[key], val)
self.assertEqual(len(cfg)
test_main(self)
Config("config.json5", "fake_config_user.json")
cfg.reload()
self.equal_cfg(cfg, test_dict)