This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
list_ = list(range(6)) | |
for idx, val in enumerate(list_): | |
print(idx, val) | |
if idx%2: #we think we wrote code that deletes every item at odd indices | |
del list_[idx] | |
print(list_) | |
#compare to |
This file contains hidden or 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
class MainActivity : AppCompatActivity() { | |
companion object { | |
val TAG = MainActivity::class.java.simpleName | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
if (Log.isLoggable(TAG, Log.DEBUG)) { | |
Log.d(TAG, "$TAG=> onCreate()") | |
} |
This file contains hidden or 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
$ adb tcpip 5555 | |
$ adb connect <Mobile Device IP Address>:5555 | |
# Example: | |
$ adb connect 192.168.1.5:5555 |
This file contains hidden or 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
$adb devices | |
List of devices attached | |
192.168.1.5:5555 device |
This file contains hidden or 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
$ adb logcat -s *:V #Verbose filter | |
$ adb logcat -s *:D #Debug filter | |
$ adb logcat -s *:I #Info filter | |
$ adb logcat -s *:W #Warning filter | |
$ adb logcat -s *:E #Error filter |
This file contains hidden or 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
$ adb shell setprop log.tag.MainActivity DEBUG | |
$ adb logcat -s MainActivity:V | |
05–13 22:54:51.539 2885 11072 I MainActivity: MainActivity=> onCreate() |