Skip to main content

Posts

DC bot on replit doeas not responding but online on server

Hi I want to make a dc bot on replit like this my code is: import discord import os client = discord.Client(intents=discord.Intents.default()) @client.event async def on_ready(): print("This is user {0.user}".format(client)) @client.event async def on_message(message): if message.author == client.user: return if message.content.startswith("$hello"): await message.channel.send("Hello!") my_secret = os.environ['TOKEN'] client.run(my_secret) My bot is not responding to my command but it is online I checked the permissions source https://stackoverflow.com/questions/75837767/dc-bot-on-replit-doeas-not-responding-but-online-on-server

How to convert my cypress code into generic Type script parameterized function

As I am new to this UI automation/cypress world, need help to setting up the assertion on javascript object return by cypress-ag-grid package My code is reading ag-grid data cy.get("#myGrid").getAgGridData().should((data)=>{ cy.log(data) }) Which is printing below object in console [ { id: 1, name: "tata", saftyRating: "50" }, { id: 2, name: "maruti", saftyRating: "50" }, { id: 3, name: "ford", saftyRating: "45" } ] My cypress code is: cy.get("#myGrid").getAgGridData().should((data)=>{ data.forEach(({ saftyRating }) => { cy.wrap(+saftyRating).should('be.gt', 50); }) }); This is working fine till the moment I try make it generic parameterized typescript function which is as below: columnValueAssertion(colname:string, asserttype:string,value:number){ cy.get("#myGrid").getAgGridData().should((data)=>{ data.forEach(({ colname }) => { cy.wrap(+colna

Is it possible to build an ARM64 linux wheel on Github?

Currently I use cibuildwheel for building a c extension on Github. cibuildwheel supports ARM64 for Windows (experimental) and Mac. It seems to support also ARM64 linux, with the name aarch64 (that is the "canonical" name of ARM64). AArch64 linux needs QEMU. The problem is that in the example it's not clear how to specify in the Github pipeline the use of QEMU for AArch64. source https://stackoverflow.com/questions/75806892/is-it-possible-to-build-an-arm64-linux-wheel-on-github

pip install <.whl file> installs dist_info but doesn't actually install the package

I'm trying change my package over from using setup.py to using pyproject.toml and setup.cfg . My setup.cfg is roughly as follows: [metadata] name = our_name version = 0.1.1 author = me [options] install_requires = networkx >= 3.0 My code is all under src , and I'm relying on the automatic src-layout discovery mechanism. When I run python -m build it generates a proper wheel file ( dist/our_name-0.1.1-py3-none-any.whl ). When I unpack that wheel file, everything is in there properly - it seems to have discovered all my code correctly. However, when I install it ( pip install dist/our_name*.whl ), only the distribution info directory shows up in site-packages . Because the dist info is there, pip list shows it as being there, but because the actual module directory is missing, I can't import anything from my module elsewhere, or do anything with it. Any clue what I'm doing wrong? Addendum: Per sinoroc's comment: pyproject.toml : [build-system] r

someone knows how to hide the content of an input without being of type password? that is of the email type

`in my work I am asked to hide the content of the input as if it were a password and I don't know what to do. I tried to replace the last letters that came with a * and it worked but if I need to delete for example the penultimate letter it erases the last one. is there a better solution? const deleteLastLetter = (unprotectedEmail, email, InitialEmail) => { let unprotectedEmailDeleteLastLetter = unprotectedEmail.slice( 0, InitialEmail.length - unprotectedEmail.length ); let emailViewDeleteLastLetter = email.slice( 0, InitialEmail.length - unprotectedEmail.length ); return { unprotectedEmailDeleteLastLetter, emailViewDeleteLastLetter, }; }; const onChangeEmail = (e, emailView) => { //trim() removes the spaces at the beginning and end of the text const InitialEmail = e.target.value.toLowerCase().trim(); //ask if the emailView variable is set to false (this shows the value of the text in *) if (!emailView) { if (InitialEmail.length < unprotectedEmail.length) { // if a lett

Calling a function parallelly that does internal parallelization?

MAJOR EDIT Suppose I have a function that does internal parallelization, and I want to parallelize this function. How do I do this in Python? Let's consider a very simple concrete example. The function fun1 takes two numbers as input and adds them up. def fun1(a, b): return a+b The function fun2 takes two integer inputs m and n . It generates a list of size mn containing tuples as the following code shows. Then it parallelizes fun1 on this list. def fun2(m, n): # create list of mn tuples list_tuple = [(i, j) for i in range(m) for j in range(n)] # apply fun1 parallelly to list_tuple pool = multiprocessing.Pool() return pool.starmap(fun1, list_tuple) Thus, fun2 returns a list of size mn. We want to apply fun2 parallelly to a list of (m,n) pairs. if __name__ == '__main__': # create the list of (m, n) tuples list_tuple = [(m, n) for m in range(10) for n in range(10)] # parallellize fun2 pool = multiprocessing.Pool() pool.starmap(fun2, list_tuple) M

Setting X axis interval with categorical date variable [closed]

I have a dataframe as below: enter image description here I wish to plot date in x axis with a list that has exactly the number of date values as in the table and the record count for that date in y axis. The code I am using (as shown below) gives the following syntax error: File "<ipython-input-48-192c9d0a3a14>", line 5 b==Rec_Cnt_BD010['Record_Count_BD010'] ^ SyntaxError: invalid syntax Any help is sincerely appreciated! xaxisint=[202101,202102,202103,202104,202105,202106,202107,202108,202109,202110,202111,202112,202201,202202,202203,202204,202205, 202206,202207,202208,202209,202210,202211,202212] a==Rec_Cnt_BD010['Process'] b==Rec_Cnt_BD010['Record_Count_BD010'] ax=plt.axes() plt.plot(a,b, kind='line', color='r', marker='x') ax.set_xticks(xaxisint) plt.axhline(y = Rec_Cnt_BD010[b].mean(), color = 'b', linestyle = '--', label='Mean') plt.grid(True) plt.xlabel('Date')