content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
add missing autoload
37d3266f35e1947f43046fb8296c560145f2b53e
<ide><path>railties/lib/rails/engine.rb <ide> module Rails <ide> # <ide> class Engine < Railtie <ide> autoload :Configuration, "rails/engine/configuration" <add> autoload :Railties, "rails/engine/railties" <ide> <ide> class << self <ide> attr_accessor :called_from, :isolated
1
Python
Python
close _session.session in clear_session
2fde2bec570a12bd2c8e5a8a7bf301b21e58dc05
<ide><path>keras/backend.py <ide> def clear_session(): <ide> _GRAPH.graph = None <ide> tf.compat.v1.reset_default_graph() <ide> reset_uids() <del> _SESSION.session = None <add> if _SESSION.session is not None: <add> _SESSION.session.close() <add> _SESSION.session = None <ide> graph = get_graph() <ide> with graph.as_default(): <ide> _DUMMY_EAGER_GRAPH.learning_phase_is_set = False
1
Python
Python
fix python 3 support
c8cbdabfab3a150904a2214930e82112d0231ff2
<ide><path>django/db/migrations/autodetector.py <ide> def _boolean_input(self, question): <ide> return result[0].lower() == "y" <ide> <ide> def _choice_input(self, question, choices): <del> print question <add> print(question) <ide> for i, choice in enumerate(choices): <del> print " %s) %s" % (i + 1, choice) <add> print(" %s) %s" % (i + 1, choice)) <ide> result = input("Select an option: ") <ide> while True: <ide> try: <ide><path>django/db/migrations/graph.py <ide> def root_nodes(self): <ide> """ <ide> roots = set() <ide> for node in self.nodes: <del> if not filter(lambda key: key[0] == node[0], self.dependencies.get(node, set())): <add> if not any(key[0] == node[0] for key in self.dependencies.get(node, set())): <ide> roots.add(node) <ide> return roots <ide> <ide> def leaf_nodes(self): <ide> """ <ide> leaves = set() <ide> for node in self.nodes: <del> if not filter(lambda key: key[0] == node[0], self.dependents.get(node, set())): <add> if not any(key[0] == node[0] for key in self.dependents.get(node, set())): <ide> leaves.add(node) <ide> return leaves <ide> <ide><path>django/db/migrations/writer.py <ide> def serialize(cls, value): <ide> elif isinstance(value, (datetime.datetime, datetime.date)): <ide> return repr(value), set(["import datetime"]) <ide> # Simple types <del> elif isinstance(value, (int, long, float, six.binary_type, six.text_type, bool, types.NoneType)): <add> elif isinstance(value, six.integer_types + (float, six.binary_type, six.text_type, bool, type(None))): <ide> return repr(value), set() <ide> # Django fields <ide> elif isinstance(value, models.Field):
3
Javascript
Javascript
add flow types in geteventmodifierstate
663835a43a5a92ff63c3e3b43e4c9ff40dde173b
<ide><path>packages/react-dom/src/events/getEventModifierState.js <ide> * <ide> * This source code is licensed under the MIT license found in the <ide> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <ide> */ <ide> <ide> /** <ide> * Translation from modifier key to the associated property in the event. <ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers <ide> */ <ide> <add>import type {AnyNativeEvent} from 'events/PluginModuleType'; <add> <ide> const modifierKeyToProp = { <ide> Alt: 'altKey', <ide> Control: 'ctrlKey', <ide> const modifierKeyToProp = { <ide> // IE8 does not implement getModifierState so we simply map it to the only <ide> // modifier keys exposed by the event itself, does not support Lock-keys. <ide> // Currently, all major browsers except Chrome seems to support Lock-keys. <del>function modifierStateGetter(keyArg) { <add>function modifierStateGetter(keyArg: string): boolean { <ide> const syntheticEvent = this; <ide> const nativeEvent = syntheticEvent.nativeEvent; <ide> if (nativeEvent.getModifierState) { <ide> function modifierStateGetter(keyArg) { <ide> return keyProp ? !!nativeEvent[keyProp] : false; <ide> } <ide> <del>function getEventModifierState(nativeEvent) { <add>function getEventModifierState( <add> nativeEvent: AnyNativeEvent, <add>): (keyArg: string) => boolean { <ide> return modifierStateGetter; <ide> } <ide>
1
Python
Python
use comprehensions instead of map/lambda
7d28fe802037bf377f94868a7be0991dd352f4d5
<ide><path>glances/exports/glances_csv.py <ide> def update(self, stats): <ide> plugins = stats.getAllPlugins() <ide> <ide> # Loop over available plugin <del> i = 0 <del> for plugin in plugins: <add> for i, plugin in enumerate(plugins): <ide> if plugin in self.plugins_to_export(): <ide> if isinstance(all_stats[i], list): <del> for item in all_stats[i]: <add> for stat in all_stats[i]: <ide> # First line: header <ide> if self.first_line: <del> csv_header += map(lambda x: plugin + '_' + item[item['key']] + '_' + x, item) <add> csv_header += ('{0}_{1}_{2}'.format( <add> plugin, stat[stat['key']], item) for item in stat) <ide> # Others lines: stats <del> fieldvalues = item.values() <add> fieldvalues = stat.values() <ide> csv_data += fieldvalues <ide> elif isinstance(all_stats[i], dict): <ide> # First line: header <ide> if self.first_line: <ide> fieldnames = all_stats[i].keys() <del> csv_header += map(lambda x: plugin + '_' + x, fieldnames) <add> csv_header += ('{0}_{1}'.format(plugin, fieldname) <add> for fieldname in fieldnames) <ide> # Others lines: stats <ide> fieldvalues = all_stats[i].values() <ide> csv_data += fieldvalues <del> i += 1 <ide> <ide> # Export to CSV <ide> if self.first_line: <ide><path>glances/exports/glances_export.py <ide> def update(self, stats): <ide> if isinstance(all_stats[i], list): <ide> for item in all_stats[i]: <ide> item.update(all_limits[i]) <del> export_names = list(map(lambda x: item[item['key']] + '.' + x, item.keys())) <add> export_names = list('{0}.{1}'.format(item[item['key']], key) <add> for key in item.keys()) <ide> export_values = list(item.values()) <ide> self.export(plugin, export_names, export_values) <ide> elif isinstance(all_stats[i], dict):
2
Python
Python
drop some trailing spaces in `numpy.ma.core`
b29a997b8a4a999577d9fd575bda20a1d6ecd3be
<ide><path>numpy/ma/core.py <ide> def __getitem__(self, indx): <ide> if self._fill_value is not None: <ide> dout._fill_value = self._fill_value[indx] <ide> <del> # If we're indexing a multidimensional field in a <add> # If we're indexing a multidimensional field in a <ide> # structured array (such as dtype("(2,)i2,(2,)i1")), <ide> # dimensionality goes up (M[field].ndim == M.ndim + <del> # len(M.dtype[field].shape)). That's fine for <del> # M[field] but problematic for M[field].fill_value <add> # len(M.dtype[field].shape)). That's fine for <add> # M[field] but problematic for M[field].fill_value <ide> # which should have shape () to avoid breaking several <ide> # methods. There is no great way out, so set to <ide> # first element. See issue #6723.
1
Python
Python
define inline to something we can use internally
f87fb9c9e98681907bd396a9835bb517cd8fe978
<ide><path>numpy/core/setup.py <ide> def generate_config_h(ext, build_dir): <ide> if sys.platform=='win32' or os.name=='nt': <ide> win32_checks(moredefs) <ide> <add> # Inline check <add> inline = config_cmd.check_inline() <add> <ide> # Generate the config.h file from moredefs <ide> target_f = open(target,'a') <ide> for d in moredefs: <ide> def generate_config_h(ext, build_dir): <ide> else: <ide> target_f.write('#define %s %s\n' % (d[0],d[1])) <ide> <add> # define inline to our keyword, or nothing <add> target_f.write('#ifndef __cplusplus\n') <add> if inline == 'inline': <add> target_f.write('/* #undef inline */\n') <add> else: <add> target_f.write('#define inline %s\n' % inline) <add> target_f.write('#endif\n') <add> <ide> target_f.close() <ide> print 'File:',target <ide> target_f = open(target)
1
PHP
PHP
remove unused local variable
33c2a3ee57d422d2be1fbfec12b25d5c3b3e3836
<ide><path>src/Illuminate/Foundation/Application.php <ide> protected function markAsRegistered($provider) <ide> */ <ide> public function loadDeferredProviders() <ide> { <del> $me = $this; <del> <ide> // We will simply spin through each of the deferred providers and register each <ide> // one and boot them if the application has booted. This should make each of <ide> // the remaining services available to this application for immediate use.
1
Text
Text
remove non-existing link
43cc6aea93ba53cab48d9668771f198a3f468c91
<ide><path>website/docs/api/cli.md <ide> $ python -m spacy train [config_path] [--output] [--code] [--verbose] [--gpu-id] <ide> ## pretrain {#pretrain new="2.1" tag="command,experimental"} <ide> <ide> Pretrain the "token to vector" ([`Tok2vec`](/api/tok2vec)) layer of pipeline <del>components on [raw text](/api/data-formats#pretrain), using an approximate <del>language-modeling objective. Specifically, we load pretrained vectors, and train <del>a component like a CNN, BiLSTM, etc to predict vectors which match the <del>pretrained ones. The weights are saved to a directory after each epoch. You can <del>then include a **path to one of these pretrained weights files** in your <add>components on raw text, using an approximate language-modeling objective. <add>Specifically, we load pretrained vectors, and train a component like a CNN, <add>BiLSTM, etc to predict vectors which match the pretrained ones. The weights are <add>saved to a directory after each epoch. You can then include a **path to one of <add>these pretrained weights files** in your <ide> [training config](/usage/training#config) as the `init_tok2vec` setting when you <ide> train your pipeline. This technique may be especially helpful if you have little <ide> labelled data. See the usage docs on <del>[pretraining](/usage/embeddings-transformers#pretraining) for more info. <add>[pretraining](/usage/embeddings-transformers#pretraining) for more info. To read <add>the raw text, a [`JsonlCorpus`](/api/top-level#JsonlCorpus) is typically used. <ide> <ide> <Infobox title="Changed in v3.0" variant="warning"> <ide> <ide> auto-generated by setting `--pretraining` on <ide> > $ python -m spacy pretrain config.cfg output_pretrain --paths.raw_text="data.jsonl" <ide> > ``` <ide> <del> <ide> ```cli <ide> $ python -m spacy pretrain [config_path] [output_dir] [--code] [--resume-path] [--epoch-resume] [--gpu-id] [overrides] <ide> ```
1
Go
Go
add check for 404 on get repository data
c8d2ec93caf7c64f3e510e4e75f49614880ed9b9
<ide><path>registry/session.go <ide> func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) { <ide> } <ide> // TODO: Right now we're ignoring checksums in the response body. <ide> // In the future, we need to use them to check image validity. <del> if res.StatusCode != 200 { <add> if res.StatusCode == 404 { <add> return nil, utils.NewHTTPRequestError(fmt.Sprintf("HTTP code: %d", res.StatusCode), res) <add> } else if res.StatusCode != 200 { <ide> errBody, err := ioutil.ReadAll(res.Body) <ide> if err != nil { <ide> log.Debugf("Error reading response body: %s", err)
1
Python
Python
fix brightbox tests
2195434b94df4c221003a7ca98df4ffbf679aecb
<ide><path>libcloud/test/loadbalancer/test_brightbox.py <ide> class BrightboxLBMockHttp(MockHttpTestCase): <ide> <ide> def _token(self, method, url, body, headers): <ide> if method == 'POST': <del> return self.response(httplib.OK, self.fixtures.load('token.json')) <add> return (httplib.OK, self.fixtures.load('token.json'), {'content-type': 'application/json'}, <add> httplib.responses[httplib.OK]) <ide> <ide> def _1_0_load_balancers(self, method, url, body, headers): <ide> if method == 'GET': <del> return self.response(httplib.OK, <del> self.fixtures.load('load_balancers.json')) <add> return (httplib.OK, self.fixtures.load('load_balancers.json'), {'content-type': 'application/json'}, <add> httplib.responses[httplib.OK]) <ide> elif method == 'POST': <ide> body = self.fixtures.load('load_balancers_post.json') <del> return self.response(httplib.ACCEPTED, body) <add> return (httplib.ACCEPTED, body, {'content-type': 'application/json'}, <add> httplib.responses[httplib.ACCEPTED]) <ide> <ide> def _1_0_load_balancers_lba_1235f(self, method, url, body, headers): <ide> if method == 'GET': <ide> body = self.fixtures.load('load_balancers_lba_1235f.json') <del> return self.response(httplib.OK, body) <add> return (httplib.OK, body, {'content-type': 'application/json'}, <add> httplib.responses[httplib.OK]) <ide> elif method == 'DELETE': <del> return self.response(httplib.ACCEPTED, '') <add> return (httplib.ACCEPTED, '', {'content-type': 'application/json'}, <add> httplib.responses[httplib.ACCEPTED]) <ide> <ide> def _1_0_load_balancers_lba_1235f_add_nodes(self, method, url, body, <ide> headers): <ide> if method == 'POST': <del> return self.response(httplib.ACCEPTED, '') <add> return (httplib.ACCEPTED, '', {'content-type': 'application/json'}, <add> httplib.responses[httplib.ACCEPTED]) <ide> <ide> def _1_0_load_balancers_lba_1235f_remove_nodes(self, method, url, body, <ide> headers): <ide> if method == 'POST': <del> return self.response(httplib.ACCEPTED, '') <del> <del> def response(self, status, body): <del> return (status, body, {'content-type': 'application/json'}, <del> httplib.responses[status]) <add> return (httplib.ACCEPTED, '', {'content-type': 'application/json'}, <add> httplib.responses[httplib.ACCEPTED]) <ide> <ide> <ide> if __name__ == "__main__":
1
Ruby
Ruby
add livecheck version and duplicate pr check
ea2f4087febd3c9d67cb6013efa5f034a28ee3a2
<ide><path>Library/Homebrew/dev-cmd/bump.rb <ide> # frozen_string_literal: true <ide> <ide> require "cli/parser" <add>require "utils/popen" <ide> <ide> module Homebrew <ide> module_function <ide> def bump_args <ide> Homebrew::CLI::Parser.new do <ide> usage_banner <<~EOS <ide> `bump` <add> <ide> Display out-of-date brew formulae, the latest version available, and whether a pull request has been opened. <ide> EOS <ide> end <ide> def bump <ide> bump_args.parse <ide> <ide> outdated_repology_packages = RepologyParser.parse_api_response <del> ohai RepologyParser.validate__packages(outdated_repology_packages) <add> outdated_packages = RepologyParser.validate_and_format_packages(outdated_repology_packages) <add> <add> display(outdated_packages) <add> end <add> <add> def display(outdated_packages) <add> ohai "Outdated Formulae" <add> <add> outdated_packages.each do |formula, package_details| <add> puts "" <add> puts "Formula: #{formula}" <add> puts "Current formula version: #{package_details["current_formula_version"]}" <add> puts "Latest repology version: #{package_details["repology_latest_version"]}" <add> puts "Latest livecheck version: #{package_details["livecheck_latest_version"]}" <add> puts "Open pull requests: #{package_details["open_pull_requests"]}" <add> end <ide> end <ide> end <ide><path>Library/Homebrew/utils/livecheck.rb <del># frozen_string_literal: true <del> <del>module Livecheck <del> def livecheck_formula_response(name) <del> ohai "Checking livecheck formula : #{name}" <del> <del> response = Utils.popen_read("brew", "livecheck", name, "--quiet").chomp <del> parse_livecheck_response(response) <del> end <del> <del> def parse_livecheck_response(response) <del> output = response.delete(" ").split(/:|==>/) <del> <del> # eg: ["burp", "2.2.18", "2.2.18"] <del> package_name, brew_version, latest_version = output <del> <del> { <del> name: package_name, <del> formula_version: brew_version, <del> livecheck_version: latest_version, <del> } <del> end <del>end <ide><path>Library/Homebrew/utils/repology.rb <ide> # frozen_string_literal: true <ide> <ide> require "utils/curl" <add>require "utils/versions" <add> <ide> require "formula_info" <ide> <ide> module RepologyParser <ide> module_function <ide> <del> MAX_PAGE_LIMIT = 15 <del> <ide> def query_api(last_package_in_response = "") <del> url = "https://repology.org/api/v1/projects/#{last_package_in_response}/?inrepo=homebrew&outdated=1" <add> url = "https://repology.org/api/v1/projects/#{last_package_in_response}?inrepo=homebrew&outdated=1" <ide> ohai "Calling API #{url}" if Homebrew.args.verbose? <ide> <ide> output, _errors, _status = curl_output(url.to_s) <ide> def query_api(last_package_in_response = "") <ide> def parse_api_response <ide> ohai "Querying outdated packages from Repology" <ide> page_no = 1 <del> ohai "Paginating Repology api page: #{page_no}" if Homebrew.args.verbose? <add> ohai "Paginating repology api page: #{page_no}" if Homebrew.args.verbose? <ide> <ide> outdated_packages = query_api <del> last_package_index = outdated_packages.size - 1 <add> last_pacakge_index = outdated_packages.size - 1 <ide> response_size = outdated_packages.size <add> page_limit = 15 <ide> <del> while response_size > 1 && page_no <= MAX_PAGE_LIMIT <add> while response_size > 1 && page_no <= page_limit <ide> page_no += 1 <del> ohai "Paginating Repology api page: #{page_no}" if Homebrew.args.verbose? <add> ohai "Paginating repology api page: #{page_no}" if Homebrew.args.verbose? <ide> <del> last_package_in_response = outdated_packages.keys[last_package_index] <del> response = query_api(last_package_in_response) <add> last_package_in_response = outdated_packages.keys[last_pacakge_index] <add> response = query_api("#{last_package_in_response}/") <ide> <ide> response_size = response.size <ide> outdated_packages.merge!(response) <del> last_package_index = outdated_packages.size - 1 <add> last_pacakge_index = outdated_packages.size - 1 <ide> end <ide> <ide> ohai "#{outdated_packages.size} outdated packages identified" <ide> <ide> outdated_packages <ide> end <ide> <del> def validate__packages(outdated_repology_packages) <del> ohai "Verifying outdated Repology packages as Homebrew Formulae" <add> def validate_and_format_packages(outdated_repology_packages) <add> ohai "Verifying outdated repology packages as Homebrew Formulae" <ide> <ide> packages = {} <ide> outdated_repology_packages.each do |_name, repositories| <ide> def validate__packages(outdated_repology_packages) <ide> latest_version = repo["version"] if repo["status"] == "newest" <ide> end <ide> <del> info = FormulaInfo.lookup(repology_homebrew_repo["srcname"]) <del> next unless info <del> <del> current_version = info.pkg_version <del> <del> packages[repology_homebrew_repo["srcname"]] = { <del> "repology_latest_version" => latest_version, <del> "current_formula_version" => current_version.to_s, <del> } <del> puts packages <add> packages[repology_homebrew_repo["srcname"]] = format_package(repology_homebrew_repo["srcname"], latest_version) <ide> end <ide> # hash of hashes {"aacgain"=>{"repology_latest_version"=>"1.9", "current_formula_version"=>"1.8"}, ...} <ide> packages <ide> end <add> <add> def format_package(package_name, latest_version) <add> current_version = Versions.current_formula_version(package_name) <add> livecheck_response = Versions.livecheck_formula(package_name) <add> pull_requests = Versions.check_for_duplicate_pull_requests(package_name, latest_version) <add> <add> formatted_package = { <add> "repology_latest_version" => latest_version, <add> "current_formula_version" => current_version.to_s, <add> "livecheck_latest_version" => livecheck_response["livecheck_latest_version"], <add> "open_pull_requests" => pull_requests, <add> } <add> <add> formatted_package <add> end <ide> end <ide><path>Library/Homebrew/utils/versions.rb <ide> # frozen_string_literal: true <ide> <del>require "formula" <del> <ide> module Versions <add> module_function <add> <ide> def current_formula_version(formula_name) <ide> Formula[formula_name].version.to_s.to_f <ide> end <ide> def bump_formula_pr(formula_name, url) <ide> formula_name, "--url=#{url}").chomp <ide> end <ide> <del> def check_for_open_pr(formula_name, download_url) <del> ohai "- Checking for open PRs for formula : #{formula_name}" <add> def check_for_open_pr(formula_name) <add> # ohai "- Checking for open PRs for formula : #{formula_name}" <add> <add> # response = bump_formula_pr(formula_name, download_url) <add> # !response.include? "Error: These open pull requests may be duplicates" <add> <add> # check_for_duplicate_pull_requests(formula, tap_full_name, new_formula_version.to_s) <add> end <add> <add> def livecheck_formula(formula) <add> ohai "Checking livecheck formula : #{formula}" if Homebrew.args.verbose? <add> <add> response = Utils.popen_read(HOMEBREW_BREW_FILE, "livecheck", formula, "--quiet").chomp <add> <add> parse_livecheck_response(response) <add> end <add> <add> def parse_livecheck_response(response) <add> output = response.delete(" ").split(/:|==>/) <add> <add> # eg: ["openclonk", "7.0", "8.1"] <add> package_name, brew_version, latest_version = output <add> <add> { <add> "formula" => package_name, <add> "current_brew_version" => brew_version, <add> "livecheck_latest_version" => latest_version, <add> } <add> end <add> <add> def fetch_pull_requests(query, tap_full_name, state: nil) <add> GitHub.issues_for_formula(query, tap_full_name: tap_full_name, state: state).select do |pr| <add> pr["html_url"].include?("/pull/") && <add> /(^|\s)#{Regexp.quote(query)}(:|\s|$)/i =~ pr["title"] <add> end <add> rescue GitHub::RateLimitExceededError => e <add> opoo e.message <add> [] <add> end <add> <add> def check_for_duplicate_pull_requests(formula, version) <add> formula = Formula[formula] <add> tap_full_name = formula.tap&.full_name <add> <add> # check for open requests <add> pull_requests = fetch_pull_requests(formula.name, tap_full_name, state: "open") <add> <add> # if we haven't already found open requests, try for an exact match across all requests <add> pull_requests = fetch_pull_requests("#{formula.name} #{version}", tap_full_name) if pull_requests.blank? <add> return if pull_requests.blank? <ide> <del> response = bump_formula_pr(formula_name, download_url) <del> !response.include? "Error: These open pull requests may be duplicates" <add> pull_requests.map { |pr| { "title" => pr["title"], "url" => pr["html_url"] } } <ide> end <ide> end
4
Text
Text
update contact info
d7bf2e0040b91443f14d2d23b73d6856683f3266
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> * [fhinkel](https://github.com/fhinkel) - <ide> **Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; (she/her) <ide> * [gabrielschulhof](https://github.com/gabrielschulhof) - <del>**Gabriel Schulhof** &lt;gabriel.schulhof@intel.com&gt; <add>**Gabriel Schulhof** &lt;gabrielschulhof@gmail.com&gt; <ide> * [gireeshpunathil](https://github.com/gireeshpunathil) - <ide> **Gireesh Punathil** &lt;gpunathi@in.ibm.com&gt; (he/him) <ide> * [jasnell](https://github.com/jasnell) - <ide> For information about the governance of the Node.js project, see <ide> * [Flarna](https://github.com/Flarna) - <ide> **Gerhard Stöbich** &lt;deb2001-github@yahoo.de&gt; (he/they) <ide> * [gabrielschulhof](https://github.com/gabrielschulhof) - <del>**Gabriel Schulhof** &lt;gabriel.schulhof@intel.com&gt; <add>**Gabriel Schulhof** &lt;gabrielschulhof@gmail.com&gt; <ide> * [gdams](https://github.com/gdams) - <ide> **George Adams** &lt;george.adams@uk.ibm.com&gt; (he/him) <ide> * [geek](https://github.com/geek) -
1
PHP
PHP
update docblock of aclcomponent
223604fb0dacc3decb88cc28244712ed0acab7a0
<ide><path>lib/Cake/Controller/Component/AclComponent.php <ide> public function adapter($adapter = null) { <ide> * Pass-thru function for ACL check instance. Check methods <ide> * are used to check whether or not an ARO can access an ACO <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> */ <ide> public function check($aro, $aco, $action = "*") { <ide> * Pass-thru function for ACL allow instance. Allow methods <ide> * are used to grant an ARO access to an ACO. <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> */ <ide> public function allow($aro, $aco, $action = "*") { <ide> * Pass-thru function for ACL deny instance. Deny methods <ide> * are used to remove permission from an ARO to access an ACO. <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> */ <ide> public function deny($aro, $aco, $action = "*") { <ide> * Pass-thru function for ACL inherit instance. Inherit methods <ide> * modify the permission for an ARO to be that of its parent object. <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> */ <ide> public function inherit($aro, $aco, $action = "*") { <ide> /** <ide> * Pass-thru function for ACL grant instance. An alias for AclComponent::allow() <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> * @deprecated <ide> public function grant($aro, $aco, $action = "*") { <ide> /** <ide> * Pass-thru function for ACL grant instance. An alias for AclComponent::deny() <ide> * <del> * @param string $aro ARO The requesting object identifier. <del> * @param string $aco ACO The controlled object identifier. <add> * @param mixed $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats <add> * @param mixed $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats <ide> * @param string $action Action (defaults to *) <ide> * @return boolean Success <ide> * @deprecated
1
Text
Text
add badges to reamde.md
55c7c502e032a65afc92ac780b69c1b3fb738738
<ide><path>README.md <ide> [![webpack](http://webpack.github.io/assets/logo.png)](http://webpack.github.io) <ide> <del>[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Gittip donate button][gittip-image]][gittip-url] <add>[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Gittip donate button][gittip-image]][gittip-url] [![Downloads](http://img.shields.io/npm/dm/webpack.svg)](http://badge.fury.io/js/webpack) <add>[![Build Status](https://travis-ci.org/webpack/webpack.svg?branch=master)](https://travis-ci.org/webpack/webpack) [![Coverage Status](https://coveralls.io/repos/webpack/webpack/badge.svg?branch=master&service=github)](https://coveralls.io/github/webpack/webpack?branch=master) <add>[![Dependency Status](https://david-dm.org/webpack/webpack.svg)](https://david-dm.org/webpack/webpack) [![devDependency Status](https://david-dm.org/webpack/webpack/dev-status.svg)](https://david-dm.org/webpack/webpack#info=devDependencies) [![peerDependency Status](https://david-dm.org/webpack/webpack/peer-status.svg)](https://david-dm.org/webpack/webpack#info=peerDependencies) <add> <add>[![NPM](https://nodei.co/npm/webpack.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/webpack) <ide> <ide> [documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top) <ide>
1
Text
Text
fix prettier linting
a231315bf49f13ed51094c0ba5b138ba2339f404
<ide><path>docs/advanced-features/amp-support/introduction.md <ide> description: With minimal config, and without leaving React, you can start addin <ide> </ul> <ide> </details> <ide> <del> <ide> With Next.js you can turn any React page into an AMP page, with minimal config, and without leaving React. <ide> <ide> You can read more about AMP in the official [amp.dev](https://amp.dev/) site.
1
Javascript
Javascript
remove extraneous buffersize setting
854171dc6f238be528e21e905c4764d9522b7033
<ide><path>lib/_stream_readable.js <ide> util.inherits(Readable, Stream); <ide> function ReadableState(options, stream) { <ide> options = options || {}; <ide> <del> // cast to an int <del> this.bufferSize = ~~this.bufferSize; <del> <ide> // the argument passed to this._read(n,cb) <ide> this.bufferSize = options.hasOwnProperty('bufferSize') ? <ide> options.bufferSize : 16 * 1024;
1
Javascript
Javascript
workaround an xml parsing bug in firefox
af1cd6f218f699abc34b1582a910c0df00312aee
<ide><path>test/unit/core.js <ide> QUnit.testUnlessIE( "jQuery.parseXML - error reporting", function( assert ) { <ide> column = columnMatch && columnMatch[ 1 ]; <ide> <ide> assert.strictEqual( line, "1", "reports error line" ); <del> assert.strictEqual( column, "11", "reports error column" ); <add> <add> // Support: Firefox 96-97+ <add> // Newer Firefox may report the column number smaller by 2 than it should. <add> // Accept both values until the issue is fixed. <add> // See https://bugzilla.mozilla.org/show_bug.cgi?id=1751796 <add> assert.ok( [ "9", "11" ].indexOf( column ) > -1, "reports error column" ); <add> // assert.strictEqual( column, "11", "reports error column" ); <ide> } ); <ide> <ide> testIframe(
1
PHP
PHP
return the api resource.
9b41936163a4e7c6e647491ce4d718157cea9a64
<ide><path>src/Illuminate/Routing/Router.php <ide> public function resource($name, $controller, array $options = []) <ide> * @param string $name <ide> * @param string $controller <ide> * @param array $options <del> * @return void <add> * @return \Illuminate\Routing\PendingResourceRegistration <ide> */ <ide> public function apiResource($name, $controller, array $options = []) <ide> { <del> $this->resource($name, $controller, array_merge([ <add> return $this->resource($name, $controller, array_merge([ <ide> 'only' => ['index', 'show', 'store', 'update', 'destroy'], <ide> ], $options)); <ide> }
1
Ruby
Ruby
drop unneeded drb require
fb4bb93d439f32421c8836261dce0c7de1addf82
<ide><path>actionpack/lib/action_controller/base.rb <ide> require 'action_view' <del>require 'drb' <ide> require 'set' <ide> <ide> module ActionController #:nodoc:
1
Javascript
Javascript
apply suggestions from code review
9a0d9a73ca82faea20ee18950c0b07cd4b71e859
<ide><path>.eslintrc.js <ide> module.exports = { <ide> <ide> rules: { <ide> '@typescript-eslint/ban-ts-comment': 'warn', <del> '@typescript-eslint/ban-types': 'warn', <del> '@typescript-eslint/no-empty-function': 'warn', <del> '@typescript-eslint/no-this-alias': 'warn', <add> '@typescript-eslint/ban-types': 'off', <add> '@typescript-eslint/no-empty-function': 'off', <add> '@typescript-eslint/no-this-alias': 'off', <ide> '@typescript-eslint/no-var-requires': 'warn', <ide> <ide> // TODO: Enable and fix these rules
1
Text
Text
add changelogs for http
cfa06fa59af4ae736e1ba087a112b4cc8504c785
<ide><path>doc/api/http.md <ide> not be emitted. <ide> ### Event: 'clientError' <ide> <!-- YAML <ide> added: v0.1.94 <add>changes: <add> - version: v6.0.0 <add> pr-url: https://github.com/nodejs/node/pull/4557 <add> description: The default action of calling `.destroy()` on the `socket` <add> will no longer take place if there are listeners attached <add> for `clientError`. <ide> --> <ide> <ide> * `exception` {Error} <ide> the request body should be sent. See the [`'checkContinue'`][] event on `Server` <ide> ### response.writeHead(statusCode[, statusMessage][, headers]) <ide> <!-- YAML <ide> added: v0.1.30 <add>changes: <add> - version: v5.11.0, v4.4.5 <add> pr-url: https://github.com/nodejs/node/pull/6291 <add> description: A `RangeError` is thrown if `statusCode` is not a number in <add> the range `[100, 999]`. <ide> --> <ide> <ide> * `statusCode` {Number}
1
Javascript
Javascript
use custom element on pane-element
ae937eca35511d2a8f00609345da14d61e99e4aa
<ide><path>src/pane-element.js <ide> const path = require('path'); <ide> const { CompositeDisposable } = require('event-kit'); <ide> <ide> class PaneElement extends HTMLElement { <del> createdCallback() { <add> constructor() { <add> super(); <ide> this.attached = false; <ide> this.subscriptions = new CompositeDisposable(); <ide> this.inlineDisplayStyles = new WeakMap(); <del> this.initializeContent(); <ide> this.subscribeToDOMEvents(); <add> this.itemViews = document.createElement('div'); <ide> } <ide> <del> attachedCallback() { <add> connectedCallback() { <add> this.initializeContent(); <ide> this.attached = true; <ide> if (this.model.isFocused()) { <ide> this.focus(); <ide> class PaneElement extends HTMLElement { <ide> initializeContent() { <ide> this.setAttribute('class', 'pane'); <ide> this.setAttribute('tabindex', -1); <del> this.itemViews = document.createElement('div'); <ide> this.appendChild(this.itemViews); <ide> this.itemViews.setAttribute('class', 'item-views'); <ide> } <ide> class PaneElement extends HTMLElement { <ide> }); <ide> } <ide> } <add> <ide> if (!this.itemViews.contains(itemView)) { <ide> this.itemViews.appendChild(itemView); <ide> } <ide> class PaneElement extends HTMLElement { <ide> } <ide> } <ide> <del>module.exports = document.registerElement('atom-pane', { <del> prototype: PaneElement.prototype <del>}); <add>function createPaneElement() { <add> return document.createElement('atom-pane'); <add>} <add> <add>window.customElements.define('atom-pane', PaneElement); <add> <add>module.exports = { <add> createPaneElement <add>}; <ide><path>src/pane.js <ide> const Grim = require('grim'); <ide> const { CompositeDisposable, Emitter } = require('event-kit'); <ide> const PaneAxis = require('./pane-axis'); <ide> const TextEditor = require('./text-editor'); <del>const PaneElement = require('./pane-element'); <add>const { createPaneElement } = require('./pane-element'); <ide> <ide> let nextInstanceId = 1; <ide> <ide> module.exports = class Pane { <ide> <ide> getElement() { <ide> if (!this.element) { <del> this.element = new PaneElement().initialize(this, { <add> this.element = createPaneElement().initialize(this, { <ide> views: this.viewRegistry, <ide> applicationDelegate: this.applicationDelegate <ide> });
2
Go
Go
fix logconfig.config in inspect
3f61002b05794eb5e4262a39e29f8a45c7260ba3
<ide><path>daemon/inspect.go <ide> func (daemon *Daemon) getInspectData(container *Container) (*types.ContainerJSON <ide> hostConfig.LogConfig.Type = daemon.defaultLogConfig.Type <ide> } <ide> <del> if hostConfig.LogConfig.Config == nil { <add> if len(hostConfig.LogConfig.Config) == 0 { <ide> hostConfig.LogConfig.Config = daemon.defaultLogConfig.Config <ide> } <ide> <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonCorruptedSyslogAddress(c *check.C) { <ide> c.Fatalf("Expected 'Error starting daemon' message; but doesn't exist in log: %q, err: %v", out, err) <ide> } <ide> } <add> <add>func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) { <add> c.Assert(s.d.Start("--log-driver=json-file", "--log-opt=max-size=1k"), check.IsNil) <add> out, err := s.d.Cmd("run", "-d", "--name=logtest", "busybox", "top") <add> c.Assert(err, check.IsNil, check.Commentf("Output: %s, err: %v", out, err)) <add> out, err = s.d.Cmd("inspect", "-f", "{{ .HostConfig.LogConfig.Config }}", "logtest") <add> c.Assert(err, check.IsNil, check.Commentf("Output: %s", out)) <add> cfg := strings.TrimSpace(out) <add> if cfg != "map[max-size:1k]" { <add> c.Fatalf("Unexpected log-opt: %s, expected map[max-size:1k]", cfg) <add> } <add>}
2
PHP
PHP
add defaulting and *orfail() to session
e81bb1bb2c0f3ba85f7aa6c8401a674f6f5314e7
<ide><path>src/Http/Session.php <ide> public function check(?string $name = null): bool <ide> * Returns given session variable, or all of them, if no parameters given. <ide> * <ide> * @param string|null $name The name of the session variable (or a path as sent to Hash.extract) <add> * @param mixed $default The return value when the path does not exist <ide> * @return string|array|null The value of the session variable, null if session not available, <ide> * session not started, or provided name not found in the session. <ide> */ <del> public function read(?string $name = null) <add> public function read(?string $name = null, $default = null) <ide> { <ide> if ($this->_hasSession() && !$this->started()) { <ide> $this->start(); <ide> public function read(?string $name = null) <ide> return $_SESSION ?: []; <ide> } <ide> <del> return Hash::get($_SESSION, $name); <add> return Hash::get($_SESSION, $name, $default); <add> } <add> <add> /** <add> * Returns given session variable, or throws Exception if not found. <add> * <add> * @param string $name The name of the session variable (or a path as sent to Hash.extract) <add> * @throws \RuntimeException <add> * @return array|string|null <add> */ <add> public function readOrFail(string $name) <add> { <add> if ($this->check($name) === false) { <add> throw new RuntimeException(sprintf('Expected session key "%s" not found.', $name)); <add> } <add> <add> return $this->read($name); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Http/SessionTest.php <ide> use Cake\Http\Session; <ide> use Cake\TestSuite\TestCase; <ide> use InvalidArgumentException; <add>use RuntimeException; <ide> use TestApp\Http\Session\TestAppLibSession; <ide> use TestApp\Http\Session\TestWebSession; <ide> <ide> public function testReadEmpty() <ide> $this->assertNull($session->read('')); <ide> } <ide> <add> /** <add> * Tests read() with defaulting. <add> * <add> * @return void <add> */ <add> public function testReadDefault() <add> { <add> $session = new Session(); <add> $this->assertSame('bar', $session->read('foo', 'bar')); <add> } <add> <add> /** <add> * Tests readOrFail() <add> * <add> * @return void <add> */ <add> public function testReadOrFail() <add> { <add> $session = new Session(); <add> $session->write('testing', '1,2,3'); <add> $result = $session->readOrFail('testing'); <add> $this->assertSame('1,2,3', $result); <add> <add> $session->write('testing', ['1' => 'one', '2' => 'two', '3' => 'three']); <add> $result = $session->readOrFail('testing.1'); <add> $this->assertSame('one', $result); <add> } <add> <add> /** <add> * Tests readOrFail() with nonexistent value <add> * <add> * @return void <add> */ <add> public function testReadOrFailException() <add> { <add> $session = new Session(); <add> <add> $this->expectException(RuntimeException::class); <add> <add> $session->readOrFail('testing'); <add> } <add> <ide> /** <ide> * Test writing simple keys <ide> *
2
Python
Python
fix loading clip vision model
d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee
<ide><path>examples/research_projects/jax-projects/hybrid_clip/configuration_hybrid_clip.py <ide> def __init__(self, projection_dim=512, **kwargs): <ide> <ide> if vision_model_type == "clip": <ide> self.vision_config = AutoConfig.for_model(vision_model_type, **vision_config).vision_config <add> elif vision_model_type == "clip_vision_model": <add> from transformers import CLIPVisionConfig <add> <add> self.vision_config = CLIPVisionConfig(**vision_config) <ide> else: <ide> self.vision_config = AutoConfig.for_model(vision_model_type, **vision_config) <ide>
1
Text
Text
fix tagtree.tv link
00037b3ec243223655a58f57b58558877c296754
<ide><path>docs/docs/videos.md <ide> next: complementary-tools.html <ide> <ide> ### Thinking in react - tagtree.tv <ide> <del>A [tagtree.tv](htp://tagtree.tv/) video conveying the principles of [Thinking in React](/react/docs/thinking-in-react.html) while building a simple app <add>A [tagtree.tv](http://tagtree.tv/) video conveying the principles of [Thinking in React](/react/docs/thinking-in-react.html) while building a simple app <ide> <figure>[![](/react/img/docs/thinking-in-react-tagtree.png)](http://tagtree.tv/thinking-in-react)</figure> <ide> <ide>
1
Python
Python
fix french test (see )
17849dee4bfb65a792e81d6d0bede05bb91d6102
<ide><path>spacy/tests/lang/fr/test_lemmatization.py <ide> def test_lemmatizer_noun_verb_2(FR): <ide> <ide> @pytest.mark.models('fr') <ide> @pytest.mark.xfail(reason="Costaricienne TAG is PROPN instead of NOUN and spacy don't lemmatize PROPN") <del>def test_lemmatizer_noun(model): <add>def test_lemmatizer_noun(FR): <ide> tokens = FR("il y a des Costaricienne.") <ide> assert tokens[4].lemma_ == "Costaricain" <ide>
1
Go
Go
move apparmor into security sub dir
d26ea78e42ebf18219b88e01c6252f30aa764aa2
<ide><path>pkg/libcontainer/nsinit/init.go <ide> import ( <ide> "github.com/dotcloud/docker/pkg/libcontainer" <ide> "github.com/dotcloud/docker/pkg/libcontainer/capabilities" <ide> "github.com/dotcloud/docker/pkg/libcontainer/network" <add> "github.com/dotcloud/docker/pkg/libcontainer/security/apparmor" <ide> "github.com/dotcloud/docker/pkg/libcontainer/utils" <ide> "github.com/dotcloud/docker/pkg/system" <ide> "github.com/dotcloud/docker/pkg/user"
1
Text
Text
fix minor grammar mistake
ad7696a78775df7cc671113b29fb34ca66b3ace5
<ide><path>docs/articles/dockerfile_best-practices.md <ide> these checksums. During the cache lookup, the checksum is compared against the <ide> checksum in the existing images. If anything has changed in the file(s), such <ide> as the contents and metadata, then the cache is invalidated. <ide> <del>* Aside from the `ADD` and `COPY` commands cache checking will not look at the <add>* Aside from the `ADD` and `COPY` commands, cache checking will not look at the <ide> files in the container to determine a cache match. For example, when processing <ide> a `RUN apt-get -y update` command the files updated in the container <ide> will not be examined to determine if a cache hit exists. In that case just
1
Python
Python
use actual classes instead of dictionary
30c3d023b37f351bcba7fc412fff191b072f9c6e
<ide><path>tests/providers/google/cloud/operators/test_datacatalog.py <ide> from google.api_core.exceptions import AlreadyExists <ide> from google.api_core.retry import Retry <ide> from google.cloud.datacatalog_v1beta1.types import Entry, EntryGroup, Tag, TagTemplate, TagTemplateField <add>from google.protobuf.field_mask_pb2 import FieldMask <ide> <ide> from airflow.providers.google.cloud.operators.datacatalog import ( <ide> CloudDataCatalogCreateEntryGroupOperator, <ide> CloudDataCatalogUpdateTagTemplateFieldOperator, <ide> CloudDataCatalogUpdateTagTemplateOperator, <ide> ) <add>from airflow.utils.context import Context <ide> <ide> TEST_PROJECT_ID: str = "example_id" <ide> TEST_LOCATION: str = "en-west-3" <ide> TEST_TAG_TEMPLATE_FIELD_ID: str = "test-tag-template-field-id" <ide> TEST_TAG_TEMPLATE_NAME: str = "test-tag-template-field-name" <ide> TEST_FORCE: bool = False <del>TEST_READ_MASK: Dict = {"fields": ["name"]} <add>TEST_READ_MASK: FieldMask = FieldMask(paths=["name"]) <ide> TEST_RESOURCE: str = "test-resource" <ide> TEST_OPTIONS_: Dict = {} <ide> TEST_PAGE_SIZE: int = 50 <ide> def test_assert_valid_hook_call(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> def test_assert_valid_hook_call_when_exists(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> def test_assert_valid_hook_call(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> def test_assert_valid_hook_call(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> def test_assert_valid_hook_call(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> def test_assert_valid_hook_call(self, mock_hook) -> None: <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide> ) <ide> ti = mock.MagicMock() <del> result = task.execute(context={"task_instance": ti}) <add> result = task.execute(context=Context(task_instance=ti)) <ide> mock_hook.assert_called_once_with( <ide> gcp_conn_id=TEST_GCP_CONN_ID, <ide> impersonation_chain=TEST_IMPERSONATION_CHAIN, <ide><path>tests/providers/google/cloud/operators/test_dataproc_metastore.py <ide> from unittest import TestCase, mock <ide> <ide> from google.api_core.retry import Retry <add>from google.protobuf.field_mask_pb2 import FieldMask <ide> <ide> from airflow.providers.google.cloud.operators.dataproc_metastore import ( <ide> DataprocMetastoreCreateBackupOperator, <ide> "second_key": "second_value", <ide> } <ide> } <del>TEST_UPDATE_MASK: dict = {"paths": ["labels"]} <add>TEST_UPDATE_MASK: FieldMask = FieldMask(paths=["labels"]) <ide> TEST_DESTINATION_GCS_FOLDER: str = "gs://bucket_name/path_inside_bucket" <ide> <ide>
2
PHP
PHP
use fqn in docblocks
360c04e72611509e60ae91092ee5fdcfa80fc12d
<ide><path>src/ORM/AssociationCollection.php <ide> class AssociationCollection { <ide> * This makes using plugins simpler as the Plugin.Class syntax is frequently used. <ide> * <ide> * @param string $alias The association alias <del> * @param Association $association The association to add. <del> * @return Association The association object being added. <add> * @param \Cake\ORM\Association $association The association to add. <add> * @return \Cake\ORM\Association The association object being added. <ide> */ <ide> public function add($alias, Association $association) { <ide> list(, $alias) = pluginSplit($alias); <ide> public function add($alias, Association $association) { <ide> * Fetch an attached association by name. <ide> * <ide> * @param string $alias The association alias to get. <del> * @return Association|null Either the association or null. <add> * @return \Cake\ORM\Association|null Either the association or null. <ide> */ <ide> public function get($alias) { <ide> $alias = strtolower($alias); <ide> public function get($alias) { <ide> * Fetch an association by property name. <ide> * <ide> * @param string $prop The property to find an association by. <del> * @return Association|null Either the association or null. <add> * @return \Cake\ORM\Association|null Either the association or null. <ide> */ <ide> public function getByProperty($prop) { <ide> foreach ($this->_items as $assoc) { <ide> public function removeAll() { <ide> * Parent associations include any association where the given table <ide> * is the owning side. <ide> * <del> * @param Table $table The table entity is for. <del> * @param Entity $entity The entity to save associated data for. <add> * @param \Cake\ORM\Table $table The table entity is for. <add> * @param \Cake\ORM\Entity $entity The entity to save associated data for. <ide> * @param array $associations The list of associations to save parents from. <ide> * associations not in this list will not be saved. <ide> * @param array $options The options for the save operation. <ide> public function saveParents(Table $table, Entity $entity, $associations, array $ <ide> * Child associations include any association where the given table <ide> * is not the owning side. <ide> * <del> * @param Table $table The table entity is for. <del> * @param Entity $entity The entity to save associated data for. <add> * @param \Cake\ORM\Table $table The table entity is for. <add> * @param \Cake\ORM\Entity $entity The entity to save associated data for. <ide> * @param array $associations The list of associations to save children from. <ide> * associations not in this list will not be saved. <ide> * @param array $options The options for the save operation. <ide> public function saveChildren(Table $table, Entity $entity, array $associations, <ide> /** <ide> * Helper method for saving an association's data. <ide> * <del> * @param Table $table The table the save is currently operating on <del> * @param Entity $entity The entity to save <add> * @param \Cake\ORM\Table $table The table the save is currently operating on <add> * @param \Cake\ORM\Entity $entity The entity to save <ide> * @param array $associations Array of associations to save. <ide> * @param array $options Original options <ide> * @param bool $owningSide Compared with association classes' <ide> protected function _saveAssociations($table, $entity, $associations, $options, $ <ide> /** <ide> * Helper method for saving an association's data. <ide> * <del> * @param Association $association The association object to save with. <del> * @param Entity $entity The entity to save <add> * @param \Cake\ORM\Association $association The association object to save with. <add> * @param \Cake\ORM\Entity $entity The entity to save <ide> * @param array $nested Options for deeper associations <ide> * @param array $options Original options <ide> * @return bool Success <ide> protected function _save($association, $entity, $nested, $options) { <ide> /** <ide> * Cascade a delete across the various associations. <ide> * <del> * @param Entity $entity The entity to delete associations for. <add> * @param \Cake\ORM\Entity $entity The entity to delete associations for. <ide> * @param array $options The options used in the delete operation. <ide> * @return void <ide> */
1
Text
Text
add a chapter to the chinese laravel doc
3cc6db752d34974dc238331b5f4d67881f04079f
<ide><path>guide/chinese/laravel/index.md <ide> localeTitle: Laravel <ide> <ide> Laravel是一个免费的开源PHP Web框架,可在[GitHub上](https://github.com/laravel/laravel)获得,并根据MIT许可条款获得许可。它是由泰勒·奥特威尔(Taylor Otwell)创建的,他设计的目标是按照模型 - 视图 - 控制器(MVC)架构模式开发Web应用程序,现在它是GitHub上最受欢迎的PHP框架。 Laravel中的一些主要功能是访问关系数据库的不同方式,有助于应用程序部署和维护的实用程序,以及最后但并非最不重要的具有专用依赖关系管理器的模块化打包系统。 <ide> <del>因为Laravel是开源的,所以它周围的社区非常强大,文档也是如此,你可以学习如何做几乎所有的事情,试着看一下[Laravel文档](https://laravel.com/docs/5.7/) ,一睹开源的力量! <ide>\ No newline at end of file <add>因为Laravel是开源的,所以它周围的社区非常强大,文档也是如此,你可以学习如何做几乎所有的事情,试着看一下[Laravel文档](https://laravel.com/docs/5.7/) ,一睹开源的力量! <add> <add>###新特性 <add>Laravel通过Composer和Packagist提供即用型软件包,包括以下内容: <add>Cashier,由Lavavel引入,提供了基于Stripe的处理收银服务,例如处理优惠券和生成发票。 <add>SSH,由Laravel4.1引入,允许使用Secure Shell在远程服务器上以编程方式执行CLI命令,通过安全的网络协议。 <add>Scheduler,由Laravel5.0引入,是对Artisan命令行的增强,允许以编程方式安排定期执行的任务。在内部,Scheduler依赖于cron守护程序来运行单个Artisan作业,而该作业又执行已配置的任务。 <add>Flysystem,由Laravel5.0引入,是一个文件系统抽象层,它允许以相同的方式透明地使用由Amazon S3和Rackspace Cloud提供的本地文件系统和基于云的存储服务。 <add>Socialite,由Laravel5.0引入,作为可选包,为不同的OAuth提供商提供简化的身份验证机制,包括Facebook,Twitter,Google,GitHub和Bitbucket。
1
Ruby
Ruby
get the name from the reflection
07d522b1bee0cec428c332ac8b7099a737f7ea35
<ide><path>activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb <ide> def valid_options <ide> <ide> def define_callbacks(model, reflection) <ide> super <del> name = self.name <add> name = reflection.name <ide> model.send(:include, Module.new { <ide> class_eval <<-RUBY, __FILE__, __LINE__ + 1 <ide> def destroy_associations
1
Go
Go
remove unnecessary archive and reader type
aa2cc18745cbe0231c33782f0fa764f657e3fb88
<ide><path>builder/remote.go <ide> func DetectContextFromRemoteURL(r io.ReadCloser, remoteURL string, createProgres <ide> dockerfileName = DefaultDockerfileName <ide> <ide> // TODO: return a context without tarsum <del> return archive.Generate(dockerfileName, string(dockerfile)) <add> r, err := archive.Generate(dockerfileName, string(dockerfile)) <add> if err != nil { <add> return nil, err <add> } <add> <add> return ioutil.NopCloser(r), nil <ide> }, <ide> // fallback handler (tar context) <ide> "": func(rc io.ReadCloser) (io.ReadCloser, error) { <ide><path>builder/remote_test.go <ide> func TestMakeRemoteContext(t *testing.T) { <ide> if err != nil { <ide> return nil, err <ide> } <del> return archive.Generate(DefaultDockerfileName, string(dockerfile)) <add> <add> r, err := archive.Generate(DefaultDockerfileName, string(dockerfile)) <add> if err != nil { <add> return nil, err <add> } <add> return ioutil.NopCloser(r), nil <ide> }, <ide> }) <ide> <ide><path>daemon/commit.go <ide> package daemon <ide> import ( <ide> "encoding/json" <ide> "fmt" <add> "io" <ide> "runtime" <ide> "strings" <ide> "time" <ide> import ( <ide> "github.com/docker/docker/dockerversion" <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/layer" <del> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/reference" <ide> "github.com/docker/go-connections/nat" <ide> func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str <ide> return id.String(), nil <ide> } <ide> <del>func (daemon *Daemon) exportContainerRw(container *container.Container) (archive.Archive, error) { <add>func (daemon *Daemon) exportContainerRw(container *container.Container) (io.ReadCloser, error) { <ide> if err := daemon.Mount(container); err != nil { <ide> return nil, err <ide> } <ide><path>daemon/export.go <ide> func (daemon *Daemon) ContainerExport(name string, out io.Writer) error { <ide> return nil <ide> } <ide> <del>func (daemon *Daemon) containerExport(container *container.Container) (archive.Archive, error) { <add>func (daemon *Daemon) containerExport(container *container.Container) (io.ReadCloser, error) { <ide> if err := daemon.Mount(container); err != nil { <ide> return nil, err <ide> } <ide><path>daemon/graphdriver/aufs/aufs.go <ide> package aufs <ide> import ( <ide> "bufio" <ide> "fmt" <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "os/exec" <ide> func (a *Driver) Put(id string) error { <ide> <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <del>func (a *Driver) Diff(id, parent string) (archive.Archive, error) { <add>func (a *Driver) Diff(id, parent string) (io.ReadCloser, error) { <ide> // AUFS doesn't need the parent layer to produce a diff. <ide> return archive.TarWithOptions(path.Join(a.rootPath(), "diff", id), &archive.TarOptions{ <ide> Compression: archive.Uncompressed, <ide> func (a *Driver) DiffGetter(id string) (graphdriver.FileGetCloser, error) { <ide> return fileGetNilCloser{storage.NewPathFileGetter(p)}, nil <ide> } <ide> <del>func (a *Driver) applyDiff(id string, diff archive.Reader) error { <add>func (a *Driver) applyDiff(id string, diff io.Reader) error { <ide> return chrootarchive.UntarUncompressed(diff, path.Join(a.rootPath(), "diff", id), &archive.TarOptions{ <ide> UIDMaps: a.uidMaps, <ide> GIDMaps: a.gidMaps, <ide> func (a *Driver) DiffSize(id, parent string) (size int64, err error) { <ide> // ApplyDiff extracts the changeset from the given diff into the <ide> // layer with the specified id and parent, returning the size of the <ide> // new layer in bytes. <del>func (a *Driver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) { <add>func (a *Driver) ApplyDiff(id, parent string, diff io.Reader) (size int64, err error) { <ide> // AUFS doesn't need the parent id to apply the diff. <ide> if err = a.applyDiff(id, diff); err != nil { <ide> return <ide><path>daemon/graphdriver/driver.go <ide> package graphdriver <ide> import ( <ide> "errors" <ide> "fmt" <add> "io" <ide> "os" <ide> "path/filepath" <ide> "strings" <ide> type Driver interface { <ide> ProtoDriver <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <del> Diff(id, parent string) (archive.Archive, error) <add> Diff(id, parent string) (io.ReadCloser, error) <ide> // Changes produces a list of changes between the specified layer <ide> // and its parent layer. If parent is "", then all changes will be ADD changes. <ide> Changes(id, parent string) ([]archive.Change, error) <ide> // ApplyDiff extracts the changeset from the given diff into the <ide> // layer with the specified id and parent, returning the size of the <ide> // new layer in bytes. <ide> // The archive.Reader must be an uncompressed stream. <del> ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) <add> ApplyDiff(id, parent string, diff io.Reader) (size int64, err error) <ide> // DiffSize calculates the changes between the specified id <ide> // and its parent and returns the size in bytes of the changes <ide> // relative to its base filesystem directory. <ide><path>daemon/graphdriver/fsdiff.go <ide> package graphdriver <ide> <ide> import ( <add> "io" <ide> "time" <ide> <ide> "github.com/Sirupsen/logrus" <del> <ide> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/chrootarchive" <ide> "github.com/docker/docker/pkg/idtools" <ide> func NewNaiveDiffDriver(driver ProtoDriver, uidMaps, gidMaps []idtools.IDMap) Dr <ide> <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <del>func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) { <add>func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, err error) { <ide> startTime := time.Now() <ide> driver := gdw.ProtoDriver <ide> <ide> func (gdw *NaiveDiffDriver) Changes(id, parent string) ([]archive.Change, error) <ide> // ApplyDiff extracts the changeset from the given diff into the <ide> // layer with the specified id and parent, returning the size of the <ide> // new layer in bytes. <del>func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) { <add>func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff io.Reader) (size int64, err error) { <ide> driver := gdw.ProtoDriver <ide> <ide> // Mount the root filesystem so we can apply the diff/layer. <ide><path>daemon/graphdriver/overlay/overlay.go <ide> package overlay <ide> import ( <ide> "bufio" <ide> "fmt" <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "os/exec" <ide> "path" <ide> "syscall" <ide> <ide> "github.com/Sirupsen/logrus" <del> <ide> "github.com/docker/docker/daemon/graphdriver" <ide> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/idtools" <del> <ide> "github.com/docker/docker/pkg/mount" <ide> "github.com/opencontainers/runc/libcontainer/label" <ide> ) <ide> type ApplyDiffProtoDriver interface { <ide> graphdriver.ProtoDriver <ide> // ApplyDiff writes the diff to the archive for the given id and parent id. <ide> // It returns the size in bytes written if successful, an error ErrApplyDiffFallback is returned otherwise. <del> ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) <add> ApplyDiff(id, parent string, diff io.Reader) (size int64, err error) <ide> } <ide> <ide> type naiveDiffDriverWithApply struct { <ide> func NaiveDiffDriverWithApply(driver ApplyDiffProtoDriver, uidMaps, gidMaps []id <ide> } <ide> <ide> // ApplyDiff creates a diff layer with either the NaiveDiffDriver or with a fallback. <del>func (d *naiveDiffDriverWithApply) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) { <add>func (d *naiveDiffDriverWithApply) ApplyDiff(id, parent string, diff io.Reader) (int64, error) { <ide> b, err := d.applyDiff.ApplyDiff(id, parent, diff) <ide> if err == ErrApplyDiffFallback { <ide> return d.Driver.ApplyDiff(id, parent, diff) <ide> func (d *Driver) Put(id string) error { <ide> } <ide> <ide> // ApplyDiff applies the new layer on top of the root, if parent does not exist with will return an ErrApplyDiffFallback error. <del>func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) { <add>func (d *Driver) ApplyDiff(id string, parent string, diff io.Reader) (size int64, err error) { <ide> dir := d.dir(id) <ide> <ide> if parent == "" { <ide><path>daemon/graphdriver/overlay2/overlay.go <ide> import ( <ide> "bufio" <ide> "errors" <ide> "fmt" <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "os/exec" <ide> func (d *Driver) Exists(id string) bool { <ide> } <ide> <ide> // ApplyDiff applies the new layer into a root <del>func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) { <add>func (d *Driver) ApplyDiff(id string, parent string, diff io.Reader) (size int64, err error) { <ide> applyDir := d.getDiffPath(id) <ide> <ide> logrus.Debugf("Applying tar in %s", applyDir) <ide> func (d *Driver) DiffSize(id, parent string) (size int64, err error) { <ide> <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <del>func (d *Driver) Diff(id, parent string) (archive.Archive, error) { <add>func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) { <ide> diffPath := d.getDiffPath(id) <ide> logrus.Debugf("Tar with options on %s", diffPath) <ide> return archive.TarWithOptions(diffPath, &archive.TarOptions{ <ide><path>daemon/graphdriver/proxy.go <ide> package graphdriver <ide> import ( <ide> "errors" <ide> "fmt" <add> "io" <ide> <ide> "github.com/docker/docker/pkg/archive" <ide> ) <ide> func (d *graphDriverProxy) Cleanup() error { <ide> return nil <ide> } <ide> <del>func (d *graphDriverProxy) Diff(id, parent string) (archive.Archive, error) { <add>func (d *graphDriverProxy) Diff(id, parent string) (io.ReadCloser, error) { <ide> args := &graphDriverRequest{ <ide> ID: id, <ide> Parent: parent, <ide> func (d *graphDriverProxy) Diff(id, parent string) (archive.Archive, error) { <ide> if err != nil { <ide> return nil, err <ide> } <del> return archive.Archive(body), nil <add> return body, nil <ide> } <ide> <ide> func (d *graphDriverProxy) Changes(id, parent string) ([]archive.Change, error) { <ide> func (d *graphDriverProxy) Changes(id, parent string) ([]archive.Change, error) <ide> return ret.Changes, nil <ide> } <ide> <del>func (d *graphDriverProxy) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) { <add>func (d *graphDriverProxy) ApplyDiff(id, parent string, diff io.Reader) (int64, error) { <ide> var ret graphDriverResponse <ide> if err := d.client.SendFile(fmt.Sprintf("GraphDriver.ApplyDiff?id=%s&parent=%s", id, parent), diff, &ret); err != nil { <ide> return -1, err <ide><path>daemon/graphdriver/windows/windows.go <ide> func (d *Driver) Cleanup() error { <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <ide> // The layer should be mounted when calling this function <del>func (d *Driver) Diff(id, parent string) (_ archive.Archive, err error) { <add>func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) { <ide> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return <ide> func (d *Driver) Changes(id, parent string) ([]archive.Change, error) { <ide> // layer with the specified id and parent, returning the size of the <ide> // new layer in bytes. <ide> // The layer should not be mounted when calling this function <del>func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) { <add>func (d *Driver) ApplyDiff(id, parent string, diff io.Reader) (int64, error) { <ide> var layerChain []string <ide> if parent != "" { <ide> rPId, err := d.resolveID(parent) <ide> func writeTarFromLayer(r hcsshim.LayerReader, w io.Writer) error { <ide> } <ide> <ide> // exportLayer generates an archive from a layer based on the given ID. <del>func (d *Driver) exportLayer(id string, parentLayerPaths []string) (archive.Archive, error) { <add>func (d *Driver) exportLayer(id string, parentLayerPaths []string) (io.ReadCloser, error) { <ide> archive, w := io.Pipe() <ide> go func() { <ide> err := winio.RunWithPrivilege(winio.SeBackupPrivilege, func() error { <ide> func writeBackupStreamFromTarAndSaveMutatedFiles(buf *bufio.Writer, w io.Writer, <ide> return backuptar.WriteBackupStreamFromTarFile(buf, t, hdr) <ide> } <ide> <del>func writeLayerFromTar(r archive.Reader, w hcsshim.LayerWriter, root string) (int64, error) { <add>func writeLayerFromTar(r io.Reader, w hcsshim.LayerWriter, root string) (int64, error) { <ide> t := tar.NewReader(r) <ide> hdr, err := t.Next() <ide> totalSize := int64(0) <ide> func writeLayerFromTar(r archive.Reader, w hcsshim.LayerWriter, root string) (in <ide> } <ide> <ide> // importLayer adds a new layer to the tag and graph store based on the given data. <del>func (d *Driver) importLayer(id string, layerData archive.Reader, parentLayerPaths []string) (size int64, err error) { <add>func (d *Driver) importLayer(id string, layerData io.Reader, parentLayerPaths []string) (size int64, err error) { <ide> cmd := reexec.Command(append([]string{"docker-windows-write-layer", d.info.HomeDir, id}, parentLayerPaths...)...) <ide> output := bytes.NewBuffer(nil) <ide> cmd.Stdin = layerData <ide><path>integration-cli/docker_cli_external_graphdriver_unix_test.go <ide> func (s *DockerExternalGraphdriverSuite) setUpPlugin(c *check.C, name string, ex <ide> <ide> mux.HandleFunc("/GraphDriver.ApplyDiff", func(w http.ResponseWriter, r *http.Request) { <ide> s.ec[ext].applydiff++ <del> var diff archive.Reader = r.Body <add> var diff io.Reader = r.Body <ide> defer r.Body.Close() <ide> <ide> id := r.URL.Query().Get("id") <ide><path>layer/layer_store.go <ide> import ( <ide> "github.com/docker/distribution" <ide> "github.com/docker/distribution/digest" <ide> "github.com/docker/docker/daemon/graphdriver" <del> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/idtools" <ide> "github.com/docker/docker/pkg/plugingetter" <ide> "github.com/docker/docker/pkg/stringid" <ide> func (ls *layerStore) applyTar(tx MetadataTransaction, ts io.Reader, parent stri <ide> return err <ide> } <ide> <del> applySize, err := ls.driver.ApplyDiff(layer.cacheID, parent, archive.Reader(rdr)) <add> applySize, err := ls.driver.ApplyDiff(layer.cacheID, parent, rdr) <ide> if err != nil { <ide> return err <ide> } <ide><path>layer/migration_test.go <ide> func TestLayerMigration(t *testing.T) { <ide> if err := graph.Create(graphID1, "", "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del> if _, err := graph.ApplyDiff(graphID1, "", archive.Reader(bytes.NewReader(tar1))); err != nil { <add> if _, err := graph.ApplyDiff(graphID1, "", bytes.NewReader(tar1)); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> func TestLayerMigration(t *testing.T) { <ide> if err := graph.Create(graphID2, graphID1, "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del> if _, err := graph.ApplyDiff(graphID2, graphID1, archive.Reader(bytes.NewReader(tar2))); err != nil { <add> if _, err := graph.ApplyDiff(graphID2, graphID1, bytes.NewReader(tar2)); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> func tarFromFilesInGraph(graph graphdriver.Driver, graphID, parentID string, fil <ide> if err := graph.Create(graphID, parentID, "", nil); err != nil { <ide> return nil, err <ide> } <del> if _, err := graph.ApplyDiff(graphID, parentID, archive.Reader(bytes.NewReader(t))); err != nil { <add> if _, err := graph.ApplyDiff(graphID, parentID, bytes.NewReader(t)); err != nil { <ide> return nil, err <ide> } <ide> <ide> func TestMountMigration(t *testing.T) { <ide> if err := graph.Create(containerInit, graphID1, "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del> if _, err := graph.ApplyDiff(containerInit, graphID1, archive.Reader(bytes.NewReader(initTar))); err != nil { <add> if _, err := graph.ApplyDiff(containerInit, graphID1, bytes.NewReader(initTar)); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> if err := graph.Create(containerID, containerInit, "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del> if _, err := graph.ApplyDiff(containerID, containerInit, archive.Reader(bytes.NewReader(mountTar))); err != nil { <add> if _, err := graph.ApplyDiff(containerID, containerInit, bytes.NewReader(mountTar)); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide><path>pkg/archive/archive.go <ide> import ( <ide> ) <ide> <ide> type ( <del> // Archive is a type of io.ReadCloser which has two interfaces Read and Closer. <del> Archive io.ReadCloser <del> // Reader is a type of io.Reader. <del> Reader io.Reader <ide> // Compression is the state represents if compressed or not. <ide> Compression int <ide> // WhiteoutFormat is the format of whiteouts unpacked <ide> type ( <ide> TarChownOptions struct { <ide> UID, GID int <ide> } <add> <ide> // TarOptions wraps the tar options. <ide> TarOptions struct { <ide> IncludeFiles []string <ide> func cmdStream(cmd *exec.Cmd, input io.Reader) (io.ReadCloser, <-chan struct{}, <ide> // NewTempArchive reads the content of src into a temporary file, and returns the contents <ide> // of that file as an archive. The archive can only be read once - as soon as reading completes, <ide> // the file will be deleted. <del>func NewTempArchive(src Archive, dir string) (*TempArchive, error) { <add>func NewTempArchive(src io.Reader, dir string) (*TempArchive, error) { <ide> f, err := ioutil.TempFile(dir, "") <ide> if err != nil { <ide> return nil, err <ide><path>pkg/archive/changes.go <ide> func ChangesSize(newDir string, changes []Change) int64 { <ide> } <ide> <ide> // ExportChanges produces an Archive from the provided changes, relative to dir. <del>func ExportChanges(dir string, changes []Change, uidMaps, gidMaps []idtools.IDMap) (Archive, error) { <add>func ExportChanges(dir string, changes []Change, uidMaps, gidMaps []idtools.IDMap) (io.ReadCloser, error) { <ide> reader, writer := io.Pipe() <ide> go func() { <ide> ta := &tarAppender{ <ide><path>pkg/archive/copy.go <ide> func SplitPathDirEntry(path string) (dir, base string) { <ide> // This function acts as a convenient wrapper around TarWithOptions, which <ide> // requires a directory as the source path. TarResource accepts either a <ide> // directory or a file path and correctly sets the Tar options. <del>func TarResource(sourceInfo CopyInfo) (content Archive, err error) { <add>func TarResource(sourceInfo CopyInfo) (content io.ReadCloser, err error) { <ide> return TarResourceRebase(sourceInfo.Path, sourceInfo.RebaseName) <ide> } <ide> <ide> // TarResourceRebase is like TarResource but renames the first path element of <ide> // items in the resulting tar archive to match the given rebaseName if not "". <del>func TarResourceRebase(sourcePath, rebaseName string) (content Archive, err error) { <add>func TarResourceRebase(sourcePath, rebaseName string) (content io.ReadCloser, err error) { <ide> sourcePath = normalizePath(sourcePath) <ide> if _, err = os.Lstat(sourcePath); err != nil { <ide> // Catches the case where the source does not exist or is not a <ide> func CopyInfoDestinationPath(path string) (info CopyInfo, err error) { <ide> // contain the archived resource described by srcInfo, to the destination <ide> // described by dstInfo. Returns the possibly modified content archive along <ide> // with the path to the destination directory which it should be extracted to. <del>func PrepareArchiveCopy(srcContent Reader, srcInfo, dstInfo CopyInfo) (dstDir string, content Archive, err error) { <add>func PrepareArchiveCopy(srcContent io.Reader, srcInfo, dstInfo CopyInfo) (dstDir string, content io.ReadCloser, err error) { <ide> // Ensure in platform semantics <ide> srcInfo.Path = normalizePath(srcInfo.Path) <ide> dstInfo.Path = normalizePath(dstInfo.Path) <ide> func PrepareArchiveCopy(srcContent Reader, srcInfo, dstInfo CopyInfo) (dstDir st <ide> <ide> // RebaseArchiveEntries rewrites the given srcContent archive replacing <ide> // an occurrence of oldBase with newBase at the beginning of entry names. <del>func RebaseArchiveEntries(srcContent Reader, oldBase, newBase string) Archive { <add>func RebaseArchiveEntries(srcContent io.Reader, oldBase, newBase string) io.ReadCloser { <ide> if oldBase == string(os.PathSeparator) { <ide> // If oldBase specifies the root directory, use an empty string as <ide> // oldBase instead so that newBase doesn't replace the path separator <ide> func CopyResource(srcPath, dstPath string, followLink bool) error { <ide> <ide> // CopyTo handles extracting the given content whose <ide> // entries should be sourced from srcInfo to dstPath. <del>func CopyTo(content Reader, srcInfo CopyInfo, dstPath string) error { <add>func CopyTo(content io.Reader, srcInfo CopyInfo, dstPath string) error { <ide> // The destination path need not exist, but CopyInfoDestinationPath will <ide> // ensure that at least the parent directory exists. <ide> dstInfo, err := CopyInfoDestinationPath(normalizePath(dstPath)) <ide><path>pkg/archive/diff.go <ide> import ( <ide> // UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be <ide> // compressed or uncompressed. <ide> // Returns the size in bytes of the contents of the layer. <del>func UnpackLayer(dest string, layer Reader, options *TarOptions) (size int64, err error) { <add>func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, err error) { <ide> tr := tar.NewReader(layer) <ide> trBuf := pools.BufioReader32KPool.Get(tr) <ide> defer pools.BufioReader32KPool.Put(trBuf) <ide> func UnpackLayer(dest string, layer Reader, options *TarOptions) (size int64, er <ide> // and applies it to the directory `dest`. The stream `layer` can be <ide> // compressed or uncompressed. <ide> // Returns the size in bytes of the contents of the layer. <del>func ApplyLayer(dest string, layer Reader) (int64, error) { <add>func ApplyLayer(dest string, layer io.Reader) (int64, error) { <ide> return applyLayerHandler(dest, layer, &TarOptions{}, true) <ide> } <ide> <ide> // ApplyUncompressedLayer parses a diff in the standard layer format from <ide> // `layer`, and applies it to the directory `dest`. The stream `layer` <ide> // can only be uncompressed. <ide> // Returns the size in bytes of the contents of the layer. <del>func ApplyUncompressedLayer(dest string, layer Reader, options *TarOptions) (int64, error) { <add>func ApplyUncompressedLayer(dest string, layer io.Reader, options *TarOptions) (int64, error) { <ide> return applyLayerHandler(dest, layer, options, false) <ide> } <ide> <ide> // do the bulk load of ApplyLayer, but allow for not calling DecompressStream <del>func applyLayerHandler(dest string, layer Reader, options *TarOptions, decompress bool) (int64, error) { <add>func applyLayerHandler(dest string, layer io.Reader, options *TarOptions, decompress bool) (int64, error) { <ide> dest = filepath.Clean(dest) <ide> <ide> // We need to be able to set any perms <ide><path>pkg/archive/utils_test.go <ide> var testUntarFns = map[string]func(string, io.Reader) error{ <ide> return Untar(r, dest, nil) <ide> }, <ide> "applylayer": func(dest string, r io.Reader) error { <del> _, err := ApplyLayer(dest, Reader(r)) <add> _, err := ApplyLayer(dest, r) <ide> return err <ide> }, <ide> } <ide><path>pkg/archive/wrap.go <ide> package archive <ide> import ( <ide> "archive/tar" <ide> "bytes" <del> "io/ioutil" <add> "io" <ide> ) <ide> <ide> // Generate generates a new archive from the content provided <ide> import ( <ide> // <ide> // FIXME: stream content instead of buffering <ide> // FIXME: specify permissions and other archive metadata <del>func Generate(input ...string) (Archive, error) { <add>func Generate(input ...string) (io.Reader, error) { <ide> files := parseStringPairs(input...) <ide> buf := new(bytes.Buffer) <ide> tw := tar.NewWriter(buf) <ide> func Generate(input ...string) (Archive, error) { <ide> if err := tw.Close(); err != nil { <ide> return nil, err <ide> } <del> return ioutil.NopCloser(buf), nil <add> return buf, nil <ide> } <ide> <ide> func parseStringPairs(input ...string) (output [][2]string) { <ide><path>pkg/chrootarchive/diff.go <ide> package chrootarchive <ide> <del>import "github.com/docker/docker/pkg/archive" <add>import ( <add> "io" <add> <add> "github.com/docker/docker/pkg/archive" <add>) <ide> <ide> // ApplyLayer parses a diff in the standard layer format from `layer`, <ide> // and applies it to the directory `dest`. The stream `layer` can only be <ide> // uncompressed. <ide> // Returns the size in bytes of the contents of the layer. <del>func ApplyLayer(dest string, layer archive.Reader) (size int64, err error) { <add>func ApplyLayer(dest string, layer io.Reader) (size int64, err error) { <ide> return applyLayerHandler(dest, layer, &archive.TarOptions{}, true) <ide> } <ide> <ide> // ApplyUncompressedLayer parses a diff in the standard layer format from <ide> // `layer`, and applies it to the directory `dest`. The stream `layer` <ide> // can only be uncompressed. <ide> // Returns the size in bytes of the contents of the layer. <del>func ApplyUncompressedLayer(dest string, layer archive.Reader, options *archive.TarOptions) (int64, error) { <add>func ApplyUncompressedLayer(dest string, layer io.Reader, options *archive.TarOptions) (int64, error) { <ide> return applyLayerHandler(dest, layer, options, false) <ide> } <ide><path>pkg/chrootarchive/diff_unix.go <ide> import ( <ide> "encoding/json" <ide> "flag" <ide> "fmt" <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "path/filepath" <ide> func applyLayer() { <ide> // applyLayerHandler parses a diff in the standard layer format from `layer`, and <ide> // applies it to the directory `dest`. Returns the size in bytes of the <ide> // contents of the layer. <del>func applyLayerHandler(dest string, layer archive.Reader, options *archive.TarOptions, decompress bool) (size int64, err error) { <add>func applyLayerHandler(dest string, layer io.Reader, options *archive.TarOptions, decompress bool) (size int64, err error) { <ide> dest = filepath.Clean(dest) <ide> if decompress { <ide> decompressed, err := archive.DecompressStream(layer) <ide><path>pkg/chrootarchive/diff_windows.go <ide> package chrootarchive <ide> <ide> import ( <ide> "fmt" <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "path/filepath" <ide> import ( <ide> // applyLayerHandler parses a diff in the standard layer format from `layer`, and <ide> // applies it to the directory `dest`. Returns the size in bytes of the <ide> // contents of the layer. <del>func applyLayerHandler(dest string, layer archive.Reader, options *archive.TarOptions, decompress bool) (size int64, err error) { <add>func applyLayerHandler(dest string, layer io.Reader, options *archive.TarOptions, decompress bool) (size int64, err error) { <ide> dest = filepath.Clean(dest) <ide> <ide> // Ensure it is a Windows-style volume path
23
Javascript
Javascript
stop reactinputselection breaking in ie8
ed7fa0ed225522009e5560dac08fcff356e2098f
<ide><path>src/core/ReactInputSelection.js <ide> <ide> "use strict"; <ide> <add>var getTextContentAccessor = require('getTextContentAccessor'); <add> <ide> // It is not safe to read the document.activeElement property in IE if there's <ide> // nothing focused. <ide> function getActiveElement() { <ide> var ReactInputSelection = { <ide> }, <ide> <ide> /** <del> * @getSelection: Gets the selection bounds of a textarea or input. <del> * -@input: Look up selection bounds of this input or textarea <add> * @getSelection: Gets the selection bounds of a focused textarea, input or <add> * contentEditable node. <add> * -@input: Look up selection bounds of this input <ide> * -@return {start: selectionStart, end: selectionEnd} <ide> */ <ide> getSelection: function(input) { <ide> var ReactInputSelection = { <ide> return {start: 0, end: 0}; <ide> } <ide> <del> var length = input.value.length; <add> var value = input.value || input[getTextContentAccessor()]; <add> var length = value.length; <ide> <ide> if (input.nodeName === 'INPUT') { <ide> return { <ide> var ReactInputSelection = { <ide> range2.setEndPoint('StartToStart', range); <ide> return { <ide> start: length - range2.text.length, <del> end: end <add> end: end <ide> }; <ide> } <ide> },
1
Javascript
Javascript
ignore asyncid 0 in exception handler
51783320a4d72eacc8956e371f443b901806533f
<ide><path>lib/internal/process/execution.js <ide> const { <ide> clearAsyncIdStack, <ide> hasAsyncIdStack, <ide> afterHooksExist, <del> emitAfter <add> emitAfter, <add> popAsyncContext, <ide> } = require('internal/async_hooks'); <ide> <ide> // shouldAbortOnUncaughtToggle is a typed array for faster <ide> function createOnGlobalUncaughtException() { <ide> // Emit the after() hooks now that the exception has been handled. <ide> if (afterHooksExist()) { <ide> do { <del> emitAfter(executionAsyncId()); <add> const asyncId = executionAsyncId(); <add> if (asyncId === 0) <add> popAsyncContext(0); <add> else <add> emitAfter(asyncId); <ide> } while (hasAsyncIdStack()); <ide> } <ide> // And completely empty the id stack, including anything that may be <ide><path>test/async-hooks/init-hooks.js <ide> class ActivityCollector { <ide> } <ide> const err = new Error(`Found a handle whose ${hook}` + <ide> ' hook was invoked but not its init hook'); <del> // Don't throw if we see invocations due to an assertion in a test <del> // failing since we want to list the assertion failure instead <del> if (/process\._fatalException/.test(err.stack)) return null; <ide> throw err; <ide> } <ide> return h; <ide><path>test/async-hooks/test-unhandled-exception-valid-ids.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const initHooks = require('./init-hooks'); <add> <add>const hooks = initHooks(); <add>hooks.enable(); <add> <add>setImmediate(() => { <add> throw new Error(); <add>}); <add> <add>setTimeout(() => { <add> throw new Error(); <add>}, 1); <add> <add>process.on('uncaughtException', common.mustCall(2));
3
Python
Python
start server in a modified environment
485f2203e05593eb3c849081f65605cab9c26163
<ide><path>unitest-restful.py <ide> def test_000_start_server(self): <ide> <ide> global pid <ide> <del> cmdline = "/usr/bin/python -m glances -w -p %s" % SERVER_PORT <add> cmdline = "/usr/bin/env python -m glances -w -p %s" % SERVER_PORT <ide> print("Run the Glances Web Server on port %s" % SERVER_PORT) <ide> args = shlex.split(cmdline) <ide> pid = subprocess.Popen(args) <ide><path>unitest-xmlrpc.py <ide> def test_000_start_server(self): <ide> <ide> global pid <ide> <del> cmdline = "/usr/bin/python -m glances -s -p %s" % SERVER_PORT <add> cmdline = "/usr/bin/env python -m glances -s -p %s" % SERVER_PORT <ide> print("Run the Glances Server on port %s" % SERVER_PORT) <ide> args = shlex.split(cmdline) <ide> pid = subprocess.Popen(args)
2
Javascript
Javascript
use regexp instead of str.replace().join()
02a44e0bfd281a42ddec013185fedc48e8d6d2ed
<ide><path>lib/util.js <ide> function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { <ide> } <ide> if (str.indexOf('\n') > -1) { <ide> if (array) { <del> str = str.split('\n').map(function(line) { <del> return ' ' + line; <del> }).join('\n').substr(2); <add> str = str.replace(/\n/g, '\n '); <ide> } else { <del> str = '\n' + str.split('\n').map(function(line) { <del> return ' ' + line; <del> }).join('\n'); <add> str = str.replace(/(^|\n)/g, '\n '); <ide> } <ide> } <ide> } else {
1
Python
Python
remove channel from delivery_info
232bf5b7b788dcd4e847e672cf1a55d7be31a5f5
<ide><path>celery/worker/job.py <ide> def __init__(self, body, on_ack=noop, <ide> self.expires = None <ide> <ide> self.delivery_info = delivery_info or {} <add> # amqplib transport adds the channel here for some reason, so need <add> # to remove it. <add> self.delivery_info.pop('channel', None) <ide> self.request_dict = body <ide> <ide> @classmethod
1
Ruby
Ruby
pull conditional out of begin block
41cc28ca42e1bcaa9716d6c7930ec9c492ffa356
<ide><path>Library/Homebrew/formula_installer.rb <ide> def install <ide> <ide> @@attempted << f <ide> <del> begin <del> if pour_bottle? :warn => true <add> if pour_bottle?(:warn => true) <add> begin <ide> pour <add> rescue => e <add> raise if ARGV.homebrew_developer? <add> @pour_failed = true <add> onoe e.message <add> opoo "Bottle installation failed: building from source." <add> else <ide> @poured_bottle = true <ide> end <del> rescue => e <del> raise e if ARGV.homebrew_developer? <del> @pour_failed = true <del> onoe e.message <del> opoo "Bottle installation failed: building from source." <ide> end <ide> <ide> build_bottle_preinstall if build_bottle?
1
Javascript
Javascript
fix .repeatwrapping()
2f77862098bad45d095e99d2863dddd1ec94d559
<ide><path>examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js <ide> fn threejs_mod( x : f32, y : f32 ) -> f32 { <ide> } <ide> ` ), <ide> repeatWrapping: new CodeNode( ` <del>fn threejs_repeatWrapping( uv : vec2<f32>, dimension : vec2<i32> ) -> vec2<i32> { <add>fn threejs_repeatWrapping( uv : vec2<f32>, dimension : vec2<u32> ) -> vec2<u32> { <ide> <del> let uvScaled = vec2<i32>( uv * vec2<f32>( dimension ) ); <add> let uvScaled = vec2<u32>( uv * vec2<f32>( dimension ) ); <ide> <ide> return ( ( uvScaled % dimension ) + dimension ) % dimension; <ide>
1
Python
Python
update doc format
e7f34ccd4f7d256f959d56f278a0ffe97fbc9ad7
<ide><path>examples/pytorch/multiple-choice/run_swag.py <ide> class DataCollatorForMultipleChoice: <ide> Data collator that will dynamically pad the inputs for multiple choice received. <ide> <ide> Args: <del> tokenizer (:class:`~transformers.PreTrainedTokenizer` or :class:`~transformers.PreTrainedTokenizerFast`): <add> tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): <ide> The tokenizer used for encoding the data. <del> padding (:obj:`bool`, :obj:`str` or :class:`~transformers.file_utils.PaddingStrategy`, `optional`, defaults to :obj:`True`): <add> padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`): <ide> Select a strategy to pad the returned sequences (according to the model's padding side and padding index) <ide> among: <ide> <del> * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single <del> sequence if provided). <del> * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the <del> maximum acceptable input length for the model if that argument is not provided. <del> * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of <del> different lengths). <del> max_length (:obj:`int`, `optional`): <add> - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence <add> if provided). <add> - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum <add> acceptable input length for the model if that argument is not provided. <add> - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different <add> lengths). <add> max_length (`int`, *optional*): <ide> Maximum length of the returned list and optionally padding length (see above). <del> pad_to_multiple_of (:obj:`int`, `optional`): <add> pad_to_multiple_of (`int`, *optional*): <ide> If set will pad the sequence to a multiple of the provided value. <ide> <ide> This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >= <ide><path>examples/pytorch/multiple-choice/run_swag_no_trainer.py <ide> class DataCollatorForMultipleChoice: <ide> Data collator that will dynamically pad the inputs for multiple choice received. <ide> <ide> Args: <del> tokenizer (:class:`~transformers.PreTrainedTokenizer` or :class:`~transformers.PreTrainedTokenizerFast`): <add> tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): <ide> The tokenizer used for encoding the data. <del> padding (:obj:`bool`, :obj:`str` or :class:`~transformers.file_utils.PaddingStrategy`, `optional`, defaults to :obj:`True`): <add> padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`): <ide> Select a strategy to pad the returned sequences (according to the model's padding side and padding index) <ide> among: <ide> <del> * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single <del> sequence if provided). <del> * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the <del> maximum acceptable input length for the model if that argument is not provided. <del> * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of <del> different lengths). <del> max_length (:obj:`int`, `optional`): <add> - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence <add> if provided). <add> - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum <add> acceptable input length for the model if that argument is not provided. <add> - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different <add> lengths). <add> max_length (`int`, *optional*): <ide> Maximum length of the returned list and optionally padding length (see above). <del> pad_to_multiple_of (:obj:`int`, `optional`): <add> pad_to_multiple_of (`int`, *optional*): <ide> If set will pad the sequence to a multiple of the provided value. <ide> <ide> This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >= <ide><path>examples/tensorflow/multiple-choice/run_swag.py <ide> class DataCollatorForMultipleChoice: <ide> Data collator that will dynamically pad the inputs for multiple choice received. <ide> <ide> Args: <del> tokenizer (:class:`~transformers.PreTrainedTokenizer` or :class:`~transformers.PreTrainedTokenizerFast`): <add> tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): <ide> The tokenizer used for encoding the data. <del> padding (:obj:`bool`, :obj:`str` or :class:`~transformers.file_utils.PaddingStrategy`, `optional`, defaults to :obj:`True`): <add> padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`): <ide> Select a strategy to pad the returned sequences (according to the model's padding side and padding index) <ide> among: <ide> <del> * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single <del> sequence if provided). <del> * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the <del> maximum acceptable input length for the model if that argument is not provided. <del> * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of <del> different lengths). <del> max_length (:obj:`int`, `optional`): <add> - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence <add> if provided). <add> - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum <add> acceptable input length for the model if that argument is not provided. <add> - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different <add> lengths). <add> max_length (`int`, *optional*): <ide> Maximum length of the returned list and optionally padding length (see above). <del> pad_to_multiple_of (:obj:`int`, `optional`): <add> pad_to_multiple_of (`int`, *optional*): <ide> If set will pad the sequence to a multiple of the provided value. <ide> <ide> This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >=
3
PHP
PHP
add missing comma
fb5489967b9409b3bd0c38694117bffd2e8453cc
<ide><path>src/View/AjaxView.php <ide> <ide> /** <ide> * A view class that is used for AJAX responses. <del> * Currently only switches the default layout and sets the response type - which just maps to <add> * Currently, only switches the default layout and sets the response type - which just maps to <ide> * text/html by default. <ide> */ <ide> class AjaxView extends View
1
Javascript
Javascript
expand localized tokens in the parser. fixes #665
afec852c5284e15c33f2d7576638362e85e6a756
<ide><path>moment.js <ide> <ide> // format date using native date object <ide> function formatMoment(m, format) { <add> <add> format = expandFormat(format, m.lang()); <add> <add> if (!formatFunctions[format]) { <add> formatFunctions[format] = makeFormatFunction(format); <add> } <add> <add> return formatFunctions[format](m); <add> } <add> <add> function expandFormat(format, lang) { <ide> var i = 5; <ide> <ide> function replaceLongDateFormatTokens(input) { <del> return m.lang().longDateFormat(input) || input; <add> return lang.longDateFormat(input) || input; <ide> } <ide> <ide> while (i-- && (localFormattingTokens.lastIndex = 0, <ide> localFormattingTokens.test(format))) { <ide> format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); <ide> } <ide> <del> if (!formatFunctions[format]) { <del> formatFunctions[format] = makeFormatFunction(format); <del> } <del> <del> return formatFunctions[format](m); <add> return format; <ide> } <ide> <ide> <ide> // date from string and format string <ide> function makeDateFromStringAndFormat(config) { <ide> // This array is used to make a Date, either with `new Date` or `Date.UTC` <del> var tokens = config._f.match(formattingTokens), <add> var lang = getLangDefinition(config._l), <ide> string = '' + config._i, <del> i, parsedInput; <add> i, parsedInput, tokens; <add> <add> tokens = expandFormat(config._f, lang).match(formattingTokens); <ide> <ide> config._a = []; <ide> <ide><path>test/moment/create.js <ide> exports.create = { <ide> ['HH:mm:ss S', '00:30:00 7'], <ide> ['HH:mm:ss SS', '00:30:00 78'], <ide> ['HH:mm:ss SSS', '00:30:00 789'], <del> ['X.SSS', '1234567890.123'] <add> ['X.SSS', '1234567890.123'], <add> ['LT', '12:30 AM'], <add> ['L', '09/02/1999'], <add> ['l', '9/2/1999'], <add> ['LL', 'September 2 1999'], <add> ['ll', 'Sep 2 1999'], <add> ['LLL', 'September 2 1999 12:30 AM'], <add> ['lll', 'Sep 2 1999 12:30 AM'], <add> ['LLLL', 'Thursday, September 2 1999 12:30 AM'], <add> ['llll', 'Thu, Sep 2 1999 12:30 AM'] <ide> ], <ide> i; <ide>
2
Ruby
Ruby
fix copy & paste test-case naming. [ci skip]
37d4bfbfd9c49cdddcafdc135165b2d6932b074a
<ide><path>activerecord/test/cases/enum_test.rb <ide> require 'cases/helper' <ide> require 'models/book' <ide> <del>class StoreTest < ActiveRecord::TestCase <add>class EnumTest < ActiveRecord::TestCase <ide> fixtures :books <ide> <ide> setup do
1
Javascript
Javascript
remove legacy packages structure
8a7318e9c0f3e58f1e9cc7a6ce591d6c83fcb351
<ide><path>bin/run-tests.js <ide> var execa = require('execa'); <ide> var RSVP = require('rsvp'); <ide> var execFile = require('child_process').execFile; <ide> var chalk = require('chalk'); <del>var FEATURES = require('../broccoli/features'); <del>var getPackages = require('../lib/packages'); <ide> var runInSequence = require('../lib/run-in-sequence'); <ide> var path = require('path'); <ide> <ide> var finalhandler = require('finalhandler'); <ide> var http = require('http'); <ide> var serveStatic = require('serve-static'); <ide> var puppeteer = require('puppeteer'); <add>const fs = require('fs'); <ide> <ide> // Serve up public/ftp folder. <ide> var serve = serveStatic('./dist/', { index: ['index.html', 'index.htm'] }); <ide> function runInBrowser(url, retries, resolve, reject) { <ide> var testFunctions = []; <ide> <ide> function generateEachPackageTests() { <del> var features = FEATURES; <del> var packages = getPackages(features); <add> let entries = fs.readdirSync('packages'); <add> entries.forEach(entry => { <add> let relativePath = path.join('packages', entry); <ide> <del> Object.keys(packages).forEach(function(packageName) { <del> if (packages[packageName].skipTests) { <add> if (!fs.existsSync(path.join(relativePath, 'tests'))) { <ide> return; <ide> } <ide> <ide> testFunctions.push(function() { <del> return run('package=' + packageName); <add> return run('package=' + entry); <ide> }); <ide> testFunctions.push(function() { <del> return run('package=' + packageName + '&dist=es'); <add> return run('package=' + entry + '&dist=es'); <ide> }); <del> if (packages[packageName].requiresJQuery === false) { <add> testFunctions.push(function() { <add> return run('package=' + entry + '&enableoptionalfeatures=true'); <add> }); <add> <add> // TODO: this should ultimately be deleted (when all packages can run with and <add> // without jQuery) <add> if (entry !== 'ember') { <ide> testFunctions.push(function() { <del> return run('package=' + packageName + '&jquery=none'); <add> return run('package=' + entry + '&jquery=none'); <ide> }); <ide> } <del> testFunctions.push(function() { <del> return run('package=' + packageName + '&enableoptionalfeatures=true'); <del> }); <ide> }); <ide> } <ide> <ide><path>lib/packages.js <del>module.exports = function() { <del> var packages = { <del> container: { <del> trees: null, <del> requirements: ['ember-utils'], <del> isTypeScript: true, <del> vendorRequirements: ['@glimmer/di'], <del> requiresJQuery: false, <del> }, <del> 'ember-environment': { <del> trees: null, <del> requirements: [], <del> skipTests: true, <del> requiresJQuery: false, <del> }, <del> 'ember-utils': { trees: null, requirements: [], requiresJQuery: false }, <del> 'ember-console': { <del> trees: null, <del> requirements: [], <del> skipTests: true, <del> requiresJQuery: false, <del> }, <del> 'ember-metal': { <del> trees: null, <del> requirements: ['ember-environment', 'ember-utils'], <del> vendorRequirements: ['backburner'], <del> requiresJQuery: false, <del> }, <del> 'ember-debug': { trees: null, requirements: [], requiresJQuery: false }, <del> 'ember-runtime': { <del> trees: null, <del> vendorRequirements: ['rsvp'], <del> requirements: ['container', 'ember-environment', 'ember-console', 'ember-metal'], <del> requiresJQuery: false, <del> }, <del> 'ember-views': { <del> trees: null, <del> requirements: ['ember-runtime'], <del> skipTests: true, <del> }, <del> 'ember-extension-support': { <del> trees: null, <del> requirements: ['ember-application'], <del> requiresJQuery: false, <del> }, <del> 'ember-testing': { <del> trees: null, <del> requiresJQuery: false, <del> requirements: ['ember-application', 'ember-routing'], <del> testing: true, <del> }, <del> 'ember-template-compiler': { <del> trees: null, <del> templateCompilerOnly: true, <del> requiresJQuery: false, <del> requirements: ['container', 'ember-metal', 'ember-environment', 'ember-console'], <del> templateCompilerVendor: [ <del> 'simple-html-tokenizer', <del> 'backburner', <del> '@glimmer/wire-format', <del> '@glimmer/syntax', <del> '@glimmer/util', <del> '@glimmer/compiler', <del> '@glimmer/reference', <del> '@glimmer/runtime', <del> 'handlebars', <del> ], <del> }, <del> 'ember-routing': { <del> trees: null, <del> vendorRequirements: ['router', 'route-recognizer'], <del> requirements: ['ember-runtime', 'ember-views'], <del> requiresJQuery: false, <del> }, <del> 'ember-application': { <del> trees: null, <del> vendorRequirements: ['dag-map'], <del> requirements: ['ember-routing'], <del> requiresJQuery: false, <del> }, <del> ember: { trees: null, requirements: ['ember-application'] }, <del> 'internal-test-helpers': { trees: null, requiresJQuery: false }, <del> <del> 'ember-glimmer': { <del> trees: null, <del> requiresJQuery: false, <del> requirements: ['container', 'ember-metal', 'ember-routing'], <del> hasTemplates: true, <del> vendorRequirements: [ <del> '@glimmer/runtime', <del> '@glimmer/reference', <del> '@glimmer/util', <del> '@glimmer/wire-format', <del> '@glimmer/node', <del> ], <del> testingVendorRequirements: [], <del> }, <del> }; <del> <del> return packages; <del>};
2
Text
Text
improve changelog entry
e918516d2fdfa24e5fc04ef14e371f08f4a8315f
<ide><path>actionpack/CHANGELOG.md <ide> * Added verification of route constraints given as a Proc or an object responding <del> to `:matches?`. Previously, when given an non-complying object, it would just <del> silently fail to enforce the constraint. It will now raise an ArgumentError <add> to `:matches?`. Previously, when given an non-complying object, it would just <add> silently fail to enforce the constraint. It will now raise an `ArgumentError` <ide> when setting up the routes. <ide> <ide> *Xavier Defrang*
1
Javascript
Javascript
fix lint error
8d86864f66fea8409b2511591a9112924699dc84
<ide><path>hot/log.js <ide> var logLevel = "info"; <ide> <del>function dummy() { } <add>function dummy() {} <ide> <ide> module.exports = function(level, msg) { <ide> if(logLevel === "info" && level === "info")
1
Javascript
Javascript
use filter for create-next-app template
2ff0913864790a456a38445b9ccfe4af1bbfd7c1
<ide><path>packages/create-next-app/templates/default/pages/index.js <ide> const Home = () => ( <ide> </a> <ide> <ide> <a <del> href="https://zeit.co/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <add> href="https://zeit.co/new?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <ide> className="card" <ide> > <ide> <h3>Deploy &rarr;</h3>
1
Text
Text
dont -> don't
87e6a786fe83b738eb42e16374e24f78ddb1a8af
<ide><path>CHANGELOG-8.x.md <ide> - Fixed problems with dots in validator ([#34355](https://github.com/laravel/framework/pull/34355)) <ide> - Maintenance mode: Fix empty Retry-After header ([#34412](https://github.com/laravel/framework/pull/34412)) <ide> - Fixed bug with error handling in closure scheduled tasks ([#34420](https://github.com/laravel/framework/pull/34420)) <del>- Dont double escape on ComponentTagCompiler.php ([12ba0d9](https://github.com/laravel/framework/commit/12ba0d937d54e81eccf8f0a80150f0d70604e1c2)) <add>- Don't double escape on ComponentTagCompiler.php ([12ba0d9](https://github.com/laravel/framework/commit/12ba0d937d54e81eccf8f0a80150f0d70604e1c2)) <ide> - Fixed `mysqldump: unknown variable 'column-statistics=0` for MariaDB schema dump ([#34442](https://github.com/laravel/framework/pull/34442)) <ide> <ide>
1
Text
Text
consolidate misc comments
30c61b808bca9938b7edb14a81e6c80f9602f2d0
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md <ide> tests: <ide> <div id='js-seed'> <ide> <ide> ```js <del>var myStr; // Only change this line <add>var myStr; // Change this line <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/03-front-end-libraries/react-and-redux/moving-forward-from-here.english.md <ide> ReactDOM.render( <ide> ); <ide> */ <ide> <add>// Only change code below this line <add> <ide> ``` <ide> <ide> </div> <ide><path>curriculum/challenges/english/03-front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials.english.md <ide> tests: <ide> <div id='html-seed'> <ide> <ide> ```html <del>// The main.scss file <del> <del> <add><!-- The main.scss file --> <ide> <ide> <ide> ``` <ide> tests: <ide> <section id='solution'> <ide> <ide> ```html <del>// The main.scss file <ide> @import 'variables' <ide> ``` <ide>
3
Javascript
Javascript
improve `nativeimagesource` return type
8924639613bc83703327db276052c5017df7295e
<ide><path>Libraries/Image/nativeImageSource.js <ide> <ide> 'use strict'; <ide> <del>const Platform = require('../Utilities/Platform'); <add>import Platform from '../Utilities/Platform'; <ide> <del>// TODO: Change `nativeImageSource` to return this type. <del>export type NativeImageSource = {| <del> +deprecated: true, <del> +height: number, <del> +uri: string, <del> +width: number, <del>|}; <add>import type {ImageURISource} from './ImageSource'; <ide> <del>type NativeImageSourceSpec = {| <del> +android?: string, <del> +ios?: string, <del> +default?: string, <add>type NativeImageSourceSpec = $ReadOnly<{| <add> android?: string, <add> ios?: string, <add> default?: string, <ide> <ide> // For more details on width and height, see <ide> // http://facebook.github.io/react-native/docs/images.html#why-not-automatically-size-everything <del> +height: number, <del> +width: number, <del>|}; <add> height: number, <add> width: number, <add>|}>; <ide> <ide> /** <ide> * In hybrid apps, use `nativeImageSource` to access images that are already <ide> type NativeImageSourceSpec = {| <ide> * http://facebook.github.io/react-native/docs/images.html <ide> * <ide> */ <del>function nativeImageSource(spec: NativeImageSourceSpec): Object { <add>function nativeImageSource(spec: NativeImageSourceSpec): ImageURISource { <ide> let uri = Platform.select({ <ide> android: spec.android, <ide> default: spec.default,
1
Python
Python
delete an unused function
6a3f774943ef743ad4e246a7010cf818ff2ee647
<ide><path>glances/glances.py <ide> def _init_host(self): <ide> self.host['os_version'] = " ".join(os_version[::2]) <ide> else: <ide> self.host['os_version'] = "" <del> <del> def __get_process_stats_NEW__(self, proc): <del> """ <del> Get process (proc) statistics <del> !!! No performance gap (CPU %) <del> !!! Without: 1.5 - 2.0 <del> !!! With: 2.0 - 2.2 <del> <del> """ <del> procstat = proc.as_dict(['get_memory_info', 'get_cpu_percent', <del> 'get_memory_percent', 'pid', 'username', <del> 'get_nice', 'get_cpu_times', 'name', <del> 'status', 'cmdline']) <del> if psutil_get_io_counter_tag: <del> procstat['io_counters'] = proc.get_io_counters() <del> procstat['status'] = str(procstat['status'])[:1].upper() <del> procstat['cmdline'] = " ".join(procstat['cmdline']) <del> <del> return procstat <add> <ide> <ide> def __update__(self, input_stats): <ide> """
1
PHP
PHP
fix issue with array based values and interval
c359e4b6890a3cfa979b413f4e1b63c80ccd96cc
<ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php <ide> public function testInputTime() { <ide> * @return void <ide> */ <ide> public function testTimeSelectedWithInterval() { <add> $result = $this->Form->input('Model.start_time', array( <add> 'type' => 'time', <add> 'interval' => 15, <add> 'selected' => array('hour' => '3', 'min' => '57', 'meridian' => 'pm') <add> )); <add> $this->assertContains('<option value="04" selected="selected">4</option>', $result); <add> $this->assertContains('<option value="00" selected="selected">00</option>', $result); <add> $this->assertContains('<option value="pm" selected="selected">pm</option>', $result); <add> <ide> $result = $this->Form->input('Model.start_time', array( <ide> 'type' => 'time', <ide> 'interval' => 15, <ide><path>lib/Cake/View/Helper/FormHelper.php <ide> public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $a <ide> if (!empty($attributes['value'])) { <ide> if (is_array($attributes['value'])) { <ide> extract($attributes['value']); <add> if ($meridian === 'pm') { <add> $hour += 12; <add> } <ide> } else { <ide> if (is_numeric($attributes['value'])) { <ide> $attributes['value'] = strftime('%Y-%m-%d %H:%M:%S', $attributes['value']);
2
PHP
PHP
remove leftover variable
b7b632c2538209a4c4ba8f7407f678ade9256dd5
<ide><path>src/Illuminate/Database/DatabaseManager.php <ide> protected function prepare(Connection $connection) <ide> $connection->setEventDispatcher($this->app['events']); <ide> } <ide> <del> $app = $this->app; <del> <del> <ide> // Here we'll set a reconnector callback. This reconnector can be any callable <ide> // so we will set a Closure to reconnect from this manager with the name of <ide> // the connection, which will allow us to reconnect from the connections.
1
Go
Go
remove import os/user
b07314e2e066a1308040e1eb45a96a0e1056f28a
<ide><path>utils/utils.go <ide> import ( <ide> "net/http" <ide> "os" <ide> "os/exec" <del> "os/user" <ide> "path/filepath" <ide> "runtime" <ide> "strconv" <ide> func StripComments(input []byte, commentMarker []byte) []byte { <ide> var output []byte <ide> for _, currentLine := range lines { <ide> var commentIndex = bytes.Index(currentLine, commentMarker) <del> if ( commentIndex == -1 ) { <add> if commentIndex == -1 { <ide> output = append(output, currentLine...) <ide> } else { <ide> output = append(output, currentLine[:commentIndex]...) <ide> func ParseRepositoryTag(repos string) (string, string) { <ide> return repos, "" <ide> } <ide> <add>type User struct { <add> Uid string // user id <add> Gid string // primary group id <add> Username string <add> Name string <add> HomeDir string <add>} <add> <ide> // UserLookup check if the given username or uid is present in /etc/passwd <ide> // and returns the user struct. <ide> // If the username is not found, an error is returned. <del>func UserLookup(uid string) (*user.User, error) { <add>func UserLookup(uid string) (*User, error) { <ide> file, err := ioutil.ReadFile("/etc/passwd") <ide> if err != nil { <ide> return nil, err <ide> } <ide> for _, line := range strings.Split(string(file), "\n") { <ide> data := strings.Split(line, ":") <ide> if len(data) > 5 && (data[0] == uid || data[2] == uid) { <del> return &user.User{ <add> return &User{ <ide> Uid: data[2], <ide> Gid: data[3], <ide> Username: data[0], <ide> func UserLookup(uid string) (*user.User, error) { <ide> return nil, fmt.Errorf("User not found in /etc/passwd") <ide> } <ide> <del>type DependencyGraph struct{ <add>type DependencyGraph struct { <ide> nodes map[string]*DependencyNode <ide> } <ide> <del>type DependencyNode struct{ <del> id string <del> deps map[*DependencyNode]bool <add>type DependencyNode struct { <add> id string <add> deps map[*DependencyNode]bool <ide> } <ide> <ide> func NewDependencyGraph() DependencyGraph { <ide> func (graph *DependencyGraph) NewNode(id string) string { <ide> return id <ide> } <ide> nd := &DependencyNode{ <del> id: id, <add> id: id, <ide> deps: map[*DependencyNode]bool{}, <ide> } <ide> graph.addNode(nd) <ide> func (graph *DependencyGraph) GenerateTraversalMap() ([][]string, error) { <ide> // If at least one dep hasn't been processed yet, we can't <ide> // add it. <ide> ok := true <del> for dep, _ := range node.deps { <add> for dep := range node.deps { <ide> if !processed[dep] { <ide> ok = false <ide> break <ide> func (graph *DependencyGraph) GenerateTraversalMap() ([][]string, error) { <ide> } <ide> } <ide> Debugf("Round %d: found %d available nodes", len(result), len(tmp_processed)) <del> // If no progress has been made this round, <add> // If no progress has been made this round, <ide> // that means we have circular dependencies. <ide> if len(tmp_processed) == 0 { <ide> return nil, fmt.Errorf("Could not find a solution to this dependency graph") <ide> func (graph *DependencyGraph) GenerateTraversalMap() ([][]string, error) { <ide> result = append(result, round) <ide> } <ide> return result, nil <del>} <ide>\ No newline at end of file <add>}
1
Java
Java
keep scrollview content visible after edits
528a3c776a26c946a6582489c5e1ad234220dc3c
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java <ide> import android.util.Log; <ide> import android.view.MotionEvent; <ide> import android.view.View; <add>import android.view.ViewGroup; <ide> import android.widget.OverScroller; <ide> import android.widget.ScrollView; <ide> <ide> * <p>ReactScrollView only supports vertical scrolling. For horizontal scrolling, <ide> * use {@link ReactHorizontalScrollView}. <ide> */ <del>public class ReactScrollView extends ScrollView implements ReactClippingViewGroup { <add>public class ReactScrollView extends ScrollView implements ReactClippingViewGroup, ViewGroup.OnHierarchyChangeListener, View.OnLayoutChangeListener { <ide> <ide> private static Field sScrollerField; <ide> private static boolean sTriedToGetScrollerField = false; <ide> public class ReactScrollView extends ScrollView implements ReactClippingViewGrou <ide> private @Nullable String mScrollPerfTag; <ide> private @Nullable Drawable mEndBackground; <ide> private int mEndFillColor = Color.TRANSPARENT; <add> private View mContentView; <ide> <ide> public ReactScrollView(ReactContext context) { <ide> this(context, null); <ide> public ReactScrollView(ReactContext context, @Nullable FpsListener fpsListener) <ide> } else { <ide> mScroller = null; <ide> } <add> <add> setOnHierarchyChangeListener(this); <ide> } <ide> <ide> public void setSendMomentumEvents(boolean sendMomentumEvents) { <ide> private boolean isScrollPerfLoggingEnabled() { <ide> return mFpsListener != null && mScrollPerfTag != null && !mScrollPerfTag.isEmpty(); <ide> } <ide> <add> private int getMaxScrollY() { <add> int contentHeight = mContentView.getHeight(); <add> int viewportHeight = getHeight() - getPaddingBottom() - getPaddingTop(); <add> return Math.max(0, contentHeight - viewportHeight); <add> } <add> <ide> @Override <ide> public void draw(Canvas canvas) { <ide> if (mEndFillColor != Color.TRANSPARENT) { <ide> protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolea <ide> // more information. <ide> <ide> if (!mScroller.isFinished() && mScroller.getCurrY() != mScroller.getFinalY()) { <del> int scrollRange = Math.max( <del> 0, <del> getChildAt(0).getHeight() - (getHeight() - getPaddingBottom() - getPaddingTop())); <add> int scrollRange = getMaxScrollY(); <ide> if (scrollY >= scrollRange) { <ide> mScroller.abortAnimation(); <ide> scrollY = scrollRange; <ide> protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolea <ide> <ide> super.onOverScrolled(scrollX, scrollY, clampedX, clampedY); <ide> } <add> <add> @Override <add> public void onChildViewAdded(View parent, View child) { <add> mContentView = child; <add> mContentView.addOnLayoutChangeListener(this); <add> } <add> <add> @Override <add> public void onChildViewRemoved(View parent, View child) { <add> mContentView.removeOnLayoutChangeListener(this); <add> mContentView = null; <add> } <add> <add> /** <add> * Called when a mContentView's layout has changed. Fixes the scroll position if it's too large <add> * after the content resizes. Without this, the user would see a blank ScrollView when the scroll <add> * position is larger than the ScrollView's max scroll position after the content shrinks. <add> */ <add> @Override <add> public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { <add> if (mContentView == null) { <add> return; <add> } <add> <add> int currentScrollY = getScrollY(); <add> int maxScrollY = getMaxScrollY(); <add> if (currentScrollY > maxScrollY) { <add> scrollTo(getScrollX(), maxScrollY); <add> } <add> } <ide> } <add>
1
Python
Python
fix gpt-j onnx conversion
0b1e0fcf7aa9bb1fec62d04ddba1112d0fe0b184
<ide><path>src/transformers/models/auto/tokenization_auto.py <ide> ("bert", ("BertTokenizer", "BertTokenizerFast" if is_tokenizers_available() else None)), <ide> ("openai-gpt", ("OpenAIGPTTokenizer", "OpenAIGPTTokenizerFast" if is_tokenizers_available() else None)), <ide> ("gpt2", ("GPT2Tokenizer", "GPT2TokenizerFast" if is_tokenizers_available() else None)), <add> ("gptj", ("GPT2Tokenizer", "GPT2TokenizerFast" if is_tokenizers_available() else None)), <ide> ("transfo-xl", ("TransfoXLTokenizer", None)), <ide> ( <ide> "xlnet", <ide><path>src/transformers/models/gptj/modeling_gptj.py <ide> def fixed_pos_embedding(x, seq_dim=1, seq_len=None): <ide> if seq_len is None: <ide> seq_len = x.shape[seq_dim] <ide> inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2) / dim)) <del> sinusoid_inp = torch.einsum("i , j -> i j", torch.arange(seq_len), inv_freq).to(x.device).float() <add> sinusoid_inp = ( <add> torch.einsum("i , j -> i j", torch.arange(seq_len, dtype=torch.float), inv_freq).to(x.device).float() <add> ) <ide> return torch.sin(sinusoid_inp), torch.cos(sinusoid_inp) <ide> <ide> <ide><path>src/transformers/onnx/features.py <ide> class FeaturesManager: <ide> "token-classification", <ide> onnx_config_cls=GPT2OnnxConfig, <ide> ), <del> "gpt-j": supported_features_mapping( <add> "gptj": supported_features_mapping( <ide> "default", <ide> "default-with-past", <ide> "causal-lm",
3
Text
Text
add regex to chai tests for double quotes
c974fd39dda56472f17de37615ff25024d3dad78
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.english.md <ide> tests: <ide> - text: You should test for 'res.status' to be 200. <ide> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.type' to be 'application/json'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.equal(data.assertions[1].args[1], '\'application/json\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.match(data.assertions[1].args[1], /('|")application\/json\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.body.name' to be 'Cristoforo'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.equal(data.assertions[2].args[1], '\'Cristoforo\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.match(data.assertions[2].args[1], /('|")Cristoforo\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.body.surname' to be 'Colombo'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.equal(data.assertions[3].args[1], '\'Colombo\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.match(data.assertions[3].args[1], /('|")Colombo\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.english.md <ide> tests: <ide> - text: You should test for 'res.status' to be 200 <ide> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.type' to be 'application/json' <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.equal(data.assertions[1].args[1], '\'application/json\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.match(data.assertions[1].args[1], /('|")application\/json\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.body.name' to be 'Giovanni' <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.equal(data.assertions[2].args[1], '\'Giovanni\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.match(data.assertions[2].args[1], /('|")Giovanni\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.body.surname' to be 'da Verrazzano' <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.equal(data.assertions[3].args[1], '\'da Verrazzano\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.match(data.assertions[3].args[1], /('|")da Verrazzano\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.english.md <ide> tests: <ide> - text: You should test for 'res.status' == 200 <ide> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should test for 'res.text' == 'hello Guest' <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.text'); assert.equal(data.assertions[1].args[1], '\'hello Guest\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.text'); assert.match(data.assertions[1].args[1], /('|")hello Guest\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.english.md <ide> tests: <ide> - text: You should assert that the headless browser request succeeded. <ide> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the text inside the element 'span#name' is 'Amerigo'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.equal(data.assertions[1].args[0], '\'span#name\''); assert.equal(data.assertions[1].args[1], '\'Amerigo\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.match(data.assertions[1].args[0], /('|")span#name\1/); assert.match(data.assertions[1].args[1], /('|")Amerigo\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the text inside the element 'span#surname' is 'Vespucci'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.equal(data.assertions[2].args[0], '\'span#surname\''); assert.equal(data.assertions[2].args[1], '\'Vespucci\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.match(data.assertions[2].args[0], /('|")span#surname\1/); assert.match(data.assertions[2].args[1], /('|")Vespucci\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the element 'span#dates' exist and its count is 1. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.equal(data.assertions[3].args[0], '\'span#dates\''); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.match(data.assertions[3].args[0], /('|")span#dates\1/); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); }) <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.english.md <ide> tests: <ide> - text: You should assert that the headless browser request succeeded. <ide> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the text inside the element 'span#name' is 'Cristoforo'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.equal(data.assertions[1].args[0], '\'span#name\''); assert.equal(data.assertions[1].args[1], '\'Cristoforo\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.match(data.assertions[1].args[0], /('|")span#name\1/); assert.match(data.assertions[1].args[1], /('|")Cristoforo\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the text inside the element 'span#surname' is 'Colombo'. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.equal(data.assertions[2].args[0], '\'span#surname\''); assert.equal(data.assertions[2].args[1], '\'Colombo\'');}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.match(data.assertions[2].args[0], /('|")span#surname\1/); assert.match(data.assertions[2].args[1], /('|")Colombo\1/);}, xhr => { throw new Error(xhr.responseText); }) <ide> - text: You should assert that the element 'span#dates' exist and its count is 1. <del> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.equal(data.assertions[3].args[0], '\'span#dates\''); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); }) <add> testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.match(data.assertions[3].args[0], /('|")span#dates\1/); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); }) <ide> <ide> ``` <ide>
5
PHP
PHP
fix a bunch of failing tests
9f1bc1e0a38da7203dd2e9c63ccc03301cebb47d
<ide><path>lib/Cake/Routing/Route/Route.php <ide> public function match($url, $context = array()) { <ide> } <ide> <ide> // Defaults with different values are a fail. <del> if (array_intersect_key($url, $defaults) !== $defaults) { <add> if (array_intersect_key($url, $defaults) != $defaults) { <ide> return false; <ide> } <ide> <ide><path>lib/Cake/Routing/Router.php <ide> public static function mapResources($controller, $options = array()) { <ide> foreach ((array)$controller as $name) { <ide> list($plugin, $name) = pluginSplit($name); <ide> $urlName = Inflector::underscore($name); <del> $plugin = Inflector::underscore($plugin); <add> if ($plugin) { <add> $plugin = Inflector::underscore($plugin); <add> } <ide> if ($plugin && !$hasPrefix) { <ide> $prefix = '/' . $plugin . '/'; <ide> } <ide><path>lib/Cake/Test/TestCase/Routing/Route/RouteTest.php <ide> public function testMatchExtractQueryStringArgs() { <ide> $this->assertEquals('/posts/index/1?page=1&dir=desc&order=title', $result); <ide> } <ide> <add>/** <add> * Test separartor. <add> * <add> * @return void <add> */ <add> public function testQueryStringGeneration() { <add> $route = new Route('/:controller/:action/*'); <add> <add> $restore = ini_get('arg_separator.output'); <add> ini_set('arg_separator.output', '&amp;'); <add> <add> $result = $route->match(array( <add> 'controller' => 'posts', <add> 'action' => 'index', <add> 0, <add> 'test' => 'var', <add> 'var2' => 'test2', <add> 'more' => 'test data' <add> )); <add> $expected = '/posts/index/0?test=var&amp;var2=test2&amp;more=test+data'; <add> $this->assertEquals($expected, $result); <add> ini_set('arg_separator.output', $restore); <add> } <add> <ide> /** <ide> * test persistParams ability to persist parameters from $params and remove params. <ide> * <ide><path>lib/Cake/Test/TestCase/Routing/RouterTest.php <ide> public function testMultipleResourceRoute() { <ide> public function testGenerateUrlResourceRoute() { <ide> Router::mapResources('Posts'); <ide> <del> $result = Router::url(array('controller' => 'posts', 'action' => 'index', '[method]' => 'GET')); <add> $result = Router::url(array( <add> 'controller' => 'posts', <add> 'action' => 'index', <add> '[method]' => 'GET' <add> )); <ide> $expected = '/posts'; <ide> $this->assertEquals($expected, $result); <ide> <del> $result = Router::url(array('controller' => 'posts', 'action' => 'view', '[method]' => 'GET', 'id' => 10)); <add> $result = Router::url(array( <add> 'controller' => 'posts', <add> 'action' => 'view', <add> '[method]' => 'GET', <add> 'id' => 10 <add> )); <ide> $expected = '/posts/10'; <ide> $this->assertEquals($expected, $result); <ide>
4
Python
Python
remove uncessary django settings
9a2a885d2def491768899458b495b00906fea6b5
<ide><path>testproj/settings.py <ide> DATABASE_HOST = '' <ide> DATABASE_PORT = '' <ide> <del># Local time zone for this installation. Choices can be found here: <del># http://en.wikipedia.org/wiki/List_of_tz_zones_by_name <del># although not all choices may be available on all operating systems. <del># If running in a Windows environment this must be set to the same as your <del># system time zone. <del>TIME_ZONE = 'America/Chicago' <del> <del># Language code for this installation. All choices can be found here: <del># http://www.i18nguy.com/unicode/language-identifiers.html <del>LANGUAGE_CODE = 'en-us' <del> <del>SITE_ID = 1 <del> <del># If you set this to False, Django will make some optimizations so as not <del># to load the internationalization machinery. <del>USE_I18N = True <del> <del># Absolute path to the directory that holds media. <del># Example: "/home/media/media.lawrence.com/" <del>MEDIA_ROOT = '' <del> <del># URL that handles the media served from MEDIA_ROOT. Make sure to use a <del># trailing slash if there is a path component (optional in other cases). <del># Examples: "http://media.lawrence.com", "http://example.com/media/" <del>MEDIA_URL = '' <del> <del># URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a <del># trailing slash. <del># Examples: "http://foo.com/media/", "/media/". <del>ADMIN_MEDIA_PREFIX = '/media/' <del> <del># Make this unique, and don't share it with anybody. <del>SECRET_KEY = '8j5$cwnv#bcdq(bolyf*#6icpmqn!o7^-q*b#n!=_r3!ol$932' <del> <del># List of callables that know how to import templates from various sources. <del>TEMPLATE_LOADERS = ( <del> 'django.template.loaders.filesystem.load_template_source', <del> 'django.template.loaders.app_directories.load_template_source', <del># 'django.template.loaders.eggs.load_template_source', <del>) <del> <del>MIDDLEWARE_CLASSES = ( <del> 'django.middleware.common.CommonMiddleware', <del> 'django.contrib.sessions.middleware.SessionMiddleware', <del> 'django.contrib.auth.middleware.AuthenticationMiddleware', <del>) <del> <del>ROOT_URLCONF = 'testproj.urls' <del> <del>TEMPLATE_DIRS = ( <del> # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". <del> # Always use forward slashes, even on Windows. <del> # Don't forget to use absolute paths, not relative paths. <del>) <del> <del> <ide> INSTALLED_APPS = ( <ide> 'django.contrib.auth', <ide> 'django.contrib.contenttypes',
1
PHP
PHP
fix typo in api docs
18aa3717f7e3ed38a6e3895f929b48e95b115b66
<ide><path>src/View/Helper/FormHelper.php <ide> public function submit($caption = null, array $options = []) <ide> * A simple array will create normal options: <ide> * <ide> * {{{ <del> * $options = array(1 => 'one', 2 => 'two); <add> * $options = array(1 => 'one', 2 => 'two'); <ide> * $this->Form->select('Model.field', $options)); <ide> * }}} <ide> *
1
Python
Python
fix bug writing predictions in run_squad_pytorch
38f740a1d579b6d21226fae4f758e315cbfa1243
<ide><path>run_squad_pytorch.py <ide> def main(): <ide> #end_logits = [x.item() for x in end_logits] <ide> end_logits = [x.view(-1).detach().cpu().numpy() for x in end_logits] <ide> for idx, i in enumerate(unique_id): <del> s = start_logits[idx] <del> e = end_logits[idx] <add> s = [float(x) for x in start_logits[idx]] <add> e = [float(x) for x in end_logits[idx]] <ide> all_results.append( <ide> RawResult( <ide> unique_id=i,
1
Python
Python
remove cytoolz usage in cli
0a6072621570464522cbfa6d939dffccc0fa6503
<ide><path>spacy/cli/converters/iob2json.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <del>import cytoolz <del> <ide> from ...gold import iob_to_biluo <add>from ...util import minibatch <ide> <ide> <ide> def iob2json(input_data, n_sents=10, *args, **kwargs): <ide> """ <ide> Convert IOB files into JSON format for use with train cli. <ide> """ <ide> docs = [] <del> for group in cytoolz.partition_all(n_sents, docs): <add> for group in minibatch(docs, n_sents): <ide> group = list(group) <ide> first = group.pop(0) <ide> to_extend = first["paragraphs"][0]["sentences"]
1
Ruby
Ruby
apply suggestions from code review
52321b4fcdf4bea64ca5c57e0171a5d36f37085f
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_formula_name <ide> def audit_license <ide> if formula.license.present? <ide> non_standard_licenses = [] <del> formula.license.each do |lic| <del> next if @spdx_data["licenses"].any? { |standard_lic| standard_lic["licenseId"] == lic } <add> formula.license.each do |license| <add> next if @spdx_data["licenses"].any? { |spdx| spdx["licenseId"] == license } <ide> <del> non_standard_licenses << lic <add> non_standard_licenses << license <ide> end <ide> <ide> if non_standard_licenses.present? <del> problem "Formula #{formula.name} contains non standard SPDX license: #{non_standard_licenses}." <add> problem "Formula #{formula.name} contains non-standard SPDX licenses: #{non_standard_licenses}." <ide> end <ide> <ide> return unless @online <ide><path>Library/Homebrew/formula.rb <ide> def license(args = nil) <ide> if args.nil? <ide> @licenses <ide> else <del> @licenses = Array(args) unless args == "" <add> @licenses = Array(args) <ide> end <ide> end <ide> <ide><path>Library/Homebrew/formula_installer.rb <ide> def forbidden_license_check <ide> end <ide> return if @only_deps <ide> <del> return unless formula.license.all? { |lic| forbidden_licenses.include? lic } <add> return unless formula.license.all? { |license| forbidden_licenses.include? license } <ide> <ide> raise CannotInstallFormulaError, <<~EOS <ide> #{formula.name}'s licenses are all forbidden: #{formula.license}.
3
Ruby
Ruby
add collectionproxy#reload documentation
158a71b2cbd6be9ef9c88282b48a3e39e47908ed
<ide><path>activerecord/lib/active_record/associations/collection_proxy.rb <ide> def clear <ide> self <ide> end <ide> <add> # Reloads the collection from the database. Returns +self+. <add> # Equivalent to +collection(true)+. <add> # <add> # class Person < ActiveRecord::Base <add> # has_many :pets <add> # end <add> # <add> # person.pets # fetches pets from the database <add> # # => [#<Pet id: 1, name: "Snoop", group: "dogs", person_id: 1>] <add> # <add> # person.pets # uses the pets cache <add> # # => [#<Pet id: 1, name: "Snoop", group: "dogs", person_id: 1>] <add> # <add> # person.pets.reload # fetches pets from the database <add> # # => [#<Pet id: 1, name: "Snoop", group: "dogs", person_id: 1>] <add> # <add> # person.pets(true)  # fetches pets from the database <add> # # => [#<Pet id: 1, name: "Snoop", group: "dogs", person_id: 1>] <ide> def reload <ide> proxy_association.reload <ide> self
1
Text
Text
explain differences between variant processors
22e5f95c83eb0ae7146d8dca8c00410b06ae8804
<ide><path>guides/source/active_storage_overview.md <ide> The default processor for Active Storage is MiniMagick, but you can also use <ide> config.active_storage.variant_processor = :vips <ide> ``` <ide> <add>The two processors are not fully compatible, so when migrating an existing application <add>using MiniMagick to Vips, some changes have to be made if using options that are format <add>specific: <add> <add>```rhtml <add><!-- MiniMagick --> <add><%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, sampling_factor: "4:2:0", strip: true, interlace: "JPEG", colorspace: "sRGB", quality: 80) %> <add> <add><!-- Vips --> <add><%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, saver: { subsample_mode: "on", strip: true, interlace: true, quality: 80 }) %> <add>``` <add> <ide> [`variant`]: https://api.rubyonrails.org/classes/ActiveStorage/Blob/Representable.html#method-i-variant <ide> [Vips]: https://www.rubydoc.info/gems/ruby-vips/Vips/Image <ide>
1
Javascript
Javascript
rewrite imports in rntester to use standard paths
26cce3d7a889e0622636c4e4b6bd42e0abecb275
<ide><path>RNTester/NativeModuleExample/NativeScreenshotManager.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../Libraries/TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../Libraries/TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +getConstants: () => {||}; <ide><path>RNTester/RCTTest/RCTSnapshotNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>import type {SyntheticEvent} from 'CoreEventTypes'; <del>import type {ViewProps} from 'ViewPropTypes'; <del>import type {NativeComponent} from 'ReactNative'; <add>const {requireNativeComponent} = require('react-native'); <add> <add>import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes'; <add>import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes'; <add>import type {NativeComponent} from '../../Libraries/Renderer/shims/ReactNative'; <ide> <ide> type SnapshotReadyEvent = SyntheticEvent< <ide> $ReadOnly<{ <ide> type NativeProps = $ReadOnly<{| <ide> <ide> type SnapshotViewNativeType = Class<NativeComponent<NativeProps>>; <ide> <del>const requireNativeComponent = require('requireNativeComponent'); <del> <ide> module.exports = ((requireNativeComponent( <ide> 'RCTSnapshot', <ide> ): any): SnapshotViewNativeType); <ide><path>RNTester/js/ARTExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {ART, Platform, View} = ReactNative; <add>const {ART, Platform, View} = require('react-native'); <ide> <ide> const {Surface, Path, Group, Shape} = ART; <ide> <ide><path>RNTester/js/AccessibilityAndroidExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <del> AccessibilityInfo, <ide> StyleSheet, <ide> Text, <ide> View, <del> ToastAndroid, <ide> TouchableWithoutFeedback, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide><path>RNTester/js/AccessibilityExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative; <add>const { <add> AccessibilityInfo, <add> Text, <add> View, <add> TouchableOpacity, <add> Alert, <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> <ide><path>RNTester/js/AccessibilityIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative; <add>const {Text, View, Alert} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> <ide> class AccessibilityIOSExample extends React.Component<Props> { <ide> <Text>Accessibility magic tap example</Text> <ide> </View> <ide> <View <del> onAccessibilityEscape={() => alert('onAccessibilityEscape success')} <add> onAccessibilityEscape={() => <add> Alert.alert('onAccessibilityEscape success') <add> } <ide> accessible={true}> <ide> <Text>Accessibility escape example</Text> <ide> </View> <ide><path>RNTester/js/ActionSheetIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> ActionSheetIOS, <ide> StyleSheet, <ide> Text, <ide> View, <ide> Alert, <ide> NativeModules, <del>} = ReactNative; <add> findNodeHandle, <add>} = require('react-native'); <ide> const ScreenshotManager = NativeModules.ScreenshotManager; <ide> <ide> const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel']; <ide> class ActionSheetAnchorExample extends React.Component< <ide> cancelButtonIndex: CANCEL_INDEX, <ide> destructiveButtonIndex: DESTRUCTIVE_INDEX, <ide> anchor: this.anchorRef.current <del> ? ReactNative.findNodeHandle(this.anchorRef.current) <add> ? findNodeHandle(this.anchorRef.current) <ide> : undefined, <ide> }, <ide> buttonIndex => { <ide> class ShareScreenshotAnchorExample extends React.Component< <ide> url: uri, <ide> excludedActivityTypes: ['com.apple.UIKit.activity.PostToTwitter'], <ide> anchor: this.anchorRef.current <del> ? ReactNative.findNodeHandle(this.anchorRef.current) <add> ? findNodeHandle(this.anchorRef.current) <ide> : undefined, <ide> }, <ide> error => Alert.alert('Error', error), <ide><path>RNTester/js/AlertExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative; <add>const { <add> Alert, <add> StyleSheet, <add> Text, <add> TouchableHighlight, <add> View, <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> <ide><path>RNTester/js/AlertIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, View, Text, TouchableHighlight, Alert} = ReactNative; <add>const { <add> StyleSheet, <add> View, <add> Text, <add> TouchableHighlight, <add> Alert, <add>} = require('react-native'); <ide> <ide> const {SimpleAlertExampleBlock} = require('./AlertExample'); <ide> <ide><path>RNTester/js/AnimatedExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, Easing, StyleSheet, Text, View} = ReactNative; <add>const {Animated, Easing, StyleSheet, Text, View} = require('react-native'); <ide> const RNTesterButton = require('./RNTesterButton'); <ide> <ide> const styles = StyleSheet.create({ <ide><path>RNTester/js/AnimatedGratuitousApp/AnExApp.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative; <add>const { <add> Animated, <add> LayoutAnimation, <add> PanResponder, <add> StyleSheet, <add> View, <add>} = require('react-native'); <ide> <del>const AnExSet = require('AnExSet'); <add>const AnExSet = require('./AnExSet'); <ide> <ide> const CIRCLE_SIZE = 80; <ide> const CIRCLE_MARGIN = 18; <ide><path>RNTester/js/AnimatedGratuitousApp/AnExBobble.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, PanResponder, StyleSheet, View} = ReactNative; <add>const {Animated, PanResponder, StyleSheet, View} = require('react-native'); <ide> <ide> const NUM_BOBBLES = 5; <ide> const RAD_EACH = Math.PI / 2 / (NUM_BOBBLES - 2); <ide><path>RNTester/js/AnimatedGratuitousApp/AnExChained.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, PanResponder, StyleSheet, View} = ReactNative; <add>const {Animated, PanResponder, StyleSheet, View} = require('react-native'); <ide> <ide> class AnExChained extends React.Component<Object, any> { <ide> constructor(props: Object) { <ide><path>RNTester/js/AnimatedGratuitousApp/AnExScroll.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, Image, ScrollView, StyleSheet, Text, View} = ReactNative; <add>const { <add> Animated, <add> Image, <add> ScrollView, <add> StyleSheet, <add> Text, <add> View, <add>} = require('react-native'); <ide> <ide> class AnExScroll extends React.Component<$FlowFixMeProps, any> { <ide> state: any = {scrollX: new Animated.Value(0)}; <ide><path>RNTester/js/AnimatedGratuitousApp/AnExSet.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, PanResponder, StyleSheet, Text, View} = ReactNative; <add>const { <add> Animated, <add> PanResponder, <add> StyleSheet, <add> Text, <add> View, <add>} = require('react-native'); <ide> <ide> const AnExBobble = require('./AnExBobble'); <ide> const AnExChained = require('./AnExChained'); <ide><path>RNTester/js/AnimatedGratuitousApp/AnExTilt.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, PanResponder, StyleSheet} = ReactNative; <add>const {Animated, PanResponder, StyleSheet} = require('react-native'); <ide> <ide> class AnExTilt extends React.Component<Object, any> { <ide> constructor(props: Object) { <ide><path>RNTester/js/AppStateExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {AppState, Text, View} = ReactNative; <add>const {AppState, Text, View} = require('react-native'); <ide> <ide> class AppStateSubscription extends React.Component< <ide> $FlowFixMeProps, <ide><path>RNTester/js/AssetScaledImageExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Image, StyleSheet, View, ScrollView} = ReactNative; <add>const {Image, StyleSheet, View, ScrollView} = require('react-native'); <ide> <del>import type {PhotoIdentifier} from 'CameraRoll'; <add>import type {PhotoIdentifier} from '../../Libraries/CameraRoll/CameraRoll'; <ide> <ide> type Props = $ReadOnly<{| <ide> asset: PhotoIdentifier, <ide><path>RNTester/js/AsyncStorageExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {AsyncStorage, PickerIOS, Text, View} = ReactNative; <add>const {AsyncStorage, PickerIOS, Text, View} = require('react-native'); <ide> const PickerItemIOS = PickerIOS.Item; <ide> <ide> const STORAGE_KEY = '@AsyncStorageExample:key'; <ide><path>RNTester/js/BorderExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, View} = ReactNative; <add>const {StyleSheet, View} = require('react-native'); <ide> <ide> const styles = StyleSheet.create({ <ide> box: { <ide><path>RNTester/js/BoxShadowExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Image, StyleSheet, View} = ReactNative; <add>const {Image, StyleSheet, View} = require('react-native'); <ide> <ide> const styles = StyleSheet.create({ <ide> box: { <ide><path>RNTester/js/ButtonExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Alert, Button, View, StyleSheet} = ReactNative; <add>const {Alert, Button, View, StyleSheet} = require('react-native'); <ide> <ide> function onButtonPress(buttonName) { <ide> Alert.alert(`${buttonName} has been pressed!`); <ide><path>RNTester/js/CameraRollExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> CameraRoll, <ide> Image, <ide> const { <ide> Text, <ide> View, <ide> TouchableOpacity, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const invariant = require('invariant'); <ide> <ide> const CameraRollView = require('./CameraRollView'); <ide> <ide> const AssetScaledImageExampleView = require('./AssetScaledImageExample'); <ide> <del>import type {PhotoIdentifier, GroupTypes} from 'CameraRoll'; <add>import type { <add> PhotoIdentifier, <add> GroupTypes, <add>} from '../../Libraries/CameraRoll/CameraRoll'; <ide> <ide> type Props = $ReadOnly<{| <ide> navigator?: ?Array< <ide><path>RNTester/js/CameraRollView.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> ActivityIndicator, <ide> Alert, <ide> const { <ide> Platform, <ide> StyleSheet, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <del>const groupByEveryN = require('groupByEveryN'); <del>const logError = require('logError'); <add>const groupByEveryN = require('../../Libraries/Utilities/groupByEveryN'); <add>const logError = require('../../Libraries/Utilities/logError'); <ide> <ide> import type { <ide> PhotoIdentifier, <ide> PhotoIdentifiersPage, <ide> GetPhotosParams, <del>} from 'CameraRoll'; <add>} from '../../Libraries/CameraRoll/CameraRoll'; <ide> <ide> type Props = $ReadOnly<{| <ide> /** <ide><path>RNTester/js/CheckBoxExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {CheckBox, Text, View, StyleSheet} = ReactNative; <add>const {CheckBox, Text, View, StyleSheet} = require('react-native'); <ide> <ide> type BasicState = {| <ide> trueCheckBoxIsOn: boolean, <ide><path>RNTester/js/ClipboardExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Clipboard, View, Text, StyleSheet} = ReactNative; <add>const {Clipboard, View, Text, StyleSheet} = require('react-native'); <ide> <ide> type Props = $ReadOnly<{||}>; <ide> type State = {| <ide><path>RNTester/js/DatePickerAndroidExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> DatePickerAndroid, <ide> StyleSheet, <ide> Text, <ide> TouchableWithoutFeedback, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide><path>RNTester/js/DatePickerIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {DatePickerIOS, StyleSheet, Text, View} = ReactNative; <add>const {DatePickerIOS, StyleSheet, Text, View} = require('react-native'); <ide> <ide> type State = {| <ide> date: Date, <ide><path>RNTester/js/DimensionsExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Dimensions, Text, View} = ReactNative; <add>const {Dimensions, Text, View} = require('react-native'); <ide> <ide> class DimensionsSubscription extends React.Component< <ide> {dim: string}, <ide><path>RNTester/js/FlatListExample.js <ide> <ide> import type {Item} from './ListExampleShared'; <ide> <del>const Alert = require('Alert'); <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, StyleSheet, View} = ReactNative; <add>const {Alert, Animated, StyleSheet, View} = require('react-native'); <ide> <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>const infoLog = require('infoLog'); <add>const infoLog = require('../../Libraries/Utilities/infoLog'); <ide> <ide> const { <ide> FooterComponent, <ide><path>RNTester/js/ImageCapInsetsExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> <del>const nativeImageSource = require('nativeImageSource'); <add>const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); <ide> const {Image, StyleSheet, Text, View} = ReactNative; <ide> <ide> type Props = $ReadOnly<{||}>; <ide><path>RNTester/js/ImageEditingExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> CameraRoll, <ide> Image, <ide> const { <ide> Text, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const PAGE_SIZE = 20; <ide> <ide><path>RNTester/js/ImageExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> ActivityIndicator, <ide> Image, <ide> StyleSheet, <ide> Text, <ide> View, <ide> ImageBackground, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const base64Icon = <ide> 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg=='; <ide><path>RNTester/js/InputAccessoryViewExample.js <ide> <ide> 'use strict'; <ide> <del>const React = require('React'); <del>const ReactNative = require('react-native'); <add>const React = require('react'); <ide> const { <ide> Alert, <ide> Button, <ide> const { <ide> Text, <ide> TextInput, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> type MessageProps = $ReadOnly<{||}>; <ide> class Message extends React.PureComponent<MessageProps> { <ide><path>RNTester/js/KeyboardAvoidingViewExample.js <ide> <ide> 'use strict'; <ide> <del>const React = require('React'); <del>const ReactNative = require('react-native'); <add>const React = require('react'); <ide> const { <ide> KeyboardAvoidingView, <ide> Modal, <ide> const { <ide> TextInput, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide><path>RNTester/js/LayoutAnimationExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {LayoutAnimation, StyleSheet, Text, View, TouchableOpacity} = ReactNative; <add>const { <add> LayoutAnimation, <add> StyleSheet, <add> Text, <add> View, <add> TouchableOpacity, <add>} = require('react-native'); <ide> <ide> class AddRemoveExample extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide><path>RNTester/js/LayoutEventsExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; <add>const { <add> Image, <add> LayoutAnimation, <add> StyleSheet, <add> Text, <add> View, <add>} = require('react-native'); <ide> <del>import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes'; <add>import type { <add> ViewLayout, <add> ViewLayoutEvent, <add>} from '../../Libraries/Components/View/ViewPropTypes'; <ide> <ide> type Props = $ReadOnly<{||}>; <ide> type State = { <ide><path>RNTester/js/LayoutExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, View} = ReactNative; <add>const {StyleSheet, Text, View} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide><path>RNTester/js/ListExampleShared.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Animated, <ide> Image, <ide> const { <ide> Text, <ide> TextInput, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> export type Item = { <ide> title: string, <ide><path>RNTester/js/ModalExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Modal, <ide> Picker, <ide> const { <ide> Text, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const Item = Picker.Item; <ide> <ide><path>RNTester/js/MultiColumnExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {FlatList, StyleSheet, Text, View, Alert} = ReactNative; <add>const {FlatList, StyleSheet, Text, View, Alert} = require('react-native'); <ide> <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>const infoLog = require('infoLog'); <add>const infoLog = require('../../Libraries/Utilities/infoLog'); <ide> <ide> const { <ide> FooterComponent, <ide><path>RNTester/js/NativeAnimationsExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> View, <ide> Text, <ide> Animated, <ide> StyleSheet, <ide> TouchableWithoutFeedback, <ide> Slider, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const AnimatedSlider = Animated.createAnimatedComponent(Slider); <ide> <ide> class LoopExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <del>const RNTesterSettingSwitchRow = require('RNTesterSettingSwitchRow'); <add>const RNTesterSettingSwitchRow = require('./RNTesterSettingSwitchRow'); <ide> class InternalSettings extends React.Component< <ide> {}, <ide> {busyTime: number | string, filteredStall: number}, <ide> class InternalSettings extends React.Component< <ide> initialValue={false} <ide> label="Track JS Stalls" <ide> onEnable={() => { <del> require('JSEventLoopWatchdog').install({thresholdMS: 25}); <del> this.setState({busyTime: '<none>'}); <del> require('JSEventLoopWatchdog').addHandler({ <del> onStall: ({busyTime}) => <del> this.setState(state => ({ <del> busyTime, <del> filteredStall: <del> (state.filteredStall || 0) * 0.97 + busyTime * 0.03, <del> })), <add> require('../../Libraries/Interaction/JSEventLoopWatchdog').install({ <add> thresholdMS: 25, <ide> }); <add> this.setState({busyTime: '<none>'}); <add> require('../../Libraries/Interaction/JSEventLoopWatchdog').addHandler( <add> { <add> onStall: ({busyTime}) => <add> this.setState(state => ({ <add> busyTime, <add> filteredStall: <add> (state.filteredStall || 0) * 0.97 + busyTime * 0.03, <add> })), <add> }, <add> ); <ide> }} <ide> onDisable={() => { <ide> console.warn('Cannot disable yet....'); <ide><path>RNTester/js/NetInfoExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {NetInfo, Text, View, TouchableWithoutFeedback} = ReactNative; <add>const {NetInfo, Text, View, TouchableWithoutFeedback} = require('react-native'); <ide> <ide> class ConnectionInfoSubscription extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide><path>RNTester/js/OrientationChangeExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {DeviceEventEmitter, Text, View} = ReactNative; <add>const {DeviceEventEmitter, Text, View} = require('react-native'); <ide> <del>import type EmitterSubscription from 'EmitterSubscription'; <add>import type EmitterSubscription from '../../Libraries/vendor/emitter/EmitterSubscription'; <ide> <ide> class OrientationChangeExample extends React.Component<{}, $FlowFixMeState> { <ide> _orientationSubscription: EmitterSubscription; <ide><path>RNTester/js/PanResponderExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {PanResponder, StyleSheet, View} = ReactNative; <add>const {PanResponder, StyleSheet, View} = require('react-native'); <ide> <del>import type {PanResponderInstance, GestureState} from 'PanResponder'; <del>import type {PressEvent} from 'CoreEventTypes'; <add>import type { <add> PanResponderInstance, <add> GestureState, <add>} from '../../Libraries/Interaction/PanResponder'; <add>import type {PressEvent} from '../../Libraries/Types/CoreEventTypes'; <ide> <ide> type CircleStyles = { <ide> backgroundColor?: string, <ide><path>RNTester/js/PermissionsExampleAndroid.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> PermissionsAndroid, <ide> Picker, <ide> StyleSheet, <ide> Text, <ide> TouchableWithoutFeedback, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const Item = Picker.Item; <ide> <ide><path>RNTester/js/PickerExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const StyleSheet = require('StyleSheet'); <del> <del>const {Picker, Text} = ReactNative; <add>const {Picker, StyleSheet, Text} = require('react-native'); <ide> <ide> const Item = Picker.Item; <ide> <ide><path>RNTester/js/PickerIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {PickerIOS, Text, View} = ReactNative; <add>const {PickerIOS, Text, View} = require('react-native'); <ide> <ide> const PickerItemIOS = PickerIOS.Item; <ide> <ide><path>RNTester/js/PointerEventsExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, View} = ReactNative; <add>const {StyleSheet, Text, View} = require('react-native'); <ide> <ide> class ExampleBox extends React.Component<$FlowFixMeProps, $FlowFixMeState> { <ide> state = { <ide><path>RNTester/js/ProgressBarAndroidExample.android.js <ide> <ide> 'use strict'; <ide> <del>const ProgressBar = require('ProgressBarAndroid'); <del>const React = require('React'); <del>const RNTesterBlock = require('RNTesterBlock'); <del>const RNTesterPage = require('RNTesterPage'); <add>const React = require('react'); <add>const {ProgressBarAndroid: ProgressBar} = require('react-native'); <add>const RNTesterBlock = require('./RNTesterBlock'); <add>const RNTesterPage = require('./RNTesterPage'); <ide> <del>import type {ProgressBarAndroidProps} from 'ProgressBarAndroid'; <add>import type {ProgressBarAndroidProps} from '../../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; <ide> <ide> type MovingBarProps = $ReadOnly<{| <ide> ...$Diff< <ide><path>RNTester/js/ProgressViewIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {ProgressViewIOS, StyleSheet, View} = ReactNative; <add>const {ProgressViewIOS, StyleSheet, View} = require('react-native'); <ide> <ide> type Props = {||}; <ide> type State = {| <ide><path>RNTester/js/PushNotificationIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Alert, <add> DeviceEventEmitter, <ide> PushNotificationIOS, <ide> StyleSheet, <ide> Text, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> class Button extends React.Component<$FlowFixMeProps> { <ide> render() { <ide> class NotificationExample extends React.Component<{}> { <ide> } <ide> <ide> _sendNotification() { <del> require('RCTDeviceEventEmitter').emit('remoteNotificationReceived', { <add> DeviceEventEmitter.emit('remoteNotificationReceived', { <ide> remote: true, <ide> aps: { <ide> alert: 'Sample notification', <ide> class NotificationExample extends React.Component<{}> { <ide> } <ide> <ide> _sendLocalNotification() { <del> require('RCTDeviceEventEmitter').emit('localNotificationReceived', { <add> DeviceEventEmitter.emit('localNotificationReceived', { <ide> aps: { <ide> alert: 'Sample local notification', <ide> badge: '+1', <ide><path>RNTester/js/RCTRootViewIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, View} = ReactNative; <del> <del>const requireNativeComponent = require('requireNativeComponent'); <add>const { <add> StyleSheet, <add> Text, <add> View, <add> requireNativeComponent, <add>} = require('react-native'); <ide> <ide> class AppPropertiesUpdateExample extends React.Component<{}> { <ide> render() { <ide><path>RNTester/js/RNTesterApp.android.js <ide> <ide> 'use strict'; <ide> <del>const AppRegistry = require('AppRegistry'); <del>const AsyncStorage = require('AsyncStorage'); <del>const BackHandler = require('BackHandler'); <del>const Dimensions = require('Dimensions'); <del>const DrawerLayoutAndroid = require('DrawerLayoutAndroid'); <del>const Linking = require('Linking'); <ide> const React = require('react'); <del>const StatusBar = require('StatusBar'); <del>const StyleSheet = require('StyleSheet'); <del>const ToolbarAndroid = require('ToolbarAndroid'); <add>const { <add> AppRegistry, <add> AsyncStorage, <add> BackHandler, <add> Dimensions, <add> DrawerLayoutAndroid, <add> Linking, <add> StatusBar, <add> StyleSheet, <add> ToolbarAndroid, <add> UIManager, <add> View, <add>} = require('react-native'); <ide> const RNTesterActions = require('./RNTesterActions'); <ide> const RNTesterExampleContainer = require('./RNTesterExampleContainer'); <ide> const RNTesterExampleList = require('./RNTesterExampleList'); <ide> /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when <ide> * making Flow check .android.js files. */ <ide> const RNTesterList = require('./RNTesterList'); <ide> const RNTesterNavigationReducer = require('./RNTesterNavigationReducer'); <del>const UIManager = require('UIManager'); <ide> const URIActionMap = require('./URIActionMap'); <del>const View = require('View'); <ide> <del>const nativeImageSource = require('nativeImageSource'); <add>const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); <ide> <ide> import type {RNTesterNavigationState} from './RNTesterNavigationReducer'; <ide> <ide><path>RNTester/js/RNTesterApp.ios.js <ide> <ide> 'use strict'; <ide> <del>require('InitializeCore'); <del>const AsyncStorage = require('AsyncStorage'); <del>const BackHandler = require('BackHandler'); <del>const Linking = require('Linking'); <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <add>const { <add> AppRegistry, <add> AsyncStorage, <add> BackHandler, <add> Button, <add> Linking, <add> SafeAreaView, <add> StyleSheet, <add> Text, <add> View, <add> YellowBox, <add>} = require('react-native'); <ide> const RNTesterActions = require('./RNTesterActions'); <ide> const RNTesterExampleContainer = require('./RNTesterExampleContainer'); <ide> const RNTesterExampleList = require('./RNTesterExampleList'); <ide> const RNTesterNavigationReducer = require('./RNTesterNavigationReducer'); <ide> const SnapshotViewIOS = require('./SnapshotViewIOS.ios'); <ide> const URIActionMap = require('./URIActionMap'); <ide> <del>const { <del> Button, <del> AppRegistry, <del> StyleSheet, <del> Text, <del> View, <del> SafeAreaView, <del> YellowBox, <del>} = ReactNative; <del> <del>import type {RNTesterExample} from 'RNTesterTypes'; <add>import type {RNTesterExample} from './Shared/RNTesterTypes'; <ide> import type {RNTesterAction} from './RNTesterActions'; <ide> import type {RNTesterNavigationState} from './RNTesterNavigationReducer'; <ide> <ide><path>RNTester/js/RNTesterButton.js <ide> const React = require('react'); <ide> const {StyleSheet, Text, TouchableHighlight} = require('react-native'); <ide> <del>import type {PressEvent} from 'CoreEventTypes'; <add>import type {PressEvent} from '../../Libraries/Types/CoreEventTypes'; <ide> <ide> type Props = $ReadOnly<{| <ide> children?: React.Node, <ide><path>RNTester/js/RNTesterExampleFilter.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const StyleSheet = require('StyleSheet'); <del>const TextInput = require('TextInput'); <del>const View = require('View'); <add>const {StyleSheet, TextInput, View} = require('react-native'); <ide> <ide> type Props = { <ide> filter: Function, <ide><path>RNTester/js/RNTesterExampleList.js <ide> <ide> 'use strict'; <ide> <del>const Platform = require('Platform'); <ide> const React = require('react'); <del>const SectionList = require('SectionList'); <del>const StyleSheet = require('StyleSheet'); <del>const Text = require('Text'); <del>const TouchableHighlight = require('TouchableHighlight'); <add>const { <add> Platform, <add> SectionList, <add> StyleSheet, <add> Text, <add> TouchableHighlight, <add> View, <add>} = require('react-native'); <ide> const RNTesterActions = require('./RNTesterActions'); <ide> const RNTesterExampleFilter = require('./RNTesterExampleFilter'); <del>const View = require('View'); <ide> <del>import type {RNTesterExample} from 'RNTesterTypes'; <del>import type {ViewStyleProp} from 'StyleSheet'; <add>import type {RNTesterExample} from './Shared/RNTesterTypes'; <add>import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet'; <ide> <ide> type Props = { <ide> onNavigate: Function, <ide><path>RNTester/js/RNTesterList.android.js <ide> <ide> 'use strict'; <ide> <del>import type {RNTesterExample} from 'RNTesterTypes'; <add>import type {RNTesterExample} from './Shared/RNTesterTypes'; <ide> <ide> const ComponentExamples: Array<RNTesterExample> = [ <ide> { <ide><path>RNTester/js/RNTesterList.ios.js <ide> <ide> 'use strict'; <ide> <del>import type {RNTesterExample} from 'RNTesterTypes'; <add>import type {RNTesterExample} from './Shared/RNTesterTypes'; <ide> <ide> const ComponentExamples: Array<RNTesterExample> = [ <ide> { <ide><path>RNTester/js/RNTesterSettingSwitchRow.js <ide> <ide> 'use strict'; <ide> <del>const React = require('React'); <del>const StyleSheet = require('StyleSheet'); <del>const Switch = require('Switch'); <del>const Text = require('Text'); <add>const React = require('react'); <add>const {StyleSheet, Switch, Text, View} = require('react-native'); <ide> const RNTesterStatePersister = require('./RNTesterStatePersister'); <del>const View = require('View'); <ide> <ide> class RNTesterSettingSwitchRow extends React.Component< <ide> $FlowFixMeProps, <ide><path>RNTester/js/RNTesterStatePersister.js <ide> <ide> 'use strict'; <ide> <del>const AsyncStorage = require('AsyncStorage'); <del>const React = require('React'); <add>const React = require('react'); <add>const {AsyncStorage} = require('react-native'); <ide> <ide> export type PassProps<State> = { <ide> state: State, <ide><path>RNTester/js/RNTesterTitle.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, View} = ReactNative; <add>const {StyleSheet, Text, View} = require('react-native'); <ide> <ide> class RNTesterTitle extends React.Component<$FlowFixMeProps> { <ide> render() { <ide><path>RNTester/js/RTLExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Alert, <ide> Animated, <ide> I18nManager, <ide> Image, <ide> PixelRatio, <add> Platform, <ide> StyleSheet, <ide> Text, <ide> TouchableWithoutFeedback, <ide> Switch, <ide> View, <ide> Button, <del>} = ReactNative; <del>const Platform = require('Platform'); <add>} = require('react-native'); <ide> <ide> type State = { <ide> toggleStatus: any, <ide><path>RNTester/js/RefreshControlExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> ScrollView, <ide> StyleSheet, <ide> RefreshControl, <ide> Text, <ide> TouchableWithoutFeedback, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const styles = StyleSheet.create({ <ide> row: { <ide><path>RNTester/js/RootViewSizeFlexibilityExampleApp.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; <add>const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); <ide> <ide> class RootViewSizeFlexibilityExampleApp extends React.Component< <ide> {toggled: boolean}, <ide><path>RNTester/js/SafeAreaViewExample.js <ide> */ <ide> 'use strict'; <ide> <del>const Button = require('Button'); <del>const DeviceInfo = require('DeviceInfo'); <del>const Modal = require('Modal'); <ide> const React = require('react'); <del>const SafeAreaView = require('SafeAreaView'); <del>const StyleSheet = require('StyleSheet'); <del>const Switch = require('Switch'); <del>const Text = require('Text'); <del>const View = require('View'); <add>const { <add> Button, <add> DeviceInfo, <add> Modal, <add> SafeAreaView, <add> StyleSheet, <add> Switch, <add> Text, <add> View, <add>} = require('react-native'); <ide> <ide> class SafeAreaViewExample extends React.Component< <ide> {}, <ide><path>RNTester/js/ScrollViewExample.js <ide> */ <ide> 'use strict'; <ide> <del>const Platform = require('Platform'); <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <add> Platform, <ide> ScrollView, <ide> StyleSheet, <ide> Text, <ide> TouchableOpacity, <ide> View, <del> Image, <del>} = ReactNative; <add>} = require('react-native'); <ide> <del>import type {ViewStyleProp} from 'StyleSheet'; <add>import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet'; <ide> <ide> exports.displayName = 'ScrollViewExample'; <ide> exports.title = '<ScrollView>'; <ide><path>RNTester/js/ScrollViewSimpleExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {ScrollView, StyleSheet, Text, TouchableOpacity} = ReactNative; <add>const { <add> ScrollView, <add> StyleSheet, <add> Text, <add> TouchableOpacity, <add>} = require('react-native'); <ide> <ide> const NUM_ITEMS = 20; <ide> <ide><path>RNTester/js/SectionListExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Alert, Animated, Button, StyleSheet, Text, View} = ReactNative; <add>const { <add> Alert, <add> Animated, <add> Button, <add> StyleSheet, <add> Text, <add> View, <add>} = require('react-native'); <ide> <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>const infoLog = require('infoLog'); <add>const infoLog = require('../../Libraries/Utilities/infoLog'); <ide> <ide> const { <ide> HeaderComponent, <ide><path>RNTester/js/SegmentedControlIOSExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {SegmentedControlIOS, Text, View, StyleSheet} = ReactNative; <add>const {SegmentedControlIOS, Text, View, StyleSheet} = require('react-native'); <ide> <ide> class BasicSegmentedControlExample extends React.Component<{}> { <ide> render() { <ide><path>RNTester/js/SetPropertiesExampleApp.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Text, View} = ReactNative; <add>const {Text, View} = require('react-native'); <ide> <ide> class SetPropertiesExampleApp extends React.Component<$FlowFixMeProps> { <ide> render() { <ide><path>RNTester/js/ShareExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, View, Text, TouchableHighlight, Share} = ReactNative; <add>const { <add> StyleSheet, <add> View, <add> Text, <add> TouchableHighlight, <add> Share, <add>} = require('react-native'); <ide> <ide> type Props = $ReadOnly<{||}>; <ide> type State = {|result: string|}; <ide><path>RNTester/js/Shared/RNTesterTypes.js <ide> <ide> 'use strict'; <ide> <del>import type {ComponentType} from 'React'; <add>import type {ComponentType} from 'react'; <ide> import * as React from 'react'; <ide> <ide> export type RNTesterProps = $ReadOnly<{| <ide><path>RNTester/js/Shared/TextLegend.js <ide> <ide> 'use strict'; <ide> <del>const React = require('React'); <add>const React = require('react'); <ide> const {Picker, Text, View} = require('react-native'); <ide> <ide> class TextLegend extends React.Component<*, *> { <ide><path>RNTester/js/SliderExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Slider, Text, StyleSheet, View} = ReactNative; <add>const {Slider, Text, StyleSheet, View} = require('react-native'); <ide> <ide> class SliderExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> { <ide> static defaultProps = { <ide><path>RNTester/js/SnapshotExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Alert, Image, NativeModules, StyleSheet, Text, View} = ReactNative; <add>const { <add> Alert, <add> Image, <add> NativeModules, <add> StyleSheet, <add> Text, <add> View, <add>} = require('react-native'); <ide> const ScreenshotManager = NativeModules.ScreenshotManager; <ide> <ide> class ScreenshotExample extends React.Component<{}, $FlowFixMeState> { <ide><path>RNTester/js/SnapshotViewIOS.android.js <ide> <ide> 'use strict'; <ide> <del>module.exports = require('UnimplementedView'); <add>module.exports = require('../../Libraries/Components/UnimplementedViews/UnimplementedView'); <ide><path>RNTester/js/SnapshotViewIOS.ios.js <ide> <ide> 'use strict'; <ide> <del>const React = require('React'); <del>const StyleSheet = require('StyleSheet'); <del>const UIManager = require('UIManager'); <del>const View = require('View'); <add>const React = require('react'); <add>const {NativeModules, StyleSheet, UIManager, View} = require('react-native'); <ide> <del>const {TestModule} = require('NativeModules'); <add>const {TestModule} = NativeModules; <ide> <del>import type {SyntheticEvent} from 'CoreEventTypes'; <del>import type {ViewProps} from 'ViewPropTypes'; <add>import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes'; <add>import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes'; <ide> <ide> // Verify that RCTSnapshot is part of the UIManager since it is only loaded <ide> // if you have linked against RCTTest like in tests, otherwise we will have <ide> // a warning printed out <ide> const RCTSnapshot = UIManager.getViewManagerConfig('RCTSnapshot') <del> ? require('RCTSnapshotNativeComponent') <add> ? require('../RCTTest/RCTSnapshotNativeComponent') <ide> : View; <ide> <ide> type SnapshotReadyEvent = SyntheticEvent< <ide><path>RNTester/js/StatusBarExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> StatusBar, <ide> StyleSheet, <ide> Text, <ide> TouchableHighlight, <ide> View, <ide> Modal, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const colors = ['#ff0000', '#00ff00', '#0000ff', 'rgba(0, 0, 0, 0.4)']; <ide> <ide><path>RNTester/js/TextExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Image, StyleSheet, Text, View} = ReactNative; <add>const {Image, StyleSheet, Text, View} = require('react-native'); <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> const TextLegend = require('./Shared/TextLegend'); <ide><path>RNTester/js/TextExample.ios.js <ide> <ide> 'use strict'; <ide> <del>const Platform = require('Platform'); <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Text, TextInput, View, LayoutAnimation, Button} = ReactNative; <add>const { <add> Button, <add> LayoutAnimation, <add> Platform, <add> Text, <add> TextInput, <add> View, <add>} = require('react-native'); <ide> const TextLegend = require('./Shared/TextLegend'); <ide> <ide> type TextAlignExampleRTLState = {| <ide><path>RNTester/js/TextInputExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Text, TextInput, View, StyleSheet, Slider, Switch} = ReactNative; <add>const { <add> Text, <add> TextInput, <add> View, <add> StyleSheet, <add> Slider, <add> Switch, <add>} = require('react-native'); <ide> <ide> class TextEventsExample extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide><path>RNTester/js/TextInputExample.ios.js <ide> <ide> 'use strict'; <ide> <del>const Button = require('Button'); <del>const InputAccessoryView = require('InputAccessoryView'); <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Text, TextInput, View, StyleSheet, Slider, Switch, Alert} = ReactNative; <add>const { <add> Button, <add> InputAccessoryView, <add> Text, <add> TextInput, <add> View, <add> StyleSheet, <add> Slider, <add> Switch, <add> Alert, <add>} = require('react-native'); <ide> <ide> class WithLabel extends React.Component<$FlowFixMeProps> { <ide> render() { <ide><path>RNTester/js/TimePickerAndroidExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> TimePickerAndroid, <ide> StyleSheet, <ide> Text, <ide> TouchableWithoutFeedback, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide><path>RNTester/js/TimerExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Alert, Platform, ToastAndroid, Text, View} = ReactNative; <add>const {Alert, Platform, ToastAndroid, Text, View} = require('react-native'); <ide> const RNTesterButton = require('./RNTesterButton'); <ide> const performanceNow = require('fbjs/lib/performanceNow'); <ide> <ide><path>RNTester/js/ToastAndroidExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, ToastAndroid, TouchableWithoutFeedback} = ReactNative; <add>const { <add> StyleSheet, <add> Text, <add> ToastAndroid, <add> TouchableWithoutFeedback, <add>} = require('react-native'); <ide> <del>const RNTesterBlock = require('RNTesterBlock'); <del>const RNTesterPage = require('RNTesterPage'); <add>const RNTesterBlock = require('./RNTesterBlock'); <add>const RNTesterPage = require('./RNTesterPage'); <ide> <ide> type Props = $ReadOnly<{||}>; <ide> class ToastExample extends React.Component<Props> { <ide><path>RNTester/js/ToolbarAndroidExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <add>const { <add> StyleSheet, <add> Switch, <add> Text, <add> ToolbarAndroid, <add> View, <add>} = require('react-native'); <add> <add>const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); <ide> <del>const nativeImageSource = require('nativeImageSource'); <del>const {StyleSheet, Text, View} = ReactNative; <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>const Switch = require('Switch'); <del>const ToolbarAndroid = require('ToolbarAndroid'); <del> <ide> class ToolbarAndroidExample extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide> actionText: 'Example app with toolbar component', <ide><path>RNTester/js/ToolbarAndroidExample.ios.js <ide> <ide> 'use strict'; <ide> <add>const {View} = require('react-native'); <add> <ide> // Not applicable to iOS. <del>module.exports = require('View'); <add>module.exports = View; <ide><path>RNTester/js/TouchableExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Animated, <ide> Image, <ide> StyleSheet, <ide> Text, <ide> TouchableHighlight, <ide> TouchableOpacity, <add> NativeModules, <ide> Platform, <ide> TouchableNativeFeedback, <ide> TouchableWithoutFeedback, <ide> View, <del>} = ReactNative; <del> <del>const NativeModules = require('NativeModules'); <add>} = require('react-native'); <ide> <ide> const forceTouchAvailable = <ide> (NativeModules.PlatformConstants && <ide><path>RNTester/js/TransformExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Animated, StyleSheet, Text, View} = ReactNative; <add>const {Animated, StyleSheet, Text, View} = require('react-native'); <ide> <ide> class Flip extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide><path>RNTester/js/TransparentHitTestExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {Text, View, TouchableOpacity, Alert} = ReactNative; <add>const {Text, View, TouchableOpacity, Alert} = require('react-native'); <ide> <ide> class TransparentHitTestExample extends React.Component<{}> { <ide> render() { <ide><path>RNTester/js/VibrationExample.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> StyleSheet, <ide> View, <ide> Text, <ide> TouchableHighlight, <ide> Vibration, <ide> Platform, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> exports.framework = 'React'; <ide> exports.title = 'Vibration'; <ide><path>RNTester/js/ViewExample.js <ide> /* eslint-disable react-native/no-inline-styles */ <ide> <ide> const React = require('react'); <del>const {StyleSheet, Text, View} = require('react-native'); <del>const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); <add>const { <add> StyleSheet, <add> Text, <add> TouchableWithoutFeedback, <add> View, <add>} = require('react-native'); <ide> <ide> exports.title = '<View>'; <ide> exports.description = <ide><path>RNTester/js/ViewPagerAndroidExample.android.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Image, <ide> StyleSheet, <ide> const { <ide> TouchableOpacity, <ide> View, <ide> ViewPagerAndroid, <del>} = ReactNative; <add>} = require('react-native'); <ide> <del>import type {ViewPagerScrollState} from 'ViewPagerAndroid'; <add>import type {ViewPagerScrollState} from '../../Libraries/Components/ViewPager/ViewPagerAndroid'; <ide> <ide> const PAGES = 5; <ide> const BGCOLOR = ['#fdc08e', '#fff6b9', '#99d1b7', '#dde5fe', '#f79273']; <ide><path>RNTester/js/WebSocketExample.js <ide> /* eslint-env browser */ <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Image, <ide> PixelRatio, <ide> const { <ide> TextInput, <ide> TouchableOpacity, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const DEFAULT_WS_URL = 'ws://localhost:5555/'; <ide> const DEFAULT_HTTP_URL = 'http://localhost:5556/'; <ide><path>RNTester/js/XHRExampleBinaryUpload.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Alert, <ide> Linking, <ide> const { <ide> Text, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const BINARY_TYPES = { <ide> String, <ide><path>RNTester/js/XHRExampleDownload.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> Alert, <ide> Platform, <ide> const { <ide> Text, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> /** <ide> * Convert number of bytes to MB and round to the nearest 0.1 MB. <ide><path>RNTester/js/XHRExampleFetch.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, TextInput, View, Platform} = ReactNative; <add>const {StyleSheet, Text, TextInput, View, Platform} = require('react-native'); <ide> <ide> class XHRExampleFetch extends React.Component<any, any> { <ide> responseURL: ?string; <ide><path>RNTester/js/XHRExampleFormData.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <ide> const { <ide> CameraRoll, <ide> Image, <ide> const { <ide> TextInput, <ide> TouchableHighlight, <ide> View, <del>} = ReactNative; <add>} = require('react-native'); <ide> <ide> const XHRExampleBinaryUpload = require('./XHRExampleBinaryUpload'); <ide> <ide><path>RNTester/js/XHRExampleHeaders.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; <add>const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); <ide> <ide> class XHRExampleHeaders extends React.Component { <ide> xhr: XMLHttpRequest; <ide><path>RNTester/js/XHRExampleOnTimeOut.js <ide> 'use strict'; <ide> <ide> const React = require('react'); <del>const ReactNative = require('react-native'); <del>const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; <add>const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); <ide> <ide> class XHRExampleOnTimeOut extends React.Component<any, any> { <ide> xhr: XMLHttpRequest; <ide><path>RNTester/js/createExamplePage.js <ide> const React = require('react'); <ide> <ide> const RNTesterExampleContainer = require('./RNTesterExampleContainer'); <del>import type {RNTesterExample} from 'RNTesterTypes'; <add>import type {RNTesterExample} from './Shared/RNTesterTypes'; <ide> <ide> const createExamplePage = function( <ide> title: ?string,
103
Python
Python
fix dropout error in bidirectional layer
0be8040e7988996232da210d04002f170a5d3f98
<ide><path>keras/layers/wrappers.py <ide> from __future__ import absolute_import <ide> <ide> import copy <add>import inspect <ide> from ..engine import Layer <ide> from ..engine import InputSpec <ide> from .. import backend as K <ide> def compute_output_shape(self, input_shape): <ide> elif self.merge_mode is None: <ide> return [self.forward_layer.compute_output_shape(input_shape)] * 2 <ide> <del> def call(self, inputs, mask=None): <del> y = self.forward_layer.call(inputs, mask) <del> y_rev = self.backward_layer.call(inputs, mask) <add> def call(self, inputs, training=None, mask=None): <add> func_args = inspect.getargspec(self.layer.call).args <add> kwargs = {} <add> for arg in ('training', 'mask'): <add> if arg in func_args: <add> kwargs[arg] = eval(arg) <add> <add> y = self.forward_layer.call(inputs, **kwargs) <add> y_rev = self.backward_layer.call(inputs, **kwargs) <ide> if self.return_sequences: <ide> y_rev = K.reverse(y_rev, 1) <ide> if self.merge_mode == 'concat': <del> return K.concatenate([y, y_rev]) <add> output = K.concatenate([y, y_rev]) <ide> elif self.merge_mode == 'sum': <del> return y + y_rev <add> output = y + y_rev <ide> elif self.merge_mode == 'ave': <del> return (y + y_rev) / 2 <add> output = (y + y_rev) / 2 <ide> elif self.merge_mode == 'mul': <del> return y * y_rev <add> output = y * y_rev <ide> elif self.merge_mode is None: <del> return [y, y_rev] <add> output = [y, y_rev] <add> <add> # Properly set learning phase <add> if 0 < self.layer.dropout + self.layer.recurrent_dropout: <add> if self.merge_mode is None: <add> for out in output: <add> out._uses_learning_phase = True <add> else: <add> output._uses_learning_phase = True <add> return output <ide> <ide> def reset_states(self): <ide> self.forward_layer.reset_states() <ide><path>tests/keras/layers/wrappers_test.py <ide> def test_Bidirectional(): <ide> dim = 2 <ide> timesteps = 2 <ide> output_dim = 2 <add> dropout_rate = 0.2 <ide> for mode in ['sum', 'concat']: <ide> x = np.random.random((samples, timesteps, dim)) <ide> target_dim = 2 * output_dim if mode == 'concat' else output_dim <ide> y = np.random.random((samples, target_dim)) <ide> <ide> # test with Sequential model <ide> model = Sequential() <del> model.add(wrappers.Bidirectional(rnn(output_dim), <add> model.add(wrappers.Bidirectional(rnn(output_dim, dropout=dropout_rate, <add> recurrent_dropout=dropout_rate), <ide> merge_mode=mode, input_shape=(timesteps, dim))) <ide> model.compile(loss='mse', optimizer='sgd') <ide> model.fit(x, y, epochs=1, batch_size=1) <ide> def test_Bidirectional(): <ide> <ide> # test with functional API <ide> input = Input((timesteps, dim)) <del> output = wrappers.Bidirectional(rnn(output_dim), merge_mode=mode)(input) <add> output = wrappers.Bidirectional(rnn(output_dim, dropout=dropout_rate, <add> recurrent_dropout=dropout_rate), <add> merge_mode=mode)(input) <ide> model = Model(input, output) <ide> model.compile(loss='mse', optimizer='sgd') <ide> model.fit(x, y, epochs=1, batch_size=1)
2
Go
Go
replace deprecated testutil.errorcontains()
55bebbaecf5e40db9d83b28080ce08dc8642f407
<ide><path>builder/dockerfile/evaluator_test.go <ide> import ( <ide> <ide> "github.com/docker/docker/builder/dockerfile/instructions" <ide> "github.com/docker/docker/builder/remotecontext" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/reexec" <add> "github.com/gotestyourself/gotestyourself/assert" <add> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/skip" <ide> ) <ide> <ide> func executeTestCase(t *testing.T, testCase dispatchTestCase) { <ide> b := newBuilderWithMockBackend() <ide> sb := newDispatchRequest(b, '`', context, NewBuildArgs(make(map[string]*string)), newStagesBuildResults()) <ide> err = dispatch(sb, testCase.cmd) <del> testutil.ErrorContains(t, err, testCase.expectedError) <add> assert.Check(t, is.ErrorContains(err, testCase.expectedError)) <ide> } <ide><path>builder/dockerfile/instructions/parse_test.go <ide> import ( <ide> <ide> "github.com/docker/docker/builder/dockerfile/command" <ide> "github.com/docker/docker/builder/dockerfile/parser" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> func TestCommandsExactlyOneArgument(t *testing.T) { <ide> "STOPSIGNAL", <ide> } <ide> <del> for _, command := range commands { <del> ast, err := parser.Parse(strings.NewReader(command)) <add> for _, cmd := range commands { <add> ast, err := parser.Parse(strings.NewReader(cmd)) <ide> assert.NilError(t, err) <ide> _, err = ParseInstruction(ast.AST.Children[0]) <del> assert.Check(t, is.Error(err, errExactlyOneArgument(command).Error())) <add> assert.Check(t, is.Error(err, errExactlyOneArgument(cmd).Error())) <ide> } <ide> } <ide> <ide> func TestCommandsAtLeastOneArgument(t *testing.T) { <ide> "VOLUME", <ide> } <ide> <del> for _, command := range commands { <del> ast, err := parser.Parse(strings.NewReader(command)) <add> for _, cmd := range commands { <add> ast, err := parser.Parse(strings.NewReader(cmd)) <ide> assert.NilError(t, err) <ide> _, err = ParseInstruction(ast.AST.Children[0]) <del> assert.Check(t, is.Error(err, errAtLeastOneArgument(command).Error())) <add> assert.Check(t, is.Error(err, errAtLeastOneArgument(cmd).Error())) <ide> } <ide> } <ide> <ide> func TestCommandsNoDestinationArgument(t *testing.T) { <ide> "COPY", <ide> } <ide> <del> for _, command := range commands { <del> ast, err := parser.Parse(strings.NewReader(command + " arg1")) <add> for _, cmd := range commands { <add> ast, err := parser.Parse(strings.NewReader(cmd + " arg1")) <ide> assert.NilError(t, err) <ide> _, err = ParseInstruction(ast.AST.Children[0]) <del> assert.Check(t, is.Error(err, errNoDestinationArgument(command).Error())) <add> assert.Check(t, is.Error(err, errNoDestinationArgument(cmd).Error())) <ide> } <ide> } <ide> <ide> func TestCommandsBlankNames(t *testing.T) { <ide> "LABEL", <ide> } <ide> <del> for _, command := range commands { <add> for _, cmd := range commands { <ide> node := &parser.Node{ <del> Original: command + " =arg2", <del> Value: strings.ToLower(command), <add> Original: cmd + " =arg2", <add> Value: strings.ToLower(cmd), <ide> Next: &parser.Node{ <ide> Value: "", <ide> Next: &parser.Node{ <ide> func TestCommandsBlankNames(t *testing.T) { <ide> }, <ide> } <ide> _, err := ParseInstruction(node) <del> assert.Check(t, is.Error(err, errBlankCommandNames(command).Error())) <add> assert.Check(t, is.Error(err, errBlankCommandNames(cmd).Error())) <ide> } <ide> } <ide> <ide> func TestParseOptInterval(t *testing.T) { <ide> Value: "50ns", <ide> } <ide> _, err := parseOptInterval(flInterval) <del> testutil.ErrorContains(t, err, "cannot be less than 1ms") <add> assert.Check(t, is.ErrorContains(err, "cannot be less than 1ms")) <ide> <ide> flInterval.Value = "1ms" <ide> _, err = parseOptInterval(flInterval) <ide> func TestErrorCases(t *testing.T) { <ide> } <ide> n := ast.AST.Children[0] <ide> _, err = ParseInstruction(n) <del> testutil.ErrorContains(t, err, c.expectedError) <add> assert.Check(t, is.ErrorContains(err, c.expectedError)) <ide> } <ide> } <ide><path>builder/dockerfile/internals_windows_test.go <ide> import ( <ide> "fmt" <ide> "testing" <ide> <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> func TestNormalizeDest(t *testing.T) { <ide> } <ide> assert.Check(t, is.Equal(testcase.expected, actual), msg) <ide> } else { <del> testutil.ErrorContains(t, err, testcase.etext) <add> assert.Check(t, is.ErrorContains(err, testcase.etext)) <ide> } <ide> } <ide> } <ide><path>builder/remotecontext/remote_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/builder" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/fs" <ide> func TestGetWithStatusError(t *testing.T) { <ide> assert.NilError(t, err) <ide> assert.Check(t, is.Contains(string(body), testcase.expectedBody)) <ide> } else { <del> testutil.ErrorContains(t, err, testcase.expectedErr) <add> assert.Check(t, is.ErrorContains(err, testcase.expectedErr)) <ide> } <ide> } <ide> } <ide><path>client/client_test.go <ide> import ( <ide> <ide> "github.com/docker/docker/api" <ide> "github.com/docker/docker/api/types" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/env" <ide> func TestParseHostURL(t *testing.T) { <ide> for _, testcase := range testcases { <ide> actual, err := ParseHostURL(testcase.host) <ide> if testcase.expectedErr != "" { <del> testutil.ErrorContains(t, err, testcase.expectedErr) <add> assert.Check(t, is.ErrorContains(err, testcase.expectedErr)) <ide> } <ide> assert.Check(t, is.DeepEqual(testcase.expected, actual)) <ide> } <ide><path>client/container_logs_test.go <ide> package client // import "github.com/docker/docker/client" <ide> <ide> import ( <ide> "bytes" <add> "context" <ide> "fmt" <ide> "io" <ide> "io/ioutil" <ide> import ( <ide> "testing" <ide> "time" <ide> <del> "context" <del> <ide> "github.com/docker/docker/api/types" <del> "github.com/docker/docker/internal/testutil" <add> "github.com/gotestyourself/gotestyourself/assert" <add> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> <ide> func TestContainerLogsNotFoundError(t *testing.T) { <ide> func TestContainerLogsError(t *testing.T) { <ide> _, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{ <ide> Since: "2006-01-02TZ", <ide> }) <del> testutil.ErrorContains(t, err, `parsing time "2006-01-02TZ"`) <add> assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`)) <ide> _, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{ <ide> Until: "2006-01-02TZ", <ide> }) <del> testutil.ErrorContains(t, err, `parsing time "2006-01-02TZ"`) <add> assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`)) <ide> } <ide> <ide> func TestContainerLogs(t *testing.T) { <ide><path>client/swarm_get_unlock_key_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> func TestSwarmGetUnlockKeyError(t *testing.T) { <ide> } <ide> <ide> _, err := client.SwarmGetUnlockKey(context.Background()) <del> testutil.ErrorContains(t, err, "Error response from daemon: Server error") <add> assert.Check(t, is.ErrorContains(err, "Error response from daemon: Server error")) <ide> } <ide> <ide> func TestSwarmGetUnlockKey(t *testing.T) { <ide><path>client/volume_inspect_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/pkg/errors" <ide> func TestVolumeInspectError(t *testing.T) { <ide> } <ide> <ide> _, err := client.VolumeInspect(context.Background(), "nothing") <del> testutil.ErrorContains(t, err, "Error response from daemon: Server error") <add> assert.Check(t, is.ErrorContains(err, "Error response from daemon: Server error")) <ide> } <ide> <ide> func TestVolumeInspectNotFound(t *testing.T) { <ide><path>cmd/dockerd/daemon_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/daemon/config" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/fs" <ide> func TestLoadDaemonCliConfigWithConflicts(t *testing.T) { <ide> assert.Check(t, flags.Set("label", "l2=baz")) <ide> <ide> _, err := loadDaemonCliConfig(opts) <del> testutil.ErrorContains(t, err, "as a flag and in the configuration file: labels") <add> assert.Check(t, is.ErrorContains(err, "as a flag and in the configuration file: labels")) <ide> } <ide> <ide> func TestLoadDaemonCliWithConflictingNodeGenericResources(t *testing.T) { <ide> func TestLoadDaemonCliWithConflictingNodeGenericResources(t *testing.T) { <ide> assert.Check(t, flags.Set("node-generic-resource", "r2=baz")) <ide> <ide> _, err := loadDaemonCliConfig(opts) <del> testutil.ErrorContains(t, err, "as a flag and in the configuration file: node-generic-resources") <add> assert.Check(t, is.ErrorContains(err, "as a flag and in the configuration file: node-generic-resources")) <ide> } <ide> <ide> func TestLoadDaemonCliWithConflictingLabels(t *testing.T) { <ide><path>daemon/config/config_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/daemon/discovery" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/docker/docker/opts" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> func TestFindConfigurationConflicts(t *testing.T) { <ide> <ide> flags.String("authorization-plugins", "", "") <ide> assert.Check(t, flags.Set("authorization-plugins", "asdf")) <del> <del> testutil.ErrorContains(t, <del> findConfigurationConflicts(config, flags), <del> "authorization-plugins: (from flag: asdf, from file: foobar)") <add> assert.Check(t, is.ErrorContains(findConfigurationConflicts(config, flags), "authorization-plugins: (from flag: asdf, from file: foobar)")) <ide> } <ide> <ide> func TestFindConfigurationConflictsWithNamedOptions(t *testing.T) { <ide> func TestFindConfigurationConflictsWithNamedOptions(t *testing.T) { <ide> flags.VarP(opts.NewNamedListOptsRef("hosts", &hosts, opts.ValidateHost), "host", "H", "Daemon socket(s) to connect to") <ide> assert.Check(t, flags.Set("host", "tcp://127.0.0.1:4444")) <ide> assert.Check(t, flags.Set("host", "unix:///var/run/docker.sock")) <del> <del> testutil.ErrorContains(t, findConfigurationConflicts(config, flags), "hosts") <add> assert.Check(t, is.ErrorContains(findConfigurationConflicts(config, flags), "hosts")) <ide> } <ide> <ide> func TestDaemonConfigurationMergeConflicts(t *testing.T) { <ide> func TestReloadSetConfigFileNotExist(t *testing.T) { <ide> flags.Set("config-file", configFile) <ide> <ide> err := Reload(configFile, flags, func(c *Config) {}) <del> assert.Check(t, is.ErrorContains(err, "")) <del> testutil.ErrorContains(t, err, "unable to configure the Docker daemon with file") <add> assert.Check(t, is.ErrorContains(err, "unable to configure the Docker daemon with file")) <ide> } <ide> <ide> // TestReloadDefaultConfigNotExist tests that if the default configuration file <ide> func TestReloadBadDefaultConfig(t *testing.T) { <ide> flags := pflag.NewFlagSet("test", pflag.ContinueOnError) <ide> flags.String("config-file", configFile, "") <ide> err = Reload(configFile, flags, func(c *Config) {}) <del> assert.Check(t, is.ErrorContains(err, "")) <del> testutil.ErrorContains(t, err, "unable to configure the Docker daemon with file") <add> assert.Check(t, is.ErrorContains(err, "unable to configure the Docker daemon with file")) <ide> } <ide> <ide> func TestReloadWithConflictingLabels(t *testing.T) { <ide> func TestReloadWithConflictingLabels(t *testing.T) { <ide> flags.String("config-file", configFile, "") <ide> flags.StringSlice("labels", lbls, "") <ide> err := Reload(configFile, flags, func(c *Config) {}) <del> testutil.ErrorContains(t, err, "conflict labels for foo=baz and foo=bar") <add> assert.Check(t, is.ErrorContains(err, "conflict labels for foo=baz and foo=bar")) <ide> } <ide> <ide> func TestReloadWithDuplicateLabels(t *testing.T) { <ide><path>daemon/delete_test.go <ide> import ( <ide> "github.com/docker/docker/api/types" <ide> containertypes "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/container" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <add> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> <ide> func newDaemonWithTmpRoot(t *testing.T) (*Daemon, func()) { <ide> func newContainerWithState(state *container.State) *container.Container { <ide> State: state, <ide> Config: &containertypes.Config{}, <ide> } <del> <ide> } <ide> <ide> // TestContainerDelete tests that a useful error message and instructions is <ide> func TestContainerDelete(t *testing.T) { <ide> d.containers.Add(c.ID, c) <ide> <ide> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: false}) <del> testutil.ErrorContains(t, err, te.errMsg) <del> testutil.ErrorContains(t, err, te.fixMsg) <add> assert.Check(t, is.ErrorContains(err, te.errMsg)) <add> assert.Check(t, is.ErrorContains(err, te.fixMsg)) <ide> } <ide> } <ide> <ide> func TestContainerDoubleDelete(t *testing.T) { <ide> // Try to remove the container when its state is removalInProgress. <ide> // It should return an error indicating it is under removal progress. <ide> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true}) <del> testutil.ErrorContains(t, err, fmt.Sprintf("removal of container %s is already in progress", c.ID)) <add> assert.Check(t, is.ErrorContains(err, fmt.Sprintf("removal of container %s is already in progress", c.ID))) <ide> } <ide><path>daemon/logger/jsonfilelog/jsonlog/time_marshalling_test.go <ide> import ( <ide> "testing" <ide> "time" <ide> <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> <ide> func TestFastTimeMarshalJSONWithInvalidYear(t *testing.T) { <ide> aTime := time.Date(-1, 1, 1, 0, 0, 0, 0, time.Local) <ide> _, err := fastTimeMarshalJSON(aTime) <del> testutil.ErrorContains(t, err, "year outside of range") <add> assert.Check(t, is.ErrorContains(err, "year outside of range")) <ide> <ide> anotherTime := time.Date(10000, 1, 1, 0, 0, 0, 0, time.Local) <ide> _, err = fastTimeMarshalJSON(anotherTime) <del> testutil.ErrorContains(t, err, "year outside of range") <add> assert.Check(t, is.ErrorContains(err, "year outside of range")) <ide> } <ide> <ide> func TestFastTimeMarshalJSON(t *testing.T) { <ide><path>daemon/trustkey_test.go <ide> import ( <ide> "path/filepath" <ide> "testing" <ide> <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/fs" <ide> func TestLoadOrCreateTrustKeyInvalidKeyFile(t *testing.T) { <ide> assert.NilError(t, err) <ide> <ide> _, err = loadOrCreateTrustKey(tmpKeyFile.Name()) <del> testutil.ErrorContains(t, err, "Error loading key file") <add> assert.Check(t, is.ErrorContains(err, "Error loading key file")) <ide> } <ide> <ide> func TestLoadOrCreateTrustKeyCreateKeyWhenFileDoesNotExist(t *testing.T) { <ide><path>distribution/pull_v2_test.go <ide> import ( <ide> <ide> "github.com/docker/distribution/manifest/schema1" <ide> "github.com/docker/distribution/reference" <del> "github.com/docker/docker/internal/testutil" <add> "github.com/gotestyourself/gotestyourself/assert" <add> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/opencontainers/go-digest" <ide> ) <ide> <ide> func TestFixManifestLayersBadParent(t *testing.T) { <ide> } <ide> <ide> err := fixManifestLayers(&duplicateLayerManifest) <del> testutil.ErrorContains(t, err, "invalid parent ID") <add> assert.Check(t, is.ErrorContains(err, "invalid parent ID")) <ide> } <ide> <ide> // TestValidateManifest verifies the validateManifest function <ide><path>image/fs_test.go <ide> import ( <ide> "path/filepath" <ide> "testing" <ide> <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <del> digest "github.com/opencontainers/go-digest" <add> "github.com/opencontainers/go-digest" <ide> ) <ide> <ide> func defaultFSStoreBackend(t *testing.T) (StoreBackend, func()) { <ide> func TestFSGetInvalidData(t *testing.T) { <ide> assert.Check(t, err) <ide> <ide> _, err = store.Get(id) <del> testutil.ErrorContains(t, err, "failed to verify") <add> assert.Check(t, is.ErrorContains(err, "failed to verify")) <ide> } <ide> <ide> func TestFSInvalidSet(t *testing.T) { <ide> func TestFSInvalidSet(t *testing.T) { <ide> assert.Check(t, err) <ide> <ide> _, err = store.Set([]byte("foobar")) <del> testutil.ErrorContains(t, err, "failed to write digest data") <add> assert.Check(t, is.ErrorContains(err, "failed to write digest data")) <ide> } <ide> <ide> func TestFSInvalidRoot(t *testing.T) { <ide> func TestFSInvalidRoot(t *testing.T) { <ide> f.Close() <ide> <ide> _, err = NewFSStoreBackend(root) <del> testutil.ErrorContains(t, err, "failed to create storage backend") <add> assert.Check(t, is.ErrorContains(err, "failed to create storage backend")) <ide> <ide> os.RemoveAll(root) <ide> } <ide> func TestFSMetadataGetSet(t *testing.T) { <ide> } <ide> <ide> _, err = store.GetMetadata(id2, "tkey2") <del> testutil.ErrorContains(t, err, "failed to read metadata") <add> assert.Check(t, is.ErrorContains(err, "failed to read metadata")) <ide> <ide> id3 := digest.FromBytes([]byte("baz")) <ide> err = store.SetMetadata(id3, "tkey", []byte("tval")) <del> testutil.ErrorContains(t, err, "failed to get digest") <add> assert.Check(t, is.ErrorContains(err, "failed to get digest")) <ide> <ide> _, err = store.GetMetadata(id3, "tkey") <del> testutil.ErrorContains(t, err, "failed to get digest") <add> assert.Check(t, is.ErrorContains(err, "failed to get digest")) <ide> } <ide> <ide> func TestFSInvalidWalker(t *testing.T) { <ide> func TestFSGetUnsetKey(t *testing.T) { <ide> <ide> for _, key := range []digest.Digest{"foobar:abc", "sha256:abc", "sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2a"} { <ide> _, err := store.Get(key) <del> testutil.ErrorContains(t, err, "failed to get digest") <add> assert.Check(t, is.ErrorContains(err, "failed to get digest")) <ide> } <ide> } <ide> <ide> func TestFSGetEmptyData(t *testing.T) { <ide> <ide> for _, emptyData := range [][]byte{nil, {}} { <ide> _, err := store.Set(emptyData) <del> testutil.ErrorContains(t, err, "invalid empty data") <add> assert.Check(t, is.ErrorContains(err, "invalid empty data")) <ide> } <ide> } <ide> <ide> func TestFSDelete(t *testing.T) { <ide> assert.Check(t, err) <ide> <ide> _, err = store.Get(id) <del> testutil.ErrorContains(t, err, "failed to get digest") <add> assert.Check(t, is.ErrorContains(err, "failed to get digest")) <ide> <ide> _, err = store.Get(id2) <ide> assert.Check(t, err) <ide> func TestFSDelete(t *testing.T) { <ide> assert.Check(t, err) <ide> <ide> _, err = store.Get(id2) <del> testutil.ErrorContains(t, err, "failed to get digest") <add> assert.Check(t, is.ErrorContains(err, "failed to get digest")) <ide> } <ide> <ide> func TestFSWalker(t *testing.T) { <ide> func TestFSWalkerStopOnError(t *testing.T) { <ide> err = store.Walk(func(id digest.Digest) error { <ide> return errors.New("what") <ide> }) <del> testutil.ErrorContains(t, err, "what") <add> assert.Check(t, is.ErrorContains(err, "what")) <ide> } <ide><path>integration/config/config_test.go <ide> import ( <ide> swarmtypes "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/client" <ide> "github.com/docker/docker/integration/internal/swarm" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/docker/docker/pkg/stdcopy" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> func TestConfigsCreateAndDelete(t *testing.T) { <ide> assert.NilError(t, err) <ide> <ide> insp, _, err = client.ConfigInspectWithRaw(ctx, configID) <del> testutil.ErrorContains(t, err, "No such config") <add> assert.Check(t, is.ErrorContains(err, "No such config")) <ide> } <ide> <ide> func TestConfigsUpdate(t *testing.T) { <ide> func TestConfigsUpdate(t *testing.T) { <ide> // this test will produce an error in func UpdateConfig <ide> insp.Spec.Data = []byte("TESTINGDATA2") <ide> err = client.ConfigUpdate(ctx, configID, insp.Version, insp.Spec) <del> testutil.ErrorContains(t, err, "only updates to Labels are allowed") <add> assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed")) <ide> } <ide> <ide> func TestTemplatedConfig(t *testing.T) { <ide><path>integration/container/copy_test.go <ide> import ( <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/client" <ide> "github.com/docker/docker/integration/internal/container" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/skip" <ide> func TestCopyFromContainerPathDoesNotExist(t *testing.T) { <ide> cid := container.Create(t, ctx, apiclient) <ide> <ide> _, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne") <del> assert.Assert(t, client.IsErrNotFound(err)) <add> assert.Check(t, client.IsErrNotFound(err)) <ide> expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne") <del> testutil.ErrorContains(t, err, expected) <add> assert.Check(t, is.ErrorContains(err, expected)) <ide> } <ide> <ide> func TestCopyFromContainerPathIsNotDir(t *testing.T) { <ide> func TestCopyFromContainerPathIsNotDir(t *testing.T) { <ide> cid := container.Create(t, ctx, apiclient) <ide> <ide> _, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/") <del> assert.Assert(t, is.Contains(err.Error(), "not a directory")) <add> assert.Assert(t, is.ErrorContains(err, "not a directory")) <ide> } <ide> <ide> func TestCopyToContainerPathDoesNotExist(t *testing.T) { <ide> func TestCopyToContainerPathDoesNotExist(t *testing.T) { <ide> cid := container.Create(t, ctx, apiclient) <ide> <ide> err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{}) <del> assert.Assert(t, client.IsErrNotFound(err)) <add> assert.Check(t, client.IsErrNotFound(err)) <ide> expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne") <del> testutil.ErrorContains(t, err, expected) <add> assert.Check(t, is.ErrorContains(err, expected)) <ide> } <ide> <ide> func TestCopyToContainerPathIsNotDir(t *testing.T) { <ide> func TestCopyToContainerPathIsNotDir(t *testing.T) { <ide> cid := container.Create(t, ctx, apiclient) <ide> <ide> err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{}) <del> assert.Assert(t, is.Contains(err.Error(), "not a directory")) <add> assert.Assert(t, is.ErrorContains(err, "not a directory")) <ide> } <ide><path>integration/container/create_test.go <ide> import ( <ide> "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/api/types/network" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <add> "github.com/gotestyourself/gotestyourself/assert" <add> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/skip" <ide> ) <ide> <ide> func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) { <ide> &network.NetworkingConfig{}, <ide> "", <ide> ) <del> testutil.ErrorContains(t, err, tc.expectedError) <add> assert.Check(t, is.ErrorContains(err, tc.expectedError)) <ide> }) <ide> } <ide> } <ide> func TestCreateWithInvalidEnv(t *testing.T) { <ide> &network.NetworkingConfig{}, <ide> "", <ide> ) <del> testutil.ErrorContains(t, err, tc.expectedError) <add> assert.Check(t, is.ErrorContains(err, tc.expectedError)) <ide> }) <ide> } <ide> } <ide> func TestCreateTmpfsMountsTarget(t *testing.T) { <ide> &network.NetworkingConfig{}, <ide> "", <ide> ) <del> testutil.ErrorContains(t, err, tc.expectedError) <add> assert.Check(t, is.ErrorContains(err, tc.expectedError)) <ide> } <ide> } <ide><path>integration/container/pause_test.go <ide> import ( <ide> "github.com/docker/docker/api/types/versions" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/poll" <ide> func TestPauseFailsOnWindowsServerContainers(t *testing.T) { <ide> poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) <ide> <ide> err := client.ContainerPause(ctx, cID) <del> testutil.ErrorContains(t, err, "cannot pause Windows Server Containers") <add> assert.Check(t, is.ErrorContains(err, "cannot pause Windows Server Containers")) <ide> } <ide> <ide> func TestPauseStopPausedContainer(t *testing.T) { <ide><path>integration/container/remove_test.go <ide> import ( <ide> "github.com/docker/docker/api/types/filters" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/fs" <ide> func TestRemoveContainerWithRemovedVolume(t *testing.T) { <ide> assert.NilError(t, err) <ide> <ide> _, _, err = client.ContainerInspectWithRaw(ctx, cID, true) <del> testutil.ErrorContains(t, err, "No such container") <add> assert.Check(t, is.ErrorContains(err, "No such container")) <ide> } <ide> <ide> // Test case for #2099/#2125 <ide> func TestRemoveContainerRunning(t *testing.T) { <ide> cID := container.Run(t, ctx, client) <ide> <ide> err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{}) <del> testutil.ErrorContains(t, err, "cannot remove a running container") <add> assert.Check(t, is.ErrorContains(err, "cannot remove a running container")) <ide> } <ide> <ide> func TestRemoveContainerForceRemoveRunning(t *testing.T) { <ide> func TestRemoveInvalidContainer(t *testing.T) { <ide> client := request.NewAPIClient(t) <ide> <ide> err := client.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{}) <del> testutil.ErrorContains(t, err, "No such container") <add> assert.Check(t, is.ErrorContains(err, "No such container")) <ide> } <ide><path>integration/container/rename_test.go <ide> import ( <ide> "github.com/docker/docker/api/types/versions" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/docker/docker/pkg/stringid" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> func TestRenameRunningContainerAndReuse(t *testing.T) { <ide> assert.Check(t, is.Equal("/"+newName, inspect.Name)) <ide> <ide> _, err = client.ContainerInspect(ctx, oldName) <del> testutil.ErrorContains(t, err, "No such container: "+oldName) <add> assert.Check(t, is.ErrorContains(err, "No such container: "+oldName)) <ide> <ide> cID = container.Run(t, ctx, client, container.WithName(oldName)) <ide> poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) <ide> func TestRenameInvalidName(t *testing.T) { <ide> poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) <ide> <ide> err := client.ContainerRename(ctx, oldName, "new:invalid") <del> testutil.ErrorContains(t, err, "Invalid container name") <add> assert.Check(t, is.ErrorContains(err, "Invalid container name")) <ide> <ide> inspect, err := client.ContainerInspect(ctx, oldName) <ide> assert.NilError(t, err) <ide> func TestRenameContainerWithSameName(t *testing.T) { <ide> <ide> poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) <ide> err := client.ContainerRename(ctx, oldName, oldName) <del> testutil.ErrorContains(t, err, "Renaming a container with the same name") <add> assert.Check(t, is.ErrorContains(err, "Renaming a container with the same name")) <ide> err = client.ContainerRename(ctx, cID, oldName) <del> testutil.ErrorContains(t, err, "Renaming a container with the same name") <add> assert.Check(t, is.ErrorContains(err, "Renaming a container with the same name")) <ide> } <ide> <ide> // Test case for GitHub issue 23973 <ide><path>integration/container/resize_test.go <ide> import ( <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <ide> req "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/poll" <ide> func TestResizeWhenContainerNotStarted(t *testing.T) { <ide> Height: 40, <ide> Width: 40, <ide> }) <del> testutil.ErrorContains(t, err, "is not running") <add> assert.Check(t, is.ErrorContains(err, "is not running")) <ide> } <ide><path>integration/container/update_test.go <ide> import ( <ide> containertypes "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> "github.com/gotestyourself/gotestyourself/poll" <ide> func TestUpdateRestartWithAutoRemove(t *testing.T) { <ide> Name: "always", <ide> }, <ide> }) <del> testutil.ErrorContains(t, err, "Restart policy cannot be updated because AutoRemove is enabled for the container") <add> assert.Check(t, is.ErrorContains(err, "Restart policy cannot be updated because AutoRemove is enabled for the container")) <ide> } <ide><path>integration/image/remove_test.go <ide> import ( <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> ) <ide> func TestRemoveImageOrphaning(t *testing.T) { <ide> <ide> // check if the second image has been deleted <ide> _, _, err = client.ImageInspectWithRaw(ctx, commitResp2.ID) <del> testutil.ErrorContains(t, err, "No such image:") <add> assert.Check(t, is.ErrorContains(err, "No such image:")) <ide> } <ide><path>integration/image/tag_test.go <ide> func TestTagInvalidReference(t *testing.T) { <ide> <ide> for _, repo := range invalidRepos { <ide> err := client.ImageTag(ctx, "busybox", repo) <del> testutil.ErrorContains(t, err, "not a valid repository/tag") <add> assert.Check(t, is.ErrorContains(err, "not a valid repository/tag")) <ide> } <ide> <ide> longTag := testutil.GenerateRandomAlphaOnlyString(121) <ide> func TestTagInvalidReference(t *testing.T) { <ide> <ide> for _, repotag := range invalidTags { <ide> err := client.ImageTag(ctx, "busybox", repotag) <del> testutil.ErrorContains(t, err, "not a valid repository/tag") <add> assert.Check(t, is.ErrorContains(err, "not a valid repository/tag")) <ide> } <ide> <ide> // test repository name begin with '-' <ide> err := client.ImageTag(ctx, "busybox:latest", "-busybox:test") <del> testutil.ErrorContains(t, err, "Error parsing reference") <add> assert.Check(t, is.ErrorContains(err, "Error parsing reference")) <ide> <ide> // test namespace name begin with '-' <ide> err = client.ImageTag(ctx, "busybox:latest", "-test/busybox:test") <del> testutil.ErrorContains(t, err, "Error parsing reference") <add> assert.Check(t, is.ErrorContains(err, "Error parsing reference")) <ide> <ide> // test index name begin with '-' <ide> err = client.ImageTag(ctx, "busybox:latest", "-index:5000/busybox:test") <del> testutil.ErrorContains(t, err, "Error parsing reference") <add> assert.Check(t, is.ErrorContains(err, "Error parsing reference")) <ide> <ide> // test setting tag fails <ide> err = client.ImageTag(ctx, "busybox:latest", "sha256:sometag") <del> testutil.ErrorContains(t, err, "refusing to create an ambiguous tag using digest algorithm as name") <add> assert.Check(t, is.ErrorContains(err, "refusing to create an ambiguous tag using digest algorithm as name")) <ide> } <ide> <ide> // ensure we allow the use of valid tags <ide> func TestTagMatchesDigest(t *testing.T) { <ide> digest := "busybox@sha256:abcdef76720241213f5303bda7704ec4c2ef75613173910a56fb1b6e20251507" <ide> // test setting tag fails <ide> err := client.ImageTag(ctx, "busybox:latest", digest) <del> testutil.ErrorContains(t, err, "refusing to create a tag with a digest reference") <add> assert.Check(t, is.ErrorContains(err, "refusing to create a tag with a digest reference")) <add> <ide> // check that no new image matches the digest <ide> _, _, err = client.ImageInspectWithRaw(ctx, digest) <del> testutil.ErrorContains(t, err, fmt.Sprintf("No such image: %s", digest)) <add> assert.Check(t, is.ErrorContains(err, fmt.Sprintf("No such image: %s", digest))) <ide> } <ide><path>integration/secret/secret_test.go <ide> import ( <ide> swarmtypes "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/client" <ide> "github.com/docker/docker/integration/internal/swarm" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/docker/docker/pkg/stdcopy" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> func TestSecretsCreateAndDelete(t *testing.T) { <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> testutil.ErrorContains(t, err, "already exists") <add> assert.Check(t, is.ErrorContains(err, "already exists")) <ide> <ide> // Ported from original TestSecretsDelete <ide> err = client.SecretRemove(ctx, secretID) <ide> assert.NilError(t, err) <ide> <ide> _, _, err = client.SecretInspectWithRaw(ctx, secretID) <del> testutil.ErrorContains(t, err, "No such secret") <add> assert.Check(t, is.ErrorContains(err, "No such secret")) <ide> <ide> err = client.SecretRemove(ctx, "non-existin") <del> testutil.ErrorContains(t, err, "No such secret: non-existin") <add> assert.Check(t, is.ErrorContains(err, "No such secret: non-existin")) <ide> <ide> // Ported from original TestSecretsCreteaWithLabels <ide> testName = "test_secret_with_labels" <ide> func TestSecretsUpdate(t *testing.T) { <ide> // this test will produce an error in func UpdateSecret <ide> insp.Spec.Data = []byte("TESTINGDATA2") <ide> err = client.SecretUpdate(ctx, secretID, insp.Version, insp.Spec) <del> testutil.ErrorContains(t, err, "only updates to Labels are allowed") <add> assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed")) <ide> } <ide> <ide> func TestTemplatedSecret(t *testing.T) { <ide><path>integration/volume/volume_test.go <ide> import ( <ide> volumetypes "github.com/docker/docker/api/types/volume" <ide> "github.com/docker/docker/integration/internal/container" <ide> "github.com/docker/docker/internal/test/request" <del> "github.com/docker/docker/internal/testutil" <ide> "github.com/google/go-cmp/cmp/cmpopts" <ide> "github.com/gotestyourself/gotestyourself/assert" <ide> is "github.com/gotestyourself/gotestyourself/assert/cmp" <ide> func TestVolumesRemove(t *testing.T) { <ide> vname := c.Mounts[0].Name <ide> <ide> err = client.VolumeRemove(ctx, vname, false) <del> testutil.ErrorContains(t, err, "volume is in use") <add> assert.Check(t, is.ErrorContains(err, "volume is in use")) <ide> <ide> err = client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{ <ide> Force: true, <ide><path>internal/testutil/helpers.go <ide> package testutil // import "github.com/docker/docker/internal/testutil" <ide> <ide> import ( <ide> "io" <del> <del> "github.com/gotestyourself/gotestyourself/assert" <ide> ) <ide> <del>type helperT interface { <del> Helper() <del>} <del> <del>// ErrorContains checks that the error is not nil, and contains the expected <del>// substring. <del>// Deprecated: use assert.Assert(t, cmp.ErrorContains(err, expected)) <del>func ErrorContains(t assert.TestingT, err error, expectedError string, msgAndArgs ...interface{}) { <del> if ht, ok := t.(helperT); ok { <del> ht.Helper() <del> } <del> assert.ErrorContains(t, err, expectedError, msgAndArgs...) <del>} <del> <ide> // DevZero acts like /dev/zero but in an OS-independent fashion. <ide> var DevZero io.Reader = devZero{} <ide>
28
PHP
PHP
add test for max and min validation rules
758b805bb99c1ae275ab803346e50f766816d7dd
<ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function testValidateMin() <ide> $v = new Validator($trans, ['foo' => '3'], ['foo' => 'Min:3']); <ide> $this->assertFalse($v->passes()); <ide> <add> // an equal value qualifies. <add> $v = new Validator($trans, ['foo' => '3'], ['foo' => 'Numeric|Min:3']); <add> $this->assertTrue($v->passes()); <add> <ide> $v = new Validator($trans, ['foo' => 'anc'], ['foo' => 'Min:3']); <ide> $this->assertTrue($v->passes()); <ide> <ide> $v = new Validator($trans, ['foo' => '2'], ['foo' => 'Numeric|Min:3']); <ide> $this->assertFalse($v->passes()); <ide> <add> // '2.001' is considered as a float when the "Numeric" rule exists. <add> $v = new Validator($trans, ['foo' => '2.001'], ['foo' => 'Numeric|Min:3']); <add> $this->assertFalse($v->passes()); <add> <add> // '2.001' is a string of length 5 in absence of the "Numeric" rule. <add> $v = new Validator($trans, ['foo' => '2.001'], ['foo' => 'Min:3']); <add> $this->assertTrue($v->passes()); <add> <add> // '20' is a string of length 2 in absence of the "Numeric" rule. <add> $v = new Validator($trans, ['foo' => '20'], ['foo' => 'Min:3']); <add> $this->assertFalse($v->passes()); <add> <ide> $v = new Validator($trans, ['foo' => '5'], ['foo' => 'Numeric|Min:3']); <ide> $this->assertTrue($v->passes()); <ide> <ide> public function testValidateMax() <ide> $v = new Validator($trans, ['foo' => '211'], ['foo' => 'Numeric|Max:100']); <ide> $this->assertFalse($v->passes()); <ide> <add> // an equal value qualifies. <add> $v = new Validator($trans, ['foo' => '3'], ['foo' => 'Numeric|Max:3']); <add> $this->assertTrue($v->passes()); <add> <add> // '2.001' is considered as a float when the "Numeric" rule exists. <add> $v = new Validator($trans, ['foo' => '2.001'], ['foo' => 'Numeric|Max:3']); <add> $this->assertTrue($v->passes()); <add> <add> // '2.001' is a string of length 5 in absence of the "Numeric" rule. <add> $v = new Validator($trans, ['foo' => '2.001'], ['foo' => 'Max:3']); <add> $this->assertFalse($v->passes()); <add> <ide> $v = new Validator($trans, ['foo' => '22'], ['foo' => 'Numeric|Max:33']); <ide> $this->assertTrue($v->passes()); <ide>
1
Text
Text
add dev report for may 8th
1397a4981103c290e095eb9ef8ac822c80d8a758
<ide><path>reports/2017-05-01.md <ide> We are almost done, it should be merged soon. <ide> <ide> Slack works great for synchronous communication, but we need to place for async discussion. A mailing list is currently being setup. <ide> <del>#### Find a good and non-confusing home for the remaining monolith <add>### Find a good and non-confusing home for the remaining monolith <ide> <ide> Lots of discussion and progress made on this topic, see [here](https://github.com/moby/moby/issues/32871). The work will start this week. <ide> <ide><path>reports/2017-05-08.md <add># Development Report for May 08, 2017 <add> <add>## Daily Meeting <add> <add>A daily meeting is hosted on [slack](https://dockercommunity.slack.com) every business day at 9am PST on the channel `#moby-project`. <add>During this meeting, we are talking about the [tasks](https://github.com/moby/moby/issues/32867) needed to be done for splitting moby and docker. <add> <add>## Topics discussed last week <add> <add>### The CLI split <add> <add>The Docker CLI was succesfully moved to [https://github.com/docker/cli](https://github.com/docker/cli) last week thanks to @tiborvass <add>The Docker CLI is now compiled from the [Dockerfile](https://github.com/moby/moby/blob/a762ceace4e8c1c7ce4fb582789af9d8074be3e1/Dockerfile#L248) <add> <add>### Mailing list <add> <add>Discourse is available at [forums.mobyproject.org](https://forums.mobyproject.org/) thanks to @thaJeztah. mailing-list mode is enabled, so once you register there, you will received every new threads / messages via email. So far, 3 categories were created: Architecture, Meta & Support. The last step missing is to setup an email address to be able to start a new thread via email. <add> <add>### Find a place for `/pkg` <add> <add>Lots of discussion and progress made on this [topic](https://github.com/moby/moby/issues/32989) thanks to @dnephin. [Here is the list](https://gist.github.com/dnephin/35dc10f6b6b7017f058a71908b301d38) proposed to split/reorganize the pkgs. <add> <add>### Find a good and non-confusing home for the remaining monolith <add> <add>@cpuguy83 is leading the effort [here](https://github.com/moby/moby/pull/33022). It's still WIP but the way we are experimenting with is to reorganise directories within the moby/moby. <add> <add>## Componentization <add> <add>So far only work on the builder, by @tonistiigi, happened regarding the componentization effort. <add> <add>### builder <add> <add>The builder dev report can be found [here](builder/2017-05-07.md) <add> <add><path>reports/builder/2017-05-08.md <del><path>reports/builder/2017-05-07.md <del># Development Report for May 07, 2017 <add># Development Report for May 08, 2017 <ide> <ide> <ide> ### Quality: Dependency interface switch
3
Text
Text
add note about v3 dev code in readme
e63beb8c6da12fe1ae0666bb0a1dea7d9c77629a
<ide><path>README.md <ide> <ide> ## Documentation <ide> <add>Currently, there are two versions of the library (2.9.4 and 3.x.x). Version 2 is the latest stable version while 3 is the next (currently beta) version. As such bear the following in mind: <add> <add>* Current docs points to version 2.9.4 <add>* Npm/CDN/etc point to version 2.9.4 (unless you explicitly set newer version, e.g. npm next) <add>* Source currently points to 3.x.x version. 2.9.4 source is available [here](https://github.com/chartjs/Chart.js/tree/2.9) <add>* Docs for version 3.x.x are available [here](https://www.chartjs.org/docs/master/) <add> <ide> - [Introduction](https://www.chartjs.org/docs/latest/) <ide> - [Getting Started](https://www.chartjs.org/docs/latest/getting-started/) <ide> - [General](https://www.chartjs.org/docs/latest/general/)
1
Java
Java
fix regression introduced in 4.3 snapshot
08eb623c41d0ba8276d4131330271ea0f49c7879
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java <ide> public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition oth <ide> * Check if any of the HTTP request methods match the given request and <ide> * return an instance that contains the matching HTTP request method only. <ide> * @param request the current request <del> * @return the same instance if the condition is empty, a new condition with <del> * the matched request method, or {@code null} if no request methods match <add> * @return the same instance if the condition is empty (unless the request <add> * method is HTTP OPTIONS), a new condition with the matched request method, <add> * or {@code null} if there is no match or the condition is empty and the <add> * request method is OPTIONS. <ide> */ <ide> @Override <ide> public RequestMethodsRequestCondition getMatchingCondition(HttpServletRequest request) { <ide> RequestMethod requestMethod = getRequestMethod(request); <del> if (requestMethod == null) { <del> return null; <del> } <ide> if (this.methods.isEmpty()) { <ide> return (RequestMethod.OPTIONS.equals(requestMethod) ? null : this); <ide> } <del> for (RequestMethod method : this.methods) { <del> if (method.equals(requestMethod)) { <del> return new RequestMethodsRequestCondition(method); <add> if (requestMethod != null) { <add> for (RequestMethod method : this.methods) { <add> if (method.equals(requestMethod)) { <add> return new RequestMethodsRequestCondition(method); <add> } <add> } <add> if (RequestMethod.HEAD.equals(requestMethod) && getMethods().contains(RequestMethod.GET)) { <add> return HEAD_CONDITION; <ide> } <del> } <del> if (RequestMethod.HEAD.equals(requestMethod) && getMethods().contains(RequestMethod.GET)) { <del> return HEAD_CONDITION; <ide> } <ide> return null; <ide> } <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestConditionTests.java <ide> public void methodHeadNoMatch() throws Exception { <ide> } <ide> <ide> @Test <del> public void noDeclaredMethodsMatchesAllMethodsExceptOptions() { <add> public void emptyMatchesAnythingExceptHttpOptions() { <ide> RequestCondition condition = new RequestMethodsRequestCondition(); <ide> <ide> assertNotNull(condition.getMatchingCondition(new MockHttpServletRequest("GET", ""))); <ide> assertNotNull(condition.getMatchingCondition(new MockHttpServletRequest("POST", ""))); <ide> assertNotNull(condition.getMatchingCondition(new MockHttpServletRequest("HEAD", ""))); <add> assertNotNull(condition.getMatchingCondition(new MockHttpServletRequest("CUSTOM", ""))); <ide> assertNull(condition.getMatchingCondition(new MockHttpServletRequest("OPTIONS", ""))); <ide> } <ide>
2
Javascript
Javascript
use all timestamps for calculating offsets
13e7a1163b2aa058906228da853b5cd1f07aff8c
<ide><path>src/scales/scale.timeseries.js <ide> class TimeSeriesScale extends TimeScale { <ide> this._table = []; <ide> } <ide> <del> initOffsets(timestamps) { <add> /** <add> * @protected <add> */ <add> initOffsets() { <ide> const me = this; <del> me._table = me.buildLookupTable(); <add> const timestamps = me._getTimestampsForTable(); <add> me._table = me.buildLookupTable(timestamps); <ide> super.initOffsets(timestamps); <ide> } <ide> <ide> class TimeSeriesScale extends TimeScale { <ide> * extremity (left + width or top + height). Note that it would be more optimized to directly <ide> * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need <ide> * to create the lookup table. The table ALWAYS contains at least two items: min and max. <del> * <add> * @param {number[]} timestamps <ide> * @return {object[]} <ide> * @protected <ide> */ <del> buildLookupTable() { <add> buildLookupTable(timestamps) { <ide> const me = this; <ide> const {min, max} = me; <del> const timestamps = me._getTimestampsForTable(); <ide> if (!timestamps.length) { <ide> return [ <ide> {time: min, pos: 0}, <ide> class TimeSeriesScale extends TimeScale { <ide> <ide> /** <ide> * Returns all timestamps <add> * @return {number[]} <ide> * @private <ide> */ <ide> _getTimestampsForTable() { <ide> class TimeSeriesScale extends TimeScale { <ide> } <ide> <ide> /** <add> * @return {number[]} <ide> * @protected <ide> */ <ide> getDataTimestamps() { <ide> class TimeSeriesScale extends TimeScale { <ide> } <ide> <ide> /** <add> * @return {number[]} <ide> * @protected <ide> */ <ide> getLabelTimestamps() { <ide><path>test/specs/scale.time.tests.js <ide> describe('Time scale tests', function() { <ide> }); <ide> }); <ide> <add> it ('should handle offset when there are more data points than ticks', function() { <add> const chart = window.acquireChart({ <add> type: 'bar', <add> data: { <add> datasets: [{ <add> data: [{x: 631180800000, y: '31.84'}, {x: 631267200000, y: '30.89'}, {x: 631353600000, y: '33.00'}, {x: 631440000000, y: '33.52'}, {x: 631526400000, y: '32.24'}, {x: 631785600000, y: '32.74'}, {x: 631872000000, y: '31.45'}, {x: 631958400000, y: '32.60'}, {x: 632044800000, y: '31.77'}, {x: 632131200000, y: '32.45'}, {x: 632390400000, y: '31.13'}, {x: 632476800000, y: '31.82'}, {x: 632563200000, y: '30.81'}, {x: 632649600000, y: '30.07'}, {x: 632736000000, y: '29.31'}, {x: 632995200000, y: '29.82'}, {x: 633081600000, y: '30.20'}, {x: 633168000000, y: '30.78'}, {x: 633254400000, y: '30.72'}, {x: 633340800000, y: '31.62'}, {x: 633600000000, y: '30.64'}, {x: 633686400000, y: '32.36'}, {x: 633772800000, y: '34.66'}, {x: 633859200000, y: '33.96'}, {x: 633945600000, y: '34.20'}, {x: 634204800000, y: '32.20'}, {x: 634291200000, y: '32.44'}, {x: 634377600000, y: '32.72'}, {x: 634464000000, y: '32.95'}, {x: 634550400000, y: '32.95'}, {x: 634809600000, y: '30.88'}, {x: 634896000000, y: '29.44'}, {x: 634982400000, y: '29.36'}, {x: 635068800000, y: '28.84'}, {x: 635155200000, y: '30.85'}, {x: 635414400000, y: '32.00'}, {x: 635500800000, y: '32.74'}, {x: 635587200000, y: '33.16'}, {x: 635673600000, y: '34.73'}, {x: 635760000000, y: '32.89'}, {x: 636019200000, y: '32.41'}, {x: 636105600000, y: '31.15'}, {x: 636192000000, y: '30.63'}, {x: 636278400000, y: '29.60'}, {x: 636364800000, y: '29.31'}, {x: 636624000000, y: '29.83'}, {x: 636710400000, y: '27.97'}, {x: 636796800000, y: '26.18'}, {x: 636883200000, y: '26.06'}, {x: 636969600000, y: '26.34'}, {x: 637228800000, y: '27.75'}, {x: 637315200000, y: '29.05'}, {x: 637401600000, y: '28.82'}, {x: 637488000000, y: '29.43'}, {x: 637574400000, y: '29.53'}, {x: 637833600000, y: '28.50'}, {x: 637920000000, y: '28.87'}, {x: 638006400000, y: '28.11'}, {x: 638092800000, y: '27.79'}, {x: 638179200000, y: '28.18'}, {x: 638438400000, y: '28.27'}, {x: 638524800000, y: '28.29'}, {x: 638611200000, y: '29.63'}, {x: 638697600000, y: '29.13'}, {x: 638784000000, y: '26.57'}, {x: 639039600000, y: '27.19'}, {x: 639126000000, y: '27.48'}, {x: 639212400000, y: '27.79'}, {x: 639298800000, y: '28.48'}, {x: 639385200000, y: '27.88'}, {x: 639644400000, y: '25.63'}, {x: 639730800000, y: '25.02'}, {x: 639817200000, y: '25.26'}, {x: 639903600000, y: '25.00'}, {x: 639990000000, y: '26.23'}, {x: 640249200000, y: '26.22'}, {x: 640335600000, y: '26.36'}, {x: 640422000000, y: '25.45'}, {x: 640508400000, y: '24.62'}, {x: 640594800000, y: '26.65'}, {x: 640854000000, y: '26.28'}, {x: 640940400000, y: '27.25'}, {x: 641026800000, y: '25.93'}], <add> backgroundColor: '#ff6666' <add> }] <add> }, <add> options: { <add> scales: { <add> x: { <add> type: 'timeseries', <add> offset: true, <add> ticks: { <add> source: 'data', <add> autoSkip: true, <add> maxRotation: 0 <add> } <add> }, <add> y: { <add> type: 'linear', <add> gridLines: { <add> drawBorder: false <add> } <add> } <add> } <add> }, <add> legend: false <add> }); <add> const scale = chart.scales.x; <add> expect(scale.getPixelForDecimal(0)).toBeCloseToPixel(29); <add> expect(scale.getPixelForDecimal(1.0)).toBeCloseToPixel(494); <add> }); <add> <ide> ['data', 'labels'].forEach(function(source) { <ide> ['timeseries', 'time'].forEach(function(type) { <ide> describe('when ticks.source is "' + source + '" and scale type is "' + type + '"', function() {
2
PHP
PHP
apply fixes from styleci
d3e486cc588ae4b30b3f3bfb49a5a455530849d6
<ide><path>tests/Mail/MailManagerTest.php <ide> <ide> namespace Illuminate\Tests\Mail; <ide> <del>use Illuminate\Mail\MailManager; <ide> use Orchestra\Testbench\TestCase; <ide> <ide> class MailManagerTest extends TestCase
1
Javascript
Javascript
use buffergeometry for frustum helper
4f7d05ff2b12ec9f9f568f4d4fd32df239a817b8
<ide><path>examples/jsm/csm/CSM.js <ide> export default class CSM { <ide> helper( cameraMatrix ) { <ide> <ide> let frustum; <del> let geometry; <add> let geometry, vertices; <ide> const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); <ide> const object = new THREE.Object3D(); <ide> <ide> for ( let i = 0; i < this.frustums.length; i ++ ) { <ide> <ide> frustum = this.frustums[ i ].toSpace( cameraMatrix ); <ide> <del> geometry = new THREE.Geometry(); <add> geometry = new THREE.BufferGeometry(); <add> vertices = []; <add> <ide> <ide> for ( let i = 0; i < 5; i ++ ) { <ide> <ide> const point = frustum.vertices.near[ i === 4 ? 0 : i ]; <del> geometry.vertices.push( new THREE.Vector3( point.x, point.y, point.z ) ); <add> vertices.push( point.x, point.y, point.z ); <ide> <ide> } <add> <add> geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); <ide> <ide> object.add( new THREE.Line( geometry, material ) ); <ide> <del> geometry = new THREE.Geometry(); <add> geometry = new THREE.BufferGeometry(); <add> vertices = []; <ide> <ide> for ( let i = 0; i < 5; i ++ ) { <ide> <ide> const point = frustum.vertices.far[ i === 4 ? 0 : i ]; <del> geometry.vertices.push( new THREE.Vector3( point.x, point.y, point.z ) ); <add> vertices.push( point.x, point.y, point.z ); <ide> <ide> } <add> <add> geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); <ide> <ide> object.add( new THREE.Line( geometry, material ) ); <ide> <ide> for ( let i = 0; i < 4; i ++ ) { <ide> <del> geometry = new THREE.Geometry(); <add> geometry = new THREE.BufferGeometry(); <add> vertices = []; <ide> <ide> const near = frustum.vertices.near[ i ]; <ide> const far = frustum.vertices.far[ i ]; <ide> <del> geometry.vertices.push( new THREE.Vector3( near.x, near.y, near.z ) ); <del> geometry.vertices.push( new THREE.Vector3( far.x, far.y, far.z ) ); <add> vertices.push( near.x, near.y, near.z ); <add> vertices.push( far.x, far.y, far.z ); <add> <add> geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); <ide> <ide> object.add( new THREE.Line( geometry, material ) ); <ide>
1
Go
Go
remove sysinitpath from process
1e81387edcab600c9b8bc2a502988f7b3a2013e7
<ide><path>container.go <ide> func (container *Container) Start() (err error) { <ide> } <ide> <ide> container.process = &execdriver.Process{ <del> ID: container.ID, <del> Privileged: container.hostConfig.Privileged, <del> Rootfs: root, <del> InitPath: "/.dockerinit", <del> Entrypoint: container.Path, <del> Arguments: container.Args, <del> WorkingDir: workingDir, <del> ConfigPath: container.lxcConfigPath(), <del> Network: en, <del> Tty: container.Config.Tty, <del> User: container.Config.User, <del> SysInitPath: runtime.sysInitPath, <add> ID: container.ID, <add> Privileged: container.hostConfig.Privileged, <add> Rootfs: root, <add> InitPath: "/.dockerinit", <add> Entrypoint: container.Path, <add> Arguments: container.Args, <add> WorkingDir: workingDir, <add> ConfigPath: container.lxcConfigPath(), <add> Network: en, <add> Tty: container.Config.Tty, <add> User: container.Config.User, <ide> } <ide> container.process.SysProcAttr = &syscall.SysProcAttr{Setsid: true} <ide> <ide><path>execdriver/driver.go <ide> type Network struct { <ide> type Process struct { <ide> exec.Cmd <ide> <del> ID string <del> Privileged bool <del> User string <del> Rootfs string // root fs of the container <del> InitPath string // dockerinit <del> Entrypoint string <del> Arguments []string <del> WorkingDir string <del> ConfigPath string <del> Tty bool <del> Network *Network // if network is nil then networking is disabled <del> SysInitPath string <add> ID string <add> Privileged bool <add> User string <add> Rootfs string // root fs of the container <add> InitPath string // dockerinit <add> Entrypoint string <add> Arguments []string <add> WorkingDir string <add> ConfigPath string <add> Tty bool <add> Network *Network // if network is nil then networking is disabled <ide> } <ide> <ide> func (c *Process) Pid() int { <ide><path>execdriver/lxc/driver.go <ide> func linkLxcStart(root string) error { <ide> return os.Symlink(sourcePath, targetPath) <ide> } <ide> <add>// TODO: This can be moved to the mountinfo reader in the mount pkg <ide> func rootIsShared() bool { <ide> if data, err := ioutil.ReadFile("/proc/self/mountinfo"); err == nil { <ide> for _, line := range strings.Split(string(data), "\n") {
3
Python
Python
update zombie message to be more descriptive
ef0b97914a6d917ca596200c19faed2f48dca88a
<ide><path>airflow/jobs/scheduler_job.py <ide> def _find_zombies(self, session: Session) -> None: <ide> self.log.warning("Failing (%s) jobs without heartbeat after %s", len(zombies), limit_dttm) <ide> <ide> for ti, file_loc in zombies: <add> <add> zombie_message_details = self._generate_zombie_message_details(ti) <ide> request = TaskCallbackRequest( <ide> full_filepath=file_loc, <ide> simple_task_instance=SimpleTaskInstance.from_ti(ti), <del> msg=f"Detected {ti} as zombie", <add> msg=str(zombie_message_details), <ide> ) <del> self.log.error("Detected zombie job: %s", request) <add> <add> self.log.error("Detected zombie job: %s", request.msg) <ide> self.executor.send_callback(request) <ide> Stats.incr('zombies_killed') <add> <add> @staticmethod <add> def _generate_zombie_message_details(ti: TaskInstance): <add> zombie_message_details = { <add> "DAG Id": ti.dag_id, <add> "Task Id": ti.task_id, <add> "Run Id": ti.run_id, <add> } <add> <add> if ti.map_index != -1: <add> zombie_message_details["Map Index"] = ti.map_index <add> if ti.hostname: <add> zombie_message_details["Hostname"] = ti.hostname <add> if ti.external_executor_id: <add> zombie_message_details["External Executor Id"] = ti.external_executor_id <add> <add> return zombie_message_details <ide><path>tests/jobs/test_scheduler_job.py <ide> def test_find_zombies(self): <ide> requests = self.scheduler_job.executor.callback_sink.send.call_args[0] <ide> assert 1 == len(requests) <ide> assert requests[0].full_filepath == dag.fileloc <del> assert requests[0].msg == f"Detected {ti} as zombie" <add> assert requests[0].msg == str(self.scheduler_job._generate_zombie_message_details(ti)) <ide> assert requests[0].is_failure_callback is True <ide> assert isinstance(requests[0].simple_task_instance, SimpleTaskInstance) <ide> assert ti.dag_id == requests[0].simple_task_instance.dag_id <ide> def test_find_zombies(self): <ide> session.query(TaskInstance).delete() <ide> session.query(LocalTaskJob).delete() <ide> <add> def test_zombie_message(self): <add> """ <add> Check that the zombie message comes out as expected <add> """ <add> <add> dagbag = DagBag(TEST_DAG_FOLDER, read_dags_from_db=False) <add> with create_session() as session: <add> session.query(LocalTaskJob).delete() <add> dag = dagbag.get_dag('example_branch_operator') <add> dag.sync_to_db() <add> <add> dag_run = dag.create_dagrun( <add> state=DagRunState.RUNNING, <add> execution_date=DEFAULT_DATE, <add> run_type=DagRunType.SCHEDULED, <add> session=session, <add> ) <add> <add> self.scheduler_job = SchedulerJob(subdir=os.devnull) <add> self.scheduler_job.executor = MockExecutor() <add> self.scheduler_job.processor_agent = mock.MagicMock() <add> <add> # We will provision 2 tasks so we can check we only find zombies from this scheduler <add> tasks_to_setup = ['branching', 'run_this_first'] <add> <add> for task_id in tasks_to_setup: <add> task = dag.get_task(task_id=task_id) <add> ti = TaskInstance(task, run_id=dag_run.run_id, state=State.RUNNING) <add> ti.queued_by_job_id = 999 <add> <add> local_job = LocalTaskJob(ti) <add> local_job.state = State.SHUTDOWN <add> <add> session.add(local_job) <add> session.flush() <add> <add> ti.job_id = local_job.id <add> session.add(ti) <add> session.flush() <add> <add> assert task.task_id == 'run_this_first' # Make sure we have the task/ti we expect <add> <add> ti.queued_by_job_id = self.scheduler_job.id <add> session.flush() <add> <add> zombie_message = self.scheduler_job._generate_zombie_message_details(ti) <add> assert zombie_message == { <add> 'DAG Id': 'example_branch_operator', <add> 'Task Id': 'run_this_first', <add> 'Run Id': 'scheduled__2016-01-01T00:00:00+00:00', <add> } <add> <add> ti.hostname = "10.10.10.10" <add> ti.map_index = 2 <add> ti.external_executor_id = "abcdefg" <add> <add> zombie_message = self.scheduler_job._generate_zombie_message_details(ti) <add> assert zombie_message == { <add> 'DAG Id': 'example_branch_operator', <add> 'Task Id': 'run_this_first', <add> 'Run Id': 'scheduled__2016-01-01T00:00:00+00:00', <add> "Hostname": "10.10.10.10", <add> "Map Index": 2, <add> "External Executor Id": "abcdefg", <add> } <add> <ide> def test_find_zombies_handle_failure_callbacks_are_correctly_passed_to_dag_processor(self): <ide> """ <ide> Check that the same set of failure callback with zombies are passed to the dag
2
Javascript
Javascript
use absolute paths from repo root
cf3ae6c32a358729c0eb303d20df0293e9b1c1e2
<ide><path>packager/react-packager/src/ModuleGraph/node-haste/node-haste.flow.js <ide> export type FastFS = { <ide> }; <ide> <ide> type HasteMapOptions = {| <del> allowRelativePaths: boolean, <ide> extensions: Extensions, <ide> files: Array<string>, <ide> helpers: DependencyGraphHelpers, <ide><path>packager/react-packager/src/ModuleGraph/node-haste/node-haste.js <ide> exports.createResolveFn = function(options: ResolveOptions): ResolveFn { <ide> getTransformedFile, <ide> ); <ide> const hasteMap = new HasteMap({ <del> allowRelativePaths: true, <ide> extensions: ['js', 'json'], <ide> files, <ide> helpers, <ide><path>packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js <ide> const PACKAGE_JSON = path.sep + 'package.json'; <ide> <ide> class HasteMap extends EventEmitter { <ide> constructor({ <del> allowRelativePaths, <ide> extensions, <ide> files, <ide> moduleCache, <ide> class HasteMap extends EventEmitter { <ide> platforms, <ide> }) { <ide> super(); <del> this._allowRelativePaths = allowRelativePaths; <ide> this._extensions = extensions; <ide> this._files = files; <ide> this._helpers = helpers; <ide> class HasteMap extends EventEmitter { <ide> } <ide> <ide> _processHastePackage(file, previousName) { <del> if (!this._allowRelativePaths) { <del> file = path.resolve(file); <del> } <ide> const p = this._moduleCache.getPackage(file); <ide> return p.isHaste() <ide> .then(isHaste => isHaste && p.getName()
3
Text
Text
explain worker semantics in async_hooks.md
a319b4a3985cb055f68285817b64ad378e339c6c
<ide><path>doc/api/async_hooks.md <ide> A resource can also be closed before the callback is called. `AsyncHook` does <ide> not explicitly distinguish between these different cases but will represent them <ide> as the abstract concept that is a resource. <ide> <add>If [`Worker`][]s are used, each thread has an independent `async_hooks` <add>interface, and each thread will use a new set of async IDs. <add> <ide> ## Public API <ide> <ide> ### Overview <ide> clearTimeout(setTimeout(() => {}, 10)); <ide> ``` <ide> <ide> Every new resource is assigned an ID that is unique within the scope of the <del>current process. <add>current Node.js instance. <ide> <ide> ###### `type` <ide> <ide> never be called. <ide> [Hook Callbacks]: #async_hooks_hook_callbacks <ide> [PromiseHooks]: https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk <ide> [promise execution tracking]: #async_hooks_promise_execution_tracking <add>[`Worker`]: worker.html#worker_worker
1
Go
Go
restore error type in findnetwork
51cea0a53c2fd36832277402e9faac81bfb4abd4
<ide><path>daemon/cluster/executor/container/controller.go <ide> func (r *controller) Start(ctx context.Context) error { <ide> <ide> for { <ide> if err := r.adapter.start(ctx); err != nil { <del> if _, ok := err.(libnetwork.ErrNoSuchNetwork); ok { <add> if _, ok := errors.Cause(err).(libnetwork.ErrNoSuchNetwork); ok { <ide> // Retry network creation again if we <ide> // failed because some of the networks <ide> // were not found. <ide><path>daemon/daemon_test.go <ide> import ( <ide> "runtime" <ide> "testing" <ide> <add> "github.com/docker/docker/api/errdefs" <ide> containertypes "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/container" <ide> _ "github.com/docker/docker/pkg/discovery/memory" <ide> import ( <ide> "github.com/docker/docker/volume/local" <ide> "github.com/docker/docker/volume/store" <ide> "github.com/docker/go-connections/nat" <add> "github.com/docker/libnetwork" <add> "github.com/pkg/errors" <ide> "github.com/stretchr/testify/assert" <ide> ) <ide> <ide> func TestValidateContainerIsolation(t *testing.T) { <ide> _, err := d.verifyContainerSettings(runtime.GOOS, &containertypes.HostConfig{Isolation: containertypes.Isolation("invalid")}, nil, false) <ide> assert.EqualError(t, err, "invalid isolation 'invalid' on "+runtime.GOOS) <ide> } <add> <add>func TestFindNetworkErrorType(t *testing.T) { <add> d := Daemon{} <add> _, err := d.FindNetwork("fakeNet") <add> _, ok := errors.Cause(err).(libnetwork.ErrNoSuchNetwork) <add> if !errdefs.IsNotFound(err) || !ok { <add> assert.Fail(t, "The FindNetwork method MUST always return an error that implements the NotFound interface and is ErrNoSuchNetwork") <add> } <add>} <ide><path>daemon/errors.go <ide> func volumeNotFound(id string) error { <ide> return objNotFoundError{"volume", id} <ide> } <ide> <del>func networkNotFound(id string) error { <del> return objNotFoundError{"network", id} <del>} <del> <ide> type objNotFoundError struct { <ide> object string <ide> id string <ide> func translateContainerdStartErr(cmd string, setExitCode func(int), err error) e <ide> // TODO: it would be nice to get some better errors from containerd so we can return better errors here <ide> return retErr <ide> } <add> <add>// TODO: cpuguy83 take care of it once the new library is ready <add>type errNotFound struct{ error } <add> <add>func (errNotFound) NotFound() {} <add> <add>func (e errNotFound) Cause() error { <add> return e.error <add>} <add> <add>// notFound is a helper to create an error of the class with the same name from any error type <add>func notFound(err error) error { <add> if err == nil { <add> return nil <add> } <add> return errNotFound{err} <add>} <ide><path>daemon/network.go <ide> func (daemon *Daemon) FindNetwork(idName string) (libnetwork.Network, error) { <ide> // 3. match by ID prefix <ide> list := daemon.GetNetworksByIDPrefix(idName) <ide> if len(list) == 0 { <del> return nil, errors.WithStack(networkNotFound(idName)) <add> // Be very careful to change the error type here, the libnetwork.ErrNoSuchNetwork error is used by the controller <add> // to retry the creation of the network as managed through the swarm manager <add> return nil, errors.WithStack(notFound(libnetwork.ErrNoSuchNetwork(idName))) <ide> } <ide> if len(list) > 1 { <ide> return nil, errors.WithStack(invalidIdentifier(idName)) <ide><path>integration-cli/docker_cli_netmode_test.go <ide> func (s *DockerSuite) TestNetHostname(c *check.C) { <ide> c.Assert(out, checker.Contains, "Invalid network mode: invalid container format container:<name|id>") <ide> <ide> out, _ = dockerCmdWithFail(c, "run", "--net=weird", "busybox", "ps") <del> c.Assert(strings.ToLower(out), checker.Contains, "no such network") <add> c.Assert(strings.ToLower(out), checker.Contains, "not found") <ide> } <ide> <ide> func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
5
PHP
PHP
fix url option key
c1e7d43bb1521ebfa32edb58c71e247b6e15e776
<ide><path>src/Controller/Component/AuthComponent.php <ide> public function redirectUrl($url = null) { <ide> $redir = '/'; <ide> } <ide> if (is_array($redir)) { <del> return Router::url($redir + array('base' => false)); <add> return Router::url($redir + array('_base' => false)); <ide> } <ide> return $redir; <ide> } <ide><path>tests/TestCase/Controller/Component/AuthComponentTest.php <ide> public function testRedirectSet() { <ide> $result = $this->Auth->redirectUrl($value); <ide> $this->assertEquals('/users/home', $result); <ide> $this->assertEquals($value, $this->Auth->session->read('Auth.redirect')); <add> <add> $request = new Request(); <add> $request->base = '/base'; <add> Router::setRequestInfo($request); <add> <add> $result = $this->Auth->redirectUrl($value); <add> $this->assertEquals('/users/home', $result); <ide> } <ide> <ide> /**
2
Ruby
Ruby
fix typos in test method names
f490a81443c9ae27dfb86964e5b74299dbae34ac
<ide><path>actionpack/test/controller/params_wrapper_test.rb <ide> def teardown <ide> UsersController.last_parameters = nil <ide> end <ide> <del> def test_derivered_name_from_controller <add> def test_derived_name_from_controller <ide> with_default_wrapper_options do <ide> @request.env['CONTENT_TYPE'] = 'application/json' <ide> post :parse, { 'username' => 'sikachu' } <ide> def teardown <ide> Admin::UsersController.last_parameters = nil <ide> end <ide> <del> def test_derivered_name_from_controller <add> def test_derived_name_from_controller <ide> with_default_wrapper_options do <ide> @request.env['CONTENT_TYPE'] = 'application/json' <ide> post :parse, { 'username' => 'sikachu' } <ide> def test_namespace_lookup_from_model <ide> end <ide> end <ide> <del> def test_heirarchy_namespace_lookup_from_model <add> def test_hierarchy_namespace_lookup_from_model <ide> # Make sure that we cleanup ::Admin::User <ide> admin_user_constant = ::Admin::User <ide> ::Admin.send :remove_const, :User
1
Ruby
Ruby
make errors during link step more visible
74a081e08df276154ef6722c25da16b788f978cf
<ide><path>Library/Homebrew/install.rb <ide> def install f <ide> onoe "The linking step did not complete successfully" <ide> puts "The package built, but is not symlinked into #{HOMEBREW_PREFIX}" <ide> puts "You can try again using `brew link #{f.name}'" <del> ohai e, e.backtrace if ARGV.debug? <add> if ARGV.debug? <add> ohai e, e.backtrace <add> else <add> onoe e <add> end <ide> show_summary_heading = true <ide> end <ide> end
1
Javascript
Javascript
copy image
5b4a70bb1d4876ae161e92be5ac37b0858f3bbd3
<ide><path>examples/jsm/utils/RoughnessMipmapper.js <ide> class RoughnessMipmapper { <ide> material.roughnessMap.repeat.copy( roughnessMap.repeat ); <ide> material.roughnessMap.center.copy( roughnessMap.center ); <ide> material.roughnessMap.rotation = roughnessMap.rotation; <add> material.roughnessMap.image = roughnessMap.image; <ide> <ide> material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate; <ide> material.roughnessMap.matrix.copy( roughnessMap.matrix );
1
Text
Text
clarify fs.mkdtemp prefix argument
2ccba1f9fa8e593d09f2f4f284e246e1f8bb6549
<ide><path>doc/api/fs.md <ide> fs.mkdtemp('/tmp/foo-', (err, folder) => { <ide> }); <ide> ``` <ide> <add>*Note*: The `fs.mkdtemp()` method will append the six randomly selected <add>characters directly to the `prefix` string. For instance, given a directory <add>`/tmp`, if the intention is to create a temporary directory *within* `/tmp`, <add>the `prefix` *must* end with a trailing platform-specific path separator <add>(`require('path').sep`). <add> <add>```js <add>// The parent directory for the new temporary directory <add>const tmpDir = '/tmp'; <add> <add>// This method is *INCORRECT*: <add>fs.mkdtemp(tmpDir, (err, folder) => { <add> if (err) throw err; <add> console.log(folder); <add> // Will print something similar to `/tmp-abc123`. <add> // Note that a new temporary directory is created <add> // at the file system root rather than *within* <add> // the /tmp directory. <add>}); <add> <add>// This method is *CORRECT*: <add>const path = require('path'); <add>fs.mkdtemp(tmpDir + path.sep, (err, folder) => { <add> if (err) throw err; <add> console.log(folder); <add> // Will print something similar to `/tmp/abc123`. <add> // A new temporary directory is created within <add> // the /tmp directory. <add>}); <add>``` <add> <ide> ## fs.mkdtempSync(template) <ide> <!-- YAML <ide> added: v5.10.0
1
Python
Python
add type hints to xlm model (pytorch)
65cf33e7e53cd46313f3655f274b3f6ca0fd679d
<ide><path>src/transformers/models/xlm/modeling_xlm.py <ide> import itertools <ide> import math <ide> from dataclasses import dataclass <del>from typing import Optional, Tuple <add>from typing import Dict, Optional, Tuple, Union <ide> <ide> import numpy as np <ide> import torch <ide> class PreTrainedModel <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def prepare_inputs_for_generation(self, input_ids, **kwargs): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, MaskedLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set <ide> def __init__(self, config): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def __init__(self, config): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> start_positions=None, <del> end_positions=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> start_positions: Optional[torch.Tensor] = None, <add> end_positions: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, QuestionAnsweringModelOutput]: <ide> r""" <ide> start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for position (index) of the start of the labelled span for computing the token classification loss. <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=XLMForQuestionAnsweringOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> start_positions=None, <del> end_positions=None, <del> is_impossible=None, <del> cls_index=None, <del> p_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> start_positions: Optional[torch.Tensor] = None, <add> end_positions: Optional[torch.Tensor] = None, <add> is_impossible: Optional[torch.Tensor] = None, <add> cls_index: Optional[torch.Tensor] = None, <add> p_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, XLMForQuestionAnsweringOutput]: <ide> r""" <ide> start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for position (index) of the start of the labelled span for computing the token classification loss. <ide> def __init__(self, config): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, TokenClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`. <ide> def __init__(self, config, *inputs, **kwargs): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> lengths: Optional[torch.Tensor] = None, <add> cache: Optional[Dict[str, torch.Tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, MultipleChoiceModelOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
1
Python
Python
imagenet short tests
44ecc4a756504adee14ffce9564c779018908947
<ide><path>official/resnet/keras/keras_imagenet_benchmark.py <ide> import os <ide> <ide> from absl import flags <del>from absl.testing import flagsaver <del>import tensorflow as tf # pylint: disable=g-bad-import-order <ide> <ide> from official.resnet import imagenet_main <add>from official.resnet.keras import keras_benchmark <ide> from official.resnet.keras import keras_common <ide> from official.resnet.keras import keras_imagenet_main <ide> <del> <add>MIN_TOP_1_ACCURACY = 0.76 <add>MAX_TOP_1_ACCURACY = 0.77 <ide> DATA_DIR = '/data/imagenet/' <ide> <add>FLAGS = flags.FLAGS <ide> <del>class KerasImagenetBenchmarkTests(object): <del> """Benchmarks and accuracy tests for KerasCifar10.""" <ide> <del> local_flags = None <add>class Resnet50KerasAccuracy(keras_benchmark.KerasBenchmark): <add> """Benchmark accuracy tests for ResNet50 in Keras.""" <ide> <ide> def __init__(self, output_dir=None): <del> self.oss_report_object = None <del> self.output_dir = output_dir <add> flag_methods = [keras_common.define_keras_flags, <add> imagenet_main.define_imagenet_flags] <add> <add> super(Resnet50KerasAccuracy, self).__init__(output_dir=output_dir, <add> flag_methods=flag_methods) <ide> <del> def keras_resnet50_8_gpu(self): <add> def benchmark_graph_8_gpu(self): <ide> """Test Keras model with Keras fit/dist_strat and 8 GPUs.""" <ide> self._setup() <del> flags.FLAGS.num_gpus = 8 <del> flags.FLAGS.data_dir = DATA_DIR <del> flags.FLAGS.batch_size = 64*8 <del> flags.FLAGS.train_epochs = 90 <del> flags.FLAGS.model_dir = self._get_model_dir('keras_resnet50_8_gpu') <del> flags.FLAGS.dtype = 'fp32' <del> stats = keras_imagenet_main.run(flags.FLAGS) <del> self._fill_report_object(stats) <del> <del> def keras_resnet50_eager_8_gpu(self): <add> FLAGS.num_gpus = 8 <add> FLAGS.data_dir = DATA_DIR <add> FLAGS.batch_size = 128*8 <add> FLAGS.train_epochs = 90 <add> FLAGS.model_dir = self._get_model_dir('keras_resnet50_8_gpu') <add> FLAGS.dtype = 'fp32' <add> stats = keras_imagenet_main.run(FLAGS) <add> self._fill_report_object(stats, FLAGS.batch_size) <add> <add> def benchmark_8_gpu(self): <ide> """Test Keras model with eager, dist_strat and 8 GPUs.""" <ide> self._setup() <del> flags.FLAGS.num_gpus = 8 <del> flags.FLAGS.data_dir = DATA_DIR <del> flags.FLAGS.batch_size = 64*8 <del> flags.FLAGS.train_epochs = 90 <del> flags.FLAGS.model_dir = self._get_model_dir('keras_resnet50_eager_8_gpu') <del> flags.FLAGS.dtype = 'fp32' <del> flags.FLAGS.enable_eager = True <del> stats = keras_imagenet_main.run(flags.FLAGS) <del> self._fill_report_object(stats) <del> <del> def _fill_report_object(self, stats): <del> if self.oss_report_object: <del> self.oss_report_object.top_1 = stats['accuracy_top_1'] <del> self.oss_report_object.add_other_quality(stats['training_accuracy_top_1'], <del> 'top_1_train_accuracy') <del> else: <del> raise ValueError('oss_report_object has not been set.') <add> FLAGS.num_gpus = 8 <add> FLAGS.data_dir = DATA_DIR <add> FLAGS.batch_size = 128*8 <add> FLAGS.train_epochs = 90 <add> FLAGS.model_dir = self._get_model_dir('keras_resnet50_eager_8_gpu') <add> FLAGS.dtype = 'fp32' <add> FLAGS.enable_eager = True <add> stats = keras_imagenet_main.run(FLAGS) <add> self._fill_report_object(stats, FLAGS.batch_size) <add> <add> def fill_report_object(self, stats, total_batch_size): <add> super(Resnet50KerasAccuracy, self).fill_report_object( <add> stats, <add> top_1_min=MIN_TOP_1_ACCURACY, <add> top_1_max=MAX_TOP_1_ACCURACY, <add> total_batch_size=total_batch_size, <add> log_steps=100) <ide> <ide> def _get_model_dir(self, folder_name): <ide> return os.path.join(self.output_dir, folder_name) <ide> <del> def _setup(self): <del> """Setups up and resets flags before each test.""" <del> tf.logging.set_verbosity(tf.logging.DEBUG) <del> if KerasImagenetBenchmarkTests.local_flags is None: <del> keras_common.define_keras_flags() <del> imagenet_main.define_imagenet_flags() <del> # Loads flags to get defaults to then override. List cannot be empty. <del> flags.FLAGS(['foo']) <del> saved_flag_values = flagsaver.save_flag_values() <del> KerasImagenetBenchmarkTests.local_flags = saved_flag_values <del> return <del> flagsaver.restore_flag_values(KerasImagenetBenchmarkTests.local_flags) <add> <add>class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark): <add> """Resnet50 benchmarks.""" <add> <add> def __init__(self, output_dir=None, default_flags=None): <add> flag_methods = [keras_common.define_keras_flags, <add> imagenet_main.define_imagenet_flags] <add> <add> super(Resnet50KerasBenchmarkBase, self).__init__( <add> output_dir=output_dir, <add> flag_methods=flag_methods, <add> default_flags=default_flags) <add> <add> def _run_benchmark(self): <add> stats = keras_imagenet_main.run(FLAGS) <add> self.fill_report_object(stats) <add> <add> def benchmark_1_gpu_no_dist_strat(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 1 <add> FLAGS.enable_eager = True <add> FLAGS.turn_off_distribution_strategy = True <add> FLAGS.batch_size = 128 <add> <add> self._run_benchmark() <add> <add> def benchmark_graph_1_gpu_no_dist_strat(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 1 <add> FLAGS.enable_eager = False <add> FLAGS.turn_off_distribution_strategy = True <add> FLAGS.batch_size = 128 <add> <add> self._run_benchmark() <add> <add> def benchmark_1_gpu(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 1 <add> FLAGS.enable_eager = True <add> FLAGS.turn_off_distribution_strategy = False <add> FLAGS.batch_size = 128 <add> <add> self._run_benchmark() <add> <add> def benchmark_graph_1_gpu(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 1 <add> FLAGS.enable_eager = False <add> FLAGS.turn_off_distribution_strategy = False <add> FLAGS.batch_size = 128 <add> <add> self._run_benchmark() <add> <add> def benchmark_8_gpu(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 8 <add> FLAGS.enable_eager = True <add> FLAGS.turn_off_distribution_strategy = False <add> FLAGS.batch_size = 128 * 8 # 8 GPUs <add> <add> self._run_benchmark() <add> <add> def benchmark_graph_8_gpu(self): <add> self._setup() <add> <add> FLAGS.num_gpus = 8 <add> FLAGS.enable_eager = False <add> FLAGS.turn_off_distribution_strategy = False <add> FLAGS.batch_size = 128 * 8 # 8 GPUs <add> <add> self._run_benchmark() <add> <add> <add>class Resnet50KerasBenchmarkSynth(Resnet50KerasBenchmarkBase): <add> """Resnet50 synthetic benchmark tests.""" <add> <add> def __init__(self, output_dir=None): <add> def_flags = {} <add> def_flags['skip_eval'] = True <add> def_flags['use_synthetic_data'] = True <add> def_flags['train_steps'] = 110 <add> def_flags['log_steps'] = 10 <add> <add> super(Resnet50KerasBenchmarkSynth, self).__init__(output_dir=output_dir, <add> default_flags=def_flags) <add> <add> <add>class Resnet50KerasBenchmarkReal(Resnet50KerasBenchmarkBase): <add> """Resnet50 real data benchmark tests.""" <add> <add> def __init__(self, output_dir=None): <add> def_flags = {} <add> def_flags['skip_eval'] = True <add> def_flags['data_dir'] = DATA_DIR <add> def_flags['train_steps'] = 110 <add> def_flags['log_steps'] = 10 <add> <add> super(Resnet50KerasBenchmarkReal, self).__init__(output_dir=output_dir, <add> default_flags=def_flags)
1
Go
Go
fix a crash in graphdriver init
a63ff8da46e11c857cd3d743d72d211c96b637e4
<ide><path>graphdriver/driver.go <ide> var ( <ide> } <ide> ) <ide> <add>func init() { <add> drivers = make(map[string]InitFunc) <add>} <add> <ide> func Register(name string, initFunc InitFunc) error { <ide> if _, exists := drivers[name]; exists { <ide> return fmt.Errorf("Name already registered %s", name)
1
Javascript
Javascript
replace deprecated method
e6a6beb38d71a4b165a40ae211636baf6cfb5c27
<ide><path>examples/with-firebase-cloud-messaging/utils/webPush.js <ide> const firebaseCloudMessaging = { <ide> } <ide> <ide> const messaging = firebase.messaging() <del> await messaging.requestPermission() <add> await Notification.requestPermission() <ide> const token = await messaging.getToken() <ide> <ide> localforage.setItem('fcm_token', token)
1
Text
Text
fix internal link
450548027cd19d97ad53ac402f4ea2eb60d5a09b
<ide><path>docs/how-to-translate-files.md <ide> Our `/learn` interface relies on JSON files loaded into an i18n plugin to genera <ide> <ide> The `links.json`, `meta-tags.json`, `motivation.json`, and `trending.json` files contain information that needs to be updated to reflect your language. However, we cannot load these into Crowdin, as the content isn't something that would be a one-to-one translation. <ide> <del>These files will most likely be maintained by your language lead but you are welcome to [read about how to translate them](/language-lead-handbook.md). <add>These files will most likely be maintained by your language lead but you are welcome to [read about how to translate them](language-lead-handbook.md). <ide> <ide> ### On Crowdin <ide>
1
Javascript
Javascript
fix some integration tests
38503d1c5fca979424485ed1ad0c523c617e0a5c
<ide><path>test/integration/annotation_spec.js <ide> describe("Checkbox annotation", () => { <ide> pages.map(async ([browserName, page]) => { <ide> for (const selector of selectors) { <ide> await page.click(selector); <add> await page.waitForFunction( <add> `document.querySelector("${selector} > :first-child").checked` <add> ); <add> <ide> for (const otherSelector of selectors) { <ide> const checked = await page.$eval( <ide> `${otherSelector} > :first-child`, <ide><path>test/integration/scripting_spec.js <ide> describe("Interaction", () => { <ide> await page.type("#\\34 16R", "3.14159", { delay: 200 }); <ide> await page.click("#\\34 19R"); <ide> <add> await page.waitForFunction( <add> `getComputedStyle(document.querySelector("#\\\\34 27R")).visibility !== "hidden"` <add> ); <add> <ide> visibility = await page.$eval( <ide> "#\\34 27R", <ide> el => getComputedStyle(el).visibility <ide> describe("Interaction", () => { <ide> // and leave it <ide> await page.click("#\\34 19R"); <ide> <add> await page.waitForFunction( <add> `getComputedStyle(document.querySelector("#\\\\34 27R")).visibility !== "visible"` <add> ); <add> <ide> visibility = await page.$eval( <ide> "#\\34 27R", <ide> el => getComputedStyle(el).visibility <ide> describe("Interaction", () => { <ide> await Promise.all( <ide> pages.map(async ([browserName, page]) => { <ide> for (const num of [7, 6, 4, 3, 2, 1]) { <add> await clearInput(page, "#\\33 3R"); <ide> await page.click(`option[value=Export${num}]`); <ide> await page.waitForFunction( <ide> `document.querySelector("#\\\\33 3R").value !== ""` <ide> describe("Interaction", () => { <ide> ); <ide> <ide> for (const num of [7, 6, 4, 3, 2, 1]) { <add> await clearInput(page, "#\\33 3R"); <ide> await page.click(`option[value=Export${num}]`); <ide> await page.waitForFunction( <ide> `document.querySelector("#\\\\33 3R").value !== ""` <ide> describe("Interaction", () => { <ide> let len = 6; <ide> for (const num of [1, 3, 5, 6, 431, -1, 0]) { <ide> ++len; <add> await clearInput(page, "#\\33 3R"); <ide> await clearInput(page, "#\\33 9R"); <ide> await page.type("#\\33 9R", `${num},Insert${num},Tresni${num}`, { <ide> delay: 10, <ide> describe("Interaction", () => { <ide> pages.map(async ([browserName, page]) => { <ide> let len = 6; <ide> // Click on Restore button. <add> await clearInput(page, "#\\33 3R"); <ide> await page.click("[data-annotation-id='37R']"); <ide> await page.waitForFunction( <ide> `document.querySelector("#\\\\33 0R").children.length === ${len}`
2
Javascript
Javascript
add `browser` env to all browser facing files
69d354835c70e92a06f272d4a5a07a57c9729507
<ide><path>.eslintrc.js <ide> module.exports = { <ide> { <ide> files: ["lib/**/*.runtime.js", "buildin/*.js", "hot/*.js"], <ide> env: { <del> es6: false <add> es6: false, <add> browser: true <ide> }, <ide> globals: { <ide> Promise: false, <ide> module.exports = { <ide> env: { <ide> mocha: true, <ide> } <del> }, { <del> files: ["buildin/**/*.js"], <del> env: { <del> browser: true <del> } <ide> } <ide> ] <ide> };
1
Python
Python
display pids of workers that we are waiting for
5ca3e45d5ac2b714cdb0c3a03fd2358361ea4d3a
<ide><path>celery/bin/multi.py <ide> def on_down(node): <ide> def note_waiting(): <ide> left = len(P) <ide> if left: <del> self.note(self.colored.blue('> Waiting for {0} {1}...'.format( <del> left, pluralize(left, 'node'))), newline=False) <add> pids = ', '.join(str(pid) for _, _, pid in P) <add> self.note(self.colored.blue('> Waiting for {0} {1} -> {2}...'.format( <add> left, pluralize(left, 'node'), pids)), newline=False) <ide> <ide> if retry: <ide> note_waiting()
1
Ruby
Ruby
use absolute path to java in write_jar_script
7f158df8420d574e4bcb2228f3c9c2b845a739cd
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def env_script_all_files(dst, env) <ide> <ide> # Writes an exec script that invokes a Java jar <ide> def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil) <del> (self/script_name).write_env_script "java", "#{java_opts} -jar \"#{target_jar}\"", <del> Language::Java.overridable_java_home_env(java_version) <add> (self/script_name).write <<~EOS <add> #!/bin/bash <add> export JAVA_HOME="#{Language::Java.overridable_java_home_env(java_version)[:JAVA_HOME]}" <add> exec "${JAVA_HOME}/bin/java" #{java_opts} -jar "#{target_jar}" "$@" <add> EOS <ide> end <ide> <ide> def install_metafiles(from = Pathname.pwd)
1
Go
Go
add virtualsize for inspect output
ec000cbf30426e745e31a406ecc1c7b1854b1220
<ide><path>graph/service.go <ide> func (s *TagStore) CmdLookup(job *engine.Job) engine.Status { <ide> out.Set("Architecture", image.Architecture) <ide> out.Set("Os", image.OS) <ide> out.SetInt64("Size", image.Size) <add> out.SetInt64("VirtualSize", image.GetParentsSize(0)+image.Size) <ide> if _, err = out.WriteTo(job.Stdout); err != nil { <ide> return job.Error(err) <ide> }
1
PHP
PHP
add strict types for network
2eedc702c9e6f16be6d2a9f769f04ff8bc1a1622
<ide><path>src/Network/Exception/SocketException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Network/Socket.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct(array $config = []) <ide> * @return bool Success <ide> * @throws \Cake\Network\Exception\SocketException <ide> */ <del> public function connect() <add> public function connect(): bool <ide> { <ide> if ($this->connection) { <ide> $this->disconnect(); <ide> public function connect() <ide> * @param string $host The host name being connected to. <ide> * @return void <ide> */ <del> protected function _setSslContext($host) <add> protected function _setSslContext(string $host): void <ide> { <ide> foreach ($this->_config as $key => $value) { <ide> if (substr($key, 0, 4) !== 'ssl_') { <ide> protected function _setSslContext($host) <ide> * @param string $message Message. <ide> * @return void <ide> */ <del> protected function _connectionErrorHandler($code, $message) <add> protected function _connectionErrorHandler(int $code, string $message): void <ide> { <ide> $this->_connectionErrors[] = $message; <ide> } <ide> protected function _connectionErrorHandler($code, $message) <ide> * <ide> * @return null|array Null when there is no connection, an array when there is. <ide> */ <del> public function context() <add> public function context(): ?array <ide> { <ide> if (!$this->connection) { <ide> return null; <ide> public function context() <ide> * <ide> * @return string Host name <ide> */ <del> public function host() <add> public function host(): string <ide> { <ide> if (Validation::ip($this->_config['host'])) { <ide> return gethostbyaddr($this->_config['host']); <ide> public function host() <ide> * <ide> * @return string IP address <ide> */ <del> public function address() <add> public function address(): string <ide> { <ide> if (Validation::ip($this->_config['host'])) { <ide> return $this->_config['host']; <ide> public function address() <ide> * <ide> * @return array IP addresses <ide> */ <del> public function addresses() <add> public function addresses(): array <ide> { <ide> if (Validation::ip($this->_config['host'])) { <ide> return [$this->_config['host']]; <ide> public function addresses() <ide> * <ide> * @return string|null Last error <ide> */ <del> public function lastError() <add> public function lastError(): ?string <ide> { <ide> if (!empty($this->lastError)) { <ide> return $this->lastError['num'] . ': ' . $this->lastError['str']; <ide> public function lastError() <ide> * @param string $errStr Error string <ide> * @return void <ide> */ <del> public function setLastError($errNum, $errStr) <add> public function setLastError(?int $errNum, string $errStr): void <ide> { <ide> $this->lastError = ['num' => $errNum, 'str' => $errStr]; <ide> } <ide> public function setLastError($errNum, $errStr) <ide> * @param string $data The data to write to the socket. <ide> * @return int Bytes written. <ide> */ <del> public function write($data) <add> public function write(string $data): int <ide> { <ide> if (!$this->connected && !$this->connect()) { <ide> return 0; <ide> public function write($data) <ide> * @param int $length Optional buffer length to read; defaults to 1024 <ide> * @return string|null Socket data <ide> */ <del> public function read($length = 1024) <add> public function read(int $length = 1024): ?string <ide> { <ide> if (!$this->connected && !$this->connect()) { <ide> return null; <ide> public function read($length = 1024) <ide> * <ide> * @return bool Success <ide> */ <del> public function disconnect() <add> public function disconnect(): bool <ide> { <ide> if (!is_resource($this->connection)) { <ide> $this->connected = false; <ide> public function __destruct() <ide> * @param array|null $state Array with key and values to reset <ide> * @return bool True on success <ide> */ <del> public function reset($state = null) <add> public function reset(?array $state = null): bool <ide> { <ide> if (empty($state)) { <ide> static $initalState = []; <ide> public function reset($state = null) <ide> * @throws \Cake\Network\Exception\SocketException When attempting to enable SSL/TLS fails <ide> * @see stream_socket_enable_crypto <ide> */ <del> public function enableCrypto($type, $clientOrServer = 'client', $enable = true) <add> public function enableCrypto(string $type, string $clientOrServer = 'client', bool $enable = true): bool <ide> { <ide> if (!array_key_exists($type . '_' . $clientOrServer, $this->_encryptMethods)) { <ide> throw new InvalidArgumentException('Invalid encryption scheme chosen'); <ide><path>tests/TestCase/Mailer/Transport/SmtpTransportTest.php <ide> public function testKeepAlive() <ide> <ide> $callback = function ($arg) { <ide> $this->assertNotEquals("QUIT\r\n", $arg); <add> <add> return 1; <ide> }; <ide> $this->socket->expects($this->any())->method('write')->will($this->returnCallback($callback)); <ide> $this->socket->expects($this->never())->method('disconnect'); <ide><path>tests/TestCase/Network/SocketTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function testSocketReading() <ide> */ <ide> public function testTimeOutConnection() <ide> { <del> $config = ['host' => '127.0.0.1', 'timeout' => 0.5]; <add> $config = ['host' => '127.0.0.1', 'timeout' => 1]; <ide> $this->Socket = new Socket($config); <ide> try { <ide> $this->assertTrue($this->Socket->connect()); <ide> <del> $config = ['host' => '127.0.0.1', 'timeout' => 0.00001]; <add> $config = ['host' => '127.0.0.1', 'timeout' => 1]; <ide> $this->Socket = new Socket($config); <del> $this->assertFalse($this->Socket->read(1024 * 1024)); <add> $this->assertNull($this->Socket->read(1024 * 1024)); <ide> $this->assertEquals('2: ' . 'Connection timed out', $this->Socket->lastError()); <ide> } catch (SocketException $e) { <ide> $this->markTestSkipped('Cannot test network, skipping.'); <ide> public function testReset() <ide> public function testEnableCryptoSocketExceptionNoSsl() <ide> { <ide> $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); <del> $configNoSslOrTls = ['host' => 'localhost', 'port' => 80, 'timeout' => 0.1]; <add> $configNoSslOrTls = ['host' => 'localhost', 'port' => 80, 'timeout' => 1]; <ide> <ide> // testing exception on no ssl socket server for ssl and tls methods <ide> $this->Socket = new Socket($configNoSslOrTls); <ide> public function testEnableCryptoSocketExceptionNoSsl() <ide> */ <ide> public function testEnableCryptoSocketExceptionNoTls() <ide> { <del> $configNoSslOrTls = ['host' => 'localhost', 'port' => 80, 'timeout' => 0.1]; <add> $configNoSslOrTls = ['host' => 'localhost', 'port' => 80, 'timeout' => 1]; <ide> <ide> // testing exception on no ssl socket server for ssl and tls methods <ide> $this->Socket = new Socket($configNoSslOrTls);
4
Text
Text
add solutions to css challenges
e73617972095781341af41e5d4e23eb8e0f7df81
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .injected-text { <add> margin-bottom: -25px; <add> text-align: center; <add> } <add> <add> .box { <add> border-style: solid; <add> border-color: black; <add> border-width: 5px; <add> text-align: center; <add> } <add> <add> .yellow-box { <add> background-color: yellow; <add> padding: 10px; <add> } <add> <add> .red-box { <add> background-color: crimson; <add> color: #fff; <add> padding-top: 40px; <add> padding-right: 20px; <add> padding-bottom: 20px; <add> padding-left: 40px; <add> } <add> <add> .blue-box { <add> background-color: blue; <add> color: #fff; <add> padding-top: 40px; <add> padding-right: 20px; <add> padding-bottom: 20px; <add> padding-left: 40px; <add> } <add></style> <add><h5 class="injected-text">margin</h5> <add> <add><div class="box yellow-box"> <add> <h5 class="box red-box">padding</h5> <add> <h5 class="box blue-box">padding</h5> <add></div> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .injected-text { <add> margin-bottom: -25px; <add> text-align: center; <add> } <add> <add> .box { <add> border-style: solid; <add> border-color: black; <add> border-width: 5px; <add> text-align: center; <add> } <add> <add> .yellow-box { <add> background-color: yellow; <add> padding: 10px; <add> } <add> <add> .red-box { <add> background-color: crimson; <add> color: #fff; <add> padding: 20px; <add> } <add> <add> .blue-box { <add> background-color: blue; <add> color: #fff; <add> padding: 20px; <add> } <add></style> <add><h5 class="injected-text">margin</h5> <add> <add><div class="box yellow-box"> <add> <h5 class="box red-box">padding</h5> <add> <h5 class="box blue-box">padding</h5> <add></div> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: red; <add> } <add> p { <add> font-size: 16px; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add> <add> .smaller-image { <add> width: 100px; <add> } <add> <add> .silver-background { <add> background-color: silver; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div class="silver-background"> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> h2 { <add> font-family: Lobster; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: black; <add> font-family: monospace; <add> color: green; <add> } <add> <add></style> <add><h1>Hello World!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 10px; <add> } <add> <add> .smaller-image { <add> width: 100px; <add> border-radius: 50%; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: black; <add> font-family: monospace; <add> color: green; <add> } <add> #orange-text { <add> color: orange; <add> } <add> .pink-text { <add> color: pink !important; <add> } <add> .blue-text { <add> color: blue; <add> } <add></style> <add><h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: black; <add> font-family: monospace; <add> color: green; <add> } <add> .pink-text { <add> color: pink; <add> } <add> .blue-text { <add> color: blue; <add> } <add> #orange-text { <add> color: orange; <add> } <add></style> <add><h1 id="orange-text" class="pink-text blue-text">Hello World!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: black; <add> font-family: monospace; <add> color: green; <add> } <add> #orange-text { <add> color: orange; <add> } <add> .pink-text { <add> color: pink; <add> } <add> .blue-text { <add> color: blue; <add> } <add></style> <add><h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: black; <add> font-family: monospace; <add> color: green; <add> } <add> .pink-text { <add> color: pink; <add> } <add> <add> .blue-text { <add> color: blue; <add> } <add></style> <add><h1 class="pink-text blue-text">Hello World!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-id-of-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add> <add> .smaller-image { <add> width: 100px; <add> } <add> <add> .silver-background { <add> background-color: silver; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div class="silver-background"> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo" id="cat-photo-form"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><!--<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">--> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: red; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/style-the-html-body-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add>body { <add> background-color: black; <add>} <add></style> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .injected-text { <add> margin-bottom: -25px; <add> text-align: center; <add> } <add> <add> .box { <add> border-style: solid; <add> border-color: black; <add> border-width: 5px; <add> text-align: center; <add> } <add> <add> .yellow-box { <add> background-color: yellow; <add> padding: 20px 40px 20px 40px; <add> } <add> <add> .red-box { <add> background-color: red; <add> margin: 20px 40px 20px 40px; <add> padding: 1.5em; <add> } <add> <add> .green-box { <add> background-color: green; <add> margin: 20px 40px 20px 40px; <add> } <add></style> <add><h5 class="injected-text">margin</h5> <add> <add><div class="box yellow-box"> <add> <h5 class="box red-box">padding</h5> <add> <h5 class="box green-box">padding</h5> <add></div> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: red; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p>Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: #F00; <add> } <add> .fuchsia-text { <add> color: #F0F; <add> } <add> .cyan-text { <add> color: #0FF; <add> } <add> .green-text { <add> color: #0F0; <add> } <add></style> <add> <add><h1 class="red-text">I am red!</h1> <add> <add><h1 class="fuchsia-text">I am fuchsia!</h1> <add> <add><h1 class="cyan-text">I am cyan!</h1> <add> <add><h1 class="green-text">I am green!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add> <add> .smaller-image { <add> width: 100px; <add> } <add> <add> .silver-background { <add> background-color: silver; <add> } <add> <add> #cat-photo-form { <add> background-color: green; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div class="silver-background"> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo" id="cat-photo-form"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> .red-text { <add> color: red; <add> } <add> <add> h2 { <add> font-family: Lobster, monospace; <add> } <add> <add> p { <add> font-size: 16px; <add> font-family: monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add> <add> .smaller-image { <add> width: 100px; <add> } <add> <add> .silver-background { <add> background-color: silver; <add> } <add> [type='checkbox'] { <add> margin-top: 10px; <add> margin-bottom: 15px; <add> } <add></style> <add> <add><h2 class="red-text">CatPhotoApp</h2> <add><main> <add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <add> <add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> <add> <div class="silver-background"> <add> <p>Things cats love:</p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> </div> <add> <add> <form action="/submit-cat-photo" id="cat-photo-form"> <add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <add> <label><input type="checkbox" name="personality" checked> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Energetic</label><br> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></main> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: #000000; <add> } <add></style> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> .red-text { <add> color: #FF0000; <add> } <add> .green-text { <add> color: #00FF00; <add> } <add> .dodger-blue-text { <add> color: #1E90FF; <add> } <add> .orange-text { <add> color: #FFA500; <add> } <add></style> <add> <add><h1 class="red-text">I am red!</h1> <add> <add><h1 class="green-text">I am green!</h1> <add> <add><h1 class="dodger-blue-text">I am dodger blue!</h1> <add> <add><h1 class="orange-text">I am orange!</h1> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><style> <add> body { <add> background-color: rgb(0, 0, 0); <add> } <add></style> <ide> ``` <ide> </section>
24