index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
723,947
fiscalyear
_check_fiscal_day
Check if ``day`` is a valid day of the fiscal year. :param fiscal_year: The fiscal year to test :param fiscal_day: The fiscal day to test :return: The fiscal day :raises ValueError: If ``year`` or ``day`` is out of range
def _check_fiscal_day(fiscal_year: int, fiscal_day: int) -> int: """Check if ``day`` is a valid day of the fiscal year. :param fiscal_year: The fiscal year to test :param fiscal_day: The fiscal day to test :return: The fiscal day :raises ValueError: If ``year`` or ``day`` is out of range """ ...
(fiscal_year: int, fiscal_day: int) -> int
[ -0.017370250076055527, 0.06110657379031181, -0.03085920214653015, 0.06313326209783554, -0.057167913764715195, 0.01124238595366478, -0.005076281260699034, 0.003276639152318239, -0.012638123705983162, -0.045543134212493896, 0.0665365681052208, 0.007925117388367653, 0.019004985690116882, -0.0...
723,948
fiscalyear
_check_month
Check if ``month`` is a valid month. :param month: The month to test :return: The month :raises ValueError: If ``month`` is out of range
def _check_month(month: int) -> int: """Check if ``month`` is a valid month. :param month: The month to test :return: The month :raises ValueError: If ``month`` is out of range """ if 1 <= month <= 12: return month else: raise ValueError(f"month {month} is out of range")
(month: int) -> int
[ 0.010972973890602589, 0.07211831212043762, 0.003131312085315585, 0.023640960454940796, -0.026442190632224083, -0.029689477756619453, 0.03174133598804474, 0.04988688603043556, -0.03165212273597717, -0.05916484817862511, 0.037147533148527145, 0.037718482315540314, -0.0025514394510537386, -0....
723,949
fiscalyear
_check_quarter
Check if ``quarter`` is a valid quarter. :param quarter: The quarter to test :return: The quarter :raises ValueError: If ``quarter`` is out of range
def _check_quarter(quarter: int) -> int: """Check if ``quarter`` is a valid quarter. :param quarter: The quarter to test :return: The quarter :raises ValueError: If ``quarter`` is out of range """ if MIN_QUARTER <= quarter <= MAX_QUARTER: return quarter else: raise ValueErro...
(quarter: int) -> int
[ -0.03876836970448494, 0.07427948713302612, -0.05381545051932335, 0.04039699584245682, -0.037706222385168076, 0.0346791036427021, 0.035369496792554855, 0.011497742496430874, -0.007293410133570433, -0.05002712830901146, 0.0838388130068779, 0.02584557980298996, 0.01890621893107891, -0.0243762...
723,950
fiscalyear
_check_year
Check if ``year`` is a valid year. :param year: The year to test :return: The year :raises ValueError: If ``year`` is out of range
def _check_year(year: int) -> int: """Check if ``year`` is a valid year. :param year: The year to test :return: The year :raises ValueError: If ``year`` is out of range """ if datetime.MINYEAR <= year <= datetime.MAXYEAR: return year else: raise ValueError(f"year {year} is o...
(year: int) -> int
[ -0.014559710398316383, 0.0853157490491867, -0.04092263802886009, 0.013366736471652985, -0.022449608892202377, -0.0064619448967278, -0.014948330819606781, 0.004457837902009487, 0.02373296022415161, -0.07027703523635864, 0.06774648278951645, -0.032318759709596634, 0.03756061941385269, -0.041...
723,951
fiscalyear
_validate_fiscal_calendar_params
Raise an Exception if the calendar parameters are invalid. :param start_year: Relationship between the start of the fiscal year and the calendar year. Possible values: ``'previous'`` or ``'same'``. :param start_month: The first month of the fiscal year :param start_day: The first day of the first m...
def _validate_fiscal_calendar_params( start_year: str, start_month: int, start_day: int ) -> None: """Raise an Exception if the calendar parameters are invalid. :param start_year: Relationship between the start of the fiscal year and the calendar year. Possible values: ``'previous'`` or ``'same'``....
(start_year: str, start_month: int, start_day: int) -> NoneType
[ 0.005444178357720375, 0.05512173846364021, -0.0022812511306256056, 0.002299383282661438, -0.044568825513124466, -0.021903637796640396, -0.023045962676405907, -0.0015978957526385784, -0.011432320810854435, -0.025965239852666855, 0.04304572567343712, 0.015992557629942894, 0.06708895415067673, ...
723,956
fiscalyear
fiscal_calendar
A context manager that lets you modify the start of the fiscal calendar inside the scope of a with-statement. :param start_year: Relationship between the start of the fiscal year and the calendar year. Possible values: ``'previous'`` or ``'same'``. :param start_month: The first month of the fiscal ...
@property def next_fiscal_year(self) -> "FiscalYear": """:returns: The next fiscal year""" return FiscalYear(self._fiscal_year + 1)
(start_year: Optional[str] = None, start_month: Optional[int] = None, start_day: Optional[int] = None) -> Iterator[NoneType]
[ -0.004534195177257061, 0.018000997602939606, -0.04193766787648201, 0.034896329045295715, 0.007948177866637707, -0.04771815985441208, -0.022462451830506325, -0.029484393075108528, 0.010562007315456867, -0.009499987587332726, 0.04713623225688934, -0.04166610166430473, 0.07328423112630844, 0....
723,957
fiscalyear
setup_fiscal_calendar
Modify the start of the fiscal calendar. :param start_year: Relationship between the start of the fiscal year and the calendar year. Possible values: ``'previous'`` or ``'same'``. :param start_month: The first month of the fiscal year :param start_day: The first day of the first month of the fiscal...
def setup_fiscal_calendar( start_year: Optional[str] = None, start_month: Optional[int] = None, start_day: Optional[int] = None, ) -> None: """Modify the start of the fiscal calendar. :param start_year: Relationship between the start of the fiscal year and the calendar year. Possible values...
(start_year: Optional[str] = None, start_month: Optional[int] = None, start_day: Optional[int] = None) -> NoneType
[ -0.01406226959079504, 0.04408315569162369, -0.0065501779317855835, -0.008652647025883198, -0.04551228508353233, -0.007223517633974552, -0.05544290319085121, -0.01430961862206459, -0.039136167615652084, -0.013155321590602398, 0.04690476879477501, -0.00275748735293746, 0.06064639985561371, 0...
723,958
displayfx
DisplayFx
null
class DisplayFx: def __init__(self, p_max_val, p_verbose=False, p_msg='', p_bar_len=50): self.bar_end_pos = 0 self.bar_start_pos = 0 self.bar_len = p_bar_len self.calibrate = 0 self.leader_str = '' self.marker_len = 0 self.markers = [] self.marker_slic...
(p_max_val, p_verbose=False, p_msg='', p_bar_len=50)
[ 0.051787618547677994, -0.015633657574653625, -0.09268397092819214, 0.044322412461042404, 0.024523384869098663, 0.01695900224149227, -0.021241579204797745, 0.029139552265405655, -0.04731570929288864, -0.027282265946269035, -0.017301609739661217, 0.0022799083963036537, 0.00477845361456275, -...
723,959
displayfx
__init__
null
def __init__(self, p_max_val, p_verbose=False, p_msg='', p_bar_len=50): self.bar_end_pos = 0 self.bar_start_pos = 0 self.bar_len = p_bar_len self.calibrate = 0 self.leader_str = '' self.marker_len = 0 self.markers = [] self.marker_slice = 0 self.max_val = p_max_val self.progress ...
(self, p_max_val, p_verbose=False, p_msg='', p_bar_len=50)
[ 0.04718253016471863, 0.0128519581630826, -0.09661855548620224, 0.029330633580684662, 0.003162374021485448, 0.006390768103301525, -0.00824814010411501, 0.01573924720287323, -0.04718253016471863, -0.02790459431707859, -0.01036079041659832, 0.028080647811293602, -0.0022468920797109604, -0.039...
723,960
displayfx
update
null
def update(self, p_i): if not self.silent: # self.barCurrPos = 0 if p_i == 0: self.calibrate = 1 self.progress = (p_i + self.calibrate) / self.max_val self.bar_end_pos = round(self.progress * self.bar_len) if self.bar_end_pos > self.bar_start_pos: prin...
(self, p_i)
[ 0.019639167934656143, 0.02399153634905815, -0.09025812149047852, 0.07238487154245377, 0.022350478917360306, 0.006470579653978348, 0.0010301198344677687, -0.0038952799513936043, -0.08162473887205124, 0.003966630436480045, -0.027452025562524796, -0.0510154590010643, 0.010542006231844425, -0....
723,961
pytest_xvfb
Xvfb
null
class Xvfb: def __init__(self, config: pytest.Config) -> None: self.width = int(config.getini("xvfb_width")) self.height = int(config.getini("xvfb_height")) self.colordepth = int(config.getini("xvfb_colordepth")) self.args = config.getini("xvfb_args") or [] self.xauth = confi...
(config: 'pytest.Config') -> 'None'
[ 0.07932084053754807, -0.12168139219284058, -0.03822268545627594, 0.0425008200109005, 0.023021278902888298, 0.02622988075017929, -0.04243068769574165, 0.010607671923935413, -0.04211508855223656, -0.010633972473442554, 0.04537628963589668, 0.004050202202051878, 0.02900014817714691, -0.023442...
723,962
pytest_xvfb
__init__
null
def __init__(self, config: pytest.Config) -> None: self.width = int(config.getini("xvfb_width")) self.height = int(config.getini("xvfb_height")) self.colordepth = int(config.getini("xvfb_colordepth")) self.args = config.getini("xvfb_args") or [] self.xauth = config.getini("xvfb_xauth") self.back...
(self, config: _pytest.config.Config) -> NoneType
[ 0.0404086634516716, -0.09135230630636215, -0.010995429009199142, -0.005442460998892784, 0.005649661645293236, 0.038935236632823944, -0.041771579533815384, 0.023998398333787918, -0.024771947413682938, 0.021309399977326393, 0.03116292506456375, 0.023409029468894005, -0.003856227733194828, 0....
723,963
pytest_xvfb
start
null
def start(self) -> None: self._virtual_display = pyvirtualdisplay.Display( # type: ignore[attr-defined] backend=self.backend, size=(self.width, self.height), color_depth=self.colordepth, use_xauth=self.xauth, extra_args=self.args, ) assert self._virtual_display is no...
(self) -> NoneType
[ 0.06506043672561646, -0.08635561168193817, -0.008398744277656078, 0.039432793855667114, 0.004309519659727812, 0.03814774006605148, 0.01136354636400938, 0.025903012603521347, -0.09480024874210358, 0.0029418552294373512, 0.0021524650510400534, 0.05547760799527168, 0.032860659062862396, -0.02...
723,964
pytest_xvfb
stop
null
def stop(self) -> None: if self.display is not None: # starting worked self._virtual_display.stop()
(self) -> NoneType
[ 0.061768241226673126, -0.009344948455691338, 0.01527245994657278, 0.04857337847352028, -0.02996828220784664, -0.010421906597912312, -0.000435394438682124, 0.0641426369547844, -0.043553225696086884, 0.004960793536156416, -0.0633964017033577, 0.01680733822286129, 0.018164137378335, -0.051422...
723,965
pytest_xvfb
XvfbExitedError
null
class XvfbExitedError(Exception): pass
null
[ 0.03225057199597359, -0.06058061867952347, -0.03876204788684845, 0.06780801713466644, 0.004585308488458395, -0.0140030886977911, -0.05720555782318115, 0.02971075288951397, 0.003161987755447626, -0.02771640010178089, 0.0859106108546257, 0.007713204715400934, 0.07029669731855392, -0.02696638...
723,967
pytest_xvfb
has_executable
null
def has_executable(name: str) -> bool: # http://stackoverflow.com/a/28909933/2085149 return any( os.access(os.path.join(path, name), os.X_OK) for path in os.environ["PATH"].split(os.pathsep) )
(name: str) -> bool
[ 0.059088680893182755, -0.06689945608377457, -0.005100645590573549, -0.03099791519343853, 0.021173153072595596, -0.020910458639264107, 0.014273051172494888, -0.013808958232402802, -0.03838837891817093, 0.0060857487842440605, 0.070191890001297, 0.035691384226083755, 0.0598592534661293, -0.03...
723,968
pytest_xvfb
is_xdist_master
null
def is_xdist_master(config: pytest.Config) -> bool: return config.getoption("dist", "no") != "no" and not os.environ.get( "PYTEST_XDIST_WORKER" )
(config: _pytest.config.Config) -> bool
[ 0.0818214863538742, 0.008862827904522419, -0.01019268948584795, -0.036186233162879944, 0.06320342421531677, 0.011741277761757374, -0.015573378652334213, 0.004024581052362919, -0.017043225467205048, 0.022187691181898117, 0.023727530613541603, -0.018688054755330086, 0.01161879114806652, -0.0...
723,971
pytest_xvfb
pytest_addoption
null
def pytest_addoption(parser: pytest.Parser) -> None: group = parser.getgroup("xvfb") group.addoption("--no-xvfb", action="store_true", help="Disable Xvfb for tests.") group.addoption( "--xvfb-backend", action="store", choices=["xvfb", "xvnc", "xephyr"], help="Use Xephyr or Xv...
(parser: _pytest.config.argparsing.Parser) -> NoneType
[ 0.002694773254916072, -0.03468704968690872, 0.0166535135358572, 0.02912966161966324, 0.040729306638240814, 0.015459979884326458, -0.011086801066994667, 0.008634463883936405, -0.03461245074868202, -0.019469505175948143, 0.05829662084579468, -0.031050503253936768, 0.0024173702113330364, 0.02...
723,972
pytest_xvfb
pytest_collection_modifyitems
null
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: for item in items: if item.get_closest_marker("no_xvfb") and xvfb_instance is not None: skipif_marker = pytest.mark.skipif(True, reason="Skipped with Xvfb") item.add_marker(skipif_marker)
(items: list[_pytest.nodes.Item]) -> NoneType
[ 0.07019858807325363, -0.0068902671337127686, -0.08432591706514359, 0.027104759588837624, -0.018224984407424927, -0.018398381769657135, -0.004960079677402973, 0.013534127734601498, 0.0377458855509758, 0.05278583616018295, 0.009920159354805946, -0.012283840216696262, 0.047346629202365875, -0...
723,973
pytest_xvfb
pytest_configure
null
def pytest_configure(config: pytest.Config) -> None: global xvfb_instance no_xvfb = config.getoption("--no-xvfb") or is_xdist_master(config) backend = config.getoption("--xvfb-backend") if no_xvfb: pass elif backend is None and not has_executable("Xvfb"): # soft fail if sys...
(config: _pytest.config.Config) -> NoneType
[ 0.06797568500041962, -0.09527770429849625, 0.01667732372879982, -0.020429953932762146, 0.009246556088328362, 0.03247934207320213, -0.034639667719602585, -0.014954651705920696, -0.016546959057450294, 0.0018134609563276172, 0.020597564056515694, -0.0443238727748394, 0.010885422118008137, 0.0...
723,975
pytest_xvfb
shutdown_xvfb
null
def shutdown_xvfb() -> None: if xvfb_instance is not None: xvfb_instance.stop()
() -> NoneType
[ 0.05956074595451355, -0.09028083086013794, -0.026158204302191734, 0.008448878303170204, -0.013984644785523415, 0.012481102719902992, -0.034034714102745056, 0.03246282786130905, -0.00786796398460865, 0.02405666373670101, 0.004455096088349819, -0.04493538662791252, 0.048625897616147995, -0.0...
723,978
coolname.exceptions
InitializationError
Custom exception for all generator initialization errors.
class InitializationError(Exception): """Custom exception for all generator initialization errors.""" pass
null
[ -0.0034904254134744406, 0.000939351215492934, 0.0070465016178786755, 0.018837355077266693, -0.020185383036732674, 0.00241156667470932, -0.012657443061470985, 0.04180632531642914, 0.05129503086209297, -0.030024224892258644, 0.0668761134147644, 0.04929925128817558, 0.05700225755572319, 0.053...
723,979
coolname.impl
RandomGenerator
This class provides random name generation interface. Create an instance of this class if you want to create custom configuration. If default implementation is enough, just use `generate`, `generate_slug` and other exported functions.
class RandomGenerator: """ This class provides random name generation interface. Create an instance of this class if you want to create custom configuration. If default implementation is enough, just use `generate`, `generate_slug` and other exported functions. """ def __init__(self, c...
(config, rand=None)
[ 0.040384966880083084, 0.006126694846898317, -0.04491596296429634, -0.005092445760965347, 0.028308875858783722, 0.023896079510450363, -0.05622375011444092, -0.05074715614318848, 0.030003074556589127, -0.05433255434036255, -0.002356610493734479, 0.09763311594724655, 0.033450569957494736, 0.0...
723,980
coolname.impl
__init__
null
def __init__(self, config, rand=None): self.random = rand # sets _random and _randrange config = dict(config) _validate_config(config) lists = {} _create_lists(config, lists, 'all', []) self._lists = {} for key, listdef in config.items(): # Other generators independent from 'all' ...
(self, config, rand=None)
[ 0.01139990147203207, 0.01366276852786541, -0.040503405034542084, -0.018331117928028107, 0.013082790188491344, 0.03588259220123291, -0.03033001348376274, -0.039818838238716125, 0.01895863562822342, -0.029265135526657104, -0.01750393584370613, 0.09507841616868973, 0.015488273464143276, 0.041...
723,981
coolname.impl
_check_not_hanging
Rough check that generate() will not hang or be very slow. Raises ConfigurationError if generate() spends too much time in retry loop. Issues a warning.warn() if there is a risk of slowdown.
def _check_not_hanging(self): """ Rough check that generate() will not hang or be very slow. Raises ConfigurationError if generate() spends too much time in retry loop. Issues a warning.warn() if there is a risk of slowdown. """ # (field_name, predicate, warning_msg, exception_msg) # predica...
(self)
[ 0.06585370749235153, -0.014954973012208939, -0.04442071169614792, 0.023431925103068352, 0.016657765954732895, 0.014760632067918777, -0.03348211199045181, -0.036258406937122345, -0.0022383874747902155, -0.066890187561512, 0.020914752036333084, 0.10431463271379471, 0.03629542142152786, 0.000...
723,982
coolname.impl
_dump
Dumps current tree into a text stream.
def _dump(self, stream, pattern=None, object_ids=False): """Dumps current tree into a text stream.""" return self._lists[pattern]._dump(stream, '', object_ids=object_ids) # noqa
(self, stream, pattern=None, object_ids=False)
[ 0.032964564859867096, -0.03026171214878559, 0.01768830418586731, -0.04362202435731888, 0.018458103761076927, -0.014181435108184814, -0.002309401286765933, 0.021999185904860497, -0.001842175261117518, -0.021383346989750862, -0.03482919558882713, -0.037258341908454895, -0.022478172555565834, ...
723,983
coolname.impl
generate
Generates and returns random name as a list of strings.
def generate(self, pattern: Union[None, str, int] = None) -> List[str]: """ Generates and returns random name as a list of strings. """ lst = self._lists[pattern] while True: result = lst[self._randrange(lst.length)] # 1. Check that there are no duplicates # 2. Check that the...
(self, pattern: Union[NoneType, str, int] = None) -> List[str]
[ 0.01974470727145672, -0.0005604145699180663, -0.027280300855636597, -0.04488750919699669, 0.023530619218945503, 0.025740576907992363, -0.005905297584831715, -0.022969072684645653, 0.0833987444639206, -0.016194282099604607, 0.0006260793306864798, 0.11368604004383087, -0.007689567282795906, ...
723,984
coolname.impl
generate_slug
Generates and returns random name as a slug.
def generate_slug(self, pattern: Union[None, str, int] = None) -> str: """ Generates and returns random name as a slug. """ return '-'.join(self.generate(pattern))
(self, pattern: Union[NoneType, str, int] = None) -> str
[ 0.014345531351864338, -0.0074532171711325645, 0.0288610327988863, -0.01881576143205166, 0.008991452865302563, -0.01306225173175335, -0.009450373239815235, 0.010308725759387016, 0.03542190417647362, -0.013215226121246815, -0.0068965633399784565, 0.11109288036823273, -0.001492555602453649, 0...
723,985
coolname.impl
get_combinations_count
Returns total number of unique combinations for the given pattern.
def get_combinations_count(self, pattern: Union[None, str, int] = None) -> int: """ Returns total number of unique combinations for the given pattern. """ lst = self._lists[pattern] return lst.length
(self, pattern: Union[NoneType, str, int] = None) -> int
[ 0.01721847802400589, -0.018493598327040672, 0.03273679316043854, 0.019950879737734795, 0.04087328165769577, 0.04861075431108475, -0.030897842720150948, -0.008587553165853024, 0.00833599828183651, 0.018649736419320107, -0.02040194347500801, 0.03702189400792122, -0.02763630636036396, -0.0492...
723,990
coolname.impl
replace_random
Replaces random number generator for the default RandomGenerator instance.
def replace_random(rand): """Replaces random number generator for the default RandomGenerator instance.""" _default.random = rand
(rand)
[ 0.03236242011189461, -0.030945472419261932, -0.000056442906497977674, 0.03593103587627411, -0.01648734137415886, 0.004281460773199797, -0.046776819974184036, 0.04621703550219536, 0.08795581758022308, 0.032659806311130524, -0.0062538194470107555, 0.022583723068237305, -0.012997448444366455, ...
723,991
pdfrw.objects.pdfdict
IndirectPdfDict
IndirectPdfDict is a convenience class. You could create a direct PdfDict and then set indirect = True on it, or you could just create an IndirectPdfDict.
class IndirectPdfDict(PdfDict): ''' IndirectPdfDict is a convenience class. You could create a direct PdfDict and then set indirect = True on it, or you could just create an IndirectPdfDict. ''' indirect = True
(*args, **kw)
[ 0.01318024005740881, 0.0035330012906342745, -0.01706377975642681, 0.0033842879347503185, -0.051089365035295486, 0.008519142866134644, -0.016536910086870193, 0.02078585885465145, 0.048675961792469025, -0.006564626470208168, 0.03698285296559334, 0.013112257234752178, -0.006709090434014797, 0...
723,992
pdfrw.objects.pdfdict
__getattr__
If the attribute doesn't exist on the dictionary object, try to slap a '/' in front of it and get it out of the actual dictionary itself.
def __getattr__(self, name, PdfName=PdfName): ''' If the attribute doesn't exist on the dictionary object, try to slap a '/' in front of it and get it out of the actual dictionary itself. ''' return self.get(PdfName(name))
(self, name, PdfName=<pdfrw.objects.pdfname.PdfName object at 0x7ff9a47dfeb0>)
[ 0.06110522150993347, -0.01044636033475399, 0.0029407101683318615, 0.0032270874362438917, 0.004979545716196299, -0.0504365973174572, 0.04629908874630928, 0.02017463929951191, 0.07153448462486267, 0.01899493671953678, 0.02140563353896141, 0.03499786928296089, 0.05132564902305603, 0.039528615...
723,994
pdfrw.objects.pdfdict
__init__
null
def __init__(self, *args, **kw): if args: if len(args) == 1: args = args[0] self.update(args) if isinstance(args, PdfDict): self.indirect = args.indirect self._stream = args.stream for key, value in iteritems(kw): setattr(self, key, value)
(self, *args, **kw)
[ 0.012111570686101913, 0.010185733437538147, -0.008383574895560741, -0.023304393514990807, -0.05869385600090027, 0.006744846235960722, -0.002930717309936881, 0.04865830019116402, 0.04374653473496437, 0.03742130845785141, 0.015097501687705517, 0.06053135171532631, -0.00431546475738287, 0.048...
723,995
pdfrw.objects.pdfdict
__iter__
null
def __iter__(self): for key, value in self.iteritems(): yield key
(self)
[ 0.05150466039776802, -0.042375072836875916, -0.09715260565280914, -0.03589823096990585, -0.01438340824097395, 0.006037586368620396, -0.013702995143830776, 0.009827226400375366, 0.10879713296890259, 0.019809484481811523, -0.02549394592642784, 0.021566499024629593, 0.04606135934591293, 0.077...
723,996
pdfrw.objects.pdfdict
__setattr__
Set an attribute on the dictionary. Handle the keywords indirect, stream, and _stream specially (for content objects)
def __setattr__(self, name, value, special=_special.get, PdfName=PdfName, vars=vars): ''' Set an attribute on the dictionary. Handle the keywords indirect, stream, and _stream specially (for content objects) ''' info = special(name) if info is None: self[PdfName(name)] =...
(self, name, value, special=<built-in method get of dict object at 0x7ff9a47ffa40>, PdfName=<pdfrw.objects.pdfname.PdfName object at 0x7ff9a47dfeb0>, vars=<built-in function vars>)
[ 0.04083492234349251, 0.013998197391629219, 0.009053628891706467, 0.028599057346582413, -0.011806698516011238, 0.02675454504787922, -0.007976141758263111, -0.008925790898501873, 0.01739501953125, -0.011843224056065083, -0.021403636783361435, -0.01109446119517088, 0.05920698866248131, 0.0551...
723,997
pdfrw.objects.pdfdict
__setitem__
null
def __setitem__(self, name, value, setter=dict.__setitem__, BasePdfName=BasePdfName, isinstance=isinstance): if not isinstance(name, BasePdfName): raise PdfParseError('Dict key %s is not a PdfName' % repr(name)) if value is not None: setter(self, name, value) elif name in sel...
(self, name, value, setter=<slot wrapper '__setitem__' of 'dict' objects>, BasePdfName=<class 'pdfrw.objects.pdfname.BasePdfName'>, isinstance=<built-in function isinstance>)
[ 0.03228028863668442, 0.026569725945591927, -0.03257407993078232, -0.015093513764441013, -0.08270217478275299, -0.0075651188381016254, -0.018205862492322922, 0.04895292967557907, 0.02745109796524048, 0.00964001752436161, -0.004342598374933004, -0.008322549052536488, 0.05655477195978165, 0.0...
723,999
pdfrw.objects.pdfdict
get
Get a value out of the dictionary, after resolving any indirect objects.
def get(self, key, dictget=dict.get, isinstance=isinstance, PdfIndirect=PdfIndirect): ''' Get a value out of the dictionary, after resolving any indirect objects. ''' value = dictget(self, key) if isinstance(value, PdfIndirect): # We used to use self[key] here, but that does an ...
(self, key, dictget=<method 'get' of 'dict' objects>, isinstance=<built-in function isinstance>, PdfIndirect=<class 'pdfrw.objects.pdfindirect.PdfIndirect'>)
[ 0.0704222097992897, -0.037529971450567245, -0.031447406858205795, 0.0305912084877491, -0.023509744554758072, 0.0038439680356532335, 0.035960275679826736, -0.026702646166086197, 0.06403640657663345, -0.03506840392947197, -0.004686787258833647, -0.01001572236418724, 0.028111804276704788, 0.0...
724,001
pdfrw.objects.pdfdict
iteritems
Iterate over the dictionary, resolving any unresolved objects
def iteritems(self, dictiter=iteritems, isinstance=isinstance, PdfIndirect=PdfIndirect, BasePdfName=BasePdfName): ''' Iterate over the dictionary, resolving any unresolved objects ''' for key, value in list(dictiter(self)): if isinstance(value, PdfIndirect): s...
(self, dictiter=<method 'items' of 'dict' objects>, isinstance=<built-in function isinstance>, PdfIndirect=<class 'pdfrw.objects.pdfindirect.PdfIndirect'>, BasePdfName=<class 'pdfrw.objects.pdfname.BasePdfName'>)
[ 0.06586163491010666, 0.0032767560333013535, -0.07533973455429077, -0.03274424001574516, -0.03468463942408562, -0.03326665237545967, 0.016810575500130653, 0.008358643390238285, 0.06895880401134491, 0.022146673873066902, -0.010840115137398243, 0.033192023634910583, 0.012584608979523182, 0.05...
724,002
pdfrw.objects.pdfdict
iterkeys
null
def iterkeys(self): return iter(self)
(self)
[ 0.0004743917379528284, -0.05414014682173729, -0.06988531351089478, -0.0121315224096179, 0.005001026671379805, 0.02289179526269436, 0.005263177212327719, 0.013123661279678345, 0.13435016572475433, 0.024117853492498398, -0.021294694393873215, -0.03852403536438942, 0.03397471457719803, 0.0415...
724,003
pdfrw.objects.pdfdict
itervalues
null
def itervalues(self): for key, value in self.iteritems(): yield value
(self)
[ 0.06421349197626114, -0.04506508260965347, -0.09040225297212601, -0.05084701627492905, -0.013000850565731525, 0.01240565162152052, -0.02656289003789425, 0.003938943147659302, 0.11550265550613403, 0.028110407292842865, -0.03251488134264946, 0.023739945143461227, 0.029640918597579002, 0.0504...
724,004
pdfrw.objects.pdfdict
keys
null
def keys(self): return list((key for key, value in self.iteritems()))
(self)
[ 0.005555867217481136, -0.018344275653362274, -0.06272225081920624, -0.043860748410224915, 0.04451590031385422, 0.019275281578302383, 0.02646472118794918, -0.03779196739196777, 0.11737577617168427, 0.005150706972926855, -0.024413058534264565, -0.03751611337065697, 0.041136693209409714, -0.0...
724,005
pdfrw.objects.pdfdict
pop
null
def pop(self, key): value = self.get(key) del self[key] return value
(self, key)
[ 0.05622303485870361, 0.016950596123933792, -0.07261857390403748, -0.02906792424619198, -0.026044996455311775, -0.008552152663469315, -0.006276417523622513, 0.02462746575474739, 0.09844154864549637, -0.048742569983005524, -0.04542930796742439, 0.00263225263915956, -0.023209935054183006, 0.0...
724,006
pdfrw.objects.pdfdict
popitem
null
def popitem(self): key, value = dict.pop(self) if isinstance(value, PdfIndirect): value = value.real_value() return value
(self)
[ 0.0851392149925232, 0.005938151851296425, -0.03674285113811493, -0.02251870557665825, -0.04956171661615372, -0.04448901116847992, 0.012219054624438286, 0.0013260159175843, 0.1074180006980896, -0.02884245291352272, 0.0020993466023355722, 0.0013602909166365862, -0.025723421946167946, 0.01177...
724,007
pdfrw.objects.pdfdict
values
null
def values(self): return list((value for key, value in self.iteritems()))
(self)
[ 0.048031121492385864, -0.0355568528175354, -0.06402997672557831, -0.0593305267393589, 0.02740192785859108, 0.021337566897273064, -0.0037319143302738667, -0.035228580236434937, 0.13531644642353058, 0.025760576128959656, -0.021596727892756462, 0.005952057894319296, 0.034883033484220505, -0.0...
724,008
pdfrw.pagemerge
PageMerge
A PageMerge object can have 0 or 1 underlying pages (that get edited with the results of the merge) and 0-n RectXObjs that can be applied before or after the underlying page.
class PageMerge(list): ''' A PageMerge object can have 0 or 1 underlying pages (that get edited with the results of the merge) and 0-n RectXObjs that can be applied before or after the underlying page. ''' page = None mbox = None cbox = None resources = None rotate = ...
(page=None)
[ 0.02809801883995533, -0.030503148213028908, -0.09857212752103806, 0.034950729459524155, -0.011405276134610176, 0.011538893915712833, -0.02960599586367607, -0.021073514595627785, -0.022085195407271385, -0.014173083938658237, 0.046308282762765884, -0.0076830522157251835, 0.006117809098213911, ...
724,009
pdfrw.pagemerge
__add__
null
def __add__(self, other): if isinstance(other, dict): other = [other] for other in other: self.add(other) return self
(self, other)
[ -0.061198487877845764, -0.027143916115164757, -0.025754660367965698, 0.03918413072824478, -0.06126973032951355, -0.007119934540241957, -0.0343395471572876, -0.0045417966321110725, 0.09860152006149292, -0.012663598172366619, -0.010579714551568031, -0.0177664402872324, 0.010811257176101208, ...
724,010
pdfrw.pagemerge
__init__
null
def __init__(self, page=None): if page is not None: self.setpage(page)
(self, page=None)
[ -0.023695344105362892, 0.008230093866586685, -0.0442601703107357, -0.0015975207788869739, -0.04642489179968834, 0.03262064605951309, 0.008692177943885326, 0.004816499073058367, -0.05205315724015236, -0.014936558902263641, 0.0178839061409235, 0.06847171485424042, 0.006735605653375387, 0.047...
724,011
pdfrw.pagemerge
add
null
def add(self, obj, prepend=False, **kw): if kw: obj = RectXObj(obj, **kw) elif obj.Type == PdfName.Page: obj = RectXObj(obj) if prepend: self.insert(0, obj) else: self.append(obj) return self
(self, obj, prepend=False, **kw)
[ -0.02504604682326317, 0.028459833934903145, -0.0620751827955246, -0.015632007271051407, -0.02455836348235607, 0.01551008690148592, 0.0027562843170017004, 0.04497141391038895, -0.022485706955194473, -0.003252676920965314, 0.04434439167380333, -0.012601401656866074, 0.01870615780353546, 0.00...
724,012
pdfrw.pagemerge
render
null
def render(self): def do_xobjs(xobj_list, restore_first=False): content = ['Q'] if restore_first else [] for obj in xobj_list: index = PdfName('pdfrw_%d' % (key_offset + len(xobjs))) if xobjs.setdefault(index, obj) is not obj: raise KeyError("XObj key %s alrea...
(self)
[ 0.0377463661134243, -0.02546081319451332, -0.09131819009780884, 0.02246987819671631, 0.003845150815322995, 0.026994140818715096, -0.0452047735452652, 0.007889065891504288, -0.01900569349527359, -0.002650196198374033, 0.05194384604692459, 0.009597496129572392, 0.01882585883140564, 0.0417973...
724,013
pdfrw.pagemerge
setpage
null
def setpage(self, page): if page.Type != PdfName.Page: raise TypeError("Expected page") self.append(None) # Placeholder self.page = page inheritable = page.inheritable self.mbox = inheritable.MediaBox self.cbox = inheritable.CropBox self.resources = inheritable.Resources self.ro...
(self, page)
[ -0.0012622971553355455, 0.04772471636533737, 0.007358159404247999, 0.01280265860259533, -0.01744755357503891, 0.04290911927819252, 0.025389693677425385, 0.015291315503418446, -0.07654642313718796, -0.005714028608053923, 0.019567852839827538, 0.059979330748319626, 0.009990565478801727, 0.04...
724,014
pdfrw.objects.pdfarray
PdfArray
A PdfArray maps the PDF file array object into a Python list. It has an indirect attribute which defaults to False.
class PdfArray(list): ''' A PdfArray maps the PDF file array object into a Python list. It has an indirect attribute which defaults to False. ''' indirect = False def __init__(self, source=[]): self._resolve = self._resolver self.extend(source) def _resolver(self, isinstanc...
(source=[])
[ 0.022488029673695564, -0.008180741220712662, -0.054778534919023514, 0.006531979888677597, -0.01809133216738701, 0.011523312889039516, -0.04501209780573845, -0.003752509830519557, 0.026001784950494766, -0.022740298882126808, 0.019731083884835243, -0.031984176486730576, 0.013199103996157646, ...
724,015
pdfrw.objects.pdfarray
__getitem__
null
def __getitem__(self, index, listget=list.__getitem__): self._resolve() return listget(self, index)
(self, index, listget=<method '__getitem__' of 'list' objects>)
[ 0.036494769155979156, -0.05901861563324928, -0.06566332280635834, 0.016330642625689507, 0.016143226996064186, 0.023665376007556915, 0.02855519764125347, -0.035813260823488235, 0.05820080637931824, -0.04020898789167404, -0.02910040318965912, -0.0015642745420336723, -0.01748068816959858, -0....
724,016
pdfrw.objects.pdfarray
__init__
null
def __init__(self, source=[]): self._resolve = self._resolver self.extend(source)
(self, source=[])
[ -0.03295464441180229, -0.03810117021203041, -0.00181604886893183, -0.008365214802324772, -0.03665001690387726, 0.02077171765267849, -0.022290365770459175, 0.027555009350180626, 0.07910463958978653, -0.04063224792480469, 0.009618098847568035, 0.003720685373991728, 0.01243603229522705, 0.047...
724,017
pdfrw.objects.pdfarray
__iter__
null
def __iter__(self, listiter=list.__iter__): self._resolve() return listiter(self)
(self, listiter=<slot wrapper '__iter__' of 'list' objects>)
[ 0.020638251677155495, -0.05866517871618271, -0.057593513280153275, 0.0068232412450015545, -0.032910577952861786, 0.015954025089740753, 0.02433723397552967, -0.0016420719912275672, 0.05254630371928215, 0.0317697711288929, 0.011736493557691574, -0.023559410125017166, -0.03493291884660721, 0....
724,018
pdfrw.objects.pdfarray
__reversed__
null
def __reversed__(self): self._resolve() return list.__reversed__(self)
(self)
[ -0.008104396983981133, 0.020777104422450066, -0.045799169689416885, -0.004613909870386124, -0.057870782911777496, -0.021987581625580788, -0.016739415004849434, 0.009692112915217876, 0.09279223531484604, -0.020959503948688507, -0.010670443996787071, -0.029101209715008736, -0.01487395167350769...
724,019
pdfrw.objects.pdfarray
_resolver
null
def _resolver(self, isinstance=isinstance, enumerate=enumerate, listiter=list.__iter__, PdfIndirect=PdfIndirect, resolved=_resolved, PdfNull=PdfObject('null')): for index, value in enumerate(list.__iter__(self)): if isinstance(value, PdfIndirect): value = valu...
(self, isinstance=<built-in function isinstance>, enumerate=<class 'enumerate'>, listiter=<slot wrapper '__iter__' of 'list' objects>, PdfIndirect=<class 'pdfrw.objects.pdfindirect.PdfIndirect'>, resolved=<function _resolved at 0x7ff9a4801bd0>, PdfNull='null')
[ 0.030677899718284607, -0.02473626099526882, -0.020910337567329407, 0.0025939573533833027, -0.03374568745493889, 0.050142496824264526, 0.042138032615184784, -0.025776488706469536, 0.03931707888841629, 0.01414885837584734, 0.0017542821587994695, -0.01767505332827568, 0.012517993338406086, -0...
724,020
pdfrw.objects.pdfarray
count
null
def count(self, item): self._resolve() return list.count(self, item)
(self, item)
[ -0.007004948332905769, -0.057847313582897186, -0.029646748676896095, 0.048644330352544785, 0.053344424813985825, 0.02721453085541725, -0.0003646270779427141, -0.024700146168470383, 0.06829927116632462, 0.0012849252671003342, -0.020920349285006523, -0.0006280829547904432, -0.01182418782263994...
724,021
pdfrw.objects.pdfarray
index
null
def index(self, item): self._resolve() return list.index(self, item)
(self, item)
[ 0.051147375255823135, -0.0031696553342044353, -0.057440899312496185, 0.038327232003211975, 0.026173070073127747, -0.040624868124723434, 0.031284477561712265, 0.012595374137163162, 0.02302630804479122, -0.01946330815553665, -0.04282260686159134, 0.006659814156591892, -0.025024252012372017, ...
724,022
pdfrw.objects.pdfarray
pop
null
def pop(self, *args): self._resolve() return list.pop(self, *args)
(self, *args)
[ -0.00178831338416785, 0.017217284068465233, -0.07658722996711731, -0.030756929889321327, -0.05079428479075432, -0.007713969796895981, 0.02996532991528511, 0.01605462282896042, 0.12381931394338608, -0.03753499686717987, -0.005306188948452473, -0.03365946188569069, -0.0552140474319458, -0.00...
724,023
pdfrw.objects.pdfarray
remove
null
def remove(self, item): self._resolve() return list.remove(self, item)
(self, item)
[ 0.03755008056759834, 0.05042728781700134, -0.06864465773105621, 0.008251046761870384, -0.0093790702521801, -0.0757761299610138, -0.0028792056255042553, 0.054753489792346954, 0.06218915060162544, 0.008462287485599518, -0.014085504226386547, -0.00127483531832695, -0.02790062129497528, 0.0262...
724,024
pdfrw.objects.pdfarray
sort
null
def sort(self, *args, **kw): self._resolve() return list.sort(self, *args, **kw)
(self, *args, **kw)
[ -0.04296435788273811, -0.006116571836173534, -0.005883438512682915, 0.004192161839455366, -0.02004099264740944, 0.008248682133853436, 0.05103501304984093, 0.01875239983201027, 0.08837026357650757, -0.04659276083111763, -0.01455599907785654, -0.01260615698993206, 0.052900079637765884, -0.02...
724,025
pdfrw.objects.pdfdict
PdfDict
PdfDict objects are subclassed dictionaries with the following features: - Every key in the dictionary starts with "/" - A dictionary item can be deleted by assigning it to None - Keys that (after the initial "/") conform to Python naming conventions can also be accessed (s...
class PdfDict(dict): ''' PdfDict objects are subclassed dictionaries with the following features: - Every key in the dictionary starts with "/" - A dictionary item can be deleted by assigning it to None - Keys that (after the initial "/") conform to Python naming convent...
(*args, **kw)
[ 0.06941479444503784, 0.013482409529387951, -0.043771374970674515, -0.01221262663602829, -0.010003411211073399, -0.01623876765370369, -0.011551925912499428, 0.03041284717619419, 0.06305555254220963, -0.01869574561715126, -0.0016040040645748377, 0.040282052010297775, 0.054012224078178406, 0....
724,042
pdfrw.pdfreader
PdfReader
null
class PdfReader(PdfDict): def findindirect(self, objnum, gennum, PdfIndirect=PdfIndirect, int=int): ''' Return a previously loaded indirect object, or create a placeholder for it. ''' key = int(objnum), int(gennum) result = self.indirect_objects.get(key) if resul...
(fname=None, fdata=None, decompress=False, decrypt=False, password='', disable_gc=True, verbose=True)
[ 0.037270717322826385, -0.006177385803312063, -0.0715928003191948, 0.014929910190403461, -0.007553414441645145, -0.0028061154298484325, -0.0015480321599170566, 0.038076676428318024, -0.012453058734536171, -0.0466277115046978, 0.027206052094697952, 0.006290416698902845, -0.005386169068515301, ...
724,045
pdfrw.pdfreader
__init__
null
def __init__(self, fname=None, fdata=None, decompress=False, decrypt=False, password='', disable_gc=True, verbose=True): self.private.verbose = verbose # Runs a lot faster with GC off. disable_gc = disable_gc and gc.isenabled() if disable_gc: gc.disable() try: if fname i...
(self, fname=None, fdata=None, decompress=False, decrypt=False, password='', disable_gc=True, verbose=True)
[ 0.034939564764499664, 0.0023888961877673864, -0.01999981701374054, 0.04104510322213173, -0.014992021955549717, -0.028875846415758133, 0.02799765206873417, 0.03843143209815025, -0.02979585900902748, 0.010308321565389633, 0.028499478474259377, 0.02185029722750187, -0.022373031824827194, 0.04...
724,049
pdfrw.pdfreader
_parse_encrypt_info
Check password and initialize crypt filters.
def _parse_encrypt_info(self, source, password, trailer): """Check password and initialize crypt filters.""" # Create and check password key key = crypt.create_key(password, trailer) if not crypt.check_user_password(key, trailer): source.warning('User password does not validate') # Create de...
(self, source, password, trailer)
[ 0.007700969465076923, -0.013303332962095737, 0.01447125244885683, 0.042811550199985504, -0.023467883467674255, -0.07540380209684372, 0.02060282975435257, -0.009972937405109406, 0.030511897057294846, 0.06171724572777748, 0.024453314021229744, -0.001329877064563334, -0.014188396744430065, 0....
724,050
pdfrw.pdfreader
badtoken
Didn't see that coming.
def badtoken(self, source): ''' Didn't see that coming. ''' source.exception('Unexpected delimiter')
(self, source)
[ -0.028163596987724304, 0.0068107242695987225, 0.044686898589134216, 0.06711255759000778, -0.030728409066796303, -0.040609508752822876, 0.00918235257267952, 0.06944718956947327, 0.025500139221549034, -0.024628762155771255, 0.03044890984892845, -0.0254508163779974, 0.018134528771042824, -0.0...
724,052
pdfrw.pdfreader
decrypt_all
null
def decrypt_all(self): self.read_all() if self.crypt_filters is not None: crypt.decrypt_objects( self.indirect_objects.values(), self.stream_crypt_filter, self.crypt_filters)
(self)
[ 0.029923822730779648, -0.02468097023665905, -0.0498235784471035, 0.03162197768688202, -0.0451742559671402, -0.05302204564213753, -0.016355058178305626, -0.05440694838762283, 0.043294742703437805, 0.049559786915779114, -0.047482430934906006, -0.018086189404129982, -0.043459612876176834, 0.0...
724,053
pdfrw.pdfreader
empty_obj
Some silly git put an empty object in the file. Back up so the caller sees the endobj.
def empty_obj(self, source, PdfObject=PdfObject): ''' Some silly git put an empty object in the file. Back up so the caller sees the endobj. ''' source.floc = source.tokstart
(self, source, PdfObject=<class 'pdfrw.objects.pdfobject.PdfObject'>)
[ -0.01617039367556572, 0.0036100035067647696, -0.03820677474141121, -0.011083078570663929, -0.03502287343144417, -0.06623891741037369, -0.0174854826182127, 0.07592903822660446, 0.01551284920424223, -0.04447074607014656, 0.009049883112311363, -0.043847810477018356, 0.0012220803182572126, 0.0...
724,054
pdfrw.pdfreader
findindirect
Return a previously loaded indirect object, or create a placeholder for it.
def findindirect(self, objnum, gennum, PdfIndirect=PdfIndirect, int=int): ''' Return a previously loaded indirect object, or create a placeholder for it. ''' key = int(objnum), int(gennum) result = self.indirect_objects.get(key) if result is None: self.indirect_objects[key] = result ...
(self, objnum, gennum, PdfIndirect=<class 'pdfrw.objects.pdfindirect.PdfIndirect'>, int=<class 'int'>)
[ 0.07496184855699539, 0.00241630501113832, -0.014003289863467216, 0.05878952145576477, -0.022106803953647614, 0.0007792257820256054, 0.04029199108481407, 0.010715032927691936, -0.02372056618332863, -0.05632549896836281, 0.01478414237499237, -0.012589078396558762, 0.00633792020380497, -0.036...
724,055
pdfrw.pdfreader
findstream
Figure out if there is a content stream following an object, and return the start pointer to the content stream if so. (We can't read it yet, because we might not know how long it is, because Length might be an indirect object.)
def findstream(self, obj, tok, source, len=len): ''' Figure out if there is a content stream following an object, and return the start pointer to the content stream if so. (We can't read it yet, because we might not know how long it is, because Length might be an indirect obj...
(self, obj, tok, source, len=<built-in function len>)
[ -0.024193845689296722, -0.03651495277881622, -0.0549159049987793, 0.01576455868780613, 0.005349010229110718, 0.0017385403625667095, 0.061193034052848816, 0.06510278582572937, 0.006756880320608616, -0.019620509818196297, -0.016984116286039352, -0.011056712828576565, 0.012930884025990963, -0...
724,056
pdfrw.pdfreader
findxref
Find the cross reference section at the end of a file
def findxref(self, fdata): ''' Find the cross reference section at the end of a file ''' startloc = fdata.rfind('startxref') if startloc < 0: raise PdfParseError('Did not find "startxref" at end of file') source = PdfTokens(fdata, startloc, False, self.verbose) tok = source.next() as...
(self, fdata)
[ -0.0034239809028804302, 0.01499220822006464, -0.0023064936976879835, 0.04412733390927315, -0.023637089878320694, 0.009413712657988071, 0.02748124673962593, 0.01469719223678112, -0.028679192066192627, -0.05764446035027504, 0.011273210868239403, -0.0012828753096982837, 0.004076593555510044, ...
724,058
pdfrw.pdfreader
getPage
null
def getPage(self, pagenum): return self.pages[pagenum]
(self, pagenum)
[ 0.006247976329177618, -0.03480467572808266, -0.07686671614646912, 0.005655972752720118, -0.03379954770207405, 0.05615086480975151, 0.040648046880960464, -0.07175590097904205, -0.055230915546417236, -0.023220153525471687, 0.03509429097175598, 0.022794252261519432, -0.014199558645486832, 0.0...
724,064
pdfrw.pdfreader
load_stream_objects
null
def load_stream_objects(self, object_streams): # read object streams objs = [] for num in object_streams: obj = self.findindirect(num, 0).real_value() assert obj.Type == '/ObjStm' objs.append(obj) # read objects from stream if objs: # Decrypt if self.crypt_fil...
(self, object_streams)
[ -0.0017340952763333917, -0.009609873406589031, -0.08077438920736313, -0.011392202228307724, -0.024713728576898575, 0.021167445927858353, -0.0033625371288508177, 0.044539835304021835, -0.04163666069507599, 0.03252289816737175, -0.019403493031859398, 0.02249041199684143, -0.056520022451877594,...
724,065
pdfrw.pdfreader
loadindirect
null
def loadindirect(self, key, PdfDict=PdfDict, isinstance=isinstance): result = self.indirect_objects.get(key) if not isinstance(result, PdfIndirect): return result source = self.source offset = int(self.source.obj_offsets.get(key, '0')) if not offset: source.warning("...
(self, key, PdfDict=<class 'pdfrw.objects.pdfdict.PdfDict'>, isinstance=<built-in function isinstance>)
[ 0.04402443394064903, 0.0074921101331710815, -0.06978744268417358, 0.025422027334570885, -0.016158709302544594, -0.009035996161401272, 0.050503071397542953, 0.04508526250720024, -0.008879712782800198, -0.03496949374675751, 0.022050103172659874, 0.016281841322779655, -0.014169653877615929, 0...
724,066
pdfrw.pdfreader
parse_xref_stream
Parse (one of) the cross-reference file section(s)
def parse_xref_stream(self, source, int=int, range=range, enumerate=enumerate, islice=itertools.islice, defaultdict=collections.defaultdict, hexlify=binascii.hexlify): ''' Parse (one of) the cross-reference file section(s) ''' def readint(s, ...
(self, source, int=<class 'int'>, range=<class 'range'>, enumerate=<class 'enumerate'>, islice=<class 'itertools.islice'>, defaultdict=<class 'collections.defaultdict'>, hexlify=<built-in function hexlify>)
[ -0.012165172956883907, -0.02389688603579998, -0.0595160610973835, -0.004624367691576481, -0.008174506016075611, 0.013936708681285381, 0.0014853101456537843, 0.04436377435922623, -0.0022344435565173626, -0.039539169520139694, 0.00047203651047311723, 0.018921509385108948, -0.011646904982626438...
724,067
pdfrw.pdfreader
parse_xref_table
Parse (one of) the cross-reference file section(s)
def parse_xref_table(self, source, int=int, range=range): ''' Parse (one of) the cross-reference file section(s) ''' setdefault = source.obj_offsets.setdefault next = source.next # plain xref table start = source.floc try: while 1: tok = next() if tok == 'trai...
(self, source, int=<class 'int'>, range=<class 'range'>)
[ -0.031346410512924194, 0.04246355593204498, -0.04590073972940445, -0.006153814494609833, -0.032939691096544266, 0.0025264204014092684, -0.02556406334042549, 0.03653799369931221, -0.046760037541389465, -0.07243151217699051, -0.036215756088495255, 0.017114317044615746, -0.0048469677567481995, ...
724,068
pdfrw.pdfreader
parsexref
Parse (one of) the cross-reference file section(s)
def parsexref(self, source): ''' Parse (one of) the cross-reference file section(s) ''' next = source.next try: tok = next() except StopIteration: tok = '' if tok.isdigit(): return self.parse_xref_stream(source), True elif tok == 'xref': self.parse_xref_table(...
(self, source)
[ -0.0351911336183548, 0.002451625419780612, 0.008069750852882862, 0.013858920894563198, -0.020402437075972557, 0.012473028153181076, 0.010569619946181774, 0.04347139969468117, 0.04705015942454338, -0.04676946997642517, -0.010587163269519806, 0.011209936812520027, 0.005429539363831282, 0.010...
724,071
pdfrw.pdfreader
read_all
null
def read_all(self): deferred = self.deferred_objects prev = set() while 1: new = deferred - prev if not new: break prev |= deferred for key in new: self.loadindirect(key)
(self)
[ -0.02025710605084896, 0.031950511038303375, -0.1275956928730011, 0.0273419339209795, -0.01618161052465439, 0.04371270164847374, 0.0020936354994773865, -0.05967076122760773, 0.0551309697329998, -0.0542711578309536, -0.04037664085626602, -0.00599716929718852, -0.035836849361658096, 0.0364903...
724,072
pdfrw.pdfreader
readarray
Found a [ token. Parse the tokens after that.
def readarray(self, source, PdfArray=PdfArray): ''' Found a [ token. Parse the tokens after that. ''' specialget = self.special.get result = [] pop = result.pop append = result.append for value in source: if value in ']R': if value == ']': break ...
(self, source, PdfArray=<class 'pdfrw.objects.pdfarray.PdfArray'>)
[ -0.010406702756881714, 0.011859008111059666, 0.0010931269498541951, -0.02517923153936863, -0.0175434909760952, 0.02644442953169346, -0.06479241698980331, -0.01961948536336422, 0.09465822577476501, -0.019441287964582443, 0.04184064641594887, -0.02459118142724037, 0.03945280611515045, -0.003...
724,073
pdfrw.pdfreader
readdict
Found a << token. Parse the tokens after that.
def readdict(self, source, PdfDict=PdfDict): ''' Found a << token. Parse the tokens after that. ''' specialget = self.special.get result = PdfDict() next = source.next tok = next() while tok != '>>': if not tok.startswith('/'): source.error('Expected PDF /name object') ...
(self, source, PdfDict=<class 'pdfrw.objects.pdfdict.PdfDict'>)
[ 0.01949722319841385, -0.007648703176528215, -0.028094707056879997, 0.007338438183069229, -0.010207263752818108, -0.003983980510383844, -0.0307746771723032, 0.01964111439883709, 0.04302339255809784, -0.029821399599313736, 0.029623549431562424, 0.0276450477540493, 0.01566612720489502, 0.0851...
724,074
pdfrw.pdfreader
readpages
null
def readpages(self, node): pagename = PdfName.Page pagesname = PdfName.Pages catalogname = PdfName.Catalog typename = PdfName.Type kidname = PdfName.Kids try: result = [] stack = [node] append = result.append pop = stack.pop while stack: node =...
(self, node)
[ -0.011600800789892673, 0.02257552742958069, -0.030917055904865265, -0.04485643282532692, -0.009897508658468723, 0.08904995769262314, 0.0051190839149057865, -0.030843399465084076, 0.023846091702580452, -0.04647685959935188, 0.07284566760063171, 0.04614540934562683, -0.015394079498946667, 0....
724,075
pdfrw.pdfreader
readstream
null
def readstream(self, obj, startstream, source, exact_required=False, streamending='endstream endobj'.split(), int=int): fdata = source.fdata length = int(obj.Length) source.floc = target_endstream = startstream + length endit = source.multiple(2) obj._stream = fdata[startstream:target...
(self, obj, startstream, source, exact_required=False, streamending=['endstream', 'endobj'], int=<class 'int'>)
[ -0.006816384382545948, 0.017499186098575592, -0.04599577561020851, -0.01995217241346836, -0.024110395461320877, -0.030074162408709526, 0.024785194545984268, 0.049388010054826736, 0.014325805939733982, -0.042202308773994446, -0.01585778221487999, -0.0009232895099557936, -0.010541458614170551,...
724,076
pdfrw.pdfreader
uncompress
null
def uncompress(self): self.read_all() uncompress(self.indirect_objects.values())
(self)
[ 0.004723599646240473, 0.0017070126486942172, -0.047817107290029526, -0.023144809529185295, -0.014760212041437626, -0.02138487435877323, -0.030583025887608528, -0.010833563283085823, 0.027760488912463188, -0.029238170012831688, -0.03206070885062218, 0.014967751689255238, -0.07338597625494003,...
724,078
pdfrw.pdfwriter
PdfWriter
null
class PdfWriter(object): _trailer = None canonicalize = False fname = None def __init__(self, fname=None, version='1.3', compress=False, **kwargs): """ Parameters: fname -- Output file name, or file-like binary object with a write method ...
(fname=None, version='1.3', compress=False, **kwargs)
[ 0.034948766231536865, 0.015090618282556534, -0.03510637208819389, 0.0027457636315375566, -0.01291370764374733, -0.018971625715494156, -0.04338059946894646, 0.03461385890841484, -0.03622930496931076, -0.007387704681605101, 0.03548068180680275, 0.008712566457688808, -0.005373323801904917, 0....
724,079
pdfrw.pdfwriter
__init__
Parameters: fname -- Output file name, or file-like binary object with a write method version -- PDF version to target. Currently only 1.3 supported. compress -- True to do compression on output. Currently...
def __init__(self, fname=None, version='1.3', compress=False, **kwargs): """ Parameters: fname -- Output file name, or file-like binary object with a write method version -- PDF version to target. Currently only 1.3 supported. ...
(self, fname=None, version='1.3', compress=False, **kwargs)
[ 0.0345146507024765, -0.0035020923241972923, -0.016121510416269302, -0.0018159812316298485, 0.0021362542174756527, -0.016235973685979843, -0.030957527458667755, 0.026467101648449898, -0.039410095661878586, 0.03933965787291527, 0.039410095661878586, 0.039480533450841904, -0.028087176382541656,...
724,080
pdfrw.pdfwriter
_get_trailer
null
def _get_trailer(self): trailer = self._trailer if trailer is not None: return trailer if self.canonicalize: self.make_canonical() # Create the basic object structure of the PDF file trailer = PdfDict( Root=IndirectPdfDict( Type=PdfName.Catalog, Pages=...
(self)
[ -0.002454372588545084, 0.04833795130252838, -0.052446309477090836, -0.011936439201235771, -0.03192303702235222, -0.015489611774682999, -0.0034490758553147316, 0.07646723836660385, -0.03142337128520012, 0.017303209751844406, 0.041527703404426575, 0.02514979988336563, -0.018404323607683182, ...
724,081
pdfrw.pdfwriter
_set_trailer
null
def _set_trailer(self, trailer): self._trailer = trailer
(self, trailer)
[ -0.026850063353776932, 0.10178979486227036, -0.05390050262212753, 0.0034272237680852413, -0.0543680414557457, -0.03149205446243286, 0.013658801093697548, 0.09304014593362808, -0.07293599843978882, 0.05119545757770538, -0.005752392578870058, -0.0028594983741641045, 0.02778514102101326, 0.01...
724,082
pdfrw.pdfwriter
addpage
null
def addpage(self, page): self._trailer = None if page.Type != PdfName.Page: raise PdfOutputError('Bad /Type: Expected %s, found %s' % (PdfName.Page, page.Type)) inheritable = page.inheritable # searches for resources self.pagearray.append( IndirectPdfDict( ...
(self, page)
[ -0.03914085775613785, 0.03618931397795677, -0.007350660860538483, 0.0005149340140633285, -0.012285567820072174, 0.02784227393567562, 0.005517695564776659, 0.02534192055463791, -0.10227006673812866, -0.02494712732732296, 0.05068384110927582, 0.04921746999025345, -0.006232081912457943, 0.050...
724,084
pdfrw.pdfwriter
addpages
null
def addpages(self, pagelist): for page in pagelist: self.addpage(page) return self
(self, pagelist)
[ -0.0756574422121048, -0.009193013422191143, -0.09383213520050049, 0.010645931586623192, -0.04839540272951126, 0.08023633807897568, -0.028160206973552704, -0.024602757766842842, -0.09256412833929062, 0.034729160368442535, 0.029463430866599083, 0.034306492656469345, 0.027015483006834984, 0.0...
724,085
pdfrw.pdfwriter
make_canonical
Canonicalizes a PDF. Assumes everything is a Pdf object already.
def make_canonical(self): ''' Canonicalizes a PDF. Assumes everything is a Pdf object already. ''' visited = set() workitems = list(self.pagearray) while workitems: obj = workitems.pop() objid = id(obj) if objid in visited: continue visited.add(ob...
(self)
[ 0.004172443877905607, 0.0550069734454155, -0.029994236305356026, 0.03227449953556061, -0.04143063351511955, -0.01115575060248375, -0.01592676341533661, -0.036975350230932236, 0.03676486387848854, -0.003867677878588438, 0.0016948498087003827, 0.010840022005140781, -0.0014416089979931712, 0....
724,086
pdfrw.pdfwriter
write
null
def write(self, fname=None, trailer=None, user_fmt=user_fmt, disable_gc=True): trailer = trailer or self.trailer # Support fname for legacy applications if (fname is not None) == (self.fname is not None): raise PdfOutputError( "PdfWriter fname must be specified exactly once") ...
(self, fname=None, trailer=None, user_fmt=<function user_fmt at 0x7ff9a47afd00>, disable_gc=True)
[ 0.0068513466976583, 0.04748772457242012, -0.0299833994358778, 0.03125372529029846, 0.025724075734615326, -0.05716461315751076, -0.00044222010183148086, 0.05499758571386337, -0.05869647487998009, 0.019428495317697525, 0.015215874649584293, -0.002103975275531411, 0.019447175785899162, -0.014...
724,087
pdfrw.objects.pdfobject
PdfObject
A PdfObject is a textual representation of any PDF file object other than an array, dict or string. It has an indirect attribute which defaults to False.
class PdfObject(str): ''' A PdfObject is a textual representation of any PDF file object other than an array, dict or string. It has an indirect attribute which defaults to False. ''' indirect = False
null
[ 0.032346297055482864, 0.02711590752005577, -0.0002469875034876168, -0.038772713392972946, 0.006645093206316233, -0.05958716198801994, 0.008430209010839462, 0.03848709538578987, 0.014495139941573143, -0.03654132038354874, 0.034024305641651154, 0.012656470760703087, -0.025902029126882553, 0....
724,088
pdfrw.errors
PdfParseError
Error thrown by parser/tokenizer
class PdfParseError(PdfError): "Error thrown by parser/tokenizer"
(msg)
[ -0.011752916499972343, 0.03362639993429184, 0.01669292151927948, 0.022887257859110832, -0.04312839359045029, -0.03024142235517502, 0.017216991633176804, 0.016125895082950592, -0.010223662480711937, 0.002476446097716689, 0.09581032395362854, 0.010172114707529545, 0.019485099241137505, 0.036...
724,127
pdfrw.objects.pdfstring
PdfString
A PdfString is an encoded string. It has a decode method to get the actual string data out, and there is an encode class method to create such a string. Like any PDF object, it could be indirect, but it defaults to being a direct object.
class PdfString(str): """ A PdfString is an encoded string. It has a decode method to get the actual string data out, and there is an encode class method to create such a string. Like any PDF object, it could be indirect, but it defaults to being a direct object. """ indirec...
null
[ 0.03645157814025879, 0.0005844543920829892, 0.0015544065972790122, 0.019646110013127327, 0.009589646011590958, -0.03931208327412605, 0.016537297517061234, 0.010309738107025623, 0.012753087095916271, 0.005125072319060564, 0.06185843050479889, 0.0702015683054924, 0.016547229140996933, 0.0758...
724,128
pdfrw.objects.pdfstring
to_unicode
Decode a PDF string to a unicode string. This is a convenience function for user code, in that (as of pdfrw 0.3) it is never actually used inside pdfrw. There are two Unicode storage methods used -- either UTF16_BE, or something called PDFDocEncoding, which ...
def to_unicode(self): """ Decode a PDF string to a unicode string. This is a convenience function for user code, in that (as of pdfrw 0.3) it is never actually used inside pdfrw. There are two Unicode storage methods used -- either UTF16_BE, or something called PDFDocEncoding, which...
(self)
[ 0.029531577602028847, 0.007189071737229824, 0.005369778256863356, 0.015188675373792648, -0.016175411641597748, -0.049759652465581894, 0.046059396117925644, 0.045460306107997894, 0.029919223859906197, 0.0045988913625478745, 0.042958226054906845, -0.002951395697891712, -0.00029045919654890895,...
724,129
pdfrw.objects.pdfstring
decode_hex
Decode a PDF hexadecimal-encoded string, which is enclosed in angle brackets <>.
def decode_hex(self): """ Decode a PDF hexadecimal-encoded string, which is enclosed in angle brackets <>. """ hexstr = convert_store(''.join(self[1:-1].split())) if len(hexstr) % 1: # odd number of chars indicates a truncated 0 hexstr += '0' return binascii.unhexlify(hexstr)
(self)
[ 0.05146408453583717, 0.04412726312875748, 0.035656243562698364, 0.018306611105799675, -0.005241219885647297, -0.02172691747546196, 0.000006684611435048282, 0.024385185912251472, 0.03390178829431534, -0.0016658484237268567, 0.09059379994869232, 0.06036042422056198, 0.025767484679818153, 0.0...
724,130
pdfrw.objects.pdfstring
decode_literal
Decode a PDF literal string, which is enclosed in parentheses () Many pdfrw users never decode strings, so defer creating data structures to do so until the first string is decoded. Possible string escapes from the spec: (PDF 1.7 Reference, section 3.2.3, page 53) ...
def decode_literal(self): """ Decode a PDF literal string, which is enclosed in parentheses () Many pdfrw users never decode strings, so defer creating data structures to do so until the first string is decoded. Possible string escapes from the spec: (PDF 1.7 Reference, section 3.2.3...
(self)
[ 0.042148906737565994, 0.015692586079239845, 0.022179821506142616, 0.03142141178250313, -0.010165750980377197, -0.007429515011608601, 0.020240899175405502, -0.010645951144397259, -0.013753663748502731, -0.00553136458620429, 0.07001864910125732, 0.053166333585977554, -0.01773117296397686, 0....
724,131
pdfrw.objects.pdfstring
to_bytes
Decode a PDF string to bytes. This is a convenience function for user code, in that (as of pdfrw 0.3) it is never actually used inside pdfrw.
def to_bytes(self): """ Decode a PDF string to bytes. This is a convenience function for user code, in that (as of pdfrw 0.3) it is never actually used inside pdfrw. """ if self.startswith('(') and self.endswith(')'): return self.decode_literal() elif self.startswith('<') and se...
(self)
[ 0.061705637723207474, -0.004931830335408449, 0.006820143666118383, 0.0002740831405390054, -0.0239571426063776, -0.062345441430807114, 0.016341686248779297, 0.009988066740334034, 0.025183435529470444, -0.0024148195516318083, 0.06885012984275818, 0.052677277475595474, 0.0012996038421988487, ...
724,133
pdfrw.tokens
PdfTokens
null
class PdfTokens(object): # Table 3.1, page 50 of reference, defines whitespace eol = '\n\r' whitespace = '\x00 \t\f' + eol # Text on page 50 defines delimiter characters # Escape the ] delimiters = r'()<>{}[\]/%' # "normal" stuff is all but delimiters or whitespace. p_normal = r'(?:[...
(fdata, startloc=0, strip_comments=True, verbose=True)
[ 0.033109113574028015, -0.001332196407020092, -0.011527786031365395, 0.016923116520047188, -0.002515944419428706, 0.00555401761084795, -0.0030278353951871395, -0.0048859999515116215, -0.011845158413052559, -0.035729993134737015, 0.04574258252978325, 0.023915549740195274, 0.004527675919234753,...
724,134
pdfrw.tokens
__init__
null
def __init__(self, fdata, startloc=0, strip_comments=True, verbose=True): self.fdata = fdata self.strip_comments = strip_comments self.iterator = iterator = self._gettoks(startloc) self.msgs_dumped = None if verbose else set() self.next = getattr(iterator, nextattr) self.current = [(startloc, st...
(self, fdata, startloc=0, strip_comments=True, verbose=True)
[ 0.019863341003656387, 0.020808350294828415, -0.05179370939731598, -0.00821884348988533, -0.03203940764069557, -0.006928544491529465, 0.010231529362499714, 0.025642428547143936, -0.0005346905090846121, -0.04161670058965683, -0.03376586362719536, 0.011031150817871094, -0.012684915214776993, ...