repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E11.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:50.464364 | #: E111
if x > 2:
print x
#: E111
if True:
print
#: E112
if False:
print
#: E113
print
print
#: E111 E113
mimetype = 'application/x-directory'
# 'httpd/unix-directory'
create_date = False
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/acid.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:50.465502 | #!/usr/bin/env python
"""Test that autopep8 runs without crashing on various Python files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import dis
import difflib
import io
import os
import random
import shlex
import sys
import subproce... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/e101_example.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:50.696887 | # -*- coding: utf-8 -*-
# From https://github.com/coto/gae-boilerplate/blob/233a88c59e46bb10de7a901ef4e6a5b60d0006a5/web/handlers.py
"""
This example will take a long time if we don't filter innocuous E101
errors from pep8.
"""
import models.models as models
from webapp2_extras.auth import InvalidAuthIdError
from w... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E12.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.025348 | #: E121
print "E121", (
"dent")
#: E122
print "E122", (
"dent")
#: E123
my_list = [
1, 2, 3,
4, 5, 6,
]
#: E124
print "E124", ("visual",
"indent_two"
)
#: E124
print "E124", ("visual",
"indent_five"
)
#: E124
a = (123,
)
#: E129
if (row < 0 or self.moduleCount <... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E20.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.078482 | #: E201:1:6
spam( ham[1], {eggs: 2})
#: E201:1:10
spam(ham[ 1], {eggs: 2})
#: E201:1:15
spam(ham[1], { eggs: 2})
#: Okay
spam(ham[1], {eggs: 2})
#:
#: E202:1:23
spam(ham[1], {eggs: 2} )
#: E202:1:22
spam(ham[1], {eggs: 2 })
#: E202:1:11
spam(ham[1 ], {eggs: 2})
#: Okay
spam(ham[1], {eggs: 2})
result = func(
arg1... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E21.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.088369 | #: E211
spam (1)
#: E211 E211
dict ['key'] = list [index]
#: E211
dict['key'] ['subkey'] = list[index]
#: Okay
spam(1)
dict['key'] = list[index]
# This is not prohibited by PEP8, but avoid it.
class Foo (Bar, Baz):
pass
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E24.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.089348 | #: E241
a = (1, 2)
#: Okay
b = (1, 20)
#: E242
a = (1, 2) # tab before 2
#: Okay
b = (1, 20) # space before 20
#: E241 E241 E241
# issue 135
more_spaces = [a, b,
ef, +h,
c, -d]
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E22.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.101751 | #: E221
a = 12 + 3
b = 4 + 5
#: E221 E221
x = 1
y = 2
long_variable = 3
#: E221 E221
x[0] = 1
x[1] = 2
long_variable = 3
#: E221 E221
x = f(x) + 1
y = long_variable + 2
z = x[0] + 3
#: E221:3:14
text = """
bar
foo %s""" % rofl
#: Okay
x = 1
y = 2
lon... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E27.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.112452 | #: E275
from w import(e, f)
#: E275
from importable.module import(e, f)
#: E275
try:
from importable.module import(e, f)
except ImportError:
pass
#: Okay
True and False
#: E271
True and False
#: E272
True and False
#: E271
if 1:
#: E273
True and False
#: E273 E274
True and False
#: E271
a and b
#: E271
1... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E26.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.177409 | #: E261
pass # an inline comment
#: E262
x = x + 1 #Increment x
#: E262
x = x + 1 # Increment x
#: E262
x = y + 1 #: Increment x
#: E265
#Block comment
a = 1
#: E265
m = 42
#! This is important
mx = 42 - 42
#: Okay
#!/usr/bin/env python
pass # an inline comment
x = x + 1 # Increment x
y = y + 1 #: Increment ... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E25.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.190928 | #: E251 E251
def foo(bar = False):
'''Test function with an error in declaration'''
pass
#: E251
foo(bar= True)
#: E251
foo(bar =True)
#: E251 E251
foo(bar = True)
#: E251
y = bar(root= "sdasd")
#: E251:2:29
parser.add_argument('--long-option',
default=
"/rather/long/file... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E23.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.215647 | #: E231
a = (1,2)
#: E231
a[b1,:]
#: E231
a = [{'a':''}]
#: Okay
a = (4,)
b = (5, )
c = {'text': text[5:]}
result = {
'key1': 'value',
'key2': 'value',
}
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E30.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:51.417005 | #: E301:5:5
class X:
def a():
pass
def b():
pass
#: E301:6:5
class X:
def a():
pass
# comment
def b():
pass
#:
#: E302:3:1
#!python
# -*- coding: utf-8 -*-
def a():
pass
#: E302:2:1
"""Main module."""
def _main():
pass
#: E302:2:1
import sys
def get_sys_pa... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/W29.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.050941 | #: Okay
# 情
#: W291
print
#: W293
class Foo(object):
bang = 12
#: W291
'''multiline
string with trailing whitespace'''
#: W292
# This line doesn't have a linefeed |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E71.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.051612 | #: E711
if res == None:
pass
#: E712
if res == True:
pass
#: E712
if res != False:
pass
#
#: E713
if not X in Y:
pass
#: E713
if not X.B in Y:
pass
#: E713
if not X in Y and Z == "zero":
pass
#: E713
if X == "zero" or not Y in Z:
pass
#
#: E714
if not X is Y:
pass
#: E714
if not X.B is... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E72.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.054506 | #: E721
if type(res) == type(42):
pass
#: E721
if type(res) != type(""):
pass
#: E721
import types
if res == types.IntType:
pass
#: E721
import types
if type(res) is not types.ListType:
pass
#: E721
assert type(res) == type(False) or type(res) == type(None)
#: E721
assert type(res) == type([])
#: E721... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/W19.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.055563 | #: W191
if False:
print # indented with 1 tab
#:
#: W191
y = x == 2 \
or x == 3
#: E101 W191
if (
x == (
3
) or
y == 4):
pass
#: E101 W191
if x == 2 \
or y > 1 \
or x == 3:
pass
#: E101 W191
if x == 2 \
or y > 1 \
or x == 3:
pass
#:
#: E101 W191
i... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E70.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.056510 | #: E701
if a: a = False
#: E701
if not header or header[:6] != 'bytes=': return
#: E702
a = False; b = True
#: E702
print(1); bdist_egg.write_safety_flag(cmd.egg_info, safe)
#: E703
print(1);
#: E702 E703
del a[:]; a.append(42);
#:
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E90.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.057611 | #: E901
= [x
#: E901 E101 W191
while True:
try:
pass
except:
print 'Whoops'
#: Okay
# Issue #119
# Do not crash with Python2 if the line endswith '\r\r\n'
EMPTY_SET = set()
SET_TYPE = type(EMPTY_SET)
toto = 0 + 0
#:
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E40.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.486226 | #: E401
import os, sys
#: Okay
import os
import sys
from subprocess import Popen, PIPE
from myclass import MyClass
from foo.bar.yourclass import YourClass
import myclass
import foo.bar.yourclass
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E30not.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.487475 | #: Okay
class X:
pass
#: Okay
def foo():
pass
#: Okay
# -*- coding: utf-8 -*-
class X:
pass
#: Okay
# -*- coding: utf-8 -*-
def foo():
pass
#: Okay
class X:
def a():
pass
# comment
def b():
pass
# This is a
# ... multi-line comment
def c():
pass
# T... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/E50.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.488595 | #: E501
a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
#: E502
a = ('123456789012345678901234567890123456789012345678901234567890123456789' \
'01234567890')
#: E502
a = ('AAA \
BBB' \
'CCC')
#: E502
if (foo is None and bar is "e000" and \
blah == 'yeah')... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/long_lines.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.966811 | if True:
if True:
if True:
self.__heap.sort() # pylint: builtin sort probably faster than O(n)-time heapify
if True:
foo = '( '+array[0] +' '
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/noqa.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.968140 | #: Okay
# silence E501
url = 'https://api.github.com/repos/sigmavirus24/Todo.txt-python/branches/master?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&?client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # noqa
# silence E128
from functools import (partial, reduce, wraps, # noqa
cmp_to_key)
from functools import (par... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/latin-1.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.981177 | # -*- coding: latin-1 -*-
# Test non-UTF8 encoding
latin1 = ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
c = ("wå")
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E10.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:52.993243 | #: E101 E122 W191 W191
if True:
pass
change_2_log = \
"""Change 2 by slamb@testclient on 2006/04/13 21:46:23
creation
"""
p4change = {
2: change_2_log,
}
class TestP4Poller(unittest.TestCase):
def setUp(self):
self.setUpGetProcessOutput()
return self.setUpChangeSource()
def te... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E11.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.000278 | #: E111
if x > 2:
print x
#: E111
if True:
print
#: E112
if False:
print
#: E113
print
print
#: E111 E113
mimetype = 'application/x-directory'
# 'httpd/unix-directory'
create_date = False
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/W39.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.080768 | #: W391
# The next line is blank
#: Okay
'''there is nothing wrong
with a multiline string at EOF
that happens to have a blank line in it
'''
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E20.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.120510 | #: E201:1:6
spam(ham[1], {eggs: 2})
#: E201:1:10
spam(ham[1], {eggs: 2})
#: E201:1:15
spam(ham[1], {eggs: 2})
#: Okay
spam(ham[1], {eggs: 2})
#:
#: E202:1:23
spam(ham[1], {eggs: 2})
#: E202:1:22
spam(ham[1], {eggs: 2})
#: E202:1:11
spam(ham[1], {eggs: 2})
#: Okay
spam(ham[1], {eggs: 2})
result = func(
arg1='some... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E21.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.155937 | #: E211
spam(1)
#: E211 E211
dict['key'] = list[index]
#: E211
dict['key']['subkey'] = list[index]
#: Okay
spam(1)
dict['key'] = list[index]
# This is not prohibited by PEP8, but avoid it.
class Foo (Bar, Baz):
pass
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E12.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.183238 | #: E121
print "E121", (
"dent")
#: E122
print "E122", (
"dent")
#: E123
my_list = [
1, 2, 3,
4, 5, 6,
]
#: E124
print "E124", ("visual",
"indent_two"
)
#: E124
print "E124", ("visual",
"indent_five"
)
#: E124
a = (123,
)
#: E129
if (row < ... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E23.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.576688 | #: E231
a = (1, 2)
#: E231
a[b1, :]
#: E231
a = [{'a': ''}]
#: Okay
a = (4,)
b = (5, )
c = {'text': text[5:]}
result = {
'key1': 'value',
'key2': 'value',
}
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E25.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.577771 | #: E251 E251
def foo(bar=False):
'''Test function with an error in declaration'''
pass
#: E251
foo(bar=True)
#: E251
foo(bar=True)
#: E251 E251
foo(bar=True)
#: E251
y = bar(root="sdasd")
#: E251:2:29
parser.add_argument('--long-option',
default="/rather/long/filesystem/path/here/blah/blah... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E26.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.589783 | #: E261
pass # an inline comment
#: E262
x = x + 1 # Increment x
#: E262
x = x + 1 # Increment x
#: E262
x = y + 1 # : Increment x
#: E265
# Block comment
a = 1
#: E265
m = 42
#! This is important
mx = 42 - 42
#: Okay
#!/usr/bin/env python
pass # an inline comment
x = x + 1 # Increment x
y = y + 1 #: Increme... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E24.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.590624 | #: E241
a = (1, 2)
#: Okay
b = (1, 20)
#: E242
a = (1, 2) # tab before 2
#: Okay
b = (1, 20) # space before 20
#: E241 E241 E241
# issue 135
more_spaces = [a, b,
ef, +h,
c, -d]
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E22.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.597333 | #: E221
a = 12 + 3
b = 4 + 5
#: E221 E221
x = 1
y = 2
long_variable = 3
#: E221 E221
x[0] = 1
x[1] = 2
long_variable = 3
#: E221 E221
x = f(x) + 1
y = long_variable + 2
z = x[0] + 3
#: E221:3:14
text = """
bar
foo %s""" % rofl
#: Okay
x = 1
y = 2
long_variable = 3
#:
#: E222
a = a + 1
b = b + 10
#: E222 E222
... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E27.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.637342 | #: E275
from w import (e, f)
#: E275
from importable.module import (e, f)
#: E275
try:
from importable.module import (e, f)
except ImportError:
pass
#: Okay
True and False
#: E271
True and False
#: E272
True and False
#: E271
if 1:
#: E273
True and False
#: E273 E274
True and False
#: E271
a and b
#: E271
1... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E30.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.689293 | #: E301:5:5
import sys
class X:
def a():
pass
def b():
pass
#: E301:6:5
class X:
def a():
pass
# comment
def b():
pass
#:
#: E302:3:1
#!python
# -*- coding: utf-8 -*-
def a():
pass
#: E302:2:1
"""Main module."""
def _main():
pass
#: E302:2:1
d... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E30not.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.701861 | #: Okay
class X:
pass
#: Okay
def foo():
pass
#: Okay
# -*- coding: utf-8 -*-
class X:
pass
#: Okay
# -*- coding: utf-8 -*-
def foo():
pass
#: Okay
class X:
def a():
pass
# comment
def b():
pass
# This is a
# ... multi-line comment
def c():
pas... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E40.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.788675 | #: E401
import os
import sys
#: Okay
import os
import sys
from subprocess import Popen, PIPE
from myclass import MyClass
from foo.bar.yourclass import YourClass
import myclass
import foo.bar.yourclass
|
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E50.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:53.789154 | #: E501
import this
a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
#: E502
a = ('123456789012345678901234567890123456789012345678901234567890123456789'
'01234567890')
#: E502
a = ('AAA \
BBB'
'CCC')
#: E502
if (foo is None and bar is "e000" and
blah == 'y... |
hhatto/autopep8 | https://github.com/hhatto/autopep8 | null | null | null | null | 4,667 | null | null | mit | null | null | null | null | null | null | null | test/suite/out/E70.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:54.418139 | #: E701
if a:
a = False
#: E701
if not header or header[:6] != 'bytes=':
return
#: E702
a = False
b = True
#: E702
print(1)
bdist_egg.write_safety_flag(cmd.egg_info, safe)
#: E703
print(1)
#: E702 E703
del a[:]
a.append(42)
#:
|
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/django_test_env/manage.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.237052 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_test.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/django_test_env/django_test/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.260728 | """
WSGI config for django_test project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/django_test_env/django_test/urls.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.263399 | # -*- coding: utf-8 -*-
"""django_test URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | docs/_themes/flask_theme_support.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.278054 | # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = "... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | example/hello_world.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.281377 | # -*- coding: utf-8 -*-
import werobot
robot = werobot.WeRoBot(token='tokenhere')
@robot.filter("帮助")
def show_help(message):
return """
帮助
XXXXX
"""
@robot.text
def hello_world(message):
return 'Hello World!'
robot.run()
|
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.298586 | #!/usr/bin/env python
# coding=utf-8
import io
import werobot
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
def initialize_options(self):
TestComman... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_config.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:57.860316 | import os
from werobot import WeRoBot
from werobot.config import Config
from werobot.utils import generate_token
basedir = os.path.dirname(os.path.abspath(__file__))
TOKEN = "123"
def test_from_pyfile():
config = Config()
assert "TOKEN" not in config
config.from_pyfile(os.path.join(basedir, "test_confi... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_crypto.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:58.194070 | # -*- coding: utf-8 -*-
from werobot.crypto import PrpCrypto, MessageCrypt
from werobot.utils import generate_token, to_binary, to_text
from werobot.parser import parse_xml
import time
def test_prpcrypto():
key = "ReUrr0NKeHkppBQq"
assert len(key) == 16
crypto = PrpCrypto(key)
text = generate_token... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_handler.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:58.195721 | # -*- coding: utf-8 -*-
from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def te... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_client.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:58.197100 | # -*- coding: utf-8 -*-
import os
import responses
import json
import pytest
import requests
import multipart
import urllib.parse
from io import BytesIO
from werobot import WeRoBot
from werobot.config import Config
from werobot.client import Client, check_error, ClientException
from werobot.utils import cached_propert... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_logger.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:58.224082 | import time
import logging
from werobot.logger import enable_pretty_logging, _LogFormatter
def get_new_logger():
return logging.getLogger(str(time.time()))
def test_logger_level():
for level in ('debug', 'info', 'warning', 'error'):
logger = get_new_logger()
enable_pretty_logging(logger, le... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_parser.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:58.225386 | # -*- coding: utf-8 -*-
from werobot.parser import parse_user_msg
def test_none_message():
assert not parse_user_msg("")
def test_text_message():
message = parse_user_msg(
"""
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/messages/test_entries.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.412211 | # -*- coding: utf-8 -*-
from werobot.messages.entries import get_value, StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text
class NoNameMessage(object):
test_int = IntEntry("TestInt")
test_string_to_int = IntEntry("TestStringToInt")
test_float_to_int = IntEntry("TestFloatToInt")
test_... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_robot.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.524095 | # -*- coding:utf-8 -*-
import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_contrib.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.525262 | # -*- coding: utf-8 -*-
import os
import random
import sys
import time
import pytest
import tornado
import webtest
from tornado.testing import AsyncHTTPSTestCase
from webtest.app import AppError
from werobot.parser import parse_xml, process_message
from werobot.utils import generate_token, get_signature
@pytest.fi... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_replies.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.526424 | # -*- coding:utf-8 -*-
import time
import pytest
from werobot.parser import parse_user_msg
from werobot.replies import WeChatReply, TextReply, ImageReply, MusicReply
from werobot.replies import VoiceReply, VideoReply
from werobot.replies import Article, ArticlesReply
from werobot.replies import TransferCustomerServic... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/config.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.745565 | # -*- coding: utf-8 -*-
import types
class ConfigAttribute(object):
"""
让一个属性指向一个配置
"""
def __init__(self, name):
self.__name__ = name
def __get__(self, obj, type=None):
if obj is None:
return self
rv = obj.config[self.__name__]
return rv
def __se... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.814480 | # -*- coding: utf-8 -*-
import re
from werobot.utils import generate_token, check_token, to_text, to_binary
from werobot.utils import pay_sign_dict, make_error_page, is_regex
def test_token_generator():
assert not check_token('AA C')
assert check_token(generate_token())
assert 3 <= len(generate_token())... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:55:59.839600 | __version__ = '1.13.1'
__author__ = 'whtsky'
__license__ = 'MIT'
__all__ = ["WeRoBot"]
try:
from werobot.robot import WeRoBot
except ImportError: # pragma: no cover
pass # pragma: no cover
|
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/contrib/bottle.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.193371 | # -*- coding: utf-8 -*-
from bottle import request, HTTPResponse
import html
def make_view(robot):
"""
为一个 BaseRoBot 生成 Bottle view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/client.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.319751 | # -*- coding: utf-8 -*-
import time
import requests
import urllib.parse
from requests.compat import json as _json
from werobot.utils import to_text
from werobot.replies import Article
class ClientException(Exception):
pass
def check_error(json):
"""
检测微信公众平台返回值中是否包含错误的返回码。
如果返回码提示有错误,抛出一个 :class:`... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/contrib/django.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.358757 | # -*- coding: utf-8 -*-
from django.http import HttpResponse, HttpResponseNotAllowed, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
import html
def make_view(robot):
"""
为一个 BaseRoBot 生成 Django view。
:param robot: 一个 BaseRoBot 实例。
:return: 一个标准的 Django view
"""
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/contrib/tornado.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.371195 | # -*- coding: utf-8 -*-
from tornado.web import RequestHandler
import html
def make_handler(robot):
"""
为一个 BaseRoBot 生成 Tornado Handler。
Usage ::
import tornado.ioloop
import tornado.web
from werobot import WeRoBot
from tornado_werobot import make_handler
robo... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/crypto/exceptions.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.529205 | # -*- coding: utf-8 -*-
class UnvalidEncodingAESKey(Exception):
pass
class AppIdValidationError(Exception):
pass
class InvalidSignature(Exception):
pass
|
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/contrib/flask.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.530380 | # -*- coding: utf-8 -*-
from flask import request, make_response
import html
def make_view(robot):
"""
为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/logger.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.825291 | # -*- coding:utf-8 -*-
import sys
import time
import logging
try:
import curses
assert curses
except ImportError:
curses = None
logger = logging.getLogger("WeRoBot")
def enable_pretty_logging(logger, level='info'):
"""
按照配置开启 log 的格式化优化。
:param logger: 配置的 logger 对象
:param level: 要为 l... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/messages/base.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:00.919780 | class WeRoBotMetaClass(type):
TYPES = {}
def __new__(mcs, name, bases, attrs):
return type.__new__(mcs, name, bases, attrs)
def __init__(cls, name, bases, attrs):
if '__type__' in attrs:
if isinstance(attrs['__type__'], list):
for _type in attrs['__type__']:
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/messages/events.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.073008 | # -*- coding: utf-8 -*-
from werobot.messages.entries import StringEntry, IntEntry, FloatEntry
from werobot.messages.base import WeRoBotMetaClass
class EventMetaClass(WeRoBotMetaClass):
pass
class WeChatEvent(object, metaclass=EventMetaClass):
target = StringEntry('ToUserName')
source = StringEntry('Fr... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/messages/messages.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.272625 | # -*- coding: utf-8 -*-
from werobot.messages.entries import StringEntry, IntEntry, FloatEntry
from werobot.messages.base import WeRoBotMetaClass
class MessageMetaClass(WeRoBotMetaClass):
pass
class WeChatMessage(object, metaclass=MessageMetaClass):
message_id = IntEntry('MsgId', 0)
target = StringEntr... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/crypto/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.325663 | # -*- coding: utf-8 -*-
import base64
import socket
import struct
import time
try:
from cryptography.hazmat.primitives.ciphers import (
Cipher, algorithms, modes
)
from cryptography.hazmat.backends import default_backend
except ImportError: # pragma: no cover
raise RuntimeError("You need to i... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/parser.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.403103 | # -*- coding: utf-8 -*-
import xmltodict
from werobot.messages.messages import MessageMetaClass, UnknownMessage
from werobot.messages.events import EventMetaClass, UnknownEvent
def parse_user_msg(xml):
message = process_message(parse_xml(xml)) if xml else None
return message
def parse_xml(text):
xml_di... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/pay.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.496842 | # -*- coding:utf-8 -*-
from hashlib import sha1, md5
from urllib import urlencode
import time
from werobot.client import Client
from werobot.utils import pay_sign_dict, generate_token
from functools import partial
NATIVE_BASE_URL = 'weixin://wxpay/bizpayurl?'
class WeixinPayClient(Client):
"""
简化微信支付API操作
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/replies.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.498037 | # -*- coding: utf-8 -*-
import time
from collections import defaultdict, namedtuple
from werobot.utils import is_string, to_text
def renderable_named_tuple(typename, field_names, tempalte):
class TMP(namedtuple(typename=typename, field_names=field_names)):
__TEMPLATE__ = tempalte
@property
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/robot.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.626976 | # -*- coding: utf-8 -*-
import warnings
from werobot.config import Config, ConfigAttribute
from werobot.client import Client
from werobot.exceptions import ConfigError
from werobot.parser import parse_xml, process_message
from werobot.replies import process_function_reply
from werobot.utils import (
to_binary, to... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.880020 | class SessionStorage(object):
def get(self, id):
raise NotImplementedError()
def set(self, id, value):
raise NotImplementedError()
def delete(self, id):
raise NotImplementedError()
def __getitem__(self, id):
return self.get(id)
def __setitem__(self, id, session):
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/filestorage.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.900412 | # -*- coding: utf-8 -*-
try:
import anydbm as dbm
assert dbm
except ImportError:
import dbm
from werobot.session import SessionStorage
from werobot.utils import json_loads, json_dumps, to_binary
class FileStorage(SessionStorage):
"""
FileStorage 会把你的 Session 数据以 dbm 形式储存在文件中。
:param filena... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/mongodbstorage.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:01.993100 | # -*- coding: utf-8 -*-
from werobot.session import SessionStorage
from werobot.utils import json_loads, json_dumps
class MongoDBStorage(SessionStorage):
"""
MongoDBStorage 会把你的 Session 数据储存在一个 MongoDB Collection 中 ::
import pymongo
import werobot
from werobot.session.mongodbstorage ... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/messages/entries.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:02.070115 | # -*- coding: utf-8 -*-
from werobot.utils import to_text
def get_value(instance, path, default=None):
dic = instance.__dict__
for entry in path.split('.'):
dic = dic.get(entry)
if dic is None:
return default
return dic or default
class BaseEntry(object):
def __init__(sel... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/mysqlstorage.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:02.082698 | # -*- coding: utf-8 -*-
from werobot.session import SessionStorage
from werobot.utils import json_loads, json_dumps
__CREATE_TABLE_SQL__ = """
CREATE TABLE IF NOT EXISTS WeRoBot(
id VARCHAR(100) NOT NULL ,
value BLOB NOT NULL,
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
"""
class MySQLStorage(SessionSt... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/postgresqlstorage.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:02.106944 | # -*- coding: utf-8 -*-
from werobot.session import SessionStorage
from werobot.utils import json_loads, json_dumps
__CREATE_TABLE_SQL__ = """
CREATE TABLE IF NOT EXISTS WeRoBot
(
id VARCHAR(100) PRIMARY KEY,
value TEXT NOT NULL
);
"""
class PostgreSQLStorage(SessionStorage):
"""
PostgreSQLStorage 会把你的 Sess... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/session/redisstorage.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:02.221392 | # -*- coding: utf-8 -*-
from werobot.session import SessionStorage
from werobot.utils import json_loads, json_dumps
class RedisStorage(SessionStorage):
"""
RedisStorage 会把你的 Session 数据储存在 Redis 中 ::
import redis
import werobot
from werobot.session.redisstorage import RedisStorage
... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | tests/test_session.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:03.759512 | # -*- coding: utf-8 -*-
import os
import mongomock
import mockredis
import pytest
import sqlite3
import werobot
import werobot.testing
import werobot.utils
from werobot.session import SessionStorage
from werobot.session import filestorage, mongodbstorage, redisstorage, saekvstorage
from werobot.session import sqlites... |
offu/WeRoBot | https://github.com/offu/WeRoBot | null | null | null | null | 4,668 | null | null | mit | null | null | null | null | null | null | null | werobot/crypto/pkcs7.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:05.977881 | # -*- coding: utf-8 -*-
from werobot.utils import to_binary
_BLOCK_SIZE = 32
def encode(text):
# 计算需要填充的位数
amount_to_pad = _BLOCK_SIZE - (len(text) % _BLOCK_SIZE)
if not amount_to_pad:
amount_to_pad = _BLOCK_SIZE
# 获得补位所用的字符
pad = chr(amount_to_pad)
return text + to_binary(pad * amou... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.448750 | # -*- coding:utf-8 -*-
"""
DDNS
@author: NewFuture, rufengsuixing
"""
import sys
from io import TextIOWrapper
from logging import getLogger
from subprocess import check_output
from . import ip
from .__init__ import __description__, __version__, build_date
from .cache import Cache
from .config import Config, load_conf... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.489242 | # -*- coding:utf-8 -*-
"""
ddns Package
"""
__description__ = "automatically update DNS records to my IP [域名自动指向本机IP]"
# 编译时,版本会被替换
__version__ = "${BUILD_VERSION}"
# 时间也会被替换掉
build_date = "${BUILD_DATE}"
|
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/config/config.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.493312 | # coding=utf-8
"""
Configuration class merged from CLI, JSON, and environment variables.
@author: NewFuture
"""
from hashlib import md5
from .cli import str_bool, log_level as get_log_level
__all__ = ["Config", "split_array_string"]
# 简单数组,支持',', ';' 分隔的参数列表
SIMPLE_ARRAY_PARAMS = ["ipv4", "ipv6", "proxy", "index4", ... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/config/cli.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.494406 | # -*- coding:utf-8 -*-
"""
Configuration loader for DDNS command-line interface.
@author: NewFuture
"""
import platform
import sys
from argparse import SUPPRESS, Action, ArgumentParser, RawTextHelpFormatter
from logging import DEBUG, basicConfig, getLevelName
from os import path as os_path
from ..scheduler import get... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/config/file.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.503111 | # -*- coding:utf-8 -*-
"""
Configuration file loader for DDNS. supports both JSON and AST parsing.
@author: NewFuture
"""
from ast import literal_eval
from json import loads as json_decode, dumps as json_encode
from sys import stderr, stdout
from ..util.comment import remove_comment
from ..util.http import request
fro... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/config/env.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.508429 | # -*- coding:utf-8 -*-
"""
Configuration loader for DDNS environment variables.
@author: NewFuture
"""
from ast import literal_eval
from os import environ
from sys import stderr
__all__ = ["load_config"]
def _try_parse_array(value, key=None):
# type: (str, str|None) -> Any
"""解析数组值[], 非数组返回元素字符串(去除前后空格)"""
... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/config/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.509680 | # -*- coding:utf-8 -*-
"""
Configuration loader for DDNS.
This module handles loading configuration from command-line arguments,
JSON configuration files, and environment variables.
@author: NewFuture
"""
import os
import sys
import logging
from .cli import load_config as load_cli_config
from .file import load_confi... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/cache.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.510778 | # -*- coding: utf-8 -*-
"""
cache module
文件缓存
"""
from logging import getLogger, Logger # noqa: F401
from os import path, stat
from json import load, dump
from tempfile import gettempdir
from time import time
class Cache(dict):
"""
using file to Cache data as dictionary
"""
def __init__(self, path,... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | .github/patch.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.529513 | #!/usr/bin/env python3
import json
import os
import re
import sys
import time
import urllib.request
from datetime import datetime, timezone
ROOT = "."
init_py_path = os.path.join(ROOT, "ddns", "__init__.py")
def extract_pure_version(version_str):
"""
提取前4组数字并用点拼接,如 v1.2.3.beta4.5 -> 1.2.3.4
"""
nums... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | .github/scripts/update_agents_structure.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:08.559112 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Compare AGENTS.md directory structure with actual files."""
import os
import re
import sys
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ISSUE_BODY_FILE = os.path.join(REPO_ROOT, ".github", "issue_body.md")
def scan_files(d... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/ip.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:09.051112 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from re import compile
from os import name as os_name, popen
from socket import socket, getaddrinfo, gethostname, AF_INET, AF_INET6, SOCK_DGRAM
from logging import debug, error
from .util.http import request
# 模块级别的SSL验证配置,默认使用auto模式
ssl_verify = "auto"
# IPV4正则
IPV4_REG ... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/provider/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:09.113690 | # coding=utf-8
from ._base import SimpleProvider
from .alidns import AlidnsProvider
from .aliesa import AliesaProvider
from .callback import CallbackProvider
from .cloudflare import CloudflareProvider
from .cloudns import CloudnsProvider
from .debug import DebugProvider
from .dnscom import DnscomProvider
from .dnspod i... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/provider/_base.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:09.122315 | # coding=utf-8
"""
## SimpleProvider 简单DNS抽象基类
* set_record()
## BaseProvider 标准DNS抽象基类
定义所有 DNS 服务商 API 类应继承的抽象基类,统一接口,便于扩展适配多服务商。
Defines a unified interface to support extension and adaptation across providers.
* _query_zone_id
* _query_record
* _update_record
* _create_record
┌────────────────────────────────────... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/provider/aliesa.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:09.131141 | # coding=utf-8
"""
AliESA API
阿里云边缘安全加速(ESA) DNS 解析操作库
@author: NewFuture, GitHub Copilot
"""
from time import strftime
from ._base import TYPE_JSON, join_domain
from .alidns import AliBaseProvider
class AliesaProvider(AliBaseProvider):
"""阿里云边缘安全加速(ESA) DNS Provider"""
endpoint = "https://esa.cn-hangzhou.... |
NewFuture/DDNS | https://github.com/NewFuture/DDNS | null | null | null | null | 4,662 | null | null | mit | null | null | null | null | null | null | null | ddns/provider/cloudflare.py | null | null | null | null | null | null | Python | 2026-05-04T01:56:09.138691 | # coding=utf-8
"""
CloudFlare API
@author: TongYifan, NewFuture
"""
from ._base import TYPE_JSON, BaseProvider, join_domain
class CloudflareProvider(BaseProvider):
endpoint = "https://api.cloudflare.com"
content_type = TYPE_JSON
def _validate(self):
if not self.token:
raise ValueErro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.