-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from barseghyanartur/dev
Dev
- Loading branch information
Showing
149 changed files
with
3,831 additions
and
2,305 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/** | ||
* Python Sphinx RTD theme for PrismJs. | ||
* | ||
* The original sphinx-rtd-theme (https://github.com/readthedocs/sphinx_rtd_theme). | ||
* | ||
* Adapted from PrismJS prism-themes (https://github.com/PrismJS/prism-themes), | ||
* specifically prism-gruvbox-light.css theme. | ||
* | ||
* @author Artur Barseghyan (https://github.com/barseghyanartur) | ||
* @version 1.0 | ||
*/ | ||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: #3c3836; | ||
font-family: Consolas, Monaco, "Andale Mono", monospace; | ||
direction: ltr; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
line-height: 1.5; | ||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
} | ||
|
||
pre[class*="language-"]::-moz-selection, | ||
pre[class*="language-"] ::-moz-selection, | ||
code[class*="language-"]::-moz-selection, | ||
code[class*="language-"] ::-moz-selection { | ||
color: #282828; | ||
background: #a89984; | ||
} | ||
|
||
pre[class*="language-"]::selection, | ||
pre[class*="language-"] ::selection, | ||
code[class*="language-"]::selection, | ||
code[class*="language-"] ::selection { | ||
color: #282828; | ||
background: #a89984; | ||
} | ||
|
||
/* Code blocks */ | ||
pre[class*="language-"] { | ||
padding: 1em; | ||
margin: 0.5em 0; | ||
overflow: auto; | ||
} | ||
|
||
:not(pre) > code[class*="language-"], | ||
pre[class*="language-"] { | ||
background: #eeffcc; | ||
border: none !important; | ||
box-shadow: none !important; | ||
} | ||
|
||
/* Inline code */ | ||
:not(pre) > code[class*="language-"] { | ||
padding: 0.1em; | ||
border-radius: 0.3em; | ||
} | ||
|
||
.token.comment { | ||
font-style: italic; | ||
} | ||
|
||
.token.comment, | ||
.token.prolog, | ||
.token.cdata { | ||
color: #7c6f64; | ||
} | ||
|
||
.token.keyword { | ||
color: #007020; | ||
font-weight: bold; | ||
} | ||
|
||
.token.delimiter, | ||
.token.boolean, | ||
.token.selector, | ||
.token.important, | ||
.token.atrule { | ||
color: #9d0006; | ||
} | ||
|
||
.token.operator, | ||
.token.punctuation, | ||
.token.attr-name { | ||
color: #7c6f64; | ||
background-color: #eeffcc; | ||
} | ||
|
||
.token.tag, | ||
.token.tag .punctuation, | ||
.token.doctype, | ||
.token.builtin { | ||
color: #b57614; | ||
} | ||
|
||
.token.entity, | ||
.token.number, | ||
.token.symbol { | ||
color: #8f3f71; | ||
} | ||
|
||
.token.property, | ||
.token.constant, | ||
.token.variable { | ||
color: #9d0006; | ||
} | ||
|
||
.token.string { | ||
color: #4070a0; | ||
} | ||
|
||
.token.char { | ||
color: #797403; | ||
} | ||
|
||
.token.attr-value, | ||
.token.attr-value .punctuation { | ||
color: #7c6f64; | ||
} | ||
|
||
.token.url { | ||
color: #797403; | ||
text-decoration: underline; | ||
} | ||
|
||
.token.function { | ||
color: #b57614; | ||
} | ||
|
||
.token.regex { | ||
background: #797403; | ||
} | ||
|
||
.token.bold { | ||
font-weight: bold; | ||
} | ||
|
||
.token.italic { | ||
font-style: italic; | ||
} | ||
|
||
.token.inserted { | ||
background: #7c6f64; | ||
} | ||
|
||
.token.deleted { | ||
background: #9d0006; | ||
} | ||
|
||
/* Additional overrides */ | ||
.rst-content code, | ||
.rst-content tt, | ||
code { | ||
border: none; | ||
} | ||
|
||
pre[class*="language-"] { | ||
border: 1px solid #e1e4e5!important; | ||
} | ||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
font-size: 12px; | ||
} | ||
|
||
pre[class*="language-"] > code:first-child { | ||
margin: 0!important; | ||
padding: 0!important; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Required imports | ||
from faker import Faker | ||
from faker_file.providers.docx_file import DocxFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(DocxFileProvider) # Register DocxFileProvider | ||
|
||
# Generate DOCX file | ||
docx_file = FAKER.docx_file() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Required imports | ||
from faker import Faker | ||
from faker_file.providers.docx_file import DocxFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(DocxFileProvider) # Register DocxFileProvider | ||
|
||
# Generate DOCX file of 20,000 characters | ||
docx_file = FAKER.docx_file(max_nb_chars=20_000) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Required imports | ||
from faker import Faker | ||
from faker_file.providers.docx_file import DocxFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(DocxFileProvider) # Register DocxFileProvider | ||
|
||
# Generate DOCX file, wrapping each line after 80 characters | ||
docx_file = FAKER.docx_file(wrap_chars_after=80) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Required imports | ||
from faker import Faker | ||
from faker_file.base import DynamicTemplate | ||
from faker_file.contrib.docx_file import ( | ||
add_page_break, | ||
add_paragraph, | ||
add_picture, | ||
add_table, | ||
) | ||
from faker_file.providers.docx_file import DocxFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(DocxFileProvider) # Register DocxFileProvider | ||
|
||
# Create a DOCX file with paragraph, picture, table and manual page breaks | ||
# in between the mentioned elements. The ``DynamicTemplate`` simply | ||
# accepts a list of callables (such as ``add_paragraph``, | ||
# ``add_page_break``) and dictionary to be later on fed to the callables | ||
# as keyword arguments for customising the default values. | ||
docx_file = FAKER.docx_file( | ||
content=DynamicTemplate( | ||
[ | ||
(add_paragraph, {}), # Add paragraph | ||
(add_page_break, {}), # Add page break | ||
(add_picture, {}), # Add picture | ||
(add_page_break, {}), # Add page break | ||
(add_table, {}), # Add table | ||
(add_page_break, {}), # Add page break | ||
] | ||
) | ||
) | ||
|
||
# You could make the list as long as you like or simply multiply for | ||
# easier repetition as follows: | ||
docx_file = FAKER.docx_file( | ||
content=DynamicTemplate( | ||
[ | ||
(add_paragraph, {}), # Add paragraph | ||
(add_page_break, {}), # Add page break | ||
(add_picture, {}), # Add picture | ||
(add_page_break, {}), # Add page break | ||
(add_table, {}), # Add table | ||
(add_page_break, {}), # Add page break | ||
] | ||
* 5 # Will repeat your config 5 times | ||
) | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from faker import Faker | ||
from faker_file.providers.augment_image_from_path import ( | ||
AugmentImageFromPathProvider, | ||
) | ||
from faker_file.providers.augment_random_image_from_dir import ( | ||
AugmentRandomImageFromDirProvider, | ||
) | ||
from faker_file.providers.image.augment import ( | ||
add_brightness, | ||
decrease_contrast, | ||
flip_horizontal, | ||
flip_vertical, | ||
resize_height, | ||
resize_width, | ||
) | ||
from faker_file.providers.png_file import GraphicPngFileProvider | ||
|
||
FAKER = Faker() | ||
FAKER.add_provider(AugmentImageFromPathProvider) | ||
FAKER.add_provider(AugmentRandomImageFromDirProvider) | ||
FAKER.add_provider(GraphicPngFileProvider) | ||
|
||
# Create a couple of graphic images to augment later on. | ||
FAKER.graphic_png_file(basename="01") # One named 01.png | ||
# And 5 more with random names. | ||
for __ in range(5): | ||
FAKER.graphic_png_file() | ||
|
||
# We assumed that directory "/tmp/tmp/" exists and contains | ||
# image files, among which "01.png". Augmentations will be applied | ||
# sequentially, one by one until all fulfilled. If you wish to apply only | ||
# a random number of augmentations, but not all, pass the `num_steps` | ||
# argument, with value less than the number of `augmentations` provided. | ||
augmented_image_file = FAKER.augment_image_from_path( | ||
path="/tmp/tmp/01.png", | ||
augmentations=[ | ||
(flip_horizontal, {}), | ||
(flip_vertical, {}), | ||
(decrease_contrast, {}), | ||
(add_brightness, {}), | ||
(resize_width, {"lower": 0.9, "upper": 1.1}), | ||
(resize_height, {"lower": 0.9, "upper": 1.1}), | ||
], | ||
prefix="augmented_image_01_", | ||
# num_steps=3, | ||
) | ||
|
||
augmented_random_image_file = FAKER.augment_random_image_from_dir( | ||
source_dir_path="/tmp/tmp/", | ||
augmentations=[ | ||
(flip_horizontal, {}), | ||
(flip_vertical, {}), | ||
(decrease_contrast, {}), | ||
(add_brightness, {}), | ||
(resize_width, {"lower": 0.9, "upper": 1.1}), | ||
(resize_height, {"lower": 0.9, "upper": 1.1}), | ||
], | ||
prefix="augmented_random_image_", | ||
# num_steps=3, | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from faker import Faker | ||
from faker_file.providers.image.imgkit_generator import ImgkitImageGenerator | ||
from faker_file.providers.png_file import PngFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(PngFileProvider) # Register PngFileProvider | ||
|
||
# Generate PNG file using `imgkit` | ||
pdf_file = FAKER.png_file(image_generator_cls=ImgkitImageGenerator) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from faker import Faker | ||
from faker_file.providers.image.imgkit_generator import ImgkitImageGenerator | ||
from faker_file.providers.png_file import PngFileProvider | ||
|
||
FAKER = Faker() # Initialize Faker | ||
FAKER.add_provider(PngFileProvider) # Register PngFileProvider | ||
|
||
# Generate an image file, wrapping each line after 80 characters | ||
png_file = FAKER.png_file( | ||
image_generator_cls=ImgkitImageGenerator, wrap_chars_after=80 | ||
) |
Oops, something went wrong.