Comments (48)
- i dont want it to be camelcase so much. i want them all to be either snake case or camel case, and they were all camel case until now
from brawlstars.
1-3 Easy fixes.
4 How do you make it required? Just donβt specify a default value?
5-6 Legacy code, if its not a huge problem i wont touch it
7 How do you add aliases? Just create a new method with the same function but different name?
8 idk how to do that
9-10 I implemented that anticipating future endpoints. Also I like my stuff very object-oriented.
11-13 Ok
14 Can you provide examples? Iβm not sure where await is required
from brawlstars.
- Yes
- How is it legacy code? π€
get_player = get_profile
- google python str classes
- all the class functions for profile, band, etc doesn't need to be coroutines
from brawlstars.
4 k
5-6 from my other wrapper cocasync
7 give example in context pls
8 k
14 but then they wont be asynchronous
from brawlstars.
what's the use for it to be asynchronous? those functions don't take up a lot of runtime and even if you call it "asyncly", it won't have much of an effect
from brawlstars.
ctrl+f __str__
http://www.greenteapress.com/thinkpython/html/book018.html
from brawlstars.
Ok I did most of them.
Stuff I am still confused about:
- How to make method aliases
Stuff I didn't do
- async client is supposed to be purely async, if they don't want async, they can just use the regular client
- get_id, get_members, etc all return objects and i think it looks better that way
- fix baseUrl to base_url because I can't find all the places where I used it and also nobody will want to get the base url so there's no point and its immutable anyways
from brawlstars.
- method aliases:
get_player = alias
, or if in__init__
, addself
to both - idk what u and 4jr mean
- idk ask 4jr he seems to think they are very unnecessary
- use
ctrl shift f
in sublime text for that (findself.baseUrl
inall open files and folders
(default) and replace withself.base_url
) and 4jr wants u to be in the habit of following pep8
from brawlstars.
- I still dont know what you mean
- this is about asyncing and not asyncing
- i just did
- too lazy also all other attributes are camelCase cuz i didn't use camel killer box so this is for uniformity
from brawlstars.
- after your
get_player
function, put this:
get_player = get_profile
- k
- k
- 4jr wants u to follow pep8 (he says it's more important than anything else, i think, except maybe copying code) and also, ctrl shift f is way easier then searching through yourself and fixing each one, so idk why you say "too lazy"
from brawlstars.
- like this?
def get_player(self, tag):
tag = tag.strip("#")
tag = tag.upper()
try:
with self.session as session:
resp = sesssion.get(f'{self.baseUrl}players/{tag}', headers=self.headers, timeout=self.timeout)
if resp.status_code == 200:
data = resp.json()
elif 500 > resp.status_code > 400:
raise HTTPError(resp.status_code)
else:
raise Error()
except ValueError:
raise MissingData('data')
except:
raise Timeout()
data = Box(data)
player = Player(data)
return player
get_player = get_profile
- k
- k
- k
from brawlstars.
- no, remove 4 spaces from the
get_player = get_profile
. It should be outside the function itself - um so yes or no?
from brawlstars.
- it is unindented, the first line just got its indent removed
- idk it would be weird for everything else to be camelCase and just that to be snake_case. example:
Attributes
player.base_url
player.trophies
player.highestTrophies
player.showdownVictories
Methods
player.get_band()
player.get_id()
It would feel weird to me if only one of the attributes were snake case while everything else was camel case because that was how i was differentiating between methods and variables
from brawlstars.
- ok
- the player class doesn't have that attribute... it's the client and async client
from brawlstars.
oh sorry but u can say the same for client too, even though client doesn't have any important attributes it would be weird for all other attributes to be camelCase except that one attribute of client.
from brawlstars.
idk how it's weird, it's pep8 m8
from brawlstars.
the only way i would switch it is if i used camel killer box for everything else but i dont want to because then ill be copying u since i dont know how to use it
also are u sure its get_player = get_profile
and not get_profile = get_player
from brawlstars.
- idk why you want it to be camelcase so much
- oops yea switch it i made that same mistake on mine too
from brawlstars.
@fourjr please help me convince this man to follow pep8 kthx
from brawlstars.
AEUORINAEIORNBON%(WN#%VASODI its the fucking api and ill probably keep them camel case unless u teach me how to use camel killer box
from brawlstars.
AEUORINAEIORNBON%(WN#%VASODI Class_That_Inherits_Box(data, camel_killer_box=True)
or just follow pep8 m8 so u don't have to change ur docs from camelCase to snake_case and ONLY one attribute instead of all. π€·ββοΈ
from brawlstars.
what if the class doesn't inherit box
from brawlstars.
i thought all your classes inherit box
from brawlstars.
not client and asyncclient
from brawlstars.
could i make them inherit from box tho?
from brawlstars.
you don't need client to inherit from box
from brawlstars.
but i want to camel_kill client and asyncclient
from brawlstars.
um client doesn't have any attributes that the user needs, only methods, so it doesn't matter
from brawlstars.
then why does baseUrl need to be base_url its not like the user is going to use it anyways cuz its always the same thing
from brawlstars.
please stop replying to me
from brawlstars.
because people read source and it looks ugly
from brawlstars.
hey but on the bright side everything else is fixed right?
from brawlstars.
also i still dont understand the aliasing thing
from brawlstars.
alias is because some people call it player and some call it profile
from brawlstars.
no i know but how do i implement it
from brawlstars.
self.get_player = self.get_profile
in init
from brawlstars.
in __init__.py
you should import * errors
from brawlstars.
u sure its not the other way around for get_profile
from brawlstars.
idk do what your program does :/
you get the concept right?
from brawlstars.
ok i changed all that
from brawlstars.
I ctrl f ed on the requests documentation for close() but nothing showed up so I assumed it didn't exist
also for aliasing do i have to await the coroutines (e.g. self.get_player = await self.get_profile)
from brawlstars.
lmao i just evalled dir(requests.Session())
from brawlstars.
nope don't await
from brawlstars.
ok
from brawlstars.
You still didn't do everything? :/
from brawlstars.
uh whats there left to do
from brawlstars.
Ahahaha I'm reading through this and I can see that umbresp is actually fucking retarded. Why make this library if you don't know how to use python?
from brawlstars.
@4rqm it's because he wanted to
- Steal the brawlstars name
- Make a better one than mine
from brawlstars.
Related Issues (4)
- docstrings HOT 1
- TypeError
- PERFECT.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brawlstars.