Skip to content

Instantly share code, notes, and snippets.

nagavenkateshgowru

Block or report user

Report or block nagavenkateshgowru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nagavenkateshgowru
nagavenkateshgowru / test_calc_v6.py
Created Feb 14, 2020
Added all add, sub, mul, div test cases
View test_calc_v6.py
from calculator import calc, get_values_from_expr
def test_calc_add():
result = calc("3 + 2")
assert result == 5
def test_calc_add2():
result = calc("300 + 20")
assert result == 320
@nagavenkateshgowru
nagavenkateshgowru / calculator_v5.py
Created Feb 14, 2020
Added code to evaluate add,sub,mul,div expression
View calculator_v5.py
def get_values_from_expr(expression):
if "+" in expression:
raw_values = expression.split("+")
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
values = list(map(str.strip, raw_values))
elif "-" in expression:
raw_values = expression.split("-")
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
values = list(map(str.strip, raw_values))
elif "*" in expression:
@nagavenkateshgowru
nagavenkateshgowru / test_calc.py
Last active Feb 14, 2020
Added test cases for evaluation sub, div, mult expressions
View test_calc.py
from calculator import calc, get_values_from_expr
def test_calc_add():
result = calc("3 + 2")
assert result == 5
def test_calc_add2():
result = calc("300 + 20")
assert result == 320
@nagavenkateshgowru
nagavenkateshgowru / calculator.py
Created Feb 14, 2020
Consuming get_values_from_expr
View calculator.py
def get_values_from_expr(expression):
if "+" in expression:
raw_values = expression.split("+")
print(raw_values)
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
values = list(map(str.strip, raw_values))
else:
raw_values = expression.split("-")
print(raw_values)
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
@nagavenkateshgowru
nagavenkateshgowru / calculator.py
Last active Feb 14, 2020
Added get_values_from_expr method
View calculator.py
def get_values_from_expr(expression):
if "+" in expression:
raw_values = expression.split("+")
print(raw_values)
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
values = list(map(str.strip, raw_values))
else:
raw_values = expression.split("-")
print(raw_values)
# raw_values is a list of operands like ['120 ',' 20'] with extra spaces
@nagavenkateshgowru
nagavenkateshgowru / prometheus.yml
Last active Dec 24, 2019
prometheus configuration to scape cAdvisor
View prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'cadvisor'
scrape_interval: 5s
static_configs:
@nagavenkateshgowru
nagavenkateshgowru / prometheus.yml
Last active Dec 24, 2019
Default-Simple Prometheus configuration
View prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
You can’t perform that action at this time.