Skip to main content

Questions tagged [enums]

A data type consisting of a set of named values called elements, members or enumerators of the type.

0 votes
0 answers
12 views

Strapi enum values change based some value

Is it possible in strapi to set different enums based some value? I want to change my enums list based my exercise type, because I want to others who used admin panel for menage exercise data will ...
Mee's user avatar
  • 43
1 vote
1 answer
48 views

How to make argparse work nicely with enums and default values?

I have an enum: from enum import auto, Enum class MyEnum(Enum): ONE = auto() TWO = auto() THREE = auto() and I want to use it as an argument with argparse. To be more specific, I want to ...
Shai Avr's user avatar
  • 1,220
1 vote
0 answers
34 views

Dataclass Enum init item from another item

I'm trying to make an Enum the values of which are of a type which is a dataclass. As per the official Python Enum HOWTO, this can be achieved by inheriting from both Enum and the base dataclass. Ok, ...
bbudescu's user avatar
  • 333
1 vote
1 answer
55 views

Detect nullable enum type in source generator

I'm writing a source generator that processes my model classes and adds some custom serialisation code for them. The model classes can have all sorts of property types. I'm currently interested in the ...
ygoe's user avatar
  • 19.7k
0 votes
1 answer
13 views

Is there a way to "expand" an enum in C++ for "type-switching"?

For a project I need an observer class (owned by a Subject that then notifies all of its observers) that handles other behaviours. These observers work by calling their onNotify( Event* ) method that ...
thegrult's user avatar
0 votes
0 answers
20 views

Kotlin/JS exhaustivity check on enums?

I am investigating into the integration of a Kotlin Multiplatform library into an existing JS project. I am struggling with the exhaustivity check on enums and sealed classes on the JS side. In JS, an ...
Ricola's user avatar
  • 2,844
3 votes
2 answers
51 views

the values of ENUM type in SQLAlchemy with PostgreSQL is the variable not the value?

so my problem is i am trying to make an enum with int values but it didn't work. first of all, this is the code. class UserRole(enum.IntEnum): publisher = 4 editor = 3 manager = 2 ...
ibrahim shazly's user avatar
1 vote
0 answers
10 views

Python Enum : achieve multiple attributes with IntelliSense through code generation (jinja2)

CONTEXT My project is about implementing the "conventional method for house-energy-efficiency assessment" in France (120 pages). This method, comes with a huge .xls file providing definition ...
Lionel du Peloux's user avatar
0 votes
1 answer
33 views

How to provide a generic Circe Decoder for a Scala 3 Enum Values?

In my model I have a subset of Enum Values (using refined types). So I need to provide Decoders for these Enum Values. I have now the following version that works (I simplified the example with only ...
pme's user avatar
  • 14.6k
0 votes
1 answer
91 views

Casting enum variant data pointers to enum pointers in Rust

The background: I've encountered a situation where I have two tree datastructures with different internal and leaf node types. I want to maintain a vector which holds pointers to the leaves using a ...
Ben Jourdan's user avatar
1 vote
2 answers
70 views

Are enums appropriate for masks?

Since mask values are integers we can represent them in different ways. For example, as macros: #define ENABLE_FEATURE_A 0x1 #define ENABLE_FEATURE_B 0x2 #define ENABLE_FEATURE_C 0x4 #define ...
Lolo's user avatar
  • 4,099
2 votes
0 answers
57 views

Can't use tuples with a 0 as the second variable in a tuple-enum in Python [closed]

I want to use an enum as a tuple for my Board-coordinates in my chess program like this: from enum import Enum class Pos(tuple, Enum): A1 = (0, 0) A2 = (0, 1) B1 = (1, ...
Tuffi's user avatar
  • 37
1 vote
1 answer
44 views

Ordinal enum mapping with Hibernate 6.5

I'm upgrading Hibernate from 6.1.7 to 6.5.2, there are many enum columns in my entities marked with @Enumerated(EnumType.ORDINAL). My codebase has to run against both Oracle and SQL Server. The ...
viliam's user avatar
  • 513
0 votes
1 answer
86 views

How to get enum documentation in Swagger

I am working with a Swagger API documentation and want to have my description of the enums in the documentation. I am using a custom filter to extract information from classes and enums, using ...
Anders Finn Jørgensen's user avatar
1 vote
1 answer
39 views

Swift data structure reverse engineering

Given the following definition of ApiError: struct ApiError: Error { var statusCode: Int! let errorCode: String var message: String init(statusCode: Int = 0, errorCode: String, ...
soleil's user avatar
  • 12.8k

15 30 50 per page
1
2 3 4 5
1510