Giter Club home page Giter Club logo

Comments (48)

umbresp avatar umbresp commented on July 30, 2024 1
  1. 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.

umbresp avatar umbresp commented on July 30, 2024

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.

fourjr avatar fourjr commented on July 30, 2024
  1. Yes
  2. How is it legacy code? πŸ€”
  3. get_player = get_profile
  4. google python str classes
  5. all the class functions for profile, band, etc doesn't need to be coroutines

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

fourjr avatar fourjr commented on July 30, 2024

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.

fourjr avatar fourjr commented on July 30, 2024

ctrl+f __str__
http://www.greenteapress.com/thinkpython/html/book018.html

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024
  1. method aliases: get_player = alias, or if in __init__, add self to both
  2. idk what u and 4jr mean
  3. idk ask 4jr he seems to think they are very unnecessary
  4. use ctrl shift f in sublime text for that (find self.baseUrl in all open files and folders (default) and replace with self.base_url) and 4jr wants u to be in the habit of following pep8

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024
  1. I still dont know what you mean
  2. this is about asyncing and not asyncing
  3. i just did
  4. too lazy also all other attributes are camelCase cuz i didn't use camel killer box so this is for uniformity

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024
  1. after your get_player function, put this:
get_player = get_profile
  1. k
  2. k
  3. 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.

umbresp avatar umbresp commented on July 30, 2024
  1. 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
  1. k
  2. k
  3. k

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024
  1. no, remove 4 spaces from the get_player = get_profile. It should be outside the function itself
  2. um so yes or no?

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024
  1. it is unindented, the first line just got its indent removed
  2. 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.

SharpBit avatar SharpBit commented on July 30, 2024
  1. ok
  2. the player class doesn't have that attribute... it's the client and async client

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024

idk how it's weird, it's pep8 m8

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024
  1. idk why you want it to be camelcase so much
  2. oops yea switch it i made that same mistake on mine too

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024

@fourjr please help me convince this man to follow pep8 kthx

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024

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.

umbresp avatar umbresp commented on July 30, 2024

what if the class doesn't inherit box

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024

i thought all your classes inherit box

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

not client and asyncclient

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

could i make them inherit from box tho?

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024

you don't need client to inherit from box

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

but i want to camel_kill client and asyncclient

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024

um client doesn't have any attributes that the user needs, only methods, so it doesn't matter

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024

please stop replying to me

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

because people read source and it looks ugly

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

hey but on the bright side everything else is fixed right?

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

also i still dont understand the aliasing thing

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

alias is because some people call it player and some call it profile

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

no i know but how do i implement it

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

self.get_player = self.get_profile in init

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

in __init__.py you should import * errors

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

u sure its not the other way around for get_profile

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

idk do what your program does :/

you get the concept right?

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

ok i changed all that

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

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.

fourjr avatar fourjr commented on July 30, 2024

lmao i just evalled dir(requests.Session())

from brawlstars.

fourjr avatar fourjr commented on July 30, 2024

nope don't await

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

ok

from brawlstars.

SharpBit avatar SharpBit commented on July 30, 2024

You still didn't do everything? :/

from brawlstars.

umbresp avatar umbresp commented on July 30, 2024

uh whats there left to do

from brawlstars.

kyb3r avatar kyb3r commented on July 30, 2024

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.

SharpBit avatar SharpBit commented on July 30, 2024

@4rqm it's because he wanted to

  1. Steal the brawlstars name
  2. Make a better one than mine

from brawlstars.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.