text:
package scala
package reflect
package internal

import Flags._

trait Mirrors extends api.Mirrors {
  thisUniverse: SymbolTable =>

  override type Mirror >: Null <: RootsBase

  // root symbols hold a strong reference to the enclosing mirror
  // this prevents the mirror from being collected
  // if there are any symbols created by that mirror
  trait RootSymbol extends Symbol { def mirror: Mirror }

  abstract class RootsBase(rootOwner: Symbol) extends scala.reflect.api.Mirror[Mirrors.this.type] { thisMirror =>
    private[this] var initialized = false
    def isMirrorInitialized = initialized

    protected[scala] def rootLoader: LazyType

    val RootClass: ClassSymbol
    val RootPackage: ModuleSymbol
    val EmptyPackageClass: ClassSymbol
    val EmptyPackage: ModuleSymbol

    def symbolOf[T: universe.WeakTypeTag]: universe.TypeSymbol = universe.weakTypeTag[T].in(this).tpe.typeSymbolDirect.asType

    def findMemberFromRoot(fullName: Name): Symbol = {
      val segs = nme.segments(fullName.toString, fullName.isTermName)
      if (segs.isEmpty) NoSymbol
      else definitions.findNamedMember(segs.tail, RootClass.info member segs.head)
    }

    /** Todo: organize similar to mkStatic in scala.reflect.Base */
    @annotation.unused
    private def getModuleOrClass(path: Name, len: Int): Symbol =
      getModuleOrClass(path.toString, len, path.newName(_))

    private def getModuleOrClass(path: String, len: Int, toName: String => Name): Symbol = {
      val point  = path.lastIndexOf('.', len - 1)
      val owner  = if (point > 0) getModuleOrClass(path, point, newTermName(_)) else RootClass
      val name   = toName(path.substring(point + 1, len))
      val sym    = owner.info.member(name)
      val result = if (name.isTermName) sym.suchThat(_.hasFlag(MODULE)) else sym
      if (result != NoSymbol) result
      else {
        if (settings.isDebug) { log(sym.info); log(sym.info.members) }//debug
        thisMirror.missingHook(owner, name) orElse {
          MissingRequirementError.notFound(s"${if (name.isTermName) "object" else "class"} $path in $thisMirror")
        }
      }
    }

    /** If you're looking for a class, pass a type name.
     *  If a module, a term name.
     *
     *  Unlike `staticModuleOrClass`, this function
     *  loads unqualified names from the root package.
     */
    private def getModuleOrClass(path: String, toName: String => Name): Symbol =
      getModuleOrClass(path, path.length, toName)

    /** If you're looking for a class, pass a type name.
     *  If a module, a term name.
     *
     *  Unlike `getModuleOrClass`, this function
     *  loads unqualified names from the empty package.
     */
    private def staticModuleOrClass(path: String, toName: String => Name): Symbol = {
      val isPackageless = !path.contains('.')
      if (isPackageless) EmptyPackageClass.info decl toName(path)
      else getModuleOrClass(path, toName)
    }

    protected def mirrorMissingHook(owner: Symbol, name: Name): Symbol = NoSymbol

    protected def universeMissingHook(owner: Symbol, name: Name): Symbol = thisUniverse.missingHook(owner, name)

    private[scala] def missingHook(owner: Symbol, name: Name): Symbol = logResult(s"missingHook($owner, $name)")(
      mirrorMissingHook(owner, name) orElse universeMissingHook(owner, name)
    )

    // todo: get rid of most the methods here and keep just staticClass/Module/Package

    /************************ loaders of class symbols ************************/

    private def ensureClassSymbol(fullname: String, sym: Symbol): ClassSymbol =
      sym match {
        case x: ClassSymbol => x
        case _              => MissingRequirementError.notFound("class " + fullname)
      }

    @deprecated("Use overload that accepts a String.", "2.13.0")
    def getClassByName(fullname: Name): ClassSymbol =
      ensureClassSymbol(fullname.toString, getModuleOrClass(fullname.toString, fullname.length, newTypeName(_)))

    def getClassByName(fullname: String): ClassSymbol =
      getRequiredClass(fullname)

    // TODO_NAMES
    def getRequiredClass(fullname: String, toName: String => Name): ClassSymbol =
      ensureClassSymbol(fullname, getModuleOrClass(fullname, fullname.length, toName))

    def getRequiredClass(fullname: String): ClassSymbol =
      ensureClassSymbol(fullname, getModuleOrClass(fullname, fullname.length, newTypeName(_)))

    def requiredClass[T: ClassTag] : ClassSymbol =
      getRequiredClass(erasureName[T], newTypeName(_))

    def getClassIfDefined(fullname: String): Symbol =
      getClassIfDefined(fullname, newTypeName(_))

    @deprecated("Use overload that accepts a String.", "2.13.0")
    def getClassIfDefined(fullname: Name): Symbol =
      wrapMissing(getClassByName(fullname.toTypeName))

    // TODO_NAMES
    def getClassIfDefined(fullname: String, toName: String => Name): Symbol =
      wrapMissing(getRequiredClass(fullname, toName))

    /** @inheritdoc
     *
     *  Unlike getClassByName/getRequiredClass this function can also load packageless symbols.
     *  Compiler might ignore them, but they should be loadable with macros.
     */
    override def staticClass(fullname: String): ClassSymbol =
      try ensureClassSymbol(fullname, staticModuleOrClass(fullname, newTypeName(_)))
      catch { case mre: MissingRequirementError => throw new ScalaReflectionException(mre.msg) }

    /************************ loaders of module symbols ************************/

    private def ensureModuleSymbol(fullname: String, sym: Symbol, allowPackages: Boolean): ModuleSymbol =
      sym match {
        case x: ModuleSymbol if allowPackages || !x.hasPackageFlag => x
        case _                                                     => MissingRequirementError.notFound(s"object $fullname")
      }

    @deprecated("Use overload that accepts a String.", "2.13.0")
    def getModuleByName(fullname: Name): ModuleSymbol =
      getModuleByName(fullname.toString)

    def getModuleByName(fullname: String): ModuleSymbol =
      ensureModuleSymbol(fullname, getModuleOrClass(fullname, fullname.length, newTermName(_)), allowPackages = true)

    def getRequiredModule(fullname: String): ModuleSymbol =
      getModuleByName(fullname)

    // TODO: What syntax do we think should work here? Say you have an object
    // like scala.Predef.  You can't say requiredModule[scala.Predef] since there's
    // no accompanying Predef class, and if you say requiredModule[scala.Predef.type]
    // the name found via the erasure is scala.Predef$.  For now I am
    // removing the trailing $, but I think that classTag should have
    // a method which returns a usable name, one which doesn't expose this
    // detail of the backend.
    def requiredModule[T: ClassTag] : ModuleSymbol =
      getRequiredModule(erasureName[T] stripSuffix "$")

    def getModuleIfDefined(fullname: String): Symbol =
      wrapMissing(getModuleByName(fullname))

    @deprecated("Use overload that accepts a String.", "2.13.0")
    def getModuleIfDefined(fullname: Name): Symbol =
      getModuleIfDefined(fullname.toString)

    /** @inheritdoc
     *
     *  Unlike getModule/getRequiredModule this function can also load packageless symbols.
     *  Compiler might ignore them, but they should be loadable with macros.
     */
    override def staticModule(fullname: String): ModuleSymbol =
      try ensureModuleSymbol(fullname, staticModuleOrClass(fullname, newTermName(_)), allowPackages = false)
      catch { case mre: MissingRequirementError => throw new ScalaReflectionException(mre.msg) }

    /************************ loaders of package symbols ************************/

    private def ensurePackageSymbol(fullname: String, sym: Symbol, allowModules: Boolean): ModuleSymbol =
      sym match {
        case x: ModuleSymbol if allowModules || x.hasPackageFlag => x
        case _                                                   => MissingRequirementError.notFound("package " + fullname)
      }

    @deprecated("use overload that accepts a String.", since = "2.13.0")
    def getPackage(fullname: TermName): ModuleSymbol =
      getPackage(fullname.toString)
    def getPackage(fullname: String): ModuleSymbol =
      ensurePackageSymbol(fullname, getModuleOrClass(fullname, newTermName(_)), allowModules = true)

    @deprecated("use overload that accepts a String.", since = "2.12.11")
    def getPackageIfDefined(fullname: TermName): Symbol =
      getPackageIfDefined(fullname.toString)
    def getPackageIfDefined(fullname: String): Symbol =
      wrapMissing(getPackage(fullname))

    @deprecated("use getPackage", "2.11.0")
    def getRequiredPackage(fullname: String): ModuleSymbol =
      getPackage(fullname)

    @deprecated("use overload that accepts a String.", since = "2.12.11")
    def getPackageObject(fullname: TermName): ModuleSymbol =
      getPackageObject(fullname.toString)
    def getPackageObject(fullname: String): ModuleSymbol =
      getPackage(fullname).packageObject match {
        case x: ModuleSymbol => x
        case _               => MissingRequirementError.notFound("package object " + fullname)
      }

    @deprecated("use overload that accepts a String.", since = "2.12.11")
    def getPackageObjectIfDefined(fullname: TermName): Symbol =
      getPackageObjectIfDefined(fullname.toString)
    def getPackageObjectIfDefined(fullname: String): Symbol =
      wrapMissing(getPackageObject(fullname))

    override def staticPackage(fullname: String): ModuleSymbol =
      try ensurePackageSymbol(fullname.toString, getModuleOrClass(fullname, fullname.length, newTermName(_)), allowModules = false)
      catch { case mre: MissingRequirementError => throw new ScalaReflectionException(mre.msg) }

    /************************ helpers ************************/

    def erasureName[T: ClassTag] : String = {
      /* We'd like the String representation to be a valid
       * scala type, so we have to decode the jvm's secret language.
       */
      def erasureString(clazz: Class[_]): String = {
        if (clazz.isArray) "Array[" + erasureString(clazz.getComponentType) + "]"
        else clazz.getName
      }
      erasureString(classTag[T].runtimeClass)
    }

   @inline final def wrapMissing(body: => Symbol): Symbol =
      try body
      catch { case _: MissingRequirementError => NoSymbol }

    def init(): Unit = if (!initialized) {
      // Still fiddling with whether it's cleaner to do some of this setup here
      // or from constructors.  The latter approach tends to invite init order issues.

      EmptyPackageClass setInfo rootLoader
      EmptyPackage setInfo EmptyPackageClass.tpe

      connectModuleToClass(EmptyPackage, EmptyPackageClass)
      connectModuleToClass(RootPackage, RootClass)

      RootClass.info.decls enter EmptyPackage
      RootClass.info.decls enter RootPackage

      if (rootOwner != NoSymbol) {
        // synthetic core classes are only present in root mirrors
        // because Definitions.scala, which initializes and enters them, only affects rootMirror
        // therefore we need to enter them manually for non-root mirrors
        definitions.syntheticCoreClasses foreach (theirSym => {
          val theirOwner = theirSym.owner
          assert(theirOwner.isPackageClass, s"theirSym = $theirSym, theirOwner = $theirOwner")
          val ourOwner = staticPackage(theirOwner.fullName).moduleClass
          val ourSym = theirSym // just copy the symbol into our branch of the symbol table
          ourOwner.info.decls enterIfNew ourSym
        })
      }

      initialized = true
    }
  }

  abstract class Roots(rootOwner: Symbol) extends RootsBase(rootOwner) { thisMirror =>

    // TODO - having these as objects means they elude the attempt to
    // add synchronization in SynchronizedSymbols.  But we should either
    // flip on object overrides or find some other accommodation, because
    // lazy vals are unnecessarily expensive relative to objects and it
    // is very beneficial for a handful of bootstrap symbols to have
    // first class identities
    sealed trait WellKnownSymbol extends Symbol {
      this initFlags (PackageFlags | STATIC)
    }
    // Features common to RootClass and RootPackage, the roots of all
    // type and term symbols respectively.
    sealed trait RootSymbol extends WellKnownSymbol with thisUniverse.RootSymbol {
      final override def isRootSymbol = true
      override def owner              = rootOwner
      override def typeOfThis         = thisSym.tpe
      def mirror                      = thisMirror.asInstanceOf[Mirror]
    }

    class RootPackage extends ModuleSymbol(rootOwner, NoPosition, nme.ROOTPKG) with RootSymbol {
      this setInfo NullaryMethodType(RootClass.tpe)

      override def isRootPackage = true
    }

    // This is the package _root_.  The actual root cannot be referenced at
    // the source level, but _root_ is essentially a function => <root>.
    lazy val RootPackage = new RootPackage

    class RootClass extends PackageClassSymbol(rootOwner, NoPosition, tpnme.ROOT) with RootSymbol {
      this setInfo rootLoader

      override def isRoot            = true
      override def isEffectiveRoot   = true
      override def isNestedClass     = false
      override def sourceModule      = RootPackage
    }

    // This is <root>, the actual root of everything except the package _root_.
    // <root> and _root_ (RootPackage and RootClass) should be the only "well known"
    // symbols owned by NoSymbol.  All owner chains should go through RootClass,
    // although it is probable that some symbols are created as direct children
    // of NoSymbol to ensure they will not be stumbled upon.  (We should designate
    // a better encapsulated place for that.)
    lazy val RootClass = new RootClass

    class EmptyPackage extends ModuleSymbol(RootClass, NoPosition, nme.EMPTY_PACKAGE_NAME) with WellKnownSymbol {
      override def isEmptyPackage = true
    }

    // The empty package, which holds all top level types without given packages.
    lazy val EmptyPackage = new EmptyPackage

    class EmptyPackageClass extends PackageClassSymbol(RootClass, NoPosition, tpnme.EMPTY_PACKAGE_NAME) with WellKnownSymbol {
      override def isEffectiveRoot     = true
      override def isEmptyPackageClass = true
      override def sourceModule        = EmptyPackage
    }

    lazy val EmptyPackageClass = new EmptyPackageClass
  }
}


text:
Castanet
========
Package for building RSS feeds for hosted podcasts. RSS 2.0 and the iTunes
extensions are supported.

Installation
------------
```sh
composer require silverorange/castanet
```

redpajama_set_name: RedPajamaGithub


text:
cask 'deckhub' do
  version :latest
  sha256 :no_check

  url 'http://download.getdeckhub.com/',
      user_agent: :fake
  name 'DeckHub'
  homepage 'https://getdeckhub.com/'

  app 'DeckHub.app'
end


text:
namespace password_manager {

class PasswordReuseManagerImpl : public PasswordReuseManager,
                                 public PasswordStoreConsumer,
                                 public PasswordStoreInterface::Observer {
 public:
  PasswordReuseManagerImpl();
  ~PasswordReuseManagerImpl() override;

  // Implements KeyedService interface.
  void Shutdown() override;

  // Implements PasswordReuseManager interface.
  void Init(PrefService* prefs,
            PasswordStoreInterface* profile_store,
            PasswordStoreInterface* account_store = nullptr) override;
  void AccountStoreStateChanged() override;
  void ReportMetrics(const std::string& username,
                     bool is_under_advanced_protection) override;
  void PreparePasswordHashData(const std::string& sync_username,
                               bool is_signed_in) override;
  void CheckReuse(const std::u16string& input,
                  const std::string& domain,
                  PasswordReuseDetectorConsumer* consumer) override;
  void SaveGaiaPasswordHash(const std::string& username,
                            const std::u16string& password,
                            bool is_primary_account,
                            GaiaPasswordHashChange event) override;
  void SaveEnterprisePasswordHash(const std::string& username,
                                  const std::u16string& password) override;
  void SaveSyncPasswordHash(const PasswordHashData& sync_password_data,
                            GaiaPasswordHashChange event) override;
  void ClearGaiaPasswordHash(const std::string& username) override;
  void ClearAllGaiaPasswordHash() override;
  void ClearAllEnterprisePasswordHash() override;
  void ClearAllNonGmailPasswordHash() override;
  base::CallbackListSubscription RegisterStateCallbackOnHashPasswordManager(
      const base::RepeatingCallback<void(const std::string& username)>&
          callback) override;
  void SetPasswordStoreSigninNotifier(
      std::unique_ptr<PasswordStoreSigninNotifier> notifier) override;
  void SchedulePasswordHashUpdate(bool should_log_metrics,
                                  bool does_primary_account_exists,
                                  bool is_signed_in) override;
  void ScheduleEnterprisePasswordURLUpdate() override;

 private:
  // Implements PasswordStoreConsumer interface.
  void OnGetPasswordStoreResults(
      std::vector<std::unique_ptr<PasswordForm>> results) override;

  // Implements PasswordStoreInterface::Observer
  void OnLoginsChanged(
      password_manager::PasswordStoreInterface* store,
      const password_manager::PasswordStoreChangeList& changes) override;
  void OnLoginsRetained(
      PasswordStoreInterface* store,
      const std::vector<PasswordForm>& retained_passwords) override;

  // Saves |username| and a hash of |password| for password reuse checking.
  // |is_gaia_password| indicates if it is a Gaia account. |event| is used for
  // metric logging. |is_primary_account| is whether account belong to the
  // password is a primary account.
  void SaveProtectedPasswordHash(const std::string& username,
                                 const std::u16string& password,
                                 bool is_primary_account,
                                 bool is_gaia_password,
                                 GaiaPasswordHashChange event);

  // Schedules the given |task| to be run on the 'background_task_runner_'.
  bool ScheduleTask(base::OnceClosure task);

  // TaskRunner for tasks that run on the main sequence (the UI thread).
  scoped_refptr<base::SequencedTaskRunner> main_task_runner_;

  // TaskRunner for all the background operations.
  scoped_refptr<base::SequencedTaskRunner> background_task_runner_;

  raw_ptr<PrefService> prefs_ = nullptr;

  scoped_refptr<PasswordStoreInterface> profile_store_;

  scoped_refptr<PasswordStoreInterface> account_store_;

  // The 'reuse_detector_', owned by this PasswordReuseManager instance, but
  // living on the background thread. It will be deleted asynchronously during
  // shutdown on the background thread, so it will outlive |this| along with all
  // its in-flight tasks.
  raw_ptr<PasswordReuseDetector> reuse_detector_ = nullptr;

  // Notifies PasswordReuseManager about sign-in events.
  std::unique_ptr<PasswordStoreSigninNotifier> notifier_;

  // Responsible for saving, clearing, retrieving and encryption of a password
  // hash data in preferences.
  HashPasswordManager hash_password_manager_;

  base::WeakPtrFactory<PasswordReuseManagerImpl> weak_ptr_factory_{this};
};

}  // namespace password_manager

#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_MANAGER_IMPL_H_


text:
export { default } from "./navigation-bar.component";
export type { NavigationBarProps } from "./navigation-bar.component";


text:
<?php
	/**
	 * Railpage JobNet base
	 * @since Version 3.7
	 * @package Railpage
	 * @author Michael Greenhill
	 */

	namespace Railpage\Jobs;

	use Railpage\AppCore;
	use Railpage\Module;
	use Exception;
	use DateTime;
	use Zend_Db_Expr;

	/**
	 * Base class
	 * @since Version 3.7.0
	 * @version 3.8.7
	 */

	class Jobs extends AppCore {

		/**
		 * Constructor
		 * @since Version 3.8.7
		 */

		public function __construct() {

			parent::__construct();

			$this->Module = new Module("jobs");

		}

		/**
		 * Filter jobs
		 * @since Version 3.8
		 * @param array $args
		 * @return array
		 */

		public function filter($args = false) {
			if ($args === false) {
				$args = array();
			}

			if (!is_array($args)) {
				throw new Exception("Cannot filter jobs - incorrect filter given");
				return false;
			}

			if ($this->db instanceof \sql_db) {
				$query = "SELECT j.*, jc.jn_classification_name AS job_classification_name, o.organisation_name , jl.jn_location_name AS job_location_name
					FROM jn_jobs AS j
						INNER JOIN jn_classifications AS jc ON j.job_classification_id = jc.jn_classification_id
						INNER JOIN organisation AS o ON j.organisation_id = o.organisation_id
						INNER JOIN jn_locations AS jl ON j.job_location_id = jl.jn_location_id ";

				$where = array();

				$salary_min = isset($args['job_salary_min']) ? $args['job_salary_min'] : false;
				$salary_max = isset($args['job_salary_max']) ? $args['job_salary_max'] : false;

				foreach ($args as $column => $value) {
					if (!empty($value) && $column != "job_salary_min" && $column != "job_salary_max") {
						$where[] = "j." . $column ." = '" . $this->db->real_escape_string($value) . "'";
					}
				}

				if ($salary_min) {
					$where[] = "j.job_salary >= " . $this->db->real_escape_string($salary_min);
				}

				if ($salary_max) {
					$where[] = "j.job_salary <= " . $this->db->real_escape_string($salary_max);
				}

				if (count($where)) {
					$query .= " WHERE " . implode(" AND " , $where);
				}

				$query .= " ORDER BY j.job_expiry ASC";

				if ($rs = $this->db->query($query)) {
					$return = array();
					$return['args'] = $args;
					$return['count'] = $rs->num_rows;

					while ($row = $rs->fetch_assoc()) {
						$row['job_description'] = format_post($row['job_description']);

						$return['jobs'][$row['job_id']] = $row;
					}

					return $return;
				} else {
					throw new Exception($this->db->error);
					return false;
				}
			} else {
				// Assume Zend_Db

				$query = "SELECT j.*, jc.jn_classification_name AS job_classification_name, o.organisation_name , jl.jn_location_name AS job_location_name
					FROM jn_jobs AS j
						INNER JOIN jn_classifications AS jc ON j.job_classification_id = jc.jn_classification_id
						INNER JOIN organisation AS o ON j.organisation_id = o.organisation_id
						INNER JOIN jn_locations AS jl ON j.job_location_id = jl.jn_location_id ";

				$where = array();
				$params = array();

				$salary_min = isset($args['job_salary_min']) ? $args['job_salary_min'] : false;
				$salary_max = isset($args['job_salary_max']) ? $args['job_salary_max'] : false;

				foreach ($args as $column => $value) {
					if (!empty($value) && $column != "job_salary_min" && $column != "job_salary_max") {
						$where[] = "j." . $column ." = ?";
						$params[] = $value;
					}
				}

				if ($salary_min) {
					$where[] = "j.job_salary >= ?";
					$params[] = $salary_min;
				}

				if ($salary_max) {
					$where[] = "j.job_salary <= ?";
					$params[] = $salary_max;
				}

				$where[] = "j.job_expiry > ?";
				$params[] = date("Y-m-d H:i:s");

				#printArray($where);printArray($params);die;

				if (count($where)) {
					$query .= " WHERE " . implode(" AND " , $where);
				}

				$query .= " ORDER BY j.job_expiry ASC";

				#printArray($query);die;

				if ($result = $this->db->fetchAll($query, $params)) {
					$return = array();
					$return = array();
					$return['args'] = $args;
					$return['count'] = count($result);

					foreach ($result as $row) {
						$row['job_description'] = format_post($row['job_description']);
						$return['jobs'][$row['job_id']] = $row;
					}

					return $return;
				}
			}
		}
	}
?>


text:
package org.ksoap2.transport;

import java.io.IOException;

/**
 * This is a simple extension of the {@link HttpTransportSE} class. It provides the exact same functionality
 * as that class and is provided purely for backwards-compatibility purposes. It will likely be deprecated at
 * some point in the near future.
 */
public class AndroidHttpTransport extends HttpTransportSE
{
	/**
	 * @see HttpTransportSE#HttpTransportSE(String)
	 */
	public AndroidHttpTransport(String url)
	{
		super(url);
	}

	/**
	 * @see org.ksoap2.transport.HttpTransportSE#getServiceConnection()
	 */
	@Override
	protected ServiceConnection getServiceConnection() throws IOException
	{
		return new AndroidServiceConnection(super.url);
	}
}


text:
import mock
import unittest

from swift.common.swob import Request
from swift.proxy import server as proxy_server
from swift.proxy.controllers.base import headers_to_container_info
from test.unit import fake_http_connect, FakeRing, FakeMemcache
from swift.common.storage_policy import StoragePolicy
from swift.common.request_helpers import get_sys_meta_prefix

from test.unit import patch_policies
from test.unit.common.ring.test_ring import TestRingBase

@patch_policies([StoragePolicy(0, 'zero', True, object_ring=FakeRing())])
class TestContainerController(TestRingBase):
    def setUp(self):
        TestRingBase.setUp(self)
        self.app = proxy_server.Application(None, FakeMemcache(),
                                            account_ring=FakeRing(),
                                            container_ring=FakeRing())

    def test_container_info_in_response_env(self):
        controller = proxy_server.ContainerController(self.app, 'a', 'c')
        with mock.patch('swift.proxy.controllers.base.http_connect',
                        fake_http_connect(200, 200, body='')):
            req = Request.blank('/v1/a/c', {'PATH_INFO': '/v1/a/c'})
            resp = controller.HEAD(req)
        self.assertEqual(2, resp.status_int // 100)
        self.assertTrue("swift.container/a/c" in resp.environ)
        self.assertEqual(headers_to_container_info(resp.headers),
                         resp.environ['swift.container/a/c'])

    def test_swift_owner(self):
        owner_headers = {
            'x-container-read': 'value', 'x-container-write': 'value',
            'x-container-sync-key': 'value', 'x-container-sync-to': 'value'}
        controller = proxy_server.ContainerController(self.app, 'a', 'c')

        req = Request.blank('/v1/a/c')
        with mock.patch('swift.proxy.controllers.base.http_connect',
                        fake_http_connect(200, 200, headers=owner_headers)):
            resp = controller.HEAD(req)
        self.assertEquals(2, resp.status_int // 100)
        for key in owner_headers:
            self.assertTrue(key not in resp.headers)

        req = Request.blank('/v1/a/c', environ={'swift_owner': True})
        with mock.patch('swift.proxy.controllers.base.http_connect',
                        fake_http_connect(200, 200, headers=owner_headers)):
            resp = controller.HEAD(req)
        self.assertEquals(2, resp.status_int // 100)
        for key in owner_headers:
            self.assertTrue(key in resp.headers)

    def _make_callback_func(self, context):
        def callback(ipaddr, port, device, partition, method, path,
                     headers=None, query_string=None, ssl=False):
            context['method'] = method
            context['path'] = path
            context['headers'] = headers or {}
        return callback

    def test_sys_meta_headers_PUT(self):
        # check that headers in sys meta namespace make it through
        # the container controller
        sys_meta_key = '%stest' % get_sys_meta_prefix('container')
        sys_meta_key = sys_meta_key.title()
        user_meta_key = 'X-Container-Meta-Test'
        controller = proxy_server.ContainerController(self.app, 'a', 'c')

        context = {}
        callback = self._make_callback_func(context)
        hdrs_in = {sys_meta_key: 'foo',
                   user_meta_key: 'bar',
                   'x-timestamp': '1.0'}
        req = Request.blank('/v1/a/c', headers=hdrs_in)
        with mock.patch('swift.proxy.controllers.base.http_connect',
                        fake_http_connect(200, 200, give_connect=callback)):
            controller.PUT(req)
        self.assertEqual(context['method'], 'PUT')
        self.assertTrue(sys_meta_key in context['headers'])
        self.assertEqual(context['headers'][sys_meta_key], 'foo')
        self.assertTrue(user_meta_key in context['headers'])
        self.assertEqual(context['headers'][user_meta_key], 'bar')
        self.assertNotEqual(context['headers']['x-timestamp'], '1.0')

    def test_sys_meta_headers_POST(self):
        # check that headers in sys meta namespace make it through
        # the container controller
        sys_meta_key = '%stest' % get_sys_meta_prefix('container')
        sys_meta_key = sys_meta_key.title()
        user_meta_key = 'X-Container-Meta-Test'
        controller = proxy_server.ContainerController(self.app, 'a', 'c')
        context = {}
        callback = self._make_callback_func(context)
        hdrs_in = {sys_meta_key: 'foo',
                   user_meta_key: 'bar',
                   'x-timestamp': '1.0'}
        req = Request.blank('/v1/a/c', headers=hdrs_in)
        with mock.patch('swift.proxy.controllers.base.http_connect',
                        fake_http_connect(200, 200, give_connect=callback)):
            controller.POST(req)
        self.assertEqual(context['method'], 'POST')
        self.assertTrue(sys_meta_key in context['headers'])
        self.assertEqual(context['headers'][sys_meta_key], 'foo')
        self.assertTrue(user_meta_key in context['headers'])
        self.assertEqual(context['headers'][user_meta_key], 'bar')
        self.assertNotEqual(context['headers']['x-timestamp'], '1.0')

if __name__ == '__main__':
    unittest.main()


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EducationV2.App_Code
{
    public class RoleType
    {
        public static String Applicant = "申请人员";
        public static String OrgDeptAdmin = "系统管理员";
        public static String OrgDeptDirector = "组织部部长";

        public static String DeptAdmin = "部门主管";
        public static String TeamAdmin = "团队负责人";
        public static String EduAdmin = "教育厅管理人员";
        public static String ProjectMember = "项目成员";

    }

    public class InfoStatus
    {
        public static String Draft = "未提交";
        public static String UnderAudit = "待审核";
        public static String Authoried = "审核通过";
    }
}


text:
__author__ = 'Ulric Qin'
from .bean import Bean
from rrd.store import db

class Host(Bean):
    _tbl = 'host'
    _cols = 'id, hostname, maintain_begin, maintain_end'

    def __init__(self, _id, hostname, maintain_begin, maintain_end):
        self.id = _id
        self.hostname = hostname
        self.maintain_begin = maintain_begin
        self.maintain_end = maintain_end

    @classmethod
    def query(cls, page, limit, query, maintaining, group_id):
        where = 'id in (select host_id from grp_host where grp_id = %s)'
        params = [group_id]

        if maintaining == '1':
            where += ' and maintain_begin > 0 and maintain_end > 0'

        if query:
            where += ' and hostname like %s'
            params.append('%' + query + '%')

        vs = cls.select_vs(where=where, params=params, page=page, limit=limit, order='hostname')
        total = cls.total(where, params)
        return vs, total

    @classmethod
    def maintain(cls, begin, end, host_ids):
        if not host_ids:
            return 'host ids is blank'

        cls.update('maintain_begin = %s, maintain_end = %s where id in (%s)' % (begin, end, host_ids))
        return ''

    @classmethod
    def no_maintain(cls, host_ids):
        if not host_ids:
            return 'host ids is blank'
        cls.update('maintain_begin = 0, maintain_end = 0 where id in (%s)' % host_ids)
        return ''

    @classmethod
    def all_host_dict(cls):
        rows = db.query_all('SELECT id, hostname FROM host')
        ret = {}
        if rows:
            for row in rows:
                ret[row[0]] = row[1]
        return ret

    @classmethod
    def add(cls, host_id, hostname):
        if cls.exists('id=%s', [host_id]):
            return
        cls.insert({'id': host_id, 'hostname': hostname})

    @classmethod
    def create(cls, hostname):
        if cls.exists('hostname=%s', [hostname]):
            return
        cls.insert({'hostname': hostname})


text:
package com.intellij.openapi.roots;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Consumer;
import com.intellij.util.EmptyConsumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;

public final class ModuleRootModificationUtil {
  public static void addContentRoot(@NotNull Module module, @NotNull String path) {
    updateModel(module, model -> model.addContentEntry(VfsUtilCore.pathToUrl(path)));
  }

  public static void addContentRoot(@NotNull Module module, @NotNull VirtualFile path) {
    updateModel(module, model -> model.addContentEntry(path));
  }

  public static void addModuleLibrary(@NotNull Module module,
                                      @Nullable String libName,
                                      @NotNull List<String> classesRootUrls,
                                      @NotNull List<String> sourceRootUrls) {
    addModuleLibrary(module, libName, classesRootUrls, sourceRootUrls, DependencyScope.COMPILE);
  }

  public static void addModuleLibrary(@NotNull Module module,
                                      @Nullable String libName,
                                      @NotNull List<String> classesRootUrls,
                                      @NotNull List<String> sourceRootUrls,
                                      @NotNull DependencyScope scope) {
    addModuleLibrary(module, libName, classesRootUrls, sourceRootUrls, Collections.emptyList(), scope);
  }

  public static void addModuleLibrary(@NotNull Module module,
                                      @Nullable String libName,
                                      @NotNull List<String> classesRootUrls,
                                      @NotNull List<String> sourceRootUrls,
                                      @NotNull List<String> excludedRootUrls,
                                      @NotNull DependencyScope scope) {
    addModuleLibrary(module, libName, classesRootUrls, sourceRootUrls, excludedRootUrls, scope, false);
  }

  public static void addModuleLibrary(@NotNull Module module,
                                      @Nullable String libName,
                                      @NotNull List<String> classesRootUrls,
                                      @NotNull List<String> sourceRootUrls,
                                      @NotNull List<String> excludedRootUrls,
                                      @NotNull DependencyScope scope,
                                      boolean exported) {
    addModuleLibrary(module, libName, classesRootUrls, sourceRootUrls, excludedRootUrls, scope, exported, EmptyConsumer.getInstance());
  }

  public static void addModuleLibrary(@NotNull Module module,
                                      @Nullable String libName,
                                      @NotNull List<String> classesRootUrls,
                                      @NotNull List<String> sourceRootUrls,
                                      @NotNull List<String> excludedRootUrls,
                                      @NotNull DependencyScope scope,
                                      boolean exported,
                                      Consumer<? super LibraryEx.ModifiableModelEx> postProcessor) {
    updateModel(module, model -> {
      LibraryEx library = (LibraryEx)model.getModuleLibraryTable().createLibrary(libName);
      LibraryEx.ModifiableModelEx libraryModel = library.getModifiableModel();

      for (String rootUrl : classesRootUrls) {
        libraryModel.addRoot(rootUrl, OrderRootType.CLASSES);
      }
      for (String rootUrl : sourceRootUrls) {
        libraryModel.addRoot(rootUrl, OrderRootType.SOURCES);
      }
      for (String excludedUrl : excludedRootUrls) {
        libraryModel.addExcludedRoot(excludedUrl);
      }

      LibraryOrderEntry entry = model.findLibraryOrderEntry(library);
      assert entry != null : library;
      entry.setScope(scope);
      entry.setExported(exported);

      postProcessor.consume(libraryModel);

      ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(libraryModel::commit));
    });
  }

  public static void addModuleLibrary(@NotNull Module module, @NotNull String classesRootUrl) {
    if (ApplicationManager.getApplication().isUnitTestMode() && classesRootUrl.endsWith(".jar")) {
      assert false : "jar file is expected, local file is used";
    }
    addModuleLibrary(module, null, Collections.singletonList(classesRootUrl), Collections.emptyList());
  }

  public static void addDependency(@NotNull Module module, @NotNull Library library) {
    addDependency(module, library, DependencyScope.COMPILE, false);
  }

  public static void addDependency(@NotNull Module module, @NotNull Library library, @NotNull DependencyScope scope, boolean exported) {
    updateModel(module, model -> {
      LibraryOrderEntry entry = model.addLibraryEntry(library);
      entry.setExported(exported);
      entry.setScope(scope);
    });
  }

  public static void setModuleSdk(@NotNull Module module, @Nullable Sdk sdk) {
    updateModel(module, model -> {
      if (sdk != null && ApplicationManager.getApplication().isUnitTestMode()) {
        //noinspection TestOnlyProblems
        WriteAction.runAndWait(() -> ProjectJdkTable.getInstance().addJdk(sdk, module.getProject()));
      }
      model.setSdk(sdk);
    });
  }

  public static void setSdkInherited(@NotNull Module module) {
    updateModel(module, model -> model.inheritSdk());
  }

  public static void addDependency(@NotNull Module from, @NotNull Module to) {
    addDependency(from, to, DependencyScope.COMPILE, false);
  }

  public static void addDependency(@NotNull Module from, @NotNull Module to, @NotNull DependencyScope scope, boolean exported) {
    updateModel(from, model -> {
      ModuleOrderEntry entry = model.addModuleOrderEntry(to);
      entry.setScope(scope);
      entry.setExported(exported);
    });
  }

  public static void updateModel(@NotNull Module module, @NotNull Consumer<? super ModifiableRootModel> task) {
    modifyModel(module, model -> {
      task.consume(model);
      return Boolean.TRUE;
    });
  }

  public static void modifyModel(@NotNull Module module, @NotNull Function<? super ModifiableRootModel, Boolean> modifier) {
    ModifiableRootModel model = ReadAction.compute(() -> ModuleRootManager.getInstance(module).getModifiableModel());
    try {
      if (modifier.apply(model)) {
        ApplicationManager.getApplication().invokeAndWait(() -> {
          if (!module.isDisposed()) {
            WriteAction.run(model::commit);
          }
        });
      }
    }
    finally {
      if (!model.isDisposed()) {
        model.dispose();
      }
    }
  }

  public static void updateExcludedFolders(@NotNull Module module,
                                           @NotNull VirtualFile contentRoot,
                                           @NotNull Collection<String> urlsToUnExclude,
                                           @NotNull Collection<String> urlsToExclude) {
    updateModel(module, modifiableModel -> {
      for (ContentEntry contentEntry : modifiableModel.getContentEntries()) {
        if (contentRoot.equals(contentEntry.getFile())) {
          for (String url : urlsToUnExclude) {
            contentEntry.removeExcludeFolder(url);
          }
          for (String url : urlsToExclude) {
            contentEntry.addExcludeFolder(url);
          }
          break;
        }
      }
    });
  }
}