text:
const webpack = require('webpack')
const webpackTargetElectronRenderer = require('webpack-target-electron-renderer')
const baseConfig = require('./webpack.base.babel')

const config = Object.create(baseConfig)

config.debug = true

config.devtool = 'cheap-module-eval-source-map'

config.entry = [
  'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr',
  './app/index',
]

config.output.publicPath = 'http://localhost:3000/dist/'

config.plugins.push(
  new webpack.HotModuleReplacementPlugin(),
  new webpack.NoErrorsPlugin(),
  new webpack.DefinePlugin({
    '__DEV__': true,
    '__PROD__': false,
    'process.env': {
      'NODE_ENV': JSON.stringify('development'),
    },
  })
)

config.target = webpackTargetElectronRenderer(config)

module.exports = config


text:
package org.apache.flink.table.legacyutils;

import org.apache.flink.api.java.tuple.Tuple2;

/** Utility class to make working with tuples more readable. */
public class MaxAccumulator<T> extends Tuple2<T, Boolean> {
    private static final long serialVersionUID = 6089142148200600733L;
}

redpajama_set_name: RedPajamaGithub


text:
using namespace vw;
using namespace vw::cartography;
namespace po = boost::program_options;
namespace fs = boost::filesystem;

struct Options : vw::GdalWriteOptions {
  // Input
  std::vector<std::string> pointcloud_files;

  // Settings
  bool  write_double;  ///< If true, output file is double instead of float

  // Output
  std::string out_file;

  Options() : write_double(false) {}
};

void handle_arguments( int argc, char *argv[], Options& opt ) {

  po::options_description general_options("General Options");
  general_options.add_options()
    ("output-file,o",  po::value(&opt.out_file)->default_value(""),        "Specify the output file.")
    ("write-double,d", po::value(&opt.write_double)->default_value(false), "Write a double precision output file.");

  general_options.add( vw::GdalWriteOptionsDescription(opt) );

  po::options_description positional("");
  positional.add_options()
    ("input-files", po::value< std::vector<std::string> >(), "Input files");

  po::positional_options_description positional_desc;
  positional_desc.add("input-files", -1);

  std::string usage("[options] <point-clouds> ");
  bool allow_unregistered = false;
  std::vector<std::string> unregistered;
  po::variables_map vm =
    asp::check_command_line( argc, argv, opt, general_options, general_options,
                             positional, positional_desc, usage,
                             allow_unregistered, unregistered );

  if (vm.count("input-files") == 0)
    vw_throw( ArgumentErr() << "Missing input point clouds.\n"
                            << usage << general_options );
  opt.pointcloud_files = vm["input-files"].as< std::vector<std::string> >();

  if (opt.out_file == "")
    vw_throw( ArgumentErr() << "The output file must be specified!\n"
              << usage << general_options );

  vw::create_out_dir(opt.out_file);
}

/// Throws if the input point clouds do not have the same number of channels.
/// - Returns the number of channels.
int check_num_channels(std::vector<std::string> const& pc_files){
  VW_ASSERT(pc_files.size() >= 1,
            ArgumentErr() << "Expecting at least one file.\n");

  int target_num = get_num_channels(pc_files[0]);
  for (int i = 1; i < (int)pc_files.size(); ++i){
    int num_channels = get_num_channels(pc_files[i]);
    if (num_channels != target_num)
      vw_throw( ArgumentErr() << "Input point clouds must all have the same number of channels!.\n" );
  }
  return target_num;
}

/// Determine the common shift value to use for the output files
Vector3 determine_output_shift(std::vector<std::string> const& pc_files, Options const& opt){

  // If writing to double format, no shift is needed.
  if (opt.write_double)
    return Vector3(0,0,0);

  // As an approximation, compute the mean shift vector of the input files.
  // - If none of the input files have a shift, the output file will be written as a double.
  vw::Vector3 shift(0,0,0), shiftIn;
  double shift_count = 0;
  for (size_t i=0; i<pc_files.size(); ++i) {
    // Read in the shift from each cloud and accumulate them
    std::string shift_str;
    boost::shared_ptr<vw::DiskImageResource> rsrc( new vw::DiskImageResourceGDAL(pc_files[i]) );
    if (vw::cartography::read_header_string(*rsrc.get(), asp::ASP_POINT_OFFSET_TAG_STR, shift_str)){
      //std::cout << "shift string = " << shift_str << std::endl;
      shift += asp::str_to_vec<vw::Vector3>(shift_str);
      shift_count += 1.0;
    }
  }
  if (shift_count < 0.9) // If no shifts read, don't use a shift.
    return Vector3(0,0,0);

  // Compute the mean shift
  // - It would be more accurate to weight the shift according to the number of input points
  shift /= shift_count;
  return shift;
}

// Do the actual work of loading, merging, and saving the point clouds

// Case 1: Single-channel cloud.
template <class PixelT>
typename boost::enable_if<boost::is_same<PixelT, vw::PixelGray<float> >, void >::type
do_work(Vector3 const& shift, Options const& opt) {
  // The spacing is selected to be compatible with the point2dem convention.
  const int spacing = ASP_MAX_SUBBLOCK_SIZE;
  ImageViewRef<PixelT> merged_cloud = asp::form_point_cloud_composite<PixelT>(opt.pointcloud_files, spacing);

  vw_out() << "Writing image: " << opt.out_file << "\n";

  bool has_georef = false;
  bool has_nodata = false;
  double nodata = -std::numeric_limits<float>::max(); // smallest float
  GeoReference georef;
  vw::cartography::block_write_gdal_image(opt.out_file, merged_cloud, has_georef,
                              georef,  has_nodata, nodata, opt,
                              TerminalProgressCallback("asp", "\t--> Merging: "));
}

// Case 2: Multi-channel cloud.
template <class PixelT>
typename boost::disable_if<boost::is_same<PixelT, vw::PixelGray<float> >, void >::type
do_work(Vector3 const& shift, Options const& opt) {
  // The spacing is selected to be compatible with the point2dem convention.
  const int spacing = ASP_MAX_SUBBLOCK_SIZE;
  ImageViewRef<PixelT> merged_cloud = asp::form_point_cloud_composite<PixelT>(opt.pointcloud_files, spacing);

  // See if we can pull a georeference from somewhere. Of course it will be wrong
  // when applied to the merged cloud, but it will at least have the correct datum
  // and projection.
  bool has_georef = false;
  cartography::GeoReference georef;
  for (size_t i = 0; i < opt.pointcloud_files.size(); i++){
    cartography::GeoReference local_georef;

    if (read_georeference(local_georef, opt.pointcloud_files[i])){
      georef = local_georef;
      has_georef = true;
    }
  }

  bool has_nodata = false;
  double nodata = -std::numeric_limits<float>::max(); // smallest float

  vw_out() << "Writing point cloud: " << opt.out_file << "\n";

  // If shift != zero then this will cast the output data to type float.
  //  Otherwise it will keep its data type.
  double point_cloud_rounding_error = 0.0;
  asp::block_write_approx_gdal_image
    ( opt.out_file, shift,
      point_cloud_rounding_error,
      merged_cloud,
      has_georef, georef, has_nodata, nodata,
      opt, TerminalProgressCallback("asp", "\t--> Merging: "));
}

//-----------------------------------------------------------------------------------

int main( int argc, char *argv[] ) {

  Options opt;
  try {
    handle_arguments( argc, argv, opt );

    // Determine the number of channels
    int num_channels = check_num_channels(opt.pointcloud_files);

    // Determine the output shift (if any)
    Vector3 shift = determine_output_shift(opt.pointcloud_files, opt);

    // The code has to branch here depending on the number of channels
    switch (num_channels)
    {
      // The input point clouds have their shift incorporated and are stored as doubles.
      // If the output file is stored as float, it needs to have a single shift value applied.
      case 1:  do_work< vw::PixelGray<float> >(shift, opt); break;
      case 3:  do_work<Vector3>(shift, opt); break;
      case 4:  do_work<Vector4>(shift, opt); break;
      case 6:  do_work<Vector6>(shift, opt); break;
      default: vw_throw( ArgumentErr() << "Unsupported number of channels!.\n" );
    }

  } ASP_STANDARD_CATCHES;

  return 0;
}


text:
package importer

import (
	"log"
	"sync"

	"github.com/GreenNav/service-database/database"
	"github.com/omniscale/imposm3/element"
	"github.com/omniscale/imposm3/parser/pbf"
)

const (
	// CHANNELSIZE is used as size of the cache for nodes/ways/relations
	// during conversion from pbf file to the database
	CHANNELSIZE = 4
)

// WriteToDatabase takes a pbf file and writes it to any database
// that is conform to the database/OSMDatabase type
func WriteToDatabase(PbfFileName string, Db database.OSMDatabase) error {
	err := Db.NewTransaction()
	if err != nil {
		log.Fatal(err)
	}
	pbfCoords := make(chan []element.Node, CHANNELSIZE)
	pbfNodes := make(chan []element.Node, CHANNELSIZE)
	pbfWays := make(chan []element.Way, CHANNELSIZE)
	pbfRelations := make(chan []element.Relation, CHANNELSIZE)

	nodesToWrite := make(chan element.Node, CHANNELSIZE)
	nodeTagsToWrite := make(chan element.Node, CHANNELSIZE)

	waysToWrite := make(chan element.Way, CHANNELSIZE)
	wayNodesToWrite := make(chan element.Way, CHANNELSIZE)
	wayTagsToWrite := make(chan element.Way, CHANNELSIZE)

	relationChannel := make(chan element.Relation, CHANNELSIZE)
	relationTagsChannel := make(chan element.Relation, CHANNELSIZE)
	relationMembersChannel := make(chan element.Relation, CHANNELSIZE)

	pbfFile, err := pbf.Open(PbfFileName)
	if err != nil {
		return err
	}

	wg := sync.WaitGroup{}
	parser := pbf.NewParser(pbfFile, pbfCoords, pbfNodes, pbfWays, pbfRelations)

	wg.Add(8)
	go func() {
		err := Db.WriteNodes(nodesToWrite)
		if err != nil {
			log.Fatal(err.Error() + " (table nodes)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteNodeTags(nodeTagsToWrite)
		if err != nil {
			log.Fatal(err.Error() + " (table node_tags)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteWays(waysToWrite)
		if err != nil {
			log.Fatal(err.Error() + " (table ways)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteWayTags(wayTagsToWrite)
		if err != nil {
			log.Fatal(err.Error() + " (table way_tags)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteWayNodes(wayNodesToWrite)
		if err != nil {
			log.Fatal(err.Error() + " (table way_nodes)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteRelation(relationChannel)
		if err != nil {
			log.Fatal(err.Error(), " (table relation_nodes)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteRelationTags(relationTagsChannel)
		if err != nil {
			log.Fatal(err.Error(), " (table relation_tags)")
		}
		wg.Done()
	}()
	go func() {
		err := Db.WriteRelationMembers(relationMembersChannel)
		if err != nil {
			log.Fatal(err.Error(), " (table relation_members)")
		}
		wg.Done()
	}()
	go func() {
		for nodes := range pbfCoords {
			for _, node := range nodes {
				nodesToWrite <- node
			}
		}
		close(nodesToWrite)
	}()
	go func() {
		for nodes := range pbfNodes {
			for _, node := range nodes {
				nodeTagsToWrite <- node
			}
		}
		close(nodeTagsToWrite)
	}()
	go func() {
		for ways := range pbfWays {
			for _, way := range ways {
				waysToWrite <- way
				wayNodesToWrite <- way
				wayTagsToWrite <- way
			}
		}
		close(waysToWrite)
		close(wayNodesToWrite)
		close(wayTagsToWrite)
	}()
	go func() {
		for relations := range pbfRelations {
			for _, relation := range relations {
				relationChannel <- relation
				relationMembersChannel <- relation
				relationTagsChannel <- relation
			}
		}
		close(relationChannel)
		close(relationMembersChannel)
		close(relationTagsChannel)
	}()

	parser.Parse()
	wg.Wait()
	if err := Db.Commit(); err != nil {
		return err
	}

	return nil
}


text:
local ffi = require "ffi"
local writer = require "writer.c"

local debug = true

local ctypes = {}
local arrayTypes = {}
local allocators = {}

local defaultAllocator = {
	alloc = function(_type)
		return ffi.new(ctypes[_type.name])
	end
}

local function tableEmpty(t)
	for k,v in pairs(t) do
		return false
	end

	return true
end

local function callDestructors(_type, instance)
	local destroy = _type.methods["destroy"];
	if destroy ~= nil then
		destroy(instance)
	end

	if _type.parent ~= nil then
		callDestructors(_type.parent, instance)
	end
end

local function buildGetterSetterTable(t, getters, setters)
	if t.parent ~= nil then
		buildGetterSetterTable(t.parent, getters, setters)
	end

	for k, v in pairs(t.properties) do
		getters[k] = v.getter
		setters[k] = v.setter
	end

	return getters, setters
end

local function buildMethodTable(t, mt)
	if t.parent ~= nil then
		buildMethodTable(t.parent, mt)
	end

	for k, v in pairs(t.methods) do
		mt[k] = v
	end

	mt["__type"] = function(self)
		return t
	end

	mt["isTypeOf"] = function(self, v)
		return v == t
	end

	if #t.templates > 0 then
		mt["__template"] = function(self, name)
			for i, v in ipairs(t.templates) do
				if v.name == name then
					return v.value
				end
			end
		end

		mt["__templateDefault"] = function(self, name)
			for i, v in ipairs(t.templates) do
				if v.name == name then
					return v.default
				end
			end
		end
	end

	return mt
end

local function propertyExistError(typeName, propertyName)
	error(typeName .. "." .. propertyName .. " does not exist")
end

local function indexMethodsGetters(methods, getters)
	return function(self, k)
		local p = getters[k]
		if p ~= nil then return p(self) end
		return methods[k]
	end
end

local function newindexSetters(name, setters)
	return function(self, k, v)
		--print("SETTER", name .. "." .. k .. " = " .. tostring(v))
		local p = setters[k]
		if p ~= nil then
			p(self, v)
		else
			propertyExistError(name, k)
		end
	end
end

local function createMetaTable(_type)
	local methods = buildMethodTable(_type, {})
	local getters, setters = buildGetterSetterTable(_type, {}, {})
	local hasGetters, hasSetters = tableEmpty(getters) == false, tableEmpty(setters) == false

	local mt = { __gc = function(instance) callDestructors(_type, instance) end }
	if hasGetters == false and hasSetters == false then
		mt.__index = methods
	elseif hasGetters == true and hasSetters == false then
		mt.__index = indexMethodsGetters(methods, getters)
	elseif hasGetters == false and hasSetters == true then
		mt.__index = methods
		mt.__newindex = newindexSetters(_type.name, setters)
	elseif hasGetters == true and hasSetters == true then
		mt.__index = indexMethodsGetters(methods, getters)
		mt.__newindex = newindexSetters(_type.name, setters)
	end

	return mt
end

local function addClassType(_type)
	assert(_type.resolved == true, _type.name .. " is unresolved")
	assert(_type.primitiveType == "class", _type.name)

	-- Make sure all parents and member types have been added to the ffi
	if _type.parent ~= nil then
		if _type.parent.primitiveType == "class" and ctypes[_type.parent.name] == nil then
			addClassType(_type.parent)
		end
	end

	for i, v in ipairs(_type.members) do
		local memType = v.type
		if v.type.primitiveType == "pointer" then
			memType = v.type.origin
		end

		if memType.primitiveType == "class" and ctypes[memType.name] == nil then
			addClassType(memType)
		end
	end

	local def = writer.write(_type, "pretty")

	print("-----------------")
	print(def)
	ffi.cdef(def);

	local mt = createMetaTable(_type)
	local ctype = ffi.metatype(_type.cType, mt)

	--assert(_type.size == ffi.sizeof(ctype), "Differing type sizes for " .. _type.name .. ": " .. _type.size .. ", " .. ffi.sizeof(ctype))
	ctypes[_type.name] = ctype
	return ctype
end

local function addArrayType(_type)
	assert(_type.primitiveType ~= "template")
	assert(_type.resolved == true)

	local origin
	if _type.primitiveType == "class" then
		origin = _type
	elseif _type.primitiveType == "pointer" then
		origin = _type.origin
	end

	if origin ~= nil then
		if origin.primitiveType == "class" and ctypes[origin.name] == nil then
			addClassType(origin)
		end
	end

	local arrayType = ffi.typeof(_type.cType .. "[?]")
	arrayTypes[_type.name] = arrayType

	return arrayType
end

local gcTest = {}

local function setAllocator(_type, allocator)
	allocators[_type.name] = allocator
end

local function commit(_type)
	assert(_type.primitiveType == "class")
	assert(_type.resolved == true)

	local ctype = ctypes[_type.name]
	if ctype == nil then
		addClassType(_type)
	end
end

local function alloc(_type, ...)
	commit(_type)

	local obj
	local allocator = allocators[_type.name]

	if allocator ~= nil then
		obj = allocator.alloc(_type)
	else
		obj = defaultAllocator.alloc(_type)
	end

	table.insert(gcTest, obj)
	return obj
end

local function construct(obj, ...)
	local _type = obj:__type()
	if _type.methods.init ~= nil then
		_type.methods.init(obj, ...)
	end
end

local function create(_type, ...)
	local obj = alloc(_type)

	if _type.methods.init ~= nil then
		_type.methods.init(obj, ...)
	end

	return obj
end

local function createArray(_type, size)
	local arrayType = arrayTypes[_type.name]
	if arrayType == nil then
		arrayType = addArrayType(_type)
	end

	--return ffi.C.malloc(_type.size * size)

	local ret = ffi.new(arrayType, size)
	table.insert(gcTest, ret)

	return ret
end

local function registerSystemType(_type)
	if _type.cType ~= _type.name then
		assert(_type.size == ffi.sizeof(_type.cType), "Size mismatch for " .. _type.name .. ": Def - " .. _type.size .. "   C - " .. ffi.sizeof(_type.cType))
	end
end

return {
	commit = commit,
	alloc = alloc,
	construct = construct,
	create = create,
	createArray = createArray,
	registerSystemType = registerSystemType,
	typeOf = typeOf
}


text:
[![codecov](https://codecov.io/gh/fras2560/InducedSubgraph/branch/main/graph/badge.svg?token=ZUB7EO8ESJ)](https://codecov.io/gh/fras2560/InducedSubgraph)

InducedSubgraph
===============

A web app that allows for the user to draw two graph G and H. It allows for the user to see if G contains an induced subgraph H.
Additional features such as coloring and checking graph properties were added. Check it out at [inducer]

Version
-----------

1.0

Dependencies
-----------

InducedSubgraph uses a number of open source projects:

* [Networkx] - NetworkX is a Python language software package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
* [Flask] - Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.

Install Dependencies
-----------
```sh
	pip install -r requirements.txt
```

Start Server
-----------
```sh
	python run.py
```

Running Tests
-----------
```sh
	python -m unittest discover -s inducer/test
```

To run just a single test use:
```sh
	python -m unittest discover -s inducer/test -p <TEST_FILE_NAME>.py
```

Linting
-----------
This project uses flake8 for its linting. Any PR to master will check if there are any linting issues. It is recommended that one setups pep8 linting for their IDE / editor. To run the linter locally use
```sh
	pip install flake8
	flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        flake8 . --count --max-complexity=20 --max-line-length=127 --statistics --exclude=inducer/__init__.py
```

Contact
-----------
Feel free to contact me for ideas and help at [dallas.fraser.water@gmail.com]

License
----

MIT

[Networkx]:http://networkx.github.io/documentation/networkx-1.9/
[Flask]:http://flask.pocoo.org/
[inducer]:http://induced-subgraph.herokuapp.com/
[dallas.fraser.water@gmail.com]:mailto:dallas.fraser.water@gmail.com


text:
import datetime
from email import utils
import test.support
import time
import unittest
import sys
import os.path

class DateTimeTests(unittest.TestCase):

    datestring = 'Sun, 23 Sep 2001 20:10:55'
    dateargs = (2001, 9, 23, 20, 10, 55)
    offsetstring = ' -0700'
    utcoffset = datetime.timedelta(hours=-7)
    tz = datetime.timezone(utcoffset)
    naive_dt = datetime.datetime(*dateargs)
    aware_dt = datetime.datetime(*dateargs, tzinfo=tz)

    def test_naive_datetime(self):
        self.assertEqual(utils.format_datetime(self.naive_dt),
                         self.datestring + ' -0000')

    def test_aware_datetime(self):
        self.assertEqual(utils.format_datetime(self.aware_dt),
                         self.datestring + self.offsetstring)

    def test_usegmt(self):
        utc_dt = datetime.datetime(*self.dateargs,
                                   tzinfo=datetime.timezone.utc)
        self.assertEqual(utils.format_datetime(utc_dt, usegmt=True),
                         self.datestring + ' GMT')

    def test_usegmt_with_naive_datetime_raises(self):
        with self.assertRaises(ValueError):
            utils.format_datetime(self.naive_dt, usegmt=True)

    def test_usegmt_with_non_utc_datetime_raises(self):
        with self.assertRaises(ValueError):
            utils.format_datetime(self.aware_dt, usegmt=True)

    def test_parsedate_to_datetime(self):
        self.assertEqual(
            utils.parsedate_to_datetime(self.datestring + self.offsetstring),
            self.aware_dt)

    def test_parsedate_to_datetime_naive(self):
        self.assertEqual(
            utils.parsedate_to_datetime(self.datestring + ' -0000'),
            self.naive_dt)

class LocaltimeTests(unittest.TestCase):

    def test_localtime_is_tz_aware_daylight_true(self):
        test.support.patch(self, time, 'daylight', True)
        t = utils.localtime()
        self.assertIsNotNone(t.tzinfo)

    def test_localtime_is_tz_aware_daylight_false(self):
        test.support.patch(self, time, 'daylight', False)
        t = utils.localtime()
        self.assertIsNotNone(t.tzinfo)

    def test_localtime_daylight_true_dst_false(self):
        test.support.patch(self, time, 'daylight', True)
        t0 = datetime.datetime(2012, 3, 12, 1, 1)
        t1 = utils.localtime(t0, isdst=-1)
        t2 = utils.localtime(t1)
        self.assertEqual(t1, t2)

    def test_localtime_daylight_false_dst_false(self):
        test.support.patch(self, time, 'daylight', False)
        t0 = datetime.datetime(2012, 3, 12, 1, 1)
        t1 = utils.localtime(t0, isdst=-1)
        t2 = utils.localtime(t1)
        self.assertEqual(t1, t2)

    def test_localtime_daylight_true_dst_true(self):
        test.support.patch(self, time, 'daylight', True)
        t0 = datetime.datetime(2012, 3, 12, 1, 1)
        t1 = utils.localtime(t0, isdst=1)
        t2 = utils.localtime(t1)
        self.assertEqual(t1, t2)

    def test_localtime_daylight_false_dst_true(self):
        test.support.patch(self, time, 'daylight', False)
        t0 = datetime.datetime(2012, 3, 12, 1, 1)
        t1 = utils.localtime(t0, isdst=1)
        t2 = utils.localtime(t1)
        self.assertEqual(t1, t2)

    @test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
    def test_localtime_epoch_utc_daylight_true(self):
        test.support.patch(self, time, 'daylight', True)
        t0 = datetime.datetime(1990, 1, 1, tzinfo = datetime.timezone.utc)
        t1 = utils.localtime(t0)
        t2 = t0 - datetime.timedelta(hours=5)
        t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
        self.assertEqual(t1, t2)

    @test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
    def test_localtime_epoch_utc_daylight_false(self):
        test.support.patch(self, time, 'daylight', False)
        t0 = datetime.datetime(1990, 1, 1, tzinfo = datetime.timezone.utc)
        t1 = utils.localtime(t0)
        t2 = t0 - datetime.timedelta(hours=5)
        t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
        self.assertEqual(t1, t2)

    def test_localtime_epoch_notz_daylight_true(self):
        test.support.patch(self, time, 'daylight', True)
        t0 = datetime.datetime(1990, 1, 1)
        t1 = utils.localtime(t0)
        t2 = utils.localtime(t0.replace(tzinfo=None))
        self.assertEqual(t1, t2)

    def test_localtime_epoch_notz_daylight_false(self):
        test.support.patch(self, time, 'daylight', False)
        t0 = datetime.datetime(1990, 1, 1)
        t1 = utils.localtime(t0)
        t2 = utils.localtime(t0.replace(tzinfo=None))
        self.assertEqual(t1, t2)

    # XXX: Need a more robust test for Olson's tzdata
    @unittest.skipIf(sys.platform.startswith('win'),
                     "Windows does not use Olson's TZ database")
    @unittest.skipUnless(os.path.exists('/usr/share/zoneinfo') or
                         os.path.exists('/usr/lib/zoneinfo'),
                         "Can't find the Olson's TZ database")
    @test.support.run_with_tz('Europe/Kiev')
    def test_variable_tzname(self):
        t0 = datetime.datetime(1984, 1, 1, tzinfo=datetime.timezone.utc)
        t1 = utils.localtime(t0)
        self.assertEqual(t1.tzname(), 'MSK')
        t0 = datetime.datetime(1994, 1, 1, tzinfo=datetime.timezone.utc)
        t1 = utils.localtime(t0)
        self.assertEqual(t1.tzname(), 'EET')

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