This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_tiled_row_height(row_width, space_width, num_images, sum_aspect) | |
""" | |
Calculate the height required for a row of tiled images based on the row width, | |
space between images, number of images and sum of aspect ratios of images. | |
""" | |
return (row_width - (num_images - 1) * space_width) / float(sum_aspect) | |
def get_image_rows(image_iter, row_width, row_min_aspect, space_width): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal(object): | |
def __new__(cls, common_name, *args, **kwargs): | |
for subclass in cls.__subclasses__(): | |
if subclass.common_name == common_name: | |
return object.__new__(subclass, *args, **kwargs) | |
raise ValueError('No animal species matched for common name "{}"'.format(common_name)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main SonarQube project information | |
sonar.projectKey=com.example:some-project | |
sonar.projectName=some-project | |
sonar.projectVersion=0.0.1 | |
# Source is everything minus typical django project and venv/ (CI server) | |
sonar.sources=. | |
sonar.exclusions=manage.py,tracker/**,apps/**/migrations/**,static/libs/**,venv/** | |
# Report paths (test results and coverage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SonarQube continuous inspection scanner | |
include: | |
- core.unzip | |
sonar-scanner-download: | |
cmd.run: | |
- name: curl -L https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.5.zip -o {{ pillar['auth']['home'] }}/sonar-scanner-2.5.zip | |
- creates: {{ pillar['auth']['home'] }}/sonar-scanner-2.5.zip |