Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/Richienb/ROS-Code into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Richienb committed Sep 17, 2018
2 parents 8140bc6 + 00feda7 commit b0ed160
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
5 changes: 4 additions & 1 deletion min/ros/__init__.py
Expand Up @@ -11,5 +11,8 @@
VER="ROS Code 2.0 | Running on {} {} | Python Version {}.{}.{}".format(platform.system(),platform.release(),list(sys.version_info)[0],list(sys.version_info)[1],list(sys.version_info)[2])
print(VER)
while True:
exec("print("+input(">> ")+")")
if sys.version_info>(3,0):
exec("print("+input(">> ")+")")
else:
exec("print("+raw_input(">> ")+")")
# Created by pyminifier (https://github.com/liftoff/pyminifier)
1 change: 0 additions & 1 deletion src/ros/__init__.py
Expand Up @@ -27,4 +27,3 @@
else:
# Python 2 code in this block
exec("print(" + raw_input(">> ") + ")")

56 changes: 33 additions & 23 deletions src/ros/main.py
Expand Up @@ -10,7 +10,7 @@
import keyword
import importlib

# String modues
# String modules
import string
import pprint

Expand All @@ -27,13 +27,13 @@
def shellinput(initialtext='>> ', splitpart=' '):
"""
Give the user a shell like interface to enter commands which are returned as a multi part list containing the command and each of the arguments
Give the user a shell-like interface to enter commands which are returned as a multi-part list containing the command and each of the arguments
initialtext:
Set the text to be displayed as the prompt. Default is '>>'.
splitpart:
The character to split when generating the list item. Default is ' '. Set to '' or None to skip splitting.
The character to split when generating the list item. The default is ' '. Set to '' or None to skip splitting.
"""

Expand All @@ -60,10 +60,10 @@ def colourcode(startcolourcode, destinationtype, longhex=False):
Set the colour code to convert from
destinationtype:
Set the colour code type to convert to. Possible options are hex, hsl, rgb, red, blue, green, hue, sat and lum
Set the colour code type to convert to. Possible options are HEX, HSL, RGB, red, blue, green, hue, sat and lum
longhex:
If converting to hex, provided the long and unsimplified version. Default is False.
If converting to hex, provided the long and unsimplified version. The default is False.
"""

Expand Down Expand Up @@ -97,13 +97,13 @@ def changecolour(colourcode, action, amount=100):
Modify a parameter of a colour code
colourcode:
The colourcode representing the colour to convert from.
The colour code representing the colour to convert from.
action:
The action to perform on the colour. Possible options are red, blue, green, hue, sat, lum
amount:
The percentage of the action to perform. For example: 100 means apply 100% of the colour (no change). Default is 100.
The percentage of the action to perform. For example, 100 means apply 100% of the colour (no change). The default is 100.
"""

Expand Down Expand Up @@ -134,7 +134,7 @@ def leadingzero(number, minlength):
Add leading zeros to a number
number:
Number to add the leading zeros to
The number to add the leading zeros to
minlength:
If the number is shorter than this length than add leading zeros to make the length correct
Expand Down Expand Up @@ -166,10 +166,10 @@ def splitstring(string, split_character=' ', part=None):
The string to split
split_character:
The character to split for the string. Default is ' '.
The character to split for the string. The default is ' '.
part:
Get a specific part of the list. Default is None.
Get a specific part of the list. The default is None.
"""

Expand All @@ -187,10 +187,10 @@ def sort(listtosort, key=None, reversesort=False):
The list which will be sorted
key:
The key to use when sorting. Default is None.
The key to use when sorting. The default is None.
reverse:
If to sort backwards. Default is False.
If to sort backwards. The default is False.
"""

Expand All @@ -203,10 +203,10 @@ def pykeyword(operation='list', keywordtotest=None):
Check if a keyword exists in the Python keyword dictionary
operation:
Whether to list or check the keywords. Possible options are list and check. Default is 'list'.
Whether to list or check the keywords. Possible options are list and check. The default is 'list'.
keywordtotest:
The keyword to test for if operation is 'check'. Default is None.
The keyword to test for if the operation is 'check'. The default is None.
"""

Expand Down Expand Up @@ -405,7 +405,7 @@ def opposite(boolean):
return not boolean
except BaseException:
raise RuntimeError(
'An Error Has Occured: Nor A Bool Or Len Was Provided (0014)')
'An Error Has Occurred: Nor A Bool Or Len Was Provided (0014)')


# Check If A Number Is A Decimal
Expand Down Expand Up @@ -604,11 +604,21 @@ def replacetext(string, texttofind, texttoreplace):
# Get User input


def userinput(prompttext):
try:
return input(prompttext)
except BaseException:
def userinput(prompttext=""):
"""
Get the input of the user via a universally secure method
prompttext:
The text to display while receiving the data. The default is "".
"""
if sys.version_info > (3, 0):
# Python 3 code in this block
return input(str(prompttext))
else:
# Python 2 code in this block
return raw_input(str(prompttext))


# Evaluate A Expression Or Operation
Expand Down Expand Up @@ -658,7 +668,7 @@ def convertascii(value, command='to'):
raise RuntimeError('Invalid Symbol (0015)')
else:
raise RuntimeError(
'An Error Has Occured: Invalid Operation Entered (0008)')
'An Error Has Occurred: Invalid Operation Entered (0008)')


# Get All Available Characters For A Type
Expand All @@ -683,7 +693,7 @@ def availchar(charactertype):
return string.whitespace
else:
raise RuntimeError(
'An Error Has Occured: Invalid Operation Entered (0008)')
'An Error Has Occurred: Invalid Operation Entered (0008)')


# Get The Value Of A Word
Expand Down Expand Up @@ -803,7 +813,7 @@ def roslicense(raw=False):
print(u'\u2139' +
' Conditions: License and copyright notice And State changes')
print(
'To View The Full license, Go To: https://rosurl.ga/ROS-Code-license'
'To View, The Full license, Go To https://rosurl.ga/ROS-Code-license'
)
else:
print('ROS Code Is licensed Under The Apache License 2.0')
Expand All @@ -813,5 +823,5 @@ def roslicense(raw=False):
print('Limitations: Trademark use, Liability And Warranty')
print('Conditions: License and copyright notice And State changes')
print(
'To View The Full license, Go To: https://rosurl.ga/ROS-Code-license'
'To View, The Full license, Go To https://rosurl.ga/ROS-Code-license'
)
2 changes: 1 addition & 1 deletion src/ros/roserrors.py
Expand Up @@ -3,7 +3,7 @@
This file contains all the code required for declaring errors
"""

import datetime
from datetime import datetime

# Regular Error and code to inherit

Expand Down

0 comments on commit b0ed160

Please sign in to comment.