From 6907ce28b0bd6383622253b60cdc4cba6c7dd5d5 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Fri, 27 Oct 2017 15:05:27 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20test.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 00000000000..1dd43ba60c0 --- /dev/null +++ b/test.py @@ -0,0 +1,17 @@ + +def buildConnectionString(params): + """Build a connection string from a dictionary of parameters. + + Returns string.""" + return ";".join(["%s=%s" % (k, v) for k, v in params.items()]) + + +if __name__ == "__main__": + myParams = { + "server": "mpilgrim", + "database": "master", + "dfw": "dsfwee", + "uid": "sa", + "pwd": "secret" + } + print buildConnectionString(myParams) From c21c37c161e4612f037b681e64ee184fcfc23938 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Fri, 27 Oct 2017 15:24:02 +0800 Subject: [PATCH 2/8] Update test.py add name --- test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index 1dd43ba60c0..3b08e356508 100644 --- a/test.py +++ b/test.py @@ -12,6 +12,7 @@ def buildConnectionString(params): "database": "master", "dfw": "dsfwee", "uid": "sa", - "pwd": "secret" + "pwd": "secret", + "name":"hmq" } print buildConnectionString(myParams) From 5091dec79f2b6d2ea10a97b99d769af7217aa936 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Fri, 27 Oct 2017 16:26:26 +0800 Subject: [PATCH 3/8] modify README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f9d7d430517..d0c1b68d277 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,6 @@ In the scripts the comments etc are lined up correctly when they are viewed in [ - `testlines.py` - This very simple script open a file and prints out 100 lines of whatever is set for the line variable. -- `serial_scanner.py` contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in our computer, this method works only on Linux and Windows (can be extended for mac osx). If no port is found, an empty list is returned. \ No newline at end of file +- `serial_scanner.py` contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in our computer, this method works only on Linux and Windows (can be extended for mac osx). If no port is found, an empty list is returned. + +- `test.py` Build a connection string from a dictionary of parameters.Returns string. \ No newline at end of file From 8a842d53939b0ad10837d03288575f12171ead00 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Fri, 27 Oct 2017 16:48:53 +0800 Subject: [PATCH 4/8] add ch1.py --- ch1.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ch1.py diff --git a/ch1.py b/ch1.py new file mode 100644 index 00000000000..80360a037ea --- /dev/null +++ b/ch1.py @@ -0,0 +1,12 @@ +from matplotlib import pyplot as plt +#%matplotlib inline +variance = [1,2,4,8,16,32,64,128,256] +bias_squared=[256,128,64,32,16,8,4,2,1] +total_error=[x+y for x,y in zip(variance,bias_squared)] +xs = [i for i,_ in enumerate(variance)] +plt.plot(xs,variance,'g-',label='variance') +plt.plot(xs,bias_squared,'r-',label='bias^2') +plt.plot(xs,total_error,'b:',label='total_error') +plt.title('bias variance') +plt.legend(loc=9) +plt.show() \ No newline at end of file From 7da42ff33a385a60032c0e82cee629a0f4e9f9c4 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Fri, 27 Oct 2017 16:56:25 +0800 Subject: [PATCH 5/8] add ch1.py commit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d0c1b68d277..8ebe693839c 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,5 @@ In the scripts the comments etc are lined up correctly when they are viewed in [ - `serial_scanner.py` contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in our computer, this method works only on Linux and Windows (can be extended for mac osx). If no port is found, an empty list is returned. -- `test.py` Build a connection string from a dictionary of parameters.Returns string. \ No newline at end of file +- `test.py` Build a connection string from a dictionary of parameters.Returns string. +- `ch1.py` matplotlib test \ No newline at end of file From 170cc6f2f59b330f330118a18a04d4bb17198866 Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Tue, 31 Oct 2017 10:42:52 +0800 Subject: [PATCH 6/8] add test --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ebe693839c..29743b98187 100644 --- a/README.md +++ b/README.md @@ -39,4 +39,5 @@ In the scripts the comments etc are lined up correctly when they are viewed in [ - `serial_scanner.py` contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in our computer, this method works only on Linux and Windows (can be extended for mac osx). If no port is found, an empty list is returned. - `test.py` Build a connection string from a dictionary of parameters.Returns string. -- `ch1.py` matplotlib test \ No newline at end of file +- `ch1.py` matplotlib test +- add test \ No newline at end of file From 2e64b5397012c95ead93bc9416675b4662439dcf Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Tue, 31 Oct 2017 10:49:17 +0800 Subject: [PATCH 7/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29743b98187..89387587312 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,4 @@ In the scripts the comments etc are lined up correctly when they are viewed in [ - `test.py` Build a connection string from a dictionary of parameters.Returns string. - `ch1.py` matplotlib test -- add test \ No newline at end of file +- add test 哈哈 From 8e7516d9bec31900af38f20e7c974e61b6c5773a Mon Sep 17 00:00:00 2001 From: coolfish-a <547007034@qq.com> Date: Tue, 31 Oct 2017 10:53:07 +0800 Subject: [PATCH 8/8] del test haha --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 89387587312..db0eb12d13e 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,3 @@ In the scripts the comments etc are lined up correctly when they are viewed in [ - `test.py` Build a connection string from a dictionary of parameters.Returns string. - `ch1.py` matplotlib test -- add test 哈哈