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 |
|---|---|---|---|---|---|---|
7,380 | uuid | _find_mac_under_heading | Looks for a MAC address under a heading in a command's output.
The first line of words in the output is searched for the given
heading. Words at the same word index as the heading in subsequent
lines are then examined to see if they look like MAC addresses.
| def _find_mac_under_heading(command, args, heading):
"""Looks for a MAC address under a heading in a command's output.
The first line of words in the output is searched for the given
heading. Words at the same word index as the heading in subsequent
lines are then examined to see if they look like MAC ... | (command, args, heading) | [
0.014834912493824959,
0.02086900733411312,
-0.039032772183418274,
-0.04468918591737747,
-0.010698000900447369,
-0.05361296981573105,
0.027491578832268715,
0.03434251621365547,
-0.02232702635228634,
-0.04233527556061745,
0.008014717139303684,
0.0037680151872336864,
-0.003289327956736088,
-0... |
7,381 | uuid | _get_command_stdout | null | def _get_command_stdout(command, *args):
import io, os, shutil, subprocess
try:
path_dirs = os.environ.get('PATH', os.defpath).split(os.pathsep)
path_dirs.extend(['/sbin', '/usr/sbin'])
executable = shutil.which(command, path=os.pathsep.join(path_dirs))
if executable is None:
... | (command, *args) | [
0.021204110234975815,
-0.07826279103755951,
0.018956055864691734,
-0.020461108535528183,
0.06751784682273865,
-0.002348074223846197,
0.04896187037229538,
-0.019699055701494217,
0.057839781045913696,
-0.04404663294553757,
0.09731409698724747,
0.029586687684059143,
-0.008501647971570492,
-0.... |
7,382 | uuid | _ifconfig_getnode | Get the hardware address on Unix by running ifconfig. | def _ifconfig_getnode():
"""Get the hardware address on Unix by running ifconfig."""
# This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes.
keywords = (b'hwaddr', b'ether', b'address:', b'lladdr')
for args in ('', '-a', '-av'):
mac = _find_mac_near_keyword('ifconfig', args, keywo... | () | [
0.04413849487900734,
0.006294085178524256,
0.042434029281139374,
-0.034994758665561676,
-0.009649747051298618,
0.004543015733361244,
0.006484949961304665,
-0.03447987139225006,
-0.010697281919419765,
-0.07400210946798325,
0.021927207708358765,
0.006791220512241125,
-0.007053104229271412,
-... |
7,383 | uuid | _ip_getnode | Get the hardware address on Unix by running ip. | def _ip_getnode():
"""Get the hardware address on Unix by running ip."""
# This works on Linux with iproute2.
mac = _find_mac_near_keyword('ip', 'link', [b'link/ether'], lambda i: i+1)
if mac:
return mac
return None
| () | [
0.04864765703678131,
-0.0003778942336793989,
0.029434604570269585,
0.016778936609625816,
-0.016181236132979393,
-0.008489085361361504,
0.013071459718048573,
0.0039110430516302586,
-0.024860894307494164,
-0.08094083517789841,
0.034008316695690155,
0.020806921645998955,
0.006466431077569723,
... |
7,384 | uuid | _ipconfig_getnode | [DEPRECATED] Get the hardware address on Windows. | def _ipconfig_getnode():
"""[DEPRECATED] Get the hardware address on Windows."""
# bpo-40501: UuidCreateSequential() is now the only supported approach
return _windll_getnode()
| () | [
0.05043325945734978,
-0.030409790575504303,
0.05547317862510681,
-0.024501504376530647,
0.0007981293019838631,
0.02158992923796177,
-0.0029541426338255405,
-0.02223694697022438,
0.019563745707273483,
-0.08574675768613815,
-0.010207541286945343,
-0.023530980572104454,
0.012208186089992523,
... |
7,385 | uuid | _is_universal | null | def _is_universal(mac):
return not (mac & (1 << 41))
| (mac) | [
0.036660537123680115,
0.03280426561832428,
0.023085763677954674,
0.0036228219978511333,
-0.010626368224620819,
-0.027322476729750633,
-0.02787584252655506,
-0.007102979347109795,
-0.024555644020438194,
-0.030469749122858047,
0.043058838695287704,
0.03928902745246887,
0.001625514472834766,
... |
7,386 | uuid | _lanscan_getnode | Get the hardware address on Unix by running lanscan. | def _lanscan_getnode():
"""Get the hardware address on Unix by running lanscan."""
# This might work on HP-UX.
return _find_mac_near_keyword('lanscan', '-ai', [b'lan0'], lambda i: 0)
| () | [
0.04457218572497368,
0.004011582117527723,
0.041541688144207,
0.01555259432643652,
0.014701331034302711,
0.026848869398236275,
-0.013909654691815376,
-0.008001882582902908,
-0.017425375059247017,
-0.09152791649103165,
0.011509090662002563,
0.029419686645269394,
-0.0017525398870930076,
-0.0... |
7,387 | uuid | _load_system_functions | [DEPRECATED] Platform-specific functions loaded at import time | def _load_system_functions():
"""[DEPRECATED] Platform-specific functions loaded at import time"""
| () | [
-0.007217560429126024,
-0.04862872138619423,
0.017586680129170418,
0.02983367256820202,
0.006658281199634075,
0.02744959108531475,
-0.0013930953573435545,
0.028886571526527405,
-0.03886378929018974,
-0.0025432920083403587,
0.01437796838581562,
-0.02859264425933361,
0.007560476195067167,
-0... |
7,388 | uuid | _netbios_getnode | [DEPRECATED] Get the hardware address on Windows. | def _netbios_getnode():
"""[DEPRECATED] Get the hardware address on Windows."""
# bpo-40501: UuidCreateSequential() is now the only supported approach
return _windll_getnode()
| () | [
0.04339749366044998,
-0.018827103078365326,
0.04774744063615799,
-0.013100809417665005,
0.014460167847573757,
-0.0005894089699722826,
-0.02270127274096012,
-0.00218771630898118,
0.023363960906863213,
-0.08115365356206894,
0.003513090079650283,
-0.0002088153996737674,
0.001878674840554595,
... |
7,389 | uuid | _netstat_getnode | Get the hardware address on Unix by running netstat. | def _netstat_getnode():
"""Get the hardware address on Unix by running netstat."""
# This works on AIX and might work on Tru64 UNIX.
return _find_mac_under_heading('netstat', '-ian', b'Address')
| () | [
0.06237024441361427,
0.02690211310982704,
0.05748520791530609,
-0.013545661233365536,
0.01825009100139141,
0.03357604146003723,
-0.01957455649971962,
-0.016401000320911407,
-0.0012782374396920204,
-0.09357257187366486,
0.02107102982699871,
0.02033139392733574,
0.01091393269598484,
-0.02375... |
7,390 | uuid | _parse_mac | null | def _parse_mac(word):
# Accept 'HH:HH:HH:HH:HH:HH' MAC address (ex: '52:54:00:9d:0e:67'),
# but reject IPv6 address (ex: 'fe80::5054:ff:fe9' or '123:2:3:4:5:6:7:8').
#
# Virtual interfaces, such as those provided by VPNs, do not have a
# colon-delimited MAC address as expected, but a 16-byte HWAddr ... | (word) | [
0.05015147104859352,
0.0950724259018898,
-0.040651921182870865,
-0.02324889972805977,
-0.045920904725790024,
-0.08399602770805359,
0.017816465348005295,
0.07311192154884338,
-0.025268035009503365,
-0.027133330702781677,
0.033248428255319595,
0.05445896089076996,
0.010711031965911388,
-0.01... |
7,391 | uuid | _random_getnode | Get a random node ID. | def _random_getnode():
"""Get a random node ID."""
# RFC 4122, $4.1.6 says "For systems with no IEEE address, a randomly or
# pseudo-randomly generated value may be used; see Section 4.5. The
# multicast bit must be set in such addresses, in order that they will
# never conflict with addresses obta... | () | [
0.00332992454059422,
0.010260464623570442,
0.02469729818403721,
-0.004825168289244175,
0.0446166917681694,
0.008589057251811028,
-0.0223083458840847,
0.04485730826854706,
0.025367580354213715,
-0.059087902307510376,
-0.0013470082776620984,
0.0686093345284462,
0.02715499885380268,
0.0637283... |
7,392 | uuid | _unix_getnode | Get the hardware address on Unix using the _uuid extension module. | def _unix_getnode():
"""Get the hardware address on Unix using the _uuid extension module."""
if _generate_time_safe:
uuid_time, _ = _generate_time_safe()
return UUID(bytes=uuid_time).node
| () | [
0.04417745769023895,
0.020121581852436066,
0.04397740960121155,
0.05828090384602547,
0.022988948971033096,
-0.003782173851504922,
-0.023855827748775482,
0.06674963980913162,
-0.03187445178627968,
-0.08975525945425034,
0.026423120871186256,
0.03840938210487366,
0.02398919314146042,
0.006759... |
7,394 | uuid | _windll_getnode | Get the hardware address on Windows using the _uuid extension module. | def _windll_getnode():
"""Get the hardware address on Windows using the _uuid extension module."""
if _UuidCreate:
uuid_bytes = _UuidCreate()
return UUID(bytes_le=uuid_bytes).node
| () | [
0.05717959254980087,
-0.034455664455890656,
0.0351615846157074,
0.004193506203591824,
0.028959564864635468,
-0.006983574945479631,
0.0014612142695114017,
0.026824994012713432,
-0.017883330583572388,
-0.07502930611371994,
0.011521637439727783,
0.021412935107946396,
0.007353342603892088,
-0.... |
7,396 | uuid | getnode | Get the hardware address as a 48-bit positive integer.
The first time this runs, it may launch a separate program, which could
be quite slow. If all attempts to obtain the hardware address fail, we
choose a random 48-bit number with its eighth bit set to 1 as recommended
in RFC 4122.
| def getnode():
"""Get the hardware address as a 48-bit positive integer.
The first time this runs, it may launch a separate program, which could
be quite slow. If all attempts to obtain the hardware address fail, we
choose a random 48-bit number with its eighth bit set to 1 as recommended
in RFC 4... | () | [
0.03742346540093422,
0.013576033525168896,
0.012268130667507648,
0.0001420982152922079,
0.03585398197174072,
0.017429988831281662,
-0.02685561031103134,
-0.017674129456281662,
-0.013113908469676971,
-0.10163278877735138,
0.023891029879450798,
0.06270959228277206,
0.015171675942838192,
0.02... |
7,401 | uuid | uuid1 | Generate a UUID from a host ID, sequence number, and the current time.
If 'node' is not given, getnode() is used to obtain the hardware
address. If 'clock_seq' is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen. | def uuid1(node=None, clock_seq=None):
"""Generate a UUID from a host ID, sequence number, and the current time.
If 'node' is not given, getnode() is used to obtain the hardware
address. If 'clock_seq' is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen."""
... | (node=None, clock_seq=None) | [
0.0315295085310936,
-0.003338392823934555,
0.01779014803469181,
0.02570759691298008,
0.013599073514342308,
-0.042015962302684784,
-0.04152495786547661,
0.06113006919622421,
-0.016159310936927795,
-0.040788453072309494,
0.03938557952642441,
0.07778915017843246,
0.029828527942299843,
0.04710... |
7,402 | uuid | uuid3 | Generate a UUID from the MD5 hash of a namespace UUID and a name. | def uuid3(namespace, name):
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
from hashlib import md5
digest = md5(
namespace.bytes + bytes(name, "utf-8"),
usedforsecurity=False
).digest()
return UUID(bytes=digest[:16], version=3)
| (namespace, name) | [
-0.04703144729137421,
-0.0009608528343960643,
-0.024111058562994003,
-0.03566755726933479,
-0.01582014560699463,
-0.020836718380451202,
-0.03388155251741409,
0.008238382637500763,
0.03817146643996239,
-0.011503969319164753,
0.04139327630400658,
0.07970482110977173,
0.0014544116565957665,
0... |
7,403 | uuid | uuid4 | Generate a random UUID. | def uuid4():
"""Generate a random UUID."""
return UUID(bytes=os.urandom(16), version=4)
| () | [
-0.015329703688621521,
0.00026984827127307653,
-0.011689944192767143,
-0.030473705381155014,
0.019387293606996536,
-0.02380700223147869,
0.0041666897013783455,
0.035004835575819016,
-0.000582059845328331,
0.018235940486192703,
0.03847746551036835,
0.029248071834445,
-0.012423466891050339,
... |
7,404 | uuid | uuid5 | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
from hashlib import sha1
hash = sha1(namespace.bytes + bytes(name, "utf-8")).digest()
return UUID(bytes=hash[:16], version=5)
| (namespace, name) | [
-0.026650482788681984,
-0.015301329083740711,
-0.013209524564445019,
-0.04696324095129967,
-0.018746132031083107,
-0.02501264400780201,
-0.027255771681666374,
-0.002828387077897787,
0.021380914375185966,
-0.014001740142703056,
0.01622706465423107,
0.08395703136920929,
0.012346099130809307,
... |
7,405 | pathlib | Path | PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers
methods to do system calls on path objects. Depending on your system,
instantiating a Path will return either a PosixPath or a WindowsPath
object. You can also instantiate a PosixPath or Win... | class Path(PurePath):
"""PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers
methods to do system calls on path objects. Depending on your system,
instantiating a Path will return either a PosixPath or a WindowsPath
object. You can also i... | (*args, **kwargs) | [
0.07145010679960251,
-0.04471677541732788,
-0.044738758355379105,
0.04451891407370567,
0.01171781774610281,
-0.0107779735699296,
0.012630180455744267,
0.057160086929798126,
-0.005886389873921871,
-0.04542028531432152,
0.04047373682260513,
0.02811836637556553,
0.025216391310095787,
0.051444... |
7,406 | pathlib | __bytes__ | Return the bytes representation of the path. This is only
recommended to use under Unix. | def __bytes__(self):
"""Return the bytes representation of the path. This is only
recommended to use under Unix."""
return os.fsencode(self)
| (self) | [
0.024480335414409637,
-0.017587492242455482,
-0.017537903040647507,
0.0632091835141182,
0.010975653305649757,
-0.07154010236263275,
-0.00293606985360384,
0.068564772605896,
0.026827538385987282,
-0.037819720804691315,
0.08112726360559464,
-0.014207189902663231,
0.012364138849079609,
0.0439... |
7,407 | pathlib | __enter__ | null | def __enter__(self):
return self
| (self) | [
0.041504357010126114,
-0.01995713636279106,
-0.027242302894592285,
0.03712351992726326,
-0.015762893483042717,
0.021352514624595642,
-0.0052610584534704685,
0.013961883261799812,
0.02975722774863243,
-0.03491687774658203,
0.0010830397950485349,
-0.04403550550341606,
0.016809426248073578,
0... |
7,408 | pathlib | __eq__ | null | def __eq__(self, other):
if not isinstance(other, PurePath):
return NotImplemented
return self._cparts == other._cparts and self._flavour is other._flavour
| (self, other) | [
0.054458942264318466,
-0.03254081308841705,
-0.013234090059995651,
0.06610848009586334,
-0.011410529725253582,
-0.08207791298627853,
-0.009586969390511513,
0.044686075299978256,
0.024520687758922577,
-0.004766928032040596,
0.0598411001265049,
-0.038737375289201736,
0.04355299100279808,
0.0... |
7,409 | pathlib | __exit__ | null | def __exit__(self, t, v, tb):
# https://bugs.python.org/issue39682
# In previous versions of pathlib, this method marked this path as
# closed; subsequent attempts to perform I/O would raise an IOError.
# This functionality was never documented, and had the effect of
# making Path objects mutable, c... | (self, t, v, tb) | [
0.057159166783094406,
0.014828868210315704,
-0.01677125319838524,
0.04206503927707672,
-0.04031946137547493,
-0.041106682270765305,
-0.005994011647999287,
0.07091844081878662,
-0.0016985172405838966,
-0.035767264664173126,
0.03946378454566002,
-0.050758711993694305,
0.035835716873407364,
-... |
7,410 | pathlib | __fspath__ | null | def __fspath__(self):
return str(self)
| (self) | [
0.01892957091331482,
-0.03986732289195061,
0.026781227439641953,
0.0317029170691967,
0.011119065806269646,
-0.06429470330476761,
0.01906125620007515,
0.05721668526530266,
0.0595540776848793,
-0.01986781880259514,
0.01708599552512169,
-0.02921738103032112,
0.014600460417568684,
0.0239006411... |
7,411 | pathlib | __ge__ | null | def __ge__(self, other):
if not isinstance(other, PurePath) or self._flavour is not other._flavour:
return NotImplemented
return self._cparts >= other._cparts
| (self, other) | [
0.042690180242061615,
-0.0257281381636858,
-0.033051036298274994,
0.08203071355819702,
-0.002948758192360401,
-0.0725162923336029,
-0.009977671317756176,
0.023340623825788498,
-0.00198773923330009,
-0.03787951543927193,
0.07661426067352295,
-0.046574342995882034,
0.024356208741664886,
0.01... |
7,412 | pathlib | __gt__ | null | def __gt__(self, other):
if not isinstance(other, PurePath) or self._flavour is not other._flavour:
return NotImplemented
return self._cparts > other._cparts
| (self, other) | [
0.03215450793504715,
-0.010125664062798023,
-0.04729436710476875,
0.05896762013435364,
0.0083083501085639,
-0.08065157383680344,
-0.016139158979058266,
0.0332157127559185,
-0.0019201176473870873,
-0.04711749777197838,
0.07782169431447983,
-0.02187850885093212,
0.02695460431277752,
0.001325... |
7,413 | pathlib | __hash__ | null | def __hash__(self):
try:
return self._hash
except AttributeError:
self._hash = hash(tuple(self._cparts))
return self._hash
| (self) | [
0.030627576634287834,
-0.03791001811623573,
-0.0075148604810237885,
0.07774824649095535,
0.00357666052877903,
-0.06865810602903366,
-0.008418709971010685,
0.007071543950587511,
0.007329786662012339,
-0.03911514952778816,
0.005948188714683056,
0.01700958050787449,
0.007988305762410164,
0.02... |
7,414 | pathlib | __le__ | null | def __le__(self, other):
if not isinstance(other, PurePath) or self._flavour is not other._flavour:
return NotImplemented
return self._cparts <= other._cparts
| (self, other) | [
0.01858804188668728,
-0.016665447503328323,
-0.02953886240720749,
0.0808730497956276,
-0.0009031547233462334,
-0.07335986196994781,
-0.008323864080011845,
0.029981857165694237,
-0.008762428537011147,
-0.03660905361175537,
0.07775437086820602,
-0.03412828594446182,
0.03714064508676529,
0.02... |
7,415 | pathlib | __lt__ | null | def __lt__(self, other):
if not isinstance(other, PurePath) or self._flavour is not other._flavour:
return NotImplemented
return self._cparts < other._cparts
| (self, other) | [
0.013877276331186295,
-0.009084109216928482,
-0.02824796736240387,
0.04655716195702553,
0.002852551406249404,
-0.0574827641248703,
0.02505839616060257,
0.04042472690343857,
0.003980355337262154,
-0.03778143599629402,
0.06576507538557053,
-0.04722679406404495,
0.01610645279288292,
0.0427508... |
7,416 | pathlib | __new__ | null | def __new__(cls, *args, **kwargs):
if cls is Path:
cls = WindowsPath if os.name == 'nt' else PosixPath
self = cls._from_parts(args)
if not self._flavour.is_supported:
raise NotImplementedError("cannot instantiate %r on your system"
% (cls.__name__,))
ret... | (cls, *args, **kwargs) | [
0.05543939769268036,
-0.054162152111530304,
0.00422009127214551,
-0.016664613038301468,
-0.027805998921394348,
-0.05181477963924408,
0.015482298098504543,
0.06752146035432816,
0.00024137152649927884,
0.020643062889575958,
0.06838446110486984,
0.07732518762350082,
-0.028686264529824257,
0.0... |
7,417 | pathlib | __reduce__ | null | def __reduce__(self):
# Using the parts tuple helps share interned path parts
# when pickling related paths.
return (self.__class__, tuple(self._parts))
| (self) | [
0.012321490794420242,
-0.011523758992552757,
-0.04567882791161537,
0.033886268734931946,
-0.006147739011794329,
-0.05608402565121651,
0.019388355314731598,
0.002089710906147957,
0.026446549221873283,
-0.014385188929736614,
0.06666264683008194,
0.05702049657702446,
0.002885275287553668,
0.0... |
7,418 | pathlib | __repr__ | null | def __repr__(self):
return "{}({!r})".format(self.__class__.__name__, self.as_posix())
| (self) | [
0.05731072276830673,
-0.022340036928653717,
0.02843584306538105,
0.0523800402879715,
0.06170105189085007,
-0.07828299701213837,
-0.005610337946563959,
0.03319766744971275,
0.0322689414024353,
-0.0502861887216568,
-0.0030669004190713167,
0.00649684714153409,
-0.012022756040096283,
0.0404586... |
7,419 | pathlib | __rtruediv__ | null | def __rtruediv__(self, key):
try:
return self._from_parts([key] + self._parts)
except TypeError:
return NotImplemented
| (self, key) | [
0.019851213321089745,
-0.03210313618183136,
-0.03365401178598404,
0.06561928987503052,
0.03563568741083145,
-0.032309919595718384,
0.005682237911969423,
-0.016542678698897362,
0.033447228372097015,
-0.021867353469133377,
0.04459630325436592,
0.05714116990566254,
0.029725125059485435,
0.017... |
7,420 | pathlib | __str__ | Return the string representation of the path, suitable for
passing to system calls. | def __str__(self):
"""Return the string representation of the path, suitable for
passing to system calls."""
try:
return self._str
except AttributeError:
self._str = self._format_parsed_parts(self._drv, self._root,
self._parts) or '.'
... | (self) | [
0.04228530451655388,
0.004068681504577398,
0.010272941552102566,
0.022745400667190552,
0.04869630187749863,
-0.07781859487295151,
0.05480038747191429,
0.031731028109788895,
0.04828708991408348,
-0.0438198521733284,
0.032515350729227066,
0.003763903398066759,
-0.008278029970824718,
0.019250... |
7,421 | pathlib | __truediv__ | null | def __truediv__(self, key):
try:
return self._make_child((key,))
except TypeError:
return NotImplemented
| (self, key) | [
0.029760807752609253,
-0.03861696645617485,
-0.014622957445681095,
0.05008191242814064,
0.009285234846174717,
0.0003277078503742814,
-0.0019244120921939611,
0.013507355935871601,
0.0481596477329731,
-0.028027335181832314,
0.05032219737768173,
0.07462514191865921,
0.03631711006164551,
-0.00... |
7,422 | pathlib | _make_child | null | def _make_child(self, args):
drv, root, parts = self._parse_args(args)
drv, root, parts = self._flavour.join_parsed_parts(
self._drv, self._root, self._parts, drv, root, parts)
return self._from_parsed_parts(drv, root, parts)
| (self, args) | [
-0.005549737252295017,
-0.010827303864061832,
-0.03034706972539425,
-0.01686609908938408,
-0.022692259401082993,
0.01360855158418417,
0.0485825277864933,
0.10560235381126404,
0.009245309047400951,
-0.011643816716969013,
0.050555769354104996,
0.10090740770101547,
-0.0003941695613320917,
0.0... |
7,423 | pathlib | _make_child_relpath | null | def _make_child_relpath(self, part):
# This is an optimization used for dir walking. `part` must be
# a single part relative to this path.
parts = self._parts + [part]
return self._from_parsed_parts(self._drv, self._root, parts)
| (self, part) | [
-0.0013556921621784568,
0.04646394029259682,
-0.0433482825756073,
0.06593680381774902,
-0.00020385651441756636,
-0.012885954231023788,
0.06265181303024292,
0.12699691951274872,
0.002851080847904086,
-0.02362142689526081,
0.06844287365674973,
0.07199878990650177,
0.040503550320863724,
0.017... |
7,424 | pathlib | absolute | Return an absolute version of this path. This function works
even if the path doesn't point to anything.
No normalization is done, i.e. all '.' and '..' will be kept along.
Use resolve() to get the canonical path to a file.
| def absolute(self):
"""Return an absolute version of this path. This function works
even if the path doesn't point to anything.
No normalization is done, i.e. all '.' and '..' will be kept along.
Use resolve() to get the canonical path to a file.
"""
# XXX untested yet!
if self.is_absolute(... | (self) | [
0.07779206335544586,
0.019553139805793762,
-0.014612292870879173,
0.05515527352690697,
0.020078763365745544,
-0.07113418728113174,
0.030889056622982025,
0.002171476138755679,
0.006057794205844402,
-0.017582057043910027,
0.038650743663311005,
0.02288207970559597,
-0.01069640927016735,
0.025... |
7,425 | pathlib | as_posix | Return the string representation of the path with forward (/)
slashes. | def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/')
| (self) | [
-0.002650156617164612,
0.010839033871889114,
-0.00898286048322916,
0.06494905799627304,
0.016288351267576218,
-0.06777589023113251,
0.029971249401569366,
0.07458753883838654,
0.05316490679979324,
-0.018970437347888947,
0.052960559725761414,
-0.018646884709596634,
0.018067894503474236,
0.04... |
7,426 | pathlib | as_uri | Return the path as a 'file' URI. | def as_uri(self):
"""Return the path as a 'file' URI."""
if not self.is_absolute():
raise ValueError("relative path can't be expressed as a file URI")
return self._flavour.make_uri(self)
| (self) | [
-0.0019011491676792502,
-0.03231953829526901,
-0.021357955411076546,
0.050046470016241074,
0.026050882413983345,
-0.0655297040939331,
0.019028618931770325,
0.06439928710460663,
0.04329824447631836,
0.0011582451406866312,
0.05665767192840576,
-0.0010870591504499316,
0.011698062531650066,
0.... |
7,427 | pathlib | chmod |
Change the permissions of the path, like os.chmod().
| def chmod(self, mode, *, follow_symlinks=True):
"""
Change the permissions of the path, like os.chmod().
"""
self._accessor.chmod(self, mode, follow_symlinks=follow_symlinks)
| (self, mode, *, follow_symlinks=True) | [
0.019351735711097717,
0.03066941536962986,
0.027169102802872658,
0.02486889623105526,
0.017901604995131493,
-0.0008443465339951217,
0.027819160372018814,
0.04553741589188576,
0.007704857271164656,
0.004148288629949093,
0.024318845942616463,
-0.006675598677247763,
0.09274164587259293,
0.029... |
7,428 | pathlib | exists |
Whether this path exists.
| def exists(self):
"""
Whether this path exists.
"""
try:
self.stat()
except OSError as e:
if not _ignore_error(e):
raise
return False
except ValueError:
# Non-encodable path
return False
return True
| (self) | [
0.04168239235877991,
-0.038566600531339645,
-0.023697340860962868,
0.03153875470161438,
0.06068873405456543,
-0.002944857580587268,
0.017673473805189133,
-0.00396830914542079,
0.00022949225967749953,
0.005989247467368841,
0.048952579498291016,
0.029288459569215775,
0.09409696608781815,
-0.... |
7,429 | pathlib | expanduser | Return a new path with expanded ~ and ~user constructs
(as returned by os.path.expanduser)
| def expanduser(self):
""" Return a new path with expanded ~ and ~user constructs
(as returned by os.path.expanduser)
"""
if (not (self._drv or self._root) and
self._parts and self._parts[0][:1] == '~'):
homedir = self._accessor.expanduser(self._parts[0])
if homedir[:1] == "~":
... | (self) | [
0.02325648069381714,
-0.024874622002243996,
0.052916668355464935,
0.03112340159714222,
0.006024994887411594,
-0.02680261991918087,
0.03938625380396843,
-0.004647853318601847,
0.0025261943228542805,
-0.01933162659406662,
0.12277217954397202,
-0.03924853727221489,
0.01631912961602211,
0.0633... |
7,430 | pathlib | glob | Iterate over this subtree and yield all existing files (of any
kind, including directories) matching the given relative pattern.
| def glob(self, pattern):
"""Iterate over this subtree and yield all existing files (of any
kind, including directories) matching the given relative pattern.
"""
sys.audit("pathlib.Path.glob", self, pattern)
if not pattern:
raise ValueError("Unacceptable pattern: {!r}".format(pattern))
dr... | (self, pattern) | [
0.05665779486298561,
-0.04774494096636772,
0.0014254014240577817,
-0.021757852286100388,
0.015055734664201736,
0.0035258205607533455,
0.05096055939793587,
-0.003783594351261854,
-0.0029534753412008286,
-0.00494576059281826,
0.03304746747016907,
0.02612689882516861,
-0.00721329590305686,
0.... |
7,431 | pathlib | group |
Return the group name of the file gid.
| def group(self):
"""
Return the group name of the file gid.
"""
return self._accessor.group(self)
| (self) | [
0.03136149048805237,
0.024647152051329613,
-0.030340107157826424,
0.09390028566122055,
0.05314541980624199,
-0.029084308072924614,
0.0035622837021946907,
0.027778277173638344,
0.03104335442185402,
-0.024111343547701836,
0.0013321936130523682,
-0.05723095312714577,
0.008824082091450691,
0.0... |
7,432 | pathlib | hardlink_to |
Make this path a hard link pointing to the same file as *target*.
Note the order of arguments (self, target) is the reverse of os.link's.
| def hardlink_to(self, target):
"""
Make this path a hard link pointing to the same file as *target*.
Note the order of arguments (self, target) is the reverse of os.link's.
"""
self._accessor.link(target, self)
| (self, target) | [
0.027086254209280014,
0.01949596218764782,
-0.03646751493215561,
0.04213038086891174,
-0.02602872997522354,
-0.013952490873634815,
-0.018950143828988075,
0.07450425624847412,
-0.027751469984650612,
0.008869553916156292,
0.026455150917172432,
-0.031401634216308594,
0.08930958807468414,
0.00... |
7,433 | pathlib | is_absolute | True if the path is absolute (has both a root and, if applicable,
a drive). | def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv)
| (self) | [
0.09019461274147034,
-0.0032890518195927143,
0.010952203534543514,
0.026295458897948265,
0.058117881417274475,
-0.04140136390924454,
0.0488610677421093,
0.019276555627584457,
-0.04065539315342903,
-0.012537389993667603,
0.028719864785671234,
0.011206511408090591,
0.018734032288193703,
-0.0... |
7,434 | pathlib | is_block_device |
Whether this path is a block device.
| def is_block_device(self):
"""
Whether this path is a block device.
"""
try:
return S_ISBLK(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see http://web.archive.org/web/2020062306172... | (self) | [
0.0977097675204277,
-0.01575418747961521,
0.01807595044374466,
0.03718379884958267,
-0.003311404027044773,
-0.018983306363224983,
-0.0013132196618244052,
0.03531571105122566,
-0.055508825927972794,
-0.04191628098487854,
0.03296726197004318,
-0.0020671256352216005,
0.03255806118249893,
-0.0... |
7,435 | pathlib | is_char_device |
Whether this path is a character device.
| def is_char_device(self):
"""
Whether this path is a character device.
"""
try:
return S_ISCHR(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see http://web.archive.org/web/2020062306... | (self) | [
0.04711774364113808,
0.012433849275112152,
0.024289775639772415,
0.03732704371213913,
0.03685110807418823,
-0.007355773355811834,
0.034182462841272354,
0.04178045317530632,
0.020278306677937508,
-0.05517467483878136,
0.08532866835594177,
0.013887155801057816,
0.045587945729494095,
0.020771... |
7,436 | pathlib | is_dir |
Whether this path is a directory.
| def is_dir(self):
"""
Whether this path is a directory.
"""
try:
return S_ISDIR(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see http://web.archive.org/web/20200623061726/https://bi... | (self) | [
0.027901632711291313,
0.03505589812994003,
0.005053846165537834,
0.008282437920570374,
0.06013251468539238,
0.0037468168884515762,
0.03955024480819702,
0.006301256362348795,
-0.029809437692165375,
0.005076776724308729,
0.05470260977745056,
0.02113259769976139,
0.04839218035340309,
-0.00756... |
7,437 | pathlib | is_fifo |
Whether this path is a FIFO.
| def is_fifo(self):
"""
Whether this path is a FIFO.
"""
try:
return S_ISFIFO(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see http://web.archive.org/web/20200623061726/https://bitbu... | (self) | [
0.03914949670433998,
0.04270543158054352,
-0.05385192483663559,
-0.00503045367076993,
0.03048189915716648,
0.01191580668091774,
-0.0013056955067440867,
0.021677536889910698,
-0.023455504328012466,
-0.04171387106180191,
0.0893087163567543,
0.006637463346123695,
0.014710978604853153,
-0.0232... |
7,438 | pathlib | is_file |
Whether this path is a regular file (also True for symlinks pointing
to regular files).
| def is_file(self):
"""
Whether this path is a regular file (also True for symlinks pointing
to regular files).
"""
try:
return S_ISREG(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
... | (self) | [
0.06549825519323349,
-0.00341174378991127,
0.025632107630372047,
0.05173386633396149,
0.029425442218780518,
-0.027257822453975677,
0.0722540020942688,
0.011090989224612713,
-0.021351058036088943,
-0.0213329941034317,
0.0756499394774437,
0.025541789829730988,
0.04443621262907982,
-0.0135295... |
7,439 | pathlib | is_mount |
Check if this path is a POSIX mount point
| def is_mount(self):
"""
Check if this path is a POSIX mount point
"""
# Need to exist and be a dir
if not self.exists() or not self.is_dir():
return False
try:
parent_dev = self.parent.stat().st_dev
except OSError:
return False
dev = self.stat().st_dev
if dev ... | (self) | [
0.08025059849023819,
0.013398482464253902,
0.06558942794799805,
0.06639614701271057,
0.04643872007727623,
0.03386449068784714,
0.03047979436814785,
0.03612679988145828,
-0.06071406602859497,
-0.016318440437316895,
0.03456598147749901,
-0.008637110702693462,
0.030883152037858963,
-0.0373544... |
7,440 | pathlib | is_relative_to | Return True if the path is relative to another path or False.
| def is_relative_to(self, *other):
"""Return True if the path is relative to another path or False.
"""
try:
self.relative_to(*other)
return True
except ValueError:
return False
| (self, *other) | [
0.007534189615398645,
-0.014067880809307098,
-0.003603969933465123,
0.057419922202825546,
-0.042769141495227814,
-0.048998333513736725,
0.05004233121871948,
0.062117915600538254,
0.012388782575726509,
0.0029231959488242865,
0.06037791818380356,
-0.04489193856716156,
0.07012190669775009,
0.... |
7,441 | pathlib | is_reserved | Return True if the path contains one of the special names reserved
by the system, if any. | def is_reserved(self):
"""Return True if the path contains one of the special names reserved
by the system, if any."""
return self._flavour.is_reserved(self._parts)
| (self) | [
0.06812002509832382,
0.027363747358322144,
-0.002891381038352847,
0.04070667549967766,
0.036209430545568466,
-0.03614329546689987,
0.032092466950416565,
0.007188150659203529,
0.06127495691180229,
-0.02513165958225727,
0.017030006274580956,
0.003056720830500126,
0.037432946264743805,
-0.010... |
7,442 | pathlib | is_socket |
Whether this path is a socket.
| def is_socket(self):
"""
Whether this path is a socket.
"""
try:
return S_ISSOCK(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see http://web.archive.org/web/20200623061726/https://b... | (self) | [
0.044879250228405,
0.007180337328463793,
0.0034703537821769714,
0.03882003575563431,
0.022593671455979347,
-0.0037827284540981054,
0.03214463219046593,
0.022747719660401344,
0.006760985124856234,
-0.029868150129914284,
0.06137947738170624,
0.011356743983924389,
0.01181032881140709,
-0.0577... |
7,443 | pathlib | is_symlink |
Whether this path is a symbolic link.
| def is_symlink(self):
"""
Whether this path is a symbolic link.
"""
try:
return S_ISLNK(self.lstat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist
return False
except ValueError:
# Non-encodable path
... | (self) | [
0.04923790693283081,
0.01680511236190796,
0.010382776148617268,
0.02788364142179489,
0.03644675761461258,
-0.004709713160991669,
0.005900521297007799,
0.011827802285552025,
0.013379866257309914,
0.020676353946328163,
0.024547595530748367,
-0.011676163412630558,
0.09262435883283615,
-0.0305... |
7,444 | pathlib | iterdir | Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
| def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
for name in self._accessor.listdir(self):
if name in {'.', '..'}:
# Yielding a path object for these makes little sense
continue
yiel... | (self) | [
0.01564945839345455,
-0.02720598317682743,
-0.03837358579039574,
0.02063135802745819,
-0.000739066512323916,
0.00429897103458643,
0.020186876878142357,
0.025039134547114372,
0.015325358137488365,
-0.009991577826440334,
0.021242519840598106,
-0.00809790100902319,
0.011704684235155582,
0.078... |
7,445 | pathlib | joinpath | Combine this path with one or several arguments, and return a
new path representing either a subpath (if all arguments are relative
paths) or a totally different path (if one of the arguments is
anchored).
| def joinpath(self, *args):
"""Combine this path with one or several arguments, and return a
new path representing either a subpath (if all arguments are relative
paths) or a totally different path (if one of the arguments is
anchored).
"""
return self._make_child(args)
| (self, *args) | [
-0.06312806159257889,
0.0003072628751397133,
-0.023002827540040016,
0.02234560437500477,
-0.03881078585982323,
-0.05292380228638649,
-0.003504472319036722,
0.06060294061899185,
0.036839116364717484,
-0.010489636100828648,
0.04507170617580414,
0.012798566371202469,
0.029557770118117332,
0.0... |
7,446 | pathlib | lchmod |
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
| def lchmod(self, mode):
"""
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
"""
self.chmod(mode, follow_symlinks=False)
| (self, mode) | [
0.018641185015439987,
0.050590336322784424,
0.05333217978477478,
0.03601175919175148,
-0.0015318372752517462,
0.012146027758717537,
0.012137668207287788,
0.03601175919175148,
-0.00009652351582190022,
-0.010716591961681843,
0.0004137841460760683,
-0.020095698535442352,
0.0637645572423935,
0... |
7,447 | pathlib | link_to |
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to *target*,
despite the implication of the function and argument names. The order
of arguments (target, link) is the reverse of Path.symlink_to, but
matches that of o... | def link_to(self, target):
"""
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to *target*,
despite the implication of the function and argument names. The order
of arguments (target, link) is the reverse of Path.symlink_to, but
matc... | (self, target) | [
0.023837819695472717,
0.02282608672976494,
-0.039759282022714615,
0.01980864256620407,
-0.020997870713472366,
-0.01056993380188942,
-0.022329095751047134,
0.04898911342024803,
-0.0004537261847872287,
0.01911640353500843,
0.03164767846465111,
-0.04391270503401756,
0.12751369178295135,
-0.02... |
7,448 | pathlib | lstat |
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
| def lstat(self):
"""
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
"""
return self.stat(follow_symlinks=False)
| (self) | [
0.032464612275362015,
0.0023248959332704544,
0.030685268342494965,
0.05663681402802467,
0.07318805903196335,
0.007432113401591778,
0.012018956243991852,
0.006756466347724199,
0.013269532471895218,
-0.01117964368313551,
-0.01358007825911045,
-0.03874266892671585,
0.05539463087916374,
-0.034... |
7,449 | pathlib | match |
Return True if this path matches the given pattern.
| def match(self, path_pattern):
"""
Return True if this path matches the given pattern.
"""
cf = self._flavour.casefold
path_pattern = cf(path_pattern)
drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
if not pat_parts:
raise ValueError("empty pattern")
if drv and ... | (self, path_pattern) | [
0.10540812462568283,
-0.021675819531083107,
0.028145164251327515,
0.024681955575942993,
0.00979191530495882,
-0.06455280631780624,
0.08424212038516998,
-0.003992798738181591,
-0.046129241585731506,
-0.004366368055343628,
0.010969758033752441,
0.057661548256874084,
0.03856994956731796,
-0.0... |
7,450 | pathlib | mkdir |
Create a new directory at this given path.
| def mkdir(self, mode=0o777, parents=False, exist_ok=False):
"""
Create a new directory at this given path.
"""
try:
self._accessor.mkdir(self, mode)
except FileNotFoundError:
if not parents or self.parent == self:
raise
self.parent.mkdir(parents=True, exist_ok=Tru... | (self, mode=511, parents=False, exist_ok=False) | [
-0.024146579205989838,
0.08999920636415482,
-0.008085866458714008,
-0.023628491908311844,
0.023258429020643234,
0.01399761438369751,
-0.00015669835556764156,
0.05791478604078293,
0.019946370273828506,
0.003323623910546303,
0.056989628821611404,
0.040669869631528854,
0.08444827049970627,
-0... |
7,451 | pathlib | open |
Open the file pointed by this path and return a file object, as
the built-in open() function does.
| def open(self, mode='r', buffering=-1, encoding=None,
errors=None, newline=None):
"""
Open the file pointed by this path and return a file object, as
the built-in open() function does.
"""
if "b" not in mode:
encoding = io.text_encoding(encoding)
return self._accessor.open(self,... | (self, mode='r', buffering=-1, encoding=None, errors=None, newline=None) | [
0.014490148983895779,
-0.05991632118821144,
-0.06702805310487747,
0.026188943535089493,
0.01589471474289894,
-0.02019731141626835,
0.008405175060033798,
0.01966393180191517,
0.005524924956262112,
-0.0012034379178658128,
0.02014397270977497,
-0.008138485252857208,
-0.02204636111855507,
0.05... |
7,452 | pathlib | owner |
Return the login name of the file owner.
| def owner(self):
"""
Return the login name of the file owner.
"""
return self._accessor.owner(self)
| (self) | [
0.02414020150899887,
0.0032573852222412825,
0.0023986005689948797,
0.07278039306402206,
0.051775507628917694,
-0.03479684144258499,
0.031113276258111,
0.03287795931100845,
0.020285308361053467,
-0.00035711308009922504,
0.004411711823195219,
-0.05989648401737213,
-0.007105854339897633,
0.00... |
7,453 | pathlib | read_bytes |
Open the file in bytes mode, read it, and close the file.
| def read_bytes(self):
"""
Open the file in bytes mode, read it, and close the file.
"""
with self.open(mode='rb') as f:
return f.read()
| (self) | [
0.02918911725282669,
-0.0943247377872467,
-0.05005341395735741,
0.07690879702568054,
0.00872538611292839,
-0.04942644014954567,
-0.016135869547724724,
0.08380550891160965,
0.04308703914284706,
-0.06579742580652237,
0.04949610307812691,
0.0029302320908755064,
-0.011381317861378193,
0.038280... |
7,454 | pathlib | read_text |
Open the file in text mode, read it, and close the file.
| def read_text(self, encoding=None, errors=None):
"""
Open the file in text mode, read it, and close the file.
"""
encoding = io.text_encoding(encoding)
with self.open(mode='r', encoding=encoding, errors=errors) as f:
return f.read()
| (self, encoding=None, errors=None) | [
0.0015093828551471233,
-0.06972431391477585,
0.023538509383797646,
0.0692000687122345,
0.01516809593886137,
0.002481416566297412,
-0.01728254370391369,
-0.009182989597320557,
0.13050155341625214,
-0.04138024523854256,
0.020270727574825287,
-0.01330703403800726,
-0.02465689368546009,
-0.003... |
7,455 | pathlib | readlink |
Return the path to which the symbolic link points.
| def readlink(self):
"""
Return the path to which the symbolic link points.
"""
path = self._accessor.readlink(self)
return self._from_parts((path,))
| (self) | [
0.012669295072555542,
0.026093941181898117,
-0.02423989772796631,
0.048136454075574875,
0.03148439899086952,
-0.007227335125207901,
0.012274452485144138,
0.043364010751247406,
0.04655708372592926,
-0.004300350323319435,
0.03294359892606735,
0.005193037446588278,
0.06736356765031815,
0.0479... |
7,456 | pathlib | relative_to | Return the relative path to another path identified by the passed
arguments. If the operation is not possible (because this is not
a subpath of the other path), raise ValueError.
| def relative_to(self, *other):
"""Return the relative path to another path identified by the passed
arguments. If the operation is not possible (because this is not
a subpath of the other path), raise ValueError.
"""
# For the purpose of this method, drive and root are considered
# separate par... | (self, *other) | [
0.007094819098711014,
-0.0026335082948207855,
-0.03040505200624466,
0.046703338623046875,
-0.03557998687028885,
-0.06611394882202148,
0.053148988634347916,
0.04935526102781296,
0.016095709055662155,
-0.03394095227122307,
0.046150851994752884,
-0.011068101972341537,
0.04290961101651192,
0.0... |
7,457 | pathlib | rename |
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are
interpreted relative to the current working directory, *not* the
directory of the Path object.
Returns the new Path instance pointing to the target path.
| def rename(self, target):
"""
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are
interpreted relative to the current working directory, *not* the
directory of the Path object.
Returns the new Path instance pointing to the target path.
"""
... | (self, target) | [
0.020855797454714775,
-0.0011272956617176533,
-0.011364642530679703,
0.009058132767677307,
-0.06493576616048813,
-0.051750656217336655,
0.02956927940249443,
0.11361107230186462,
0.04909949749708176,
-0.001909940387122333,
0.024196259677410126,
-0.04252461716532707,
0.10788456350564957,
0.0... |
7,458 | pathlib | replace |
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are
interpreted relative to the current working directory, *not* the
directory of the Path object.
Returns the new Path instance pointing to the ta... | def replace(self, target):
"""
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are
interpreted relative to the current working directory, *not* the
directory of the Path object.
Returns the new Path instance pointi... | (self, target) | [
0.05267772078514099,
-0.008984341286122799,
0.00045596191193908453,
0.0015606344677507877,
-0.056117039173841476,
-0.04095596447587013,
0.020793836563825607,
0.09938927739858627,
0.041131436824798584,
0.017275555059313774,
0.02702321484684944,
-0.04481642320752144,
0.08233306556940079,
0.0... |
7,459 | pathlib | resolve |
Make the path absolute, resolving all symlinks on the way and also
normalizing it (for example turning slashes into backslashes under
Windows).
| def resolve(self, strict=False):
"""
Make the path absolute, resolving all symlinks on the way and also
normalizing it (for example turning slashes into backslashes under
Windows).
"""
def check_eloop(e):
winerror = getattr(e, 'winerror', 0)
if e.errno == ELOOP or winerror == _WI... | (self, strict=False) | [
0.04005591943860054,
0.028533224016427994,
-0.017592841759324074,
0.06190139055252075,
-0.008368510752916336,
0.0056642950512468815,
0.022657180204987526,
0.02570989914238453,
0.036315012723207474,
-0.018263380974531174,
0.02496877685189247,
0.013110813684761524,
0.019498584792017937,
0.00... |
7,460 | pathlib | rglob | Recursively yield all existing files (of any kind, including
directories) matching the given relative pattern, anywhere in
this subtree.
| def rglob(self, pattern):
"""Recursively yield all existing files (of any kind, including
directories) matching the given relative pattern, anywhere in
this subtree.
"""
sys.audit("pathlib.Path.rglob", self, pattern)
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
if drv or ... | (self, pattern) | [
0.05032836273312569,
-0.05130764842033386,
-0.004094206728041172,
-0.0026034172624349594,
0.008463838137686253,
-0.003276677103713155,
0.04791511967778206,
-0.0019389010267332196,
0.022733449935913086,
-0.02582869678735733,
0.04186452180147171,
0.024744486436247826,
-0.010623516514897346,
... |
7,461 | pathlib | rmdir |
Remove this directory. The directory must be empty.
| def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
self._accessor.rmdir(self)
| (self) | [
-0.012258918955922127,
0.07143723964691162,
0.017042048275470734,
-0.04783128947019577,
0.042394351214170456,
-0.02205745130777359,
-0.04944860562682152,
0.07467187196016312,
-0.000300558574963361,
0.045147232711315155,
-0.00017313034913968295,
0.005458444822579622,
0.07714946568012238,
0.... |
7,462 | pathlib | samefile | Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
| def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
st = self.stat()
try:
other_st = other_path.stat()
except AttributeError:
other_st = self._accessor.stat(other_path)
return os.path.samestat(s... | (self, other_path) | [
0.07458117604255676,
-0.04324307292699814,
0.009716561064124107,
0.09664039313793182,
0.0033811007160693407,
-0.04166741669178009,
-0.00013862238847650588,
0.030970444902777672,
0.02379244565963745,
0.01565154269337654,
0.0273114163428545,
-0.05598840117454529,
0.04485374689102173,
0.03151... |
7,463 | pathlib | stat |
Return the result of the stat() system call on this path, like
os.stat() does.
| def stat(self, *, follow_symlinks=True):
"""
Return the result of the stat() system call on this path, like
os.stat() does.
"""
return self._accessor.stat(self, follow_symlinks=follow_symlinks)
| (self, *, follow_symlinks=True) | [
0.042175889015197754,
-0.044703781604766846,
0.01757883094251156,
0.05594624951481819,
0.0735749751329422,
-0.0006439265562221408,
0.0330621711909771,
0.008847623132169247,
0.009778952226042747,
-0.0002458250673953444,
0.03312869742512703,
-0.003186890622600913,
0.07497196644544601,
-0.032... |
7,464 | pathlib | symlink_to |
Make this path a symlink pointing to the target path.
Note the order of arguments (link, target) is the reverse of os.symlink.
| def symlink_to(self, target, target_is_directory=False):
"""
Make this path a symlink pointing to the target path.
Note the order of arguments (link, target) is the reverse of os.symlink.
"""
self._accessor.symlink(target, self, target_is_directory)
| (self, target, target_is_directory=False) | [
0.01938869059085846,
0.02771623246371746,
-0.011794334277510643,
0.016492154449224472,
-0.006693714763969183,
-0.00728659937158227,
-0.009277968667447567,
0.04670665040612221,
-0.004688768181949854,
0.045656654983758926,
0.025018833577632904,
-0.05496177822351456,
0.12071315944194794,
-0.0... |
7,465 | pathlib | touch |
Create this file with the given access mode, if it doesn't exist.
| def touch(self, mode=0o666, exist_ok=True):
"""
Create this file with the given access mode, if it doesn't exist.
"""
self._accessor.touch(self, mode, exist_ok)
| (self, mode=438, exist_ok=True) | [
0.04476990923285484,
0.038970697671175,
-0.0036969969514757395,
0.015326485969126225,
0.05891998112201691,
-0.026792354881763458,
-0.035888832062482834,
0.08357491344213486,
-0.04533325880765915,
-0.005703938193619251,
0.03370169922709465,
0.005140586290508509,
0.07051840424537659,
-0.0283... |
7,466 | pathlib | unlink |
Remove this file or link.
If the path is a directory, use rmdir() instead.
| def unlink(self, missing_ok=False):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
try:
self._accessor.unlink(self)
except FileNotFoundError:
if not missing_ok:
raise
| (self, missing_ok=False) | [
0.021585553884506226,
0.03884352743625641,
-0.01625460386276245,
0.023557396605610847,
0.014431086368858814,
-0.01992781274020672,
-0.025599036365747452,
0.07503467053174973,
-0.005928611382842064,
0.056084051728248596,
0.02807692624628544,
-0.00566249992698431,
0.08550462126731873,
-0.004... |
7,467 | pathlib | with_name | Return a new path with the file name changed. | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
or drv or root o... | (self, name) | [
0.004537875298410654,
-0.031104139983654022,
-0.016566915437579155,
0.05270077660679817,
-0.060926370322704315,
-0.08254081010818481,
0.013878464698791504,
0.06210145354270935,
0.06580474972724915,
0.0116885332390666,
0.018801357597112656,
-0.011563903652131557,
0.01924646645784378,
0.0831... |
7,468 | pathlib | with_stem | Return a new path with the stem changed. | def with_stem(self, stem):
"""Return a new path with the stem changed."""
return self.with_name(stem + self.suffix)
| (self, stem) | [
0.056515198200941086,
-0.00520931463688612,
0.005602944176644087,
0.027034834027290344,
-0.05169114097952843,
-0.03128938749432564,
-0.00533912843093276,
0.07256189733743668,
0.07349991053342819,
0.035242434591054916,
0.05604619160294533,
-0.014195800758898258,
-0.0012457966804504395,
0.02... |
7,469 | pathlib | with_suffix | Return a new path with the file suffix changed. If the path
has no suffix, add given suffix. If the given suffix is an empty
string, remove the suffix from the path.
| def with_suffix(self, suffix):
"""Return a new path with the file suffix changed. If the path
has no suffix, add given suffix. If the given suffix is an empty
string, remove the suffix from the path.
"""
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise Val... | (self, suffix) | [
0.016100550070405006,
-0.0025290485937148333,
-0.019124511629343033,
0.03592429682612419,
-0.03912079334259033,
-0.04696675017476082,
0.023283593356609344,
0.10853568464517593,
0.07119476050138474,
-0.05314180627465248,
0.040392130613327026,
0.007223907392472029,
0.01936061680316925,
0.004... |
7,470 | pathlib | write_bytes |
Open the file in bytes mode, write to it, and close the file.
| def write_bytes(self, data):
"""
Open the file in bytes mode, write to it, and close the file.
"""
# type-check for the buffer interface before truncating the file
view = memoryview(data)
with self.open(mode='wb') as f:
return f.write(view)
| (self, data) | [
0.0062534804455935955,
-0.040349528193473816,
-0.03359559550881386,
0.06785266101360321,
0.0413939505815506,
-0.05890543758869171,
-0.0642319917678833,
0.08111682534217834,
-0.022350644692778587,
-0.05761731415987015,
0.05476256087422371,
-0.038574010133743286,
0.016562802717089653,
0.0009... |
7,471 | pathlib | write_text |
Open the file in text mode, write to it, and close the file.
| def write_text(self, data, encoding=None, errors=None, newline=None):
"""
Open the file in text mode, write to it, and close the file.
"""
if not isinstance(data, str):
raise TypeError('data must be str, not %s' %
data.__class__.__name__)
encoding = io.text_encoding(e... | (self, data, encoding=None, errors=None, newline=None) | [
-0.02506779506802559,
-0.04167855530977249,
0.023676130920648575,
0.07018982619047165,
0.018038107082247734,
-0.030081354081630707,
-0.04653153941035271,
0.029867252334952354,
0.06961888819932938,
-0.022659145295619965,
0.03136596828699112,
-0.050278324633836746,
0.034024402499198914,
-0.0... |
7,472 | gruut_lang_de | get_lang_dir | Get directory with language resources | def get_lang_dir() -> Path:
"""Get directory with language resources"""
return _DIR
| () -> pathlib.Path | [
-0.008269443176686764,
-0.03895905986428261,
0.01665472984313965,
-0.002613161923363805,
0.024024158716201782,
-0.00907589215785265,
0.036998629570007324,
0.038816481828689575,
0.0055114771239459515,
-0.030564861372113228,
0.045089855790138245,
-0.03714120760560036,
0.008371920324862003,
0... |
7,473 | orjson | Fragment | null | from orjson import Fragment
| null | [
0.001657427055761218,
-0.03829523175954819,
-0.04977326840162277,
0.021745091304183006,
-0.0011106187012046576,
0.028800399973988533,
-0.007788042537868023,
0.07539702206850052,
-0.011732521466910839,
0.0003142639761790633,
0.04791291430592537,
-0.00681398855522275,
-0.055880848318338394,
... |
7,474 | orjson | JSONDecodeError | null | from orjson import JSONDecodeError
| (msg, doc, pos) | [
-0.0331827811896801,
-0.03616182878613472,
0.008213900960981846,
0.056205812841653824,
-0.012957988306879997,
-0.0021105161868035793,
-0.046321578323841095,
0.07390788942575455,
0.0754232406616211,
-0.03685062378644943,
0.051694195717573166,
0.016333092004060745,
-0.02560601755976677,
-0.0... |
7,475 | json.decoder | __init__ | null | def __init__(self, msg, doc, pos):
lineno = doc.count('\n', 0, pos) + 1
colno = pos - doc.rfind('\n', 0, pos)
errmsg = '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos)
ValueError.__init__(self, errmsg)
self.msg = msg
self.doc = doc
self.pos = pos
self.lineno = lineno
sel... | (self, msg, doc, pos) | [
-0.005185223650187254,
0.011851939372718334,
0.013894470408558846,
0.024177255108952522,
-0.01967141404747963,
-0.026000630110502243,
0.01673472858965397,
0.054245416074991226,
0.012228887528181076,
-0.03825581818819046,
0.02542205899953842,
0.05677009001374245,
0.017418494448065758,
0.014... |
7,476 | json.decoder | __reduce__ | null | def __reduce__(self):
return self.__class__, (self.msg, self.doc, self.pos)
| (self) | [
-0.005502624902874231,
-0.0288240946829319,
-0.0057958681136369705,
-0.000026177627660217695,
0.004579770844429731,
-0.04191654548048973,
-0.002615471836179495,
-0.03805263340473175,
0.06051162630319595,
-0.01783609390258789,
0.03168753162026405,
0.026598894968628883,
0.032636258751153946,
... |
7,477 | builtins | TypeError | Inappropriate argument type. | from builtins import TypeError
| null | [
0.004899708554148674,
0.014440814033150673,
0.036376748234033585,
0.02638872340321541,
0.0017661501187831163,
0.02046807110309601,
0.00865136831998825,
0.03467107564210892,
0.023288991302251816,
-0.04428188502788544,
0.049103688448667526,
0.0682269036769867,
0.023108582943677902,
-0.033408... |
7,480 | example_package_anellenson | add_one | null | def add_one(number):
return number + 1
| (number) | [
-0.06702468544244766,
0.02692444436252117,
0.004759796895086765,
0.11443731933832169,
0.0302268173545599,
0.011271873489022255,
-0.06375601142644882,
0.031220899894833565,
-0.04094268009066582,
-0.05691538006067276,
-0.006899599451571703,
-0.007464035879820585,
0.03507928177714348,
0.02104... |
7,481 | eth_account.account | Account |
The primary entry point for working with Ethereum private keys.
It does **not** require a connection to an Ethereum node.
| class Account:
"""
The primary entry point for working with Ethereum private keys.
It does **not** require a connection to an Ethereum node.
"""
_keys = keys
_default_kdf = os.getenv("ETH_ACCOUNT_KDF", "scrypt")
# Enable unaudited features (off by default)
_use_unaudited_hdwallet_fea... | () | [
0.044432129710912704,
-0.07242868095636368,
-0.046330198645591736,
0.04117520898580551,
0.045639991760253906,
-0.07385223358869553,
-0.034575097262859344,
-0.015411046333611012,
0.004893465433269739,
-0.04425957798957825,
0.04473409429192543,
0.009188391268253326,
0.013545328751206398,
0.0... |
7,482 | eth_account.account | _parsePrivateKey |
Generate a :class:`eth_keys.datatypes.PrivateKey` from the provided key.
If the key is already of type :class:`eth_keys.datatypes.PrivateKey`,
return the key.
:param key: the private key from which a :class:`eth_keys.datatypes.PrivateKey`
will be generated
... | from collections.abc import (
Mapping,
)
import json
import os
from typing import (
Any,
Dict,
Optional,
Tuple,
TypeVar,
Union,
cast,
)
import warnings
from eth_keyfile import (
create_keyfile_json,
decode_keyfile_json,
)
from eth_keys import (
KeyAPI,
keys,
)
from eth_k... | (self, key) | [
0.04513120651245117,
-0.057246968150138855,
-0.039679113775491714,
0.04402780905365944,
0.03857571631669998,
-0.06023263558745384,
-0.029034554958343506,
-0.011347707360982895,
0.000809971010312438,
-0.05010732263326645,
0.04346529021859169,
0.026806119829416275,
0.012245572172105312,
0.01... |
7,483 | eth_account.account | _recover_hash | null | from collections.abc import (
Mapping,
)
import json
import os
from typing import (
Any,
Dict,
Optional,
Tuple,
TypeVar,
Union,
cast,
)
import warnings
from eth_keyfile import (
create_keyfile_json,
decode_keyfile_json,
)
from eth_keys import (
KeyAPI,
keys,
)
from eth_k... | (self, message_hash: eth_typing.evm.Hash32, vrs: Optional[Tuple[~VRS, ~VRS, ~VRS]] = None, signature: bytes = None) -> eth_typing.evm.ChecksumAddress | [
0.04513120651245117,
-0.057246968150138855,
-0.039679113775491714,
0.04402780905365944,
0.03857571631669998,
-0.06023263558745384,
-0.029034554958343506,
-0.011347707360982895,
0.000809971010312438,
-0.05010732263326645,
0.04346529021859169,
0.026806119829416275,
0.012245572172105312,
0.01... |
7,485 | eth_account.account | create |
Creates a new private key, and returns it as a
:class:`~eth_account.local.LocalAccount`.
:param extra_entropy: Add extra randomness to whatever randomness your OS
can provide
:type extra_entropy: str or bytes or int
:returns: an object with private key and convenience... | from collections.abc import (
Mapping,
)
import json
import os
from typing import (
Any,
Dict,
Optional,
Tuple,
TypeVar,
Union,
cast,
)
import warnings
from eth_keyfile import (
create_keyfile_json,
decode_keyfile_json,
)
from eth_keys import (
KeyAPI,
keys,
)
from eth_k... | (self, extra_entropy='') | [
0.04513120651245117,
-0.057246968150138855,
-0.039679113775491714,
0.04402780905365944,
0.03857571631669998,
-0.06023263558745384,
-0.029034554958343506,
-0.011347707360982895,
0.000809971010312438,
-0.05010732263326645,
0.04346529021859169,
0.026806119829416275,
0.012245572172105312,
0.01... |
7,486 | eth_account.account | create_with_mnemonic |
Create a new private key and related mnemonic.
.. CAUTION:: This feature is experimental, unaudited, and likely to change soon
Creates a new private key, and returns it as a
:class:`~eth_account.local.LocalAccount`, alongside the mnemonic that can
used to regenerate it using a... | from collections.abc import (
Mapping,
)
import json
import os
from typing import (
Any,
Dict,
Optional,
Tuple,
TypeVar,
Union,
cast,
)
import warnings
from eth_keyfile import (
create_keyfile_json,
decode_keyfile_json,
)
from eth_keys import (
KeyAPI,
keys,
)
from eth_k... | (self, passphrase: str = '', num_words: int = 12, language: str = 'english', account_path: str = "m/44'/60'/0'/0/0") -> Tuple[eth_account.signers.local.LocalAccount, str] | [
0.04513120651245117,
-0.057246968150138855,
-0.039679113775491714,
0.04402780905365944,
0.03857571631669998,
-0.06023263558745384,
-0.029034554958343506,
-0.011347707360982895,
0.000809971010312438,
-0.05010732263326645,
0.04346529021859169,
0.026806119829416275,
0.012245572172105312,
0.01... |
7,487 | eth_account.account | decrypt |
Decrypts a private key.
The key may have been encrypted using an Ethereum client or
:meth:`~Account.encrypt`.
:param keyfile_json: The encrypted key
:type keyfile_json: dict or str
:param str password: The password that was used to encrypt the key
:returns: the... | @staticmethod
def decrypt(keyfile_json, password):
"""
Decrypts a private key.
The key may have been encrypted using an Ethereum client or
:meth:`~Account.encrypt`.
:param keyfile_json: The encrypted key
:type keyfile_json: dict or str
:param str password: The password that was used to encry... | (keyfile_json, password) | [
0.06427541375160217,
-0.06542055308818817,
0.0053932243026793,
0.031158799305558205,
0.0036639757454395294,
-0.05836503207683563,
0.002185225486755371,
0.05267628654837608,
0.027003062888979912,
-0.02417716011404991,
0.07295628637075424,
0.05906688794493675,
0.016955411061644554,
-0.003892... |
7,488 | eth_account.account | from_key |
Returns a convenient object for working with the given private key.
:param private_key: The raw private key
:type private_key: hex str, bytes, int or :class:`eth_keys.datatypes.PrivateKey`
:return: object with methods for signing and encrypting
:rtype: LocalAccount
.. ... | from collections.abc import (
Mapping,
)
import json
import os
from typing import (
Any,
Dict,
Optional,
Tuple,
TypeVar,
Union,
cast,
)
import warnings
from eth_keyfile import (
create_keyfile_json,
decode_keyfile_json,
)
from eth_keys import (
KeyAPI,
keys,
)
from eth_k... | (self, private_key) | [
0.04513120651245117,
-0.057246968150138855,
-0.039679113775491714,
0.04402780905365944,
0.03857571631669998,
-0.06023263558745384,
-0.029034554958343506,
-0.011347707360982895,
0.000809971010312438,
-0.05010732263326645,
0.04346529021859169,
0.026806119829416275,
0.012245572172105312,
0.01... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.