text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\MediaBundle\Entity;

use JMS\Serializer\Annotation\Exclude;
use Sulu\Component\Persistence\Model\AuditableInterface;

/**
 * FileVersion.
 */
class FileVersion implements AuditableInterface
{
    /**
     * @var string
     */
    private $name;

    /**
     * @var int
     */
    private $version;

    /**
     * @var int
     */
    private $size;

    /**
     * @var string
     */
    private $mimeType;

    /**
     * @var string
     */
    private $storageOptions;

    /**
     * @var string
     */
    private $storageType;

    /**
     * @var int
     */
    private $downloadCounter = 0;

    /**
     * @var \DateTime
     */
    private $created;

    /**
     * @var \DateTime
     */
    private $changed;

    /**
     * @var int
     */
    private $id;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $contentLanguages;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $publishLanguages;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $meta;

    /**
     * @var \Sulu\Bundle\MediaBundle\Entity\File
     * @Exclude
     */
    private $file;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $tags;

    /**
     * @var \Sulu\Component\Security\Authentication\UserInterface
     */
    private $changer;

    /**
     * @var \Sulu\Component\Security\Authentication\UserInterface
     */
    private $creator;

    /**
     * @var \Sulu\Bundle\MediaBundle\Entity\FileVersionMeta
     */
    private $defaultMeta;

    /**
     * @var string
     */
    private $properties = '{}';

    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->contentLanguages = new \Doctrine\Common\Collections\ArrayCollection();
        $this->publishLanguages = new \Doctrine\Common\Collections\ArrayCollection();
        $this->meta = new \Doctrine\Common\Collections\ArrayCollection();
        $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Set name.
     *
     * @param string $name
     *
     * @return FileVersion
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set version.
     *
     * @param int $version
     *
     * @return FileVersion
     */
    public function setVersion($version)
    {
        $this->version = $version;

        return $this;
    }

    /**
     * Get version.
     *
     * @return int
     */
    public function getVersion()
    {
        return $this->version;
    }

    /**
     * Set size.
     *
     * @param int $size
     *
     * @return FileVersion
     */
    public function setSize($size)
    {
        $this->size = $size;

        return $this;
    }

    /**
     * Get size.
     *
     * @return int
     */
    public function getSize()
    {
        return $this->size;
    }

    /**
     * Set mimeType.
     *
     * @param string $mimeType
     *
     * @return FileVersion
     */
    public function setMimeType($mimeType)
    {
        $this->mimeType = $mimeType;

        return $this;
    }

    /**
     * Get mimeType.
     *
     * @return string
     */
    public function getMimeType()
    {
        return $this->mimeType;
    }

    /**
     * Set storageOptions.
     *
     * @param string $storageOptions
     *
     * @return FileVersion
     */
    public function setStorageOptions($storageOptions)
    {
        $this->storageOptions = $storageOptions;

        return $this;
    }

    /**
     * Get storageOptions.
     *
     * @return string
     */
    public function getStorageOptions()
    {
        return $this->storageOptions;
    }

    /**
     * Set downloadCounter.
     *
     * @param int $downloadCounter
     *
     * @return FileVersion
     */
    public function setDownloadCounter($downloadCounter)
    {
        $this->downloadCounter = $downloadCounter;

        return $this;
    }

    /**
     * Get downloadCounter.
     *
     * @return int
     */
    public function getDownloadCounter()
    {
        return $this->downloadCounter;
    }

    /**
     * Get created.
     *
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Get created.
     *
     * @param \DateTime $created
     *
     * @return $this
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Get changed.
     *
     * @return \DateTime
     */
    public function getChanged()
    {
        return $this->changed;
    }

    /**
     * Set changed.
     *
     * @param \DateTime $changed
     *
     * @return $this
     */
    public function setChanged($changed)
    {
        $this->changed = $changed;

        return $this;
    }

    /**
     * Get id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Add contentLanguages.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionContentLanguage $contentLanguages
     *
     * @return FileVersion
     */
    public function addContentLanguage(\Sulu\Bundle\MediaBundle\Entity\FileVersionContentLanguage $contentLanguages)
    {
        $this->contentLanguages[] = $contentLanguages;

        return $this;
    }

    /**
     * Remove contentLanguages.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionContentLanguage $contentLanguages
     */
    public function removeContentLanguage(\Sulu\Bundle\MediaBundle\Entity\FileVersionContentLanguage $contentLanguages)
    {
        $this->contentLanguages->removeElement($contentLanguages);
    }

    /**
     * Get contentLanguages.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getContentLanguages()
    {
        return $this->contentLanguages;
    }

    /**
     * Add publishLanguages.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionPublishLanguage $publishLanguages
     *
     * @return FileVersion
     */
    public function addPublishLanguage(\Sulu\Bundle\MediaBundle\Entity\FileVersionPublishLanguage $publishLanguages)
    {
        $this->publishLanguages[] = $publishLanguages;

        return $this;
    }

    /**
     * Remove publishLanguages.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionPublishLanguage $publishLanguages
     */
    public function removePublishLanguage(\Sulu\Bundle\MediaBundle\Entity\FileVersionPublishLanguage $publishLanguages)
    {
        $this->publishLanguages->removeElement($publishLanguages);
    }

    /**
     * Get publishLanguages.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPublishLanguages()
    {
        return $this->publishLanguages;
    }

    /**
     * Add meta.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $meta
     *
     * @return FileVersion
     */
    public function addMeta(\Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $meta)
    {
        $this->meta[] = $meta;

        return $this;
    }

    /**
     * Remove meta.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $meta
     */
    public function removeMeta(\Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $meta)
    {
        $this->meta->removeElement($meta);
    }

    /**
     * Get meta.
     *
     * @return FileVersionMeta[]
     */
    public function getMeta()
    {
        return $this->meta;
    }

    /**
     * Set file.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\File $file
     *
     * @return FileVersion
     */
    public function setFile(\Sulu\Bundle\MediaBundle\Entity\File $file = null)
    {
        $this->file = $file;

        return $this;
    }

    /**
     * Get file.
     *
     * @return \Sulu\Bundle\MediaBundle\Entity\File
     */
    public function getFile()
    {
        return $this->file;
    }

    /**
     * Add tags.
     *
     * @param \Sulu\Bundle\TagBundle\Entity\Tag $tags
     *
     * @return FileVersion
     */
    public function addTag(\Sulu\Bundle\TagBundle\Entity\Tag $tags)
    {
        $this->tags[] = $tags;

        return $this;
    }

    /**
     * Remove tags.
     *
     * @param \Sulu\Bundle\TagBundle\Entity\Tag $tags
     */
    public function removeTag(\Sulu\Bundle\TagBundle\Entity\Tag $tags)
    {
        $this->tags->removeElement($tags);
    }

    /**
     * Remove all tags.
     */
    public function removeTags()
    {
        $this->tags->clear();
    }

    /**
     * Get tags.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTags()
    {
        return $this->tags;
    }

    /**
     * Set changer.
     *
     * @param \Sulu\Component\Security\Authentication\UserInterface $changer
     *
     * @return FileVersion
     */
    public function setChanger(\Sulu\Component\Security\Authentication\UserInterface $changer = null)
    {
        $this->changer = $changer;

        return $this;
    }

    /**
     * Get changer.
     *
     * @return \Sulu\Component\Security\Authentication\UserInterface
     */
    public function getChanger()
    {
        return $this->changer;
    }

    /**
     * Set creator.
     *
     * @param \Sulu\Component\Security\Authentication\UserInterface $creator
     *
     * @return FileVersion
     */
    public function setCreator(\Sulu\Component\Security\Authentication\UserInterface $creator = null)
    {
        $this->creator = $creator;

        return $this;
    }

    /**
     * Get creator.
     *
     * @return \Sulu\Component\Security\Authentication\UserInterface
     */
    public function getCreator()
    {
        return $this->creator;
    }

    /**
     * Set defaultMeta.
     *
     * @param \Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $defaultMeta
     *
     * @return FileVersion
     */
    public function setDefaultMeta(\Sulu\Bundle\MediaBundle\Entity\FileVersionMeta $defaultMeta = null)
    {
        $this->defaultMeta = $defaultMeta;

        return $this;
    }

    /**
     * Get defaultMeta.
     *
     * @return \Sulu\Bundle\MediaBundle\Entity\FileVersionMeta
     */
    public function getDefaultMeta()
    {
        return $this->defaultMeta;
    }

    /**
     * don't clone id to create a new entities.
     */
    public function __clone()
    {
        if ($this->id) {
            $this->id = null;
            /** @var FileVersionMeta[] $newMetaList */
            $newMetaList = [];
            $defaultMetaLocale = $this->getDefaultMeta()->getLocale();

            /** @var FileVersionContentLanguage[] $newContentLanguageList */
            $newContentLanguageList = [];

            /** @var FileVersionPublishLanguage[] $newPublishLanguageList */
            $newPublishLanguageList = [];

            /** @var FileVersionMeta $meta */
            foreach ($this->meta as $meta) {
                $newMetaList[] = clone $meta;
            }

            $this->meta->clear();
            foreach ($newMetaList as $newMeta) {
                $newMeta->setFileVersion($this);
                $this->addMeta($newMeta);

                if ($newMeta->getLocale() === $defaultMetaLocale) {
                    $this->setDefaultMeta($newMeta);
                }
            }

            /** @var FileVersionContentLanguage $contentLanguage */
            foreach ($this->contentLanguages as $contentLanguage) {
                $newContentLanguageList[] = clone $contentLanguage;
            }

            $this->contentLanguages->clear();
            foreach ($newContentLanguageList as $newContentLanguage) {
                $newContentLanguage->setFileVersion($this);
                $this->addContentLanguage($newContentLanguage);
            }

            /** @var FileVersionPublishLanguage $publishLanguage */
            foreach ($this->publishLanguages as $publishLanguage) {
                $newPublishLanguageList[] = clone $publishLanguage;
            }

            $this->publishLanguages->clear();
            foreach ($newPublishLanguageList as $newPublishLanguage) {
                $newPublishLanguage->setFileVersion($this);
                $this->addPublishLanguage($newPublishLanguage);
            }
        }
    }

    /**
     * Set storageType.
     *
     * @param string $storageType
     *
     * @return FileVersion
     */
    public function setStorageType($storageType)
    {
        $this->storageType = $storageType;

        return $this;
    }

    /**
     * Get storageType.
     *
     * @return string
     */
    public function getStorageType()
    {
        return $this->storageType;
    }

    /**
     * @return array
     */
    public function getProperties()
    {
        return json_decode($this->properties, true);
    }

    /**
     * @param array $properties
     *
     * @return self
     */
    public function setProperties(array $properties)
    {
        $this->properties = json_encode($properties);

        return $this;
    }
}


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

        <!--window默认是黑色配置是否透明(window是最顶级,在decoreView的外面)-->
        <item name="android:windowIsTranslucent">true</item>
        <item name="ate_key">default_theme</item>
    </style>

</resources>

redpajama_set_name: RedPajamaGithub


text:
package com.sinespera.controller;

import java.util.concurrent.atomic.AtomicLong;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sinespera.model.Greeting;
import com.sinespera.model.Usuario;

@RestController
public class GreetingController {

	private static final String template = "Hello, %s!";

	private final AtomicLong counter = new AtomicLong();

	@RequestMapping("/greeting")
	public Greeting greeting(@AuthenticationPrincipal Usuario user) {
		return new Greeting(counter.incrementAndGet(),
				String.format(template, user.getNombre()));
	}

}


text:
<?php
if(isset($_POST['username']) && isset($_POST['pass']) && isset($_POST['pass2'])) {
	// DB Info
	$user = "username";
	$pass = "password";
	$db = new PDO('mysql:host=127.0.0.1;mydatabase', $user, $pass);

	// Captcha info
	$recaptcha_secret = "secretgoeshere";
	$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
        $response = json_decode($response, true);

    // Begin register
	$username = trim($_POST['username']);
	$password = $_POST['pass'];
	$confirm = $_POST['pass2'];
	$salt = uniqid(mt_rand(), true);
	$hashedPassword = md5($password . $salt);
	if(strlen($username) >= 4 && strlen($username) <= 12 && ctype_alnum(str_replace(" ","",$username))) { // Minimum 4, maximum 12 characters for username
		$nametaken = $db->prepare("SELECT * from users where username = :username");
		$nametaken->bindParam(':username', $username);
		$nametaken->execute();
		if($nametaken->rowCount() == 0) {
			if(strlen($password) >= 8 && strlen($password) <= 32) { // Minimum 8, maximum 32 characters for password
				if($password == $confirm) { // Do the passwords match?
					if($response["success"]  === true) { // They aren't a flesh eating robot from the future...
						$reg = $db->prepare("INSERT INTO users (id, username, password, salt) VALUES (NULL, :username, :password, :salt)");
						$reg->bindParam(':username', $username);
						$reg->bindParam(':password', $hashedPassword);
						$reg->bindParam(':salt', $salt);
						$reg->execute();
						$msg = "Successfully registered! You may now login.";
					} else {
						$msg = "The reCaptcha was not completed correctly.";
					}
				} else {
					$msg = "Your passwords did not match.";
				}
			} else {
				$msg = "Your password must be between 8 and 32 characters.";
			}
		} else {
			$msg = "That username is already taken!";
		}
	} else {
		$msg = "Your username must be between 4 and 12 characters and contain only letters, numbers, and/or spaces.";
	}
}
?>
<!DOCTYPE HTML>

<title>Register</title>

<?php if (!empty($msg)) {
   echo "
$msg
";
} ?>

Register

<form action="register.php" method="post">
<input type="text" name="username" id="username" placeholder="Create a Username" maxlength="12">

<input type="password" name="pass" id="pass" placeholder="Create a Password" maxlength="32">

<input type="password" name="pass2" id="pass2" placeholder="Confirm Password" maxlength="32">

<input type="submit" value="Register">


text:
<!DOCTYPE HTML>

        <link rel="stylesheet" type="text/css" href="../../funcunit/qunit/qunit.css" />
        <title>can Plugin Test</title>

can Plugin Tests


text:
import { HtmlElementAst, HtmlAttrAst, htmlVisitAll } from 'angular2/src/compiler/html_ast';
import { BaseException } from 'angular2/src/facade/exceptions';
/**
 * Expands special forms into elements.
 *
 * For example,
 *
 * ```
 * { messages.length, plural,
 *   =0 {zero}
 *   =1 {one}
 *   =other {more than one}
 * }
 * ```
 *
 * will be expanded into
 *
 * ```
 * <ul [ngPlural]="messages.length">
 *   <template [ngPluralCase]="0"><li i18n="plural_0">zero</li></template>
 *   <template [ngPluralCase]="1"><li i18n="plural_1">one</li></template>
 *   <template [ngPluralCase]="other"><li i18n="plural_other">more than one</li></template>
 * </ul>
 * ```
 */
export function expandNodes(nodes) {
    let e = new _Expander();
    let n = htmlVisitAll(e, nodes);
    return new ExpansionResult(n, e.expanded);
}
export class ExpansionResult {
    constructor(nodes, expanded) {
        this.nodes = nodes;
        this.expanded = expanded;
    }
}
class _Expander {
    constructor() {
        this.expanded = false;
    }
    visitElement(ast, context) {
        return new HtmlElementAst(ast.name, ast.attrs, htmlVisitAll(this, ast.children), ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
    }
    visitAttr(ast, context) { return ast; }
    visitText(ast, context) { return ast; }
    visitComment(ast, context) { return ast; }
    visitExpansion(ast, context) {
        this.expanded = true;
        return ast.type == "plural" ? _expandPluralForm(ast) : _expandDefaultForm(ast);
    }
    visitExpansionCase(ast, context) {
        throw new BaseException("Should not be reached");
    }
}
function _expandPluralForm(ast) {
    let children = ast.cases.map(c => {
        let expansionResult = expandNodes(c.expression);
        let i18nAttrs = expansionResult.expanded ?
            [] :
            [new HtmlAttrAst("i18n", `${ast.type}_${c.value}`, c.valueSourceSpan)];
        return new HtmlElementAst(`template`, [
            new HtmlAttrAst("ngPluralCase", c.value, c.valueSourceSpan),
        ], [
            new HtmlElementAst(`li`, i18nAttrs, expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan)
        ], c.sourceSpan, c.sourceSpan, c.sourceSpan);
    });
    let switchAttr = new HtmlAttrAst("[ngPlural]", ast.switchValue, ast.switchValueSourceSpan);
    return new HtmlElementAst("ul", [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
}
function _expandDefaultForm(ast) {
    let children = ast.cases.map(c => {
        let expansionResult = expandNodes(c.expression);
        let i18nAttrs = expansionResult.expanded ?
            [] :
            [new HtmlAttrAst("i18n", `${ast.type}_${c.value}`, c.valueSourceSpan)];
        return new HtmlElementAst(`template`, [
            new HtmlAttrAst("ngSwitchWhen", c.value, c.valueSourceSpan),
        ], [
            new HtmlElementAst(`li`, i18nAttrs, expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan)
        ], c.sourceSpan, c.sourceSpan, c.sourceSpan);
    });
    let switchAttr = new HtmlAttrAst("[ngSwitch]", ast.switchValue, ast.switchValueSourceSpan);
    return new HtmlElementAst("ul", [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
}


text:
package org.apache.harmony.beans.tests.support;

import java.beans.PropertyChangeListener;

public class OtherBean {

    public void addSampleListener(SampleListener listener) {
    }

    public void removeSampleListener(SampleListener listener) {
    }

    // no corresponding add method
    public void removePropertyChangeListener(PropertyChangeListener listener) {
    }

    public void setNumber(int a) {
    }

    public void set(int a) {
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
	<info organisation="grafos-de-gran-escala"
		module="grafos-de-gran-escala_2.10"
		revision="1.0"
		status="integration"
		publication="20160824134316"
	>
		<description>
		Grafos de Gran Escala
		</description>
	</info>
	<configurations>
		<conf name="compile" visibility="public" description=""/>
		<conf name="runtime" visibility="public" description="" extends="compile"/>
		<conf name="test" visibility="public" description="" extends="runtime"/>
		<conf name="provided" visibility="public" description=""/>
		<conf name="optional" visibility="public" description=""/>
		<conf name="compile-internal" visibility="private" description="" extends="compile,optional,provided"/>
		<conf name="runtime-internal" visibility="private" description="" extends="runtime,optional"/>
		<conf name="test-internal" visibility="private" description="" extends="test,optional,provided"/>
		<conf name="plugin" visibility="private" description=""/>
		<conf name="sources" visibility="public" description=""/>
		<conf name="docs" visibility="public" description=""/>
		<conf name="pom" visibility="public" description=""/>
		<conf name="scala-tool" visibility="private" description=""/>
	</configurations>
	<publications>
		<artifact name="grafos-de-gran-escala_2.10" type="pom" ext="pom" conf="pom"/>
		<artifact name="grafos-de-gran-escala_2.10" type="jar" ext="jar" conf="compile"/>
		<artifact name="grafos-de-gran-escala_2.10" type="src" ext="jar" conf="sources" e:classifier="sources"/>
		<artifact name="grafos-de-gran-escala_2.10" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
	</publications>
	<dependencies>
		<dependency org="org.scala-lang" name="scala-compiler" rev="2.10.3" conf="scala-tool->default,optional(default)"/>
		<dependency org="org.scala-lang" name="scala-library" rev="2.10.3" conf="scala-tool->default,optional(default);compile->default(compile)"/>
		<dependency org="org.apache.spark" name="spark-graphx_2.10" rev="2.0.0" conf="compile->default(compile)"/>
		<dependency org="org.graphstream" name="gs-core" rev="1.2" conf="compile->default(compile)"/>
		<dependency org="log4j" name="log4j" rev="1.2.17" conf="compile->default(compile)"/>
	</dependencies>
</ivy-module>


text:
"""
libcloud provides a unified interface to the cloud computing resources.

:var __version__: Current version of libcloud
"""

import os
import codecs
import atexit

from libcloud.base import DriverType  # NOQA
from libcloud.base import DriverTypeFactoryMap  # NOQA
from libcloud.base import get_driver  # NOQA

try:
    # TODO: This import is slow and adds overhead in situations when no
    # requests are made but it's necessary for detecting bad version of
    # requests
    import requests  # NOQA

    have_requests = True
except ImportError:
    have_requests = False

__all__ = ["__version__", "enable_debug"]

__version__ = "3.5.2-dev"

def enable_debug(fo):
    """
    Enable library wide debugging to a file-like object.

    :param fo: Where to append debugging information
    :type fo: File like object, only write operations are used.
    """
    from libcloud.common.base import Connection
    from libcloud.utils.loggingconnection import LoggingConnection

    LoggingConnection.log = fo
    Connection.conn_class = LoggingConnection

    # Ensure the file handle is closed on exit
    def close_file(fd):
        try:
            fd.close()
        except Exception:
            pass

    atexit.register(close_file, fo)

def _init_once():
    """
    Utility function that is ran once on Library import.

    This checks for the LIBCLOUD_DEBUG environment variable, which if it exists
    is where we will log debug information about the provider transports.

    This also checks for known environment/dependency incompatibilities.
    """
    path = os.getenv("LIBCLOUD_DEBUG")

    if path:
        mode = "a"

        # Special case for /dev/stderr and /dev/stdout on Python 3.
        from libcloud.utils.py3 import PY3

        # Opening those files in append mode will throw "illegal seek"
        # exception there.
        # Late import to avoid setup.py related side affects
        if path in ["/dev/stderr", "/dev/stdout"] and PY3:
            mode = "w"

        fo = codecs.open(path, mode, encoding="utf8")
        enable_debug(fo)

        # NOTE: We use lazy import to avoid unnecessary import time overhead
        try:
            import paramiko  # NOQA

            have_paramiko = True
        except ImportError:
            have_paramiko = False

        if have_paramiko and hasattr(paramiko.util, "log_to_file"):
            import logging

            # paramiko always tries to open file path in append mode which
            # won't work with /dev/{stdout, stderr} so we just ignore those
            # errors
            try:
                paramiko.util.log_to_file(filename=path, level=logging.DEBUG)
            except OSError as e:
                if "illegal seek" not in str(e).lower():
                    raise e

    # check for broken `yum install python-requests`
    if have_requests and requests.__version__ == "2.6.0":
        chardet_version = requests.packages.chardet.__version__
        required_chardet_version = "2.3.0"
        assert chardet_version == required_chardet_version, (
            "Known bad version of requests detected! This can happen when "
            "requests was installed from a source other than PyPI, e.g. via "
            "a package manager such as yum. Please either install requests "
            "from PyPI or run `pip install chardet==%s` to resolve this "
            "issue." % required_chardet_version
        )

_init_once()