Quantcast
Channel: User Amir Afianian - Stack Overflow
Browsing all 39 articles
Browse latest View live
↧

Comment by Amir Afianian on How to instruct pip to install a requirement with...

Unfortunately not in the way I wanted. Resolved it on a different level. (Container)

View Article


Comment by Amir Afianian on Python TooManyRedirects: Exceeded 30 redirects

@Bridge added the source

View Article

Comment by Amir Afianian on How to delay evaluation of python expression...

Looks promising. There are more challenges to what I want though, I just revised the question. Could you have another expert look?

View Article

Comment by Amir Afianian on How to delay evaluation of python expression...

The reason I want to postpone is that the evaluation of has_perm inside auth classes depends on some runtime value (for instance some request header value). By Postpone I mean that I want the or logic...

View Article

Comment by Amir Afianian on How to delay evaluation of python expression...

Hmm, could work. But the bitwise logic will be hidden under the IsAllowed class while I want it to be exposed in its init.

View Article


Comment by Amir Afianian on How to change __init__ param before instantiation

The important difference is that I want to define the bitwise logic explicitly on IsAllowed. So it looks like: IsAllowed(IsAdmin | HasPerm)

View Article

Comment by Amir Afianian on What's the best way to create flink table for...

Yes, timestamps and values are of the same length, could you share a snippet?

View Article

Comment by Amir Afianian on How to create a refreshable table using in-memory...

@DavidAnderson is PROCESS_CONTINUOUSLY supported by pyflink?

View Article


Comment by Amir Afianian on pre-commit authenticating to gitlab

Solved the issue for me as well

View Article


Comment by Amir Afianian on Validate iso datetime of csv column pyspark

@JNevill I added the missing info. Thanx.

View Article

Answer by Amir Afianian for Python module does not recognize module variable

A variable is global so long as you have not assigned it a value in your function. The latter makes the variable local. Even if, like in your case, the condition is not satisfied.Note: The use of...

View Article

Answer by Amir Afianian for Django: Get User profile from User serializer

The easiest way is to put, for showing profile data is to put depth = 1 in class Meta of your serializer as follows:class CurrentUserSerializer(serializers.ModelSerializer): groups =...

View Article

django, is it possible to use django multiple databases for file distribution

I have a scenario in which user uploads a file and a django app encodes the file into N distinct segments, each, to be stored on a different remote server. Say if we have 5 segments as the result of...

View Article


Answer by Amir Afianian for Where do I keep ORM in a distributed app?

I'd suggest you keep your DRF code with the rest of Django and containerize them together.As for the ORM, what matters is the container for Postgres. You cannot tear apart, say, models into a separate...

View Article

Answer by Amir Afianian for Download full text from tweepy API

You just need to pass tweet_mode='extended' while initializing Api:df = pd.DataFrame([str(tweet.created_at) +''+ tweet.text +'' for tweet in tweepy.Cursor(api.user_timeline, tweet_mode='extended', id =...

View Article


Answer by Amir Afianian for Google scholar blocks python scrapy with Captcha

Try using Google Cache along with a referer.Also, note not to send more than 2 requests/sec. You may get blocked:headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...

View Article

Answer by Amir Afianian for Which field in Django model to choose for a file...

It's a fairly and obvious choice to make:This is what Django docs say about FilePathFieldA CharField whose choices are limited to the filenames in a certain directory on the filesystem. Has some...

View Article


Answer by Amir Afianian for Converting Django BooleanField to...

It's taking you so long because of this for loop: objects= MyModel.objects.active().filter(my_boolean=False) for object in objects: object.my_boolean = None object.save() # Database roundtrip Namely,...

View Article

Answer by Amir Afianian for Mock a subset of a Python class's methods and...

Instead of patching the whole class, you must patch the object. Namely, make an instance of your class, then, patch the methods of that instance.Note that you can also use the decorator @patch.object...

View Article

Answer by Amir Afianian for Why can't I install Rasa on OSX? "There was a...

Given that you're on Mac you're gonna have an easier time if you go through homebrewIf you do not have Homebrew:/usr/bin/ruby -e "$(curl -fsSL...

View Article
Browsing all 39 articles
Browse latest View live