How to use library_path method in localstack

Best Python code snippet using localstack_python

library.py

Source: library.py Github

copy

Full Screen

...14from core.settings import settings15from core.settings.settings import control16from core.tasks import app17UPDATE_FREQUENCY = 0.518def get_library_path() -> str:19 """Returns the absolute path of the local library."""20 return os.path.abspath(os.path.join(conf.SONGS_CACHE_DIR, "local_library"))21@control22def list_subdirectories(request: WSGIRequest) -> HttpResponse:23 """Returns a list of all subdirectories for the given path."""24 path = request.GET.get("path")25 if path is None:26 return HttpResponseBadRequest("path was not supplied.")27 basedir, subdirpart = os.path.split(path)28 if path == "":29 suggestions = ["/​"]30 elif os.path.isdir(basedir):31 suggestions = [32 os.path.join(basedir, subdir + "/​")...

Full Screen

Full Screen

base.py

Source: base.py Github

copy

Full Screen

1#!/​usr/​bin/​env python2# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai3from __future__ import (unicode_literals, division, absolute_import,4 print_function)5__license__ = 'GPL v3'6__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'7__docformat__ = 'restructuredtext en'8import unittest, os, shutil, tempfile, atexit, gc9from functools import partial10from io import BytesIO11from future_builtins import map12rmtree = partial(shutil.rmtree, ignore_errors=True)13class BaseTest(unittest.TestCase):14 longMessage = True15 maxDiff = None16 def setUp(self):17 self.library_path = self.mkdtemp()18 self.create_db(self.library_path)19 def tearDown(self):20 gc.collect(), gc.collect()21 shutil.rmtree(self.library_path)22 def create_db(self, library_path):23 from calibre.library.database2 import LibraryDatabase224 if LibraryDatabase2.exists_at(library_path):25 raise ValueError('A library already exists at %r'%library_path)26 src = os.path.join(os.path.dirname(__file__), 'metadata.db')27 dest = os.path.join(library_path, 'metadata.db')28 shutil.copyfile(src, dest)29 db = LibraryDatabase2(library_path)30 db.set_cover(1, I('lt.png', data=True))31 db.set_cover(2, I('polish.png', data=True))32 db.add_format(1, 'FMT1', BytesIO(b'book1fmt1'), index_is_id=True)33 db.add_format(1, 'FMT2', BytesIO(b'book1fmt2'), index_is_id=True)34 db.add_format(2, 'FMT1', BytesIO(b'book2fmt1'), index_is_id=True)35 db.conn.close()36 return dest37 def init_cache(self, library_path=None):38 from calibre.db.backend import DB39 from calibre.db.cache import Cache40 backend = DB(library_path or self.library_path)41 cache = Cache(backend)42 cache.init()43 return cache44 def mkdtemp(self):45 ans = tempfile.mkdtemp(prefix='db_test_')46 atexit.register(rmtree, ans)47 return ans48 def init_old(self, library_path=None):49 from calibre.library.database2 import LibraryDatabase250 return LibraryDatabase2(library_path or self.library_path)51 def init_legacy(self, library_path=None):52 from calibre.db.legacy import LibraryDatabase53 return LibraryDatabase(library_path or self.library_path)54 def clone_library(self, library_path):55 if not hasattr(self, 'clone_dir'):56 self.clone_dir = tempfile.mkdtemp()57 atexit.register(rmtree, self.clone_dir)58 self.clone_count = 059 self.clone_count += 160 dest = os.path.join(self.clone_dir, str(self.clone_count))61 shutil.copytree(library_path, dest)62 return dest63 @property64 def cloned_library(self):65 return self.clone_library(self.library_path)66 def compare_metadata(self, mi1, mi2):67 allfk1 = mi1.all_field_keys()68 allfk2 = mi2.all_field_keys()69 self.assertEqual(allfk1, allfk2)70 all_keys = {'format_metadata', 'id', 'application_id',71 'author_sort_map', 'author_link_map', 'book_size',72 'ondevice_col', 'last_modified', 'has_cover',73 'cover_data'}.union(allfk1)74 for attr in all_keys:75 if attr == 'user_metadata':76 continue77 attr1, attr2 = getattr(mi1, attr), getattr(mi2, attr)78 if attr == 'formats':79 attr1, attr2 = map(lambda x:tuple(x) if x else (), (attr1, attr2))80 if isinstance(attr1, (tuple, list)) and 'authors' not in attr and 'languages' not in attr:81 attr1, attr2 = set(attr1), set(attr2)82 self.assertEqual(attr1, attr2,83 '%s not the same: %r != %r'%(attr, attr1, attr2))84 if attr.startswith('#'):85 attr1, attr2 = mi1.get_extra(attr), mi2.get_extra(attr)86 self.assertEqual(attr1, attr2,...

Full Screen

Full Screen

_library_paths.py

Source: _library_paths.py Github

copy

Full Screen

1from __future__ import annotations2import os3from dataclasses import dataclass4from threading import Lock5from ._config import AppConfig6class _LibraryMeta(type):7 _instances = {}8 _lock: Lock = Lock()9 def __call__(cls, grch: str = "hg38") -> _LibraryPaths:10 with cls._lock:11 if cls not in cls._instances:12 if grch == "hg38":13 instance = _LibraryPaths3814 else:15 instance = _LibraryPaths1916 cls._instances[cls] = instance.__call__()17 return cls._instances[cls]18@dataclass19class _LibraryPaths:20 # PICARD: str = os.path.join(AppConfig.LIBRARY_PATH, "picard.jar")21 # GATK: str = os.path.join(AppConfig.LIBRARY_PATH, "GenomeAnalysisTK.jar")22 # GATK4: str = os.path.join(AppConfig.LIBRARY_PATH, "gatk-4.1.0.0", "gatk")23 # VARSCAN: str = os.path.join(AppConfig.LIBRARY_PATH, "VarScan.v2.3.9.jar")24 # FASTQC: str = os.path.join(AppConfig.LIBRARY_PATH, "FastQC", "fastqc")25 # FASTP: str = os.path.join(AppConfig.LIBRARY_PATH, "fastp", "fastp")26 # STRELKA: str = os.path.join(27 # AppConfig.LIBRARY_PATH,28 # "strelka-2.9.10.centos6_x86_64",29 # "bin",30 # "configureStrelkaSomaticWorkflow.py",31 # )32 # SOMATICSNIPER: str = os.path.join(33 # AppConfig.LIBRARY_PATH, "somatic-sniper", "build", "bin", "bam-somaticsniper"34 # )35@dataclass36class _LibraryPaths38(_LibraryPaths):37 REF_DIR: str = os.path.join(38 AppConfig.LIBRARY_PATH, "ref_genome_indexes", "hg38_bundle"39 )40 DBSNP: str = os.path.join(41 AppConfig.LIBRARY_PATH,42 "ref_genome_indexes",43 "hg38_bundle",44 "dbsnp_146.hg38.vcf.gz",45 )46 MILLS_INDEL: str = os.path.join(47 AppConfig.LIBRARY_PATH,48 "ref_genome_indexes",49 "hg38_bundle",50 "Mills_and_1000G_gold_standard.indels.hg38.vcf.gz",51 )52 COSMIC: str = os.path.join(53 AppConfig.LIBRARY_PATH,54 "ref_genome_indexes",55 "hg19_bundle",56 "cosmic_hg19_lifted_over.vcf",57 )58 ANNOVAR: str = os.path.join(AppConfig.LIBRARY_PATH, "annovar")59 ANNOVAR_DB: str = os.path.join(AppConfig.LIBRARY_PATH, "annovar", "humandb_38")60 ONE_THOUSAND_G: str = os.path.join(61 AppConfig.LIBRARY_PATH,62 "ref_genome_indexes",63 "hg38_bundle",64 "1000G_phase1.snps.high_confidence.hg38.vcf.gz",65 )66@dataclass67class _LibraryPaths19(_LibraryPaths):68 REF_DIR: str = os.path.join(69 AppConfig.LIBRARY_PATH, "ref_genome_indexes", "hg19_bundle"70 )71 DBSNP: str = os.path.join(72 AppConfig.LIBRARY_PATH,73 "ref_genome_indexes",74 "hg19_bundle",75 "dbsnp_138.hg19.vcf.gz",76 )77 MILLS_INDEL: str = os.path.join(78 AppConfig.LIBRARY_PATH,79 "ref_genome_indexes",80 "hg19_bundle",81 "Mills_and_1000G_gold_standard.indels.hg19.sites.vcf.gz",82 )83 COSMIC: str = os.path.join(84 AppConfig.LIBRARY_PATH,85 "ref_genome_indexes",86 "hg19_bundle",87 "cosmic_hg19_lifted_over.vcf",88 )89 ANNOVAR: str = os.path.join(AppConfig.LIBRARY_PATH, "annovar")90 ANNOVAR_DB: str = os.path.join(AppConfig.LIBRARY_PATH, "annovar", "humandb")91 ONE_THOUSAND_G: str = os.path.join(92 AppConfig.LIBRARY_PATH,93 "ref_genome_indexes",94 "hg19_bundle",95 "1000G_phase1.snps.high_confidence.hg19.sites.vcf.gz",96 )97@dataclass98class LibraryPaths(metaclass=_LibraryMeta):99 """100 Only this class is imported from outside101 Metaclass will automatically create the correct instance...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation &#8211; Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful