Skip to content

Commit b234017

Browse files
authored
Apply Ruff formatting to fix lint CI
1 parent a8a9c56 commit b234017

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ python -m twine upload dist/* # Publish to PyPI
7373
local_config = mixpanel.LocalFlagsConfig(
7474
api_host="api-eu.mixpanel.com", # EU data residency
7575
enable_polling=True,
76-
polling_interval_in_seconds=90
76+
polling_interval_in_seconds=90,
7777
)
7878
mp = Mixpanel(token, local_flags_config=local_config)
7979
```

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ from mixpanel import Mixpanel
3131
mp = Mixpanel(YOUR_TOKEN)
3232

3333
# tracks an event with certain properties
34-
mp.track(DISTINCT_ID, 'button clicked', {'color' : 'blue', 'size': 'large'})
34+
mp.track(DISTINCT_ID, "button clicked", {"color": "blue", "size": "large"})
3535

3636
# sends an update to a user profile
37-
mp.people_set(DISTINCT_ID, {'$first_name' : 'Ilya', 'favorite pizza': 'margherita'})
37+
mp.people_set(DISTINCT_ID, {"$first_name": "Ilya", "favorite pizza": "margherita"})
3838
```
3939

4040
You can use an instance of the Mixpanel class for sending all of your events
@@ -50,18 +50,18 @@ from mixpanel import Mixpanel, ServiceAccountCredentials
5050
# Create credentials object
5151
# Service accounts replace api_key/api_secret for authentication
5252
credentials = ServiceAccountCredentials(
53-
username='YOUR_SERVICE_ACCOUNT_USERNAME',
54-
secret='YOUR_SERVICE_ACCOUNT_SECRET',
55-
project_id='YOUR_PROJECT_ID'
53+
username="YOUR_SERVICE_ACCOUNT_USERNAME",
54+
secret="YOUR_SERVICE_ACCOUNT_SECRET",
55+
project_id="YOUR_PROJECT_ID",
5656
)
5757

5858
# Token identifies the project and is used for event tracking
5959
# Credentials are used for endpoints that require authentication
6060
mp = Mixpanel(YOUR_TOKEN, credentials=credentials)
6161

6262
# Event tracking operations use the token (sent in payload)
63-
mp.track(DISTINCT_ID, 'button clicked', {'color': 'blue'})
64-
mp.people_set(DISTINCT_ID, {'$first_name': 'John'})
63+
mp.track(DISTINCT_ID, "button clicked", {"color": "blue"})
64+
mp.people_set(DISTINCT_ID, {"$first_name": "John"})
6565
```
6666

6767
Service account credentials can also be used with custom consumers like `BufferedConsumer`:
@@ -70,9 +70,9 @@ Service account credentials can also be used with custom consumers like `Buffere
7070
from mixpanel import Mixpanel, BufferedConsumer, ServiceAccountCredentials
7171

7272
credentials = ServiceAccountCredentials(
73-
username='YOUR_SERVICE_ACCOUNT_USERNAME',
74-
secret='YOUR_SERVICE_ACCOUNT_SECRET',
75-
project_id='YOUR_PROJECT_ID'
73+
username="YOUR_SERVICE_ACCOUNT_USERNAME",
74+
secret="YOUR_SERVICE_ACCOUNT_SECRET",
75+
project_id="YOUR_PROJECT_ID",
7676
)
7777

7878
# Option 1: Pass credentials to the consumer constructor
@@ -83,7 +83,7 @@ mp = Mixpanel(YOUR_TOKEN, consumer=consumer)
8383
mp = Mixpanel(YOUR_TOKEN, credentials=credentials)
8484

8585
# Event tracking uses the token (sent in payload)
86-
mp.track(DISTINCT_ID, 'event_name')
86+
mp.track(DISTINCT_ID, "event_name")
8787
```
8888

8989
Service account credentials are only used for the `/import` endpoint and feature flags. Regular event tracking operations (`track`, `people_set`, `group_set`) use the token provided in the constructor, which is sent in the event payload.
@@ -97,20 +97,20 @@ from mixpanel import Mixpanel, ServiceAccountCredentials
9797
from mixpanel.flags.types import LocalFlagsConfig
9898

9999
credentials = ServiceAccountCredentials(
100-
username='YOUR_SERVICE_ACCOUNT_USERNAME',
101-
secret='YOUR_SERVICE_ACCOUNT_SECRET',
102-
project_id='YOUR_PROJECT_ID'
100+
username="YOUR_SERVICE_ACCOUNT_USERNAME",
101+
secret="YOUR_SERVICE_ACCOUNT_SECRET",
102+
project_id="YOUR_PROJECT_ID",
103103
)
104104

105105
# Token identifies the project for event tracking, credentials handle authentication
106106
mp = Mixpanel(
107-
YOUR_TOKEN,
108-
credentials=credentials,
109-
local_flags_config=LocalFlagsConfig()
107+
YOUR_TOKEN, credentials=credentials, local_flags_config=LocalFlagsConfig()
110108
)
111109

112110
# Feature flag requests will use service account authentication
113-
variant = mp.local_flags.get_variant_value('my-flag', fallback_value=False, context={...})
111+
variant = mp.local_flags.get_variant_value(
112+
"my-flag", fallback_value=False, context={...}
113+
)
114114
```
115115

116116
**Note**: When using service account credentials, the `token` parameter in the `Mixpanel` constructor is still required for event tracking operations (`track`, `people_set`, etc.) since the token is included in the event data payload. However, feature flag operations use the `project_id` from credentials instead of the token for authentication.

0 commit comments

Comments
 (0)