pylint friendly

Kindly request that requests be more pylint compliant.  When evaluating which package to use, this comes up with a score of -154.
Global evaluation
Your code has been rated at -154.92/10 (previous run: -154.91/10, -0.00)
Errors:
Davids-MacBook-Pro-2:~ dhwu$ pylint -E /Users/dhwu/Desktop/Evals/HTTP\ Libs/requests-2.5.1/requests
No config file found, using default configuration
************* Module requests.compat
E: 88, 4: No name 'quote' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'unquote' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'quote_plus' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'unquote_plus' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'urlencode' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'getproxies' in module 'urllib' (no-name-in-module)
E: 88, 4: No name 'proxy_bypass' in module 'urllib' (no-name-in-module)
E: 98,10: Undefined variable 'unicode' (undefined-variable)
E: 99,17: Using variable 'basestring' before assignment (used-before-assignment)
E:100,26: Undefined variable 'long' (undefined-variable)
************* Module requests.models
E: 39,10: Instance of 'LookupDict' has no 'moved' member (no-member)
E: 40,10: Instance of 'LookupDict' has no 'found' member (no-member)
E: 41,10: Instance of 'LookupDict' has no 'other' member (no-member)
E: 42,10: Instance of 'LookupDict' has no 'temporary_redirect' member (no-member)
E: 43,10: Instance of 'LookupDict' has no 'permanent_redirect' member (no-member)
E:343,18: Undefined variable 'unicode' (undefined-variable)
E:634,74: Instance of 'LookupDict' has no 'moved_permanently' member (no-member)
E:634,99: Instance of 'LookupDict' has no 'permanent_redirect' member (no-member)
E:792,51: Instance of 'bool' has no 'decode' member (no-member)
************* Module requests.sessions
E:145,42: Instance of 'LookupDict' has no 'see_other' member (no-member)
E:151,41: Instance of 'LookupDict' has no 'found' member (no-member)
E:156,41: Instance of 'LookupDict' has no 'moved' member (no-member)
E:162,46: Instance of 'LookupDict' has no 'temporary_redirect' member (no-member)
E:162,72: Instance of 'LookupDict' has no 'permanent_redirect' member (no-member)
************* Module requests.utils
E:537,52: Module 'sys' has no 'pypy_version_info' member (no-member)
E:538,52: Module 'sys' has no 'pypy_version_info' member (no-member)
E:539,52: Module 'sys' has no 'pypy_version_info' member (no-member)
E:540,15: Module 'sys' has no 'pypy_version_info' member (no-member)
E:541,76: Module 'sys' has no 'pypy_version_info' member (no-member)
************* Module requests.packages.chardet
E: 23,52: Undefined variable 'unicode' (undefined-variable)
************* Module requests.packages.chardet.compat
E: 25,21: Undefined variable 'unicode' (undefined-variable)
************* Module requests.packages.urllib3.connection
E:159, 0: class already defined line 20 (function-redefined)
************* Module requests.packages.urllib3.connectionpool
E: 46,19: Instance of '_MovedItems' has no 'xrange' member (no-member)
************* Module requests.packages.urllib3.request
E:  4, 4: No name 'urlencode' in module 'urllib' (no-name-in-module)
E: 49, 8: NotImplemented raised - should raise NotImplementedError (notimplemented-raised)
************* Module requests.packages.urllib3.response
E:182,36: Instance of 'str' has no 'read' member (no-member)
E:186,36: Instance of 'str' has no 'read' member (no-member)
E:195,33: Instance of 'str' has no 'close' member (no-member)
E:296,21: Instance of 'str' has no 'close' member (no-member)
E:303,28: Instance of 'str' has no 'closed' member (no-member)
E:305,28: Instance of 'str' has no 'isclosed' member (no-member)
E:313,28: Instance of 'str' has no 'fileno' member (no-member)
E:320,28: Instance of 'str' has no 'flush' member (no-member)
************* Module requests.packages.urllib3.contrib.ntlmpool
E: 44,13: Instance of 'NTLMConnectionPool' has no 'num_connections' member (no-member)
E: 46,24: Instance of 'NTLMConnectionPool' has no 'num_connections' member (no-member)
E: 46,46: Instance of 'NTLMConnectionPool' has no 'host' member (no-member)
E: 53,41: Instance of 'NTLMConnectionPool' has no 'host' member (no-member)
E: 53,57: Instance of 'NTLMConnectionPool' has no 'port' member (no-member)
************* Module requests.packages.urllib3.contrib.pyopenssl
E: 58, 0: No name '_fileobject' in module 'socket' (no-name-in-module)
E:158,33: Instance of 'OctetString' has no 'getComponentByPosition' member (no-member)
E:158,33: Instance of 'Any' has no 'getComponentByPosition' member (no-member)
E:158,33: Instance of 'str' has no 'getComponentByPosition' member (no-member)
************* Module requests.packages.urllib3.packages.ordered_dict
E: 82,35: Instance of 'dict' has no 'itervalues' member (no-member)
E:142, 4: Method has no argument (no-method-argument)
E:165,29: Instance of 'tuple' has no 'keys' member (no-member)
************* Module requests.packages.urllib3.packages.six
E: 42,19: Undefined variable 'basestring' (undefined-variable)
E: 43,26: Undefined variable 'long' (undefined-variable)
E: 44,31: Module 'types' has no 'ClassType' member (no-member)
E: 45,16: Undefined variable 'unicode' (undefined-variable)
E: 84,22: Instance of '_LazyDescr' has no 'resolve' member (no-member)
E:294,15: Undefined variable 'unicode' (undefined-variable)
E:341,36: Undefined variable 'basestring' (undefined-variable)
E:347,31: Undefined variable 'unicode' (undefined-variable)
E:353,31: Undefined variable 'unicode' (undefined-variable)
E:361,35: Undefined variable 'unicode' (undefined-variable)
E:365,22: Undefined variable 'unicode' (undefined-variable)
E:366,20: Undefined variable 'unicode' (undefined-variable)
************* Module requests.packages.urllib3.util.connection
E: 87, 8: Raising NoneType while only classes or instances are allowed (raising-bad-type)
************* Module requests.packages.urllib3.util.ssl
E: 22, 4: No name 'OP_NO_SSLv2' in module 'ssl' (no-name-in-module)
E: 22, 4: No name 'OP_NO_SSLv3' in module 'ssl' (no-name-in-module)
E: 22, 4: No name 'OP_NO_COMPRESSION' in module 'ssl' (no-name-in-module)
E: 41, 4: class already defined line 7 (function-redefined)
Davids-MacBook-Pro-2:~ dhwu$

Opening this kind of issue is exactly the kind of thing that is likely to get you some very negative comments indeed. =) Offering criticism without offering to help improve it is extremely bad manners. It's worse when the criticism is of the form "Your project doesn't live up to my personal standard " as this is. It's worse still when your criticism is based on an automated tool that is wrong.
Allow me to pick some examples:

E: 88, 4: No name 'quote' in module 'urllib' (no-name-in-module)

That's only true in Python 3, and the whole purpose of this module is to cover over differences between Python 2 and 3. All these errors are wrong.

E: 39,10: Instance of 'LookupDict' has no 'moved' member (no-member)

Static analysis of Python is stupid: it's a dynamic language! In practice, the instance gains this member at import time: any tool smart enough to import the module would have known this. These errors are all wrong.

E:537,52: Module 'sys' has no 'pypy_version_info' member (no-member)

It does on PyPy. Given that this is guarded by an 'if pypy' check, this error and all the ones like it are wrong.

E: 23,52: Undefined variable 'unicode' (undefined-variable)

There is on Python 2.
Any of the errors on urllib3 are in the wrong module, which is even more obviously true of six.
I'm being as polite as I can when I say that your tool is doing a terrible job. I strongly advise you never to open a similar issue on a different repository, or you will likely encounter a much stronger negative reaction than this one.

It looks like most of these are based around py2/3 compatibility which we have no intention of breaking.

@Lukasa : I am following a well known practice that is detailed in Idiomatic Python author:
http://www.jeffknupp.com/blog/2013/11/15/supercharge-your-python-developers/
Also detailed in Google coding standards.
FWIW:  pylint has caught many errors in my code and others in the past.
While we may differ in our views, not placing value judgements.  Just a data point.
Like I said in my prior post, my intent is to weight differing approaches.  Request at the top of that list.
Was hoping that this kind ask would be more open to possible changes... looks like closed for discussion already.
If you guys are open, I'd be open to making changes once I had more time.
But then that would be un-welcomed based on your statement too.
my 2 cents

To be clear: I do not believe anything that pylint has printed for modules outside requests.packages (which are third party code) is valid. I think everything it has said is wrong. If you can point to something that is not wrong, I will happily consider accepting a change based on it.
I agree that pylint can catch errors. However, doing a drive-by dump of every line reported by pylint is not a helpful approach. Two notes for the future:

Authors often have different views on Python style, particularly PEP8. Requests does not follow all of PEP8, and this is quite deliberate. You should always consult a project's author before raising a bug report about their code failing a linter.
You should validate the concerns of the linter before raising them. Open source maintainers are often very busy people, and asking them to validate each line of the linter's output for false positives is a rude way to behave. If you'd looked at these 'errors' first you'd have seen that they aren't valid.
It's likely that you'll say we should add a .pylintrc file to address these concerns. That's not a good idea. We should not have to add a dotfile to the repository root for every person who writes a linter.

Points taken
My apology for this faux pas
Sent from my iPhone

On Jan 20, 2015, at 10:19 AM, Cory Benfield<EMAIL_ADDRESS>wrote:
To be clear: I do not believe anything that pylint has printed for modules outside requests.packages (which are third party code) is valid. I think everything it has said is wrong. If you can point to something that is not wrong, I will happily consider accepting a change based on it.
I agree that pylint can catch errors. However, doing a drive-by dump of every line reported by pylint is not a helpful approach. Two notes for the future:
Authors often have different views on Python style, particularly PEP8. Requests does not follow all of PEP8, and this is quite deliberate. You should always consult a project's author before raising a bug report about their code failing a linter.
You should validate the concerns of the linter before raising them. Open source maintainers are often very busy people, and asking them to validate each line of the linter's output for false positives is a rude way to behave. If you'd looked at these 'errors' first you'd have seen that they aren't valid.
It's likely that you'll say we should add a .pylintrc file to address these concerns. That's not a good idea. We should not have to add a dotfile to the repository root for every person who writes a linter.
—
Reply to this email directly or view it on GitHub.

@Lukasa
Are you open to annotating source with comments disabling pylint warnings? Given that one can use symbolic names of warnings/errors such annotation would serve as documentation at the same time which should be useful.

@piotr-dobrogost Nope. =)
My concern is the potentially unbounded number of linters that we may be asked to support annotations or dotfiles for. Just because someone created a tool that they love doesn't mean we should add metadata to our codebase to support it. If the requests project uses a tool for its development, we'll add that metadata.  The majority of the errors are just plain wrong and any changes belong in pylint.

https://github.com/PyCQA/pylint/issues/1411 is the pylint issue which unfortunately indicates that pylint will not support requests.codes.
However, a workaround has been suggested for users: generated-members, documented in https://pylint.readthedocs.io/en/latest/technical_reference/features.html#id34.

To be clear, Requests should not add generated-members support itself. If folks want to add it to their own CI that’s fine, but pylint’s failure to support this does not place a burden on us to support them.

@Lukasa - yes, I wrote that comment to try to be helpful for people coming to this issue with the same issue that I had.
The hack that I did as a good-enough-for-me workaround was to run:
import string

import requests

pattern = '(requests\.)?codes\.({allowed}),'
accepted_characters = set(string.ascii_letters + '_')
keys = [key for key in requests.codes.__dict__.keys() if set(key).issubset(accepted_characters)]
print(pattern.format(allowed='|'.join(keys)))

and then add the outputted string to my pylint-rc's generated-members section.


add Document SymbolHandler

fix #125
LSP support for symbol Information added.

I request to not merge it to master branch until we add the symbol support in the compiler https://github.com/flix/flix/issues/2051 so that we can test it before merging.
After successful testing, we can merge it.


Interim Python Notebook Update

Here's an initial pull request for importing Spain data. I'd like a quick review to make sure I'm on the right track with respect to how sources are cited, datasets are created, proper amount of documenting, etc.

I'm not sure I understand about a Data Source being a python package. Does that mean that there won't be a Jupyter Notebook, or is that an output of a Jupyter Notebook. If it's a regular python file, is there a way to convert a Jupyter Notebook?
Thanks. I updated columns
I think this is addressed now

Do you have an example of a python contribution that would be good for me to look at?

Hi @Brian-V, can you please fix the linting issues?


Allow to render Chisel signals fields with different value representations

Now the UI supports only one type of TywavesTranslation, any value is shown with its type but the value is rendered as a bit vector.
It would be nice and useful if the user can also select different ways to render the values while still preserving the hierarchies and showing the types.

Solved by https://gitlab.com/rameloni/surfer-tywaves-demo/-/merge_requests/7
This issue will be closed once the release v0.3.1 of Surfer-tywaves will be published


Reorganize headers so that we can delete them downstream and replace them with our own.

I'll merge this if ticket 334 is approved.

LGTM.


Remove unused import io.netty.handler.logging.LogLevel

Coverage decreased (-0.7%) to 84.726% when pulling 61cd91664b387f6b1b862028fd9c04ad6f971fcf on JuHyun419:feature/120_remove_unused_import into 51068998bb36aba7b07ebe298785f6cfcb3f5afa on ztkmkoo:develop.


Not show Search voice

I'm try: searchView.setVoiceSearch(true);
But searchvoice not show.
When i delete isVoiceAvailable():
Line:
if (show && isVoiceAvailable() && allowVoiceSearch) {
...
Searchvoice is show, but don't click it
Help me

Does your device suport that feature?
This code is used in the library internally to check if works in your terminal:
private boolean isVoiceAvailable() {
        if (isInEditMode()) {
            return true;
        }
        PackageManager pm = getContext().getPackageManager();
        List<ResolveInfo> activities = pm.queryIntentActivities(
                new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
        return activities.size() == 0;
    }

If is not available, it will not show the voice input, doesn't matter if you used setVoiceSearch(true);

My code like you, but it not show searchvoice.
When i delete isVoiceAvailable():
Line:
if (show && isVoiceAvailable() && allowVoiceSearch) {
...
Searchvoice is show, but don't click it
Help me. Please!

I think it should be : return activities.size() != 0

This man --> @nex0s speaks the truth!
Issue #19 also related.

i edited return activities.size() != 0, but when click the voice, not show micaro.
I think not fix this.

It meens that the context you inflated the materialSearch is not instance of Activity.
Did you use the theme attribut on your view?

this problem is the same as me, the button search voice is hidden. Does anyone fix it ??

Change the onVoiceClicked to:
private void onVoiceClicked() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
//intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak an item name or number");    // user hint
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);    // setting recognition model, optimized for short phrases – search queries
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);    // quantity of results we want to receive
if (mContext instanceof Activity) {
((Activity) mContext).startActivityForResult(intent, REQUEST_VOICE);
} else {
scanForActivity(mContext).startActivityForResult(intent, REQUEST_VOICE);
}
}
private static Activity scanForActivity(Context cont) {
    if (cont == null)
        return null;
    else if (cont instanceof Activity)
        return (Activity)cont;
    else if (cont instanceof ContextWrapper)
        return scanForActivity(((ContextWrapper)cont).getBaseContext());

    return null;
}


HATEOAS:

Hypermedia as the Engine of Application State is a principle that hypertext links should be used to create a better navigation through the API.
E.g.,
{
    "name": "Alice",
    "links": [ {
        "rel": "self",
        "href": "http://localhost:8080/customer/1"
    } ]

}

In flask_restful it's accomplished like this:'uri': fields.Url('todo_resource'),

addressed in #19


InteractiveViewer should support aligning sized content when 'constrained' is false

Use case
I have a large image that the user can drag around within a smaller box using the new InteractiveViewer widget. I have set constrained to false. I'm not seeing any way to set the initial alignment of the contents -- currently the image is always forced to the top-left. A requirement of this use case is that the image starts center-aligned. Using a Transform widget is insufficient because it won't place nicely with the boundary margin of the InteractiveViewer.
Proposal
I'm not sure what the API should look like, but we need some way to control how the contents of the InteractiveViewer are initially positioned when the child is larger than the parent.
This might be as simple as passing an Alignment into the InteractiveViewer which can be used on the inner OverflowBox.

CC @justinmc

This may be a duplicate of https://github.com/flutter/flutter/issues/58997, take a look at the discussion there.  I'm thinking we should add a BoxFit parameter to handle things like this.
Another thing to look at in the meantime is my flutter-go example.  It's not exactly what you want, but it might give you some ideas.
Last thing to try, it should definitely be possible to center the child by actually setting the translation of the matrix with TransformationController.  You'll have to know the size of the parent and child and do the math yourself.

You're right, this appears to be a duplicate. Thanks for the ideas in the meantime!

No problem, I'll try to follow up on https://github.com/flutter/flutter/issues/58997 soon.


No longer works (most likely due to new modules)

A fresh install no longer works.  All get requests return a 404:

My bad, forgot to attach '/api' in the URL.  Runs perfectly.


Loggable and Translation

Hi,
working on a Category and CategoryTranslation.
getUpdateLogMessage() is not triggered if I modify only translations of Category.
Do I have to use ORMBehaviors\Loggable\Loggable on each Category and CategoryTranslation ? or is there another way ?

unfortunately, doctrine does not trigger events on an entity if only its associations change. You'll have to workaround a second listener of yours maybe.

Ok thanks.


Add API endpoint to set task target completion date

Need
See the front-end ticket.
DOD

PATCH endpoint to support bulk update of task completion dates.
The targetCompletion date should be in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ Example: 2024-05-17T10:00:00Z . The front end will map dates to quarters or months etc. for display.
The command fails with 400 if the date is not valid.
The command fails if one of the IDs is invalid with 404.
Tests!

Technical Design
Below is an initial approach with some code sketches to accomplish the above, extracted from this ChatGPT session.
API Endpoint: /api/tasks/completionDates
HTTP Method: PATCH
Request

Endpoint: /api/tasks/completionDates
Method: PATCH
Request Body:{
  "taskIds": ["id1", "id2", "id3"],
  "targetCompletion": "2024-05-17T10:00:00Z"
}

Response

Status Codes:

200 OK: The update is successful, and the response includes the updated entities.
400 Bad Request: The request is malformed or contains invalid data. e.g. the date is not a valid date.
404 Not Found: One or more of the specified task IDs do not exist.

Response Body (200 OK):
[
  {
    "id": "id1",
    "targetCompletion": "2024-05-17T10:00:00Z",
    "updatedAt": "2024-05-17T12:00:00Z",
    "otherField1": "value1",
    "otherField2": "value2"
  },
  {
    "id": "id2",
    "targetCompletion": "2024-05-17T10:00:00Z",
    "updatedAt": "2024-05-17T12:00:00Z",
    "otherField1": "value1",
    "otherField2": "value2"
  },
  {
    "id": "id3",
    "targetCompletion": "2024-05-17T10:00:00Z",
    "updatedAt": "2024-05-17T12:00:00Z",
    "otherField1": "value1",
    "otherField2": "value2"
  }
]

We want to return the full updated task objects in the response.

SQL Update Statement
The SQL update statement must ensure that if one of the provided IDs is not valid, the request should be rejected with a 404 Not Found error.
UPDATE hat.validations
SET target_completion = $1, updated_at = CURRENT_TIMESTAMP
WHERE id = ANY($2::uuid[]);

Node.js with TypeScript Implementation
import { Pool } from 'pg';

const pool = new Pool({
  user: 'yourUsername',
  host: 'yourHost',
  database: 'yourDatabase',
  password: 'yourPassword',
  port: 5432, // or your port number
});

async function updateCompletionDates(ids: string[], completionDate: string): Promise<any[]> {
  const client = await pool.connect();
  try {
    await client.query('BEGIN');

    const updateQuery = `
      UPDATE hat.validations
      SET target_completion = $1, updated_at = CURRENT_TIMESTAMP
      WHERE id = ANY($2::uuid[])
      RETURNING *;
    `;
    const result = await client.query(updateQuery, [completionDate, ids]);

    if (result.rowCount !== ids.length) {
      throw new Error('Not all IDs exist');
    }

    await client.query('COMMIT');
    return result.rows; // Return the updated rows
  } catch (error) {
    await client.query('ROLLBACK');
    if (error.message === 'Not all IDs exist') {
      throw new Error('404 Not Found');
    }
    throw error;
  } finally {
    client.release();
  }
}

// Example usage
const ids = ['id1', 'id2', 'id3']; // replace with actual UUIDs
const completionDate = '2024-05-17T10:00:00Z';

updateCompletionDates(ids, completionDate)
  .then((updatedTasks) => {
    console.log('Update successful', updatedTasks);
  })
  .catch((error) => {
    if (error.message === '404 Not Found') {
      console.error('Update failed: One or more task IDs not found.');
    } else {
      console.error('Update failed:', error.message);
    }
  });

Error Handling

If the number of rows updated does not match the number of provided IDs, the transaction will be rolled back, and an error indicating that not all IDs exist will be thrown, resulting in a 404 Not Found response.
The transaction will also be rolled back if any other error occurs during the update process.

Testing

Ensure that the endpoint correctly updates the targetCompletion date for the specified task IDs.
Verify that the endpoint fails with an appropriate error message if any of the specified IDs do not exist.
Test edge cases, such as providing an empty list of IDs or an invalid targetCompletion date.

I should add, this is only accessible by CONTENT_ADMINS

Complete


chore(litmus-portal): added setup for gql query, subscription and in-memory cache

Removed unused imports
Setup for Graphql: added setup for gql query, subscription and in-memory cache

(this contains setup files only and the two schemas)

@arkajyotiMukherjee circleci is failed

@arkajyotiMukherjee circleci is failed

the build has passed...just had to rerun it @rajdas98


Unable to generate metrics with fake prediction

Hi, thank you for the dataset. I'm currently working on the 3D tracking and be able to generate a .bin file. I'm trying to use the waymo evaluation tool and I meet above problem during running a demo to generate metric. The chinese means Insufficient permissions.

Hi,
You might need to specify the build target:
bazel build waymo_open_dataset/metrics/tools:compute_detection_metrics_main

Best,
Wayne, on behalf of the Waymo Open Dataset team