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_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
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...
[ "def", "shuffle_song", "(", "self", ",", "song", ",", "*", ",", "num_songs", "=", "100", ",", "only_library", "=", "False", ",", "recently_played", "=", "None", ")", ":", "station_info", "=", "{", "'num_entries'", ":", "num_songs", ",", "'library_content_onl...
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...
[ "Get", "a", "listing", "of", "song", "shuffle", "/", "mix", "songs", "." ]
train
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...
[ "def", "situations", "(", "self", ",", "*", ",", "tz_offset", "=", "None", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "ListenNowSituations", ",", "tz_offset", ")", "situation_list", "=", "response", ".", "body", ".", "get", "(...
Get a listing of situations. Parameters: tz_offset (int, Optional): A time zone offset from UTC in seconds.
[ "Get", "a", "listing", "of", "situations", "." ]
train
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...
[ "def", "song", "(", "self", ",", "song_id", ")", ":", "if", "song_id", ".", "startswith", "(", "'T'", ")", ":", "song_info", "=", "self", ".", "_call", "(", "mc_calls", ".", "FetchTrack", ",", "song_id", ")", ".", "body", "else", ":", "song_info", "=...
Get information about a song. Parameters: song_id (str): A song ID. Returns: dict: Song information.
[ "Get", "information", "about", "a", "song", "." ]
train
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 =...
[ "def", "songs_add", "(", "self", ",", "songs", ")", ":", "mutations", "=", "[", "mc_calls", ".", "TrackBatch", ".", "add", "(", "song", ")", "for", "song", "in", "songs", "]", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "TrackBatch", ...
Add store songs to your library. Parameters: songs (list): A list of store song dicts. Returns: list: Songs' library IDs.
[ "Add", "store", "songs", "to", "your", "library", "." ]
train
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...
[ "def", "songs_delete", "(", "self", ",", "songs", ")", ":", "mutations", "=", "[", "mc_calls", ".", "TrackBatch", ".", "delete", "(", "song", "[", "'id'", "]", ")", "for", "song", "in", "songs", "]", "response", "=", "self", ".", "_call", "(", "mc_ca...
Delete songs from library. Parameters: song (list): A list of song dicts. Returns: list: Successfully deleted song IDs.
[ "Delete", "songs", "from", "library", "." ]
train
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...
[ "def", "song_play", "(", "self", ",", "song", ")", ":", "if", "'storeId'", "in", "song", ":", "song_id", "=", "song", "[", "'storeId'", "]", "elif", "'trackId'", "in", "song", ":", "song_id", "=", "song", "[", "'trackId'", "]", "else", ":", "song_id", ...
Add play to song play count. Parameters: song (dict): A song dict. Returns: bool: ``True`` if successful, ``False`` if not.
[ "Add", "play", "to", "song", "play", "count", "." ]
train
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...
[ "def", "song_rate", "(", "self", ",", "song", ",", "rating", ")", ":", "if", "'storeId'", "in", "song", ":", "song_id", "=", "song", "[", "'storeId'", "]", "elif", "'trackId'", "in", "song", ":", "song_id", "=", "song", "[", "'trackId'", "]", "else", ...
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.
[ "Rate", "song", "." ]
train
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
[ "def", "songs", "(", "self", ")", ":", "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.
[ "Get", "a", "listing", "of", "library", "songs", "." ]
train
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...
[ "def", "songs_iter", "(", "self", ",", "*", ",", "page_size", "=", "250", ")", ":", "start_token", "=", "None", "while", "True", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "TrackFeed", ",", "max_results", "=", "page_size", ",", "...
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.
[ "Get", "a", "paged", "iterator", "of", "library", "songs", "." ]
train
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...
[ "def", "station", "(", "self", ",", "station_id", ",", "*", ",", "num_songs", "=", "25", ",", "recently_played", "=", "None", ")", ":", "station_info", "=", "{", "'station_id'", ":", "station_id", ",", "'num_entries'", ":", "num_songs", ",", "'library_conten...
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 `...
[ "Get", "information", "about", "a", "station", "." ]
train
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 ...
[ "def", "station_feed", "(", "self", ",", "*", ",", "num_songs", "=", "25", ",", "num_stations", "=", "4", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "RadioStationFeed", ",", "num_entries", "=", "num_songs", ",", "num_stations", ...
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...
[ "Generate", "stations", "." ]
train
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...
[ "def", "station_songs", "(", "self", ",", "station", ",", "*", ",", "num_songs", "=", "25", ",", "recently_played", "=", "None", ")", ":", "station_id", "=", "station", "[", "'id'", "]", "station", "=", "self", ".", "station", "(", "station_id", ",", "...
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`` ...
[ "Get", "a", "listing", "of", "songs", "from", "a", "station", "." ]
train
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...
[ "def", "stations", "(", "self", ",", "*", ",", "generated", "=", "True", ",", "library", "=", "True", ")", ":", "station_list", "=", "[", "]", "for", "chunk", "in", "self", ".", "stations_iter", "(", "page_size", "=", "49995", ")", ":", "for", "stati...
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...
[ "Get", "a", "listing", "of", "library", "stations", "." ]
train
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...
[ "def", "stations_iter", "(", "self", ",", "*", ",", "page_size", "=", "250", ")", ":", "start_token", "=", "None", "while", "True", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "RadioStation", ",", "max_results", "=", "page_size", ",...
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.
[ "Get", "a", "paged", "iterator", "of", "library", "stations", "." ]
train
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...
[ "def", "stream", "(", "self", ",", "item", ",", "*", ",", "device_id", "=", "None", ",", "quality", "=", "'hi'", ",", "session_token", "=", "None", ")", ":", "if", "device_id", "is", "None", ":", "device_id", "=", "self", ".", "device_id", "stream_url"...
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...
[ "Get", "MP3", "stream", "of", "a", "podcast", "episode", "library", "song", "station_song", "or", "store", "song", "." ]
train
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...
[ "def", "stream_url", "(", "self", ",", "item", ",", "*", ",", "device_id", "=", "None", ",", "quality", "=", "'hi'", ",", "session_token", "=", "None", ")", ":", "if", "device_id", "is", "None", ":", "device_id", "=", "self", ".", "device_id", "if", ...
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...
[ "Get", "a", "URL", "to", "stream", "a", "podcast", "episode", "library", "song", "station_song", "or", "store", "song", "." ]
train
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...
[ "def", "thumbs_up_songs", "(", "self", ",", "*", ",", "library", "=", "True", ",", "store", "=", "True", ")", ":", "thumbs_up_songs", "=", "[", "]", "if", "library", "is", "True", ":", "thumbs_up_songs", ".", "extend", "(", "song", "for", "song", "in",...
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.
[ "Get", "a", "listing", "of", "Thumbs", "Up", "store", "songs", "." ]
train
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
[ "def", "top_charts", "(", "self", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "BrowseTopChart", ")", "top_charts", "=", "response", ".", "body", "return", "top_charts" ]
Get a listing of the default top charts.
[ "Get", "a", "listing", "of", "the", "default", "top", "charts", "." ]
train
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_...
[ "def", "top_charts_for_genre", "(", "self", ",", "genre_id", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "BrowseTopChartForGenre", ",", "genre_id", ")", "top_chart_for_genre", "=", "response", ".", "body", "return", "top_chart_for_genre"...
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`.
[ "Get", "a", "listing", "of", "top", "charts", "for", "a", "top", "chart", "genre", "." ]
train
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
[ "def", "top_charts_genres", "(", "self", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "BrowseTopChartGenres", ")", "top_chart_genres", "=", "response", ".", "body", ".", "get", "(", "'genres'", ",", "[", "]", ")", "return", "top_c...
Get a listing of genres from the browse top charts tab.
[ "Get", "a", "listing", "of", "genres", "from", "the", "browse", "top", "charts", "tab", "." ]
train
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'))
[ "def", "run", "(", "stream", "=", "sys", ".", "stdin", ".", "buffer", ")", ":", "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.
[ "Reads", "from", "stream", "applying", "the", "LT", "decoding", "algorithm", "to", "incoming", "encoded", "blocks", "until", "sufficiently", "many", "blocks", "have", "been", "received", "to", "reconstruct", "the", "entire", "file", "." ]
train
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),...
[ "def", "_split_file", "(", "f", ",", "blocksize", ")", ":", "f_bytes", "=", "f", ".", "read", "(", ")", "blocks", "=", "[", "int", ".", "from_bytes", "(", "f_bytes", "[", "i", ":", "i", "+", "blocksize", "]", ".", "ljust", "(", "blocksize", ",", ...
Block file byte contents into blocksize chunks, padding last one if necessary
[ "Block", "file", "byte", "contents", "into", "blocksize", "chunks", "padding", "last", "one", "if", "necessary" ]
train
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 = _...
[ "def", "encoder", "(", "f", ",", "blocksize", ",", "seed", "=", "None", ",", "c", "=", "sampler", ".", "DEFAULT_C", ",", "delta", "=", "sampler", ".", "DEFAULT_DELTA", ")", ":", "# Generate seed if not provided", "if", "seed", "is", "None", ":", "seed", ...
Generates an infinite sequence of blocks to transmit to the receiver
[ "Generates", "an", "infinite", "sequence", "of", "blocks", "to", "transmit", "to", "the", "receiver" ]
train
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')
[ "def", "_read_block", "(", "blocksize", ",", "stream", ")", ":", "blockdata", "=", "stream", ".", "read", "(", "blocksize", ")", "return", "int", ".", "from_bytes", "(", "blockdata", ",", "'big'", ")" ]
Read block data from network into integer type
[ "Read", "block", "data", "from", "network", "into", "integer", "type" ]
train
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)
[ "def", "read_blocks", "(", "stream", ")", ":", "while", "True", ":", "header", "=", "_read_header", "(", "stream", ")", "block", "=", "_read_block", "(", "header", "[", "1", "]", ",", "stream", ")", "yield", "(", "header", ",", "block", ")" ]
Generate parsed blocks from input stream
[ "Generate", "parsed", "blocks", "from", "input", "stream" ]
train
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 = ...
[ "def", "add_block", "(", "self", ",", "nodes", ",", "data", ")", ":", "# We can eliminate this source node", "if", "len", "(", "nodes", ")", "==", "1", ":", "to_eliminate", "=", "list", "(", "self", ".", "eliminate", "(", "next", "(", "iter", "(", "nodes...
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.
[ "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", "." ]
train
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...
[ "def", "eliminate", "(", "self", ",", "node", ",", "data", ")", ":", "# Cache resolved value", "self", ".", "eliminated", "[", "node", "]", "=", "data", "others", "=", "self", ".", "checks", "[", "node", "]", "del", "self", ".", "checks", "[", "node", ...
Resolves a source node, passing the message to all associated checks
[ "Resolves", "a", "source", "node", "passing", "the", "message", "to", "all", "associated", "checks" ]
train
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...
[ "def", "mobileclient", "(", "username", "=", "None", ",", "device_id", "=", "None", ",", "*", ",", "token", "=", "None", ",", "locale", "=", "'en_US'", ")", ":", "return", "MobileClient", "(", "username", ",", "device_id", ",", "token", "=", "token", "...
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...
[ "Create", "and", "authenticate", "a", "Google", "Music", "mobile", "client", "." ]
train
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'...
[ "def", "_dendropy_to_dataframe", "(", "tree", ",", "add_node_labels", "=", "True", ",", "use_uids", "=", "True", ")", ":", "# Maximum distance from root.", "tree", ".", "max_distance_from_root", "(", ")", "# Initialize the data object.", "idx", "=", "[", "]", "data"...
Convert Dendropy tree to Pandas dataframe.
[ "Convert", "Dendropy", "tree", "to", "Pandas", "dataframe", "." ]
train
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...
[ "def", "_read", "(", "filename", "=", "None", ",", "data", "=", "None", ",", "schema", "=", "None", ",", "add_node_labels", "=", "True", ",", "use_uids", "=", "True", ")", ":", "if", "filename", "is", "not", "None", ":", "# Use Dendropy to parse tree.", ...
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 ...
[ "Read", "a", "phylogenetic", "tree", "into", "a", "phylopandas", ".", "DataFrame", "." ]
train
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,...
[ "def", "_read_function", "(", "schema", ")", ":", "def", "func", "(", "filename", "=", "None", ",", "data", "=", "None", ",", "add_node_labels", "=", "True", ",", "use_uids", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Use generic write class to wri...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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 ...
[ "def", "pandas_df_to_biopython_seqrecord", "(", "df", ",", "id_col", "=", "'uid'", ",", "sequence_col", "=", "'sequence'", ",", "extra_data", "=", "None", ",", "alphabet", "=", "None", ",", ")", ":", "seq_records", "=", "[", "]", "for", "i", ",", "row", ...
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...
[ "Convert", "pandas", "dataframe", "to", "biopython", "seqrecord", "for", "easy", "writing", "." ]
train
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 ...
[ "def", "pandas_series_to_biopython_seqrecord", "(", "series", ",", "id_col", "=", "'uid'", ",", "sequence_col", "=", "'sequence'", ",", "extra_data", "=", "None", ",", "alphabet", "=", "None", ")", ":", "# Get sequence", "seq", "=", "Seq", "(", "series", "[", ...
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 ...
[ "Convert", "pandas", "series", "to", "biopython", "seqrecord", "for", "easy", "writing", "." ]
train
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. ...
[ "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. If no filename is given, a string will be returned. sequence_col : str (default='sequence') Sequence column name in DataFrame. id_col : str (def...
[ "General", "write", "function", ".", "Write", "phylopanda", "data", "to", "biopython", "format", "." ]
train
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...
[ "def", "_write_method", "(", "schema", ")", ":", "def", "method", "(", "self", ",", "filename", "=", "None", ",", "schema", "=", "schema", ",", "id_col", "=", "'uid'", ",", "sequence_col", "=", "'sequence'", ",", "extra_data", "=", "None", ",", "alphabet...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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...
[ "def", "_write_function", "(", "schema", ")", ":", "def", "func", "(", "data", ",", "filename", "=", "None", ",", "schema", "=", "schema", ",", "id_col", "=", "'uid'", ",", "sequence_col", "=", "'sequence'", ",", "extra_data", "=", "None", ",", "alphabet...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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...
[ "def", "_read", "(", "filename", ",", "schema", ",", "seq_label", "=", "'sequence'", ",", "alphabet", "=", "None", ",", "use_uids", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Check Alphabet if given", "if", "alphabet", "is", "None", ":", "alphabet"...
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
[ "Use", "BioPython", "s", "sequence", "parsing", "module", "to", "convert", "any", "file", "format", "to", "a", "Pandas", "DataFrame", "." ]
train
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...
[ "def", "_read_method", "(", "schema", ")", ":", "def", "func", "(", "self", ",", "filename", ",", "seq_label", "=", "'sequence'", ",", "alphabet", "=", "None", ",", "combine_on", "=", "'uid'", ",", "use_uids", "=", "True", ",", "*", "*", "kwargs", ")",...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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, ...
[ "def", "_read_function", "(", "schema", ")", ":", "def", "func", "(", "filename", ",", "seq_label", "=", "'sequence'", ",", "alphabet", "=", "None", ",", "use_uids", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Use generic write class to write data.", ...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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...
[ "def", "read_blast_xml", "(", "filename", ",", "*", "*", "kwargs", ")", ":", "# Read file.", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "blast_record", "=", "NCBIXML", ".", "read", "(", "f", ")", "# Prepare DataFrame fields.", "data"...
Read BLAST XML format.
[ "Read", "BLAST", "XML", "format", "." ]
train
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...
[ "def", "_pandas_df_to_dendropy_tree", "(", "df", ",", "taxon_col", "=", "'uid'", ",", "taxon_annotations", "=", "[", "]", ",", "node_col", "=", "'uid'", ",", "node_annotations", "=", "[", "]", ",", "branch_lengths", "=", "True", ",", ")", ":", "if", "isins...
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...
[ "Turn", "a", "phylopandas", "dataframe", "into", "a", "dendropy", "tree", "." ]
train
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...
[ "def", "_write", "(", "df", ",", "filename", "=", "None", ",", "schema", "=", "'newick'", ",", "taxon_col", "=", "'uid'", ",", "taxon_annotations", "=", "[", "]", ",", "node_col", "=", "'uid'", ",", "node_annotations", "=", "[", "]", ",", "branch_lengths...
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) ...
[ "Write", "a", "phylopandas", "tree", "DataFrame", "to", "various", "formats", "." ]
train
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)...
[ "def", "_write_method", "(", "schema", ")", ":", "def", "method", "(", "self", ",", "filename", "=", "None", ",", "schema", "=", "schema", ",", "taxon_col", "=", "'uid'", ",", "taxon_annotations", "=", "[", "]", ",", "node_col", "=", "'uid'", ",", "nod...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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)...
[ "def", "_write_function", "(", "schema", ")", ":", "def", "func", "(", "data", ",", "filename", "=", "None", ",", "schema", "=", "schema", ",", "taxon_col", "=", "'uid'", ",", "taxon_annotations", "=", "[", "]", ",", "node_col", "=", "'uid'", ",", "nod...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
train
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))
[ "def", "get_random_id", "(", "length", ")", ":", "alphabet", "=", "string", ".", "ascii_uppercase", "+", "string", ".", "ascii_lowercase", "+", "string", ".", "digits", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "alphabet", ")", "for",...
Generate a random, alpha-numerical id.
[ "Generate", "a", "random", "alpha", "-", "numerical", "id", "." ]
train
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
[ "def", "set_folder", "(", "self", ",", "folder", ")", ":", "self", ".", "folder", "=", "folder", "self", ".", "templates", ".", "directories", "[", "0", "]", "=", "folder", "self", ".", "app", ".", "root_path", "=", "folder" ]
Sets the folder where the files to serve are located.
[ "Sets", "the", "folder", "where", "the", "files", "to", "serve", "are", "located", "." ]
train
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)
[ "def", "run", "(", "self", ",", "host", "=", "'0.0.0.0'", ",", "port", "=", "8080", ")", ":", "waitress", ".", "serve", "(", "self", ".", "app", ",", "host", "=", "host", ",", "port", "=", "port", ")" ]
Launch a development web server.
[ "Launch", "a", "development", "web", "server", "." ]
train
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...
[ "def", "get", "(", "self", ",", "path", ")", ":", "data", "=", "self", ".", "app", ".", "test_client", "(", ")", ".", "get", "(", "\"/%s\"", "%", "path", ")", ".", "data", "return", "data" ]
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.
[ "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", "proces...
train
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) ...
[ "def", "gen_static", "(", "self", ",", "output_folder", ")", ":", "files", "=", "[", "]", "for", "l", "in", "self", ".", "file_listers", ":", "files", "+=", "l", "(", ")", "for", "f", "in", "files", ":", "_logger", ".", "info", "(", "\"generating %s\...
Generates a complete static version of the web site. It will stored in output_folder.
[ "Generates", "a", "complete", "static", "version", "of", "the", "web", "site", ".", "It", "will", "stored", "in", "output_folder", "." ]
train
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...
[ "def", "cli", "(", "self", ",", "cmd_args", "=", "None", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ",", "format", "=", "'%(message)s'", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "...
The command line interface of PyGreen.
[ "The", "command", "line", "interface", "of", "PyGreen", "." ]
train
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...
[ "def", "init", "(", "self", ",", "switch_configuration", ",", "terminal_controller", ",", "logger", ",", "piping_processor", ",", "*", "args", ")", ":", "self", ".", "switch_configuration", "=", "switch_configuration", "self", ".", "terminal_controller", "=", "ter...
: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
[ ":", "type", "switch_configuration", ":", "fake_switches", ".", "switch_configuration", ".", "SwitchConfiguration", ":", "type", "terminal_controller", ":", "fake_switches", ".", "terminal", ".", "TerminalController", ":", "type", "logger", ":", "logging", ".", "Logge...
train
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...
[ "def", "_gccalc", "(", "lon", ",", "lat", ",", "azimuth", ",", "maxdist", "=", "None", ")", ":", "glat1", "=", "lat", "*", "np", ".", "pi", "/", "180.", "glon1", "=", "lon", "*", "np", ".", "pi", "/", "180.", "s", "=", "maxdist", "/", "1.852243...
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
[ "Original", "javascript", "on", "http", ":", "//", "williams", ".", "best", ".", "vwh", ".", "net", "/", "gccalc", ".", "htm", "Translated", "into", "python", "by", "Thomas", "Lecocq", "This", "function", "is", "a", "black", "box", "because", "trigonometry...
train
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 = ...
[ "def", "circle", "(", "m", ",", "centerlon", ",", "centerlat", ",", "radius", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "glon1", "=", "centerlon", "glat1", "=", "centerlat", "X", "=", "[", "]", "Y", "=", "[", "]", "for", "azimuth", "in...
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
[ "Return", "lon", "lat", "tuples", "of", "a", "circle", "which", "matches", "the", "chosen", "Basemap", "projection", "Takes", "the", "following", "arguments", ":", "m", "=", "basemap", "instance", "centerlon", "=", "originating", "lon", "centrelat", "=", "orig...
train
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...
[ "def", "register_mime", "(", "shortname", ",", "mime_types", ")", ":", "if", "shortname", "in", "_MIME_TYPES", ":", "raise", "MimeRenderException", "(", "'\"%s\" has already been registered'", "%", "shortname", ")", "_MIME_TYPES", "[", "shortname", "]", "=", "mime_t...
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(... ...
[ "Register", "a", "new", "mime", "type", ".", "Usage", "example", ":", "mimerender", ".", "register_mime", "(", "svg", "(", "application", "/", "x", "-", "svg", "application", "/", "svg", "+", "xml", "))", "After", "this", "you", "can", "do", ":" ]
train
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): ...
[ "def", "wsgi_wrap", "(", "app", ")", ":", "@", "wraps", "(", "app", ")", "def", "wrapped", "(", "environ", ",", "start_response", ")", ":", "status_headers", "=", "[", "None", ",", "None", "]", "def", "_start_response", "(", "status", ",", "headers", "...
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", "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", "retu...
train
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)) ...
[ "def", "WSGIMimeRender", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "*", "args2", ",", "*", "*", "kwargs2", ")", ":", "# take the function", "def", "wrapped", "(", "f", ")", ":", "return", "_WSGIMimeRender", "(", "*", ...
A wrapper for _WSGIMimeRender that wrapps the inner callable with wsgi_wrap first.
[ "A", "wrapper", "for", "_WSGIMimeRender", "that", "wrapps", "the", "inner", "callable", "with", "wsgi_wrap", "first", "." ]
train
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,...
[ "def", "map_exceptions", "(", "self", ",", "mapping", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "@", "self", ".", "__call__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "def", "helper", "(", "e", ",", "status", ")", ":", "return",...
Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs.
[ "Exception", "mapping", "helper", "decorator", ".", "Takes", "the", "same", "arguments", "as", "the", "main", "decorator", "plus", "mapping", "which", "is", "a", "list", "of", "(", "exception_class", "status_line", ")", "pairs", "." ]
train
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)
[ "def", "relative", "(", "self", ")", ":", "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.
[ "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", ...
train
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...
[ "def", "resolve", "(", "self", ",", "uri", "=", "None", ",", "*", "*", "parts", ")", ":", "if", "uri", ":", "result", "=", "self", ".", "__class__", "(", "urljoin", "(", "str", "(", "self", ")", ",", "str", "(", "uri", ")", ")", ")", "else", ...
Attempt to resolve a new URI given an updated URI, partial or complete.
[ "Attempt", "to", "resolve", "a", "new", "URI", "given", "an", "updated", "URI", "partial", "or", "complete", "." ]
train
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 ...
[ "def", "strptime", "(", "cls", ",", "date_string", ",", "fmt", ")", ":", "# noinspection PyUnresolvedReferences", "result", "=", "cls", ".", "formatterfactory", "(", "fmt", ")", ".", "parse", "(", "date_string", ")", "result", "=", "{", "k", ":", "v", "for...
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...
[ "This", "is", "opposite", "of", "the", ":", "py", ":", "meth", ":", "khayyam", ".", "JalaliDate", ".", "strftime", "and", "used", "to", "parse", "date", "strings", "into", "date", "object", "." ]
train
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...
[ "def", "replace", "(", "self", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ")", ":", "return", "JalaliDate", "(", "year", "if", "year", "else", "self", ".", "year", ",", "month", "if", "month", "else", "self", ".",...
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.
[ "Replaces", "the", "given", "arguments", "on", "this", "instance", "and", "return", "a", "new", "instance", "." ]
train
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...
[ "def", "todate", "(", "self", ")", ":", "arr", "=", "get_gregorian_date_from_julian_day", "(", "self", ".", "tojulianday", "(", ")", ")", "return", "datetime", ".", "date", "(", "int", "(", "arr", "[", "0", "]", ")", ",", "int", "(", "arr", "[", "1",...
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`
[ "Calculates", "the", "corresponding", "day", "in", "the", "gregorian", "calendar", ".", "this", "is", "the", "main", "use", "case", "of", "this", "library", "." ]
train
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, ...
[ "def", "timetuple", "(", "self", ")", ":", "return", "time", ".", "struct_time", "(", "(", "self", ".", "year", ",", "self", ".", "month", ",", "self", ".", "day", ",", "0", ",", "0", ",", "0", ",", "self", ".", "weekday", "(", ")", ",", "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, tm_isdst=-1) The tm_isdst flag ...
[ "It", "s", "equivalent", "to", ":" ]
train
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`,...
[ "def", "weekofyear", "(", "self", ",", "first_day_of_week", "=", "SATURDAY", ")", ":", "first_day_of_year", "=", "self", ".", "firstdayofyear", "(", ")", "days", "=", "(", "self", "-", "first_day_of_year", ")", ".", "days", "offset", "=", "first_day_of_week", ...
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`, ...
[ "weekofyear", "(", "first_day_of_week", "=", "SATURDAY", ")" ]
train
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...
[ "def", "fromtimestamp", "(", "cls", ",", "timestamp", ",", "tz", "=", "None", ")", ":", "return", "cls", "(", "datetime", ".", "fromtimestamp", "(", "timestamp", ",", "tz", "=", "tz", ")", ")" ]
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...
[ "Creates", "a", "new", ":", "py", ":", "class", ":", "khayyam", ".", "JalaliDatetime", "instance", "from", "the", "given", "posix", "timestamp", "." ]
train
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...
[ "def", "combine", "(", "cls", ",", "date", ",", "_time", ")", ":", "if", "isinstance", "(", "date", ",", "(", "JalaliDatetime", ",", "khayyam", ".", "JalaliDate", ")", ")", ":", "date", "=", "date", ".", "todate", "(", ")", "return", "cls", "(", "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...
[ "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"...
train
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` """ ...
[ "def", "todatetime", "(", "self", ")", ":", "arr", "=", "get_gregorian_date_from_julian_day", "(", "self", ".", "tojulianday", "(", ")", ")", "return", "datetime", "(", "int", "(", "arr", "[", "0", "]", ")", ",", "int", "(", "arr", "[", "1", "]", ")"...
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", "." ]
train
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)
[ "def", "date", "(", "self", ")", ":", "return", "khayyam", ".", "JalaliDate", "(", "self", ".", "year", ",", "self", ".", "month", ",", "self", ".", "day", ")" ]
Return date object with same year, month and day. :rtype: :py:class:`khayyam.JalaliDate`
[ "Return", "date", "object", "with", "same", "year", "month", "and", "day", "." ]
train
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...
[ "def", "replace", "(", "self", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "hour", "=", "None", ",", "minute", "=", "None", ",", "second", "=", "None", ",", "microsecond", "=", "None", ",", "tzinfo", "=", "N...
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...
[ "Return", "a", ":", "py", ":", "class", ":", "khayyam", ".", "JalaliDatetime", "instance", "with", "the", "same", "attributes", "except", "for", "those", "attributes", "given", "new", "values", "by", "whichever", "keyword", "arguments", "are", "specified", "."...
train
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...
[ "def", "astimezone", "(", "self", ",", "tz", ")", ":", "if", "self", ".", "tzinfo", "is", "tz", ":", "return", "self", "if", "self", ".", "tzinfo", ":", "utc", "=", "self", "-", "self", ".", "utcoffset", "(", ")", "else", ":", "utc", "=", "self",...
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 :...
[ "Return", "a", ":", "py", ":", "class", ":", "khayyam", ".", "JalaliDatetime", "object", "with", "new", ":", "py", ":", "meth", ":", "khayyam", ".", "JalaliDatetime", ".", "tzinfo", "attribute", "tz", "adjusting", "the", "date", "and", "time", "data", "s...
train
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: ...
[ "def", "hour12", "(", "self", ")", ":", "res", "=", "self", ".", "hour", "if", "res", ">", "12", ":", "res", "-=", "12", "elif", "res", "==", "0", ":", "res", "=", "12", "return", "res" ]
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
[ "Return", "The", "hour", "value", "between", "1", "-", "12", ".", "use", ":", "py", ":", "meth", ":", "khayyam", ".", "JalaliDatetime", ".", "ampm", "()", "or", ":", "py", ":", "meth", ":", "khayyam", ".", "JalaliDatetime", ".", "ampmascii", "()", "t...
train
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] = ...
[ "def", "lpc_ref", "(", "signal", ",", "order", ")", ":", "if", "signal", ".", "ndim", ">", "1", ":", "raise", "ValueError", "(", "\"Array of rank > 1 not supported yet\"", ")", "if", "order", ">", "signal", ".", "size", ":", "raise", "ValueError", "(", "\"...
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...
[ "Compute", "the", "Linear", "Prediction", "Coefficients", "." ]
train
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)...
[ "def", "levinson_1d", "(", "r", ",", "order", ")", ":", "r", "=", "np", ".", "atleast_1d", "(", "r", ")", "if", "r", ".", "ndim", ">", "1", ":", "raise", "ValueError", "(", "\"Only rank 1 are supported for now.\"", ")", "n", "=", "r", ".", "size", "i...
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...
[ "Levinson", "-", "Durbin", "recursion", "to", "efficiently", "solve", "symmetric", "linear", "systems", "with", "toeplitz", "structure", "." ]
train
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 ...
[ "def", "acorr_lpc", "(", "x", ",", "axis", "=", "-", "1", ")", ":", "if", "not", "np", ".", "isrealobj", "(", "x", ")", ":", "raise", "ValueError", "(", "\"Complex input not supported yet\"", ")", "maxlag", "=", "x", ".", "shape", "[", "axis", "]", "...
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.
[ "Compute", "autocorrelation", "of", "x", "along", "the", "given", "axis", "." ]
train
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[...
[ "def", "lpc", "(", "signal", ",", "order", ",", "axis", "=", "-", "1", ")", ":", "n", "=", "signal", ".", "shape", "[", "axis", "]", "if", "order", ">", "n", ":", "raise", "ValueError", "(", "\"Input signal must have length >= order\"", ")", "r", "=", ...
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...
[ "Compute", "the", "Linear", "Prediction", "Coefficients", "." ]
train
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 ...
[ "def", "acoustic_similarity_mapping", "(", "path_mapping", ",", "analysis_function", ",", "distance_function", ",", "stop_check", "=", "None", ",", "call_back", "=", "None", ",", "multiprocessing", "=", "True", ")", ":", "num_cores", "=", "int", "(", "(", "3", ...
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 ...
[ "Takes", "in", "an", "explicit", "mapping", "of", "full", "paths", "to", ".", "wav", "files", "to", "have", "acoustic", "similarity", "computed", "." ]
train
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...
[ "def", "axb_mapping", "(", "path_mapping", ",", "analysis_function", ",", "distance_function", ",", "stop_check", "=", "None", ",", "call_back", "=", "None", ",", "multiprocessing", "=", "True", ")", ":", "num_cores", "=", "int", "(", "(", "3", "*", "cpu_cou...
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 ...
[ "Takes", "in", "an", "explicit", "mapping", "of", "full", "paths", "to", ".", "wav", "files", "to", "have", "acoustic", "similarity", "computed", "." ]
train
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 "...
[ "def", "acoustic_similarity_directories", "(", "directories", ",", "analysis_function", ",", "distance_function", ",", "stop_check", "=", "None", ",", "call_back", "=", "None", ",", "multiprocessing", "=", "True", ")", ":", "files", "=", "[", "]", "if", "call_ba...
Analyze many directories. Parameters ---------- directories : list of str List of fully specified paths to the directories to be analyzed
[ "Analyze", "many", "directories", "." ]
train
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 ...
[ "def", "dtw_distance", "(", "rep_one", ",", "rep_two", ",", "norm", "=", "True", ")", ":", "if", "not", "isinstance", "(", "rep_one", ",", "np", ".", "ndarray", ")", ":", "rep_one", "=", "rep_one", ".", "to_array", "(", ")", "if", "not", "isinstance", ...
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...
[ "Computes", "the", "distance", "between", "two", "representations", "with", "the", "same", "number", "of", "filters", "using", "Dynamic", "Time", "Warping", "." ]
train
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 ...
[ "def", "generate_distance_matrix", "(", "source", ",", "target", ",", "weights", "=", "None", ")", ":", "if", "weights", "is", "None", ":", "weights", "=", "ones", "(", "(", "source", ".", "shape", "[", "1", "]", ",", "1", ")", ")", "sLen", "=", "s...
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...
[ "Generates", "a", "local", "distance", "matrix", "for", "use", "in", "dynamic", "time", "warping", "." ]
train
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....
[ "def", "regularDTW", "(", "distMat", ",", "norm", "=", "True", ")", ":", "sLen", ",", "tLen", "=", "distMat", ".", "shape", "totalDistance", "=", "zeros", "(", "(", "sLen", ",", "tLen", ")", ")", "totalDistance", "[", "0", ":", "sLen", ",", "0", ":...
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", "." ]
train
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...
[ "def", "preproc", "(", "path", ",", "sr", "=", "16000", ",", "alpha", "=", "0.95", ")", ":", "oldsr", ",", "sig", "=", "wavfile", ".", "read", "(", "path", ")", "try", ":", "sig", "=", "sig", "[", ":", ",", "0", "]", "except", "IndexError", ":"...
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...
[ "Preprocess", "a", ".", "wav", "file", "for", "later", "processing", ".", "Currently", "assumes", "a", "16", "-", "bit", "PCM", "input", ".", "Only", "returns", "left", "channel", "of", "stereo", "files", "." ]
train
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 =...
[ "def", "fftfilt", "(", "b", ",", "x", ",", "*", "n", ")", ":", "N_x", "=", "len", "(", "x", ")", "N_b", "=", "len", "(", "b", ")", "# Determine the FFT length to use:", "if", "len", "(", "n", ")", ":", "# Use the specified FFT length (rounded up to the nea...
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.
[ "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", ...
train
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...
[ "def", "dct_spectrum", "(", "spec", ")", ":", "ncep", "=", "spec", ".", "shape", "[", "0", "]", "dctm", "=", "np", ".", "zeros", "(", "(", "ncep", ",", "ncep", ")", ")", "for", "i", "in", "range", "(", "ncep", ")", ":", "dctm", "[", "i", ",",...
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.
[ "Convert", "a", "spectrum", "into", "a", "cepstrum", "via", "type", "-", "III", "DCT", "(", "following", "HTK", ")", "." ]
train
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...
[ "def", "construct_filterbank", "(", "num_filters", ",", "nfft", ",", "sr", ",", "min_freq", ",", "max_freq", ")", ":", "min_mel", "=", "freq_to_mel", "(", "min_freq", ")", "max_mel", "=", "freq_to_mel", "(", "max_freq", ")", "mel_points", "=", "np", ".", "...
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...
[ "Constructs", "a", "mel", "-", "frequency", "filter", "bank", "." ]
train
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...
[ "def", "_prefetch_items", "(", "self", ",", "change", ")", ":", "if", "self", ".", "is_initialized", ":", "view", "=", "self", ".", "item_view", "upper_limit", "=", "view", ".", "iterable_index", "+", "view", ".", "iterable_fetch_size", "-", "view", ".", "...
When the current_row in the model changes (whether from scrolling) or set by the application. Make sure the results are loaded!
[ "When", "the", "current_row", "in", "the", "model", "changes", "(", "whether", "from", "scrolling", ")", "or", "set", "by", "the", "application", ".", "Make", "sure", "the", "results", "are", "loaded!" ]
train
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...
[ "def", "windowed_iterable", "(", "self", ")", ":", "# Seek to offset", "effective_offset", "=", "max", "(", "0", ",", "self", ".", "item_view", ".", "iterable_index", ")", "for", "i", ",", "item", "in", "enumerate", "(", "self", ".", "iterable", ")", ":", ...
That returns only the window
[ "That", "returns", "only", "the", "window" ]
train
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 = ...
[ "def", "refresh_items", "(", "self", ")", ":", "old_items", "=", "self", ".", "items", "[", ":", "]", "# if self._dirty else []", "old_iter_data", "=", "self", ".", "_iter_data", "# if self._dirty else {}", "iterable", "=", "self", ".", "windowed_iterable", "patte...
Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items.
[ "Refresh", "the", "items", "of", "the", "pattern", "." ]
train
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
[ "def", "create_widget", "(", "self", ")", ":", "widget", "=", "QDoubleSpinBox", "(", "self", ".", "parent_widget", "(", ")", ")", "widget", ".", "setKeyboardTracking", "(", "False", ")", "self", ".", "widget", "=", "widget" ]
Create the underlying QDoubleSpinBox widget.
[ "Create", "the", "underlying", "QDoubleSpinBox", "widget", "." ]
train
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...
[ "def", "initialize", "(", "self", ")", ":", "super", "(", "Block", ",", "self", ")", ".", "initialize", "(", ")", "if", "self", ".", "block", ":", "self", ".", "block", ".", "parent", ".", "insert_children", "(", "self", ".", "block", ",", "self", ...
A reimplemented initializer. This method will add the include objects to the parent of the include and ensure that they are initialized.
[ "A", "reimplemented", "initializer", "." ]
train
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. ...
[ "def", "_observe_block", "(", "self", ",", "change", ")", ":", "if", "self", ".", "is_initialized", ":", "if", "change", "[", "'type'", "]", "==", "'update'", ":", "old_block", "=", "change", "[", "'oldvalue'", "]", "old_block", ".", "parent", ".", "remo...
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", "." ]
train
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)
[ "def", "_update_index", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "self", ".", "index", "=", "self", ".", "view", ".", "model", ".", "index", "(", "d", ".", "row", ",", "d", ".", "column", ")", "if", "self", ".", "delegate", ":...
Update the reference to the index within the table
[ "Update", "the", "reference", "to", "the", "index", "within", "the", "table" ]
train
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 ...
[ "def", "_update_delegate", "(", "self", ")", ":", "self", ".", "_refresh_count", "-=", "1", "if", "self", ".", "_refresh_count", "!=", "0", ":", "return", "try", ":", "delegate", "=", "self", ".", "delegate", "if", "not", "self", ".", "is_visible", "(", ...
Update the delegate cell widget. This is deferred so it does not get called until the user is done scrolling.
[ "Update", "the", "delegate", "cell", "widget", ".", "This", "is", "deferred", "so", "it", "does", "not", "get", "called", "until", "the", "user", "is", "done", "scrolling", "." ]
train
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)
[ "def", "data_changed", "(", "self", ",", "change", ")", ":", "index", "=", "self", ".", "index", "if", "index", ":", "self", ".", "view", ".", "model", ".", "dataChanged", ".", "emit", "(", "index", ",", "index", ")" ]
Notify the model that data has changed in this cell!
[ "Notify", "the", "model", "that", "data", "has", "changed", "in", "this", "cell!" ]
train
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...
[ "def", "GetHandle", "(", "self", ")", ":", "win_id", "=", "self", ".", "winId", "(", ")", "# this returns either an int or voitptr\r", "if", "\"%s\"", "%", "type", "(", "win_id", ")", "==", "\"<type 'PyCObject'>\"", ":", "# PySide\r", "### with PySide, self.winId() ...
returns an the identifier of the GUI widget. It must be an integer
[ "returns", "an", "the", "identifier", "of", "the", "GUI", "widget", ".", "It", "must", "be", "an", "integer" ]
train
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...
[ "def", "_loop_topo", "(", "self", ",", "topologyType", ",", "topologicalEntity", "=", "None", ",", "topologyTypeToAvoid", "=", "None", ")", ":", "topoTypes", "=", "{", "TopAbs_VERTEX", ":", "TopoDS_Vertex", ",", "TopAbs_EDGE", ":", "TopoDS_Edge", ",", "TopAbs_FA...
this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face)
[ "this", "could", "be", "a", "faces", "generator", "for", "a", "python", "TopoShape", "class", "that", "way", "you", "can", "just", "do", ":", "for", "face", "in", "srf", ".", "faces", ":", "processFace", "(", "face", ")" ]
train
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...
[ "def", "_map_shapes_and_ancestors", "(", "self", ",", "topoTypeA", ",", "topoTypeB", ",", "topologicalEntity", ")", ":", "topo_set", "=", "set", "(", ")", "_map", "=", "TopTools_IndexedDataMapOfShapeListOfShape", "(", ")", "topexp_MapShapesAndAncestors", "(", "self", ...
using the same method @param topoTypeA: @param topoTypeB: @param topologicalEntity:
[ "using", "the", "same", "method" ]
train
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...
[ "def", "_number_shapes_ancestors", "(", "self", ",", "topoTypeA", ",", "topoTypeB", ",", "topologicalEntity", ")", ":", "topo_set", "=", "set", "(", ")", "_map", "=", "TopTools_IndexedDataMapOfShapeListOfShape", "(", ")", "topexp_MapShapesAndAncestors", "(", "self", ...
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:
[ "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", ...
train
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...
[ "def", "init_layout", "(", "self", ")", ":", "for", "child", "in", "self", ".", "children", "(", ")", ":", "self", ".", "child_added", "(", "child", ")", "self", ".", "update_shape", "(", "{", "}", ")" ]
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.
[ "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",...
train
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...
[ "def", "init_widget", "(", "self", ")", ":", "super", "(", "QtKeyEvent", ",", "self", ")", ".", "init_widget", "(", ")", "d", "=", "self", ".", "declaration", "widget", "=", "self", ".", "widget", "self", ".", "_keyPressEvent", "=", "widget", ".", "key...
The KeyEvent uses the parent_widget as it's widget
[ "The", "KeyEvent", "uses", "the", "parent_widget", "as", "it", "s", "widget" ]
train
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_key_event.py#L47-L55