Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
1. fix issues/24 bug
    -tool combiner UnicodeDecodeError
2. fix issues/26 bug
    --repeat python3 TypeError: 'dict_keys' object is not subscriptable
  • Loading branch information
LandGrey committed Mar 14, 2021
1 parent 2f26ba5 commit 7440c97
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pydictor

[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7&3.4](https://img.shields.io/badge/python-2.7&3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.1.5.2-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7&3.4](https://img.shields.io/badge/python-2.7&3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.1.5.3-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)


**README.md [中文版](README_CN.md)**
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pydictor
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7&3.4](https://img.shields.io/badge/python-2.7&3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.1.5.2-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7&3.4](https://img.shields.io/badge/python-2.7&3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.1.5.3-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)

**README.md [English](README.md)**

Expand Down
2 changes: 1 addition & 1 deletion lib/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def init_pystrs():
# start time
pystrs.startime = time.time()

pystrs.version = '2.1.5.2#dev'
pystrs.version = '2.1.5.3#dev'

# build configuration file element description
pystrs.conf_head = "head"
Expand Down
6 changes: 3 additions & 3 deletions lib/fun/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# coding:utf-8
#
"""
Copyright (c) 2016-2019 LandGrey (https://github.com/LandGrey/pydictor)
Copyright (c) 2016-2021 LandGrey (https://github.com/LandGrey/pydictor)
License: GNU GENERAL PUBLIC LICENSE Version 3
"""

Expand Down Expand Up @@ -148,8 +148,8 @@ def repeat_filter(item, letter_repeat=pyoptions.letter_repeat, digital_repeat=py
groups = groupby(item)
repeat_dict = [{label: sum(1 for _ in group)} for label, group in groups]
for r in repeat_dict:
key = r.keys()[0]
value = r.values()[0]
key = list(r.keys())[0]
value = list(r.values())[0]
if key in string.ascii_letters:
l_repeat = max(l_repeat, value)
elif key in string.digits:
Expand Down
7 changes: 4 additions & 3 deletions tools/combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# coding:utf-8
# author: LandGrey
"""
Copyright (c) 2016-2017 LandGrey (https://github.com/LandGrey/pydictor)
Copyright (c) 2016-2021 LandGrey (https://github.com/LandGrey/pydictor)
License: GNU GENERAL PUBLIC LICENSE Version 3
"""
from __future__ import unicode_literals

import os
import codecs
import mimetypes
import traceback
from lib.data.data import pyoptions
Expand Down Expand Up @@ -35,9 +36,9 @@ def combiner_magic(*args):
if mimetypes.guess_type(_)[0] == 'text/plain':
combine_list.append(_)
try:
with open(storepath, "a") as f:
with codecs.open(storepath, 'a', encoding="utf-8") as f:
for onefile in combine_list:
with open(onefile, 'r') as tf:
with codecs.open(onefile, 'r', encoding="utf-8") as tf:
f.write(tf.read())
finishprinter(storepath)

Expand Down

0 comments on commit 7440c97

Please sign in to comment.