text:
Monotonic rewrite

See #873.

Hi @Finomnis , sorry for the delay on this!
Overall it looks like a very nice improvement of the monotonics. Would you like to cleanup the PR to get tests to start passing?
And please give us a ping when we can test it more :D

@korken89 Hey! Sorry for the delay, I was kinda busy with family and stuff. I'll start working on this now again, looking forward to your feedback.

TODO: Replace all mod _interrupt with a nested function in the generated start function. That way it's completely hidden.

@korken89 Bump :)

Is this planned for merging or is there still discussion or more to do?

Planned for merging, waiting for a review.

We just merged a large RISC-V support PR that has minor clashes with this PR, could you rebase?

Some minor comments

Busy at work RN, might take a look later :)

@korken89 Fixed

@Finomnis Could you please rebase on latest master branch and while doing that remove all merge commits?
Might also be a good opportunity to tidy a bit in the commit log 😇
If unsure how, I'm happy to help 👍

@Finomnis Could you please rebase on latest master branch and while doing that remove all merge commits?
Might also be a good opportunity to tidy a bit in the commit log 😇
If unsure how, I'm happy to help 👍

I planned to do a squash merge, if that's allright. I'm too lazy to clean them up :D

Why have you downgrade esp32c3 version?

Why have you downgrade esp32c3 version?

My bad. Merging gets out of hand with these kind of huge merge requests. I hope it is merged soon.

@AfoHT Is it alright with you if we squash merge?

@korken89 Did some minor fixes after merging the main branch, should be stable again

@Finomnis don't worry about the esp32c3 QEMU run :)
I'm in the process of squashing/tidying the PR which is about to be merged
But if you got more commits coming I can hold off a little, or we just create another PR. What do you think?
I'll bring in the https://github.com/rtic-rs/rtic/pull/874/commits/986f9594709c936605c7a42b69182d3b3c21b199 onto the squashed/rebased WIP I got :)

I took the liberty of tacking on a tiny CI fix, to get CI happy enough for a merge :)

Very nice

authors: AfoHT Finomnis SpinFast burrbull korken89

repo: rtic-rs/rtic


text:
Bug with bindings

Found a bug with binding multiple things when writing the self-hosted compiler.
See commit for a snapshot of the issue.
The problem looks something like this:
fn Parser.parse_type(*Parser: self) -> [Result<Opt<Token> HayError>] {
    // ...
    unary_match Result.unwrap as [op_tok]
        &op_tok Token.unary_operator as [result] {
            &result Result.is_err if {
                result Result.unwrap_err Result.Err::<Opt<Token> HayError> return
            } else {
                result Result.unwrap
            }
        }
        self Parser.parse_type as [result] {
            &result Result.is_err if {
                drop result Result.unwrap_err Result.Err::<Opt<Token> HayError> return
            } else {
                result Result.unwrap
            }
        }
        as [op maybe_type]

gets resolved when turned into:
fn Parser.parse_type(*Parser: self) -> [Result<Opt<Token> HayError>] {
    // ...
    unary_match Result.unwrap as [op_tok]
        &op_tok Token.unary_operator as [result] {
            &result Result.is_err if {
                result Result.unwrap_err Result.Err::<Opt<Token> HayError> return
            } else {
                result Result.unwrap
            }
        }
        as [op] // This is the change
        self Parser.parse_type as [result] {
            &result Result.is_err if {
                result Result.unwrap_err Result.Err::<Opt<Token> HayError> return
            } else {
                result Result.unwrap
            }
        }
        as [maybe_type]

So much of the compiler has changed since this snapshot. It's certainly possible for this to still exist, but it will be near impossible to recreate. i'm going to close this for now

source: gharchive/issue

repo: rtulip/haystack

license: MIT

license_type: permissive

license_source: github-api


text:
Soap Logs

is there a way to get access to the soap logs somehow?

I would also like to know this.

I have zero experience with SOAP. Does #34 cover the issue you have?

Hey @grevory
For the purposes of reporting bugs and/or DFP API difficulties, one must provide the SOAP logs over at the Google DFP API forums here https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api
At the moment, using this node module, there doesn't seem to be an easy way (as far as I know) to grab the last request made (unless you open up access to the soap client as I've done in #34)

I've made a PR to expose the last soap request body, as I needed the body to debug as well.
The internal soap client was not exposed and no reference was kept so I had to explictly expose it, and point to my forked solution.
I opened a PR for this feature: https://github.com/rubicon-project/node-google-dfp/pull/41
you use is as such:
dfpUser.getService('ReportService', function (err, service) {
  if (err) { /* log error */ )
  // build input ....
  const input = { ... }
  service.runReportjob(input, function (err, res) {
    // ...
    console.log(service._lastSoapRequest());
  });
});

Two tips for using this library:

check the official google dfp reference docs for specific types (xsi:type attribute is important!)
the order of the elements also seems to matter so avoid using things like prettier on the places where you build your input objects for soap calls

I guess this issue can now be closed now that the other PR doing the same thing was merged into master
https://github.com/rubicon-project/node-google-dfp/pull/34

@grevory this can be closed, since (as @Bennit says) #34 was already merged.

authors: AliUz Bennit grevory mvhirsch res-io serratedserenade

repo: rubicon-project/node-google-dfp

license: ISC


text:
Add new Style/MapToSet cop

Fixes #11339.
This PR adds new Style/MapToSet cop
This cop looks for uses of map.to_set or collect.to_set that could be written with just to_set. It is unsafe, as it can produce false positives if the receiver is not an Enumerable.
# bad
something.map { |i| i * 2 }.to_set

# good
something.to_set { |i| i * 2 }

# bad
[1, 2, 3].collect { |i| i.to_s }.to_set

# good
[1, 2, 3].to_set { |i| i.to_s }

Before submitting the PR make sure the following are checked:

[x] The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
[x] Wrote good commit messages.
[x] Commit message starts with [Fix #issue-number] (if the related issue exists).
[x] Feature branch is up-to-date with master (if not - rebase it).
[x] Squashed related commits together.
[x] Added tests.
[x] Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
[x] Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

Thanks!

source: gharchive/pull-request

authors: bbatsov koic

repo: rubocop/rubocop


text:
Use Turbolinks 3.0

某些不会更新的地方用 3.0 的新功能实现不再处理，减少 Dom 渲染;
去掉直接的 JS，用 Turbolinks 相关的 Gem;
Turbolinks 是 Master 的代码，还未发布的，但看起来问题不大；

大致测试了一遍，暂时未发现问题，可以先上去跑跑看。

@chloerei 昨天尝试的时候看起来是可行的，这样 Head 区域不用 Dom 替换了。
不过今早想了想，还是算了，保守点，免得有问题。

Turboliniks 本身不替换 head，temporary 都是对于 body 的。

authors: chloerei huacnlee

repo: ruby-china/ruby-china


text:
Calculate the default for index relative to git_dir instead of work_tree

Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.

[x] Ensure all commits include DCO sign-off.
[x] Ensure that your contributions pass unit testing.
[x] Ensure that your contributions contain documentation if applicable.

Description
index when not given, defaults to "#{work_tree}/.git/index".  This only works as long as git_dir is "#{work_tree}/.git". In the general case, the index default should be #{git_dir}/index.
This PR adds two tests:

TestGitDir#test_index_calculated_from_git_dir which tests that index is calculated correctly when git_dir is not "#{work_tree}/.git/index"
TestGitDir#test_git_dir_outside_work_tree which tests that when git_dir is in a non-standard location, Git.open and option functions work.

Fix the case in Base#open where the --git-dir is a file as is the case with Submodules and (non-main) Worktrees.  This case was handled for Base.init but not Base.open.
tests/test_helper.rb was changed so that MiniTest classes that do not call set_file_paths do not output a warning because @tmp_path is referenced without being defined.

@solawing reported the following in #479:

git diff in worktree is broken. report index file open failed: Not a directory. and debug, the GIT_INDEX_FILE environment is set to wrong path

@solawing I am having a hard time reproducing your problem.  Can you provide a reproduction recipe?  If you can do that, I'll make sure that there is a test for what you are reporting and that this change addresses the issue.

@SolaWing reported the following in #479:

git diff in worktree is broken. report index file open failed: Not a directory. and debug, the GIT_INDEX_FILE environment is set to wrong path

@SolaWing I am having a hard time reproducing your problem. Can you provide a reproduction recipe? If you can do that, I'll make sure that there is a test for what you are reporting and that this change addresses the issue.

Reproduce script:
mkdir git_root
cd git_root
git init
git commit --allow-empty -m 'init'
git worktree add child
cd child/
ruby -rgit -e 'Git.open(".").diff.to_a'
# clean
cd ../..
rm -rf git_root

@SolaWing I have added the test TestGitDir::test_git_diff_to_a which fails in the way you describe without this change and succeeds with this change.

nice!

authors: SolaWing jcouball robertxyz

repo: ruby-git/ruby-git


text:
Breaking change for nested params in declared in Grape 1.3.3

A PR was merged back in April and included in Grape 1.3.3 that has changed the way declared works.
https://github.com/ruby-grape/grape/pull/2043
Before this PR was merged, the declared helper would guarantee that the entire params structure would be recreated, including deeply nested parameters. Any leaf params not provided would have nil values.
With this merged PR, any missing Hash params would be evaluated as {}, even if they has deeper nested params defined.
Here is an example from endpoint_spec.rb. The params are defined as:
subject.params do
  requires :first
  optional :second
  optional :third, default: 'third-default'
  optional :nested, type: Hash do
    optional :fourth
    optional :fifth
    optional :nested_two, type: Hash do
      optional :sixth
      optional :nested_three, type: Hash do
        optional :seventh
      end
    end
    optional :nested_arr, type: Array do
      optional :eighth
    end
  end
  optional :arr, type: Array do
    optional :nineth
  end
end

Given a test that calls get '/declared?first=present', the result of declared(params) would be:
In Grape 1.3.2:
{
  "first": "present",
  "second": null,
  "third": "third-default",
  "nested": {
    "fourth": null,
    "fifth": null,
    "nested_two": {
      "sixth": null,
      "nested_three": {
        "seventh": null
      }
    }
  },
  "nested_arr": []
}

In Grape 1.3.3:
{
  "first": "present",
  "second": null,
  "third": "third-default",
  "nested": {},
  "arr": []
}

It is not clear which of these is the correct behavior. The merged PR https://github.com/ruby-grape/grape/pull/2043 would suggest that the latter is correct, however it is actually very useful to have the previous behavior from 1.3.2.
The README isn't clear about what the behavior should be for deeply nested params.

Ouch, this keeps biting us, cc: @kadotami and @dnesteryuk.
Naively reading our own README it feels like if you say include_missing: true, we should get the entire structure. Do you want to attempt a change/fix for this and see whether we are breaking any specs? Reading #2043 it feels that we simply didn't consider this, but I could be wrong.

My interpretation is that you should get the whole (aka declared) structure, and there are certainly benefits to that behavior. The specs before https://github.com/ruby-grape/grape/pull/2043 were ambiguous - there was no spec that definitively asserted or refuted the behavior.
If we can get a definitive design decision from the maintainers of Grape one way or the other I would be happy to submit a PR to update the README /  code / specs.

Just for a bit of additional context, we have many use cases that looks something like this:
params do
  optional :filter, type: Hash do
    optional :widgets, type: Hash do
      optional :name, type: String
    end
    optional :gadgets, type: Hash do
      optional :name, type: String
    end
  end
end

In the API body, we would be able to go:
filter = declared(params)[:filter]
filter_by_widget_name if filter[:widgets][:name].present?

In Grape 1.3.2 this would work fine.
In Grape 1.3.3 this would fail with a undefined method []' for nil:NilClasserror due tofilter[:widgets]beingnil`.
If we were to preserve the existing behavior, the API code would need to change to something like:
filter = declared(params)[:filter]
filter_by_widget_name if filter.dig(:widgets, :name).present?

My interpretation is that you should get the whole (aka declared) structure, and there are certainly benefits to that behavior. The specs before #2043 were ambiguous - there was no spec that definitively asserted or refuted the behavior.
If we can get a definitive design decision from the maintainers of Grape one way or the other I would be happy to submit a PR to update the README / code / specs.

I vote for expanding deep as you suggest. If others can add a +1 that'd be great.

authors: dblock tlconnor

repo: ruby-grape/grape


text:
fix a performance issue with dependent params

Fixes https://github.com/ruby-grape/grape/issues/2100
The reason was in ActiveSupport::HashWithIndifferentAccess, it is super expensive.
When users use a Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder or Grape::Extensions::Hashie::Mash::ParamBuilder parameter builder there is no change. However, users who use Grape::Extensions::Hash::ParamBuilder must make sure a parameter to be dependent on must be a symbol.
given :matrix do
  # block here
end

Benchmark after this fix:
Warming up --------------------------------------
               Given     1.000  i/100ms
              Simple     1.000  i/100ms
Calculating -------------------------------------
               Given      0.804  (± 0.0%) i/s -     49.000  in  61.186831s
              Simple      0.855  (± 0.0%) i/s -     52.000  in  60.926097s

Comparison:
              Simple:        0.9 i/s
               Given:        0.8 i/s - 1.06x  slower

@dblock please, have a look again. thanks.


text:
Remove unused maximum_passkeys_per_user; not the gem's concern

The :maximum_passkeys_per_user attribute is legacy code from the early experiments in the gem (see: https://github.com/ruby-passkeys/devise-passkeys/blob/main/lib/devise/passkeys/passkey_issuer.rb#L38).
And validations/limits on the number of passkeys that can be created should be handled by the app itself. This keeps the gem focused, reduces our maintenance overhead, and gives implementors control over the exact behavior

@tcannonfodder I can take this issue when I return home.

Created a pull request for this issue: https://github.com/ruby-passkeys/devise-passkeys/pull/41

repo: ruby-passkeys/devise-passkeys


text:
Weird require 'enumerator' issue caused by this gem

Hi,
I'm in the process of upgrading our Rails app to version 6 on Ruby 2.7.5, and have encountered a weird interaction between three gems: this one, bio ruby and ruby-progressbar.
It seems that when having ruby-progressbar loaded when this gem is loaded, something breaks that then causes require 'enumerator' (used in bioruby) to cause:
`require': cannot load such file -- enumerator (LoadError)

It seems to happen because ruby-progressbar includes a file named enumerator.rb.
I've created a minimal repository that reproduces this error: https://github.com/fbacall/rdf-issue

Ruby RDF also has an enumerator class, but loading should honor module pathing. What makes you suspect that the issue is in rdf and not one of the other gems?

I tried various combinations of the affected gems, and each one individually.
In my repo above I don't use any gems except linkeddata, and a very basic require of an enumerator.rb file under a sub path/namespace.
Admittedly I can't see where the problem is in rdf-ruby.
It seems something to do with these autoload statements: https://github.com/ruby-rdf/rdf/blob/develop/lib/rdf/mixin/queryable.rb#L12
If I hack the gem source locally and  rename rdf/mixin/enumerator.rb to enumerator2.rb (and update the autoloads) the problem goes away. Perhaps this is a Ruby bug?

Autoload is fairly mysterious. I can probably replace Enumerator to be a require_local instead of an autoload, but I won’t be able to get to it until next week at the earliest. You might try cloning GitHub.com/Ruby-rdf/rdf and make the change yourself to see if that addresses the issue properly.

authors: fbacall gkellogg

repo: ruby-rdf/linkeddata

license: unlicense

license_source: bigquery


text:
Document and reorganize ThreadClient

Similar methods are now closer together, for example #to_s is now next to #inspect.
Command-specific methods are grouped by the command.
Comments are added for different sections.

Maybe it is not an command (confusing with debug command), but okay (I'll change when I find another term)

I took the cmd term from
https://github.com/ruby/debug/blob/5e7cba4eead1265f3bbbf0a5d45e25d67b150121/lib/debug/thread_client.rb#L580
It's hard to use find a proper term because the cmd can be either verb (show or eval) or noun (frame or breakpoint). If we can convert nouns to verbs (frame -> switch_frame) we can name it action?
Or we can rename cmd  as category, which I think fits here but is a little too generalized.

ah, I see. sorry. It means message between thread and debugger (session) and message contains a command.

So there are:

User commands
Session to Thread commands

Perhaps we can name the latter as Session to Thread instructions?

I added https://github.com/ruby/debug/pull/200 as a demonstration.

repo: ruby/debug


text:
Fix to parse command-style method calls more correctly

Fix #1468
Fix #1575
To decide whether command-style method calls are allowed, this introduces a new parameter accepts_command_call to parse_expression and some functions.
Although one thinks this can be solved by operator precedence, it is hard or impossible, because the precedence of command-style calls is skewed (e.g. ! bar 1  is accepted, but foo = ! bar 1 and !! bar 1 are rejected.)
One of the most complex examples is that:

Even though foo = bar = baz 1 and foo, bar = baz 1 are accepted,
foo, bar = baz = fuzz 1 is rejected.

To implement this behavior, this introduces a new binding power PM_BINDING_POWER_MULTI_ASSIGNMENT and uses it to distinguish which single assignments or multi assignments at their RHS.

Rebasing is done.

repo: ruby/prism


text:
handle missing HEREDOC endline at start of heredoc

Found via: https://github.com/BlakeWilliams/backbone_handlebars/blob/master/lib/backbone_handlebars/template.rb#L30

Somehow I rebased this branch into oblivion. Re-opened here: https://github.com/ruby/yarp/pull/1278

repo: ruby/yarp


text:
README bug - Discord server link is invalid

Discord server link is invalid. It doesnt work.

There you go, fixed.

authors: rubybb spjoes

repo: rubybb/modrinth


text:
1101 I have changed the donation issued at filter to be to/from and t…

This adds a date range filter to the donations page. It has not been tested yet.

This works great so far - let's tighten up the CSS a little and it should be ready to go!

I ended up taking over this work in #1176 - closing this one

authors: duaimei mdworken

repo: rubyforgood/diaper

license: mit


text:
Add the ability for bank users to create and assign Item Categories

Resolves #2359
Description
This PR gives bank users the ability to define their own Item Categories. The long term goal of this feature is to be able to control which item categories can be requested by select partners.
Here are some notable changes:

Added ItemCategory table and scope to organization
Remove 'Base Item' column in the Items table (seemed redundant)

Type of change

New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added system tests via magic_test!
Tested locally

Screenshots

@albertchae @scooter-dangle can I get a review on this please

repo: rubyforgood/human-essentials


text:
Fix and update seed file

This PR is a follow-up ticket of PR #666 and does following:

removes variable names that are not being called and replaces with print text
fixes not working admin interpolation

@1000miles cool :) Good to have you onboard and setting up so many things <3


text:
Folder Structure and Naming Conventions

The folder structure of the project is a bit odd in some places, owing to the fact that it has been left to grow organically for so long. Examples of this are

src/component-library folder (can be flattened)
component-library/components folder (can be cleaned -- some files are floating around outside of the newly established hierarchy)
API routes under source/app
... and others

[ ] Clean these up!

In addition, it might make sense to do the following

[ ] Come up with naming conventions (or formalise the ones which already exist) and put them into writing.

Components cleaned up in #266

repo: rucio/webui


text:
Sources navigation changes

Adjusts sidebar.js to conform to new IA

TODO

[ ] Write landing page content
[ ] move folders, update paths

The sidebar has quite evolved during our day, so you might need to resolve its conflicts :)
The structure looks fine to me. Although, wanna understand how to create/update the sources.yaml.

repo: rudderlabs/rudderstack-docs


text:
[meta] Tracking issue for r0.6.0 compatibility

Based on the changelog for r0.6.0. ToDo: Add new endpoints, implement upstream changes, review spec clarifications.
Breaking Changes

[x] Add id_access_token as a required request parameter to a few endpoints which require an id_server parameter as part of MSC2140. (https://github.com/matrix-org/matrix-doc/issues/2255)

New Endpoints

[x] Add POST /account/3pid/unbind for removing a 3PID from an identity server. (https://github.com/matrix-org/matrix-doc/issues/2282)

Backwards Compatible Changes

[x] Add M_USER_DEACTIVATED error code. (https://github.com/matrix-org/matrix-doc/issues/2234): #135
[x] Remove bind_msisdn and bind_email from /register now that the identity server's bind endpoint requires authentication. (https://github.com/matrix-org/matrix-doc/issues/2279)
[x] Add m.identity_server account data for tracking the user's preferred identity server. (https://github.com/matrix-org/matrix-doc/issues/2281)
[x] Deprecate id_server and make it optional in several places. (https://github.com/matrix-org/matrix-doc/issues/2310)

Spec Clarifications

[x] Add missing format fields to m.room.message$m.notice schema. (https://github.com/matrix-org/matrix-doc/issues/2125)
[x] Remove "required" designation from the url field of certain m.room.message msgtypes. (https://github.com/matrix-org/matrix-doc/issues/2129)
[x] Clarify the distinction between m.key.verification.start and its m.sas.v1 variant. (https://github.com/matrix-org/matrix-doc/issues/2132)
[x] Fix link to Olm signing specification. (https://github.com/matrix-org/matrix-doc/issues/2133)
[x] Clarify the conditions for the .m.rule.room_one_to_one push rule. (https://github.com/matrix-org/matrix-doc/issues/2152)
[x] Clarify the encryption algorithms supported by the device of the device keys example. (https://github.com/matrix-org/matrix-doc/issues/2157)
[x] Clarify that /rooms/:roomId/event/:eventId returns a Matrix error. (https://github.com/matrix-org/matrix-doc/issues/2204)
[x] Add a missing state_key check on .m.rule.tombstone. (https://github.com/matrix-org/matrix-doc/issues/2223)
[x] Fix the m.room_key_request action value, setting it from cancel_request to request_cancellation. (https://github.com/matrix-org/matrix-doc/issues/2247)
[x] Clarify that the submit_url field is without authentication. (https://github.com/matrix-org/matrix-doc/issues/2341)
[x] Clarify the expected phone number format. (https://github.com/matrix-org/matrix-doc/issues/2342)
[x] Clarify that clients should consider not requesting URL previews in encrypted rooms. (https://github.com/matrix-org/matrix-doc/issues/2343)
[x] Add missing information on how filters are meant to work with /context. (https://github.com/matrix-org/matrix-doc/issues/2344)
[x] Clarify what the keys are for rooms in /sync. (https://github.com/matrix-org/matrix-doc/issues/2345)

This can be closed :)

authors: iinuwa jplatte

repo: ruma/ruma-client-api


text:
Update sync endpoint

The following modifications to the GET /sync endpoint  need to be made:

Add online and unavailable variants to SetPresence (0.4.0/matrix-org/matrix-doc#1141)
Add device_one_time_keys_count to response (0.4.0/matrix-org/matrix-doc#1284)
Add to_device parameter

There may be other changes necessary, so so the spec documentation for more information.

I'm starting on this one. I'll wait till #123 is merged though.

@jplatte, it looks like you added this TODO comment. Were you thinking to add a collection of AccountData events to ruma-events?

I'm not sure, that comment is clearly incomplete :man_facepalming:
It seems likely that's what that comment should have been about. But I'm not sure whether there even is a distinction to be made between AccountData events and the current collections::only::Events / NonRoomEvents.

It doesn't seem like the spec on Client Config/Account Data has anything to say about what types of events can go in Account Data. It can probably just stay as a collection of NonRoomEvents.


text:
[Bug]: TypeError when saving message to ChatStore if return_direct=True was used in QueryEngineTool

Bug Description
This error occurs in the finalize_task function of the OpenAIAgentWorker class, which is used inside OpenAIAgent. It occurs when it tries to save messages to the Azure Chat Store. While saving the metadata that shows the tools used during the agent's work, the error TypeError: 'MockValSer' object cannot be converted to 'SchemaSerializer' occurs. By and large, the error is due to a bug inside AzureChatStore.
Version of llama-index-storage-chat-store-azure - 0.2.0
Version
0.11.16
Steps to Reproduce
index = VectorStoreIndex.from_documents([ <your docs>])

tool = QueryEngineTool.from_defaults(
    name='name',
    query_engine=index.as_query_engine(),
    description='description',
    return_direct=True,
)

chat_store = AzureChatStore.from_account_and_key(
    account_name='name',
    account_key='key',
)

memory = ChatMemoryBuffer.from_defaults(
    token_limit=5000,
    chat_store=chat_store,
    chat_store_key='1',
)

agent = OpenAIAgent.from_tools(
    [tool],
    memory=memory,
)

await agent.achat('tool-related query')

Relevant Logs/Tracbacks
2024-10-07 16:57:44,320 - main - ERROR - Traceback (most recent call last):
  File "...\.venv\Lib\site-packages\botbuilder\core\bot_adapter.py", line 174, in run_pipeline
    return await self._middleware.receive_activity_with_status(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 69, in receive_activity_with_status
    return await self.receive_activity_internal(context, callback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 79, in receive_activity_internal
    return await callback(context)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\botbuilder\core\activity_handler.py", line 70, in on_turn
    await self.on_message_activity(turn_context)
  File "......\common\azure_message_logger.py", line 29, in wrapper
    response, rag_message = await func(self, turn_context, *args, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "......\bot\hr_bot.py", line 55, in on_message_activity
    response = await self.chat_service.agent_chat(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "......\common\chat_service.py", line 53, in agent_chat
    return await agent.achat(query)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py", line 353, in async_wrapper
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\callbacks\utils.py", line 56, in async_wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\agent\runner\base.py", line 672, in achat
    chat_response = await self._achat(
                    ^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py", line 353, in async_wrapper
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\agent\runner\base.py", line 625, in _achat
    result = self.finalize_response(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py", line 307, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\agent\runner\base.py", line 549, in finalize_response
    self.agent_worker.finalize_task(self.state.get_task(task_id))
  File "...\.venv\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py", line 307, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\agent\openai\step.py", line 784, in finalize_task
    task.memory.put_messages(task.extra_state["new_memory"].get_all())
  File "...\.venv\Lib\site-packages\llama_index\core\memory\types.py", line 51, in put_messages
    self.put(message)
  File "...\.venv\Lib\site-packages\llama_index\core\memory\types.py", line 99, in put
    self.chat_store.add_message(self.chat_store_key, message)
  File "...\.venv\Lib\site-packages\llama_index\storage\chat_store\azure\base.py", line 237, in add_message
    **message.dict(),
      ^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\base\llms\types.py", line 110, in dict
    return self.model_dump(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\llama_index\core\base\llms\types.py", line 114, in model_dump
    msg = super().model_dump(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\pydantic\main.py", line 390, in model_dump
    return self.__pydantic_serializer__.to_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'MockValSer' object cannot be converted to 'SchemaSerializer'

The issue is coming from calling message.dict() on a message in the chat history (likely a response from the LLM). This is unrelated to the chat store being used tbh
Seems like an issue with the serialization logic in general with pydantic v2

authors: MarkHmnv logan-markewich


text:
[Bug]:

Bug Description
Multi-Document Agents.
You need to add additional code for OpenAI Key under setup and demo
Current:
llm = OpenAI(temperature=0, model="gpt-3.5-turbo")
service_context = ServiceContext.from_defaults(llm=llm)
Recommended:
import openai
Set the API key
openai.api_key =
llm = OpenAI(temperature=0, model="gpt-3.5-turbo")
service_context = ServiceContext.from_defaults(llm=llm)
Version
llama_index-0.8.44-py3-none-any.whl
Steps to Reproduce
Run
llm = OpenAI(temperature=0, model="gpt-3.5-turbo")
service_context = ServiceContext.from_defaults(llm=llm)
will throw an error of no API Key
Relevant Logs/Tracbacks
No response

Adding the following will address the issue.
import openai
Set the API key
openai.api_key = <add your secret key from OpenAI - you will need to setup and OpenAI account to get one>

Thanks for raising the issue! A lot of the notebook right now assume user has OpenAI API key configured as part of the environment variables.
If you are up for it, would love to have your help on making this more explicit. Feel free to directly make PR against the file, should be here (https://github.com/run-llama/llama_index/blob/main/docs/examples/agent/multi_document_agents.ipynb).

authors: Disiok dougsmithstpete


text:
[Bug]: 【Urgent】【Azure OpenAI Embeddings】TypeError: 'NoneType' object is not iterable

Bug Description
There was an error when I followed this tutorial to implement Azure OpenAI Embedding
https://docs.llamaindex.ai/en/latest/examples/customization/llms/AzureOpenAI.html#
The Code：
`from llama_index.llms import AzureOpenAI
from llama_index.embeddings import AzureOpenAIEmbedding
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
import logging
import sys
logging.basicConfig(
stream=sys.stdout, level=logging.INFO
)  # logging.DEBUG for more verbose output
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
api_key = "xxx"
azure_endpoint = "https://xxxxxxx/azure"
api_version = "2023-06-01-preview"
llm = AzureOpenAI(
model="gpt-35-turbo-16k",
deployment_name="my-custom-llm",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
embed_model = AzureOpenAIEmbedding(
model="text-embedding-ada-002",
deployment_name="my-custom-embedding",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
from llama_index import set_global_service_context
service_context = ServiceContext.from_defaults(
llm=llm,
embed_model=embed_model,
)
set_global_service_context(service_context)
documents = SimpleDirectoryReader(
input_files=["/mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt"]
).load_data()
index = VectorStoreIndex.from_documents(documents)
`

TypeError                                 Traceback (most recent call last)
/mnt/workspace/workgroup/lengmou/TARS-Code/LlamaIndex/test.ipynb Cell 4 line 4
1 documents = SimpleDirectoryReader(
2     input_files=["/mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt"]
3 ).load_data()
----> 4 index = VectorStoreIndex.from_documents(documents)
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/base.py:102, in BaseIndex.from_documents(cls, documents, storage_context, service_context, show_progress, **kwargs)
97     docstore.set_document_hash(doc.get_doc_id(), doc.hash)
98 nodes = service_context.node_parser.get_nodes_from_documents(
99     documents, show_progress=show_progress
100 )
--> 102 return cls(
103     nodes=nodes,
104     storage_context=storage_context,
105     service_context=service_context,
106     show_progress=show_progress,
107     **kwargs,
108 )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py:49, in VectorStoreIndex.init(self, nodes, index_struct, service_context, storage_context, use_async, store_nodes_override, show_progress, **kwargs)
47 self._use_async = use_async
48 self._store_nodes_override = store_nodes_override
---> 49 super().init(
50     nodes=nodes,
51     index_struct=index_struct,
52     service_context=service_context,
53     storage_context=storage_context,
54     show_progress=show_progress,
55     **kwargs,
56 )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/base.py:71, in BaseIndex.init(self, nodes, index_struct, storage_context, service_context, show_progress, **kwargs)
69 if index_struct is None:
70     assert nodes is not None
---> 71     index_struct = self.build_index_from_nodes(nodes)
72 self._index_struct = index_struct
73 self._storage_context.index_store.add_index_struct(self._index_struct)
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py:254, in VectorStoreIndex.build_index_from_nodes(self, nodes, **insert_kwargs)
243 def build_index_from_nodes(
244     self,
245     nodes: Sequence[BaseNode],
246     **insert_kwargs: Any,
247 ) -> IndexDict:
248     """Build the index from nodes.
249
250     NOTE: Overrides BaseIndex.build_index_from_nodes.
251         VectorStoreIndex only stores nodes in document store
252         if vector store does not store text
253     """
--> 254     return self._build_index_from_nodes(nodes, **insert_kwargs)
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py:235, in VectorStoreIndex._build_index_from_nodes(self, nodes, **insert_kwargs)
233     run_async_tasks(tasks)
234 else:
--> 235     self._add_nodes_to_index(
236         index_struct,
237         nodes,
238         show_progress=self._show_progress,
239         **insert_kwargs,
240     )
241 return index_struct
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py:188, in VectorStoreIndex._add_nodes_to_index(self, index_struct, nodes, show_progress, **insert_kwargs)
185 if not nodes:
186     return
--> 188 nodes = self._get_node_with_embedding(nodes, show_progress)
189 new_ids = self._vector_store.add(nodes, **insert_kwargs)
191 if not self._vector_store.stores_text or self._store_nodes_override:
192     # NOTE: if the vector store doesn't store text,
193     # we need to add the nodes to the index struct and document store
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py:100, in VectorStoreIndex._get_node_with_embedding(self, nodes, show_progress)
89 def _get_node_with_embedding(
90     self,
91     nodes: Sequence[BaseNode],
92     show_progress: bool = False,
93 ) -> List[BaseNode]:
94     """Get tuples of id, node, and embedding.
95
96     Allows us to store these nodes in a vector store.
97     Embeddings are called in batches.
98
99     """
--> 100     id_to_embed_map = embed_nodes(
101         nodes, self._service_context.embed_model, show_progress=show_progress
102     )
104     results = []
105     for node in nodes:
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/indices/utils.py:137, in embed_nodes(nodes, embed_model, show_progress)
134     else:
135         id_to_embed_map[node.node_id] = node.embedding
--> 137 new_embeddings = embed_model.get_text_embedding_batch(
138     texts_to_embed, show_progress=show_progress
139 )
141 for new_id, text_embedding in zip(ids_to_embed, new_embeddings):
142     id_to_embed_map[new_id] = text_embedding
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/embeddings/base.py:250, in BaseEmbedding.get_text_embedding_batch(self, texts, show_progress)
244 if idx == len(texts) - 1 or len(cur_batch) == self.embed_batch_size:
245     # flush
246     with self.callback_manager.event(
247         CBEventType.EMBEDDING,
248         payload={EventPayload.SERIALIZED: self.to_dict()},
249     ) as event:
--> 250         embeddings = self._get_text_embeddings(cur_batch)
251         result_embeddings.extend(embeddings)
252         event.on_end(
253             payload={
254                 EventPayload.CHUNKS: cur_batch,
255                 EventPayload.EMBEDDINGS: embeddings,
256             },
257         )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/embeddings/openai.py:344, in OpenAIEmbedding._get_text_embeddings(self, texts)
337 def _get_text_embeddings(self, texts: List[str]) -> List[List[float]]:
338     """Get text embeddings.
339
340     By default, this is a wrapper around _get_text_embedding.
341     Can be overridden for batch queries.
342
343     """
--> 344     return get_embeddings(
345         self._client,
346         texts,
347         engine=self._text_engine,
348         **self.additional_kwargs,
349     )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/tenacity/init.py:289, in BaseRetrying.wraps..wrapped_f(*args, **kw)
287 @functools.wraps(f)
288 def wrapped_f(*args: t.Any, **kw: t.Any) -> t.Any:
--> 289     return self(f, *args, **kw)
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/tenacity/init.py:379, in Retrying.call(self, fn, *args, **kwargs)
377 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
378 while True:
--> 379     do = self.iter(retry_state=retry_state)
380     if isinstance(do, DoAttempt):
381         try:
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/tenacity/init.py:314, in BaseRetrying.iter(self, retry_state)
312 is_explicit_retry = fut.failed and isinstance(fut.exception(), TryAgain)
313 if not (is_explicit_retry or self.retry(retry_state)):
--> 314     return fut.result()
316 if self.after is not None:
317     self.after(retry_state)
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/concurrent/futures/_base.py:439, in Future.result(self, timeout)
437     raise CancelledError()
438 elif self._state == FINISHED:
--> 439     return self.__get_result()
441 self._condition.wait(timeout)
443 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/concurrent/futures/_base.py:391, in Future.__get_result(self)
389 if self._exception:
390     try:
--> 391         raise self._exception
392     finally:
393         # Break a reference cycle with the exception in self._exception
394         self = None
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/tenacity/init.py:382, in Retrying.call(self, fn, *args, **kwargs)
380 if isinstance(do, DoAttempt):
381     try:
--> 382         result = fn(*args, **kwargs)
383     except BaseException:  # noqa: B902
384         retry_state.set_exception(sys.exc_info())  # type: ignore[arg-type]
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/llama_index/embeddings/openai.py:161, in get_embeddings(client, list_of_text, engine, **kwargs)
157 assert len(list_of_text) <= 2048, "The batch size should not be larger than 2048."
159 list_of_text = [text.replace("\n", " ") for text in list_of_text]
--> 161 data = client.embeddings.create(input=list_of_text, model=engine, **kwargs).data
162 return [d.embedding for d in data]
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/resources/embeddings.py:106, in Embeddings.create(self, input, model, encoding_format, user, extra_headers, extra_query, extra_body, timeout)
100         embedding.embedding = np.frombuffer(  # type: ignore[no-untyped-call]
101             base64.b64decode(data), dtype="float32"
102         ).tolist()
104     return obj
--> 106 return self._post(
107     "/embeddings",
108     body=maybe_transform(params, embedding_create_params.EmbeddingCreateParams),
109     options=make_request_options(
110         extra_headers=extra_headers,
111         extra_query=extra_query,
112         extra_body=extra_body,
113         timeout=timeout,
114         post_parser=parser,
115     ),
116     cast_to=CreateEmbeddingResponse,
117 )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/_base_client.py:1088, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls)
1074 def post(
1075     self,
1076     path: str,
(...)
1083     stream_cls: type[_StreamT] | None = None,
1084 ) -> ResponseT | _StreamT:
1085     opts = FinalRequestOptions.construct(
1086         method="post", url=path, json_data=body, files=to_httpx_files(files), **options
1087     )
-> 1088     return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/_base_client.py:853, in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls)
844 def request(
845     self,
846     cast_to: Type[ResponseT],
(...)
851     stream_cls: type[_StreamT] | None = None,
852 ) -> ResponseT | _StreamT:
--> 853     return self._request(
854         cast_to=cast_to,
855         options=options,
856         stream=stream,
857         stream_cls=stream_cls,
858         remaining_retries=remaining_retries,
859     )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/_base_client.py:932, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls)
928         err.response.read()
930     raise self._make_status_error_from_response(err.response) from None
--> 932 return self._process_response(
933     cast_to=cast_to,
934     options=options,
935     response=response,
936     stream=stream,
937     stream_cls=stream_cls,
938 )
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/_base_client.py:518, in BaseClient._process_response(self, cast_to, options, response, stream, stream_cls)
515 if response.request.headers.get(RAW_RESPONSE_HEADER) == "true":
516     return cast(ResponseT, api_response)
--> 518 return api_response.parse()
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/_response.py:63, in APIResponse.parse(self)
61 parsed = self._parse()
62 if is_given(self._options.post_parser):
---> 63     parsed = self._options.post_parser(parsed)
65 self._parsed = parsed
66 return parsed
File /mnt/workspace/workgroup/lengmou/miniconda3/envs/llamaindex/lib/python3.9/site-packages/openai/resources/embeddings.py:94, in Embeddings.create..parser(obj)
90 if is_given(encoding_format):
91     # don't modify the response object if a user explicitly asked for a format
92     return obj
---> 94 for embedding in obj.data:
95     data = cast(object, embedding.embedding)
96     if not isinstance(data, str):
97         # numpy is not installed / base64 optimisation isn't enabled for this model yet
TypeError: 'NoneType' object is not iterable
Could you please help me take a look at this issue? Thank you！
Version
0.9.16.post1
Steps to Reproduce
`from llama_index.llms import AzureOpenAI
from llama_index.embeddings import AzureOpenAIEmbedding
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
import logging
import sys
logging.basicConfig(
stream=sys.stdout, level=logging.INFO
)  # logging.DEBUG for more verbose output
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
api_key = "xxx"
azure_endpoint = "https://xxxxxxx/azure"
api_version = "2023-06-01-preview"
llm = AzureOpenAI(
model="gpt-35-turbo-16k",
deployment_name="my-custom-llm",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
embed_model = AzureOpenAIEmbedding(
model="text-embedding-ada-002",
deployment_name="my-custom-embedding",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
from llama_index import set_global_service_context
service_context = ServiceContext.from_defaults(
llm=llm,
embed_model=embed_model,
)
set_global_service_context(service_context)
documents = SimpleDirectoryReader(
input_files=["/mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt"]
).load_data()
index = VectorStoreIndex.from_documents(documents)
`
Relevant Logs/Tracbacks
No response

🤖
Hello @pydaxing, nice to meet you! 😊 I'm Dosu, a bot here to assist you with bugs, answer your questions, and help you become a contributor while we wait for a human maintainer. Don't worry, we'll dive into this issue of yours together. 🦙
The error you're encountering, TypeError: 'NoneType' object is not iterable, typically occurs when a function or operation is trying to iterate over an object of NoneType. In your case, this error might be happening because the documents parameter passed to the VectorStoreIndex.from_documents(documents) function is None.
In the code you provided, documents is the result of the SimpleDirectoryReader.load_data() method. If the input_files parameter passed to this method is None, does not exist, or does not contain any valid data, the documents list would be empty. This could lead to a NoneType error when trying to iterate over documents in the VectorStoreIndex.from_documents(documents) function.
To resolve this issue, you should ensure that the input_files parameter passed to the SimpleDirectoryReader.load_data() method contains valid file paths and that these files contain valid data. You can add a check at the beginning of the load_data method to return an error if input_files is None, does not exist, or is empty:
def load_data(self):
    """Load data from the directory."""
    if not self.input_files or not all(os.path.exists(file) for file in self.input_files):
        raise ValueError("No valid input files to load data from")

    # rest of the code

This will ensure that the load_data method does not proceed if there are no valid input files to load data from, preventing the NoneType error.
If you're still encountering the issue after checking the input files, it would be helpful if you could provide more information about the contents of the input files and the exact error message you're receiving. This will help in diagnosing the issue further.
For more information about the SimpleDirectoryReader.load_data() method and the VectorStoreIndex.from_documents(documents) function, you can refer to the LlamaIndex documentation.
I hope this helps! If you have any other questions, feel free to ask.
Best, Dosu
Sources

llama_index/vector_stores/cogsearch.py

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.

Thank you for your reply. I have checked the file path and found that it exists. The content inside the file is also present, which is Hello World!
The file: /mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt
The content in it is: Hello World!
The output of the documents, I have print the documents. The result is below
documents = SimpleDirectoryReader(input_files=["/mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt"]).load_data()
print(documents)
index = VectorStoreIndex.from_documents(documents)

[Document(id_='cc480732-d497-4983-8541-863426da33e4', embedding=None, metadata={'file_path': '/mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt', 'file_name': 'artificial_query.txt', 'file_type': 'text/plain', 'file_size': 12, 'creation_date': '2023-12-20', 'last_modified_date': '2023-12-20', 'last_accessed_date': '2023-12-20'}, excluded_embed_metadata_keys=['file_name', 'file_type', 'file_size', 'creation_date', 'last_modified_date', 'last_accessed_date'], excluded_llm_metadata_keys=['file_name', 'file_type', 'file_size', 'creation_date', 'last_modified_date', 'last_accessed_date'], relationships={}, hash='d4c23c4c52d05e42151d138ba791428c6fbc4fca80c4a79f7cc43f81406f7309', text='Hello World!', start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\n\n{content}', metadata_template='{key}: {value}', metadata_seperator='\n')]

🤖
Based on the information you've provided, it seems like the issue might be related to the Azure OpenAI Embedding implementation in LlamaIndex. The error TypeError: 'NoneType' object is not iterable typically occurs when you're trying to iterate over an object that is None.
Given that the error traceback points to the _get_text_embeddings function in the openai.py file, it's possible that the texts parameter being passed to this function is None. This could happen if the SimpleDirectoryReader is unable to read the file at the provided path or if the file is empty.
However, you've mentioned that the file does exist and is not empty. This leads me to believe that the issue might be with the Azure OpenAI Embedding implementation itself.
The get_embeddings function is called with the parameters self._client, texts, engine=self._text_engine, and **self.additional_kwargs. If any of these parameters are None, it could lead to the error you're experiencing.
I would recommend checking the values of these parameters before the get_embeddings function is called. You can do this by adding print statements or using a debugger to inspect the values at runtime.
Here's an example of how you can add print statements:
print(f"client: {self._client}")
print(f"texts: {texts}")
print(f"engine: {self._text_engine}")
print(f"additional_kwargs: {self.additional_kwargs}")

embeddings = get_embeddings(
    self._client,
    texts,
    engine=self._text_engine,
    **self.additional_kwargs,
)

If any of these print statements output None, then you've found the source of the issue. If the self._client is None, it could mean that the Azure OpenAI client is not being initialized correctly. If texts is None, it could mean that the documents are not being loaded correctly. If self._text_engine or self.additional_kwargs are None, it could mean that these properties are not being set correctly.
Once you've identified the source of the issue, you can take the necessary steps to fix it. For example, if the Azure OpenAI client is not being initialized correctly, you might need to check your Azure OpenAI configuration. If the documents are not being loaded correctly, you might need to check the file path and contents. If the self._text_engine or self.additional_kwargs properties are not being set correctly, you might need to check how these properties are being assigned in your code.
I hope this helps! If you have any further questions or need more assistance, feel free to ask.
For more information, you can refer to the Azure OpenAI Embedding implementation in LlamaIndex and the SimpleDirectoryReader implementation.
Sources

docs/examples/customization/llms/AzureOpenAI.ipynb
llama_index/embeddings/openai.py

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.

I have checked these parameters
    # .../python3.9/site-packages/llama_index/embeddings/openai.py

    def _get_text_embeddings(self, texts: List[str]) -> List[List[float]]:
        """Get text embeddings.

        By default, this is a wrapper around _get_text_embedding.
        Can be overridden for batch queries.

        """
        client = self._get_client()
        print(f"client: {client}")
        print(f"texts: {texts}")
        print(f"engine: {self._text_engine}")
        print(f"additional_kwargs: {self.additional_kwargs}")

client: <openai.lib.azure.AzureOpenAI object at 0x7fa0b35aae80>
texts: ['file_path: /mnt/workspace/workgroup/lengmou/Data/NL2SQL/artificial_query.txt\n\nHello world!']
engine: text-embedding-ada-002
additional_kwargs: {}
Also, I have checked the response of openai :
.../python3.9/site-packages/openai/_base_client.py

    def _process_response(
        self,
        *,
        cast_to: Type[ResponseT],
        options: FinalRequestOptions,
        response: httpx.Response,
        stream: bool,
        stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None,
    ) -> ResponseT:
        api_response = APIResponse(
            raw=response,
            client=self,
            cast_to=cast_to,
            stream=stream,
            stream_cls=stream_cls,
            options=options,
        )

        print(str(api_response))

        if response.request.headers.get(RAW_RESPONSE_HEADER) == "true":
            return cast(ResponseT, api_response)

        return api_response.parse()

If I use print(api_response), we get the output:
<APIResponse [200 OK] type=<class 'openai.types.create_embedding_response.CreateEmbeddingResponse'>>
If I use print(api_response.parse()), there is nothing in output
there maybe some bugs in the function parse()
return api_response.parse()

could you please fix it?

The response:
{"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}
What the Deployment is?
My config is :
llm = AzureOpenAI(
model="gpt-35-turbo-16k",
deployment_name="my-custom-llm",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)

embed_model = AzureOpenAIEmbedding(
model="text-embedding-ada-002",
deployment_name="my-custom-embedding",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)

Hi,
Is this issue resolved @pydaxing, I am facing similar issue while creating embedding for my list of string. It seems its working for smaller chunk, lets say
text = "this is a test document"
embeddings = AzureOpenAIEmbeddings(
    azure_deployment=api_base,
    openai_api_version=api_version,
)
doc_result = embeddings.embed_documents([text])
print(doc_result[0][:5])

This is the output:

[-0.006712075614417865,
0.0064680001883293545,
0.05015298966607705,
-0.02599855817469904,
-0.00687027285680617]

but when I run it for the list of strings, of length of 2881 items, it gives me below error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[29], line 1
----> 1 db = FAISS.from_texts(chunks, embeddings)

File c:\Users\M307900\Documents\Uptimize BOT\hao-talk-to-your-docs-app-ddaooburjtxi1huv\.venv\lib\site-packages\langchain_community\vectorstores\faiss.py:914, in FAISS.from_texts(cls, texts, embedding, metadatas, ids, **kwargs)
    887 @classmethod
    888 def from_texts(
    889     cls,
   (...)
    894     **kwargs: Any,
    895 ) -> FAISS:
    896     """Construct FAISS wrapper from raw documents.
    897
    898     This is a user friendly interface that:
   (...)
    912             faiss = FAISS.from_texts(texts, embeddings)
    913     """
--> 914     embeddings = embedding.embed_documents(texts)
    915     return cls.__from(
    916         texts,
    917         embeddings,
   (...)
    921         **kwargs,
    922     )
...
     95     data = cast(object, embedding.embedding)
     96     if not isinstance(data, str):
     97         # numpy is not installed / base64 optimisation isn't enabled for this model yet

TypeError: 'NoneType' object is not iterable

Not an answer
I don't see how urgent this is. Why is "urgent" put in the title?
There wasn't an justification on the urgency. Could someone remove that word from the title?

authors: ma26yank pydaxing tslmy


text:
Add task timeout

From time to time some workers hang due to execution script.
Example:
we have python scripts + playwright Firefox browser. Sometimes this Firefox hangs and task stops. In this state it could be long time before we identify that this is fail of script (and another worker already finish this task due to Queue timeout).
So we know average time of task execution and is it possible to add some value during Job creation that if task executing longer than X we can restart it?

What are the possible values?
timeout: 10s|10m|10h|10d?

Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y".

Thanks a lot!

authors: ppcololo runabol

repo: runabol/tork


text:
Add phiv ident for U+03D5 GREEK PHI SYMBOL

Adds phiv identifier for ϕ (U+03D5 GREEK PHI SYMBOL) character.
This is \phi in TeX, but ϕ, ϕ and ϕ in HTML. Token straightphi is too long, and \varphi stands for phi (U+03C6) in mathup, so I’ve chosen phiv for consistency with existing tools and to prevent confusion.

Thank you. Merged in 2e3c23d7

Published in 1.0.0-beta.2

authors: runarberg tie

repo: runarberg/mathup


text:
Make build scripts location-agnostic

The build scripts assume they are executed from the root of this repo.
This prevents running scripts from other locations, for example,
cd web && ../bin/go-run ..
Modify the build scripts to work regardless of current directory.
Fixes #301
Signed-off-by: Andrew Seigner siggy@buoyant.io

yeah, i went back and forth on basedir vs bindir. switching it back to bindir.

repo: runconduit/conduit


text:
Rooftop Removal POH Dungeons

Please check if your issue is not a duplicate by searching existing issues
I did
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:

Go to your poh
Enter your dungeon

Expected behavior
A clear and concise description of what you expected to happen.
The dungeon and above ground collapse
Screenshots
If applicable, add screenshots to help explain your problem.
http://prntscr.com/1g5l931
Environment (please complete the following information):

OS: Windows
RuneLite version: 26/7/2021
Launcher version: 26/7/2021

Additional context
Add any other context about the problem here, e.g. logs. Your client logs can usually be found in
C:\Users\<your_user_name>\.runelite\logs on Windows and ~/.runelite/logs on Linux and macOS.
Like some other guy said, a toggle for poh would be nice.

Duplicate of #13891 (the issue is basically going to end up being the same thing)

repo: runelite/runelite


text:
Game Client Layout setting not remembered between different profiles

Type
Incorrect behavior
Operating System
Windows
OS Version
Windows 10
Bug description
Game Client Layout setting not remembered between different profiles.
Playing on my main Runelite profile through the Jagex Launcher. I recently started an alt while using a secondary profile in Runelite without the Jagex Launcher.
When changing my Game Client Layout in Display Settings between Fixed (Classic) and Resizable (Classic) the change transfers to other profiles. This doesn't happen for the control settings.
All plugin settings differences act as they should. The only setting I know of is Game Client Layout.
Using this feature to setup a profile -> https://github.com/runelite/runelite/wiki/General-Features#playing-with-multiple-accounts
Each of my accounts have separate emails and runelite accounts.
The "Target" field for my shortcut is "S:\Users\MYNAME\AppData\Local\RuneLite\RuneLite.exe --clientargs "--config=settings2.properties --sessionfile=session2"
The directory of my original client and the shortcut is "S:\Users\MYNAME\AppData\Local\RuneLite"
Screenshots or videos
No response
RuneLite version
Runelite Version: 1.8.29
Oldschool revision: Rev 207
Launcher Version: 2.2.0
Logs
No response

The game client layout, along with all other Jagex settings, have nothing to do with RuneLite or its settings, as it is a feature of the vanilla game.


text:
Add a new "Guide" plugin? (feature-request)

When the plugin is enabled, right-clicking on a quest or a diary or a skill would have an "open youtube guide" option
Concept: https://i.imgur.com/zyhYezz.png (made it in paint cause ps won't open)
Edit: Video could be played either through the runelite plugin or the user's default browser when this sign is clicked

Related #3038

I have made something that will link to the wiki page for most things in game. You can check it out here.

Duplicate of #3038 and #2038

authors: Abextm F-RCE Reasel deathbeam


text:
Highlight attackable players in wilderness

Top Request

Overlay player names for ALL players with an option to exclude people from your own clan-chat (very useful for clanwars fights)

More advanced request

Exclude players outside your level range (only displays player names of people you can attack while in wilderness/PvP world)

Sure, one moment. Let me ask Custard if he can do this.

Given the reason for closing https://github.com/runelite/runelite/issues/7072#issuecomment-450448227, I think this issue can be closed as well?

Yes

authors: Jay1175 Mod-Archie Nightfirecat deathbeam


text:
Add ROCm PyTorch Official RunPod Image

Added official PyTorch images for ROCm

ROCm
PyTorch
Ubuntu
Python

5.6
2.0.1
20.04
3.8

5.7
2.0.1
22.04
3.10

6.0
2.1.1
20.04
3.9

6.0.2
2.1.2
22.04
3.10

6.1
2.0.1
22.04
3.10

6.1
2.1.2
22.04
3.10

is this already tested? do we know how much it increases the container size?

Oh lol we did the exact same thing with removing two dockerfiles @justinmerrell runpod/containers#b53c1a8d046105e509b548527070e0b86b18a371

repo: runpod/containers


text:
[ADD] "Design"

Category Name
Design
Subcategory Name
Mobile, Web, Desktop...
Additional Context
Maybe we could have a "Design" category, to list good links related to this theme, then as subcategories something like mobile, web, desktop... Or other subcategories.
I'd suggest, e.g., RealTime Colors, wich is an open source website that changes it's own colors and fonts for color testing, but there are surely many other tools that could be listed.
If this looks like a good idea, I'm interested in developing this category.
Checklist

[X] I have checked the existing issues
[X] I have read the Contributing Guidelines
[X] I have checked that this category does not exist
[X] I have checked that this subcategory does not exist
[X] I am willing to work on this issue (optional)

@GabrielBittar we already have this category as Design Inspiration, though we can consider adding more subcategories to it.

@GabrielBittar we already have this category as Design Inspiration, though we can consider adding more subcategories to it.

Ops, sorry, I didn't realise it was inside front end. We can't add subcategories nowadays, since it is already one. Maybe would it make sense turning Design Inspiration into a subcategory of Design instead, so frontend and design are not mixed anymore?

@GabrielBittar we already have this category as Design Inspiration, though we can consider adding more subcategories to it.

Ops, sorry, I didn't realise it was inside front end. We can't add subcategories nowadays, since it is already one. Maybe would it make sense turning Design Inspiration into a subcategory of Design instead, so frontend and design are not mixed anymore?

Sounds cool, we can do that. Are you interested in working on this?

@GabrielBittar we already have this category as Design Inspiration, though we can consider adding more subcategories to it.

Ops, sorry, I didn't realise it was inside front end. We can't add subcategories nowadays, since it is already one. Maybe would it make sense turning Design Inspiration into a subcategory of Design instead, so frontend and design are not mixed anymore?

Sounds cool, we can do that.

Nice. Can I be assigned?
Btw, would it be good if we had a subcategory called Design Tools where we could insert useful tools (like, e.g., the one suggested in this issue)? Then we'd have Inspiration and Tools inside Design as a kickstart.

@GabrielBittar we already have this category as Design Inspiration, though we can consider adding more subcategories to it.

Ops, sorry, I didn't realise it was inside front end. We can't add subcategories nowadays, since it is already one. Maybe would it make sense turning Design Inspiration into a subcategory of Design instead, so frontend and design are not mixed anymore?

Sounds cool, we can do that.

Nice. Can I be assigned? Btw, would it be good if we had a subcategory called Design Tools where we could insert useful tools (like, e.g., the one suggested in this issue)? Then we'd have Inspiration and Tools inside Design as a kickstart.

Yeah, we can even a subcategory named Tutorials and add video links to it from youtube.

@GabrielBittar, you're assigned.

Hello, just for the record, since I got assigned, I'm working on it and will deliver it for review soon.

@GabrielBittar are you working on this?

@GabrielBittar are you working on this?

Hello,
Sorry, I was, but then I got sick, so I'm staying away for some time. But looking forward to return to the project and keep working on this issue asap. If you guys don't mind, I truly intend to return asap, I'm loving to contribute on this project.
Thanks.

@GabrielBittar are you working on this?

Hello, Sorry, I was, but then I got sick, so I'm staying away for some time. But looking forward to return to the project and keep working on this issue asap. If you guys don't mind, I truly intend to return asap, I'm loving to contribute on this project. Thanks.

Alright, please take care Gabriel. And get well soon :)

authors: GabrielBittar rupali-codes

repo: rupali-codes/LinksHub


text:
[Add] Life of Pix

URL
https://www.lifeofpix.com/
Description of the above provided site
Life of Pix is an online platform that provides free access to a remarkable assortment of premium images taken by skilled photographers worldwide. Its intuitive interface and absence of copyright limitations make it the ideal choice for individuals seeking attractive and genuine photographs.
Category
Frontend
Sub Category
images

Can you assign this issue to me ?

@Oyebolade would you like to work on this?

Yes

All right

Can I raise a PR for it ?

Can I raise a PR for it ?

Sure @parma1111! :)


text:
Travis: add an additional dimension to the build matrix

This changes moves unit tests into jobs separated from integration tests and documentation. This isn't really a long-term solution concerning build timeouts considering how fast the codebase grows but should give us some time to come up with a better solution.

This is neat, thanks! My only concern is that a and b are not as descriptive as I would like, when looking at the job overview in Travis:

What do you think about renaming the values to unit and integration?

Thanks, merging this now!

authors: pgerber srijs

repo: rusoto/rusoto


text:
minor: improve readability

bors r+
🤖

Did you mean to r+ this?

bors r+
yeah,thanks!

authors: lnicola matklad

repo: rust-analyzer/rust-analyzer


text:
Include clippy lint groups in autocomplete

Why
close: https://github.com/rust-analyzer/rust-analyzer/issues/11027
Proof
I confirmed that complement candidates are coming out.
https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov

Thanks!
bors r+

authors: Veykril k-nasa


text:
Use src node for analyze source in descend_into_macros

This PR fixed a bug which descend_into_macros cannot resolve deeper macro, by use source node for SourceAnalyzer.

Hm, I see how this can be better than what we have right now, but ideally we should fix SourceAnalyzer to work when created inside macros...
bors r+

bors retry

merging manually, looks like github just doesn't trust bots when someone (me) edits actions.


text:
Hide unit function return types

r? @flodiebold
This might be a bit heavy-handed (e.g. || -> () to ||), what do you think?

Hm, for fn I think this is good, but for || it seems a bit weird...

Updated to remove the closure change.

bors r+

authors: flodiebold lnicola


text:
Change missing impl assist to use todo!() instead of unimplemented()

todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html)
Rust documentation provides further clarification:

The difference between unimplemented! and todo! is that while todo!
conveys an intent of implementing the functionality later and the
message is "not yet implemented", unimplemented! makes no such claims.

todo!() seems more appropriate for assists that insert missing impls.

I mentioned this preference (todo over unimplemented) in #3904 and figured it'd be rather trivial to change.

bors r+
Thanks!

authors: cjhopman matklad


text:
add 'Re-enable this test' assist

The Ignore this test assist previously allowed ignoring multiple times, each time adding a #[ignore] attribute.
This PR instead shows an assist to undo the ignoring.

Thank you.
bors r+

authors: SomeoneToIgnore jakobhellermann


text:
Remove code duplication in highlight injection

bors r+

changelog skip


text:
Building 1.48 fails

I thought this used to work, but now when I try to build with 1.48 toolchain, I get an error:
cargo +1.48 build
    Updating crates.io index
error: failed to select a version for the requirement `once_cell = "=1.18.0"`
candidate versions found which didn't match: 1.17.2, 1.17.1, 1.17.0, ...
location searched: crates.io index
required by package `wasm-bindgen-backend v0.2.87`
    ... which is depended on by `wasm-bindgen-macro-support v0.2.87`
    ... which is depended on by `wasm-bindgen-macro v0.2.87`
    ... which is depended on by `wasm-bindgen v0.2.87`
    ... which is depended on by `console_error_panic_hook v0.1.7`
    ... which is depended on by `wasm-bindgen-test v0.3.37`
    ... which is depended on by `bitcoin_hashes v0.12.0 (/usr/home/yancy/Git/rust-bitcoin/hashes)`
    ... which is depended on by `bitcoin v0.30.0 (/usr/home/yancy/Git/rust-bitcoin/bitcoin)`
    ... which is depended on by `bitcoin-fuzz v0.0.1 (/usr/home/yancy/Git/rust-bitcoin/fuzz)`

I think we should remove the versions from the README and just point devs towards the contrib/test.sh file, its one less thing to maintain and one is never 100% sure that the README is correct anyway, the test file is the single source of truth.

Another issue with our current CI setup is that we are not actually testing against the latest dependencies in the CI. A new user on stable would expect cargo update && cargo test to succeed, but we are actually not testing that in the CI setup.

I guess we should add that as a separate job (probably with --all-features) so we'll notice when stuff breaks.

cp Cargo-recent.lock ./Cargo.lock fixed the problem.  I wouldn't mind adding this to the README under the Build section since maybe not every dev wants to go poking around in a shell script to figure out how compile.

@yancyribbens that will only work for people compiling this crate directly, not anybody depending on it.
It's sad that people need to "poke around in a shell script to figure out how to compile", yes, but that's a problem with cargo, not with us.

I guess the correct answer to "What do I run on MSRV" is look at the cargo-recent.toml to find the latest dependencies that we support.

I get a bit mixed up with lock files, cargo, and pinning, but as far as I can tell we have holes in the test scripts at the moment.
For recent deps in bitcoin crate we do:

cp Cargo-recent.lock Cargo.lock
We use cargo update to pin some dependencies (whether this changes the lock file being used is not discernible from the shell scripts)
We do all the testing with --locked (using the current, possibly modified, lockfile)
We run cargo update and then warn if there are changes to the lock file against the Cargo-recent.lock

So, we have two cases that will both pass CI:

The pinning was done before the original Cargo-recent.lock was made, the pinning commands in the CI script do not change the lock file
The pinning was not done before the original Cargo-recent.lock file, the pinning commands in the CI script modify the recent lock file

Conclusions:

In both cases the warnings generated in (4) are invalid for MSRV
Everytime we need to pin a new dependency or change the pinned version we either have to fix the Cargo-recent.lock OR add a pinning command to the CI script - so the CI pinning is not the single source of truth. Ouch.

Everytime we need to pin a new dependency or change the pinned version we either have to fix the Cargo-recent.lock

Cargo-recent.lock should always work, and by definition, will not be affected by new broken dependencies. And our choices of when to update the lockfile shouldn't have anything to do with pinning requirements.
But you are correct that our current mix of pinning and fixed lockfiles is incoherent. We should have CI jobs that use the fixed lockfiles, with no pinning, and a CI job that uses the actual latest dependencies along with pinning to make it work.

Agreed with @apoelstra.
I wanted something like
-DEPS="recent minimal"
+DEPS="recent minimal latest"

 for dep in $DEPS
 do
-       cp "Cargo-$dep.lock" Cargo.lock
+       if [ "$dep" = latest ];
+       then
+               cargo update
+       else
+               cp "Cargo-$dep.lock" Cargo.lock
+       fi

But I am not thrilled that this will increase our CI times by 50%. Moves them from 18 mins to 27 mins. If we are doing this as a part of CI, I fail to see the value of Cargo-recent.toml except at the time of release.
Or maybe another simple lightweight job that just tests --all-features.

Maybe the strategy could be outlined and documented some place in a developer section.  IE how to build MSRV and process by which the toml files are updated.

If we are doing this as a part of CI, I fail to see the value of Cargo-recent.toml except at the time of release.

I'm curious about this as well.

I fail to see the value of Cargo-recent.toml except at the time of release.

The point is that it's the "latest set of dependencies we support". (And also the latest set of dependencies that I test with locally.) Where "support" has nothing to do with CI, it means the dependency versions we've looked at and are okay with.
We can drop it for now, but eventually the idea is that we'll be using crev and actually keeping this somewhat up to date.

closed by #1977

authors: apoelstra sanket1729 tcharding yancyribbens

repo: rust-bitcoin/rust-bitcoin


text:
Improvement: Minimize LANGID enum under feature flag

Recently I started mitigating my code to use usb-device 0.3.1 on an stm32l4 project.
looking the objdump I noticed the langid conversion method requires ~8KB of code:

clearly, mapping a huge enum this is unavoidable.
however,
to support smaller builds I think hiding most langIDs under a feature flag would suffice.
as a test run I copied the langid enum and covered it with a feature flag min-lang-id
#[allow(missing_docs)]
#[derive(Clone, Copy, PartialEq, Debug, TryFromPrimitive)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(u16)]
#[cfg(feature="min-lang-id")]
pub enum LangID {
    EN_US = 0x0409,
}

assuming we minimize to only EN_US, the enum gets completly optimized out.
I'm sure there can be a minimal set of common LANGIDs actually seen in the wild.
Regardless, I do think that avoiding adding this much code for an embedded targeted code is essential.

I would not be opposed to this idea. That's wild that it takes so much space though.

It's a very noticeable size increase if usb-device is used in a bootloader.
I can see why this API is better than a plain u16, however it's not obvious why usb-device is supposed to validate and check language id and not leave it to a user of library.
Maybe something like this?
#[allow(missing_docs)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct LangID(u16);

impl From<LangID> for u16 {
    fn from(lang_id: LangID) -> Self {
        let LangID(id) = lang_id;
        id
    }
}

impl TryFrom<u16> for LangID {
    type Error = &'static str;

    fn try_from(lang_id: u16) -> Result<Self, Self::Error> {
        Ok(LangID(lang_id))
    }
}

#[allow(missing_docs)]
impl LangID {
    pub const AR: LangID = LangID(0x0001);
    pub const BG: LangID = LangID(0x0002);
    pub const CA: LangID = LangID(0x0003);
    pub const ZH_HANS: LangID = LangID(0x0004);
    pub const CS: LangID = LangID(0x0005);
    pub const DA: LangID = LangID(0x0006);
    pub const DE: LangID = LangID(0x0007);
    pub const EL: LangID = LangID(0x0008);
    pub const EN: LangID = LangID(0x0009);
...

I like that idea of just having constants instead if it eliminates the code bloat. LangIDs aren't even part of the USB spec anymore.

This was taking up a big chunk of memory on my current target, so I had to change this on my local fork. To keep the safety in the developer API, I made StringDescriptors keep the LangID parameter, but removed the TryFromPrimitive and let the internal parts of usb_device simply handle the u16. For my use case, there's no need to actually validate the received language is valid, so working simply in the u16 saves a ton of memory(was around 3kB).
Best regards,
Lasse

If someone submits a PR, I'd be happy to review, merge, and release it :)
The whole concept of LangIDs is a bit questionable in my opinion since I think they're deprecated now as well, so simplifying this sounds like a wonderful idea.

authors: dalegaard maor1993 ryan-summers vitalyvb

repo: rust-embedded-community/usb-device


text:
Release v0.2.0 seems to be missing the MUSL binary

This is breaking my build.
https://travis-ci.org/Byron/dua-cli/jobs/653944394#L465
Do you think it's possible to force an older version for the time being?
Thanks for your advise, it's much appreciated.

It's definitely available from the releases page now: https://github.com/rust-embedded/cross/releases/tag/v0.2.0

Thanks!
Indeed, it's there now and retriggering the pipeline was all it took.
What confused me is that the commit creating the release apparently was 6 hours old, which was about the time when my pipeline failed.
Is there any learning from this, @reitermarkus? Or is there anything I should consider to do or not do in future to prevent this from happening again? Thank you.

I think the problem is that the tag/release is created before the artifacts are uploaded. Not sure what the best workflow would be so that doesn't happen.

authors: Byron reitermarkus

repo: rust-embedded/cross


text:
Complete Chinese Translation

This issue contains the description of the entire Chinese translation and the description of the pull request.
The following is the list to be translated. If there is any omission, please supplement

[x] 03_hacky_hello_world
[x] 04_safe_globals
[ ] 05_drivers_gpio_uart
[ ] 06_uart_chainloader
[ ] 07_timestamps
[ ] 08_hw_debug_JTAG
[ ] 09_privilege_level
[ ] 10_virtual_mem_part1_identity_mapping
[ ] 11_exceptions_part1_groundwork
[ ] 12_integrated_testing
[ ] 13_exceptions_part2_peripheral_IRQs
[ ] 14_virtual_mem_part2_mmio_remap
[ ] 15_virtual_mem_part3_precomputed_tables
[ ] 16_virtual_mem_part4_higher_half_kernel
[ ] 17_kernel_symbols
[ ] 18_backtrace
[ ] 19_kernel_heap

Hi, I'm willing to help with the translation. I've noticed that there is an unmerged PR for chpt.4 so I thought I could begin with chpt.5?

@posborne sure, It is necessary to open new PR corresponding to different chapters

@Phantato You could also review the chapter 4 PR #171 and viceversa and so you can help each other.

authors: Jzow Phantato eldruin


text:
Refine JTAG wiring images

Updated some images related to JTAG wiring for tutorial 0B as pointed out at #18

#18

Thanks for helping!

authors: andre-richter naotaco


text:
Enum with values named identically generates invalid code

The following generates invalid code:
<field>
	<name>AADEN</name>
	<description>AAD enable.</description>
	<bitRange>[2:2]</bitRange>
	<enumeratedValues>
		<name>ENUM</name>
		<enumeratedValue>
			<name>AUTO_ADDRESS_DETECT_</name>
			<description>Auto Address Detect (AAD) is disabled.</description>
			<value>1</value>
		</enumeratedValue>
		<enumeratedValue>
			<name>AUTO_ADDRESS_DETECT_</name>
			<description>Auto Address Detect (AAD) is enabled.</description>
			<value>0</value>
		</enumeratedValue>
	</enumeratedValues>
</field>

#[doc = "Possible values of the field `AADEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AADENR {
    #[doc = "Auto Address Detect (AAD) is disabled."]
    AUTO_ADDRESS_DETECT_,
    #[doc = "Auto Address Detect (AAD) is enabled."]
    AUTO_ADDRESS_DETECT_,
}

In such cases shouldn't we automatically rename the fields to AUTO_ADDRESS_DETECT_ON / OFF? And issue a warning at least?

How exactly would you know that the missing pieces in the identifier are ON and OFF? Could also be HOT and COLD, YES and NO, FOO and BAR.

And issue a warning at least?

This will not compile but of course PRs to implement better diagnostics are always welcome.

Well "it's something"... Still better than generating invalid code, isn't it? We could use the values instead of on / off to be general

I'm very much opposed to introducing automagic in attempt to fix broken SVD files. Once you start going down that rabbit hole you'll find lots of broken things you might want want to autocorrect.


text:
Add associated const ptr PTR to each peripheral RegisterBlock

cc https://github.com/rust-embedded/cortex-m/pull/235
Signed-off-by: Daniel Egger daniel@eggers-club.de

r? @adamgreig
(rust_highfive has picked a reviewer for you, use r? to override)

authors: rust-highfive therealprof


text:
Reorg the transaction module

split the transaction module to legacy/eip2930/eip1559 modules
add to_message method for LegacyTransaction/EIP2930Transaction/EIP1559Transaction
adjust some imports

@sorpaas PTAL

repo: rust-ethereum/ethereum


text:
derive: Protect against unbounded recursion when u.is_empty()

Fixes https://github.com/rust-fuzz/arbitrary/issues/107

I'll publish a new release with this fix.

Published 1.1.1

repo: rust-fuzz/arbitrary


text:
Translate untranslated lines in guard.md

訳文の追加と合わせて、オリジナルに合わせて不要な行を削除しています。

ありがとうございます。マージします。

authors: dalance kdnakt

repo: rust-lang-ja/rust-by-example-ja


text:
Allow deprecated to remove warnings in nightly

Fixes #151

Thanks @Schaeff! This looks good to me.

authors: KodrAus Schaeff


text:
Issue #1037: pass all derive-enabling flags in bindgen for csmith driver

r? @fitzgen

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @fitzgen (or someone else) soon.

@bors-servo r+

:pushpin: Commit 225c9a4 has been approved by fitzgen

:hourglass: Testing commit 225c9a47f2b054538ad11d019dcb43a952bec606 with merge e350477a115df02c1b53d69d0153c08c7066bffd...

:broken_heart: Test failed - status-travis

looks like it fails in building rustfmt-nightly in CI. so does it need a re-run?

looks like it fails in building rustfmt-nightly in CI. so does it need a re-run?

I think it was https://github.com/rust-lang-nursery/rustfmt/issues/2002, which now appears to be fixed. I'll go ahead and merge this manually though.
Sorry for the hiccup!

authors: bors-servo clippered fitzgen highfive

repo: rust-lang-nursery/rust-bindgen


text:
reqwest examples are outdated

Since reqwest 0.10.1, it uses async by default, making most examples in the cookbook outdated.
I'll try and make a PR, but I do not think that have sufficient experience with the crate. I will also try to contact the project maintainers.

Good point.  We really ought to do some async stuff now that crates are starting to apply the core implementation.

I suggest migrating the old examples to reqwest::blocking as soon as possible. It is an optional feature so it requires this line in the toml:
reqwest = { version = "*", features = ["blocking"] }
I can prepare a pull request if you would like.

Yeah, the example here is outdated as Responses can no longer be std::io::copyd: https://github.com/rust-lang-nursery/rust-cookbook/blob/master/src/web/clients/download/basic.md

authors: AndyGauge Belval samuela swedebugia

repo: rust-lang-nursery/rust-cookbook


text:
Disallow combining a method call with prefix or suffix

Closes #2704.

The test failure is not related to this PR (poor clippy).

repo: rust-lang-nursery/rustfmt


text:
Fails to build with --frozen although cache and Cargo.lock is up-to-date

Problem
I'm unable to build with --frozen flag although the dependencies are up-to-date for the bob project.
cc @MordechaiHadad (the author)
Also reported here: https://github.com/MordechaiHadad/bob/issues/153
Steps

git clone https://github.com/MordechaiHadad/bob && cd bob/
cargo fetch --locked --target "x86_64-unknown-linux-gnu"
cargo build --release --frozen

thread 'main' panicked at 'packages downloaded: failed to download `flate2 v1.0.27`

Caused by:
    attempting to make an HTTP request, but --frozen was specified', src/cargo/ops/cargo_compile/mod.rs:910:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Possible Solution(s)
If you remove the --frozen flag, build once and repeat the process, then it works magically.
Notes
I don't know this is an error specific to the bob project but it is reproducible so I thought it would be better to report this to cargo directly.
Another thing to note, this is not a flate2 specific error since I got errors related to other crates as well:
thread 'main' panicked at 'packages downloaded: failed to download `tar v0.4.40`

Caused by:
    attempting to make an HTTP request, but --frozen was specified', src/cargo/ops/cargo_compile/mod.rs:908:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Version
cargo 1.72.0-nightly (5b377cece 2023-06-30)
release: 1.72.0-nightly
commit-hash: 5b377cece0e0dd0af686cf53ce4637d5d85c2a10
commit-date: 2023-06-30
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Arch Linux Rolling Release [64-bit]

To add to this:
This also fails on cargo 1.65.0 (4bc8f24d3 2022-10-20) on Arch Linux
But runs successfully when running the same commands(changing to ("x86_64-pc-windows-msvc")
Dont have any info on this regarding other linux distros or macOS

Could you also try running cargo build with --target "x86_64-unknown-linux-gnu"?

Running cargo build --target "x86_64-unknown-linux-gnu" works just fine for me.

I dunno why this works on windows without any issue.

Sorry I was on my phone. Now it looks like having the same root cause as https://github.com/rust-lang/cargo/issues/11352.

You are right, flate2 is a MacOS dependency defined here: https://github.com/MordechaiHadad/bob/blob/master/Cargo.toml#L79
But it is being downloaded during build on Linux:
thread 'main' panicked at 'packages downloaded: failed to download `flate2 v1.0.27`

yeah exactly and winreg is a windows dependency

So is there a workaround/fix for this issue? @weihanglo

I guess no. #11352 is still open. The only workaround I am aware of is avoiding platform filtering when running cargo fetch.
I'll close this and let's discuss in #11352. Thank you for the report anyway!

authors: MordechaiHadad orhun weihanglo

repo: rust-lang/cargo


text:
Add a --sysroot option to build and rustc commands

When cross compiling you need to provide both a target and a sysroot (a place where all the target libraries can be found). Both cargo and rustc should provide a way to set these. rustc's --sysroot might be buggy or rust specific, see https://github.com/rust-lang/rust/issues/31180 and it does not pass it on to the linker.

This sounds like it's a use case for RUSTFLAGS rather than its own dedicated flag. All of the cross-compiling linkers I've seen in the past auto-find their own sysroot so making this a first-class option may be too front-and-center for this?

This won't be very useful if you have to pass the C sysroot in RUSTFLAGS anyway.

This sounds like it can be closed. Please reopen if I'm wrong! 🌵

authors: Zoxc alexcrichton carols10cents