repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.shuffle_song
def shuffle_song( self, song, *, num_songs=100, only_library=False, recently_played=None ): """Get a listing of song shuffle/mix songs. Parameters: song (dict): A song dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``100`` only_library (bool, Optio...
python
def shuffle_song( self, song, *, num_songs=100, only_library=False, recently_played=None ): """Get a listing of song shuffle/mix songs. Parameters: song (dict): A song dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``100`` only_library (bool, Optio...
Get a listing of song shuffle/mix songs. Parameters: song (dict): A song dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``100`` only_library (bool, Optional): Only return content from library. Default: False recently_played (list, Optional): A li...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1465-L1510
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.situations
def situations(self, *, tz_offset=None): """Get a listing of situations. Parameters: tz_offset (int, Optional): A time zone offset from UTC in seconds. """ response = self._call( mc_calls.ListenNowSituations, tz_offset ) situation_list = response.body.get('situations', []) return situation_lis...
python
def situations(self, *, tz_offset=None): """Get a listing of situations. Parameters: tz_offset (int, Optional): A time zone offset from UTC in seconds. """ response = self._call( mc_calls.ListenNowSituations, tz_offset ) situation_list = response.body.get('situations', []) return situation_lis...
Get a listing of situations. Parameters: tz_offset (int, Optional): A time zone offset from UTC in seconds.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1512-L1525
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.song
def song(self, song_id): """Get information about a song. Parameters: song_id (str): A song ID. Returns: dict: Song information. """ if song_id.startswith('T'): song_info = self._call( mc_calls.FetchTrack, song_id ).body else: song_info = next( ( song for song in self...
python
def song(self, song_id): """Get information about a song. Parameters: song_id (str): A song ID. Returns: dict: Song information. """ if song_id.startswith('T'): song_info = self._call( mc_calls.FetchTrack, song_id ).body else: song_info = next( ( song for song in self...
Get information about a song. Parameters: song_id (str): A song ID. Returns: dict: Song information.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1527-L1552
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.songs_add
def songs_add(self, songs): """Add store songs to your library. Parameters: songs (list): A list of store song dicts. Returns: list: Songs' library IDs. """ mutations = [mc_calls.TrackBatch.add(song) for song in songs] response = self._call( mc_calls.TrackBatch, mutations ) success_ids =...
python
def songs_add(self, songs): """Add store songs to your library. Parameters: songs (list): A list of store song dicts. Returns: list: Songs' library IDs. """ mutations = [mc_calls.TrackBatch.add(song) for song in songs] response = self._call( mc_calls.TrackBatch, mutations ) success_ids =...
Add store songs to your library. Parameters: songs (list): A list of store song dicts. Returns: list: Songs' library IDs.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1566-L1588
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.songs_delete
def songs_delete(self, songs): """Delete songs from library. Parameters: song (list): A list of song dicts. Returns: list: Successfully deleted song IDs. """ mutations = [mc_calls.TrackBatch.delete(song['id']) for song in songs] response = self._call( mc_calls.TrackBatch, mutations ) suc...
python
def songs_delete(self, songs): """Delete songs from library. Parameters: song (list): A list of song dicts. Returns: list: Successfully deleted song IDs. """ mutations = [mc_calls.TrackBatch.delete(song['id']) for song in songs] response = self._call( mc_calls.TrackBatch, mutations ) suc...
Delete songs from library. Parameters: song (list): A list of song dicts. Returns: list: Successfully deleted song IDs.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1602-L1631
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.song_play
def song_play(self, song): """Add play to song play count. Parameters: song (dict): A song dict. Returns: bool: ``True`` if successful, ``False`` if not. """ if 'storeId' in song: song_id = song['storeId'] elif 'trackId' in song: song_id = song['trackId'] else: song_id = song['id'] so...
python
def song_play(self, song): """Add play to song play count. Parameters: song (dict): A song dict. Returns: bool: ``True`` if successful, ``False`` if not. """ if 'storeId' in song: song_id = song['storeId'] elif 'trackId' in song: song_id = song['trackId'] else: song_id = song['id'] so...
Add play to song play count. Parameters: song (dict): A song dict. Returns: bool: ``True`` if successful, ``False`` if not.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1633-L1658
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.song_rate
def song_rate(self, song, rating): """Rate song. Parameters: song (dict): A song dict. rating (int): 0 (not rated), 1 (thumbs down), or 5 (thumbs up). Returns: bool: ``True`` if successful, ``False`` if not. """ if 'storeId' in song: song_id = song['storeId'] elif 'trackId' in song: song_i...
python
def song_rate(self, song, rating): """Rate song. Parameters: song (dict): A song dict. rating (int): 0 (not rated), 1 (thumbs down), or 5 (thumbs up). Returns: bool: ``True`` if successful, ``False`` if not. """ if 'storeId' in song: song_id = song['storeId'] elif 'trackId' in song: song_i...
Rate song. Parameters: song (dict): A song dict. rating (int): 0 (not rated), 1 (thumbs down), or 5 (thumbs up). Returns: bool: ``True`` if successful, ``False`` if not.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1660-L1684
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.songs
def songs(self): """Get a listing of library songs. Returns: list: Song dicts. """ song_list = [] for chunk in self.songs_iter(page_size=49995): song_list.extend(chunk) return song_list
python
def songs(self): """Get a listing of library songs. Returns: list: Song dicts. """ song_list = [] for chunk in self.songs_iter(page_size=49995): song_list.extend(chunk) return song_list
Get a listing of library songs. Returns: list: Song dicts.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1686-L1697
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.songs_iter
def songs_iter(self, *, page_size=250): """Get a paged iterator of library songs. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Song dicts. """ start_token = None while True: response = se...
python
def songs_iter(self, *, page_size=250): """Get a paged iterator of library songs. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Song dicts. """ start_token = None while True: response = se...
Get a paged iterator of library songs. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Song dicts.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1699-L1726
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.station
def station(self, station_id, *, num_songs=25, recently_played=None): """Get information about a station. Parameters: station_id (str): A station ID. Use 'IFL' for I'm Feeling Lucky. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (lis...
python
def station(self, station_id, *, num_songs=25, recently_played=None): """Get information about a station. Parameters: station_id (str): A station ID. Use 'IFL' for I'm Feeling Lucky. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (lis...
Get information about a station. Parameters: station_id (str): A station ID. Use 'IFL' for I'm Feeling Lucky. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (list, Optional): A list of dicts in the form of {'id': '', 'type'} where `...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1730-L1764
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.station_feed
def station_feed(self, *, num_songs=25, num_stations=4): """Generate stations. Note: A Google Music subscription is required. Parameters: num_songs (int, Optional): The total number of songs to return. Default: ``25`` num_stations (int, Optional): The number of stations to return when no station_infos ...
python
def station_feed(self, *, num_songs=25, num_stations=4): """Generate stations. Note: A Google Music subscription is required. Parameters: num_songs (int, Optional): The total number of songs to return. Default: ``25`` num_stations (int, Optional): The number of stations to return when no station_infos ...
Generate stations. Note: A Google Music subscription is required. Parameters: num_songs (int, Optional): The total number of songs to return. Default: ``25`` num_stations (int, Optional): The number of stations to return when no station_infos is provided. Default: ``5`` Returns: list: Station i...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1767-L1789
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.station_songs
def station_songs(self, station, *, num_songs=25, recently_played=None): """Get a listing of songs from a station. Parameters: station (str): A station dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (list, Optional): A list of dicts...
python
def station_songs(self, station, *, num_songs=25, recently_played=None): """Get a listing of songs from a station. Parameters: station (str): A station dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (list, Optional): A list of dicts...
Get a listing of songs from a station. Parameters: station (str): A station dict. num_songs (int, Optional): The maximum number of songs to return from the station. Default: ``25`` recently_played (list, Optional): A list of dicts in the form of {'id': '', 'type'} where ``id`` is a song ID and ``type`` ...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1791-L1812
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.stations
def stations(self, *, generated=True, library=True): """Get a listing of library stations. The listing can contain stations added to the library and generated from the library. Parameters: generated (bool, Optional): Include generated stations. Default: True library (bool, Optional): Include library s...
python
def stations(self, *, generated=True, library=True): """Get a listing of library stations. The listing can contain stations added to the library and generated from the library. Parameters: generated (bool, Optional): Include generated stations. Default: True library (bool, Optional): Include library s...
Get a listing of library stations. The listing can contain stations added to the library and generated from the library. Parameters: generated (bool, Optional): Include generated stations. Default: True library (bool, Optional): Include library stations. Default: True Returns: list: Station in...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1814-L1838
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.stations_iter
def stations_iter(self, *, page_size=250): """Get a paged iterator of library stations. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Station dicts. """ start_token = None while True: resp...
python
def stations_iter(self, *, page_size=250): """Get a paged iterator of library stations. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Station dicts. """ start_token = None while True: resp...
Get a paged iterator of library stations. Parameters: page_size (int, Optional): The maximum number of results per returned page. Max allowed is ``49995``. Default: ``250`` Yields: list: Station dicts.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1840-L1864
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.stream
def stream(self, item, *, device_id=None, quality='hi', session_token=None): """Get MP3 stream of a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, station_song...
python
def stream(self, item, *, device_id=None, quality='hi', session_token=None): """Get MP3 stream of a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, station_song...
Get MP3 stream of a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, station_song, or store song. A Google Music subscription is required to stream store songs...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1866-L1898
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.stream_url
def stream_url(self, item, *, device_id=None, quality='hi', session_token=None): """Get a URL to stream a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, statio...
python
def stream_url(self, item, *, device_id=None, quality='hi', session_token=None): """Get a URL to stream a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, statio...
Get a URL to stream a podcast episode, library song, station_song, or store song. Note: Streaming requires a ``device_id`` from a valid, linked mobile device. Parameters: item (str): A podcast episode, library song, station_song, or store song. A Google Music subscription is required to stream store son...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1900-L1974
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.thumbs_up_songs
def thumbs_up_songs(self, *, library=True, store=True): """Get a listing of 'Thumbs Up' store songs. Parameters: library (bool, Optional): Include 'Thumbs Up' songs from library. Default: True generated (bool, Optional): Include 'Thumbs Up' songs from store. Default: True Returns: list: Dicts o...
python
def thumbs_up_songs(self, *, library=True, store=True): """Get a listing of 'Thumbs Up' store songs. Parameters: library (bool, Optional): Include 'Thumbs Up' songs from library. Default: True generated (bool, Optional): Include 'Thumbs Up' songs from store. Default: True Returns: list: Dicts o...
Get a listing of 'Thumbs Up' store songs. Parameters: library (bool, Optional): Include 'Thumbs Up' songs from library. Default: True generated (bool, Optional): Include 'Thumbs Up' songs from store. Default: True Returns: list: Dicts of 'Thumbs Up' songs.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1976-L2002
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.top_charts
def top_charts(self): """Get a listing of the default top charts.""" response = self._call(mc_calls.BrowseTopChart) top_charts = response.body return top_charts
python
def top_charts(self): """Get a listing of the default top charts.""" response = self._call(mc_calls.BrowseTopChart) top_charts = response.body return top_charts
Get a listing of the default top charts.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L2004-L2010
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.top_charts_for_genre
def top_charts_for_genre(self, genre_id): """Get a listing of top charts for a top chart genre. Parameters: genre_id (str): A top chart genre ID as found with :meth:`top_charts_genres`. """ response = self._call(mc_calls.BrowseTopChartForGenre, genre_id) top_chart_for_genre = response.body return top_...
python
def top_charts_for_genre(self, genre_id): """Get a listing of top charts for a top chart genre. Parameters: genre_id (str): A top chart genre ID as found with :meth:`top_charts_genres`. """ response = self._call(mc_calls.BrowseTopChartForGenre, genre_id) top_chart_for_genre = response.body return top_...
Get a listing of top charts for a top chart genre. Parameters: genre_id (str): A top chart genre ID as found with :meth:`top_charts_genres`.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L2012-L2022
thebigmunch/google-music
src/google_music/clients/mobileclient.py
MobileClient.top_charts_genres
def top_charts_genres(self): """Get a listing of genres from the browse top charts tab.""" response = self._call(mc_calls.BrowseTopChartGenres) top_chart_genres = response.body.get('genres', []) return top_chart_genres
python
def top_charts_genres(self): """Get a listing of genres from the browse top charts tab.""" response = self._call(mc_calls.BrowseTopChartGenres) top_chart_genres = response.body.get('genres', []) return top_chart_genres
Get a listing of genres from the browse top charts tab.
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L2024-L2030
anrosent/LT-code
lt/decode/__main__.py
run
def run(stream=sys.stdin.buffer): """Reads from stream, applying the LT decoding algorithm to incoming encoded blocks until sufficiently many blocks have been received to reconstruct the entire file. """ payload = decode.decode(stream) sys.stdout.write(payload.decode('utf8'))
python
def run(stream=sys.stdin.buffer): """Reads from stream, applying the LT decoding algorithm to incoming encoded blocks until sufficiently many blocks have been received to reconstruct the entire file. """ payload = decode.decode(stream) sys.stdout.write(payload.decode('utf8'))
Reads from stream, applying the LT decoding algorithm to incoming encoded blocks until sufficiently many blocks have been received to reconstruct the entire file.
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/decode/__main__.py#L14-L20
anrosent/LT-code
lt/encode/__init__.py
_split_file
def _split_file(f, blocksize): """Block file byte contents into blocksize chunks, padding last one if necessary """ f_bytes = f.read() blocks = [int.from_bytes(f_bytes[i:i+blocksize].ljust(blocksize, b'0'), sys.byteorder) for i in range(0, len(f_bytes), blocksize)] return len(f_bytes),...
python
def _split_file(f, blocksize): """Block file byte contents into blocksize chunks, padding last one if necessary """ f_bytes = f.read() blocks = [int.from_bytes(f_bytes[i:i+blocksize].ljust(blocksize, b'0'), sys.byteorder) for i in range(0, len(f_bytes), blocksize)] return len(f_bytes),...
Block file byte contents into blocksize chunks, padding last one if necessary
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/encode/__init__.py#L7-L14
anrosent/LT-code
lt/encode/__init__.py
encoder
def encoder(f, blocksize, seed=None, c=sampler.DEFAULT_C, delta=sampler.DEFAULT_DELTA): """Generates an infinite sequence of blocks to transmit to the receiver """ # Generate seed if not provided if seed is None: seed = randint(0, 1 << 31 - 1) # get file blocks filesize, blocks = _...
python
def encoder(f, blocksize, seed=None, c=sampler.DEFAULT_C, delta=sampler.DEFAULT_DELTA): """Generates an infinite sequence of blocks to transmit to the receiver """ # Generate seed if not provided if seed is None: seed = randint(0, 1 << 31 - 1) # get file blocks filesize, blocks = _...
Generates an infinite sequence of blocks to transmit to the receiver
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/encode/__init__.py#L17-L43
anrosent/LT-code
lt/decode/__init__.py
_read_block
def _read_block(blocksize, stream): """Read block data from network into integer type """ blockdata = stream.read(blocksize) return int.from_bytes(blockdata, 'big')
python
def _read_block(blocksize, stream): """Read block data from network into integer type """ blockdata = stream.read(blocksize) return int.from_bytes(blockdata, 'big')
Read block data from network into integer type
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/decode/__init__.py#L145-L149
anrosent/LT-code
lt/decode/__init__.py
read_blocks
def read_blocks(stream): """Generate parsed blocks from input stream """ while True: header = _read_header(stream) block = _read_block(header[1], stream) yield (header, block)
python
def read_blocks(stream): """Generate parsed blocks from input stream """ while True: header = _read_header(stream) block = _read_block(header[1], stream) yield (header, block)
Generate parsed blocks from input stream
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/decode/__init__.py#L151-L157
anrosent/LT-code
lt/decode/__init__.py
BlockGraph.add_block
def add_block(self, nodes, data): """Adds a new check node and edges between that node and all source nodes it connects, resolving all message passes that become possible as a result. """ # We can eliminate this source node if len(nodes) == 1: to_eliminate = ...
python
def add_block(self, nodes, data): """Adds a new check node and edges between that node and all source nodes it connects, resolving all message passes that become possible as a result. """ # We can eliminate this source node if len(nodes) == 1: to_eliminate = ...
Adds a new check node and edges between that node and all source nodes it connects, resolving all message passes that become possible as a result.
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/decode/__init__.py#L29-L62
anrosent/LT-code
lt/decode/__init__.py
BlockGraph.eliminate
def eliminate(self, node, data): """Resolves a source node, passing the message to all associated checks """ # Cache resolved value self.eliminated[node] = data others = self.checks[node] del self.checks[node] # Pass messages to all associated checks for...
python
def eliminate(self, node, data): """Resolves a source node, passing the message to all associated checks """ # Cache resolved value self.eliminated[node] = data others = self.checks[node] del self.checks[node] # Pass messages to all associated checks for...
Resolves a source node, passing the message to all associated checks
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/decode/__init__.py#L64-L80
thebigmunch/google-music
src/google_music/api.py
mobileclient
def mobileclient(username=None, device_id=None, *, token=None, locale='en_US'): """Create and authenticate a Google Music mobile client. >>> import google_music >>> mc = google_music.mobileclient('username') Parameters: username (str, Optional): Your Google Music username. This is used to store OAuth credent...
python
def mobileclient(username=None, device_id=None, *, token=None, locale='en_US'): """Create and authenticate a Google Music mobile client. >>> import google_music >>> mc = google_music.mobileclient('username') Parameters: username (str, Optional): Your Google Music username. This is used to store OAuth credent...
Create and authenticate a Google Music mobile client. >>> import google_music >>> mc = google_music.mobileclient('username') Parameters: username (str, Optional): Your Google Music username. This is used to store OAuth credentials for different accounts separately. device_id (str, Optional): A mobile device...
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/api.py#L6-L29
Zsailer/phylopandas
phylopandas/treeio/read.py
_dendropy_to_dataframe
def _dendropy_to_dataframe( tree, add_node_labels=True, use_uids=True): """Convert Dendropy tree to Pandas dataframe.""" # Maximum distance from root. tree.max_distance_from_root() # Initialize the data object. idx = [] data = { 'type': [], 'id': [], 'parent'...
python
def _dendropy_to_dataframe( tree, add_node_labels=True, use_uids=True): """Convert Dendropy tree to Pandas dataframe.""" # Maximum distance from root. tree.max_distance_from_root() # Initialize the data object. idx = [] data = { 'type': [], 'id': [], 'parent'...
Convert Dendropy tree to Pandas dataframe.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/read.py#L35-L104
Zsailer/phylopandas
phylopandas/treeio/read.py
_read
def _read( filename=None, data=None, schema=None, add_node_labels=True, use_uids=True ): """Read a phylogenetic tree into a phylopandas.DataFrame. The resulting DataFrame has the following columns: - name: label for each taxa or node. - id: unique id (created by phylopan...
python
def _read( filename=None, data=None, schema=None, add_node_labels=True, use_uids=True ): """Read a phylogenetic tree into a phylopandas.DataFrame. The resulting DataFrame has the following columns: - name: label for each taxa or node. - id: unique id (created by phylopan...
Read a phylogenetic tree into a phylopandas.DataFrame. The resulting DataFrame has the following columns: - name: label for each taxa or node. - id: unique id (created by phylopandas) given to each node. - type: type of node (leaf, internal, or root). - parent: parent id. necessary ...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/read.py#L107-L158
Zsailer/phylopandas
phylopandas/treeio/read.py
_read_function
def _read_function(schema): """Add a write method for named schema to a class. """ def func( filename=None, data=None, add_node_labels=True, use_uids=True, **kwargs): # Use generic write class to write data. return _read( filename=filename,...
python
def _read_function(schema): """Add a write method for named schema to a class. """ def func( filename=None, data=None, add_node_labels=True, use_uids=True, **kwargs): # Use generic write class to write data. return _read( filename=filename,...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/read.py#L189-L209
Zsailer/phylopandas
phylopandas/seqio/write.py
pandas_df_to_biopython_seqrecord
def pandas_df_to_biopython_seqrecord( df, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, ): """Convert pandas dataframe to biopython seqrecord for easy writing. Parameters ---------- df : Dataframe Pandas dataframe to convert id_col : str ...
python
def pandas_df_to_biopython_seqrecord( df, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, ): """Convert pandas dataframe to biopython seqrecord for easy writing. Parameters ---------- df : Dataframe Pandas dataframe to convert id_col : str ...
Convert pandas dataframe to biopython seqrecord for easy writing. Parameters ---------- df : Dataframe Pandas dataframe to convert id_col : str column in dataframe to use as sequence label sequence_col str: column in dataframe to use as sequence data extra_data : list...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/write.py#L34-L93
Zsailer/phylopandas
phylopandas/seqio/write.py
pandas_series_to_biopython_seqrecord
def pandas_series_to_biopython_seqrecord( series, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None ): """Convert pandas series to biopython seqrecord for easy writing. Parameters ---------- series : Series Pandas series to convert id_col : str ...
python
def pandas_series_to_biopython_seqrecord( series, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None ): """Convert pandas series to biopython seqrecord for easy writing. Parameters ---------- series : Series Pandas series to convert id_col : str ...
Convert pandas series to biopython seqrecord for easy writing. Parameters ---------- series : Series Pandas series to convert id_col : str column in dataframe to use as sequence label sequence_col : str column in dataframe to use as sequence data extra_data : list ...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/write.py#L95-L142
Zsailer/phylopandas
phylopandas/seqio/write.py
_write
def _write( data, filename=None, schema='fasta', id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): """General write function. Write phylopanda data to biopython format. Parameters ---------- filename : str File to write string to. ...
python
def _write( data, filename=None, schema='fasta', id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): """General write function. Write phylopanda data to biopython format. Parameters ---------- filename : str File to write string to. ...
General write function. Write phylopanda data to biopython format. Parameters ---------- filename : str File to write string to. If no filename is given, a string will be returned. sequence_col : str (default='sequence') Sequence column name in DataFrame. id_col : str (def...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/write.py#L144-L207
Zsailer/phylopandas
phylopandas/seqio/write.py
_write_method
def _write_method(schema): """Add a write method for named schema to a class. """ def method( self, filename=None, schema=schema, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): # Use generic write clas...
python
def _write_method(schema): """Add a write method for named schema to a class. """ def method( self, filename=None, schema=schema, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): # Use generic write clas...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/write.py#L209-L234
Zsailer/phylopandas
phylopandas/seqio/write.py
_write_function
def _write_function(schema): """Add a write method for named schema to a class. """ def func( data, filename=None, schema=schema, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): # Use generic write clas...
python
def _write_function(schema): """Add a write method for named schema to a class. """ def func( data, filename=None, schema=schema, id_col='uid', sequence_col='sequence', extra_data=None, alphabet=None, **kwargs): # Use generic write clas...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/write.py#L237-L262
Zsailer/phylopandas
phylopandas/seqio/read.py
_read
def _read( filename, schema, seq_label='sequence', alphabet=None, use_uids=True, **kwargs): """Use BioPython's sequence parsing module to convert any file format to a Pandas DataFrame. The resulting DataFrame has the following columns: - name - id - descripti...
python
def _read( filename, schema, seq_label='sequence', alphabet=None, use_uids=True, **kwargs): """Use BioPython's sequence parsing module to convert any file format to a Pandas DataFrame. The resulting DataFrame has the following columns: - name - id - descripti...
Use BioPython's sequence parsing module to convert any file format to a Pandas DataFrame. The resulting DataFrame has the following columns: - name - id - description - sequence
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/read.py#L37-L88
Zsailer/phylopandas
phylopandas/seqio/read.py
_read_method
def _read_method(schema): """Add a write method for named schema to a class. """ def func( self, filename, seq_label='sequence', alphabet=None, combine_on='uid', use_uids=True, **kwargs): # Use generic write class to write data. df0 = s...
python
def _read_method(schema): """Add a write method for named schema to a class. """ def func( self, filename, seq_label='sequence', alphabet=None, combine_on='uid', use_uids=True, **kwargs): # Use generic write class to write data. df0 = s...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/read.py#L91-L116
Zsailer/phylopandas
phylopandas/seqio/read.py
_read_function
def _read_function(schema): """Add a write method for named schema to a class. """ def func( filename, seq_label='sequence', alphabet=None, use_uids=True, **kwargs): # Use generic write class to write data. return _read( filename=filename, ...
python
def _read_function(schema): """Add a write method for named schema to a class. """ def func( filename, seq_label='sequence', alphabet=None, use_uids=True, **kwargs): # Use generic write class to write data. return _read( filename=filename, ...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/read.py#L119-L139
Zsailer/phylopandas
phylopandas/seqio/read.py
read_blast_xml
def read_blast_xml(filename, **kwargs): """Read BLAST XML format.""" # Read file. with open(filename, 'r') as f: blast_record = NCBIXML.read(f) # Prepare DataFrame fields. data = {'accession': [], 'hit_def': [], 'hit_id': [], 'title': [], 'len...
python
def read_blast_xml(filename, **kwargs): """Read BLAST XML format.""" # Read file. with open(filename, 'r') as f: blast_record = NCBIXML.read(f) # Prepare DataFrame fields. data = {'accession': [], 'hit_def': [], 'hit_id': [], 'title': [], 'len...
Read BLAST XML format.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/read.py#L154-L180
Zsailer/phylopandas
phylopandas/treeio/write.py
_pandas_df_to_dendropy_tree
def _pandas_df_to_dendropy_tree( df, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, ): """Turn a phylopandas dataframe into a dendropy tree. Parameters ---------- df : DataFrame DataFrame containing tree data. ta...
python
def _pandas_df_to_dendropy_tree( df, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, ): """Turn a phylopandas dataframe into a dendropy tree. Parameters ---------- df : DataFrame DataFrame containing tree data. ta...
Turn a phylopandas dataframe into a dendropy tree. Parameters ---------- df : DataFrame DataFrame containing tree data. taxon_col : str (optional) Column in dataframe to label the taxon. If None, the index will be used. taxon_annotations : str List of columns to annotation...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/write.py#L31-L126
Zsailer/phylopandas
phylopandas/treeio/write.py
_write
def _write( df, filename=None, schema='newick', taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs ): """Write a phylopandas tree DataFrame to various formats. Parameters ---------- df : DataFrame Dat...
python
def _write( df, filename=None, schema='newick', taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs ): """Write a phylopandas tree DataFrame to various formats. Parameters ---------- df : DataFrame Dat...
Write a phylopandas tree DataFrame to various formats. Parameters ---------- df : DataFrame DataFrame containing tree data. filename : str filepath to write out tree. If None, will return string. schema : str tree format to write out. taxon_col : str (optional) ...
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/write.py#L129-L182
Zsailer/phylopandas
phylopandas/treeio/write.py
_write_method
def _write_method(schema): """Add a write method for named schema to a class. """ def method( self, filename=None, schema=schema, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs)...
python
def _write_method(schema): """Add a write method for named schema to a class. """ def method( self, filename=None, schema=schema, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs)...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/write.py#L185-L212
Zsailer/phylopandas
phylopandas/treeio/write.py
_write_function
def _write_function(schema): """Add a write method for named schema to a class. """ def func( data, filename=None, schema=schema, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs)...
python
def _write_function(schema): """Add a write method for named schema to a class. """ def func( data, filename=None, schema=schema, taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs)...
Add a write method for named schema to a class.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/treeio/write.py#L215-L242
Zsailer/phylopandas
phylopandas/utils.py
get_random_id
def get_random_id(length): """Generate a random, alpha-numerical id.""" alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits return ''.join(random.choice(alphabet) for _ in range(length))
python
def get_random_id(length): """Generate a random, alpha-numerical id.""" alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits return ''.join(random.choice(alphabet) for _ in range(length))
Generate a random, alpha-numerical id.
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/utils.py#L4-L7
nicolas-van/pygreen
pygreen.py
PyGreen.set_folder
def set_folder(self, folder): """ Sets the folder where the files to serve are located. """ self.folder = folder self.templates.directories[0] = folder self.app.root_path = folder
python
def set_folder(self, folder): """ Sets the folder where the files to serve are located. """ self.folder = folder self.templates.directories[0] = folder self.app.root_path = folder
Sets the folder where the files to serve are located.
https://github.com/nicolas-van/pygreen/blob/41d433edb408f86278cf95269fabf3acc00c9119/pygreen.py#L81-L87
nicolas-van/pygreen
pygreen.py
PyGreen.run
def run(self, host='0.0.0.0', port=8080): """ Launch a development web server. """ waitress.serve(self.app, host=host, port=port)
python
def run(self, host='0.0.0.0', port=8080): """ Launch a development web server. """ waitress.serve(self.app, host=host, port=port)
Launch a development web server.
https://github.com/nicolas-van/pygreen/blob/41d433edb408f86278cf95269fabf3acc00c9119/pygreen.py#L89-L93
nicolas-van/pygreen
pygreen.py
PyGreen.get
def get(self, path): """ Get the content of a file, indentified by its path relative to the folder configured in PyGreen. If the file extension is one of the extensions that should be processed through Mako, it will be processed. """ data = self.app.test_client().get("/%s...
python
def get(self, path): """ Get the content of a file, indentified by its path relative to the folder configured in PyGreen. If the file extension is one of the extensions that should be processed through Mako, it will be processed. """ data = self.app.test_client().get("/%s...
Get the content of a file, indentified by its path relative to the folder configured in PyGreen. If the file extension is one of the extensions that should be processed through Mako, it will be processed.
https://github.com/nicolas-van/pygreen/blob/41d433edb408f86278cf95269fabf3acc00c9119/pygreen.py#L95-L102
nicolas-van/pygreen
pygreen.py
PyGreen.gen_static
def gen_static(self, output_folder): """ Generates a complete static version of the web site. It will stored in output_folder. """ files = [] for l in self.file_listers: files += l() for f in files: _logger.info("generating %s" % f) ...
python
def gen_static(self, output_folder): """ Generates a complete static version of the web site. It will stored in output_folder. """ files = [] for l in self.file_listers: files += l() for f in files: _logger.info("generating %s" % f) ...
Generates a complete static version of the web site. It will stored in output_folder.
https://github.com/nicolas-van/pygreen/blob/41d433edb408f86278cf95269fabf3acc00c9119/pygreen.py#L104-L120
nicolas-van/pygreen
pygreen.py
PyGreen.cli
def cli(self, cmd_args=None): """ The command line interface of PyGreen. """ logging.basicConfig(level=logging.INFO, format='%(message)s') parser = argparse.ArgumentParser(description='PyGreen, micro web framework/static web site generator') subparsers = parser.add_subpa...
python
def cli(self, cmd_args=None): """ The command line interface of PyGreen. """ logging.basicConfig(level=logging.INFO, format='%(message)s') parser = argparse.ArgumentParser(description='PyGreen, micro web framework/static web site generator') subparsers = parser.add_subpa...
The command line interface of PyGreen.
https://github.com/nicolas-van/pygreen/blob/41d433edb408f86278cf95269fabf3acc00c9119/pygreen.py#L125-L155
internap/fake-switches
fake_switches/command_processing/base_command_processor.py
BaseCommandProcessor.init
def init(self, switch_configuration, terminal_controller, logger, piping_processor, *args): """ :type switch_configuration: fake_switches.switch_configuration.SwitchConfiguration :type terminal_controller: fake_switches.terminal.TerminalController :type logger: logging.Logger :ty...
python
def init(self, switch_configuration, terminal_controller, logger, piping_processor, *args): """ :type switch_configuration: fake_switches.switch_configuration.SwitchConfiguration :type terminal_controller: fake_switches.terminal.TerminalController :type logger: logging.Logger :ty...
:type switch_configuration: fake_switches.switch_configuration.SwitchConfiguration :type terminal_controller: fake_switches.terminal.TerminalController :type logger: logging.Logger :type piping_processor: fake_switches.command_processing.piping_processor_base.PipingProcessorBase
https://github.com/internap/fake-switches/blob/ea5f77f0c73493497fb43ce59f3c75b52ce9bac8/fake_switches/command_processing/base_command_processor.py#L19-L35
urschrei/Circles
Circles/circles.py
_gccalc
def _gccalc(lon, lat, azimuth, maxdist=None): """ Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult """ glat1 = lat * np.pi / 180. glon1 = lon * np.pi / 180. s = maxd...
python
def _gccalc(lon, lat, azimuth, maxdist=None): """ Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult """ glat1 = lat * np.pi / 180. glon1 = lon * np.pi / 180. s = maxd...
Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult
https://github.com/urschrei/Circles/blob/5aab401b470935e816a28d7ba817eb72f9344672/Circles/circles.py#L30-L95
urschrei/Circles
Circles/circles.py
circle
def circle(m, centerlon, centerlat, radius, *args, **kwargs): """ Return lon, lat tuples of a "circle" which matches the chosen Basemap projection Takes the following arguments: m = basemap instance centerlon = originating lon centrelat = originating lat radius = radius """ glon1 = ...
python
def circle(m, centerlon, centerlat, radius, *args, **kwargs): """ Return lon, lat tuples of a "circle" which matches the chosen Basemap projection Takes the following arguments: m = basemap instance centerlon = originating lon centrelat = originating lat radius = radius """ glon1 = ...
Return lon, lat tuples of a "circle" which matches the chosen Basemap projection Takes the following arguments: m = basemap instance centerlon = originating lon centrelat = originating lat radius = radius
https://github.com/urschrei/Circles/blob/5aab401b470935e816a28d7ba817eb72f9344672/Circles/circles.py#L98-L120
martinblech/mimerender
src/mimerender.py
register_mime
def register_mime(shortname, mime_types): """ Register a new mime type. Usage example: mimerender.register_mime('svg', ('application/x-svg', 'application/svg+xml',)) After this you can do: @mimerender.mimerender(svg=render_svg) def GET(... ... """ if shortname...
python
def register_mime(shortname, mime_types): """ Register a new mime type. Usage example: mimerender.register_mime('svg', ('application/x-svg', 'application/svg+xml',)) After this you can do: @mimerender.mimerender(svg=render_svg) def GET(... ... """ if shortname...
Register a new mime type. Usage example: mimerender.register_mime('svg', ('application/x-svg', 'application/svg+xml',)) After this you can do: @mimerender.mimerender(svg=render_svg) def GET(... ...
https://github.com/martinblech/mimerender/blob/8bcd05337402c93cf595ff26a8710ec3b1a19b04/src/mimerender.py#L63-L75
martinblech/mimerender
src/mimerender.py
wsgi_wrap
def wsgi_wrap(app): ''' Wraps a standard wsgi application e.g.: def app(environ, start_response) It intercepts the start_response callback and grabs the results from it so it can return the status, headers, and body as a tuple ''' @wraps(app) def wrapped(environ, start_response): ...
python
def wsgi_wrap(app): ''' Wraps a standard wsgi application e.g.: def app(environ, start_response) It intercepts the start_response callback and grabs the results from it so it can return the status, headers, and body as a tuple ''' @wraps(app) def wrapped(environ, start_response): ...
Wraps a standard wsgi application e.g.: def app(environ, start_response) It intercepts the start_response callback and grabs the results from it so it can return the status, headers, and body as a tuple
https://github.com/martinblech/mimerender/blob/8bcd05337402c93cf595ff26a8710ec3b1a19b04/src/mimerender.py#L412-L427
martinblech/mimerender
src/mimerender.py
WSGIMimeRender
def WSGIMimeRender(*args, **kwargs): ''' A wrapper for _WSGIMimeRender that wrapps the inner callable with wsgi_wrap first. ''' def wrapper(*args2, **kwargs2): # take the function def wrapped(f): return _WSGIMimeRender(*args, **kwargs)(*args2, **kwargs2)(wsgi_wrap(f)) ...
python
def WSGIMimeRender(*args, **kwargs): ''' A wrapper for _WSGIMimeRender that wrapps the inner callable with wsgi_wrap first. ''' def wrapper(*args2, **kwargs2): # take the function def wrapped(f): return _WSGIMimeRender(*args, **kwargs)(*args2, **kwargs2)(wsgi_wrap(f)) ...
A wrapper for _WSGIMimeRender that wrapps the inner callable with wsgi_wrap first.
https://github.com/martinblech/mimerender/blob/8bcd05337402c93cf595ff26a8710ec3b1a19b04/src/mimerender.py#L452-L462
martinblech/mimerender
src/mimerender.py
MimeRenderBase.map_exceptions
def map_exceptions(self, mapping, *args, **kwargs): """ Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs. """ @self.__call__(*args, **kwargs) def helper(e,...
python
def map_exceptions(self, mapping, *args, **kwargs): """ Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs. """ @self.__call__(*args, **kwargs) def helper(e,...
Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs.
https://github.com/martinblech/mimerender/blob/8bcd05337402c93cf595ff26a8710ec3b1a19b04/src/mimerender.py#L276-L297
marrow/uri
uri/uri.py
URI.relative
def relative(self): """Identify if this URI is relative to some "current context". For example, if the protocol is missing, it's protocol-relative. If the host is missing, it's host-relative, etc. """ scheme = self.scheme if not scheme: return True return scheme.is_relative(self)
python
def relative(self): """Identify if this URI is relative to some "current context". For example, if the protocol is missing, it's protocol-relative. If the host is missing, it's host-relative, etc. """ scheme = self.scheme if not scheme: return True return scheme.is_relative(self)
Identify if this URI is relative to some "current context". For example, if the protocol is missing, it's protocol-relative. If the host is missing, it's host-relative, etc.
https://github.com/marrow/uri/blob/1d8220f11111920cd625a0a32ba6a354edead825/uri/uri.py#L243-L254
marrow/uri
uri/uri.py
URI.resolve
def resolve(self, uri=None, **parts): """Attempt to resolve a new URI given an updated URI, partial or complete.""" if uri: result = self.__class__(urljoin(str(self), str(uri))) else: result = self.__class__(self) for part, value in parts.items(): if part not in self.__all_parts__: raise Type...
python
def resolve(self, uri=None, **parts): """Attempt to resolve a new URI given an updated URI, partial or complete.""" if uri: result = self.__class__(urljoin(str(self), str(uri))) else: result = self.__class__(self) for part, value in parts.items(): if part not in self.__all_parts__: raise Type...
Attempt to resolve a new URI given an updated URI, partial or complete.
https://github.com/marrow/uri/blob/1d8220f11111920cd625a0a32ba6a354edead825/uri/uri.py#L256-L270
pylover/khayyam
khayyam/jalali_date.py
JalaliDate.strptime
def strptime(cls, date_string, fmt): """ This is opposite of the :py:meth:`khayyam.JalaliDate.strftime`, and used to parse date strings into date object. `ValueError` is raised if the date_string and format can’t be parsed by time.strptime() or if it returns a value which isn’t ...
python
def strptime(cls, date_string, fmt): """ This is opposite of the :py:meth:`khayyam.JalaliDate.strftime`, and used to parse date strings into date object. `ValueError` is raised if the date_string and format can’t be parsed by time.strptime() or if it returns a value which isn’t ...
This is opposite of the :py:meth:`khayyam.JalaliDate.strftime`, and used to parse date strings into date object. `ValueError` is raised if the date_string and format can’t be parsed by time.strptime() or if it returns a value which isn’t a time tuple. For a complete list of formatting d...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L155-L173
pylover/khayyam
khayyam/jalali_date.py
JalaliDate.replace
def replace(self, year=None, month=None, day=None): """ Replaces the given arguments on this instance, and return a new instance. :param year: :param month: :param day: :return: A :py:class:`khayyam.JalaliDate` with the same attributes, except for those attri...
python
def replace(self, year=None, month=None, day=None): """ Replaces the given arguments on this instance, and return a new instance. :param year: :param month: :param day: :return: A :py:class:`khayyam.JalaliDate` with the same attributes, except for those attri...
Replaces the given arguments on this instance, and return a new instance. :param year: :param month: :param day: :return: A :py:class:`khayyam.JalaliDate` with the same attributes, except for those attributes given new values by which keyword arguments are specified.
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L210-L225
pylover/khayyam
khayyam/jalali_date.py
JalaliDate.todate
def todate(self): """ Calculates the corresponding day in the gregorian calendar. this is the main use case of this library. :return: Corresponding date in gregorian calendar. :rtype: :py:class:`datetime.date` """ arr = get_gregorian_date_from_julian_day(self.tojulianday...
python
def todate(self): """ Calculates the corresponding day in the gregorian calendar. this is the main use case of this library. :return: Corresponding date in gregorian calendar. :rtype: :py:class:`datetime.date` """ arr = get_gregorian_date_from_julian_day(self.tojulianday...
Calculates the corresponding day in the gregorian calendar. this is the main use case of this library. :return: Corresponding date in gregorian calendar. :rtype: :py:class:`datetime.date`
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L227-L235
pylover/khayyam
khayyam/jalali_date.py
JalaliDate.timetuple
def timetuple(self): """ It's equivalent to: >>> time.struct_time((d.year, d.month, d.day, d.hour, d.minute, d.second, d.weekday(), dayofyear, [-1|1|0])) # doctest: +SKIP time.struct_time(tm_year=2015, tm_mon=7, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=209, ...
python
def timetuple(self): """ It's equivalent to: >>> time.struct_time((d.year, d.month, d.day, d.hour, d.minute, d.second, d.weekday(), dayofyear, [-1|1|0])) # doctest: +SKIP time.struct_time(tm_year=2015, tm_mon=7, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=209, ...
It's equivalent to: >>> time.struct_time((d.year, d.month, d.day, d.hour, d.minute, d.second, d.weekday(), dayofyear, [-1|1|0])) # doctest: +SKIP time.struct_time(tm_year=2015, tm_mon=7, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=209, tm_isdst=-1) The tm_isdst flag ...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L257-L283
pylover/khayyam
khayyam/jalali_date.py
JalaliDate.weekofyear
def weekofyear(self, first_day_of_week=SATURDAY): """weekofyear(first_day_of_week=SATURDAY) :param first_day_of_week: One of the :py:data:`khayyam.SATURDAY`, :py:data:`khayyam.SUNDAY`, :py:data:`khayyam.MONDAY`, :py:data:`khayyam.TUESDAY`,...
python
def weekofyear(self, first_day_of_week=SATURDAY): """weekofyear(first_day_of_week=SATURDAY) :param first_day_of_week: One of the :py:data:`khayyam.SATURDAY`, :py:data:`khayyam.SUNDAY`, :py:data:`khayyam.MONDAY`, :py:data:`khayyam.TUESDAY`,...
weekofyear(first_day_of_week=SATURDAY) :param first_day_of_week: One of the :py:data:`khayyam.SATURDAY`, :py:data:`khayyam.SUNDAY`, :py:data:`khayyam.MONDAY`, :py:data:`khayyam.TUESDAY`, :py:data:`khayyam.WEDNESDAY`, ...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L447-L470
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.fromtimestamp
def fromtimestamp(cls, timestamp, tz=None): """ Creates a new :py:class:`khayyam.JalaliDatetime` instance from the given posix timestamp. If optional argument tz is :py:obj:`None` or not specified, the timestamp is converted to the platform's local date and time, and the returned dateti...
python
def fromtimestamp(cls, timestamp, tz=None): """ Creates a new :py:class:`khayyam.JalaliDatetime` instance from the given posix timestamp. If optional argument tz is :py:obj:`None` or not specified, the timestamp is converted to the platform's local date and time, and the returned dateti...
Creates a new :py:class:`khayyam.JalaliDatetime` instance from the given posix timestamp. If optional argument tz is :py:obj:`None` or not specified, the timestamp is converted to the platform's local date and time, and the returned datetime object is naive. Else tz must be an instance of a cl...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L164-L199
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.combine
def combine(cls, date, _time): """ Return a new jalali datetime object whose date members are equal to the given date object's, and whose _time and tzinfo members are equal to the given _time object's. For any datetime object d, d == datetime.combine(d.date(), d.timetz()). If date is a d...
python
def combine(cls, date, _time): """ Return a new jalali datetime object whose date members are equal to the given date object's, and whose _time and tzinfo members are equal to the given _time object's. For any datetime object d, d == datetime.combine(d.date(), d.timetz()). If date is a d...
Return a new jalali datetime object whose date members are equal to the given date object's, and whose _time and tzinfo members are equal to the given _time object's. For any datetime object d, d == datetime.combine(d.date(), d.timetz()). If date is a datetime object, its _time and tzinfo member...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L227-L241
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.todatetime
def todatetime(self): """ Converts the current instance to the python builtins :py:class:`datetime.datetime` instance. :return: the new :py:class:`datetime.datetime` instance representing the current date and time in gregorian calendar. :rtype: :py:class:`datetime.datetime` """ ...
python
def todatetime(self): """ Converts the current instance to the python builtins :py:class:`datetime.datetime` instance. :return: the new :py:class:`datetime.datetime` instance representing the current date and time in gregorian calendar. :rtype: :py:class:`datetime.datetime` """ ...
Converts the current instance to the python builtins :py:class:`datetime.datetime` instance. :return: the new :py:class:`datetime.datetime` instance representing the current date and time in gregorian calendar. :rtype: :py:class:`datetime.datetime`
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L265-L274
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.date
def date(self): """ Return date object with same year, month and day. :rtype: :py:class:`khayyam.JalaliDate` """ return khayyam.JalaliDate(self.year, self.month, self.day)
python
def date(self): """ Return date object with same year, month and day. :rtype: :py:class:`khayyam.JalaliDate` """ return khayyam.JalaliDate(self.year, self.month, self.day)
Return date object with same year, month and day. :rtype: :py:class:`khayyam.JalaliDate`
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L276-L282
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.replace
def replace(self, year=None, month=None, day=None, hour=None, minute=None, second=None, microsecond=None, tzinfo=None): """ Return a :py:class:`khayyam.JalaliDatetime` instance with the same attributes, except for those attributes given new values by whichever keyword arguments a...
python
def replace(self, year=None, month=None, day=None, hour=None, minute=None, second=None, microsecond=None, tzinfo=None): """ Return a :py:class:`khayyam.JalaliDatetime` instance with the same attributes, except for those attributes given new values by whichever keyword arguments a...
Return a :py:class:`khayyam.JalaliDatetime` instance with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Note that tzinfo=None can be specified to create a naive datetime from an aware datetime with no conversion of date and time data, wit...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L302-L336
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.astimezone
def astimezone(self, tz): """ Return a :py:class:`khayyam.JalaliDatetime` object with new :py:meth:`khayyam.JalaliDatetime.tzinfo` attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in *tz*‘s local time. *tz* must be an instance of a :py:class...
python
def astimezone(self, tz): """ Return a :py:class:`khayyam.JalaliDatetime` object with new :py:meth:`khayyam.JalaliDatetime.tzinfo` attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in *tz*‘s local time. *tz* must be an instance of a :py:class...
Return a :py:class:`khayyam.JalaliDatetime` object with new :py:meth:`khayyam.JalaliDatetime.tzinfo` attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in *tz*‘s local time. *tz* must be an instance of a :py:class:`datetime.tzinfo` subclass, and its :...
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L338-L387
pylover/khayyam
khayyam/jalali_datetime.py
JalaliDatetime.hour12
def hour12(self): """ Return The hour value between `1-12`. use :py:meth:`khayyam.JalaliDatetime.ampm()` or :py:meth:`khayyam.JalaliDatetime.ampmascii()` to determine `ante meridiem` and or `post meridiem` :rtype: int """ res = self.hour if res > 12: ...
python
def hour12(self): """ Return The hour value between `1-12`. use :py:meth:`khayyam.JalaliDatetime.ampm()` or :py:meth:`khayyam.JalaliDatetime.ampmascii()` to determine `ante meridiem` and or `post meridiem` :rtype: int """ res = self.hour if res > 12: ...
Return The hour value between `1-12`. use :py:meth:`khayyam.JalaliDatetime.ampm()` or :py:meth:`khayyam.JalaliDatetime.ampmascii()` to determine `ante meridiem` and or `post meridiem` :rtype: int
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_datetime.py#L568-L580
mmcauliffe/Conch-sounds
conch/analysis/formants/lpc.py
lpc_ref
def lpc_ref(signal, order): """Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[i] = ...
python
def lpc_ref(signal, order): """Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[i] = ...
Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[i] = xp[i] - x[i] is minimized. Par...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/formants/lpc.py#L13-L50
mmcauliffe/Conch-sounds
conch/analysis/formants/lpc.py
levinson_1d
def levinson_1d(r, order): """Levinson-Durbin recursion, to efficiently solve symmetric linear systems with toeplitz structure. Parameters --------- r : array-like input array to invert (since the matrix is symmetric Toeplitz, the corresponding pxp matrix is defined by p items only)...
python
def levinson_1d(r, order): """Levinson-Durbin recursion, to efficiently solve symmetric linear systems with toeplitz structure. Parameters --------- r : array-like input array to invert (since the matrix is symmetric Toeplitz, the corresponding pxp matrix is defined by p items only)...
Levinson-Durbin recursion, to efficiently solve symmetric linear systems with toeplitz structure. Parameters --------- r : array-like input array to invert (since the matrix is symmetric Toeplitz, the corresponding pxp matrix is defined by p items only). Generally the autocorrel...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/formants/lpc.py#L54-L123
mmcauliffe/Conch-sounds
conch/analysis/formants/lpc.py
acorr_lpc
def acorr_lpc(x, axis=-1): """Compute autocorrelation of x along the given axis. This compute the biased autocorrelation estimator (divided by the size of input signal) Notes ----- The reason why we do not use acorr directly is for speed issue.""" if not np.isrealobj(x): raise ...
python
def acorr_lpc(x, axis=-1): """Compute autocorrelation of x along the given axis. This compute the biased autocorrelation estimator (divided by the size of input signal) Notes ----- The reason why we do not use acorr directly is for speed issue.""" if not np.isrealobj(x): raise ...
Compute autocorrelation of x along the given axis. This compute the biased autocorrelation estimator (divided by the size of input signal) Notes ----- The reason why we do not use acorr directly is for speed issue.
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/formants/lpc.py#L133-L153
mmcauliffe/Conch-sounds
conch/analysis/formants/lpc.py
lpc
def lpc(signal, order, axis=-1): """Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[...
python
def lpc(signal, order, axis=-1): """Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[...
Compute the Linear Prediction Coefficients. Return the order + 1 LPC coefficients for the signal. c = lpc(x, k) will find the k+1 coefficients of a k order linear filter: xp[n] = -c[1] * x[n-2] - ... - c[k-1] * x[n-k-1] Such as the sum of the squared-error e[i] = xp[i] - x[i] is minimized. Par...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/formants/lpc.py#L157-L195
mmcauliffe/Conch-sounds
conch/main.py
acoustic_similarity_mapping
def acoustic_similarity_mapping(path_mapping, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables ...
python
def acoustic_similarity_mapping(path_mapping, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables ...
Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables Explicit mapping of full paths of .wav files, in the form of a list of tuples to be compared. Returns ------- dict ...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/main.py#L11-L41
mmcauliffe/Conch-sounds
conch/main.py
axb_mapping
def axb_mapping(path_mapping, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables Explicit m...
python
def axb_mapping(path_mapping, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables Explicit m...
Takes in an explicit mapping of full paths to .wav files to have acoustic similarity computed. Parameters ---------- path_mapping : iterable of iterables Explicit mapping of full paths of .wav files, in the form of a list of tuples to be compared. Returns ------- dict ...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/main.py#L43-L73
mmcauliffe/Conch-sounds
conch/main.py
acoustic_similarity_directories
def acoustic_similarity_directories(directories, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """ Analyze many directories. Parameters ---------- directories : list of str List of fully specified paths to the directories to be analyzed "...
python
def acoustic_similarity_directories(directories, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True): """ Analyze many directories. Parameters ---------- directories : list of str List of fully specified paths to the directories to be analyzed "...
Analyze many directories. Parameters ---------- directories : list of str List of fully specified paths to the directories to be analyzed
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/main.py#L76-L130
mmcauliffe/Conch-sounds
conch/distance/dtw.py
dtw_distance
def dtw_distance(rep_one, rep_two, norm=True): """Computes the distance between two representations with the same number of filters using Dynamic Time Warping. Parameters ---------- rep_one : 2D array First representation to compare. First dimension is time in frames or samples and ...
python
def dtw_distance(rep_one, rep_two, norm=True): """Computes the distance between two representations with the same number of filters using Dynamic Time Warping. Parameters ---------- rep_one : 2D array First representation to compare. First dimension is time in frames or samples and ...
Computes the distance between two representations with the same number of filters using Dynamic Time Warping. Parameters ---------- rep_one : 2D array First representation to compare. First dimension is time in frames or samples and second dimension is the features. rep_two : 2D arr...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/distance/dtw.py#L16-L41
mmcauliffe/Conch-sounds
conch/distance/dtw.py
generate_distance_matrix
def generate_distance_matrix(source, target, weights=None): """Generates a local distance matrix for use in dynamic time warping. Parameters ---------- source : 2D array Source matrix with features in the second dimension. target : 2D array Target matrix with features in the second ...
python
def generate_distance_matrix(source, target, weights=None): """Generates a local distance matrix for use in dynamic time warping. Parameters ---------- source : 2D array Source matrix with features in the second dimension. target : 2D array Target matrix with features in the second ...
Generates a local distance matrix for use in dynamic time warping. Parameters ---------- source : 2D array Source matrix with features in the second dimension. target : 2D array Target matrix with features in the second dimension. Returns ------- 2D array Local dist...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/distance/dtw.py#L44-L68
mmcauliffe/Conch-sounds
conch/distance/dtw.py
regularDTW
def regularDTW(distMat, norm=True): """Use a local distance matrix to perform dynamic time warping. Parameters ---------- distMat : 2D array Local distance matrix. Returns ------- float Total unweighted distance of the optimal path through the local distance matrix....
python
def regularDTW(distMat, norm=True): """Use a local distance matrix to perform dynamic time warping. Parameters ---------- distMat : 2D array Local distance matrix. Returns ------- float Total unweighted distance of the optimal path through the local distance matrix....
Use a local distance matrix to perform dynamic time warping. Parameters ---------- distMat : 2D array Local distance matrix. Returns ------- float Total unweighted distance of the optimal path through the local distance matrix.
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/distance/dtw.py#L71-L109
mmcauliffe/Conch-sounds
conch/analysis/helper.py
preproc
def preproc(path, sr=16000, alpha=0.95): """Preprocess a .wav file for later processing. Currently assumes a 16-bit PCM input. Only returns left channel of stereo files. Parameters ---------- path : str Full path to .wav file to load. sr : int, optional Sampling rate to resamp...
python
def preproc(path, sr=16000, alpha=0.95): """Preprocess a .wav file for later processing. Currently assumes a 16-bit PCM input. Only returns left channel of stereo files. Parameters ---------- path : str Full path to .wav file to load. sr : int, optional Sampling rate to resamp...
Preprocess a .wav file for later processing. Currently assumes a 16-bit PCM input. Only returns left channel of stereo files. Parameters ---------- path : str Full path to .wav file to load. sr : int, optional Sampling rate to resample at, if specified. alpha : float, optional...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/helper.py#L29-L67
mmcauliffe/Conch-sounds
conch/analysis/helper.py
fftfilt
def fftfilt(b, x, *n): """Filter the signal x with the FIR filter described by the coefficients in b using the overlap-add method. If the FFT length n is not specified, it and the overlap-add block length are selected so as to minimize the computational cost of the filtering operation.""" N_x =...
python
def fftfilt(b, x, *n): """Filter the signal x with the FIR filter described by the coefficients in b using the overlap-add method. If the FFT length n is not specified, it and the overlap-add block length are selected so as to minimize the computational cost of the filtering operation.""" N_x =...
Filter the signal x with the FIR filter described by the coefficients in b using the overlap-add method. If the FFT length n is not specified, it and the overlap-add block length are selected so as to minimize the computational cost of the filtering operation.
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/helper.py#L121-L184
mmcauliffe/Conch-sounds
conch/analysis/mfcc/rastamat.py
dct_spectrum
def dct_spectrum(spec): """Convert a spectrum into a cepstrum via type-III DCT (following HTK). Parameters ---------- spec : array Spectrum to perform a DCT on. Returns ------- array Cepstrum of the input spectrum. """ ncep = spec.shape[0] dctm = np.zeros((ncep...
python
def dct_spectrum(spec): """Convert a spectrum into a cepstrum via type-III DCT (following HTK). Parameters ---------- spec : array Spectrum to perform a DCT on. Returns ------- array Cepstrum of the input spectrum. """ ncep = spec.shape[0] dctm = np.zeros((ncep...
Convert a spectrum into a cepstrum via type-III DCT (following HTK). Parameters ---------- spec : array Spectrum to perform a DCT on. Returns ------- array Cepstrum of the input spectrum.
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/mfcc/rastamat.py#L12-L32
mmcauliffe/Conch-sounds
conch/analysis/mfcc/rastamat.py
construct_filterbank
def construct_filterbank(num_filters, nfft, sr, min_freq, max_freq): """Constructs a mel-frequency filter bank. Parameters ---------- nfft : int Number of points in the FFT. Returns ------- array Filter bank to...
python
def construct_filterbank(num_filters, nfft, sr, min_freq, max_freq): """Constructs a mel-frequency filter bank. Parameters ---------- nfft : int Number of points in the FFT. Returns ------- array Filter bank to...
Constructs a mel-frequency filter bank. Parameters ---------- nfft : int Number of points in the FFT. Returns ------- array Filter bank to multiply an FFT spectrum to create a mel-frequency spectrum...
https://github.com/mmcauliffe/Conch-sounds/blob/e05535fd08e4b0e47e37a77ef521d05eff1d6bc5/conch/analysis/mfcc/rastamat.py#L35-L66
frmdstryr/enamlx
enamlx/core/looper.py
ItemViewLooper._prefetch_items
def _prefetch_items(self,change): """ When the current_row in the model changes (whether from scrolling) or set by the application. Make sure the results are loaded! """ if self.is_initialized: view = self.item_view upper_limit = view.iterabl...
python
def _prefetch_items(self,change): """ When the current_row in the model changes (whether from scrolling) or set by the application. Make sure the results are loaded! """ if self.is_initialized: view = self.item_view upper_limit = view.iterabl...
When the current_row in the model changes (whether from scrolling) or set by the application. Make sure the results are loaded!
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/core/looper.py#L157-L186
frmdstryr/enamlx
enamlx/core/looper.py
ItemViewLooper.windowed_iterable
def windowed_iterable(self): """ That returns only the window """ # Seek to offset effective_offset = max(0,self.item_view.iterable_index) for i,item in enumerate(self.iterable): if i<effective_offset: continue elif i>=(effective_offset+self.item_v...
python
def windowed_iterable(self): """ That returns only the window """ # Seek to offset effective_offset = max(0,self.item_view.iterable_index) for i,item in enumerate(self.iterable): if i<effective_offset: continue elif i>=(effective_offset+self.item_v...
That returns only the window
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/core/looper.py#L190-L199
frmdstryr/enamlx
enamlx/core/looper.py
ItemViewLooper.refresh_items
def refresh_items(self): """ Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items. """ old_items = self.items[:]# if self._dirty else [] old_iter_data = self._iter_data# if self._dirty else {} iterable = ...
python
def refresh_items(self): """ Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items. """ old_items = self.items[:]# if self._dirty else [] old_iter_data = self._iter_data# if self._dirty else {} iterable = ...
Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/core/looper.py#L201-L252
frmdstryr/enamlx
enamlx/qt/qt_double_spin_box.py
QtDoubleSpinBox.create_widget
def create_widget(self): """ Create the underlying QDoubleSpinBox widget. """ widget = QDoubleSpinBox(self.parent_widget()) widget.setKeyboardTracking(False) self.widget = widget
python
def create_widget(self): """ Create the underlying QDoubleSpinBox widget. """ widget = QDoubleSpinBox(self.parent_widget()) widget.setKeyboardTracking(False) self.widget = widget
Create the underlying QDoubleSpinBox widget.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_double_spin_box.py#L24-L30
frmdstryr/enamlx
enamlx/core/block.py
Block.initialize
def initialize(self): """ A reimplemented initializer. This method will add the include objects to the parent of the include and ensure that they are initialized. """ super(Block, self).initialize() if self.block: self.block.parent.insert_children(self.block...
python
def initialize(self): """ A reimplemented initializer. This method will add the include objects to the parent of the include and ensure that they are initialized. """ super(Block, self).initialize() if self.block: self.block.parent.insert_children(self.block...
A reimplemented initializer. This method will add the include objects to the parent of the include and ensure that they are initialized.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/core/block.py#L23-L32
frmdstryr/enamlx
enamlx/core/block.py
Block._observe_block
def _observe_block(self, change): """ A change handler for the 'objects' list of the Include. If the object is initialized objects which are removed will be unparented and objects which are added will be reparented. Old objects will be destroyed if the 'destroy_old' flag is True. ...
python
def _observe_block(self, change): """ A change handler for the 'objects' list of the Include. If the object is initialized objects which are removed will be unparented and objects which are added will be reparented. Old objects will be destroyed if the 'destroy_old' flag is True. ...
A change handler for the 'objects' list of the Include. If the object is initialized objects which are removed will be unparented and objects which are added will be reparented. Old objects will be destroyed if the 'destroy_old' flag is True.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/core/block.py#L35-L48
frmdstryr/enamlx
enamlx/qt/qt_table_view.py
QtTableViewItem._update_index
def _update_index(self): """ Update the reference to the index within the table """ d = self.declaration self.index = self.view.model.index(d.row, d.column) if self.delegate: self._refresh_count += 1 timed_call(self._loading_interval, self._update_delegate)
python
def _update_index(self): """ Update the reference to the index within the table """ d = self.declaration self.index = self.view.model.index(d.row, d.column) if self.delegate: self._refresh_count += 1 timed_call(self._loading_interval, self._update_delegate)
Update the reference to the index within the table
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_table_view.py#L161-L167
frmdstryr/enamlx
enamlx/qt/qt_table_view.py
QtTableViewItem._update_delegate
def _update_delegate(self): """ Update the delegate cell widget. This is deferred so it does not get called until the user is done scrolling. """ self._refresh_count -= 1 if self._refresh_count != 0: return try: delegate = self.delegate ...
python
def _update_delegate(self): """ Update the delegate cell widget. This is deferred so it does not get called until the user is done scrolling. """ self._refresh_count -= 1 if self._refresh_count != 0: return try: delegate = self.delegate ...
Update the delegate cell widget. This is deferred so it does not get called until the user is done scrolling.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_table_view.py#L169-L188
frmdstryr/enamlx
enamlx/qt/qt_table_view.py
QtTableViewItem.data_changed
def data_changed(self, change): """ Notify the model that data has changed in this cell! """ index = self.index if index: self.view.model.dataChanged.emit(index, index)
python
def data_changed(self, change): """ Notify the model that data has changed in this cell! """ index = self.index if index: self.view.model.dataChanged.emit(index, index)
Notify the model that data has changed in this cell!
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_table_view.py#L194-L198
frmdstryr/enamlx
enamlx/qt/qt_occ_viewer.py
QtBaseViewer.GetHandle
def GetHandle(self): ''' returns an the identifier of the GUI widget. It must be an integer ''' win_id = self.winId() # this returns either an int or voitptr if "%s"%type(win_id) == "<type 'PyCObject'>": # PySide ### with PySide, self.winId() does not return...
python
def GetHandle(self): ''' returns an the identifier of the GUI widget. It must be an integer ''' win_id = self.winId() # this returns either an int or voitptr if "%s"%type(win_id) == "<type 'PyCObject'>": # PySide ### with PySide, self.winId() does not return...
returns an the identifier of the GUI widget. It must be an integer
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_occ_viewer.py#L160-L182
frmdstryr/enamlx
examples/occ_viewer/occ/occ_shape.py
Topology._loop_topo
def _loop_topo(self, topologyType, topologicalEntity=None, topologyTypeToAvoid=None): ''' this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face) ''' topoTypes = {TopAbs_VERTEX: Top...
python
def _loop_topo(self, topologyType, topologicalEntity=None, topologyTypeToAvoid=None): ''' this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face) ''' topoTypes = {TopAbs_VERTEX: Top...
this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face)
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/examples/occ_viewer/occ/occ_shape.py#L145-L207
frmdstryr/enamlx
examples/occ_viewer/occ/occ_shape.py
Topology._map_shapes_and_ancestors
def _map_shapes_and_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): ''' using the same method @param topoTypeA: @param topoTypeB: @param topologicalEntity: ''' topo_set = set() _map = TopTools_IndexedDataMapOfShapeListOfShape() t...
python
def _map_shapes_and_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): ''' using the same method @param topoTypeA: @param topoTypeB: @param topologicalEntity: ''' topo_set = set() _map = TopTools_IndexedDataMapOfShapeListOfShape() t...
using the same method @param topoTypeA: @param topoTypeB: @param topologicalEntity:
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/examples/occ_viewer/occ/occ_shape.py#L307-L341
frmdstryr/enamlx
examples/occ_viewer/occ/occ_shape.py
Topology._number_shapes_ancestors
def _number_shapes_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): '''returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a faces has @pa...
python
def _number_shapes_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): '''returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a faces has @pa...
returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a faces has @param topoTypeA: @param topoTypeB: @param topologicalEntity:
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/examples/occ_viewer/occ/occ_shape.py#L343-L362
frmdstryr/enamlx
examples/occ_viewer/occ/occ_shape.py
OccDependentShape.init_layout
def init_layout(self): """ Initialize the layout of the toolkit shape. This method is called during the bottom-up pass. This method should initialize the layout of the widget. The child widgets will be fully initialized and layed out when this is called. """ for...
python
def init_layout(self): """ Initialize the layout of the toolkit shape. This method is called during the bottom-up pass. This method should initialize the layout of the widget. The child widgets will be fully initialized and layed out when this is called. """ for...
Initialize the layout of the toolkit shape. This method is called during the bottom-up pass. This method should initialize the layout of the widget. The child widgets will be fully initialized and layed out when this is called.
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/examples/occ_viewer/occ/occ_shape.py#L580-L590
frmdstryr/enamlx
enamlx/qt/qt_key_event.py
QtKeyEvent.init_widget
def init_widget(self): """ The KeyEvent uses the parent_widget as it's widget """ super(QtKeyEvent, self).init_widget() d = self.declaration widget = self.widget self._keyPressEvent = widget.keyPressEvent self._keyReleaseEvent = widget.keyReleaseEvent self.set_ena...
python
def init_widget(self): """ The KeyEvent uses the parent_widget as it's widget """ super(QtKeyEvent, self).init_widget() d = self.declaration widget = self.widget self._keyPressEvent = widget.keyPressEvent self._keyReleaseEvent = widget.keyReleaseEvent self.set_ena...
The KeyEvent uses the parent_widget as it's widget
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_key_event.py#L47-L55