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 |
|---|---|---|---|---|---|---|---|---|---|
c9087297e3357b70a572239dd247a9ada07320e2e5fa465915974ef7acd72a1a | def test_parse_grid_data(simple_grid):
'Test parse_grid_data method in Grid class'
assert (simple_grid.num_points == 8)
assert (simple_grid.dr == (0.1 / 7))
grid_conf2 = {'r_min': 0, 'r_max': 0.1, 'dr': (0.1 / 7)}
grid2 = Grid(grid_conf2)
assert (grid2.dr == (0.1 / 7))
assert (grid2.num_poin... | Test parse_grid_data method in Grid class | tests/test_core.py | test_parse_grid_data | kpf59/turbopy | 0 | python | def test_parse_grid_data(simple_grid):
assert (simple_grid.num_points == 8)
assert (simple_grid.dr == (0.1 / 7))
grid_conf2 = {'r_min': 0, 'r_max': 0.1, 'dr': (0.1 / 7)}
grid2 = Grid(grid_conf2)
assert (grid2.dr == (0.1 / 7))
assert (grid2.num_points == 8) | def test_parse_grid_data(simple_grid):
assert (simple_grid.num_points == 8)
assert (simple_grid.dr == (0.1 / 7))
grid_conf2 = {'r_min': 0, 'r_max': 0.1, 'dr': (0.1 / 7)}
grid2 = Grid(grid_conf2)
assert (grid2.dr == (0.1 / 7))
assert (grid2.num_points == 8)<|docstring|>Test parse_grid_data m... |
de79c423f7b6c9f48cad955e659ea0ddc82eeb05c0406e9eb8a478804d6c7041 | def test_set_value_from_keys(simple_grid):
'Test set_value_from_keys method in Grid class'
assert (simple_grid.r_min == 0)
assert (simple_grid.r_max == 0.1)
grid_conf1 = {'N': 8, 'r_min': 0}
with pytest.raises(Exception):
assert Grid(grid_conf1) | Test set_value_from_keys method in Grid class | tests/test_core.py | test_set_value_from_keys | kpf59/turbopy | 0 | python | def test_set_value_from_keys(simple_grid):
assert (simple_grid.r_min == 0)
assert (simple_grid.r_max == 0.1)
grid_conf1 = {'N': 8, 'r_min': 0}
with pytest.raises(Exception):
assert Grid(grid_conf1) | def test_set_value_from_keys(simple_grid):
assert (simple_grid.r_min == 0)
assert (simple_grid.r_max == 0.1)
grid_conf1 = {'N': 8, 'r_min': 0}
with pytest.raises(Exception):
assert Grid(grid_conf1)<|docstring|>Test set_value_from_keys method in Grid class<|endoftext|> |
b51e129067b903480835845f42a841b0ce6ad6e3366e185f1b7cb0b09f56558f | def test_generate_field(simple_grid):
'Test generate_field method in Grid class'
assert np.allclose(simple_grid.generate_field(), np.zeros(8))
assert np.allclose(simple_grid.generate_field(3), np.zeros((8, 3))) | Test generate_field method in Grid class | tests/test_core.py | test_generate_field | kpf59/turbopy | 0 | python | def test_generate_field(simple_grid):
assert np.allclose(simple_grid.generate_field(), np.zeros(8))
assert np.allclose(simple_grid.generate_field(3), np.zeros((8, 3))) | def test_generate_field(simple_grid):
assert np.allclose(simple_grid.generate_field(), np.zeros(8))
assert np.allclose(simple_grid.generate_field(3), np.zeros((8, 3)))<|docstring|>Test generate_field method in Grid class<|endoftext|> |
a20d02395b3c046e95b31917d3348cf2394fe8ca5eda9e3aaca75988cab913bd | def test_generate_linear(simple_grid):
'Test generate_linear method in Grid class'
comp = []
for i in range(simple_grid.num_points):
comp.append((i / (simple_grid.num_points - 1)))
assert np.allclose(simple_grid.generate_linear(), np.array(comp)) | Test generate_linear method in Grid class | tests/test_core.py | test_generate_linear | kpf59/turbopy | 0 | python | def test_generate_linear(simple_grid):
comp = []
for i in range(simple_grid.num_points):
comp.append((i / (simple_grid.num_points - 1)))
assert np.allclose(simple_grid.generate_linear(), np.array(comp)) | def test_generate_linear(simple_grid):
comp = []
for i in range(simple_grid.num_points):
comp.append((i / (simple_grid.num_points - 1)))
assert np.allclose(simple_grid.generate_linear(), np.array(comp))<|docstring|>Test generate_linear method in Grid class<|endoftext|> |
9bcc2a1f510ad5a78bc4ad3807f8d57372be39819f0cacf4fffc5e5783a92280 | def test_create_interpolator(simple_grid):
'Test create_interpolator method in Grid class'
field = simple_grid.generate_linear()
r_val = 0.05
interp = simple_grid.create_interpolator(r_val)
linear_value = (r_val / (simple_grid.r_max - simple_grid.r_min))
assert np.allclose(interp(field), linear_... | Test create_interpolator method in Grid class | tests/test_core.py | test_create_interpolator | kpf59/turbopy | 0 | python | def test_create_interpolator(simple_grid):
field = simple_grid.generate_linear()
r_val = 0.05
interp = simple_grid.create_interpolator(r_val)
linear_value = (r_val / (simple_grid.r_max - simple_grid.r_min))
assert np.allclose(interp(field), linear_value) | def test_create_interpolator(simple_grid):
field = simple_grid.generate_linear()
r_val = 0.05
interp = simple_grid.create_interpolator(r_val)
linear_value = (r_val / (simple_grid.r_max - simple_grid.r_min))
assert np.allclose(interp(field), linear_value)<|docstring|>Test create_interpolator met... |
51782db44d3fdf8900651a33c5b85a61289656c0c2aebcf00ce5238a696a6717 | def test_set_cartesian_volumes():
'Test that cell volumes are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (edges[1:] - edges[0:(- 1)])
assert (grid2.cell_volumes.size == volumes.size... | Test that cell volumes are set properly. | tests/test_core.py | test_set_cartesian_volumes | kpf59/turbopy | 0 | python | def test_set_cartesian_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (edges[1:] - edges[0:(- 1)])
assert (grid2.cell_volumes.size == volumes.size)
assert np.allclose(grid2.cell_volume... | def test_set_cartesian_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (edges[1:] - edges[0:(- 1)])
assert (grid2.cell_volumes.size == volumes.size)
assert np.allclose(grid2.cell_volume... |
f22789de1ced477f1d3a40e363f8544b1a836bf86ed1762a8d9e9bfbeb108460 | def test_set_cylindrical_volumes():
'Test that cell volumes are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (np.pi * ((edges[1:] ** 2) - (edges[0:(- 1)] ** 2)))
assert (grid2.cell_... | Test that cell volumes are set properly. | tests/test_core.py | test_set_cylindrical_volumes | kpf59/turbopy | 0 | python | def test_set_cylindrical_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (np.pi * ((edges[1:] ** 2) - (edges[0:(- 1)] ** 2)))
assert (grid2.cell_volumes.size == volumes.size)
assert n... | def test_set_cylindrical_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (np.pi * ((edges[1:] ** 2) - (edges[0:(- 1)] ** 2)))
assert (grid2.cell_volumes.size == volumes.size)
assert n... |
e966a5806c38ab96ff738e483f3a3cbf9ea6e1b331d98bba852d951598e773c8 | def test_set_spherical_volumes():
'Test that cell volumes are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (((4 / 3) * np.pi) * ((edges[1:] ** 3) - (edges[0:(- 1)] ** 3)))
assert (gri... | Test that cell volumes are set properly. | tests/test_core.py | test_set_spherical_volumes | kpf59/turbopy | 0 | python | def test_set_spherical_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (((4 / 3) * np.pi) * ((edges[1:] ** 3) - (edges[0:(- 1)] ** 3)))
assert (grid2.cell_volumes.size == volumes.size)
... | def test_set_spherical_volumes():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
volumes = (((4 / 3) * np.pi) * ((edges[1:] ** 3) - (edges[0:(- 1)] ** 3)))
assert (grid2.cell_volumes.size == volumes.size)
... |
80ce226f885be6aa1c8ecd1b4b8f29088818f799a98dd12d1ec8240f155a5564 | def test_set_cartesian_areas():
'Test that cell areas are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
areas = np.ones_like(grid2.interface_areas)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(gr... | Test that cell areas are set properly. | tests/test_core.py | test_set_cartesian_areas | kpf59/turbopy | 0 | python | def test_set_cartesian_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
areas = np.ones_like(grid2.interface_areas)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface_areas, areas) | def test_set_cartesian_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cartesian'}
grid2 = Grid(grid_conf2)
areas = np.ones_like(grid2.interface_areas)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface_areas, areas)<|docstring|>... |
4895d02267635d333365bf4f209e8fe345eae632e9e24025032f04aeda909a46 | def test_set_cylindrical_areas():
'Test that cell areas are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = ((2.0 * np.pi) * edges)
assert (grid2.interface_areas.size == areas.size)
... | Test that cell areas are set properly. | tests/test_core.py | test_set_cylindrical_areas | kpf59/turbopy | 0 | python | def test_set_cylindrical_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = ((2.0 * np.pi) * edges)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface_areas... | def test_set_cylindrical_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'cylindrical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = ((2.0 * np.pi) * edges)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface_areas... |
51d400da37e975cdf138231826252dcdf94bd4cdd782e045ebf14f4208ec0372 | def test_set_spherical_areas():
'Test that cell areas are set properly.'
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = (((4.0 * np.pi) * edges) * edges)
assert (grid2.interface_areas.size == areas.size... | Test that cell areas are set properly. | tests/test_core.py | test_set_spherical_areas | kpf59/turbopy | 0 | python | def test_set_spherical_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = (((4.0 * np.pi) * edges) * edges)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface... | def test_set_spherical_areas():
grid_conf2 = {'r_min': 0, 'r_max': 1, 'dr': 0.1, 'coordinate_system': 'spherical'}
grid2 = Grid(grid_conf2)
edges = grid2.cell_edges
areas = (((4.0 * np.pi) * edges) * edges)
assert (grid2.interface_areas.size == areas.size)
assert np.allclose(grid2.interface... |
b68380e6f577aafc9f8cac898883749691d5a92296a60d80dd1f9284d0bef9b8 | def test_integer_num_steps():
'Tests for initialization of SimulationClock'
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 10.5), 'print_time': True}
with pytest.raises(RuntimeError):
SimulationClock(Simulation({}), clock_config) | Tests for initialization of SimulationClock | tests/test_core.py | test_integer_num_steps | kpf59/turbopy | 0 | python | def test_integer_num_steps():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 10.5), 'print_time': True}
with pytest.raises(RuntimeError):
SimulationClock(Simulation({}), clock_config) | def test_integer_num_steps():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 10.5), 'print_time': True}
with pytest.raises(RuntimeError):
SimulationClock(Simulation({}), clock_config)<|docstring|>Tests for initialization of SimulationClock<|endoftext|> |
69ae9dcbbe77ea76ad403e4e394998ce54367db26e7f21bba01295d964549eb2 | def test_advance():
'Tests `advance` method of the SimulationClock class'
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'num_steps': 20, 'print_time': True}
clock1 = SimulationClock(Simulation({}), clock_config)
assert (clock1.num_steps == ((clock1.end_time - clock1.start_time) / clock1.dt))
... | Tests `advance` method of the SimulationClock class | tests/test_core.py | test_advance | kpf59/turbopy | 0 | python | def test_advance():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'num_steps': 20, 'print_time': True}
clock1 = SimulationClock(Simulation({}), clock_config)
assert (clock1.num_steps == ((clock1.end_time - clock1.start_time) / clock1.dt))
clock1.advance()
assert (clock1.this_step == 1)
... | def test_advance():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'num_steps': 20, 'print_time': True}
clock1 = SimulationClock(Simulation({}), clock_config)
assert (clock1.num_steps == ((clock1.end_time - clock1.start_time) / clock1.dt))
clock1.advance()
assert (clock1.this_step == 1)
... |
49e63474dba98a5ba14a2db37cb5951501f8bf04ad272d0772c4e5017ba30d85 | def test_is_running():
'Tests `is_running` method of the SimulationClock class'
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 20), 'print_time': True}
clock2 = SimulationClock(Simulation({}), clock_config)
assert (clock2.num_steps == 20)
assert (clock2.is_running() and (clock2... | Tests `is_running` method of the SimulationClock class | tests/test_core.py | test_is_running | kpf59/turbopy | 0 | python | def test_is_running():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 20), 'print_time': True}
clock2 = SimulationClock(Simulation({}), clock_config)
assert (clock2.num_steps == 20)
assert (clock2.is_running() and (clock2.this_step < clock2.num_steps))
for i in range(clock... | def test_is_running():
clock_config = {'start_time': 0.0, 'end_time': 1e-08, 'dt': (1e-08 / 20), 'print_time': True}
clock2 = SimulationClock(Simulation({}), clock_config)
assert (clock2.num_steps == 20)
assert (clock2.is_running() and (clock2.this_step < clock2.num_steps))
for i in range(clock... |
0c42425c2d3a50d6f535773494c588ea825a700f9b49710d74689574e8baed4e | def urijoin(*args):
'Joins given arguments into a URI.\n :returns: a URI string\n '
return '/'.join(map((lambda x: str(x).strip('/')), args)) | Joins given arguments into a URI.
:returns: a URI string | groupsio_subscriptions.py | urijoin | LF-Engineering/perceval-scripts | 2 | python | def urijoin(*args):
'Joins given arguments into a URI.\n :returns: a URI string\n '
return '/'.join(map((lambda x: str(x).strip('/')), args)) | def urijoin(*args):
'Joins given arguments into a URI.\n :returns: a URI string\n '
return '/'.join(map((lambda x: str(x).strip('/')), args))<|docstring|>Joins given arguments into a URI.
:returns: a URI string<|endoftext|> |
7a64065814522b3e23e93a0894e7f742287d3e1e9fd7e979e23a2a0924dc60ee | def fetch(url, payload, auth):
'Fetch requests from groupsio API'
r = requests.get(url, params=payload, auth=auth)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e:
raise e
return r | Fetch requests from groupsio API | groupsio_subscriptions.py | fetch | LF-Engineering/perceval-scripts | 2 | python | def fetch(url, payload, auth):
r = requests.get(url, params=payload, auth=auth)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e:
raise e
return r | def fetch(url, payload, auth):
r = requests.get(url, params=payload, auth=auth)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e:
raise e
return r<|docstring|>Fetch requests from groupsio API<|endoftext|> |
c22870875f213519b8624b419d7a361fda1ed2eae5b01cd3f4beef4e1f45d8f3 | @staticmethod
def parse_image(im, model):
'Parses graph image downloaded from innerfidelity.com'
box = (69, 31, 550, 290)
im = im.crop(box)
px_a_max = 0
px_a_min = im.size[1]
f_min = 20
f_max = 20000
f_step = ((f_max / f_min) ** (1 / im.size[0]))
f = [f_min]
for _ in range(1, im.... | Parses graph image downloaded from innerfidelity.com | measurements/referenceaudioanalyzer/reference_audio_analyzer_crawler.py | parse_image | eliMakeouthill/AutoEq | 3 | python | @staticmethod
def parse_image(im, model):
box = (69, 31, 550, 290)
im = im.crop(box)
px_a_max = 0
px_a_min = im.size[1]
f_min = 20
f_max = 20000
f_step = ((f_max / f_min) ** (1 / im.size[0]))
f = [f_min]
for _ in range(1, im.size[0]):
f.append((f[(- 1)] * f_step))
a_... | @staticmethod
def parse_image(im, model):
box = (69, 31, 550, 290)
im = im.crop(box)
px_a_max = 0
px_a_min = im.size[1]
f_min = 20
f_max = 20000
f_step = ((f_max / f_min) ** (1 / im.size[0]))
f = [f_min]
for _ in range(1, im.size[0]):
f.append((f[(- 1)] * f_step))
a_... |
b199ab05019be6f91799ef71ed9eaa91b307dbd0854d8e15449c2707615bb35b | @app.cli.command()
def test():
'Run the unit tests.'
import unittest
tests = unittest.TestLoader().discover('tests')
testresult = unittest.TextTestRunner(verbosity=2).run(tests)
if testresult.wasSuccessful():
exit(0)
else:
exit(1) | Run the unit tests. | app.py | test | UST-QuAntiL/Quokka | 0 | python | @app.cli.command()
def test():
import unittest
tests = unittest.TestLoader().discover('tests')
testresult = unittest.TextTestRunner(verbosity=2).run(tests)
if testresult.wasSuccessful():
exit(0)
else:
exit(1) | @app.cli.command()
def test():
import unittest
tests = unittest.TestLoader().discover('tests')
testresult = unittest.TextTestRunner(verbosity=2).run(tests)
if testresult.wasSuccessful():
exit(0)
else:
exit(1)<|docstring|>Run the unit tests.<|endoftext|> |
e9a2558c9dfd6932fb851464016c857d9b6ac4bc0f3cc03e9df3e151c53dc253 | def remove_refct_calls(func):
'\n Remove redundant incref/decref within on a per block basis\n '
for bb in func.basic_blocks:
remove_null_refct_call(bb)
remove_refct_pairs(bb) | Remove redundant incref/decref within on a per block basis | numba/targets/cpu.py | remove_refct_calls | SPIRV/NUMBA | 4 | python | def remove_refct_calls(func):
'\n \n '
for bb in func.basic_blocks:
remove_null_refct_call(bb)
remove_refct_pairs(bb) | def remove_refct_calls(func):
'\n \n '
for bb in func.basic_blocks:
remove_null_refct_call(bb)
remove_refct_pairs(bb)<|docstring|>Remove redundant incref/decref within on a per block basis<|endoftext|> |
5ba2051cce6f30ebd6380883a6b84c1654f15178e9a3a02413a5cf861d325768 | def remove_null_refct_call(bb):
'\n Remove refct api calls to NULL pointer\n '
pass | Remove refct api calls to NULL pointer | numba/targets/cpu.py | remove_null_refct_call | SPIRV/NUMBA | 4 | python | def remove_null_refct_call(bb):
'\n \n '
pass | def remove_null_refct_call(bb):
'\n \n '
pass<|docstring|>Remove refct api calls to NULL pointer<|endoftext|> |
9be760e972dd88926d29282337e2fa577673817a86a56562858308f9e14b1b41 | def remove_refct_pairs(bb):
'\n Remove incref decref pairs on the same variable\n '
didsomething = True
while didsomething:
didsomething = False
increfs = {}
decrefs = {}
for inst in bb.instructions:
if isinstance(inst, lc.CallOrInvokeInstruction):
... | Remove incref decref pairs on the same variable | numba/targets/cpu.py | remove_refct_pairs | SPIRV/NUMBA | 4 | python | def remove_refct_pairs(bb):
'\n \n '
didsomething = True
while didsomething:
didsomething = False
increfs = {}
decrefs = {}
for inst in bb.instructions:
if isinstance(inst, lc.CallOrInvokeInstruction):
fname = inst.called_function.name
... | def remove_refct_pairs(bb):
'\n \n '
didsomething = True
while didsomething:
didsomething = False
increfs = {}
decrefs = {}
for inst in bb.instructions:
if isinstance(inst, lc.CallOrInvokeInstruction):
fname = inst.called_function.name
... |
57b5cc44beb79a17cb96c4fae49d3e06e8b1fc96dd809b28aecd9a9f7aa6fc70 | def get_env_from_closure(self, builder, clo):
'\n From the pointer *clo* to a _dynfunc.Closure, get a pointer\n to the enclosed _dynfunc.Environment.\n '
with cgutils.if_unlikely(builder, cgutils.is_null(builder, clo)):
self.debug_print(builder, 'Fatal error: missing _dynfunc.Closur... | From the pointer *clo* to a _dynfunc.Closure, get a pointer
to the enclosed _dynfunc.Environment. | numba/targets/cpu.py | get_env_from_closure | SPIRV/NUMBA | 4 | python | def get_env_from_closure(self, builder, clo):
'\n From the pointer *clo* to a _dynfunc.Closure, get a pointer\n to the enclosed _dynfunc.Environment.\n '
with cgutils.if_unlikely(builder, cgutils.is_null(builder, clo)):
self.debug_print(builder, 'Fatal error: missing _dynfunc.Closur... | def get_env_from_closure(self, builder, clo):
'\n From the pointer *clo* to a _dynfunc.Closure, get a pointer\n to the enclosed _dynfunc.Environment.\n '
with cgutils.if_unlikely(builder, cgutils.is_null(builder, clo)):
self.debug_print(builder, 'Fatal error: missing _dynfunc.Closur... |
084d7d1439935894733a6829bf541e1128ac98df79ea8126a40419d534ea7606 | def get_env_body(self, builder, envptr):
'\n From the given *envptr* (a pointer to a _dynfunc.Environment object),\n get a EnvBody allowing structured access to environment fields.\n '
body_ptr = cgutils.pointer_add(builder, envptr, _dynfunc._impl_info['offsetof_env_body'])
return EnvBo... | From the given *envptr* (a pointer to a _dynfunc.Environment object),
get a EnvBody allowing structured access to environment fields. | numba/targets/cpu.py | get_env_body | SPIRV/NUMBA | 4 | python | def get_env_body(self, builder, envptr):
'\n From the given *envptr* (a pointer to a _dynfunc.Environment object),\n get a EnvBody allowing structured access to environment fields.\n '
body_ptr = cgutils.pointer_add(builder, envptr, _dynfunc._impl_info['offsetof_env_body'])
return EnvBo... | def get_env_body(self, builder, envptr):
'\n From the given *envptr* (a pointer to a _dynfunc.Environment object),\n get a EnvBody allowing structured access to environment fields.\n '
body_ptr = cgutils.pointer_add(builder, envptr, _dynfunc._impl_info['offsetof_env_body'])
return EnvBo... |
ffdb813a2cbe0072ee021bf825ea3bdf5393851761bb48241a202165f429f5fc | def get_generator_state(self, builder, genptr, return_type):
'\n From the given *genptr* (a pointer to a _dynfunc.Generator object),\n get a pointer to its state area.\n '
return cgutils.pointer_add(builder, genptr, _dynfunc._impl_info['offsetof_generator_state'], return_type=return_type) | From the given *genptr* (a pointer to a _dynfunc.Generator object),
get a pointer to its state area. | numba/targets/cpu.py | get_generator_state | SPIRV/NUMBA | 4 | python | def get_generator_state(self, builder, genptr, return_type):
'\n From the given *genptr* (a pointer to a _dynfunc.Generator object),\n get a pointer to its state area.\n '
return cgutils.pointer_add(builder, genptr, _dynfunc._impl_info['offsetof_generator_state'], return_type=return_type) | def get_generator_state(self, builder, genptr, return_type):
'\n From the given *genptr* (a pointer to a _dynfunc.Generator object),\n get a pointer to its state area.\n '
return cgutils.pointer_add(builder, genptr, _dynfunc._impl_info['offsetof_generator_state'], return_type=return_type)<|... |
48b9a8ce74ca4d057b48f8560ff1f131d27dca6c5ad07f7eadd843ba50fa19a9 | def build_list(self, builder, list_type, items):
'\n Build a list from the Numba *list_type* and its initial *items*.\n '
return listobj.build_list(self, builder, list_type, items) | Build a list from the Numba *list_type* and its initial *items*. | numba/targets/cpu.py | build_list | SPIRV/NUMBA | 4 | python | def build_list(self, builder, list_type, items):
'\n \n '
return listobj.build_list(self, builder, list_type, items) | def build_list(self, builder, list_type, items):
'\n \n '
return listobj.build_list(self, builder, list_type, items)<|docstring|>Build a list from the Numba *list_type* and its initial *items*.<|endoftext|> |
554585819c0a72829df163680e55ccaaf22aff2e5d85a7672c7beca65d90c236 | def build_set(self, builder, set_type, items):
'\n Build a set from the Numba *set_type* and its initial *items*.\n '
return setobj.build_set(self, builder, set_type, items) | Build a set from the Numba *set_type* and its initial *items*. | numba/targets/cpu.py | build_set | SPIRV/NUMBA | 4 | python | def build_set(self, builder, set_type, items):
'\n \n '
return setobj.build_set(self, builder, set_type, items) | def build_set(self, builder, set_type, items):
'\n \n '
return setobj.build_set(self, builder, set_type, items)<|docstring|>Build a set from the Numba *set_type* and its initial *items*.<|endoftext|> |
8b714fdeed37f89b59c9d579e82db9606141ede9e178bd793b50a1304e08e747 | def get_executable(self, library, fndesc, env):
'\n Returns\n -------\n (cfunc, fnptr)\n\n - cfunc\n callable function (Can be None)\n - fnptr\n callable function address\n - env\n an execution environment (from _dynfunc)\n '
base... | Returns
-------
(cfunc, fnptr)
- cfunc
callable function (Can be None)
- fnptr
callable function address
- env
an execution environment (from _dynfunc) | numba/targets/cpu.py | get_executable | SPIRV/NUMBA | 4 | python | def get_executable(self, library, fndesc, env):
'\n Returns\n -------\n (cfunc, fnptr)\n\n - cfunc\n callable function (Can be None)\n - fnptr\n callable function address\n - env\n an execution environment (from _dynfunc)\n '
base... | def get_executable(self, library, fndesc, env):
'\n Returns\n -------\n (cfunc, fnptr)\n\n - cfunc\n callable function (Can be None)\n - fnptr\n callable function address\n - env\n an execution environment (from _dynfunc)\n '
base... |
159ecc1aab61627f2780b9482ae046af844399ab8c8b9259384064f38b853a2f | def calc_array_sizeof(self, ndim):
'\n Calculate the size of an array struct on the CPU target\n '
aryty = types.Array(types.int32, ndim, 'A')
return self.get_abi_sizeof(self.get_value_type(aryty)) | Calculate the size of an array struct on the CPU target | numba/targets/cpu.py | calc_array_sizeof | SPIRV/NUMBA | 4 | python | def calc_array_sizeof(self, ndim):
'\n \n '
aryty = types.Array(types.int32, ndim, 'A')
return self.get_abi_sizeof(self.get_value_type(aryty)) | def calc_array_sizeof(self, ndim):
'\n \n '
aryty = types.Array(types.int32, ndim, 'A')
return self.get_abi_sizeof(self.get_value_type(aryty))<|docstring|>Calculate the size of an array struct on the CPU target<|endoftext|> |
b75317cd2cae015ed3565aa6132c25d2dc1f6fde96eafaf182330840b6cf13c9 | def get_validate_image(request_session):
'\n Get validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captcha in base64 format, ret... | Get validate image
:param request_session: Requests session
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
image_str: str, Raw byte of Captcha in base64 format, return "" if fail | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_validate_image | Svolcano/python_exercise | 6 | python | def get_validate_image(request_session):
'\n Get validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captcha in base64 format, ret... | def get_validate_image(request_session):
'\n Get validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captcha in base64 format, ret... |
9316c52fe0dec8df04de302d082a641fea43f0e512678ad9066a2e087a7c5b51 | def refresh_validate_image(request_session):
'\n 该函数已废弃\n Get another validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captc... | 该函数已废弃
Get another validate image
:param request_session: Requests session
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
image_str: str, Raw byte of Captcha in base64 format, return "" if fail | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | refresh_validate_image | Svolcano/python_exercise | 6 | python | def refresh_validate_image(request_session):
'\n 该函数已废弃\n Get another validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captc... | def refresh_validate_image(request_session):
'\n 该函数已废弃\n Get another validate image\n :param request_session: Requests session\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n image_str: str, Raw byte of Captc... |
6405a30460740bf7a5f675c58c1097c25e5d15abcd1539becafc590d34868b43 | def is_cq_local_number(tel, requests):
'\n Verify if the target tel number is a cq local number\n :param tel: Tel number\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n '
headers = {'X-Requested-With': 'XMLHttpRe... | Verify if the target tel number is a cq local number
:param tel: Tel number
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | is_cq_local_number | Svolcano/python_exercise | 6 | python | def is_cq_local_number(tel, requests):
'\n Verify if the target tel number is a cq local number\n :param tel: Tel number\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n '
headers = {'X-Requested-With': 'XMLHttpRe... | def is_cq_local_number(tel, requests):
'\n Verify if the target tel number is a cq local number\n :param tel: Tel number\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n '
headers = {'X-Requested-With': 'XMLHttpRe... |
0f09f57e26ade20dd34ee96dd17f37242f1718c2f48296c195af2acbdc17796f | def is_validate(user_id, user_password, picture_validate_code, requests):
'\n Check if the target tel, password, code are valid\n :param user_id: Tel number\n :param user_password: Password\n :param picture_validate_code: code in Capcha image\n :return:\n status_key: str, The key of status cod... | Check if the target tel, password, code are valid
:param user_id: Tel number
:param user_password: Password
:param picture_validate_code: code in Capcha image
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | is_validate | Svolcano/python_exercise | 6 | python | def is_validate(user_id, user_password, picture_validate_code, requests):
'\n Check if the target tel, password, code are valid\n :param user_id: Tel number\n :param user_password: Password\n :param picture_validate_code: code in Capcha image\n :return:\n status_key: str, The key of status cod... | def is_validate(user_id, user_password, picture_validate_code, requests):
'\n Check if the target tel, password, code are valid\n :param user_id: Tel number\n :param user_password: Password\n :param picture_validate_code: code in Capcha image\n :return:\n status_key: str, The key of status cod... |
4c4d8f341123c07b7a349a8dec67b836fc7f6901afea2e1c29fec587fd00cecd | def get_redirect_url_from_text(response_text):
'\n Get redirect url from target response text\n :param response_text: Response text returned from Request Login\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n url:... | Get redirect url from target response text
:param response_text: Response text returned from Request Login
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
url: str, The redirect url | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_redirect_url_from_text | Svolcano/python_exercise | 6 | python | def get_redirect_url_from_text(response_text):
'\n Get redirect url from target response text\n :param response_text: Response text returned from Request Login\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n url:... | def get_redirect_url_from_text(response_text):
'\n Get redirect url from target response text\n :param response_text: Response text returned from Request Login\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n url:... |
5511bc3fe6d8963230b2f222e6ab09b49dacac88aafd2ef57ae0b5b6da858a3d | def get_sam_lart_from_xhtml(xhtml_string):
'\n Get SAMLart from target xhtml string\n :param xhtml_string: Response returned from Request Login Box\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n samlart: str, Th... | Get SAMLart from target xhtml string
:param xhtml_string: Response returned from Request Login Box
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
samlart: str, The SAMLart id | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_sam_lart_from_xhtml | Svolcano/python_exercise | 6 | python | def get_sam_lart_from_xhtml(xhtml_string):
'\n Get SAMLart from target xhtml string\n :param xhtml_string: Response returned from Request Login Box\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n samlart: str, Th... | def get_sam_lart_from_xhtml(xhtml_string):
'\n Get SAMLart from target xhtml string\n :param xhtml_string: Response returned from Request Login Box\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n samlart: str, Th... |
3da6744556f45bc960db6bf0d791086cd3fa6b435dd6513f1cabb0e086738a23 | def get_good_id_from_xml(xml_string):
'\n Get good id from target xml string\n :param xml_string: Response returned from Get Good IDs\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n good_id: str, The good id\n ... | Get good id from target xml string
:param xml_string: Response returned from Get Good IDs
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
good_id: str, The good id | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_good_id_from_xml | Svolcano/python_exercise | 6 | python | def get_good_id_from_xml(xml_string):
'\n Get good id from target xml string\n :param xml_string: Response returned from Get Good IDs\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n good_id: str, The good id\n ... | def get_good_id_from_xml(xml_string):
'\n Get good id from target xml string\n :param xml_string: Response returned from Get Good IDs\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n good_id: str, The good id\n ... |
496f655f0105e7d2946a2b50268c7a29d539ef19e6dbd43b3b66190271121b98 | def get_personal_info_from_xml(xml_string):
"\n Get personal info from target xml string\n :param xml_string: Response returned from Get Personal Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n personal_info... | Get personal info from target xml string
:param xml_string: Response returned from Get Personal Info
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
personal_info_value: dict, The person's info | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_personal_info_from_xml | Svolcano/python_exercise | 6 | python | def get_personal_info_from_xml(xml_string):
"\n Get personal info from target xml string\n :param xml_string: Response returned from Get Personal Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n personal_info... | def get_personal_info_from_xml(xml_string):
"\n Get personal info from target xml string\n :param xml_string: Response returned from Get Personal Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n personal_info... |
ea716aeb04d4fb9f4844f059977054fcaf28294ba6c52a9f2c4c4f5b02cb822e | def get_second_validate_result_from_xml(xml_string):
'\n Get second validate result from xml string\n :param xml_string: Response returned from Check SMS Validate Code\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n ... | Get second validate result from xml string
:param xml_string: Response returned from Check SMS Validate Code
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_second_validate_result_from_xml | Svolcano/python_exercise | 6 | python | def get_second_validate_result_from_xml(xml_string):
'\n Get second validate result from xml string\n :param xml_string: Response returned from Check SMS Validate Code\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n ... | def get_second_validate_result_from_xml(xml_string):
'\n Get second validate result from xml string\n :param xml_string: Response returned from Check SMS Validate Code\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n ... |
eda4c74b3d766c5e01b08b126a818251797f46e6e765d9d3eb5433fda1dcd685 | def get_detail_bill_from_xml(xml_string):
'\n Get detail bill from target xml string\n :param xml_string: Response returned from Get Detail Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n detail_bill_value: ... | Get detail bill from target xml string
:param xml_string: Response returned from Get Detail Info
:return:
status_key: str, The key of status code
level: int, Error level
message: unicode, Error Message
detail_bill_value: list, The list of detail bill info | dianhua/worker/crawler/china_mobile/chongqing/base_info_crawler.py | get_detail_bill_from_xml | Svolcano/python_exercise | 6 | python | def get_detail_bill_from_xml(xml_string):
'\n Get detail bill from target xml string\n :param xml_string: Response returned from Get Detail Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n detail_bill_value: ... | def get_detail_bill_from_xml(xml_string):
'\n Get detail bill from target xml string\n :param xml_string: Response returned from Get Detail Info\n :return:\n status_key: str, The key of status code\n level: int, Error level\n message: unicode, Error Message\n detail_bill_value: ... |
3d863c1b2bdf30d2041b6d4eaa4c54a693926c744dffe72d2cef0e51b2fbad30 | def __init__(self, x, y, radius, sx, sy, color=Color.RED):
'初始化方法'
self.x = x
self.y = y
self.radius = radius
self.sx = sx
self.sy = sy
self.color = color
self.alive = True | 初始化方法 | com/xy/ztang/gui/ball.py | __init__ | zhangptang/python_learning | 0 | python | def __init__(self, x, y, radius, sx, sy, color=Color.RED):
self.x = x
self.y = y
self.radius = radius
self.sx = sx
self.sy = sy
self.color = color
self.alive = True | def __init__(self, x, y, radius, sx, sy, color=Color.RED):
self.x = x
self.y = y
self.radius = radius
self.sx = sx
self.sy = sy
self.color = color
self.alive = True<|docstring|>初始化方法<|endoftext|> |
75ce63e36c016a4aed36edd7463d237130060b323d36af76e98922ae7fa72743 | def _to_m8(key):
'\n Timedelta-like => dt64\n '
if (not isinstance(key, Timedelta)):
key = Timedelta(key)
return np.int64(key.value).view(_TD_DTYPE) | Timedelta-like => dt64 | pandas/core/arrays/timedeltas.py | _to_m8 | fleimgruber/pandas | 1 | python | def _to_m8(key):
'\n \n '
if (not isinstance(key, Timedelta)):
key = Timedelta(key)
return np.int64(key.value).view(_TD_DTYPE) | def _to_m8(key):
'\n \n '
if (not isinstance(key, Timedelta)):
key = Timedelta(key)
return np.int64(key.value).view(_TD_DTYPE)<|docstring|>Timedelta-like => dt64<|endoftext|> |
002d535d84eef6f4fc1df45330971c434dd3f7e404db4631753f67ebcb202848 | def _td_array_cmp(cls, op):
'\n Wrap comparison operations to convert timedelta-like to timedelta64\n '
opname = '__{name}__'.format(name=op.__name__)
nat_result = (True if (opname == '__ne__') else False)
meth = getattr(dtl.DatetimeLikeArrayMixin, opname)
def wrapper(self, other):
if... | Wrap comparison operations to convert timedelta-like to timedelta64 | pandas/core/arrays/timedeltas.py | _td_array_cmp | fleimgruber/pandas | 1 | python | def _td_array_cmp(cls, op):
'\n \n '
opname = '__{name}__'.format(name=op.__name__)
nat_result = (True if (opname == '__ne__') else False)
meth = getattr(dtl.DatetimeLikeArrayMixin, opname)
def wrapper(self, other):
if (_is_convertible_to_td(other) or (other is NaT)):
try:... | def _td_array_cmp(cls, op):
'\n \n '
opname = '__{name}__'.format(name=op.__name__)
nat_result = (True if (opname == '__ne__') else False)
meth = getattr(dtl.DatetimeLikeArrayMixin, opname)
def wrapper(self, other):
if (_is_convertible_to_td(other) or (other is NaT)):
try:... |
786cc5d5cc2fd71d8cfd810d66479df8954f80e5abc82ed71f410ccb58add17d | def sequence_to_td64ns(data, copy=False, unit='ns', errors='raise'):
'\n Parameters\n ----------\n array : list-like\n copy : bool, default False\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n errors : {"raise", "coerce", "ignore"}, default "raise"\n ... | Parameters
----------
array : list-like
copy : bool, default False
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
errors : {"raise", "coerce", "ignore"}, default "raise"
How to handle elements that cannot be converted to timedelta64[ns].
See ``pandas.to_timedelta`` for detail... | pandas/core/arrays/timedeltas.py | sequence_to_td64ns | fleimgruber/pandas | 1 | python | def sequence_to_td64ns(data, copy=False, unit='ns', errors='raise'):
'\n Parameters\n ----------\n array : list-like\n copy : bool, default False\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n errors : {"raise", "coerce", "ignore"}, default "raise"\n ... | def sequence_to_td64ns(data, copy=False, unit='ns', errors='raise'):
'\n Parameters\n ----------\n array : list-like\n copy : bool, default False\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n errors : {"raise", "coerce", "ignore"}, default "raise"\n ... |
349b60eb2c0f6ab5fe53a8fb7b73fa0d100c7e2a29b1ce616d176c7fc790cc73 | def ints_to_td64ns(data, unit='ns'):
'\n Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating\n the integers as multiples of the given timedelta unit.\n\n Parameters\n ----------\n data : numpy.ndarray with integer-dtype\n unit : str, default "ns"\n The timedelta unit to... | Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit.
Parameters
----------
data : numpy.ndarray with integer-dtype
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
Returns
-------
numpy.ndarray : timedelta64[n... | pandas/core/arrays/timedeltas.py | ints_to_td64ns | fleimgruber/pandas | 1 | python | def ints_to_td64ns(data, unit='ns'):
'\n Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating\n the integers as multiples of the given timedelta unit.\n\n Parameters\n ----------\n data : numpy.ndarray with integer-dtype\n unit : str, default "ns"\n The timedelta unit to... | def ints_to_td64ns(data, unit='ns'):
'\n Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating\n the integers as multiples of the given timedelta unit.\n\n Parameters\n ----------\n data : numpy.ndarray with integer-dtype\n unit : str, default "ns"\n The timedelta unit to... |
2e23fc7fc25bb935f91e74d1e93d8f483c51a9e1474afd1053d8c0b8abd4423c | def objects_to_td64ns(data, unit='ns', errors='raise'):
'\n Convert a object-dtyped or string-dtyped array into an\n timedelta64[ns]-dtyped array.\n\n Parameters\n ----------\n data : ndarray or Index\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n er... | Convert a object-dtyped or string-dtyped array into an
timedelta64[ns]-dtyped array.
Parameters
----------
data : ndarray or Index
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
errors : {"raise", "coerce", "ignore"}, default "raise"
How to handle elements that cannot be convert... | pandas/core/arrays/timedeltas.py | objects_to_td64ns | fleimgruber/pandas | 1 | python | def objects_to_td64ns(data, unit='ns', errors='raise'):
'\n Convert a object-dtyped or string-dtyped array into an\n timedelta64[ns]-dtyped array.\n\n Parameters\n ----------\n data : ndarray or Index\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n er... | def objects_to_td64ns(data, unit='ns', errors='raise'):
'\n Convert a object-dtyped or string-dtyped array into an\n timedelta64[ns]-dtyped array.\n\n Parameters\n ----------\n data : ndarray or Index\n unit : str, default "ns"\n The timedelta unit to treat integers as multiples of.\n er... |
0054f2dbc4e91494b8570e7dc3693fb1012920c0abe03cb0054002524be43012 | def _add_delta(self, delta):
'\n Add a timedelta-like, Tick, or TimedeltaIndex-like object\n to self, yielding a new TimedeltaArray.\n\n Parameters\n ----------\n other : {timedelta, np.timedelta64, Tick,\n TimedeltaIndex, ndarray[timedelta64]}\n\n Returns\n... | Add a timedelta-like, Tick, or TimedeltaIndex-like object
to self, yielding a new TimedeltaArray.
Parameters
----------
other : {timedelta, np.timedelta64, Tick,
TimedeltaIndex, ndarray[timedelta64]}
Returns
-------
result : TimedeltaArray | pandas/core/arrays/timedeltas.py | _add_delta | fleimgruber/pandas | 1 | python | def _add_delta(self, delta):
'\n Add a timedelta-like, Tick, or TimedeltaIndex-like object\n to self, yielding a new TimedeltaArray.\n\n Parameters\n ----------\n other : {timedelta, np.timedelta64, Tick,\n TimedeltaIndex, ndarray[timedelta64]}\n\n Returns\n... | def _add_delta(self, delta):
'\n Add a timedelta-like, Tick, or TimedeltaIndex-like object\n to self, yielding a new TimedeltaArray.\n\n Parameters\n ----------\n other : {timedelta, np.timedelta64, Tick,\n TimedeltaIndex, ndarray[timedelta64]}\n\n Returns\n... |
0748861753f47783d0ca1364d52efc5a4e96e6d60418b8f2a0b10e153acd2aa4 | def _add_datetime_arraylike(self, other):
'\n Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray.\n '
if isinstance(other, np.ndarray):
from pandas.core.arrays import DatetimeArrayMixin
other = DatetimeArrayMixin(other)
return (other + self) | Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray. | pandas/core/arrays/timedeltas.py | _add_datetime_arraylike | fleimgruber/pandas | 1 | python | def _add_datetime_arraylike(self, other):
'\n \n '
if isinstance(other, np.ndarray):
from pandas.core.arrays import DatetimeArrayMixin
other = DatetimeArrayMixin(other)
return (other + self) | def _add_datetime_arraylike(self, other):
'\n \n '
if isinstance(other, np.ndarray):
from pandas.core.arrays import DatetimeArrayMixin
other = DatetimeArrayMixin(other)
return (other + self)<|docstring|>Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray.<|endoftex... |
651b960b511617333a20174341a831886c4bf89e7f7ae277ecd21deb88f47952 | def total_seconds(self):
"\n Return total duration of each element expressed in seconds.\n\n This method is available directly on TimedeltaArray, TimedeltaIndex\n and on Series containing timedelta values under the ``.dt`` namespace.\n\n Returns\n -------\n seconds : [ndarr... | Return total duration of each element expressed in seconds.
This method is available directly on TimedeltaArray, TimedeltaIndex
and on Series containing timedelta values under the ``.dt`` namespace.
Returns
-------
seconds : [ndarray, Float64Index, Series]
When the calling object is a TimedeltaArray, the return t... | pandas/core/arrays/timedeltas.py | total_seconds | fleimgruber/pandas | 1 | python | def total_seconds(self):
"\n Return total duration of each element expressed in seconds.\n\n This method is available directly on TimedeltaArray, TimedeltaIndex\n and on Series containing timedelta values under the ``.dt`` namespace.\n\n Returns\n -------\n seconds : [ndarr... | def total_seconds(self):
"\n Return total duration of each element expressed in seconds.\n\n This method is available directly on TimedeltaArray, TimedeltaIndex\n and on Series containing timedelta values under the ``.dt`` namespace.\n\n Returns\n -------\n seconds : [ndarr... |
e746795bb18896d307664969e7ea373fb1d03f476568a7101840bba69a918ddd | def to_pytimedelta(self):
'\n Return Timedelta Array/Index as object ndarray of datetime.timedelta\n objects.\n\n Returns\n -------\n datetimes : ndarray\n '
return tslibs.ints_to_pytimedelta(self.asi8) | Return Timedelta Array/Index as object ndarray of datetime.timedelta
objects.
Returns
-------
datetimes : ndarray | pandas/core/arrays/timedeltas.py | to_pytimedelta | fleimgruber/pandas | 1 | python | def to_pytimedelta(self):
'\n Return Timedelta Array/Index as object ndarray of datetime.timedelta\n objects.\n\n Returns\n -------\n datetimes : ndarray\n '
return tslibs.ints_to_pytimedelta(self.asi8) | def to_pytimedelta(self):
'\n Return Timedelta Array/Index as object ndarray of datetime.timedelta\n objects.\n\n Returns\n -------\n datetimes : ndarray\n '
return tslibs.ints_to_pytimedelta(self.asi8)<|docstring|>Return Timedelta Array/Index as object ndarray of datet... |
56d909bc85ff47fc9b7f5f848e30da60e265515313cde164034a65a366faafb2 | @property
def components(self):
'\n Return a dataframe of the components (days, hours, minutes,\n seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.\n\n Returns\n -------\n a DataFrame\n '
from pandas import DataFrame
columns = ['days', 'hours', 'm... | Return a dataframe of the components (days, hours, minutes,
seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.
Returns
-------
a DataFrame | pandas/core/arrays/timedeltas.py | components | fleimgruber/pandas | 1 | python | @property
def components(self):
'\n Return a dataframe of the components (days, hours, minutes,\n seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.\n\n Returns\n -------\n a DataFrame\n '
from pandas import DataFrame
columns = ['days', 'hours', 'm... | @property
def components(self):
'\n Return a dataframe of the components (days, hours, minutes,\n seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.\n\n Returns\n -------\n a DataFrame\n '
from pandas import DataFrame
columns = ['days', 'hours', 'm... |
f003947e2f003bbb8625eec02a89731d26d0f5d7722cd01ae3b89cbd5916145b | @typing.overload
def __init__(self: TelegramClient, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop):
"Start TelegramClient with customized api.\n\n Read more at [opentele GitHub](https://github.com/thedemons/opentele#authorization)\n \n ### Argumen... | Start TelegramClient with customized api.
Read more at [opentele GitHub](https://github.com/thedemons/opentele#authorization)
### Arguments:
session (`str` | `Session`):
The file name of the `session file` to be used, if a string is\
given (it may be a full path), or the `Session` instance to be u... | src/tl/telethon.py | __init__ | annihilatorrrr/opentele | 30 | python | @typing.overload
def __init__(self: TelegramClient, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop):
"Start TelegramClient with customized api.\n\n Read more at [opentele GitHub](https://github.com/thedemons/opentele#authorization)\n \n ### Argumen... | @typing.overload
def __init__(self: TelegramClient, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop):
"Start TelegramClient with customized api.\n\n Read more at [opentele GitHub](https://github.com/thedemons/opentele#authorization)\n \n ### Argumen... |
39e37c180ce97f2a2934fa04d9cb0a4b6c6678031ee33c17ba073f36a3c16727 | @typing.overload
def __init__(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=None, api_id: int=0, api_hash: str=None, *, connection: typing.Type[Connection]=ConnectionTcpFull, use_ipv6: bool=False, proxy: Union[(tuple, dict)]=None, local_addr: Union[(str, tuple)]=None, timeout: int=10, ... | !skip
This is the abstract base class for the client. It defines some
basic stuff like connecting, switching data center, etc, and
leaves the `__call__` unimplemented.
### Arguments:
session (`str` | `Session`, default=`None`):
The file name of the `session file` to be used, if a string is\
given (... | src/tl/telethon.py | __init__ | annihilatorrrr/opentele | 30 | python | @typing.overload
def __init__(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=None, api_id: int=0, api_hash: str=None, *, connection: typing.Type[Connection]=ConnectionTcpFull, use_ipv6: bool=False, proxy: Union[(tuple, dict)]=None, local_addr: Union[(str, tuple)]=None, timeout: int=10, ... | @typing.overload
def __init__(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=None, api_id: int=0, api_hash: str=None, *, connection: typing.Type[Connection]=ConnectionTcpFull, use_ipv6: bool=False, proxy: Union[(tuple, dict)]=None, local_addr: Union[(str, tuple)]=None, timeout: int=10, ... |
bb18e685c21590d954903b62d70ec66501ff520b8fee78f0f9a006f7ea51f820 | async def GetSessions(self) -> Optional[types.account.Authorizations]:
'\n Get all logged-in sessions.\n\n ### Returns:\n - Return an instance of `Authorizations` on success\n '
return (await self(functions.account.GetAuthorizationsRequest())) | Get all logged-in sessions.
### Returns:
- Return an instance of `Authorizations` on success | src/tl/telethon.py | GetSessions | annihilatorrrr/opentele | 30 | python | async def GetSessions(self) -> Optional[types.account.Authorizations]:
'\n Get all logged-in sessions.\n\n ### Returns:\n - Return an instance of `Authorizations` on success\n '
return (await self(functions.account.GetAuthorizationsRequest())) | async def GetSessions(self) -> Optional[types.account.Authorizations]:
'\n Get all logged-in sessions.\n\n ### Returns:\n - Return an instance of `Authorizations` on success\n '
return (await self(functions.account.GetAuthorizationsRequest()))<|docstring|>Get all logged-in sessio... |
a163a33e8019591038e3d99416f65f3207f90313a1998df9b05cfd4a5899aa37 | async def GetCurrentSession(self) -> Optional[types.Authorization]:
'\n Get current logged-in session.\n\n ### Returns:\n Return `telethon.types.Authorization` on success.\n Return `None` on failure.\n '
results = (await self.GetSessions())
return (next((auth for a... | Get current logged-in session.
### Returns:
Return `telethon.types.Authorization` on success.
Return `None` on failure. | src/tl/telethon.py | GetCurrentSession | annihilatorrrr/opentele | 30 | python | async def GetCurrentSession(self) -> Optional[types.Authorization]:
'\n Get current logged-in session.\n\n ### Returns:\n Return `telethon.types.Authorization` on success.\n Return `None` on failure.\n '
results = (await self.GetSessions())
return (next((auth for a... | async def GetCurrentSession(self) -> Optional[types.Authorization]:
'\n Get current logged-in session.\n\n ### Returns:\n Return `telethon.types.Authorization` on success.\n Return `None` on failure.\n '
results = (await self.GetSessions())
return (next((auth for a... |
11f4f526c43c100dfe905d1632f7784aa3d1f5f9cf536916c49fc992400e57e4 | async def TerminateSession(self, hash: int):
"\n Terminate a specific session\n\n ### Arguments:\n hash (`int`):\n The `session`'s hash to terminate\n\n ### Raises:\n `FreshResetAuthorisationForbiddenError`: You can't log out other `sessions` if less than `2... | Terminate a specific session
### Arguments:
hash (`int`):
The `session`'s hash to terminate
### Raises:
`FreshResetAuthorisationForbiddenError`: You can't log out other `sessions` if less than `24 hours` have passed since you logged on to the `current session`.
`HashInvalidError`: The provided has... | src/tl/telethon.py | TerminateSession | annihilatorrrr/opentele | 30 | python | async def TerminateSession(self, hash: int):
"\n Terminate a specific session\n\n ### Arguments:\n hash (`int`):\n The `session`'s hash to terminate\n\n ### Raises:\n `FreshResetAuthorisationForbiddenError`: You can't log out other `sessions` if less than `2... | async def TerminateSession(self, hash: int):
"\n Terminate a specific session\n\n ### Arguments:\n hash (`int`):\n The `session`'s hash to terminate\n\n ### Raises:\n `FreshResetAuthorisationForbiddenError`: You can't log out other `sessions` if less than `2... |
21ade977914f819ecf0ed9f85bdfb1b58ad307776b76a83b93f709bcddee83fd | async def TerminateAllSessions(self) -> bool:
'\n Terminate all other sessions.\n '
sessions = (await self.GetSessions())
if (sessions == None):
return False
for ss in sessions.authorizations:
if (not ss.current):
(await self.TerminateSession(ss.hash))
retur... | Terminate all other sessions. | src/tl/telethon.py | TerminateAllSessions | annihilatorrrr/opentele | 30 | python | async def TerminateAllSessions(self) -> bool:
'\n \n '
sessions = (await self.GetSessions())
if (sessions == None):
return False
for ss in sessions.authorizations:
if (not ss.current):
(await self.TerminateSession(ss.hash))
return True | async def TerminateAllSessions(self) -> bool:
'\n \n '
sessions = (await self.GetSessions())
if (sessions == None):
return False
for ss in sessions.authorizations:
if (not ss.current):
(await self.TerminateSession(ss.hash))
return True<|docstring|>Terminate ... |
3a1b90339fb53be2747cef333c8f35b4afba6ed9cca666497414b8370825fdac | async def PrintSessions(self, sessions: types.account.Authorizations=None):
'\n Pretty-print all logged-in sessions.\n\n ### Arguments:\n sessions (`Authorizations`, default=`None`):\n `Sessions` that return by `GetSessions()`, if `None` then it will `GetSessions()` first.\n\... | Pretty-print all logged-in sessions.
### Arguments:
sessions (`Authorizations`, default=`None`):
`Sessions` that return by `GetSessions()`, if `None` then it will `GetSessions()` first.
### Returns:
On success, it should prints the sessions table as the code below.
```
|---------+-----------------... | src/tl/telethon.py | PrintSessions | annihilatorrrr/opentele | 30 | python | async def PrintSessions(self, sessions: types.account.Authorizations=None):
'\n Pretty-print all logged-in sessions.\n\n ### Arguments:\n sessions (`Authorizations`, default=`None`):\n `Sessions` that return by `GetSessions()`, if `None` then it will `GetSessions()` first.\n\... | async def PrintSessions(self, sessions: types.account.Authorizations=None):
'\n Pretty-print all logged-in sessions.\n\n ### Arguments:\n sessions (`Authorizations`, default=`None`):\n `Sessions` that return by `GetSessions()`, if `None` then it will `GetSessions()` first.\n\... |
a7896dde02808dc41417d45fda6d29c27123268f8002fff4d189ed2e85dbf9bc | async def is_official_app(self) -> bool:
'\n Return `True` if this session was logged-in using an official app (`API`).\n '
auth = (await self.GetCurrentSession())
return (False if (auth == None) else bool(auth.official_app)) | Return `True` if this session was logged-in using an official app (`API`). | src/tl/telethon.py | is_official_app | annihilatorrrr/opentele | 30 | python | async def is_official_app(self) -> bool:
'\n \n '
auth = (await self.GetCurrentSession())
return (False if (auth == None) else bool(auth.official_app)) | async def is_official_app(self) -> bool:
'\n \n '
auth = (await self.GetCurrentSession())
return (False if (auth == None) else bool(auth.official_app))<|docstring|>Return `True` if this session was logged-in using an official app (`API`).<|endoftext|> |
feda1927bd826e8c9ed5c70db9e33a8307e21323639392a83cc9ea4c6fa9baff | @typing.overload
async def QRLoginToNewClient(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n Create a new session using the current session.\n\n ### Arguments:\n session (`str`, `Session`, defau... | Create a new session using the current session.
### Arguments:
session (`str`, `Session`, default=`None`):
description
api (`API`, default=`TelegramDesktop`):
Which API to use. Read more `[here](API)`.
password (`str`, default=`None`):
Two-step verification password, set if needed... | src/tl/telethon.py | QRLoginToNewClient | annihilatorrrr/opentele | 30 | python | @typing.overload
async def QRLoginToNewClient(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n Create a new session using the current session.\n\n ### Arguments:\n session (`str`, `Session`, defau... | @typing.overload
async def QRLoginToNewClient(self, session: Union[(str, Session)]=None, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n Create a new session using the current session.\n\n ### Arguments:\n session (`str`, `Session`, defau... |
5e40728bfffb8dc1c348d97cd2491ff2a9370a7b1085bf3927267cfabf90c7e8 | async def ToTDesktop(self, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> td.TDesktop:
'\n Convert this instance of `TelegramClient` to `TDesktop`\n\n ### Arguments:\n flag (`LoginFlag`, default=`CreateNewSession`):\n... | Convert this instance of `TelegramClient` to `TDesktop`
### Arguments:
flag (`LoginFlag`, default=`CreateNewSession`):
The login flag. Read more `[here](LoginFlag)`.
api (`API`, default=`TelegramDesktop`):
Which API to use. Read more `[here](API)`.
password (`str`, default=`None`):
... | src/tl/telethon.py | ToTDesktop | annihilatorrrr/opentele | 30 | python | async def ToTDesktop(self, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> td.TDesktop:
'\n Convert this instance of `TelegramClient` to `TDesktop`\n\n ### Arguments:\n flag (`LoginFlag`, default=`CreateNewSession`):\n... | async def ToTDesktop(self, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> td.TDesktop:
'\n Convert this instance of `TelegramClient` to `TDesktop`\n\n ### Arguments:\n flag (`LoginFlag`, default=`CreateNewSession`):\n... |
c0b8d4b9cf8bdd87e70a5e0175ea86835f1c0177233ca97e7ea79d70c975e302 | @typing.overload
@staticmethod
async def FromTDesktop(account: Union[(td.TDesktop, td.Account)], session: Union[(str, Session)]=None, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n \n ### Arguments:\n ... | ### Arguments:
account (`TDesktop`, `Account`):
The `TDesktop` or `Account` you want to convert from.
session (`str`, `Session`, default=`None`):
The file name of the `session file` to be used, if `None` then the session will not be saved.\
Read more [here](https://docs.telethon.dev/en/... | src/tl/telethon.py | FromTDesktop | annihilatorrrr/opentele | 30 | python | @typing.overload
@staticmethod
async def FromTDesktop(account: Union[(td.TDesktop, td.Account)], session: Union[(str, Session)]=None, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n \n ### Arguments:\n ... | @typing.overload
@staticmethod
async def FromTDesktop(account: Union[(td.TDesktop, td.Account)], session: Union[(str, Session)]=None, flag: Type[LoginFlag]=CreateNewSession, api: Union[(Type[APIData], APIData)]=API.TelegramDesktop, password: str=None) -> TelegramClient:
'\n \n ### Arguments:\n ... |
ea7f05052f226c15a3053444b6ce74c9954c981fb02f6102e7f0f6d89df5f314 | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator | :param yaml_path: path to yaml file
:param default_separator: default value separator for path-mode | sitri/contrib/yaml.py | __init__ | gitter-badger/sitri | 0 | python | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator<... |
b0aeb439df3dac193e61bf7ce4430da17890466e69bcd0e4da77b5b6d25c8af2 | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... | Retrieve value from a dictionary using a list of keys.
:param path: string with separated keys | sitri/contrib/yaml.py | _get_by_path | gitter-badger/sitri | 0 | python | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... |
0c8c9c7cade0339dd1551f00635e991d1a080ecc185d1143882f29983a325680 | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from json\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None | Retrieve value from a dictionary using a key.
:param key: key from json | sitri/contrib/yaml.py | _get_by_key | gitter-badger/sitri | 0 | python | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from json\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from json\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None<|docstring|>Retrieve value from a dictionary using a key.
:param key: key from json<... |
0780bd8ab03ba7a68113b3accb7d72514c0a64741b821994692d52410f97a324 | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... | Get value from json
:param key: key or path for search
:param path_mode: boolean mode switcher
:param separator: separator for path keys in path mode | sitri/contrib/yaml.py | get | gitter-badger/sitri | 0 | python | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... |
2fb08d773578a9462082448a7d8ae85e0b53072b13a498f9fbfab97c6d7249b1 | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... | Keys in json
:param path_mode: [future] path mode for keys list
:param separator: [future] separators for keys in path mode | sitri/contrib/yaml.py | keys | gitter-badger/sitri | 0 | python | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... |
ea7f05052f226c15a3053444b6ce74c9954c981fb02f6102e7f0f6d89df5f314 | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator | :param yaml_path: path to yaml file
:param default_separator: default value separator for path-mode | sitri/contrib/yaml.py | __init__ | gitter-badger/sitri | 0 | python | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator | def __init__(self, yaml_path: str='./data.yaml', default_separator: str='.'):
'\n\n :param yaml_path: path to yaml file\n :param default_separator: default value separator for path-mode\n '
self._yaml = yaml.safe_load(open(os.path.abspath(yaml_path)))
self.separator = default_separator<... |
b0aeb439df3dac193e61bf7ce4430da17890466e69bcd0e4da77b5b6d25c8af2 | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... | Retrieve value from a dictionary using a list of keys.
:param path: string with separated keys | sitri/contrib/yaml.py | _get_by_path | gitter-badger/sitri | 0 | python | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... | def _get_by_path(self, path: str, separator: str) -> typing.Any:
'Retrieve value from a dictionary using a list of keys.\n\n :param path: string with separated keys\n '
dict_local = self._yaml.copy()
keys = path.split(separator)
for key in keys:
try:
dict_local = (dict_... |
54d7076fa6be673eadc9c64bf417358f2e07548f12c9b6a96a033ed08081deb9 | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from yaml\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None | Retrieve value from a dictionary using a key.
:param key: key from yaml | sitri/contrib/yaml.py | _get_by_key | gitter-badger/sitri | 0 | python | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from yaml\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None | def _get_by_key(self, key: str) -> typing.Any:
'Retrieve value from a dictionary using a key.\n\n :param key: key from yaml\n '
if (key in self._yaml):
return self._yaml[key]
else:
return None<|docstring|>Retrieve value from a dictionary using a key.
:param key: key from yaml<... |
0780bd8ab03ba7a68113b3accb7d72514c0a64741b821994692d52410f97a324 | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... | Get value from json
:param key: key or path for search
:param path_mode: boolean mode switcher
:param separator: separator for path keys in path mode | sitri/contrib/yaml.py | get | gitter-badger/sitri | 0 | python | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... | def get(self, key: str, path_mode: bool=False, separator: str=None) -> typing.Optional[typing.Any]:
'Get value from json\n\n :param key: key or path for search\n :param path_mode: boolean mode switcher\n :param separator: separator for path keys in path mode\n '
separator = (separato... |
2fb08d773578a9462082448a7d8ae85e0b53072b13a498f9fbfab97c6d7249b1 | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... | Keys in json
:param path_mode: [future] path mode for keys list
:param separator: [future] separators for keys in path mode | sitri/contrib/yaml.py | keys | gitter-badger/sitri | 0 | python | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... | def keys(self, path_mode: bool=False, separator: str=None) -> typing.List[str]:
'Keys in json\n\n :param path_mode: [future] path mode for keys list\n :param separator: [future] separators for keys in path mode\n '
if (not path_mode):
return self._yaml.keys()
else:
raise... |
d5b9bceea05d8951feec908370aff3e1570db1521177a769a3c05e64f4d2c767 | def __init__(self, xknx: XKNX, udp_client: UDPClient, communication_channel_id: int, route_back: bool=False):
'Initialize ConnectionState class.'
self.udp_client = udp_client
self.route_back = route_back
super().__init__(xknx, self.udp_client, ConnectionStateResponse, timeout_in_seconds=CONNECTIONSTATE_... | Initialize ConnectionState class. | xknx/io/request_response/connectionstate.py | __init__ | magicbear/xknx | 179 | python | def __init__(self, xknx: XKNX, udp_client: UDPClient, communication_channel_id: int, route_back: bool=False):
self.udp_client = udp_client
self.route_back = route_back
super().__init__(xknx, self.udp_client, ConnectionStateResponse, timeout_in_seconds=CONNECTIONSTATE_REQUEST_TIMEOUT)
self.communica... | def __init__(self, xknx: XKNX, udp_client: UDPClient, communication_channel_id: int, route_back: bool=False):
self.udp_client = udp_client
self.route_back = route_back
super().__init__(xknx, self.udp_client, ConnectionStateResponse, timeout_in_seconds=CONNECTIONSTATE_REQUEST_TIMEOUT)
self.communica... |
9d6ba18d4716c5b984815b616727373261d096addd0fb1bf8455d742910eaa09 | def create_knxipframe(self) -> KNXIPFrame:
'Create KNX/IP Frame object to be sent to device.'
if self.route_back:
endpoint = HPAI()
else:
(local_addr, local_port) = self.udpclient.getsockname()
endpoint = HPAI(ip_addr=local_addr, port=local_port)
connectionstate_request = Connect... | Create KNX/IP Frame object to be sent to device. | xknx/io/request_response/connectionstate.py | create_knxipframe | magicbear/xknx | 179 | python | def create_knxipframe(self) -> KNXIPFrame:
if self.route_back:
endpoint = HPAI()
else:
(local_addr, local_port) = self.udpclient.getsockname()
endpoint = HPAI(ip_addr=local_addr, port=local_port)
connectionstate_request = ConnectionStateRequest(self.xknx, communication_channel_i... | def create_knxipframe(self) -> KNXIPFrame:
if self.route_back:
endpoint = HPAI()
else:
(local_addr, local_port) = self.udpclient.getsockname()
endpoint = HPAI(ip_addr=local_addr, port=local_port)
connectionstate_request = ConnectionStateRequest(self.xknx, communication_channel_i... |
cbbabce2b8831c32513da0bf957a2bb6b43e7537c038d2219e37768944129f06 | def ids_tensor(shape, vocab_size, rng=None, name=None):
'Creates a random int32 tensor of the shape within the vocab size.'
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append(rng.rand... | Creates a random int32 tensor of the shape within the vocab size. | tests/test_modeling_common.py | ids_tensor | mmaybeno/transformers | 83 | python | def ids_tensor(shape, vocab_size, rng=None, name=None):
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append(rng.randint(0, (vocab_size - 1)))
return torch.tensor(data=values, dtyp... | def ids_tensor(shape, vocab_size, rng=None, name=None):
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append(rng.randint(0, (vocab_size - 1)))
return torch.tensor(data=values, dtyp... |
84249e4ccaba3f5b8c46ef63a733261cf83e6c008b9e8718d24a3605ffcce7c5 | def floats_tensor(shape, scale=1.0, rng=None, name=None):
'Creates a random float32 tensor of the shape within the vocab size.'
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append((rng... | Creates a random float32 tensor of the shape within the vocab size. | tests/test_modeling_common.py | floats_tensor | mmaybeno/transformers | 83 | python | def floats_tensor(shape, scale=1.0, rng=None, name=None):
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append((rng.random() * scale))
return torch.tensor(data=values, dtype=torch.... | def floats_tensor(shape, scale=1.0, rng=None, name=None):
if (rng is None):
rng = global_rng
total_dims = 1
for dim in shape:
total_dims *= dim
values = []
for _ in range(total_dims):
values.append((rng.random() * scale))
return torch.tensor(data=values, dtype=torch.... |
e3f42f523e627c40134588b1d5409db6a20ffd8b784de62594a251a74995a5be | def __init__(self, config=None):
"\n Constructor\n\n :param config: [dict] config dictionary of the form {'hyperparameter': {...}, ...}\n "
self._data = {HYPERPARAMETERPATH: {}, SETTINGSPATH: {}}
if (config is not None):
self.set_config(config) | Constructor
:param config: [dict] config dictionary of the form {'hyperparameter': {...}, ...} | hyppopy/HyppopyProject.py | __init__ | MIC-DKFZ/Hyppopy | 26 | python | def __init__(self, config=None):
"\n Constructor\n\n :param config: [dict] config dictionary of the form {'hyperparameter': {...}, ...}\n "
self._data = {HYPERPARAMETERPATH: {}, SETTINGSPATH: {}}
if (config is not None):
self.set_config(config) | def __init__(self, config=None):
"\n Constructor\n\n :param config: [dict] config dictionary of the form {'hyperparameter': {...}, ...}\n "
self._data = {HYPERPARAMETERPATH: {}, SETTINGSPATH: {}}
if (config is not None):
self.set_config(config)<|docstring|>Constructor
:param co... |
453ddd939082824aad192305b48380fd18a2992d527c224718c7e48609370e8f | def __parse_members(self):
'\n The function converts settings into class attributes\n '
for (name, value) in self.settings.items():
if (name not in self.__dict__.keys()):
setattr(self, name, value)
else:
self.__dict__[name] = value | The function converts settings into class attributes | hyppopy/HyppopyProject.py | __parse_members | MIC-DKFZ/Hyppopy | 26 | python | def __parse_members(self):
'\n \n '
for (name, value) in self.settings.items():
if (name not in self.__dict__.keys()):
setattr(self, name, value)
else:
self.__dict__[name] = value | def __parse_members(self):
'\n \n '
for (name, value) in self.settings.items():
if (name not in self.__dict__.keys()):
setattr(self, name, value)
else:
self.__dict__[name] = value<|docstring|>The function converts settings into class attributes<|endoftext|> |
2586a18fd443e6209af5fbecf511cfd0a27684a0d8bf5f7345b7e72c1f070c79 | def set_config(self, config):
'\n Set a config dict\n\n :param config: [dict] configuration dict defining hyperparameter and general settings\n '
assert isinstance(config, dict), 'precondition violation, config needs to be of type dict, got {}'.format(type(config))
confic_cp = copy.deep... | Set a config dict
:param config: [dict] configuration dict defining hyperparameter and general settings | hyppopy/HyppopyProject.py | set_config | MIC-DKFZ/Hyppopy | 26 | python | def set_config(self, config):
'\n Set a config dict\n\n :param config: [dict] configuration dict defining hyperparameter and general settings\n '
assert isinstance(config, dict), 'precondition violation, config needs to be of type dict, got {}'.format(type(config))
confic_cp = copy.deep... | def set_config(self, config):
'\n Set a config dict\n\n :param config: [dict] configuration dict defining hyperparameter and general settings\n '
assert isinstance(config, dict), 'precondition violation, config needs to be of type dict, got {}'.format(type(config))
confic_cp = copy.deep... |
f08d1791b9a93f3e8bbecdbd8996d46d21893e047555a4be77d2e20245edb11d | def set_hyperparameter(self, params):
'\n This function can be used to set the hyperparameter description directly by passing the hyperparameter section\n of a config dict (see class description). Alternatively use add_hyperparameter to add one after each other.\n\n :param params: [dict] config... | This function can be used to set the hyperparameter description directly by passing the hyperparameter section
of a config dict (see class description). Alternatively use add_hyperparameter to add one after each other.
:param params: [dict] configuration dict defining hyperparameter | hyppopy/HyppopyProject.py | set_hyperparameter | MIC-DKFZ/Hyppopy | 26 | python | def set_hyperparameter(self, params):
'\n This function can be used to set the hyperparameter description directly by passing the hyperparameter section\n of a config dict (see class description). Alternatively use add_hyperparameter to add one after each other.\n\n :param params: [dict] config... | def set_hyperparameter(self, params):
'\n This function can be used to set the hyperparameter description directly by passing the hyperparameter section\n of a config dict (see class description). Alternatively use add_hyperparameter to add one after each other.\n\n :param params: [dict] config... |
8bebc6172d315a094e6e80a8ce6f62bdf74cbd4607c35e5ad7e290140289b7bf | def add_hyperparameter(self, name, **kwargs):
"\n This function can be used to set hyperparameter descriptions. Alternatively use set_hyperparameter to set all at\n once.\n\n :param name: [str] hyperparameter name\n :param kwargs: [dict] configuration dict defining a hyperparameter e.g. ... | This function can be used to set hyperparameter descriptions. Alternatively use set_hyperparameter to set all at
once.
:param name: [str] hyperparameter name
:param kwargs: [dict] configuration dict defining a hyperparameter e.g. domain='uniform', data=[1,100], ... | hyppopy/HyppopyProject.py | add_hyperparameter | MIC-DKFZ/Hyppopy | 26 | python | def add_hyperparameter(self, name, **kwargs):
"\n This function can be used to set hyperparameter descriptions. Alternatively use set_hyperparameter to set all at\n once.\n\n :param name: [str] hyperparameter name\n :param kwargs: [dict] configuration dict defining a hyperparameter e.g. ... | def add_hyperparameter(self, name, **kwargs):
"\n This function can be used to set hyperparameter descriptions. Alternatively use set_hyperparameter to set all at\n once.\n\n :param name: [str] hyperparameter name\n :param kwargs: [dict] configuration dict defining a hyperparameter e.g. ... |
4e7783cac34ccb3504fa5929ab6e81c2baa9a423cc338d703d70e628de5d8b3c | def set_settings(self, **kwargs):
"\n This function can be used to set the general settings directly by passing the settings as name=value pairs.\n Alternatively use add_setting to add one after each other.\n\n :param kwargs: [dict] settings dict e.g. my_setting_1=3.1415, my_setting_2='hello wo... | This function can be used to set the general settings directly by passing the settings as name=value pairs.
Alternatively use add_setting to add one after each other.
:param kwargs: [dict] settings dict e.g. my_setting_1=3.1415, my_setting_2='hello world', ... | hyppopy/HyppopyProject.py | set_settings | MIC-DKFZ/Hyppopy | 26 | python | def set_settings(self, **kwargs):
"\n This function can be used to set the general settings directly by passing the settings as name=value pairs.\n Alternatively use add_setting to add one after each other.\n\n :param kwargs: [dict] settings dict e.g. my_setting_1=3.1415, my_setting_2='hello wo... | def set_settings(self, **kwargs):
"\n This function can be used to set the general settings directly by passing the settings as name=value pairs.\n Alternatively use add_setting to add one after each other.\n\n :param kwargs: [dict] settings dict e.g. my_setting_1=3.1415, my_setting_2='hello wo... |
87ef57eb987d4c4ba23aaf2c978f8610dc73dede3bd676c6dc92d381374e6c42 | def add_setting(self, name, value):
'\n This function can be used to set a general settings. Alternatively use set_settings to set all at once.\n\n :param name: [str] setting name\n :param value: [object] settings value\n '
assert isinstance(name, str), 'precondition violation, name ... | This function can be used to set a general settings. Alternatively use set_settings to set all at once.
:param name: [str] setting name
:param value: [object] settings value | hyppopy/HyppopyProject.py | add_setting | MIC-DKFZ/Hyppopy | 26 | python | def add_setting(self, name, value):
'\n This function can be used to set a general settings. Alternatively use set_settings to set all at once.\n\n :param name: [str] setting name\n :param value: [object] settings value\n '
assert isinstance(name, str), 'precondition violation, name ... | def add_setting(self, name, value):
'\n This function can be used to set a general settings. Alternatively use set_settings to set all at once.\n\n :param name: [str] setting name\n :param value: [object] settings value\n '
assert isinstance(name, str), 'precondition violation, name ... |
6b10849e8e34ee870fd803b18b8583e791c3f9979efaeaa860ab3df76883828d | def get_typeof(self, name):
'\n Returns a hyperparameter type by name\n\n :param name: [str] hyperparameter name\n :return: [type] hyperparameter type\n '
if (not (name in self.hyperparameter.keys())):
raise LookupError("Typechecking failed, couldn't find hyperparameter {}!".... | Returns a hyperparameter type by name
:param name: [str] hyperparameter name
:return: [type] hyperparameter type | hyppopy/HyppopyProject.py | get_typeof | MIC-DKFZ/Hyppopy | 26 | python | def get_typeof(self, name):
'\n Returns a hyperparameter type by name\n\n :param name: [str] hyperparameter name\n :return: [type] hyperparameter type\n '
if (not (name in self.hyperparameter.keys())):
raise LookupError("Typechecking failed, couldn't find hyperparameter {}!".... | def get_typeof(self, name):
'\n Returns a hyperparameter type by name\n\n :param name: [str] hyperparameter name\n :return: [type] hyperparameter type\n '
if (not (name in self.hyperparameter.keys())):
raise LookupError("Typechecking failed, couldn't find hyperparameter {}!".... |
d38576f48c7f7bcd4c93f0d1742dedafc7e4189bbead6ca3b30153b344899dbd | def on(type: str='', rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher... | :说明:
注册一个基础事件响应器,可自定义类型。
:参数:
* ``type: str``: 事件响应器类型
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: 事件响应器优先级
* ``bloc... | nonebot/plugin/__init__.py | on | SK-415/nonebot2 | 1,757 | python | def on(type: str=, rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:... | def on(type: str=, rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:... |
df5d11e3007f7a1dad8665e22cc9ab83faedfcc83e9bdf24dd5ca8c107af0a35 | def on_metaevent(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个元事件响应器。\n\n... | :说明:
注册一个元事件响应器。
:参数:
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: 事件响应器优先级
* ``block: bool``: 是否阻止事件向更低优先级传递
* ``state: Optional[T_State]``: 默认 state
* ``state_fac... | nonebot/plugin/__init__.py | on_metaevent | SK-415/nonebot2 | 1,757 | python | def on_metaevent(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个元事件响应器。\n\n... | def on_metaevent(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个元事件响应器。\n\n... |
38193904d26f2186ec86619a04aaf1e8ccb8e1c16a9eb6430405689dd4d679a1 | def on_message(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=True, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
... | :说明:
注册一个消息事件响应器。
:参数:
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: 事件响应器优先级
* ``block: bool``: 是否阻止事件向更低优先级传递
* ``st... | nonebot/plugin/__init__.py | on_message | SK-415/nonebot2 | 1,757 | python | def on_message(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=True, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
... | def on_message(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, permission: Optional[Permission]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=True, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
... |
0e082eaa155c0fc6a19626c5357e1b9cf0c7d8c9897fbce66339a22afdc1912c | def on_notice(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个通知事件响应器。\n\n ... | :说明:
注册一个通知事件响应器。
:参数:
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: 事件响应器优先级
* ``block: bool``: 是否阻止事件向更低优先级传递
* ``state: Optional[T_State]``: 默认 state
* ``state_fa... | nonebot/plugin/__init__.py | on_notice | SK-415/nonebot2 | 1,757 | python | def on_notice(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个通知事件响应器。\n\n ... | def on_notice(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个通知事件响应器。\n\n ... |
c3cb7f5202f8ed4942a6f8606c1f616a08bc1b3a95a6ca228ea2289e1599c8de | def on_request(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个请求事件响应器。\n\n ... | :说明:
注册一个请求事件响应器。
:参数:
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: 事件响应器优先级
* ``block: bool``: 是否阻止事件向更低优先级传递
* ``state: Optional[T_State]``: 默认 state
* ``state_fa... | nonebot/plugin/__init__.py | on_request | SK-415/nonebot2 | 1,757 | python | def on_request(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个请求事件响应器。\n\n ... | def on_request(rule: Optional[Union[(Rule, T_RuleChecker)]]=None, *, handlers: Optional[List[Union[(T_Handler, Handler)]]]=None, temp: bool=False, priority: int=1, block: bool=False, state: Optional[T_State]=None, state_factory: Optional[T_StateFactory]=None) -> Type[Matcher]:
'\n :说明:\n\n 注册一个请求事件响应器。\n\n ... |
3e78e5edf025001b431a99ab639120eeaca051f97a886213771cbb8cc1e92542 | def on_startswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``rule: O... | :说明:
注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。
:参数:
* ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``ignorecase: bool``: 是否忽略大小写
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ... | nonebot/plugin/__init__.py | on_startswith | SK-415/nonebot2 | 1,757 | python | def on_startswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``rule: O... | def on_startswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``rule: O... |
78fb5e0d22b14b5327cbb822557ff4a561e08fca44346dc5dd79ed9135d54cfb | def on_endswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``rule: Opt... | :说明:
注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。
:参数:
* ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``ignorecase: bool``: 是否忽略大小写
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ... | nonebot/plugin/__init__.py | on_endswith | SK-415/nonebot2 | 1,757 | python | def on_endswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``rule: Opt... | def on_endswith(msg: Union[(str, Tuple[(str, ...)])], rule: Optional[Optional[Union[(Rule, T_RuleChecker)]]]=None, ignorecase: bool=False, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``rule: Opt... |
84c8a1482cea3304ff94ac2945f0aa141a94b6d664d82dad953f7e6301d34991 | def on_keyword(keywords: Set[str], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[... | :说明:
注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。
:参数:
* ``keywords: Set[str]``: 关键词列表
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表
* ``temp: bool``: 是否为临时事件响应器(仅执行一次)
* ``priority: int``: ... | nonebot/plugin/__init__.py | on_keyword | SK-415/nonebot2 | 1,757 | python | def on_keyword(keywords: Set[str], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[... | def on_keyword(keywords: Set[str], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[... |
90f3795a8f29d35d015798966af4823f239b7ad7f304240bfe1c719cecd72d85 | def on_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n... | :说明:
注册一个消息事件响应器,并且当消息以指定命令开头时响应。
命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_
:参数:
* ``cmd: Union[str, Tuple[str, ...]]``: 指定命令内容
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``aliases: Optional[Set[Union[str, Tuple[str, ...]]]]``: 命令别名
* ``permission: Optional[Permission]``: 事件响应权限
... | nonebot/plugin/__init__.py | on_command | SK-415/nonebot2 | 1,757 | python | def on_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n... | def on_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n... |
65d96ac7a4fdbe864b73a0cabec9d84cf622e7ef1c066ece046728eccdae5955 | def on_shell_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on... | :说明:
注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。
与普通的 ``on_command`` 不同的是,在添加 ``parser`` 参数时, 响应器会自动处理消息。
并将用户输入的原始参数列表保存在 ``state["argv"]``, ``parser`` 处理的参数保存在 ``state["args"]`` 中
:参数:
* ``cmd: Union[str, Tuple[str, ...]]``: 指定命令内容
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``aliases: Optio... | nonebot/plugin/__init__.py | on_shell_command | SK-415/nonebot2 | 1,757 | python | def on_shell_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on... | def on_shell_command(cmd: Union[(str, Tuple[(str, ...)])], rule: Optional[Union[(Rule, T_RuleChecker)]]=None, aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on... |
e14027c6c03ead045fb1086a0a9bf8552b241b7b86e618b3cd932d5905362846 | def on_regex(pattern: str, flags: Union[(int, re.RegexFlag)]=0, rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags:... | :说明:
注册一个消息事件响应器,并且当消息匹配正则表达式时响应。
命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_
:参数:
* ``pattern: str``: 正则表达式
* ``flags: Union[int, re.RegexFlag]``: 正则匹配标志
* ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则
* ``permission: Optional[Permission]``: 事件响应权限
* ``handlers: Optional[List[Union[T_H... | nonebot/plugin/__init__.py | on_regex | SK-415/nonebot2 | 1,757 | python | def on_regex(pattern: str, flags: Union[(int, re.RegexFlag)]=0, rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags:... | def on_regex(pattern: str, flags: Union[(int, re.RegexFlag)]=0, rule: Optional[Union[(Rule, T_RuleChecker)]]=None, **kwargs) -> Type[Matcher]:
'\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags:... |
654b67f549ce1b886edd6c4b3cadeb2b4a09be322efceedc025c7efc3e04982d | def load_plugin(module_path: str) -> Optional[Plugin]:
'\n :说明:\n\n 使用 ``PluginManager`` 加载单个插件,可以是本地插件或是通过 ``pip`` 安装的插件。\n\n :参数:\n\n * ``module_path: str``: 插件名称 ``path.to.your.plugin``\n\n :返回:\n\n - ``Optional[Plugin]``\n '
context: Context = copy_context()
manager = PluginMa... | :说明:
使用 ``PluginManager`` 加载单个插件,可以是本地插件或是通过 ``pip`` 安装的插件。
:参数:
* ``module_path: str``: 插件名称 ``path.to.your.plugin``
:返回:
- ``Optional[Plugin]`` | nonebot/plugin/__init__.py | load_plugin | SK-415/nonebot2 | 1,757 | python | def load_plugin(module_path: str) -> Optional[Plugin]:
'\n :说明:\n\n 使用 ``PluginManager`` 加载单个插件,可以是本地插件或是通过 ``pip`` 安装的插件。\n\n :参数:\n\n * ``module_path: str``: 插件名称 ``path.to.your.plugin``\n\n :返回:\n\n - ``Optional[Plugin]``\n '
context: Context = copy_context()
manager = PluginMa... | def load_plugin(module_path: str) -> Optional[Plugin]:
'\n :说明:\n\n 使用 ``PluginManager`` 加载单个插件,可以是本地插件或是通过 ``pip`` 安装的插件。\n\n :参数:\n\n * ``module_path: str``: 插件名称 ``path.to.your.plugin``\n\n :返回:\n\n - ``Optional[Plugin]``\n '
context: Context = copy_context()
manager = PluginMa... |
7363e7715de0a4eec35968a7723c11e6873afc24ee4781380a50dd8898cffb14 | def load_plugins(*plugin_dir: str) -> Set[Plugin]:
'\n :说明:\n\n 导入目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``*plugin_dir: str``: 插件路径\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set()
manager = PluginManager(PLUGIN_NAMESPACE, search_path=plugin_dir)
for plugin_name i... | :说明:
导入目录下多个插件,以 ``_`` 开头的插件不会被导入!
:参数:
- ``*plugin_dir: str``: 插件路径
:返回:
- ``Set[Plugin]`` | nonebot/plugin/__init__.py | load_plugins | SK-415/nonebot2 | 1,757 | python | def load_plugins(*plugin_dir: str) -> Set[Plugin]:
'\n :说明:\n\n 导入目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``*plugin_dir: str``: 插件路径\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set()
manager = PluginManager(PLUGIN_NAMESPACE, search_path=plugin_dir)
for plugin_name i... | def load_plugins(*plugin_dir: str) -> Set[Plugin]:
'\n :说明:\n\n 导入目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``*plugin_dir: str``: 插件路径\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set()
manager = PluginManager(PLUGIN_NAMESPACE, search_path=plugin_dir)
for plugin_name i... |
41d1a68bb2640852bfe8fed2c875504af86a5ea172cb84b64ac13f951d175675 | def load_all_plugins(module_path: Set[str], plugin_dir: Set[str]) -> Set[Plugin]:
'\n :说明:\n\n 导入指定列表中的插件以及指定目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``module_path: Set[str]``: 指定插件集合\n - ``plugin_dir: Set[str]``: 指定插件路径集合\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set... | :说明:
导入指定列表中的插件以及指定目录下多个插件,以 ``_`` 开头的插件不会被导入!
:参数:
- ``module_path: Set[str]``: 指定插件集合
- ``plugin_dir: Set[str]``: 指定插件路径集合
:返回:
- ``Set[Plugin]`` | nonebot/plugin/__init__.py | load_all_plugins | SK-415/nonebot2 | 1,757 | python | def load_all_plugins(module_path: Set[str], plugin_dir: Set[str]) -> Set[Plugin]:
'\n :说明:\n\n 导入指定列表中的插件以及指定目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``module_path: Set[str]``: 指定插件集合\n - ``plugin_dir: Set[str]``: 指定插件路径集合\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set... | def load_all_plugins(module_path: Set[str], plugin_dir: Set[str]) -> Set[Plugin]:
'\n :说明:\n\n 导入指定列表中的插件以及指定目录下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``module_path: Set[str]``: 指定插件集合\n - ``plugin_dir: Set[str]``: 指定插件路径集合\n\n :返回:\n\n - ``Set[Plugin]``\n '
loaded_plugins = set... |
56e2cfb499db0a5c302289369fd4359568a941cd136c50b869abfc564c16f480 | def load_from_json(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 json 文件中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 json 文件路径\n - ``encoding: str``: 指定 json 文件编码\n\n :返回:\n\n - ``Set[Plugin]``\n '
wi... | :说明:
导入指定 json 文件中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,以 ``_`` 开头的插件不会被导入!
:参数:
- ``file_path: str``: 指定 json 文件路径
- ``encoding: str``: 指定 json 文件编码
:返回:
- ``Set[Plugin]`` | nonebot/plugin/__init__.py | load_from_json | SK-415/nonebot2 | 1,757 | python | def load_from_json(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 json 文件中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 json 文件路径\n - ``encoding: str``: 指定 json 文件编码\n\n :返回:\n\n - ``Set[Plugin]``\n '
wi... | def load_from_json(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 json 文件中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 json 文件路径\n - ``encoding: str``: 指定 json 文件编码\n\n :返回:\n\n - ``Set[Plugin]``\n '
wi... |
5886dffc6292edee1190466a1b14883d929919cd37d02f4843d01fa2afbb919f | def load_from_toml(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 toml 文件 ``[nonebot.plugins]`` 中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,\n 以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 toml 文件路径\n - ``encoding: str``: 指定 toml 文件编码\n\n :返回:\n\n ... | :说明:
导入指定 toml 文件 ``[nonebot.plugins]`` 中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,
以 ``_`` 开头的插件不会被导入!
:参数:
- ``file_path: str``: 指定 toml 文件路径
- ``encoding: str``: 指定 toml 文件编码
:返回:
- ``Set[Plugin]`` | nonebot/plugin/__init__.py | load_from_toml | SK-415/nonebot2 | 1,757 | python | def load_from_toml(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 toml 文件 ``[nonebot.plugins]`` 中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,\n 以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 toml 文件路径\n - ``encoding: str``: 指定 toml 文件编码\n\n :返回:\n\n ... | def load_from_toml(file_path: str, encoding: str='utf-8') -> Set[Plugin]:
'\n :说明:\n\n 导入指定 toml 文件 ``[nonebot.plugins]`` 中的 ``plugins`` 以及 ``plugin_dirs`` 下多个插件,\n 以 ``_`` 开头的插件不会被导入!\n\n :参数:\n\n - ``file_path: str``: 指定 toml 文件路径\n - ``encoding: str``: 指定 toml 文件编码\n\n :返回:\n\n ... |
85c7fed6663da8112e4d230d16c6e36094b4d73b4923c481dec0a7f1f6731a6a | def load_builtin_plugins(name: str='echo') -> Optional[Plugin]:
'\n :说明:\n\n 导入 NoneBot 内置插件\n\n :返回:\n\n - ``Plugin``\n '
return load_plugin(f'nonebot.plugins.{name}') | :说明:
导入 NoneBot 内置插件
:返回:
- ``Plugin`` | nonebot/plugin/__init__.py | load_builtin_plugins | SK-415/nonebot2 | 1,757 | python | def load_builtin_plugins(name: str='echo') -> Optional[Plugin]:
'\n :说明:\n\n 导入 NoneBot 内置插件\n\n :返回:\n\n - ``Plugin``\n '
return load_plugin(f'nonebot.plugins.{name}') | def load_builtin_plugins(name: str='echo') -> Optional[Plugin]:
'\n :说明:\n\n 导入 NoneBot 内置插件\n\n :返回:\n\n - ``Plugin``\n '
return load_plugin(f'nonebot.plugins.{name}')<|docstring|>:说明:
导入 NoneBot 内置插件
:返回:
- ``Plugin``<|endoftext|> |
2ff481e086b3a206cf6ced083d14457ab7ae3136da868168c280be93156c651d | def get_plugin(name: str) -> Optional[Plugin]:
'\n :说明:\n\n 获取当前导入的某个插件。\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Plugin]``\n '
return plugins.get(name) | :说明:
获取当前导入的某个插件。
:参数:
* ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。
:返回:
- ``Optional[Plugin]`` | nonebot/plugin/__init__.py | get_plugin | SK-415/nonebot2 | 1,757 | python | def get_plugin(name: str) -> Optional[Plugin]:
'\n :说明:\n\n 获取当前导入的某个插件。\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Plugin]``\n '
return plugins.get(name) | def get_plugin(name: str) -> Optional[Plugin]:
'\n :说明:\n\n 获取当前导入的某个插件。\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Plugin]``\n '
return plugins.get(name)<|docstring|>:说明:
获取当前导入的某个插件。
:参数:
* ``name: s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.