Skip to content

Commit

Permalink
Remove ChannelSpec setters
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Nov 28, 2023
1 parent 13afd8f commit 54ccbb0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
3 changes: 0 additions & 3 deletions libmamba/include/mamba/specs/channel_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ namespace mamba::specs
ChannelSpec(std::string location, dynamic_platform_set filters, Type type);

[[nodiscard]] auto type() const -> Type;
void set_type(Type t);

[[nodiscard]] auto location() const& -> const std::string&;
[[nodiscard]] auto location() && -> std::string;
void set_location(std::string location);
auto clear_location() -> std::string;

[[nodiscard]] auto platform_filters() const& -> const dynamic_platform_set&;
[[nodiscard]] auto platform_filters() && -> dynamic_platform_set;
void set_platform_filters(dynamic_platform_set filters);
auto clear_platform_filters() -> dynamic_platform_set;

private:
Expand Down
15 changes: 0 additions & 15 deletions libmamba/src/specs/channel_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ namespace mamba::specs
return m_type;
}

void ChannelSpec::set_type(Type t)
{
m_type = t;
}

auto ChannelSpec::location() const& -> const std::string&
{
return m_location;
Expand All @@ -194,11 +189,6 @@ namespace mamba::specs
return std::move(m_location);
}

void ChannelSpec::set_location(std::string location)
{
m_location = std::move(location);
}

auto ChannelSpec::clear_location() -> std::string
{
return std::exchange(m_location, "");
Expand All @@ -214,11 +204,6 @@ namespace mamba::specs
return std::move(m_platform_filters);
}

void ChannelSpec::set_platform_filters(dynamic_platform_set filters)
{
m_platform_filters = std::move(filters);
}

auto ChannelSpec::clear_platform_filters() -> dynamic_platform_set
{
return std::exchange(m_platform_filters, {});
Expand Down
10 changes: 3 additions & 7 deletions libmambapy/src/libmambapy/bindings/specs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,9 @@ namespace mambapy
)
.def("__copy__", &copy<ChannelSpec>)
.def("__deepcopy__", &deepcopy<ChannelSpec>, pybind11::arg("memo"))
.def_property("type", &ChannelSpec::type, &ChannelSpec::set_type)
.def_property("location", &ChannelSpec::location, &ChannelSpec::set_location)
.def_property(
"platform_filters",
&ChannelSpec::platform_filters,
&ChannelSpec::set_platform_filters
);
.def_property_readonly("type", &ChannelSpec::type)
.def_property_readonly("location", &ChannelSpec::location)
.def_property_readonly("platform_filters", &ChannelSpec::platform_filters);

py::class_<BasicHTTPAuthentication>(m, "BasicHTTPAuthentication")
.def(
Expand Down
8 changes: 0 additions & 8 deletions libmambapy/tests/test_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,6 @@ def test_ChannelSpec():
assert spec.platform_filters == {"linux-64"}
assert spec.type == ChannelSpec.Type.Name

# Setters
spec.location = "https://mamba.pm/"
assert spec.location == "https://mamba.pm/"
spec.platform_filters = {"win-64"}
assert spec.platform_filters == {"win-64"}
spec.type = ChannelSpec.Type.URL
assert spec.type == ChannelSpec.Type.URL

# Copy
other = copy.deepcopy(spec)
assert other.location == spec.location
Expand Down

0 comments on commit 54ccbb0

Please sign in to comment.