Re: Question regarding objects in __call__() methods

2018-03-26 Thread Arshpreet Singh
On Monday, 26 March 2018 11:32:51 UTC+5:30, dieter wrote: > Fürther inspection utilities: "dir", "vars" and the "inspect" module. > Read the documentation to find out what they do. Thanks, Dieter, That is really helpful! -- https://mail.python.org/mailman/listinfo/python-list

Question regarding objects in __call__() methods

2018-03-25 Thread Arshpreet Singh
I am debugging a set of code which is something like this: http://dpaste.com/1JXTCF0 I am not able to understand that what role internet object is playing and how I can use/call it. As debugging the code I got at line 10. I am sending a request to particular API and returning a

Re: Cython taking more time than regular Python

2016-09-19 Thread Arshpreet Singh
On Tuesday, 20 September 2016 11:00:40 UTC+5:30, Stefan Behnel wrote: > > In [8]: %timeit omega(10) > > 1 loops, best of 3: 91.6 µs per loop > > Note that this is the worst benchmark ever. Any non-dump C compiler will > happily apply Young Gauß and calculate the result in constant

Cython taking more time than regular Python

2016-09-19 Thread Arshpreet Singh
Hope this is good place to ask question about Cython as well. Following code of mine is taking 2.5 times more time than Native Python code: %%cython import numpy as np a = np.array([]) def large_sum2(int num_range): np.append(a,[i for i in xrange(num_range)]) return a.sum %timeit

Re: Holding until next value change

2016-08-26 Thread Arshpreet Singh
On Saturday, 20 August 2016 11:38:03 UTC+5:30, Steve D'Aprano wrote: > state = ignore_negative # DON'T call the function yet > for value in main_call(): > print(value) # for testing > if state(value): > print("changing state") > state = TABLE[state] Above code works at

Re: Holding until next value change

2016-08-25 Thread Arshpreet Singh
On Saturday, 20 August 2016 19:48:38 UTC+5:30, andrze...@gmail.com wrote: > prev = None > for value in main_call(): > if value==prev: > pass > else: > prev = value > if prev>0: > print('+v') > elif prev<0: > print('-v') >

Re: Holding until next value change

2016-08-20 Thread Arshpreet Singh
On Saturday, 20 August 2016 11:38:03 UTC+5:30, Steve D'Aprano wrote: > On Sat, 20 Aug 2016 02:53 pm, Arshpreet Singh wrote: > > > I am writing a function as main_call() which is continuously producing > > values. (+ve or -ve) I want to print on screen only for first +ve value

Holding until next value change

2016-08-19 Thread Arshpreet Singh
I am writing a function as main_call() which is continuously producing values. (+ve or -ve) I want to print on screen only for first +ve value and hold until -ve value comes around. here is my code: def main_call(): while True: yield strategy() for value in main_call():

holding if/else condition in live bitcoin trading Python

2016-08-02 Thread Arshpreet Singh
I am making a function that is running in while loop and if/else statements make decisions on based on the condition: here is code: def main_call(): while True: l0_0 = getDiff('btcusd',8) l1_0 = np.tanh(l0_0*0.8446488687) l1_1 = np.tanh(l0_0*-0.5674069006)

Python text file fetch specific part of line

2016-07-27 Thread Arshpreet Singh
I am writing Imdb scrapper, and getting available list of titles from IMDB website which provide txt file in very raw format, Here is the one part of file(http://pastebin.com/fpMgBAjc) as the file provides tags like Distribution Votes,Rank,Title I want to parse title names, I tried with

CyberRoam Python Alternative for network security

2016-07-08 Thread Arshpreet Singh
This is question more about product information and less technical but Hope It will be use-able at some context, I use Cyeberoam(https://www.cyberoam.com/) Is there any Python alternative available for that? or If I have to write/implement something like

Re: not able to install mysqldb-python

2016-06-24 Thread Arshpreet Singh
On Thursday, 23 June 2016 23:18:27 UTC+5:30, Joaquin Alzola wrote: > >ImportError: No module named 'ConfigParser' > It is telling you the error > This email is confidential and may be subject to privilege. If you are not > the intended recipient, please do not copy or disclose its content

not able to install mysqldb-python

2016-06-23 Thread Arshpreet Singh
I am trying to run django project in virtual environment. it needs mysql database library but when I try to install that it returns the error that configparser is not installed but I have installed configparser still the error remains same, is this ubuntu bug? (env) ubuntu@ip-:~/clearapp$ pip

passing dictionay as argument

2016-06-13 Thread Arshpreet Singh
I have to pass dictionary as function argument for following code: import authorize authorize.Configuration.configure( authorize.Environment.TEST, 'api_login_id', 'api_transaction_key', ) result = authorize.Transaction.sale({ 'amount': 40.00, 'credit_card': {

Re: Intel Distribution for Python

2016-05-10 Thread Arshpreet Singh
Thanks for the information, I just applied for program but I got one mail about license and expiration. This software license expires on October 29, 2016. I am not able to understand that can anyone put some light on that how license can be expired? --

Re: E-commerce system in Python

2016-03-20 Thread Arshpreet Singh
On Friday, 18 March 2016 21:44:46 UTC+5:30, Chris Warrick wrote: > asyncio is, as you said, brand new -- probably nothing exists. > Why not use the existing Django solution though? What is your problem > with it? It's a great framework that does a lot of the hard work for > you. Flask is

Re: Fetch Gmail Archieved messages

2016-03-20 Thread Arshpreet Singh
On Saturday, 19 March 2016 05:38:16 UTC+5:30, Rick Johnson wrote: > I gave you "real help". > > What you want me to do -- write the code for you? Sorry, but Python-list is > not a soup kitchen for destitute code. Neither is it a triage center were you > can bring your sick code, drop it at

E-commerce system in Python

2016-03-19 Thread Arshpreet Singh
I am looking for an E-commerce system in python to sell things things online, which can also be responsive for Android and IOS. A quick Google search brought me http://getsaleor.com/ it uses Django, Is there any available one using Flask or newly born asyncio based framework? --

Re: Fetch Gmail Archieved messages

2016-03-18 Thread Arshpreet Singh
On Friday, 18 March 2016 11:14:44 UTC+5:30, Rick Johnson wrote: > # > # BEGIN CODE > # > import imaplib > > def inbox_week(): > emailAddress = '...@gmail.com' > emailPassword = 'mypassword' > # START ADDING CODE HERE > # > # END CODE > # Well I am asking for real

Re: Fetch Gmail Archieved messages

2016-03-18 Thread Arshpreet Singh
On Tuesday, 15 March 2016 22:32:42 UTC+5:30, Rick Johnson wrote: > Is that last line doing what you think it's doing? Let's > break it down... Basically you have one condition, that is > composed of two main components: > > Component-1: EMAIL in str(msg[header]) > > and > >

Fetch Gmail Archieved messages

2016-03-15 Thread Arshpreet Singh
Hi, I am using imaplib to fetch Gmail's Inbox Archived message but results are not that much accurate. Here is code+logic: def inbox_week(): import imaplib EMAIL = 'myusern...@gmail.com' PASSWORD = 'mypassword' mail = imaplib.IMAP4_SSL('imap.gmail.com') mail.login( EMAIL,

Re: Pyraf problem

2016-02-26 Thread Arshpreet Singh
On Thursday, 25 February 2016 20:07:52 UTC+5:30, Sapna Mishra wrote: > Dear Sir/Mam, > > I am using python for my astronomy purpose, for that I want to use PyRaf, but > strange thing is occurring that pyraf is getting open as a root but out side > my root user directory when I am typing pyraf

Re: avoid for loop calling Generator function

2016-02-22 Thread Arshpreet Singh
On Monday, 22 February 2016 19:05:24 UTC+5:30, Peter Otten wrote: > Arshpreet Singh wrote: > > > Hi, I am converting PDF into text file, I am using following code. > > > > from pypdf2 import PdfFileReader > > > > def read_pdf(pdfFileName): > >

Re: Setting up/authenticating Google API?

2016-02-22 Thread Arshpreet Singh
On Sunday, 21 February 2016 21:21:54 UTC+5:30, Skip Montanaro wrote: > This isn't strictly a Python question, however... Once I get myself > authenticated, I intend to use the Python Google API to pump archived > mail messages from a few defunct mailing lists into Google Groups. I > thought it

avoid for loop calling Generator function

2016-02-22 Thread Arshpreet Singh
Hi, I am converting PDF into text file, I am using following code. from pypdf2 import PdfFileReader def read_pdf(pdfFileName): pdf = PdfFileReader(pdfFileName) yield from (pg.extractText() for pg in pdf.pages) for i in read_pdf('book.pdf'): print(i) I want to avoid for

Re: Why generators take long time?

2016-01-19 Thread Arshpreet Singh
On Tuesday, 19 January 2016 12:58:28 UTC+5:30, Arshpreet Singh wrote: > I was playing with Generators and found that using Generators time is bit > more than list-comprehensions or I am doing it wrong? > > > Function with List comprehensions: > > def sum_text(number_ran

Re: Why generators take long time?

2016-01-19 Thread Arshpreet Singh
On Tuesday, 19 January 2016 15:42:16 UTC+5:30, Steven D'Aprano wrote: > [steve@ando ~]$ python -m timeit -s "from collections import deque" > -s "it = iter([i for i in xrange(1000)])" "deque(it, maxlen=0)" > 100 loops, best of 3: 0.913 usec per loop > > > [steve@ando ~]$ python -m

Why generators take long time?

2016-01-18 Thread Arshpreet Singh
I was playing with Generators and found that using Generators time is bit more than list-comprehensions or I am doing it wrong? Function with List comprehensions: def sum_text(number_range): return sum([i*i for i in xrange(number_range)]) %timeit sum_text(1) 1 loops, best of 3:

Re: When I need classes?

2016-01-10 Thread Arshpreet Singh
On Sunday, 10 January 2016 23:20:02 UTC+5:30, Bernardo Sulzbach wrote: > Essentially, classes (as modules) are used mainly for organizational purposes. > > Although you can solve any problem you would solve using classes > without classes, solutions to some big problems may be cheaper and > more

Re: When I need classes?

2016-01-10 Thread Arshpreet Singh
On Sunday, 10 January 2016 21:09:52 UTC+5:30, Steven D'Aprano wrote: > There are *no* problems that are impossible to solve without classes, but > sometimes classes will make problems easier to solve. And sometimes classes > make problems harder to solve. It depends on the problem. Is there any

Re: When I need classes?

2016-01-10 Thread Arshpreet Singh
On Sunday, 10 January 2016 20:33:20 UTC+5:30, Michael Torrie wrote: > This way I can import functions defined in this script into another > script later if I want. > > If I find I need to share state between functions, and if I find that I > might need to have multiple situations of shared

When I need classes?

2016-01-09 Thread Arshpreet Singh
Hello Friends, I am quite new to OOP(object oriented Programming), I did some projects with python which includes Data-Analysis, Flask Web Development and some simple scripts. I have only one question which is bothering me most of the time, When I will get the need to use Classes in Python?

Python PNG Viewer(Browser Based)

2015-11-03 Thread Arshpreet Singh
Hello Everyone, I am looking for Browser-based PNG file viewer written in Python.(Flask framework preferably) Following project(Flask-Based) provides many things(File manager as well as file viewer) but it does not support PNG files. https://github.com/vmi356/filemanager Any idea if I have to

Re: Python PNG Viewer(Browser Based)

2015-11-03 Thread Arshpreet Singh
On Tuesday, 3 November 2015 21:32:03 UTC+5:30, Chris Warrick wrote: > On 3 November 2015 at 12:54, Arshpreet Singh <arsh...@gmail.com> wrote: > > Hello Everyone, > > > > I am looking for Browser-based PNG file viewer written in > > Python.(Flask framework pref

Re: Recover data over the network

2015-10-09 Thread Arshpreet Singh
On Saturday, 10 October 2015 04:40:27 UTC+5:30, Steven D'Aprano wrote: > What do you mean, "recover data from a server"? What has happened to the > server? Can it boot or is it in an unbootable state? Are the hard drives > physically damaged? What sort of hard drives? (Solid state, or magnetic

Re: Recover data over the network

2015-10-09 Thread Arshpreet Singh
On Saturday, 10 October 2015 04:40:27 UTC+5:30, Steven D'Aprano wrote: > What do you mean, "recover data from a server"? What has happened to the > server? Can it boot or is it in an unbootable state? Are the hard drives > physically damaged? What sort of hard drives? (Solid state, or magnetic

Re: Recover data over the network

2015-10-09 Thread Arshpreet Singh
On Friday, 9 October 2015 22:51:16 UTC+5:30, Emile van Sebille wrote: > without extensive clues as to the nature of the data to be recovered > you're not going to get much further with this. It is mostly /home partition data on disk. Those are user Configuration files.(user accounts,

Recover data over the network

2015-10-09 Thread Arshpreet Singh
Hello Python and People! I want to write a small Python application which will be able to 1.recover data from server and 2.send it to another server. For the 2nd part I can use scp(secure copy), Please let me know if any data-recovery library is available in Python to do 1st task. --