"ERROR: Signature extraction failed" for youtube video

Hi,

I have encountered an error with a video:
https://www.youtube.com/watch?v=LDvVYqUMuJ0

```
$ /tmp/ydl/youtube-dl/youtube-dl https://www.youtube.com/watch?v=LDvVYqUMuJ0 --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'https://www.youtube.com/watch?v=LDvVYqUMuJ0', u'--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.11.02
[debug] Python version 2.7.10+ - Linux-4.2.0-1-amd64-x86_64-with-debian-stretch-sid
[debug] exe versions: ffmpeg 1.0.6, ffprobe 1.0.6, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] LDvVYqUMuJ0: Downloading webpage
[youtube] LDvVYqUMuJ0: Downloading video info webpage
[youtube] LDvVYqUMuJ0: Extracting video information
WARNING: unable to extract html5 player; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[youtube] {22} signature length 40.44, html5 player None
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 817, in _decrypt_signature
    video_id, player_url, s
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 709, in _extract_signature_function
    raise ExtractorError('Cannot identify player %r' % player_url)
ExtractorError: Cannot identify player u'https://s.ytimg.com/yts/jsbin/player-en_US-vfljDEtYP/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
 (caused by ExtractorError(u"Cannot identify player u'https://s.ytimg.com/yts/jsbin/player-en_US-vfljDEtYP/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 817, in _decrypt_signature
    video_id, player_url, s
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 709, in _extract_signature_function
    raise ExtractorError('Cannot identify player %r' % player_url)
ExtractorError: Cannot identify player u'https://s.ytimg.com/yts/jsbin/player-en_US-vfljDEtYP/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/YoutubeDL.py", line 661, in extract_info
    ie_result = ie.extract(url)
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/common.py", line 290, in extract
    return self._real_extract(url)
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 1345, in _real_extract
    encrypted_sig, video_id, player_url, age_gate)
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 827, in _decrypt_signature
    'Signature extraction failed: ' + tb, cause=e)
ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 817, in _decrypt_signature
    video_id, player_url, s
  File "/tmp/ydl/youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 709, in _extract_signature_function
    raise ExtractorError('Cannot identify player %r' % player_url)
ExtractorError: Cannot identify player u'https://s.ytimg.com/yts/jsbin/player-en_US-vfljDEtYP/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
 (caused by ExtractorError(u"Cannot identify player u'https://s.ytimg.com/yts/jsbin/player-en_US-vfljDEtYP/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
```

Thanks,
Corey


ITV BTCC videos support?

## Please follow the guide below

- You will be asked some questions and requested to provide some information, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *issue* (like this: `[x]`)
- Use the *Preview* tab to see what your issue will actually look like

---

### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2018.04.09*. If it's not, read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
- [*] I've **verified** and **I assure** that I'm running youtube-dl **2018.04.09**

### Before submitting an *issue* make sure you have:
- [*] At least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [*] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones
- [*] Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

### What is the purpose of your *issue*?
- [ ] Bug report (encountered problems with youtube-dl)
- [*] Site support request (request for adding support for a new site)
- [ ] Feature request (request for a new functionality)
- [ ] Question
- [ ] Other

---

### The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your *issue*

---

### If the purpose of this *issue* is a *bug report*, *site support request* or you are not completely sure provide the full verbose output as follows:

Add the `-v` flag to **your command line** you run youtube-dl with (`youtube-dl -v <your command line>`), copy the **whole** output and insert it here. It should look similar to one below (replace it with **your** log inserted between triple ```):

```
$ youtube-dl -v https://pastebin.com/raw/KxD6rhpF --geo-bypass-country UK
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://pastebin.com/raw/KxD6rhpF', u'--geo-bypass-country', u'UK']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.04.09
[debug] Python version 2.7.13 (CPython) - Linux-4.9.62-v7+-armv7l-with-debian-9.4
[debug] exe versions: ffmpeg 3.2.10-1, ffprobe 3.2.10-1
[debug] Proxy map: {}
[debug] Using fake IP None (UK) as X-Forwarded-For.
[generic] KxD6rhpF: Requesting header
WARNING: Falling back on generic information extractor.
[generic] KxD6rhpF: Downloading webpage
[generic] KxD6rhpF: Extracting information
[download] Downloading playlist: Brightcove video tester
[generic] playlist Brightcove video tester: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[debug] Using fake IP None (UK) as X-Forwarded-For.
[debug] Using fake IP None (UK) as X-Forwarded-For.
[brightcove:new] 5766870719001: Downloading webpage
[brightcove:new] 5766870719001: Downloading JSON metadata
ERROR: Access to this resource is forbidden by access policy.
You might want to use a VPN or a proxy server (with --proxy) to workaround.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/brightcove.py", line 706, in _real_extract
    json_data = self._download_json(api_url, video_id, headers=headers)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 692, in _download_json
    encoding=encoding, data=data, headers=headers, query=query)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 634, in _download_webpage
    res = self._download_webpage_handle(url_or_request, video_id, note, errnote, fatal, encoding=encoding, data=data, headers=headers, query=query)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/adobepass.py", line 1332, in _download_webpage_handle
    *args, **compat_kwargs(kwargs))
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 539, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 528, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
ExtractorError: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 789, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 440, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/brightcove.py", line 712, in _real_extract
    self.raise_geo_restricted(msg=message)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 743, in raise_geo_restricted
    raise GeoRestrictedError(msg, countries=countries)
GeoRestrictedError: Access to this resource is forbidden by access policy.
```

---

### If the purpose of this *issue* is a *site support request* please provide all kinds of example URLs support for which should be included (replace following example URLs by **yours**):

ITV separated the BTCC race videos from the hub (which also seems to be having issues as per https://github.com/rg3/youtube-dl/issues/15925)
Lately the video are hosted at http://www.itv.com/btcc/races (ie for a particular weekend all videos are posted at individual pages like: http://www.itv.com/btcc/races/btcc-2018-all-the-action-from-brands-hatch)

Skimming the source code of this sample weekend page, I extracted the vid params and built a test page:
- Single video: https://pastebin.com/raw/KxD6rhpF

**Question 1:** is the log error above pointing just to a geo restriction error or is there anything else involved that I missed? (ie: like writing some header to force the ITV scrapper to act instead of a generic one)

```
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Brightcove video tester</title>
   <style>
    .video-js {
      height: 360px;
      width: 640px;
    }
    .video-js.vjs-mouse .vjs-big-play-button {
      background-color: red;
      opacity: .3;
    }
   </style>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>

<body>
	<video data-id="id3809566268703" data-video-id="5766870719001" data-account="1582188683001" data-player="HkiHLnNRx" data-embed="default" data-application-id="" data-fc-id="87459" class="video-js" controls="">
	</video>

	<script src="https://players.brightcove.net/1582188683001/HkiHLnNRx_default/index.min.js">
	</script>
</body>
</html>
```

**Question 2:** is there any way to generate a playlist of downloadable items based on pages like http://www.itv.com/btcc/races/btcc-2018-all-the-action-from-brands-hatch with youtube-dl?


type: bug
aws:cloudformation
status: backlog

bug: CDK Table build with replicationRegions failing on latest

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Trying to deploy a [CDK Table](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html) to a localstack environment results in the following:

```
stack | 0/3 | 8:56:58 PM | CREATE_FAILED        | AWS::CloudFormation::Stack | stack Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "CREATE_FAILED" at least once
```

```
localstack  | 2023-08-06T03:56:28.709 DEBUG --- [   asgi_gw_4] localstack.packages.api    : Installation of dynamodb-local skipped (already installed).
localstack  | 2023-08-06T03:56:28.709 DEBUG --- [   asgi_gw_4] l.services.dynamodb.server : Starting DynamoDB Local: ['java', '-Xmx256m', '-javaagent:/usr/lib/localstack/dynamodb-local/latest/ddb-local-loader-0.1.jar', '-Djava.library.path=/usr/lib/localstack/dynamodb-local/latest/DynamoDBLocal_lib', '-jar', '/usr/lib/localstack/dynamodb-local/latest/DynamoDBLocal.jar', '-port', '35799', '-dbPath', '/var/lib/localstack/tmp/state/dynamodb']
localstack  | 2023-08-06T03:56:28.710 DEBUG --- [uncthread160] localstack.utils.run       : Executing command: ['java', '-Xmx256m', '-javaagent:/usr/lib/localstack/dynamodb-local/latest/ddb-local-loader-0.1.jar', '-Djava.library.path=/usr/lib/localstack/dynamodb-local/latest/DynamoDBLocal_lib', '-jar', '/usr/lib/localstack/dynamodb-local/latest/DynamoDBLocal.jar', '-port', '35799', '-dbPath', '/var/lib/localstack/tmp/state/dynamodb']
localstack  | 2023-08-06T03:56:28.939 DEBUG --- [uncthread160] l.services.dynamodb.server : Initializing DynamoDB Local with the following configuration:
localstack  | 2023-08-06T03:56:28.939 DEBUG --- [uncthread160] l.services.dynamodb.server : Port:	35799
localstack  | 2023-08-06T03:56:28.939 DEBUG --- [uncthread160] l.services.dynamodb.server : InMemory:	false
localstack  | 2023-08-06T03:56:28.939 DEBUG --- [uncthread160] l.services.dynamodb.server : DbPath:	/var/lib/localstack/tmp/state/dynamodb
localstack  | 2023-08-06T03:56:28.940 DEBUG --- [uncthread160] l.services.dynamodb.server : SharedDb:	false
localstack  | 2023-08-06T03:56:28.940 DEBUG --- [uncthread160] l.services.dynamodb.server : shouldDelayTransientStatuses:	false
localstack  | 2023-08-06T03:56:28.940 DEBUG --- [uncthread160] l.services.dynamodb.server : CorsParams:	null
localstack  | 2023-08-06T03:56:28.950 DEBUG --- [uncthread160] l.services.dynamodb.server :
localstack  | 2023-08-06T03:56:29.715  INFO --- [   asgi_gw_4] botocore.credentials       : Found credentials in environment variables.
localstack  | 2023-08-06T03:56:30.532 DEBUG --- [   asgi_gw_4] l.services.plugins         : checking service health dynamodb:4566
localstack  | 2023-08-06T03:56:30.534  INFO --- [   asgi_gw_4] localstack.utils.bootstrap : Execution of "require" took 1887.18ms
localstack  | 2023-08-06T03:56:30.879 DEBUG --- [   asgi_gw_1] l.services.plugins         : checking service health kinesis:4566
localstack  | 2023-08-06T03:56:30.886  INFO --- [   asgi_gw_1] l.s.k.kinesis_mock_server  : Creating kinesis backend for account 000000000000
localstack  | 2023-08-06T03:56:30.887 DEBUG --- [   asgi_gw_1] localstack.packages.api    : Starting installation of kinesis-local...
localstack  | 2023-08-06T03:56:30.887 DEBUG --- [   asgi_gw_1] localstack.utils.run       : Executing command: ['npm', 'install', '--prefix', '/var/lib/localstack/lib/kinesis-local/0.4.2', 'kinesis-local@0.4.2']
localstack  | 2023-08-06T03:56:32.575 DEBUG --- [   asgi_gw_1] localstack.packages.core   : Setting ownership root:root on /var/lib/localstack/lib/kinesis-local/0.4.2
localstack  | 2023-08-06T03:56:32.575 DEBUG --- [   asgi_gw_1] localstack.packages.api    : Installation of kinesis-local finished.
localstack  | 2023-08-06T03:56:32.576 DEBUG --- [   asgi_gw_1] l.s.k.kinesis_mock_server  : starting kinesis process ['node', PosixPath('/var/lib/localstack/lib/kinesis-local/0.4.2/node_modules/kinesis-local/main.js')] with env vars {'KINESIS_MOCK_CERT_PATH': '/var/lib/localstack/lib/kinesis-local/0.4.2/node_modules/kinesis-local/server.json', 'KINESIS_MOCK_PLAIN_PORT': 42209, 'KINESIS_MOCK_TLS_PORT': 34279, 'SHARD_LIMIT': '100', 'ON_DEMAND_STREAM_COUNT_LIMIT': '10', 'AWS_ACCOUNT_ID': '000000000000', 'CREATE_STREAM_DURATION': '500ms', 'DELETE_STREAM_DURATION': '500ms', 'REGISTER_STREAM_CONSUMER_DURATION': '500ms', 'START_STREAM_ENCRYPTION_DURATION': '500ms', 'STOP_STREAM_ENCRYPTION_DURATION': '500ms', 'DEREGISTER_STREAM_CONSUMER_DURATION': '500ms', 'MERGE_SHARDS_DURATION': '500ms', 'SPLIT_SHARD_DURATION': '500ms', 'UPDATE_SHARD_COUNT_DURATION': '500ms', 'UPDATE_STREAM_MODE_DURATION': '500ms', 'SHOULD_PERSIST_DATA': 'true', 'PERSIST_PATH': '../../../var/lib/localstack/tmp/state/kinesis', 'PERSIST_FILE_NAME': '000000000000.json', 'PERSIST_INTERVAL': '5s', 'LOG_LEVEL': 'INFO'}
localstack  | 2023-08-06T03:56:32.576 DEBUG --- [uncthread166] localstack.utils.run       : Executing command: ['node', PosixPath('/var/lib/localstack/lib/kinesis-local/0.4.2/node_modules/kinesis-local/main.js')]
localstack  | 2023-08-06T03:56:32.834  INFO --- [uncthread166] l.s.k.kinesis_mock_server  : [info] kinesis.mock.KinesisMockService$ 2023-08-06T03:56:32.823005Z contextId=6956dd23-c61e-4aa1-80ce-b8bfc8d0894b, cacheConfig={"awsAccountId":"000000000000","awsRegion":"us-east-1","createStreamDuration":{"length":500,"unit":"MILLISECONDS"},"deleteStreamDuration":{"length":500,"unit":"MILLISECONDS"},"deregisterStreamConsumerDuration":{"length":500,"unit":"MILLISECONDS"},"initializeStreams":null,"logLevel":"INFO","mergeShardsDuration":{"length":500,"unit":"MILLISECONDS"},"onDemandStreamCountLimit":10,"persistConfig":{"fileName":"000000000000.json","interval":{"length":5,"unit":"SECONDS"},"loadIfExists":true,"path":"../../../var/lib/localstack/tmp/state/kinesis","shouldPersist":true},"registerStreamConsumerDuration":{"length":500,"unit":"MILLISECONDS"},"shardLimit":100,"splitShardDuration":{"length":500,"unit":"MILLISECONDS"},"startStreamEncryptionDuration":{"length":500,"unit":"MILLISECONDS"},"stopStreamEncryptionDuration":{"length":500,"unit":"MILLISECONDS"},"updateShardCountDuration":{"length":500,"unit":"MILLISECONDS"}} Logging Cache Config
localstack  | 2023-08-06T03:56:32.986  INFO --- [uncthread166] l.s.k.kinesis_mock_server  : [info] kinesis.mock.KinesisMockService$ 2023-08-06T03:56:32.986197Z  Starting Kinesis TLS Mock Service on port 34279
localstack  | 2023-08-06T03:56:32.987  INFO --- [uncthread166] l.s.k.kinesis_mock_server  : [info] kinesis.mock.KinesisMockService$ 2023-08-06T03:56:32.986862Z  Starting Kinesis Plain Mock Service on port 42209
localstack  | 2023-08-06T03:56:32.994  INFO --- [uncthread166] l.s.k.kinesis_mock_server  : [info] kinesis.mock.KinesisMockService$ 2023-08-06T03:56:32.994001Z contextId=1d81ef53-1648-4fbc-8b16-f09375d77ece Starting persist data loop
localstack  | 2023-08-06T03:56:33.215 DEBUG --- [uncthread158] l.s.c.resource_provider    : Executing callback method for AWS::DynamoDB::Table:ddbFooTabletable735E488F
localstack  | 2023-08-06T03:56:33.330 DEBUG --- [uncthread158] l.s.c.e.template_deployer  : Error applying changes for CloudFormation stack "stack-ddbFooTableNestedStackdd-f1d922ad": 'NoneType' object has no attribute 'get' Traceback (most recent call last):
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 965, in _run
localstack  |     self.do_apply_changes_in_loop(changes, stack)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 1011, in do_apply_changes_in_loop
localstack  |     should_deploy = self.prepare_should_deploy_change(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 1105, in prepare_should_deploy_change
localstack  |     resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py.enc", line 35, in resolve_refs_recursively
localstack  |     A=resolve_refs_recursively_orig(*E,**F)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 178, in resolve_refs_recursively
localstack  |     result = _resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 478, in _resolve_refs_recursively
localstack  |     value[key] = resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py.enc", line 35, in resolve_refs_recursively
localstack  |     A=resolve_refs_recursively_orig(*E,**F)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 178, in resolve_refs_recursively
localstack  |     result = _resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 478, in _resolve_refs_recursively
localstack  |     value[key] = resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py.enc", line 35, in resolve_refs_recursively
localstack  |     A=resolve_refs_recursively_orig(*E,**F)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 178, in resolve_refs_recursively
localstack  |     result = _resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 497, in _resolve_refs_recursively
localstack  |     value[i] = resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py.enc", line 35, in resolve_refs_recursively
localstack  |     A=resolve_refs_recursively_orig(*E,**F)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 178, in resolve_refs_recursively
localstack  |     result = _resolve_refs_recursively(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/functions.py", line 80, in func
localstack  |     return wrapped(*args, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 290, in _resolve_refs_recursively
localstack  |     resolved_getatt = get_attr_from_model_instance(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 102, in get_attr_from_model_instance
localstack  |     attribute = attribute.get(part)
localstack  | AttributeError: 'NoneType' object has no attribute 'get'
localstack  |
localstack  |
localstack  | 2023-08-06T03:56:33.426  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:33.445  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:38.447  INFO --- [   asgi_gw_4] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:38.458  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:43.464  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:43.473  INFO --- [   asgi_gw_4] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:48.479  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:48.489  INFO --- [   asgi_gw_4] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:53.495  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:53.502  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:58.487  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:56:58.495  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:56:58.743 DEBUG --- [uncthread154] l.s.c.e.template_deployer  : Error applying changes for CloudFormation stack "stack": Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "CREATE_FAILED" at least once Traceback (most recent call last):
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 965, in _run
localstack  |     self.do_apply_changes_in_loop(changes, stack)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 1039, in do_apply_changes_in_loop
localstack  |     self.apply_change(change, stack=stack)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/engine/template_deployer.py", line 1152, in apply_change
localstack  |     progress_event = executor.deploy_loop(resource_provider_payload)  # noqa
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/resource_provider.py", line 572, in deploy_loop
localstack  |     event = self.execute_action(resource_provider, payload)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/resource_provider.py", line 638, in execute_action
localstack  |     return resource_provider.create(request)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/resource_provider.py", line 350, in create
localstack  |     return self.create_or_delete(request)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/resource_provider.py", line 499, in create_or_delete
localstack  |     result_handler(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/cloudformation/models/cloudformation.py", line 55, in _handle_result
localstack  |     connect_to().cloudformation.get_waiter("stack_create_complete").wait(
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/waiter.py", line 55, in wait
localstack  |     Waiter.wait(self, **kwargs)
localstack  |   File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/waiter.py", line 375, in wait
localstack  |     raise WaiterError(
localstack  | botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "CREATE_FAILED" at least once
localstack  |
localstack  |
localstack  | 2023-08-06T03:57:03.504  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
localstack  | 2023-08-06T03:57:03.511  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS cloudformation.DescribeStacks => 200
localstack  | 2023-08-06T03:57:03.520  INFO --- [   asgi_gw_4] localstack.request.aws     : AWS cloudformation.DescribeStackEvents => 200
```

I am using the CDK Table class with a stream enabled, which requires replicas to enable the stream. There's no creative way around this issue that I'm aware of, due to the stack failing before the fully deployment of the Table class.

### Expected Behavior

I'm expecting the build to succeed locally, so I can continue with our stack deployment chain for our local environments.

The behavior is not present on `localstack/localstack-pro:2.2.0` or any release prior to the update this week. I am successfully able to deploy to live environments with the same CDK stack without error.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

docker-compose up

```
version: "3.8"

networks:
  ls:
    name: ls

services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
    environment:
      - DEBUG=${DEBUG-1}
      - DISABLE_CORS_CHECKS=1
      - DISABLE_CUSTOM_CORS_APIGATEWAY=1
      - DOCKER_HOST=unix:///var/run/docker.sock
      - EXTRA_CORS_ALLOWED_ORIGINS=*
      - MAIN_DOCKER_NETWORK=ls
      - PERSISTENCE=${PERSISTENCE-}
    env_file:
      - ./localstack.local.env
    image: "localstack/localstack-pro:${LOCALSTACK_VERSION-latest}"
    networks:
      - ls
    ports:
      - "127.0.0.1:4566:4566" # LocalStack Gateway
      - "127.0.0.1:4510-4559:4510-4559" # external services port range
      - "127.0.0.1:53:53" # DNS config (required for Pro)
      - "127.0.0.1:53:53/udp" # DNS config (required for Pro)
      - "127.0.0.1:443:443" # LocalStack HTTPS Gateway (required for Pro)
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

```

.env file contains:

```
LOCALSTACK_API_KEY=xxxxxxxxxx
```

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

npx cdklocal deploy api

```
const account = process.env.CDK_ACCOUNT || "000000000000";
const region = "us-west-2";

new APIStack(app, "api", {
  crossRegionReferences: true,
  env: { account, region },
  stackName: "api",
});
```

```
new DynamoStack(this, "ddbFooTable", {
  billingMode: BillingMode.PROVISIONED,
  deletionProtection: false,
  encryption: TableEncryption.AWS_MANAGED,
  partitionKey: { name: "id", type: AttributeType.STRING },
  pointInTimeRecovery: false,
  removalPolicy: false
    ? RemovalPolicy.RETAIN
    : RemovalPolicy.DESTROY,
  replicationRegions: ["us-west-1"],
  stream: StreamViewType.NEW_AND_OLD_IMAGES,
  tableName: "foo",
});
```

### Environment

```markdown
- OS: OSX 13.4
- LocalStack: latest (70e077bf43491cc0954698c1240159caa9cecc0ac6652b890b52aaf0801d5fcb)
- aws-cdk-lib: 2.90.0
- aws-cdk-local: 2.18.0
```

### Anything else?

Unfortunately, I'm in a position where I need the latest update due to Cognito User Pool domains not being functional in prior releases. I'm trying to get our devs to authenticate locally with an Oauth2 IDP flow instead of forcing them to authenticate with a live-stable environment. More information [here](https://github.com/localstack/localstack/issues/8700).


bug: LAMBDA_DOCKER_FLAGS doesn't work with -e

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Attempting to add environment variables to containers created to service lambda requests no longer works in the latest version of localstack. This works in localStack version 0.12.16

### Expected Behavior

Setting the environment variable `LAMBDA_DOCKER_FLAGS=-e TEST_VAL=True` on localstack's docker container will result in spawned containers created for serving lambda functions having the environment variable TEST_VAL set to True.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

1. Run `docker-compose up -d` with the following docker-compose.yml
```yaml
version: '2.1'

services:
  localstack_ltest:
    container_name: "ltest"
    image: localstack/localstack:0.12.18
    ports:
      - "4566:4566"
    environment:
      - DOCKER_HOST=unix:///var/run/docker.sock
      - LOCALSTACK_API_KEY=<removed>
      - LAMBDA_EXECUTOR=docker-reuse
      - LAMBDA_DOCKER_FLAGS=-e TEST_VAL=True
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    restart: always
```
2. Create the file logs-template.yml
```yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Resources:
  LambdaFunctionLogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      RetentionInDays: 60
      LogGroupName: !Join ["", ["/aws/lambda/", !Ref LambdaFunction]]
  LambdaFunctionRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
        - Effect: Allow
          Principal:
            Service:
            - lambda.amazonaws.com
          Action:
          - sts:AssumeRole
      Path: /
      Policies:
      - PolicyName: LambdaRolePolicy
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action:
              - 'logs:*'
              Resource: 'arn:aws:logs:*:*:*'
  LambdaFunction:
    Type: AWS::Lambda::Function
    Properties:
      FunctionName: "test-function"
      Role: !GetAtt LambdaFunctionRole.Arn
      Handler: index.lambda_handler
      Runtime: python3.8
      Code:
        ZipFile: |
          import os
          def lambda_handler(event, context):
              print("environ: " + str(os.environ))

```
3. Run ` aws cloudformation deploy --stack-name test --template-file .\logs-template.yml --endpoint-url http://127.0.0.1:4566 --region us-east-1`
4. Run `aws --endpoint-url http://127.0.0.1:4566 --region us-east-1 lambda invoke --function-name test-function out.txt`
5. Run `aws --endpoint-url=http://localhost:4566 --region us-east-1 logs tail /aws/lambda/test-function`
6. Check for `"TEST_VAL": "True",`  being in the output of the above command.

### Environment

```markdown
Current configuration (broken)
- OS: Ubuntu 20.04
- LocalStack version: 0.12.18
- LocalStack build date: 2021-09-27
- LocalStack build git hash: 00797f9e

Working configuration
- OS: Ubuntu 20.04
- LocalStack version: 0.12.16
- LocalStack Docker container id: b0137bad2045
- LocalStack build date: 2021-07-31
- LocalStack build git hash: f1262f74
```

### Anything else?

_No response_


status: triage needed
area: configuration

Illegal path is passed into the HEAD request during the object download

# Type of request: This is a ...
[ ] bug report
[ ] feature request

# Detailed description
I have tried to upgrade localstack to 0.11.5(and after) and use the service port 4566.
On local, I got passes to all tests we have been doing.
But on CircleCI, I got errors when download object from s3.

```
An error occurred (404) when calling the HeadObject operation: Not Found
```

It goes through to 0.11.4, so I'm sure it's a bug, but what do you think?
Would you have any advice?

## Expected behavior
My test does as below

1. upload object to s3 bucket named "test-bucket"
1. list v2 for the bucket
1. download it

So, I expected to succeed to this.
Of course, this test has been passed until localstack upgrade.

## Actual behavior
At CircleCI, I got below.
Somehow "/test-bucket/test-bucket" is being passed as a HEAD request parameter at download time.
This path is double of bucket name "/test-bucket".

```
:
2020-10-30 05:47:54,523:API: 172.20.0.5 - - [30/Oct/2020 05:47:54] "PUT /test-bucket HTTP/1.1" 200 -
2020-10-30 05:47:54,536:API: 172.20.0.5 - - [30/Oct/2020 05:47:54] "PUT /test-bucket/loadable/2020/04/06/000000_2_e462a109-916a-4b8f-b393-f5b01a6a8c10 HTTP/1.1" 200 -
2020-10-30 05:47:54,554:API: 172.20.0.5 - - [30/Oct/2020 05:47:54] "GET /test-bucket?list-type=2&max-keys=200&prefix=loadable%2F HTTP/1.1" 200 -
2020-10-30 05:47:54,566:API: 172.20.0.5 - - [30/Oct/2020 05:47:54] "GET /test-bucket/loadable/2020/04/06/000000_2_e462a109-916a-4b8f-b393-f5b01a6a8c10 HTTP/1.1" 206 -
2020-10-30 05:47:54,578:API: 172.20.0.5 - - [30/Oct/2020 05:47:54] "HEAD /test-bucket/test-bucket HTTP/1.1" 404 -
2020-10-30T05:47:54:WARNING:bootstrap.py: Thread run method <function AdaptiveThreadPool.submit.<locals>._run at 0x7f333a234f70>(None) failed: An error occurred (404) when calling the HeadObject operation: Not Found Traceback (most recent call last):
  File "/opt/code/localstack/localstack/utils/bootstrap.py", line 534, in run
    result = self.func(self.params)
  File "/opt/code/localstack/localstack/utils/async_utils.py", line 28, in _run
    return fn(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 560, in handler
    response = modify_and_forward(method=method, path=path_with_params, data_bytes=data, headers=headers,
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 333, in modify_and_forward
    listener_result = listener.forward_request(method=method,
  File "/opt/code/localstack/localstack/services/edge.py", line 81, in forward_request
    return do_forward_request(api, port, method, path, data, headers)
  File "/opt/code/localstack/localstack/services/edge.py", line 86, in do_forward_request
    result = do_forward_request_inmem(api, port, method, path, data, headers)
  File "/opt/code/localstack/localstack/services/edge.py", line 106, in do_forward_request_inmem
    response = modify_and_forward(method=method, path=path, data_bytes=data, headers=headers,
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 401, in modify_and_forward
    updated_response = update_listener.return_response(**kwargs)
  File "/opt/code/localstack/localstack/services/s3/s3_listener.py", line 1254, in return_response
    fix_range_content_type(bucket_name, path, headers, response)
  File "/opt/code/localstack/localstack/services/s3/s3_listener.py", line 465, in fix_range_content_type
    result = s3_client.head_object(Bucket=bucket_name, Key=key_name)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found
```

# Steps to reproduce
## Command used to start LocalStack
sorry...

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)
sorry...

┆Issue is synchronized with this [Jira Task](https://localstack.atlassian.net/browse/LOC-71) by [Unito](https://www.unito.io/learn-more)


Please support Azure OpenAI


Support OPENAI_ API_ BASE for proxy URLs

How to add OPENAI_ API_ BASE code to use other proxy keys？


torch.einsum does not pass equation argument to __torch_function__ API

## 🐛 Bug

when delegating torch.einsum call to an object which implements
`__torch_function__` API the equation argument is not passed resulting in the error.
```TypeError: einsum(): argument 'equation' (position 1) must be str, not Tensor```

this was tested on pytorch 1.5.0

I've actually found the cause of this bug and have written a fix.

the following script illustrates the problem and the proposed solution

## To Reproduce

```python
import torch

class Wrapper():
    def __init__(self,data):
        self.data = data

    def __torch_function__(self, func, types, args=(), kwargs=None):
        if kwargs is None:
            kwargs = {}

        #unwrap inputs if necessary
        def unwrap(v):
            return v.data if isinstance(v,Wrapper) else v
        args = map(unwrap,args)
        kwargs = {k:unwrap(v) for k,v in kwargs.items()}

        return func(*args, **kwargs)

# fixed einsum implementation
from torch import Tensor,_VF
from torch._overrides import has_torch_function,handle_torch_function
def fixed_einsum(equation,*operands):
    if not torch.jit.is_scripting():
        if any(type(t) is not Tensor for t in operands) and has_torch_function(operands):
            # equation is not passed
            # return handle_torch_function(einsum, operands, *operands)
            return handle_torch_function(fixed_einsum, operands, equation,*operands)
    if len(operands) == 1 and isinstance(operands[0], (list, tuple)):
        # the old interface of passing the operands as one list argument
        operands = operands[0]

        # recurse incase operands contains value that has torch function
        #in the original implementation this line is omitted
        return fixed_einsum(equation,*operands)

    return _VF.einsum(equation, operands)

if __name__ == "__main__":
    print(torch.__version__)
    # uncomment to use fixed einsum
    # torch.einsum = fixed_einsum

    #operands are wrapped
    x = Wrapper(torch.randn(5))
    y = Wrapper(torch.randn(4))
    assert torch.allclose(torch.einsum('i,j->ij',x, y),torch.ger(x,y))  # outer product
    print("works with wrapped inputs")

    #old interface operands is a list
    a = Wrapper(torch.randn(2,3))
    b = Wrapper(torch.randn(5,3,7))
    c = Wrapper(torch.randn(2,7))
    assert torch.allclose(torch.einsum('ik,jkl,il->ij', [a, b, c]),torch.nn.functional.bilinear(a,c,b)) # bilinear interpolation
    print("works with old API operands is list")

    #equation is wrapped
    As = Wrapper(torch.randn(3,2,5))
    Bs = Wrapper(torch.randn(3,5,4))
    equation = Wrapper('bij,bjk->bik')
    assert torch.allclose(torch.einsum(equation, As, Bs),torch.matmul(As,Bs)) # batch matrix multiplication
    print("works with equation wrapped")

    #see that it also works with plain tensors
    x = torch.randn(5)
    y = torch.randn(4)
    assert torch.allclose(torch.einsum('i,j->ij',x, y),torch.ger(x,y))
    print("works with no wrapped values")

```

cc @albanD @mruberry


triaged
tracker
oncall: pt2
module: dynamo

14k github models on PyTorch 2.0 pass rates dashboard

We are weekly running dynamo-eager, dynamo-eager-fullgraph, export and inductor on 14k ```nn.Modules``` crawled from 1.4k github projects to get coverage level, find and fix bugs. This dashboard page is used to track the pass rates of different backends.

How to repro:
* Checkout https://github.com/jansel/pytorch-jit-paritybench
* Batch evaluation with different backends:
  * dynamo-eager: ```python main.py --backend eager```
  * dynamo-eager-fullgraph: ```python main.py --backend eager --fullgraph```
  * export: ```python main.py --compile_mode export```
  * inductor: ```python main.py```
* Adhoc evaluation:
  * ```pytest ./generated/{filename}.py -k test_{n}``` (e.g, ```pytest ./generated/test_KunpengLi1994_VSRN.py -k test_002```)
  * ```python -e ./generated/{filename}.py --backend eager```

Bugs umbrella task(#92670)

cc @ezyang @msaroufim @bdhirsh @anijain2305 @zou3519 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng @soumith @wconstab @ngimel @Xia-Weiwen @desertfire @davidberard98


module: windows
module: multiprocessing
triaged
skipped

DISABLED test_fs_sharing (__main__.TestMultiprocessing)

Flaky failures in the last week: https://fburl.com/scuba/opensource_ci_jobs/inmj698k. They only appear to be on windows

Platforms: rocm

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @VitalyFedyunin


Tracer doesn't work with join/wait

Reported error: `RuntimeError: output 0 of traced region did not have observable data dependence with trace inputs; this probably indicates your program cannot be understood by the tracer.`

To reproduce:
```python
def test_async_script_trace(self):
        class Module(torch.jit.ScriptModule):
            def __init__(self):
                super(Module, self).__init__(False)

            @torch.jit.script_method
            def forward(self, x):
                future = torch.jit._fork(torch.neg, x)
                outputs = []
                outputs.append(torch.jit._wait(future))

                return outputs

        class Tuple(nn.Module):
            def __init__(self):
                super(Tuple, self).__init__()
                self.module = Module()

            def forward(self, x):
                return tuple(self.module(x))

        x = torch.rand(3, 4)
        module = torch.jit.trace(Tuple(), (x), _force_outplace=True)
        self.assertEqual(module(x), torch.neg(x))


high priority
module: cudnn
module: nn
triaged
small

Disable nondeterministic CTCLoss from cuDNN

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

1.I i updated pytorch version and ctc，use pytorch_nightly, but in my train ,nn.CTCloss() is still zero,so,i would like to ask if the version pytorch(nightly) has been solved this problem
1.
1.

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```

 - PyTorch Version (e.g., 1.0):
 - OS (e.g., Linux):
 - How you installed PyTorch (`conda`, `pip`, source):
 - Build command you used (if compiling from source):
 - Python version:
 - CUDA/cuDNN version:
 - GPU models and configuration:
 - Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->


permission denied

**Bug description**
I'm running basic G4F code from README:
```
import g4f

response = g4f.ChatCompletion.create(
    model=g4f.models.gpt_4,
    messages=[{"role": "user", "content": "hi"}],
)  # alterative model setting

print(response)
```

Error:
```
Traceback (most recent call last):
  File "C:\Users\IonE\Desktop\main.py", line 3, in <module>
    import g4f
  File "D:\Program Files\Python399\lib\site-packages\g4f\__init__.py", line 1, in <module>
    from . import models
  File "D:\Program Files\Python399\lib\site-packages\g4f\models.py", line 3, in <module>
    from .Provider import Bard, BaseProvider, GetGpt, H2o, Liaobots, Vercel, Equing
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\__init__.py", line 6, in <module>
    from .Bard import Bard
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\Bard.py", line 11, in <module>
    class Bard(AsyncProvider):
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\Bard.py", line 22, in Bard
    cookies: dict = get_cookies(".google.com"),
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\base_provider.py", line 45, in get_cookies
    for cookie in browser_cookie3.load(cookie_domain):
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 1233, in load
    for cookie in cookie_fn(domain_name=domain_name):
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 1160, in chrome
    return Chrome(cookie_file, domain_name, key_file).load()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 489, in load
    with _DatabaseConnetion(self.cookie_file) as con:
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 349, in __enter__
    return self.get_connection()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 383, in get_connection
    con = method()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 374, in __get_connection_legacy
    shutil.copyfile(self.__database_file, self.__temp_cookie_file)
  File "D:\Program Files\Python399\lib\shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\IonE\\AppData\\Roaming\\..\\Local\\Google\\Chrome\\User Data\\Default\\Network\\Cookies'
```

**Environement**
- python 3.9.9
- ukraine


please delete site chat.aivvm.com

**Known Issues** // delete this
please delete site `chat.aivvm.com`

**Delete site description**
Gpt4free maintainers, I am the administrator of chat.aivvm.com and request to delete this site. My website is already under high load

3
用户请求项目删除自己网址


can not run hackingtool !!!!! SyntaxError: invalid syntax ???

# python3 ./hackingtool.py

Traceback (most recent call last):
  File "/root/hackingtool/./hackingtool.py", line 11, in <module>
    from tools.ddos import DDOSTools
  File "/root/hackingtool/tools/ddos.py", line 29
    "sudo", "python3 ddos", method, url, socks_type5.4.1, threads, proxylist, multiple, timer])
                                                    ^
SyntaxError: invalid syntax

__________________________________________________________________________________


Help me please

Traceback (most recent call last):
  File "/usr/share/doc/hackingtool/hackingtool.py", line 11, in <module>
    from tools.ddos import DDOSTools
  File "/usr/share/doc/hackingtool/tools/ddos.py", line 29
    "sudo", "python3 ddos", method, url, socks_type5.4.1, threads, proxylist, multiple, timer])
                                                    ^
SyntaxError: invalid syntax


look


Running Issue

**Describe the bug**
A clear and concise description of what the bug is.

I have installed this tool successfully though when i go to run it with <sudo hackingtool> or <hackingtool> it comes up with the error I have attached as a screenshot. Why would this be happening?

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/13176339/161368818-26bf3219-9ba7-4bab-a451-65d379c6d405.jpeg)

**Desktop (please complete the following information):**
 - OS: Kali
 - Browser [e.g. chrome, safari]
 - Version [e.g. 22]

**Smartphone (please complete the following information):**
 - Device: rpi4
 - OS: [e.g. iOS8.1]
 - Browser [e.g. stock browser, safari]
 - Version [e.g. 22]

**Additional context**
Add any other context about the problem here.


SyntaxError: invalid syntax traceback most recent call last

┌──(root💀localhost)-[~]
└─# hackingtool
Traceback (most recent call last):
  File "/usr/share/doc/hackingtool/hackingtool.py", line 11, in <module>
    from tools.ddos import DDOSTools
  File "/usr/share/doc/hackingtool/tools/ddos.py", line 29
    "sudo", "python3 ddos", method, url, socks_type5.4.1, threads, proxylist, multiple, timer])
                                                    ^
SyntaxError: invalid syntax

this happens when i type in "hackingtool" in terminal. any fixes?


from tools.ddos import DDOSTools

# sudo hackingtool
Traceback (most recent call last):
  File "/usr/share/doc/hackingtool/hackingtool.py", line 11, in <module>
    from tools.ddos import DDOSTools
  File "/usr/share/doc/hackingtool/tools/ddos.py", line 29
    "sudo", "python3 ddos", method, url, socks_type5.4.1, threads, proxylist, multiple, timer])
                                                    ^
SyntaxError: invalid syntax


Matthews correlation coefficient metric throws misleading division by zero RuntimeWarning

#### Description
With tested values all equal, `sklearn.metrics.matthews_corrcoef` throws a `RuntimeWarning` reporting a division by zero. This behavior was already reported in #1937 and reported fixed, but reappears in recent versions.

#### Steps/Code to Reproduce
The snippet below reproduces the warning.
```python
import sklearn.metrics
trues = [1,0,1,1,0]
preds = [0,0,0,0,0]
sklearn.metrics.matthews_corrcoef(trues, preds)
```

#### Expected Results
No warning is thrown.

#### Actual Results
The following warning is thrown:
```
C:\anaconda\envs\sklearn-test\lib\site-packages\sklearn\metrics\_classification.py:900: RuntimeWarning: invalid value encountered in double_scalars
  mcc = cov_ytyp / np.sqrt(cov_ytyt * cov_ypyp)
```

#### Versions
```
System:
    python: 3.8.2 (default, Mar 25 2020, 08:56:29) [MSC v.1916 64 bit (AMD64)]
executable: C:\anaconda\envs\sklearn-test\python.exe
   machine: Windows-10-10.0.18362-SP0

Python dependencies:
       pip: 20.0.2
setuptools: 46.1.3.post20200330
   sklearn: 0.22.1
     numpy: 1.18.1
     scipy: 1.4.1
    Cython: None
    pandas: None
matplotlib: None
    joblib: 0.14.1
```


LatentDirichletAllocation has superfluous attributes

It has `dirichlet_component_` (undocumented) and `exp_dirichlet_component_` (exponential of same). I propose to get rid of at least the latter.


Sparse cumsum functions do not work

e.g. SparseSeries.cumsum


to_datetime should support ISO week year

`to_datetime` does not currently seem to support `ISO week year` like `strptime` does:

```
In [38]: datetime.date(2016, 1, 1).strftime('%G-%V')
Out[38]: '2015-53'

In [39]: datetime.datetime.strptime(datetime.date(2016, 1, 1).strftime('%G-%V')+'-1', '%G-%V-%u')
Out[39]: datetime.datetime(2015, 12, 28, 0, 0)

In [41]: pd.to_datetime(datetime.date(2016, 1, 1).strftime('%G-%V')+'-1', format='%G-%V-%u')
        ---------------------------------------------------------------------------
        TypeError                                 Traceback (most recent call last)
        /Users/Robin/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in _convert_listlike(arg, box, format, name, tz)
            443             try:
        --> 444                 values, tz = tslib.datetime_to_datetime64(arg)
            445                 return DatetimeIndex._simple_new(values, name=name, tz=tz)

        pandas/_libs/tslib.pyx in pandas._libs.tslib.datetime_to_datetime64 (pandas/_libs/tslib.c:33275)()

        TypeError: Unrecognized value type: <class 'str'>

        During handling of the above exception, another exception occurred:

        ValueError                                Traceback (most recent call last)
        <ipython-input-41-7ce30c959690> in <module>()
        ----> 1 pd.to_datetime(datetime.date(2016, 1, 1).strftime('%G-%V')+'-1', format='%G-%V-%u')

        /Users/Robin/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in to_datetime(arg, errors, dayfirst, yearfirst, utc, box, format, exact, unit, infer_datetime_format, origin)
            516         result = _convert_listlike(arg, box, format)
            517     else:
        --> 518         result = _convert_listlike(np.array([arg]), box, format)[0]
            519
            520     return result

        /Users/Robin/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in _convert_listlike(arg, box, format, name, tz)
            445                 return DatetimeIndex._simple_new(values, name=name, tz=tz)
            446             except (ValueError, TypeError):
        --> 447                 raise e
            448
            449     if arg is None:

        /Users/Robin/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in _convert_listlike(arg, box, format, name, tz)
            412                     try:
            413                         result = tslib.array_strptime(arg, format, exact=exact,
        --> 414                                                       errors=errors)
            415                     except tslib.OutOfBoundsDatetime:
            416                         if errors == 'raise':

        pandas/_libs/tslib.pyx in pandas._libs.tslib.array_strptime (pandas/_libs/tslib.c:63124)()

        pandas/_libs/tslib.pyx in pandas._libs.tslib.array_strptime (pandas/_libs/tslib.c:63003)()

        ValueError: 'G' is a bad directive in format '%G-%V-%u'

```

<details>
INSTALLED VERSIONS
------------------
commit: None

pandas: 0.20.1
pytest: 3.1.0
pip: 9.0.1
setuptools: 28.8.0
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 6.0.0
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: 1.1.10
pymysql: None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
</details>


send_file doesn't urlencode ':/' in unicode attachment_filename

### Expected Behavior

When sending files with unicode filename (with `:` or `/`) they should be downloaded with name from `filename*` field.

```python
# -*- coding: utf-8 -*-
import os
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/test/', methods=['GET'])
def test_route():
    tmp_dir = os.getcwd()
    tmp_filename = __file__
    attachment_filename = u'тест:тест_тест.py'
    return send_from_directory(
        tmp_dir,
        tmp_filename,
        as_attachment=True,
        attachment_filename=attachment_filename
    )
if __name__ == '__main__':
    app.run(host='::', port=5000)
```
### Actual Behavior

Some browsers (Chrome-based/Safari) ignore `filename*` field when it contains colon or slash. For example file `тест:тест_тест.py` gets downloaded in Chrome/Safari as `__.py` but in Firefox as `тест_тест_тест.py` which is acceptable in my opinion.

Flask response:
`Content-Disposition: attachment; filename*="UTF-8''%D1%82%D0%B5%D1%81%D1%82:%D1%82%D0%B5%D1%81%D1%82_%D1%82%D0%B5%D1%81%D1%82.py"; filename=":_.py"`

### Environment

* Python version: 2.7.15
* Flask version: 1.0.2
* Werkzeug version: 0.14.1


Harmless race condition in tutorial

I was browsing the flaskr tutorial when I noticed an (admittedly quite unlikely) race condition in the `register` view, specifically:

```py
if not username:
    error = 'Username is required.'
elif not password:
    error = 'Password is required.'
elif db.execute(
    'SELECT id FROM user WHERE username = ?', (username,)
).fetchone() is not None:
    error = f"User {username} is already registered."

if error is None:
    db.execute(
        'INSERT INTO user (username, password) VALUES (?, ?)',
        (username, generate_password_hash(password))
    )
    db.commit()
    return redirect(url_for('auth.login'))
```

If two requests arrive with the right timing, the following can happen:

```
   Request 1:                                Request 2:
SELECT id
  FROM user
 WHERE username = abc
     |
     v
empty, no such user

                                          SELECT id
                                            FROM user
                                           WHERE username = abc
                                               |
                                               v
                                          empty, no such user

INSERT INTO user (username, password)
     VALUES (abc, 123)
     |
     v
    ok

                                          INSERT INTO user (username, password)
                                               VALUES (abc, 456)
                                               |
                                               v
                                          failed UNIQUE constraint ->
                                          -> sqlite3.IntegrityError ->
                                          -> user gets HTTP 500
```

While the likelihood of this happening is pretty small and the harm practically zero (user gets HTTP 500 and has to manually login/choose a different username), I feel like this is not really the sort of good practice the tutorial should teach. I also believe it's important the developer understands that it's the UNIQUE constraint that ensures their app works correctly and not the if condition in the application code (the tutorial mentions SQL injection attacks and explains what protects the developer against them, so I don't really feel this is out of scope).

In my own app I've modified the code to the following:
```py
if not username:
    error = 'Username is required.'
elif not password:
    error = 'Password is required.'
else:
    try:
        db.execute(
            'INSERT INTO users (username, password) VALUES (?, ?)',
            (username, generate_password_hash(password))
        )
        db.commit()
    except IntegrityError:
        error = f"User {username} is already registered."
    else:
        return redirect(url_for('auth.login'))
```

I suggest something similar be incorporated into the tutorial, with a short explanation (maybe a comment) of how the UNIQUE constraint does the work for the developer and maybe a note about the principle that one should "ask forgiveness, not permission." I'm not sure on how it's better worded, so I'm making this an issue instead of a pull request.

Cheers, and thank you for your great work!


json_encoder not invoked from flask.jsonify

I created a custom JSON encoder class extended from flask.json.JSONEncoder but it is not called when calling flask.jsonify. Additionally, I removed my custom JSON encoder and confirmed that  flask.json.JSONEncoder isn't called either via a break statement in Pycharm.

```
from flask import Flask
from flask import jsonify
from flask.json import JSONEncoder

class MyEncoder(JSONEncoder):
    def default(self, obj):
        if hasattr(obj, '__json__'):
            return obj.__json__()
        else:
            try:
                iterable = iter(obj)
            except TypeError:
                pass
            else:
                return list(iterable)

        return JSONEncoder.default(self, obj)

class MyClass(object):
    key = 'a'
    value = 'b'

    def __json__(self):
        return {'key': self.key, 'value': self.value}

app = Flask(__name__)
app.json_encoder = MyEncoder

@app.route('/')
def hello_world():
    return jsonify(MyClass())

if __name__ == '__main__':
    app.run(debug=True)
```


Flask 1.0 backwards-incompat with double-slash/no-slash re. #2629

This is a major backwards-compat breaking change, but I suspect not the intended design and hopefully easy to fix.

The issue is related to PR #2629, and this example follows from that:

Given blueprint `bp` and app `app`:

```python
@bp.route('b/')
def tmp():
    return "URI should be '/a/b/"

app.register_blueprint(bp, url_prefix='/a/')
```

In Flask 0.12 the URL is correctly `/a/b`, but in Flask 1.0 it's `/ab`.

Since issue #2629 relates to resolve double-slashes, I imagine this is a bug (and not a design decision) - and the correct solution would be to remove a slash only when there are two.


add ssl_context option to `flask run`

### Expected Behaviour

I expect to be able to pass the `flask run` command any of the options which are valid for the `Flask.run()` method:

```sh
$ FLASK_APP=myapp/run.py FLASK_DEBUG=1 flask run --host=0.0.0.0 --ssl_context=adhoc
* Running on https://0.0.0.0:5000/ (Press CTRL+C to quit)
```

Specifically, I want to pass `ssl_context=adhoc`, but it seems sensible to extend the command to accept all valid keyword arguments for `Flask.run()` / `werkzeug.serving.run_simple()`.

### Actual Behaviour
```
Error: no such option: --ssl_context
flask run --host=0.0.0.0 --ssl_context=adhoc exited with code 2
```

### Environment

* Python version: 3.5.2
* Flask version: 0.12.2
* Werkzeug version: 0.12.2


Blueprint template lookup not documented enough

The new blueprint template lookup scheme where the templates folder is just added to the searchpath instead of doing some weird stuff with the names as before. The documentation has to be clearer about that.


config.from_pyfile crashes on Python 3 when source isn't encoded in default encoding

when I read my instance config file, I get an error.

> exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
> UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 437: illegal multibyte sequence
Then I modify the code of config.from_pyfile to this

> with open(filename, 'rb') as config_file:
The problem is resolved.


How should logging in Flask look like?

Flask started to ship with a default, hardcoded logging handler. Unfortunately this setup makes it harder to install custom logging setups, because then you'll have to undo all the things Flask did to the app logger, or replace the `app.logger` entirely. A symptom of this is #1993, where Flask's own logger had to be tweaked yet again such that messages didn't get logged twice (once via Flask's setup, once via the custom one).

My question is: **Do we even want Flask to do any logging setup?** It appears that this sort of default logging is only useful during development, so maybe it makes sense to set up a default logging handler in the new Flask CLI instead of from within the application.


DispatcherMiddleware with different loggers per app in flask 1.0

After upgrading to flask 1.0 logging from different apps using DispatcherMiddleware, each log emitted is written to all handlers in the different apps. I assume this caused by `app.logger` always having the name `flask.app`, maybe?

Here is a example:

```
from werkzeug.wsgi import DispatcherMiddleware
from flask import Flask
from logging.handlers import RotatingFileHandler

handler1 = RotatingFileHandler('app1.log')
app1 = Flask('app1')
app1.logger.addHandler(handler1)

handler2 = RotatingFileHandler('app2.log')
app2 = Flask('app2')
app2.logger.addHandler(handler2)

@app1.route("/")
def hello():
    app1.logger.error("from app1")
    return ''

@app2.route("/")
def hello2():
    app2.logger.error("from app2")
    return ''

app = DispatcherMiddleware(app1, {
    '/app2': app2
})
```

Run with
```
uwsgi --socket 0.0.0.0:8000 --protocol=http -w app --callable app
```

And then make a request to / and /app2/. Each error log will be written in both logfiles.

### Environment

* Python version: 3.6.5
* Flask version: 1.0.2
* Werkzeug version: 0.14.1

My actual app is using `current_app.logger` with blueprints with the same behaviour, but I assume it the same issue.


Switch to importlib breaks scripts with `app.run()`

With a trivial script [using `app.run()`](https://flask.palletsprojects.com/en/2.3.x/server/#in-code) such as:

```python3
from flask import Flask

app = Flask(__name__)

if __name__ == "__main__":
    app.run(debug=True)
```

The current git `main` breaks with:

```pytb
Traceback (most recent call last):
  File "/home/florian/tmp/flask/app.py", line 3, in <module>
    app = Flask(__name__)
          ^^^^^^^^^^^^^^^
  File "/home/florian/tmp/flask/src/flask/app.py", line 376, in __init__
    instance_path = self.auto_find_instance_path()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/flask/src/flask/app.py", line 630, in auto_find_instance_path
    prefix, package_path = find_package(self.import_name)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/flask/src/flask/scaffold.py", line 898, in find_package
    package_path = _find_package_path(import_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/flask/src/flask/scaffold.py", line 858, in _find_package_path
    spec = importlib.util.find_spec(root_mod_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 114, in find_spec
ValueError: __main__.__spec__ is None
```

This seems to be a regression due to 84e11a1e827c0f55f9b9ee15952eddcf8a6492e0 from #5157.

Environment:

- Python version: 3.11.4
- Flask version: git main


linkedin false positive


Optional csv Result Output

While the text output file is good to have, it only shows the sites that do have an account with the username. It would be useful to also have a list of the sites that still had an opening.

I think that it would be useful to have a csv output as well.  It could be optional, so the user would have to add a `--csv` switch before the file would be output.  Then the output would be available in LibreOffice or Excel for users to sort and organize as they wish.

I am thinking of the following columns:

- Username
The user name that is being queried.
- Social Network Name
For example, "Twitter", "GitHub", ...
- Social Network Main URL
For example, "https://twitter.com/" for Twitter
- Social Network User URL
This is the URL that Sherlock would be trying to check the existence of.  For example, "https://twitter.com/user123" for Twitter.
- Username Exists
Will be either "True" or "False".
- Request Response Data
I think that this would be useful for debug of the program. Especially for those sites where Sherlock depends on the response text (as opposed to an explicit HTTP response code).


Add search "kali community"

```
  "kali community": {
    "errorType": "status_code",
    "rank": 10313,
    "url": "https://forums.kali.org/member.php?username={}",
    "urlMain": "https://forums.kali.org/",
    "username_claimed": "blue",
    "username_unclaimed": "noonewouldeverusethis7"
  },
```


[ISSUE] Sherlock stops after Countable search

- [X] I'm reporting a bug in Sherlock's functionality
- [X] The bug I'm reporting is not a false positive or a false negative
- [X] I've verified that I'm running the latest version of Sherlock
- [X] I've checked for similar bug reports including closed ones
- [X] I've checked for pull requests that attempt to fix this bug

## Description
Upon running `python3 sherlock username`, the checks stop right after a return on Countable. (See screenshot below)
As I am unsure of if this is a social media downtime issue, I am consulting here.
<img width="401" alt="Screen_Shot_2022-04-16_at_11 00 42_PM" src="https://user-images.githubusercontent.com/60671860/163698401-dd7c35e0-b6ec-468c-9b9d-6ac29806065c.png">

Suggested fix:
Improve 404 messages and insert timeouts if sites are not reachable within a few seconds.


Codepen False Negative/Trip False Positive


Formatting on windows Powershell very off

[+] Unsplash: https://unsplash.com/@User
[*] Saved: User.txt

That's how all the lines look like in windows powershell. I guess the print is designed for a linux platform?


Error Connecting for most websites (Failed to establish a new connection: [Errno -2] Name or service not known' in urllib3

I believe this might be a partial duplicate of #230, however, because of lack of information and error output I made my own issue just to be safe.

With the latest python3.7.3 and the correct requirements I constantly run into the issue of websites not connecting.
Specifically this happens after trying to connect to Bandcamp, subsequently, all other urls following bandcamp fail as well.

I printed the `requests.exceptions.ConnectionError` at line 128 as well as the future object class.
For some reason, urllib3 seems to fail finding the name or service (so this might be a DNS issue?).

Further details below (snippet from e.g. YouTube):

```
[-] Error Connecting: YouTube
[-] YouTube: Error!
{'errorType': 'response_url', 'errorUrl': 'https://www.zhihu.com/people/{}', 'rank': 0, 'url': 'https://www.zhihu.com/people/{}', 'urlMain': 'https://www.zhihu.com/', 'username_claimed': 'blue', 'username_unclaimed': 'noonewouldeverusethis7', 'request_future': <Future at 0x7f318072ce80 state=finished raised ConnectionError>}
<Future at 0x7f318072ce80 state=finished raised ConnectionError>
HTTPSConnectionPool(host='www.zhihu.com', port=443): Max retries exceeded with url: /people/berghopper (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f318070c2e8>: Failed to establish a new connection: [Errno -2] Name or service not known'))
<Future at 0x7f318072ce80 state=finished raised ConnectionError>
```


The vocabulary_size method of preprocessing layers does not work in graph mode

**System information**.
- Have I written custom code (as opposed to using a stock example script provided in Keras): **yes**
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): **Colab**
- TensorFlow installed from (source or binary): **binary**
- TensorFlow version (use command below): **TF 2.8, nightly 2.10.0-dev20220422**

**Describe the problem**.

Using the `vocabulary_size()` method of preprocessing layers (like `tf.keras.layers.StringLookup`) fails in graph mode, because the implementation looks like this: https://github.com/keras-team/keras/blob/aea9728313bcaa8262774699c21976288171b209/keras/layers/preprocessing/index_lookup.py#L346-L352

**Describe the current behavior**.

Calling `vocabulary_size()` in graph mode fails.

**Describe the expected behavior**.

Calling `vocabulary_size()` in graph mode succeeds and returns a `tf.Tensor` with the size.

**Standalone code to reproduce the issue**.

Colab notebook showing the issue is at https://colab.research.google.com/drive/1Mq9G8eUvNLw6ykk4ARKf6jurLREAvRhu?usp=sharing both for TF 2.8 and TF nightly.

**Source code / logs**.

An obvious fix is to avoid using the `numpy()` method when in graph mode, i.e., instead of
```python
return int(self.lookup_table.size().numpy()) + self._token_start_index()
```
use just
```python
return self.lookup_table.size() + self._token_start_index()
```
Note that the above notebook also shows that this implementation works in the graph mode.


Tensorflow BackupAndRestore method does not work

I copied the [example code here](https://keras.io/api/callbacks/backup_and_restore/) and it raises a ValueError with Python 3.11 and Tensorflow 2.17:
```
import keras
import numpy as np

class InterruptingCallback(keras.callbacks.Callback):
   def on_epoch_begin(self, epoch, logs=None):
     if epoch == 4:
       raise RuntimeError('Interrupting!')
callback = keras.callbacks.BackupAndRestore(backup_dir="/tmp/backup")
model = keras.models.Sequential([keras.layers.Dense(10)])
model.compile(keras.optimizers.SGD(), loss='mse')
try:
   model.fit(np.arange(100).reshape(5, 20), np.zeros(5), epochs=10,
             batch_size=1, callbacks=[callback, InterruptingCallback()],
             verbose=0)
except Exception as e:
   print(e)
history = model.fit(np.arange(100).reshape(5, 20), np.zeros(5),
                     epochs=10, batch_size=1, callbacks=[callback],
                     verbose=0)
len(history.history['loss'])

ValueError: To use the BackupAndRestore method, your model must be built before you call `fit()`. Model is unbuilt. You can build it beforehand by calling it on a batch of data.
```

Doesn't that defeat the purpose of backupAndRestore?


vgg16 predictions: class probabilities change significantly in 2.0.9

Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on [StackOverflow](http://stackoverflow.com/questions/tagged/keras) or [join the Keras Slack channel](https://keras-slack-autojoin.herokuapp.com/) and ask there instead of filing a GitHub issue.

Thank you!

- [x] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps

- [x] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found [here](https://www.tensorflow.org/get_started/os_setup).

- [x] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps

- [x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).

I've noticed when updating to Keras 2.0.9 that the class probabilities for predictions on the "creative_commons_elephant.jpg" image used in tutorials change significantly (i.e. African_elephant goes from `0.909` to `0.789`).

Here is my script:

```python
from keras.applications.vgg16 import VGG16
model = VGG16(weights='imagenet')

from keras.preprocessing import image
from keras.applications.vgg16 import preprocess_input, decode_predictions
import numpy as np

img_path = 'creative_commons_elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

preds = model.predict(x)
print('Predicted:', decode_predictions(preds, top=3)[0])
```

Under Keras 2.0.8 this gives:

```
('Predicted:', [(u'n02504458', u'African_elephant', 0.90942073), (u'n01871265', u'tusker', 0.086183183), (u'n02504013', u'Indian_elephant', 0.0043545808)])
```

However under Keras 2.0.9 it gives:

```
('Predicted:', [(u'n02504458', u'African_elephant', 0.78988522), (u'n01871265', u'tusker', 0.1987267), (u'n02504013', u'Indian_elephant', 0.011142471)])
```


Error with multiprocessing on Sequence in fit_generator()

I'm trying to use a `Sequence` as the generator for `model.fit_generator()`.

With `use_multiprocessing=False` it works fine, but with `use_multiprocessing=True` an error is produced.

**Minimal working example:**
```python
from keras.utils import Sequence
from keras.models import Sequential
from keras.layers import Dense
from keras.utils import to_categorical
import numpy as np

class DummySequence(Sequence):

    def __init__(self, x_set, y_set, batch_size):
        self.x, self.y = x_set, y_set
        self.batch_size = batch_size

    def __len__(self):
        return int(np.ceil(len(self.x) / float(self.batch_size)))

    def __getitem__(self, idx):
        batch_x = self.x[idx * self.batch_size:(idx + 1) * self.batch_size]
        batch_y = self.y[idx * self.batch_size:(idx + 1) * self.batch_size]

        return np.array(batch_x), np.array(batch_y)

if __name__ == '__main__':

    x = np.random.random((100, 3))
    y = to_categorical(np.random.random(100) > .5).astype(int)

    seq = DummySequence(x, y, 10)

    model = Sequential()
    model.add(Dense(32, input_dim=3))
    model.add(Dense(2, activation='softmax'))
    model.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

    model.fit_generator(generator=seq, workers=2, use_multiprocessing=True)
```
**Error:**
```
Traceback (most recent call last):
  File "C:\Users\elcombato\AppData\Local\Continuum\Anaconda3\envs\ml\lib\multiprocessing\pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\elcombato\AppData\Local\Continuum\Anaconda3\envs\ml\lib\site-packages\keras\utils\data_utils.py", line 392, in get_index
    return _SHARED_SEQUENCES[uid][i]
KeyError: 0
```

**Setup**
Windows 10
Python 3.6.4
Keras 2.1.3
Tensorflow 1.2.1


type:docs
stat:awaiting response from contributor

kl divergence outputs confusing result when the label contains negative

Here are some APIs implemented for kl divergence:
```
tf.losses.kullback_leibler_divergence
tf.keras.losses.KLDivergence
tf.keras.metrics.kl_divergence
```
However, when the `y_true` or `y_pred` is negative, these APIs output incorrect result which is inconsistent with the documentation (https://www.tensorflow.org/api_docs/python/tf/keras/losses/KLDivergence).

Here is the code to reproduce:
```
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['CUDA_VISIBLE_DEVICES'] = ''
import numpy as np
np.random.seed(35)
import tensorflow as tf
y_true = tf.constant(np.random.randn(1), dtype='float32')
y_pred = tf.constant(np.random.randn(1), dtype='float32')
print(y_true, y_pred)
out1 = tf.losses.kullback_leibler_divergence(y_true,y_pred)
out2 = tf.keras.losses.KLDivergence(
    reduction='sum_over_batch_size', name='kl_divergence'
)(y_true, y_pred)
out3 = tf.keras.metrics.kl_divergence(y_true, y_pred)
print(out1, out2, out3)  # 0.0, 0.0, 0.0
print(f"Expected result: {y_true*(np.log(y_true/y_pred))}")  # Expected result following the equation: [-2.8711002]
```

I notice that the current code will silently clip the negative value close to zero:
https://github.com/keras-team/keras/blob/61bbff593a0914f5a2c426c14caadb7372f56da0/keras/losses/losses.py#L1466-L1467

If negative value is not allowed for these concerned APIs, maybe some descriptions on the documentation or validation check inside the source code can provide more information.


Nasnet weight errors (no_top version)

I"m running into this error:

    ValueError: You are trying to load a weight file containing 532 layers into a model with 526 layers.

My keras version is:

`>>> keras.__version__
    '2.2.4'`

`Tensorflow version:

    '1.12.0'`

Bascially, when the model tries to load I get this value error
    ` ValueError: You are trying to load a weight file containing 532 layers into a model with 526 layers. `

I"ve looked at this thread:

https://github.com/keras-team/keras/issues/10109

However, I"m trying to run the `no_top version`, so It shouldn't matter what my input vector is.

base_model(weights='imagenet', include_top=False)

Thank you.

Here is the script Im using:

       ################IMPORTS########################

    #--Keras imports--#

    from keras.applications import resnet50, xception,inception_v3,inception_resnet_v2, densenet, nasnet, imagenet_utils
    from keras.preprocessing import image
    from keras.preprocessing.image import ImageDataGenerator
    from keras.layers import Input, Dense
    from keras import backend as k
    from keras.models import Model, clone_model
    from keras.layers import Dense, GlobalAveragePooling2D,Dropout, BatchNormalization
    from keras import optimizers
    from keras.optimizers import Adam
    from keras.callbacks import ModelCheckpoint,ProgbarLogger
    from keras.utils import print_summary
    from keras import __version__
    from keras.datasets import cifar10

    #--python imports--#
    import os
    import numpy as np
    import datetime
    import h5py
    import json
    import time

    ################# -- PARAMETERS -- ##################################

    img_width, img_height = 480, 480
    (x_train, y_train), _ = cifar10.load_data()
    classes = len(y_train[0])

    ##------initial training parameters -----##

    i_epochs = 10
    i_batch_size = 20
    i_steps_per_epoch = 100
    i_optimizer = optimizers.SGD(lr=0.0001, momentum=0.9)

    #################### MODELS ######################################

    def basemodel():

        base_model = nasnet.NASNetLarge(weights='imagenet', include_top=False)
        preprocess = nasnet.preprocess_input
        return base_model, preprocess

    def full_model():
        base_model, preprocess = basemodel()
        x = base_model.output
        x = GlobalAveragePooling2D()(x)
        x = Dense(2048, activation='relu')(x)
        x = Dropout(.60)(x)
        x=  Dense(512, activation='relu')(x)
        predictions = Dense(classes, activation='softmax')(x)
        model = Model(inputs= base_model.input, outputs=predictions)
        return model,preprocess

    def initial_training_full():
        model, preprocess = full_model()
        for layer in model.layers[:-5]:
            layer.trainable = False

        model.compile(optimizer= i_optimizer,
                  loss='sparse_categorical_crossentropy', metrics = ['accuracy'])

        print('Starting model training')

        history = model.fit(x_train, y_train,
        steps_per_epoch = i_steps_per_epoch,
        epochs = i_epochs,
        shuffle= True,
        verbose = 1)
        return history

    if __name__ == "__main__":
        initial_training_full()


Performance Using HDF5 File vs In-Memory Dataset

I am trying out using the HDF5 file as the format of training/testing data, so that I can avoid the problem of big dataset which cannot fit into the memory.

As a test, I used a dataset with about 20 million rows and 10 columns as my input, and my response variable is a real-valued vector. The model is a simple sequential model with 2 hidden layers and 50 neurons per hidden layer, and the training batch size is 10000. I am still using Keras version 1.2.0.

When the dataset is fully loaded into the memory, one epoch of training takes about 30 seconds. However, if I used HDF5 matrix with HDF5Matrix, one epoch of training takes about 360 seconds. Is this huge slow down common due to the I/O bottleneck? Shall I implement some perhaps better data loading process with fit_generator by myself by considering the specifications of my dataset?


fit_generator crashes though keras.utils.data_utils.Sequence was used

When `model.fit_generator` is used with `workers=0` and subclasses of [`keras.utils.data_utils.Sequence`](https://keras.io/utils/#sequence) for both training and validation data, API of `Sequence` is not recognized inside `evaluate_generator`, it raises:
```python
  File ".../keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File ".../keras/engine/training.py", line 1415, in fit_generator
    initial_epoch=initial_epoch)
  File ".../keras/engine/training_generator.py", line 230, in fit_generator
    validation_steps,
  File ".../keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File ".../keras/engine/training.py", line 1469, in evaluate_generator
    verbose=verbose)
  File ".../keras/engine/training_generator.py", line 298, in evaluate_generator
    else:
ValueError: `steps=None` is only valid for a generator based on the `keras.utils.Sequence` class. Please specify `steps` or use the `keras.utils.Sequence` class.
```
Example code:
```python
from keras import Sequential
from keras.layers import Dense
from keras.utils.data_utils import Sequence
import numpy as np

class Dataset(Sequence):
    def __getitem__(self, index):
        return np.random.uniform(size=(16, 8)), np.random.uniform(size=(16, 1))
    def __len__(self):
        return 128

model = Sequential([Dense(4, activation='relu', input_shape=(8,)),
                    Dense(1, activation='sigmoid')])
model.compile(loss='mse', optimizer='adam')
model.fit_generator(generator=Dataset(), validation_data=Dataset(),
                    workers=0)
```

Issue can be fixed [here](https://github.com/keras-team/keras/blob/7205d903fbc079bb99fbae0e3c02e6d2b4d227f0/keras/engine/training_generator.py#L124) by replacing:

```python
if isinstance(val_data, Sequence):
    val_enqueuer_gen = iter(val_data)
```
with
```python
if isinstance(val_data, Sequence):
    val_enqueuer_gen = iter(val_data)
    validation_steps = len(val_data)
```


clipnorm doesn't work with Embedding

I'm getting a Traceback every time "clipnorm" is used in NN with Embedding layer.
Here is a simple script where the problem is obvious:

``` python
import numpy as np
from keras.layers import Input, Embedding
from keras.optimizers import Adam
from keras.models import Model

input_layer = Input(shape = (1,) )

embedding = Embedding(input_dim = 1,
                      output_dim = 1)(input_layer)

model = Model(input = input_layer, output = embedding)

model.compile(optimizer = Adam(clipnorm = 1.0), loss = 'mse')

X = np.array([[1]])
Y = np.array([[[0.5]]])
model.fit(X, Y, nb_epoch = 1)
```

Failure:

``` shell
I tensorflow/core/common_runtime/gpu/gpu_device.cc:867] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:01:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:867] Creating TensorFlow device (/gpu:1) -> (device: 1, name: GeForce GTX TITAN X, pci bus id: 0000:02:00.0)
Traceback (most recent call last):
  File "./clipnorm-bug.py", line 20, in <module>
    model.fit(X, Y, nb_epoch = 1)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/training.py", line 1079, in fit
    self._make_train_function()
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/training.py", line 696, in _make_train_function
    self.total_loss)
  File "/usr/local/lib/python3.5/dist-packages/keras/optimizers.py", line 379, in get_updates
    grads = self.get_gradients(loss, params)
  File "/usr/local/lib/python3.5/dist-packages/keras/optimizers.py", line 71, in get_gradients
    grads = [clip_norm(g, self.clipnorm, norm) for g in grads]
  File "/usr/local/lib/python3.5/dist-packages/keras/optimizers.py", line 71, in <listcomp>
    grads = [clip_norm(g, self.clipnorm, norm) for g in grads]
  File "/usr/local/lib/python3.5/dist-packages/keras/optimizers.py", line 9, in clip_norm
    g = K.switch(n >= c, g * c / n, g)
TypeError: unsupported operand type(s) for *: 'IndexedSlices' and 'float'
```

Keras version is 1.1.0, TensorFlow is 0.10rc

clipvalue on the other hand works fine.


PReLU should be channelwise

```

from keras.models import Sequential
from keras.layers.advanced_activations import PReLU
from keras.layers import Convolution2D, MaxPooling2D

model = Sequential()
model.add(Convolution2D(32, 5, 5, input_shape=(28,28,1)))
model.add(PReLU())

model.summary()
```

This script produces the PReLU layer with 18432 parameters. If the PReLU was implemented according to the paper (https://arxiv.org/abs/1502.01852), number of parameters would be 32. Shouldn't this not be implemented that way? It adds an unnecessarily large number of parameters to the model.


Args are lost with git_push

From the README:

> `git_push` – adds `--set-upstream origin $branch` to previous failed `git push`;

This isn't actually the case, `--set-upstream` isn't added to the previous push, the entire command is replaced with just `git push --set-upstream origin $branch` regardless of whether there were any args.

Example:

```
$ git push --quiet
fatal: The current branch new-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-branch

$ fuck
git push --set-upstream origin new-branch [enter/↑/↓/ctrl+c]
```

The `--quiet` arg is lost, ideally `git push --set-upstream origin new-branch --quiet` would be suggested.


Cannot run fuck in zsh without export errors

Installed via pip. Ran eval "$(thefuck --alias)" in both bash and zsh. $ fuck then produces 'No fucks given' in bash while in zsh it complains about invalid arguments.
```
$ eval "$(thefuck --alias)"
$ fuck
fuck:export:3: not valid in this context: -'
fuck:3: not an identifier: [skip
```

Also FWIW:
```
$ zsh --version
zsh 4.3.11 (x86_64-redhat-linux-gnu)
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
```


alias produces invalid code for fish as of 3.24

As of 3.24 the output from `thefuck --alias` is incompatible with fish

**Output from 3.24**
```
$ thefuck --alias

            function fuck () {
                TF_PYTHONIOENCODING=$PYTHONIOENCODING;
                export TF_ALIAS=fuck;
                export TF_SHELL_ALIASES=$(alias);
                export TF_HISTORY=$(fc -ln -10);
                export PYTHONIOENCODING=utf-8;
                TF_CMD=$(
                    thefuck THEFUCK_ARGUMENT_PLACEHOLDER $@
                ) && eval $TF_CMD;
                unset TF_HISTORY;
                export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
                history -s $TF_CMD;
            }

$ thefuck --version
The Fuck 3.24 using Python 3.5.2
```

**Output from 3.23**
```
$ thefuck --alias
function fuck -d "Correct your previous console command"
  set -l fucked_up_command $history[1]
  env TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command | read -l unfucked_command
  if [ "$unfucked_command" != "" ]
    eval $unfucked_command
    builtin history delete --exact --case-sensitive -- $fucked_up_command
    builtin history merge ^ /dev/null
  end
end

$ thefuck --version
The Fuck 3.23 using Python 3.5.2
```

**Fish version output**
```
$ fish --version
fish, version 2.6.0
```


git push to branch not of same name: use git's suggestion

I checked out a branch with a different name than the remote counterpart:

```
$ git checkout -b local-branch myupstream/remote-branch
```

When I attempted to push my changes upstream, I got the following error:
```
$ git push -f
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push myupstream HEAD:remote-branch

To push to the branch of the same name on the remote, use

    git push myupstream local-branch
```

However, thefuck didn't use this information to provide a suggestion:
```
$ fuck
git push -d [enter/↑/↓/ctrl+c]
```


werid behavior

python 2.7.10
windows powershell

when I type:

``` bash
> git comit -am 'test'
> fuck
```

it gives me something that is completely weird:

```
C:\Python27\lib\site-packages\win_unicode_console\__init__.py:27: RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == None, readline hook consumer may assume they are the same
  readline_hook.enable(use_pyreadline=use_pyreadline)
git commit -am 'test' [enter/↑/↓/ctrl+c]
```

and then give an exception:

```
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\thefuck.exe\__main__.py", line 9, in <module>
  File "C:\Python27\lib\site-packages\thefuck\main.py", line 80, in main
    fix_command()
  File "C:\Python27\lib\site-packages\thefuck\main.py", line 32, in fix_command
    selected_command = select_command(corrected_commands)
  File "C:\Python27\lib\site-packages\thefuck\ui.py", line 80, in select_command
    for action in read_actions():
  File "C:\Python27\lib\site-packages\thefuck\ui.py", line 13, in read_actions
    key = get_key()
  File "C:\Python27\lib\site-packages\thefuck\system\win32.py", line 25, in get_key
    return ch.decode(sys.stdout.encoding)
TypeError: decode() argument 1 must be string, not None
```

I think this is related to UTF-8 encoding in python2...
I cannot add python3 to path, because my vim plugins will require python2 in the path...

Is there any way I can fix this?


Powershell, The term 'thefuck' is not recognized as the name of a cmdlet

**The output of `thefuck --version` (something like `The Fuck 3.1 using Python 3.5.0`):**

    The Fuck 3.26 using Python 3.6.5

**Your shell and its version (`bash`, `zsh`, *Windows PowerShell*, etc.):**

    Windows Powershell, 5.1.16299.251

**Your system (Debian 7, ArchLinux, Windows, etc.):**

    Windows 10

**How to reproduce the bug:**

    - install thefuck
	`py -m pip install thefuck`
    - put the alias into your powershell profile
    ```
    $env:PYTHONIOENCODING="utf-8"
    iex "$(thefuck --alias)"
    ```
    - start a new powershell

Result:
```
thefuck : The term 'thefuck' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
```

**The output of The Fuck with `THEFUCK_DEBUG=true` exported (typically execute `export THEFUCK_DEBUG=true` in your shell before The Fuck):**

Hmm I can't manage to output this.

**Anything else you think is relevant:**

I also tried it with the following in my profile:
```
...
iex "$(C:\Users\MyUserName\AppData\Local\Programs\Python\Python36-32\Scripts\thefuck.exe --alias)"
```
Then I get a similar error after executing `fuck`:
```
thefuck : The term 'thefuck' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:141
+ ... g]::IsNullOrWhiteSpace($history)) {         $fuck = $(thefuck $args $ ...
+                                                           ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (thefuck:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
```


exception while "run fuck second time for configuring it automatically."

```
luca@g550jk ~> fuck
Seems like fuck alias isn't configured!
Please put eval (thefuck --alias | tr '
' ';') in your ~/.config/fish/config.fish and apply changes with fish or restart your shell.
Or run fuck second time for configuring it automatically.
More details - https://github.com/nvbn/thefuck#manual-installation
luca@g550jk ~> fuck
Traceback (most recent call last):
  File "/usr/bin/fuck", line 11, in <module>
    load_entry_point('thefuck==3.18', 'console_scripts', 'fuck')()
  File "/usr/lib/python3.6/site-packages/thefuck/not_configured.py", line 80, in main
    elif _is_second_run():
  File "/usr/lib/python3.6/site-packages/thefuck/not_configured.py", line 40, in _is_second_run
    if not tracker_path.exists() or not shell.get_history()[-1] == 'fuck':
IndexError: list index out of range
luca@g550jk ~> thefuck --version
The Fuck 3.18 using Python 3.6.1
luca@g550jk ~> lsb_release -d
Description:    Arch Linux
luca@g550jk ~> echo $SHELL
/usr/bin/fish
luca@g550jk ~> fish --version
fish, version 2.5.0
```


Should suggest 'git tag' when typing 'git tags' instead of 'git stage'

```
$ git tags
git: 'tags' is not a git command. See 'git --help'.

Did you mean one of these?
    stage
    tag
$ fuck
git stage
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?
```

Any way to improve the suggestion in this case?


Windows - ImportError: No module named dbm

I have installed thefuck with pip using Python 2.7.11 in Windows. When running `thefuck` from Powershell, I get the error message `ImportError: No module named dbm`. Any ideas?