This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch = { | |
'foo': int, | |
'bar': json.loads, | |
'foobar': something, | |
} | |
def identity(x): return x | |
cleaned = {} | |
for key in raw: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import user_from_dict, user_to_dict | |
data = {"name": "Uzumaki Naruto", "village": "Leaf Village"} | |
usr = user_from_dict(data) | |
print(usr.name) | |
usr_dict = user_to_dict(usr) | |
print(usr_dict["village"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def user_from_dict(s: Dict[str, Any]) -> User: | |
return User(**s) | |
def user_to_dict(x: User) -> Dict[str, Any]: | |
return vars(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "TheLittleNaruto/test.py", line 8, in <module> | |
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!")) | |
TypeError: concatenate() got an unexpected keyword argument 'c' | |
Process finished with exit code 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# concatenate.py | |
def concatenate(a: str, b: str): | |
result = "" | |
result += a | |
result += b | |
return result | |
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from https://realpython.com/python-kwargs-and-args/ | |
# concatenate.py | |
def concatenate(**kwargs): | |
result = "" | |
# Iterating over the Python kwargs dictionary | |
for arg in kwargs.values(): | |
result += arg | |
return result | |
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj-m:=hello.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<linux/module.h> | |
#include<linux/init.h> | |
#include<linux/kernel.h> | |
static int hello_init(void){ | |
printk(KERN_ALERT "Hello TheLittleNaruto; it's your first driver which d oes no shit :/\n"); | |
return 0; | |
} | |
static void hello_exit(void){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2019 @author TheLittleNaruto | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<option name="taskNames"> | |
<list> | |
<option value="assembleRelease" /> | |
<option value="myCustomTask1" /> | |
<option value="myCustomTask2" /> | |
</list> | |
</option> |