id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
4,300 | db3197d7b48aaba50f1b615bf33a7ffc | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | cr | function | function cr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}} |
4,301 | f8f350a4322eb5405ea7b23a8e56b167 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Hr | function | function Hr(n){for(var r=n&&Ir(n,Y).length||0,t=Array(r),e=0;e<r;e++)t[e]=Nr(n,e);return t} |
4,302 | 7d5183146ccf414aa3965e06fd339a97 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Or | function | function Or(n,r,t){r=qn(r,t);for(var e=!er(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0} |
4,303 | 778a872dbd6c8920913644dbb9344293 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Xr | function | function Xr(n,r){return n._chain?tn(r).chain():r} |
4,304 | 5d8eeda49c2b6ccc53e44595ca90184c | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | qr | function | function qr(n,r,t){return r in t} |
4,305 | 13e19130c77f816bd91ff4286a8f5831 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | x | function | function x(n){var r="[object "+n+"]";return function(n){return a.call(n)===r}} |
4,306 | d767c6d109a43c5c681c4d58b4e0641f | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | W | function | function W(n,r){return null!=n&&f.call(n,r)} |
4,307 | 8214ff550a5c1ca3bde4ef07df24ef36 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | C | function | function C(n){return function(){return n}} |
4,308 | e5949a8c5fa84b0897f60ce3f3297296 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | tn | function | function tn(n){return n instanceof tn?n:this instanceof tn?void(this._wrapped=n):new tn(n)} |
4,309 | 8e4a360fa760f92c7225bdf4b0825013 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | _n | function | function _n(n){for(var r={},t=nn(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r} |
4,310 | 7d18752067e81cebac88fe135bf7d486 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | En | function | function En(n){return _(n)?U(n)?n.slice():xn({},n):n} |
4,311 | 83e95ccba56d8ddc89c33ed7e8682ad3 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | kn | function | function kn(n){return n} |
4,312 | cdb38f593531e8fdb3f6ee35259f9eca | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Rn | function | function Rn(n){return n=Nn(n),function(r){return In(r,n)}} |
4,313 | 1e4eb80e84add2cb7fc22bb1f3365d24 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Wn | function | function Wn(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))} |
4,314 | 420fd81bbb3ee4c10912a0de375e10f8 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | ur | function | function ur(n,r,t,e){if(e=e||[],r||0===r){if(r<=0)return e.concat(n)}else r=1/0;for(var u=e.length,o=0,i=Y(n);o<i;o++){var a=n[o];if(er(a)&&(U(a)||L(a)))if(r>1)ur(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else t||(e[u++]=a)}return e} |
4,315 | 72b70e86821485b0077e2ebff4a5733d | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | pr | function | function pr(n){return function(r,t,e){t=qn(t,e);for(var u=Y(r),o=n>0?0:u-1;o>=0&&o<u;o+=n)if(t(r[o],o,r))return o;return-1}} |
4,316 | 8d42ef4c99579ac91d54a43224c80db5 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | dr | function | function dr(n,r,t){return function(e,u,o){var a=0,f=Y(e);if("number"==typeof o)n>0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o<f;o+=n)if(e[o]===u)return o;return-1}} |
4,317 | a86909ed4ecec1a9168612039ba216e6 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | mr | function | function mr(n,r,t){var e=(er(n)?vr:sr)(n,r,t);if(void 0!==e&&-1!==e)return n[e]} |
4,318 | 9b31f54fab1d065c3154f5dbbc32b6eb | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Sr | function | function Sr(n,r,t){var e=[];return r=qn(r,t),jr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e} |
4,319 | 327fe28c7ce4bf844b8a9df093c68fb5 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | jr | function | function jr(n,r,t){var e,u;if(r=Fn(r,t),er(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=nn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n} |
4,320 | 5c1489270fea041d340058eb09f7f342 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Mr | function | function Mr(n,r,t){r=qn(r,t);for(var e=!er(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1} |
4,321 | 8fe202c5b6aea4d63a7b389f33726413 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Nr | function | function Nr(n,r){return _r(n,Rn(r))} |
4,322 | c47d0815f0b54127b74b3bed32970b58 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Tr | function | function Tr(n,r,t){if(null==r||t)return er(n)||(n=jn(n)),n[Wn(n.length-1)];var e=er(n)?En(n):jn(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=Wn(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)} |
4,323 | 131b15e1ee944a5cd91ebf604b52f01f | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | Yr | function | function Yr(n){return jr(wn(n),(function(r){var t=tn[r]=n[r];tn.prototype[r]=function(){var n=[this._wrapped];return o.apply(n,arguments),Xr(this,t.apply(tn,n))}})),tn} |
4,324 | 15083f99388195d4e49a53864a825ab5 | swh:1:cnt:cf177d4285ab55fbc16406a5ec827b80e7eecd53;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=6-6/ | 25edab5eafb40a01795d5608b83ddb365bb00fbb | workflow_utils | analytics | docs/build/html/_static/underscore.js | zr | function | function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))} |
4,325 | 84d3ed0925cba449be2de8beac746e4e | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=257-258/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_size_remote_directory::mocksize(*args) | function | def mocksize(*args):
return None |
4,326 | c5d0de18f1c4ba1911b86b27294d1239 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=327-332/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_size(fs_artifact_source,fs_artifact_cache) | function | def test_fs_artifact_cache_size(fs_artifact_source,fs_artifact_cache):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source, caches=[fs_artifact_cache])
size = fs_artifact_cache.size(artifact)
assert size ... |
4,327 | e3fa527946955081bbf66aaffd91fbbe | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=377-427/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_custom_fs_artifact_cache_put(
fs_artifact_source_local,
custom_fs_artifact_cache_current,
custom_fs_artifact_cache_tstamped
) | function | def test_custom_fs_artifact_cache_put(
fs_artifact_source_local,
custom_fs_artifact_cache_current,
custom_fs_artifact_cache_tstamped
):
"""
Test that a put of new content will result in the content
being written into the cache at the cache url for the artifact id.
"""
artifac... |
4,328 | ae570861182ec9b3ba03068afcee192f | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=462-466/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_delete(fs_artifact_source, fs_artifact_cache) | function | def test_fs_artifact_cache_delete(fs_artifact_source, fs_artifact_cache):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source, caches=[fs_artifact_cache])
fs_artifact_cache.delete(artifact)
assert not fs_... |
4,329 | d866d70e6108b2e445329240c923f14e | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=483-488/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_locators(artifact) | function | # == Test Artifact ==
def test_artifact_locators(artifact):
assert len(artifact.locators(must_exist=False)) == 2, \
"artifact has a source and one cache, so # of locators should be 2"
assert len(artifact.locators(must_exist=True)) == 1, \
"artifact has not yet been cached, so # of locatators wit... |
4,330 | 1a9f61da9c272dea35a18429e821ba45 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=704-712/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_fsspec_options_passed_to_fs() | function | def test_fs_artifact_source_fsspec_options_passed_to_fs():
opts = {"headers": {"PRIVATE-TOKEN": "test-token"}}
source = FsArtifactSource(
base_uri="https://example.org/artifacts",
fsspec_options=opts,
)
artifact = Artifact(id="archive.zip", source=source)
fs = source.fs(artifact)
... |
4,331 | 9240ff11ae274995790109921d730961 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=69-74/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_fs_artifact_source(local_maven_repo) | function | def fixture_fs_artifact_source(local_maven_repo):
"""
Yields a path to a tmpdir with a maven artifact jar in it and
an instantiated FsArtifactSource
"""
yield FsArtifactSource(local_maven_repo) |
4,332 | df6dcb4009cfe2a320a52295c9738780 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=138-146/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_custom_fs_artifact_cache_tstamped(tmpdir) | function | def fixture_custom_fs_artifact_cache_tstamped(tmpdir):
"""
Yields a FsVersionedArtifactCache with no items in the cache,
with a tstamp as part of destination path.
"""
local_cache_dir = os.path.join(tmpdir, 'versioned_artifact_cache_dir')
yield FsArtifactCache(local_cache_dir, cache_key_tstamp... |
4,333 | 4ca8d49c73ee7023beabeba797b8da77 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=335-339/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_size_no_file(fs_artifact_source, fs_artifact_cache) | function | def test_fs_artifact_cache_size_no_file(fs_artifact_source, fs_artifact_cache):
artifact_id = 'non_existent'
artifact = Artifact(id=artifact_id, source=fs_artifact_source, caches=[fs_artifact_cache])
size = fs_artifact_cache.size(artifact)
assert size is None |
4,334 | ea3d4d6bfc7e6e1f4df0f26dedefdc79 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=430-459/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_custom_fs_artifact_cache_delete(
fs_artifact_source_local,
custom_fs_artifact_cache_current
) | function | def test_custom_fs_artifact_cache_delete(
fs_artifact_source_local,
custom_fs_artifact_cache_current
):
"""
Test that a put of new content will result in the content
being written into the cache at the cache url for the artifact id.
"""
artifact_id = 'git_repo_folder'
artifact = ... |
4,335 | c8485d88fb97e742e369e9645260aecd | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=469-480/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_maven_artifact_cache_url(maven_artifact_source, fs_maven_artifact_cache) | function | def test_fs_maven_artifact_cache_url(maven_artifact_source, fs_maven_artifact_cache):
"""
FsMavenArtifactCache.url() should just return the
path in a maven repo for a maven coordinate artifact id.
"""
artifact_id = 'org.apache.hadoop:hadoop-yarn-client:2.10.1'
artifact = Artifact(id=artifact_id,... |
4,336 | 552cbbbd5fbe2ef077bf1ae721df08a8 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=491-492/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_exists(artifact) | function | def test_artifact_exists(artifact):
assert artifact.exists() is True |
4,337 | ef829cff31e428e0b2e5d27446b61b3e | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=715-718/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_fsspec_options_passed_to_fs(tmpdir) | function | def test_fs_artifact_cache_fsspec_options_passed_to_fs(tmpdir):
cache_dir = os.path.join(str(tmpdir), "cache")
cache = FsArtifactCache(cache_dir, fsspec_options={"auto_mkdir": True}) # local fs doesn't support `headers`
assert cache.fs.auto_mkdir is True |
4,338 | 1bf4bfb7cce2d476d4b312576e12a56e | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=303-316/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_url(fs_artifact_source, fs_artifact_cache) | function | # == Test ArtifactCaches ==
def test_fs_artifact_cache_url(fs_artifact_source, fs_artifact_cache):
"""
FsArtifactCache.url() should just return the
a safe filename of id prefixed with the cache base uri.
"""
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
... |
4,339 | d0b410e23dc4086cfecac4bc693adbbb | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=342-356/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_size_remote_directory(monkeypatch, fs_artifact_source_local, fs_artifact_cache) | function | def test_fs_artifact_cache_size_remote_directory(monkeypatch, fs_artifact_source_local, fs_artifact_cache):
"""Re-create the conditions of querying the size of a remote
directory, implementation of which returns `None` in such case.
"""
artifact_id = 'non_existent'
artifact = Artifact(id=artifact_id... |
4,340 | 76f6bf39af346dcbbdddb45759295c7a | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=506-510/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_cached_urls(artifact) | function | def test_artifact_cached_urls(artifact):
assert len(artifact.cached_urls(must_exist=False)) == 1, \
"artifact has not yet been cached, # urls that might exist in caches should be 1"
assert len(artifact.cached_urls(must_exist=True)) == 0, \
"artifact has not yet been cached, # of urls that must e... |
4,341 | b512162f10fb513c2c76fcc76f38cd7d | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=78-83/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_maven_artifact_source(local_maven_repo) | function | def fixture_maven_artifact_source(local_maven_repo):
"""
Yields an instantiated MavenArtifactSource using
a local maven tmpdir repo with an artifact in it.
"""
yield MavenArtifactSource(local_maven_repo) |
4,342 | a78e87574a491b8c8dbcd6224b2ffd15 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=38-56/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_local_directory(tmpdir) | function | def fixture_local_directory(tmpdir):
"""
Yields a path to a tmpdir with various files in it
"""
git_repo_path = os.path.join(tmpdir, 'fake_git_repo')
d1_dir = os.path.join(git_repo_path, 'git_repo_folder', 'dir1')
d1_file = os.path.join(d1_dir, 'd1.txt')
os.makedirs(d1_dir)
with open(d1... |
4,343 | 2fea21ee508aaf9460b48268fe6c48f2 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=60-65/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_fs_artifact_source_local(local_directory) | function | def fixture_fs_artifact_source_local(local_directory):
"""
Yields a path to a tmpdir with various files in it and
an instantiated FsArtifactSource
"""
yield FsArtifactSource(local_directory) |
4,344 | 4e2f1f540bd9add3cadd194908889437 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=114-122/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_custom_fs_artifact_cache_current(tmpdir) | function | def fixture_custom_fs_artifact_cache_current(tmpdir):
"""
Yields a FsVersionedArtifactCache with no items in the cache,
with "current" as part of destination path.
"""
local_cache_dir = os.path.join(tmpdir, 'versioned_artifact_cache_dir')
yield FsArtifactCache(local_cache_dir, cache_key_curren... |
4,345 | c5c9b6988c22b17c2abb55ba29bdd0e4 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=125-134/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | cache_key_tstamped(artifact: Artifact) | function | def cache_key_tstamped(artifact: Artifact) -> str:
"""Appends a folder named after current timestamp after a safe-encoded
Artifact name.
:param artifact: Artifact
"""
tstamp = datetime.utcnow().strftime('%Y%m%d%H%M%S')
return os.path.join(safe_filename(artifact.name), tstamp) |
4,346 | cd08c786807821a208089f66f921f83d | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=180-219/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_artifact_configs(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
) | function | def fixture_artifact_configs(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
):
yield {
'artifacts': {
'hadoop-yarn-client-2.10.1.jar': {
'id': 'org.apache.hadoop:hadoop-yarn-client:2.10.1',
'source': 'maven_s... |
4,347 | 15f21ab7a90275d8c79a0f9eb62bb8c4 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=319-324/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_exists(fs_artifact_source, fs_artifact_cache) | function | def test_fs_artifact_cache_exists(fs_artifact_source, fs_artifact_cache):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source, caches=[fs_artifact_cache])
assert fs_artifact_cache.exists(artifact)
artifac... |
4,348 | 94f6919e0c8482375496ba8658b64837 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=359-374/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_put(fs_artifact_source, fs_artifact_cache) | function | def test_fs_artifact_cache_put(fs_artifact_source, fs_artifact_cache):
"""
Test that a put of new content will result in the content
being written into the cache at the cache url for the artifact id.
"""
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
ar... |
4,349 | 3964687454e3956e6905002a2c347ed9 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=513-517/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_cached_url(artifact) | function | def test_artifact_cached_url(artifact):
assert artifact.cached_url(must_exist=False) is not None, \
"artifact has not yet been cached, should be a cached url that might exist"
assert artifact.cached_url(must_exist=True) is None, \
"artifact has not yet been cached, so cached url should be None" |
4,350 | 3c472d06ca5d4ec0ad4ddd20dda190cb | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=240-245/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_size(fs_artifact_source) | function | def test_fs_artifact_source_size(fs_artifact_source):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source)
size = fs_artifact_source.size(artifact)
assert size is not None
assert size > 0 |
4,351 | e2f92e5e0196488c1267ff0f05636af1 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=271-288/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_fs_no_base_uri() | function | def test_fs_artifact_source_fs_no_base_uri():
fs_artifact_source = FsArtifactSource()
assert fs_artifact_source.fs(
Artifact(id="/tmp/file", source=fs_artifact_source)
).protocol == ('file', 'local')
assert fs_artifact_source.fs(
Artifact(id="file:///tmp/file", source=fs_artifact_sourc... |
4,352 | 2b8da1d1395a6fad170e7a0d462a7f80 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=520-527/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_cache_put_and_delete(artifact) | function | def test_artifact_cache_put_and_delete(artifact):
artifact.cache_put()
assert len(artifact.locators(must_exist=True)) == 2, \
"artifact has been cached, so # of locators with must_exist should be 2"
artifact.cache_delete()
assert len(artifact.locators(must_exist=True)) == 1, \
"artifact... |
4,353 | 900a22ddafa278e49a61e927c2b64cda | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=544-595/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_factory(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
) | function | def test_artifact_factory(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
):
available_sources = {
'fs_source': fs_artifact_source,
'maven_source': maven_artifact_source,
}
available_caches = {
'fs_cache': fs_artifact_cache,
... |
4,354 | e7f3e8c928c03618e2ebdeccf7abfe0f | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=656-661/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_fsspec_options_stored() | function | # == Test fsspec_options ==
def test_fs_artifact_source_fsspec_options_stored():
opts = {"headers": {"USER-ID": "123", "MAX-RESULTS": "1"}}
source = FsArtifactSource(fsspec_options=opts)
assert source.fsspec_options == opts |
4,355 | 1f44b7366b793ef00ed773e061edd20b | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=664-666/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_fsspec_options_default() | function | def test_fs_artifact_source_fsspec_options_default():
source = FsArtifactSource()
assert source.fsspec_options == {} |
4,356 | 01d67a6df277433b19efc7edc8e9af05 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=23-34/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_local_maven_repo(tmpdir) | function | def fixture_local_maven_repo(tmpdir):
"""
Yields a path to a tmpdir with a maven artifact jar in it
"""
maven_repo_path = os.path.join(tmpdir, 'local_maven_repo')
a1_dir = os.path.join(maven_repo_path, 'org/apache/hadoop/hadoop-yarn-client/2.10.1')
a1_file = os.path.join(a1_dir, 'hadoop-yarn-cli... |
4,357 | e4afb62eacf38b7b8f668c47a1dcb189 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=87-101/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_fs_artifact_cache(tmpdir) | function | def fixture_fs_artifact_cache(tmpdir):
"""
Yields a FsArtifactCache with one item in the cache.
"""
local_cache_dir = os.path.join(tmpdir, 'artifact_cache_dir')
a1_file = os.path.join(
local_cache_dir,
'org_apache_hadoop_hadoop-yarn-client_2.10.1_hadoop-yarn-client-2.10.1.jar'
)... |
4,358 | 2e1df9d3a836af1187979345149c6d54 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=247-251/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_size_no_file(fs_artifact_source) | function | def test_fs_artifact_source_size_no_file(fs_artifact_source):
artifact_id = 'non_existent'
artifact = Artifact(id=artifact_id, source=fs_artifact_source)
size = fs_artifact_source.size(artifact)
assert size is None |
4,359 | 55be0d8491ad721fcfde22c69f5d75ab | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=150-164/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_fs_maven_artifact_cache(tmpdir) | function | def fixture_fs_maven_artifact_cache(tmpdir):
"""
Yields a FsMavenArtifactCache with one item in the cache.
"""
local_cache_dir = os.path.join(tmpdir, 'maven_artifact_cache_dir')
a1_file = os.path.join(
local_cache_dir,
'org_apache_hadoop_hadoop-yarn-client_2.10.1_hadoop-yarn-client-... |
4,360 | fb0f62b94bd43b7b23bf16d940079971 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=290-300/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_maven_artifact_source_url(maven_artifact_source) | function | def test_maven_artifact_source_url(maven_artifact_source):
"""
MavenArtifactSource.url() should translate from a maven coordinate to a URL.
"""
artifact_id = 'org.apache.hadoop:hadoop-yarn-client:2.10.1'
artifact = Artifact(id=artifact_id, source=maven_artifact_source)
expected = os.path.join(
... |
4,361 | b2edd6f59f4dcf6507b608240f90cbee | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=529-541/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_cache_put_mismatched_file_size(artifact) | function | def test_artifact_cache_put_mismatched_file_size(artifact):
cached_url = artifact.cached_url()
# write different content into cached_url so it has a different file size than the source.
os.makedirs(os.path.dirname(cached_url))
with open(cached_url, 'wt', encoding="utf-8") as file:
file.write("DI... |
4,362 | 341893d3ab277ad6424460594a3addc7 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=598-623/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_load_artifacts_from_config(
artifact_configs,
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
) | function | def test_load_artifacts_from_config(
artifact_configs,
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
):
artifacts = Artifact.load_artifacts_from_config(artifact_configs)
maven_artifact = artifacts['hadoop-yarn-client-2.10.1.jar']
maven_artifact_id... |
4,363 | 1402e3cc0c0993aba13d4b0ca328fa4c | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=669-701/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_load_artifacts_from_config_with_fsspec_options(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
) | function | def test_load_artifacts_from_config_with_fsspec_options(
fs_artifact_source,
maven_artifact_source,
fs_artifact_cache,
fs_maven_artifact_cache
):
config = {
'artifacts': {
'my_artifact.zip': {
'id': 'my_artifact.zip',
},
},
'artifact_so... |
4,364 | 9221e6be880ed81435ca34d43e9b98f1 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=626-653/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_load_artifacts_from_config_with_incorrect_config(
artifact_configs
) | function | def test_load_artifacts_from_config_with_incorrect_config(
artifact_configs
):
artifact_configs_for_test = deepcopy(artifact_configs)
del artifact_configs_for_test['artifacts']['my_artifact.zip']['id']
# ValueError, id is required
with pytest.raises(ValueError):
Artifact.load_artifacts_from_... |
4,365 | 80fe79e5ec8926778b5a1d2a7cc4e0a0 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=721-762/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_put_unwraps_directory_from_remote(monkeypatch, tmpdir) | function | def test_fs_artifact_cache_put_unwraps_directory_from_remote(monkeypatch, tmpdir):
"""Simulate a remote source where fsspec get() creates a directory
containing a single file with a query-string name (e.g. archive.zip?sha=v0.0.1).
The cache put should unwrap it into a clean file."""
from unittest.mock i... |
4,366 | 29dedc8e97976abddf1dd26f2b4a8623 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=222-231/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_url(fs_artifact_source) | function | # == Test ArtifactSources ==
def test_fs_artifact_source_url(fs_artifact_source):
"""
FsArtifactSource.url() should return the artifact id
prefixed with the base_uri.
"""
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id,... |
4,367 | db7f045a834627386a71962c56276440 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=253-264/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_size_remote_directory(monkeypatch, fs_artifact_source) | function | def test_fs_artifact_source_size_remote_directory(monkeypatch, fs_artifact_source):
artifact_id = 'non_existent'
artifact = Artifact(id=artifact_id, source=fs_artifact_source)
def mocksize(*args):
return None
from fsspec.spec import AbstractFileSystem
monkeypatch.setattr(AbstractFileSystem... |
4,368 | 84d3ed0925cba449be2de8beac746e4e | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=349-350/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_size_remote_directory::mocksize(*args) | function | def mocksize(*args):
return None |
4,369 | 0c5be6b2a484451eb210f4de44cb8af9 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=495-496/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_exists_in_cache(artifact) | function | def test_artifact_exists_in_cache(artifact):
assert artifact.exists_in_cache() is False |
4,370 | 013b816ad2c0a7cbe8acb865feedba92 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=747-753/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_cache_put_unwraps_directory_from_remote::fake_get(rpath, lpath, recursive=False) | function | def fake_get(rpath, lpath, recursive=False):
"""Simulate fsspec HTTP get() creating a directory with a single file."""
os.makedirs(lpath, exist_ok=True)
# The file inside gets the URL basename including query params
inner_name = "archive.zip?sha=v0.0.1"
import shutil
shut... |
4,371 | 626eab306204eb0e35c7e429f579b0a5 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=168-176/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | fixture_artifact(maven_artifact_source, tmpdir) | function | def fixture_artifact(maven_artifact_source, tmpdir):
local_cache_dir = os.path.join(tmpdir, 'artifact_cache_dir_0')
yield Artifact(
id='org.apache.hadoop:hadoop-yarn-client:2.10.1',
source=maven_artifact_source,
# Use a new empty cache
caches=[FsMavenArtifactCache(local_cache_dir... |
4,372 | 43d9cc2eb94d2394c82e325e8572ee77 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=104-110/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | cache_key_current(artifact: Artifact) | function | def cache_key_current(artifact: Artifact) -> str:
"""Appends a folder named "current" after a safe-encoded
Artifact name.
:param artifact: Artifact
"""
return os.path.join(safe_filename(artifact.name), "current") |
4,373 | 4f7bee29f04752f2df2dc29cc81feb58 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=233-238/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_exists(fs_artifact_source) | function | def test_fs_artifact_source_exists(fs_artifact_source):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source)
assert fs_artifact_source.exists(artifact)
artifact_not_exists = Artifact(id='not/exists', sour... |
4,374 | c844b2013193dea4c5b3b392245edef9 | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=266-269/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_fs_artifact_source_fs_base_uri(fs_artifact_source) | function | def test_fs_artifact_source_fs_base_uri(fs_artifact_source):
artifact_id = 'org/apache/hadoop/hadoop-yarn-client/2.10.1/hadoop-yarn-client-2.10.1.jar'
artifact = Artifact(id=artifact_id, source=fs_artifact_source)
assert fs_artifact_source.fs(artifact).protocol == ('file', 'local') |
4,375 | 9e39dca3c3f95b58ded8ed241081280b | swh:1:cnt:51fac991cc2f34c408ca9e674845c5ec00da256e;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=499-503/ | 644fb3e976972e9084a086592011f65f2e97f7e9 | workflow_utils | analytics | tests/test_artifact.py | test_artifact_urls(artifact) | function | def test_artifact_urls(artifact):
assert len(artifact.urls(must_exist=False)) == 2, \
"artifact has a source and one cache, so # of urls should be 2"
assert len(artifact.urls(must_exist=True)) == 1, \
"artifact has not yet been cached, so # of urls with must_exist should be 1" |
4,376 | f9e9d3669354b1fad4d7621c3c314d15 | swh:1:cnt:c59d34c29c4576e1f5e4697cb24015c139334c09;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=91-100/ | 4fdb07dd8aabf21f9e2a387de718b60a1874a9d6 | workflow_utils | analytics | tests/test_conda.py | test_find_conda_exe(forge_base_env) | function | def test_find_conda_exe(forge_base_env):
assert conda.find_conda_exe() == os.path.join(forge_base_env, 'bin', 'conda'), \
'should find conda in PATH'
with mock.patch.dict(os.environ, {'CONDA_EXE': '/path/to/env/conda'}):
assert \
conda.find_conda_exe(conda_exe='/path/to/custom/conda... |
4,377 | 9fcf06637692b5989b5e4ccd53ee55f9 | swh:1:cnt:c59d34c29c4576e1f5e4697cb24015c139334c09;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=10-51/ | 4fdb07dd8aabf21f9e2a387de718b60a1874a9d6 | workflow_utils | analytics | tests/test_conda.py | fixture_forge_base_env(tmpdir_factory) | function | def fixture_forge_base_env(tmpdir_factory): # pylint: disable=unused-argument
"""
Yields a path to a tmpdir with a base miniconda env installed.
See the bin/install-miniforge-env shell script.
The miniforge installer will be downloaded from https://github.com/conda-forge/miniforge.
Set environmen... |
4,378 | d637af58af2931e60e9e44e11cfeac67 | swh:1:cnt:c59d34c29c4576e1f5e4697cb24015c139334c09;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=55-88/ | 4fdb07dd8aabf21f9e2a387de718b60a1874a9d6 | workflow_utils | analytics | tests/test_conda.py | fixture_python_project(tmpdir) | function | def fixture_python_project(tmpdir):
"""
Yields a path to a fake python project that uses
pyproject.toml, a conda environment.yml, and a setup.cfg with a minimal pip dependency.
"""
python_project_path = os.path.join(tmpdir, 'myproject')
os.makedirs(python_project_path)
with open(os.path.joi... |
4,379 | 7bf5d61ec825cae197e941684598c156 | swh:1:cnt:c59d34c29c4576e1f5e4697cb24015c139334c09;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=103-112/ | 4fdb07dd8aabf21f9e2a387de718b60a1874a9d6 | workflow_utils | analytics | tests/test_conda.py | test_find_pip_exe(forge_base_env) | function | def test_find_pip_exe(forge_base_env):
assert conda.find_pip_exe() == os.path.join(forge_base_env, 'bin', 'pip'), \
'should find pip in PATH'
with mock.patch.dict(os.environ, {'PIP_EXE': '/path/to/env/pip'}):
assert \
conda.find_pip_exe(pip_exe='/path/to/custom/pip') == '/path/to/cu... |
4,380 | 4d810a4e7d212c8f05cfb8e2ae91618b | swh:1:cnt:c59d34c29c4576e1f5e4697cb24015c139334c09;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=115-141/ | 4fdb07dd8aabf21f9e2a387de718b60a1874a9d6 | workflow_utils | analytics | tests/test_conda.py | test_conda_create_and_pack_dist_env(forge_base_env, python_project, tmpdir) | function | # pylint: disable=unused-argument
def test_conda_create_and_pack_dist_env(forge_base_env, python_project, tmpdir):
conda_dist_env_prefix = os.path.join(tmpdir, 'dist', 'conda_dist_env')
conda_dist_env_dest = os.path.join(tmpdir, 'dist', 'conda_dist_env.tgz')
conda_packed_env = conda.conda_create_and_pack_d... |
4,381 | 973b80996088f4d2577037290ec10765 | swh:1:cnt:81b93d1afd583e50b2fa4b3ca4a7409db14be8b3;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=43-44/ | 28e4d0ade10d735898f0ff770e3e2bc6b7f754a3 | workflow_utils | analytics | tests/test_maven.py | test_parse_maven_coordinate(coordinate, expected) | function | def test_parse_maven_coordinate(coordinate, expected):
assert parse_maven_coordinate(coordinate) == expected |
4,382 | 25c576dd9578d071635371adf733a9e5 | swh:1:cnt:81b93d1afd583e50b2fa4b3ca4a7409db14be8b3;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=111-113/ | 28e4d0ade10d735898f0ff770e3e2bc6b7f754a3 | workflow_utils | analytics | tests/test_maven.py | test_invalid_maven_coordinate() | function | def test_invalid_maven_coordinate():
with pytest.raises(ValueError):
assert parse_maven_coordinate('bad bad') |
4,383 | fe64664c8ca911d0bab24276ad459703 | swh:1:cnt:81b93d1afd583e50b2fa4b3ca4a7409db14be8b3;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=83-84/ | 28e4d0ade10d735898f0ff770e3e2bc6b7f754a3 | workflow_utils | analytics | tests/test_maven.py | test_maven_artifact_uri(coordinate, expected) | function | def test_maven_artifact_uri(coordinate, expected):
assert maven_artifact_uri(coordinate) == expected |
4,384 | bc26a466188ed50a0e0556038744c41b | swh:1:cnt:81b93d1afd583e50b2fa4b3ca4a7409db14be8b3;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=107-108/ | 28e4d0ade10d735898f0ff770e3e2bc6b7f754a3 | workflow_utils | analytics | tests/test_maven.py | test_maven_artifact_uri_with_prefix(coordinate, repo_uri, expected) | function | def test_maven_artifact_uri_with_prefix(coordinate, repo_uri, expected):
assert maven_artifact_uri(coordinate, repo_uri=repo_uri) == expected |
4,385 | b0c2fb1548dc8a34c25697f6d8b9265f | swh:1:cnt:81b93d1afd583e50b2fa4b3ca4a7409db14be8b3;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=63-64/ | 28e4d0ade10d735898f0ff770e3e2bc6b7f754a3 | workflow_utils | analytics | tests/test_maven.py | test_maven_artifact_dir(coordinate, expected) | function | def test_maven_artifact_dir(coordinate, expected):
assert maven_artifact_dir(coordinate) == expected |
4,386 | 63f72916faeb625ab26b1076d1c0fbf8 | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=25-51/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | test_instantiate() | function | def test_instantiate():
instance = instantiate(
class_name='tests.test_util.MyClass',
name='a1'
)
assert isinstance(instance, MyClass), \
'instantiate should work with class_name string as kwarg'
assert instance.name == 'a1'
instance = instantiate(**{
'class_name': ... |
4,387 | 3c29110a3ed850260d4a957e5c8b3730 | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=22-23/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | MyClass::__init__(self, name) | function | def __init__(self, name):
self.name = name |
4,388 | fe1f07ec55b61198629fd2ae65e51fea | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=17-18/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | test_safe_filename(name, expected) | function | def test_safe_filename(name, expected):
assert safe_filename(name) == expected |
4,389 | 96a1cebd641b4b27822081b8a54ab4bb | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=53-71/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | test_instantiate_fn_ref() | function | def test_instantiate_fn_ref():
test_base_uri = '/wmf/cache/artifacts/airflow/analytics/mvn'
instance = instantiate(
class_name='workflow_utils.artifact.FsArtifactCache',
base_uri=test_base_uri,
cache_key_fn='workflow_utils.artifact.cache.cache_key_maven',
)
from workflow_utils.a... |
4,390 | 37b9dcd875bfd8a0a6d9238599870514 | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=75-80/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | test_find_java_home() | function | def test_find_java_home():
with mock.patch.dict(os.environ, {'JAVA_HOME': '/nonexistent'}):
assert find_java_home() is None
with mock.patch.dict(os.environ, {'JAVA_HOME': '/'}):
assert find_java_home() == '/' |
4,391 | 8f95b4def977a1274311001c258a2b55 | swh:1:cnt:85b10e3bde2e96cfdd6d49a616332d0414d0d225;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=21-23/ | 2f66d07ffb8696dc802c34e25f0a598f4a5f285e | workflow_utils | analytics | tests/test_util.py | MyClass | type | class MyClass(): # pylint: disable=too-few-public-methods
def __init__(self, name):
self.name = name |
4,392 | 5bc79de7c27fc949b00f55d7398ef1f3 | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=141-158/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | _run(command: List[str]) | function | def _run(command: List[str]) -> int:
"""
Runs command via subprocess.run.
print stdout and stderr in the caller process,
unless the returncode is non-zero, which
case the stdout and stderr is logged at error level,
and a subprocess.CalledProcessError is raised.
:param command: command args ... |
4,393 | 00b00e01d96838a7acfcd7aea75ec820 | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=65-80/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | find_conda_exe(conda_exe: Optional[str] = None) | function | def find_conda_exe(conda_exe: Optional[str] = None) -> Optional[str]:
"""
Looks for a conda executable in the following order:
- conda_exe parameter
- CONDA_EXE env variable
- conda in search PATH
:param conda_exe: path to conda executable to use.
:return: path to conda executable, or None.... |
4,394 | f38371f7a7a60f0e3358f830290153db | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=191-219/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | pip_cli(
args: Optional[List[str]] = None,
pip_exe: Optional[str] = None,
) | function | def pip_cli(
args: Optional[List[str]] = None,
pip_exe: Optional[str] = None,
) -> int:
"""
Shells out to pip_exe to run a command.
:param args:
args to pass to the conda executable.
:pip_exe:
Path to pip executable. If not given, one will
be found via find_pip_exe func... |
4,395 | 1d97d7b35a01770810c34eab60e780fb | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=248-263/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | conda_create(prefix: str, args: Optional[List[str]] = None) | function | def conda_create(prefix: str, args: Optional[List[str]] = None) -> int:
"""
Creates a conda enviroment at prefix.
:param prefix:
Path to conda env to update.
:param args:
Args to pass to conda env update
:return:
return code of conda cli command
"""
if args is None... |
4,396 | 78f0f31fb0cfa5668b7deaafd69fd884 | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=287-319/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | pip_install(
prefix: str,
args: Optional[List[str]] = None,
) | function | def pip_install(
prefix: str,
args: Optional[List[str]] = None,
) -> int:
"""
Shells out to pip install to install into prefix.
:param prefix:
Path to env to pip install into.
:param args:
Args to pass to pip install.
:param pip_exe:
pip_exe param to pip_cli
:... |
4,397 | a4ff10f970af23d230c1801be6aa512d | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=439-468/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | conda_create_and_pack_dist_env(
dist_env_prefix: str, dist_env_dest: str, conda_pack_dest_prefix: Optional[str] = None, **build_kwargs: Any
) | function | def conda_create_and_pack_dist_env(
dist_env_prefix: str, dist_env_dest: str, conda_pack_dest_prefix: Optional[str] = None, **build_kwargs: Any
) -> str:
"""
Calls conda_create_dist_env and then uses conda-pack to create
a packed .tgz of the env at destination.
:return:
Path to conda packed... |
4,398 | d01610c7c2d223216b3e1aed5763545b | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=27-62/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | pack(**conda_pack_kwargs: Any) | function | def pack(**conda_pack_kwargs: Any) -> str:
"""
Calls conda_pack.pack.
If the packed output file already exists, this will not repackage
it unless conda_pack_kwargs["force"] == True.
:param conda_pack_kwargs: args to pass to conda_pack.pack().
:returns: result of conda_pack.pack, the path to the... |
4,399 | b818b0212712d33012468cbc2c33444b | swh:1:cnt:df80d583eed3ba763d5d569f28fceb656397c598;origin=https://gitlab.wikimedia.org/repos/data-engineering/workflow_utils.git;lines=83-138/ | 99deec58e0c1ebd4f9564c7e2cffbe5b00ec9623 | workflow_utils | analytics | workflow_utils/conda.py | find_pip_exe(
pip_exe: Optional[str] = None,
prefix: Optional[str] = None,
conda_exe: Optional[str] = None,
) | function | def find_pip_exe(
pip_exe: Optional[str] = None,
prefix: Optional[str] = None,
conda_exe: Optional[str] = None,
) -> Optional[str]:
"""
Looks for a pip executable in the following order:
- pip_exe parameter
- PIP_EXE env variable
- In a bin directory in prefix if it exists
- In a bin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.