instruction_seed stringlengths 217 5.42k | response_seed stringlengths 16 128k | response stringlengths 10 14.5k | __original_row_idx int64 0 35.9k | conversations listlengths 2 2 |
|---|---|---|---|---|
You are tasked with creating a Python function `update_style_info` that takes a JSON object representing a style's metadata and updates its information based on the provided parameters. The function should adhere to the following requirements:
1. The JSON object will have the same structure as the given code snippet... |
```python
import json
from datetime import datetime
def update_style_info(json_data, new_css, new_format, new_author_name):
"""
Updates the style's metadata with new CSS, format, and author's name.
Parameters:
- json_data (dict): The JSON object containing the style's metadata.
- new_css (st... | To create the `update_style_info` function as specified, we will follow the requirements outlined in the prompt. Let's break down the process:
1. We'll take a JSON object and a few parameters that represent new values for CSS, format, and author's name.
2. The function will check for the new values and update the corr... | 10,000 | [
{
"from": "human",
"value": "\n\nYou are tasked with creating a Python function `update_style_info` that takes a JSON object representing a style's metadata and updates its information based on the provided parameters. The function should adhere to the following requirements:\n\n1. The JSON object will have... |
Design a function `generate_nft_metadata` that takes a dictionary representing the base attributes of an NFT (Non-Fungible Token) and returns a JSON string representing the complete metadata for that NFT. The function should add a unique identifier and a timestamp to the metadata. The base attributes will include the... |
```python
import json
import uuid
from datetime import datetime
def generate_nft_metadata(base_attributes):
"""
Generates a JSON string representing the complete metadata for an NFT.
Parameters:
- base_attributes (dict): A dictionary with the base attributes of the NFT.
Returns:
- s... | Sure! Here's how you can implement the `generate_nft_metadata` function in Python. This function will take a dictionary representing the base attributes of an NFT, validate the input, and generate the complete metadata including a unique identifier and a timestamp.
```python
import json
import uuid
from datetime impor... | 10,001 | [
{
"from": "human",
"value": "\n\nDesign a function `generate_nft_metadata` that takes a dictionary representing the base attributes of an NFT (Non-Fungible Token) and returns a JSON string representing the complete metadata for that NFT. The function should add a unique identifier and a timestamp to the met... |
Create a Python function `update_exercise_metadata` that takes a JSON string representing the metadata of a programming exercise and updates it according to the following rules:
1. If the `blurb` field contains the string "TODO", replace it with a provided non-empty string. If the provided string is empty, raise a V... |
```python
import json
def update_exercise_metadata(json_str, new_blurb, username):
"""
Updates the metadata of a programming exercise.
:param json_str: A JSON string representing the exercise metadata.
:param new_blurb: A non-empty string to replace the TODO in the blurb field.
:param username: ... | To create the `update_exercise_metadata` function as you described, we can follow these steps:
1. Parse the input JSON string into a Python dictionary.
2. Check and update the `blurb` field.
3. Add the `updated_by` field with the provided username.
4. Modify the filenames in the `files` field based on the specified co... | 10,002 | [
{
"from": "human",
"value": "\n\nCreate a Python function `update_exercise_metadata` that takes a JSON string representing the metadata of a programming exercise and updates it according to the following rules:\n\n1. If the `blurb` field contains the string \"TODO\", replace it with a provided non-empty str... |
Write a Python program that reads a JSON configuration file for a Java development environment and updates all configurations to use a new version of the JavaFX SDK. The path to the new JavaFX SDK should be provided as an argument to the program. The program should also ensure that the `vmArgs` field contains the cor... |
```python
import json
def update_javafx_sdk(config_file_path, new_sdk_path):
"""
Updates the JavaFX SDK path in the vmArgs of each configuration in the given JSON file.
:param config_file_path: Path to the JSON configuration file.
:param new_sdk_path: The new path to the JavaFX SDK to be used.
"... | To accomplish the task of updating the JavaFX SDK path in a JSON configuration file, we can write a Python program that reads the configurations, updates them, and saves the changes. Below is an implementation of the `update_javafx_sdk` function that performs the required actions.
First, ensure that you have Python i... | 10,003 | [
{
"from": "human",
"value": "\n\nWrite a Python program that reads a JSON configuration file for a Java development environment and updates all configurations to use a new version of the JavaFX SDK. The path to the new JavaFX SDK should be provided as an argument to the program. The program should also ensu... |
You are tasked with writing a Python function `aggregate_election_results` that processes a list of dictionaries containing election data for various polling stations within a region. Each dictionary represents a polling station and contains information about the region, polling station, and election results for two ... |
```python
from typing import List, Dict, Any
def aggregate_election_results(election_data: List[Dict[str, Any]]) -> Dict[str, int]:
"""
Aggregates the total votes for general election and presidential election from a list of polling station data.
:param election_data: A list of dictionaries, where each ... | To implement the function `aggregate_election_results`, we need to process a list of dictionaries, extracting and aggregating the total vote counts for both the general election and the presidential election. We will consider any `null` values for the `toplam_oy` fields as 0, ensuring that our aggregation is accurate.
... | 10,004 | [
{
"from": "human",
"value": "\n\nYou are tasked with writing a Python function `aggregate_election_results` that processes a list of dictionaries containing election data for various polling stations within a region. Each dictionary represents a polling station and contains information about the region, pol... |
Write a Python function `normalize_journal_data` that takes a JSON object representing a journal entry and normalizes it by filling in missing fields with default values. The function should adhere to the following specifications:
- The JSON object will have the structure as shown in the given code snippet.
- The fi... |
```python
import json
def normalize_journal_data(journal_entry):
"""
Normalizes a journal entry JSON object by filling missing fields with default values.
Parameters:
journal_entry (dict): A dictionary representing a journal entry.
Returns:
dict: The normalized journal entry with mi... | Here's a Python function `normalize_journal_data` that meets the specified requirements. It takes a JSON object (represented as a dictionary in Python) and normalizes it by filling in missing fields with specified default values.
```python
def normalize_journal_data(journal_entry):
"""
Normalize a journal entr... | 10,005 | [
{
"from": "human",
"value": "\n\nWrite a Python function `normalize_journal_data` that takes a JSON object representing a journal entry and normalizes it by filling in missing fields with default values. The function should adhere to the following specifications:\n\n- The JSON object will have the structure... |
Write a Python function `calculate_influence_score` that takes a JSON string representing a Twitter user's profile and calculates their influence score based on the following formula:
```
Influence Score = (Average Retweet Count * 0.4) + (Average Favorite Count * 0.3) + (Followers Count * 0.2) + (Verified Bonus)
```... |
```python
import json
def calculate_influence_score(json_profile):
"""
Calculate the influence score of a Twitter user based on their profile data.
:param json_profile: A JSON string containing the Twitter user's profile data.
:return: The calculated influence score as a float rounded to two dec... | To implement the `calculate_influence_score` function as described in your request, we can follow these steps:
1. Parse the JSON string into a Python dictionary.
2. Extract the required values: average retweet count, average favorite count, followers count, and whether the user is verified.
3. Calculate the influence ... | 10,006 | [
{
"from": "human",
"value": "\n\nWrite a Python function `calculate_influence_score` that takes a JSON string representing a Twitter user's profile and calculates their influence score based on the following formula:\n\n```\nInfluence Score = (Average Retweet Count * 0.4) + (Average Favorite Count * 0.3) + ... |
You are tasked with creating a Python function `parse_package_info` that takes a JSON string representing a package information similar to the one provided in the code snippet and returns a dictionary with specific details about the package.
The function should extract the following information:
- Package name
- Pac... |
```python
import json
def parse_package_info(json_string: str) -> dict:
"""
Parses a JSON string containing package information and extracts specific details.
Parameters:
- json_string (str): A JSON string representing package information.
Returns:
- dict: A dictionary with keys 'name', 'de... | To implement the `parse_package_info` function, we will use the built-in `json` module in Python to parse the JSON string and extract the required information. Here's a complete implementation of the function:
```python
import json
def parse_package_info(json_string: str) -> dict:
"""
Parses a JSON string con... | 10,007 | [
{
"from": "human",
"value": "\n\nYou are tasked with creating a Python function `parse_package_info` that takes a JSON string representing a package information similar to the one provided in the code snippet and returns a dictionary with specific details about the package.\n\nThe function should extract th... |
Write a Python function `update_package_version(package_json, package_name, new_version)` that takes a JSON string representing a `package.json` file (commonly used in JavaScript projects), the name of a dependency package, and a new version number. The function should update the version of the specified package in t... |
```python
import json
def update_package_version(package_json, package_name, new_version):
"""
Updates the version of a specified package in the dependencies of a package.json file.
:param package_json: A JSON string representing a package.json file.
:param package_name: The name of the package ... | Here's a Python function that accomplishes what you've described. This function takes a JSON string representing a `package.json` file, updates the version of a specified dependency, and returns the updated JSON string. It also handles errors related to invalid JSON structure.
```python
import json
def update_package... | 10,008 | [
{
"from": "human",
"value": "\n\nWrite a Python function `update_package_version(package_json, package_name, new_version)` that takes a JSON string representing a `package.json` file (commonly used in JavaScript projects), the name of a dependency package, and a new version number. The function should updat... |
Write a Python function `update_package_version` that takes a JSON string representing a `package.json` file (commonly used in Node.js projects) and two arguments: `package_name` (a string) and `new_version` (a string). The function should update the version of the specified package in the `dependencies` section of t... |
```python
import json
def update_package_version(json_str, package_name, new_version):
"""
Updates the version of a specified package in the dependencies of a package.json file.
:param json_str: A JSON string representing a package.json file.
:param package_name: The name of the package to updat... | Certainly! Below is the Python function `update_package_version` that meets the specified requirements:
```python
import json
def update_package_version(json_str, package_name, new_version):
try:
# Parse the input JSON string
package_data = json.loads(json_str)
# Check if 'depende... | 10,009 | [
{
"from": "human",
"value": "\n\nWrite a Python function `update_package_version` that takes a JSON string representing a `package.json` file (commonly used in Node.js projects) and two arguments: `package_name` (a string) and `new_version` (a string). The function should update the version of the specified... |
Design a function `parse_mission_data` that takes a JSON string representing the mission data of a game and extracts relevant information to create a summary of the mission. The function should return a dictionary with the following keys and their corresponding values:
- `mission_name`: The name of the mission.
- `m... |
```python
import json
def parse_mission_data(json_data):
"""
Parses the given JSON string containing mission data and extracts relevant information.
Parameters:
- json_data (str): A JSON string representing the mission data.
Returns:
- dict: A dictionary with keys 'mission_name', 'm... | To implement the `parse_mission_data` function, we will leverage Python's built-in `json` module to parse the incoming JSON string. The function will then extract required keys from the parsed data and handle potential errors related to missing information or invalid JSON. Here's how we can do this:
```python
import j... | 10,010 | [
{
"from": "human",
"value": "\n\nDesign a function `parse_mission_data` that takes a JSON string representing the mission data of a game and extracts relevant information to create a summary of the mission. The function should return a dictionary with the following keys and their corresponding values:\n\n- ... |
Design a Python function `extract_relationship_data` that takes a JSON object representing a bundle of cybersecurity threat information and extracts specific details about the relationships between entities within the bundle. The function should adhere to the following requirements:
- The input JSON object follows t... |
```python
import json
def extract_relationship_data(bundle_json):
"""
Extracts relationship data from a STIX bundle JSON object.
Parameters:
bundle_json (dict): A JSON object representing a STIX bundle.
Returns:
list: A list of dictionaries containing relationship information.
"""
t... | To implement the `extract_relationship_data` function as described, we will assume that the input JSON object is structured according to the STIX format, particularly focusing on the relationships. Here's how you can create this function in Python:
```python
import json
def extract_relationship_data(stix_bundle):
... | 10,011 | [
{
"from": "human",
"value": "\n\nDesign a Python function `extract_relationship_data` that takes a JSON object representing a bundle of cybersecurity threat information and extracts specific details about the relationships between entities within the bundle. The function should adhere to the following requi... |
You are tasked with creating a system that manages employee day-off requests for a company. The system should be able to process a list of employee records, each containing personal information and day-off requests, and perform various operations on this data.
Write a Python program that accomplishes the following t... |
```python
import json
def process_dayoff_requests(json_data):
"""
Processes day-off requests from a JSON string of employee data.
Parameters:
- json_data (str): A JSON string containing a list of employees and their day-off requests.
Returns:
- List[Dict[str, Any]]: A list of dictio... | Here's how you can implement the specified functionality in Python. We'll define a function `process_dayoff_requests(json_data)` that will handle loading the JSON data, validating the day-off requests, and generating the report.
Below is the complete code:
```python
import json
def process_dayoff_requests(json_data)... | 10,012 | [
{
"from": "human",
"value": "\n\nYou are tasked with creating a system that manages employee day-off requests for a company. The system should be able to process a list of employee records, each containing personal information and day-off requests, and perform various operations on this data.\n\nWrite a Pyt... |
You are tasked with creating a Python function `analyze_vulnerability_data` that processes JSON data representing a cybersecurity vulnerability report. The function should extract and return a summary of the vulnerability, including its ID, status, severity, and a brief description in English.
The JSON data structur... |
```python
import json
def analyze_vulnerability_data(json_data):
"""
Analyzes vulnerability data in JSON format and extracts a summary.
Parameters:
- json_data (str): A JSON string representing the vulnerability report.
Returns:
- dict: A dictionary with keys 'id', 'status', 'severity', and... | Sure! Below is a Python function `analyze_vulnerability_data` that adheres to the requirements you've provided. It processes a JSON string representing a cybersecurity vulnerability report and extracts the necessary information, returning it as a dictionary. In the case of missing information, it raises a `ValueError` ... | 10,013 | [
{
"from": "human",
"value": "\n\nYou are tasked with creating a Python function `analyze_vulnerability_data` that processes JSON data representing a cybersecurity vulnerability report. The function should extract and return a summary of the vulnerability, including its ID, status, severity, and a brief desc... |
You are tasked with creating a Python function `update_navigation_bar` that takes a JSON object representing a configuration for a mobile application and updates the navigation bar properties based on the provided parameters. The function should adhere to the following requirements:
1. The function should accept thr... |
```python
import json
def update_navigation_bar(config_json, background_color, title_text):
"""
Updates the navigation bar properties in the given JSON configuration object.
Parameters:
- config_json (dict): The JSON object representing the app configuration.
- background_color (str): The new ba... | Here is how you can implement the `update_navigation_bar` function in Python according to the specifications you provided:
```python
import json
def update_navigation_bar(config_json, background_color=None, title_text=None):
"""
Updates the navigation bar properties in the given app configuration.
Parame... | 10,014 | [
{
"from": "human",
"value": "\n\nYou are tasked with creating a Python function `update_navigation_bar` that takes a JSON object representing a configuration for a mobile application and updates the navigation bar properties based on the provided parameters. The function should adhere to the following requi... |
Write a Python function `extract_artwork_details` that takes a JSON string representing an artwork's metadata and extracts specific details into a more concise dictionary. The function should focus on the following details: `accession_number`, `artist`, `classification`, `country`, `dated`, `department`, `dimension`,... |
```python
import json
def extract_artwork_details(json_string: str) -> dict:
# Parse the JSON string into a dictionary
artwork_data = json.loads(json_string)
# Define the keys to extract
keys_to_extract = [
'accession_number', 'artist', 'classification', 'country',
'dated', 'depa... | Certainly! Below is the implementation of the `extract_artwork_details` function as per your requirements:
```python
import json
def extract_artwork_details(json_string: str) -> dict:
"""
Extracts specific details from an artwork's metadata JSON string.
Parameters:
- json_string (str): A JSON string ... | 10,015 | [
{
"from": "human",
"value": "\n\nWrite a Python function `extract_artwork_details` that takes a JSON string representing an artwork's metadata and extracts specific details into a more concise dictionary. The function should focus on the following details: `accession_number`, `artist`, `classification`, `co... |
Design a function `generate_item_metadata` that takes an item's template ID, name, description, image URL, IPFS hash (optional), slot, and a list of attributes as input and generates a JSON object representing the item's metadata. The function should follow these specifications:
- The `template` should be a string r... |
```python
import json
def generate_item_metadata(template, name, description, image, slot, attributes, ipfs=""):
"""
Generates a JSON object representing an item's metadata.
:param template: A string representing the unique ID of the item template.
:param name: A string representing the name of the ... | Below is a Python function named `generate_item_metadata` that implements the specifications you provided. It constructs a JSON object representing an item's metadata based on the parameters given.
```python
import json
def generate_item_metadata(template, name, description, image, slot, attributes, ipfs=""):
# C... | 10,016 | [
{
"from": "human",
"value": "\n\nDesign a function `generate_item_metadata` that takes an item's template ID, name, description, image URL, IPFS hash (optional), slot, and a list of attributes as input and generates a JSON object representing the item's metadata. The function should follow these specificati... |
You are given a JSON object representing a digital collectible (NFT) with various attributes. Your task is to write a Python function `summarize_nft_attributes(json_data)` that takes this JSON object as input and returns a summary of the NFT's attributes. The summary should include the following information:
1. The ... |
```python
import json
def summarize_nft_attributes(json_data):
"""
Summarizes the attributes of an NFT given its JSON representation.
Parameters:
- json_data (str): A JSON string representing the NFT.
Returns:
- summary (dict): A dictionary containing:
- 'total_attributes' (... | Here’s a Python function that summarizes the attributes of a digital collectible (NFT) based on the requirements you've provided:
```python
import json
def summarize_nft_attributes(json_data):
"""
Summarizes the attributes of a digital collectible (NFT).
Parameters:
json_data (dict): A JSON object re... | 10,017 | [
{
"from": "human",
"value": "\n\nYou are given a JSON object representing a digital collectible (NFT) with various attributes. Your task is to write a Python function `summarize_nft_attributes(json_data)` that takes this JSON object as input and returns a summary of the NFT's attributes. The summary should ... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 10