Crash during Login: TypeError: None has type <type 'NoneType'>

Expected Behavior
Succ login
Actual Behavior
Crash
Steps to Reproduce
Got a crash after ./run.sh.
I have done all the instructions mentioned in the wiki and set config.json
Other Information
OS: Centos 7
Git Commit: format563f898f61233ff86d38d83b68d8399c1f63051b
Python Version: 2.7.5
(PokemonGo-Bot) [billy@IRISLAB-44 PokemonGo-Bot]$ ./run.sh
2016-08-09 00:57:26,810 [       cli] [INFO] PokemonGO Bot v1.0
2016-08-09 00:57:26,812 [       cli] [INFO] Configuration initialized
2016-08-09 00:57:26,812 [pokemongo_bot.health_record.bot_event] [INFO] Health check is enabled. For more information:
2016-08-09 00:57:26,812 [pokemongo_bot.health_record.bot_event] [INFO] https://github.com/PokemonGoF/PokemonGo-Bot/tree/dev#analytics
2016-08-09 00:57:26,820 [requests.packages.urllib3.connectionpool] [INFO] Starting new HTTP connection (1): www.google-analytics.com
2016-08-09 00:57:26,840 [PokemonGoBot] [INFO] [set_start_location] Setting start location.
2016-08-09 00:57:26,841 [PokemonGoBot] [INFO] [x] Coordinates found in passed in location, not geocoding.
2016-08-09 00:57:26,841 [PokemonGoBot] [INFO] [location_found] Location found: 24.80401287450498,120.97030162723968 (24.8040128,<PHONE_NUMBER>, 0.0)
2016-08-09 00:57:26,841 [PokemonGoBot] [INFO] [position_update] Now at (24.8040128,<PHONE_NUMBER>, 0)
2016-08-09 00:57:26,842 [PokemonGoBot] [INFO] [login_started] Login procedure started.
Traceback (most recent call last):
File "pokecli.py", line 503, in
main()
File "pokecli.py", line 131, in main
report_summary(bot)
File "pokecli.py", line 140, in report_summary
metrics.capture_stats()
File "/home/billy/git/PokemonGo-Bot/pokemongo_bot/metrics.py", line 76, in capture_stats
response_dict = request.call()
File "/home/billy/git/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 106, in call
result = self._call()
File "/home/billy/git/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 63, in _call
return PGoApiRequest.call(self)
File "/home/billy/git/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 220, in call
response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
File "/home/billy/git/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 126, in request
request_proto = self._build_main_request(subrequests, player_position)
File "/home/billy/git/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 216, in _build_main_request
request.auth_info.token.contents = self._auth_provider.get_access_token()
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 669, in field_setter
new_value = type_checker.CheckValue(new_value)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 176, in CheckValue
raise TypeError(message)
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)
2016-08-09 00:57:27,607 [sentry.errors] [ERROR] Sentry responded with an error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) (url: https://app.getsentry.com/api/90254/store/)
Traceback (most recent call last):
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
super(ThreadedHTTPTransport, self).send(data, headers)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
ca_certs=self.ca_certs,
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
return opener.open(url, data, timeout)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
response = self._open(req, data)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
'_open', req)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
result = func(*args)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
return self.do_open(ValidHTTPSConnection, req)
File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1284, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/usr/lib64/python2.7/httplib.py", line 979, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.7/httplib.py", line 1013, in _send_request
self.endheaders(body)
File "/usr/lib64/python2.7/httplib.py", line 975, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 833, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
2016-08-09 00:57:27,609 [sentry.errors.uncaught] [ERROR] [u"TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)", u'  File "pokecli.py", line 503, in ', u'  File "pokecli.py", line 131, in main', u'  File "pokecli.py", line 140, in report_summary', u'  File "pokemongo_bot/metrics.py", line 76, in capture_stats', u'  File "pokemongo_bot/api_wrapper.py", line 106, in call', u'  File "pokemongo_bot/api_wrapper.py", line 63, in _call', u'  File "pgoapi/pgoapi.py", line 220, in call', u'  File "pgoapi/rpc_api.py", line 126, in request', u'  File "pgoapi/rpc_api.py", line 216, in _build_main_request', u'  File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 669, in field_setter', u'  File "/home/billy/git/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 176, in CheckValue']

This happened to me after exactly 1 hour of running the bot. Everything worked fine...then this:
2016-08-08 17:25:31,554 [       cli] [INFO] Ran for 1:00:00
...
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)
2016-08-08 17:25:31,613 [sentry.errors] [ERROR] Sentry responded with an error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) (url: https://app.getsentry.com/api/90254/store/)
...
2016-08-08 17:25:31,625 [sentry.errors.uncaught] [ERROR] [u"TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)", u'  File "pokecli.py", line 503, in ', u'  File "pokecli.py", line 89, in main', u'  File "pokemongo_bot/init.py", line 434, in tick', u'  File "pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work', u'  File "pgoapi/pgoapi.py", line 122, in function', u'  File "pokemongo_bot/api_wrapper.py", line 106, in call', u'  File "pokemongo_bot/api_wrapper.py", line 63, in _call', u'  File "pgoapi/pgoapi.py", line 220, in call', u'  File "pgoapi/rpc_api.py", line 126, in request', u'  File "pgoapi/rpc_api.py", line 216, in _build_main_request', u'  File "/Users/LordWilson/Applications/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 669, in field_setter', u'  File "/Users/LordWilson/Applications/PokemonGo-Bot/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 176, in CheckValue']

Will try another run. May this was just random.

same here: crashes after 1 hour of running. tried everything i found about it but nothing worked

i have same problem
2016-08-09 15:50:25,742 [       cli] [INFO] Ran for 0:59:40
2016-08-09 15:50:25,742 [       cli] [INFO] Total XP Earned: 4610  Average: 4635.14/h
2016-08-09 15:50:25,742 [       cli] [INFO] Travelled 0.17km
2016-08-09 15:50:25,742 [       cli] [INFO] Visited 5 stops
2016-08-09 15:50:25,742 [       cli] [INFO] Encountered 16 pokemon, 16 caught, 11 released, 0 evolved, 2 never seen before
2016-08-09 15:50:25,742 [       cli] [INFO] Threw 17 pokeballs
2016-08-09 15:50:25,743 [       cli] [INFO] Earned 1600 Stardust
2016-08-09 15:50:25,743 [       cli] [INFO]
2016-08-09 15:50:25,743 [       cli] [INFO] Highest CP Pokemon: Goldeen [CP: 344] [IV: 8/10/7] Potential: 0.56
2016-08-09 15:50:25,743 [       cli] [INFO] Most Perfect Pokemon: Voltorb [CP: 11] [IV: 13/12/11] Potential: 0.8
Traceback (most recent call last):
File "pokecli.py", line 502, in
main()
File "pokecli.py", line 133, in main
raise e
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

This may has something to do with the cell_workers folder. I exchanged it for a colored version of the bot before. Switched to the old one again. Will see if it comes up again. Couldn't try yet.

Duplicate of #2975


Use collection expression instead of ToArray

API change check
API changes are not detected in this pull request.


Incorrect aggregation logic when getting statistics

Describe the bug

I think there is a mistake in using a parameterized variable CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW in function:
https://github.com/locustio/locust/blob/dc0e4c06a5e52c281c8abd3c92c0d01b8627853a/locust/stats.py#L605-L647
According to the documentation, the value can be freely changed, there are no restrictions on the value set.
https://github.com/locustio/locust/blob/dc0e4c06a5e52c281c8abd3c92c0d01b8627853a/locust/stats.py#L625-L627
If you set a variable to a value that is less than 8, then in the loop above, due to hardcode, values are added to the list acceptable_timestamps whose timestamp is not yet occurred. Below is a condition that tries to find the current time in the acceptable_timestamps list:
https://github.com/locustio/locust/blob/dc0e4c06a5e52c281c8abd3c92c0d01b8627853a/locust/stats.py#L631-L632
For example, how can I aggregate percentile values in 3 seconds using locust? Is't possible? I get 0 stably if I set the CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW value less than 5.
Expected behavior

Getting the correct percentile value aggregated for the last 3 seconds.
Actual behavior

Stable receiving 0 value.
Steps to reproduce

Replacing the variable CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW:

import locust.stats
locust.stats.CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW = 3

Getting the value of the percentile:

for operation_name_type, stats in self.environment.stats.entries.items():
    print(stats.get_current_response_time_percentile(0.99))

Environment

OS: MacOS 13.1
Python version: 3.10.8
Locust version: 2.15.1
Locust command line that you ran: -
Locust file contents (anonymized if necessary): -

Interesting. Should it be changed to something like this?
for i in range(1, CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW-1):
Either way, if you can make a failing test case and a change that fixes it, it would be awesome!

@llirrikk Did you manage to fix it? I am trying to calculate the percentiles for the batch of response times in each second by setting CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW = 1 but gives out weird results


How to add scheduleTime when creating a Cloud Task programmatically?

Hi,
Here we see that scheduleTime can be used to determine when a given cloud task will run. But this example does not show how to do it.
Could you please point out how to set it?
Thanks!

Actually it's just a matter of setting ETA:
t := taskqueue.NewPOSTTask("/_ah/queue/test", params)

now := time.Now().UTC()
scheduleDateTime := now.Add(time.Duration(2) * time.Minute)

t.ETA = scheduleDateTime

👍

Glad you got it figured out! Random comment, no need for the time.Duration conversion. You can do 2 * time.Minute and it works. Here's an example: https://play.golang.org/p/ZROGzyMeqDn.

cool! Thanks for the tip! :)


Add Explicit Args To Exercises - Part 3

Part of #473
The POV page is broken. I can open an Issue if that's the case.
Exercises covered:

[x] POV
[x] Pythagorean Triplet
[x] Queen Attack
[x] Raindrops
[x] Robot Name
[x] Robot Simulator
[x] Roman Numerals
[x] Run Length Encoding
[x] Saddle Points
[x] Say
[x] Scrabble Score
[x] Secret Handshake
[x] SGF Parsing

The POV page is broken.

Unfortunately that means the canary we added in #454 died, and for the wrong reason.
$ ruby -r./lib/trackler -e "Trackler::Tracks.new('.')['haskell'].implementations['pov'].files"
/home/pt/.rvm/gems/ruby-2.4.0/gems/trackler-<IP_ADDRESS>/lib/trackler/implementation.rb:30:in `read': No such file or directory @ rb_sysopen - tracks/haskell/exercises/pov/.dummylink (Errno::ENOENT)

Guess it would be better to remove it.
At least http://x.exercism.io/v2/exercises/haskell/pov still works, eh?

Unfortunately that means the canary we added in #454 died

Er? it works again? http://exercism.io/exercises/haskell/pov/readme
Okay fine guess we can leave the canary in...


Consider adding .gitignore and remove .serverless directory

Nice project!
Also consider tweaking ReadCapacityUnits etc and set it to a lower number to reduce cost further.

Thanks for raising the suggestion... Done in 0948c16.


[BUG] deflisten script not working

Checklist before submitting an issue

[X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
[X] I have specifically verified that this bug is not a common user error
[X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug
I tested my python script to detect workspace change and it works but doesn't work on eww
eww state:
get-time: 18:05
active-ws: hyprctl activeworkspace -j | jq '.id'
music: Baby Don’t Hurt Me - Sped Up

eww.yuck
(deflisten active-ws
    :initial `hyprctl activeworkspace -j | jq '.id'`
    `scripts/hypr.py -a`)

even after trying another way as seen below it still doesn't work
(deflisten active-ws
    :initial '1'
    `scripts/hypr.py -a`)

hypr.py
#!/usr/bin/env python3
# Script for getting active workspace/window

import os
import sys
import socket
import subprocess

WORKSPACES = 6
HYPR_INSTANCE = os.getenv('HYPRLAND_INSTANCE_SIGNATURE')
SOCKET_PATH = f'/tmp/hypr/{HYPR_INSTANCE}/.socket2.sock'

def get_window_title():
    pass

def get_active_workspace(line):
    if line.find('workspace>>') == 0:
        print(line[-1])

with socket.socket(socket.AF_UNIX) as client_socket:
        # Connect to the Unix domain socket
        client_socket.connect(SOCKET_PATH)

        # Receive data from the socket
        while True:
            data = client_socket.recv(1024)  # Adjust the buffer size as needed
            decoded_data = data.decode().strip().split('\n')  # Convert bytes to string and remove leading/trailing whitespace
            for line in decoded_data:
                if sys.argv[1] == '-a':
                    get_active_workspace(line)

Reproducing the issue
just change workspaces
Expected behaviour
workspace widget should reflect active workspace on switch
Additional context
Full eww.yuck config:
;; Variables
(deflisten active-ws
    :initial `hyprctl activeworkspace -j | jq '.id'`
    `scripts/hypr.py -a`)

(defpoll get-time :interval "2s"
    "date +%H:%M")

(defwindow bar
    :monitor 0
    :exclusive true
    :geometry (geometry
        :width "100%"
        :height "32px"
        :anchor "center top")
    (box :class "bar"
        :valign "fill"
        :halign "fill"
        (workspace)
        (clock)
        ))

(defwidget workspace []
    (box :class "workspace"
        :halign "start"
        :spacing 8
        :space-evenly true
        (ws-item :num '1')
        (ws-item :num '2')
        (ws-item :num '3')
        (ws-item :num '4')
        (ws-item :num '5')
        (ws-item :num '6')))

(defwidget ws-item [num]
    (eventbox :cursor "pointer"
        ;; :onclick "~/.config/hypr/scripts/workspace.py -s ${num}"
        (box :class "ws-item ${num == active-ws ? "ws-active": ""}"
            :valign "center")))

(defwidget clock []
    (box :class "clock"
        :halign "end"
        get-time))

Full scss:
* {
    all: unset
}

.bar {
    padding: 6px 12px;
    background-color: #0A1321;
}

.workspace {
    border-radius: 16px;
}

.ws-item {
    opacity: 0.4;
    border: 2px solid white;
    border-radius: 50%;
    transition: 0.15s ease;

    min-height: 10px;
    min-width: 10px;
}

.ws-active {
    opacity: 1;
    background-color: white;
}

.clock {
    font-size: 1.2rem;
    font-weight: bold;
}

I'm not sure it will fix your issue, but you should try printing with print(line[-1], flush=True).
Doing this fixed some of my script, so it might works for you.

I'm not sure it will fix your issue, but you should try printing with print(line[-1], flush=True). Doing this fixed some of my script, so it might works for you.

thanks it worked! but one more thing:
in the line below, is it invalid to set the initial value of deflisten as the output of an command?
I ran eww state and it shows the literal command that I ran instead of the output of the value.
(deflisten active-ws
    :initial `hyprctl activeworkspace -j | jq '.id'`
    `scripts/hypr.py -a`)

That is indeed invalid! The idea of the initial value is to have some value that shows before any scripts push their first output, thus setting the initial value to some command would mean that eww would still have to wait for the command to finish before being able to proceed with rendering anything. To ensure that your variable is set to a correct value as fast as possible, I recommend just starting out your hypr.py script by running hyprctl activeworkspaces -j | jq .'id', such that eww gets a meaningful value as fast as possible.
And ye, that flush=True fix ensures that your script actually outputs the data, rather than just buffering it and then printing it in some batch at some point -- eww can't really do anything to avoid this being required :/ Thus, I'll close this issue. Feel free to re-open or create a new one if there are other issues.


v2.0.0 cause error used in react or angular app

I found no information on what changed between the versions. Checked the instructions on how to make it work and did not notice any changes.
So I simply upgraded the version to 2.0.0.
Which leads to this error being thrown:
Control.FullScreen.js:80 Uncaught ReferenceError: screenfull is not defined
    at NewClass._createButton (Control.FullScreen.js:80)
    at NewClass.onAdd (Control.FullScreen.js:40)
    at NewClass.addTo (leaflet-src.js:4757)
    at eval (FullScreenControl.js:22)
    at invokePassiveEffectCreate (react-dom.development.js:23487)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at flushPassiveEffectsImpl (react-dom.development.js:23574)
    at unstable_runWithPriority (scheduler.development.js:646)
_createButton @ Control.FullScreen.js:80
onAdd @ Control.FullScreen.js:40
addTo @ leaflet-src.js:4757
eval @ FullScreenControl.js:22
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:646
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
eval @ react-dom.development.js:23324
workLoop @ scheduler.development.js:590
flushWork @ scheduler.development.js:545
performWorkUntilDeadline @ scheduler.development.js:157
react_devtools_backend.js:2430 The above error occurred in the <FullScreenControl> component:

    at FullScreenControl (webpack-internal:///./src/components/Projekte/Karte/FullScreenControl.js:40:75)
    at div
    at MapContainer (webpack-internal:///./node_modules/react-leaflet/esm/MapContainer.js:36:3)
    at Karte__StyledMapContainer (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at ErrorBoundary (webpack-internal:///./node_modules/react-error-boundary/dist/react-error-boundary.umd.js:40:37)
    at MyErrorBoundary (webpack-internal:///./src/components/shared/ErrorBoundary.js:146:3)
    at div
    at Karte__Container (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at Karte (webpack-internal:///./node_modules/mobx-react-lite/es/observer.js:30:80)
    at eval (webpack-internal:///./src/components/Projekte/KarteOrNull.js:18:3)
    at div
    at ProjektContainer__InnerContainer (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at div
    at Pane (webpack-internal:///./node_modules/react-split-pane/dist/index.esm.js:170:5)
    at div
    at SplitPane (webpack-internal:///./node_modules/react-split-pane/dist/index.esm.js:343:5)
    at ProjektContainer__StyledSplitPane (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at div
    at Pane (webpack-internal:///./node_modules/react-split-pane/dist/index.esm.js:170:5)
    at div
    at SplitPane (webpack-internal:///./node_modules/react-split-pane/dist/index.esm.js:343:5)
    at ProjektContainer__StyledSplitPane (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at div
    at ProjektContainer__Container (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at ProjektContainer (webpack-internal:///./node_modules/mobx-react-lite/es/observer.js:30:80)
    at ResizeDetector (webpack-internal:///./node_modules/react-resize-detector/lib/esm/components/ResizeDetector.js:51:5)
    at ResizeDetectorHOC (webpack-internal:///./node_modules/react-resize-detector/lib/esm/hoc/withResizeDetector.js:52:7)
    at withResizeDetector(ProjektContainer)
    at div
    at Projekte__Container (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at Projekte (webpack-internal:///./node_modules/mobx-react-lite/es/observer.js:30:80)
    at div
    at Daten__Container (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at div
    at Layout__ContentContainer (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at div
    at Layout__Container (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:28:19472)
    at Layout (webpack-internal:///./node_modules/mobx-react-lite/es/observer.js:30:80)
    at ErrorBoundary (webpack-internal:///./node_modules/react-error-boundary/dist/react-error-boundary.umd.js:40:37)
    at MyErrorBoundary (webpack-internal:///./src/components/shared/ErrorBoundary.js:146:3)
    at DatenPage (webpack-internal:///./node_modules/mobx-react-lite/es/observer.js:30:80)
    at PageRenderer (webpack-internal:///./.cache/page-renderer.js:19:1)
    at PageQueryStore (webpack-internal:///./.cache/query-result-store.js:28:5)
    at RouteHandler
    at div
    at FocusHandlerImpl (webpack-internal:///./node_modules/@reach/router/es/index.js:361:5)
    at FocusHandler (webpack-internal:///./node_modules/@reach/router/es/index.js:332:19)
    at RouterImpl (webpack-internal:///./node_modules/@reach/router/es/index.js:239:5)
    at Location (webpack-internal:///./node_modules/@reach/router/es/index.js:72:23)
    at Router
    at ScrollHandler (webpack-internal:///./node_modules/gatsby-react-router-scroll/scroll-handler.js:34:35)
    at RouteUpdates (webpack-internal:///./.cache/navigation.js:264:5)
    at EnsureResources (webpack-internal:///./.cache/ensure-resources.js:15:5)
    at LocationHandler (webpack-internal:///./.cache/root.js:84:1)
    at LocationProvider (webpack-internal:///./node_modules/@reach/router/es/index.js:92:5)
    at Location (webpack-internal:///./node_modules/@reach/router/es/index.js:72:23)
    at Root
    at SnackbarProvider (webpack-internal:///./node_modules/notistack/dist/notistack.esm.js:749:24)
    at ThemeProvider (webpack-internal:///./node_modules/@material-ui/styles/esm/ThemeProvider/ThemeProvider.js:42:24)
    at ApolloProvider (webpack-internal:///./node_modules/@apollo/client/react/context/ApolloProvider.js:11:21)
    at App (webpack-internal:///./src/App.js:100:3)
    at StaticQueryStore (webpack-internal:///./.cache/query-result-store.js:108:5)
    at ErrorBoundary (webpack-internal:///./.cache/fast-refresh-overlay/components/error-boundary.js:11:5)
    at FastRefreshOverlay (webpack-internal:///./.cache/fast-refresh-overlay/index.js:27:5)
    at ConditionalFastRefreshOverlay (webpack-internal:///./.cache/root.js:230:3)

This is my component: https://github.com/barbalex/apf2/blob/master/src/components/Projekte/Karte/FullScreenControl.js
The readme mentions that this tool uses https://github.com/sindresorhus/screenfull.js. But that is not listed in package.json as a dependency. Could that be the reason for this error?
I tried installing screenfull and even importing it. But that did not solve the issue.

Hi,

I found no information on what changed between the versions. Checked the instructions on how to make it work and did not notice any changes.

https://github.com/brunob/leaflet.fullscreen/compare/1.6.0...2.0.0
You're welcome :)

The readme mentions that this tool uses https://github.com/sindresorhus/screenfull.js. But that is not listed in package.json as a dependency. Could that be the reason for this error?

Nope, screenfull.js is directly in the script as you can see here https://github.com/brunob/leaflet.fullscreen/blob/master/Control.FullScreen.js#L152

Hi,

I found no information on what changed between the versions. Checked the instructions on how to make it work and did not notice any changes.

https://github.com/brunob/leaflet.fullscreen/compare/1.6.0...2.0.0
You're welcome :)

The readme mentions that this tool uses https://github.com/sindresorhus/screenfull.js. But that is not listed in package.json as a dependency. Could that be the reason for this error?

Nope, screenfull.js is directly in the script as you can see here https://github.com/brunob/leaflet.fullscreen/blob/master/Control.FullScreen.js#L152

I don't get why it is not found then

I don't get why it is not found then

Maybe because it is called on line 80 but the function is defined beginning on line 152?

Maybe because it is called on line 80 but the function is defined beginning on line 152?

Maybe because it is called on line 80 but the function is defined beginning on line 152?

That was already the case with v1, maybe it's a internal problem with react but i can't tell more since i don't use it.

Maybe because it is called on line 80 but the function is defined beginning on line 152?

That was already the case with v1, maybe it's a internal problem with react but i can't tell more since i don't use it.

I just forked this project, moved screenfull above your code and tested. Same issue.
So you are right.

I just forked this project, moved screenfull above your code and tested. Same issue.
So you are right.

I do have the same error in an Angular 9 app. A simplified example can be seen in this Stackblitz.
As far as I understand from the source code, one of the changes in V2.0.0 is the integration of screenfull in this package and exporting it, so that it can be used in other places in the application using leaflet.screenfull.
Another change is the making this package usable in different module systems (commonjs, amd, ..). And imho here lays the problem.
If the package is used in a non-commonjs environment, then the screenfull object is written to the window object in line 333. Otherwise it is exported as the default object of this module.
In the "main" section (the extension of leaflet.control) screenfull is used in different  places - e.g. in line 80 during construction of the 'fullscreen button'. Here screenfull is always used as a global variable!
If screenfull is written to the window object, then screenfull can be used this way (if we want to be more explicit, then we would have to write window.screenfull).
But if we are in a commonjs environment, then there is no global variable screenfull and we fail with the error mentioned above.
Possible solutions could be:

add screenfull always to the window object (even if we are in a commonjs environment) - looks more like a hack to me :-).
transfer not only the leaflet object to the IIFE in line 12, but also the screenfull object - I failed trying to modify the source in my angular app - but this is a typescript environment and has its own topics; e.g. 'require is unknown'.
and for sure there are more and better solutions :-)

As I use this great extension in my application, I would appreciate it, if this problem could be fixed.

@BePo65 & @barbalex i'd really like to fix this, but i don't use react or angular, maybe you should ask advice to the author of https://github.com/krvital/react-leaflet-fullscreen or https://github.com/runette/ngx-leaflet-fullscreen ?
Hope we will find a way to fix this asap (for the moment you can rollback your apps to latest v1 tag).

Obviously my hunch was wrong while @BePo65 seems to have a much better idea. Unfortunately I don't understand the subject well enough to be of any help. At least I think so. Let's hope someone comes along who creates a solving pull request or can teach us how to solve it 🙏

So it would be nice, if you could insert window.screenfull = screenfull; after line 331 as kind of a fast solution and I will work out a better solution in the next few weeks.
The code starting from line 330 should then look like  here:
	if (isCommonjs) {
		module.exports = screenfull;
		window.screenfull = screenfull;
	} else {
		window.screenfull = screenfull;
	}

You may have a look to screenfull.js issues about react & angular cf https://github.com/sindresorhus/screenfull.js/search?q=react&type=issues & https://github.com/sindresorhus/screenfull.js/search?q=angular&type=issues

Modifications from V1.6 to V2.0 I did identify:

implementation of the umd module structure as recommended by the leaflet plugin guide
switch to 'screenfull' package for displaying the fullscreen map

The code has 2 external dependencies (leaflet + screenfull), but in the iife implementation of the 'leaflet.fullscreen' part only 1 is injected (leaflet); 'screenfull' is "injected" via global variable (window.screenfull).
This means that the project implements a 'mixed pattern' - a little bit 'umd module' and a little bit "classic" iife.
I think that this design could be improved (:-)
Additionally the code for 'screenfull' is copied into the 'lelaflet.FullScreen.js' file.
For iife implementations this is an acceptable pattern (as they use global variables as basis for accessing external modules).
But for module systems this will not work, as in this case the (module-) loaders usually will expect 1 module in 1 file named after the module.
This means that the loaders will expect the module 'screenfull' in a file (or folder) named 'screenfull' and the module 'leaflet.fullscreen' in a file (or folder) name 'leaflet.fullscreen'.
To implement this pattern, the javascript file must be split into 2 files.
Besides that, if you copy the source from 'screenfull' into your project, then you are also responsible to repeat that steps for every change to 'screenfull' (e.g. bug fixes and security issues).
The idea of all this module thing is to avoid just that (as this for sure not the fun part of programming).
But I'm sure you know all that points; I just wanted to describe what is the idea behind my pr.
So I modified the project to use 'screenfull' as an external reference, inject it in the iife and update the documentation.
I prepared examples for a classic (iife) and an angular (with modules) implementation.
Details can be found in pr #79.

Awesome @BePo65. Please have a beer, lean back and enjoy life!

you are too kind  :-)

Thx for the report.

Besides that, if you copy the source from 'screenfull' into your project, then you are also responsible to repeat that steps for every change to 'screenfull' (e.g. bug fixes and security issues).

I know, and i plainly assume this responsibility :)

The idea of all this module thing is to avoid just that (as this for sure not the fun part of programming).
But I'm sure you know all that points; I just wanted to describe what is the idea behind my pr.

I know and it's clearly what i want to avoid... this script just work as is in a browser, i'd would like to keep it simple for users and not have to write things like "Include screenfull.js, Control.FullScreen.js and Control.FullScreen.css in your page (screenfull.js must stand before Control.FullScreen.js)`.

So I modified the project to use 'screenfull' as an external reference, inject it in the iife and update the documentation.
Details can be found in pr #79.

Thx for the PR but i would prefer to stay away from ts, angular, react, etc in this repo.
All this remind me when people asked me years ago to put bower files in this repo, and finally this was effortless and it also remind me this post https://nolanlawson.com/2015/10/19/the-struggles-of-publishing-a-javascript-library/
Just to be clear, i'd really like to help people to use this script in whatever js tech, but i alos want to keep this script simple and in my competences scope. Finally, the v1 was working well with an old script based on a post dated from 2011 cf https://j.hn/native-fullscreen-javascript-api-plus-jquery-plugin/ => weird
To conclude, what would be the simple solution, possibly without having to modify the screenfull source ?

OK, I agree in every point you made.
You have a solution that solves the defined tasks (among others being a library for javascript in a "plain" browser environment) and that is all it has to do. And the time of all of us is limited. So you should just stay with this project as it is by now.
Perhaps it would be acceptable to add a small hint in the readme, that for "module" users (like react and angular) it is necessary to additionally install 'screenfull' (npm i screenfull) and recomended to install the type definitions for leaflet.fullscreen (npm i -D @types/leaflet.fullscreen) to remove the screenfull is not defined message.
The small 'penalty' is the additional footprint of 'screenfull' (a mere 18.1kB). And if this is too much overhead, then everybody is free to fork this great repo - perhaps I find the time to do just that :-)
As I am just an angular guy and therefore tested all this only with angular 9, perhaps @barbalex can test, if this solution will work in react too.
Anyway, thanks for your patience.

@BePo65 thx to be that kind of person who can understand my opinion on this :)
I'm totally open to give points for react/angular/etc users in the readme or anywhere appropriated, let's disccus about it here.

How about adding a small (ok, not so small) section at the end of the How ? chapter?
----- start of typescript tipps ------
Tipps for typescript environments:
Installation
npm i leaflet.fullscreen
npm i screenfull
npm i -D @types/leaflet.fullscreen

Usage
import * as leaflet from 'leaflet';
import 'leaflet.fullscreen';

@Component({
    :
})
export class AppComponent implements AfterViewInit {
  private map: leaflet.Map;
  private mapOptions: leaflet.MapOptions = {
    :
    fullscreenControl: true,
    fullscreenControlOptions: {
      position: 'topleft'
    }
  } ;

  ngAfterViewInit(): void {
    this.map = new leaflet.Map('map', this.mapOptions);
  }
    :
}

----- end of typescript tipps ------

nice @BePo65 :) feel free to PR this !

I have created a plugin for react-leaflet v3 to integrate with this awesome repo. Please check this out - https://github.com/elangobharathi/react-leaflet-fullscreen-plugin


Ensure timer channel is empty after stop

Found that the k8sapi/kubelet executor that use the WaitForTermination()
of the common executor randomly throw the error as below and
also issue has been reported (#1573)
=== 8< ===
time="2019-12-05T06:00:16Z" level=info msg="Waiting on main container"
time="2019-12-05T06:00:20Z" level=info msg="main container started with container ID: 980c0415db8e7c404161eb37ada3f5a17fe38f284ff02960e130526b69d3b7a3"
time="2019-12-05T06:00:20Z" level=info msg="Starting annotations monitor"
time="2019-12-05T06:00:20Z" level=info msg="Waiting for container 980c0415db8e7c404161eb37ada3f5a17fe38f284ff02960e130526b69d3b7a3 to complete"
time="2019-12-05T06:00:20Z" level=info msg="Starting deadline monitor"
time="2019-12-05T06:00:20Z" level=info msg="Starting to wait completion of containerID 980c0415db8e7c404161eb37ada3f5a17fe38f284ff02960e130526b69d3b7a3 ..."
time="2019-12-05T06:00:20Z" level=warning msg="Failed to wait for container id '980c0415db8e7c404161eb37ada3f5a17fe38f284ff02960e130526b69d3b7a3': timeout after 0s"
time="2019-12-05T06:00:20Z" level=error msg="executor error: timeout after 0s"
time="2019-12-05T06:00:20Z" level=info msg="Saving output parameters"
=== >8 ===

Refers to [1], we should ensure that the timer channel is empty after stop,
otherwise, the error will be thrown unexpectedly.

[1] https://golang.org/pkg/time/#Timer.Stop

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.


QM9 raw dataset link broken?

🐛 Bug
When trying to instantiate the QM9 dataset, I get a HTTP Error 403: Forbidden message
To Reproduce
Steps to reproduce the behavior:
Launch python, run the following code and see the results below:
import torch_geometric
torch_geometric.datasets.QM9(root='./qm9')
Downloading https://s3-us-west-1.amazonaws.com/deepchem.io/datasets/molnet_publish/qm9.zip
Traceback (most recent call last):
File "", line 1, in
File "3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/datasets/qm9.py", line 130, in init
super(QM9, self).init(root, transform, pre_transform, pre_filter)
File "3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/data/in_memory_dataset.py", line 54, in init
pre_filter)
File "3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/data/dataset.py", line 89, in init
self._download()
File "3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/data/dataset.py", line 141, in _download
self.download()
File "3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/datasets/qm9.py", line 165, in download
file_path = download_url(self.raw_url, self.raw_dir)
File "Projects/3rdPartyLibs/torch_geometric/pytorch_geometric/torch_geometric/data/download.py", line 34, in download_url
data = urllib.request.urlopen(url, context=context)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "~/anaconda3/envs/ocp-models/lib/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
Expected behavior
dataset downloads successfully
Environment

OS: Ubuntu 20.04
Python version: 3.6.11
PyTorch version: 1.7.0
CUDA/cuDNN version: 11.0
GCC version: 9.3.0-17ubuntu1~20.04
Any other relevant information: Using the latest pytorch_geometric as of today: Nov 2, 2020

This link works:
https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/molnet_publish/qm9.zip

Thanks for letting me know. Fixed in master!

Same things happened for MoleculeNet.

Might want to revisit all deepchem.io hosted links?

Indeed. This is now also fixed!

Hi Matthias, Thanks for your quick actions!
I am reinstalled torch-geometric and try to download tox21 from MoleculeNet, but still receiving the same error message (urllib.error.HTTPError: HTTP Error 403: Forbidden). Could you please give me some comments or instructions? Much appreciate!

You can install from master via
pip install git+https://github.com/rusty1s/pytorch_geometric.git

Thanks for your super-fast-awesome supports! It should be Glore1s, rather than Rusty1s.


Fix a few issues

These are a some changes that I needed to make in order to convert the Material Theme without exceptions.
I also had to clone the theme repository and build it locally.
Other than that, the result looks pretty good and you saved me quite some time, so thank you for that! :tada:

@alexisfontaine Thank you for the PR. Yeah the "new" package isn't released yet 😄


Failing to create device. NetBox 400 status reason: {'cluster': ["Related object not found using the provided attributes:

Environment

Python version:  3.6.7
NetBox version: 2.6.8
vCenter version: 6.5.0
vCenter NetBox Sync version:

Steps to Reproduce

Follow steps in readme.md and install.
Execute run.py -v

Expected Behavior
For devices to be created in netbox
Observed Behavior
I firstly got an error message regarding null error message, I got round this with the workaround in this issue: https://github.com/synackray/vcenter-netbox-sync/issues/58
This is odd because I have the most up to date build as I only cloned it a few hours ago.
Anyway I now have an error that says:
NetBox 400 status reason: {'cluster': ["Related object not found using the provided attributes: {'name': 'edimandvesxh001.lambienet.local'}"]}

This then causes all the other devices to error because the device it is trying to add them to does not exist.
Unsure why it cannot get a serial number for this device.
Full debug is attached.
output.txt

Hi @fraserc182! I'll look into this immediately.
This is odd because I have the most up to date build as I only cloned it a few hours ago.
Are you running the latest commit from the develop branch or the last release on master?

Hi,
The last release on master! I can grab the develop branch if this is where the serial address fix is.
As for the other error:
NetBox 400 status reason: {'cluster': ["Related object not found using the provided attributes: {'name': 'edimandvesxh001.lambienet.local'}"]}

I manually created a cluster named edimandvesxh001.lambienet.local in netbox and then it ran without any problems. So it looks like it is having issues with creating this cluster?
Thanks for getting back to me so fast.

I cloned the development build and this resolves the serial number issue.
Thanks for the update. I am planning to promote to master soon, pending final regression testing. Are there any outstanding issues in your sync with develop?

Yes I am still getting this error:
NetBox 400 status reason: {'cluster': ["Related object not found using the provided attributes: {'name': 'edimandvesxh001.lambienet.local'}"]}

Manually creating the cluster it's looking for fixes it but I feel I'm sidestepping something by doing this.

Hmm something doesn't look right with the way the cluster is being parsed after collection. I am sorry to ask, but I may need to have you run a special branch to get additional detail. First I'll try to recreate the issue on my side.
2020-02-10 11:43:25,948 [INFO] Initiated sync of vCenter cluster objects to NetBox.
2020-02-10 11:43:25,948 [INFO] Collecting vCenter cluster objects.
2020-02-10 11:43:25,967 [DEBUG] Collected 1 vCenter cluster object.
2020-02-10 11:43:25,967 [INFO] Starting sync of 0 vCenter clusters objects to NetBox clusters objects.
2020-02-10 11:43:25,968 [INFO] Finished sync of 0 vCenter clusters objects to NetBox clusters objects.

Sure thing, just let me know what you need from me.

I suspect this may related to the structure of your particular vCenter resources. Is the host edimandvesxh001.lambienet.local actually assigned to a cluster or is it standalone and perhaps in a folder instead? My reasoning for this is that the cluster objects call on their parent resources as shown in the screenshot below.

If a cluster is not created then it would seem no clusters would be returned and perhaps vCenter returns the host itself as the parent object.. I've never run into the situation but it's a theory. I'll try to spin this up in lab and see if I can reproduce.

This is our lab environment so it's just standalone.
It is just a single esxi host on bare metal, so you're right it's not part of a cluster!
I suppose this is expected behaviour then.
Maybe I can manually name the cluster instead of it getting it from the parent object?

I see. I've never actually tested the script on a single host. You should be able to create the cluster object, the rules for it are very simple. The platform is "VMware ESXi", the default site is "vCenter" and the device role is "Server".
This is an interesting use case though. I'll do some testing on this and see if it's feasible for future support.

Brilliant, thanks for looking into this for me so quickly!
I'll just add the cluster manually.
Cheers for creating this project!

I've added the ability to import hosts that are not part of parent clusters while patching #82. Thanks for your report it was a big help.

Hi,
i had the same issue with datacenters with only one Host not being added properly to Netbox. But I found a different solution: I changed the vc_obj_views value for clusters from vim.ClusterComputeResource to vim.ComputeResource this means datacenters with a single Hosts have a Cluster added to Netbox with the host name as the cluster name. This cluster also gets the correct cluster group and host device added.
I am interested to hear feedback on my approach and what disadvantages it may cause. But on first look it seems a lot simpler because the it is only a one line change and the rest is handled by the existing script.


Maven Mirror Overly Greedy

Trying to put all of the Maven Mirror/Cache stuff into my pipeline, and I've figured out why I had removed it in the first place:
The maven settings.xml claims that it is a mirror of * (everything), even though it's actually only a mirror of certain repositories. This causes dependencies to fail to load from other repositories, even when they are present in the POM.
https://github.com/aegershman/pipeline-tasks/blob/5c017f8722ccfc32227269655c955ad63755899f/maven/settings.xml#L14

We have to be careful here because long term the desire would be to have everything come from a single source of truth to ensure reproducability of builds if necessary.  If the dependencies pulled exist in a central nexus repository that value this gains is that everything is there.  But if this does not fit your purposes you can provide your own settings.xml via the MAVEN_CONFIG and point to your own settings.xml

What is the recommended location for such a file? The current one is in the pipeline-tasks repo

That is, in common.yml there is a dubious relative url that ends up in pipeline-tasks: ../pipeline-tasks/maven/settings.xml
Relative to what? Unsure.

closing in preparation of archiving this repo


Feature: Cogpit

Feature Description:
great, we can ourself Cogo working CLI. but do you know what can really help managing command execution just in one terminal? that right UI so lets write a TUI for Cogo.
Expected Behavior:

using (Bubbletea)[https://github.com/charmbracelet/bubbletea] we can achieve a pretty nice looking and capable TUI.
preferably we would like the Cogo repository to contain the CLI only there for we would like PR to be opend to the Cogpit repository containing the TUI app for Cogo

(Cogpit repository)[https://github.com/royiro10/cogpit]


BUG: Make datum name match exact in query_utm_crs_info

Related to https://github.com/geopandas/geopandas/issues/2045
[x] Tests added
[x] Fully documented, including history.rst for all changes and api/*.rst for new API

I did a check with all of the UTM CRS in the database and the names all have "/" in the name, so this is a pretty safe change in the present state.


Stop creating references unnecessarily to compare pointers by-address

The test common::deque::basics contains several lines that look like this:
assert!(std::ptr::eq(head_d, unsafe { node1_ptr.as_ref() }));

What is happening is that we assert that head_c, a reference, is equal by-address to node1_ptr, a NonNull<_>. However, the way we do this is by creating a reference, instead of using as_ptr.
The current way has several downsides:

It requires an unsafe block. Comparing pointer addresses is safe so this should be unnecessary.
It is unsound, at least under Tree Borrows rules. The references created there violate the uniqueness of references/Boxes created internally in the Deque, which trips the Deque later when it tries to use these internally-held references.
It is unnecessary -- comparing the result of as_ptr works just the same, maybe even faster due to less intermediary methods.

As such, the test should be updated to only use as_ptr. When done, it actually makes the tests pass under Tree Borrows.
See also https://github.com/moka-rs/mini-moka/pull/31

Thanks for merging, and nice that you use Tree Borrows in your CI :partying_face: But be warned that in miri, Tree Borrows currently comes with a performance impact, since there's a bit more to check. While I plan to optimize this further, I can't promise anything. Though if you notice any code that is significantly slower under TB than SB, reach out and I will see what I can do.
Besides, can you also merge the sister PR for mini-moka?


ARROW-1114: [C++] Add simple RecordBatchBuilder class

This patch includes ARROW-1172 which I put up separately. Putting this up for comments on the API before I go too far down the rabbit hole. The idea is to make it simpler for users to construct record batches given a known schema. For example, this could be used in turbodbc or another database driver
closes #810 incidentally

I will write some tests and maybe a benchmark or two soon

No longer WIP. I wanted to get something basic in so that adapter components like Avro can use this class. Figure we can refine / expand the API as needed as we proceed
@xhochy or @cpcloud could you review? Thanks

Updated docs, this could use review before merging

+1


Usage of newtypes instead of type aliases in generated code

I'm wondering whether it's possible to use the transparent newtypes everywhere the current generated code uses type aliases (e.g. Window.
For now, I can see only one problem - the fact that we have to generate ID first (in a general way), and only then give this ID a meaning by allocating the corresponding resource; this makes it probably infeasible to use the traditional newtype pattern, i.e. replace type Window = u32 with struct Window(u32). However, it might be possible to do the following (that's just a sketch, without thinking too much of ergonomics yet):

First, add struct Id<Type>(u32, PhantomData<Type>) as a generic "handler type" (probably with #[repr(transparent)]).
Second, set the return type of Connection::generate_id to be Id<()> (i.e. "handler to something").
Third, add marker structs such as struct WindowH.
Fourth, set type aliases to the different specifications of Id, e.g. type Window = Id<WindowH>.

This way, freshly generated IDs will not be usable, unless one explicitly states what they want to use them for. That might reduce the possible confusion, especially for functions with long argument lists.
If this approach can be useful, I'll start working on the PR. If not, it'd probably be good to have the reasons for such decision documented somewhere?

Just to summarize: You want to turn the following into a compiler error, right? (Problem is that a CreateWindow creates a window while FreePixmap expects a pixmap and will produce a runtime error)
let id = connection.create_id()?;
connection.create_window(id, other arguments)?;
connection.free_pixmap(id)?;

I didn't really think much about your proposed solution, but the above is the problem you want to solve. Is this something that "actually happens a lot" (did it happen to you)? Or is this just due to "it feels more Rust-y this way" (with which I certainly agree)?

If this approach can be useful, I'll start working on the PR.

How would you do that? The XML does not contain the necessary type information, I think.
Actually "I thought", but apparently it does since I just found:
  <xidunion name="DRAWABLE">
    <type>WINDOW</type>
    <type>PIXMAP</type>
  </xidunion>

So, apparently the necessary information is available (but I bet somewhere in the XML something got this wrong since libxcb does not use this information at all. xcbgen does not even parse the contents of an <xidunion> and there are only three instances of it in all the XML).

Third, add marker structs such as struct WindowH.

Why? Why not just have several newtypes?
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] // Dunno if I got all traits
struct XId(u32); // This is what `generate_id()` produces
impl From<Xid> for u32 {...}
impl From<u32> for Xid {...}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct WindowId(u32);
impl From<WindowId> for u32 {...}
impl From<Xid> for WindowId {...}
impl From<u32> for WindowId {...}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct PixmapId(u32);
impl From<PixmapId> for u32 {...}
impl From<Xid> for PixmapId {...}
impl From<u32> for PixmapId {...}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct DrawableId(u32);
impl From<DrawableId> for u32 {...}
impl From<Xid> for DrawableId {...}
impl From<u32> for DrawableId {...}
impl From<WindowId> for DrawableId {...}
impl From<PixmapId> for DrawableId {...}

Hm... would the drawable argument of copy_area then become a generic Into<DrawableId>? That way, one could also use this with our WindowWrapper (if that implements the necessary trait).

You want to turn the following into a compiler error, right? (Problem is that a CreateWindow creates a window while FreePixmap expects a pixmap and will produce a runtime error)

Yes, that's correct.

Is this something that "actually happens a lot" (did it happen to you)? Or is this just due to "it feels more Rust-y this way" (with which I certainly agree)?

Just an attempt to make this API a little more idiomatic, nothing more. I haven't worked with the library yet, to be honest.

The XML does not contain the necessary type information, I think.

Not sure what do you mean here. I was thinking only of the currently generated type aliases, which, if I understand correctly, are created from the xidtype elements. The xidunion complicates this a bit, however, but seems to be doable nevertheless, if the definitions themselves are correct. Probably I'm missing something else?

Why not just have several newtypes?

That's more or less the same approach, but you're right, it seems to be simpler.

would the drawable argument of copy_area then become a generic Into? That way, one could also use this with our WindowWrapper (if that implements the necessary trait).

Or we generate the as_drawable_id on anything relevant. This might lead to a more verbose code, but the API will be a little simpler with less generics and implicit conversions.

Hm, all those Froms mean that this idea does not actually provide the wanted guarantees, because one can just keep the return value from generate_id() as an Xid without having to convert it to anything else...

Could it be a good idea then to not implement neither Copy nor Clone on Xid, so that one can only convert it into more specific identifier (which then will itself be copyable)? Like this (playground):
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct XId(u32);

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct WindowId(u32);
impl From<XId> for WindowId {
    fn from(xid: XId) -> WindowId {
        WindowId(xid.0)
    }
}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct PixmapId(u32);
impl From<XId> for PixmapId {
    fn from(xid: XId) -> PixmapId {
        PixmapId(xid.0)
    }
}

fn generate_id() -> XId {
    XId(0) // just a stub
}

fn create_window(_: WindowId) {
    // an empty stub
}

fn free_pixmap(_: PixmapId) {
    // an empty stub
}

fn main() {
    let wid = generate_id().into();
    create_window(wid);
    // free_pixmap(wid); - error, mismatched types
    // we can then do something else with `wid` - it's Copy, so it's not gone

    let pid = generate_id().into();
    free_pixmap(pid);
    // create_window(pid); - error, mismatched types

    let xid = generate_id();
    create_window(xid.into());
    // free_pixmap(xid.into()); error, xid was moved
}

Hm... would the drawable argument of copy_area then become a generic Into?

This is actually how I did it in breadx. Each XID type was a wrapper around a u32 with From impls for u32 as well as anything it was a union of. I also used Into<DrawableId> for functions in breadx. The only real issue is that it generates two separate functions when you call it for, say, both Window and Drawable. However, considering that, in this alternate reality, Window and Drawable both refer to the same data, this would mean the exact same bytecode would be generated for each function. I think newer versions of rustc can optimize it so that only one of those functions get used (at the cost of some minor confusion during debugging).

Could it be a good idea then to not implement neither Copy nor Clone on Xid

I don't think so, since there are a million ways around it anyways.


Dependency injection for privacy rules

Hi,
How do we inject dependencies into privacy rules?  We want to call some external services (casbin) from the rule functions. How to do that? One approach we can find is putting them to the context object but that is a bit cumbersome process.
Thanks,
Dilip

Hey @dilipkk-foyernet,
Can you explain a bit more about what you're trying to do? It sounds like you could use closures (example) to return a function that has access to casbin, but if you share a code example of where you're stuck it will be easier to assist.

Thanks @rotemtam  for the quick response. Yes, I am aware of the closures but the problem here is ent is injecting privacy rules into ent/runtime/runtime.go while generating the code from schema so injecting static dependencies should be possible but my dependencies will be available when the app starts so I am too sure how to approach this.
// Rule
func FilterProjectRule() privacy.QueryRule {
	type ProjectFilter interface {
		WhereHasProjectWith(...predicate.Project)
	}
	return privacy.FilterFunc(func(ctx context.Context, f privacy.Filter) error {
		userScope := ctx.Value(constants.UserScopeContextKey).(types.UserAuthScope)
		tf, ok := f.(ProjectFilter)
		if !ok {
			return privacy.Denyf("unexpected filter type %T", f)
		}
		tf.WhereHasProjectWith(project.IDEQ(userScope.ProjectID.ID))
		return privacy.Skip
	})
}

// Policy of the project-mixin.
func (ProjectMixin) Policy() ent.Policy {
	return privacy.Policy{
		Query: privacy.QueryPolicy{
			rule.FilterProjectRule(),
		},
		Mutation: privacy.MutationPolicy{
			rule.MutationProjectRule(),
		},
	}
}

This statically generates right? how can inject dynamic dependencies here into tule functions?

Hey hey @dilipkk-foyernet. It's great to see you here again 😃
Like you mentioned above, you can pass these dependencies on the context.Context, or you can attach them to all generated builders using templates. I created an example commit to show how to do it (https://github.com/ent/ent/commit/a21d8fe3b60643bb1cbea5df23d49b7035c101a1) - I actually use it as well.
In short, the usage is as follows:
c, err := ent.Open(..., ent.Casbin(...), ent.Cache(...), /* additional options */ )
// Then, you can access it from the privacy rules as follows:

// UseCasbinEnforcer is an example for a usage of casbin enforcer in a privacy policy rule.
func UseCasbinEnforcer() privacy.QueryRule {
	return privacy.UserQueryRuleFunc(func(ctx context.Context, q *ent.UserQuery) error {
		_ = q.Enforcer
		return privacy.Skip
	})
}

Let me know if you need more help with this.

Thanks a lot @a8m, I am also delighted to explore more features of this awesome package. Thanks a lot for your efforts on this.

@a8m One small issue I am facing with this now, we are using github.com/casbin/casbin/v2 but in the generated file it is taking v1. Is there a workaround for it?

You can tell ent (goimports) what packages to import using the same technique. I've updated the branch, see https://github.com/ent/ent/commit/626b577b9f7aaf6067b54810d3f2cfc8c2c370e1
We need to add this to our FAQ page with some example. Feel free to contribute this, or I'll add this later this week.

Worked like charm, Thanks again. I will add this to FAQ soon.

https://github.com/ent/ent/pull/1308


Cannot save a new record coming from a record page

Describe the bug
I'm having issues with saving records in a namespace in latest.cortezaproject.org: https://latest.cortezaproject.org/compose/ns/urbandataplatform/pages/167156202046750724. I don't see any error in the console, but it looks like an issue with related records.
To Reproduce
To reproduce how it's not working (coming from a record list on a record page):

Go to https://latest.cortezaproject.org/compose/ns/urbandataplatform/pages/167156202046750724 (list of Neighbourhoods)
Click on the first record: "Ballymeade"
Hit the add button in the "EV Charging Stations" record list block
Give the new EV Charging Station the name "test2"
Hit Save. -> Nothing happens

Steps on how it does work (coming from a record list on a list page):

Go to https://latest.cortezaproject.org/compose/ns/urbandataplatform/pages/167160997226741764 (list of EV Charging Stations)
Click on Add
Fill in the name "test2"
Select the Neighbourhood "Ballymeade"
Hit save

Expected behavior
Record would be saved
Desktop (please complete the following information):

Browser: Firefox (latest)

This is not an issue in the CRM or Service Solution namespaces... There it works good. The namespace above is new.

thanks @lennyhorstink, Jože will take a look at this.

@lennyhorstink nice catch !
I found the cause of the problem.
Ev Charging station has a Record Line editor on its record page called Ev Charging Station updates.
Creating a new record by accessing the record page through another page seems to bug out the record line editor.
The method resolveRecords in RecorListBase doesn't seem to register, therefore the submission fails since the Promise just hangs.
A simple refresh of the page makes it work again. I haven't been able to solve the problem yet. But the cause is now known.

Fixed in 313a0ed on develop
This is my favorite bug so far.
When you went from a record page to another record page these two conditions had to be met for the bug to happen:

Both of the pages have to have a recordList on the same block index
The recordList on the new page has to be editable(RecordLines)

This really was an edge case!
Again nice catch @lennyhorstink


fix(material/select): fix recursive call to SelectionModel.select()

Checks if option selection state in SelectionModel is different than the option selected value. Fixes "Maximum call stack size exceeded" error.
Fixes #12504

@crisbeto could you please review? It is a critical bug in our enterprise app.


Documentation: No clue how to run the application

Hey y'all, super interested in what you're working on. I cloned the repo to run it locally and see what's up, but there is not really any documentation surrounding what scripts to run and how to get it running properly. Updating the Readme with steps to run would be super helpful.
Some other helpful points of documentation:

What environment variables need to be set and where (especially for the frontend)
Which scripts to run when
The exact docker commands to run for the different environments (dev vs cloud)

Note: I get it seemingly close to running but when I go to localhost:8080 it white-screen-of-deaths on the /main route
Thanks y'all!

Hey there!
Thanks for pointing this out and for the interest you put in AgentLabs 😃
As specified in the README, the repository is under active development and not really at a stage where you could use it. That's the reason why there's no documentation at the moment because it would not make sense that anyone runs the project at this stage.
That being said, good news is we're actively building this and we plan to rollout an alpha version really soon!
Everything will be documented and running the project will be as simple as changing some environment variables and launching docker-compose up.
We'll also provide a cloud-based version for those who wanna quickly test or use the product without dealing with this.
Thanks again for your issue, it's motivating to see that people are eager for this project 🚀
And feel free to reach our anytime 👍

Just added more info in the README to make it clearer 😃
https://github.com/agentlabs-inc/agentlabs#alpha-release

Just added more info in the README to make it clearer 😃
https://github.com/agentlabs-inc/agentlabs#alpha-release

Great! Hey, I'd love to see a video demo of this 😄. I'm doing my best to run AgentLabs on local.