index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
48,802
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/cover.py
160,161
119,183
open
wser
162,166
161,166
class wser(Device): """Controls a Wistar curtain motor""" TYPE = "WSER" def _send(self, operation: int, data: Sequence = b""): """Send a command to the device.""" packet = bytearray(12) packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05]...
class wser(Device): """Controls a Wistar curtain motor""" TYPE = "WSER" def _send(self, operation: int, data: Sequence = b""): """Send a command to the device.""" packet = bytearray(12) packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05]...
resp = self._send(2, [0x4A, 0x31, 0xA0]) position = resp[0x0E] return position
"""Open the curtain.""" resp = self._send(2, [0x4A, 0x31, 0xA0]) position = resp[0x0E] return position
11
650
48
698
"""Support for covers.""" import time from typing import Sequence from . import exceptions as e from .device import Device class dooya(Device): """Controls a Dooya curtain motor.""" TYPE = "DT360E" def _send(self, command: int, attribute: int = 0) -> int: """Send a packet to the device.""" ...
"""Support for covers.""" import time from typing import Sequence from . import exceptions as e from .device import Device class dooya(Device): """Controls a Dooya curtain motor.""" TYPE = "DT360E" def _send(self, command: int, attribute: int = 0) -> int: """Send a packet to the device.""" ...
48,803
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/exceptions.py
139,140
1,153
exception
141,148
140,148
"""Exceptions for Broadlink devices.""" import collections import struct class BroadlinkException(Exception): """Base class common to all Broadlink exceptions.""" def __init__(self, *args, **kwargs): """Initialize the exception.""" super().__init__(*args, **kwargs) if len(args) >= 2: ...
"""Exceptions for Broadlink devices.""" import collections import struct class BroadlinkException(Exception): """Base class common to all Broadlink exceptions.""" def __init__(self, *args, **kwargs): """Initialize the exception.""" super().__init__(*args, **kwargs) if len(args) >= 2: ...
try: exc, msg = BROADLINK_EXCEPTIONS[err_code] return exc(err_code, msg) except KeyError: return UnknownError(err_code, "Unknown error")
"""Return exception corresponding to an error code.""" try: exc, msg = BROADLINK_EXCEPTIONS[err_code] return exc(err_code, msg) except KeyError: return UnknownError(err_code, "Unknown error")
14
1,250
64
1,314
"""Exceptions for Broadlink devices.""" import collections import struct class BroadlinkException(Exception): """Base class common to all Broadlink exceptions.""" def __init__(self, *args, **kwargs): """Initialize the exception.""" super().__init__(*args, **kwargs) if len(args) >= 2: ...
"""Exceptions for Broadlink devices.""" import collections import struct class BroadlinkException(Exception): """Base class common to all Broadlink exceptions.""" def __init__(self, *args, **kwargs): """Initialize the exception.""" super().__init__(*args, **kwargs) if len(args) >= 2: ...
48,804
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/helpers.py
13,15
5,44
get_table
CRC16
16,31
15,31
class CRC16: """Helps with CRC-16 calculation. CRC tables are cached for performance. """ _cache: Dict[int, List[int]] = {} @classmethod def get_table(cls, polynomial: int) -> List[int]: FILL_FUNC_BODY @classmethod def calculate( cls, sequence: Sequence[int], po...
class CRC16: """Helps with CRC-16 calculation. CRC tables are cached for performance. """ _cache: Dict[int, List[int]] = {} @classmethod def get_table(cls, polynomial: int) -> List[int]: """Return the CRC-16 table for a polynomial.""" FILL_FUNC_BODY @classmethod def calculate( ...
try: crc_table = cls._cache[polynomial] except KeyError: crc_table = [] for dividend in range(0, 256): remainder = dividend for _ in range(0, 8): if remainder & 1: remainder = remainder >> 1 ^...
"""Return the CRC-16 table for a polynomial.""" try: crc_table = cls._cache[polynomial] except KeyError: crc_table = [] for dividend in range(0, 256): remainder = dividend for _ in range(0, 8): if remainder &...
45
250
149
399
"""Helper functions and classes.""" from typing import Dict, List, Sequence class CRC16: """Helps with CRC-16 calculation. CRC tables are cached for performance. """ _cache: Dict[int, List[int]] = {} @classmethod def get_table(cls, polynomial: int) -> List[int]: FILL_FUNC_BODY @classmeth...
"""Helper functions and classes.""" from typing import Dict, List, Sequence class CRC16: """Helps with CRC-16 calculation. CRC tables are cached for performance. """ _cache: Dict[int, List[int]] = {} @classmethod def get_table(cls, polynomial: int) -> List[int]: """Return the CRC-16...
48,805
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/hub.py
57,64
10,99
set_state
s3
65,80
64,80
class s3(Device): """Controls a Broadlink S3.""" TYPE = "S3" MAX_SUBDEVICES = 8 def get_subdevices(self, step: int = 5) -> list: """Return a list of sub devices.""" total = self.MAX_SUBDEVICES sub_devices = [] seen = set() index = 0 while index < total:...
class s3(Device): """Controls a Broadlink S3.""" TYPE = "S3" MAX_SUBDEVICES = 8 def get_subdevices(self, step: int = 5) -> list: """Return a list of sub devices.""" total = self.MAX_SUBDEVICES sub_devices = [] seen = set() index = 0 while index < total:...
state = {} if did is not None: state["did"] = did if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if pwr3 is not None: state["pwr3"] = int(bool(pwr3)) packet = self....
"""Set the power state of the device.""" state = {} if did is not None: state["did"] = did if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if pwr3 is not None: state[...
46
763
178
941
"""Support for hubs.""" import struct import json from typing import Optional from . import exceptions as e from .device import Device class s3(Device): """Controls a Broadlink S3.""" TYPE = "S3" MAX_SUBDEVICES = 8 def get_subdevices(self, step: int = 5) -> list: """Return a list of sub dev...
"""Support for hubs.""" import struct import json from typing import Optional from . import exceptions as e from .device import Device class s3(Device): """Controls a Broadlink S3.""" TYPE = "S3" MAX_SUBDEVICES = 8 def get_subdevices(self, step: int = 5) -> list: """Return a list of sub dev...
48,806
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/light.py
34,51
11,109
set_state
lb1
52,87
51,87
class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" RGB = 0 WHITE = 1 SCENE = 2 def get_state(self) -> dict: """Return the power state of the device. Example: `{...
class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" RGB = 0 WHITE = 1 SCENE = 2 def get_state(self) -> dict: """Return the power state of the device. Example: `{...
state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if red is not None: state["red"] = int(red) if blue is not None: state["blue"] = int(blue) if green is not None: state["green"] = int(green) if brightness is not N...
"""Set the power state of the device.""" state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if red is not None: state["red"] = int(red) if blue is not None: state["blue"] = int(blue) if green is not None: state["gr...
126
1,126
450
1,576
"""Support for lights.""" import enum import json import struct from typing import Optional from . import exceptions as e from .device import Device class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" ...
"""Support for lights.""" import enum import json import struct from typing import Optional from . import exceptions as e from .device import Device class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" ...
48,807
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/light.py
182,183
109,201
_encode
lb2
184,195
183,195
class lb2(Device): """Controls a Broadlink LB26/LB27.""" TYPE = "LB2" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" RGB = 0 WHITE = 1 SCENE = 2 def get_state(self) -> dict: """Return the power state of the device. Examp...
class lb2(Device): """Controls a Broadlink LB26/LB27.""" TYPE = "LB2" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" RGB = 0 WHITE = 1 SCENE = 2 def get_state(self) -> dict: """Return the power state of the device. Examp...
# flag: 1 for reading, 2 for writing. packet = bytearray(12) data = json.dumps(state, separators=(",", ":")).encode() struct.pack_into( "<HHHBBI", packet, 0, 0xA5A5, 0x5A5A, 0, flag, 0x0B, len(data) ) packet.extend(data) checksum = sum(packet, 0xBEAF) ...
"""Encode a JSON packet.""" # flag: 1 for reading, 2 for writing. packet = bytearray(12) data = json.dumps(state, separators=(",", ":")).encode() struct.pack_into( "<HHHBBI", packet, 0, 0xA5A5, 0x5A5A, 0, flag, 0x0B, len(data) ) packet.extend(data) ...
40
1,298
176
1,474
"""Support for lights.""" import enum import json import struct from typing import Optional from . import exceptions as e from .device import Device class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" ...
"""Support for lights.""" import enum import json import struct from typing import Optional from . import exceptions as e from .device import Device class lb1(Device): """Controls a Broadlink LB1.""" TYPE = "LB1" @enum.unique class ColorMode(enum.IntEnum): """Enumerates color modes.""" ...
48,808
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/protocol.py
24,26
6,51
unpack
Datetime
27,46
26,46
class Datetime: """Helps to pack and unpack datetime objects for the Broadlink protocol.""" @staticmethod def pack(datetime: dt.datetime) -> bytes: """Pack the timestamp to be sent over the Broadlink protocol.""" data = bytearray(12) utcoffset = int(datetime.utcoffset().total_second...
class Datetime: """Helps to pack and unpack datetime objects for the Broadlink protocol.""" @staticmethod def pack(datetime: dt.datetime) -> bytes: """Pack the timestamp to be sent over the Broadlink protocol.""" data = bytearray(12) utcoffset = int(datetime.utcoffset().total_second...
utcoffset = int.from_bytes(data[0x00:0x04], "little", signed=True) year = int.from_bytes(data[0x04:0x06], "little") minute = data[0x06] hour = data[0x07] subyear = data[0x08] isoweekday = data[0x09] day = data[0x0A] month = data[0x0B] tz_info = dt...
"""Unpack a timestamp received over the Broadlink protocol.""" utcoffset = int.from_bytes(data[0x00:0x04], "little", signed=True) year = int.from_bytes(data[0x04:0x06], "little") minute = data[0x06] hour = data[0x07] subyear = data[0x08] isoweekday = data[0x09] ...
60
358
269
627
"""The networking part of the python-broadlink library.""" import datetime as dt import time class Datetime: """Helps to pack and unpack datetime objects for the Broadlink protocol.""" @staticmethod def pack(datetime: dt.datetime) -> bytes: """Pack the timestamp to be sent over the Broadlink prot...
"""The networking part of the python-broadlink library.""" import datetime as dt import time class Datetime: """Helps to pack and unpack datetime objects for the Broadlink protocol.""" @staticmethod def pack(datetime: dt.datetime) -> bytes: """Pack the timestamp to be sent over the Broadlink prot...
48,809
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/remote.py
9,10
1,174
pulses_to_data
11,28
10,28
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: FILL_FUNC_BODYdef data_to_pulses(data: bytes, tick: float = 32.84) -> List[int]: """Parse a Bro...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" FILL_FUNC_BODYdef dat...
result = bytearray(4) result[0x00] = 0x26 for pulse in pulses: div, mod = divmod(int(pulse // tick), 256) if div: result.append(0) result.append(div) result.append(mod) data_len = len(result) - 4 result[0x02] = data_len & 0xFF result[0x03] = data...
"""Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearray(4) result[0x00] = 0x26 for pulse in pulses: div, mod = divmod(int(pulse // tick), 256) if div: result.append(0) result.append(div) result.append(mod) data_le...
39
1,511
153
1,664
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: FILL_FUNC_BODYdef data_to_pulses(data: bytes, tick: float = 32.84) -> List[int]: """Parse a Bro...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" FILL_FUNC_BODYdef dat...
48,810
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/remote.py
149,150
135,158
check_temperature
rm4mini
151,153
150,153
class rm4mini(rmminib): """Controls a Broadlink RM4 mini.""" TYPE = "RM4MINI" def check_sensors(self) -> dict: """Return the state of the sensors.""" resp = self._send(0x24) temp = struct.unpack("<bb", resp[:0x2]) return { "temperature": temp[0x0] + temp[0x1] / ...
class rm4mini(rmminib): """Controls a Broadlink RM4 mini.""" TYPE = "RM4MINI" def check_sensors(self) -> dict: """Return the state of the sensors.""" resp = self._send(0x24) temp = struct.unpack("<bb", resp[:0x2]) return { "temperature": temp[0x0] + temp[0x1] / ...
return self.check_sensors()["temperature"]
"""Return the temperature.""" return self.check_sensors()["temperature"]
2
221
16
237
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
48,811
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/remote.py
55,56
50,82
_send
rmmini
57,63
56,63
class rmmini(Device): """Controls a Broadlink RM mini 3.""" TYPE = "RMMINI" def _send(self, command: int, data: bytes = b"") -> bytes: FILL_FUNC_BODY def update(self) -> None: """Update device name and lock status.""" resp = self._send(0x1) self.name = resp[0x48:].split(b"\x00")...
class rmmini(Device): """Controls a Broadlink RM mini 3.""" TYPE = "RMMINI" def _send(self, command: int, data: bytes = b"") -> bytes: """Send a packet to the device.""" FILL_FUNC_BODY def update(self) -> None: """Update device name and lock status.""" resp = self._send(0x1) ...
packet = struct.pack("<I", command) + data resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) payload = self.decrypt(resp[0x38:]) return payload[0x4:]
"""Send a packet to the device.""" packet = struct.pack("<I", command) + data resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) payload = self.decrypt(resp[0x38:]) return payload[0x4:]
16
265
86
351
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
48,812
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/remote.py
125,126
120,135
_send
rmminib
127,135
126,135
class rmminib(rmmini): """Controls a Broadlink RM mini 3 (new firmware).""" TYPE = "RMMINIB" def _send(self, command: int, data: bytes = b"") -> bytes: FILL_FUNC_BODY
class rmminib(rmmini): """Controls a Broadlink RM mini 3 (new firmware).""" TYPE = "RMMINIB" def _send(self, command: int, data: bytes = b"") -> bytes: """Send a packet to the device.""" FILL_FUNC_BODY
packet = struct.pack("<HI", len(data) + 4, command) + data resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) payload = self.decrypt(resp[0x38:]) p_len = struct.unpack("<H", payload[:0x2])[0] return payload[0x6:p_len+2]
"""Send a packet to the device.""" packet = struct.pack("<HI", len(data) + 4, command) + data resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) payload = self.decrypt(resp[0x38:]) p_len = struct.unpack("<H", payload[:0x2])[0] return payload[0x6:...
23
83
125
208
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
48,813
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/remote.py
109,110
82,120
check_sensors
rmpro
111,115
110,115
class rmpro(rmmini): """Controls a Broadlink RM pro.""" TYPE = "RMPRO" def sweep_frequency(self) -> None: """Sweep frequency.""" self._send(0x19) def check_frequency(self) -> Tuple[bool, float]: """Return True if the frequency was identified successfully.""" resp = sel...
class rmpro(rmmini): """Controls a Broadlink RM pro.""" TYPE = "RMPRO" def sweep_frequency(self) -> None: """Sweep frequency.""" self._send(0x19) def check_frequency(self) -> Tuple[bool, float]: """Return True if the frequency was identified successfully.""" resp = sel...
resp = self._send(0x1) temp = struct.unpack("<bb", resp[:0x2]) return {"temperature": temp[0x0] + temp[0x1] / 10.0}
"""Return the state of the sensors.""" resp = self._send(0x1) temp = struct.unpack("<bb", resp[:0x2]) return {"temperature": temp[0x0] + temp[0x1] / 10.0}
14
344
61
405
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
"""Support for universal remotes.""" import struct from typing import List, Optional, Tuple from . import exceptions as e from .device import Device def pulses_to_data(pulses: List[int], tick: float = 32.84) -> bytes: """Convert a microsecond duration sequence into a Broadlink IR packet.""" result = bytearra...
48,814
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/sensor.py
29,30
8,45
check_sensors_raw
a1
31,45
30,45
class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "normal", "bad")), ("noise", ("quiet", "normal", "noisy")), ) def check_sensors(self) -> dict: ...
class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "normal", "bad")), ("noise", ("quiet", "normal", "noisy")), ) def check_sensors(self) -> dict: ...
packet = bytearray([0x1]) resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) data = self.decrypt(resp[0x38:]) return { "temperature": data[0x04] + data[0x05] / 10.0, "humidity": data[0x06] + data[0x07] / 10.0, "light": data[0...
"""Return the state of the sensors in raw format.""" packet = bytearray([0x1]) resp = self.send_packet(0x6A, packet) e.check_error(resp[0x22:0x24]) data = self.decrypt(resp[0x38:]) return { "temperature": data[0x04] + data[0x05] / 10.0, "humidity"...
32
237
183
420
"""Support for sensors.""" from typing import Sequence from . import exceptions as e from .device import Device class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "nor...
"""Support for sensors.""" from typing import Sequence from . import exceptions as e from .device import Device class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "nor...
48,815
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/sensor.py
50,51
45,91
_send
a2
52,80
51,80
class a2(Device): """Controls a Broadlink A2.""" TYPE = "A2" def _send(self, operation: int, data: Sequence = b""): FILL_FUNC_BODY def check_sensors_raw(self) -> dict: """Return the state of the sensors in raw format.""" data = self._send(1) return { "temperature": ...
class a2(Device): """Controls a Broadlink A2.""" TYPE = "A2" def _send(self, operation: int, data: Sequence = b""): """Send a command to the device.""" FILL_FUNC_BODY def check_sensors_raw(self) -> dict: """Return the state of the sensors in raw format.""" data = self._send(1) ...
packet = bytearray(12) packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05] = 0x5A packet[0x08] = operation packet[0x09] = 0x0B if data: data_len = len(data) packet[0x0A] = data_len & 0xFF packet[0x0...
"""Send a command to the device.""" packet = bytearray(12) packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05] = 0x5A packet[0x08] = operation packet[0x09] = 0x0B if data: data_len = len(data) packet[0x...
81
247
349
596
"""Support for sensors.""" from typing import Sequence from . import exceptions as e from .device import Device class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "nor...
"""Support for sensors.""" from typing import Sequence from . import exceptions as e from .device import Device class a1(Device): """Controls a Broadlink A1.""" TYPE = "A1" _SENSORS_AND_LEVELS = ( ("light", ("dark", "dim", "normal", "bright")), ("air_quality", ("excellent", "good", "nor...
48,816
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
257,267
242,319
set_state
bg1
268,289
267,289
class bg1(Device): """Controls a BG Electrical smart outlet.""" TYPE = "BG1" def get_state(self) -> dict: """Return the power state of the device. Example: `{"pwr":1,"pwr1":1,"pwr2":0,"maxworktime":60,"maxworktime1":60,"maxworktime2":0,"idcbrightness":50}` """ packet = sel...
class bg1(Device): """Controls a BG Electrical smart outlet.""" TYPE = "BG1" def get_state(self) -> dict: """Return the power state of the device. Example: `{"pwr":1,"pwr1":1,"pwr2":0,"maxworktime":60,"maxworktime1":60,"maxworktime2":0,"idcbrightness":50}` """ packet = sel...
state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if maxworktime is not None: state["maxworktime"] = maxworktime ...
"""Set the power state of the device.""" state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if maxworktime is not None: ...
70
607
262
869
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,817
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
324,340
319,375
set_state
ehc31
341,375
340,375
class ehc31(bg1): """Controls a BG Electrical smart extension lead.""" TYPE = "EHC31" def set_state( self, pwr: Optional[bool] = None, pwr1: Optional[bool] = None, pwr2: Optional[bool] = None, pwr3: Optional[bool] = None, maxworktime1: Optional[int] = None, ...
class ehc31(bg1): """Controls a BG Electrical smart extension lead.""" TYPE = "EHC31" def set_state( self, pwr: Optional[bool] = None, pwr1: Optional[bool] = None, pwr2: Optional[bool] = None, pwr3: Optional[bool] = None, maxworktime1: Optional[int] = None, ...
state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if pwr3 is not None: state["pwr3"] = int(bool(pwr3)) if m...
"""Set the power state of the device.""" state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if pwr1 is not None: state["pwr1"] = int(bool(pwr1)) if pwr2 is not None: state["pwr2"] = int(bool(pwr2)) if pwr3 is not None: ...
118
246
438
684
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,818
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
403,404
375,431
check_power_raw
mp1
405,420
404,420
class mp1(Device): """Controls a Broadlink MP1.""" TYPE = "MP1" def set_power_mask(self, sid_mask: int, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0x00] = 0x0D packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x0...
class mp1(Device): """Controls a Broadlink MP1.""" TYPE = "MP1" def set_power_mask(self, sid_mask: int, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0x00] = 0x0D packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x0...
packet = bytearray(16) packet[0x00] = 0x0A packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05] = 0x5A packet[0x06] = 0xAE packet[0x07] = 0xC0 packet[0x08] = 0x01 response = self.send_packet(0x6A, packet) e.chec...
"""Return the power state of the device in raw format.""" packet = bytearray(16) packet[0x00] = 0x0A packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05] = 0x5A packet[0x06] = 0xAE packet[0x07] = 0xC0 packet[0x08] = 0x01...
37
502
203
705
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,819
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
436,437
431,473
get_state
mp1s
444,473
437,473
class mp1s(mp1): """Controls a Broadlink MP1S.""" TYPE = "MP1S" def get_state(self) -> dict: FILL_FUNC_BODY
class mp1s(mp1): """Controls a Broadlink MP1S.""" TYPE = "MP1S" def get_state(self) -> dict: """Return the power state of the device. voltage in V. current in A. power in W. power consumption in kW·h. """ FILL_FUNC_BODY
packet = bytearray(16) packet[0x00] = 0x0E packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0x05] = 0x5A packet[0x06] = 0xB2 packet[0x07] = 0xC0 packet[0x08] = 0x01 packet[0x0A] = 0x04 response = self.send_packet(...
"""Return the power state of the device. voltage in V. current in A. power in W. power consumption in kW·h. """ packet = bytearray(16) packet[0x00] = 0x0E packet[0x02] = 0xA5 packet[0x03] = 0xA5 packet[0x04] = 0x5A packet[0...
89
98
439
537
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,820
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
15,16
10,23
set_power
sp1
17,23
16,23
class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: FILL_FUNC_BODY
class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" FILL_FUNC_BODY
packet = bytearray(4) packet[0] = bool(pwr) response = self.send_packet(0x66, packet) e.check_error(response[0x22:0x24])
"""Set the power state of the device.""" packet = bytearray(4) packet[0] = bool(pwr) response = self.send_packet(0x66, packet) e.check_error(response[0x22:0x24])
11
67
67
134
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: FILL_FUNC_BODYclass sp2(Device): """Controls a Broadlink...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" FILL_FUNC_B...
48,821
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
36,37
23,46
check_power
sp2
38,46
37,46
class sp2(Device): """Controls a Broadlink SP2.""" TYPE = "SP2" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0] = 2 packet[4] = bool(pwr) response = self.send_packet(0x6A, packet) e.check_erro...
class sp2(Device): """Controls a Broadlink SP2.""" TYPE = "SP2" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0] = 2 packet[4] = bool(pwr) response = self.send_packet(0x6A, packet) e.check_erro...
packet = bytearray(16) packet[0] = 1 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return bool(payload[0x4])
"""Return the power state of the device.""" packet = bytearray(16) packet[0] = 1 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return bool(payload[0x4])
16
160
95
255
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,822
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
51,52
46,61
get_energy
sp2s
53,61
52,61
class sp2s(sp2): """Controls a Broadlink SP2S.""" TYPE = "SP2S" def get_energy(self) -> float: FILL_FUNC_BODY
class sp2s(sp2): """Controls a Broadlink SP2S.""" TYPE = "SP2S" def get_energy(self) -> float: """Return the power consumption in W.""" FILL_FUNC_BODY
packet = bytearray(16) packet[0] = 4 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return int.from_bytes(payload[0x4:0x7], "little") / 1000
"""Return the power consumption in W.""" packet = bytearray(16) packet[0] = 4 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return int.from_bytes(payload[0x4:0x7], "little") / 1000
19
65
112
177
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,823
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
82,83
61,101
check_power
sp3
84,91
83,91
class sp3(Device): """Controls a Broadlink SP3.""" TYPE = "SP3" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0] = 2 packet[4] = self.check_nightlight() << 1 | bool(pwr) response = self.send_packet(0x6...
class sp3(Device): """Controls a Broadlink SP3.""" TYPE = "SP3" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" packet = bytearray(16) packet[0] = 2 packet[4] = self.check_nightlight() << 1 | bool(pwr) response = self.send_packet(0x6...
packet = bytearray(16) packet[0] = 1 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return bool(payload[0x4] & 1)
"""Return the power state of the device.""" packet = bytearray(16) packet[0] = 1 response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) return bool(payload[0x4] & 1)
18
396
97
493
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,824
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
106,107
101,116
get_energy
sp3s
108,116
107,116
class sp3s(sp2): """Controls a Broadlink SP3S.""" TYPE = "SP3S" def get_energy(self) -> float: FILL_FUNC_BODY
class sp3s(sp2): """Controls a Broadlink SP3S.""" TYPE = "SP3S" def get_energy(self) -> float: """Return the power consumption in W.""" FILL_FUNC_BODY
packet = bytearray([8, 0, 254, 1, 5, 1, 0, 0, 0, 45]) response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) energy = payload[0x7:0x4:-1].hex() return int(energy) / 100
"""Return the power consumption in W.""" packet = bytearray([8, 0, 254, 1, 5, 1, 0, 0, 0, 45]) response = self.send_packet(0x6A, packet) e.check_error(response[0x22:0x24]) payload = self.decrypt(response[0x38:]) energy = payload[0x7:0x4:-1].hex() return int(energy...
27
65
134
199
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,825
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
129,138
116,194
set_state
sp4
139,157
138,157
class sp4(Device): """Controls a Broadlink SP4.""" TYPE = "SP4" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" self.set_state(pwr=pwr) def set_nightlight(self, ntlight: bool) -> None: """Set the night light state of the device.""" self...
class sp4(Device): """Controls a Broadlink SP4.""" TYPE = "SP4" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" self.set_state(pwr=pwr) def set_nightlight(self, ntlight: bool) -> None: """Set the night light state of the device.""" self...
state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if ntlight is not None: state["ntlight"] = int(bool(ntlight)) if indicator is not None: state["indicator"] = int(bool(indicator)) if ntlbrightness is not None: state["ntlb...
"""Set state of device.""" state = {} if pwr is not None: state["pwr"] = int(bool(pwr)) if ntlight is not None: state["ntlight"] = int(bool(ntlight)) if indicator is not None: state["indicator"] = int(bool(indicator)) if ntlbrightness i...
61
687
207
894
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,826
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink
/home/hieuvd/dung_repo/raw/stars_03/mjg59_python-broadlink/python-broadlink/broadlink/switch.py
211,212
194,242
_encode
sp4b
213,233
212,233
class sp4b(sp4): """Controls a Broadlink SP4 (type B).""" TYPE = "SP4B" def get_state(self) -> dict: """Get full state of device.""" state = super().get_state() # Convert sensor data to float. Remove keys if sensors are not supported. sensor_attrs = ["current", "volt", "po...
class sp4b(sp4): """Controls a Broadlink SP4 (type B).""" TYPE = "SP4B" def get_state(self) -> dict: """Get full state of device.""" state = super().get_state() # Convert sensor data to float. Remove keys if sensors are not supported. sensor_attrs = ["current", "volt", "po...
packet = bytearray(14) data = json.dumps(state, separators=(",", ":")).encode() length = 12 + len(data) struct.pack_into( "<HHHHBBI", packet, 0, length, 0xA5A5, 0x5A5A, 0x0000, flag, ...
"""Encode a message.""" packet = bytearray(14) data = json.dumps(state, separators=(",", ":")).encode() length = 12 + len(data) struct.pack_into( "<HHHHBBI", packet, 0, length, 0xA5A5, 0x5A5A, 0x0...
38
317
207
524
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
"""Support for switches.""" import json import struct from typing import Optional from . import exceptions as e from .device import Device class sp1(Device): """Controls a Broadlink SP1.""" TYPE = "SP1" def set_power(self, pwr: bool) -> None: """Set the power state of the device.""" pac...
48,894
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu/mu/__main__.py
4,5
1,10
main
5,8
5,8
from mu.app import run def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
from mu.app import run def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
run()
run()
1
38
9
47
from mu.app import run def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
from mu.app import run def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
48,897
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu/mu/debugger/utils.py
21,22
1,42
is_breakpoint_line
28,42
22,42
""" Debug related utility functions for the Mu editor. Copyright (c) Nicholas H.Tollervey and others (see the AUTHORS file). This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the L...
""" Debug related utility functions for the Mu editor. Copyright (c) Nicholas H.Tollervey and others (see the AUTHORS file). This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the L...
code = code.strip() if not code: return False # Can't set breakpoints on blank lines or comments. # TODO: Make this more robust. if code[0] == "#" or code[:3] == '"""' or code[:3] == "'''": return False # Can't set breakpoints on lines that end with opening (, { or [ if code[...
""" Return a boolean indication if the specified code from a single line can have a breakpoint added to it. Based entirely on simple but effective heuristics (see comments). """ code = code.strip() if not code: return False # Can't set breakpoints on blank lines or comments. ...
87
269
178
447
""" Debug related utility functions for the Mu editor. Copyright (c) Nicholas H.Tollervey and others (see the AUTHORS file). This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the L...
""" Debug related utility functions for the Mu editor. Copyright (c) Nicholas H.Tollervey and others (see the AUTHORS file). This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the L...
48,898
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu
/home/hieuvd/dung_repo/raw/stars_03/mu-editor_mu/mu/mu/mu_debug.py
18,19
1,34
debug
25,32
19,32
import os import sys from mu.debugger.config import DEBUGGER_PORT import mu.debugger.runner if sys.platform == "win32" and "pythonw.exe" in sys.executable: # Add the python**.zip path to sys.path if running from the version of Mu # installed via the official Windows installer. # See: #612 and #581 for cont...
import os import sys from mu.debugger.config import DEBUGGER_PORT import mu.debugger.runner if sys.platform == "win32" and "pythonw.exe" in sys.executable: # Add the python**.zip path to sys.path if running from the version of Mu # installed via the official Windows installer. # See: #612 and #581 for cont...
if filename is None: print("Debugger requires a Python script filename to run.") else: filepath = os.path.normcase(os.path.abspath(filename)) mu.debugger.runner.run("localhost", DEBUGGER_PORT, filepath, args)
""" Create a debug runner in a new process. This is what the Mu debugger will drive. Uses the filename and associated args found in sys.argv. """ if filename is None: print("Debugger requires a Python script filename to run.") else: filepath = os.path.normcase(os.path.abspat...
20
302
79
381
import os import sys from mu.debugger.config import DEBUGGER_PORT import mu.debugger.runner if sys.platform == "win32" and "pythonw.exe" in sys.executable: # Add the python**.zip path to sys.path if running from the version of Mu # installed via the official Windows installer. # See: #612 and #581 for cont...
import os import sys from mu.debugger.config import DEBUGGER_PORT import mu.debugger.runner if sys.platform == "win32" and "pythonw.exe" in sys.executable: # Add the python**.zip path to sys.path if running from the version of Mu # installed via the official Windows installer. # See: #612 and #581 for cont...
49,027
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku/SudokuSolver.py
217,218
186,240
solve
AlgorithmX
218,240
218,240
class AlgorithmX: """ Use Algorithm X with dancing links to solve a constraint satisfaction problem represented in the form of Exact Cover. Refer to https://en.wikipedia.org/wiki/Dancing_Links and https://en.wikipedia.org/wiki/Algorithm_X for the algorithm. """ def __init__(self, constrain...
class AlgorithmX: """ Use Algorithm X with dancing links to solve a constraint satisfaction problem represented in the form of Exact Cover. Refer to https://en.wikipedia.org/wiki/Dancing_Links and https://en.wikipedia.org/wiki/Algorithm_X for the algorithm. """ def __init__(self, constrain...
if self.root.right == self.root: # All constraints have been satisfied return True # Find column with least number of nodes header = min(self.root.loop('right'), key=attrgetter('value')) if header.value == 0: # No valid solution exists retu...
if self.root.right == self.root: # All constraints have been satisfied return True # Find column with least number of nodes header = min(self.root.loop('right'), key=attrgetter('value')) if header.value == 0: # No valid solution exists retu...
70
282
209
491
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
49,028
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku/SudokuSolver.py
125,126
98,186
insert_above
AlgorithmXNode
129,134
126,134
class AlgorithmXNode: def __init__(self, value=0): """ Create a node with self links. :param value: Serves multiple purposes: - nothing for root node - the number of cells in column for all header nodes - the row id in all other nodes """ s...
class AlgorithmXNode: def __init__(self, value=0): """ Create a node with self links. :param value: Serves multiple purposes: - nothing for root node - the number of cells in column for all header nodes - the row id in all other nodes """ s...
self.top = node.top self.up = node.up self.down = node self.insert_v()
""" Insert this node above the given node, in the column, updating the top. """ self.top = node.top self.up = node.up self.down = node self.insert_v()
10
757
39
796
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
49,029
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku
/home/hieuvd/dung_repo/raw/stars_03/neeru1207_AI_Sudoku/AI_Sudoku/SudokuSolver.py
46,48
4,98
solve_sudoku
Solver
63,98
48,98
class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9): if arr[row][col...
class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9): if arr[row][col...
# Represent the binary matrix as sparse matrix (has < 729 * 4 ones in a matrix of 729 * 342) positions = [] def add_position(ch, r, c, x): positions.append([ch, [ 9 * r + x, # Row constraint 81 + 9 * c + x, # Col constraint 162 + 9 *...
""" Create a binary matrix to convert to an exact cover problem. Choices: 729 Each cell can have any value from 1 to 9. Constraints: 324 1. Each row must have all the values from 1 to 9, total: 81 2. Each column must have all the values from 1 to 9, total: 81 ...
168
610
415
1,025
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
49,040
/home/hieuvd/dung_repo/raw/stars_03/ngerakines_commitment/commitment
/home/hieuvd/dung_repo/raw/stars_03/ngerakines_commitment/commitment/testing.py
27,28
1,62
fill_line
28,57
28,57
import random import re import os import sys messages = open("commit_messages.txt").read().split('\n') humans = open("static/humans.txt").read().split('\n') names = ['Nick', 'Steve', 'Andy', 'Qi', 'Fanny', 'Sarah', 'Cord', 'Todd', 'Chris', 'Pasha', 'Gabe', 'Tony', 'Jason', 'Randal', 'Ali', 'Kim', 'Rainer', '...
import random import re import os import sys messages = open("commit_messages.txt").read().split('\n') humans = open("static/humans.txt").read().split('\n') names = ['Nick', 'Steve', 'Andy', 'Qi', 'Fanny', 'Sarah', 'Cord', 'Todd', 'Chris', 'Pasha', 'Gabe', 'Tony', 'Jason', 'Randal', 'Ali', 'Kim', 'Rainer', '...
message = message.replace('XNAMEX', random.choice(names)) message = message.replace('XUPPERNAMEX', random.choice(names).upper()) message = message.replace('XLOWERNAMEX', random.choice(names).lower()) nums = num_re.findall(message) while nums: start = 1 end = 999 value = num...
message = message.replace('XNAMEX', random.choice(names)) message = message.replace('XUPPERNAMEX', random.choice(names).upper()) message = message.replace('XLOWERNAMEX', random.choice(names).lower()) nums = num_re.findall(message) while nums: start = 1 end = 999 value = num...
88
378
319
697
import random import re import os import sys messages = open("commit_messages.txt").read().split('\n') humans = open("static/humans.txt").read().split('\n') names = ['Nick', 'Steve', 'Andy', 'Qi', 'Fanny', 'Sarah', 'Cord', 'Todd', 'Chris', 'Pasha', 'Gabe', 'Tony', 'Jason', 'Randal', 'Ali', 'Kim', 'Rainer', '...
import random import re import os import sys messages = open("commit_messages.txt").read().split('\n') humans = open("static/humans.txt").read().split('\n') names = ['Nick', 'Steve', 'Andy', 'Qi', 'Fanny', 'Sarah', 'Cord', 'Todd', 'Chris', 'Pasha', 'Gabe', 'Tony', 'Jason', 'Randal', 'Ali', 'Kim', 'Rainer', '...
49,138
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/e2e_benchmarks/test_screenshot_commands.py
23,24
15,36
tearDown
TestScreenshot
24,29
24,29
class TestScreenshot(unittest.TestCase): def setUp(self): self.under_test_bundle_id = UNDER_TEST_BUNDLE_ID self.wda_client: wda.Client = wda.Client() self.app = self.wda_client.session(bundle_id=self.under_test_bundle_id) self.temp_file_pic = os.path.join(curPath, 'temp_file_pic.png...
class TestScreenshot(unittest.TestCase): def setUp(self): self.under_test_bundle_id = UNDER_TEST_BUNDLE_ID self.wda_client: wda.Client = wda.Client() self.app = self.wda_client.session(bundle_id=self.under_test_bundle_id) self.temp_file_pic = os.path.join(curPath, 'temp_file_pic.png...
self.app.orientation = wda.PORTRAIT self.wda_client.close() [os.remove(temp_file) for temp_file in [self.temp_file_pic] if os.path.exists(temp_file)]
self.app.orientation = wda.PORTRAIT self.wda_client.close() [os.remove(temp_file) for temp_file in [self.temp_file_pic] if os.path.exists(temp_file)]
11
209
71
280
''' WDA Screenshot Command Testing source code here: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Commands/FBScreenshotCommands.m WDA API document and example(not offical): https://documenter.getpostman.com/view/1837823/TVmMhJNB#bf7cb0a1-cc3b-4eb5-a9ee-1e7e63b55df1 ''' import os import unittes...
''' WDA Screenshot Command Testing source code here: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Commands/FBScreenshotCommands.m WDA API document and example(not offical): https://documenter.getpostman.com/view/1837823/TVmMhJNB#bf7cb0a1-cc3b-4eb5-a9ee-1e7e63b55df1 ''' import os import unittes...
49,139
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/exceptions.py
68,70
62,75
check
WDAInvalidSessionIdError
70,75
70,75
class WDAInvalidSessionIdError(WDARequestError): """ "value" : { "error" : "invalid session id", "message" : "Session does not exist", """ @staticmethod def check(v: dict): FILL_FUNC_BODY
class WDAInvalidSessionIdError(WDARequestError): """ "value" : { "error" : "invalid session id", "message" : "Session does not exist", """ @staticmethod def check(v: dict): FILL_FUNC_BODY
if v.get('error') == 'invalid session id': return True return False
if v.get('error') == 'invalid session id': return True return False
10
75
30
105
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
49,140
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/exceptions.py
54,56
47,62
check
WDAKeyboardNotPresentError
56,62
56,62
class WDAKeyboardNotPresentError(WDARequestError): # {'error': 'invalid element state', # 'message': 'Error Domain=com.facebook.WebDriverAgent Code=1 # "The on-screen keyboard must be present to send keys" # UserInfo={NSLocalizedDescription=The on-screen keyboard must be present to send keys...
class WDAKeyboardNotPresentError(WDARequestError): # {'error': 'invalid element state', # 'message': 'Error Domain=com.facebook.WebDriverAgent Code=1 # "The on-screen keyboard must be present to send keys" # UserInfo={NSLocalizedDescription=The on-screen keyboard must be present to send keys...
if v.get('error') == 'invalid element state' and \ 'keyboard must be present to send keys' in v.get('message', ''): return True return False
if v.get('error') == 'invalid element state' and \ 'keyboard must be present to send keys' in v.get('message', ''): return True return False
22
130
54
184
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
49,141
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/exceptions.py
76,78
75,83
check
WDAPossiblyCrashedError
78,83
78,83
class WDAPossiblyCrashedError(WDARequestError): @staticmethod def check(v: dict): FILL_FUNC_BODY
class WDAPossiblyCrashedError(WDARequestError): @staticmethod def check(v: dict): FILL_FUNC_BODY
if "possibly crashed" in v.get('message', ''): return True return False
if "possibly crashed" in v.get('message', ''): return True return False
10
42
33
75
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
49,142
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/exceptions.py
92,94
90,95
check
WDAStaleElementReferenceError
94,95
94,95
class WDAStaleElementReferenceError(WDARequestError): """ error: 'stale element reference' """ @staticmethod def check(v: dict): FILL_FUNC_BODY
class WDAStaleElementReferenceError(WDARequestError): """ error: 'stale element reference' """ @staticmethod def check(v: dict): FILL_FUNC_BODY
return v.get("error") == 'stale element reference'
return v.get("error") == 'stale element reference'
6
52
17
69
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
49,143
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/exceptions.py
85,87
83,90
check
WDAUnknownError
87,90
87,90
class WDAUnknownError(WDARequestError): """ error: unknown error, message: *** - """ @staticmethod def check(v: dict): FILL_FUNC_BODY
class WDAUnknownError(WDARequestError): """ error: unknown error, message: *** - """ @staticmethod def check(v: dict): FILL_FUNC_BODY
return v.get("error") == "unknown error"
return v.get("error") == "unknown error"
5
50
19
69
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
import json from os import stat JSONDecodeError = json.decoder.JSONDecodeError if hasattr( json.decoder, "JSONDecodeError") else ValueError class MuxError(Exception): """ Mutex error """ class MuxConnectError(MuxError, ConnectionError): """ Error when MessageType: Connect """ class WDAError(Exceptio...
49,144
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/requests_usbmux.py
77,78
70,102
get_connection
UsbmuxAdapter
78,95
78,95
class UsbmuxAdapter(HTTPAdapter): def __init__(self, timeout=60, pool_connections=25, *args, **kwargs): super(UsbmuxAdapter, self).__init__(*args, **kwargs) self.timeout = timeout self.pools = urllib3._collections.RecentlyUsedContainer( pool_connections, dispose_func=lambda p: p....
class UsbmuxAdapter(HTTPAdapter): def __init__(self, timeout=60, pool_connections=25, *args, **kwargs): super(UsbmuxAdapter, self).__init__(*args, **kwargs) self.timeout = timeout self.pools = urllib3._collections.RecentlyUsedContainer( pool_connections, dispose_func=lambda p: p....
proxies = proxies or {} proxy = proxies.get(urlparse(url.lower()).scheme) if proxy: raise ValueError('%s does not support specifying proxies' % self.__class__.__name__) with self.pools.lock: pool = self.pools.get(url) if ...
proxies = proxies or {} proxy = proxies.get(urlparse(url.lower()).scheme) if proxy: raise ValueError('%s does not support specifying proxies' % self.__class__.__name__) with self.pools.lock: pool = self.pools.get(url) if ...
37
175
149
324
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
49,145
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/requests_usbmux.py
45,46
28,59
connect
UsbmuxHTTPConnection
46,59
46,59
class UsbmuxHTTPConnection(httplib.HTTPConnection, object): def __init__(self, usbmux_socket_url, timeout=60): """Create an HTTP connection to a unix domain socket :param usbmux_socket_url: A URL with a scheme of 'http+unix' and the netloc is a percent-encoded path to a unix domain socket. E...
class UsbmuxHTTPConnection(httplib.HTTPConnection, object): def __init__(self, usbmux_socket_url, timeout=60): """Create an HTTP connection to a unix domain socket :param usbmux_socket_url: A URL with a scheme of 'http+unix' and the netloc is a percent-encoded path to a unix domain socket. E...
netloc = unquote(urlparse(self.usbmux_socket_url).netloc) udid, port = splitport(netloc) if not port: port = 8100 # WDA Default port if not udid: udid = _usbmux.get_single_device_udid() _device = _usbmux.device(udid) conn = _device.create_inner_co...
netloc = unquote(urlparse(self.usbmux_socket_url).netloc) udid, port = splitport(netloc) if not port: port = 8100 # WDA Default port if not udid: udid = _usbmux.get_single_device_udid() _device = _usbmux.device(udid) conn = _device.create_inner_co...
33
270
158
428
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
49,146
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/requests_usbmux.py
66,67
59,70
_new_conn
UsbmuxHTTPConnectionPool
67,70
67,70
class UsbmuxHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool): def __init__(self, socket_path, timeout=60): super(UsbmuxHTTPConnectionPool, self).__init__('127.0.0.1', timeout=timeout) self.socket_path = socket_path self.time...
class UsbmuxHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool): def __init__(self, socket_path, timeout=60): super(UsbmuxHTTPConnectionPool, self).__init__('127.0.0.1', timeout=timeout) self.socket_path = socket_path self.time...
return UsbmuxHTTPConnection(self.socket_path, self.timeout)
return UsbmuxHTTPConnection(self.socket_path, self.timeout)
3
113
25
138
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
# # Thanks to: https://github.com/msabramo/requests-unixsocket # import socket import sys from urllib.parse import splitport, unquote, urlparse import requests import urllib3 from requests.adapters import HTTPAdapter # from requests.compat import unquote, urlparse from wda import usbmux try: import http.client ...
49,147
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/usbmux.py
215,216
191,244
create_inner_connection
Device
216,244
216,244
class Device(object): def __init__(self, udid: str, _usbmux=None): assert udid, "udid should not empty" self._usbmux = _usbmux or Usbmux() self._udid = udid self._info = self.info # DeviceID will be changed if device re-plug # So can not use cached_property here @propert...
class Device(object): def __init__(self, udid: str, _usbmux=None): assert udid, "udid should not empty" self._usbmux = _usbmux or Usbmux() self._udid = udid self._info = self.info # DeviceID will be changed if device re-plug # So can not use cached_property here @propert...
# I really donot know why do this # The following code convert port(0x1234) to port(0x3412) _port = ((port & 0xff) << 8) | (port >> 8) logger.debug("port convert %s(%d) -> %s(%d)", hex(port), port, hex(_port), _port) _original_port = port del (port) ...
# I really donot know why do this # The following code convert port(0x1234) to port(0x3412) _port = ((port & 0xff) << 8) | (port >> 8) logger.debug("port convert %s(%d) -> %s(%d)", hex(port), port, hex(_port), _port) _original_port = port del (port) ...
105
252
361
613
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
49,148
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/usbmux.py
88,89
63,107
recv_packet
PlistSocket
89,102
89,102
class PlistSocket(SafeStreamSocket): def __init__(self, addr: str, tag: int = 0): super().__init__(addr) self._tag = tag self._first = True def send_packet(self, payload: dict, reqtype: int = 8): """ Args: payload: required # The following args o...
class PlistSocket(SafeStreamSocket): def __init__(self, addr: str, tag: int = 0): super().__init__(addr) self._tag = tag self._first = True def send_packet(self, payload: dict, reqtype: int = 8): """ Args: payload: required # The following args o...
if self._first or header_size == 16: # first receive header = self.recvall(16) (length, version, resp, tag) = struct.unpack("IIII", header) length -= 16 # minus header length self._first = False else: header = self.recvall(4) (len...
if self._first or header_size == 16: # first receive header = self.recvall(16) (length, version, resp, tag) = struct.unpack("IIII", header) length -= 16 # minus header length self._first = False else: header = self.recvall(4) (len...
46
319
153
472
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
49,149
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/usbmux.py
49,50
20,63
sendall
SafeStreamSocket
50,52
50,52
class SafeStreamSocket(): def __init__(self, addr: Union[str, tuple, socket.socket]): """ Args: addr: can be /var/run/usbmuxd or (localhost, 27015) """ self._sock = None if isinstance(addr, socket.socket): self._sock = addr return i...
class SafeStreamSocket(): def __init__(self, addr: Union[str, tuple, socket.socket]): """ Args: addr: can be /var/run/usbmuxd or (localhost, 27015) """ self._sock = None if isinstance(addr, socket.socket): self._sock = addr return i...
return self._sock.sendall(data)
return self._sock.sendall(data)
2
368
16
384
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
49,150
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/usbmux.py
134,135
107,191
device_list
Usbmux
146,157
135,157
class Usbmux: def __init__(self, address: Optional[Union[str, tuple]] = None): if address is None: if os.name == "posix": # linux or darwin address = "/var/run/usbmuxd" elif os.name == "nt": # windows address = ('127.0.0.1', 27015) else: ...
class Usbmux: def __init__(self, address: Optional[Union[str, tuple]] = None): if address is None: if os.name == "posix": # linux or darwin address = "/var/run/usbmuxd" elif os.name == "nt": # windows address = ('127.0.0.1', 27015) else: ...
payload = { "MessageType": "ListDevices", # 必选 "ClientVersionString": "libusbmuxd 1.1.0", "ProgName": PROGRAM_NAME, "kLibUSBMuxVersion": 3, # "ProcessID": 0, # Xcode send it processID } data = self.send_recv(payload) _devices =...
""" Return example: [{'ConnectionSpeed': 480000000, 'ConnectionType': 'USB', 'DeviceID': 37, 'LocationID': 123456, 'ProductID': 4776, 'SerialNumber': 'xxx', 'UDID': 'xxx', 'USBSerialNumber': 'xxx'}}]} """ paylo...
43
708
151
859
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
# Created: codeskyblue 2020/05 # Inspired by: https://github.com/iOSForensics/pymobiledevice import logging import os import plistlib import socket import struct import sys from functools import lru_cache from typing import Optional, Union from .exceptions import MuxConnectError, MuxError PROGRAM_NAME = "facebook-w...
49,151
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda
/home/hieuvd/dung_repo/raw/stars_03/openatx_facebook-wda/facebook-wda/wda/utils.py
32,33
1,69
limit_call_depth
36,57
33,57
# coding: utf-8 import functools import typing import inspect def inject_call(fn, *args, **kwargs): """ Call function without known all the arguments Args: fn: function args: arguments kwargs: key-values Returns: as the fn returns """ assert callable(fn),...
# coding: utf-8 import functools import typing import inspect def inject_call(fn, *args, **kwargs): """ Call function without known all the arguments Args: fn: function args: arguments kwargs: key-values Returns: as the fn returns """ assert callable(fn),...
def wrapper(fn: typing.Callable): if not hasattr(fn, '_depth'): fn._depth = 0 @functools.wraps(fn) def _inner(*args, **kwargs): if fn._depth > n: raise RuntimeError("call depth exceed %d" % n) fn._depth += 1 try: ...
""" n = 0 means not allowed recursive call """ def wrapper(fn: typing.Callable): if not hasattr(fn, '_depth'): fn._depth = 0 @functools.wraps(fn) def _inner(*args, **kwargs): if fn._depth > n: raise RuntimeError("call depth exceed %d" % n)...
43
301
158
459
# coding: utf-8 import functools import typing import inspect def inject_call(fn, *args, **kwargs): """ Call function without known all the arguments Args: fn: function args: arguments kwargs: key-values Returns: as the fn returns """ assert callable(fn),...
# coding: utf-8 import functools import typing import inspect def inject_call(fn, *args, **kwargs): """ Call function without known all the arguments Args: fn: function args: arguments kwargs: key-values Returns: as the fn returns """ assert callable(fn),...
49,152
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/checks/cvss.py
7,8
6,45
execute
Cvss
8,45
8,45
class Cvss(BaseCheck): def execute(self): FILL_FUNC_BODY
class Cvss(BaseCheck): def execute(self): FILL_FUNC_BODY
old_metrics = self.cve_obj.json.get("metrics") new_metrics = self.cve_json.get("metrics") # Check the new CVSS scores new = {} if "cvssMetricV31" in new_metrics: new["v3"] = new_metrics["cvssMetricV31"][0]["cvssData"]["baseScore"] elif "cvssMetricV30" in new...
old_metrics = self.cve_obj.json.get("metrics") new_metrics = self.cve_json.get("metrics") # Check the new CVSS scores new = {} if "cvssMetricV31" in new_metrics: new["v3"] = new_metrics["cvssMetricV31"][0]["cvssData"]["baseScore"] elif "cvssMetricV30" in new...
104
26
543
569
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.extensions import db class Cvss(BaseCheck): def execute(self): FILL_FUNC_BODY
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.extensions import db class Cvss(BaseCheck): def execute(self): FILL_FUNC_BODY
49,153
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/checks/cwes.py
10,11
9,46
execute
Cwes
11,46
11,46
class Cwes(BaseCheck): def execute(self): FILL_FUNC_BODY
class Cwes(BaseCheck): def execute(self): FILL_FUNC_BODY
new_weaknesses = weaknesses_to_flat(self.cve_json.get("weaknesses")) old_weaknesses = weaknesses_to_flat(self.cve_obj.json.get("weaknesses")) payload = { "added": list(set(new_weaknesses) - set(old_weaknesses)), "removed": list(set(old_weaknesses) - set(new_weaknesses))...
new_weaknesses = weaknesses_to_flat(self.cve_json.get("weaknesses")) old_weaknesses = weaknesses_to_flat(self.cve_obj.json.get("weaknesses")) payload = { "added": list(set(new_weaknesses) - set(old_weaknesses)), "removed": list(set(old_weaknesses) - set(new_weaknesses))...
121
26
447
473
from opencve.checks import BaseCheck from opencve.commands import info from opencve.commands.utils import CveUtil from opencve.extensions import db from opencve.models.cwe import Cwe from opencve.utils import weaknesses_to_flat class Cwes(BaseCheck): def execute(self): FILL_FUNC_BODY
from opencve.checks import BaseCheck from opencve.commands import info from opencve.commands.utils import CveUtil from opencve.extensions import db from opencve.models.cwe import Cwe from opencve.utils import weaknesses_to_flat class Cwes(BaseCheck): def execute(self): FILL_FUNC_BODY
49,154
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/checks/first_time.py
7,8
6,19
execute
FirstTime
8,19
8,19
class FirstTime(BaseCheck): def execute(self): FILL_FUNC_BODY
class FirstTime(BaseCheck): def execute(self): FILL_FUNC_BODY
old_confs = vendors_conf_to_flat(self.cve_obj.json.get("configurations", [])) new_confs = vendors_conf_to_flat(self.cve_json.get("configurations", [])) payload = list(set(new_confs) - set(old_confs)) if payload: event = CveUtil.create_event( self.cve_obj, sel...
old_confs = vendors_conf_to_flat(self.cve_obj.json.get("configurations", [])) new_confs = vendors_conf_to_flat(self.cve_json.get("configurations", [])) payload = list(set(new_confs) - set(old_confs)) if payload: event = CveUtil.create_event( self.cve_obj, sel...
27
25
146
171
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.utils import vendors_conf_to_flat class FirstTime(BaseCheck): def execute(self): FILL_FUNC_BODY
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.utils import vendors_conf_to_flat class FirstTime(BaseCheck): def execute(self): FILL_FUNC_BODY
49,155
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/checks/summary.py
11,13
6,56
get_descriptions_payload
Summary
13,30
13,30
class Summary(BaseCheck): @staticmethod def get_flat_descriptions(descriptions): return {d["lang"]: d["value"] for d in descriptions} @staticmethod def get_descriptions_payload(old, new): FILL_FUNC_BODY def execute(self): old_summary = self.get_flat_descriptions(self.cve_obj.json["de...
class Summary(BaseCheck): @staticmethod def get_flat_descriptions(descriptions): return {d["lang"]: d["value"] for d in descriptions} @staticmethod def get_descriptions_payload(old, new): FILL_FUNC_BODY def execute(self): old_summary = self.get_flat_descriptions(self.cve_obj.json["de...
payload = {"changed": {}, "added": {}, "removed": {}} added = list(set(new.keys()) - set(old.keys())) payload["added"] = {lang: new[lang] for lang in added} removed = list(set(old.keys()) - set(new.keys())) payload["removed"] = {lang: old[lang] for lang in removed} for...
payload = {"changed": {}, "added": {}, "removed": {}} added = list(set(new.keys()) - set(old.keys())) payload["added"] = {lang: new[lang] for lang in added} removed = list(set(old.keys()) - set(new.keys())) payload["removed"] = {lang: old[lang] for lang in removed} for...
57
351
181
532
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.extensions import db class Summary(BaseCheck): @staticmethod def get_flat_descriptions(descriptions): return {d["lang"]: d["value"] for d in descriptions} @staticmethod def get_descriptions_payload(ol...
from opencve.checks import BaseCheck from opencve.commands.utils import CveUtil from opencve.extensions import db class Summary(BaseCheck): @staticmethod def get_flat_descriptions(descriptions): return {d["lang"]: d["value"] for d in descriptions} @staticmethod def get_descriptions_payload(ol...
49,156
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/models/cwe.py
12,14
5,20
short_id
Cwe
14,18
14,18
class Cwe(BaseModel): __tablename__ = "cwes" cwe_id = db.Column(db.String(), nullable=False, index=True) name = db.Column(db.String()) description = db.Column(db.String()) @property def short_id(self): FILL_FUNC_BODY def __repr__(self): return "<Cwe {}>".format(self.cwe_id)
class Cwe(BaseModel): __tablename__ = "cwes" cwe_id = db.Column(db.String(), nullable=False, index=True) name = db.Column(db.String()) description = db.Column(db.String()) @property def short_id(self): FILL_FUNC_BODY def __repr__(self): return "<Cwe {}>".format(self.cwe_id)
if not self.cwe_id.startswith("CWE-"): return None return self.cwe_id.split("CWE-")[1]
if not self.cwe_id.startswith("CWE-"): return None return self.cwe_id.split("CWE-")[1]
7
122
47
169
from opencve.extensions import db from opencve.models import BaseModel class Cwe(BaseModel): __tablename__ = "cwes" cwe_id = db.Column(db.String(), nullable=False, index=True) name = db.Column(db.String()) description = db.Column(db.String()) @property def short_id(self): FILL_FUNC_BODY d...
from opencve.extensions import db from opencve.models import BaseModel class Cwe(BaseModel): __tablename__ = "cwes" cwe_id = db.Column(db.String(), nullable=False, index=True) name = db.Column(db.String()) description = db.Column(db.String()) @property def short_id(self): FILL_FUNC_BODY d...
49,157
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve
/home/hieuvd/dung_repo/raw/stars_03/opencve_opencve/opencve/opencve/models/vendors.py
15,17
6,21
human_name
Vendor
17,19
17,19
class Vendor(BaseModel): __tablename__ = "vendors" name = db.Column(db.String(), nullable=False, unique=True) # Relationships products = db.relationship("Product", back_populates="vendor") users = db.relationship("User", secondary=users_vendors) @property def human_name(self): FILL_FUNC_B...
class Vendor(BaseModel): __tablename__ = "vendors" name = db.Column(db.String(), nullable=False, unique=True) # Relationships products = db.relationship("Product", back_populates="vendor") users = db.relationship("User", secondary=users_vendors) @property def human_name(self): FILL_FUNC_B...
return _humanize_filter(self.name)
return _humanize_filter(self.name)
2
136
16
152
from opencve.context import _humanize_filter from opencve.extensions import db from opencve.models import BaseModel, users_vendors class Vendor(BaseModel): __tablename__ = "vendors" name = db.Column(db.String(), nullable=False, unique=True) # Relationships products = db.relationship("Product", back_...
from opencve.context import _humanize_filter from opencve.extensions import db from opencve.models import BaseModel, users_vendors class Vendor(BaseModel): __tablename__ = "vendors" name = db.Column(db.String(), nullable=False, unique=True) # Relationships products = db.relationship("Product", back_...
49,158
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget/gget/compile.py
27,28
1,93
compile_muscle
32,93
28,93
import os import subprocess import sys import platform import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) ...
import os import subprocess import sys import platform import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) ...
if platform.system() != "Linux" and platform.system() != "Darwin": raise OSError( f"Muscle compiler currently only supports Linux and Darwin, not {platform.system()}.\n" ) logging.info("Compiling MUSCLE binary from source... ") # Record current working directory cwd = os.g...
""" Compiles MUSCLE from source. Currently only supports Linux and Darwin. """ if platform.system() != "Linux" and platform.system() != "Darwin": raise OSError( f"Muscle compiler currently only supports Linux and Darwin, not {platform.system()}.\n" ) logging.info("C...
230
265
787
1,052
import os import subprocess import sys import platform import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) ...
import os import subprocess import sys import platform import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) ...
49,166
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget/gget/gget_gpt.py
13,27
1,121
gpt
60,121
27,121
import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) def gpt( prompt, api_key, model="gpt-3.5-t...
import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) def gpt( prompt, api_key, model="gpt-3.5-t...
# Check if cellxgene_census is installed try: import openai except ImportError: logging.error( """ Some third-party dependencies are missing. Please run the following command: >>> gget.setup('gpt') or $ gget setup gpt Alternative: Install the...
""" Generates natural language text based on a given prompt using the OpenAI API's 'openai.ChatCompletion.create' endpoint. Parameters: - prompt (str): The input prompt to generate text from. - api_key (str): Your OpenAI API key (see: https://platform.openai.com/account/api-k...
117
837
562
1,399
import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) def gpt( prompt, api_key, model="gpt-3.5-t...
import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr").setLevel(logging.WARNING) def gpt( prompt, api_key, model="gpt-3.5-t...
49,169
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget/gget/gget_pdb.py
18,19
1,147
pdb
42,147
19,147
from urllib.request import urlopen from urllib.error import HTTPError import json import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr")....
from urllib.request import urlopen from urllib.error import HTTPError import json import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr")....
# Check if resource argument is valid resources = [ "pdb", "entry", "pubmed", "assembly", "branched_entity", "nonpolymer_entity", "polymer_entity", "uniprot", "branched_entity_instance", "polymer_entity_instance", "nonpolym...
""" Query RCSB PDB for the protein structutre/metadata of a given PDB ID. Args: - pdb_id PDB ID to be queried (str), e.g. "7S7U". - resource Defines type of information to be returned. "pdb": Returns the protein structure in PDB format (default). ...
332
618
1,103
1,721
from urllib.request import urlopen from urllib.error import HTTPError import json import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr")....
from urllib.request import urlopen from urllib.error import HTTPError import json import logging # Add and format time stamp in logging messages logging.basicConfig( format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO, datefmt="%c", ) # Mute numexpr threads info logging.getLogger("numexpr")....
49,172
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget
/home/hieuvd/dung_repo/raw/stars_03/pachterlab_gget/gget/setup.py
5,6
1,46
read
6,10
6,10
from setuptools import setup, find_packages from gget.__init__ import __version__, __author__, __email__ def read(path): FILL_FUNC_BODYlong_description = read("README.md") setup( name="gget", version=__version__, license="BSD-2", author=__author__, author_email=__email__, maintainer=__author_...
from setuptools import setup, find_packages from gget.__init__ import __version__, __author__, __email__ def read(path): FILL_FUNC_BODYlong_description = read("README.md") setup( name="gget", version=__version__, license="BSD-2", author=__author__, author_email=__email__, maintainer=__author_...
with open(path, "r") as f: return f.read()
with open(path, "r") as f: return f.read()
7
441
26
467
from setuptools import setup, find_packages from gget.__init__ import __version__, __author__, __email__ def read(path): FILL_FUNC_BODYlong_description = read("README.md") setup( name="gget", version=__version__, license="BSD-2", author=__author__, author_email=__email__, maintainer=__author_...
from setuptools import setup, find_packages from gget.__init__ import __version__, __author__, __email__ def read(path): FILL_FUNC_BODYlong_description = read("README.md") setup( name="gget", version=__version__, license="BSD-2", author=__author__, author_email=__email__, maintainer=__author_...
49,316
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/alert.py
64,65
10,98
stop
AlertListener
69,72
65,72
class AlertListener(threading.Thread): """ Creates a websocket connection to the PlexServer to optionally receive alert notifications. These often include messages from Plex about media scans as well as updates to currently running Transcode Sessions. This class implements threading.Thread, therefor...
class AlertListener(threading.Thread): """ Creates a websocket connection to the PlexServer to optionally receive alert notifications. These often include messages from Plex about media scans as well as updates to currently running Transcode Sessions. This class implements threading.Thread, therefor...
log.info('Stopping AlertListener.') self._ws.close()
""" Stop the AlertListener thread. Once the notifier is stopped, it cannot be directly started again. You must call :func:`~plexapi.server.PlexServer.startAlertListener` from a PlexServer instance. """ log.info('Stopping AlertListener.') self._ws.close()
3
998
25
1,023
# -*- coding: utf-8 -*- import json import socket from typing import Callable import threading from plexapi import log class AlertListener(threading.Thread): """ Creates a websocket connection to the PlexServer to optionally receive alert notifications. These often include messages from Plex about media ...
# -*- coding: utf-8 -*- import json import socket from typing import Callable import threading from plexapi import log class AlertListener(threading.Thread): """ Creates a websocket connection to the PlexServer to optionally receive alert notifications. These often include messages from Plex about media ...
49,317
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/audio.py
358,359
292,417
track
Album
368,379
359,379
@utils.registerPlexObject class Album( Audio, SplitMergeMixin, UnmatchMatchMixin, RatingMixin, ArtMixin, PosterMixin, ThemeUrlMixin, AlbumEditMixins ): """ Represents a single Album. Attributes: TAG (str): 'Directory' TYPE (str): 'album' collections (List...
@utils.registerPlexObject class Album( Audio, SplitMergeMixin, UnmatchMatchMixin, RatingMixin, ArtMixin, PosterMixin, ThemeUrlMixin, AlbumEditMixins ): """ Represents a single Album. Attributes: TAG (str): 'Directory' TYPE (str): 'album' collections (List...
key = f'{self.key}/children' if title is not None and not isinstance(title, int): return self.fetchItem(key, Track, title__iexact=title) elif track is not None or isinstance(title, int): if isinstance(title, int): index = title else: ...
""" Returns the :class:`~plexapi.audio.Track` that matches the specified title. Parameters: title (str): Title of the track to return. track (int): Track number (default: None; required if title not specified). Raises: :exc:`~plexapi.exce...
47
1,691
142
1,833
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
49,318
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/audio.py
237,238
170,292
track
Artist
248,255
238,255
@utils.registerPlexObject class Artist( Audio, AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, RatingMixin, ArtMixin, PosterMixin, ThemeMixin, ArtistEditMixins ): """ Represents a single Artist. Attributes: TAG (str): 'Directory' TY...
@utils.registerPlexObject class Artist( Audio, AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, RatingMixin, ArtMixin, PosterMixin, ThemeMixin, ArtistEditMixins ): """ Represents a single Artist. Attributes: TAG (str): 'Directory' TY...
key = f'{self.key}/allLeaves' if title is not None: return self.fetchItem(key, Track, title__iexact=title) elif album is not None and track is not None: return self.fetchItem(key, Track, parentTitle__iexact=album, index=track) raise BadRequest('Missing argument: t...
""" Returns the :class:`~plexapi.audio.Track` that matches the specified title. Parameters: title (str): Title of the track to return. album (str): Album name (default: None; required if title not specified). track (int): Track number (default: None; ...
37
1,547
107
1,654
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
49,321
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/audio.py
575,576
568,579
_loadData
TrackHistory
577,579
576,579
@utils.registerPlexObject class TrackHistory(PlexHistory, Track): """ Represents a single Track history entry loaded from :func:`~plexapi.server.PlexServer.history`. """ _HISTORYTYPE = True def _loadData(self, data): FILL_FUNC_BODY
@utils.registerPlexObject class TrackHistory(PlexHistory, Track): """ Represents a single Track history entry loaded from :func:`~plexapi.server.PlexServer.history`. """ _HISTORYTYPE = True def _loadData(self, data): """ Load attribute values from Plex XML response. """ FILL_FUNC_BODY
Track._loadData(self, data) PlexHistory._loadData(self, data)
""" Load attribute values from Plex XML response. """ Track._loadData(self, data) PlexHistory._loadData(self, data)
4
97
26
123
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
49,322
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/audio.py
562,563
555,568
_loadData
TrackSession
564,568
563,568
@utils.registerPlexObject class TrackSession(PlexSession, Track): """ Represents a single Track session loaded from :func:`~plexapi.server.PlexServer.sessions`. """ _SESSIONTYPE = True def _loadData(self, data): FILL_FUNC_BODY
@utils.registerPlexObject class TrackSession(PlexSession, Track): """ Represents a single Track session loaded from :func:`~plexapi.server.PlexServer.sessions`. """ _SESSIONTYPE = True def _loadData(self, data): """ Load attribute values from Plex XML response. """ FILL_FUNC_BODY
Track._loadData(self, data) PlexSession._loadData(self, data)
""" Load attribute values from Plex XML response. """ Track._loadData(self, data) PlexSession._loadData(self, data)
4
95
30
125
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
# -*- coding: utf-8 -*- from __future__ import annotations import os from pathlib import Path from urllib.parse import quote_plus from typing import Any, Dict, List, Optional, TypeVar from plexapi import media, utils from plexapi.base import Playable, PlexPartialObject, PlexHistory, PlexSession from plexapi.exceptio...
49,323
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/client.py
608,609
603,639
_loadData
ClientTimeline
609,639
609,639
class ClientTimeline(PlexObject): """Get the timeline's attributes.""" key = 'timeline/poll' def _loadData(self, data): FILL_FUNC_BODY
class ClientTimeline(PlexObject): """Get the timeline's attributes.""" key = 'timeline/poll' def _loadData(self, data): FILL_FUNC_BODY
self._data = data self.address = data.attrib.get('address') self.audioStreamId = utils.cast(int, data.attrib.get('audioStreamId')) self.autoPlay = utils.cast(bool, data.attrib.get('autoPlay')) self.containerKey = data.attrib.get('containerKey') self.controllable = data.at...
self._data = data self.address = data.attrib.get('address') self.audioStreamId = utils.cast(int, data.attrib.get('audioStreamId')) self.autoPlay = utils.cast(bool, data.attrib.get('autoPlay')) self.containerKey = data.attrib.get('containerKey') self.controllable = data.at...
105
55
631
686
# -*- coding: utf-8 -*- import time import weakref from xml.etree import ElementTree import requests from plexapi import BASE_HEADERS, CONFIG, TIMEOUT, log, logfilter, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest, NotFound, Unauthorized, Unsupported from plexapi.playqueue import...
# -*- coding: utf-8 -*- import time import weakref from xml.etree import ElementTree import requests from plexapi import BASE_HEADERS, CONFIG, TIMEOUT, log, logfilter, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest, NotFound, Unauthorized, Unsupported from plexapi.playqueue import...
49,326
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/config.py
54,55
1,70
reset_base_headers
56,70
55,70
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
import plexapi return { 'X-Plex-Platform': plexapi.X_PLEX_PLATFORM, 'X-Plex-Platform-Version': plexapi.X_PLEX_PLATFORM_VERSION, 'X-Plex-Provides': plexapi.X_PLEX_PROVIDES, 'X-Plex-Product': plexapi.X_PLEX_PRODUCT, 'X-Plex-Version': plexapi.X_PLEX_VERSION, 'X-Plex-...
""" Convenience function returns a dict of all base X-Plex-* headers for session requests. """ import plexapi return { 'X-Plex-Platform': plexapi.X_PLEX_PLATFORM, 'X-Plex-Platform-Version': plexapi.X_PLEX_PLATFORM_VERSION, 'X-Plex-Provides': plexapi.X_PLEX_PROVIDES, 'X-Plex-P...
27
539
281
820
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
49,327
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/config.py
24,25
9,54
get
PlexConfig
32,44
25,44
class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing plexapi by simply setting the value. See the documentation section 'Configuration' for more details on available options...
class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing plexapi by simply setting the value. See the documentation section 'Configuration' for more details on available options...
try: # First: check environment variable is set envkey = f"PLEXAPI_{key.upper().replace('.', '_')}" value = os.environ.get(envkey) if value is None: # Second: check the config file has attr section, name = key.lower().split('.') ...
""" Returns the specified configuration value or <default> if not found. Parameters: key (str): Configuration variable to load in the format '<section>.<variable>'. default: Default value to use if key not found. cast (func): Cast the value to the spe...
49
329
149
478
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
# -*- coding: utf-8 -*- import os from collections import defaultdict from configparser import ConfigParser from plexapi import utils class PlexConfig(ConfigParser): """ PlexAPI configuration object. Settings are stored in an INI file within the user's home directory and can be overridden after importing...
49,328
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/gdm.py
135,136
1,152
main
137,150
136,150
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
from pprint import pprint gdm = GDM() pprint("Scanning GDM for servers...") gdm.scan() pprint(gdm.entries) pprint("Scanning GDM for clients...") gdm.scan(scan_for_clients=True) pprint(gdm.entries)
"""Test GDM discovery.""" from pprint import pprint gdm = GDM() pprint("Scanning GDM for servers...") gdm.scan() pprint(gdm.entries) pprint("Scanning GDM for clients...") gdm.scan(scan_for_clients=True) pprint(gdm.entries)
19
1,503
105
1,608
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
49,329
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/gdm.py
50,51
15,135
update
GDM
83,135
51,135
class GDM: """Base class to discover GDM services. Attributes: entries (List<dict>): List of server and/or client data discovered. """ def __init__(self): self.entries = [] def scan(self, scan_for_clients=False): """Scan the network.""" self.update(scan_for_c...
class GDM: """Base class to discover GDM services. Attributes: entries (List<dict>): List of server and/or client data discovered. """ def __init__(self): self.entries = [] def scan(self, scan_for_clients=False): """Scan the network.""" self.update(scan_for_c...
gdm_msg = 'M-SEARCH * HTTP/1.0'.encode('ascii') gdm_timeout = 1 self.entries = [] known_responses = [] # setup socket for discovery -> multicast message sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(gdm_timeout) # Set the time...
"""Scan for new GDM services. Examples of the dict list assigned to self.entries by this function: Server: [{'data': { 'Content-Type': 'plex/media-server', 'Host': '53f4b5b6023d41182fe88a99b0e714ba.plex.direct', ...
148
758
624
1,382
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
""" Support for discovery using GDM (Good Day Mate), multicast protocol by Plex. # Licensed Apache 2.0 # From https://github.com/home-assistant/netdisco/netdisco/gdm.py Inspired by: hippojay's plexGDM: https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py iBaa's PlexConnect: https://github.co...
49,330
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1215,1216
1181,1225
settings
Agent
1216,1220
1216,1220
@utils.registerPlexObject class Agent(PlexObject): """ Represents a single Agent. Attributes: TAG (str): 'Agent' """ TAG = 'Agent' def __repr__(self): uid = self._clean(self.firstAttr('shortIdentifier')) return f"<{':'.join([p for p in [self.__class__.__name__, uid]...
@utils.registerPlexObject class Agent(PlexObject): """ Represents a single Agent. Attributes: TAG (str): 'Agent' """ TAG = 'Agent' def __repr__(self): uid = self._clean(self.firstAttr('shortIdentifier')) return f"<{':'.join([p for p in [self.__class__.__name__, uid]...
key = f'/:/plugins/{self.identifier}/prefs' data = self._server.query(key) return self.findItems(data, cls=settings.Setting)
key = f'/:/plugins/{self.identifier}/prefs' data = self._server.query(key) return self.findItems(data, cls=settings.Setting)
9
395
50
445
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,331
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1242,1245
1225,1248
languageCode
AgentMediaType
1245,1248
1245,1248
class AgentMediaType(Agent): """ Represents a single Agent MediaType. Attributes: TAG (str): 'MediaType' """ TAG = 'MediaType' def __repr__(self): uid = self._clean(self.firstAttr('name')) return f"<{':'.join([p for p in [self.__class__.__name__, uid] if p])}>" ...
class AgentMediaType(Agent): """ Represents a single Agent MediaType. Attributes: TAG (str): 'MediaType' """ TAG = 'MediaType' def __repr__(self): uid = self._clean(self.firstAttr('name')) return f"<{':'.join([p for p in [self.__class__.__name__, uid] if p])}>" ...
return self.languageCodes
return self.languageCodes
2
219
13
232
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,332
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
399,400
368,433
_loadData
AudioStream
401,422
400,422
@utils.registerPlexObject class AudioStream(MediaPartStream): """ Represents a audio stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 2 audioChannelLayout (str): The audio channel layout of the audio stream (ex: 5.1(sid...
@utils.registerPlexObject class AudioStream(MediaPartStream): """ Represents a audio stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 2 audioChannelLayout (str): The audio channel layout of the audio stream (ex: 5.1(sid...
super(AudioStream, self)._loadData(data) self.audioChannelLayout = data.attrib.get('audioChannelLayout') self.bitDepth = utils.cast(int, data.attrib.get('bitDepth')) self.bitrateMode = data.attrib.get('bitrateMode') self.channels = utils.cast(int, data.attrib.get('channels')) ...
""" Load attribute values from Plex XML response. """ super(AudioStream, self)._loadData(data) self.audioChannelLayout = data.attrib.get('audioChannelLayout') self.bitDepth = utils.cast(int, data.attrib.get('bitDepth')) self.bitrateMode = data.attrib.get('bitrateMode') se...
69
521
433
954
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,333
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1271,1272
1248,1284
_loadData
Availability
1272,1284
1272,1284
@utils.registerPlexObject class Availability(PlexObject): """ Represents a single online streaming service Availability. Attributes: TAG (str): 'Availability' country (str): The streaming service country. offerType (str): Subscription, buy, or rent from the streaming ser...
@utils.registerPlexObject class Availability(PlexObject): """ Represents a single online streaming service Availability. Attributes: TAG (str): 'Availability' country (str): The streaming service country. offerType (str): Subscription, buy, or rent from the streaming ser...
self._data = data self.country = data.attrib.get('country') self.offerType = data.attrib.get('offerType') self.platform = data.attrib.get('platform') self.platformColorThumb = data.attrib.get('platformColorThumb') self.platformInfo = data.attrib.get('platformInfo') ...
self._data = data self.country = data.attrib.get('country') self.offerType = data.attrib.get('offerType') self.platform = data.attrib.get('platform') self.platformColorThumb = data.attrib.get('platformColorThumb') self.platformInfo = data.attrib.get('platformInfo') ...
37
288
207
495
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,334
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1030,1032
1001,1045
resourceFilepath
BaseResource
1035,1045
1032,1045
class BaseResource(PlexObject): """ Base class for all Art, Poster, and Theme objects. Attributes: TAG (str): 'Photo' or 'Track' key (str): API URL (/library/metadata/<ratingkey>). provider (str): The source of the resource. 'local' for local files (e.g. theme.mp3), ...
class BaseResource(PlexObject): """ Base class for all Art, Poster, and Theme objects. Attributes: TAG (str): 'Photo' or 'Track' key (str): API URL (/library/metadata/<ratingkey>). provider (str): The source of the resource. 'local' for local files (e.g. theme.mp3), ...
if self.ratingKey.startswith('media://'): return str(Path('Media') / 'localhost' / self.ratingKey.split('://')[-1]) elif self.ratingKey.startswith('metadata://'): return str(Path(self._parent().metadataDirectory) / 'Contents' / '_combined' / self.ratingKey.split('://')[-1]) ...
""" Returns the file path to the resource in the Plex Media Server data directory. Note: Returns the URL if the resource is not stored locally. """ if self.ratingKey.startswith('media://'): return str(Path('Media') / 'localhost' / self.ratingKey.split('://')[-1]) ...
29
400
165
565
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,335
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1084,1085
1060,1096
_loadData
Chapter
1085,1096
1085,1096
@utils.registerPlexObject class Chapter(PlexObject): """ Represents a single Chapter media tag. Attributes: TAG (str): 'Chapter' end (int): The end time of the chapter in milliseconds. filter (str): The library filter for the chapter. id (int): The ID of the ...
@utils.registerPlexObject class Chapter(PlexObject): """ Represents a single Chapter media tag. Attributes: TAG (str): 'Chapter' end (int): The end time of the chapter in milliseconds. filter (str): The library filter for the chapter. id (int): The ID of the ...
self._data = data self.end = utils.cast(int, data.attrib.get('endTimeOffset')) self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id', 0)) self.index = utils.cast(int, data.attrib.get('index')) self.tag = data.attrib.get('tag') self...
self._data = data self.end = utils.cast(int, data.attrib.get('endTimeOffset')) self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id', 0)) self.index = utils.cast(int, data.attrib.get('index')) self.tag = data.attrib.get('tag') self...
32
303
169
472
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,336
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
773,774
762,780
collection
Collection
776,780
774,780
@utils.registerPlexObject class Collection(MediaTag): """ Represents a single Collection media tag. Attributes: TAG (str): 'Collection' FILTER (str): 'collection' """ TAG = 'Collection' FILTER = 'collection' def collection(self): FILL_FUNC_BODY
@utils.registerPlexObject class Collection(MediaTag): """ Represents a single Collection media tag. Attributes: TAG (str): 'Collection' FILTER (str): 'collection' """ TAG = 'Collection' FILTER = 'collection' def collection(self): """ Return the :class:`~plex...
key = f'{self._librarySectionKey}/collections' return self.fetchItem(key, etag='Directory', index=self.id)
""" Return the :class:`~plexapi.collection.Collection` object for this collection tag. """ key = f'{self._librarySectionKey}/collections' return self.fetchItem(key, etag='Directory', index=self.id)
7
117
44
161
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,337
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
660,661
654,715
_loadData
Conversion
661,694
661,694
@utils.registerPlexObject class Conversion(PlexObject): """ Represents a Conversion item. Conversions are items queued for optimization or being actively optimized.""" TAG = 'Video' def _loadData(self, data): FILL_FUNC_BODY def remove(self): """ Remove Conversion from queue """ k...
@utils.registerPlexObject class Conversion(PlexObject): """ Represents a Conversion item. Conversions are items queued for optimization or being actively optimized.""" TAG = 'Video' def _loadData(self, data): FILL_FUNC_BODY def remove(self): """ Remove Conversion from queue """ k...
self._data = data self.addedAt = data.attrib.get('addedAt') self.art = data.attrib.get('art') self.chapterSource = data.attrib.get('chapterSource') self.contentRating = data.attrib.get('contentRating') self.duration = data.attrib.get('duration') self.generatorID =...
self._data = data self.addedAt = data.attrib.get('addedAt') self.art = data.attrib.get('art') self.chapterSource = data.attrib.get('chapterSource') self.contentRating = data.attrib.get('contentRating') self.duration = data.attrib.get('duration') self.generatorID =...
96
298
572
870
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,338
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1152,1153
1141,1158
_loadData
Field
1153,1158
1153,1158
@utils.registerPlexObject class Field(PlexObject): """ Represents a single Field. Attributes: TAG (str): 'Field' locked (bool): True if the field is locked. name (str): The name of the field. """ TAG = 'Field' def _loadData(self, data): FILL_FUNC_BODY
@utils.registerPlexObject class Field(PlexObject): """ Represents a single Field. Attributes: TAG (str): 'Field' locked (bool): True if the field is locked. name (str): The name of the field. """ TAG = 'Field' def _loadData(self, data): FILL_FUNC_BODY
self._data = data self.locked = utils.cast(bool, data.attrib.get('locked')) self.name = data.attrib.get('name')
self._data = data self.locked = utils.cast(bool, data.attrib.get('locked')) self.name = data.attrib.get('name')
10
99
53
152
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,339
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
946,947
936,952
_loadData
Guid
948,952
947,952
@utils.registerPlexObject class Guid(PlexObject): """ Represents a single Guid media tag. Attributes: TAG (str): 'Guid' id (id): The guid for external metadata sources (e.g. IMDB, TMDB, TVDB, MBID). """ TAG = 'Guid' def _loadData(self, data): FILL_FUNC_BODY
@utils.registerPlexObject class Guid(PlexObject): """ Represents a single Guid media tag. Attributes: TAG (str): 'Guid' id (id): The guid for external metadata sources (e.g. IMDB, TMDB, TVDB, MBID). """ TAG = 'Guid' def _loadData(self, data): """ Load attribute ...
self._data = data self.id = data.attrib.get('id')
""" Load attribute values from Plex XML response. """ self._data = data self.id = data.attrib.get('id')
6
123
28
151
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,340
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
495,496
481,504
_loadData
LyricStream
497,504
496,504
class LyricStream(MediaPartStream): """ Represents a lyric stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 4 format (str): The format of the lyric stream (ex: lrc). minLines (int): The minimum number of lin...
class LyricStream(MediaPartStream): """ Represents a lyric stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 4 format (str): The format of the lyric stream (ex: lrc). minLines (int): The minimum number of lin...
super(LyricStream, self)._loadData(data) self.format = data.attrib.get('format') self.minLines = utils.cast(int, data.attrib.get('minLines')) self.provider = data.attrib.get('provider') self.timed = utils.cast(bool, data.attrib.get('timed', '0'))
""" Load attribute values from Plex XML response. """ super(LyricStream, self)._loadData(data) self.format = data.attrib.get('format') self.minLines = utils.cast(int, data.attrib.get('minLines')) self.provider = data.attrib.get('provider') self.timed = utils.cast(bool, da...
17
204
109
313
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,341
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1129,1131
1096,1141
first
Marker
1132,1141
1131,1141
@utils.registerPlexObject class Marker(PlexObject): """ Represents a single Marker media tag. Attributes: TAG (str): 'Marker' end (int): The end time of the marker in milliseconds. final (bool): True if the marker is the final credits marker. id (int): The ID...
@utils.registerPlexObject class Marker(PlexObject): """ Represents a single Marker media tag. Attributes: TAG (str): 'Marker' end (int): The end time of the marker in milliseconds. final (bool): True if the marker is the final credits marker. id (int): The ID...
if self.type != 'credits': return None first = min( (marker for marker in self._parent().markers if marker.type == 'credits'), key=lambda m: m.start ) return first == self
""" Returns True if the marker in the first credits marker. """ if self.type != 'credits': return None first = min( (marker for marker in self._parent().markers if marker.type == 'credits'), key=lambda m: m.start ) return first == self
26
447
75
522
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,342
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
93,94
12,102
delete
Media
94,102
94,102
@utils.registerPlexObject class Media(PlexObject): """ Container object for all MediaPart objects. Provides useful data about the video or audio this media belong to such as video framerate, resolution, etc. Attributes: TAG (str): 'Media' aspectRatio (float): The aspect rati...
@utils.registerPlexObject class Media(PlexObject): """ Container object for all MediaPart objects. Provides useful data about the video or audio this media belong to such as video framerate, resolution, etc. Attributes: TAG (str): 'Media' aspectRatio (float): The aspect rati...
part = f'{self._parentKey}/media/{self.id}' try: return self._server.query(part, method=self._server._session.delete) except BadRequest: log.error("Failed to delete %s. This could be because you haven't allowed items to be deleted", part) raise
part = f'{self._parentKey}/media/{self.id}' try: return self._server.query(part, method=self._server._session.delete) except BadRequest: log.error("Failed to delete %s. This could be because you haven't allowed items to be deleted", part) raise
26
1,295
90
1,385
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,343
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
133,134
102,240
_loadData
MediaPart
135,160
134,160
@utils.registerPlexObject class MediaPart(PlexObject): """ Represents a single media part (often a single file) for the media this belongs to. Attributes: TAG (str): 'Part' accessible (bool): True if the file is accessible. audioProfile (str): The audio profile of the fi...
@utils.registerPlexObject class MediaPart(PlexObject): """ Represents a single media part (often a single file) for the media this belongs to. Attributes: TAG (str): 'Part' accessible (bool): True if the file is accessible. audioProfile (str): The audio profile of the fi...
self._data = data self.accessible = utils.cast(bool, data.attrib.get('accessible')) self.audioProfile = data.attrib.get('audioProfile') self.container = data.attrib.get('container') self.decision = data.attrib.get('decision') self.deepAnalysisVersion = utils.cast(int, dat...
""" Load attribute values from Plex XML response. """ self._data = data self.accessible = utils.cast(bool, data.attrib.get('accessible')) self.audioProfile = data.attrib.get('audioProfile') self.container = data.attrib.get('container') self.decision = data.attrib.get('dec...
84
1,424
518
1,942
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,344
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
263,264
240,286
_loadData
MediaPartStream
265,286
264,286
class MediaPartStream(PlexObject): """ Base class for media streams. These consist of video, audio, subtitles, and lyrics. Attributes: bitrate (int): The bitrate of the stream. codec (str): The codec of the stream (ex: srt, ac3, mpeg4). default (bool): True if this is th...
class MediaPartStream(PlexObject): """ Base class for media streams. These consist of video, audio, subtitles, and lyrics. Attributes: bitrate (int): The bitrate of the stream. codec (str): The codec of the stream (ex: srt, ac3, mpeg4). default (bool): True if this is th...
self._data = data self.bitrate = utils.cast(int, data.attrib.get('bitrate')) self.codec = data.attrib.get('codec') self.decision = data.attrib.get('decision') self.default = utils.cast(bool, data.attrib.get('default')) self.displayTitle = data.attrib.get('displayTitle') ...
""" Load attribute values from Plex XML response. """ self._data = data self.bitrate = utils.cast(int, data.attrib.get('bitrate')) self.codec = data.attrib.get('codec') self.decision = data.attrib.get('decision') self.default = utils.cast(bool, data.attrib.get('default'))...
66
396
382
778
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,345
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
735,736
715,762
_loadData
MediaTag
737,755
736,755
class MediaTag(PlexObject): """ Base class for media tags used for filtering and searching your library items or navigating the metadata of media items in your library. Tags are the construct used for things such as Country, Director, Genre, etc. Attributes: filter (str): The li...
class MediaTag(PlexObject): """ Base class for media tags used for filtering and searching your library items or navigating the metadata of media items in your library. Tags are the construct used for things such as Country, Director, Genre, etc. Attributes: filter (str): The li...
self._data = data self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id')) self.key = data.attrib.get('key') self.role = data.attrib.get('role') self.tag = data.attrib.get('tag') self.tagKey = data.attrib.get('tagKey') self....
""" Load attribute values from Plex XML response. """ self._data = data self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id')) self.key = data.attrib.get('key') self.role = data.attrib.get('role') self.tag = data.attrib.get('tag')...
48
392
279
671
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,346
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
622,623
616,654
_loadData
Optimized
623,631
623,631
@utils.registerPlexObject class Optimized(PlexObject): """ Represents a Optimized item. Optimized items are optimized and queued conversions items.""" TAG = 'Item' def _loadData(self, data): FILL_FUNC_BODY def items(self): """ Returns a list of all :class:`~plexapi.media.Video` objects ...
@utils.registerPlexObject class Optimized(PlexObject): """ Represents a Optimized item. Optimized items are optimized and queued conversions items.""" TAG = 'Item' def _loadData(self, data): FILL_FUNC_BODY def items(self): """ Returns a list of all :class:`~plexapi.media.Video` objects ...
self._data = data self.id = data.attrib.get('id') self.composite = data.attrib.get('composite') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.target = data.attrib.get('target') self.targetTagID = data.attrib.get('targetTagID')
self._data = data self.id = data.attrib.get('id') self.composite = data.attrib.get('composite') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.target = data.attrib.get('target') self.targetTagID = data.attrib.get('targetTagID')
21
336
112
448
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,347
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
966,967
952,974
_loadData
Rating
968,974
967,974
@utils.registerPlexObject class Rating(PlexObject): """ Represents a single Rating media tag. Attributes: TAG (str): 'Rating' image (str): The uri for the rating image (e.g. ``imdb://image.rating``, ``rottentomatoes://image.rating.ripe``, ``rottentoma...
@utils.registerPlexObject class Rating(PlexObject): """ Represents a single Rating media tag. Attributes: TAG (str): 'Rating' image (str): The uri for the rating image (e.g. ``imdb://image.rating``, ``rottentomatoes://image.rating.ripe``, ``rottentoma...
self._data = data self.image = data.attrib.get('image') self.type = data.attrib.get('type') self.value = utils.cast(float, data.attrib.get('value'))
""" Load attribute values from Plex XML response. """ self._data = data self.image = data.attrib.get('image') self.type = data.attrib.get('type') self.value = utils.cast(float, data.attrib.get('value'))
13
193
67
260
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,348
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
990,991
974,1001
_loadData
Review
991,1001
991,1001
@utils.registerPlexObject class Review(PlexObject): """ Represents a single Review for a Movie. Attributes: TAG (str): 'Review' filter (str): The library filter for the review. id (int): The ID of the review. image (str): The image uri for the review. ...
@utils.registerPlexObject class Review(PlexObject): """ Represents a single Review for a Movie. Attributes: TAG (str): 'Review' filter (str): The library filter for the review. id (int): The ID of the review. image (str): The image uri for the review. ...
self._data = data self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id', 0)) self.image = data.attrib.get('image') self.link = data.attrib.get('link') self.source = data.attrib.get('source') self.tag = data.attrib.get('tag') ...
self._data = data self.filter = data.attrib.get('filter') self.id = utils.cast(int, data.attrib.get('id', 0)) self.image = data.attrib.get('image') self.link = data.attrib.get('link') self.source = data.attrib.get('source') self.tag = data.attrib.get('tag') ...
26
165
134
299
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,349
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
1172,1173
1158,1181
_loadData
SearchResult
1173,1181
1173,1181
@utils.registerPlexObject class SearchResult(PlexObject): """ Represents a single SearchResult. Attributes: TAG (str): 'SearchResult' """ TAG = 'SearchResult' def __repr__(self): name = self._clean(self.firstAttr('name')) score = self._clean(self.firstAttr('score'))...
@utils.registerPlexObject class SearchResult(PlexObject): """ Represents a single SearchResult. Attributes: TAG (str): 'SearchResult' """ TAG = 'SearchResult' def __repr__(self): name = self._clean(self.firstAttr('name')) score = self._clean(self.firstAttr('score'))...
self._data = data self.guid = data.attrib.get('guid') self.lifespanEnded = data.attrib.get('lifespanEnded') self.name = data.attrib.get('name') self.score = utils.cast(int, data.attrib.get('score')) self.year = data.attrib.get('year')
self._data = data self.guid = data.attrib.get('guid') self.lifespanEnded = data.attrib.get('lifespanEnded') self.name = data.attrib.get('name') self.score = utils.cast(int, data.attrib.get('score')) self.year = data.attrib.get('year')
19
152
111
263
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,350
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
516,517
504,522
_loadData
Session
517,522
517,522
@utils.registerPlexObject class Session(PlexObject): """ Represents a current session. Attributes: TAG (str): 'Session' id (str): The unique identifier for the session. bandwidth (int): The Plex streaming brain reserved bandwidth for the session. location (st...
@utils.registerPlexObject class Session(PlexObject): """ Represents a current session. Attributes: TAG (str): 'Session' id (str): The unique identifier for the session. bandwidth (int): The Plex streaming brain reserved bandwidth for the session. location (st...
self.id = data.attrib.get('id') self.bandwidth = utils.cast(int, data.attrib.get('bandwidth')) self.location = data.attrib.get('location')
self.id = data.attrib.get('id') self.bandwidth = utils.cast(int, data.attrib.get('bandwidth')) self.location = data.attrib.get('location')
10
124
61
185
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,351
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
455,456
433,481
_loadData
SubtitleStream
457,470
456,470
@utils.registerPlexObject class SubtitleStream(MediaPartStream): """ Represents a audio stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 3 container (str): The container of the subtitle stream. forced (bool)...
@utils.registerPlexObject class SubtitleStream(MediaPartStream): """ Represents a audio stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 3 container (str): The container of the subtitle stream. forced (bool)...
super(SubtitleStream, self)._loadData(data) self.container = data.attrib.get('container') self.forced = utils.cast(bool, data.attrib.get('forced', '0')) self.format = data.attrib.get('format') self.headerCompression = data.attrib.get('headerCompression') self.hearingImpai...
""" Load attribute values from Plex XML response. """ super(SubtitleStream, self)._loadData(data) self.container = data.attrib.get('container') self.forced = utils.cast(bool, data.attrib.get('forced', '0')) self.format = data.attrib.get('format') self.headerCompression = ...
42
425
258
683
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,352
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
603,604
596,616
_loadData
TranscodeJob
604,616
604,616
@utils.registerPlexObject class TranscodeJob(PlexObject): """ Represents an Optimizing job. TrancodeJobs are the process for optimizing conversions. Active or paused optimization items. Usually one item as a time.""" TAG = 'TranscodeJob' def _loadData(self, data): FILL_FUNC_BODY
@utils.registerPlexObject class TranscodeJob(PlexObject): """ Represents an Optimizing job. TrancodeJobs are the process for optimizing conversions. Active or paused optimization items. Usually one item as a time.""" TAG = 'TranscodeJob' def _loadData(self, data): FILL_FUNC_BODY
self._data = data self.generatorID = data.attrib.get('generatorID') self.key = data.attrib.get('key') self.progress = data.attrib.get('progress') self.ratingKey = data.attrib.get('ratingKey') self.size = data.attrib.get('size') self.targetTagID = data.attrib.get('...
self._data = data self.generatorID = data.attrib.get('generatorID') self.key = data.attrib.get('key') self.progress = data.attrib.get('progress') self.ratingKey = data.attrib.get('ratingKey') self.size = data.attrib.get('size') self.targetTagID = data.attrib.get('...
30
91
164
255
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,353
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
561,562
522,596
_loadData
TranscodeSession
563,596
562,596
@utils.registerPlexObject class TranscodeSession(PlexObject): """ Represents a current transcode session. Attributes: TAG (str): 'TranscodeSession' audioChannels (int): The number of audio channels of the transcoded media. audioCodec (str): The audio codec of the transco...
@utils.registerPlexObject class TranscodeSession(PlexObject): """ Represents a current transcode session. Attributes: TAG (str): 'TranscodeSession' audioChannels (int): The number of audio channels of the transcoded media. audioCodec (str): The audio codec of the transco...
self._data = data self.audioChannels = utils.cast(int, data.attrib.get('audioChannels')) self.audioCodec = data.attrib.get('audioCodec') self.audioDecision = data.attrib.get('audioDecision') self.complete = utils.cast(bool, data.attrib.get('complete', '0')) self.container...
""" Load attribute values from Plex XML response. """ self._data = data self.audioChannels = utils.cast(int, data.attrib.get('audioChannels')) self.audioCodec = data.attrib.get('audioCodec') self.audioDecision = data.attrib.get('audioDecision') self.complete = utils.cast(...
112
599
727
1,326
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,354
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/media.py
330,331
286,368
_loadData
VideoStream
332,368
331,368
@utils.registerPlexObject class VideoStream(MediaPartStream): """ Represents a video stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 1 anamorphic (str): If the video is anamorphic. bitDepth (int): The bit d...
@utils.registerPlexObject class VideoStream(MediaPartStream): """ Represents a video stream within a :class:`~plexapi.media.MediaPart`. Attributes: TAG (str): 'Stream' STREAMTYPE (int): 1 anamorphic (str): If the video is anamorphic. bitDepth (int): The bit d...
super(VideoStream, self)._loadData(data) self.anamorphic = data.attrib.get('anamorphic') self.bitDepth = utils.cast(int, data.attrib.get('bitDepth')) self.cabac = utils.cast(int, data.attrib.get('cabac')) self.chromaLocation = data.attrib.get('chromaLocation') self.chroma...
""" Load attribute values from Plex XML response. """ super(VideoStream, self)._loadData(data) self.anamorphic = data.attrib.get('anamorphic') self.bitDepth = utils.cast(int, data.attrib.get('bitDepth')) self.cabac = utils.cast(int, data.attrib.get('cabac')) self.chromaLo...
121
747
826
1,573
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
# -*- coding: utf-8 -*- import xml from pathlib import Path from urllib.parse import quote_plus from plexapi import log, settings, utils from plexapi.base import PlexObject from plexapi.exceptions import BadRequest from plexapi.utils import deprecated @utils.registerPlexObject class Media(PlexObject): """ Contai...
49,355
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
555,556
552,570
editAddedAt
AddedAtMixin
563,570
556,570
class AddedAtMixin(EditFieldMixin): """ Mixin for Plex objects that can have an added at date. """ def editAddedAt(self, addedAt, locked=True): FILL_FUNC_BODY
class AddedAtMixin(EditFieldMixin): """ Mixin for Plex objects that can have an added at date. """ def editAddedAt(self, addedAt, locked=True): """ Edit the added at date. Parameters: addedAt (int or str or datetime): The new value as a unix timestamp (int), ...
if isinstance(addedAt, str): addedAt = int(round(datetime.strptime(addedAt, '%Y-%m-%d').timestamp())) elif isinstance(addedAt, datetime): addedAt = int(round(addedAt.timestamp())) return self.editField('addedAt', addedAt, locked=locked)
""" Edit the added at date. Parameters: addedAt (int or str or datetime): The new value as a unix timestamp (int), "YYYY-MM-DD" (str), or datetime object. locked (bool): True (default) to lock the field, False to unlock the field. """ ...
17
135
93
228
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,356
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
20,21
12,65
preference
AdvancedSettingsMixin
26,34
21,34
class AdvancedSettingsMixin: """ Mixin for Plex objects that can have advanced settings. """ def preferences(self): """ Returns a list of :class:`~plexapi.settings.Preferences` objects. """ data = self._server.query(self._details_key) return self.findItems(data, settings.Preferences, rt...
class AdvancedSettingsMixin: """ Mixin for Plex objects that can have advanced settings. """ def preferences(self): """ Returns a list of :class:`~plexapi.settings.Preferences` objects. """ data = self._server.query(self._details_key) return self.findItems(data, settings.Preferences, rt...
prefs = self.preferences() try: return next(p for p in prefs if p.id == pref) except StopIteration: availablePrefs = [p.id for p in prefs] raise NotFound(f'Unknown preference "{pref}" for {self.TYPE}. ' f'Available preferences: {avai...
""" Returns a :class:`~plexapi.settings.Preferences` object for the specified pref. Parameters: pref (str): The id of the preference to return. """ prefs = self.preferences() try: return next(p for p in prefs if p.id == pref) except StopIt...
35
491
100
591
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,357
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
370,371
363,375
unlockArt
ArtLockMixin
372,375
371,375
class ArtLockMixin: """ Mixin for Plex objects that can have a locked background artwork. """ def lockArt(self): """ Lock the background artwork for a Plex object. """ return self._edit(**{'art.locked': 1}) def unlockArt(self): FILL_FUNC_BODY
class ArtLockMixin: """ Mixin for Plex objects that can have a locked background artwork. """ def lockArt(self): """ Lock the background artwork for a Plex object. """ return self._edit(**{'art.locked': 1}) def unlockArt(self): """ Unlock the background artwork for a Plex object. "...
return self._edit(**{'art.locked': 0})
""" Unlock the background artwork for a Plex object. """ return self._edit(**{'art.locked': 0})
3
99
22
121
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,358
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
382,383
375,408
uploadArt
ArtMixin
389,398
383,398
class ArtMixin(ArtUrlMixin, ArtLockMixin): """ Mixin for Plex objects that can have background artwork. """ def arts(self): """ Returns list of available :class:`~plexapi.media.Art` objects. """ return self.fetchItems(f'/library/metadata/{self.ratingKey}/arts', cls=media.Art) def uploadArt...
class ArtMixin(ArtUrlMixin, ArtLockMixin): """ Mixin for Plex objects that can have background artwork. """ def arts(self): """ Returns list of available :class:`~plexapi.media.Art` objects. """ return self.fetchItems(f'/library/metadata/{self.ratingKey}/arts', cls=media.Art) def uploadArt...
if url: key = f'/library/metadata/{self.ratingKey}/arts?url={quote_plus(url)}' self._server.query(key, method=self._server._session.post) elif filepath: key = f'/library/metadata/{self.ratingKey}/arts' data = openOrRead(filepath) self._server.q...
""" Upload a background artwork from a url or filepath. Parameters: url (str): The full URL to the image to upload. filepath (str): The full file path the the image to upload or file-like object. """ if url: key = f'/library/metadata/{self...
20
246
124
370
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,359
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
356,358
353,363
artUrl
ArtUrlMixin
359,363
358,363
class ArtUrlMixin: """ Mixin for Plex objects that can have a background artwork url. """ @property def artUrl(self): FILL_FUNC_BODY
class ArtUrlMixin: """ Mixin for Plex objects that can have a background artwork url. """ @property def artUrl(self): """ Return the art url for the Plex object. """ FILL_FUNC_BODY
art = self.firstAttr('art', 'grandparentArt') return self._server.url(art, includeToken=True) if art else None
""" Return the art url for the Plex object. """ art = self.firstAttr('art', 'grandparentArt') return self._server.url(art, includeToken=True) if art else None
11
62
42
104
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,360
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
843,844
840,862
addCollection
CollectionMixin
850,852
844,852
class CollectionMixin(EditTagsMixin): """ Mixin for Plex objects that can have collections. """ def addCollection(self, collections, locked=True): FILL_FUNC_BODY def removeCollection(self, collections, locked=True): """ Remove a collection tag(s). Parameters: collections...
class CollectionMixin(EditTagsMixin): """ Mixin for Plex objects that can have collections. """ def addCollection(self, collections, locked=True): """ Add a collection tag(s). Parameters: collections (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. ...
return self.editTags('collection', collections, locked=locked)
""" Add a collection tag(s). Parameters: collections (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. locked (bool): True (default) to lock the field, False to unlock the field. """ return self.editTags('collection', collections, l...
4
228
20
248
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,361
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
573,574
570,583
editContentRating
ContentRatingMixin
580,583
574,583
class ContentRatingMixin(EditFieldMixin): """ Mixin for Plex objects that can have a content rating. """ def editContentRating(self, contentRating, locked=True): FILL_FUNC_BODY
class ContentRatingMixin(EditFieldMixin): """ Mixin for Plex objects that can have a content rating. """ def editContentRating(self, contentRating, locked=True): """ Edit the content rating. Parameters: contentRating (str): The new value. locked (bool): True...
return self.editField('contentRating', contentRating, locked=locked)
""" Edit the content rating. Parameters: contentRating (str): The new value. locked (bool): True (default) to lock the field, False to unlock the field. """ return self.editField('contentRating', contentRating, locked=locked)
4
109
26
135
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,362
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
874,875
862,884
removeCountry
CountryMixin
881,884
875,884
class CountryMixin(EditTagsMixin): """ Mixin for Plex objects that can have countries. """ def addCountry(self, countries, locked=True): """ Add a country tag(s). Parameters: countries (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. lock...
class CountryMixin(EditTagsMixin): """ Mixin for Plex objects that can have countries. """ def addCountry(self, countries, locked=True): """ Add a country tag(s). Parameters: countries (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. lock...
return self.editTags('country', countries, locked=locked, remove=True)
""" Remove a country tag(s). Parameters: countries (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. locked (bool): True (default) to lock the field, False to unlock the field. """ return self.editTags('country', countries, locked=l...
5
223
26
249
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
49,363
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi
/home/hieuvd/dung_repo/raw/stars_03/pkkid_python-plexapi/python-plexapi/plexapi/mixins.py
896,897
884,906
removeDirector
DirectorMixin
903,906
897,906
class DirectorMixin(EditTagsMixin): """ Mixin for Plex objects that can have directors. """ def addDirector(self, directors, locked=True): """ Add a director tag(s). Parameters: directors (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. l...
class DirectorMixin(EditTagsMixin): """ Mixin for Plex objects that can have directors. """ def addDirector(self, directors, locked=True): """ Add a director tag(s). Parameters: directors (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. l...
return self.editTags('director', directors, locked=locked, remove=True)
""" Remove a director tag(s). Parameters: directors (List<str> or List<:class:`~plexapi.media.MediaTag`>): List of tags. locked (bool): True (default) to lock the field, False to unlock the field. """ return self.editTags('director', directors, locked...
5
226
27
253
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...
# -*- coding: utf-8 -*- from collections import deque from datetime import datetime from typing import Deque, Set, Tuple, Union from urllib.parse import parse_qsl, quote, quote_plus, unquote, urlencode, urlsplit from plexapi import media, settings, utils from plexapi.exceptions import BadRequest, NotFound from plexapi...