text:
permalink: /pyneng-resources/
title: Ресурсы по Python
comments: true
share: true
tags:
 - pyneng
 - links
category:
 - pyneng
toc: true
---

> [Resources in English](https://natenka.github.io/pyneng-resources-en/)

# Python для сетевых инженеров

## Курсы

Бесплатные курсы:

* [Бесплатный email курс 'Python for network engineers' от Kirk Byers](https://pynet.twb-tech.com/email-signup.html)
* [GNS3 Talks. Python Programming for Network Engineers](https://www.youtube.com/playlist?list=PLhfrWIlLOoKPn7T9FtvbOWX8GxgsFFNwn)
* [Курсы на Cisco DevNet](https://learninglabs.cisco.com/)
* [Network programmability basics](https://developer.cisco.com/video/net-prog-basics)

Nicholas Russo:

* [Automating Networks with Python](https://www.pluralsight.com/courses/automating-networks-python)
* [Automating Networks with Ansible the Right Way](https://www.pluralsight.com/courses/automating-networks-ansible-right-way)

John McGovern:

* [Introduction to Python for Network Engineers](https://www.cbtnuggets.com/it-training/python/network-engineers-intro)
* [Advanced Network Automation with Cisco and Python. CBT Nuggets](https://www.cbtnuggets.com/it-training/networking/network-automation-cisco-python)

Kirk Byers:

* [Python for Network Engineers](https://pynet.twb-tech.com/class.html)
* [Ansible](https://pynet.twb-tech.com/class-ansible.html)

GNS3 Academy:

* [Python Network Programming - Part 1: Build 7 Python Apps](http://academy.gns3.com/p/python-programming-for-real-life-networking-use)
* [Ansible for Network Engineers: Quick Start with GNS3, Ansible and Network Automation](http://academy.gns3.com/p/ansible-for-network-engineers-gns3-ansible-cisco-network-automation/)
* [Network Programmability and Network Automation using GNS3 and Python](http://academy.gns3.com/p/python-programming-for-network-engineers)
* [Другие курсы по Python GNS3 academy](http://academy.gns3.com/courses?query=python)

Udemy:

* [Python Network Programming - Part 1: Build 7 Python Apps](https://www.udemy.com/python-programming-for-real-life-networking-use/)
* [Python Network Programming - Part 2: Multivendor Environment](https://www.udemy.com/python-network-programming-multivendor/)
* [Python Programming For Network Engineers](https://www.udemy.com/python-programming-for-network-engineers/)
* [Python for Network Engineers: Netmiko, NAPALM, pyntc, Telnet](https://www.udemy.com/python-for-network-engineers-netmiko-napalm-pyntc-telnet-ssh-automate/)
* [Python Programming for Network Engineers: Cisco, Netmiko ++](https://www.udemy.com/python-programming-for-cisco-network-engineers/)

Ivan Pepelnjak:

* [Network automation webinars](http://www.ipspace.net/Roadmap/Network_Automation_webinars)
* [Ansible for Networking Engineers](http://www.ipspace.net/Ansible_for_Networking_Engineers)

Rick Donato (Packet Coders):

* [Network Configuration with Scrapli](https://www.packetcoders.io/network-configuration-with-scrapli/)
* [Network Configuration with Netmiko](https://www.packetcoders.io/network-configuration-with-netmiko/)

Другие:

* [INE Python courses](https://my.ine.com/search?query=python&learningArea=Networking)
* [Курсы от Network to Code](http://networktocode.com/products/training/)
* [Network Automation using Python for Engineers (ehacking academy)](http://academy.ehacking.net/p/network-automation-python-engineers)

## Книги

* [(ru) Python для сетевых инженеров (Наташа Самойленко)](https://natenka.gitbook.io/pyneng/)
* [Mastering Python Networking (Eric Chou)](https://www.packtpub.com/networking-and-servers/mastering-python-networking)
* [Network Programmability and Automation. Skills for the Next-Generation Network Engineer](http://shop.oreilly.com/product/0636920042082.do). Книга есть в переводе
* [Network Automation at Scale](https://www.cloudflare.com/media/pdf/network-automation-at-scale.pdf)

## Live Stream, Youtube

* [Network programmability, automation and Python. Dmitry Figol](https://www.twitch.tv/dmfigol)

YouTube каналы:

* [Dmitry Figol](https://www.youtube.com/channel/UCS8yWZCX-fdxft8yFAffZCg)

## Проекты

* [Ansible](https://www.ansible.com/)
* [CiscoConfParse](https://github.com/mpenning/ciscoconfparse)
* [eNMS](https://github.com/afourmy/eNMS)
* [NAPALM](https://github.com/napalm-automation/napalm)
* [NetBox](https://netbox.readthedocs.io/en/stable/)
* [netdev](https://github.com/selfuryon/netdev)
* [NetworkX](https://github.com/networkx/networkx)
* [NOC Project](https://kb.nocproject.org/display/SITE/NOC)
* [Nornir](https://github.com/nornir-automation/nornir)
* [Requests](https://github.com/kennethreitz/requests)
* [SaltStack](https://saltstack.com/)
* [Scapy](https://github.com/secdev/scapy)
* [Scrapli](https://github.com/carlmontanari/scrapli)
* [StackStorm](https://stackstorm.com/)

## Полезные модули Python

* [argparse](https://docs.python.org/3/library/argparse.html)
* [getpass](https://docs.python.org/3/library/getpass.html)
* [ipaddress](https://docs.python.org/3/library/ipaddress.html)
* [Jinja2](http://jinja.pocoo.org/docs/2.9/)
* [netmiko](https://github.com/ktbyers/netmiko)
* [paramiko](http://docs.paramiko.org/)
* [pexpect](https://pexpect.readthedocs.io/en/stable/index.html)
* [pyserial](https://pythonhosted.org/pyserial/)
* [pysnmp](http://pysnmp.sourceforge.net/)
* [subprocess](https://docs.python.org/3/library/subprocess.html)
* [telnetlib](https://docs.python.org/3/library/telnetlib.html)
* [TextFSM](https://github.com/google/textfsm/wiki)
* [concurrent.futures](https://docs.python.org/3.6/library/concurrent.futures.html)

## Slack

* [Network to code](https://networktocode.herokuapp.com/) - отличное сообщество в slack, где обсуждается всё, что касается программирования и автоматизации в сетях
* [(ru) PyNEng](https://join.slack.com/t/pyneng/shared_invite/enQtNzkyNTYwOTU5Njk5LWE4OGNjMmM1ZTlkNWQ0N2RhODExZDA0OTNhNDJjZDZlOTZhOGRiMzIyZjBhZWYzYzc3MTg3ZmQzODllYmQ4OWU) - русскоязычное сообщество по тем же темам

# Ресурсы по Python без привязки к сетевому оборудованию

* [The Hitchhiker's Guide to Python!](http://docs.python-guide.org/en/latest/) - отличное руководство в котором есть рекомендации, описание доступных проектов, библиотек и модулей по разным темам.
  * [Подборка ресурсов по изучению Python](http://docs.python-guide.org/en/latest/intro/learning/)
* [Best Python Resources](https://www.fullstackpython.com/best-python-resources.html) - подборка ссылок на хорошие ресурсы по Python
* [PEP 8 — the Style Guide for Python Code](http://pep8.org/) - красивый вариант PEP8

## Курсы

### Бесплатные курсы:

* [(ru) Code Basics от Hexlet](https://ru.code-basics.com/languages/python)
* [(ru) Программирование на Python](https://stepik.org/course/%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BD%D0%B0-Python-67) - хороший русскоязычный курс по основам Python
* [MITx - 6.00.1x Introduction to Computer Science and Programming Using Python](https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-9) - очень хороший курс, много практических заданий, достаточно интенсивный (англ)
* [Python: основы и применение](https://stepik.org/course/512/promo)
* [(ru) Python от Computer Science Center](https://www.youtube.com/playlist?list=PLlb7e2G7aSpTTNp7HBYzCBByaE1h54ruW) - отличные видеолекции по Python
* [Google's Python Class](https://developers.google.com/edu/python/?csw=1) - курс по основам Python от Google (англ)
* [(ru) Курс языка Python и базовых алгоритмов и структур данных](https://github.com/Yorko/python_intro)

### Платные курсы:

* [#100DaysOfCode in Python](https://training.talkpython.fm/courses/explore_100days_in_python/100-days-of-code-in-python)
* [Write Pythonic Code Like a Seasoned Developer](https://training.talkpython.fm/courses/explore_pythonic_code/write-pythonic-code-like-a-seasoned-developer)

## Книги:

Основы:

* [Think Python](https://greenteapress.com/wp/think-python-2e/) - хорошая книга по основам Python. В книге есть задания.
* [Python Crash Course: A Hands-On, Project-Based Introduction to Programming](https://www.amazon.com/Python-Crash-Course-Hands-Project-Based-ebook/dp/B018UXJ9RI/) - книга по основам Python. Половина книги посвящена "стандартному" описанию основ Python, а во второй половине эти основы используются для проектов. В книге есть задания.
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com/). [На русском](https://www.ozon.ru/context/detail/id/137673590/) -  в этой книге можно найти много идей по автоматизации ежедневной работы. Тут рассматриваются такие темы: работа с файлами PDF, Excel, Word, отправка писем, работа с картинками, работа в веб

Среднего/продвинутого уровня:

* [Python Tricks](https://www.amazon.com/Python-Tricks-Buffet-Awesome-Features-ebook/dp/B0785Q7GSY) - отличный вариант для 2-3 книги по Python. В книге описываются различные аспекты Python и то как правильно использовать. Книга достаточно новая (конец 2017 года), в ней рассматривается Python 3. Есть перевод.
* [Practices of the Python Pro](https://www.amazon.com/gp/product/1617296082/)
* [Effective Python: 90 Specific Ways to Write Better Python (Effective Software Development Series)](https://www.amazon.com/gp/product/0134853989/) - книга полезных советов как лучше писать код.
* [Problem Solving with Algorithms and Data Structures using Python](https://runestone.academy/ns/books/published/pythonds/index.html) - отличная книга по структурам данных и алгоритмам. Много примеров и домашних заданий. [На русском](http://aliev.me/runestone/)
* [Fluent Python](https://www.amazon.com/gp/product/1491946008/) - отличная книга по более продвинутым темам. Даже те темы, которые устарели в текущей версии Python (asyncio) стоит прочитать ради прекрасного объяснения темы.
* [Python Cookbook](https://www.amazon.com/gp/product/1449340377/) - отличная книга рецептов. Рассматривается огромное количество сценариев с решениями и пояснением.
* [Dive Into Python](https://diveintopython3.problemsolving.io/). [На русском](https://pep8.ru/doc/dive-into-python-3/) - книга достаточно старая, но есть темы, которые отстутсвуют в других книгах в списке: xml, packaging и другие. Прочитать можно, но стоит учитывать, что в некоторых темах набрали популярность другие модули. Например, вместо httplib2 - requests и вместо unittest - pytest. Как дополнительный материал по тем же темам, книга отлично подходит.

## Сайты с задачами

* [Bites of Py](https://codechalleng.es/bites/)
* [HackerRank](https://www.hackerrank.com/)
* [CheckIO - online game for Python and JavaScript coders](https://checkio.org/)

## Документация

* [Официальная документация Python](https://docs.python.org/3/index.html)
* [Python Module of the Week](https://pymotw.com/3/index.html)

## Подкасты

* [Talk Python To Me](https://talkpython.fm/)
* [Best Python Podcasts](https://www.fullstackpython.com/best-python-podcasts.html)

## YouTube каналы:

* [Corey Schafer](https://www.youtube.com/user/schafer5)

# Другие подборки ресурсов

Python без привязки к сетевому оборудованию:

* [Awesome Python](https://github.com/vinta/awesome-python)
* [The Best Python Books](https://realpython.com/best-python-books/)
* [Intermediate to Advanced resources](https://learnbyexample.github.io/py_resources/intermediate.html#intermediate-to-advanced-resources)

Python для сетевых инженеров:

* [Awesome Network Automation](https://github.com/itdependsnetworks/awesome-network-automation)
* [Python for Network Engineers Resources](https://kontrolissues.net/python-for-network-engineers-resources/)
* [Awesome Network Programmability](https://github.com/cisco-ie/awesome-network-programmability)


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.ai.textanalytics.implementation;

import com.azure.ai.textanalytics.models.ClassificationCategory;

/**
 * The helper class to set the non-public properties of an {@link ClassificationCategory} instance.
 */
public final class ClassificationCategoryPropertiesHelper {
    private static ClassificationCategoryAccessor accessor;

    private ClassificationCategoryPropertiesHelper() { }

    /**
     * Type defining the methods to set the non-public properties of an {@link ClassificationCategory} instance.
     */
    public interface ClassificationCategoryAccessor {
        void setCategory(ClassificationCategory classification, String category);
        void setConfidenceScore(ClassificationCategory classification, double confidenceScore);
    }

    /**
     * The method called from {@link ClassificationCategory} to set it's accessor.
     *
     * @param classificationCategoryAccessor The accessor.
     */
    public static void setAccessor(final ClassificationCategoryAccessor classificationCategoryAccessor) {
        accessor = classificationCategoryAccessor;
    }

    public static void setCategory(ClassificationCategory classification, String category) {
        accessor.setCategory(classification, category);
    }

    public static void setConfidenceScore(ClassificationCategory classification, double confidenceScore) {
        accessor.setConfidenceScore(classification, confidenceScore);
    }
}

redpajama_set_name: RedPajamaGithub


text:
export function buildGreeting(name) {
    return `Hello, ${name}! How are you?`
}

export function choosePartingWord(language) {
    return (language === "Spanish") ? "Adios!" : "Goodbye!"
}

export function choosePartingWordFromObject(data) {
    const { name, language } = data
    return `Goodbye, ${name}!`
}

export function mapPartingWords(languages) {
    return languages.map()
}


text:
<ng-template #notFoundTemplate class="dialog-container">

404: Not Found

    <mat-dialog-content>Sorry, that short URL does not exist 🙄</mat-dialog-content>
    <mat-dialog-actions class="float-right">
        <button mat-button (click)="close()" class="btn deep-orange">Go back</button>
    </mat-dialog-actions>
</ng-template>

    Redirecting...


text:
(function($){
	var file_frame;

	jQuery('.media-uploader-button').click(function(e) {
		e.preventDefault();

		if ( file_frame ) {
			file_frame.open();
			return;
		}

		file_frame = wp.media.frames.file_frame = wp.media({
			title: 'Add Icon',
			button: {
				text: 'Select icon',
			},
			multiple: false
		});

		file_frame.on( 'select', function() {
			attachment = file_frame.state().get('selection').first().toJSON();
			console.log(attachment);
			if ( attachment ) {

				var url;

				if ( attachment.sizes.cptm_icon ) {
					url = attachment.sizes.cptm_icon.url;
				} else {
					url = attachment.url;
				}
				jQuery('#cptm_icon').val( url );
				jQuery('.current-cptm-icon').html('<img src="'+url+'" height="16" width="16" />');
				jQuery('.remove-cptm-icon').show();
				jQuery('.media-uploader-button').html('Edit icon');

			}
		});

		file_frame.open();
		return false;
	});

	jQuery('.remove-cptm-icon').click(function(e) {
		e.preventDefault();
		jQuery('#cptm_icon').val('');
		jQuery('.current-cptm-icon').html('');
		jQuery('.remove-cptm-icon').hide();
		jQuery('.media-uploader-button').html('Add icon');
	});
})(jQuery);


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('relateddeleted', '0002_auto_20150524_2020'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='news',
            name='category',
        ),
        migrations.DeleteModel(
            name='Category',
        ),
    ]


text:
import falcon
from falcon_cors import CORS

from .routes import routes

cors = CORS(allow_all_origins=True)
api = application = falcon.API(middleware=[cors.middleware])

r = routes()
for route in r:
    api.add_route(route, r[route])


text:
namespace HeroicallyRecipes.Data.Models
{
    using System.ComponentModel.DataAnnotations;
    using Common.Validation;

    public class Tag : BaseModel<int>
    {
        [Required]
        [StringLength(ModelConstants.TagMaxLength, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = ModelConstants.TagMinLength)]
        public string Text { get; set; }
    }
}


text:
package com.franzwong.til.maven.dependencymanagement;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Project1Application {
	private static final Logger LOGGER = LoggerFactory.getLogger(Project1Application.class);

	public static void main(String[] args) {
		LOGGER.info("hello world");
	}
}


text:
import mock
from openstack import connection
from openstack import profile
from openstack import transport
from oslo_serialization import jsonutils
from requests import exceptions as req_exc
import six

from senlin.common import exception as senlin_exc
from senlin.drivers.openstack import sdk
from senlin.tests.unit.common import base

class OpenStackSDKTest(base.SenlinTestCase):

    def setUp(self):
        super(OpenStackSDKTest, self).setUp()

    def test_parser_exception_http_exception_with_details(self):
        details = jsonutils.dumps({
            'error': {
                'code': 404,
                'message': 'Resource BAR is not found.'
            }
        })
        raw = sdk.exc.ResourceNotFound('A message', details, 404)
        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(404, ex.code)
        self.assertEqual('Resource BAR is not found.', six.text_type(ex))

    def test_parser_exception_http_exception_no_details(self):
        details = "An error message"

        raw = sdk.exc.ResourceNotFound('A message.', details, 404)
        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(404, ex.code)
        self.assertEqual('A message.', six.text_type(ex))

    def test_parser_exception_http_exception_code_displaced(self):
        details = jsonutils.dumps({
            'code': 400,
            'error': {
                'message': 'Resource BAR is in error state.'
            }
        })

        raw = sdk.exc.HttpException('A message.', details)
        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(400, ex.code)
        self.assertEqual('Resource BAR is in error state.', six.text_type(ex))

    def test_parser_exception_sdk_exception(self):
        raw = sdk.exc.AuthorizationFailure()

        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(500, ex.code)
        self.assertEqual('AuthorizationFailure', six.text_type(ex))

    def test_parser_exception_request_exception(self):
        raw = req_exc.HTTPError(401, 'ERROR')

        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(401, ex.code)
        self.assertEqual('[Errno 401] ERROR', ex.message)

    def test_parser_exception_other_exceptions(self):
        raw = Exception('Unknown Error')

        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.parse_exception, raw)

        self.assertEqual(500, ex.code)
        self.assertEqual('Unknown Error', six.text_type(ex))

    def test_translate_exception_wrapper(self):

        test_func = mock.Mock()
        test_func.__name__ = 'test_func'

        res = sdk.translate_exception(test_func)
        self.assertEqual('function', res.__class__.__name__)

    def test_translate_exception_with_exception(self):

        @sdk.translate_exception
        def test_func(driver):
            raise(Exception('test exception'))

        error = senlin_exc.InternalError(code=500, message='BOOM')
        self.patchobject(sdk, 'parse_exception', side_effect=error)
        ex = self.assertRaises(senlin_exc.InternalError,
                               test_func, mock.Mock())

        self.assertEqual(500, ex.code)
        self.assertEqual('BOOM', ex.message)

    @mock.patch.object(profile, 'Profile')
    @mock.patch.object(connection, 'Connection')
    def test_create_connection(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          foo='bar')

    @mock.patch.object(profile, 'Profile')
    @mock.patch.object(connection, 'Connection')
    def test_create_connection_with_region(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'region_name': 'REGION_ONE'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_region.assert_called_once_with(x_profile.ALL,
                                                     'REGION_ONE')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT)

    @mock.patch.object(profile, 'Profile')
    @mock.patch.object(connection, 'Connection')
    @mock.patch.object(sdk, 'parse_exception')
    def test_create_connection_with_exception(self, mock_parse, mock_conn,
                                              mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        ex_raw = Exception('Whatever')
        mock_conn.side_effect = ex_raw
        mock_parse.side_effect = senlin_exc.InternalError(code=123,
                                                          message='BOOM')

        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.create_connection)

        mock_profile.assert_called_once_with()
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT)
        mock_parse.assert_called_once_with(ex_raw)
        self.assertEqual(123, ex.code)
        self.assertEqual('BOOM', ex.message)

    @mock.patch.object(sdk, 'create_connection')
    @mock.patch.object(transport, 'Transport')
    def test_authenticate(self, mock_transport, mock_conn):
        x_conn = mock_conn.return_value
        x_auth = x_conn.session.authenticator
        x_transport = mock_transport.return_value
        x_access_info = mock.Mock()
        mock_authorize = mock.Mock(return_value=x_access_info)
        x_auth.authorize = mock_authorize

        res = sdk.authenticate(foo='bar')

        self.assertEqual(x_access_info, res)
        mock_conn.assert_called_once_with({'foo': 'bar'})
        mock_transport.assert_called_once_with()
        mock_authorize.assert_called_once_with(x_transport)

    @mock.patch.object(sdk, 'create_connection')
    @mock.patch.object(transport, 'Transport')
    @mock.patch.object(sdk, 'parse_exception')
    def test_authenticate_with_exception(self, mock_parse, mock_transport,
                                         mock_conn):
        x_conn = mock_conn.return_value
        x_auth = x_conn.session.authenticator
        x_transport = mock_transport.return_value
        error = Exception('test exception')
        x_auth.authorize.side_effect = error
        mock_parse.side_effect = senlin_exc.InternalError(code=123,
                                                          message='BOOM')

        ex = self.assertRaises(senlin_exc.InternalError,
                               sdk.authenticate, foo='bar')

        mock_conn.assert_called_once_with({'foo': 'bar'})
        mock_transport.assert_called_once_with()
        x_auth.authorize.assert_called_once_with(x_transport)
        mock_parse.assert_called_once_with(error)
        self.assertEqual(123, ex.code)
        self.assertEqual('BOOM', ex.message)


text:
<resources>
    <string name="app_name">MICIR</string>
    <string name="action_settings">Settings</string>
    <string name="open">open</string>
    <string name="close">close</string>
    <string name="delete">Delete</string>
</resources>


text:
#import <Foundation/Foundation.h>

extern NSString* const FSAudioStreamStateChangeNotification;
extern NSString* const FSAudioStreamNotificationKey_State;

extern NSString* const FSAudioStreamErrorNotification;
extern NSString* const FSAudioStreamNotificationKey_Error;

extern NSString* const FSAudioStreamMetaDataNotification;
extern NSString* const FSAudioStreamNotificationKey_MetaData;

typedef enum {
    kFsAudioStreamRetrievingURL,
    kFsAudioStreamStopped,
    kFsAudioStreamBuffering,
    kFsAudioStreamPlaying,
    kFsAudioStreamSeeking,
    kFSAudioStreamEndOfFile,
    kFsAudioStreamFailed
} FSAudioStreamState;

typedef enum {
    kFsAudioStreamErrorOpen = 1,
    kFsAudioStreamErrorStreamParse = 2,
    kFsAudioStreamErrorNetwork = 3
} FSAudioStreamError;

@class FSAudioStreamPrivate;

typedef struct {
    unsigned minute;
    unsigned second;
} FSStreamPosition;

@interface FSAudioStream : NSObject {
    FSAudioStreamPrivate *_private;
}

- (void)play;
- (void)playFromURL:(NSURL*)url;
- (void)stop;
- (void)pause;
- (void)seekToPosition:(FSStreamPosition)position;

@property (nonatomic,assign) NSURL *url;
@property (nonatomic,readonly) FSStreamPosition currentTimePlayed;
@property (nonatomic,readonly) FSStreamPosition duration;
@property (nonatomic,readonly) BOOL continuous;

@end


text:
@implementation CIFilter (HTConvenience)

+ (NSArray *)supportedFilterNames
{
    NSArray *supportedFilters = [CIFilter filterNamesInCategory:kCICategoryBuiltIn];
    return supportedFilters;
}

- (void)setInputCIImage:(CIImage *)ciImage;
{
    [self setValue:ciImage forKey:kCIInputImageKey];
}

- (void)setInputCGImage:(CGImageRef)cgImage;
{
    [self setValue:[CIImage imageWithCGImage:cgImage] forKey:kCIInputImageKey];
}

- (void)setInputUIImage:(UIImage *)uiImage;
{
    [self setValue:[CIImage imageWithCGImage:uiImage.CGImage] forKey:kCIInputImageKey];
}

- (CIImage *)outputImage;
{
    return [self valueForKey:kCIOutputImageKey];
}

@end


text:
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.wsl;

import com.google.common.net.InetAddresses;
import com.intellij.credentialStore.CredentialAttributes;
import com.intellij.credentialStore.CredentialPromptDialog;
import com.intellij.execution.CommandLineUtil;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.PathEnvironmentVariableUtil;
import com.intellij.execution.process.*;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.Experiments;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.NullableLazyValue;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.OSAgnosticPathUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.Strings;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.impl.wsl.WslConstants;
import com.intellij.util.*;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;

import static com.intellij.execution.wsl.WSLUtil.LOG;
import static com.intellij.openapi.util.NullableLazyValue.lazyNullable;

/**
 * Represents a single linux distribution in WSL, installed after Fall Creators Update
 *
 * @see WSLUtil
 */
public class WSLDistribution implements AbstractWslDistribution {
  public static final String DEFAULT_WSL_MNT_ROOT = "/mnt/";
  private static final int RESOLVE_SYMLINK_TIMEOUT = 10000;
  private static final String RUN_PARAMETER = "run";
  static final int DEFAULT_TIMEOUT = SystemProperties.getIntProperty("ide.wsl.probe.timeout", 20_000);
  private static final String SHELL_PARAMETER = "$SHELL";
  public static final String WSL_EXE = "wsl.exe";
  public static final String DISTRIBUTION_PARAMETER = "--distribution";
  public static final String EXIT_CODE_PARAMETER = "; exitcode=$?";
  public static final String EXEC_PARAMETER = "--exec";

  private static final Key<ProcessListener> SUDO_LISTENER_KEY = Key.create("WSL sudo listener");
  private static final String RSYNC = "rsync";

  private final @NotNull WslDistributionDescriptor myDescriptor;
  private final @Nullable Path myExecutablePath;
  private @Nullable Integer myVersion;
  private final NullableLazyValue<String> myHostIp = lazyNullable(this::readHostIp);
  private final NullableLazyValue<String> myWslIp = lazyNullable(this::readWslIp);
  private final NullableLazyValue<String> myShellPath = lazyNullable(this::readShellPath);
  private final NullableLazyValue<String> myUserHomeProvider = lazyNullable(this::readUserHome);

  protected WSLDistribution(@NotNull WSLDistribution dist) {
    this(dist.myDescriptor, dist.myExecutablePath);
    myVersion = dist.myVersion;
  }

  WSLDistribution(@NotNull WslDistributionDescriptor descriptor, @Nullable Path executablePath) {
    myDescriptor = descriptor;
    myExecutablePath = executablePath;
  }

  public WSLDistribution(@NotNull String msId) {
    this(new WslDistributionDescriptor(msId), null);
  }

  /**
   * @return executable file, null for WSL distributions parsed from `wsl.exe --list` output
   * @deprecated please don't use it, to be will be removed after we collect statistics and make sure versions before 1903 aren't used.
   * Check statistics and remove in the next version
   */
  @Deprecated(forRemoval = true)
  public @Nullable Path getExecutablePath() {
    return myExecutablePath;
  }

  /**
   * @return identification data of WSL distribution.
   */
  public @Nullable @NlsSafe String readReleaseInfo() {
    try {
      final String key = "PRETTY_NAME";
      final String releaseInfo = "/etc/os-release"; // available for all distributions
      final ProcessOutput output = executeOnWsl(10000, "cat", releaseInfo);
      if (LOG.isDebugEnabled()) LOG.debug("Reading release info: " + getId());
      if (!output.checkSuccess(LOG)) return null;
      for (String line : output.getStdoutLines(true)) {
        if (line.startsWith(key) && line.length() >= (key.length() + 1)) {
          final String prettyName = line.substring(key.length() + 1);
          return StringUtil.nullize(StringUtil.unquoteString(prettyName));
        }
      }
    }
    catch (ExecutionException e) {
      LOG.warn(e);
    }
    return null;
  }

  void setVersion(@Nullable Integer version) {
    myVersion = version;
  }

  /**
   * @return version if it can be determined or -1 instead
   */
  public int getVersion() {
    if (myVersion == null) {
      myVersion = WSLUtil.getWslVersion(this);
    }
    return myVersion;
  }

  /**
   * Creates a patched command line, executes it on wsl distribution and returns output
   *
   * @param command                linux command, eg {@code gem env}
   * @param options                {@link WSLCommandLineOptions} instance
   * @param timeout                timeout in ms
   * @param processHandlerConsumer consumes process handler just before execution, may be used for cancellation
   */
  public @NotNull ProcessOutput executeOnWsl(@NotNull List<String> command,
                                             @NotNull WSLCommandLineOptions options,
                                             int timeout,
                                             @Nullable Consumer<? super ProcessHandler> processHandlerConsumer) throws ExecutionException {
    GeneralCommandLine commandLine = patchCommandLine(new GeneralCommandLine(command), null, options);
    CapturingProcessHandler processHandler = new CapturingProcessHandler(commandLine);
    if (processHandlerConsumer != null) {
      processHandlerConsumer.consume(processHandler);
    }
    ProcessOutput output = processHandler.runProcess(timeout);
    if (output.getExitCode() != 0 || output.isTimeout() || output.isCancelled()) {
      LOG.info("command on wsl: " + commandLine.getCommandLineString() + " was failed:" +
               "ec=" + output.getExitCode() + ",timeout=" + output.isTimeout() + ",cancelled=" + output.isCancelled()
               + ",stderr=" + output.getStderr() + ",stdout=" + output.getStdout());
    }
    return output;
  }

  public @NotNull ProcessOutput executeOnWsl(int timeout, @NonNls String @NotNull ... command) throws ExecutionException {
    return executeOnWsl(Arrays.asList(command), new WSLCommandLineOptions(), timeout, null);
  }

  /**
   * Recursively copies {@code sourceWslPath} to {@code targetWinDirPath} using rsync.
   *

   * Examples:
   *

   *
Copying {@code /dir1} to {@code C:\dir2}, will result in {@code C:\dir2\dir1}

   *
Copying {@code /file1} to {@code C:\dir2}, will result in {@code C:\dir2\file1}

   *

   *

   *
   * @param sourceWslPath     path to the source file or directory inside WSL e.g. /usr/bin/ or /usr/bin/bundle.
   * @param targetWinDirPath  target windows directory path, e.g. C:\tmp\.
   *                          This directory will be created along with all parents, if necessary.
   * @param additionalOptions may be used for --delete (not recommended), --include and so on.
   * @param handlerConsumer   consumes process handler just before execution.
   *                          Can be used for fast cancellation.
   * @deprecated copying using rsync is very slow on WSL2, instead consider using
   * {@link com.intellij.execution.wsl.sync.WslSync.Companion#syncWslFolders(String, Path, AbstractWslDistribution, boolean, String[])}.
   */
  @Deprecated
  public void copyFromWslToWinDir(@NotNull String sourceWslPath,
                                  @NotNull String targetWinDirPath,
                                  @Nullable List<String> additionalOptions,
                                  @Nullable Consumer<? super ProcessHandler> handlerConsumer) throws ExecutionException {
    var command = ContainerUtil.newArrayList(RSYNC, "--checksum", "--recursive");
    if (additionalOptions != null) {
      command.addAll(additionalOptions);
    }
    command.add(getSourceWslPath(sourceWslPath));
    command.add(getTargetWslPath(targetWinDirPath));

    var process = executeOnWsl(command, new WSLCommandLineOptions(), -1, handlerConsumer);
    if (process.getExitCode() != 0) {
      // Most common problem is rsync not installed
      if (executeOnWsl(10_000, "type", RSYNC).getExitCode() != 0) {
        throw new ExecutionException(IdeBundle.message("wsl.no.rsync", this.myDescriptor.getMsId()));
      }
      else {
        throw new ExecutionException(process.getStderr());
      }
    }
  }

  /**
   * @deprecated use {@link #patchCommandLine(GeneralCommandLine, Project, WSLCommandLineOptions)} instead
   */
  @Deprecated(forRemoval = true)
  public @NotNull <T extends GeneralCommandLine> T patchCommandLine(@NotNull T commandLine,
                                                                    @Nullable Project project,
                                                                    @Nullable String remoteWorkingDir,
                                                                    boolean askForSudo) {
    WSLCommandLineOptions options = new WSLCommandLineOptions()
      .setRemoteWorkingDirectory(remoteWorkingDir)
      .setSudo(askForSudo);
    try {
      return patchCommandLine(commandLine, project, options);
    }
    catch (ExecutionException e) {
      throw new IllegalStateException("Cannot patch command line for WSL", e);
    }
  }

  @Override
  public @NotNull <T extends GeneralCommandLine> T patchCommandLine(@NotNull T commandLine,
                                                                    @Nullable Project project,
                                                                    @NotNull WSLCommandLineOptions options) throws ExecutionException {
    logCommandLineBefore(commandLine, options);
    Path executable = getExecutablePath();
    boolean launchWithWslExe = options.isLaunchWithWslExe() || executable == null;
    Path wslExe = launchWithWslExe ? findWslExe() : null;
    if (wslExe == null && executable == null) {
      throw new ExecutionException(IdeBundle.message("wsl.not.installed.dialog.message"));
    }
    boolean executeCommandInShell = wslExe == null || options.isExecuteCommandInShell();
    List<String> linuxCommand = buildLinuxCommand(commandLine, executeCommandInShell);

    final boolean isElevated = options.isSudo();
    // use old approach in case of wsl.exe is not available
    if (isElevated && wslExe == null) { // fixme shouldn't we sudo for every chunk? also, preserve-env, login?
      prependCommand(linuxCommand, "sudo", "-S", "-p", "''");
      //TODO[traff]: ask password only if it is needed. When user is logged as root, password isn't asked.

      SUDO_LISTENER_KEY.set(commandLine, new ProcessAdapter() {
        @Override
        public void startNotified(@NotNull ProcessEvent event) {
          OutputStream input = event.getProcessHandler().getProcessInput();
          if (input == null) {
            return;
          }
          String password = CredentialPromptDialog.askPassword(
            project,
            IdeBundle.message("wsl.enter.root.password.dialog.title"),
            IdeBundle.message("wsl.sudo.password.for.root.label", getPresentableName()),
            new CredentialAttributes("WSL", "root", WSLDistribution.class),
            true
          );
          if (password != null) {
            try (PrintWriter pw = new PrintWriter(input, false, commandLine.getCharset())) {
              pw.println(password);
            }
          }
          else {
            // fixme notify user?
          }
          super.startNotified(event);
        }
      });
    }

    if (executeCommandInShell && StringUtil.isNotEmpty(options.getRemoteWorkingDirectory())) {
      prependCommand(linuxCommand, "cd", CommandLineUtil.posixQuote(options.getRemoteWorkingDirectory()), "&&");
    }
    if (executeCommandInShell && !options.isPassEnvVarsUsingInterop()) {
      commandLine.getEnvironment().forEach((key, val) -> {
        prependCommand(linuxCommand, "export", CommandLineUtil.posixQuote(key) + "=" + CommandLineUtil.posixQuote(val), "&&");
      });
      commandLine.getEnvironment().clear();
    }
    else {
      passEnvironmentUsingInterop(commandLine);
    }
    if (executeCommandInShell) {
      for (String command : options.getInitShellCommands()) {
        prependCommand(linuxCommand, command, "&&");
      }
    }

    commandLine.getParametersList().clearAll();
    String linuxCommandStr = StringUtil.join(linuxCommand, " ");
    if (wslExe != null) {
      commandLine.setExePath(wslExe.toString());
      commandLine.addParameters(DISTRIBUTION_PARAMETER, getMsId());
      if (isElevated) {
        commandLine.addParameters("-u", "root");
      }
      if (options.isExecuteCommandInShell()) {
        // workaround WSL1 problem: https://github.com/microsoft/WSL/issues/4082
        if (options.getSleepTimeoutSec() > 0 && getVersion() == 1) {
          linuxCommandStr += EXIT_CODE_PARAMETER + "; sleep " + options.getSleepTimeoutSec() + "; (exit $exitcode)";
        }

        if (options.isExecuteCommandInDefaultShell()) {
          commandLine.addParameters(SHELL_PARAMETER, "-c", linuxCommandStr);
        }
        else {
          commandLine.addParameters(EXEC_PARAMETER, options.getShellPath());
          if (options.isExecuteCommandInInteractiveShell()) {
            commandLine.addParameters("-i");
          }
          if (options.isExecuteCommandInLoginShell()) {
            commandLine.addParameters("-l");
          }
          commandLine.addParameters("-c", linuxCommandStr);
        }
      }
      else {
        commandLine.addParameter(EXEC_PARAMETER);
        commandLine.addParameters(linuxCommand);
      }
    }
    else {
      commandLine.setExePath(executable.toString());
      commandLine.addParameter(getRunCommandLineParameter());
      commandLine.addParameter(linuxCommandStr);
    }

    if (Registry.is("wsl.use.utf8.encoding", true)) {
      // Unlike the default system encoding on Windows (e.g. cp-1251),
      // UTF-8 is the default for most Linux distributions
      commandLine.setCharset(StandardCharsets.UTF_8);
    }

    logCommandLineAfter(commandLine);
    return commandLine;
  }

  private void logCommandLineBefore(@NotNull GeneralCommandLine commandLine, @NotNull WSLCommandLineOptions options) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("[" + getId() + "] " +
                "Patching: " +
                commandLine.getCommandLineString() +
                "; options: " +
                options +
                "; envs: " + commandLine.getEnvironment()
      );
    }
  }

  private void logCommandLineAfter(@NotNull GeneralCommandLine commandLine) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("[" + getId() + "] " + "Patched as: " + commandLine.getCommandLineList(null));
    }
  }

  public static @Nullable Path findWslExe() {
    File file = PathEnvironmentVariableUtil.findInPath(WSL_EXE);
    return file != null ? file.toPath() : null;
  }

  private static @NotNull List<String> buildLinuxCommand(@NotNull GeneralCommandLine commandLine, boolean executeCommandInShell) {
    List<String> command = ContainerUtil.concat(List.of(commandLine.getExePath()), commandLine.getParametersList().getList());
    return new ArrayList<>(ContainerUtil.map(command, executeCommandInShell ? CommandLineUtil::posixQuote : Functions.identity()));
  }

  // https://blogs.msdn.microsoft.com/commandline/2017/12/22/share-environment-vars-between-wsl-and-windows/
  private static void passEnvironmentUsingInterop(@NotNull GeneralCommandLine commandLine) {
    StringBuilder builder = new StringBuilder();
    for (String envName : commandLine.getEnvironment().keySet()) {
      if (StringUtil.isNotEmpty(envName)) {
        if (builder.length() > 0) {
          builder.append(":");
        }
        builder.append(envName).append("/u");
      }
    }
    if (builder.length() > 0) {
      String prevValue = commandLine.getEnvironment().get(WslConstants.WSLENV);
      if (prevValue == null) {
        prevValue = commandLine.getParentEnvironment().get(WslConstants.WSLENV);
      }
      String value = prevValue != null ? StringUtil.trimEnd(prevValue, ':') + ':' + builder
                                       : builder.toString();
      commandLine.getEnvironment().put(WslConstants.WSLENV, value);
    }
  }

  protected @NotNull @NlsSafe String getRunCommandLineParameter() {
    return RUN_PARAMETER;
  }

  /**
   * Attempts to resolve symlink with a given timeout
   *
   * @param path                  path in question
   * @param timeoutInMilliseconds timeout for execution
   * @return actual file name
   */
  public @NotNull @NlsSafe String resolveSymlink(@NotNull String path, int timeoutInMilliseconds) {

    try {
      final ProcessOutput output = executeOnWsl(timeoutInMilliseconds, "readlink", "-f", path);
      if (output.getExitCode() == 0) {
        String stdout = output.getStdout().trim();
        if (output.getExitCode() == 0 && StringUtil.isNotEmpty(stdout)) {
          return stdout;
        }
      }
    }
    catch (ExecutionException e) {
      LOG.debug("Error while resolving symlink: " + path, e);
    }
    return path;
  }

  public @NotNull @NlsSafe String resolveSymlink(@NotNull String path) {
    return resolveSymlink(path, RESOLVE_SYMLINK_TIMEOUT);
  }

  /**
   * Patches process handler with sudo listener, asking user for the password
   *
   * @param commandLine    patched command line
   * @param processHandler process handler, created from patched commandline
   * @return passed processHandler, patched with sudo listener if any
   */
  public @NotNull <T extends ProcessHandler> T patchProcessHandler(@NotNull GeneralCommandLine commandLine, @NotNull T processHandler) {
    ProcessListener listener = SUDO_LISTENER_KEY.get(commandLine);
    if (listener != null) {
      processHandler.addProcessListener(listener);
      SUDO_LISTENER_KEY.set(commandLine, null);
    }
    return processHandler;
  }

  /**
   * @return environment map of the default user in wsl
   */
  public @Nullable Map<String, String> getEnvironment() {
    try {
      ProcessOutput processOutput =
        executeOnWsl(Collections.singletonList("env"),
                     new WSLCommandLineOptions()
                       .setExecuteCommandInShell(true)
                       .setExecuteCommandInLoginShell(true)
                       .setExecuteCommandInInteractiveShell(true),
                     5000,
                     null);
      if (processOutput.getExitCode() == 0){
        Map<String, String> result = new HashMap<>();
        for (String string : processOutput.getStdoutLines()) {
          int assignIndex = string.indexOf('=');
          if (assignIndex == -1) {
            result.put(string, "");
          }
          else {
            result.put(string.substring(0, assignIndex), string.substring(assignIndex + 1));
          }
        }
        return result;
      }
    }
    catch (ExecutionException e) {
      LOG.warn(e);
    }
    return null;
  }

  /**
   * @return Windows-dependent path for a file, pointed by {@code wslPath} in WSL, or {@code null} if path is unmappable
   */
  public @NotNull @NlsSafe String getWindowsPath(@NotNull String wslPath) {
    if (containsDriveLetter(wslPath)) {
      String windowsPath = WSLUtil.getWindowsPath(wslPath, getMntRoot());
      if (windowsPath != null) {
        return windowsPath;
      }
    }
    return getUNCRoot() + FileUtil.toSystemDependentName(FileUtil.normalize(wslPath));
  }

  private static boolean containsDriveLetter(@NotNull String linuxPath) {
    int slashInd = linuxPath.indexOf('/');
    while (slashInd >= 0) {
      int nextSlashInd = linuxPath.indexOf('/', slashInd + 1);
      if ((nextSlashInd == slashInd + 2 || (nextSlashInd == -1 && slashInd + 2 == linuxPath.length())) &&
          OSAgnosticPathUtil.isDriveLetter(linuxPath.charAt(slashInd + 1))) {
        return true;
      }
      slashInd = nextSlashInd;
    }
    return false;
  }

  @Override
  public @Nullable @NlsSafe String getWslPath(@NotNull String windowsPath) {
    WslPath wslPath = WslPath.parseWindowsUncPath(windowsPath);
    if (wslPath != null) {
      if (wslPath.getDistributionId().equalsIgnoreCase(myDescriptor.getMsId())) {
        return wslPath.getLinuxPath();
      }
      throw new IllegalArgumentException("Trying to get WSL path from a different WSL distribution. Requested path (" + windowsPath + ")" +
                                         " belongs to " + wslPath.getDistributionId() + " distribution" +
                                         ", but context distribution is " + myDescriptor.getMsId());
    }

    if (OSAgnosticPathUtil.isAbsoluteDosPath(windowsPath)) { // absolute windows path => /mnt/disk_letter/path
      return getMntRoot() + convertWindowsPath(windowsPath);
    }
    return null;
  }

  /**
   * @see WslDistributionDescriptor#getMntRoot()
   */
  public final @NotNull @NlsSafe String getMntRoot() {
    return myDescriptor.getMntRoot();
  }

  public final @Nullable @NlsSafe String getUserHome() {
    return myUserHomeProvider.getValue();
  }

  private @NlsSafe @Nullable String readUserHome() {
    return getEnvironmentVariable("HOME");
  }

  /**
   * @param windowsAbsolutePath properly formatted windows local absolute path: {@code drive:\path}
   * @return windows path converted to the linux path according to wsl rules: {@code c:\some\path} => {@code c/some/path}
   */
  static @NotNull @NlsSafe String convertWindowsPath(@NotNull String windowsAbsolutePath) {
    return Character.toLowerCase(windowsAbsolutePath.charAt(0)) + FileUtil.toSystemIndependentName(windowsAbsolutePath.substring(2));
  }

  public @NotNull @NlsSafe String getId() {
    return myDescriptor.getId();
  }

  public @NotNull @NlsSafe String getMsId() {
    return myDescriptor.getMsId();
  }

  public @NotNull @NlsSafe String getPresentableName() {
    return myDescriptor.getPresentableName();
  }

  @Override
  public String toString() {
    return myDescriptor.getMsId();
  }

  private static void prependCommand(@NotNull List<? super String> command, String @NotNull ... commandToPrepend) {
    command.addAll(0, Arrays.asList(commandToPrepend));
  }

  @Override
  public boolean equals(Object o) {
    return this == o || o != null && getClass() == o.getClass() && getMsId().equals(((WSLDistribution)o).getMsId());
  }

  @Override
  public int hashCode() {
    return Strings.stringHashCodeInsensitive(getMsId());
  }

  /**
   * @deprecated use {@link WSLDistribution#getUNCRootPath()} instead
   */
  @Deprecated(forRemoval = true)
  public @NotNull File getUNCRoot() {
    return new File(WslConstants.UNC_PREFIX + myDescriptor.getMsId());
  }

  /**
   * @return UNC root for the distribution, e.g. {@code \\wsl$\Ubuntu}
   */
  @ApiStatus.Experimental
  public @NotNull Path getUNCRootPath() {
    return Paths.get(WslConstants.UNC_PREFIX + myDescriptor.getMsId());
  }

  @Override
  @ApiStatus.Experimental
  public @Nullable VirtualFile getUNCRootVirtualFile(boolean refreshIfNeed) {
    if (!Experiments.getInstance().isFeatureEnabled("wsl.p9.support")) {
      return null;
    }
    File uncRoot = getUNCRoot();
    return uncRoot.exists() ? VfsUtil.findFileByIoFile(uncRoot, refreshIfNeed) : null;
  }

  // https://docs.microsoft.com/en-us/windows/wsl/compare-versions#accessing-windows-networking-apps-from-linux-host-ip
  public String getHostIp() {
    return myHostIp.getValue();
  }

  public String getWslIp() {
    return myWslIp.getValue();
  }

  public InetAddress getHostIpAddress() {
    return InetAddresses.forString(getHostIp());
  }

  public InetAddress getWslIpAddress() {
    return InetAddresses.forString(getWslIp());
  }

  private @Nullable String readHostIp() {
    String wsl1LoopbackAddress = getWsl1LoopbackAddress();
    if (wsl1LoopbackAddress != null) {
      return wsl1LoopbackAddress;
    }
    if (Registry.is("wsl.obtain.windows.host.ip.alternatively", true)) {
      InetAddress wslAddr = getWslIpAddress();
      // Connect to any port on WSL IP. The destination endpoint is not needed to be reachable as no real connection is established.
      // This transfers the socket into "connected" state including setting the local endpoint according to the system's routing table.
      // Works on Windows and Linux.
      try (DatagramSocket datagramSocket = new DatagramSocket()) {
        // Any port in range [1, 0xFFFF] can be used. Port=0 is forbidden: https://datatracker.ietf.org/doc/html/rfc8085
        // "A UDP receiver SHOULD NOT bind to port zero".
        // Java asserts "port != 0" since v15 (https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8240533).
        int anyPort = 1;
        datagramSocket.connect(wslAddr, anyPort);
        return datagramSocket.getLocalAddress().getHostAddress();
      }
      catch (Exception e) {
        LOG.error("Cannot obtain Windows host IP alternatively: failed to connect to WSL IP " + wslAddr + ". Fallback to default way.", e);
      }
    }
    final String releaseInfo = "/etc/resolv.conf"; // available for all distributions
    final ProcessOutput output;
    try {
      output = executeOnWsl(List.of("cat", releaseInfo), new WSLCommandLineOptions(), 10_000, null);
    }
    catch (ExecutionException e) {
      LOG.info("Cannot read host ip", e);
      return null;
    }
    if (LOG.isDebugEnabled()) LOG.debug("Reading release info: " + getId());
    if (!output.checkSuccess(LOG)) return null;
    for (String line : output.getStdoutLines(true)) {
      if (line.startsWith("nameserver")) {
        return line.substring("nameserver".length()).trim();
      }
    }
    return null;
  }

  private @Nullable String readWslIp() {
    String wsl1LoopbackAddress = getWsl1LoopbackAddress();
    if (wsl1LoopbackAddress != null) {
      return wsl1LoopbackAddress;
    }
    final ProcessOutput output;
    try {
      output = executeOnWsl(List.of("ip", "addr", "show", "eth0"), new WSLCommandLineOptions(), 10_000, null);
    }
    catch (ExecutionException e) {
      LOG.info("Cannot read wsl ip", e);
      return null;
    }
    if (LOG.isDebugEnabled()) LOG.debug("Reading eth0 info: " + getId());
    if (!output.checkSuccess(LOG)) return null;
    for (String line : output.getStdoutLines(true)) {
      String trimmed = line.trim();
      if (trimmed.startsWith("inet ")) {
        int index = trimmed.indexOf("/");
        if (index != -1) {
          return trimmed.substring("inet ".length(), index);
        }
      }
    }
    return null;
  }

  private @Nullable String getWsl1LoopbackAddress() {
    return getVersion() == 1 ? InetAddress.getLoopbackAddress().getHostAddress() : null;
  }

  public @NonNls @Nullable String getEnvironmentVariable(String name) {
    WSLCommandLineOptions options = new WSLCommandLineOptions()
      .setExecuteCommandInInteractiveShell(true)
      .setExecuteCommandInLoginShell(true)
      .setShellPath(getShellPath());
    return WslExecution.executeInShellAndGetCommandOnlyStdout(this, new GeneralCommandLine("printenv", name), options, DEFAULT_TIMEOUT,
                                                              true);
  }

  public @NlsSafe @NotNull String getShellPath() {
    return ObjectUtils.notNull(myShellPath.getValue(), WSLCommandLineOptions.DEFAULT_SHELL);
  }

  private @NlsSafe @Nullable String readShellPath() {
    WSLCommandLineOptions options = new WSLCommandLineOptions().setExecuteCommandInDefaultShell(true);
    return WslExecution.executeInShellAndGetCommandOnlyStdout(this, new GeneralCommandLine("printenv", "SHELL"), options, DEFAULT_TIMEOUT,
                                                              true);
  }

  /**
   * @return {@code wslPath} without trailing slashes.
   */
  private static @NotNull String getSourceWslPath(final @NotNull String wslPath) {
    return UriUtil.trimTrailingSlashes(wslPath);
  }

  /**
   * @return {@code windowsDirPath} converted to WSL path (e.g. /mnt/c/...) with a trailing slash at the end.
   * Also, ensures that the necessary directory structure is created.
   * @throws ExecutionException in case of errors.
   */
  private @NotNull String getTargetWslPath(final @NotNull String windowsDirPath) throws ExecutionException {
    if (!FileUtil.createDirectory(new File(windowsDirPath))) {
      throw new ExecutionException(IdeBundle.message("wsl.rsync.unable.to.create.target.dir.message", windowsDirPath));
    }

    var targetWslPath = getWslPath(windowsDirPath);
    if (targetWslPath == null) {
      throw new ExecutionException(IdeBundle.message("wsl.rsync.unable.to.copy.files.dialog.message", windowsDirPath));
    }
    return targetWslPath.endsWith("/") ? targetWslPath : targetWslPath + "/";
  }
}


text:
from django.conf.urls import patterns, url
from apps.blog import views

urlpatterns = patterns(
    '',
    url(r'^$', views.home, name='home'),
    #url(r'^posts/$', views.post_list, name="post_list"),
    #url(r'^post/(?P<id>\d+)/$', views.post_detail, name="post_detail"),
    #url(r'^edit-post/$', views.post_form, name="post_form"),
    #url(r'^edit-post/(?P<id>\d*)/$', views.post_form, name="post_form"),
)


text:
require 'rails_helper'

RSpec.describe Scoutlander::Datum::Person do
  let(:person) { Scoutlander::Datum::Person.new(email: 'threadhead@gmail.com') }
  subject { person }

  context 'when initialized' do
    specify { expect(subject.parent).to be_nil }
    specify { expect(subject.email).to eq('threadhead@gmail.com') }
    specify { expect(subject.relations).to be_empty }
    specify { expect(subject.parent).to be_nil }
    specify { expect(subject.inspected).to be_falsy }
  end

  describe '.add_relation' do
    before do
      @person2 = Scoutlander::Datum::Person.new
      person.add_relation(@person2)
    end

    specify { expect(subject.relations.size).to eq(1) }
    specify { expect(subject.relations).to include(@person2) }
    specify { expect(@person2.parent).to eq(person) }

    it 'should reject non-Person objects' do
      @person3 = Hash.new
      person.add_relation(@person3)
      expect(subject.relations).to_not include(@person3)
    end
  end

  describe '.to_params' do
    specify { expect(subject.to_params).to include(email: 'threadhead@gmail.com') }
    specify { expect(subject.to_params).not_to have_key(:included) }
    specify { expect(subject.to_params).not_to have_key(:relations) }
    specify { expect(subject.to_params).not_to have_key(:parent) }
    specify { expect(subject.to_params).not_to have_key(:security_level) }
  end

end


text:
package simx.core.svaractor.unifiedaccess

import simx.core.entity.Entity
import simx.core.entity.description.SVal
import simx.core.entity.typeconversion.{TypeInfo, ConvertibleTrait}
import simx.core.entity.typeconversion.TypeInfo.DataTag
import simx.core.ontology.types.OntologySymbol
import simx.core.ontology.{types, SValDescription, Annotation}
import simx.core.svaractor.{TimedRingBuffer, SVarActor}
import simx.core.svaractor.TimedRingBuffer.{Unbuffered, BufferMode}
import simx.core.svaractor.semantictrait.base._
import simx.core.worldinterface.WorldInterfaceHandling

import scala.reflect.ClassTag

/**
 *
 * Created by dennis on 12.09.14.
 */
class RelationDescription[S <: Entity : DataTag  : ClassTag, O <: Entity : ClassTag  : DataTag](val leftDesc : ConvertibleTrait[S],
                                                                                val relationName : GroundedSymbolFeatures,
                                                                                val rightDesc : ConvertibleTrait[O],
                                                                                owlLink : String,
                                                                                val isSymmetric : Boolean,
                                                                                annotations : Set[Annotation] = Set())
  extends SValDescription(types.Relation.asConst as relationName definedAt owlLink setAnnotations annotations)
{
  private type updateFunc[X <: Entity] = (X => ((X#SelfType => Any) => Unit))

  protected def this(leftDesc : ConvertibleTrait[S], r : RelationDescription[_ >: S, _ >: O], rightDesc : ConvertibleTrait[O],
                     owlLink : String, isSymmetric: Boolean) =
    this(leftDesc, r.relationName, rightDesc, r.ontoLink.get, isSymmetric, r.annotations)

  override def setAnnotations(annotations : Set[Annotation]) =
    new RelationDescription[S, O](leftDesc, relationName, rightDesc, owlLink, isSymmetric, annotations)

  override def setAnnotations(annotations : GroundedSymbolFeatures*) =
    new RelationDescription[S, O](leftDesc, relationName, rightDesc, owlLink, isSymmetric, annotations.map(OntologySymbol(_)).toSet)

  def asRelation[S2 <: S, O2 <: O, X <: Entity : DataTag](s: S2, o : O2, x : X ) =
    new TypedRelation[S, O, X](s, setAnnotations(Set[Annotation](types.RelationSubject(s), types.RelationObject(o)) ++ annotations), o, x)

  def restrictTypes[NewS <: S , NewO <: O](newLeft : ConvertibleTrait[NewS], newRight : ConvertibleTrait[NewO]) =
    new RelationDescription[NewS, NewO](newLeft, this, newRight, owlLink, isSymmetric)(newLeft.typeTag, newLeft.classTag, newRight.classTag, newRight.typeTag)

  def restrictSubjectType[SpecialS <: S](specialLeftType : ConvertibleTrait[SpecialS]) =
    restrictTypes(specialLeftType, rightDesc)

  def restrictObjectType[SpecialO <: O](specialRightType : ConvertibleTrait[SpecialO]) =
    restrictTypes(leftDesc, specialRightType)

  def get(right : LeftUnknownTuple[O]) =
    right.getValue.get(LeftRequest[S, O](this, right.getValue))

  def get(left : RightUnknownTuple[S] ) =
    left.getValue.get(RightRequest[S, O](this, left.getValue))

  def get(tuple : (S, O)) =
    tuple._1.get(asRelation(tuple._1, tuple._2, null).description)

  def observe(right : (Unknown, O), ignoredWriters : Set[SVarActor.Ref]) =
    right._2.observe(LeftRequest[S, O](this, right._2), ignoredWriters)

  def observe(left : RightUnknownTuple[S])  : ObservableAccessSet[Relation, O] =
    observe(left, Set[SVarActor.Ref]())

  def observe(left : RightUnknownTuple[S], ignoredWriters : Set[SVarActor.Ref])  : ObservableAccessSet[Relation, O] =
    left.getValue.observe(RightRequest(this, left.getValue), ignoredWriters)

  def observe(right : LeftUnknownTuple[O]) : ObservableAccessSet[Relation, S] =
    observe(right, Set[SVarActor.Ref]())

  def observe(right : LeftUnknownTuple[O], ignoredWriters : Set[SVarActor.Ref]) : ObservableAccessSet[Relation, S] =
    right.getValue.observe(LeftRequest(this, right.getValue), ignoredWriters)

  def observe(tuple : (S, O)) =
    tuple._1.observe(asRelation(tuple._1, tuple._2, null).description)

  def set(subj : S, obj : O, bufferMode : BufferMode = TimedRingBuffer.defaultMode)(implicit actor : WorldInterfaceHandling with EntityUpdateHandling) : Unit =
    asRelation(subj, obj, subj).publish(_ => {}, bufferMode)

  def set(tuple : ( S, O ))(implicit actor : WorldInterfaceHandling  with EntityUpdateHandling) : Unit =
    set(tuple, TimedRingBuffer.defaultMode)

  def set(tuple : ( S, O ), bufferMode : BufferMode)(implicit actor : WorldInterfaceHandling  with EntityUpdateHandling) : Unit =
    set(tuple._1, tuple._2, bufferMode)

  def remove(subj : S, obj : O)(implicit actor : WorldInterfaceHandling  with EntityUpdateHandling) : Unit =
    asRelation(subj, obj, subj).remove(_ => {})

  def remove(tuple : ( S, O ))(implicit actor : WorldInterfaceHandling  with EntityUpdateHandling) : Unit =
    remove(tuple._1, tuple._2)

  def ?  : S => LeftRelationPart[S, O] =
    LeftRelationPart(this, _)

  def ->(x : Unknown) : S => LeftRelationPart[S, O] =
    LeftRelationPart(this, _)

  def ->(x : O) =
    RightRelationPart[S, O](this, x)

  def apply[X <: StateParticleAccess](in : TypedRelation[S, O, X])(implicit ct : ClassTag[TypedRelation[S, O, X]], dt : DataTag[TypedRelation[S, O, X]]) =
    SVal(withType(classOf[TypedRelation[S, O, X]]), valueDescription)(in)

  override def toString: String =
    sVarIdentifier.name + " (" + typeTag.toString() + annotationsString + ")"

  private def annotationsString: String = if (annotations.isEmpty) ""
  else " (with annotations " + annotations.map { annotation =>
    createPrefixStringFrom(annotation) + createSuffixStringFrom(annotation)
  }.mkString(" and ")

  private val relationRoles: Set[TypeInfo[_,_]] = Set(types.RelationSubject,types.RelationObject)

  private def createPrefixStringFrom(annotation: Annotation): String =
    if(relationRoles.contains(annotation.typedSemantics))
      annotation.value.asInstanceOf[Entity].getSimpleName
    else annotation.value.toString

  private def createSuffixStringFrom(annotation: Annotation): String =
    if (annotation.typedSemantics == OntologySymbol) ""
    else " (" + annotation.typedSemantics.sVarIdentifier.name + ")"
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.shopizer</groupId>
	<artifactId>sm-core</artifactId>
	<version>2.0.0-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>sm-core</name>
	<url>http://www.shopizer.com</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<jdk.version>1.6</jdk.version>

		<jackson-version>1.9.13</jackson-version>
		<axis-version>1.4</axis-version>
		<jaxws.api.version>2.1</jaxws.api.version>
		<jaxws.version>2.1.4</jaxws.version>
		<jsr181.version>1.0-MR1</jsr181.version>
		<jsr250.version>1.0</jsr250.version>
		<org.elasticsearch-version>0.90.2</org.elasticsearch-version>
		<jasperreports-version>3.7.4</jasperreports-version>

		<freemarker.version>2.3.19</freemarker.version>
		<org.slf4j-version>1.6.6</org.slf4j-version>
		<hibernate.ehcache.version>3.5.1-Final</hibernate.ehcache.version>
		<sm-core.hibernate-entitymanager-version>4.1.2</sm-core.hibernate-entitymanager-version>
		<sm-core.hibernate-jpamodelgen.version>1.1.1.Final</sm-core.hibernate-jpamodelgen.version>
		<sm-core.aspectj.version>1.5.4</sm-core.aspectj.version>
		<sm-core.mysql-connector-java>5.1.31</sm-core.mysql-connector-java>
		<sm-core.junit.version>4.9</sm-core.junit.version>
		<sm-core.org.springframework.version>3.1.0.RELEASE</sm-core.org.springframework.version>
		<sm-core.c3p0.version>0.9.1.2</sm-core.c3p0.version>
		<sm-core.querydsl.version>3.4.2</sm-core.querydsl.version>
		<sm-core.jodatime.version>2.0</sm-core.jodatime.version>
		<sm-core.jodatime-hibernate.version>1.3</sm-core.jodatime-hibernate.version>
		<sm-core.javassist.version>3.3</sm-core.javassist.version>
		<sm-search.version>0.0.3</sm-search.version>
	</properties>

	<dependencies>

		<!--<dependency>
    		<groupId>com.shopizer</groupId>
    		<artifactId>com.shopizer.authorizenet</artifactId>
    		<version>0.0.1-SNAPSHOT</version>
		</dependency>-->

	    <!-- sm-search -->
		<dependency>
			<groupId>com.shopizer</groupId>
			<artifactId>sm-search</artifactId>
			<version>${sm-search.version}</version>
		</dependency>

		<!-- Loggers -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${org.slf4j-version}</version>
		</dependency>

		<!-- required for query dsl 3 -->
		<dependency>
    		<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
			<version>2.2</version>
    	</dependency>

		<!-- Hibernate -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>${sm-core.hibernate-entitymanager-version}</version>
			<exclusions>
				<exclusion>
					<artifactId>javassist</artifactId>
					<groupId>org.javassist</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>${sm-core.hibernate-entitymanager-version}</version>
			<exclusions>
				<exclusion>
					<groupId>asm</groupId>
					<artifactId>asm</artifactId>
				</exclusion>
				<exclusion>
					<groupId>asm</groupId>
					<artifactId>asm-attrs</artifactId>
				</exclusion>
				<exclusion>
					<groupId>cglib</groupId>
					<artifactId>cglib</artifactId>
				</exclusion>
				<exclusion>
					<artifactId>javassist</artifactId>
					<groupId>javassist</groupId>
				</exclusion>
				<exclusion>
					<groupId>org.hibernate</groupId>
					<artifactId>hibernate-core</artifactId>
				</exclusion>
				<exclusion>
					<artifactId>javassist</artifactId>
					<groupId>org.javassist</groupId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- Hibernate ehcache -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-ehcache</artifactId>
			<version>${hibernate.ehcache.version}</version>
		</dependency>

		<!-- Javassist -->
		<dependency>
			<groupId>javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>${sm-core.javassist.version}</version>
		</dependency>

		<!-- QueryDsl -->
		<dependency>
			<groupId>com.mysema.querydsl</groupId>
			<artifactId>querydsl-apt</artifactId>
			<version>${sm-core.querydsl.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.mysema.querydsl</groupId>
			<artifactId>querydsl-core</artifactId>
			<version>${sm-core.querydsl.version}</version>
		</dependency>
		<dependency>
			<groupId>com.mysema.querydsl</groupId>
			<artifactId>querydsl-jpa</artifactId>
			<version>${sm-core.querydsl.version}</version>
		</dependency>

		<!-- Pool c3p0 -->
		<dependency>
			<groupId>c3p0</groupId>
			<artifactId>c3p0</artifactId>
			<version>${sm-core.c3p0.version}</version>
		</dependency>

		<!-- Spring -->
		<!--
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-asm</artifactId>
			<version>${sm-core.org.springframework-security.version}</version>
		</dependency>
		-->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${sm-core.org.springframework.version}</version>
		</dependency>

		<!-- JSR 303 with Hibernate Validator -->
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<version>4.3.0.Final</version>
		</dependency>

		<!-- AspectJ -->
		<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${sm-core.aspectj.version}</version>
		</dependency>
		<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>${sm-core.aspectj.version}</version>
		</dependency>

		<!-- Mysql Connector -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>${sm-core.mysql-connector-java}</version>
		</dependency>

		<!-- H2 Connector -->
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.3.152</version>
		</dependency>

		<!-- Jackson JSON Processor -->
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
			<version>${jackson-version}</version>
		</dependency>
		<dependency>
			<groupId>com.googlecode.json-simple</groupId>
			<artifactId>json-simple</artifactId>
			<version>1.1.1</version>
		</dependency>

		<!-- File Upload -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.2.2</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.0.1</version>
		</dependency>

		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.2.1</version>
	   </dependency>

		<!-- Apache common -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.0</version>
		</dependency>

		<dependency>
			<groupId>commons-validator</groupId>
			<artifactId>commons-validator</artifactId>
			<version>1.4.0</version>
		</dependency>

		<!--
		<dependency>
  			<groupId>org.jboss.cache</groupId>
  			<artifactId>jbosscache-core</artifactId>
  			<version>3.2.5.GA</version>
		</dependency>
		-->

		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>

		<dependency>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
			<version>3.1</version>
		</dependency>

		<!-- JodaTime -->
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
			<version>${sm-core.jodatime.version}</version>
		</dependency>
		<dependency>
			<groupId>org.jadira.usertype</groupId>
			<artifactId>usertype.core</artifactId>
			<version>3.0.0.CR1</version>
		</dependency>

        <!-- Infinispan -->
  		<dependency>
			<groupId>org.infinispan</groupId>
    		<artifactId>infinispan-core</artifactId>
    		<version>5.1.6.FINAL</version>
  		</dependency>

  		<!-- TO REMOVE -->
  		<dependency>
    		<groupId>org.infinispan</groupId>
    		<artifactId>infinispan-cachestore-bdbje</artifactId>
    		<version>5.1.4.FINAL</version>
  		</dependency>

		<dependency>
			<groupId>org.infinispan</groupId>
			<artifactId>infinispan-cachestore-jdbc</artifactId>
			<version>5.1.4.FINAL</version>
		</dependency>

		<dependency>
			<groupId>org.infinispan</groupId>
			<artifactId>infinispan-tree</artifactId>
			<version>5.1.6.FINAL</version>
		</dependency>

		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>${freemarker.version}</version>
		</dependency>

		<dependency>
			<groupId>javax.mail</groupId>
			<artifactId>mail</artifactId>
			<version>1.4.5</version>
		</dependency>

		<dependency>
			<groupId>org.jopendocument</groupId>
			<artifactId>jOpenDocument</artifactId>
			<version>1.3b1</version>
		</dependency>

	    <dependency>
			<groupId>com.lowagie</groupId>
			<artifactId>itext</artifactId>
			<version>4.2.1</version>
		</dependency>

		<!-- integration -->
		<!--
		<dependency>
  			<groupId>com.paypal.sdk</groupId>
  			<artifactId>rest-api-sdk</artifactId>
  			<version>0.7.1</version>
		</dependency>
		-->

		<dependency>
			<groupId>com.paypal.sdk</groupId>
			<artifactId>merchantsdk</artifactId>
			<version>2.6.109</version>
		</dependency>

	    <dependency>
	        <groupId>com.maxmind.geoip2</groupId>
	        <artifactId>geoip2</artifactId>
	        <version>0.7.0</version>
	    </dependency>

		<!-- Test dependencies -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${sm-core.junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${sm-core.org.springframework.version}</version>
			<scope>test</scope>
		</dependency>

		<!-- <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc5</artifactId>
			<version>11.1.0.7.0</version> <scope>provided</scope> </dependency> -->
	</dependencies>

	<repositories>
		<!-- For testing against latest Spring snapshots -->
		<repository>
			<id>org.springframework.maven.snapshot</id>
			<name>Spring Maven Snapshot Repository</name>
			<url>http://maven.springframework.org/snapshot</url>
			<releases><enabled>false</enabled></releases>
			<snapshots><enabled>true</enabled></snapshots>
		</repository>
		<!-- For developing against latest Spring milestones -->
		<repository>
			<id>org.springframework.maven.milestone</id>
			<name>Spring Maven Milestone Repository</name>
			<url>http://maven.springframework.org/milestone</url>
			<snapshots><enabled>false</enabled></snapshots>
		</repository>
		<repository>
			<id>org.jboss.repository.releases</id>
			<name>JBoss Maven Release Repository</name>
			<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
			<snapshots><enabled>false</enabled></snapshots>
		</repository>
	</repositories>

	<build>
		<!--
			Annotation processor to be generated in target/generated-sources
			The build will generate the required annotated classes in generated-sources
			Then will jump to the regular build in pluginManagement

			mvn clean
			mvn install

			** if the install phase complains on missing Qxyz classes then

			mvn clean
			mvn generate-sources
			mvn install

			*** Want to have the schema generated

			** hbm2ddl not working
			mvn hibernate3:hbm2ddl

		-->
		<plugins>
			<plugin>
				<groupId>org.bsc.maven</groupId>
				<artifactId>maven-processor-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>process</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>com.mysema.maven</groupId>
				<artifactId>maven-apt-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>process</goal>
						</goals>
						<configuration>
							<outputDirectory>target/generated-sources/querydsl</outputDirectory>
							<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>2.3.2</version>
					<configuration>
						<source>${jdk.version}</source>
						<target>${jdk.version}</target>
						<encoding>${project.build.sourceEncoding}</encoding>
						<compilerArgument>-proc:none</compilerArgument>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.12</version>
					<configuration>
          				<skipTests>true</skipTests>
        			</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>2.2</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>2.3.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.2.2</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>2.3</version>
				</plugin>
				<plugin>
					<groupId>org.bsc.maven</groupId>
					<artifactId>maven-processor-plugin</artifactId>
					<version>2.0.5</version>
					<configuration>
						<outputDirectory>target/generated-sources</outputDirectory>
						<options>
							<fullyAnnotationConfigured>true</fullyAnnotationConfigured>
							<addSuppressWarningsAnnotation>true</addSuppressWarningsAnnotation>
						</options>
					</configuration>
					<executions>
						<execution>
							<id>process</id>
							<goals>
								<goal>process</goal>
							</goals>
							<phase>generate-sources</phase>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.bsc.maven</groupId>
					<artifactId>maven-processor-plugin</artifactId>
					<executions>
						<execution>
							<id>process</id>
							<goals>
								<goal>process</goal>
							</goals>
							<phase>generate-sources</phase>
							<configuration>
								<options>
									<fullyAnnotationConfigured>true</fullyAnnotationConfigured>
									<addSuppressWarningsAnnotation>true</addSuppressWarningsAnnotation>
								</options>
							</configuration>
						</execution>
					</executions>
					<dependencies>
						<dependency>
							<groupId>org.hibernate</groupId>
							<artifactId>hibernate-jpamodelgen</artifactId>
							<version>${sm-core.hibernate-jpamodelgen.version}</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>com.mysema.maven</groupId>
					<artifactId>maven-apt-plugin</artifactId>
					<version>1.0.2</version>
					<configuration>
						<outputDirectory>target/generated-sources/querydsl</outputDirectory>
					</configuration>
					<executions>
						<execution>
							<goals>
								<goal>process</goal>
							</goals>
							<configuration>
								<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
							</configuration>
						</execution>
					</executions>
					<dependencies>
						<dependency>
							<groupId>com.mysema.querydsl</groupId>
							<artifactId>querydsl-apt</artifactId>
							<version>${sm-core.querydsl.version}</version>
						</dependency>
					</dependencies>
				</plugin>
				<!-- hbm2ddl Hibernate entities to schema -->
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>hibernate3-maven-plugin</artifactId>
					<version>2.2</version><!-- 2.2 -->
					<executions>
						<execution>
							<phase>process-classes</phase>
							<goals>
								<goal>hbm2ddl</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
						<components>
							<component>
								<name>hbm2ddl</name>
								<implementation>jpaconfiguration</implementation>
							</component>
						</components>
						<componentProperties>
							<persistenceunit>sm-unit</persistenceunit>
							<!--<propertyfile>src/test/resources/hbm2ddl.properties</propertyfile>-->
							<outputfilename>schema.ddl</outputfilename>
							<drop>false</drop>
							<create>true</create>
							<export>false</export>
							<format>true</format>
						</componentProperties>
					</configuration>
				</plugin>
				<!--This plugin's configuration is used to store Eclipse m2e settings
					only. It has no influence on the Maven build itself. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.codehaus.mojo</groupId>
										<artifactId>aspectj-maven-plugin</artifactId>
										<versionRange>[1.0,)</versionRange>
										<goals>
											<goal>test-compile</goal>
											<goal>compile</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<execute />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>


text:
layout: data_model
title: RelatedPackageType
this_version: 1.2
---

RelatedPackageTypeSTIX Core Schema

Identifies or characterizes a relationship to a Package.

      <form id="nav-version">
        <select>

            <option value="1.2" selected="selected">STIX 1.2</option>

            <option value="1.1.1" >STIX 1.1.1</option>

            <option value="1.1" >STIX 1.1</option>

        </select>
      </form>

Fields

      Field Name
      Type
      Description

      Confidence0..1

          ConfidenceType

The confidence field specifies the level of confidence in the assertion of the relationship between the two components.

      Information_Source0..1

          InformationSourceType

The Information_Source field specifies the source of the information about the relationship between the two components.

      Relationship0..1

          ControlledVocabularyStringType

The relationship field characterizes the type of the relationship between the two components.

This field is implemented through the xsi:type controlled vocabulary extension mechanism. No default vocabulary type has been defined for STIX 1.2. Users may either define their own vocabulary using the type extension mechanism, specify a vocabulary name and reference using the attributes, or simply use this as a free string field.

      Package1..1

          STIXType

A reference to or representation of the related Package.

This field is implemented through the xsi:type extension mechanism. The default and strongly recommended type is IncidentType in the http://stix.mitre.org/Incident-1 namespace. This type is defined in the incident.xsd file or at the URL http://stix.mitre.org/XMLSchema/incident/1.2/incident.xsd.


text:
declare var PouchDB: any;

import { Tag } from './tag';
import { randString } from '../utils';

let db = new PouchDB('cards');

export interface ICard {
    parent_id: string;
    _id: string;
    title: string;
    description: string;
    tags_ids: string[];
    createdAt: number;
    until: number;
    _rev: string;
}

export class Card implements ICard {

    parent_id: string;
    _id: string;
    title: string;
    description: string;
    tags_ids: string[];
    createdAt: number;
    until: number;
    _rev: string;

    static createCard(parent_id: string, title: string): Promise<any>  {
        let newCard: Card = new Card(parent_id, 'card-' + randString(), title);
        return db.put(newCard);
    }

    static from(c: { parent_id: string, _id: string, title: string, description: string, tags_ids: string[], until: number, createdAt: number, _rev: string }): Card {
        return new Card(c.parent_id, c._id, c.title, c.description, c.tags_ids, c.until, c.createdAt, c._rev);
    }

    static getDummy(): Card { return new Card('null', 'null', 'Dummy Card'); }

    constructor(parent_id:string, _id: string, title: string, description: string = '', tags_ids: string[] = [], until: number = -1, createdAt: number = Date.now(), _rev: string = undefined) {
        this.parent_id = parent_id;
        this._id = _id;
        this.title = title;
        this.description = description;
        this.tags_ids = tags_ids;
        this.until = until;
        this.createdAt = createdAt;
        this._rev = _rev;
    }

    update(): Promise<any> {
        return db.put(this);
    }

    delete(): Promise<any> {
        return db.remove(this._id, this._rev);
    }

    appendTag(tag: Tag) {
        if(typeof tag !== 'undefined')
            this.tags_ids.push(tag._id);
        return this;
    }

}


text:
export * from './auth';
export * from './notification-service';


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

	<bean id="pizzaDao" class="fr.pizzeria.dao.pizza.PizzaDaoMemoire"></bean>

	<import resource="dao.xml"/>

</beans>


text:
namespace media {

struct SupportedResolutionRange {
  gfx::Size min_resolution;
  gfx::Size max_landscape_resolution;
  gfx::Size max_portrait_resolution;
};

using SupportedResolutionRangeMap =
    base::flat_map<VideoCodecProfile, SupportedResolutionRange>;

// Enumerates the extent of hardware decoding support for H.264, VP8, VP9, and
// AV1. If a codec is supported, its minimum and maximum supported resolutions
// are returned under the appropriate VideoCodecProfile entry.
//
// Notes:
// - VP8 and AV1 are only tested if their base::Feature entries are enabled.
// - Only baseline, main, and high H.264 profiles are supported.
MEDIA_GPU_EXPORT
SupportedResolutionRangeMap GetSupportedD3D11VideoDecoderResolutions(
    ComD3D11Device device,
    const gpu::GpuDriverBugWorkarounds& workarounds);

}  // namespace media

#endif  // MEDIA_GPU_WINDOWS_SUPPORTED_PROFILE_HELPERS_H_


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Form\EventSubscriber;

use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Webmozart\Assert\Assert;

final class CustomerRegistrationFormSubscriber implements EventSubscriberInterface
{
    /** @var RepositoryInterface */
    private $customerRepository;

    public function __construct(RepositoryInterface $customerRepository)
    {
        $this->customerRepository = $customerRepository;
    }

    public static function getSubscribedEvents(): array
    {
        return [
            FormEvents::PRE_SUBMIT => 'preSubmit',
        ];
    }

    /**
     * @throws \InvalidArgumentException
     */
    public function preSubmit(FormEvent $event): void
    {
        $rawData = $event->getData();
        $form = $event->getForm();
        $data = $form->getData();

        Assert::isInstanceOf($data, CustomerInterface::class);

        // if email is not filled in, go on
        if (!isset($rawData['email']) || empty($rawData['email'])) {
            return;
        }

        /** @var CustomerInterface|null $existingCustomer */
        $existingCustomer = $this->customerRepository->findOneBy(['email' => $rawData['email']]);
        if (null === $existingCustomer || null !== $existingCustomer->getUser()) {
            return;
        }

        $existingCustomer->setUser($data->getUser());
        $form->setData($existingCustomer);
    }
}


text:
/* tslint:disable:no-unused-variable */
import app = require("application");
import TKUnit = require("./TKUnit");
import commonTests = require("./application-tests-common");

global.moduleMerge(commonTests, exports);

// <snippet module="application" title="application">
// ### Using the Android-specific implementation
// Accessing the Android-specific object instance (will be undefined if running on iOS)
// ``` JavaScript
var androidApp = app.android;
// ```
// </snippet>
// <snippet module="application" title="application">
// ### Using the Android Application context
// ``` JavaScript
var context = app.android.context;
//// get the Files (Documents) folder (directory)
var dir = context.getFilesDir();
// ```
// </snippet>
// <snippet module="application" title="application">
// ### Tracking the current Activity
// ``` JavaScript
if (androidApp.foregroundActivity === androidApp.startActivity) {
    ////console.log("We are currently in the main (start) activity of the application");
}
// ```
// </snippet>
// <snippet module="application" title="application">
// ### Registering a Broadcast Receiver (Android)
// ``` JavaScript
//// Register the broadcast receiver
if (app.android) {
    app.android.registerBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED,
        function onReceiveCallback(context: android.content.Context, intent: android.content.Intent) {
            var level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1);
            var scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1);
            var percent = (level / scale) * 100.0;
            ////console.log("Battery: " + percent + "%");
        });
}
//// When no longer needed, unregister the broadcast receiver
if (app.android) {
    app.android.unregisterBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED);
}
// ```
// </snippet>

export var testAndroidApplicationInitialized = function () {
    TKUnit.assert(app.android, "Android application not initialized.");
    TKUnit.assert(app.android.context, "Android context not initialized.");
    TKUnit.assert(app.android.foregroundActivity, "Android currentActivity not initialized.");
    TKUnit.assert(app.android.startActivity, "Android startActivity not initialized.");
    TKUnit.assert(app.android.nativeApp, "Android nativeApp not initialized.");
    TKUnit.assert(app.android.packageName, "Android packageName not initialized.");
}


text:
import { BaseModel, Manager, Model } from './base'
import { Http, Url, http } from './http'
import { register, unregister, REGISTRY } from './decorators'
import { ModelSerializer } from './serialization'
import * as fields from './fields'

module.exports = {
  REGISTRY,
  register,
  unregister,
  fields,
  http,
  Http,
  ModelSerializer,
  Manager,
  BaseModel,
  Model,
  Url,
}


text:
<?php defined('BX_DOL') or die('hack attempt');

define('BX_DOL_STUDIO_DSG_TYPE_GENERAL', 'general');
define('BX_DOL_STUDIO_DSG_TYPE_LOGO', 'logo');
define('BX_DOL_STUDIO_DSG_TYPE_ICON', 'icon');
define('BX_DOL_STUDIO_DSG_TYPE_COVER', 'cover');
define('BX_DOL_STUDIO_DSG_TYPE_SETTINGS', 'settings');

define('BX_DOL_STUDIO_DSG_TYPE_DEFAULT', 'general');

class BxDolStudioDesigner extends BxTemplStudioPage
{
    protected $sPage;

    function __construct($sPage = "")
    {
        parent::__construct('designer');

        $this->oDb = new BxDolStudioDesignerQuery();

        $this->sPage = BX_DOL_STUDIO_DSG_TYPE_DEFAULT;
        if(is_string($sPage) && !empty($sPage))
            $this->sPage = $sPage;

        //--- Check actions ---//
        if(($sAction = bx_get('dsg_action')) !== false) {
            $sAction = bx_process_input($sAction);

            $aResult = array('code' => 1, 'message' => _t('_adm_dsg_err_cannot_process_action'));
            switch($sAction) {
                case 'delete_logo':
                    $aResult = array('code' => 0, 'message' => '');
                    if(!$this->deleteLogo())
                        $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_remove_old_logo'));
                    break;

                case 'make_default':
                    $aResult = array('code' => 0, 'message' => '');
                    if(!$this->makeDefault())
                        $aResult = array('code' => 2, 'message' => _t('_adm_dsg_err_make_default'));
                    break;

                case 'get-page-by-type':
                    $sValue = bx_process_input(bx_get('dsg_value'));
                    if(empty($sValue))
                        break;

                    $this->sPage = $sValue;
                    $aResult = array('code' => 0, 'content' => $this->getPageCode());
                    break;
            }

            echo json_encode($aResult);
            exit;
        }
    }

    function makeDefault()
    {
        $sValue = bx_get('dsg_value');
        if($sValue === false)
            return false;

        $sValue = bx_process_input($sValue);
        return $this->oDb->setParam('template', $sValue);
    }

    function submitLogo(&$oForm)
    {
        $iProfileId = getLoggedId();

        if(!empty($_FILES['image']['tmp_name'])) {
            $oStorage = BxDolStorage::getObjectInstance('sys_images_custom');

            if(!$this->deleteLogo())
                return $this->getJsResult('_adm_dsg_err_remove_old_logo');

            $iId = $oStorage->storeFileFromForm($_FILES['image'], false, $iProfileId);
            if($iId === false) {
                $this->oDb->setParam('sys_site_logo', 0);
                return $this->getJsResult(_t('_adm_dsg_err_save') . $oStorage->getErrorString(), false);
            }

            $this->oDb->setParam('sys_site_logo', $iId);
            $oStorage->afterUploadCleanup($iId, $iProfileId);
        }

        $this->oDb->setParam('sys_site_logo_alt', $oForm->getCleanValue('alt'));
        $this->oDb->setParam('sys_site_logo_width', $oForm->getCleanValue('width'));
        $this->oDb->setParam('sys_site_logo_height', $oForm->getCleanValue('height'));
        return $this->getJsResult('_adm_dsg_scs_save', true, true, BX_DOL_URL_STUDIO . 'designer.php?page=' . BX_DOL_STUDIO_DSG_TYPE_LOGO);
    }

    function deleteLogo()
    {
        $iProfileId = getLoggedId();

        $oStorage = BxDolStorage::getObjectInstance('sys_images_custom');

        $iId = (int)getParam('sys_site_logo');
        if($iId != 0 && !$oStorage->deleteFile($iId, $iProfileId))
            return false;

        $this->oDb->setParam('sys_site_logo', 0);
        return true;
    }

    function submitIcon(&$oForm)
    {
        $iProfileId = getLoggedId();

        $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);

        $iId = (int)getParam('sys_site_icon');
        if($iId != 0 && !$oStorage->deleteFile($iId, $iProfileId))
            return $this->getJsResult('_adm_dsg_err_remove_old_icon');

        $iId = $oStorage->storeFileFromForm($_FILES['image'], true, $iProfileId);
        if($iId === false) {
            $this->oDb->setParam('sys_site_icon', 0);
            return $this->getJsResult(_t('_adm_dsg_err_save') . $oStorage->getErrorString(), false);
        }

        $this->oDb->setParam('sys_site_icon', $iId);
        $oStorage->afterUploadCleanup($iId, $iProfileId);

        return $this->getJsResult('_adm_dsg_scs_save', true, true, BX_DOL_URL_STUDIO . 'designer.php?page=' . BX_DOL_STUDIO_DSG_TYPE_ICON);
    }

    function submitCover(&$oForm)
    {
    	$this->oDb->setParam('sys_site_cover_code', $oForm->getCleanValue('code'));
        $this->oDb->setParam('sys_site_cover_enabled', $oForm->getCleanValue('enabled') == 'on' ? 'on' : '');

        return $this->getJsResult('_adm_dsg_scs_save', true, true, BX_DOL_URL_STUDIO . 'designer.php?page=' . BX_DOL_STUDIO_DSG_TYPE_COVER);
    }
}

/** @} */