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
$ mypy t.py | |
t.py:16: error: Argument 1 of "foo" is incompatible with supertype "BaseTest"; supertype defines the argument type as "TBase" [override] | |
t.py:16: note: This violates the Liskov substitution principle | |
t.py:16: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides | |
Found 1 error in 1 file (checked 1 source file) |
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 <stdio.h> | |
#define LEN 1200000000 | |
char nums[LEN]; | |
int main() { | |
nums[0] = 1; | |
nums[1] = 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
long next_state_change = 0; | |
long state = -1; | |
void loop() { | |
if(digitalRead(PIN_BUTTON) == LOW) { | |
state = 5; | |
// it will start counting after releasing button | |
next_state_change = millis() + 10000; |
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
#!/usr/bin/python3 | |
import json | |
import requests | |
def get_by_keys(res, *keys): | |
try: | |
for k in keys: | |
res = res[k] | |
return res |
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 get_by_keys(res, *keys): | |
try: | |
for k in keys: | |
res = res[k] | |
return res | |
except (TypeError, KeyError, IndexError): | |
return None | |
book_data = { | |
'title': get_by_keys(result, 'volumeInfo', 'title'), |
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
#!/usr/bin/env python | |
# my_first_calculator.py by AceLewis | |
# optimized by Kompas | |
if 3/2 == 1: # Because Python 2 does not know maths | |
input = raw_input # Python 2 compatibility | |
print('Welcome to this calculator!') | |
print('It can add, subtract, multiply and divide whole numbers from 0 to 50') | |
num1 = float(input('Please choose your first number: ')) |
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 RPi.GPIO as GPIO | |
import time | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
logger = logging.getLogger('') | |
logger.setLevel(logging.DEBUG) |
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
>>> class Node(object): | |
... def __init__(self, n): self.name = n | |
... def getName(self): return self.name | |
... | |
>>> n = Node('abc') | |
>>> n.getName() | |
'abc' | |
>>> node('xyz') | |
<__main__.Node object at 0x7f7dbc033f50> | |
>>> def node(name): return Node(name) |
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
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 | |
debug1: Reading configuration data /home/kompas/.ssh/config | |
debug1: /home/kompas/.ssh/config line 39: Applying options for * | |
debug1: Reading configuration data /etc/ssh/ssh_config | |
debug1: /etc/ssh/ssh_config line 19: Applying options for * | |
debug2: ssh_connect: needpriv 0 | |
debug1: Connecting to bamboo16.lzil.la [25.51.23.16] port 22. | |
debug1: Connection established. | |
debug1: identity file /home/kompas/.ssh/id_rsa type 1 | |
debug1: identity file /home/kompas/.ssh/id_rsa-cert type -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
#!/usr/bin/env python | |
# coding: utf-8 | |
from influxdb import InfluxDBClient | |
import time | |
DBNAME = 'test_db' | |
SERIES_NAME = 'test_series' | |
POINTS_NUMBER = 5000000 | |
THRESHOLD = 500000 |
NewerOlder