id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
238,600
zkbt/the-friendly-stars
thefriendlystars/constellations/constellation.py
Constellation.from_coordinates
def from_coordinates(cls, ra=None, dec=None, distance=None, pm_ra_cosdec=None, pm_dec=None, radial_velocity=None, obstime=2000.0*u.year, id=None, mag=None, ...
python
def from_coordinates(cls, ra=None, dec=None, distance=None, pm_ra_cosdec=None, pm_dec=None, radial_velocity=None, obstime=2000.0*u.year, id=None, mag=None, ...
[ "def", "from_coordinates", "(", "cls", ",", "ra", "=", "None", ",", "dec", "=", "None", ",", "distance", "=", "None", ",", "pm_ra_cosdec", "=", "None", ",", "pm_dec", "=", "None", ",", "radial_velocity", "=", "None", ",", "obstime", "=", "2000.0", "*",...
Iniitalize a constellation object. Parameters ---------- ra, dec, distance, pm_ra_cosdec, pm_dec, radial_velocity These must be able to initialize a SkyCoord. id : list, array Identifications for the entries. mag : list, array Magnitudes for...
[ "Iniitalize", "a", "constellation", "object", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/constellation.py#L73-L115
238,601
zkbt/the-friendly-stars
thefriendlystars/constellations/constellation.py
Constellation.to_text
def to_text(self, filename=None, overwrite=True): ''' Write this catalog out to a text file. ''' table = self.standardized #table = hstack([self.identifiers, # self._coordinate_table(), # self.magnitudes, # sel...
python
def to_text(self, filename=None, overwrite=True): ''' Write this catalog out to a text file. ''' table = self.standardized #table = hstack([self.identifiers, # self._coordinate_table(), # self.magnitudes, # sel...
[ "def", "to_text", "(", "self", ",", "filename", "=", "None", ",", "overwrite", "=", "True", ")", ":", "table", "=", "self", ".", "standardized", "#table = hstack([self.identifiers,", "# self._coordinate_table(),", "# self.magnitudes,", "# ...
Write this catalog out to a text file.
[ "Write", "this", "catalog", "out", "to", "a", "text", "file", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/constellation.py#L166-L180
238,602
zkbt/the-friendly-stars
thefriendlystars/constellations/constellation.py
Constellation.plot
def plot(self, sizescale=10, color=None, alpha=0.5, label=None, edgecolor='none', **kw): ''' Plot the ra and dec of the coordinates, at a given epoch, scaled by their magnitude. (This does *not* create a new empty figure.) Parameters ---------- sizescale : (opti...
python
def plot(self, sizescale=10, color=None, alpha=0.5, label=None, edgecolor='none', **kw): ''' Plot the ra and dec of the coordinates, at a given epoch, scaled by their magnitude. (This does *not* create a new empty figure.) Parameters ---------- sizescale : (opti...
[ "def", "plot", "(", "self", ",", "sizescale", "=", "10", ",", "color", "=", "None", ",", "alpha", "=", "0.5", ",", "label", "=", "None", ",", "edgecolor", "=", "'none'", ",", "*", "*", "kw", ")", ":", "# calculate the sizes of the stars (logarithmic with b...
Plot the ra and dec of the coordinates, at a given epoch, scaled by their magnitude. (This does *not* create a new empty figure.) Parameters ---------- sizescale : (optional) float The marker size for scatter for a star at the magnitudelimit. color : (option...
[ "Plot", "the", "ra", "and", "dec", "of", "the", "coordinates", "at", "a", "given", "epoch", "scaled", "by", "their", "magnitude", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/constellation.py#L281-L314
238,603
zkbt/the-friendly-stars
thefriendlystars/constellations/constellation.py
Constellation.animate
def animate(self, filename='constellation.mp4', epochs=[1900,2100], dt=5, dpi=300, fps=10, **kw): ''' Animate a finder chart. ''' scatter = self.finder(**kw) plt.tight_layout() figure = plt.gcf() if '.gif' in filename: try: writer = a...
python
def animate(self, filename='constellation.mp4', epochs=[1900,2100], dt=5, dpi=300, fps=10, **kw): ''' Animate a finder chart. ''' scatter = self.finder(**kw) plt.tight_layout() figure = plt.gcf() if '.gif' in filename: try: writer = a...
[ "def", "animate", "(", "self", ",", "filename", "=", "'constellation.mp4'", ",", "epochs", "=", "[", "1900", ",", "2100", "]", ",", "dt", "=", "5", ",", "dpi", "=", "300", ",", "fps", "=", "10", ",", "*", "*", "kw", ")", ":", "scatter", "=", "s...
Animate a finder chart.
[ "Animate", "a", "finder", "chart", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/constellation.py#L352-L383
238,604
mensi/gittornado
gittornado/__init__.py
BaseHandler.get_gitdir
def get_gitdir(self): """Determine the git repository for this request""" if self.gitlookup is None: raise tornado.web.HTTPError(500, 'no git lookup configured') gitdir = self.gitlookup(self.request) if gitdir is None: raise tornado.web.HTTPError(404, 'unable to ...
python
def get_gitdir(self): """Determine the git repository for this request""" if self.gitlookup is None: raise tornado.web.HTTPError(500, 'no git lookup configured') gitdir = self.gitlookup(self.request) if gitdir is None: raise tornado.web.HTTPError(404, 'unable to ...
[ "def", "get_gitdir", "(", "self", ")", ":", "if", "self", ".", "gitlookup", "is", "None", ":", "raise", "tornado", ".", "web", ".", "HTTPError", "(", "500", ",", "'no git lookup configured'", ")", "gitdir", "=", "self", ".", "gitlookup", "(", "self", "."...
Determine the git repository for this request
[ "Determine", "the", "git", "repository", "for", "this", "request" ]
adf86b5537064337c806cce0e71eacaabc8bb610
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/__init__.py#L59-L69
238,605
reefab/foobot_async
foobot_async/__init__.py
FoobotClient.get_last_data
def get_last_data(self, uuid, period=0, average_by=0): """ Get the data from one device for period till now. :param uuid: Id of the device :type uuid: str :param period: Number of seconds between start time of search and now :type period: integer :param average_b...
python
def get_last_data(self, uuid, period=0, average_by=0): """ Get the data from one device for period till now. :param uuid: Id of the device :type uuid: str :param period: Number of seconds between start time of search and now :type period: integer :param average_b...
[ "def", "get_last_data", "(", "self", ",", "uuid", ",", "period", "=", "0", ",", "average_by", "=", "0", ")", ":", "return", "self", ".", "parse_data", "(", "(", "yield", "from", "self", ".", "_get", "(", "LAST_DATA_URL", ".", "format", "(", "uuid", "...
Get the data from one device for period till now. :param uuid: Id of the device :type uuid: str :param period: Number of seconds between start time of search and now :type period: integer :param average_by: amount of seconds to average data over. 0 or 300 for no aver...
[ "Get", "the", "data", "from", "one", "device", "for", "period", "till", "now", "." ]
73dd27e8f3b99df284c326dccc2372e9368d808d
https://github.com/reefab/foobot_async/blob/73dd27e8f3b99df284c326dccc2372e9368d808d/foobot_async/__init__.py#L60-L87
238,606
reefab/foobot_async
foobot_async/__init__.py
FoobotClient.get_historical_data
def get_historical_data(self, uuid, start, end, average_by=0): """ Get the data from one device for a specified time range. .. note:: Can fetch a maximum of 42 days of data. To speed up query processing, you can use a combination of average factor multiple of...
python
def get_historical_data(self, uuid, start, end, average_by=0): """ Get the data from one device for a specified time range. .. note:: Can fetch a maximum of 42 days of data. To speed up query processing, you can use a combination of average factor multiple of...
[ "def", "get_historical_data", "(", "self", ",", "uuid", ",", "start", ",", "end", ",", "average_by", "=", "0", ")", ":", "return", "self", ".", "parse_data", "(", "(", "yield", "from", "self", ".", "_get", "(", "HISTORICAL_DATA_URL", ".", "format", "(", ...
Get the data from one device for a specified time range. .. note:: Can fetch a maximum of 42 days of data. To speed up query processing, you can use a combination of average factor multiple of 1H in seconds (e.g. 3600), and o'clock start and end times :param uuid: I...
[ "Get", "the", "data", "from", "one", "device", "for", "a", "specified", "time", "range", "." ]
73dd27e8f3b99df284c326dccc2372e9368d808d
https://github.com/reefab/foobot_async/blob/73dd27e8f3b99df284c326dccc2372e9368d808d/foobot_async/__init__.py#L90-L119
238,607
reefab/foobot_async
foobot_async/__init__.py
FoobotClient.parse_data
def parse_data(self, response): """ Convert the weird list format used for datapoints to a more usable dictionnary one :param response: dictionnary from API json response :type response: dict :returns: list of datapoints .. note:: Datapoint content:...
python
def parse_data(self, response): """ Convert the weird list format used for datapoints to a more usable dictionnary one :param response: dictionnary from API json response :type response: dict :returns: list of datapoints .. note:: Datapoint content:...
[ "def", "parse_data", "(", "self", ",", "response", ")", ":", "parsed", "=", "[", "]", "try", ":", "items", "=", "response", "[", "'sensors'", "]", "for", "datapoint", "in", "response", "[", "'datapoints'", "]", ":", "line", "=", "{", "}", "for", "ind...
Convert the weird list format used for datapoints to a more usable dictionnary one :param response: dictionnary from API json response :type response: dict :returns: list of datapoints .. note:: Datapoint content: * time: UTC timestamp, unit: second...
[ "Convert", "the", "weird", "list", "format", "used", "for", "datapoints", "to", "a", "more", "usable", "dictionnary", "one" ]
73dd27e8f3b99df284c326dccc2372e9368d808d
https://github.com/reefab/foobot_async/blob/73dd27e8f3b99df284c326dccc2372e9368d808d/foobot_async/__init__.py#L121-L150
238,608
PSU-OIT-ARC/django-perms
permissions/registry.py
PermissionsRegistry.metaclass
def metaclass(self): """Get a metaclass configured to use this registry.""" if '_metaclass' not in self.__dict__: self._metaclass = type('PermissionsMeta', (PermissionsMeta,), {'registry': self}) return self._metaclass
python
def metaclass(self): """Get a metaclass configured to use this registry.""" if '_metaclass' not in self.__dict__: self._metaclass = type('PermissionsMeta', (PermissionsMeta,), {'registry': self}) return self._metaclass
[ "def", "metaclass", "(", "self", ")", ":", "if", "'_metaclass'", "not", "in", "self", ".", "__dict__", ":", "self", ".", "_metaclass", "=", "type", "(", "'PermissionsMeta'", ",", "(", "PermissionsMeta", ",", ")", ",", "{", "'registry'", ":", "self", "}",...
Get a metaclass configured to use this registry.
[ "Get", "a", "metaclass", "configured", "to", "use", "this", "registry", "." ]
083610582ed83b83ad07121cb658f6fb1aca04ee
https://github.com/PSU-OIT-ARC/django-perms/blob/083610582ed83b83ad07121cb658f6fb1aca04ee/permissions/registry.py#L179-L183
238,609
PSU-OIT-ARC/django-perms
permissions/registry.py
PermissionsRegistry.register
def register(self, perm_func=None, model=None, allow_staff=None, allow_superuser=None, allow_anonymous=None, unauthenticated_handler=None, request_types=None, name=None, replace=False, _return_entry=False): """Register permission function & return the original function. ...
python
def register(self, perm_func=None, model=None, allow_staff=None, allow_superuser=None, allow_anonymous=None, unauthenticated_handler=None, request_types=None, name=None, replace=False, _return_entry=False): """Register permission function & return the original function. ...
[ "def", "register", "(", "self", ",", "perm_func", "=", "None", ",", "model", "=", "None", ",", "allow_staff", "=", "None", ",", "allow_superuser", "=", "None", ",", "allow_anonymous", "=", "None", ",", "unauthenticated_handler", "=", "None", ",", "request_ty...
Register permission function & return the original function. This is typically used as a decorator:: permissions = PermissionsRegistry() @permissions.register def can_do_something(user): ... For internal use only: you can pass ``_return_entry=True``...
[ "Register", "permission", "function", "&", "return", "the", "original", "function", "." ]
083610582ed83b83ad07121cb658f6fb1aca04ee
https://github.com/PSU-OIT-ARC/django-perms/blob/083610582ed83b83ad07121cb658f6fb1aca04ee/permissions/registry.py#L185-L246
238,610
PSU-OIT-ARC/django-perms
permissions/registry.py
PermissionsRegistry.require
def require(self, perm_name, **kwargs): """Use as a decorator on a view to require a permission. Optional args: - ``field`` The name of the model field to use for lookup (this is only relevant when requiring a permission that was registered with ``model=SomeMode...
python
def require(self, perm_name, **kwargs): """Use as a decorator on a view to require a permission. Optional args: - ``field`` The name of the model field to use for lookup (this is only relevant when requiring a permission that was registered with ``model=SomeMode...
[ "def", "require", "(", "self", ",", "perm_name", ",", "*", "*", "kwargs", ")", ":", "view_decorator", "=", "self", ".", "_get_entry", "(", "perm_name", ")", ".", "view_decorator", "return", "view_decorator", "(", "*", "*", "kwargs", ")", "if", "kwargs", ...
Use as a decorator on a view to require a permission. Optional args: - ``field`` The name of the model field to use for lookup (this is only relevant when requiring a permission that was registered with ``model=SomeModelClass``) Examples:: @registr...
[ "Use", "as", "a", "decorator", "on", "a", "view", "to", "require", "a", "permission", "." ]
083610582ed83b83ad07121cb658f6fb1aca04ee
https://github.com/PSU-OIT-ARC/django-perms/blob/083610582ed83b83ad07121cb658f6fb1aca04ee/permissions/registry.py#L250-L271
238,611
PSU-OIT-ARC/django-perms
permissions/registry.py
PermissionsRegistry.entry_for_view
def entry_for_view(self, view, perm_name): """Get registry entry for permission if ``view`` requires it. In other words, if ``view`` requires the permission specified by ``perm_name``, return the :class:`Entry` associated with the permission. If ``view`` doesn't require the permission, ...
python
def entry_for_view(self, view, perm_name): """Get registry entry for permission if ``view`` requires it. In other words, if ``view`` requires the permission specified by ``perm_name``, return the :class:`Entry` associated with the permission. If ``view`` doesn't require the permission, ...
[ "def", "entry_for_view", "(", "self", ",", "view", ",", "perm_name", ")", ":", "view_name", "=", "self", ".", "_get_view_name", "(", "view", ")", "entry", "=", "self", ".", "_get_entry", "(", "perm_name", ")", "if", "view_name", "in", "entry", ".", "view...
Get registry entry for permission if ``view`` requires it. In other words, if ``view`` requires the permission specified by ``perm_name``, return the :class:`Entry` associated with the permission. If ``view`` doesn't require the permission, return ``None`` instead.
[ "Get", "registry", "entry", "for", "permission", "if", "view", "requires", "it", "." ]
083610582ed83b83ad07121cb658f6fb1aca04ee
https://github.com/PSU-OIT-ARC/django-perms/blob/083610582ed83b83ad07121cb658f6fb1aca04ee/permissions/registry.py#L412-L425
238,612
praekelt/panya-music
music/importer.py
TrackImporter.get_importer
def get_importer(self): """ Resolve importer from TRACK_IMPORTER_CLASS setting. """ try: importer_path = settings.TRACK_IMPORTER_CLASS except AttributeError: raise ImproperlyConfigured('No TRACK_IMPORTER_CLASS setting found.') try: dot ...
python
def get_importer(self): """ Resolve importer from TRACK_IMPORTER_CLASS setting. """ try: importer_path = settings.TRACK_IMPORTER_CLASS except AttributeError: raise ImproperlyConfigured('No TRACK_IMPORTER_CLASS setting found.') try: dot ...
[ "def", "get_importer", "(", "self", ")", ":", "try", ":", "importer_path", "=", "settings", ".", "TRACK_IMPORTER_CLASS", "except", "AttributeError", ":", "raise", "ImproperlyConfigured", "(", "'No TRACK_IMPORTER_CLASS setting found.'", ")", "try", ":", "dot", "=", "...
Resolve importer from TRACK_IMPORTER_CLASS setting.
[ "Resolve", "importer", "from", "TRACK_IMPORTER_CLASS", "setting", "." ]
9300b1866bc33178e721b6de4771ba866bfc4b11
https://github.com/praekelt/panya-music/blob/9300b1866bc33178e721b6de4771ba866bfc4b11/music/importer.py#L10-L36
238,613
praekelt/panya-music
music/importer.py
TrackImporter.lookup_track
def lookup_track(self, track): """ Looks up Django Track object for provided raw importing track object. """ tracks = Track.objects.filter(title__iexact=track.title) for track_obj in tracks: for contributor in track_obj.get_primary_contributors(permitted=False): ...
python
def lookup_track(self, track): """ Looks up Django Track object for provided raw importing track object. """ tracks = Track.objects.filter(title__iexact=track.title) for track_obj in tracks: for contributor in track_obj.get_primary_contributors(permitted=False): ...
[ "def", "lookup_track", "(", "self", ",", "track", ")", ":", "tracks", "=", "Track", ".", "objects", ".", "filter", "(", "title__iexact", "=", "track", ".", "title", ")", "for", "track_obj", "in", "tracks", ":", "for", "contributor", "in", "track_obj", "....
Looks up Django Track object for provided raw importing track object.
[ "Looks", "up", "Django", "Track", "object", "for", "provided", "raw", "importing", "track", "object", "." ]
9300b1866bc33178e721b6de4771ba866bfc4b11
https://github.com/praekelt/panya-music/blob/9300b1866bc33178e721b6de4771ba866bfc4b11/music/importer.py#L38-L47
238,614
praekelt/panya-music
music/importer.py
TrackImporter.run
def run(self): """ Run import. """ latest_track = Track.objects.all().order_by('-last_played') latest_track = latest_track[0] if latest_track else None importer = self.get_importer() tracks = importer.run() # Create/update Django Track objects fo...
python
def run(self): """ Run import. """ latest_track = Track.objects.all().order_by('-last_played') latest_track = latest_track[0] if latest_track else None importer = self.get_importer() tracks = importer.run() # Create/update Django Track objects fo...
[ "def", "run", "(", "self", ")", ":", "latest_track", "=", "Track", ".", "objects", ".", "all", "(", ")", ".", "order_by", "(", "'-last_played'", ")", "latest_track", "=", "latest_track", "[", "0", "]", "if", "latest_track", "else", "None", "importer", "=...
Run import.
[ "Run", "import", "." ]
9300b1866bc33178e721b6de4771ba866bfc4b11
https://github.com/praekelt/panya-music/blob/9300b1866bc33178e721b6de4771ba866bfc4b11/music/importer.py#L49-L86
238,615
pip-services3-python/pip-services3-commons-python
pip_services3_commons/reflect/TypeMatcher.py
TypeMatcher.match_value_by_name
def match_value_by_name(expected_type, actual_value): """ Matches expected type to a type of a value. :param expected_type: an expected type name to match. :param actual_value: a value to match its type to the expected one. :return: true if types are matching and false if they...
python
def match_value_by_name(expected_type, actual_value): """ Matches expected type to a type of a value. :param expected_type: an expected type name to match. :param actual_value: a value to match its type to the expected one. :return: true if types are matching and false if they...
[ "def", "match_value_by_name", "(", "expected_type", ",", "actual_value", ")", ":", "if", "expected_type", "==", "None", ":", "return", "True", "if", "actual_value", "==", "None", ":", "raise", "Exception", "(", "\"Actual value cannot be null\"", ")", "return", "Ty...
Matches expected type to a type of a value. :param expected_type: an expected type name to match. :param actual_value: a value to match its type to the expected one. :return: true if types are matching and false if they don't.
[ "Matches", "expected", "type", "to", "a", "type", "of", "a", "value", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/reflect/TypeMatcher.py#L68-L83
238,616
pip-services3-python/pip-services3-commons-python
pip_services3_commons/reflect/TypeMatcher.py
TypeMatcher.match_type_by_name
def match_type_by_name(expected_type, actual_type): """ Matches expected type to an actual type. :param expected_type: an expected type name to match. :param actual_type: an actual type to match defined by type code. :return: true if types are matching and false if they don't....
python
def match_type_by_name(expected_type, actual_type): """ Matches expected type to an actual type. :param expected_type: an expected type name to match. :param actual_type: an actual type to match defined by type code. :return: true if types are matching and false if they don't....
[ "def", "match_type_by_name", "(", "expected_type", ",", "actual_type", ")", ":", "if", "expected_type", "==", "None", ":", "return", "True", "if", "actual_type", "==", "None", ":", "raise", "Exception", "(", "\"Actual type cannot be null\"", ")", "expected_type", ...
Matches expected type to an actual type. :param expected_type: an expected type name to match. :param actual_type: an actual type to match defined by type code. :return: true if types are matching and false if they don't.
[ "Matches", "expected", "type", "to", "an", "actual", "type", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/reflect/TypeMatcher.py#L87-L132
238,617
tarvitz/django-unity-asset-server-http-client
duashttp/views/api.py
AssetVersionViewSetBase.blob
def blob(self, request, pk=None): """ fetch large object from pg and gives it back to user via HTTP 1.1 request :param request: django request instance :param pk: requested resource primary key :rtype: django.http.HttpResponse :rtype: HttpResponse :return...
python
def blob(self, request, pk=None): """ fetch large object from pg and gives it back to user via HTTP 1.1 request :param request: django request instance :param pk: requested resource primary key :rtype: django.http.HttpResponse :rtype: HttpResponse :return...
[ "def", "blob", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "obj", "=", "self", ".", "get_object_or_none", "(", ")", "if", "obj", ":", "blob", "=", "obj", ".", "get_blob_data", "(", ")", "content_type", "=", "'octet/stream'", "respons...
fetch large object from pg and gives it back to user via HTTP 1.1 request :param request: django request instance :param pk: requested resource primary key :rtype: django.http.HttpResponse :rtype: HttpResponse :return: file with its filename stored in database
[ "fetch", "large", "object", "from", "pg", "and", "gives", "it", "back", "to", "user", "via", "HTTP", "1", ".", "1", "request" ]
2b7e3b1116b5e98b31c2e267bdd66a77e0579ad1
https://github.com/tarvitz/django-unity-asset-server-http-client/blob/2b7e3b1116b5e98b31c2e267bdd66a77e0579ad1/duashttp/views/api.py#L27-L49
238,618
rosenbrockc/ci
pyci/config.py
RepositorySettings._get_github
def _get_github(self): """Creates an instance of github.Github to interact with the repos via the API interface in pygithub. """ from github import Github vms("Querying github with user '{}'.".format(self.username)) g = Github(self.username, self.apikey) self._us...
python
def _get_github(self): """Creates an instance of github.Github to interact with the repos via the API interface in pygithub. """ from github import Github vms("Querying github with user '{}'.".format(self.username)) g = Github(self.username, self.apikey) self._us...
[ "def", "_get_github", "(", "self", ")", ":", "from", "github", "import", "Github", "vms", "(", "\"Querying github with user '{}'.\"", ".", "format", "(", "self", ".", "username", ")", ")", "g", "=", "Github", "(", "self", ".", "username", ",", "self", ".",...
Creates an instance of github.Github to interact with the repos via the API interface in pygithub.
[ "Creates", "an", "instance", "of", "github", ".", "Github", "to", "interact", "with", "the", "repos", "via", "the", "API", "interface", "in", "pygithub", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L86-L116
238,619
rosenbrockc/ci
pyci/config.py
RepositorySettings._parse_xml
def _parse_xml(self): """Extracts the XML settings into class instances that can operate on the settings to perform the testing functions. """ import xml.etree.ElementTree as ET from os import path #This dict has the keys of XML tags that are required in order for the ...
python
def _parse_xml(self): """Extracts the XML settings into class instances that can operate on the settings to perform the testing functions. """ import xml.etree.ElementTree as ET from os import path #This dict has the keys of XML tags that are required in order for the ...
[ "def", "_parse_xml", "(", "self", ")", ":", "import", "xml", ".", "etree", ".", "ElementTree", "as", "ET", "from", "os", "import", "path", "#This dict has the keys of XML tags that are required in order for the", "#CI server to run the repo. When each one is parsed, we change i...
Extracts the XML settings into class instances that can operate on the settings to perform the testing functions.
[ "Extracts", "the", "XML", "settings", "into", "class", "instances", "that", "can", "operate", "on", "the", "settings", "to", "perform", "the", "testing", "functions", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L129-L166
238,620
rosenbrockc/ci
pyci/config.py
CronSettings._parse_xml
def _parse_xml(self, xml): """Extracts the attributes from the XMLElement instance.""" from re import split vms("Parsing <cron> XML child tag.", 2) self.frequency = get_attrib(xml, "frequency", default=5, cast=int) self.emails = split(",\s*", get_attrib(xml, "emails", default="")...
python
def _parse_xml(self, xml): """Extracts the attributes from the XMLElement instance.""" from re import split vms("Parsing <cron> XML child tag.", 2) self.frequency = get_attrib(xml, "frequency", default=5, cast=int) self.emails = split(",\s*", get_attrib(xml, "emails", default="")...
[ "def", "_parse_xml", "(", "self", ",", "xml", ")", ":", "from", "re", "import", "split", "vms", "(", "\"Parsing <cron> XML child tag.\"", ",", "2", ")", "self", ".", "frequency", "=", "get_attrib", "(", "xml", ",", "\"frequency\"", ",", "default", "=", "5"...
Extracts the attributes from the XMLElement instance.
[ "Extracts", "the", "attributes", "from", "the", "XMLElement", "instance", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L197-L203
238,621
rosenbrockc/ci
pyci/config.py
StaticSettings._parse_xml
def _parse_xml(self, xml): """Extracts objects representing and interacting with the settings in the xml tag. """ vms("Parsing <static> XML child tag.", 2) for child in xml: if "path" in child.attrib and "target" in child.attrib: if child.tag == "file"...
python
def _parse_xml(self, xml): """Extracts objects representing and interacting with the settings in the xml tag. """ vms("Parsing <static> XML child tag.", 2) for child in xml: if "path" in child.attrib and "target" in child.attrib: if child.tag == "file"...
[ "def", "_parse_xml", "(", "self", ",", "xml", ")", ":", "vms", "(", "\"Parsing <static> XML child tag.\"", ",", "2", ")", "for", "child", "in", "xml", ":", "if", "\"path\"", "in", "child", ".", "attrib", "and", "\"target\"", "in", "child", ".", "attrib", ...
Extracts objects representing and interacting with the settings in the xml tag.
[ "Extracts", "objects", "representing", "and", "interacting", "with", "the", "settings", "in", "the", "xml", "tag", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L230-L242
238,622
rosenbrockc/ci
pyci/config.py
StaticSettings.copy
def copy(self, repodir): """Copies the static files and folders specified in these settings into the locally-cloned repository directory. :arg repodir: the full path to the directory with the locally-cloned version of the pull request being unit tested. """ #Instead of...
python
def copy(self, repodir): """Copies the static files and folders specified in these settings into the locally-cloned repository directory. :arg repodir: the full path to the directory with the locally-cloned version of the pull request being unit tested. """ #Instead of...
[ "def", "copy", "(", "self", ",", "repodir", ")", ":", "#Instead of using the built-in shell copy, we make shell calls to rsync.", "#This allows us to copy only changes across between runs of pull-requests.", "from", "os", "import", "system", ",", "path", "vms", "(", "\"Running st...
Copies the static files and folders specified in these settings into the locally-cloned repository directory. :arg repodir: the full path to the directory with the locally-cloned version of the pull request being unit tested.
[ "Copies", "the", "static", "files", "and", "folders", "specified", "in", "these", "settings", "into", "the", "locally", "-", "cloned", "repository", "directory", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L244-L266
238,623
rosenbrockc/ci
pyci/config.py
GlobalSettings.serial
def serial(self): """Returns true if the CI server should run in serial mode. """ serial = self.property_get("SERIAL", False) if isinstance(serial, str): return serial.lower() == "true" else: return serial
python
def serial(self): """Returns true if the CI server should run in serial mode. """ serial = self.property_get("SERIAL", False) if isinstance(serial, str): return serial.lower() == "true" else: return serial
[ "def", "serial", "(", "self", ")", ":", "serial", "=", "self", ".", "property_get", "(", "\"SERIAL\"", ",", "False", ")", "if", "isinstance", "(", "serial", ",", "str", ")", ":", "return", "serial", ".", "lower", "(", ")", "==", "\"true\"", "else", "...
Returns true if the CI server should run in serial mode.
[ "Returns", "true", "if", "the", "CI", "server", "should", "run", "in", "serial", "mode", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L429-L436
238,624
rosenbrockc/ci
pyci/config.py
GlobalSettings.var_replace
def var_replace(self, text): """Replaces all instances of @VAR with their values in the specified text. """ result = text for var in self._vardict: result = result.replace("@{}".format(var), self._vardict[var]) return result
python
def var_replace(self, text): """Replaces all instances of @VAR with their values in the specified text. """ result = text for var in self._vardict: result = result.replace("@{}".format(var), self._vardict[var]) return result
[ "def", "var_replace", "(", "self", ",", "text", ")", ":", "result", "=", "text", "for", "var", "in", "self", ".", "_vardict", ":", "result", "=", "result", ".", "replace", "(", "\"@{}\"", ".", "format", "(", "var", ")", ",", "self", ".", "_vardict", ...
Replaces all instances of @VAR with their values in the specified text.
[ "Replaces", "all", "instances", "of" ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/config.py#L454-L460
238,625
siemens/django-dingos
dingos/models.py
get_or_create_iobject
def get_or_create_iobject(identifier_uid, identifier_namespace_uri, iobject_type_name, iobject_type_namespace_uri, iobject_type_revision_name, iobject_family_name, ...
python
def get_or_create_iobject(identifier_uid, identifier_namespace_uri, iobject_type_name, iobject_type_namespace_uri, iobject_type_revision_name, iobject_family_name, ...
[ "def", "get_or_create_iobject", "(", "identifier_uid", ",", "identifier_namespace_uri", ",", "iobject_type_name", ",", "iobject_type_namespace_uri", ",", "iobject_type_revision_name", ",", "iobject_family_name", ",", "iobject_family_revision_name", "=", "\"\"", ",", "identifier...
Get or create an information object.
[ "Get", "or", "create", "an", "information", "object", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L1860-L1940
238,626
siemens/django-dingos
dingos/models.py
get_or_create_fact
def get_or_create_fact(fact_term, fact_dt_name='String', fact_dt_namespace_uri=DINGOS_NAMESPACE_URI, values=None, value_iobject_id=None, value_iobject_ts=None, ): """ Get or ...
python
def get_or_create_fact(fact_term, fact_dt_name='String', fact_dt_namespace_uri=DINGOS_NAMESPACE_URI, values=None, value_iobject_id=None, value_iobject_ts=None, ): """ Get or ...
[ "def", "get_or_create_fact", "(", "fact_term", ",", "fact_dt_name", "=", "'String'", ",", "fact_dt_namespace_uri", "=", "DINGOS_NAMESPACE_URI", ",", "values", "=", "None", ",", "value_iobject_id", "=", "None", ",", "value_iobject_ts", "=", "None", ",", ")", ":", ...
Get or create a fact object.
[ "Get", "or", "create", "a", "fact", "object", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L1943-L2047
238,627
siemens/django-dingos
dingos/models.py
get_or_create_fact_term
def get_or_create_fact_term(iobject_family_name, fact_term_name, fact_term_attribute, iobject_type_name, iobject_type_namespace_uri, fact_dt_name=DINGOS_DEFAULT_FACT_DATATYPE, ...
python
def get_or_create_fact_term(iobject_family_name, fact_term_name, fact_term_attribute, iobject_type_name, iobject_type_namespace_uri, fact_dt_name=DINGOS_DEFAULT_FACT_DATATYPE, ...
[ "def", "get_or_create_fact_term", "(", "iobject_family_name", ",", "fact_term_name", ",", "fact_term_attribute", ",", "iobject_type_name", ",", "iobject_type_namespace_uri", ",", "fact_dt_name", "=", "DINGOS_DEFAULT_FACT_DATATYPE", ",", "fact_dt_namespace_name", "=", "None", ...
Get or create a fact term.
[ "Get", "or", "create", "a", "fact", "term", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L2050-L2109
238,628
siemens/django-dingos
dingos/models.py
InfoObject2Fact.marking_thru
def marking_thru(self): """ Return the back-pointer to markings that may have been attached via Django's content type mechanism. """ self_django_type = ContentType.objects.get_for_model(self) return Marking2X.objects.filter(content_type__pk=self_django_type.id, ...
python
def marking_thru(self): """ Return the back-pointer to markings that may have been attached via Django's content type mechanism. """ self_django_type = ContentType.objects.get_for_model(self) return Marking2X.objects.filter(content_type__pk=self_django_type.id, ...
[ "def", "marking_thru", "(", "self", ")", ":", "self_django_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "self", ")", "return", "Marking2X", ".", "objects", ".", "filter", "(", "content_type__pk", "=", "self_django_type", ".", "id", ","...
Return the back-pointer to markings that may have been attached via Django's content type mechanism.
[ "Return", "the", "back", "-", "pointer", "to", "markings", "that", "may", "have", "been", "attached", "via", "Django", "s", "content", "type", "mechanism", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L687-L694
238,629
siemens/django-dingos
dingos/models.py
InfoObject.embedded_in
def embedded_in(self): """ Used in the view for the InfoObject (in order to be able to use the standard class-based object view. Should be removed from here and put into a proper custom view for the object. This query only returns embedding objects of the latest revision: to change ...
python
def embedded_in(self): """ Used in the view for the InfoObject (in order to be able to use the standard class-based object view. Should be removed from here and put into a proper custom view for the object. This query only returns embedding objects of the latest revision: to change ...
[ "def", "embedded_in", "(", "self", ")", ":", "return", "self", ".", "_DCM", "[", "'InfoObject2Fact'", "]", ".", "objects", ".", "filter", "(", "fact__value_iobject_id", "=", "self", ".", "identifier", ")", ".", "filter", "(", "iobject__timestamp", "=", "F", ...
Used in the view for the InfoObject (in order to be able to use the standard class-based object view. Should be removed from here and put into a proper custom view for the object. This query only returns embedding objects of the latest revision: to change this, the filter 'iobject__timestamp=F(...
[ "Used", "in", "the", "view", "for", "the", "InfoObject", "(", "in", "order", "to", "be", "able", "to", "use", "the", "standard", "class", "-", "based", "object", "view", ".", "Should", "be", "removed", "from", "here", "and", "put", "into", "a", "proper...
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L946-L969
238,630
siemens/django-dingos
dingos/models.py
InfoObject.set_name
def set_name(self,name=None): """ Set the name of the object. If no name is given, the name is extracted via the extract_name method. """ if name: self.name = name[:254] else: self.name = self.extract_name()[:254] self.save() retu...
python
def set_name(self,name=None): """ Set the name of the object. If no name is given, the name is extracted via the extract_name method. """ if name: self.name = name[:254] else: self.name = self.extract_name()[:254] self.save() retu...
[ "def", "set_name", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", ":", "self", ".", "name", "=", "name", "[", ":", "254", "]", "else", ":", "self", ".", "name", "=", "self", ".", "extract_name", "(", ")", "[", ":", "254", "]", ...
Set the name of the object. If no name is given, the name is extracted via the extract_name method.
[ "Set", "the", "name", "of", "the", "object", ".", "If", "no", "name", "is", "given", "the", "name", "is", "extracted", "via", "the", "extract_name", "method", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L1496-L1508
238,631
siemens/django-dingos
dingos/models.py
InfoObject.add_relation
def add_relation(self, target_id=None, relation_types=None, fact_dt_namespace_name=None, fact_dt_namespace_uri=DINGOS_NAMESPACE_URI, fact_dt_kind=FactDataType.UNKNOWN_KIND, fact_dt_name='String'...
python
def add_relation(self, target_id=None, relation_types=None, fact_dt_namespace_name=None, fact_dt_namespace_uri=DINGOS_NAMESPACE_URI, fact_dt_kind=FactDataType.UNKNOWN_KIND, fact_dt_name='String'...
[ "def", "add_relation", "(", "self", ",", "target_id", "=", "None", ",", "relation_types", "=", "None", ",", "fact_dt_namespace_name", "=", "None", ",", "fact_dt_namespace_uri", "=", "DINGOS_NAMESPACE_URI", ",", "fact_dt_kind", "=", "FactDataType", ".", "UNKNOWN_KIND...
Add a relationship between this object and another object.
[ "Add", "a", "relationship", "between", "this", "object", "and", "another", "object", "." ]
7154f75b06d2538568e2f2455a76f3d0db0b7d70
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/models.py#L1510-L1586
238,632
PureWhiteWu/pyformatter
pyformatter/core.py
Formatter._load_data
def _load_data(self): """ Load data from raw_data or file_path """ if self.raw_data is None and self.data_format is not FormatType.PYTHON: if self.file_path is None: raise ArgumentInvalid('One of "raw_data" or "file_path" should be set!') if not os...
python
def _load_data(self): """ Load data from raw_data or file_path """ if self.raw_data is None and self.data_format is not FormatType.PYTHON: if self.file_path is None: raise ArgumentInvalid('One of "raw_data" or "file_path" should be set!') if not os...
[ "def", "_load_data", "(", "self", ")", ":", "if", "self", ".", "raw_data", "is", "None", "and", "self", ".", "data_format", "is", "not", "FormatType", ".", "PYTHON", ":", "if", "self", ".", "file_path", "is", "None", ":", "raise", "ArgumentInvalid", "(",...
Load data from raw_data or file_path
[ "Load", "data", "from", "raw_data", "or", "file_path" ]
c3cc9f48d0e251919542e87524900d6ef8d16d82
https://github.com/PureWhiteWu/pyformatter/blob/c3cc9f48d0e251919542e87524900d6ef8d16d82/pyformatter/core.py#L42-L52
238,633
PureWhiteWu/pyformatter
pyformatter/core.py
Formatter._validate
def _validate(self): """ Validate the input data. """ if self.data_format is FormatType.PYTHON: self.data = self.raw_data elif self.data_format is FormatType.JSON: self._validate_json() elif self.data_format is FormatType.YAML: self._va...
python
def _validate(self): """ Validate the input data. """ if self.data_format is FormatType.PYTHON: self.data = self.raw_data elif self.data_format is FormatType.JSON: self._validate_json() elif self.data_format is FormatType.YAML: self._va...
[ "def", "_validate", "(", "self", ")", ":", "if", "self", ".", "data_format", "is", "FormatType", ".", "PYTHON", ":", "self", ".", "data", "=", "self", ".", "raw_data", "elif", "self", ".", "data_format", "is", "FormatType", ".", "JSON", ":", "self", "....
Validate the input data.
[ "Validate", "the", "input", "data", "." ]
c3cc9f48d0e251919542e87524900d6ef8d16d82
https://github.com/PureWhiteWu/pyformatter/blob/c3cc9f48d0e251919542e87524900d6ef8d16d82/pyformatter/core.py#L54-L63
238,634
demurgos/py-pathmatch
pathmatch/wildmatch.py
match
def match(pattern, text, no_escape=False, path_name=True, wild_star=True, period=False, case_fold=False): u""" Matches text against the supplied wildmatch pattern. To get git's behavior, use the `wild_star` flag. Note that the EXTMATCH (ksh extended glob patterns) option is not available ...
python
def match(pattern, text, no_escape=False, path_name=True, wild_star=True, period=False, case_fold=False): u""" Matches text against the supplied wildmatch pattern. To get git's behavior, use the `wild_star` flag. Note that the EXTMATCH (ksh extended glob patterns) option is not available ...
[ "def", "match", "(", "pattern", ",", "text", ",", "no_escape", "=", "False", ",", "path_name", "=", "True", ",", "wild_star", "=", "True", ",", "period", "=", "False", ",", "case_fold", "=", "False", ")", ":", "regex", "=", "translate", "(", "pattern",...
u""" Matches text against the supplied wildmatch pattern. To get git's behavior, use the `wild_star` flag. Note that the EXTMATCH (ksh extended glob patterns) option is not available :type pattern: text_type :param pattern: A wildmatch pattern :type text: text_type :param text: The text t...
[ "u", "Matches", "text", "against", "the", "supplied", "wildmatch", "pattern", "." ]
70b3aa99ee34da8b80b6ec6340862b760159d2a1
https://github.com/demurgos/py-pathmatch/blob/70b3aa99ee34da8b80b6ec6340862b760159d2a1/pathmatch/wildmatch.py#L602-L637
238,635
demurgos/py-pathmatch
pathmatch/wildmatch.py
WildmatchPattern.filter
def filter(self, texts): u""" Returns a generator yielding the elements of `texts` matching this pattern. :type texts: typing.Iterable[text_type] :param texts: An iterable collection of texts to match :rtype: typing.Iterable[text_type] :return: A generator of filtered el...
python
def filter(self, texts): u""" Returns a generator yielding the elements of `texts` matching this pattern. :type texts: typing.Iterable[text_type] :param texts: An iterable collection of texts to match :rtype: typing.Iterable[text_type] :return: A generator of filtered el...
[ "def", "filter", "(", "self", ",", "texts", ")", ":", "return", "(", "text", "for", "text", "in", "texts", "if", "self", ".", "regex", ".", "match", "(", "text", ")", "is", "not", "None", ")" ]
u""" Returns a generator yielding the elements of `texts` matching this pattern. :type texts: typing.Iterable[text_type] :param texts: An iterable collection of texts to match :rtype: typing.Iterable[text_type] :return: A generator of filtered elements.
[ "u", "Returns", "a", "generator", "yielding", "the", "elements", "of", "texts", "matching", "this", "pattern", "." ]
70b3aa99ee34da8b80b6ec6340862b760159d2a1
https://github.com/demurgos/py-pathmatch/blob/70b3aa99ee34da8b80b6ec6340862b760159d2a1/pathmatch/wildmatch.py#L733-L742
238,636
perimosocordiae/viztricks
viztricks/convenience.py
imagesc
def imagesc(data, title=None, fig='current', ax=None): '''Simple alias for a Matlab-like imshow function.''' ax = _get_axis(fig, ax, False) ax.imshow(data, interpolation='nearest', aspect='auto') if title: ax.set_title(title) return plt.show
python
def imagesc(data, title=None, fig='current', ax=None): '''Simple alias for a Matlab-like imshow function.''' ax = _get_axis(fig, ax, False) ax.imshow(data, interpolation='nearest', aspect='auto') if title: ax.set_title(title) return plt.show
[ "def", "imagesc", "(", "data", ",", "title", "=", "None", ",", "fig", "=", "'current'", ",", "ax", "=", "None", ")", ":", "ax", "=", "_get_axis", "(", "fig", ",", "ax", ",", "False", ")", "ax", ".", "imshow", "(", "data", ",", "interpolation", "=...
Simple alias for a Matlab-like imshow function.
[ "Simple", "alias", "for", "a", "Matlab", "-", "like", "imshow", "function", "." ]
bae2f8a9ce9278ce0197f8efc34cc4fef1dfe1eb
https://github.com/perimosocordiae/viztricks/blob/bae2f8a9ce9278ce0197f8efc34cc4fef1dfe1eb/viztricks/convenience.py#L72-L78
238,637
perimosocordiae/viztricks
viztricks/convenience.py
vector_field
def vector_field(points, directions, title=None, fig='current', ax=None, edge_style='k-', vertex_style='o'): '''Plots vectors that start at 'points', and move along 'directions'.''' assert points.shape[1] in (2,3) and directions.shape == points.shape ax = _get_axis(fig, ax, points.shape[1] == 3) ...
python
def vector_field(points, directions, title=None, fig='current', ax=None, edge_style='k-', vertex_style='o'): '''Plots vectors that start at 'points', and move along 'directions'.''' assert points.shape[1] in (2,3) and directions.shape == points.shape ax = _get_axis(fig, ax, points.shape[1] == 3) ...
[ "def", "vector_field", "(", "points", ",", "directions", ",", "title", "=", "None", ",", "fig", "=", "'current'", ",", "ax", "=", "None", ",", "edge_style", "=", "'k-'", ",", "vertex_style", "=", "'o'", ")", ":", "assert", "points", ".", "shape", "[", ...
Plots vectors that start at 'points', and move along 'directions'.
[ "Plots", "vectors", "that", "start", "at", "points", "and", "move", "along", "directions", "." ]
bae2f8a9ce9278ce0197f8efc34cc4fef1dfe1eb
https://github.com/perimosocordiae/viztricks/blob/bae2f8a9ce9278ce0197f8efc34cc4fef1dfe1eb/viztricks/convenience.py#L110-L134
238,638
dizak/headnode_notifier
headnode_notifier.py
read_passwd_file
def read_passwd_file(pass_file): """Read password from external file and retrun as string. The file should contain just single line. Prevents hard-coding password anywhere in this script. IMPORTANT! Password is stored as plain text! Do NOT use with your personal account!" Args: pass_file (s...
python
def read_passwd_file(pass_file): """Read password from external file and retrun as string. The file should contain just single line. Prevents hard-coding password anywhere in this script. IMPORTANT! Password is stored as plain text! Do NOT use with your personal account!" Args: pass_file (s...
[ "def", "read_passwd_file", "(", "pass_file", ")", ":", "with", "open", "(", "pass_file", ")", "as", "fin", ":", "passwd", "=", "fin", ".", "read", "(", ")", ".", "strip", "(", ")", "return", "passwd" ]
Read password from external file and retrun as string. The file should contain just single line. Prevents hard-coding password anywhere in this script. IMPORTANT! Password is stored as plain text! Do NOT use with your personal account!" Args: pass_file (str): /path/to/pass_file
[ "Read", "password", "from", "external", "file", "and", "retrun", "as", "string", ".", "The", "file", "should", "contain", "just", "single", "line", ".", "Prevents", "hard", "-", "coding", "password", "anywhere", "in", "this", "script", ".", "IMPORTANT!", "Pa...
dc19577417ddf86d7818da0946ec28758255e8c3
https://github.com/dizak/headnode_notifier/blob/dc19577417ddf86d7818da0946ec28758255e8c3/headnode_notifier.py#L19-L30
238,639
dizak/headnode_notifier
headnode_notifier.py
send_mail
def send_mail(to_addr, subj_msg, body_msg, attach_path, serv_addr, serv_port, from_addr, passwd): """Send an e-mail message using smtplib and email standard python libraries. IMPORTANT! Password is stored as plain ...
python
def send_mail(to_addr, subj_msg, body_msg, attach_path, serv_addr, serv_port, from_addr, passwd): """Send an e-mail message using smtplib and email standard python libraries. IMPORTANT! Password is stored as plain ...
[ "def", "send_mail", "(", "to_addr", ",", "subj_msg", ",", "body_msg", ",", "attach_path", ",", "serv_addr", ",", "serv_port", ",", "from_addr", ",", "passwd", ")", ":", "msg", "=", "MIMEMultipart", "(", ")", "if", "attach_path", "is", "not", "None", ":", ...
Send an e-mail message using smtplib and email standard python libraries. IMPORTANT! Password is stored as plain text! Do NOT use with your personal account! Args: to_addr (str): Recipient address. subj_msg (str): Message subject. body_msg (str): Message body. serv_addr (str...
[ "Send", "an", "e", "-", "mail", "message", "using", "smtplib", "and", "email", "standard", "python", "libraries", ".", "IMPORTANT!", "Password", "is", "stored", "as", "plain", "text!", "Do", "NOT", "use", "with", "your", "personal", "account!" ]
dc19577417ddf86d7818da0946ec28758255e8c3
https://github.com/dizak/headnode_notifier/blob/dc19577417ddf86d7818da0946ec28758255e8c3/headnode_notifier.py#L33-L74
238,640
rvswift/EB
EB/builder/utilities/performance.py
roc_calculator
def roc_calculator(screened_molecules, status_field, active_label, decoy_label): """ Calculates ROC curve """ P = 0 # Total no. of actives N = 0 # Total no. of decoys tpf = []; tpf.append(0) # true positive fraction list fpf = []; fpf.append(0) # false positive fraction list ...
python
def roc_calculator(screened_molecules, status_field, active_label, decoy_label): """ Calculates ROC curve """ P = 0 # Total no. of actives N = 0 # Total no. of decoys tpf = []; tpf.append(0) # true positive fraction list fpf = []; fpf.append(0) # false positive fraction list ...
[ "def", "roc_calculator", "(", "screened_molecules", ",", "status_field", ",", "active_label", ",", "decoy_label", ")", ":", "P", "=", "0", "# Total no. of actives", "N", "=", "0", "# Total no. of decoys", "tpf", "=", "[", "]", "tpf", ".", "append", "(", "0", ...
Calculates ROC curve
[ "Calculates", "ROC", "curve" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/utilities/performance.py#L32-L71
238,641
wickman/compactor
compactor/bin/http_example.py
listen
def listen(identifier): """ Launch a listener and return the compactor context. """ context = Context() process = WebProcess(identifier) context.spawn(process) log.info("Launching PID %s", process.pid) return process, context
python
def listen(identifier): """ Launch a listener and return the compactor context. """ context = Context() process = WebProcess(identifier) context.spawn(process) log.info("Launching PID %s", process.pid) return process, context
[ "def", "listen", "(", "identifier", ")", ":", "context", "=", "Context", "(", ")", "process", "=", "WebProcess", "(", "identifier", ")", "context", ".", "spawn", "(", "process", ")", "log", ".", "info", "(", "\"Launching PID %s\"", ",", "process", ".", "...
Launch a listener and return the compactor context.
[ "Launch", "a", "listener", "and", "return", "the", "compactor", "context", "." ]
52714be3d84aa595a212feccb4d92ec250cede2a
https://github.com/wickman/compactor/blob/52714be3d84aa595a212feccb4d92ec250cede2a/compactor/bin/http_example.py#L34-L46
238,642
obskyr/puush.py
puush/puush.py
Account.history
def history(self): """Get the latest 10 files uploaded to the account. Return a list of Puush File objects. """ res = self._api_request('hist') if res[0][0] == '-1': raise PuushError("History retrieval failed.") files = [] for line in res[1:]:...
python
def history(self): """Get the latest 10 files uploaded to the account. Return a list of Puush File objects. """ res = self._api_request('hist') if res[0][0] == '-1': raise PuushError("History retrieval failed.") files = [] for line in res[1:]:...
[ "def", "history", "(", "self", ")", ":", "res", "=", "self", ".", "_api_request", "(", "'hist'", ")", "if", "res", "[", "0", "]", "[", "0", "]", "==", "'-1'", ":", "raise", "PuushError", "(", "\"History retrieval failed.\"", ")", "files", "=", "[", "...
Get the latest 10 files uploaded to the account. Return a list of Puush File objects.
[ "Get", "the", "latest", "10", "files", "uploaded", "to", "the", "account", ".", "Return", "a", "list", "of", "Puush", "File", "objects", "." ]
a0e4fe424c43a7758d8aaf1b31659ab51266f6d1
https://github.com/obskyr/puush.py/blob/a0e4fe424c43a7758d8aaf1b31659ab51266f6d1/puush/puush.py#L174-L186
238,643
kezabelle/django-template-selector
templateselector/fields.py
TemplateChoiceField.prepare_value
def prepare_value(self, value): """ To avoid evaluating the lazysorted callable more than necessary to establish a potential initial value for the field, we do it here. If there's - only one template choice, and - the field is required, and - there's no prior ini...
python
def prepare_value(self, value): """ To avoid evaluating the lazysorted callable more than necessary to establish a potential initial value for the field, we do it here. If there's - only one template choice, and - the field is required, and - there's no prior ini...
[ "def", "prepare_value", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", "and", "self", ".", "required", ":", "choices", "=", "list", "(", "self", ".", "choices", ")", "if", "len", "(", "choices", ")", "==", "1", ":", "value", "=",...
To avoid evaluating the lazysorted callable more than necessary to establish a potential initial value for the field, we do it here. If there's - only one template choice, and - the field is required, and - there's no prior initial set (either by being bound or by being set ...
[ "To", "avoid", "evaluating", "the", "lazysorted", "callable", "more", "than", "necessary", "to", "establish", "a", "potential", "initial", "value", "for", "the", "field", "we", "do", "it", "here", "." ]
1c42baf934f38bb09b0939c67512057e33cacabb
https://github.com/kezabelle/django-template-selector/blob/1c42baf934f38bb09b0939c67512057e33cacabb/templateselector/fields.py#L196-L212
238,644
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/FloatConverter.py
FloatConverter.to_float_with_default
def to_float_with_default(value, default_value): """ Converts value into float or returns default when conversion is not possible. :param value: the value to convert. :param default_value: the default value. :return: float value or default value when conversion is not supporte...
python
def to_float_with_default(value, default_value): """ Converts value into float or returns default when conversion is not possible. :param value: the value to convert. :param default_value: the default value. :return: float value or default value when conversion is not supporte...
[ "def", "to_float_with_default", "(", "value", ",", "default_value", ")", ":", "result", "=", "FloatConverter", ".", "to_nullable_float", "(", "value", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts value into float or returns default when conversion is not possible. :param value: the value to convert. :param default_value: the default value. :return: float value or default value when conversion is not supported.
[ "Converts", "value", "into", "float", "or", "returns", "default", "when", "conversion", "is", "not", "possible", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/FloatConverter.py#L55-L66
238,645
roboogle/gtkmvc3
gtkmvco/examples/thread/model.py
MyModel.run
def run(self): """This method is run by a separated thread""" self.busy = True for i in range(9): self.counter += 1 time.sleep(0.5) pass self.counter += 1 self.busy = False return
python
def run(self): """This method is run by a separated thread""" self.busy = True for i in range(9): self.counter += 1 time.sleep(0.5) pass self.counter += 1 self.busy = False return
[ "def", "run", "(", "self", ")", ":", "self", ".", "busy", "=", "True", "for", "i", "in", "range", "(", "9", ")", ":", "self", ".", "counter", "+=", "1", "time", ".", "sleep", "(", "0.5", ")", "pass", "self", ".", "counter", "+=", "1", "self", ...
This method is run by a separated thread
[ "This", "method", "is", "run", "by", "a", "separated", "thread" ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/thread/model.py#L58-L69
238,646
majerteam/sqla_inspect
sqla_inspect/base.py
BaseSqlaInspector.get_info_field
def get_info_field(prop): """ Return the info attribute of the given property """ if isinstance(prop, ColumnProperty): column = prop.columns[0] elif isinstance(prop, RelationshipProperty): column = prop return column.info
python
def get_info_field(prop): """ Return the info attribute of the given property """ if isinstance(prop, ColumnProperty): column = prop.columns[0] elif isinstance(prop, RelationshipProperty): column = prop return column.info
[ "def", "get_info_field", "(", "prop", ")", ":", "if", "isinstance", "(", "prop", ",", "ColumnProperty", ")", ":", "column", "=", "prop", ".", "columns", "[", "0", "]", "elif", "isinstance", "(", "prop", ",", "RelationshipProperty", ")", ":", "column", "=...
Return the info attribute of the given property
[ "Return", "the", "info", "attribute", "of", "the", "given", "property" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/base.py#L62-L72
238,647
majerteam/sqla_inspect
sqla_inspect/base.py
Registry.add_item
def add_item(self, sqla_col_type, item, key_specific=None): """ Add an item to the registry """ if key_specific is not None: self.setdefault(key_specific, {})[sqla_col_type] = item else: self[sqla_col_type] = item
python
def add_item(self, sqla_col_type, item, key_specific=None): """ Add an item to the registry """ if key_specific is not None: self.setdefault(key_specific, {})[sqla_col_type] = item else: self[sqla_col_type] = item
[ "def", "add_item", "(", "self", ",", "sqla_col_type", ",", "item", ",", "key_specific", "=", "None", ")", ":", "if", "key_specific", "is", "not", "None", ":", "self", ".", "setdefault", "(", "key_specific", ",", "{", "}", ")", "[", "sqla_col_type", "]", ...
Add an item to the registry
[ "Add", "an", "item", "to", "the", "registry" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/base.py#L79-L86
238,648
majerteam/sqla_inspect
sqla_inspect/base.py
FormatterRegistry.add_formatter
def add_formatter(self, sqla_col_type, formatter, key_specific=None): """ Add a formatter to the registry if key_specific is provided, this formatter will only be used for some specific exports """ self.add_item(sqla_col_type, formatter, key_specific)
python
def add_formatter(self, sqla_col_type, formatter, key_specific=None): """ Add a formatter to the registry if key_specific is provided, this formatter will only be used for some specific exports """ self.add_item(sqla_col_type, formatter, key_specific)
[ "def", "add_formatter", "(", "self", ",", "sqla_col_type", ",", "formatter", ",", "key_specific", "=", "None", ")", ":", "self", ".", "add_item", "(", "sqla_col_type", ",", "formatter", ",", "key_specific", ")" ]
Add a formatter to the registry if key_specific is provided, this formatter will only be used for some specific exports
[ "Add", "a", "formatter", "to", "the", "registry", "if", "key_specific", "is", "provided", "this", "formatter", "will", "only", "be", "used", "for", "some", "specific", "exports" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/base.py#L102-L108
238,649
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.setup_layout
def setup_layout(self, orientation=None): """Setup the layout for the tooltip in the given orientation :param layout: the orentation of the layout :type layout: QtCore.Qt.Orientation | None :returns: None :rtype: None :raises: None """ if orientation == Q...
python
def setup_layout(self, orientation=None): """Setup the layout for the tooltip in the given orientation :param layout: the orentation of the layout :type layout: QtCore.Qt.Orientation | None :returns: None :rtype: None :raises: None """ if orientation == Q...
[ "def", "setup_layout", "(", "self", ",", "orientation", "=", "None", ")", ":", "if", "orientation", "==", "QtCore", ".", "Qt", ".", "Horizontal", "or", "orientation", "is", "None", ":", "layout", "=", "QtGui", ".", "QHBoxLayout", "(", ")", "elif", "orien...
Setup the layout for the tooltip in the given orientation :param layout: the orentation of the layout :type layout: QtCore.Qt.Orientation | None :returns: None :rtype: None :raises: None
[ "Setup", "the", "layout", "for", "the", "tooltip", "in", "the", "given", "orientation" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L95-L112
238,650
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.setup_size
def setup_size(self, width, height): """Set the width and height for one cell in the tooltip This is inderectly acomplished by setting the iconsizes for the buttons. :param width: the width of one cell, min. is 7 -> icon width = 0 :type width: int :param height: the height of o...
python
def setup_size(self, width, height): """Set the width and height for one cell in the tooltip This is inderectly acomplished by setting the iconsizes for the buttons. :param width: the width of one cell, min. is 7 -> icon width = 0 :type width: int :param height: the height of o...
[ "def", "setup_size", "(", "self", ",", "width", ",", "height", ")", ":", "self", ".", "_iconw", "=", "max", "(", "0", ",", "width", "-", "7", ")", "self", ".", "_iconh", "=", "max", "(", "0", ",", "height", "-", "6", ")", "self", ".", "update_a...
Set the width and height for one cell in the tooltip This is inderectly acomplished by setting the iconsizes for the buttons. :param width: the width of one cell, min. is 7 -> icon width = 0 :type width: int :param height: the height of one cell, min. is 6 -> icon height = 0 :t...
[ "Set", "the", "width", "and", "height", "for", "one", "cell", "in", "the", "tooltip" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L114-L129
238,651
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.setup_cyatimer
def setup_cyatimer(self, interval): """Setup the timer that will close the widget after the mouse left the widget for the time of interval :param interval: the time that the tooltip waits before it dissapears in milliseconds :type interval: int :returns: None :rtype: None ...
python
def setup_cyatimer(self, interval): """Setup the timer that will close the widget after the mouse left the widget for the time of interval :param interval: the time that the tooltip waits before it dissapears in milliseconds :type interval: int :returns: None :rtype: None ...
[ "def", "setup_cyatimer", "(", "self", ",", "interval", ")", ":", "self", ".", "cyatimer", "=", "QtCore", ".", "QTimer", "(", "self", ")", "self", ".", "cyatimer", ".", "setSingleShot", "(", "True", ")", "self", ".", "cyatimer", ".", "timeout", ".", "co...
Setup the timer that will close the widget after the mouse left the widget for the time of interval :param interval: the time that the tooltip waits before it dissapears in milliseconds :type interval: int :returns: None :rtype: None :raises: None
[ "Setup", "the", "timer", "that", "will", "close", "the", "widget", "after", "the", "mouse", "left", "the", "widget", "for", "the", "time", "of", "interval" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L131-L143
238,652
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.event
def event(self, event): """Reimplementation of QWidget.event The widget is closed, when the window is deactivated. The widget is closed after the set interval if the mouse leaves the widget. The timer is stops when the mouse enters the widget before the interval ends. On show, t...
python
def event(self, event): """Reimplementation of QWidget.event The widget is closed, when the window is deactivated. The widget is closed after the set interval if the mouse leaves the widget. The timer is stops when the mouse enters the widget before the interval ends. On show, t...
[ "def", "event", "(", "self", ",", "event", ")", ":", "if", "event", ".", "type", "(", ")", "==", "QtCore", ".", "QEvent", ".", "WindowDeactivate", ":", "# hide the tooltip", "self", ".", "cyatimer", ".", "stop", "(", ")", "self", ".", "hide", "(", ")...
Reimplementation of QWidget.event The widget is closed, when the window is deactivated. The widget is closed after the set interval if the mouse leaves the widget. The timer is stops when the mouse enters the widget before the interval ends. On show, the added widgets are rendered for t...
[ "Reimplementation", "of", "QWidget", ".", "event" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L145-L167
238,653
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.create_button
def create_button(self, widget): """Create a button that has the given widget rendered as an icon :param widget: the widget to render as icon :type widget: QtGui.QWidget :returns: the created button :rtype: QtGui.QAbstractButton :raises: None """ btn = Qt...
python
def create_button(self, widget): """Create a button that has the given widget rendered as an icon :param widget: the widget to render as icon :type widget: QtGui.QWidget :returns: the created button :rtype: QtGui.QAbstractButton :raises: None """ btn = Qt...
[ "def", "create_button", "(", "self", ",", "widget", ")", ":", "btn", "=", "QtGui", ".", "QToolButton", "(", "self", ")", "btn", ".", "setIconSize", "(", "QtCore", ".", "QSize", "(", "self", ".", "_iconw", ",", "self", ".", "_iconh", ")", ")", "self",...
Create a button that has the given widget rendered as an icon :param widget: the widget to render as icon :type widget: QtGui.QWidget :returns: the created button :rtype: QtGui.QAbstractButton :raises: None
[ "Create", "a", "button", "that", "has", "the", "given", "widget", "rendered", "as", "an", "icon" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L169-L181
238,654
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.update_button
def update_button(self, button, widget): """Update the icon of the button with the given widget if the widget does not is invalid, it is deleted from the tooltip automatically. :param button: the button to update :type button: QtGui.QAbstractButton :param widget: the widget to ...
python
def update_button(self, button, widget): """Update the icon of the button with the given widget if the widget does not is invalid, it is deleted from the tooltip automatically. :param button: the button to update :type button: QtGui.QAbstractButton :param widget: the widget to ...
[ "def", "update_button", "(", "self", ",", "button", ",", "widget", ")", ":", "if", "not", "shiboken", ".", "isValid", "(", "widget", ")", ":", "self", ".", "remove_widget", "(", "widget", ")", "return", "button", ".", "setIconSize", "(", "QtCore", ".", ...
Update the icon of the button with the given widget if the widget does not is invalid, it is deleted from the tooltip automatically. :param button: the button to update :type button: QtGui.QAbstractButton :param widget: the widget to render as icon :type widget: QtGui.QWidget ...
[ "Update", "the", "icon", "of", "the", "button", "with", "the", "given", "widget" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L183-L203
238,655
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.update_all_buttons
def update_all_buttons(self, ): """Update all buttons :returns: None :rtype: None :raises: None """ for widget, button in self._buttons.items(): self.update_button(button, widget) self.adjustSize()
python
def update_all_buttons(self, ): """Update all buttons :returns: None :rtype: None :raises: None """ for widget, button in self._buttons.items(): self.update_button(button, widget) self.adjustSize()
[ "def", "update_all_buttons", "(", "self", ",", ")", ":", "for", "widget", ",", "button", "in", "self", ".", "_buttons", ".", "items", "(", ")", ":", "self", ".", "update_button", "(", "button", ",", "widget", ")", "self", ".", "adjustSize", "(", ")" ]
Update all buttons :returns: None :rtype: None :raises: None
[ "Update", "all", "buttons" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L205-L214
238,656
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.focus_widget
def focus_widget(self, checked=None, w=None): """Focus the given widget. Checked is ignored and only used as a slot for QAbstractButton.clicked. :param checked: The checked state of the button that was clicked :type checked: bool :param w: the widget to focus :type w: QtGui.QWid...
python
def focus_widget(self, checked=None, w=None): """Focus the given widget. Checked is ignored and only used as a slot for QAbstractButton.clicked. :param checked: The checked state of the button that was clicked :type checked: bool :param w: the widget to focus :type w: QtGui.QWid...
[ "def", "focus_widget", "(", "self", ",", "checked", "=", "None", ",", "w", "=", "None", ")", ":", "if", "w", "is", "None", ":", "return", "if", "w", ".", "isMinimized", "(", ")", ":", "w", ".", "showNormal", "(", ")", "else", ":", "w", ".", "sh...
Focus the given widget. Checked is ignored and only used as a slot for QAbstractButton.clicked. :param checked: The checked state of the button that was clicked :type checked: bool :param w: the widget to focus :type w: QtGui.QWidget :returns: None :raises: None
[ "Focus", "the", "given", "widget", ".", "Checked", "is", "ignored", "and", "only", "used", "as", "a", "slot", "for", "QAbstractButton", ".", "clicked", "." ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L216-L233
238,657
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.add_widget
def add_widget(self, widget): """Add the given widget to the tooltip :param widget: the widget to add :type widget: QtGui.QWidget :returns: None :rtype: None :raises: None """ if self._buttons.get(widget): return btn = self.create_butt...
python
def add_widget(self, widget): """Add the given widget to the tooltip :param widget: the widget to add :type widget: QtGui.QWidget :returns: None :rtype: None :raises: None """ if self._buttons.get(widget): return btn = self.create_butt...
[ "def", "add_widget", "(", "self", ",", "widget", ")", ":", "if", "self", ".", "_buttons", ".", "get", "(", "widget", ")", ":", "return", "btn", "=", "self", ".", "create_button", "(", "widget", ")", "cb", "=", "partial", "(", "self", ".", "focus_widg...
Add the given widget to the tooltip :param widget: the widget to add :type widget: QtGui.QWidget :returns: None :rtype: None :raises: None
[ "Add", "the", "given", "widget", "to", "the", "tooltip" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L235-L250
238,658
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.remove_widget
def remove_widget(self, widget): """Remove the given widget from the tooltip :param widget: the widget to remove :type widget: QtGui.QWidget :returns: None :rtype: None :raises: KeyError """ button = self._buttons.pop(widget) self.layout().removeW...
python
def remove_widget(self, widget): """Remove the given widget from the tooltip :param widget: the widget to remove :type widget: QtGui.QWidget :returns: None :rtype: None :raises: KeyError """ button = self._buttons.pop(widget) self.layout().removeW...
[ "def", "remove_widget", "(", "self", ",", "widget", ")", ":", "button", "=", "self", ".", "_buttons", ".", "pop", "(", "widget", ")", "self", ".", "layout", "(", ")", ".", "removeWidget", "(", "button", ")", "button", ".", "deleteLater", "(", ")" ]
Remove the given widget from the tooltip :param widget: the widget to remove :type widget: QtGui.QWidget :returns: None :rtype: None :raises: KeyError
[ "Remove", "the", "given", "widget", "from", "the", "tooltip" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L252-L263
238,659
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.eventFilter
def eventFilter(self, watched, event): """Filter ToolTip events and display this tooltip widget, if watched requests a tooltip. :param watched: The watched object :type watched: QtCore.QObject :param event: The event sent by watched :type event: QtCore.QEvent :returns: T...
python
def eventFilter(self, watched, event): """Filter ToolTip events and display this tooltip widget, if watched requests a tooltip. :param watched: The watched object :type watched: QtCore.QObject :param event: The event sent by watched :type event: QtCore.QEvent :returns: T...
[ "def", "eventFilter", "(", "self", ",", "watched", ",", "event", ")", ":", "if", "event", ".", "type", "(", ")", "==", "self", ".", "_triggerevent", ":", "self", ".", "show", "(", ")", "return", "True", "else", ":", "return", "False" ]
Filter ToolTip events and display this tooltip widget, if watched requests a tooltip. :param watched: The watched object :type watched: QtCore.QObject :param event: The event sent by watched :type event: QtCore.QEvent :returns: True if the event was processed. False if the event...
[ "Filter", "ToolTip", "events", "and", "display", "this", "tooltip", "widget", "if", "watched", "requests", "a", "tooltip", "." ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L265-L280
238,660
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.get_position
def get_position(self, ): """Return a recommended position for this widget to appear This implemenation returns a position so that the widget is vertically centerd on the mouse and 10 pixels left of the mouse :returns: the position :rtype: QPoint :raises: None "...
python
def get_position(self, ): """Return a recommended position for this widget to appear This implemenation returns a position so that the widget is vertically centerd on the mouse and 10 pixels left of the mouse :returns: the position :rtype: QPoint :raises: None "...
[ "def", "get_position", "(", "self", ",", ")", ":", "pos", "=", "QtGui", ".", "QCursor", ".", "pos", "(", ")", "if", "self", ".", "_alignment", "&", "QtCore", ".", "Qt", ".", "AlignLeft", "==", "QtCore", ".", "Qt", ".", "AlignLeft", ":", "pos", ".",...
Return a recommended position for this widget to appear This implemenation returns a position so that the widget is vertically centerd on the mouse and 10 pixels left of the mouse :returns: the position :rtype: QPoint :raises: None
[ "Return", "a", "recommended", "position", "for", "this", "widget", "to", "appear" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L282-L305
238,661
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
WidgetToolTip.show
def show(self, ): """Reimplementation that moves the tooltip and updates the buttons :returns: None :rtype: None :raises: None """ self.update_all_buttons() pos = self.get_position() self.move(pos) super(WidgetToolTip, self).show()
python
def show(self, ): """Reimplementation that moves the tooltip and updates the buttons :returns: None :rtype: None :raises: None """ self.update_all_buttons() pos = self.get_position() self.move(pos) super(WidgetToolTip, self).show()
[ "def", "show", "(", "self", ",", ")", ":", "self", ".", "update_all_buttons", "(", ")", "pos", "=", "self", ".", "get_position", "(", ")", "self", ".", "move", "(", "pos", ")", "super", "(", "WidgetToolTip", ",", "self", ")", ".", "show", "(", ")" ...
Reimplementation that moves the tooltip and updates the buttons :returns: None :rtype: None :raises: None
[ "Reimplementation", "that", "moves", "the", "tooltip", "and", "updates", "the", "buttons" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L387-L397
238,662
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/tooltip.py
JB_WindowToolTip.show
def show(self, ): """Reimplementation of show to update all currently available JB_MainWindows :returns: None :rtype: None :raises: None """ wins = set(JB_MainWindow.instances()) widgets = set(self.get_widgets()) for w in wins - widgets: self....
python
def show(self, ): """Reimplementation of show to update all currently available JB_MainWindows :returns: None :rtype: None :raises: None """ wins = set(JB_MainWindow.instances()) widgets = set(self.get_widgets()) for w in wins - widgets: self....
[ "def", "show", "(", "self", ",", ")", ":", "wins", "=", "set", "(", "JB_MainWindow", ".", "instances", "(", ")", ")", "widgets", "=", "set", "(", "self", ".", "get_widgets", "(", ")", ")", "for", "w", "in", "wins", "-", "widgets", ":", "self", "....
Reimplementation of show to update all currently available JB_MainWindows :returns: None :rtype: None :raises: None
[ "Reimplementation", "of", "show", "to", "update", "all", "currently", "available", "JB_MainWindows" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/tooltip.py#L402-L413
238,663
mapmyfitness/jtime
jtime/jira_ext.py
JIRA.get_issue
def get_issue(self, branch): """ Gets the JIRA issue associated with the branch name. Returns None if no issue with this branch name. """ if branch: try: issue = self.issue(branch, expand='changelog') return issue except ji...
python
def get_issue(self, branch): """ Gets the JIRA issue associated with the branch name. Returns None if no issue with this branch name. """ if branch: try: issue = self.issue(branch, expand='changelog') return issue except ji...
[ "def", "get_issue", "(", "self", ",", "branch", ")", ":", "if", "branch", ":", "try", ":", "issue", "=", "self", ".", "issue", "(", "branch", ",", "expand", "=", "'changelog'", ")", "return", "issue", "except", "jira", ".", "exceptions", ".", "JIRAErro...
Gets the JIRA issue associated with the branch name. Returns None if no issue with this branch name.
[ "Gets", "the", "JIRA", "issue", "associated", "with", "the", "branch", "name", "." ]
402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jira_ext.py#L16-L30
238,664
mapmyfitness/jtime
jtime/jira_ext.py
JIRA.workflow_transition
def workflow_transition(self, issue, status_name): """ Change the status of a JIRA issue to a named status. Will only be updated if this transition is available from the current status. """ transitions = self.transitions(issue) for transition in transitions: ...
python
def workflow_transition(self, issue, status_name): """ Change the status of a JIRA issue to a named status. Will only be updated if this transition is available from the current status. """ transitions = self.transitions(issue) for transition in transitions: ...
[ "def", "workflow_transition", "(", "self", ",", "issue", ",", "status_name", ")", ":", "transitions", "=", "self", ".", "transitions", "(", "issue", ")", "for", "transition", "in", "transitions", ":", "if", "transition", "[", "'to'", "]", "[", "'name'", "]...
Change the status of a JIRA issue to a named status. Will only be updated if this transition is available from the current status.
[ "Change", "the", "status", "of", "a", "JIRA", "issue", "to", "a", "named", "status", ".", "Will", "only", "be", "updated", "if", "this", "transition", "is", "available", "from", "the", "current", "status", "." ]
402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jira_ext.py#L64-L77
238,665
mapmyfitness/jtime
jtime/jira_ext.py
JIRA.get_datetime_issue_in_progress
def get_datetime_issue_in_progress(self, issue): """ If the issue is in progress, gets that most recent time that the issue became 'In Progress' """ histories = issue.changelog.histories for history in reversed(histories): history_items = history.items for...
python
def get_datetime_issue_in_progress(self, issue): """ If the issue is in progress, gets that most recent time that the issue became 'In Progress' """ histories = issue.changelog.histories for history in reversed(histories): history_items = history.items for...
[ "def", "get_datetime_issue_in_progress", "(", "self", ",", "issue", ")", ":", "histories", "=", "issue", ".", "changelog", ".", "histories", "for", "history", "in", "reversed", "(", "histories", ")", ":", "history_items", "=", "history", ".", "items", "for", ...
If the issue is in progress, gets that most recent time that the issue became 'In Progress'
[ "If", "the", "issue", "is", "in", "progress", "gets", "that", "most", "recent", "time", "that", "the", "issue", "became", "In", "Progress" ]
402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jira_ext.py#L79-L88
238,666
mapmyfitness/jtime
jtime/jira_ext.py
JIRA.get_cycle_time
def get_cycle_time(self, issue_or_start_or_key): """ Provided an issue or a start datetime, will return the cycle time since the start or progress """ if isinstance(issue_or_start_or_key, basestring): issue_or_start_or_key = self.get_issue(issue_or_start_or_key) if i...
python
def get_cycle_time(self, issue_or_start_or_key): """ Provided an issue or a start datetime, will return the cycle time since the start or progress """ if isinstance(issue_or_start_or_key, basestring): issue_or_start_or_key = self.get_issue(issue_or_start_or_key) if i...
[ "def", "get_cycle_time", "(", "self", ",", "issue_or_start_or_key", ")", ":", "if", "isinstance", "(", "issue_or_start_or_key", ",", "basestring", ")", ":", "issue_or_start_or_key", "=", "self", ".", "get_issue", "(", "issue_or_start_or_key", ")", "if", "isinstance"...
Provided an issue or a start datetime, will return the cycle time since the start or progress
[ "Provided", "an", "issue", "or", "a", "start", "datetime", "will", "return", "the", "cycle", "time", "since", "the", "start", "or", "progress" ]
402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jira_ext.py#L101-L114
238,667
mapmyfitness/jtime
jtime/jira_ext.py
JIRA.get_week_avg_cycletime
def get_week_avg_cycletime(self): """ Gets the average cycletime of the current user for the past week. This includes any ticket that was marked "In Progress" but not reopened. """ def moving_average(new_val, old_avg, prev_n): return (new_val + old_avg) / (prev_n + 1)...
python
def get_week_avg_cycletime(self): """ Gets the average cycletime of the current user for the past week. This includes any ticket that was marked "In Progress" but not reopened. """ def moving_average(new_val, old_avg, prev_n): return (new_val + old_avg) / (prev_n + 1)...
[ "def", "get_week_avg_cycletime", "(", "self", ")", ":", "def", "moving_average", "(", "new_val", ",", "old_avg", ",", "prev_n", ")", ":", "return", "(", "new_val", "+", "old_avg", ")", "/", "(", "prev_n", "+", "1", ")", "active_tickets_jql", "=", "'assigne...
Gets the average cycletime of the current user for the past week. This includes any ticket that was marked "In Progress" but not reopened.
[ "Gets", "the", "average", "cycletime", "of", "the", "current", "user", "for", "the", "past", "week", ".", "This", "includes", "any", "ticket", "that", "was", "marked", "In", "Progress", "but", "not", "reopened", "." ]
402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jira_ext.py#L116-L135
238,668
Brazelton-Lab/bio_utils
bio_utils/blast_tools/filter_b6_evalue.py
b6_evalue_filter
def b6_evalue_filter(handle, e_value, *args, **kwargs): """Yields lines from handle with E-value less than or equal to e_value Args: handle (file): B6/M8 file handle, can be any iterator so long as it it returns subsequent "lines" of a B6/M8 entry e_value (float): max E-value to re...
python
def b6_evalue_filter(handle, e_value, *args, **kwargs): """Yields lines from handle with E-value less than or equal to e_value Args: handle (file): B6/M8 file handle, can be any iterator so long as it it returns subsequent "lines" of a B6/M8 entry e_value (float): max E-value to re...
[ "def", "b6_evalue_filter", "(", "handle", ",", "e_value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "entry", "in", "b6_iter", "(", "handle", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "entry", ".", "evalue", "<=", ...
Yields lines from handle with E-value less than or equal to e_value Args: handle (file): B6/M8 file handle, can be any iterator so long as it it returns subsequent "lines" of a B6/M8 entry e_value (float): max E-value to return *args: Variable length argument list for b6_iter ...
[ "Yields", "lines", "from", "handle", "with", "E", "-", "value", "less", "than", "or", "equal", "to", "e_value" ]
5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7
https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/blast_tools/filter_b6_evalue.py#L43-L70
238,669
FujiMakoto/AgentML
agentml/parser/tags/condition.py
Condition.value
def value(self): """ Return the current evaluation of a condition statement """ return ''.join(map(str, self.evaluate(self.trigger.user)))
python
def value(self): """ Return the current evaluation of a condition statement """ return ''.join(map(str, self.evaluate(self.trigger.user)))
[ "def", "value", "(", "self", ")", ":", "return", "''", ".", "join", "(", "map", "(", "str", ",", "self", ".", "evaluate", "(", "self", ".", "trigger", ".", "user", ")", ")", ")" ]
Return the current evaluation of a condition statement
[ "Return", "the", "current", "evaluation", "of", "a", "condition", "statement" ]
c8cb64b460d876666bf29ea2c682189874c7c403
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/parser/tags/condition.py#L37-L41
238,670
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_judged_identifiers
def get_judged_identifiers(input_file): """ Extracts the paragraph identifiers, and the scores of the judged paragraphs from relevance judgements in the NTCIR-11 Math-2, and NTCIR-12 MathIR format. Parameters ---------- input_file : file The input file containing relevance judgements in...
python
def get_judged_identifiers(input_file): """ Extracts the paragraph identifiers, and the scores of the judged paragraphs from relevance judgements in the NTCIR-11 Math-2, and NTCIR-12 MathIR format. Parameters ---------- input_file : file The input file containing relevance judgements in...
[ "def", "get_judged_identifiers", "(", "input_file", ")", ":", "for", "line", "in", "tqdm", "(", "list", "(", "input_file", ")", ")", ":", "_", ",", "__", ",", "identifier", ",", "score", "=", "line", ".", "split", "(", "' '", ")", "yield", "(", "iden...
Extracts the paragraph identifiers, and the scores of the judged paragraphs from relevance judgements in the NTCIR-11 Math-2, and NTCIR-12 MathIR format. Parameters ---------- input_file : file The input file containing relevance judgements in the NTCIR-11 Math-2, and NTCIR-12 MathIR fo...
[ "Extracts", "the", "paragraph", "identifiers", "and", "the", "scores", "of", "the", "judged", "paragraphs", "from", "relevance", "judgements", "in", "the", "NTCIR", "-", "11", "Math", "-", "2", "and", "NTCIR", "-", "12", "MathIR", "format", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L22-L40
238,671
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_all_identifiers
def get_all_identifiers(dataset): """ Extracts paragraph identifiers from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. Yields ------- (Path, str) A parent directory of a paragraph, and...
python
def get_all_identifiers(dataset): """ Extracts paragraph identifiers from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. Yields ------- (Path, str) A parent directory of a paragraph, and...
[ "def", "get_all_identifiers", "(", "dataset", ")", ":", "for", "document", "in", "tqdm", "(", "dataset", ".", "glob", "(", "\"**/*.xhtml.zip\"", ")", ",", "desc", "=", "\"get_all_identifiers(%s)\"", "%", "dataset", ".", "name", ")", ":", "identifier", "=", "...
Extracts paragraph identifiers from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. Yields ------- (Path, str) A parent directory of a paragraph, and the identifier of the paragraph.
[ "Extracts", "paragraph", "identifiers", "from", "a", "dataset", "in", "the", "NTCIR", "-", "11", "Math", "-", "2", "and", "NTCIR", "-", "12", "MathIR", "XHTML5", "format", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L60-L79
238,672
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_position
def get_position(directory, identifier): """ Extracts the position of a paragraph from the identifier, and the parent directory of the paragraph. Parameters ---------- directory : Path A parent directory of a paragraph. identifier : str An identifier of a paragraph. Ret...
python
def get_position(directory, identifier): """ Extracts the position of a paragraph from the identifier, and the parent directory of the paragraph. Parameters ---------- directory : Path A parent directory of a paragraph. identifier : str An identifier of a paragraph. Ret...
[ "def", "get_position", "(", "directory", ",", "identifier", ")", ":", "paragraph_number", "=", "get_paragraph_number", "(", "identifier", ")", "paragraph_total", "=", "max", "(", "# Not all paragraphs are stored, e.g. because of processing errors.", "get_paragraph_number", "(...
Extracts the position of a paragraph from the identifier, and the parent directory of the paragraph. Parameters ---------- directory : Path A parent directory of a paragraph. identifier : str An identifier of a paragraph. Returns ------- float The estimated posi...
[ "Extracts", "the", "position", "of", "a", "paragraph", "from", "the", "identifier", "and", "the", "parent", "directory", "of", "the", "paragraph", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L104-L127
238,673
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_all_positions
def get_all_positions(dataset, num_workers=1): """ Extracts paragraph identifiers, and positions from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. num_workers : int, optional The number of proc...
python
def get_all_positions(dataset, num_workers=1): """ Extracts paragraph identifiers, and positions from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. num_workers : int, optional The number of proc...
[ "def", "get_all_positions", "(", "dataset", ",", "num_workers", "=", "1", ")", ":", "positions", "=", "[", "]", "identifiers", "=", "tqdm", "(", "list", "(", "get_all_identifiers", "(", "dataset", ")", ")", ",", "desc", "=", "\"get_all_positions(%s)\"", "%",...
Extracts paragraph identifiers, and positions from a dataset in the NTCIR-11 Math-2, and NTCIR-12 MathIR XHTML5 format. Parameters ---------- dataset : Path A path to a dataset. num_workers : int, optional The number of processes that will extract paragraph positions from the datase...
[ "Extracts", "paragraph", "identifiers", "and", "positions", "from", "a", "dataset", "in", "the", "NTCIR", "-", "11", "Math", "-", "2", "and", "NTCIR", "-", "12", "MathIR", "XHTML5", "format", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L135-L160
238,674
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_estimators
def get_estimators(positions_all, positions_relevant): """ Extracts density estimators from a judged sample of paragraph positions. Parameters ---------- positions_all : dict of (Path, float) A sample of paragraph positions from various datasets in the NTCIR-11 Math-2, and NTCIR-12 ...
python
def get_estimators(positions_all, positions_relevant): """ Extracts density estimators from a judged sample of paragraph positions. Parameters ---------- positions_all : dict of (Path, float) A sample of paragraph positions from various datasets in the NTCIR-11 Math-2, and NTCIR-12 ...
[ "def", "get_estimators", "(", "positions_all", ",", "positions_relevant", ")", ":", "samples_all", "=", "[", "(", "position", ",", ")", "for", "_", ",", "positions", "in", "positions_all", ".", "items", "(", ")", "for", "position", "in", "positions", "]", ...
Extracts density estimators from a judged sample of paragraph positions. Parameters ---------- positions_all : dict of (Path, float) A sample of paragraph positions from various datasets in the NTCIR-11 Math-2, and NTCIR-12 MathIR format. positions_relevant : dict of (Path, float) ...
[ "Extracts", "density", "estimators", "from", "a", "judged", "sample", "of", "paragraph", "positions", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L163-L192
238,675
MIR-MU/ntcir-math-density
ntcir_math_density/estimator.py
get_estimates
def get_estimates(estimators_tuple, positions, num_workers=1): """ Estimates densities, and probabilities for paragraph positions. Parameters ---------- estimators_tuple : (float, KernelDensity, KernelDensity) An estimate of the prior probability P(relevant), an estimator of the prior densi...
python
def get_estimates(estimators_tuple, positions, num_workers=1): """ Estimates densities, and probabilities for paragraph positions. Parameters ---------- estimators_tuple : (float, KernelDensity, KernelDensity) An estimate of the prior probability P(relevant), an estimator of the prior densi...
[ "def", "get_estimates", "(", "estimators_tuple", ",", "positions", ",", "num_workers", "=", "1", ")", ":", "estimators", "=", "dict", "(", ")", "estimators", "[", "\"P(relevant)\"", "]", ",", "estimators", "[", "\"p(position)\"", "]", ",", "estimators", "[", ...
Estimates densities, and probabilities for paragraph positions. Parameters ---------- estimators_tuple : (float, KernelDensity, KernelDensity) An estimate of the prior probability P(relevant), an estimator of the prior density p(position), and an estimator of the conditional density p(posit...
[ "Estimates", "densities", "and", "probabilities", "for", "paragraph", "positions", "." ]
648c74bfc5bd304603ef67da753ff25b65e829ef
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/estimator.py#L195-L236
238,676
foliant-docs/foliantcontrib.mkdocs
foliant/backends/mkdocs.py
Backend._get_build_command
def _get_build_command(self, mkdocs_site_path: Path) -> str: '''Generate ``mkdocs build`` command to build the site. :param mkdocs_site_path: Path to the output directory for the site ''' components = [self._mkdocs_config.get('mkdocs_path', 'mkdocs')] components.append('build')...
python
def _get_build_command(self, mkdocs_site_path: Path) -> str: '''Generate ``mkdocs build`` command to build the site. :param mkdocs_site_path: Path to the output directory for the site ''' components = [self._mkdocs_config.get('mkdocs_path', 'mkdocs')] components.append('build')...
[ "def", "_get_build_command", "(", "self", ",", "mkdocs_site_path", ":", "Path", ")", "->", "str", ":", "components", "=", "[", "self", ".", "_mkdocs_config", ".", "get", "(", "'mkdocs_path'", ",", "'mkdocs'", ")", "]", "components", ".", "append", "(", "'b...
Generate ``mkdocs build`` command to build the site. :param mkdocs_site_path: Path to the output directory for the site
[ "Generate", "mkdocs", "build", "command", "to", "build", "the", "site", "." ]
5f71a47139ab1cb630f1b61d4cef1c0657001272
https://github.com/foliant-docs/foliantcontrib.mkdocs/blob/5f71a47139ab1cb630f1b61d4cef1c0657001272/foliant/backends/mkdocs.py#L49-L63
238,677
foliant-docs/foliantcontrib.mkdocs
foliant/backends/mkdocs.py
Backend._get_ghp_command
def _get_ghp_command(self) -> str: '''Generate ``mkdocs gh-deploy`` command to deploy the site to GitHub Pages.''' components = [self._mkdocs_config.get('mkdocs_path', 'mkdocs')] components.append('gh-deploy') command = ' '.join(components) self.logger.debug(f'GHP upload comma...
python
def _get_ghp_command(self) -> str: '''Generate ``mkdocs gh-deploy`` command to deploy the site to GitHub Pages.''' components = [self._mkdocs_config.get('mkdocs_path', 'mkdocs')] components.append('gh-deploy') command = ' '.join(components) self.logger.debug(f'GHP upload comma...
[ "def", "_get_ghp_command", "(", "self", ")", "->", "str", ":", "components", "=", "[", "self", ".", "_mkdocs_config", ".", "get", "(", "'mkdocs_path'", ",", "'mkdocs'", ")", "]", "components", ".", "append", "(", "'gh-deploy'", ")", "command", "=", "' '", ...
Generate ``mkdocs gh-deploy`` command to deploy the site to GitHub Pages.
[ "Generate", "mkdocs", "gh", "-", "deploy", "command", "to", "deploy", "the", "site", "to", "GitHub", "Pages", "." ]
5f71a47139ab1cb630f1b61d4cef1c0657001272
https://github.com/foliant-docs/foliantcontrib.mkdocs/blob/5f71a47139ab1cb630f1b61d4cef1c0657001272/foliant/backends/mkdocs.py#L65-L75
238,678
foliant-docs/foliantcontrib.mkdocs
foliant/backends/mkdocs.py
Backend._get_page_with_optional_heading
def _get_page_with_optional_heading(self, page_file_path: str) -> str or Dict: '''Get the content of first heading of source Markdown file, if the file contains any headings. Return a data element of ``pages`` section of ``mkdocs.yml`` file. :param page_file_path: path to source Markdow...
python
def _get_page_with_optional_heading(self, page_file_path: str) -> str or Dict: '''Get the content of first heading of source Markdown file, if the file contains any headings. Return a data element of ``pages`` section of ``mkdocs.yml`` file. :param page_file_path: path to source Markdow...
[ "def", "_get_page_with_optional_heading", "(", "self", ",", "page_file_path", ":", "str", ")", "->", "str", "or", "Dict", ":", "self", ".", "logger", ".", "debug", "(", "f'Looking for the first heading in {page_file_path}'", ")", "if", "page_file_path", ".", "endswi...
Get the content of first heading of source Markdown file, if the file contains any headings. Return a data element of ``pages`` section of ``mkdocs.yml`` file. :param page_file_path: path to source Markdown file :returns: Unchanged file path or a dictionary: content of first heading, f...
[ "Get", "the", "content", "of", "first", "heading", "of", "source", "Markdown", "file", "if", "the", "file", "contains", "any", "headings", ".", "Return", "a", "data", "element", "of", "pages", "section", "of", "mkdocs", ".", "yml", "file", "." ]
5f71a47139ab1cb630f1b61d4cef1c0657001272
https://github.com/foliant-docs/foliantcontrib.mkdocs/blob/5f71a47139ab1cb630f1b61d4cef1c0657001272/foliant/backends/mkdocs.py#L77-L106
238,679
jespino/anillo
anillo/middlewares/json.py
wrap_json
def wrap_json(func=None, *, encoder=json.JSONEncoder, preserve_raw_body=False): """ A middleware that parses the body of json requests and encodes the json responses. NOTE: this middleware exists just for backward compatibility, but it has some limitations in terms of response body encoding bec...
python
def wrap_json(func=None, *, encoder=json.JSONEncoder, preserve_raw_body=False): """ A middleware that parses the body of json requests and encodes the json responses. NOTE: this middleware exists just for backward compatibility, but it has some limitations in terms of response body encoding bec...
[ "def", "wrap_json", "(", "func", "=", "None", ",", "*", ",", "encoder", "=", "json", ".", "JSONEncoder", ",", "preserve_raw_body", "=", "False", ")", ":", "if", "func", "is", "None", ":", "return", "functools", ".", "partial", "(", "wrap_json", ",", "e...
A middleware that parses the body of json requests and encodes the json responses. NOTE: this middleware exists just for backward compatibility, but it has some limitations in terms of response body encoding because it only accept list or dictionary outputs and json specification allows store other...
[ "A", "middleware", "that", "parses", "the", "body", "of", "json", "requests", "and", "encodes", "the", "json", "responses", "." ]
901a84fd2b4fa909bc06e8bd76090457990576a7
https://github.com/jespino/anillo/blob/901a84fd2b4fa909bc06e8bd76090457990576a7/anillo/middlewares/json.py#L9-L32
238,680
jespino/anillo
anillo/middlewares/json.py
wrap_json_params
def wrap_json_params(func): """ A middleware that parses the body of json requests and add it to the request under the `params` key. """ @functools.wraps(func) def wrapper(request, *args, **kwargs): ctype, pdict = parse_header(request.headers.get('Content-Type', '')) if ctype ==...
python
def wrap_json_params(func): """ A middleware that parses the body of json requests and add it to the request under the `params` key. """ @functools.wraps(func) def wrapper(request, *args, **kwargs): ctype, pdict = parse_header(request.headers.get('Content-Type', '')) if ctype ==...
[ "def", "wrap_json_params", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ctype", ",", "pdict", "=", "parse_header", "(", "request", "."...
A middleware that parses the body of json requests and add it to the request under the `params` key.
[ "A", "middleware", "that", "parses", "the", "body", "of", "json", "requests", "and", "add", "it", "to", "the", "request", "under", "the", "params", "key", "." ]
901a84fd2b4fa909bc06e8bd76090457990576a7
https://github.com/jespino/anillo/blob/901a84fd2b4fa909bc06e8bd76090457990576a7/anillo/middlewares/json.py#L60-L72
238,681
rvswift/EB
EB/builder/splitter/splitter.py
run
def run(itf): """ Run preprocess functions """ if not itf: return 1 # access command-line arguments options = SplitInput(itf) # read input infile = os.path.abspath(options.input) molList = read_csv(infile, options) # split molList into actives and decoys activeList, dec...
python
def run(itf): """ Run preprocess functions """ if not itf: return 1 # access command-line arguments options = SplitInput(itf) # read input infile = os.path.abspath(options.input) molList = read_csv(infile, options) # split molList into actives and decoys activeList, dec...
[ "def", "run", "(", "itf", ")", ":", "if", "not", "itf", ":", "return", "1", "# access command-line arguments", "options", "=", "SplitInput", "(", "itf", ")", "# read input", "infile", "=", "os", ".", "path", ".", "abspath", "(", "options", ".", "input", ...
Run preprocess functions
[ "Run", "preprocess", "functions" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L11-L34
238,682
rvswift/EB
EB/builder/splitter/splitter.py
write_csv_header
def write_csv_header(mol, csv_writer): """ Write the csv header """ # create line list where line elements for writing will be stored line = [] # ID line.append('id') # status line.append('status') # query labels queryList = mol.properties.keys() for queryLabel in queryList...
python
def write_csv_header(mol, csv_writer): """ Write the csv header """ # create line list where line elements for writing will be stored line = [] # ID line.append('id') # status line.append('status') # query labels queryList = mol.properties.keys() for queryLabel in queryList...
[ "def", "write_csv_header", "(", "mol", ",", "csv_writer", ")", ":", "# create line list where line elements for writing will be stored", "line", "=", "[", "]", "# ID", "line", ".", "append", "(", "'id'", ")", "# status", "line", ".", "append", "(", "'status'", ")"...
Write the csv header
[ "Write", "the", "csv", "header" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L37-L57
238,683
rvswift/EB
EB/builder/splitter/splitter.py
write_csv_line
def write_csv_line(mol, csv_writer, options): """ Parse mol object and write a line to the csv file """ # set variables status_field = options.status_field # elements for writing will be stored in the line list line = [] # ID id = mol.GetProp('id') if id is not None: line.ap...
python
def write_csv_line(mol, csv_writer, options): """ Parse mol object and write a line to the csv file """ # set variables status_field = options.status_field # elements for writing will be stored in the line list line = [] # ID id = mol.GetProp('id') if id is not None: line.ap...
[ "def", "write_csv_line", "(", "mol", ",", "csv_writer", ",", "options", ")", ":", "# set variables", "status_field", "=", "options", ".", "status_field", "# elements for writing will be stored in the line list", "line", "=", "[", "]", "# ID", "id", "=", "mol", ".", ...
Parse mol object and write a line to the csv file
[ "Parse", "mol", "object", "and", "write", "a", "line", "to", "the", "csv", "file" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L60-L87
238,684
rvswift/EB
EB/builder/splitter/splitter.py
csv_writer
def csv_writer(molecules, options, prefix): """ Write a csv file. """ # output file outdir = os.getcwd() filename = prefix + '.csv' outfile = os.path.join(outdir, filename) # initiate csv writer object f = open(outfile, 'w') csv_writer = csv.writer(f) # write csv header mol ...
python
def csv_writer(molecules, options, prefix): """ Write a csv file. """ # output file outdir = os.getcwd() filename = prefix + '.csv' outfile = os.path.join(outdir, filename) # initiate csv writer object f = open(outfile, 'w') csv_writer = csv.writer(f) # write csv header mol ...
[ "def", "csv_writer", "(", "molecules", ",", "options", ",", "prefix", ")", ":", "# output file", "outdir", "=", "os", ".", "getcwd", "(", ")", "filename", "=", "prefix", "+", "'.csv'", "outfile", "=", "os", ".", "path", ".", "join", "(", "outdir", ",",...
Write a csv file.
[ "Write", "a", "csv", "file", "." ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L90-L113
238,685
rvswift/EB
EB/builder/splitter/splitter.py
split
def split(activeList, decoyList, options): """ Create training and validation sets """ # set input variables training_fraction = options.training_fraction decoy_to_active = options.decoy_to_active # take care of default decoy_to_active ratio if decoy_to_active is None: decoy_to_activ...
python
def split(activeList, decoyList, options): """ Create training and validation sets """ # set input variables training_fraction = options.training_fraction decoy_to_active = options.decoy_to_active # take care of default decoy_to_active ratio if decoy_to_active is None: decoy_to_activ...
[ "def", "split", "(", "activeList", ",", "decoyList", ",", "options", ")", ":", "# set input variables", "training_fraction", "=", "options", ".", "training_fraction", "decoy_to_active", "=", "options", ".", "decoy_to_active", "# take care of default decoy_to_active ratio", ...
Create training and validation sets
[ "Create", "training", "and", "validation", "sets" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L116-L163
238,686
rvswift/EB
EB/builder/splitter/splitter.py
partition
def partition(molList, options): """ Partition molList into activeList and decoyList """ # set input variables status_field = options.status_field active_label = options.active_label decoy_label = options.decoy_label # initiate lists activeList = [] decoyList = [] # partition moL...
python
def partition(molList, options): """ Partition molList into activeList and decoyList """ # set input variables status_field = options.status_field active_label = options.active_label decoy_label = options.decoy_label # initiate lists activeList = [] decoyList = [] # partition moL...
[ "def", "partition", "(", "molList", ",", "options", ")", ":", "# set input variables", "status_field", "=", "options", ".", "status_field", "active_label", "=", "options", ".", "active_label", "decoy_label", "=", "options", ".", "decoy_label", "# initiate lists", "a...
Partition molList into activeList and decoyList
[ "Partition", "molList", "into", "activeList", "and", "decoyList" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L166-L187
238,687
rvswift/EB
EB/builder/splitter/splitter.py
read_csv
def read_csv(csvfile, options): """ Read csv and return molList, a list of mol objects """ # open file or exit name, ext = os.path.splitext(csvfile) try: if ext == '.gz': f = gzip.open(csvfile, 'rb') else: f = open(csvfile, 'rU') except IOError: pri...
python
def read_csv(csvfile, options): """ Read csv and return molList, a list of mol objects """ # open file or exit name, ext = os.path.splitext(csvfile) try: if ext == '.gz': f = gzip.open(csvfile, 'rb') else: f = open(csvfile, 'rU') except IOError: pri...
[ "def", "read_csv", "(", "csvfile", ",", "options", ")", ":", "# open file or exit", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "csvfile", ")", "try", ":", "if", "ext", "==", "'.gz'", ":", "f", "=", "gzip", ".", "open", "(", "...
Read csv and return molList, a list of mol objects
[ "Read", "csv", "and", "return", "molList", "a", "list", "of", "mol", "objects" ]
341880b79faf8147dc9fa6e90438531cd09fabcc
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter.py#L190-L230
238,688
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command_internals.py
InputHeader.read
def read(self, input_file): """ Reads an InputHeader from `input_file`. The input header is read as a sequence of *<key>***:***<value>* pairs separated by a newline. The end of the input header is signalled by an empty line or an end-of-file. :param input_file: File-like object...
python
def read(self, input_file): """ Reads an InputHeader from `input_file`. The input header is read as a sequence of *<key>***:***<value>* pairs separated by a newline. The end of the input header is signalled by an empty line or an end-of-file. :param input_file: File-like object...
[ "def", "read", "(", "self", ",", "input_file", ")", ":", "key", ",", "value", "=", "None", ",", "None", "import", "sys", "for", "line", "in", "input_file", ":", "if", "line", "==", "'\\n'", ":", "break", "if", "line", "[", "-", "1", ":", "]", "==...
Reads an InputHeader from `input_file`. The input header is read as a sequence of *<key>***:***<value>* pairs separated by a newline. The end of the input header is signalled by an empty line or an end-of-file. :param input_file: File-like object that supports iteration over lines
[ "Reads", "an", "InputHeader", "from", "input_file", "." ]
433886e52698f0ddb9956f087b76041966c3bcd1
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command_internals.py#L110-L137
238,689
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command_internals.py
MessagesHeader.write
def write(self, output_file): """ Writes this MessageHeader to an output stream. Messages are written as a sequence of *<message_text-message_level>***=** *<message_text-text>* pairs separated by '\r\n'. The sequence is terminated by a pair of '\r\n' sequences. """ for ...
python
def write(self, output_file): """ Writes this MessageHeader to an output stream. Messages are written as a sequence of *<message_text-message_level>***=** *<message_text-text>* pairs separated by '\r\n'. The sequence is terminated by a pair of '\r\n' sequences. """ for ...
[ "def", "write", "(", "self", ",", "output_file", ")", ":", "for", "message_level", ",", "message_text", "in", "self", ":", "output_file", ".", "write", "(", "'%s=%s\\r\\n'", "%", "(", "message_level", ",", "message_text", ")", ")", "output_file", ".", "write...
Writes this MessageHeader to an output stream. Messages are written as a sequence of *<message_text-message_level>***=** *<message_text-text>* pairs separated by '\r\n'. The sequence is terminated by a pair of '\r\n' sequences.
[ "Writes", "this", "MessageHeader", "to", "an", "output", "stream", "." ]
433886e52698f0ddb9956f087b76041966c3bcd1
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command_internals.py#L189-L199
238,690
emilydolson/avida-spatial-tools
avidaspatial/cell_picker.py
cell_picker.callback
def callback(self, event): """ Selects cells on click. """ self.init_width() if len(self.initial) > 0: for cell in self.initial: self.color_square(cell[0], cell[1], True) self.initial = [] self.begin_drag = event self.color...
python
def callback(self, event): """ Selects cells on click. """ self.init_width() if len(self.initial) > 0: for cell in self.initial: self.color_square(cell[0], cell[1], True) self.initial = [] self.begin_drag = event self.color...
[ "def", "callback", "(", "self", ",", "event", ")", ":", "self", ".", "init_width", "(", ")", "if", "len", "(", "self", ".", "initial", ")", ">", "0", ":", "for", "cell", "in", "self", ".", "initial", ":", "self", ".", "color_square", "(", "cell", ...
Selects cells on click.
[ "Selects", "cells", "on", "click", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/cell_picker.py#L56-L67
238,691
emilydolson/avida-spatial-tools
avidaspatial/cell_picker.py
cell_picker.init_width
def init_width(self): """ Get rectangle diameters """ self.col_width = self.c.winfo_width()/self.cols self.row_height = self.c.winfo_height()/self.rows
python
def init_width(self): """ Get rectangle diameters """ self.col_width = self.c.winfo_width()/self.cols self.row_height = self.c.winfo_height()/self.rows
[ "def", "init_width", "(", "self", ")", ":", "self", ".", "col_width", "=", "self", ".", "c", ".", "winfo_width", "(", ")", "/", "self", ".", "cols", "self", ".", "row_height", "=", "self", ".", "c", ".", "winfo_height", "(", ")", "/", "self", ".", ...
Get rectangle diameters
[ "Get", "rectangle", "diameters" ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/cell_picker.py#L69-L74
238,692
emilydolson/avida-spatial-tools
avidaspatial/cell_picker.py
cell_picker.color_square
def color_square(self, x, y, unit_coords=False): """ Handles actually coloring the squares """ # Calculate column and row number if unit_coords: col = x row = y else: col = x//self.col_width row = y//self.row_height ...
python
def color_square(self, x, y, unit_coords=False): """ Handles actually coloring the squares """ # Calculate column and row number if unit_coords: col = x row = y else: col = x//self.col_width row = y//self.row_height ...
[ "def", "color_square", "(", "self", ",", "x", ",", "y", ",", "unit_coords", "=", "False", ")", ":", "# Calculate column and row number", "if", "unit_coords", ":", "col", "=", "x", "row", "=", "y", "else", ":", "col", "=", "x", "//", "self", ".", "col_w...
Handles actually coloring the squares
[ "Handles", "actually", "coloring", "the", "squares" ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/cell_picker.py#L76-L102
238,693
emilydolson/avida-spatial-tools
avidaspatial/cell_picker.py
cell_picker.dragend
def dragend(self, event): """ Handles the end of a drag action. """ x_range = [self.begin_drag.x//self.col_width, event.x//self.col_width] y_range = [self.begin_drag.y//self.row_height, event.y//self.row_height] # Check bounds for i in range(2)...
python
def dragend(self, event): """ Handles the end of a drag action. """ x_range = [self.begin_drag.x//self.col_width, event.x//self.col_width] y_range = [self.begin_drag.y//self.row_height, event.y//self.row_height] # Check bounds for i in range(2)...
[ "def", "dragend", "(", "self", ",", "event", ")", ":", "x_range", "=", "[", "self", ".", "begin_drag", ".", "x", "//", "self", ".", "col_width", ",", "event", ".", "x", "//", "self", ".", "col_width", "]", "y_range", "=", "[", "self", ".", "begin_d...
Handles the end of a drag action.
[ "Handles", "the", "end", "of", "a", "drag", "action", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/cell_picker.py#L110-L134
238,694
Bystroushaak/pyDHTMLParser
src/dhtmlparser/specialdict.py
_lower_if_str
def _lower_if_str(item): """ Try to convert item to lowercase, if it is string. Args: item (obj): Str, unicode or any other object. Returns: obj: ``item.lower()`` if `item` is ``str`` or ``unicode``, else just \ `item` itself. """ # python 2 / 3 shill try: ...
python
def _lower_if_str(item): """ Try to convert item to lowercase, if it is string. Args: item (obj): Str, unicode or any other object. Returns: obj: ``item.lower()`` if `item` is ``str`` or ``unicode``, else just \ `item` itself. """ # python 2 / 3 shill try: ...
[ "def", "_lower_if_str", "(", "item", ")", ":", "# python 2 / 3 shill", "try", ":", "string_type", "=", "basestring", "except", "NameError", ":", "string_type", "=", "str", "if", "isinstance", "(", "item", ",", "string_type", ")", ":", "return", "item", ".", ...
Try to convert item to lowercase, if it is string. Args: item (obj): Str, unicode or any other object. Returns: obj: ``item.lower()`` if `item` is ``str`` or ``unicode``, else just \ `item` itself.
[ "Try", "to", "convert", "item", "to", "lowercase", "if", "it", "is", "string", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/specialdict.py#L11-L31
238,695
rosenbrockc/ci
pyci/utility.py
get_repo_relpath
def get_repo_relpath(repo, relpath): """Returns the absolute path to the 'relpath' taken relative to the base directory of the repository. """ from os import path if relpath[0:2] == "./": return path.join(repo, relpath[2::]) else: from os import chdir, getcwd cd = getcwd(...
python
def get_repo_relpath(repo, relpath): """Returns the absolute path to the 'relpath' taken relative to the base directory of the repository. """ from os import path if relpath[0:2] == "./": return path.join(repo, relpath[2::]) else: from os import chdir, getcwd cd = getcwd(...
[ "def", "get_repo_relpath", "(", "repo", ",", "relpath", ")", ":", "from", "os", "import", "path", "if", "relpath", "[", "0", ":", "2", "]", "==", "\"./\"", ":", "return", "path", ".", "join", "(", "repo", ",", "relpath", "[", "2", ":", ":", "]", ...
Returns the absolute path to the 'relpath' taken relative to the base directory of the repository.
[ "Returns", "the", "absolute", "path", "to", "the", "relpath", "taken", "relative", "to", "the", "base", "directory", "of", "the", "repository", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/utility.py#L18-L31
238,696
rosenbrockc/ci
pyci/utility.py
load_with_datetime
def load_with_datetime(pairs): """Deserialize JSON into python datetime objects.""" d = {} for k, v in pairs: if isinstance(v, basestring): try: d[k] = dateutil.parser.parse(v) except ValueError: d[k] = v else: d[k] = v ...
python
def load_with_datetime(pairs): """Deserialize JSON into python datetime objects.""" d = {} for k, v in pairs: if isinstance(v, basestring): try: d[k] = dateutil.parser.parse(v) except ValueError: d[k] = v else: d[k] = v ...
[ "def", "load_with_datetime", "(", "pairs", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "pairs", ":", "if", "isinstance", "(", "v", ",", "basestring", ")", ":", "try", ":", "d", "[", "k", "]", "=", "dateutil", ".", "parser", ".", "...
Deserialize JSON into python datetime objects.
[ "Deserialize", "JSON", "into", "python", "datetime", "objects", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/utility.py#L34-L45
238,697
rosenbrockc/ci
pyci/utility.py
get_json
def get_json(jsonpath, default): """Returns the JSON serialized object at the specified path, or the default if it doesn't exist or can't be deserialized. """ from os import path import json result = default if path.isfile(jsonpath): try: with open(jsonpath) as f: ...
python
def get_json(jsonpath, default): """Returns the JSON serialized object at the specified path, or the default if it doesn't exist or can't be deserialized. """ from os import path import json result = default if path.isfile(jsonpath): try: with open(jsonpath) as f: ...
[ "def", "get_json", "(", "jsonpath", ",", "default", ")", ":", "from", "os", "import", "path", "import", "json", "result", "=", "default", "if", "path", ".", "isfile", "(", "jsonpath", ")", ":", "try", ":", "with", "open", "(", "jsonpath", ")", "as", ...
Returns the JSON serialized object at the specified path, or the default if it doesn't exist or can't be deserialized.
[ "Returns", "the", "JSON", "serialized", "object", "at", "the", "specified", "path", "or", "the", "default", "if", "it", "doesn", "t", "exist", "or", "can", "t", "be", "deserialized", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/utility.py#L47-L63
238,698
rosenbrockc/ci
pyci/utility.py
run_exec
def run_exec(repodir, command, output, index): """Runs the specified command in the repo directory. :arg repodir: the absolute path of the repo directory to run 'command' in. :arg command: what to run in the 'repodir'. Should be valid in the context of the $PATH variable. :arg output: the multipr...
python
def run_exec(repodir, command, output, index): """Runs the specified command in the repo directory. :arg repodir: the absolute path of the repo directory to run 'command' in. :arg command: what to run in the 'repodir'. Should be valid in the context of the $PATH variable. :arg output: the multipr...
[ "def", "run_exec", "(", "repodir", ",", "command", ",", "output", ",", "index", ")", ":", "from", "os", "import", "path", "from", "subprocess", "import", "Popen", ",", "PIPE", "from", "datetime", "import", "datetime", "child", "=", "Popen", "(", "\"cd {}; ...
Runs the specified command in the repo directory. :arg repodir: the absolute path of the repo directory to run 'command' in. :arg command: what to run in the 'repodir'. Should be valid in the context of the $PATH variable. :arg output: the multiprocessing queue to push the results to. :arg index:...
[ "Runs", "the", "specified", "command", "in", "the", "repo", "directory", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/utility.py#L72-L90
238,699
mikicz/arca
arca/utils.py
load_class
def load_class(location: str) -> type: """ Loads a class from a string and returns it. >>> from arca.utils import load_class >>> load_class("arca.backend.BaseBackend") <class 'arca.backend.base.BaseBackend'> :raise ArcaMisconfigured: If the class can't be loaded. """ module_name, _, class_...
python
def load_class(location: str) -> type: """ Loads a class from a string and returns it. >>> from arca.utils import load_class >>> load_class("arca.backend.BaseBackend") <class 'arca.backend.base.BaseBackend'> :raise ArcaMisconfigured: If the class can't be loaded. """ module_name, _, class_...
[ "def", "load_class", "(", "location", ":", "str", ")", "->", "type", ":", "module_name", ",", "_", ",", "class_name", "=", "location", ".", "rpartition", "(", "\".\"", ")", "if", "not", "module_name", ":", "raise", "ArcaMisconfigured", "(", "f\"The module is...
Loads a class from a string and returns it. >>> from arca.utils import load_class >>> load_class("arca.backend.BaseBackend") <class 'arca.backend.base.BaseBackend'> :raise ArcaMisconfigured: If the class can't be loaded.
[ "Loads", "a", "class", "from", "a", "string", "and", "returns", "it", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/utils.py#L25-L45