text
stringlengths
1
22.8M
Mary Musani (born 4 September 1944) is a Ugandan hurdler. She competed in the women's 80 metres hurdles at the 1964 Summer Olympics. References 1944 births Living people Athletes (track and field) at the 1964 Summer Olympics Ugandan female hurdlers Olympic athletes for Uganda Place of birth missing (living people)
```smalltalk // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.TemplateEngine.Authoring.CLI.Commands { internal class ValidateCommandArgs { public ValidateCommandArgs(string templateLocation) { TemplateLocation = templateLocation; } public string TemplateLocation { get; } } } ```
Enzo Collotti (15 August 1929 – 7 October 2021) was an Italian historian and academic. He taught contemporary history at the University of Florence, the University of Bologna, and the University of Trieste. He is considered an important historian of the Italian resistance and in the study of Nazism. He was married to his colleague Enrica Pischel. References 1929 births 2021 deaths 20th-century Italian historians Academic staff of the University of Florence Academic staff of the University of Bologna Academic staff of the University of Trieste People from Messina
Cahill Park is a park in San Jose, California, located in the St. Leo's neighborhood of The Alameda district, immediately west of Diridon Station in Downtown San Jose. History Cahill park was deeded to the city in 2003. The park is named after Hiram B. Cahill, who originally owned the land where the park and nearby Diridon Station (formerly Cahill Depot). Hiram's widow, Mary Welch Cahill, eventually sold the land to Southern Pacific Railroad with the request that the station they erect be named in his memory. The Cahill Park is one of the affected stakeholders in Google's planned revitalization of the Diridon area of Downtown San Jose. Location Cahill Park is located in the St. Leo's neighborhood of The Alameda, the district immediately to the west of Diridon Station in Downtown San Jose. See also Diridon Station References External links Cahill Park at City of San José Parks & Recreation Parks in San Jose, California
The Geriatric Depression Scale (GDS) is a 30-item self-report assessment used to identify depression in the elderly. The scale was first developed in 1982 by J.A. Yesavage and others. Description In the Geriatric Depression Scale, questions are answered "yes" or "no". A five-category response set is not utilized in order to ensure that the scale is simple enough to be used when testing ill or moderately cognitively impaired individuals, for whom a more complex set of answers may be confusing, or lead to inaccurate recording of responses. The GDS is commonly used as a routine part of a comprehensive geriatric assessment. One point is assigned to each answer and the cumulative score is rated on a scoring grid. The grid sets a range of 0–9 as "normal", 10–19 as "mildly depressed", and 20–30 as "severely depressed". A diagnosis of clinical depression should not be based on GDS results alone. Although the test has well-established reliability and validity evaluated against other diagnostic criteria, responses should be considered along with results from a comprehensive diagnostic work-up. A short version of the GDS (GDS-SF) containing 15 questions has been developed, and the scale is available in languages other than English. The conducted research found the GDS-SF to be an adequate substitute for the original 30-item scale. The GDS was validated against Hamilton Rating Scale for Depression (HRS-D) and the Zung Self-Rating Depression Scale (SDS). It was found to have a 92% sensitivity and an 89% specificity when evaluated against diagnostic criteria. Scale questions and scoring The scale consists of 30 yes/no questions. Each question is scored as either 0 or 1 points. The following general cutoff may be used to qualify the severity: normal 0–9, mild depressives 10–19, severe depressives 20–30. See also Diagnostic classification and rating scales used in psychiatry References External links Online version of the Geriatric Depression Scale Stanford University web site on the Geriatric Depression Scale including translations Depression screening and assessment tools Geriatric psychiatry
```php <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\CssSelector\Parser\Handler; use Symfony\Component\CssSelector\Parser\Reader; use Symfony\Component\CssSelector\Parser\TokenStream; /** * CSS selector handler interface. * * This component is a port of the Python cssselect library, * which is copyright Ian Bicking, @see path_to_url * * @author Jean-Franois Simon <jeanfrancois.simon@sensiolabs.com> */ interface HandlerInterface { /** * @param Reader $reader * @param TokenStream $stream * * @return bool */ public function handle(Reader $reader, TokenStream $stream); } ```
```java /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * * Subject to the condition set forth below, permission is hereby granted to any * person obtaining a copy of this software, associated documentation and/or * data (collectively the "Software"), free of charge and under any and all * copyright rights in the Software, and any and all patent rights owned or * freely licensable by each licensor hereunder covering either (i) the * unmodified Software as contributed to or provided by such licensor, or (ii) * the Larger Works (as defined below), to deal in both * * (a) the Software, and * * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if * one is included with the Software each a "Larger Work" to which the Software * is contributed by such licensors), * * without restriction, including without limitation the rights to copy, create * derivative works of, display, perform, and distribute the Software and make, * use, sell, offer for sale, import, export, have made, and have sold the * Software and the Larger Work(s), and to sublicense the foregoing rights on * either these or other terms. * * This license is subject to the following condition: * * The above copyright notice and either this complete permission notice or at a * minimum a reference to the UPL must be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oracle.truffle.object.basic.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import org.junit.Ignore; import org.junit.Test; import com.oracle.truffle.api.object.DynamicObject; import com.oracle.truffle.api.object.DynamicObjectLibrary; import com.oracle.truffle.api.object.Shape; import com.oracle.truffle.api.test.AbstractLibraryTest; public class CachedFallbackTest extends AbstractLibraryTest { @Test public void testMixedReceiverTypeSameShape() { Shape shape = Shape.newBuilder().build(); DynamicObject o1 = new TestDynamicObjectMinimal(shape); DynamicObject o2 = new TestDynamicObjectDefault(shape); String key = "key"; String val = "value"; CachedPutNode writeNode = adopt(CachedPutNodeGen.create()); writeNode.execute(o1, key, val); writeNode.execute(o2, key, val); assertSame("expected same shape", o1.getShape(), o2.getShape()); CachedGetNode readNode = adopt(CachedGetNodeGen.create()); assertEquals(val, readNode.execute(o1, key)); assertEquals(val, readNode.execute(o2, key)); } @Test public void testTransition() { Shape shape = Shape.newBuilder().build(); DynamicObject o1 = new TestDynamicObjectDefault(shape); DynamicObject o2 = new TestDynamicObjectDefault(shape); String key1 = "key1"; String val1 = "value1"; String key2 = "key2"; String val2 = "value2"; DynamicObjectLibrary library = adopt(DynamicObjectLibrary.getFactory().create(o1)); assertTrue(library.accepts(o1)); assertTrue(library.accepts(o2)); library.put(o1, key1, val1); library.put(o2, key1, val1); library.put(o1, key2, val2); library.put(o2, key2, val2); assertSame("expected same shape", o1.getShape(), o2.getShape()); CachedGetNode readNode = adopt(CachedGetNodeGen.create()); assertEquals(val1, readNode.execute(o1, key1)); assertEquals(val1, readNode.execute(o2, key1)); assertEquals(val2, readNode.execute(o1, key2)); assertEquals(val2, readNode.execute(o2, key2)); } @Ignore @Test public void testMixedReceiverTypeSameShapeWithFallback() { Shape shape = Shape.newBuilder().build(); DynamicObject o1 = new TestDynamicObjectMinimal(shape); DynamicObject o2 = new TestDynamicObjectDefault(shape); String key1 = "key1"; String val1 = "value1"; String key2 = "key2"; String val2 = "value2"; DynamicObjectLibrary library1 = adopt(DynamicObjectLibrary.getFactory().create(o1)); library1.put(o1, key1, val1); library1.put(o2, key1, val1); DynamicObjectLibrary library2 = adopt(DynamicObjectLibrary.getFactory().create(o1)); library2.put(o1, key2, val2); library2.put(o2, key2, val2); assertSame("expected same shape", o1.getShape(), o2.getShape()); CachedGetNode readNode = adopt(CachedGetNodeGen.create()); assertEquals(val1, readNode.execute(o1, key1)); assertEquals(val1, readNode.execute(o2, key1)); assertEquals(val2, readNode.execute(o1, key2)); assertEquals(val2, readNode.execute(o2, key2)); } } ```
The steel wheel of a steam locomotive and other older types of rolling stock were usually fitted with a steel tire (American English) or tyre (in British English, Australian English and others) to provide a replaceable wearing element on a costly wheel. Installation Replacing a whole wheel because of a worn contact surface was expensive, so older types of railway wheels were fitted with a replaceable steel tire. The tire is a hoop of steel that is fitted around the steel wheel centre. The tire is machined with a shoulder on its outer face to locate it on the wheel centre, and a groove on the inside diameter of the flange face. The inside diameter of the tire is machined to be slightly less than the diameter of the wheel centre on which it is mounted, to give an interference fit. The tire is fitted by heating to a controlled temperature, avoiding overheating. This causes the tire to expand. The wheel centre, usually already mounted on the axle, is lowered into the tire which is flange side up. The tire cools, and the retaining ring (a shaped steel bar rolled into a hoop, known as a Gibson ring, after its inventor J. Gibson of the British Great Western Railway) is fitted into the groove. Hydraulically operated rolls swage the groove down on to the retaining ring. The tire is primarily held in place by its interference fit. The shoulder on the outside and the retaining ring also keep the tire in place if the interference fit is lost. This is most often due to severe drag braking down a gradient, or due to an error in the machining. Removal of a worn tire is by machining out the retaining ring and heating the tire to relax the interference fit. Some steam locomotive wheels had tires bolted through the rim, or with a second smaller shoulder machined on the inside face of the tire. This shoulder was severely limited in size as it had to pass over the wheel centre for assembly. Tires of different designs were fitted to wheels with wooden centers (Mansell wheels in the UK) and to various other types. The use of tires is becoming obsolete. The utilisation of traditional freight wagons was often so low that tires never needed renewal, so it was cheaper to fit a one-piece ("monoblock") wheel. Monoblock wheels are lighter and offer better integrity as there is no tire to come loose. Modern flow-line repair lines are disrupted by the inspection of the wheel centre once the tire is removed, possibly generating extra rectification work, and the need to make each tire fit its allocated wheel centre. Monoblock wheels are now more economical. Causes of damage The most usual cause of damage is drag braking on severe gradients. Because the brake blocks apply directly on the tire, it is heated up, relaxing the interference fit. It is not feasible to fit the tire with such a heavy interference as to eliminate this risk entirely, and the retaining ring will ensure that the tire can only rotate on the wheel center, maintaining its alignment. In rare instances the rotation could be so severe as to wear the retaining ring down till it breaks, which could result in derailment. Severe braking or low adhesion may stop the rotation of the wheels while the vehicle is still moving can cause a flat spot on the tire and localized heat damage to the tire material. Tires are reasonably thick, about , giving plenty of room for wear. Worn tires or tires with flats are reprofiled on a wheel lathe if there is sufficient thickness of material remaining. A damaged railway tire was the cause of the Eschede train disaster, when a tire failed on a high-speed ICE train, causing it to derail and killing 101 people. Non-steel railway tires Some trains, mostly metros and people movers, have rubber tires, including some lines of the Paris Métro, the Mexico City Metro, the Caracas Metro, the Montreal Metro, Sapporo Subway, Seattle Center Monorail, Taipei Rapid Transit System, Santiago Metro and the Uijeongbu LRT References ISO 1005 Parts 1-9 BS 5892 Parts 1-6 Train wheels
The 1921 Talladega football team was an American football team that represented the Talladega College during the 1921 college football season. In its second season under head coach Jubie Bragg, the team compiled a – record. Talladega was recognized as the 1921 black college national co-champion. In November 1921, The Birmingham News reported that Talladega's quarterback "Skeats" Gordon was "reputed to have been showing dazzling ability all this year." Other players on the 1920 Talladega team included fullback Edwards from Anniston, halfback Spencer from Edgewater, and halfback Webber from King's Mountain, North Carolina. Talladega College was and remains a historically black college located in Talladega, Alabama. Due to segregation, Talladega and other historically black colleges and universities played games among themselves. In 1920, the Pittsburgh Courier, an African-American weekly newspaper, began selecting national champions from the black college football teams. The Courier selected Talladega as the co-champion in both 1920 and 1921. Schedule References Talladega Talladega Tornadoes football seasons Black college football national champions College football undefeated seasons Talladega football
```objective-c // // FavIconResultTableCellView.h // Strongbox // // Created by Mark on 21/12/2019. // #import <Cocoa/Cocoa.h> #import "ClickableImageView.h" NS_ASSUME_NONNULL_BEGIN @interface FavIconResultTableCellView : NSTableCellView @property (weak) IBOutlet NSImageView *icon; @property (weak) IBOutlet NSTextField *title; @property (weak) IBOutlet NSTextField *subTitle; @property BOOL checkable; @property BOOL checked; @property BOOL showIconChooseButton; @property (copy, nullable) void (^onClickChooseIcon)(void); @property (copy, nullable) void (^onCheckChanged)(void); @end NS_ASSUME_NONNULL_END ```
Our Lady of Peace is a Roman Catholic parish with a church and K-8 school. It is located in Millcreek Township in Erie County, Pennsylvania. The Our Lady of Peace Parish provides philanthropic services in the Diocese and to those in need who may reside outside of the county or State. School The parish also has a school with approximately 404 students. Average class size of the school is around 20 students for Kindergarten through 8th grade. The Our Lady of Peace school is not one of the selected schools to close in the Diocese. History Our Lady of Peace Parish was established on September 30, 1955, by Archbishop John Mark Gannon. On October 1, Archbishop Gannon appointed Father Daily as the founding pastor. The Millcreek School Board gave permission to OLP to use the high school auditorium for Sunday Masses. As of 2006, the diocesan headquarters was also located in Millcreek. Diocese Our Lady of Peace is a parish within the Roman Catholic Diocese of Erie. There are 39 parishes within the Diocese of Erie. The Diocese also has 15 Catholic schools within Erie County. References External links Our Lady of Peace School Churches in Pennsylvania Churches in Erie County, Pennsylvania
```yaml # this file should contain all periodic jobs that use the k8s-triage-robot token periodics: - name: ci-k8s-triage-robot interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds API review process description to kind/api-change PRs testgrid-tab-name: api-review-help spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: # pull requests against master branches in the kubernetes org labeled kind/api-change # exclude PRs that are in progress, held, or need rebase (typically aren't ready for API review). # exclude PRs already labeled api-review or tracked in the API review project # exclude PRs that already have the comment text - |- --query=org:kubernetes is:pr base:master label:kind/api-change -label:do-not-merge/work-in-progress -label:do-not-merge/hold -label:needs-rebase -label:api-review -project:kubernetes/169 NOT "complete the pre-review checklist and request an API review" - --updated=5m - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=This PR [may require API review](path_to_url#what-apis-need-to-be-reviewed). If so, when the changes are ready, [complete the pre-review checklist and request an API review](path_to_url#mechanics). Status of requested reviews is tracked in the [API Review project](path_to_url - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-stable-metrics interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds stable metrics review documentation to area/stable-metrics PRs testgrid-tab-name: stable-metrics-help spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: # pull requests against master branches in the kubernetes org labeled area/stable-metrics # exclude PRs that already have the comment text - |- --query=org:kubernetes is:pr base:master label:area/stable-metrics NOT "documentation for the requirements and lifecycle of stable metrics" - --updated=5m - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=This PR [may require stable metrics review](path_to_url Stable metrics are guaranteed to **not change**. Please review the documentation for the requirements and lifecycle of stable metrics and ensure that your metrics meet these guidelines. - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-cla interval: 10m cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: A sample job to make sure things work testgrid-tab-name: cla spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:pr is:open -label:"cncf-cla: no" -label:"cncf-cla: yes" - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /check-cla /easycla - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-close-issues interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Closes rotten issues after 30d of inactivity testgrid-tab-name: close-issues spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:issue -repo:kubernetes-sigs/kind -repo:kubernetes/kubectl -repo:kubernetes/steering -label:lifecycle/frozen -label:"help wanted" -label:"good first issue" -label:triage/accepted -label:priority/critical-urgent,priority/important-soon,priority/important-longterm label:lifecycle/rotten - --updated=720h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed You can: - Reopen this issue with `/reopen` - Mark this issue as fresh with `/remove-lifecycle rotten` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /close not-planned [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-close-prs interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Closes rotten PRs after 30d of inactivity testgrid-tab-name: close-prs spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:pr -repo:kubernetes-sigs/kind -repo:kubernetes/ingress-nginx -repo:kubernetes/steering -label:lifecycle/frozen label:lifecycle/rotten - --updated=720h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the PR is closed You can: - Reopen this PR with `/reopen` - Mark this PR as fresh with `/remove-lifecycle rotten` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /close [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-retester interval: 20m # Retest at most 1 PR per 20m, which should not DOS the queue. cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot testgrid-tab-name: retester description: Automatically /retest for approved PRs that are failing tests spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=is:pr -label:do-not-merge -label:do-not-merge/blocked-paths -label:do-not-merge/cherry-pick-not-approved -label:do-not-merge/contains-merge-commits -label:do-not-merge/hold -label:do-not-merge/invalid-commit-message -label:do-not-merge/invalid-owners-file -label:do-not-merge/needs-sig -label:do-not-merge/needs-kind -label:do-not-merge/release-note-label-needed -label:do-not-merge/work-in-progress label:lgtm label:approved label:"cncf-cla: yes" status:failure -label:needs-rebase -label:needs-ok-to-test -label:"cncf-cla: no" repo:kubernetes/kops repo:kubernetes/kubernetes repo:kubernetes/test-infra - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules: - The PR does have any `do-not-merge/*` labels - The PR does not have the `needs-ok-to-test` label - The PR is mergeable (does not have a `needs-rebase` label) - The PR is approved (has `cncf-cla: yes`, `lgtm`, `approved` labels) - The PR is failing tests required for merge You can: - Review the [full test history](path_to_url{{.Org}}&repo={{.Repo}}&pr={{.Number}}) for this PR - Prevent this bot from retesting with `/lgtm cancel` or `/hold` - Help make our tests less flaky by following our [Flaky Tests Guide][1] /retest [1]: path_to_url - --template - --ceiling=1 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-rotten-issues interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds lifecycle/rotten to stale issues after 30d of inactivity testgrid-tab-name: rotten-issues spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:issue -repo:kubernetes-sigs/kind -repo:kubernetes/ingress-nginx -repo:kubernetes/steering -label:lifecycle/frozen -label:lifecycle/rotten -label:"help wanted" -label:"good first issue" -label:"triage/accepted" label:lifecycle/stale - --updated=720h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed You can: - Mark this issue as fresh with `/remove-lifecycle rotten` - Close this issue with `/close` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /lifecycle rotten [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-rotten-prs interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds lifecycle/rotten to stale PRs after 30d of inactivity testgrid-tab-name: rotten-prs spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:pr -repo:kubernetes-sigs/kind -repo:kubernetes/ingress-nginx -repo:kubernetes/steering -label:lifecycle/frozen -label:lifecycle/rotten label:lifecycle/stale - --updated=720h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the PR is closed You can: - Mark this PR as fresh with `/remove-lifecycle rotten` - Close this PR with `/close` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /lifecycle rotten [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-stale-issues interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds lifecycle/stale to issues after 90d of inactivity testgrid-tab-name: stale-issues spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:issue -repo:kubernetes-sigs/kind -repo:kubernetes/ingress-nginx -repo:kubernetes/steering -label:lifecycle/frozen -label:lifecycle/stale -label:lifecycle/rotten -label:"help wanted" -label:"good first issue" -label:"triage/accepted" - --updated=2160h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed You can: - Mark this issue as fresh with `/remove-lifecycle stale` - Close this issue with `/close` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /lifecycle stale [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-stale-prs interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Adds lifecycle/stale to PRs after 90d of inactivity testgrid-tab-name: stale-prs spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi is:pr -repo:kubernetes-sigs/kind -repo:kubernetes/ingress-nginx -repo:kubernetes/steering -label:lifecycle/frozen -label:lifecycle/stale -label:lifecycle/rotten - --updated=2160h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules: - After 90d of inactivity, `lifecycle/stale` is applied - After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied - After 30d of inactivity since `lifecycle/rotten` was applied, the PR is closed You can: - Mark this PR as fresh with `/remove-lifecycle stale` - Close this PR with `/close` - Offer to help out with [Issue Triage][1] Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /lifecycle stale [1]: path_to_url - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-thaw-prs interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Removes lifecycle/frozen from PRs testgrid-tab-name: thaw-prs spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi label:lifecycle/frozen is:pr - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=The `lifecycle/frozen` label can not be applied to PRs. This bot removes `lifecycle/frozen` from PRs because: - Commenting `/lifecycle frozen` on a PR has not worked since March 2021 - PRs that remain open for >150 days are unlikely to be easily rebased You can: - Rebase this PR and attempt to get it merged - Close this PR with `/close` Please send feedback to sig-contributor-experience at [kubernetes/community](path_to_url /remove-lifecycle frozen - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-retriage interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Removes the triage/accepted label after 1 year of inactivity testgrid-tab-name: re-triage spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi -repo:kubernetes-sigs/kind -repo:kubernetes/steering label:triage/accepted -label:priority/important-soon -label:priority/critical-urgent is:issue - --updated=8760h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=This issue has not been updated in over 1 year, and should be re-triaged. You can: - Confirm that this issue is still relevant with `/triage accepted` (org members only) - Close this issue with `/close` For more details on the triage process, see path_to_url /remove-triage accepted - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-retriage-important interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Removes the triage/accepted label on important issues after 3 months of inactivity testgrid-tab-name: re-triage-important spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi -repo:kubernetes-sigs/kind -repo:kubernetes/steering label:triage/accepted label:priority/important-soon is:issue - --updated=2160h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=This issue is labeled with `priority/important-soon` but has not been updated in over 90 days, and should be re-triaged. Important-soon issues must be staffed and worked on either currently, or very soon, ideally in time for the next release. You can: - Confirm that this issue is still relevant with `/triage accepted` (org members only) - Deprioritize it with `/priority important-longterm` or `/priority backlog` - Close this issue with `/close` For more details on the triage process, see path_to_url /remove-triage accepted - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: ci-k8s-triage-robot-retriage-critical interval: 1h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Removes the triage/accepted label on critical issues after 1 month of inactivity testgrid-tab-name: re-triage-critical spec: containers: - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 command: - commenter args: - |- --query=org:kubernetes org:kubernetes-sigs org:kubernetes-client org:kubernetes-csi -repo:kubernetes-sigs/kind -repo:kubernetes/steering label:triage/accepted label:priority/critical-urgent is:issue - --updated=720h - --token=/etc/github-token/token - --endpoint=path_to_url - |- --comment=This issue is labeled with `priority/critical-urgent` but has not been updated in over 30 days, and should be re-triaged. Critical-urgent issues must be actively worked on as someone's top priority right now. You can: - Confirm that this issue is still relevant with `/triage accepted` (org members only) - Deprioritize it with `/priority {important-soon, important-longterm, backlog}` - Close this issue with `/close` For more details on the triage process, see path_to_url /remove-triage accepted - --template - --ceiling=10 - --confirm volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token - name: issue-creator interval: 24h cluster: k8s-infra-prow-build-trusted labels: preset-service-account: "true" decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: Creates github issues based on data from various 'IssueSource's. spec: containers: - image: gcr.io/k8s-staging-test-infra/issue-creator:v20240801-a5d9345e59 command: - issue-creator args: - --dry-run=false - --alsologtostderr - --org=kubernetes - --project=kubernetes - --token-file=/etc/github-token/token - --triage-window=1 - --triage-count=10 - --flakyjob-count=3 volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token # periodically file / close bugs for repos based on presence of SECURITY_CONTACTS - name: secping interval: 24h cluster: k8s-infra-prow-build-trusted decorate: true annotations: testgrid-dashboards: sig-contribex-k8s-triage-robot description: files bugs for SECURITY_CONTACTS testgrid-tab-name: secping extra_refs: - base_ref: main org: justaugustus repo: secping spec: containers: - command: - go - run - . - -d - --confirm - --token-path=/etc/github-token/token - --skip-emails env: - name: GO111MODULE value: "on" image: golang:latest volumeMounts: - name: token mountPath: /etc/github-token volumes: - name: token secret: secretName: k8s-triage-robot-github-token ```
Filipino-American Art includes art and music forms done by Filipino Americans. It has been growing in number in 2016. Filipino Americans are starting to be known for art, singing and even dancing. As we go back in history like Americans, Filipinos have been using the form of art to express themselves, to tell a story about their ancestors, to give a voice to those who feel like they do not have a voice or the right to speak up. Filipino American Artist also uses all types of art to have this sense of belonging and identity. Going back to history the Philippines was taken over by America and Spain, and since then some believe they do not know who they exactly are. Filipino Americans struggle to find their own identity, because like all Asian Americans they are looked down upon because there would be people who categorize them as only “Filipino” but there are other people who can also categorize them as only "American". This stigma results in identity loss, not being able to know where you belong and how to fit in. But with the help of different forms of art it gives the opportunity for Filipino Americans to be in touch with their Filipino roots as well as their American roots. Filipino-American identity and hip hop For many years hip hop has been an outlet for anyone who felt like they needed to express themselves or a calling to those who have felt oppressed. Filipino Americans throughout history have always been at some sort of identity crisis. “If this history is not remembered or associated with the experiences of Filipino Americans today, the colonizers’ historical records favor U.S. exceptionalism by not recognizing a pattern of white supremacy and imperialism.” (Bischoff) He explains that throughout history all we learn about is American history, and African American history etc. but you really do not see a huge chunk of Filipino American history. We do not hear about how America took over the Philippines, or how Spain and America worked together to fool the Philippines. Even education was not up to the Filipinos, America sent people to teach Filipinos the history of the Americans. So it is not a huge surprise when Filipinos migrate to the United States where they do not know who they are. Hip hop plays a huge role into this identity crisis. Young Filipino Americans are affected mostly because of this because of all the racial comments they get from people. Hip-Hop has been put out there originating from African Americans rapping about how they were oppressed, or how they have been segregated for too long. Filipino Americans also used this as an outlet to talk about their issues with society. In the book "Writer in Exile/Writer in Revolt: Critical Perspectives on Carlos Bulosan" Viola talks about how Hip-Hop in general talks about the movements that has been made, it replicates the feelings that people had, how strongly they felt about what mattered to them the most. Hip-Hop is this form of expression that put what people wanted to fight for in a form of expression where everybody and anybody could listen to it. Filipino Americans also used Hip-hop to talk about how they are present now, that we are not the same as every Asian American, there are many different races and ethnicities and we have different backgrounds, different cultures than the different races. Black Eyed Peas One of the most popular groups in music history was “The Black Eyed Peas” One of their founding members Apl.de.ap or previously known as Allan Pineda, is a Filipino American. He was born in the Philippines but came to the United States as he grew up. In the United States he quickly found Taboo, and Wil.I.am; together they formed a group but soon enough fell apart due to personal reasons. All members were going through issues that affected their group so they fell apart. Apl soon realized that there were many problems that he had to face: he could not send money to his family back home, as well as his brother committing suicide. He eventually went back to the Philippines to finally remember his roots. He had forgotten what it was like to be back and to see all the hardships and struggles people go through everyday to make a living. He finally came out with a song called “The ALP Song” in the lyrics you could clearly hear that he is talking about the hardships he saw in the Philippines “How would you feel if you had to catch your meal, Build a hut to live and to eat and chill in, Having to pump the water outta the ground?” (Devitt) This is just a prime example of Filipino Americans using their voice and talents to shed light on Filipino history and struggles faced in every day lives. As time went on he formed a new group called the Black Eyed Peas, he then also came up with a new song called "Bebot" which means "chick" in English. He also sheds light on the Filipino communities and cultures they have. He talks about the dishes that Filipinos are widely known for like chicken adobo, “pan de sal” which is Filipino bread, as well as "balut" which is a fertilized bird egg. This was history changing because we saw that people are starting to be more aware of their cultural and Filipino roots because The Black Eyed Peas started to use their voice, and fame to make people more aware of issues that are not really talked about in everyday lives. Filipino American dancers As there are many Filipino American artists singing wise there are also many Filipino American dancers. With many forms of expression dancing is definitely another outlet to express how Filipino American people feel. Filipino Americans started using dance as a form of letting loose as early as the 1920s. Filipino Americans started going to taxi dance halls where Filipino men were allowed to showcase their dancing abilities as well as socialize with women. This was one of the first times where Filipino Americans did not feel oppressed, and that they can be as equal as the other races. These men were praised by many people and this was a start of something new. Fast forwarding to today we have many uprising Filipino American dancers who express themselves. Shows like “So You Think You Can Dance” and “America’s Best Dance Crew” gave many people opportunities to showcase their dancing abilities. In the bunch of dance crews and people who competed in the years. There were many Filipino Americans who have competed and won. Dtrix (Dominic Sandoval), Ryanimay Conferido are some of the few who have competed for “So You Think You Can Dance” but also have combined their skills to have won season three of “America’s Best Dance Crew” with their dance crew “Quest Crew.” Another famous dance crew who predominantly is made of many Filipino Americans is a crew called “The Jabbawockeez” who was the first ever dance crew to win ABDC. These are just a few of the many and talented Filipino Americans who use their talents to express themselves as well as inspire other young Filipino Americans to follow their dreams. Filipino American artists Another form of expression used to showcase Filipino American pride is the sense of art itself. There have been many eras where art shined. Eras like Surrealism, Cubism were made popular by Pablo Picasso. Each era so different from the other because it depended on what was going on in history and how the artist himself felt. How does this relate to Filipino American Artistry? Like Picasso Filipino-American artist, Paul Pfeiffer created an art piece called “Leviathan” which is basically a painting that depicts many blonde wigs coming out of a frame. The hidden meaning to this art piece is that he wanted to show how having the western look/American look was a Filipino American’s dream, to look like the people on TV as well as be like them. Paul wanted to depict it like this because it shows how the wigs are everywhere but also is a metaphor because while people were so obsessed with being like the Westerners, Filipino history was never told and forgotten. America hid the cruel things they have done to the Filipinos. Picasso used his art to show how he felt at the time, and in each era he felt something different the same goes with Paul Pfeiffer he created in art piece that shows how he felt about Filipino American history. How he felt about Filipino Americans giving in to Western culture as well as the untold history of the Philippines. There are many more artists as well as art pieces who empower the Filipino American. Filipino cultural night Pilipino Cultural Night (PCN) is an event that Filipino American students have made up to stage in touch with their roots, and although there is not a specific person who is well known for PCNs. It is a huge factor in Filipino American’s (as well as other people who are not Filipino American) expression and another way for them to keep in touch with their family and friend’s roots. PCNs were dance, song, and art forms all in one event. They allowed students to learn about their forgotten and unspoken history. Students around the nation have adapted the idea of a PCN. PCN dates all the way back to 1980 in California where a group of students were curious about their cultural roots. Today PCNs are performed all over the United States educating everyone on Filipino culture. In PCNs there are usually four suites that base the performances. The four suites Rural, Cordillera, Tribal, and Muslim. In each suite you see how different they are. Each suite contains many different dances that tell a different part of history of the Philippines. This is important because Filipino American students that put on these performances not only tell the story of our ancestors but they are also educated on the struggles and hardships they faced. PCN is included in Filipino American Artists because students pay tribute to the Pilipino history, you do not have to be famous and well-known nationally in order to show your support for the Filipino American history. In Filipino-American performances, many dances are theatrically altered versions of rituals and dances. Although criticized by some, PCN's were created for the community at-large to receive information they never did before, whether it be about Filipino history, dances, rituals, or Fil-Am experiences. Dances such as "Sarimanok", "Tahing", and "Mumbaki" tell the stories of rituals performed in the Philippines. Mumbaki depicts the ritual of priests praying to the god for a successful harvest. Skeptics Over time there seems to be a pattern on the fame Filipino American Artists. Some may believe that fame Filipino Americans get are based on their ethnicity instead of their talent. Famous artists like Charice Pempengco rose to fame when people saw her internet videos on YouTube giving her millions of hits. She was then flown to America where she guest appeared on major TV shows like Ellen, Oprah and Glee. While being interviewed on Oprah you saw that she was questioned more about how she was Filipino coming to America rather than her music abilities. On Glee she played Sunshine Corazon a transfer student from the Philippines, she played a stereotypical Filipina. This brings to the table are Filipinos famous for their abilities or because they are Filipino. People may have different opinions. References Filipino-American culture
This is a list of notable bridges in New Zealand. See also List of bridges List of New Zealand spans, a list of overhead powerline spans References New Zealand Bri Bri
Burrowing frog may refer to several fossorial frog species: Giant burrowing frog (Heleioporus australiacus), a frog in the family Myobatrachidae found in coastal south east New South Wales and Victoria, Australia Indian burrowing frog (Sphaerotheca breviceps), a frog in the family Dicroglossidae found in South Asia Ornate burrowing frog (Opisthodon ornatus), a frog in the family Myobatrachidae native to Australia Northern burrowing frog (Neobatrachus aquilonius), a frog in the family Myobatrachidae endemic to Australia Spencer's burrowing frog (Opisthodon spenceri), a frog in the family Myobatrachidae native to western and central Australia Striped burrowing frog (Cyclorana alboguttata), a frog in the family Hylidae found throughout much of Australia Painted burrowing frog (Neobatrachus pictus), also called Sudell's frog, a frog in the family Myobatrachidae native to western Victoria, eastern South Australia including Kangaroo Island, and southern New South Wales Mexican burrowing toad (Rhinophrynus dorsalis), a frog in the family Rhinophrynidae found in southern Texas through Mexico, Guatemala, Honduras, and El Salvador to Nicaragua and Costa Rica Moquard's burrowing frog (Scaphiophryne calcarata), a frog in the family Microhylidae endemic to Madagascar shovelnose frogs (Hemisus), the only genus in the family Hemisotidae, found in tropical and subtropical sub-Saharan Africa Rainbow burrowing frog (Scaphiophryne gottlebei), a frog in the family Microhylidae found in Madagascar Short-footed frog (Cyclorana brevipes), a frog in the family Hylidae native to eastern Queensland, Australia Animal common name disambiguation pages
```javascript exports.apiConfig = function () { 'use strict'; return { version: 4, routes: { echo: { 'GET': { authorizationType: 'BOOM' } }} }; }; exports.proxyRouter = function (event, context) { 'use strict'; context.succeed(event); }; ```
```xml import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import React from "react"; import { Link, MemoryRouter, Outlet, Route, Routes } from "react-router-dom"; import { STYLE_WRAPPER } from "../../util/test-utils"; import { MainNavPageInfo } from "./mainNavContext"; import { MainNavLayout } from "./MainNavLayout"; const TestPageA = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumb-a1", id: "a1", path: "/a1" }} /> Page A1 <Link to="a2">go-a2</Link> <Outlet /> </div> ); }; const TestChildPageA = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumb-a2", id: "a2", path: "/a1/a2" }} /> Page A2 <Link to="a3">go-a3</Link> <Outlet /> </div> ); }; const TestGrandChildPageA = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumb-a3", id: "a3", path: "/a1/a2/a3" }} /> Page A3 <Link to="/b1/b2">go-b2</Link> </div> ); }; const TestPageB = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumb-b1", id: "b1", path: "/b1" }} /> Page B1 <Outlet /> </div> ); }; const TestChildNonMainNavPageB = () => { return ( <div> {/* Not a Main Nav page */} Page B2 <Link to="b3">go-b3</Link> <Outlet /> </div> ); }; const TestGrandChildPageB = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumb-b3", id: "b3", path: "/b1/b2/b3" }} /> Page B3 <Link to="/c">go-c</Link> </div> ); }; const TestPageC = () => { return ( <div> <MainNavPageInfo pageInfo={{ title: "breadcrumbc", id: "c", path: "/c" }} /> Page C </div> ); }; const TestApp = ({ location = "/" }: { location?: string }) => { return ( <STYLE_WRAPPER> <MemoryRouter initialEntries={[location]}> <Routes> <Route element={<MainNavLayout />}> <Route element={<TestPageA />} path="a1"> <Route element={<TestChildPageA />} path="a2"> <Route element={<TestGrandChildPageA />} path="a3" /> </Route> </Route> <Route element={<TestPageB />} path="b1"> <Route element={<TestChildNonMainNavPageB />} path="b2"> <Route element={<TestGrandChildPageB />} path="b3" /> </Route> </Route> <Route element={<TestPageC />} path="c" /> </Route> </Routes> </MemoryRouter> </STYLE_WRAPPER> ); }; describe("MainNavLayout", () => { it("navigates and renders breadcrumbs correctly", async () => { const user = userEvent.setup(); render(<TestApp location="/a1" />); await screen.findByText(/Page A1/); // No breadcrumbs when there is only 1 page expect(screen.queryByText(/breadcrumb-a1/)).not.toBeInTheDocument(); await user.click(screen.getByText(/go-a2/)); await screen.findByText(/Page A2/); expect(screen.getByText(/breadcrumb-a1/)).toBeInTheDocument(); expect(screen.getByText(/breadcrumb-a2/)).toBeInTheDocument(); await user.click(screen.getByText(/go-a3/)); await screen.findByText(/Page A3/); expect(screen.getByText(/breadcrumb-a1/)).toBeInTheDocument(); expect(screen.getByText(/breadcrumb-a2/)).toBeInTheDocument(); expect(screen.getByText(/breadcrumb-a3/)).toBeInTheDocument(); await user.click(screen.getByText(/go-b2/)); await screen.findByText(/Page B2/); // No breadcrumbs because only one of the pages is a main nav page expect(screen.queryByText(/breadcrumb-b1/)).not.toBeInTheDocument(); expect(screen.queryByText(/breadcrumb-b3/)).not.toBeInTheDocument(); await user.click(screen.getByText(/go-b3/)); await screen.findByText(/Page B3/); expect(screen.getByText(/breadcrumb-b1/)).toBeInTheDocument(); expect(screen.getByText(/breadcrumb-b3/)).toBeInTheDocument(); // Test that single non-parent pages work as well await user.click(screen.getByText(/go-c/)); await screen.findByText(/Page C/); expect(screen.queryByText(/breadcrumb-c/)).not.toBeInTheDocument(); }); }); ```
```javascript import React from 'react' import ReactTooltip from 'react-tooltip' import TextField, { enterKeyCode } from 'components/common/TextField' import { mount } from 'enzyme' describe('TextField', () => { const generateProps = () => { return { onChange: sinon.spy(), onEnterKey: sinon.spy(), label: 'label', text: 'text', rows: 1 } } it('should render the text field', () => { const props = generateProps() const textField = mount(<TextField {...props} />) assert(textField.find('label').text() === props.label) assert(textField.find('input').exists()) assert(textField.find('input').prop('value') === props.text) }) it('should render the text field using the textarea element if rows are > 2', () => { const props = generateProps() props.rows = 2 const textField = mount(<TextField {...props} />) assert(textField.find('textarea').exists()) assert(textField.find('textarea').prop('value') === props.text) }) it('should call onChange if there is some input', () => { const props = generateProps() const textField = mount(<TextField {...props} />) textField.find('input').simulate('change', {target: {value: 'input'}}) assert(props.onChange.calledOnce) }) it('should call onEnterKey if the enter key is pressed', () => { const props = generateProps() const textField = mount(<TextField {...props} />) textField.find('input').simulate('keydown', {keyCode: enterKeyCode, target: {value: ''}}) assert(props.onEnterKey.calledOnce) }) it('should not call onEnterKey if the other key is pressed', () => { const props = generateProps() const textField = mount(<TextField {...props} />) textField.find('input').simulate('keydown', {keyCode: 0, target: {value: ''}}) assert(props.onEnterKey.notCalled) }) it('should show the tooltip if there is information prop', () => { const props = generateProps() props.information = 'info' const textField = mount(<TextField {...props} />) assert(textField.find(ReactTooltip).exists()) }) }) ```
```jsx import React, { Component } from "react"; import PropTypes from "prop-types"; import { TransitionMotion, spring } from "react-motion"; import stripStyle from "react-motion/lib/stripStyle"; import shallowEqual from "shallowequal"; import omit from "lodash.omit"; import { buildTransform, positionToProperties } from "../utils/transformHelpers"; import { commonPropTypes, commonDefaultProps } from "../utils/commonProps"; import assertIsElement from "../utils/assertIsElement"; export default class extends Component { static propTypes = { ...commonPropTypes, springConfig: PropTypes.shape({ stiffness: PropTypes.number, damping: PropTypes.number, precision: PropTypes.number }) }; static defaultProps = { ...commonDefaultProps, springConfig: { stiffness: 60, damping: 14, precision: 0.1 } }; constructor(props) { super(props); this.state = this.doLayout(props); } componentWillReceiveProps(nextProps) { if (!shallowEqual(nextProps, this.props)) { this.setState(this.doLayout(nextProps)); } } doLayout(props) { const items = React.Children.toArray(props.children).map(element => { assertIsElement(element); return { key: element.key, data: { element } }; }); const { positions, gridWidth, gridHeight } = props.layout( items.map(item => ({ ...item.data.element.props, key: item.data.element.key })), props ); const styles = positions.map((position, i) => ({ ...items[i], style: { ...items[i].style, zIndex: 2, ...springify( props.entered(items[i].data.element.props, props, { gridWidth, gridHeight }), props.springConfig ), ...springify(positionToProperties(position), props.springConfig) } })); return { styles, gridWidth, gridHeight }; } willEnter = transitionStyle => { const { gridWidth, gridHeight } = this.state; const { enter } = this.props; return { ...stripStyle(transitionStyle.style), zIndex: 1, ...enter(transitionStyle.data.element.props, this.props, { gridWidth, gridHeight }) }; }; willLeave = transitionStyle => { const { exit, springConfig } = this.props; const { gridWidth, gridHeight } = this.state; const exitStyle = exit(transitionStyle.data.element.props, this.props, { gridWidth, gridHeight }); return { ...transitionStyle.style, zIndex: 0, ...springify(exitStyle, springConfig) }; }; render() { const { component: Parent, style, perspective, lengthUnit, angleUnit, ...rest } = omit(this.props, [ "itemHeight", "measured", "columns", "columnWidth", "gutterWidth", "gutterHeight", "layout", "enter", "entered", "exit", "springConfig", "duration", "easing" ]); const { styles, gridWidth, gridHeight } = this.state; return ( <TransitionMotion styles={styles} willEnter={this.willEnter} willLeave={this.willLeave} > {interpolatedStyles => ( <Parent style={{ position: "relative", ...style, width: `${gridWidth}${lengthUnit}`, height: `${gridHeight}${lengthUnit}` }} {...rest} > {interpolatedStyles.map(config => { const { style: { opacity, zIndex }, data } = config; const Child = data.element.type; const transform = buildTransform(config.style, perspective, { length: lengthUnit, angle: angleUnit }); const itemProps = omit(data.element.props, [ "itemRect", "itemHeight" ]); return ( <Child key={data.element.key} {...itemProps} style={{ ...itemProps.style, position: "absolute", top: 0, left: 0, zIndex, opacity, transform, WebkitTransform: transform, msTransform: transform }} /> ); })} </Parent> )} </TransitionMotion> ); } } function springify(style, springConfig) { return Object.keys(style).reduce((obj, key) => { obj[key] = spring(style[key], springConfig); return obj; }, {}); } ```
Bah Bill Abuza Mamadou (born 8 September 2001), more commonly known as Bill Mamadou or monoymously as Bill, is a Singaporean footballer of Malian descent currently playing as a centre-back, right-back or central-midfielder for Singapore Premier League club Lion City Sailors and the Singapore under-23 national team. He is the son of former footballer Bah Mamadou. Club career Home United In 2019, he was promoted to the 1st team and played a total of 3 matches for the protectors. Young Lions After enlistment, he played for the Young Lions Team for 2 years from 2020 to 2021. Lion City Sailors He played for the Sailors after his completion of the NS. He made his season debut against Tanjong Pagar in a 7-0 at the Jalan Besar Stadium on 13 August for their second big-margin win for the season. For the match against Albriex, Harris was suspended and Pedro was injured for the match, which resulted in Bill starting the 1st of many matches for the season Personal life He is the son of former footballer and S.League legend, Bah Mamadou. He is of African descent through his father who was born in Mali. His dad formerly played for S.League clubs including Gombak United, Balestier Khalsa, and Woodlands Wellington. Career statistics Club Notes International statistics U23 International caps References Living people 2001 births Singaporean men's footballers Guinean men's footballers Men's association football midfielders Singapore Premier League players Lion City Sailors FC players Young Lions FC players Singaporean people of Malian descent Singapore men's youth international footballers Competitors at the 2023 SEA Games SEA Games competitors for Singapore
Eastmont School District is a public school district located in Douglas County, Washington, United States. Eastmont Schools Schools in Eastmont School District include: Eastmont High School - Grades 10 through 12 Eastmont Jr. High - Grades 7,8,9 Sterling Jr. High- Grades 7,8,9 Clovis Point Elementary Kenroy Elementary - Grant Elementary - Rock Island Elementary - Lee Elementary - Cascade Elementary - Eastmont High School Principal - Lance Noell Asst. Principal (Grade 10: A-M) - Jon Abbott Asst. Principal (Grade 10: N-Z) - Jim Schmutzler Asst. Principal (Grade 11) - Tom McRae Asst. Principal (Grade 12) - Stacia Hardie Administration Eastmont School District officials include: School Board as of January 2020: Annette Eggers Dave Piepel Whitney Smith Meaghan Vibbert Cindy Wright Other officials as of March 2023: Becky Berg - Superintendent Spencer Taylor - Executive Director Elementary Ed. Matt Charlton - Assistant Superintendent Secondary Ed. References External links District Home Page School districts in Washington (state) Education in Douglas County, Washington
```yaml name: SpaceEye description: Live satellite imagery for your desktop background. website: path_to_url category: Utilities repository: path_to_url keywords: - taskbar - toolbar - space - satellite - desktop wallpaper - live - earth - open source license: MIT ```
The Senate of Canada () is the upper house of the Parliament of Canada. Together with the Crown and the House of Commons, they compose the bicameral legislature of Canada. The Senate is modelled after the British House of Lords with members appointed by the governor general on the advice of the prime minister. The appointment is made primarily by four divisions, each having twenty-four senators: the Maritime division, the Quebec division, the Ontario division, and the Western division. Newfoundland and Labrador is not part of any division, and has six senators. Each of the three territories has one senator, bringing the total to 105 senators. Senate appointments were originally for life; since 1965, they have been subject to a mandatory retirement age of 75. While the Senate is the upper house of parliament and the House of Commons is the lower house, this does not imply the former is more powerful than the latter. It merely entails that its members and officers outrank the members and officers of the Commons in the order of precedence for the purposes of protocol. In fact, the opposite is true; as a matter of practice and custom, the House of Commons is the dominant chamber. The prime minister and Cabinet are responsible solely to the House of Commons and remain in office only so long as they retain the confidence of that chamber. Parliament is composed of the two houses together with the "Crown-in-Parliament" (i.e. the monarch, represented by the governor general as ex officio viceroy). The approval of both houses is necessary for legislation to become law, and thus the Senate can reject bills passed by the House of Commons. Between 1867 and 1987, the Senate rejected fewer than two bills per year, but this has increased in more recent years. Although legislation can normally be introduced in either chamber, the majority of government bills originate in the House of Commons, with the Senate acting as the chamber of "sober second thought" (as it was called by John A. Macdonald, Canada's first prime minister). History The Senate came into existence in 1867, when the Parliament of the United Kingdom passed the British North America Act 1867 (now entitled the Constitution Act, 1867), uniting the Province of Canada (as two separate provinces, Quebec and Ontario), Nova Scotia and New Brunswick into a single federal Dominion. The Canadian parliament was based on the Westminster system (that is, the model of the Parliament of the United Kingdom). Canada's first prime minister, Sir John A. Macdonald, described the Senate as a body of "sober second thought" that would curb the "democratic excesses" of the elected House of Commons and provide regional representation. He believed that if the House of Commons properly represented the population, the upper chamber should represent the regions. It was not meant to be more than a revising body or a brake on the House of Commons. Therefore, it was deliberately made an appointed house, since an elected Senate might prove too popular and too powerful and be able to block the will of the House of Commons. In 2008 the Canadian Heraldic Authority granted the Senate, as an institution, a coat of arms composed of a depiction of the chamber's mace (representing the monarch's authority in the upper chamber) behind the escutcheon of the Arms of Canada. Senate reform Discussion of Senate reform dates back to at least 1874, but to date there has been little meaningful change. In 1927, The Famous Five Canadian women asked the Supreme Court to determine whether women were eligible to become senators. In the Persons Case, the court unanimously held that women could not become senators since they were not "qualified persons". On appeal, the Judicial Committee of the Privy Council ruled that women were persons, and four months later, Cairine Wilson was appointed to the senate. In the 1960s, discussion of reform appeared along with the Quiet Revolution and the rise of Western alienation. The first change to the Senate was in 1965, when a mandatory retirement age of 75 years was set. Appointments made before then were for life. In the 1970s the emphasis was on increased provincial involvement in the senators' appointments. Since the '70s, there have been at least 28 major proposals for constitutional Senate reform, and all have failed, including the 1987 Meech Lake Accord, and the 1992 Charlottetown Accord. Starting in the 1980s, proposals were put forward to elect senators. After Parliament enacted the National Energy Program Western Canadians called for a Triple-E (elected, equal, and effective) senate. In 1982 the Senate was given a qualified veto over certain constitutional amendments. In 1987 Alberta legislated for the Alberta Senate nominee elections. Results of the 1989 Alberta Senate nominee election were non-binding. Following the Canadian Senate expenses scandal Prime Minister Stephen Harper declared a moratorium on further appointments. Harper had advocated for an elected Senate for decades, but his proposals were blocked by a 2014 Supreme Court ruling that requires a constitutional amendment approved by a minimum of seven provinces, whose populations together accounted for at least half of the national population. In 2014 Liberal leader Justin Trudeau expelled all senators from the Liberal caucus and, as prime minister in 2016, created the Independent Advisory Board for Senate Appointment, both of which were attempts to make the Senate less partisan without requiring constitutional change. Members of the board include members from each jurisdiction where there is a vacancy. The board provides a short list of recommended candidates to the Prime Minister, who is not bound to accept them. Some provinces refused to participate, stating that it would make the situation worse by lending the Senate some legitimacy. Since this new appointments process was launched in 2016, 66 new senators, all selected under this procedure, were appointed to fill vacancies. All Canadians may now apply directly for a Senate appointment at any time, or nominate someone they believe meets the merit criteria. Chamber and offices The original Senate chamber was lost to the fire that consumed the Parliament Buildings in 1916. The Senate then sat in the mineral room of what is today the Canadian Museum of Nature until 1922, when it relocated to Parliament Hill. With the Centre Block undergoing renovations, temporary chambers have been constructed in the Senate of Canada Building, where the Senate began meeting in 2019. There are chairs and desks on both sides of the chamber, divided by a centre aisle. A public gallery is above the chamber. The dais of the speaker is at one end of the chamber, and includes the new royal thrones, made in part from English walnut from Windsor Great Park. Outside of Parliament Hill, most senators have offices in the Victoria Building across Wellington Street. Composition Qualifications Senators are appointed by the governor general via the recommendation of the prime minister. Traditionally, members of the prime minister's party were chosen. The constitution requires that a person be a subject of the King, between 30 and 75 years of age and a resident of the province or territory for which they are appointed, to become a senator. Senators must also own property worth at least $4,000 above their debts and liabilities, a rule introduced to ensure senators were not beholden to economic vagaries and turmoil. There is a mandatory retirement age of 75. A sitting senator is disqualified from holding office if they: fail to attend two consecutive sessions of the Senate; become a subject or citizen of a foreign power; file for bankruptcy; are convicted of treason or an indictable offence; or cease to be qualified in respect of property or of residence (except where required to stay in Ottawa because they hold a government office). Representation Each province and territory is entitled to its number of Senate seats specified in section 22. That section divides most of the provinces of Canada geographically among four regions, with one province and all three territories remaining outside any division. The divisions have equal representation of 24 senators each: Western Canada, Ontario, Quebec, and the Maritimes. The Western division comprises British Columbia, Alberta, Saskatchewan and Manitoba, each having 6 seats. The Maritimes division comprises New Brunswick and Nova Scotia, who each have 10 seats, and Prince Edward Island, which has 4 seats. Newfoundland and Labrador is represented by six senators. The Northwest Territories, Yukon and Nunavut have one senator each. Quebec senators are the only ones to be assigned to specific districts within their province. This rule was adopted to ensure that both French- and English-speakers from Quebec were represented appropriately in the Senate. Like most other upper houses worldwide, the Canadian formula does not use representation by population as a primary criterion for member selection, since this is already done for the House of Commons. Rather, the intent when the formula was struck was to achieve a balance of regional interests and to provide a house of "sober second thought" to check the power of the lower house when necessary. Therefore, the most populous province (Ontario) and two western provinces that were low-population at their accession to the federation and that are within a region are under-represented, while the Maritimes are over-represented. For example, British Columbia, with a population of about five million, sends six senators to Ottawa, whereas Nova Scotia and New Brunswick, both with populations under one million, are entitled to 10 senators each. Only Quebec has a share of senators approximate to its share of the total population. Senators must possess land worth at least $4,000 and have residency in the province or territory for which they are appointed. In the past, the residency requirement has often been interpreted liberally, with virtually any holding that met the property qualification, including primary residences, second residences, summer homes, investment properties, and undeveloped lots, having been deemed to meet the residency requirement; as long as the senator listed a qualifying property as a residence, no further efforts have typically been undertaken to verify whether they actually resided there in any meaningful way. Residency has come under increased scrutiny, particularly as several senators have faced allegations of irregularities in their housing expense claims. In 2013, the Senate's internal economy committee required all senators to provide documents proving their residency in the provinces. There exists a constitutional provision—section 26 of the Constitution Act, 1867—under which the sovereign may approve the appointment of four or eight extra senators, equally divided among the four regions. The approval is given by the monarch on the advice of the prime minister, and the governor general is instructed to issue the necessary letters patent. This provision has been used only once: in 1990, when Prime Minister Brian Mulroney sought to ensure the passage of a bill creating the Goods and Services Tax (GST). The appointment of eight additional senators allowed a slight majority for the Progressive Conservative Party. There was one unsuccessful attempt to use Section 26, by Prime Minister Alexander Mackenzie in 1874. It was denied by Queen Victoria, on the advice of the British Cabinet. The clause does not result in a permanent increase in the number of Senate seats, however. Instead, an attrition process is applied by which senators leaving office through normal means are not replaced until after their province has returned to its normal number of seats. Since 1989, the voters of Alberta have elected "senators-in-waiting", or nominees for the province's Senate seats. These elections, however, are not held pursuant to any federal constitutional or legal provision; thus, the prime minister is not required to recommend the nominees for appointment. Only three senators-in-waiting have been appointed to the Senate: the first was Stan Waters, who was appointed in 1990 on the recommendation of Brian Mulroney; the second was Bert Brown, elected a senator-in-waiting in 1998 and 2004, and appointed to the Senate in 2007 on the recommendation of Prime Minister Stephen Harper; and the third was Betty Unger, elected in 2004 and appointed in 2012. The base annual salary of a senator was $150,600 in 2019, although members may receive additional salaries in right of other offices they hold (for instance, the title of Speaker). Most senators rank immediately above Members of Parliament in the order of precedence, although the speaker is ranked just above the speaker of the House of Commons and both are a few ranks higher than the remaining senators. Current composition Parliamentary groups While for much of the Senate's history, most senators were affiliated with the same federal political parties that seek seats in elections to the House of Commons, this has changed in the 21st century and the large majority of current senators have no formal partisan affiliations. From 1867 to 2015, prime ministers normally chose members of their own parties to be senators, though they sometimes nominated non-affiliated senators or members of opposing parties. Since November 4, 2015, all newly-appointed Senators have not been affiliated with a political party and there has been no government caucus in the Senate. On December 6, 2016, for the first time in Canadian history the number of senators without a partisan affiliation exceeded that of the largest parliamentary group of senators with a partisan affiliation, and on October 17, 2017, the largest parliamentary group became one composed of senators unaffiliated with a political party. By the end of the 43rd Parliament, only 20 per cent of senators were affiliated with a political party, all members of the Conservative caucus. Senators are organized into one of four recognized parliamentary groups (or 'caucuses'), or are described as "non-affiliated" if they are members of none. Three of the parliamentary groups have weak to nonexistent patterns of party discipline and in lieu of a whip designate an individual to serve as a 'liaison'; they have accordingly been compared to technical groups or crossbenchers in other jurisdictions. By contrast, the Conservative group remains affiliated with the federal party with its members attending caucus meetings with its members of the House of Commons; they follow the party whip as a condition of continued affiliation. Gender A majority of sitting senators are women. , there are 51 women in the Senate out of 94 sitting members (54.4%). The Senate has generally had a higher level of female representation than the House of Commons throughout history. The number of female senators equalled males for the first time ever on November 11, 2020, and surpassed males for the first time on October 2, 2022. Notes Vacancies There is some debate as to whether there is any requirement for the prime minister to advise the governor general to appoint new senators to fill vacancies as they arise. In 2014, Leader of the Opposition Tom Mulcair argued that there is no constitutional requirement to fill vacancies. Constitutional scholar Peter Hogg has commented that the courts "might be tempted to grant a remedy" if the refusal to recommend appointments caused the Senate to be diminished to such a degree that it could not do its work or serve its constitutional function. Vancouver lawyer Aniz Alani filed an application for judicial review of Prime Minister Stephen Harper's apparent refusal to advise the appointment of senators to fill existing vacancies in 2014, arguing that the failure to do so violates the Constitution Act, 1867. On July 24, 2015, Harper announced that he would not be advising the governor general to fill the 22 vacancies in the Senate, preferring that the provinces "come up with a plan of comprehensive reform or to conclude that the only way to deal with the status quo is abolition". He declined to say how long he would allow vacancies to accumulate. Under the Constitution Act, 1867, senators are appointed by the governor general on the advice of the prime minister. If no such advice is forthcoming, according to constitutional scholar Adam Dodek, in "extreme cases, there is no question that the Governor General would be forced to exercise such power [of appointment] without advice". On December 5, 2015, the new Liberal government announced a new merit-based appointment process, using specific new criteria as to eligibility for the Senate. Independent applicants, not affiliated with any political party, will be approved by a new five-member advisory board (to be in place by year end), a reform that was intended to begin eliminating the partisan nature of the Senate. At the time, there were 22 vacancies in the Senate. On April 12, 2016, seven new senators were sworn in, including Prime Minister Justin Trudeau's hand-picked Representative of the Government in the Senate, Peter Harder. A series of additional appointments were announced for October and November 2016 that would fill all vacancies. Once these senators were summoned, the independent non-aligned senators became more numerous than either of the party caucuses for the first time in the Senate's history. The independent senator group also grew to include over half the total number of senators. On December 12, 2018, the four remaining vacancies were filled in Nova Scotia, the Yukon, the Northwest Territories and Ontario. With these appointments, the Senate had a full complement of senators for the first time in over eight years. Since December 2018, additional senators have retired, resigned or died so the Senate currently has fewer than 105 members again, with 12 vacancies as of November 2022. Officers The presiding officer of the Senate is the speaker, who is appointed by the governor general on the advice of the prime minister. The speaker is assisted by a speaker pro tempore ("Current Speaker"), who is elected by the Senate at the beginning of each parliamentary session. If the Speaker is unable to attend, the speaker pro tempore presides instead. Furthermore, the Parliament of Canada Act authorizes the speaker to appoint another senator to temporarily serve. Muriel McQueen Fergusson was the Parliament of Canada's first female speaker, holding the office from 1972 to 1974. The speaker presides over sittings of the Senate and controls debates by calling on members to speak. Senators may raise a point of order if a rule (or standing order) has been breached, on which the speaker makes a ruling. However, the speaker's decisions are subject to appeal to the whole Senate. When presiding, the speaker remains impartial, while maintaining membership in a political party. Unlike the speaker of the House of Commons, the speaker of the Senate does not hold a casting vote, but, instead, retains the right to vote in the same manner as any other. As of the 44th Parliament, Senator Raymonde Gagné presides as Speaker of the Senate. The senator responsible for steering legislation through the Senate is the representative of the Government in the Senate, who is a senator selected by the prime minister and whose role is to introduce legislation on behalf of the government. The position was created in 2016 to replace the former position of leader of the Government in the Senate. The opposition equivalent is the leader of the Opposition in the Senate is selected by the leader of the Official Opposition. However, if the Official Opposition in the Commons is a different party than the Official Opposition in the Senate (as was the case from 2011 to 2015), then the Senate party chooses its own leader. Officers of the Senate who are not members include the clerk, the deputy clerk, the law clerk, and several other clerks. These officers advise the speaker and members on the rules and procedure of the Senate. Another officer is the usher of the Black Rod, whose duties include the maintenance of order and security within the Senate chamber. The usher of the Black Rod bears a ceremonial black ebony staff, from which the title "black rod" arises. This position is roughly analogous to that of the sergeant-at-arms in the House of Commons, but the usher's duties are more ceremonial in nature. The responsibility for security and the infrastructure lie with the director general of Parliamentary Precinct Services. Committees The Parliament of Canada uses committees for a variety of purposes. Committees consider bills in detail and can make amendments. Other committees scrutinize various government agencies and ministries. The largest of the Senate committees is the Committee of the Whole, which, as the name suggests, consists of all senators. The Committee of the Whole meets in the chamber of the Senate, but proceeds under slightly modified rules of debate. (For example, there is no limit on the number of speeches a senator may make on a particular motion.) The presiding officer is known as the chairman. The Senate may resolve itself into a Committee of the Whole for a number of purposes, including to consider legislation or to hear testimony from individuals. Nominees to be officers of Parliament often appear before Committee of the Whole to answer questions with respect to their qualifications prior to their appointment. The Senate also has several standing committees, each of which has responsibility for a particular area of government (for example, finance or transport). These committees consider legislation and conduct special studies on issues referred to them by the Senate and may hold hearings, collect evidence, and report their findings to the Senate. Standing committees consist of between nine and fifteen members each and elect their own chairmen. Special committees are appointed by the Senate on an ad hoc basis to consider a particular issue. The number of members for a special committee varies, but, the partisan composition would roughly reflect the strength of the parties in the whole Senate. These committees have been struck to study bills (e.g., the Special Senate Committee on Bill C-36 (the Anti-terrorism Act), 2001) or particular issues of concern (e.g., the Special Senate Committee on Illegal Drugs). Other committees include joint committees, which include both members of the House of Commons and senators. There are currently two joint committees: the Standing Joint Committee on the Scrutiny of Regulations, which considers delegated legislation, and the Standing Joint Committee on the Library of Parliament, which advises the two speakers on the management of the library. Parliament may also establish special joint committees on an ad hoc basis to consider issues of particular interest or importance. Legislative functions Although legislation may be introduced in either chamber, most bills originate in the House of Commons. Because the Senate's schedule for debate is more flexible than that of the House of Commons, the government will sometimes introduce particularly complex legislation in the Senate first. In conformity with the British model, the Senate is not permitted to originate bills imposing taxes or appropriating public funds. Unlike in Britain but similar to the United States, this restriction on the power of the Senate is not merely a matter of convention but is explicitly stated in the Constitution Act, 1867. In addition, the House of Commons may, in effect, override the Senate's refusal to approve an amendment to the Canadian constitution; however, they must wait at least 180 days before exercising this override. Other than these two exceptions, the power of the two Houses of Parliament is theoretically equal; the approval of each is necessary for a bill's passage. In practice, however, the House of Commons is the dominant chamber of parliament, with the Senate very rarely exercising its powers in a manner that opposes the will of the democratically elected chamber. Although the Senate has not vetoed a bill from the House of Commons since 1939, minor changes proposed by the Senate to a bill are usually accepted by the Commons. The Senate tends to be less partisan and confrontational than the Commons and is more likely to come to a consensus on issues. It also often has more opportunity to study proposed bills in detail either as a whole or in committees. This careful review process is why the Senate is still today called the chamber of "sober second thought", though the term has a slightly different meaning from what it did when used by John A. Macdonald. The format of the Senate allows it to make many small improvements to legislation before its final reading. The Senate, at times, is more active at reviewing, amending, and even rejecting legislation. In the first 60 years after Confederation, approximately 180 bills were passed by the House of Commons and sent to the Senate that subsequently did not receive Royal Assent, either because they were rejected by the Senate or were passed by the Senate with amendments that were not accepted by the Commons. In contrast, fewer than one-quarter of that number of bills were lost for similar reasons in the sixty-year period from 1928 to 1987. The late 1980s and early 1990s was a period of contention. During this period, the Senate opposed legislation on issues such as the 1988 free trade bill with the US (forcing the Canadian federal election of 1988) and the Goods and Services Tax. In the 1990s, the Senate rejected four pieces of legislation: a bill passed by the Commons restricting abortion (C-43), a proposal to streamline federal agencies (C-93), a bill to redevelop the Lester B. Pearson Airport (C-28), and a bill on profiting from authorship as it relates to crime (C-220). From 2000 to 2013, the Senate rejected 75 bills in total. In December 2010, the Senate rejected Bill C-311, involving greenhouse gas regulation that would have committed Canada to a 25 per cent reduction in emissions by 2020 and an 80 per cent reduction by 2050. The bill was passed by all the parties except the Conservatives in the House of Commons and was rejected by the majority Conservatives in the Senate on a vote of 43 to 32. Divorce and other private bills Historically, before the passage of the Divorce Act in 1968, there was no divorce legislation in either Quebec or Newfoundland. The only way for couples to get divorced in these provinces was to apply to Parliament for a private bill of divorce. These bills were primarily handled by the Senate, where a special committee would undertake an investigation of a request for a divorce. If the committee found that the request had merit, the marriage would be dissolved by an Act of Parliament. A similar situation existed in Ontario before 1930. This function has not been exercised since 1968 as the Divorce Act provided a uniform statutory basis across Canada accessed through the court system. However, though increasingly rare, private bills usually commence in the Senate and only upon petition by a private person (natural or legal). In addition to the general stages public bills must go through, private bills also require the Senate to perform some judicial functions to ensure the petitioner's request does not impair rights of other persons. Investigative functions The Senate also performs investigative functions. In the 1960s, the Senate authored the first Canadian reports on media concentration with the Special Senate Subcommittee on Mass Media, or the Davey Commission, since "appointed senators would be better insulated from editorial pressure brought by publishers"; this triggered the formation of press councils. More recent investigations include the Kirby Commissions on health care (as opposed to the Romanow Commission) and mental health care by Senator Michael Kirby and the Final Report on the Canadian News Media in 2006. Relationship with the Government of Canada Unlike the House of Commons, the Senate has no effect in the decision to end the term of the prime minister or of the government. Only the House of Commons may force prime ministers to tender their resignation or to recommend the dissolution of Parliament and issue election writs, by passing a motion of no-confidence or by withdrawing supply. Thus, the Senate's oversight of the government is limited. The Senate does however, approve the appointment of certain officials and approves the removal of certain officials, in some cases only for cause, and sometimes in conjunction with the House of Commons, usually as a recommendation from the Governor in Council. Officers in this category include the auditor general of Canada, and the Senate must join in the resolution to remove the chief electoral officer of Canada. Most Cabinet ministers are from the House of Commons. In particular, every prime minister has been a member of the House of Commons since 1896, with the exception of John Turner. Typically, the Cabinet includes only one senator: the leader of the Government in the Senate. Occasionally, when the governing party does not include any members from a particular region, senators are appointed to ministerial positions in order to maintain regional balance in the Cabinet. The most recent example of this was on February 6, 2006, when Stephen Harper advised that Michael Fortier be appointed to be both a senator representing the Montreal region, where the minority government had no elected representation, and the Cabinet position of Minister of Public Works and Government Services. Fortier resigned his Senate seat to run (unsuccessfully) for a House of Commons seat in the 2008 general election. Broadcasting Unlike the House of Commons, proceedings of the Senate were historically not carried by CPAC, as the upper house long declined to allow its sessions to be televised. On April 25, 2006, Senator Hugh Segal moved that the proceedings of the Senate be televised; the motion was referred to the Senate Standing Committee on Rules, Procedures and the Rights of Parliament for consideration; although the motion was approved in principle, broadcast of Senate proceedings was not actually launched at that time apart from selected committee meetings. Full broadcast of Senate proceedings began on March 18, 2019, concurrent with the Senate's temporary relocation to the Senate of Canada Building. See also Canadian Senate divisions Canadian Senate expenses scandal Canadian Senate Page Program Joint address List of Senate of Canada appointments by prime minister List of current senators of Canada Lists of Canadian senators Procedural officers and senior officials of the parliament of Canada References Further reading External links Senate of Canada – official website Department of Justice. (2004). Constitution Acts, 1867 to 1982. Forsey, Eugene. (2003). "How Canadians Govern Themselves." The Parliament of Canada. Official Website. A Legislative and Historical Overview of the Canadian Senate Government of Canada Canada sv:Kanadas parlament#Senaten
Anderson José Lopes de Souza (born 15 September 1993), known as Anderson Lopes, is a Brazilian footballer who plays for Yokohama F. Marinos as a forward or a winger. Club career Brazil Born in Recife, Pernambuco, Anderson Lopes joined Avaí's youth setup in 2011, after starting it out at Internacional. He made his professional debut on 29 November 2013, coming on as a second-half substitute in a 1–0 home win against Boa Esporte. In 2014 Anderson Lopes was loaned to Marcílio Dias. After scoring six goals in only 16 matches, he returned to Avaí, being assigned to the main squad in the second level. On 14 May 2014 Anderson Lopes scored his first goals for Leão, netting a brace in a 2–1 home win against ASA, for the season's Copa do Brasil. He finished the year with 33 league appearances and four goals, also being promoted to Série A. On 10 May 2015 Anderson Lopes made his Série A debut, starting in a 1–1 home draw against Santos. Sanfrecce Hiroshima On 10 July 2016, Anderson Lopes joined J1 League side Sanfrecce Hiroshima on loan. FC Seoul On 12 February 2018, Anderson Lopes joined K League 1 side FC Seoul on loan. In November 2018 he was removed from the matchday squad due to poor attitude and left the club at the end of the 2018 season, in which he scored 6 times in 30 league appearances. Hokkaido Consadole Sapporo On 1 January 2019, Anderson Lopes signed a one-year contract with J1 League side Hokkaido Consadole Sapporo. Wuhan FC On 3 July 2021, Anderson Lopez sign transfer to Chinese club, Wuhan FC for during mid 2021 season. Yokohama F. Marinos On 3 February 2022, Anderson Lopez announcement officially transfer to J1 club, Yokohama F. Marinos for upcoming 2022 season. He debut with the club in 19 February at same year, Recorded 1 goal and 1 assist in the match against Cerezo Osaka in the first round of the J1 League, the first official match after joining the club. Although he has been performing well since the opening, he was sent off for spatting on the opponent's defender Daiki Miya in the match against Avispa Fukuoka in Matchweek 14, he was suspended for 6 games and fined 600,000 yen. In the league match, he scored 11 points in team tie with Leo Ceara and contributed to the team's league victory. Career Statistics Club Honours Club Yokohama F. Marinos J1 League: 2022 References External links Anderson Lopes at playmakerstats.com (English version of ogol.com.br) 1993 births Living people Footballers from Recife Brazilian men's footballers Men's association football forwards Campeonato Brasileiro Série A players Campeonato Brasileiro Série B players Avaí FC players Clube Náutico Marcílio Dias players Club Athletico Paranaense players Sanfrecce Hiroshima players FC Seoul players Hokkaido Consadole Sapporo players Wuhan Yangtze River F.C. players Yokohama F. Marinos players J1 League players K League 1 players Chinese Super League players Brazilian expatriate men's footballers Expatriate men's footballers in Japan Expatriate men's footballers in South Korea Expatriate men's footballers in China Brazilian expatriate sportspeople in Japan Brazilian expatriate sportspeople in South Korea Brazilian expatriate sportspeople in China
Svenska Supercupen 2012, Swedish Super Cup 2012, was the 6th Svenska Supercupen for women, an annual football match contested by the winners of the previous season's Damallsvenskan and Svenska Cupen competitions. The match was played at Malmö IP, Malmö, on 25 March 2012, and was contested by league winners LdB FC Malmö and cup winners Kopparbergs/Göteborg FC. The match was Malmö's second consecutive appearance and Kopparbergs/Göteborg's first in Svenska Supercupen since its creation. Malmö won the match 2–1 and claimed their second consecutive title in the competition. Match facts External links Super
Zielonka is a village in the administrative district of Gmina Gołdap, within Gołdap County, Warmian-Masurian Voivodeship, in northern Poland, close to the border with the Kaliningrad Oblast of Russia. It lies approximately south-west of Gołdap and north-east of the regional capital Olsztyn. References Villages in Gołdap County
Grand Ayatollah Sheikh Mohammad Ibrahim al-Karbasi (kalbasi) (; ; 1766–1845) known as Sahib al-Isharat () was a Shia jurist, mujtahid, fundamentalist, Quran commentator, theologian, scholar of biographical evaluation and marja', and considered the reviver of the Isfahan Seminary in the 19th-century. Early life and education al-Karbasi was born on 24 September 1766 in Isfahan, Iran, to Sheikh Muhammad-Hasan al-Karbasi. The Karbasi family claim descent from Malik al-Ashtar, the noble companion of the first Shia Imam, Ali. His father passed away when he was ten years old. His father died when he was ten years old, and went on to study under Agha Muhammad Bidabadi. He then travelled across a number of cities to acquire knowledge, and this included, Karbala, Najaf, Kadhimiya, Qom, and Kashan. In theses different cities, he studied under greats like Sheikh Muhammad-Baqir Behbehani, Sayyid Muhammad-Mehdi Bahr al-Uloom, Sheikh Jafar Kashif al-Ghita, and Sheikh Muhammad-Mehdi al-Naraqi. al-Karbasi excelled in his studies, and managed to make an exceptional connection between Islamic mysticism, which was taught by his teacher, Binabadi, as well as Usulism, which was founded by his teacher, Behbehani. Also, his most famous masters in Isfahan are: Mulla Ali Noori Mazandarani Mulla Mehrab Gilani Mirza Mohammad Ali MirzaMozaffar Mir Mohammad Hossein Khatoonabadi Sheikh Mohammad Ali Harandi Sheikh Mohammad ibn Sheikh Zeynoddin Religious career al-Karbasi became an expert in several fields of Islamic sciences. He taught Fiqh and Principles of Islamic jurisprudence in the Hakim Mosque of Isfahan, and in this field, raised many students who among them are: Sheikh Hadi Sabzavari Mirza Shirazi Mohammad ibn Soleiman Tonekaboni Sayyid Hassan Modarres Isfahani Sheikh Mahdi Qomsheh'ee Sayyid Mohammad Shahshahani Sheikh Hamzeh Qaeni Sayyid Muhammad-Hassan Mojtahed Isfahani Works Ayatollah Mohammad Ibrahim Kalbasi, along with his educational, training and propaganda efforts, was engaged in writing and researching and has written works in the field of Fiqh, Principles of Islamic jurisprudence and other Islamic teachings, which include: Esharat al-Osul (, Signs of the Usul) Ershad al-Mostarshedin fi Marefateh men Ahkam al-Din (, The guidance of the guides in the knowledge of the rules of religion) Al-Nokhbeh (, The elite) Menhaj al-Hedayah ela Ahkam al-Sharia va Forooe al-Fiqh (, The curriculum of guidance to the provisions of Sharia and the branches of jurisprudence) Al-Soal va al-Javab fi al-Fiqh va al-Ahkam (, Question and answer in jurisprudence and rulings) Shawarie al-Hidayah fi Sharh al-Kefayah al-Muqtasid (, Ways of guidance in the explanation of the frugal sufficiency) Taqlid al-Meyyet (, The dead tradition) Al-Iqaazaat (, The adjournments) Resaleh ee dar Sahih va Aam; Dar Elme Osule Feqh (, A treatise on the correct and general; In the science of the principles of jurisprudence) Naqd al-Usul (, Critique of principles) Manaseke Hajj (, Hajj rituals) Resaleh ee dar Mofattar Boodane Qelyan ya Tootoon (, A treatise on the nullifier of hookah or tobacco) At the insistence of the people and the insistence of the jurists and authorities of the time, such as Mirza-ye Qomi, he published a treatise of "Nokhbeh" (, The elite), which is the first collections of juridical edicts or clarifications of questions (Risalah (fiqh)) in Persian. Social actions He was one of the opponents of the Sufi orders in Isfahan. It is also said that he warned Fath-Ali Shah Qajar and some rulers of the time for neglecting the masses and monitoring the prices of goods. Death Al-Karbasi died on the night of Thursday, 15 May 1845, at the age of 81, and according to his will, he was buried in a place in front of the Hakim Mosque, in the family's crypt. See also Mirza-ye Qomi Seyyed Mohammad Hojjat Kooh Kamari Sayyed Ibrahim Estahbanati Agha Hossein Khansari Mohammad Jafar Sabzevari Mohaghegh Sabzevari References External links Tomb of Mohammad Ibrahim Kalbasi Kalbāsī, Muḥammad Ibrāhīm — Brill Portrait: Kalbasi Muhammad Ibrahim - Ullama & Marajay 1766 births 1845 deaths Shia clerics from Isfahan Iranian grand ayatollahs Writers from Isfahan 18th-century Iranian writers 19th-century Iranian writers
Hermine Haselböck (born 7 March 1967 in Melk, Lower Austria) is an Austrian mezzo-soprano in opera, concert and lied. Career After graduating from Stiftsgymnasium Melk Haselböck studied with Rita Streich at the Vienna Music Academy and continued at the Hochschule für Musik Detmold, with Ingeborg Ruß, finishing with diplomas for both performing and vocal education. She received further vocal training by Brigitte Fassbaender, Sena Jurinac, Marjana Lipovšek, Christa Ludwig and Eva Randová, and took master classes with Kurt Equiluz, Kurt Widmer and Edith Sélig-Papée. Her operatic career began with the role of Mercedes in Carmen, when Nikolaus Harnoncourt discovered her for his production at styriarte in 2005. She performed Dorabella (Così fan tutte) at the Concertgebouw Amsterdam, and the Second Lady (The Magic Flute) at the Mozart Festival Reinsberg, the Theater an der Wien and the Grand Théâtre de Luxembourg. 2006 she sang the role Frauenschatten in Erwin Schulhoff's Flammen. Two trouser roles followed, Hansel (Hansel and Gretel, Volksoper Wien) and Ramiro (La finta giardiniera, National Opera Tokyo and Bruckner Festival Linz). 2009 she first sang Magdalene (Die Meistersinger von Nürnberg), 2012 Brangäne (Tristan und Isolde) and 2013 Azucena (Il Trovatore) at the Tyrolian Festival Erl and Gertrud/Mother, (Hansel and Gretel at the Graz Opera House. 2013 she debuted as Floßhilde (Rheingold) in the Sala Santa Cecilia in Rome and made 2014 her debut as Fricka in Das Rheingold and Die Walküre at the Tyrolian Festival Erl, Austria. 2015 she performed Flosshilde in Das Rheingold with the Hong Kong Philharmonic Orchestra under the conduct of Jaap van Zweden. In 2015, she was singing the role of Fricka at the first staged performance of Das Rheingold and Die Walküre in Beijing and Shanghai. In 2016 followed the role of the daughter in the Austrian premiere of Ella Milch-Sheriff's Baruchs Schweigen at the EntarteOpera Festival, Vienna. Haselböck has collaborated with orchestras such as the Wiener Symphoniker, the Münchner Philharmoniker, the Orchestra dell'Accademia Nazionale di Santa Cecilia, the Orchestre National de Lille, the RSO Vienna, the MDR Sinfonieorchester, the Hongkong Philharmonic Orchestra, the Residence Orchestra Den Haag, the Dresdner Philharmonie, Budapest Philharmonic Orchestra, and under conductors such as Bertrand de Billy, Vladimir Fedoseyev, Rafael Frühbeck de Burgos, Martin Haselböck, Manfred Honeck, Gustav Kuhn, Fabio Luisi, Kirill Petrenko, Martin Sieghart, Jean-Christophe Spinosi, Christian Thielemann, Franz Welser-Möst, Jaap van Zweden. Symphonic and lieder repertoire plays an important role, performed in the Brucknerhaus Linz, Carnegie Hall, Frauenkirche in Dresden, Gewandhaus, Konzerthaus Vienna, Mozarteum Salzburg, Musikverein Vienna, Musée d'Orsay, Paris, and Teatro San Carlo Naples. Her repertoire includes the major works by Bach, Haydn, Händel, Mendelssohn, Beethoven, Mahler, Mozart, Schubert, Zemlinsky (Maeterlinck Songs), Wagner (Wesendoncklieder) and Verdi (Requiem). Haselböck is Guest Professor for Voice at the University of Music and Performing Arts Graz. Awards In 2005, Haselböck was awarded for her debut CD "Songs by Zemlinsky" the International Zemlinsky Award at the Musikverein Vienna and the Pasticcio Prize of the Austrian classical radio station. In 2014, Haselböck's CD recording of Gustav Mahler's Lieder eines fahrenden Gesellen, Kindertotenlieder, Rückert Lieder, Russell Ryan, piano, 2011: bridge records 9341 received the SUPER SONIC classic music award of the magazin PIZZICATO, Luxemburg. Discography Gustav Mahler: Symphony No. 2, Orchestre National de Lille, C: Jean-Claude Casadesus, Olena Tokar, soprano, Philharmonic Choir of Brno, Petr Fiala, 2016, EVIDENCE EVCD027 Richard Wagner, Das Rheingold, (Flosshilde), Hong Kong Philharmonic Orchestra, Jaap van Zweden, Matthias Goerne, Michelle De Young, Peter Sidhom, Kwangchul Youn, Stephen Milling, Kim Begley, Anna Samuil, David Cangelosi, Deborah Humble, Oleksandr Pushniak, Eri Nakamura, 2015 NAXOS 8.660374-75 Gustav Mahler: Lieder eines fahrenden Gesellen, Kindertotenlieder, Rückert Lieder, Russell Ryan, piano, 2011: bridge records 9341 Gustav Mahler: Lieder-Collectors edition, with Elisabeth Flechl, soprano, Wolfgang Holzmair, baritone, Alexander Kaimbacher, tenor, Angelika Kirchschlager, mezzo-soprano, Michael Kraus, baritone, Daniel Schmutzhard, baritone, Birgid Steinberger, soprano, Christopher Hinterhuber and Russell Ryan, piano, Christian Fennesz: Mahler Remix, Visuals: Annablume, Victoria Coeln, lia, Lillevan, lwz, Valence. 2011, Music DVD, departure 711956 Hugo Wolf Lieder: Lieder-Collectors edition, with Birgid Steinberger, soprano, Bernhard Berchtold, tenor, Florian Boesch, bass-baritone, Wolfgang Holzmair, baritone, Angelika Kirchschlager, mezzo-soprano, Michaela Selinger, mezzo-soprano; Georg Beckmann and Russell Ryan, piano, visuals: Victoria Coeln, Timo Novotny, luma.launisch (sound:frame lab), Claudia Rohrmoser; 2011, music DVD, departure 711760 Gustav Mahler: Das Lied von der Erde, with Bernhard Berchtold, tenor, Markus Vorzellner, piano original version for piano and high or middle voice. 2009: c-avi records 4260085531257 Ludwig van Beethoven: Missa Solemnis, Haydn Orchestre Bozen/Trient, D: Gustav Kuhn), 2007: col legno 60011 Songs of Franz Schreker, with Wolfgang Holzmair, baritone, Russel Ryan, piano, 2007: bridge records 9259 Songs of Alexander Zemlinsky with Florian Henschel, piano, 2006 2nd edition bridge records 9244 Songs of Alexander Zemlinsky with Florian Henschel, piano, 2003: panclassics pc 10162 Franz Schubert: Mass in A-flat major, Spirit of Europe, Martin Sieghart, 2007. orf-n cd 034 Ludwig van Beethoven: Symphony No. 9, Haydn Orchestra of Bozen and Trient, D: Gustav Kuhn), 2006:col legno 60005 Gaetano Donizetti: Adelia, (Odetta), Haydn Orchestra Bozen and Trient, D: Gustav Kuhn George Frideric Handel: Judas Maccabeus, Barucco Kammerorchester, D: Heinz Ferlesch, 2006 orf sacd 2010059 References Sources WWW.FORUMOPERA.COM - Jean-Marcel Humbert, 5.8.2014 (Rhine Gold and Valkyrie) >> „... Hermine Haselböck, a magnificent Fricka, has enormously developed further since her Brangäne 2012, her voice has gained homogeneity and roundness and she is as person and stage appearance an excellent actress with strong presence ...“ THE OPERATIC MUSICOLOGIST - Daniel Url 12.7.2015 >> „As Brangäne Hermine Haselböck once again impressed me with her powerful and still very beautiful voice. She has the perfect voice for Wagner's demanding mezzo roles and has a very warm tender timbre. Her guarding song during the love scene in act 2 was magic and lured the audience into another world. Also her diction is really exemplary and impressively precise.“ The Operatic Musicologist Holland, Bernhard (9 September 2006). "A Taste of Vienna, Flavored by Yesterday and Tomorrow". New York Times Rosenblum, Joshua (March 2012). Recording review: Hermine Haselböck and Russell Ryan: "Mahler: Lieder Eines Fahrenden Gesellen; Rückert-Lieder; Kindertotenlieder". Opera News Schweitzer, Vivien (29 March 2007). "Smaller Songs, Large in Spirit". New York Times Bayley, Lynn René (10 December 2012) MAHLER Songs of a Wayfarer. Rückert Lieder. Kindertotenlieder. White, Bill (10 December 2012) MAHLER Songs of a Wayfarer. Rückert Lieder. Kindertotenlieder Dubins, Jerry, (9 December 2012) SCHREKER Songs. White, Bill (9 December 2012) ZEMLINSKY songs. White, Bill (20 September 2012) Interview Vous avez cherché hermine haselböck, Alain Steffen, review Mahler song CD, SUPER SONIC classic music award 2014 Earnest singing and dramatic insight in Das Rheingold External links Hermine Haselböck Italartist Austroconcert „Rheingold“: Richard Wagner erobert Rom Living people Austrian operatic mezzo-sopranos 1967 births Hochschule für Musik Detmold alumni People from Lower Austria
```shell Let's play the blame game Interactive staging Create a new branch from a stash Show history of a function Debug using binary search ```
"In the Dark" is a song performed by American singer Dev. It was written by Dev alongside the Cataracs, who produced it for Dev's debut studio album, The Night the Sun Came Up (2011). The song was released as the album's second single on April 25, 2011, through Universal Motown. "In the Dark" came about when Dev wanted to make a sexy song to show that she is a grown woman. She collaborated with American rapper Flo Rida on an official remix as she believed she would enjoy the remix when hearing it on the radio. "In the Dark" is a dance-pop song with a saxophone hook and influences of Eurodance, Latin and jazz music. The lyrics emphasize sex drives and letting the sensation of touch fully take over from sight. The song received generally positive reviews from music critics, who highlighted its production and the saxophone line. However, critics were divided regarding the song's lyrical content; some referred it to as sexy, while others dismissed its metaphors. "In the Dark" enjoyed commercial success in the United States, peaking at number 11 on the Billboard Hot 100 chart and the summit of Hot Dance Club Songs. The song achieved its highest national peak in Russia and Slovakia, where it reached number one. Elsewhere, the song peaked in the top forty in Canada, Australia, Denmark, Ireland, Scotland and the United Kingdom. The song's music video features shots of black-painted hands that touch Dev while she is standing naked. According to Dev, the inspiration behind the video was to reflect the "dark" themes of the song, by creating a Tim Burton-inspired feel. Background "In the Dark" was written by Dev alongside the Cataracs, a group that consists of Niles Hollowell-Dhar and David Singer-Vine, who also produced the track. Dev described the song as "very flavorful" and "hot". In an interview with music blog Idolator, she talked in-depth about the conception of the song, stating, "I was like, dammit, I'm gonna make a sexy song!" She explained that she wanted the song to be "tasteful, yet sexual" and described it as "very sexy, but very musical at the same time". She said, "The songs I had before, even though they were explicit to an extent, they were just fun. It was time when we just wanted to make that sort of record, and we did. It's probably one of the sexier songs on the record, but I think it needed that!" "In the Dark" was recorded during a session in January 2011; it was one of the first songs to be recorded for Dev's debut album and it was eventually also recorded by Demi Lovato. It was later mixed by Manny Marroquin at Larrabee Studios in Los Angeles, California and mastered by Tom Coyne at Sterling Sound in New York City. The song was released on April 25, 2011, via digital download as the second single from Dev's debut studio album, The Night the Sun Came Up. It was later sent for rhythmic airplay in the United States on May 24, 2011, followed by an add on mainstream radio stations on June 21, 2011. In the United Kingdom, "In the Dark" was released in a digital extended play (EP) alongside three remixes of the track as well as its music video. Rapper Flo Rida is featured on an official remix of the song, and Dev stated that she wanted to make a remix as it would be refreshing and "great for radio". She explained that a rapper would suit the song well and that she would enjoy the remix when hearing it on the radio. She elaborated on choosing Flo Rida, saying: "We went in thinking about who would be cool on the radio [...] Flo Rida fit, and he completely killed it." 50 Cent is featured on another remix of the track, which he recorded at Sonic Vista Studios Ibiza (Spain) in August 2011, while Kanye West appears on an unofficial remix, of which Dev said: "That was just kind of something that floated onto the Internet and the airwaves, which I don't mind at all because it sounds absolutely amazing and it's one of my favorite remixes too." Composition "In the Dark" is a dance-pop song that features Eurodance beats and synths, mixed with influences of Latin music. The song features a house rhythm and a prominent saxophone riff that serves as the song's instrumentation. Critics compared the riff to "Mr. Saxobeat" (2011) by Romanian singer Alexandra Stan. "In the Dark" opens with Dev's sing-talk vocal style as she sings "On my waist, through my hair / Think about it when you touch me there / Close my eyes, here you are dance-dance-dancing in the dark." According to Nadine Cheung of AOL Radio, the line borrows the melody from Reel 2 Real's "I Like to Move It" (1994). "In the Dark" sees Dev using her singing voice more than her distinctive sing-talk style. Lyrically, the song speaks of sex drives and letting sensation of touch fully taking over from sight, as Dev repeats the line, "I got a sex drive that's push to start". According to sheet music published at Musicnotes.com by Hal Leonard Corporation, "In the Dark" is written in the time signature of common time and set in a fast tempo of 125 beats per minute. It is written in the key of C minor and Dev's vocals span from the note of A4 to the note of B5. It has a basic sequence of Cm–E6–A5–G5 as its chord progression. Critical reception "In the Dark" received generally positive reviews from music critics. Lewis Corner of British music website Digital Spy rated it four stars out of five, particularly praising the saxophone hook. Corner commented, "[Dev] purrs in her sensual and sultry tones, accompanied by that saxophone hook spicier than an extra-hot peri peri chicken from Nandos – and, we should add, just as lip-lickingly addictive." Bill Lamb of About.com rated "In the Dark" four stars out of five and praised Dev's vocals, as well as the song's sexy lyrics and the saxophone hook. Lamb observed that the song is "nearly pure libido", but said that it works well without explicit lyrics. On the other hand, he criticized the song for being "locked in the current time", writing: "'In the Dark' seems very much a song of the dance pop moment. Like the hit 'Like a G6,' it is quite possible in a few months 'In the Dark' may sound a bit dated. It does not seem to capture something timeless." Lamb ended on a positive note; however, writing that the song is a worthy addition to party playlists and praised Dev and the Cataracs for "hav[ing] their fingers on the pulse of current party music". Garyn Ganz of Rolling Stone graded the song three stars out of five and commented: "Dev speak-sings about her sex drive over a Nineties Latin house beat like a top-shelf version of Kesha – seductive, not sleazy." While reviewing The Night the Sun Came Up, Slant Magazine critic Sal Cinquemani named the song the album's best track. He pointed out that, unlike the rest of the album, "In the Dark" avoids "too-aggressive beats and chintzy synths" and instead relies on Dev's "ooh la la" hook and the "sleek" saxophone line. Cinquemani concluded by writing that the song is "almost enough to forgive [the Cataracs] for 'Like a G6'." Tris McCall of The Star-Ledger named "In the Dark" the "Song of the Week" and compared its saxophone line to Alexandra Stan's "Mr. Saxobeat", and said that while the latter is "total Euroschlock", "In the Dark" preserves "some of the mechanized detachment" of Dev's song "Booty Bounce" (2010). McCall was mixed regarding "In the Dark"'s lyrical content and called the line "do your work on me/Open up my body and do some surgery" the "grossest pillow talk" since the Black Eyed Peas' "My Humps". Writing for the Dallas Observer, Shahryar Rizvi was negative in his review of the song and criticized the "cheesy" saxophone sound, saying that it "serves well to show just how mediocre this song is". LA Weekly writer Shea Serrano regarded the song as "predictable" and dismissed the metaphors, labeling them "confusing". Recognition Music magazine Spin included "In the Dark" at number 15 on its "Favorite Pop Tracks of 2011" list, naming it "radio gold". The Hollywood Reporter music editor Shirley Halperin put it at number four on her "Top 10 Singles of 2011" list and called it "irresistible". Halperin went on to comment: "Spotlighting the sexiest sax solo this side of Duran Duran's 'Rio' and a sultry, almost Latin-flavored vibe, it may or may not be an ode to masturbation, but it definitely satisfies in all the right places." In 2021, "In the Dark" entered various international music charts due to going viral on the video-sharing app TikTok. Chart performance In the United States, "In the Dark" made its debut at number 92 on the Billboard Hot 100 chart in the issue dated August 20, 2011, almost three months after the song's release in April. The song steadily ascended on the chart for eight weeks before reaching its peak position of number 11 in the issue dated October 22, 2011. The song proved to be a bigger commercial success than Dev's debut single, "Bass Down Low" (2010), which reached number 61. Additionally, "In the Dark" reached number one on two of Billboards component charts, Heatseekers Songs and Hot Dance Club Songs. The song also peaked at number eight on both Pop Songs and Radio Songs. On March 8, 2012, the single was certified platinum by the Recording Industry Association of America (RIAA) for sales of over one million units. In Canada, "In the Dark" debuted at number 83 on the Canadian Hot 100 chart in the issue dated September 17, 2011 and peaked at number 15 six weeks later on October 22, 2011. In Australia, the song debuted at number 64 on the singles chart, and eventually peaked at number 41. Across Europe, "In the Dark" made its first appearance on the Tracklisten chart in Denmark on July 29, 2011, entering at number 36. The following week, the song reached its peak of number 22 and was listed on the chart for five weeks before falling off. In Slovakia, "In the Dark" debuted at number 30 and peaked at the top position seven weeks later. In the United Kingdom, the song debuted and peaked at number 37 on the UK Singles Chart in the issue dated August 27, 2011. Although failing to match "Bass Down Low"'s peak of number ten, it did give Dev her second top 40 single in the UK. In Ireland, "In the Dark" fared similarly to the UK on the Irish Singles Chart, entering and peaking at number 33. Music video The music video for "In the Dark" was directed by Ethan Lader, whom Dev enlisted to make the video as he regularly makes videos for her and the Cataracs. Lader originally contacted her with ideas for the clip, and she soon replied with what she would want in the video. She said, "So we did that back and forth, which he always does with me until I get my point across. ... and then we met up and we got both of our ideas and feelings across. I wanted to be sexy and dark like the song is, in a really interesting way, and we pulled it off, I think." The video was filmed in Los Angeles, California in late-April 2011, just before Dev joined Usher as the opening act for his OMG Tour. Dev took more control over the "In the Dark" video than previous video shoots as she used to let the director "take a little bit of control" when she was inexperienced in the process. In an interview with Idolator, Dev elaborated on the video's concept, stating that she wanted a dark feel similar to Tim Burton's Alice in Wonderland: "I wanted the video to be sexy as well [...] we'd have an Alice in Wonderland/Tim Burton type of feel." In the video, Dev is seen in a club scene with intense dancing. The main focus is black-painted hands and arms, which are prominent in several shots of Dev as she is standing naked while the hands are touching her body. Some of the hands were digitally added, but most of them were real, including the ones touching Dev. She explained, "The extras were amazing, they let me paint their hands and bodies, and they stacked on top of each other and did that for hours. For takes and takes and takes." The video also includes shots of an albino ball python and a tarantula. Cory Lamz of Westword wrote a positive review of the video: "Watching 'In the Dark' is like dancing under a strobe light on ecstasy. In a sea of hands, literally, Dev manages to tease you, seduce you and entice you. She makes you want to touch her, just like every other hand in the video." Contessa Gayles of AOL Music referred the video to as "freaky" and "funky", writing "Forget 'dancing in the dark,' Dev works it in a sea of dismembered, black-painted hands and arms in this freaky, funky new vid." In contrast, Becky Bain of Idolator called it "somewhat unsettling". Bill Lamb of About.com wrote that the video "will likely leave you never looking at hands exactly the same". Track listings CD single and digital download "In the Dark" – 3:48 Digital EP "In the Dark" (Radio Edit) – 3:30 "In the Dark" (featuring Flo Rida) – 3:40 "In the Dark" (Proper Villains Remix) – 4:26 "In the Dark" (Havana Brown Remix) – 5:33 "In the Dark" (Music video) – 3:46 Remix download "In the Dark" (featuring Flo Rida) – 3:39 Remix EP "In the Dark" (Proper Villains Remix) – 4:27 "In the Dark" (Hype Jones 2012 Remix) – 4:33 "In the Dark" (DJ Havoc & SpekrFreks Remix) – 3:28 "In the Dark" (Static Revenger Remix) – 6:26 "In the Dark" (Johan Wedel Remix) – 6:30 "In the Dark" (Benzi & DStar Remix) – 4:42 "In the Dark" (DJ Vice Remix) – 6:30 "In the Dark" (DJ Kue Remix) – 6:52 "In the Dark" (DJ Enferno Remix) – 6:08 "In the Dark" (Ranidu Remix) – 5:38 "In the Dark" (Alfa Paare Remix) – 5:17 Credits and personnel Recording Recorded at The Indie-Pop Sweat Shop Personnel Songwriting – Devin Tailes, Niles Hollowell-Dhar, David Singer-Vine Production – Niles Hollowell-Dhar Recording – The Cataracs Mixing – Manny Marroquin Mastering – Tom Coyne Credits adapted from The Night the Sun Came Up liner notes. Charts Weekly charts Year-end charts Certifications Radio add dates and release history See also List of number-one dance singles of 2011 (U.S.) List of number-one songs of 2011 (Russia) List of songs recorded by Dev References 2011 singles 2011 songs Dev (singer) songs Eurodance songs Number-one singles in Russia Song recordings produced by the Cataracs Songs written by David Singer-Vine Songs written by Dev (singer) Songs written by Kshmr Universal Republic Records singles
```java package com.yahoo.messagebus; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Stream; /** * <p>A reply is a response to a message that has been sent throught the messagebus. No reply will ever exist without a * corresponding message. There are no error-replies defined, as errors can instead piggyback any reply by the {@link * #errors} member variable.</p> * * @author Simon Thoresen Hult */ public abstract class Reply extends Routable { private double retryDelay = -1.0; private Message msg = null; private List<Error> errors = new ArrayList<>(); @Override public void swapState(Routable rhs) { super.swapState(rhs); if (rhs instanceof Reply) { Reply reply = (Reply)rhs; double retryDelay = this.retryDelay; this.retryDelay = reply.retryDelay; reply.retryDelay = retryDelay; Message msg = this.msg; this.msg = reply.msg; reply.msg = msg; List<Error> errors = this.errors; this.errors = reply.errors; reply.errors = errors; } } /** * <p>Returns the message to which this is a reply.</p> * * @return The message. */ public Message getMessage() { return msg; } /** * <p>Sets the message to which this is a reply. Although it might seem very bogus to allow such an accessor, it is * necessary since we allow an empty constructor.</p> * * @param msg The message to which this is a reply. */ public void setMessage(Message msg) { this.msg = msg; } /** * <p>Returns whether or not this reply contains any errors.</p> * * @return True if there are errors, false otherwise. */ public boolean hasErrors() { return errors.size() > 0; } /** * <p>Returns whether or not this reply contains any fatal errors.</p> * * @return True if it contains fatal errors. */ public boolean hasFatalErrors() { for (Error error : errors) { if (error.getCode() >= ErrorCode.FATAL_ERROR) { return true; } } return false; } /** * <p>Returns the error at the given position.</p> * * @param i The index of the error to return. * @return The error at the given index. */ public Error getError(int i) { return errors.get(i); } /** * <p>Returns the number of errors that this reply contains.</p> * * @return The number of replies. */ public int getNumErrors() { return errors.size(); } /** * <p>Add an error to this reply. This method will also trace the error as long as there is any tracing * enabled.</p> * * @param error The error object to add. */ public void addError(Error error) { errors.add(error); getTrace().trace(TraceLevel.ERROR, error.toString()); } /** * <p>Returns the retry request of this reply. This can be set using {@link #setRetryDelay} and is an instruction to * the resender logic of message bus on how to perform the retry. If this value is anything other than a negative * number, it instructs the resender to disregard all configured resending attributes and instead act according to * this value.</p> * * @return The retry request. */ public double getRetryDelay() { return retryDelay; } /** * <p>Sets the retry delay request of this reply. If this is a negative number, it will use the defaults configured * in the source session.</p> * * @param retryDelay The retry request. */ public void setRetryDelay(double retryDelay) { this.retryDelay = retryDelay; } /** * Retrieves a (read only) stream of the errors in this reply */ public Stream<Error> getErrors() { return errors.stream(); } /** * Retrieves a set of integer error codes */ public Set<Integer> getErrorCodes() { Set<Integer> errorCodes = new HashSet<>(); for (Error error : errors) { errorCodes.add(error.getCode()); } return errorCodes; } } ```
Leesville Lake is a reservoir in Virginia used for hydroelectric power generation in conjunction with Smith Mountain Lake as a pump storage project. It is located southeast of Roanoke, and southwest of Lynchburg. Smaller and lower than Smith Mountain Lake, Leesville Lake covers and contains of water at full pond. The lake is long with around of shoreline. The reservoir lies in a broad valley nestled in the Blue Ridge Mountains of rural southwestern Virginia of the Appalachian chain. Before the lake's creation, farming and logging were the primary industries. Power generation Initial proposals were made in the late 1920s to dam the Roanoke River and the Blackwater River at the Smith Mountain gorge to generate electricity. Construction of the Smith Mountain Dam began in 1960 and was completed in 1963. The dam produces hydro-electric power mostly during hours of peak demand on the American Electric Power system. Water passes from Smith Mountain Lake through generators to Leesville Lake, producing power. In times of low demand, the generators are used as pumps to reverse the flow and return the water to Smith Mountain Lake. This takes advantage of the more or less constant output of steam generation plants in off-peak periods. In its partnership role with Smith Mountain Lake generating power, Leesville Lake has a maximum refill rate of per hour and a maximum drawdown rate of per hour. Normal fluctuation consists of on average with an absolute maximum of , allowing Leesville Lake to avoid the drastic drawdowns of other area lakes. Recreation and development Since the 1960s, the area around Leesville Lake has remained relatively rural and remote with mostly corn, tobacco, small family farms and other agriculture. The limited early residential developments around the lake consisted largely of family farms. Since about 2004, however, residential growth has begun to expand rather quickly and lakefront homes and communities now dot the shoreline. Boat traffic on the lake remains low relative to nearby Smith Mountain Lake, Kerr Lake and Lake Gaston. Leesville Lake is becoming a popular recreational area. Fishing is very popular, especially for striped bass. The state record striped bass was caught out of Leesville Lake in 2000. Boating, water skiing, wakeboarding, and riding personal watercraft are also common activities. Access to Leesville Lake is primarily by way of U.S. Route 29, although State Route 43 and State Route 40 provide access to the north and south sides of the lake, respectively. References External links The Leesville Lake Association website Leesville Lake VA SML website SML Dam website Bodies of water of Bedford County, Virginia Bodies of water of Pittsylvania County, Virginia Reservoirs in Virginia Bodies of water of Campbell County, Virginia Roanoke River
Dowdeman (, also Romanized as Dowdemān; also known as Dowdehān) is a village in Kuhestan Rural District, Rostaq District, Darab County, Fars Province, Iran. At the 2006 census, its population was 19, in 4 families. References Populated places in Darab County
Nucetu may refer to several villages in Romania: Nucetu, a village in Lupșanu Commune, Călărași County Nucetu, a village in Negomir Commune, Gorj County
Nicholas Zsámboki was a palatine of the Kingdom of Hungary in the 14th century. He was appointed in 1342. He left his position in 1356 to hand it over to Nicholas Kont, who married his daughter Klara. References 14th-century Hungarian people Medieval Croatian nobility Medieval Hungarian nobility Palatines of Hungary
```java /* * * This file is part of LibreTorrent. * * LibreTorrent is free software: you can redistribute it and/or modify * (at your option) any later version. * * LibreTorrent is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * along with LibreTorrent. If not, see <path_to_url */ package org.proninyaroslav.libretorrent.service; import android.content.Context; import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; import androidx.work.Data; import androidx.work.OneTimeWorkRequest; import androidx.work.WorkManager; import androidx.work.Worker; import androidx.work.WorkerParameters; import org.proninyaroslav.libretorrent.core.FeedParser; import org.proninyaroslav.libretorrent.core.RepositoryHelper; import org.proninyaroslav.libretorrent.core.model.data.entity.FeedChannel; import org.proninyaroslav.libretorrent.core.model.data.entity.FeedItem; import org.proninyaroslav.libretorrent.core.settings.SettingsRepository; import org.proninyaroslav.libretorrent.core.storage.FeedRepository; import org.proninyaroslav.libretorrent.core.utils.Utils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; /* * The worker for fetching items from RSS/Atom channels. */ public class FeedFetcherWorker extends Worker { private static final String TAG = FeedFetcherWorker.class.getSimpleName(); public static final String ACTION_FETCH_CHANNEL = "org.proninyaroslav.libretorrent.service.FeedFetcherWorker.ACTION_FETCH_CHANNEL"; public static final String ACTION_FETCH_CHANNEL_LIST = "org.proninyaroslav.libretorrent.service.FeedFetcherWorker.ACTION_FETCH_CHANNEL_LIST"; public static final String ACTION_FETCH_ALL_CHANNELS = "org.proninyaroslav.libretorrent.service.FeedFetcherWorker.ACTION_FETCH_ALL_CHANNELS"; public static final String TAG_ACTION = "action"; public static final String TAG_NO_AUTO_DOWNLOAD = "no_download"; public static final String TAG_CHANNEL_ID = "channel_url_id"; public static final String TAG_CHANNEL_ID_LIST = "channel_id_list"; private Context context; private FeedRepository repo; private SettingsRepository pref; public FeedFetcherWorker(@NonNull Context context, @NonNull WorkerParameters params) { super(context, params); } @NonNull @Override public Result doWork() { context = getApplicationContext(); repo = RepositoryHelper.getFeedRepository(context); pref = RepositoryHelper.getSettingsRepository(context); long keepTime = pref.feedItemKeepTime(); long keepDateBorderTime = (keepTime > 0 ? System.currentTimeMillis() - keepTime : 0); deleteOldItems(keepDateBorderTime); Data data = getInputData(); String action = data.getString(TAG_ACTION); boolean noAutoDownload = data.getBoolean(TAG_NO_AUTO_DOWNLOAD, false); if (action == null) return Result.failure(); switch (action) { case ACTION_FETCH_CHANNEL: return fetchChannel(data.getLong(TAG_CHANNEL_ID, -1), keepDateBorderTime, noAutoDownload); case ACTION_FETCH_CHANNEL_LIST: return fetchChannelsByUrl(data.getLongArray(TAG_CHANNEL_ID_LIST), keepDateBorderTime, noAutoDownload); case ACTION_FETCH_ALL_CHANNELS: return fetchChannels(repo.getAllFeeds(), keepDateBorderTime, noAutoDownload); default: return Result.failure(); } } private Result fetchChannelsByUrl(long[] ids, long acceptMinDate, boolean noAutoDownload) { if (ids == null) return Result.failure(); ArrayList<Result> results = new ArrayList<>(); for (long id : ids) results.add(fetchChannel(id, acceptMinDate, noAutoDownload)); for (Result result : results) if (result instanceof Result.Failure) return result; return Result.success(); } private Result fetchChannels(List<FeedChannel> channels, long acceptMinDate, boolean noAutoDownload) { if (channels == null) return Result.failure(); ArrayList<Result> results = new ArrayList<>(); for (FeedChannel channel : channels) { if (channel == null) continue; results.add(fetchChannel(channel.id, acceptMinDate, noAutoDownload)); } for (Result result : results) if (result instanceof Result.Failure) return result; return Result.success(); } private Result fetchChannel(long id, long acceptMinDate, boolean noAutoDownload) { if (id == -1) return Result.failure(); FeedChannel channel = repo.getFeedById(id); if (channel == null) return Result.failure(); FeedParser parser; try { parser = new FeedParser(getApplicationContext(), channel); } catch (Exception e) { channel.fetchError = e.getMessage(); repo.updateFeed(channel); return Result.failure(); } List<FeedItem> items = parser.getItems(); filterItems(id, items, acceptMinDate); if (pref.feedRemoveDuplicates()) filterItemDuplicates(items); repo.addItems(items); channel.fetchError = null; if (TextUtils.isEmpty(channel.name)) { channel.name = parser.getTitle(); if (TextUtils.isEmpty(channel.name)) channel.name = channel.url; } channel.lastUpdate = System.currentTimeMillis(); repo.updateFeed(channel); if (!noAutoDownload && channel.autoDownload) sendFetchedItems(channel, items); return Result.success(); } private void filterItems(long id, List<FeedItem> items, long acceptMinDate) { List<String> existingItemsId = repo.getItemsIdByFeedId(id); /* Also filtering the items that we already have in db */ items.removeIf(item -> item != null && (item.pubDate > 0 && item.pubDate <= acceptMinDate || existingItemsId.contains(item.id))); } private void filterItemDuplicates(List<FeedItem> items) { List<String> titles = new ArrayList<>(); for (FeedItem item : items) titles.add(item.title); List<String> existingTitles = repo.findItemsExistingTitles(titles); items.removeIf(item -> item != null && existingTitles.contains(item.title)); } private void deleteOldItems(long keepDateBorderTime) { if (keepDateBorderTime > 0) repo.deleteItemsOlderThan(keepDateBorderTime); } private void sendFetchedItems(FeedChannel channel, List<FeedItem> items) { ArrayList<String> ids = new ArrayList<>(); for (FeedItem item : items) { if (item == null || item.read) continue; if (isMatch(item, channel.filter, channel.isRegexFilter)) { ids.add(item.id); repo.markAsRead(item.id); } } if (ids.isEmpty()) return; Data data = new Data.Builder() .putString(FeedDownloaderWorker.TAG_ACTION, FeedDownloaderWorker.ACTION_DOWNLOAD_TORRENT_LIST) .putStringArray(FeedDownloaderWorker.TAG_ITEM_ID_LIST, ids.toArray(new String[0])) .build(); OneTimeWorkRequest work = new OneTimeWorkRequest.Builder(FeedDownloaderWorker.class) .setInputData(data) .build(); WorkManager.getInstance(context).enqueue(work); } private boolean isMatch(FeedItem item, String filters, boolean isRegex) { if (filters == null || TextUtils.isEmpty(filters)) return true; for (String filter : filters.split(Utils.NEWLINE_PATTERN)) { if (TextUtils.isEmpty(filter)) continue; if (isRegex) { Pattern pattern; try { pattern = Pattern.compile(filter); } catch (PatternSyntaxException e) { /* TODO: maybe there is an option better? */ Log.e(TAG, "Invalid pattern: " + filter); return true; } return pattern.matcher(item.title).matches(); } else { String[] words = filter.split(repo.getFilterSeparator()); for (String word : words) if (item.title.toLowerCase().contains(word.toLowerCase().trim())) return true; } } return false; } } ```
```java package org.schemaspy.view; import java.util.Collection; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import org.schemaspy.cli.NoRowsConfigCli; import org.schemaspy.cli.TemplateDirectoryConfigCli; import org.schemaspy.model.Table; import org.schemaspy.util.markup.Asciidoc; import org.schemaspy.util.markup.Markdown; import org.schemaspy.util.markup.Markup; import org.schemaspy.util.markup.MarkupFromString; import org.schemaspy.util.markup.PageRegistry; import org.schemaspy.util.markup.WithReferenceLinks; @Parameters(resourceBundle = "htmlconfigcli") public class HtmlConfigCli implements HtmlConfig { @Parameter( names = { "-desc", "--description", "schemaspy.desc", "schemaspy.description" }, descriptionKey = "desc" ) private String description; @Parameter( names = { "-nopages", "--no-pages", "schemaspy.nopages", "schemaspy.no-pages" }, descriptionKey = "nopages" ) private boolean noPages = false; @Parameter( names = { "-asciidoc", "--asciidoc", "schemaspy.asciidoc" }, descriptionKey = "asciidoc" ) private boolean useAsciiDoc = false; private final NoRowsConfigCli noRowsConfigCli; private final TemplateDirectoryConfigCli templateDirectoryConfigCli; private final PageRegistry pageRegistry = new PageRegistry(); public HtmlConfigCli( NoRowsConfigCli noRowsConfigCli, TemplateDirectoryConfigCli templateDirectoryConfigCli ) { this.noRowsConfigCli = noRowsConfigCli; this.templateDirectoryConfigCli = templateDirectoryConfigCli; } @Override public String getDescription() { return description; } @Override public String getTemplateDirectory() { return templateDirectoryConfigCli.getTemplateDirectory(); } @Override public boolean isPaginationEnabled() { return !noPages; } @Override public boolean isNumRowsEnabled() { return noRowsConfigCli.isNumRowsEnabled(); } @Override public void registryPage(final Collection<Table> tables) { pageRegistry.register(tables); } @Override public Markup markupProcessor(final String markupText, final String rootPath) { if (useAsciiDoc) { return new Asciidoc( new WithReferenceLinks( new MarkupFromString(markupText), pageRegistry, rootPath, Asciidoc.LINK_FORMAT ) ); } else { return new Markdown( new WithReferenceLinks( new MarkupFromString(markupText), pageRegistry, rootPath, Markdown.LINK_FORMAT ) ); } } } ```
CoRoT-8 is a star in the constellation Aquila at a distance of about 1239 light-years from us. At least one planet revolves around the star. CoRoT-8 is an orange dwarf which has 0.88 solar masses and 0.77 solar radius. By astronomical standards, this is already a rather young star compared to the Sun: its age is about 3 billion years. It got its name in honor of the CoRoT space telescope, with the help of which its planetary companion was discovered. In 2010, a group of astronomers working within the CoRoT program announced the discovery of the planet CoRoT-8b in this system. It is a hot gas giant, similar in mass and size to Saturn. The planet orbits at a distance of about 0.06 AU. e. from the parent star, while making a complete revolution in 6.21 days. References Aquila (constellation) K-type main-sequence stars
The 1st Army Corps () was first formed before World War I. During World War II it fought in the Campaign for France in 1940, on the Mediterranean islands of Corsica and Elba in 1943 - 1944 and in the campaigns to liberate France in 1944 and invade Germany in 1945. World War I The Corps saw service throughout the entirety of World War I. During the Battles of St. Quentin and Guise, the 1st Corps forced Karl von Bülow's German Second Army into retreat in what historian Stuart Robson called "the last old-style Napoleonic infantry charge in history." This forced Alexander von Kluck to divert his First Army as a reinforcement, preventing the Imperial German Army from encircling Paris and overrunning France under the Schlieffen Plan. The Corps participated in the Battle of Passchendaele as part of the French First Army. At the time, the Corps comprised the 1st, 2nd, 51st and 162nd Infantry Divisions. Its troops came from the 1st military region of the Metropolitan Army, which covered the départements of Nord & Pas-de-Calais. Commanders in WW I 20 November 1913 : général Franchet d'Espérey 3 September 1914 : Général Deligny 25 February 1915 : général Guillaumat 17 December 1916 : Général de Riols de Fonclare 25 January 1917 : Général Muteau 19 April 1917 : Général Lacapelle 11 February 1919 : Général Nollet World War II 1940 Campaign 1st Army Corps was constituted on August 27, 1939, in Lille under the command of Major General Sciard as part of the French mobilization for war. Initially assigned as part of the French First Army, the corps was transferred to the French Seventh Army and moved to coastal regions near Calais and Dunkerque by mid-November 1939. On May 10, 1940, the Corps commanded the 25th Motorised Infantry Division (25e DIM) in addition to its organic units. With the German invasion violating the neutrality of Belgium and the Netherlands on May 10, 1940, the 1st Army Corps moved into Belgium with the goal of gaining contact with the Dutch Army. This was achieved on May 12 near Breda, but the general failure of the Allies to hold the German advance mandated early retreats so that the 1st Army Corps would not be cut off. Breda fell to the Germans on May 13 and the corps conducted a fighting withdrawal through Dorp and Wuustwezel to the fortified zone of Antwerp, Belgium. During May 15–17, the corps defended the Scheldt Estuary with the 60th and 21st Infantry Divisions (60e DI and 21e DI), but was ordered to retreat back into France on May 18. The period from May 19–26 saw the corps falling back to the line of the river Somme, where the French Army intended to make a major stand. Because of German advances, the 1st Army Corps had to deploy its divisional reconnaissance units to cover positions on the river that the slower-moving infantry divisions (4th Colonial Infantry Division - 4e DIC, 7th North African Infantry Division - 7e DINA, and the 19e DI) could then occupy. This required combat with the Germans, but the corps reached positions near Le Hamel, Aubigny, and along the road between Amiens and Saint-Quentin. During May 24–25, troops of the corps seized and lost Aubigny twice. The Germans, however, had held onto a large bridgehead at Peronne. The Germans broke out of this bridgehead on June 5, 1940, and continued their advance into the heart of France. A counterattack by armored elements of the corps on June 6 was halted by the Germans. From June 9, the corps was involved in a succession of withdrawals that were meant to form lines of defense along the rivers Avre, Oise, Nonette, Seine, and Loire. The crossing of the Oise River was made under German air attack, some bridges were destroyed by the Luftwaffe, and portions of the corps' infantry had to surrender north of the Oise. After the Germans crossed the Loire on June 18, the 19e DI of the corps was largely destroyed near La Ferté. This was followed by capture of the bulk of the infantry of the 29th (29e DI) and 47th Infantry Divisions (47e DI) on June 19 near Lamotte-Beuvron. The final week of the campaign was a constant retreat for the remnants of the corps, with elements crossing the river Dordogne near Bergerac on June 24, 1940. The following day, an armistice was declared and the corps assembled in the region of Miallet and Thiviers. On July 1, Brigadier General Trancart assumed command of the corps. The 1st Army Corps was demobilized on July 10, 1940. Corsica 1943 The 1st Army Corps was reconstituted on August 16, 1943, in Ain-Taya, French Algeria. Now commanded by Lieutenant General Martin the primary combat units of the corps were provided American equipment and weapons as part of the rearmament of the French Army of Africa. During the Allied invasion of Italy the 1st Army Corps, comprising Headquarters, 4th Moroccan Mountain Division (4e DMM), the 1st Regiment of Moroccan Tirailleurs (1er RTM), the 4th Regiment of Moroccan Spahis (4e RSM) (light tank), the 2nd Group of Moroccan Tabors (2e GTM), the Commandos de Choc battalion and the 3rd Battalion, 69th Mountain Artillery Regiment (69e RAM), landed on Fascist-occupied Corsica in the same month. To the south, the German 90. Panzergrenadier-Division and the Reichsführer-SS assault infantry brigade were evacuating Sardinia and landing on the southern coast of Corsica. Wishing to cut off the German troops, and informed on September 10, 1943, that the Royal Italian Army troops on Corsica were willing to fight on the side of the Allies, the French launched Operation Vésuve and landed elements of the 1st Army Corps at Ajaccio on September 13, meeting Corsican partisans who also wanted enemy troops off the island. German General Fridolin von Senger und Etterlin hoped to obtain reinforcements with which to hold the island. After the Germans began disarming Italian soldiers, General Magli of the Italian Army ordered Italian forces to consider the Germans as an enemy rather than as allies. Thereafter, Italian units on the island cooperated with the French forces. Surprising the Italian Friuli Division in the northern port of Bastia on the night of September 13, 1943, the SS troops took 2,000 Italian prisoners and secured the port from which the Germans could evacuate their forces. Although supported by the Royal Navy, the French were unable to land forces quickly enough on Corsica to prevent the bulk of the German troops from reaching their exit ports on the east coast of the island. The final combat took place around Bastia, with the island secured by French forces on October 4, 1943. The bulk of the German forces, however, had made good their escape. The Germans took 700 casualties and lost 350 men to POW camps. The Italians lost 800 men in the fighting (mostly Friuli Division troops), and the French had 75 killed, 12 missing, and 239 wounded. From October 1943 until May 1944, the 1st Army Corps defended Corsica, conducted training, and moved units between Corsica and North Africa. On April 18, 1944, the 1st Army Corps was subordinated to General de Lattre's Armée B. Elba 1944 Following the liberation of Corsica, the French proposed to invade the island of Elba, possession of which would allow the Allies to dominate by gunfire ships in the Piombino Channel and vehicles on the coastal road of the Italian Peninsula, both transportation arteries essential to the supply of German Wehrmacht forces in western Italy. Initially, the proposal was denied by General Eisenhower, who considered it a dispersal of resources while the planning for the Anzio landings was underway. After British General Sir Henry Maitland Wilson took over the Mediterranean Theater, however, attitudes at Allied headquarters changed and the operation was approved. By this time, though, the Germans had strongly fortified Elba, an island dominated by rugged terrain in any case, making the assault considerably more difficult. At 0400 hours on June 17, 1944, the 1st Army Corps assaulted Elba in Operation Brassard. French forces comprised the 9th Colonial Infantry Division (9e DIC), two battalions of French commandos (Commandos d'Afrique and Commandos de Choc), a battalion and supplementary battery of the Colonial Artillery Regiment of Morocco (R.A.C.M.) and the 2nd Group of Moroccan Tabors (2e GTM), in addition to 48 men from "A" and "O" commandos of the Royal Navy. French Choc (lightly armed fighters who had the mission of operating behind enemy lines) units landed at multiple points before the main landing force and neutralized coastal artillery batteries. Landing in the Gulf of Campo on the south coast, the French initially ran into difficulties because of the German fortifications and extremely rugged terrain that ringed the landing area. Falling back on an alternate plan, the landing beach was shifted to the east, near Nercio, and here the troops of the 9th Colonial Infantry Division seized a viable beachhead. Within two hours, French commandos reached the crest of the 400-meter Monte Tambone Ridge overlooking the landing areas. The RN commandos boarded and seized the German Flak ship Köln and also landed to guide in other troops headed for the beaches, but a massive blast from a German demolition charge killed 38 of their men. Portoferraio was taken by the 9th Division on June 18 and the island was largely secured by the following day. Fighting in the hills between the Germans and the Senegalese colonial infantry was vicious, with the Senegalese employing flamethrowers to clear entrenched German troops. The Germans defended Elba with two infantry battalions, fortified coastal areas, and several coastal artillery batteries totaling some 60 guns of medium and heavy caliber. In the fighting, the French seized the island, killing 500 German and Italian defenders, and taking 1,995 of them prisoner. French losses were 252 killed and missing, and 635 men wounded in action, while the British lost 38 of their 48 commandos, with nine others wounded by the blast of the demolition charge. France 1944 Following the successful Operation Dragoon landings in southern France, the headquarters of the 1st Army Corps was assembled at Aix, France on September 1, 1944, to command troops as a subordinate corps of the French First Army. 1st Army Corps was now under the command of Lieutenant General Émile Béthouart, a veteran of the 1940 campaign in Norway and an officer who had actively assisted the Allied landings in French North Africa in November 1942. For the remainder of the war in Europe, many French divisions would be subordinated to 1st Army Corps, but the divisions that spent the most time with the corps were the 2nd Moroccan Infantry Division (2e DIM), the 9th Colonial Infantry Division (9e DIC), the 4th Moroccan Mountain Division (4e DMM), and the 1st Armoured Division (1re DB). 1st Army Corps drove north along the east bank of the river Rhône, but the push lacked strength as the 4e DMM was still deploying to France (and would be further engaged securing the alpine frontier with Italy for several months) and the 1re DB was still assembling in southern France. In mid-September, the corps secured the Lomont Mountains, a range about long running from the river Doubs to the Swiss border. German resistance was spotty in September, but rapidly coalesced in front of the Belfort Gap, a corridor of relatively flat terrain that lies between the Vosges and Jura mountains on the Swiss frontier, and a gateway to the river Rhine. Operating with one division and experiencing the same logistics problems as other Allied units in Europe, the advance of the 1st Army Corps was slowed in front of the Belfort Gap by the German 11. Panzer-Division. Compounding the distance that supplies had to travel from the ports in southern France were the north–south railway lines with destroyed bridges and sections of track. Early October 1944 also saw the unseasonably early arrival of cold and wet weather more characteristic of November. All of these factors served to force a halt to the 1st Army Corps' advance in October while the corps improved its supply situations and resolved manpower issues caused by the French high command's decision to rotate the Senegalese troops to the south and replace them with French Forces of the Interior manpower. The supply situation had improved by early November, coinciding with orders from General Eisenhower, now in charge of all Allied forces in northwestern Europe, directing a general offensive all along the Western Front. Believing that the relative inactivity of 1st Army Corps meant the corps was digging in for the winter, the Germans reduced their forces in the Belfort Gap to a single, not-at-full strength infantry division. The 1st Army Corps launched their attack to force the Belfort Gap on November 13, 1944. By a stroke of fate, the French attack caught the German division commander near the front lines, who perished under a hail of Moroccan gunfire. The same attack narrowly missed capturing the commander of the German IV. Luftwaffen-Feldkorps. Although desperate German troops formed islands of resistance, most notably at the fortified city of Belfort, troops of the 2e DIM, 9e DIC, and the 1re DB pushed through gaps in the German lines, disrupting their defense and keeping the battle mobile. French tanks moved through the Belfort Gap and reached the Rhine at Huningue on November 19. The battle cut off the German 308. Grenadier-Regiment on November 24, forcing the German troops to either surrender or intern themselves in Switzerland. On November 25, 1st Army Corps units liberated both Mulhouse (taken by a surprise armored drive) and Belfort (taken by assault of the 2e DIM). Realizing the German defense had been too static for their own good, General De Lattre (commander of the French First Army) directed both corps of his army to close on Burnhaupt in order to encircle the German LXIII. Armeekorps (the former IV. Luftwaffe Korps). This maneuver succeeded on November 28, 1944, and resulted in the capture of over 10,000 German troops, crippling the LXIII. Armeekorps. French losses, however, had also been significant, and plans to immediately clear the Alsatian Plain of German forces had to be shelved while both sides gathered strength for the next battles. The November offensives of the French First Army and the U.S. Seventh Army had collapsed the German presence in Alsace to a roughly circular pocket around the town of Colmar on the Alsatian Plain. This Colmar Pocket contained the German 19. Armee. As the southernmost corps of Allied forces in northwestern Europe, the French 1st Army Corps now faced the Rhine at Huningue and held Mulhouse and the southern boundary of the Colmar Pocket. A French offensive in mid-December designed to collapse the Colmar Pocket failed for lack of offensive power and the requirement to cover more of the Allied front line as U.S. units were shifted north in response to the Ardennes Offensive. On January 1, 1945, the Germans launched Operation Nordwind, an offensive with the goal of recapturing Alsace. After the U.S. Seventh and French First Armies had held and turned back this offensive, the Allies were ready to reduce the Colmar Pocket once and for all. The 1st Army Corps led the attack against the Colmar Pocket on January 20, 1945. Fighting in woodlands and dense urban areas, the 1st Army Corps' attack stalled after the first day, meeting a German defense in depth and attracting German 19. Armee reinforcements. By the end of the month, however, other attacks by U.S. and French forces against the Colmar Pocket had forced the Germans to redistribute their troops, and an early February attack by the 1st Army Corps moved north through weak German resistance, reaching the bridge over the Rhine at Chalampé and making contact with the U.S. XXI Corps at Rouffach, south of Colmar. The final German forces in the 1st Army Corps' area retreated over the Rhine into Baden on February 9, 1945. Thereafter, the thrust of the Allied offensive moved to the north, and the 1st Army Corps was assigned the defense of the Rhine from the area south of Strasbourg to the Swiss frontier until mid-April 1945. Germany 1945 On April 15, 1st Army Corps was given the mission of crossing the Rhine, traversing the Black Forest, and sweeping South Baden of German Army troops. The 4e DMM drove directly on Freudenstadt, an important Black Forest road junction, capturing it on April 17, 1945. The 9e DIC, crossing the Rhine north of Karlsruhe, raced south along the east bank of the Rhine and then swung east, paralleling the course of the Swiss frontier. From Freudenstadt, the 4e DMM turned south and met the 9e DIC near Döggingen on April 29, cutting off the German XVIII. SS-Armeekorps in the Black Forest. Frantic attempts at escape by the encircled German troops came to naught among French roadblocks and the formidable terrain of the forest, and they were left no options save death or surrender. From Freudenstadt, elements of the 1re DB pushed east and south, capturing Ulm on April 24, and then pushed south again with elements of the 2e DIM into the Alps, crossing into Austria and marching into Sankt-Anton on May 7, 1945. Elements of the 5e DB and the 4e DMM drove southeast along the north shore of Lake Constance, capturing Bregenz and then turning east toward Sankt-Anton. The following day was VE Day, ending Allied military operations in Europe. During the course of its operations in France and Germany in 1944 - 1945, the 1st Army Corps lost 3,518 men killed, 13,339 wounded, and 1,449 missing, for a total of 18,306 casualties. Although not all casualties inflicted on the Germans by 1st Army Corps are known, the corps is credited with taking 101,556 Germans prisoner during the campaigns to liberate France and invade Germany. Commanders in WW II 2 September 1939 - 2 July 1940 : Général Sciard 2–10 July 1940 : Général Trancart . 30 August 1943 - 10 August 1944 : Général Martin 10 August 1944 - 8 July 1945 : Général Béthouart 1 September 1945 - 6 June 1946 : Général Sevez Postwar After VE Day, the 1st Army Corps occupied Baden along with parts of Württemberg and Austria as the French occupation zone in Germany, with corps headquarters initially in Ravensburg. On July 16, 1945, the 1st Army Corps was renamed "Army Corps of the South" (). General Béthouart became the commander of French forces in Austria and the High Commissioner for France in Austria until 1950. 1st Army Corps was inactivated on April 30, 1946. It was reformed later during the Cold War, with corps headquarters being at Nancy in 1970. In 1977, the corps was fused with the 6th Military Region, and the artillery commandant took up quarters in the Chateau of Mercy (Ars-Laquenexy). Genérals Faverdin, Bonmati, D'HULST, BARASCUD, MARTINIE and DELISSNYDER succeeded him there. However, by 1984 the corps headquarters and military region HQ had been split again. From circa 1965 to 1978 it included the 8th Division (with 4th and 14th Brigades) until the 8th Division, later the 8th Armoured Division, was disestablished in the small divisions reorganisation of the late 1970s. In 1989 it had its HQ at Metz with the 1st Armoured Division at Trier (Germany), the 7th Armoured Division at Besançon, 12th Light Armoured Division at Saumur, and the 14th Light Armoured Division at Montpellier. The headquarters staff of the 12e Division légère blindée was to be mobilized in time of war from the Armoured and Cavalry Branch Training School headquarters in Saumur. The corps was again disbanded in 1990, seemingly on 1 July 1990. References Citations Sources L'Armée de la Victoire (Four volumes). Paul Gaugac. , Paris: Charles Lavauzelle, 1985. Guerre 1939 - 1945. Les Grandes Unités Françaises (Volumes I, IV, V-I, and V-III). Armée de Terre, Service Historique. Paris: Imprimerie Nationale, 1976. The History of the French First Army. Jean de Lattre de Tassigny. London: George Allen and Unwin Ltd, 1952. History of the Great War - Military Operations: France and Belgium, 1917, Volume II. J. E. Edmonds, 1948 Riviera to the Rhine (U.S. Army in World War II Series). Jeffrey J. Clarke and Robert Ross Smith. Washington: Government Printing Office, 1993. Biographical data for World War II Generals 001 Military units and formations established in 1939 Military units and formations disestablished in 1990 1939 establishments in France Corps of France
George Leach (18 July 1881 – 10 January 1945) was an English cricketer active from 1903 to 1914 who played for Sussex. He was born in Malta and died in Rawtenstall. He appeared in 226 first-class matches as a righthanded batsman who bowled right arm fast. He scored 5,870 runs with a highest score of 113 not out and took 413 wickets with a best performance of eight for 48. George Leach was a summer cricketer for Sussex and played for both Tottenham Hotspurs and Brighton & Hove Albion in the early 1900s as a centre forward. Having joined from Hailsham Leach played at Brighton & Hove Albion for a short while before joining Spurs in 1905, coming in to add some physical presence, but only made the team on seven occasions (two in the Southern League and five in the Western League) in his first season scoring 3 goals and then failed to make the first eleven appearances again in a senior game. The rest of his appearances were in friendlies. It was unsurprising that without much opportunity to play, Tottenham released him in April 1907 and he later re-signed with the Seagulls. A useful right hand batsman and a right arm fast bowler, George represented Sussex at county cricket with distinction between 1903 and 1912, playing 226 matches and scoring runs at an average of 18.93, while taking over 400 wickets at an average of 27.94.  In 1917, he was selected for Captain Harwood's England XI. George Leach died in Rowtenstall, Lancashire on 10 January 1945. Notes 1881 births 1945 deaths English cricketers Sussex cricketers Non-international England cricketers
Eutropiichthys vacha is a species of schilbid catfish native to India, Nepal, Bhutan, and Bangladesh. It can reach a length of 34 cm, and a mass of 1.35 kg. Eutropiichthys vacha is a climate sensitive species that may be selected as a target species for climate change impact studies. Region-specific adaptation was noticed in breeding phenology of this schilbid catfish in River Ganga, based on local trends of warming climate. A threshold water temperature around 24 °C and rainfall of > 100 mm were found to be necessary for attainment of breeding GSI (> 3.5 units) in E. vacha. It appears that warming climate may have the most profound effect on gonad maturation and spawning in E. vacha. References Schilbeidae Fish of Asia Taxa named by Francis Buchanan-Hamilton Fish described in 1822
```c++ /* * * This program is free software: you can redistribute it and/or modify * the Free Software Foundation, either version 2 or (at your option) * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * along with this program. If not, see <path_to_url */ #include "AutoTypeMatchModel.h" #include <QFont> #include "core/Entry.h" #include "core/Global.h" #include "core/Group.h" #include "core/Metadata.h" #include "gui/DatabaseIcons.h" #include "gui/Icons.h" AutoTypeMatchModel::AutoTypeMatchModel(QObject* parent) : QAbstractTableModel(parent) { } AutoTypeMatch AutoTypeMatchModel::matchFromIndex(const QModelIndex& index) const { Q_ASSERT(index.isValid() && index.row() < m_matches.size()); return m_matches.at(index.row()); } QModelIndex AutoTypeMatchModel::indexFromMatch(const AutoTypeMatch& match) const { int row = m_matches.indexOf(match); Q_ASSERT(row != -1); return index(row, 1); } QModelIndex AutoTypeMatchModel::closestIndexFromMatch(const AutoTypeMatch& match) const { int row = -1; for (int i = m_matches.size() - 1; i >= 0; --i) { const auto& currentMatch = m_matches.at(i); if (currentMatch.first == match.first) { row = i; if (currentMatch.second == match.second) { break; } } } return (row > -1) ? index(row, 1) : QModelIndex(); } void AutoTypeMatchModel::setMatchList(const QList<AutoTypeMatch>& matches) { beginResetModel(); severConnections(); m_allGroups.clear(); m_matches = matches; QSet<Database*> databases; for (AutoTypeMatch& match : m_matches) { databases.insert(match.first->group()->database()); } for (Database* db : asConst(databases)) { Q_ASSERT(db); for (const Group* group : db->rootGroup()->groupsRecursive(true)) { m_allGroups.append(group); } if (db->metadata()->recycleBin()) { m_allGroups.removeOne(db->metadata()->recycleBin()); } } for (const Group* group : asConst(m_allGroups)) { makeConnections(group); } endResetModel(); } int AutoTypeMatchModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } return m_matches.size(); } int AutoTypeMatchModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent); return 4; } QVariant AutoTypeMatchModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { return {}; } AutoTypeMatch match = matchFromIndex(index); if (role == Qt::DisplayRole) { switch (index.column()) { case ParentGroup: if (match.first->group()) { return match.first->group()->name(); } break; case Title: return match.first->resolveMultiplePlaceholders(match.first->title()); case Username: return match.first->resolveMultiplePlaceholders(match.first->username()); case Sequence: return match.second; } } else if (role == Qt::DecorationRole) { switch (index.column()) { case ParentGroup: if (match.first->group()) { return Icons::groupIconPixmap(match.first->group()); } break; case Title: return Icons::entryIconPixmap(match.first); } } else if (role == Qt::FontRole) { QFont font; if (match.first->isExpired()) { font.setStrikeOut(true); } return font; } return {}; } QVariant AutoTypeMatchModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { case ParentGroup: return tr("Group"); case Title: return tr("Title"); case Username: return tr("Username"); case Sequence: return tr("Sequence"); } } return {}; } void AutoTypeMatchModel::entryDataChanged(Entry* entry) { for (int row = 0; row < m_matches.size(); ++row) { AutoTypeMatch match = m_matches[row]; if (match.first == entry) { emit dataChanged(index(row, 0), index(row, columnCount() - 1)); } } } void AutoTypeMatchModel::entryAboutToRemove(Entry* entry) { for (int row = 0; row < m_matches.size(); ++row) { AutoTypeMatch match = m_matches[row]; if (match.first == entry) { beginRemoveRows(QModelIndex(), row, row); m_matches.removeAt(row); endRemoveRows(); --row; } } } void AutoTypeMatchModel::entryRemoved() { } void AutoTypeMatchModel::severConnections() { for (const Group* group : asConst(m_allGroups)) { disconnect(group, nullptr, this, nullptr); } } void AutoTypeMatchModel::makeConnections(const Group* group) { connect(group, SIGNAL(entryAboutToRemove(Entry*)), SLOT(entryAboutToRemove(Entry*))); connect(group, SIGNAL(entryRemoved(Entry*)), SLOT(entryRemoved())); connect(group, SIGNAL(entryDataChanged(Entry*)), SLOT(entryDataChanged(Entry*))); } ```
```xml import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { BehaviorSubject, Subject, switchMap, takeUntil, tap } from "rxjs"; import { SafeProvider, safeProvider } from "@bitwarden/angular/platform/utils/safe-provider"; import { OrganizationAuthRequestApiService } from "@bitwarden/bit-common/admin-console/auth-requests/organization-auth-request-api.service"; import { OrganizationAuthRequestService } from "@bitwarden/bit-common/admin-console/auth-requests/organization-auth-request.service"; import { PendingAuthRequestView } from "@bitwarden/bit-common/admin-console/auth-requests/pending-auth-request.view"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { TableDataSource, NoItemsModule } from "@bitwarden/components"; import { Devices } from "@bitwarden/web-vault/app/admin-console/icons"; import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared"; import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module"; @Component({ selector: "app-org-device-approvals", templateUrl: "./device-approvals.component.html", standalone: true, providers: [ safeProvider({ provide: OrganizationAuthRequestApiService, deps: [ApiService], }), safeProvider({ provide: OrganizationAuthRequestService, deps: [OrganizationAuthRequestApiService, CryptoService, OrganizationUserService], }), ] satisfies SafeProvider[], imports: [SharedModule, NoItemsModule, LooseComponentsModule], }) export class DeviceApprovalsComponent implements OnInit, OnDestroy { tableDataSource = new TableDataSource<PendingAuthRequestView>(); organizationId: string; loading = true; actionInProgress = false; protected readonly Devices = Devices; private destroy$ = new Subject<void>(); private refresh$ = new BehaviorSubject<void>(null); constructor( private organizationAuthRequestService: OrganizationAuthRequestService, private route: ActivatedRoute, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, private logService: LogService, private validationService: ValidationService, private configService: ConfigService, ) {} async ngOnInit() { this.route.params .pipe( tap((params) => (this.organizationId = params.organizationId)), switchMap(() => this.refresh$.pipe( tap(() => (this.loading = true)), switchMap(() => this.organizationAuthRequestService.listPendingRequests(this.organizationId), ), ), ), takeUntil(this.destroy$), ) .subscribe((r) => { this.tableDataSource.data = r; this.loading = false; }); } async approveRequest(authRequest: PendingAuthRequestView) { await this.performAsyncAction(async () => { try { await this.organizationAuthRequestService.approvePendingRequest( this.organizationId, authRequest, ); this.platformUtilsService.showToast( "success", null, this.i18nService.t("loginRequestApproved"), ); } catch (error) { this.platformUtilsService.showToast( "error", null, this.i18nService.t("resetPasswordDetailsError"), ); } }); } async approveAllRequests() { if (this.tableDataSource.data.length === 0) { return; } await this.performAsyncAction(async () => { await this.organizationAuthRequestService.approvePendingRequests( this.organizationId, this.tableDataSource.data, ); this.platformUtilsService.showToast( "success", null, this.i18nService.t("allLoginRequestsApproved"), ); }); } async denyRequest(requestId: string) { await this.performAsyncAction(async () => { await this.organizationAuthRequestService.denyPendingRequests(this.organizationId, requestId); this.platformUtilsService.showToast("error", null, this.i18nService.t("loginRequestDenied")); }); } async denyAllRequests() { if (this.tableDataSource.data.length === 0) { return; } await this.performAsyncAction(async () => { await this.organizationAuthRequestService.denyPendingRequests( this.organizationId, ...this.tableDataSource.data.map((r) => r.id), ); this.platformUtilsService.showToast( "error", null, this.i18nService.t("allLoginRequestsDenied"), ); }); } private async performAsyncAction(action: () => Promise<void>) { if (this.actionInProgress) { return; } this.actionInProgress = true; try { await action(); this.refresh$.next(); } catch (err: unknown) { this.logService.error(err.toString()); this.validationService.showError(err); } finally { this.actionInProgress = false; } } ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } } ```
Los Vaqueros (English: The Cowboys) is a collaboration album by Wisin & Yandel featuring the artists from their record label WY Records. It was nominated for a Lo Nuestro Award for Urban Album of the Year. Content It features the following artists: Wisin & Yandel, Gadiel, Franco "El Gorila", Yomille Omar "El Tio", Tony Dize with guest appearances by Don Omar, Gallego and Héctor el Father. This album is the "baby" of Wisin & Yandel's recently emerged WY Records, for being the first production by the record label. Besides participating in the vocals, Herson Cifuentes was as well active in the production and development of Los Vaqueros. The Puerto Rican duo, as founders of WY Records, introduced Franco "El Gorilla", Gadiel, and El Tío to the genre for the first time with a more broad promotion by featuring them in several songs on this album. Not too long after the release of Los Vaqueros, a Collector's Edition was released by the company, which included the original CD but with four extra songs plus an extra DVD with two music video clips, an interview, and a photo shot session video. Track listing Wild Wild Mixes Los Vaqueros: Wild Wild Mixes is a remix album of Los Vaqueros released on July 24, 2007. Charts Certifications See also List of number-one Billboard Latin Rhythm Albums of 2007 References 2006 albums Wisin & Yandel albums Machete Music albums
```javascript 'use strict'; const { OrBase } = require('./orBase'); /** * @typedef {import('screwdriver-models/lib/build')} Build * @typedef {import('screwdriver-models/lib/event')} Event */ class OrTrigger extends OrBase { /** * Trigger the next jobs of the current job * @param {Event} event * @param {Number} pipelineId * @param {String} nextJobName * @param {Number} nextJobId * @param {import('./helpers').ParentBuilds} parentBuilds * @param {Boolean} isNextJobVirtual * @return {Promise<Build|null>} */ async execute(event, pipelineId, nextJobName, nextJobId, parentBuilds, isNextJobVirtual) { return this.trigger(event, pipelineId, nextJobName, nextJobId, parentBuilds, isNextJobVirtual); } } module.exports = { OrTrigger }; ```
Stream load is a geologic term referring to the solid matter carried by a stream (Strahler and Strahler, 2006). Erosion and bed shear stress continually remove mineral material from the bed and banks of the stream channel, adding this material to the regular flow of water. The amount of solid load that a stream can carry, or stream capacity, is measured in metric tons per day, passing a given location. Stream capacity is dependent upon the stream's velocity, the amount of water flow, and the gradation (because streams that occur on steeper slopes tend to have greater flow and velocity) (Strahler and Strahler, 2006). Types of stream erosion There are two main sources of stream erosion: hydraulic action and abrasion. All of the materials added to normal stream flow through these processes increase the overall stream load (Strahler and Strahler, 2006). Hydraulic action Hydraulic action describes the erosion caused by the dragging of water over the stream bed and bank. This dragging, coupled with the impact of small parties, easily loosens and erodes smaller alluvial matter, such as gravel, sand, silt and clay (Mangelsdorf, 1990). One powerful example of hydraulic action is bank caving, which normally occurs when a stream loosens sediment and undercuts a bank. Consequently, large masses of sediment slump and collapse into the stream, adding significantly to the stream's load (Strahler and Strahler, 2006). The severity of hydraulic action increases with stream velocity and current stream load. Abrasion Abrasion occurs when larger rock particles roll and strike against bedrock walls, chipping and splintering particles and pieces of rock (Strahler and Strahler). As these cobbles and boulders roll across the stream bed, they continue to crush and grind the bedrock, producing an assortment of eroded rock sizes (Ritter, 2006). Again, the severity of this type of erosion is dependent upon stream velocity and stream load (i.e. the presence of larger rock particles).. Types of stream load Mineral materials of many different shapes and particle sizes erode and contribute to overall stream load. Differences in the size of those materials determine how they will be transported down stream. Stream load is broken into three types: dissolved load, suspended load, and bed load (Ritter, 2006). Dissolved load Dissolved matter is invisible, and is transported in the form of chemical ions. All streams carry some type of dissolved load. This type of load can result from mineral alteration from chemical erosion, or may even be the result of groundwater seepage into the stream. Materials comprising the dissolved load have the smallest particle size of the three load types (Strahler and Strahler, 2006). Suspended load Suspended load is composed of fine sediment particles suspended and transported through the stream. These materials are too large to be dissolved, but too small to lie on the bed of the stream (Mangelsdorf, 1990). Stream flow keeps these suspended materials, such as clay and silt, from settling on the stream bed. Suspended load is the result of material eroded by hydraulic action at the stream surface bordering the channel as well as erosion of the channel itself. Suspended load accounts for the largest majority of stream load (Strahler and Strahler, 2006). Bed load Bed load rolls slowly along the floor of the stream. These include the largest and heaviest materials in the stream, ranging from sand and gravel to cobbles and boulders. There are two main ways to transport bed load: traction and saltation. Traction describes the “scooting and rolling” of particles along the bed (Ritter, 2006). In stream load transport, saltation is a bounce-like movement, occurring when large particles are suspended in the stream for a short distance after which they fall to the bed, dislodging particles from the house. The dislodged particles move downstream a short distance where they fall to the bed, again loosening bed load particles upon impact (Ritter, 2006). Flood and stream load Floods create a scenario in which stream flow and velocity are unusually high due to the drastic addition of water to a stream. These heightened characteristics increase both the potential of stream erosion and heavier stream load (Knighton, 1998). Flooded streams are often responsible for heavy sediment transportation and deposition downstream. Stream capacity is greatly increased during a flood (Knighton, 1998). During a flood, increased suspended load may be visible, giving the stream a muddy color. See also Rouse number Sediment Sediment transport Wash load References Knighton, David. (1998). Fluvial Forms & Processes: A New Perspective, London: Arnold. Mangelsdorf, J. et al. (1990). River Morphology: A Guide for Geoscientists and Engineers, Berlin: Springer-Verlag. Ritter, M.E. (2006). The Physical Environment: an Introduction to Physical Geography: The Geologic Work of Streams. Visited: March 2, 2008. https://web.archive.org/web/20080516233555/http://www.uwsp.edu/geo/faculty/ritter/geog101/textbook/climate_systems/icecap.html Strahler, A. and A. Strahler. (2006). Introducing Physical Geography, Boston: Wiley & Sons. Erosion
```cython # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # # path_to_url # # Unless required by applicable law or agreed to in writing, # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # specific language governing permissions and limitations # distutils: language = c++ # cython: embedsignature = True include "config.pxi" from libcpp.string cimport string from libcpp cimport bool as c_bool from libcpp.map cimport map cimport cpython from cython.operator cimport dereference as deref from libkudu_client cimport * from kudu.compat import tobytes, frombytes, dict_iter from kudu.schema cimport Schema, ColumnSchema, ColumnSpec, KuduValue, KuduType from kudu.errors cimport check_status from kudu.util import to_unixtime_micros, from_unixtime_micros, \ from_hybridtime, to_unscaled_decimal, from_unscaled_decimal, \ unix_epoch_days_to_date, date_to_unix_epoch_days from errors import KuduException import six # True if this python client was compiled with a # compiler that supports __int128 which is required # for decimal type support. This is generally true # except for EL6 environments. IF PYKUDU_INT128_SUPPORTED == 1: CLIENT_SUPPORTS_DECIMAL = True ELSE: CLIENT_SUPPORTS_DECIMAL = False try: import pandas CLIENT_SUPPORTS_PANDAS = True except ImportError: CLIENT_SUPPORTS_PANDAS = False # Replica selection enums LEADER_ONLY = ReplicaSelection_Leader CLOSEST_REPLICA = ReplicaSelection_Closest FIRST_REPLICA = ReplicaSelection_First cdef dict _replica_selection_policies = { 'leader': ReplicaSelection_Leader, 'closest': ReplicaSelection_Closest, 'first': ReplicaSelection_First } # Read mode enums READ_LATEST = ReadMode_Latest READ_AT_SNAPSHOT = ReadMode_Snapshot READ_YOUR_WRITES = ReadMode_ReadYourWrites cdef dict _read_modes = { 'latest': ReadMode_Latest, 'snapshot': ReadMode_Snapshot, 'read_your_writes': ReadMode_ReadYourWrites } ENCRYPTION_OPTIONAL = EncryptionPolicy_Optional ENCRYPTION_REQUIRED_REMOTE = EncryptionPolicy_RequiredRemote ENCRYPTION_REQUIRED = EncryptionPolicy_Required cdef dict _encryption_policies = { 'optional': EncryptionPolicy_Optional, 'required_remote': EncryptionPolicy_RequiredRemote, 'required': EncryptionPolicy_Required } cdef dict _type_names = { KUDU_INT8 : "KUDU_INT8", KUDU_INT16 : "KUDU_INT16", KUDU_INT32 : "KUDU_INT32", KUDU_INT64 : "KUDU_INT64", KUDU_STRING : "KUDU_STRING", KUDU_BOOL : "KUDU_BOOL", KUDU_FLOAT : "KUDU_FLOAT", KUDU_DOUBLE : "KUDU_DOUBLE", KUDU_BINARY : "KUDU_BINARY", KUDU_UNIXTIME_MICROS : "KUDU_UNIXTIME_MICROS", KUDU_DECIMAL : "KUDU_DECIMAL", KUDU_VARCHAR : "KUDU_VARCHAR", KUDU_DATE : "KUDU_DATE" } # Range Partition Bound Type enums EXCLUSIVE_BOUND = PartitionType_Exclusive INCLUSIVE_BOUND = PartitionType_Inclusive cdef dict _partition_bound_types = { 'exclusive': PartitionType_Exclusive, 'inclusive': PartitionType_Inclusive } def _check_convert_range_bound_type(bound): # Convert bounds types to constants and raise exception if invalid. def invalid_bound_type(bound_type): raise ValueError('Invalid range partition bound type: {0}' .format(bound_type)) if isinstance(bound, int): if bound >= len(_partition_bound_types) \ or bound < 0: invalid_bound_type(bound) else: return bound else: try: return _partition_bound_types[bound.lower()] except KeyError: invalid_bound_type(bound) def _correct_pandas_data_type(dtype): """ This method returns the correct Pandas data type for some data types that are converted incorrectly by Pandas. Returns ------- pdtype : type """ import numpy as np if dtype == "int8": return np.int8 if dtype == "int16": return np.int16 if dtype == "int32": return np.int32 if dtype == "float": return np.float32 else: return None cdef class TimeDelta: """ Wrapper interface for kudu MonoDelta class, which is used to specify timedeltas for timeouts and other uses. """ cdef: MonoDelta delta def __cinit__(self): pass @staticmethod def from_seconds(seconds): """ Construct a new TimeDelta from fractional seconds. Parameters ---------- seconds : double Returns ------- delta : TimeDelta """ cdef TimeDelta result = TimeDelta() result.init(MonoDelta.FromSeconds(seconds)) return result @staticmethod def from_millis(int64_t ms): """ Construct a new TimeDelta from integer milliseconds. Parameters ---------- ms : int Returns ------- delta : TimeDelta """ cdef TimeDelta result = TimeDelta() result.init(MonoDelta.FromMilliseconds(ms)) return result @staticmethod def from_micros(int64_t us): """ Construct a new TimeDelta from integer microseconds. Parameters ---------- us : int Returns ------- delta : TimeDelta """ cdef TimeDelta result = TimeDelta() result.init(MonoDelta.FromMicroseconds(us)) return result @staticmethod def from_nanos(seconds): """ Construct a new TimeDelta from integer nanoseconds. Parameters ---------- ns : int Returns ------- delta : TimeDelta """ cdef TimeDelta result = TimeDelta() result.init(MonoDelta.FromNanoseconds(seconds)) return result cpdef double to_seconds(self): """ Return timedelta as fractional seconds. """ return self.delta.ToSeconds() cpdef int64_t to_millis(self): """ Return timedelta as exact milliseconds. """ return self.delta.ToMilliseconds() cpdef int64_t to_micros(self): """ Return timedelta as exact microseconds. """ return self.delta.ToMicroseconds() cpdef int64_t to_nanos(self): """ Return timedelta as exact nanoseconds. """ return self.delta.ToNanoseconds() cdef init(self, const MonoDelta& val): self.delta = val def __repr__(self): cdef object as_string if self.delta.Initialized(): as_string = self.delta.ToString() return 'kudu.TimeDelta({0})'.format(as_string) else: return 'kudu.TimeDelta()' def __richcmp__(TimeDelta self, TimeDelta other, int op): if op == cpython.Py_EQ: return self.delta.Equals(other.delta) elif op == cpython.Py_NE: return not self.delta.Equals(other.delta) elif op == cpython.Py_LT: return self.delta.LessThan(other.delta) elif op == cpython.Py_LE: return not self.delta.MoreThan(other.delta) elif op == cpython.Py_GT: return self.delta.MoreThan(other.delta) elif op == cpython.Py_GE: return not self.delta.LessThan(other.delta) else: raise ValueError('invalid operation: {0}'.format(op)) cdef class Client: """ The primary class for interacting with a Kudu cluster. Can connect to one or more Kudu master servers. Do not instantiate this class directly; use kudu.connect instead. """ def __cinit__(self, addr_or_addrs, admin_timeout_ms=None, rpc_timeout_ms=None, sasl_protocol_name=None, require_authentication=False, encryption_policy=ENCRYPTION_OPTIONAL, jwt=None, trusted_certificates=None): cdef: string c_addr vector[string] c_addrs KuduClientBuilder builder TimeDelta timeout # Python programs will often have already imported _ssl, which # has the side effect of initializing OpenSSL. So, we detect # whether _ssl is present, and if we can import it, we disable # Kudu's initialization to avoid a conflict. try: import _ssl except: pass else: check_status(DisableOpenSSLInitialization()) if isinstance(addr_or_addrs, six.string_types): addr_or_addrs = [addr_or_addrs] elif not isinstance(addr_or_addrs, list): addr_or_addrs = list(addr_or_addrs) # Raise exception for empty iters, otherwise the connection call # will hang if not addr_or_addrs: raise ValueError("Empty iterator for addr_or_addrs.") self.master_addrs = addr_or_addrs for addr in addr_or_addrs: c_addrs.push_back(tobytes(addr)) builder.master_server_addrs(c_addrs) if admin_timeout_ms is not None: timeout = TimeDelta.from_millis(admin_timeout_ms) builder.default_admin_operation_timeout(timeout.delta) if rpc_timeout_ms is not None: timeout = TimeDelta.from_millis(rpc_timeout_ms) builder.default_rpc_timeout(timeout.delta) if sasl_protocol_name is not None: builder.sasl_protocol_name(sasl_protocol_name) if require_authentication: builder.require_authentication(require_authentication) if jwt is not None: builder.jwt(tobytes(jwt)) if trusted_certificates is not None: for c in trusted_certificates: builder.trusted_certificate(tobytes(c)) builder.encryption_policy(encryption_policy) check_status(builder.Build(&self.client)) # A convenience self.cp = self.client.get() def __dealloc__(self): self.close() property is_multimaster: def __get__(self): return self.cp.IsMultiMaster() cpdef close(self): # Nothing yet to clean up here pass def latest_observed_timestamp(self): """ Get the highest timestamp observed by the client in UTC. This is intended to gain external consistency across clients. Note: The latest observed timestamp can also be used to start a snapshot scan on a table which is guaranteed to contain all data written or previously read by this client. This should be treated as experimental as it this method will change or disappear in a future release. Additionally, note that 1 must be added to the value to be used in snapshot reads (this is taken care of in the from_hybridtime method). Returns ------- latest : datetime.datetime """ return from_hybridtime(self.cp.GetLatestObservedTimestamp()) def create_table(self, table_name, Schema schema, partitioning, n_replicas=None, owner=None, comment=None): """ Creates a new Kudu table from the passed Schema and options. Parameters ---------- table_name : string schema : kudu.Schema Create using kudu.schema_builder partitioning : Partitioning object n_replicas : int Number of replicas to set. This should be an odd number. If not provided (or if <= 0), falls back to the server-side default. """ cdef: KuduTableCreator* c Status s c = self.cp.NewTableCreator() try: c.table_name(tobytes(table_name)) c.schema(schema.schema) self._apply_partitioning(c, partitioning, schema) if n_replicas: c.num_replicas(n_replicas) if owner: c.set_owner(tobytes(owner)) if comment: c.set_comment(tobytes(comment)) s = c.Create() check_status(s) finally: del c cdef _apply_partitioning(self, KuduTableCreator* c, part, Schema schema): cdef: vector[string] v PartialRow lower_bound PartialRow upper_bound PartialRow split_row KuduRangePartition* range_partition # Apply hash partitioning. for col_names, num_buckets, seed in part._hash_partitions: v.clear() for n in col_names: v.push_back(tobytes(n)) if seed: c.add_hash_partitions(v, num_buckets, seed) else: c.add_hash_partitions(v, num_buckets) # Apply range partitioning if part._range_partition_cols is not None: v.clear() for n in part._range_partition_cols: v.push_back(tobytes(n)) c.set_range_partition_columns(v) if part._range_partitions_with_custom_hash_schemas: for p in part._range_partitions_with_custom_hash_schemas: if not isinstance(p.lower_bound, PartialRow): lower_bound = schema.new_row(p.lower_bound) else: lower_bound = p.lower_bound lower_bound._own = 0 if not isinstance(p.upper_bound, PartialRow): upper_bound = schema.new_row(p.upper_bound) else: upper_bound = p.upper_bound upper_bound._own = 0 range_partition = new KuduRangePartition( lower_bound.row, upper_bound.row, p.lower_bound_type, p.upper_bound_type) for col_names, num_buckets, seed in p.hash_dimensions: v.clear() for n in col_names: v.push_back(tobytes(n)) range_partition.add_hash_partitions(v, num_buckets, seed if seed else 0) c.add_custom_range_partition(range_partition) if part._range_partitions: for partition in part._range_partitions: if not isinstance(partition[0], PartialRow): lower_bound = schema.new_row(partition[0]) else: lower_bound = partition[0] lower_bound._own = 0 if not isinstance(partition[1], PartialRow): upper_bound = schema.new_row(partition[1]) else: upper_bound = partition[1] upper_bound._own = 0 c.add_range_partition( lower_bound.row, upper_bound.row, _check_convert_range_bound_type(partition[2]), _check_convert_range_bound_type(partition[3]) ) if part._range_partition_splits: for split in part._range_partition_splits: if not isinstance(split, PartialRow): split_row = schema.new_row(split) else: split_row = split split_row._own = 0 c.add_range_partition_split(split_row.row) def delete_table(self, table_name): """ Delete/drop a Kudu table without reserving. Raises KuduNotFound if the table does not exist. Notes ----- The deleted table may turn to soft-deleted status with the flag default_deleted_table_reserve_seconds set to nonzero on the master side. The delete operation or drop operation means that the service will directly delete the table after receiving the instruction. Which means that once we delete the table by mistake, we have no way to recall the deleted data. We have added a new API @soft_delete_table to allow the deleted data to be reserved for a period of time, which means that the wrongly deleted data may be recalled. In order to be compatible with the previous versions, this interface will continue to directly delete tables without reserving the table. Refer to soft_delete_table for detailed usage examples. Parameters ---------- table_name : string """ check_status(self.cp.DeleteTable(tobytes(table_name))) def soft_delete_table(self, table_name, reserve_seconds=None): """ Soft delete/drop a table. Notes ----- Usage Example1: Equal to delete_table(table_name) and the table will not be reserved. client.soft_delete_table(table_name) Usage Example2: The table will be reserved for 600s after delete operation. We can recall the table in time after the delete. client.soft_delete_table(table_name, 600) client.recall_table(table_id) Parameters ---------- table_name : string Name of the table to drop. reserve_seconds : int Reserve seconds after being deleted. """ if reserve_seconds is not None: check_status(self.cp.SoftDeleteTable(tobytes(table_name), reserve_seconds)) else: check_status(self.cp.SoftDeleteTable(tobytes(table_name))) def recall_table(self, table_id, new_table_name=None): """ Recall a deleted but still reserved table. Parameters ---------- table_id : string ID of the table to recall. new_table_name : string New table name for the recalled table. The recalled table will use the original table name if the parameter is empty string (i.e. ""). """ if new_table_name is not None: check_status(self.cp.RecallTable(tobytes(table_id), tobytes(new_table_name))) else: check_status(self.cp.RecallTable(tobytes(table_id))) def table_exists(self, table_name): """Return True if the indicated table exists in the Kudu cluster. Parameters ---------- table_name : string Returns ------- exists : bool """ cdef: string c_name = tobytes(table_name) c_bool exists check_status(self.cp.TableExists(c_name, &exists)) return exists def deserialize_token_into_scanner(self, serialized_token): """ Deserializes a ScanToken using the client and returns a scanner. Parameters ---------- serialized_token : String Serialized form of a ScanToken. Returns ------- scanner : Scanner """ token = ScanToken() return token.deserialize_into_scanner(self, serialized_token) def table(self, table_name): """ Construct a kudu.Table and retrieve its schema from the cluster. Raises KuduNotFound if the table does not exist. Parameters ---------- table_name : string Returns ------- table : kudu.Table """ table_name = tobytes(table_name) cdef Table table = Table(table_name, self) check_status(self.cp.OpenTable(table_name, &table.table)) table.init() return table def list_tables(self, match_substring=None): """ Retrieve a list of non-soft-deleted table names in the Kudu cluster with an optional substring filter. Parameters ---------- match_substring : string, optional If passed, the string must be exactly contained in the table names Returns ------- tables : list[string] Table names returned from Kudu """ cdef: vector[string] tables string c_match size_t i if match_substring is not None: c_match = tobytes(match_substring) check_status(self.cp.ListTables(&tables, c_match)) else: check_status(self.cp.ListTables(&tables)) result = [] for i in range(tables.size()): result.append(frombytes(tables[i])) return result def list_soft_deleted_tables(self, match_substring=None): """ Retrieve a list of soft-deleted table names in the Kudu cluster with an optional substring filter. Parameters ---------- match_substring : string, optional If passed, the string must be exactly contained in the table names Returns ------- tables : list[string] Table names returned from Kudu """ cdef: vector[string] tables string c_match size_t i if match_substring is not None: c_match = tobytes(match_substring) check_status(self.cp.ListSoftDeletedTables(&tables, c_match)) else: check_status(self.cp.ListSoftDeletedTables(&tables)) result = [] for i in range(tables.size()): result.append(frombytes(tables[i])) return result def list_tablet_servers(self): """ Retrieve a list of tablet servers currently running in the Kudu cluster Returns ------- tservers : list[TabletServer] List of TabletServer objects """ cdef: vector[KuduTabletServer*] tservers size_t i check_status(self.cp.ListTabletServers(&tservers)) result = [] for i in range(tservers.size()): ts = TabletServer() ts._own = 1 result.append(ts._init(tservers[i])) return result def new_session(self, flush_mode='manual', timeout_ms=5000, **kwargs): """ Create a new KuduSession for applying write operations. Parameters ---------- flush_mode : {'manual', 'sync', 'background'}, default 'manual' See Session.set_flush_mode timeout_ms : int, default 5000 Timeout in milliseconds mutation_buffer_sz : Size in bytes of the buffer space. mutation_buffer_watermark : Watermark level as percentage of the mutation buffer size, this is used to trigger a flush in AUTO_FLUSH_BACKGROUND mode. mutation_buffer_flush_interval : The duration of the interval for the time-based flushing, in milliseconds. In some cases, while running in AUTO_FLUSH_BACKGROUND mode, the size of the mutation buffer for pending operations and the flush watermark for fresh operations may be too high for the rate of incoming data: it would take too long to accumulate enough data in the buffer to trigger flushing. I.e., it makes sense to flush the accumulated operations if the prior flush happened long time ago. This parameter sets the wait interval for the time-based flushing which takes place along with the flushing triggered by the over-the-watermark criterion. By default, the interval is set to 1000 ms (i.e. 1 second). mutation_buffer_max_num : The maximum number of mutation buffers per KuduSession object to hold the applied operations. Use 0 to set the maximum number of concurrent mutation buffers to unlimited Returns ------- session : kudu.Session """ cdef Session result = Session() result.s = self.cp.NewSession() result.set_flush_mode(flush_mode) result.set_timeout_ms(timeout_ms) if "mutation_buffer_sz" in kwargs: result.set_mutation_buffer_space(kwargs["mutation_buffer_sz"]) if "mutation_buffer_watermark" in kwargs: result.set_mutation_buffer_flush_watermark(kwargs["mutation_buffer_watermark"]) if "mutation_buffer_flush_interval" in kwargs: result.set_mutation_buffer_flush_interval(kwargs["mutation_buffer_flush_interval"]) if "mutation_buffer_max_num" in kwargs: result.set_mutation_buffer_max_num(kwargs["mutation_buffer_max_num"]) return result def new_table_alterer(self, Table table): """ Create a TableAlterer object that can be used to apply a set of steps to alter a table. Parameters ---------- table : Table Table to alter. NOTE: The TableAlterer.alter() method will return a new Table object with the updated information. Examples -------- table = client.table('example') alterer = client.new_table_alterer(table) table = alterer.rename('example2').alter() Returns ------- alterer : TableAlterer """ return TableAlterer(table) #your_sha256_hash------ # Handle marshalling Python values to raw values. Since range predicates # require a const void*, this is one valid (though a bit verbose) # approach. Note that later versions of Cython handle many Python -> C type # casting problems (and integer overflows), but these should all be tested # rigorously in our test suite cdef class RawValue: cdef: void* data def __cinit__(self): self.data = NULL cdef class Int8Val(RawValue): cdef: int8_t val def __cinit__(self, obj): self.val = <int8_t> obj self.data = &self.val cdef class Int16Val(RawValue): cdef: int16_t val def __cinit__(self, obj): self.val = <int16_t> obj self.data = &self.val cdef class Int32Val(RawValue): cdef: int32_t val def __cinit__(self, obj): self.val = <int32_t> obj self.data = &self.val cdef class Int64Val(RawValue): cdef: int64_t val def __cinit__(self, obj): self.val = <int64_t> obj self.data = &self.val cdef class DoubleVal(RawValue): cdef: double val def __cinit__(self, obj): self.val = <double> obj self.data = &self.val cdef class FloatVal(RawValue): cdef: float val def __cinit__(self, obj): self.val = <float> obj self.data = &self.val cdef class BoolVal(RawValue): cdef: c_bool val def __cinit__(self, obj): self.val = <c_bool> obj self.data = &self.val cdef class StringVal(RawValue): cdef: # Python "str" object that was passed into the constructor. # We hold a reference to this so that the underlying data # doesn't go out of scope. object py_str # Heap-allocated Slice object, owned by this instance, # which points to the data in 'py_str' cdef Slice* val def __cinit__(self, obj): self.py_str = obj self.val = new Slice(<char*>self.py_str, len(self.py_str)) # The C++ API expects a Slice* to be passed to the range predicate # constructor. self.data = self.val def __dealloc__(self): del self.val cdef class UnixtimeMicrosVal(RawValue): cdef: int64_t val def __cinit__(self, obj): self.val = to_unixtime_micros(obj) self.data = &self.val cdef class DateVal(RawValue): cdef: int32_t val def __cinit__(self, obj): self.val = date_to_unix_epoch_days(obj) self.data = &self.val #your_sha256_hash------ cdef class TabletServer: """ Represents a Kudu tablet server, containing the uuid, hostname and port. Create a list of TabletServers by using the kudu.Client.list_tablet_servers method after connecting to a cluster """ cdef: const KuduTabletServer* _tserver public bint _own cdef _init(self, const KuduTabletServer* tserver): self._tserver = tserver self._own = 0 return self def __dealloc__(self): if self._tserver != NULL and self._own: del self._tserver def __richcmp__(TabletServer self, TabletServer other, int op): if op == 2: # == return ((self.uuid(), self.hostname(), self.port()) == (other.uuid(), other.hostname(), other.port())) elif op == 3: # != return ((self.uuid(), self.hostname(), self.port()) != (other.uuid(), other.hostname(), other.port())) else: raise NotImplementedError def uuid(self): return frombytes(self._tserver.uuid()) def hostname(self): return frombytes(self._tserver.hostname()) def port(self): return self._tserver.port() cdef class Table: """ Represents a Kudu table, containing the schema and other tools. Create by using the kudu.Client.table method after connecting to a cluster. """ def __cinit__(self, name, Client client): self._name = name self.parent = client # Users should not instantiate directly self.schema = Schema() cdef init(self): # Called after the refptr has been populated self.schema.schema = &self.ptr().schema() self.schema.own_schema = 0 self.schema.parent = self self.num_replicas = self.ptr().num_replicas() def __len__(self): # TODO: is this cheaply knowable? raise NotImplementedError def __getitem__(self, key): spec = self.schema[key] return Column(self, spec) property name: """Name of the table.""" def __get__(self): return frombytes(self.ptr().name()) property id: """Identifier string for the table.""" def __get__(self): return frombytes(self.ptr().id()) # XXX: don't love this name property num_columns: """Number of columns in the table's schema.""" def __get__(self): return len(self.schema) property owner: """Name of the owner of the table.""" def __get__(self): return frombytes(self.ptr().owner()) property comment: """Comment on the table.""" def __get__(self): return frombytes(self.ptr().comment()) def rename(self, new_name): raise NotImplementedError def drop(self): raise NotImplementedError def new_insert(self, record=None): """ Create a new Insert operation. Pass the completed Insert to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- insert : Insert """ return Insert(self, record) def new_insert_ignore(self, record=None): """ Create a new InsertIgnore operation. Pass the completed InsertIgnore to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- insertIgnore : InsertIgnore """ return InsertIgnore(self, record) def new_upsert(self, record=None): """ Create a new Upsert operation. Pass the completed Upsert to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- upsert : Upsert """ return Upsert(self, record) def new_upsert_ignore(self, record=None): """ Create a new UpsertIgnore operation. Pass the completed UpsertIgnore to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- upsertIgnore : UpsertIgnore """ return UpsertIgnore(self, record) def new_update(self, record=None): """ Create a new Update operation. Pass the completed Update to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- update : Update """ return Update(self, record) def new_update_ignore(self, record=None): """ Create a new UpdateIgnore operation. Pass the completed UpdateIgnore to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- updateIgnore : UpdateIgnore """ return UpdateIgnore(self, record) def new_delete(self, record=None): """ Create a new Delete operation. Pass the completed Update to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- delete : Delete """ return Delete(self, record) def new_delete_ignore(self, record=None): """ Create a new DeleteIgnore operation. Pass the completed DeleteIgnore to a Session. If a record is provided, a PartialRow will be initialized with values from the input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names, indexes, or a mix of both names and indexes. Parameters ---------- record : tuple/list/dict Returns ------- deleteIgnore : DeleteIgnore """ return DeleteIgnore(self, record) def scanner(self): """ Create a new scanner for this table for retrieving a selection of table rows. Examples -------- scanner = table.scanner() scanner.add_predicate(table['key'] > 10) scanner.open() batch = scanner.read_all() tuples = batch.as_tuples() Returns ------- scanner : kudu.Scanner """ cdef Scanner result = Scanner(self) result.scanner = new KuduScanner(self.ptr()) return result def scan_token_builder(self): """ Create a new ScanTokenBuilder for this table to build a series of scan tokens. Examples -------- builder = table.scan_token_builder() builder.set_fault_tolerant().add_predicate(table['key'] > 10) tokens = builder.build() for token in tokens: scanner = token.into_kudu_scanner() scanner.open() tuples = scanner.read_all_tuples() Returns ------- builder : ScanTokenBuilder """ return ScanTokenBuilder(self) cdef class Column: """ A reference to a Kudu table column intended to simplify creating predicates and other column-specific operations. Write arithmetic comparisons to create new Predicate objects that can be passed to a Scanner. Examples -------- scanner.add_predicate(table[col_name] <= 10) """ cdef readonly: Table parent ColumnSchema spec str name def __cinit__(self, Table parent, ColumnSchema spec): self.name = spec.name self.parent = parent self.spec = spec def __repr__(self): result = ('Column({0}, parent={1}, type={2})' .format(self.name, self.parent.name, self.spec.type.name)) return result def __richcmp__(Column self, value, int op): cdef: KuduPredicate* pred KuduValue val Slice col_name_slice ComparisonOp cmp_op Predicate result object _name = tobytes(self.name) col_name_slice = Slice(<char*> _name, len(_name)) if op == 0: # < cmp_op = KUDU_LESS elif op == 1: # <= cmp_op = KUDU_LESS_EQUAL elif op == 2: # == cmp_op = KUDU_EQUAL elif op == 4: # > cmp_op = KUDU_GREATER elif op == 5: # >= cmp_op = KUDU_GREATER_EQUAL else: raise NotImplementedError val = self.spec.type.new_value(value) pred = (self.parent.ptr() .NewComparisonPredicate(col_name_slice, cmp_op, val._value)) result = Predicate() result.init(pred) return result def in_list(Column self, values): """ Creates a new InListPredicate for the Column. If a single value is provided, then an equality comparison predicate is created. Parameters ---------- values : list Examples -------- scanner.add_predicate(table['key'].in_list([1, 2, 3]) Returns ------- pred : Predicate """ cdef: KuduPredicate* pred KuduValue kval vector[C_KuduValue*] vals Slice col_name_slice Predicate result object _name = tobytes(self.name) col_name_slice = Slice(<char*> _name, len(_name)) try: for val in values: kval = self.spec.type.new_value(val) vals.push_back(kval._value) except TypeError: while not vals.empty(): _val = vals.back() del _val vals.pop_back() raise pred = (self.parent.ptr() .NewInListPredicate(col_name_slice, &vals)) result = Predicate() result.init(pred) return result def is_not_null(Column self): """ Creates a new IsNotNullPredicate for the Column which can be used for scanners on this table. Examples -------- scanner.add_predicate(table[col_name].is_not_null()) Returns ------- pred : Predicate """ cdef: KuduPredicate* pred Slice col_name_slice Predicate result object _name = tobytes(self.name) col_name_slice = Slice(<char*> _name, len(_name)) pred = (self.parent.ptr() .NewIsNotNullPredicate(col_name_slice)) result = Predicate() result.init(pred) return result def is_null(Column self): """ Creates a new IsNullPredicate for the Column which can be used for scanners on this table. Examples -------- scanner.add_predicate(table[col_name].is_null()) Returns ------- pred : Predicate """ cdef: KuduPredicate* pred Slice col_name_slice Predicate result object _name = tobytes(self.name) col_name_slice = Slice(<char*> _name, len(_name)) pred = (self.parent.ptr() .NewIsNullPredicate(col_name_slice)) result = Predicate() result.init(pred) return result class RangePartition(object): """ Argument to Client.add_custom_range_partition(...) to contain information on the range bounds and range-specific hash schema. """ def __init__(self, lower_bound=None, upper_bound=None, lower_bound_type='inclusive', upper_bound_type='exclusive'): """ Parameters ---------- lower_bound : PartialRow/list/tuple/dict upper_bound : PartialRow/list/tuple/dict lower_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND upper_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND """ self.lower_bound = lower_bound self.upper_bound = upper_bound self.lower_bound_type = _check_convert_range_bound_type(lower_bound_type) self.upper_bound_type = _check_convert_range_bound_type(upper_bound_type) self.hash_dimensions = [] def add_hash_partitions(self, column_names, num_buckets, seed=None): """ Adds a dimension with the specified parameters to the custom hash schema for this range partition. Parameters ---------- column_names : list of string column names on which to compute hash function num_buckets : the number of buckets for the hash function seed : int - optional; the seed for the hash function mapping rows to buckets Returns ------- self: this object """ if isinstance(column_names, str): column_names = [column_names] self.hash_dimensions.append( (column_names, num_buckets, seed) ) return self class Partitioning(object): """ Argument to Client.create_table(...) to describe table partitioning. """ def __init__(self): self._hash_partitions = [] self._range_partition_cols = None self._range_partitions = [] self._range_partitions_with_custom_hash_schemas = [] self._range_partition_splits = [] def add_hash_partitions(self, column_names, num_buckets, seed=None): """ Adds a set of hash partitions to the table. For each set of hash partitions added to the table, the total number of table partitions is multiplied by the number of buckets. For example, if a table is created with 3 split rows, and two hash partitions with 4 and 5 buckets respectively, the total number of table partitions will be 80 (4 range partitions * 4 hash buckets * 5 hash buckets). Optionally, a seed can be used to randomize the mapping of rows to hash buckets. Setting the seed may provide some amount of protection against denial of service attacks when the hashed columns contain user provided values. Parameters ---------- column_names : list of string column names on which to partition num_buckets : the number of buckets to create seed : int - optional Hash: seed for mapping rows to hash buckets. Returns ------- self: this object """ if isinstance(column_names, str): column_names = [column_names] self._hash_partitions.append( (column_names, num_buckets, seed) ) return self def set_range_partition_columns(self, column_names): """ Sets the columns on which the table will be range-partitioned. Every column must be a part of the table's primary key. If not set, the table will be created with the primary-key columns as the range-partition columns. If called with an empty vector, the table will be created without range partitioning. Parameters ---------- column_names : list of string column names on which to partition Returns ------- self: this object """ if isinstance(column_names, str): column_names = [column_names] self._range_partition_cols = column_names return self def add_range_partition(self, lower_bound=None, upper_bound=None, lower_bound_type='inclusive', upper_bound_type='exclusive'): """ Add a range partition to the table. Multiple range partitions may be added, but they must not overlap. All range splits specified by add_range_partition_split must fall in a range partition. The lower bound must be less than or equal to the upper bound. If this method is not called, the table's range will be unbounded. Parameters ---------- lower_bound : PartialRow/list/tuple/dict upper_bound : PartialRow/list/tuple/dict lower_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND upper_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND Returns ------- self : Partitioning """ if self._range_partition_cols: self._range_partitions.append( (lower_bound, upper_bound, lower_bound_type, upper_bound_type) ) else: raise ValueError("Range Partition Columns must be set before " + "adding a range partition.") return self def add_custom_range_partition(self, range_partition): """ Parameters ---------- range_partition : range partition with custom hash schema to add Returns ------- self : Partitioning """ if self._range_partition_cols is None: raise ValueError("Range Partition Columns must be set before " + "adding a range partition.") self._range_partitions_with_custom_hash_schemas.append(range_partition) return self def add_range_partition_split(self, split_row): """ Add a range partition split at the provided row. Parameters ---------- split_row : PartialRow/list/tuple/dict Returns ------- self : Partitioning """ if self._range_partition_cols: self._range_partition_splits.append(split_row) else: raise ValueError("Range Partition Columns must be set before " + "adding a range partition split.") return self cdef class Predicate: """ Wrapper for a KuduPredicate. Pass to Scanner.add_predicates """ cdef: KuduPredicate* pred def __cinit__(self): self.pred = NULL def __dealloc__(self): if self.pred != NULL: del self.pred cdef init(self, KuduPredicate* pred): self.pred = pred FLUSH_AUTO_SYNC = FlushMode_AutoSync FLUSH_AUTO_BACKGROUND = FlushMode_AutoBackground FLUSH_MANUAL = FlushMode_Manual cdef dict _flush_modes = { 'manual': FlushMode_Manual, 'sync': FlushMode_AutoSync, 'background': FlushMode_AutoBackground } cdef class Session: """ Wrapper for a client KuduSession to build up write operations to interact with the cluster. """ def __cinit__(self): pass def set_flush_mode(self, flush_mode='manual'): """ Set the session operation flush mode Parameters ---------- flush_mode : {'manual', 'sync', 'background'}, default 'manual' You can also use the constants FLUSH_MANUAL, FLUSH_AUTO_SYNC, and FLUSH_AUTO_BACKGROUND """ cdef Status status cdef FlushMode fmode if isinstance(flush_mode, int): # todo: validation fmode = <FlushMode> flush_mode else: try: fmode = _flush_modes[flush_mode.lower()] except KeyError: raise ValueError('Invalid flush mode: {0}' .format(flush_mode)) status = self.s.get().SetFlushMode(fmode) check_status(status) def set_timeout_ms(self, int64_t ms): """ Set the session timeout in milliseconds """ self.s.get().SetTimeoutMillis(ms) def set_mutation_buffer_space(self, size_t size_bytes): """ Set the amount of buffer space used by this session for outbound writes. The effect of the buffer size varies based on the flush mode of the session: AUTO_FLUSH_SYNC: since no buffering is done, this has no effect. AUTO_FLUSH_BACKGROUND: if the buffer space is exhausted, then write calls will block until there is space available in the buffer. MANUAL_FLUSH: if the buffer space is exhausted, then write calls will return an error By default, the buffer space is set to 7 MiB (i.e. 7 * 1024 * 1024 bytes). Parameters ---------- size_bytes : Size of the buffer space to set (number of bytes) """ status = self.s.get().SetMutationBufferSpace(size_bytes) check_status(status) def set_mutation_buffer_flush_watermark(self, double watermark_pct): """ Set the buffer watermark to trigger flush in AUTO_FLUSH_BACKGROUND mode. This method sets the watermark for fresh operations in the buffer when running in AUTO_FLUSH_BACKGROUND mode: once the specified threshold is reached, the session starts sending the accumulated write operations to the appropriate tablet servers. The flush watermark determines how much of the buffer space is taken by newly submitted operations. Setting this level to 100% results in flushing the buffer only when the newly applied operation would overflow the buffer. By default, the buffer flush watermark is set to 50%. Parameters ---------- watermark_pct : Watermark level as percentage of the mutation buffer size """ status = self.s.get().SetMutationBufferFlushWatermark(watermark_pct) check_status(status) def set_mutation_buffer_flush_interval(self, unsigned int millis): """ Set the interval for time-based flushing of the mutation buffer. In some cases, while running in AUTO_FLUSH_BACKGROUND mode, the size of the mutation buffer for pending operations and the flush watermark for fresh operations may be too high for the rate of incoming data: it would take too long to accumulate enough data in the buffer to trigger flushing. I.e., it makes sense to flush the accumulated operations if the prior flush happened long time ago. This method sets the wait interval for the time-based flushing which takes place along with the flushing triggered by the over-the-watermark criterion. By default, the interval is set to 1000 ms (i.e. 1 second). Parameters ---------- millis : The duration of the interval for the time-based flushing, in milliseconds. """ status = self.s.get().SetMutationBufferFlushInterval(millis) check_status(status) def set_mutation_buffer_max_num(self, unsigned int max_num): """ Set the maximum number of mutation buffers per Session object. A Session accumulates write operations submitted via the Apply() method in mutation buffers. A Session always has at least one mutation buffer. The mutation buffer which accumulates new incoming operations is called the current mutation buffer. The current mutation buffer is flushed using the Session.flush() method or it's done by the Session automatically if running in AUTO_FLUSH_BACKGROUND mode. After flushing the current mutation buffer, a new buffer is created upon calling Session.apply(), provided the limit is not exceeded. A call to Session.apply() blocks if it's at the maximum number of buffers allowed; the call unblocks as soon as one of the pending batchers finished flushing and a new batcher can be created. The minimum setting for this parameter is 1 (one). The default setting for this parameter is 2 (two). Parameters ---------- max_num : The maximum number of mutation buffers per Session object to hold the applied operations. Use 0 to set the maximum number of concurrent mutation buffers to unlimited. """ status = self.s.get().SetMutationBufferMaxNum(max_num) check_status(status) def apply(self, WriteOperation op): """ Apply the indicated write operation Examples -------- # Executes a single Insert operation session = client.new_session() op = table.new_insert() op['key'] = 0 op['value1'] = 5 op['value2'] = 3.5 session.apply(op) session.flush() """ return op.add_to_session(self) def flush(self): """ Flush pending operations """ check_status(self.s.get().Flush()) def get_pending_errors(self): """ Returns a list of buffered Kudu errors. A second value is returned indicating if there were more errors than could be stored in the session's error buffer (i.e. False means there was no error overflow) Returns ------- errors, overflowed : list, bool """ cdef: KuduError error vector[C_KuduError*] v_errors c_bool overflowed size_t i self.s.get().GetPendingErrors(&v_errors, &overflowed) result = [] for i in range(v_errors.size()): error = KuduError() error.error = v_errors[i] result.append(error) return result, overflowed def get_write_op_metrics(self): """ Return the cumulative write operation metrics since the beginning of the session. Returns ------- metrics : Dictionary """ _map = self.s.get().GetWriteOpMetrics().Get() # Convert map to python dictionary result = {} for it in _map: result[frombytes(it.first)] = it.second return result cdef class Row: """ A single row from a row batch """ cdef: RowBatch parent # This object is owned by the parent RowBatch KuduRowPtr row def __cinit__(self, batch): self.parent = batch def __dealloc__(self): pass cpdef tuple as_tuple(self): """ Return the row as a Python tuple """ cdef: int i, k tuple tup k = self.parent.batch.projection_schema().num_columns() tup = cpython.PyTuple_New(k) for i in range(k): val = None if not self.is_null(i): val = self.get_slot(i) cpython.Py_INCREF(val) cpython.PyTuple_SET_ITEM(tup, i, val) return tup cdef inline get_bool(self, int i): cdef c_bool val check_status(self.row.GetBool(i, &val)) # The built-in bool is masked by the libcpp typedef return bool(val) cdef inline get_int8(self, int i): cdef int8_t val check_status(self.row.GetInt8(i, &val)) return val cdef inline get_int16(self, int i): cdef int16_t val check_status(self.row.GetInt16(i, &val)) return val cdef inline get_int32(self, int i): cdef int32_t val check_status(self.row.GetInt32(i, &val)) return val cdef inline get_int64(self, int i): cdef int64_t val check_status(self.row.GetInt64(i, &val)) return val cdef inline get_double(self, int i): cdef double val check_status(self.row.GetDouble(i, &val)) return val cdef inline get_float(self, int i): cdef float val check_status(self.row.GetFloat(i, &val)) return val cdef inline get_string(self, int i): cdef Slice val check_status(self.row.GetString(i, &val)) return cpython.PyBytes_FromStringAndSize(<char*> val.mutable_data(), val.size()) cdef inline get_binary(self, int i): cdef Slice val check_status(self.row.GetBinary(i, &val)) return cpython.PyBytes_FromStringAndSize(<char*> val.mutable_data(), val.size()) cdef inline get_unixtime_micros(self, int i): cdef int64_t val check_status(self.row.GetUnixTimeMicros(i, &val)) return val cdef inline __get_unscaled_decimal(self, int i): IF PYKUDU_INT128_SUPPORTED == 1: cdef int128_t val check_status(self.row.GetUnscaledDecimal(i, &val)) return val ELSE: raise KuduException("The decimal type is not supported when GCC version is < 4.6.0" % self) cdef inline get_decimal(self, int i): scale = self.parent.batch.projection_schema().Column(i).type_attributes().scale() return from_unscaled_decimal(self.__get_unscaled_decimal(i), scale) cdef inline get_varchar(self, int i): cdef Slice val check_status(self.row.GetVarchar(i, &val)) return cpython.PyBytes_FromStringAndSize(<char*> val.mutable_data(), val.size()) cdef inline get_date(self, int i): cdef int32_t val check_status(self.row.GetDate(i, &val)) return unix_epoch_days_to_date(val) cdef inline get_slot(self, int i): cdef: Status s DataType t = self.parent.batch.projection_schema().Column(i).type() if t == KUDU_BOOL: return self.get_bool(i) elif t == KUDU_INT8: return self.get_int8(i) elif t == KUDU_INT16: return self.get_int16(i) elif t == KUDU_INT32: return self.get_int32(i) elif t == KUDU_INT64: return self.get_int64(i) elif t == KUDU_DOUBLE: return self.get_double(i) elif t == KUDU_FLOAT: return self.get_float(i) elif t == KUDU_STRING: return frombytes(self.get_string(i)) elif t == KUDU_BINARY: return self.get_binary(i) elif t == KUDU_UNIXTIME_MICROS: return from_unixtime_micros(self.get_unixtime_micros(i)) elif t == KUDU_DECIMAL: return self.get_decimal(i) elif t == KUDU_VARCHAR: return frombytes(self.get_varchar(i)) elif t == KUDU_DATE: return self.get_date(i) else: raise TypeError("Cannot get kudu type <{0}>" .format(_type_names[t])) cdef inline bint is_null(self, int i): return self.row.IsNull(i) cdef class RowBatch: """ Class holding a batch of rows from a Scanner """ # This class owns the KuduScanBatch data cdef: KuduScanBatch batch def __len__(self): return self.batch.NumRows() def __getitem__(self, i): return self.get_row(i).as_tuple() def __iter__(self): cdef int i = 0 for i in range(len(self)): yield self.get_row(i).as_tuple() def as_tuples(self): """ Return RowBatch as a list of Python tuples To simplify testing for the moment. """ cdef list tuples = [] for i in range(self.batch.NumRows()): tuples.append(self.get_row(i).as_tuple()) return tuples cdef Row get_row(self, i): # TODO: boundscheck # For safety, we need to increment the parent reference count and hold # on to a reference internally so that if the RowBatch goes out of # scope we won't end up with orphaned Row objects. This isn't the best, # but an intermediate solution until we can do something better.. cdef Row row = Row(self) row.row = self.batch.Row(i) return row cdef class Scanner: """ A class for defining a selection of data we wish to scan out of a Kudu table. Create a scanner using Table.scanner. """ cdef: Table table KuduScanner* scanner bint is_open def __cinit__(self, Table table = None): self.table = table self.scanner = NULL self.is_open = 0 def __dealloc__(self): # We own this one if self.scanner != NULL: del self.scanner cdef inline ensure_open(self): if not self.is_open: self.open() def add_predicates(self, preds): """ Add a list of scan predicates to the scanner. Select columns from the parent table and make comparisons to create predicates. Returns a reference to itself to facilitate chaining. Examples -------- c = table[col_name] preds = [c >= 0, c <= 10] scanner.add_predicates(preds) Parameters ---------- preds : list of Predicate Returns ------- self : scanner """ for pred in preds: self.add_predicate(pred) return self cpdef add_predicate(self, Predicate pred): """ Add a scan predicates to the scanner. Select columns from the parent table and make comparisons to create predicates. Returns a reference to itself to facilitate chaining. Examples -------- pred = table[col_name] <= 10 scanner.add_predicate(pred) Parameters ---------- pred : kudu.Predicate Returns ------- self : scanner """ cdef KuduPredicate* clone # We clone the KuduPredicate so that the Predicate wrapper class can be # reused clone = pred.pred.Clone() check_status(self.scanner.AddConjunctPredicate(clone)) return self def set_projected_column_names(self, names): """ Sets the columns to be scanned. Parameters ---------- names : list of string Returns ------- self : Scanner """ if isinstance(names, str): names = [names] cdef vector[string] v_names for name in names: v_names.push_back(tobytes(name)) check_status(self.scanner.SetProjectedColumnNames(v_names)) return self def set_selection(self, replica_selection): """ Set the replica selection policy while scanning. Parameters ---------- replica_selection : {'leader', 'closest', 'first'} You can also use the constants LEADER_ONLY, CLOSEST_REPLICA, and FIRST_REPLICA Returns ------- self : Scanner """ cdef ReplicaSelection selection def invalid_selection_policy(): raise ValueError('Invalid replica selection policy: {0}' .format(replica_selection)) if isinstance(replica_selection, int): if 0 <= replica_selection < len(_replica_selection_policies): check_status(self.scanner.SetSelection( <ReplicaSelection> replica_selection)) else: invalid_selection_policy() else: try: check_status(self.scanner.SetSelection( _replica_selection_policies[replica_selection.lower()])) except KeyError: invalid_selection_policy() return self def set_projected_column_indexes(self, indexes): """ Sets the columns to be scanned. Parameters ---------- indexes : list of integers representing column indexes Returns ------- self : Scanner """ cdef vector[int] v_indexes = indexes check_status(self.scanner.SetProjectedColumnIndexes(v_indexes)) return self def set_read_mode(self, read_mode): """ Set the read mode for scanning. Parameters ---------- read_mode : {'latest', 'snapshot', 'read_your_writes'} You can also use the constants READ_LATEST, READ_AT_SNAPSHOT, READ_YOUR_WRITES Returns ------- self : Scanner """ cdef ReadMode rmode def invalid_selection_policy(): raise ValueError('Invalid read mode: {0}' .format(read_mode)) if isinstance(read_mode, int): if 0 <= read_mode < len(_read_modes): check_status(self.scanner.SetReadMode( <ReadMode> read_mode)) else: invalid_selection_policy() else: try: check_status(self.scanner.SetReadMode( _read_modes[read_mode.lower()])) except KeyError: invalid_selection_policy() return self def set_snapshot(self, timestamp, format=None): """ Set the snapshot timestamp for this scanner. Parameters --------- timestamp : datetime.datetime or string If a string is provided, a format must be provided as well. NOTE: This should be in UTC. If a timezone aware datetime object is provided, it will be converted to UTC, otherwise, all other input is assumed to be UTC. format : Required if a string timestamp is provided Uses the C strftime() function, see strftime(3) documentation. Returns ------- self : Scanner """ # Confirm that a format is provided if timestamp is a string if isinstance(timestamp, six.string_types) and not format: raise ValueError( "To use a string timestamp you must provide a format. " + "See the strftime(3) documentation.") snapshot_micros = to_unixtime_micros(timestamp, format) if snapshot_micros >= 0: check_status(self.scanner.SetSnapshotMicros( <uint64_t> snapshot_micros)) else: raise ValueError( "Snapshot Timestamps be greater than the unix epoch.") return self def set_limit(self, limit): """ Set a limit on the number of rows returned by this scanner. Must be a positive value. Parameters ---------- limit : the maximum number of rows to return Returns ------- self : Scanner """ if limit <= 0: raise ValueError("Limit must be positive.") check_status(self.scanner.SetLimit(<int64_t> limit)) def set_fault_tolerant(self): """ Makes the underlying KuduScanner fault tolerant. Returns a reference to itself to facilitate chaining. Returns ------- self : Scanner """ check_status(self.scanner.SetFaultTolerant()) return self def new_bound(self): """ Returns a new instance of a PartialRow to be later set with add_lower_bound()/add_exclusive_upper_bound(). Returns ------- bound : PartialRow """ return self.table.schema.new_row() def add_lower_bound(self, bound): """ Sets the (inclusive) lower bound of the scan. Returns a reference to itself to facilitate chaining. Parameters ---------- bound : PartialRow/tuple/list/dictionary Returns ------- self : Scanner """ cdef: PartialRow row # Convert record to bound if not isinstance(bound, PartialRow): row = self.table.schema.new_row(bound) else: row = bound check_status(self.scanner.AddLowerBound(deref(row.row))) return self def add_exclusive_upper_bound(self, bound): """ Sets the (exclusive) upper bound of the scan. Returns a reference to itself to facilitate chaining. Parameters ---------- bound : PartialRow/tuple/list/dictionary Returns ------- self : Scanner """ cdef: PartialRow row # Convert record to bound if not isinstance(bound, PartialRow): row = self.table.schema.new_row(bound) else: row = bound check_status(self.scanner.AddExclusiveUpperBound(deref(row.row))) return self def get_projection_schema(self): """ Returns the schema of the projection being scanned Returns ------- schema : kudu.Schema """ result = Schema() # Had to instantiate a new schema to return a pointer since the # GetProjectionSchema method does not cdef KuduSchema* schema = new KuduSchema(self.scanner. GetProjectionSchema()) result.schema = schema return result def get_resource_metrics(self): """ Return the cumulative resource metrics since the scan was started. Returns ------- metrics : Dictionary """ _map = self.scanner.GetResourceMetrics().Get() # Convert map to python dictionary result = {} for it in _map: result[frombytes(it.first)] = it.second return result def open(self): """ Returns a reference to itself to facilitate chaining Returns ------- self : Scanner """ if not self.is_open: check_status(self.scanner.Open()) self.is_open = 1 return self def has_more_rows(self): """ Returns True if there are more rows to be read. """ return self.scanner.HasMoreRows() def read_all_tuples(self): """ Compute a RowBatch containing all rows from the scan operation (which hopefully fit into memory, probably not handled gracefully at the moment). """ cdef list tuples = [] cdef RowBatch batch self.ensure_open() while self.has_more_rows(): batch = self.next_batch() tuples.extend(batch.as_tuples()) return tuples def xbatches(self): """ This method acts as a generator to enable more effective memory management by yielding batches of tuples. """ self.ensure_open() while self.has_more_rows(): yield self.next_batch().as_tuples() def read_next_batch_tuples(self): return self.next_batch().as_tuples() cpdef RowBatch next_batch(self): """ Retrieve the next batch of rows from the scanner. Returns ------- batch : RowBatch """ if not self.has_more_rows(): raise StopIteration cdef RowBatch batch = RowBatch() check_status(self.scanner.NextBatch(&batch.batch)) return batch def set_cache_blocks(self, cache_blocks): """ Sets the block caching policy. Returns a reference to itself to facilitate chaining. Parameters ---------- cache_blocks : bool Returns ------- self : Scanner """ check_status(self.scanner.SetCacheBlocks(cache_blocks)) return self def keep_alive(self): """ Keep the current remote scanner alive. Keep the current remote scanner alive on the Tablet server for an additional time-to-live (set by a configuration flag on the tablet server). This is useful if the interval in between NextBatch() calls is big enough that the remote scanner might be garbage collected (default ttl is set to 60 secs.). This does not invalidate any previously fetched results. Returns ------- self : Scanner """ check_status(self.scanner.KeepAlive()) return self def get_current_server(self): """ Get the TabletServer that is currently handling the scan. More concretely, this is the server that handled the most recent open() or next_batch() RPC made by the server. Returns ------- tserver : TabletServer """ cdef: TabletServer tserver = TabletServer() KuduTabletServer* tserver_p = NULL check_status(self.scanner.GetCurrentServer(&tserver_p)) tserver._own = 1 tserver._init(tserver_p) return tserver def close(self): """ Close the scanner. Closing the scanner releases resources on the server. This call does not block, and will not ever fail, even if the server cannot be contacted. Note: The scanner is reset to its initial state by this function. You'll have to re-add any projection, predicates, etc if you want to reuse this object. Note: When the Scanner object is garbage collected, this method is run. This method call is only needed if you want to explicitly release the resources on the server. """ self.scanner.Close() def to_pandas(self, index=None, coerce_float=False): """ Returns the contents of this Scanner to a Pandas DataFrame. This is only available if Pandas is installed. Note: This should only be used if the results from the scanner are expected to be small, as Pandas will load the entire contents into memory. Parameters ---------- index : string, list of fields Field or list of fields to use as the index coerce_float : boolean Attempt to convert decimal values to floating point (double precision). Returns ------- dataframe : DataFrame """ import pandas as pd self.ensure_open() # Here we are using list comprehension with the batch generator to avoid # doubling our memory footprint. dfs = [ pd.DataFrame.from_records(batch, index=index, coerce_float=coerce_float, columns=self.get_projection_schema().names) for batch in self.xbatches() if len(batch) != 0 ] df = pd.concat(dfs, ignore_index=not(bool(index))) types = {} for column in self.get_projection_schema(): pandas_type = _correct_pandas_data_type(column.type.name) if pandas_type is not None and \ not(column.nullable and df[column.name].isnull().any()): types[column.name] = pandas_type for col, dtype in types.items(): df[col] = df[col].astype(dtype, copy=False) return df cdef class ScanToken: """ A ScanToken describes a partial scan of a Kudu table limited to a single contiguous physical location. Using the KuduScanTokenBuilder, clients can describe the desired scan, including predicates, bounds, timestamps, and caching, and receive back a collection of scan tokens. """ cdef: KuduScanToken* _token def __cinit__(self): self._token = NULL def __dealloc__(self): if self._token != NULL: del self._token cdef _init(self, KuduScanToken* token): self._token = token return self def into_kudu_scanner(self): """ Returns a scanner under the current client. Returns ------- scanner : Scanner """ cdef: Scanner result = Scanner() KuduScanner* _scanner = NULL check_status(self._token.IntoKuduScanner(&_scanner)) result.scanner = _scanner return result def tablet(self): """ Returns the Tablet associated with this ScanToken Returns ------- tablet : Tablet """ tablet = Tablet() return tablet._init(&self._token.tablet()) def serialize(self): """ Serialize token into a string. Returns ------- serialized_token : string """ cdef string buf check_status(self._token.Serialize(&buf)) return buf def deserialize_into_scanner(self, Client client, serialized_token): """ Returns a new scanner from the serialized token created under the provided Client. Parameters ---------- client : Client serialized_token : string Returns ------- scanner : Scanner """ cdef: Scanner result = Scanner() KuduScanner* _scanner check_status(self._token.DeserializeIntoScanner(client.cp, serialized_token, &_scanner)) result.scanner = _scanner return result cdef class ScanTokenBuilder: """ This class builds ScanTokens for a Table. """ cdef: KuduScanTokenBuilder* _builder Table _table def __cinit__(self, Table table): self._table = table self._builder = new KuduScanTokenBuilder(table.ptr()) def __dealloc__(self): if self._builder != NULL: del self._builder def set_projected_column_names(self, names): """ Sets the columns to be scanned. Returns a reference to itself to facilitate chaining. Parameters ---------- names : list of strings Returns ------- self : ScanTokenBuilder """ if isinstance(names, str): names = [names] cdef vector[string] v_names for name in names: v_names.push_back(tobytes(name)) check_status(self._builder.SetProjectedColumnNames(v_names)) return self def set_projected_column_indexes(self, indexes): """ Sets the columns to be scanned. Returns a reference to itself to facilitate chaining. Parameters ---------- indexes : list of integers representing column indexes Returns ------- self : ScanTokenBuilder """ cdef vector[int] v_indexes = indexes check_status(self._builder.SetProjectedColumnIndexes(v_indexes)) return self def set_batch_size_bytes(self, batch_size): """ Sets the batch size in bytes. Returns a reference to itself to facilitate chaining. Parameters ---------- batch_size : Size of batch in bytes Returns ------- self : ScanTokenBuilder """ check_status(self._builder.SetBatchSizeBytes(batch_size)) return self def set_read_mode(self, read_mode): """ Set the read mode for scanning. Parameters ---------- read_mode : {'latest', 'snapshot'} You can also use the constants READ_LATEST, READ_AT_SNAPSHOT Returns ------- self : ScanTokenBuilder """ cdef ReadMode rmode def invalid_selection_policy(): raise ValueError('Invalid read mode: {0}' .format(read_mode)) if isinstance(read_mode, int): if 0 <= read_mode < len(_read_modes): check_status(self._builder.SetReadMode( <ReadMode> read_mode)) else: invalid_selection_policy() else: try: check_status(self._builder.SetReadMode( _read_modes[read_mode.lower()])) except KeyError: invalid_selection_policy() return self def set_snapshot(self, timestamp, format=None): """ Set the snapshot timestamp for this ScanTokenBuilder. Parameters --------- timestamp : datetime.datetime or string If a string is provided, a format must be provided as well. NOTE: This should be in UTC. If a timezone aware datetime object is provided, it will be converted to UTC, otherwise, all other input is assumed to be UTC. format : Required if a string timestamp is provided Uses the C strftime() function, see strftime(3) documentation. Returns ------- self : ScanTokenBuilder """ # Confirm that a format is provided if timestamp is a string if isinstance(timestamp, six.string_types) and not format: raise ValueError( "To use a string timestamp you must provide a format. " + "See the strftime(3) documentation.") snapshot_micros = to_unixtime_micros(timestamp, format) if snapshot_micros >= 0: check_status(self._builder.SetSnapshotMicros( <uint64_t> snapshot_micros)) else: raise ValueError( "Snapshot Timestamps be greater than the unix epoch.") return self def set_timeout_millis(self, millis): """ Sets the scan request timeout in milliseconds. Returns a reference to itself to facilitate chaining. Parameters ---------- millis : int64_t timeout in milliseconds Returns ------- self : ScanTokenBuilder """ check_status(self._builder.SetTimeoutMillis(millis)) return self def set_timout_millis(self, millis): """ See set_timeout_millis(). This method is deprecated due to having a typo in the method name and will be removed in a future release. """ return self.set_timeout_millis(millis) def set_fault_tolerant(self): """ Makes the underlying KuduScanner fault tolerant. Returns a reference to itself to facilitate chaining. Returns ------- self : ScanTokenBuilder """ check_status(self._builder.SetFaultTolerant()) return self def set_selection(self, replica_selection): """ Set the replica selection policy while scanning. Parameters ---------- replica_selection : {'leader', 'closest', 'first'} You can also use the constants LEADER_ONLY, CLOSEST_REPLICA, and FIRST_REPLICA Returns ------- self : ScanTokenBuilder """ cdef ReplicaSelection selection def invalid_selection_policy(): raise ValueError('Invalid replica selection policy: {0}' .format(replica_selection)) if isinstance(replica_selection, int): if 0 <= replica_selection < len(_replica_selection_policies): check_status(self._builder.SetSelection( <ReplicaSelection> replica_selection)) else: invalid_selection_policy() else: try: check_status(self._builder.SetSelection( _replica_selection_policies[replica_selection.lower()])) except KeyError: invalid_selection_policy() return self def add_predicates(self, preds): """ Add a list of scan predicates to the ScanTokenBuilder. Select columns from the parent table and make comparisons to create predicates. Examples -------- c = table[col_name] preds = [c >= 0, c <= 10] builder.add_predicates(preds) Parameters ---------- preds : list of Predicate """ for pred in preds: self.add_predicate(pred) cpdef add_predicate(self, Predicate pred): """ Add a scan predicates to the scan token. Select columns from the parent table and make comparisons to create predicates. Examples -------- pred = table[col_name] <= 10 builder.add_predicate(pred) Parameters ---------- pred : kudu.Predicate Returns ------- self : ScanTokenBuilder """ cdef KuduPredicate* clone # We clone the KuduPredicate so that the Predicate wrapper class can be # reused clone = pred.pred.Clone() check_status(self._builder.AddConjunctPredicate(clone)) def new_bound(self): """ Returns a new instance of a PartialRow to be later set with add_lower_bound()/add_upper_bound(). Returns ------- bound : PartialRow """ return self._table.schema.new_row() def add_lower_bound(self, bound): """ Sets the lower bound of the scan. Returns a reference to itself to facilitate chaining. Parameters ---------- bound : PartialRow/list/tuple/dict Returns ------- self : ScanTokenBuilder """ cdef: PartialRow row # Convert record to bound if not isinstance(bound, PartialRow): row = self._table.schema.new_row(bound) else: row = bound check_status(self._builder.AddLowerBound(deref(row.row))) return self def add_upper_bound(self, bound): """ Sets the upper bound of the scan. Returns a reference to itself to facilitate chaining. Parameters ---------- bound : PartialRow/list/tuple/dict Returns ------- self : ScanTokenBuilder """ cdef: PartialRow row # Convert record to bound if not isinstance(bound, PartialRow): row = self._table.schema.new_row(bound) else: row = bound check_status(self._builder.AddUpperBound(deref(row.row))) return self def set_cache_blocks(self, cache_blocks): """ Sets the block caching policy. Returns a reference to itself to facilitate chaining. Parameters ---------- cache_blocks : bool Returns ------- self : ScanTokenBuilder """ check_status(self._builder.SetCacheBlocks(cache_blocks)) return self def build(self): """ Build the set of scan tokens. The builder may be reused after this call. Returns a list of ScanTokens to be serialized and executed in parallel with seperate client instances. Returns ------- tokens : List[ScanToken] """ cdef: vector[KuduScanToken*] tokens size_t i check_status(self._builder.Build(&tokens)) result = [] for i in range(tokens.size()): token = ScanToken() result.append(token._init(tokens[i])) return result cdef class Tablet: """ Represents a remote Tablet. Contains the tablet id and Replicas associated with the Kudu Tablet. Retrieved by the ScanToken.tablet() method. """ cdef: const KuduTablet* _tablet vector[KuduReplica*] _replicas cdef _init(self, const KuduTablet* tablet): self._tablet = tablet return self def id(self): return frombytes(self._tablet.id()) def replicas(self): cdef size_t i result = [] _replicas = self._tablet.replicas() for i in range(_replicas.size()): replica = Replica() result.append(replica._init(_replicas[i])) return result cdef class Replica: """ Represents a remote Tablet's replica. Retrieve a list of Replicas with the Tablet.replicas() method. Contains the boolean is_leader and its respective TabletServer object. """ cdef const KuduReplica* _replica cdef _init(self, const KuduReplica* replica): self._replica = replica return self def is_leader(self): return self._replica.is_leader() def ts(self): ts = TabletServer() return ts._init(&self._replica.ts()) cdef class KuduError: """ Wrapper for a C++ KuduError indicating a client error resulting from applying operations in a session. """ cdef: C_KuduError* error def __cinit__(self): self.error = NULL def __dealloc__(self): # We own this object if self.error != NULL: del self.error def failed_op(self): """ Get debug string representation of the failed operation. Returns ------- op : str """ return frombytes(self.error.failed_op().ToString()) def was_possibly_successful(self): """ Check if there is a chance that the requested operation was successful. In some cases, it is possible that the server did receive and successfully perform the requested operation, but the client can't tell whether or not it was successful. For example, if the call times out, the server may still succeed in processing at a later time. Returns ------- result : bool """ return self.error.was_possibly_successful() def __repr__(self): return "KuduError('%s')" % (self.error.status().ToString()) cdef class PartialRow: def __cinit__(self, Schema schema): # This gets called before any subclass cinit methods self.schema = schema self._own = 1 def __dealloc__(self): if self._own and self.row != NULL: del self.row def __setitem__(self, key, value): if isinstance(key, basestring): self.set_field(key, value) else: if 0 <= key < len(self.schema): self.set_loc(key, value) else: raise IndexError("Column index {0} is out of bounds." .format(key)) def from_record(self, record): """ Initializes PartialRow with values from an input record. The record can be in the form of a tuple, dict, or list. Dictionary keys can be either column names or indexes. Parameters ---------- record : tuple/list/dict Returns ------- self : PartialRow """ if isinstance(record, (tuple, list)): for indx, val in enumerate(record): self[indx] = val elif isinstance(record, dict): for key, val in dict_iter(record): self[key] = val else: raise TypeError("Invalid record type <{0}> for " + "PartialRow.from_record." .format(type(record).__name__)) return self cpdef set_field(self, key, value): cdef: int i = self.schema.get_loc(key) self.set_loc(i, value) cpdef set_loc(self, int i, value): cdef: DataType t = self.schema.loc_type(i) Slice slc if value is None: check_status(self.row.SetNull(i)) return # Leave it to Cython to do the coercion and complain if it doesn't # work. Cython will catch many casting problems but we should verify # with unit tests. if t == KUDU_BOOL: check_status(self.row.SetBool(i, <c_bool> value)) elif t == KUDU_INT8: check_status(self.row.SetInt8(i, <int8_t> value)) elif t == KUDU_INT16: check_status(self.row.SetInt16(i, <int16_t> value)) elif t == KUDU_INT32: check_status(self.row.SetInt32(i, <int32_t> value)) elif t == KUDU_INT64: check_status(self.row.SetInt64(i, <int64_t> value)) elif t == KUDU_FLOAT: check_status(self.row.SetFloat(i, <float> value)) elif t == KUDU_DOUBLE: check_status(self.row.SetDouble(i, <double> value)) elif t == KUDU_STRING: if isinstance(value, unicode): value = value.encode('utf8') slc = Slice(<char*> value, len(value)) check_status(self.row.SetStringCopy(i, slc)) elif t == KUDU_BINARY: if isinstance(value, unicode): raise TypeError("Unicode objects must be explicitly encoded " + "before storing in a Binary field.") slc = Slice(<char*> value, len(value)) check_status(self.row.SetBinaryCopy(i, slc)) elif t == KUDU_VARCHAR: if isinstance(value, unicode): value = value.encode('utf8') slc = Slice(<char*> value, len(value)) check_status(self.row.SetVarchar(i, slc)) elif t == KUDU_UNIXTIME_MICROS: check_status(self.row.SetUnixTimeMicros(i, <int64_t> to_unixtime_micros(value))) elif t == KUDU_DATE: val = date_to_unix_epoch_days(value) check_status(self.row.SetDate(i, <int32_t>val)) elif t == KUDU_DECIMAL: IF PYKUDU_INT128_SUPPORTED == 1: check_status(self.row.SetUnscaledDecimal(i, <int128_t>to_unscaled_decimal(value))) ELSE: raise KuduException("The decimal type is not supported when GCC version is < 4.6.0" % self) else: raise TypeError("Cannot set kudu type <{0}>.".format(_type_names[t])) cpdef set_field_null(self, key): pass cpdef set_loc_null(self, int i): pass cdef add_to_session(self, Session s): pass cdef class WriteOperation: cdef: # Whether the WriteOperation has been applied. # Set by subclasses. bint applied KuduWriteOperation* op PartialRow py_row def __cinit__(self, Table table, record=None): self.applied = 0 self.py_row = PartialRow(table.schema) self.py_row._own = 0 cdef add_to_session(self, Session s): if self.applied: raise Exception check_status(s.s.get().Apply(self.op)) self.op = NULL self.applied = 1 def __setitem__(self, key, value): # Since the write operation is no longer a sub-class of the PartialRow # we need to explicitly retain the item setting functionality and API # style. self.py_row[key] = value cdef class Insert(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewInsert() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class InsertIgnore(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewInsertIgnore() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class Upsert(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewUpsert() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class UpsertIgnore(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewUpsertIgnore() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class Update(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewUpdate() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class UpdateIgnore(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewUpdateIgnore() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class Delete(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewDelete() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef class DeleteIgnore(WriteOperation): def __cinit__(self, Table table, record=None): self.op = table.ptr().NewDeleteIgnore() self.py_row.row = self.op.mutable_row() if record: self.py_row.from_record(record) def __dealloc__(self): del self.op cdef inline cast_pyvalue(DataType t, object o): if t == KUDU_BOOL: return BoolVal(o) elif t == KUDU_INT8: return Int8Val(o) elif t == KUDU_INT16: return Int16Val(o) elif t == KUDU_INT32: return Int32Val(o) elif t == KUDU_INT64: return Int64Val(o) elif t == KUDU_DOUBLE: return DoubleVal(o) elif t == KUDU_FLOAT: return FloatVal(o) elif t == KUDU_STRING: return StringVal(o) elif t == KUDU_UNIXTIME_MICROS: return UnixtimeMicrosVal(o) elif t == KUDU_BINARY: return StringVal(o) elif t == KUDU_VARCHAR: return StringVal(o) elif t == KUDU_DATE: return DateVal(o) else: raise TypeError("Cannot cast kudu type <{0}>".format(_type_names[t])) cdef class TableAlterer: """ Alters an existing table based on the provided steps. """ def __cinit__(self, Table table): self._table = table self._new_name = None self._init(self._table.parent.cp .NewTableAlterer(tobytes(self._table.name))) def __dealloc__(self): if self._alterer != NULL: del self._alterer cdef _init(self, KuduTableAlterer* alterer): self._alterer = alterer def rename(self, table_name): """ Rename the table. Returns a reference to itself to facilitate chaining. Parameters ---------- table_name : str The new name for the table. Return ------ self : TableAlterer """ self._alterer.RenameTo(tobytes(table_name)) self._new_name = table_name return self def add_column(self, name, type_=None, nullable=None, compression=None, encoding=None, default=None): """ Add a new column to the table. When adding a column, you must specify the default value of the new column using ColumnSpec.default(...) or the default parameter in this method. Parameters ---------- name : string type_ : string or KuduType Data type e.g. 'int32' or kudu.int32 nullable : boolean, default None New columns are nullable by default. Set boolean value for explicit nullable / not-nullable compression : string or int One of kudu.COMPRESSION_* constants or their string equivalent. encoding : string or int One of kudu.ENCODING_* constants or their string equivalent. default : obj Use this to set the column default value Returns ------- spec : ColumnSpec """ cdef: ColumnSpec result = ColumnSpec() result.spec = self._alterer.AddColumn(tobytes(name)) if type_ is not None: result.type(type_) if nullable is not None: result.nullable(nullable) if compression is not None: result.compression(compression) if encoding is not None: result.encoding(encoding) if default: result.default(default) return result def alter_column(self, name, rename_to=None): """ Alter an existing column. Parameters ---------- name : string rename_to : str If set, the column will be renamed to this Returns ------- spec : ColumnSpec """ cdef: ColumnSpec result = ColumnSpec() result.spec = self._alterer.AlterColumn(tobytes(name)) if rename_to: result.rename(rename_to) return result def drop_column(self, name): """ Drops an existing column from the table. Parameters ---------- name : str The name of the column to drop. Returns ------- self : TableAlterer """ self._alterer.DropColumn(tobytes(name)) return self def add_range_partition(self, lower_bound=None, upper_bound=None, lower_bound_type='inclusive', upper_bound_type='exclusive'): """ Add a range partition to the table with the specified lower bound and upper bound. Multiple range partitions may be added as part of a single alter table transaction by calling this method multiple times on the table alterer. This client may immediately write and scan the new tablets when Alter() returns success, however other existing clients may have to wait for a timeout period to elapse before the tablets become visible. This period is configured by the master's 'table_locations_ttl_ms' flag, and defaults to 5 minutes. Parameters ---------- lower_bound : PartialRow/list/tuple/dict upper_bound : PartialRow/list/tuple/dict lower_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND upper_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND Returns ------- self : TableAlterer """ cdef: PartialRow lbound PartialRow ubound if not isinstance(lower_bound, PartialRow): lbound = self._table.schema.new_row(lower_bound) else: lbound = lower_bound lbound._own = 0 if not isinstance(upper_bound, PartialRow): ubound = self._table.schema.new_row(upper_bound) else: ubound = upper_bound ubound._own = 0 self._alterer.AddRangePartition( lbound.row, ubound.row, _check_convert_range_bound_type(lower_bound_type), _check_convert_range_bound_type(upper_bound_type) ) def add_custom_range_partition(self, range_partition): """ Add a range partition with custom hash schema. Multiple range partitions may be added as part of a single alter table transaction by calling this method multiple times on the table alterer. This client may immediately write and scan the new tablets when Alter() returns success, however other existing clients may have to wait for a timeout period to elapse before the tablets become visible. This period is configured by the master's 'table_locations_ttl_ms' flag, and defaults to 5 minutes. Parameters ---------- range_partition : RangePartition Returns ------- self : TableAlterer """ cdef: vector[string] v KuduRangePartition* p PartialRow lower_bound PartialRow upper_bound if not isinstance(range_partition.lower_bound, PartialRow): lower_bound = self._table.schema.new_row(range_partition.lower_bound) else: lower_bound = range_partition.lower_bound lower_bound._own = 0 if not isinstance(range_partition.upper_bound, PartialRow): upper_bound = self._table.schema.new_row(range_partition.upper_bound) else: upper_bound = range_partition.upper_bound upper_bound._own = 0 p = new KuduRangePartition( lower_bound.row, upper_bound.row, range_partition.lower_bound_type, range_partition.upper_bound_type) for col_names, num_buckets, seed in range_partition.hash_dimensions: v.clear() for n in col_names: v.push_back(tobytes(n)) p.add_hash_partitions(v, num_buckets, seed if seed else 0) self._alterer.AddRangePartition(p) def drop_range_partition(self, lower_bound=None, upper_bound=None, lower_bound_type='inclusive', upper_bound_type='exclusive'): """ Drop the range partition from the table with the specified lower bound and upper bound. The bounds must match an existing range partition exactly, and may not span multiple range partitions. Multiple range partitions may be dropped as part of a single alter table transaction by calling this method multiple times on the table alterer. Parameters ---------- lower_bound : PartialRow/list/tuple/dict upper_bound : PartialRow/list/tuple/dict lower_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND upper_bound_type : {'inclusive', 'exclusive'} or constants kudu.EXCLUSIVE_BOUND and kudu.INCLUSIVE_BOUND Returns ------- self : TableAlterer """ cdef: PartialRow lbound PartialRow ubound if not isinstance(lower_bound, PartialRow): lbound = self._table.schema.new_row(lower_bound) else: lbound = lower_bound lbound._own = 0 if not isinstance(upper_bound, PartialRow): ubound = self._table.schema.new_row(upper_bound) else: ubound = upper_bound ubound._own = 0 self._alterer.DropRangePartition( lbound.row, ubound.row, _check_convert_range_bound_type(lower_bound_type), _check_convert_range_bound_type(upper_bound_type) ) def set_owner(self, new_owner): """ Set the owner of the table. Parameters ---------- new_owner : string Returns ------- self : TableAlterer """ self._alterer.SetOwner(tobytes(new_owner)) return self def set_comment(self, new_comment): """ Set the comment on the table. Parameters ---------- new_comment : string Returns ------- self : TableAlterer """ self._alterer.SetComment(tobytes(new_comment)) return self def alter(self): """ Alter table. Returns a new table object upon completion of the alter. Returns ------- table :Table """ check_status(self._alterer.Alter()) return self._table.parent.table(self._new_name or self._table.name) ```
Paranam is a town in the Para District, Suriname. Paranam was created in 1938 for a bauxite factory. In 1965, an aluminium smelter was added. The factories closed down in 2017. History There used to be a little hamlet called Klein Curaçao at the location. Paranam was created in 1938 when Alcoa began building a plant to support new mining areas along the Suriname River. Built on a former plantation, the facility was called Paranam after the Para and Suriname Rivers which border the mining concession areas. The Paranam mine began operations in 1941. Alcoa operates worldwide through a joint ventures, and the operation in Suriname is called The Suriname Aluminum Company (or Suralco). A market and theatre were built in town, however most workers remained in Paramaribo. In 1965, an aluminium smelter was opened in Paranam which operated on the electricity generated by the Afobaka Dam. The smelter converts bauxite to produce approximately 3,150 metric tons of alumina each day at this location. Paranam became the first location in the world with an integrated system where the earth was transformed into aluminium. In 2015, Alcoa announced that it was going to close the factories, because the local supplies were exhausted, and the factories could not handle the bauxite from the Bakhuis Mountains. The factories closed down in 2017. Harbour Due to the deep water available on the Suriname River, Paranam is a port accessible to oceangoing ships. A pilot is required. Notable people Hélène Ramjiawan (1952–2021), children's book author References Populated places in Para District Bauxite mining in Suriname 1938 establishments in Suriname Populated places established in 1938
is a 2013 Japanese film directed by Katsuhide Motoki, and released by Warner Bros. in Japan on 22 November 2013. Inspired by the 2003 British romantic comedy Love Actually, the film is made up of six separate stories revolving around ten people at Tokyo Station just before Christmas. It was produced to commemorate the 100th anniversary of Tokyo Station, and was filmed with full cooperation by the railway company JR East. Stories Cast Story 1: Eve no Koibito Hiroshi Tamaki as Kazuki Kuroyama, a company president Rin Takanashi as Reiko Sasaki, an aspiring actress Story 2: Enkyori Renai Fumino Kimura as Yukina Yamaguchi, a fashion designer Masahiro Higashide as Takumi Tsumura, a construction worker Story 3: Christmas no Yūki Tsubasa Honda as Natsumi Otomo, a cake shop employee Story 4: Christmas Present Miwako Ichikawa as Chiharu Kishimoto, an orphanage worker Emiri Kai as Akane Terai Story 5: Nibun no Ichi Seijinshiki Saburō Tokitō as Masayuki Miyazaki, a train driver Nene Otsuka as Saori Miyazaki, Masayuki's wife Ryutaro Yamasaki as Koji Miyazaki, their son Story 6: Okurete Kita Present Chieko Baisho as Kotoko Oshima, a Tokyo Station pastry shop employee Nenji Kobayashi as Taizo Matsuura Special screenings The film was screened at the 26th Tokyo International Film Festival on 23 October 2013. References External links It All Began When I Met You at KineNote 2013 films Japanese anthology films Japanese remakes of foreign films Films directed by Katsuhide Motoki Films scored by Yoshihiro Ike 2010s Japanese-language films
Ground Components were an Australian soul, punk rock band. Formed December 2002 by Indra Adams on bass guitar, Joe McGuigan on lead vocals and guitar, Simon McGuigan on drums and Dallas Paxton on keyboards. Their debut album, An Eye for a Brow, a Tooth for a Pick (September 2006), reached the ARIA Albums Chart. They disbanded in 2007. History Ground Components were formed in the Melbourne suburb of East Brunswick in December 2002 by Indra Adams on bass guitar, Joe McGuigan on lead vocals and guitar, Simon McGuigan on drums and Dallas Paxton on keyboards. Their first public performances were in that year, playing alongside friends' bands and at house parties. They signed with local independent record label, Love&Mercy, in the following year. They performed at Meredith Music Festival, Big Day Out, Splendour in the Grass and Homebake. And played as support band for The Black Keys, Hard Fi, Teenage Fanclub, Saul Williams, Spoon, My Morning Jacket, Muse band, M Ward, Microphones, J Mascis, The Liars, Suicide Girls, The Sleepy Jackson, Spiderbait, Powderfinger. Before touring United States and playing SXSW festival, and the UK in 2004. Ground Components collaborated with Melbourne-based female MC Macromantics (Kill Rock Stars, US). And played as backing band to both Microphones and M Ward. Adams and Paxton also played horns for My Morning Jacket on their most recent tour of Australia. Their debut album, An Eye for a Brow, a Tooth for a Pick, was released in September 2006 via Shock Records and reached the ARIA Albums Chart. The group disbanded soon after Simon McGuigan left in 2007 with then-guitarist, Robert Bravington. The two played and recorded together in Baby Brain (2008/09) before starting Thread Count Music Production in 2010. Adams and Paxton played on recordings by Dan Kelly – Adams is a member of his live backing band. Paxton appeared as a guest member of Midnight Juggeranuts and Architecture in Helsinki at live shows. Adams is founder of Singhala Music, a music bookings and online media business. Joe McGuigan performed as Garage Joe, a trio consisting of members of Little Red. Members Indra Adams – bass guitar, backing vocals Joe McGuigan – rhythm Guitar, vocals Simon McGuigan – drums Dallas Paxton – electric piano, Hammond organ, backing vocals Robert Bravington – guitar Discography Studio albums Extended plays References External links "Ground Components" at The Dwarf Victoria (state) musical groups
Flava was a British hip-hop music television channel owned and operated by Sony Pictures Television. It was launched in June 2004 and was formerly called B4 TV, a previous pre-launch music channel from CSC Media Group. Flava broadcast for 24 hours a day and played Hip Hop, Urban and R&B music from the late 1970s to the 2010s. It also occasionally showed films and original programming (#PLAY). The channel advertised itself as 100% Old Skool Hip-Hop/R&B 24/7. History B4 Flava launched on 12 July 2004 and started off as a test channel which focused on Pop and Dance under the name of "B4". The channel used to play the latest pre release music videos from the notable artists and groups. It also had hours dedicated to playing requested music. The channel had advertised itself as both 'B4 It's A Hit' and 'B4 Everyone Else'. The B4 logo was on screen in the bottom left-hand corner during music videos and the song information was shown in a white coloured bar at the start and near the end of each music video. The channels' identity was also seen before and after advert breaks when the B4 logo forms on screen in a white box shape on an orange background. B4 was available 24 hours a day on Sky channel 357 and was part of several music channels owned by CSC Media Group. B4 also produced an early morning music video programme broadcast from 2004 on weekdays on Channel 4 at 7am. It was normally broadcast as part of Channel 4's breakfast programming following children's programmes and preceding a number of comedy programmes from America. Produced by the firm behind ITV's The Chart Show, the show featured around seven new upfront videos each day that were going to be released in the United Kingdom in the near future, normally within the next month. Rebrand to Flava The B4 rebrand to Flava first came to light when the Ofcom licence for B4 was removed and replaced by one under the name of Flava, this also reflected the EPG references of the term "Flava" being used to describe the programmes being shown, in late February/early March 2008. On 26 March 2008, B4 launched officially as an all-urban music channel named Flava. On 29 September 2009, Flava launched on Freesat channel 502, replacing Scuzz on the platform. On 26 November 2012, Flava changed its logo. On 5 June 2013, Flava swapped positions with Scuzz on Sky. The channel moved from channel 367 to 374, while Scuzz moved from 374 to 367 (to sit next to Kerrang!, as both are rock music channels). On 21 July 2014, Flava, along with Bliss were removed from Freesat. On 23 April 2017, Flava introduced a brand new logo, changed their programme graphics from blue to black (red in some programmes and yellow in "Remember The Year"), as well as later rebranding themselves to be a 100% Old Skool Hip Hop and RnB channel on 2 May 2017. Closure Flava ceased broadcasting at 11:15 on 1 November 2017 without warning, with "Juicy" by The Notorious B.I.G. the final music video to be played on the channel. Flava abruptly crashed and went blank in the middle of the video. The channel was then closed down and removed from the EPG abruptly and shortly after. The last video played in full was "In Da Club" by 50 Cent. Programming 99 Problems: Rap Anthems - We've got 99 rap anthems for you right now, so keep it Flava for Old Skool Eminem, Jay Z, Dr Dre, Snoop, 2Pac & more. A-Z of Hip Hop - The ultimate countdown of the best Hip-Hop videos from artists A-Z. Bass Believers - A collection of the best drum 'n' base tunes. Big Tunes Fo' Shizzle - Non stop variety of Hip Hop Music Block Rockin Beatz - A mix of big urban tunes. Brand New! This Weeks Hottest - Brand new music, and the biggest new hip-hop and R&B music. Breakfast Beats - Non-stop hip hop, rnb & drum 'n' bass music. Britain's Next Urban Superstar with Jordan Kensington - The nationwide talent search ran by Jordan Kensington. Charlie Sloth's Old Skool Takeover - BBC Radio 1Xtra presenter Charlie Sloth chooses his selection of old skool hip hop music. Dope Morning Beats - The latest urban music on a morning. Double Up - Back to back videos from the best urban artists around. Drum 'n' Bass - A mix of the finest drum 'n' base music. First for Flava - A collection of the newest urban music videos. Flava at the Flicks - The best hip-hop music from movies Freshest Beats - The latest urban music. Garage Anthems - The best in new and classic garage tunes. Godfathers of Hip Hop - The best music from male urban artists. Hip Hop Download Chart - A countdown of the weeks most downloaded Hip-Hop tracks. Hip Hop Number Ones - A collection of Hip-Hop number ones from recent years. Hip Hop Vs Garage - A mash up of Hip-Hop and garage music. Hip Hop Xplosion - A mix of the biggest Hip-Hop music. In The Mix - The biggest urban, hip-hop, pop and R&B tunes, in the mix! In The Mix: 90s Hip-Hop Anthems - Rap classics from the 90s, in the mix. Masters of Hip Hop - Music from the founders of Hip-Hop. Morning Rewind - Hip Hop from the 80s, 90s & 00s on a morning. Non Stop Flava - Non-stop R&B and Hip-Hop music. Official Flava Urban Chart - Get your daily fix of the hottest RnB, Hip Hop, grime and dance tracks in our massive Top 20 countdown. Party Flava - Classic urban party tunes. #PLAY - Interactive twitter block #PLAY: Eminem and Friends - A special edition of #PLAY reserved for songs by Eminem and his collaborators. #PLAY: Movie Soundtracks - A special edition of #PLAY featuring hip-hop music from movies. R&B Download Chart - A countdown of the most downloaded R&B songs each week. R&B Singles Chart - Countdown of the weeks' top R&B music. Scratch Masters - Back to back scratch tunes from the experts. Something for da Honeyz - The best music from male RnB/Hip-Hop artists. Straight Outta Old Skool - Hip Hop from the 80s, 90s & 00s The Jump Off - A collection of Hip-Hop music with the loudest beats. Top 10 Biggest Tracks Now - The latest top 10 hottest urban tunes. Top 20 Bad Boyz of Hip Hop - Countdown of the best male artists in Hip-Hop. Top 20 Buff Boys - We unleash 20 of the buffest boys in hip hop music! Turn Up The Flava - A collection of the best R&B music from the last two years. Urban Beats - The best new and classic R&B and Hip-Hop music. Urban Cutz - The latest R&B and Hip-Hop music. Wake Up wit Flava - A mix of the latest new music. Westwood TV - Interviews with artists from the hip hop scene xXx: State of the Union - See more. B4 programming B4 Breakers - A countdown of the top ten most selected videos. B4 Breakfast - An energetic mix of the latest pre-release songs. B4 Dawn - Music from new artists and groups. B4 Hits - A selection of the newest music. B4 Loves... - An hour dedicated to the life and music of one artist or group. B4's Big Ones - A mix of the biggest and best hits. B4's Hot Hits - All the latest and most requested music videos. B4's Lovin' - The most requested new music. B4's Most Selected - The top ten most requested music videos. Brand New - All the biggest and newest music videos. First on Friday - All the latest music videos every Friday. Fresh New Tracks - A showcase of brand new music videos. Most Requested - Songs most requested by the viewers. Out Tomorrow - Brand new music that's released tomorrow. Today's Most Selected - An hour of music videos selected by viewers. Top 5 - Five non interrupted songs from an artist or group. Top Ten Bands to See This Week - A countdown of the top ten best bands to see in concert. Videos to Cure a Hangover - A mix of the best non-stop music. Wake Up with B4 - A selection of fresh new music videos. External links Flava - Official site CSC Media Group Official myspace CSC Media Group Music video networks in the United Kingdom Television channels and stations established in 2004 Sony Pictures Television Television channels and stations disestablished in 2017 Defunct television channels in the United Kingdom
James Nutter may refer to: James A. Nutter, American football player and coach James B. Nutter Sr. (1928–2017), founder and chairman of James B. Nutter & Company
John Balmbra (born c. 1811) was the owner, proprietor, manager and licensee of Balmbra's Music Hall in Newcastle, England, to which he gave his name. John Balmbra was born about 1811 in Alnwick, Northumberland. He became owner and licensee of the Wheatsheaf Public House at 6 Cloth Market, Newcastle, possibly from 1859 to 1864. In about 1848 a first floor room of the pub was opened and in later advertisements was called "The Royal Music Saloon" (this name appears in advertisements dated 1859). In about 1862 it appears that the room was rebuilt and the name changed to Balmbra's Music Hall. It was here that the song "Blaydon Races" was first performed by George "Geordie" Ridley in 1862, The song referring to the Music Hall by name, as the starting point of the trip – "I took the bus from Balmbra’s and she was heavy-laden, Away we went along Collingwood Street, that’s on the road to Blaydon." References (Booklet) The Hall That Outlived Them All by Cindy Lightburn. (Amazon) (Booklet) BALMBRA'S: A Nostalgic Revisit by Cindy Lightburn. (Amazon) External links Balmbra's – The Theatres Trust Balmbra's Music Hall, Newcastle Allan’s Illustrated Edition of Tyneside songs and readings The Hall That Outlived Them All by Cindy Lightburn BALMBRA'S: A Nostalgic Revisit by Cindy Lightburn Music hall people People from Newcastle upon Tyne (district)
The 2002 WGC-Accenture Match Play Championship was a golf tournament that was played from February 20–24, 2002 at La Costa Resort and Spa in Carlsbad, California. It was the fourth WGC-Accenture Match Play Championship and the first of four World Golf Championships events held in 2002. Kevin Sutherland won his first and only World Golf Championships event by defeating Scott McCarron 1 up in the 36 hole final. It was also the only PGA Tour win for Sutherland. Brackets The Championship was a single elimination match play event. The field consisted of the top 64 players available from the Official World Golf Rankings, seeded according to the rankings. José Cóceres (ranked 23) withdrew because he was recovering from a broken arm and Thomas Bjørn (ranked 24) withdrew to rest an injured shoulder. They were replaced by John Cook (ranked 65) and Peter O'Malley (ranked 66). Bobby Jones bracket Ben Hogan bracket Gary Player bracket Sam Snead bracket Final Four Prize money breakdown References External links Bracket PDF source About the matches WGC Match Play Golf in California Carlsbad, California Sports competitions in San Diego County, California WGC-Accenture Match Play Championship WGC-Accenture Match Play Championship WGC-Accenture Match Play Championship
```python # # # path_to_url # # Unless required by applicable law or agreed to in writing, software # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """Tests for official.nlp.projects.lra.mega_encoder.""" import numpy as np import tensorflow as tf, tf_keras from official.projects.lra import mega_encoder class MegaEncoderTest(tf.test.TestCase): def test_encoder(self): sequence_length = 1024 batch_size = 2 vocab_size = 1024 network = mega_encoder.MegaEncoder( num_layers=1, vocab_size=1024, max_sequence_length=4096, ) word_id_data = np.random.randint( vocab_size, size=(batch_size, sequence_length) ) mask_data = np.random.randint(2, size=(batch_size, sequence_length)) type_id_data = np.random.randint(2, size=(batch_size, sequence_length)) outputs = network({ "input_word_ids": word_id_data, "input_mask": mask_data, "input_type_ids": type_id_data, }) self.assertEqual( outputs["sequence_output"].shape, (batch_size, sequence_length, 128), ) if __name__ == "__main__": tf.test.main() ```
```go package css_parser import ( "fmt" "testing" "github.com/evanw/esbuild/internal/ast" "github.com/evanw/esbuild/internal/compat" "github.com/evanw/esbuild/internal/config" "github.com/evanw/esbuild/internal/css_printer" "github.com/evanw/esbuild/internal/logger" "github.com/evanw/esbuild/internal/test" ) func expectPrintedCommon(t *testing.T, name string, contents string, expected string, expectedLog string, loader config.Loader, options config.Options) { t.Helper() t.Run(name, func(t *testing.T) { t.Helper() log := logger.NewDeferLog(logger.DeferLogNoVerboseOrDebug, nil) tree := Parse(log, test.SourceForTest(contents), OptionsFromConfig(loader, &options)) msgs := log.Done() text := "" for _, msg := range msgs { text += msg.String(logger.OutputOptions{}, logger.TerminalInfo{}) } test.AssertEqualWithDiff(t, text, expectedLog) symbols := ast.NewSymbolMap(1) symbols.SymbolsForSource[0] = tree.Symbols result := css_printer.Print(tree, symbols, css_printer.Options{ MinifyWhitespace: options.MinifyWhitespace, }) test.AssertEqualWithDiff(t, string(result.CSS), expected) }) } func expectPrinted(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents, contents, expected, expectedLog, config.LoaderCSS, config.Options{}) } func expectPrintedLocal(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [local]", contents, expected, expectedLog, config.LoaderLocalCSS, config.Options{}) } func expectPrintedLower(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [lower]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ UnsupportedCSSFeatures: ^compat.CSSFeature(0), }) } func expectPrintedLowerUnsupported(t *testing.T, unsupportedCSSFeatures compat.CSSFeature, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [lower]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ UnsupportedCSSFeatures: unsupportedCSSFeatures, }) } func expectPrintedWithAllPrefixes(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [prefixed]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ CSSPrefixData: compat.CSSPrefixData(map[compat.Engine]compat.Semver{ compat.Chrome: {Parts: []int{0}}, compat.Edge: {Parts: []int{0}}, compat.Firefox: {Parts: []int{0}}, compat.IE: {Parts: []int{0}}, compat.IOS: {Parts: []int{0}}, compat.Opera: {Parts: []int{0}}, compat.Safari: {Parts: []int{0}}, }), }) } func expectPrintedMinify(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [minify]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ MinifyWhitespace: true, }) } func expectPrintedMangle(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [mangle]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ MinifySyntax: true, }) } func expectPrintedLowerMangle(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [lower, mangle]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ UnsupportedCSSFeatures: ^compat.CSSFeature(0), MinifySyntax: true, }) } func expectPrintedMangleMinify(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [mangle, minify]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ MinifySyntax: true, MinifyWhitespace: true, }) } func expectPrintedLowerMinify(t *testing.T, contents string, expected string, expectedLog string) { t.Helper() expectPrintedCommon(t, contents+" [lower, minify]", contents, expected, expectedLog, config.LoaderCSS, config.Options{ UnsupportedCSSFeatures: ^compat.CSSFeature(0), MinifyWhitespace: true, }) } func TestSingleLineComment(t *testing.T) { expectPrinted(t, "a, // a\nb // b\n{}", "a, // a b // b {\n}\n", "<stdin>: WARNING: Comments in CSS use \"/* ... */\" instead of \"//\"\n"+ "<stdin>: WARNING: Comments in CSS use \"/* ... */\" instead of \"//\"\n") expectPrinted(t, "a, ///// a /////\n{}", "a, ///// a ///// {\n}\n", "<stdin>: WARNING: Comments in CSS use \"/* ... */\" instead of \"//\"\n") } func TestEscapes(t *testing.T) { // TIdent expectPrinted(t, "a { value: id\\65nt }", "a {\n value: ident;\n}\n", "") expectPrinted(t, "a { value: \\69 dent }", "a {\n value: ident;\n}\n", "") expectPrinted(t, "a { value: \\69dent }", "a {\n value: \u69DEnt;\n}\n", "") expectPrinted(t, "a { value: \\2cx }", "a {\n value: \\,x;\n}\n", "") expectPrinted(t, "a { value: \\,x }", "a {\n value: \\,x;\n}\n", "") expectPrinted(t, "a { value: x\\2c }", "a {\n value: x\\,;\n}\n", "") expectPrinted(t, "a { value: x\\, }", "a {\n value: x\\,;\n}\n", "") expectPrinted(t, "a { value: x\\0 }", "a {\n value: x\uFFFD;\n}\n", "") expectPrinted(t, "a { value: x\\1 }", "a {\n value: x\\\x01;\n}\n", "") expectPrinted(t, "a { value: x\x00 }", "a {\n value: x\uFFFD;\n}\n", "") expectPrinted(t, "a { value: x\x01 }", "a {\n value: x\x01;\n}\n", "") // THash expectPrinted(t, "a { value: #0h\\61sh }", "a {\n value: #0hash;\n}\n", "") expectPrinted(t, "a { value: #\\30hash }", "a {\n value: #0hash;\n}\n", "") expectPrinted(t, "a { value: #\\2cx }", "a {\n value: #\\,x;\n}\n", "") expectPrinted(t, "a { value: #\\,x }", "a {\n value: #\\,x;\n}\n", "") // THashID expectPrinted(t, "a { value: #h\\61sh }", "a {\n value: #hash;\n}\n", "") expectPrinted(t, "a { value: #\\68 ash }", "a {\n value: #hash;\n}\n", "") expectPrinted(t, "a { value: #\\68ash }", "a {\n value: #\u068Ash;\n}\n", "") expectPrinted(t, "a { value: #x\\2c }", "a {\n value: #x\\,;\n}\n", "") expectPrinted(t, "a { value: #x\\, }", "a {\n value: #x\\,;\n}\n", "") // TFunction expectPrinted(t, "a { value: f\\6e() }", "a {\n value: fn();\n}\n", "") expectPrinted(t, "a { value: \\66n() }", "a {\n value: fn();\n}\n", "") expectPrinted(t, "a { value: \\2cx() }", "a {\n value: \\,x();\n}\n", "") expectPrinted(t, "a { value: \\,x() }", "a {\n value: \\,x();\n}\n", "") expectPrinted(t, "a { value: x\\2c() }", "a {\n value: x\\,();\n}\n", "") expectPrinted(t, "a { value: x\\,() }", "a {\n value: x\\,();\n}\n", "") // TString expectPrinted(t, "a { value: 'a\\62 c' }", "a {\n value: \"abc\";\n}\n", "") expectPrinted(t, "a { value: 'a\\62c' }", "a {\n value: \"a\u062C\";\n}\n", "") expectPrinted(t, "a { value: '\\61 bc' }", "a {\n value: \"abc\";\n}\n", "") expectPrinted(t, "a { value: '\\61bc' }", "a {\n value: \"\u61BC\";\n}\n", "") expectPrinted(t, "a { value: '\\2c' }", "a {\n value: \",\";\n}\n", "") expectPrinted(t, "a { value: '\\,' }", "a {\n value: \",\";\n}\n", "") expectPrinted(t, "a { value: '\\0' }", "a {\n value: \"\uFFFD\";\n}\n", "") expectPrinted(t, "a { value: '\\1' }", "a {\n value: \"\x01\";\n}\n", "") expectPrinted(t, "a { value: '\x00' }", "a {\n value: \"\uFFFD\";\n}\n", "") expectPrinted(t, "a { value: '\x01' }", "a {\n value: \"\x01\";\n}\n", "") // TURL expectPrinted(t, "a { value: url(a\\62 c) }", "a {\n value: url(abc);\n}\n", "") expectPrinted(t, "a { value: url(a\\62c) }", "a {\n value: url(a\u062C);\n}\n", "") expectPrinted(t, "a { value: url(\\61 bc) }", "a {\n value: url(abc);\n}\n", "") expectPrinted(t, "a { value: url(\\61bc) }", "a {\n value: url(\u61BC);\n}\n", "") expectPrinted(t, "a { value: url(\\2c) }", "a {\n value: url(,);\n}\n", "") expectPrinted(t, "a { value: url(\\,) }", "a {\n value: url(,);\n}\n", "") // TAtKeyword expectPrinted(t, "a { value: @k\\65yword }", "a {\n value: @keyword;\n}\n", "") expectPrinted(t, "a { value: @\\6b eyword }", "a {\n value: @keyword;\n}\n", "") expectPrinted(t, "a { value: @\\6beyword }", "a {\n value: @\u06BEyword;\n}\n", "") expectPrinted(t, "a { value: @\\2cx }", "a {\n value: @\\,x;\n}\n", "") expectPrinted(t, "a { value: @\\,x }", "a {\n value: @\\,x;\n}\n", "") expectPrinted(t, "a { value: @x\\2c }", "a {\n value: @x\\,;\n}\n", "") expectPrinted(t, "a { value: @x\\, }", "a {\n value: @x\\,;\n}\n", "") // TDimension expectPrinted(t, "a { value: 10\\65m }", "a {\n value: 10em;\n}\n", "") expectPrinted(t, "a { value: 10p\\32x }", "a {\n value: 10p2x;\n}\n", "") expectPrinted(t, "a { value: 10e\\32x }", "a {\n value: 10\\65 2x;\n}\n", "") expectPrinted(t, "a { value: 10e-\\32x }", "a {\n value: 10\\65-2x;\n}\n", "") expectPrinted(t, "a { value: 10E\\32x }", "a {\n value: 10\\45 2x;\n}\n", "") expectPrinted(t, "a { value: 10E-\\32x }", "a {\n value: 10\\45-2x;\n}\n", "") expectPrinted(t, "a { value: 10e1e\\32x }", "a {\n value: 10e1e2x;\n}\n", "") expectPrinted(t, "a { value: 10e1e-\\32x }", "a {\n value: 10e1e-2x;\n}\n", "") expectPrinted(t, "a { value: 10e1E\\32x }", "a {\n value: 10e1E2x;\n}\n", "") expectPrinted(t, "a { value: 10e1E-\\32x }", "a {\n value: 10e1E-2x;\n}\n", "") expectPrinted(t, "a { value: 10E1e\\32x }", "a {\n value: 10E1e2x;\n}\n", "") expectPrinted(t, "a { value: 10E1e-\\32x }", "a {\n value: 10E1e-2x;\n}\n", "") expectPrinted(t, "a { value: 10E1E\\32x }", "a {\n value: 10E1E2x;\n}\n", "") expectPrinted(t, "a { value: 10E1E-\\32x }", "a {\n value: 10E1E-2x;\n}\n", "") expectPrinted(t, "a { value: 10\\32x }", "a {\n value: 10\\32x;\n}\n", "") expectPrinted(t, "a { value: 10\\2cx }", "a {\n value: 10\\,x;\n}\n", "") expectPrinted(t, "a { value: 10\\,x }", "a {\n value: 10\\,x;\n}\n", "") expectPrinted(t, "a { value: 10x\\2c }", "a {\n value: 10x\\,;\n}\n", "") expectPrinted(t, "a { value: 10x\\, }", "a {\n value: 10x\\,;\n}\n", "") // This must remain unescaped. See path_to_url expectPrinted(t, "@font-face { unicode-range: U+0e2e-0e2f }", "@font-face {\n unicode-range: U+0e2e-0e2f;\n}\n", "") // RDeclaration colorWarning := "<stdin>: WARNING: \",olor\" is not a known CSS property\nNOTE: Did you mean \"color\" instead?\n" expectPrintedMangle(t, "a { c\\6flor: #f00 }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { \\63olor: #f00 }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { \\2color: #f00 }", "a {\n \\,olor: #f00;\n}\n", colorWarning) expectPrintedMangle(t, "a { \\,olor: #f00 }", "a {\n \\,olor: #f00;\n}\n", colorWarning) // RUnknownAt expectPrinted(t, "@unknown;", "@unknown;\n", "") expectPrinted(t, "@u\\6eknown;", "@unknown;\n", "") expectPrinted(t, "@\\75nknown;", "@unknown;\n", "") expectPrinted(t, "@u\\2cnknown;", "@u\\,nknown;\n", "") expectPrinted(t, "@u\\,nknown;", "@u\\,nknown;\n", "") expectPrinted(t, "@\\2cunknown;", "@\\,unknown;\n", "") expectPrinted(t, "@\\,unknown;", "@\\,unknown;\n", "") // RAtKeyframes expectPrinted(t, "@k\\65yframes abc { from {} }", "@keyframes abc {\n from {\n }\n}\n", "") expectPrinted(t, "@keyframes \\61 bc { from {} }", "@keyframes abc {\n from {\n }\n}\n", "") expectPrinted(t, "@keyframes a\\62 c { from {} }", "@keyframes abc {\n from {\n }\n}\n", "") expectPrinted(t, "@keyframes abc { \\66rom {} }", "@keyframes abc {\n from {\n }\n}\n", "") expectPrinted(t, "@keyframes a\\2c c { \\66rom {} }", "@keyframes a\\,c {\n from {\n }\n}\n", "") expectPrinted(t, "@keyframes a\\,c { \\66rom {} }", "@keyframes a\\,c {\n from {\n }\n}\n", "") // RAtNamespace namespaceWarning := "<stdin>: WARNING: \"@namespace\" rules are not supported\n" expectPrinted(t, "@n\\61mespace ns 'path';", "@namespace ns \"path\";\n", namespaceWarning) expectPrinted(t, "@namespace \\6es 'path';", "@namespace ns \"path\";\n", namespaceWarning) expectPrinted(t, "@namespace ns 'p\\61th';", "@namespace ns \"path\";\n", namespaceWarning) expectPrinted(t, "@namespace \\2cs 'p\\61th';", "@namespace \\,s \"path\";\n", namespaceWarning) expectPrinted(t, "@namespace \\,s 'p\\61th';", "@namespace \\,s \"path\";\n", namespaceWarning) // CompoundSelector expectPrinted(t, "* {}", "* {\n}\n", "") expectPrinted(t, "*|div {}", "*|div {\n}\n", "") expectPrinted(t, "\\2a {}", "\\* {\n}\n", "") expectPrinted(t, "\\2a|div {}", "\\*|div {\n}\n", "") expectPrinted(t, "\\2d {}", "\\- {\n}\n", "") expectPrinted(t, "\\2d- {}", "-- {\n}\n", "") expectPrinted(t, "-\\2d {}", "-- {\n}\n", "") expectPrinted(t, "\\2d 123 {}", "\\-123 {\n}\n", "") // SSHash expectPrinted(t, "#h\\61sh {}", "#hash {\n}\n", "") expectPrinted(t, "#\\2chash {}", "#\\,hash {\n}\n", "") expectPrinted(t, "#\\,hash {}", "#\\,hash {\n}\n", "") expectPrinted(t, "#\\2d {}", "#\\- {\n}\n", "") expectPrinted(t, "#\\2d- {}", "#-- {\n}\n", "") expectPrinted(t, "#-\\2d {}", "#-- {\n}\n", "") expectPrinted(t, "#\\2d 123 {}", "#\\-123 {\n}\n", "") expectPrinted(t, "#\\61hash {}", "#ahash {\n}\n", "") expectPrinted(t, "#\\30hash {}", "#\\30hash {\n}\n", "") expectPrinted(t, "#0\\2chash {}", "#0\\,hash {\n}\n", "<stdin>: WARNING: Unexpected \"#0\\\\2chash\"\n") expectPrinted(t, "#0\\,hash {}", "#0\\,hash {\n}\n", "<stdin>: WARNING: Unexpected \"#0\\\\,hash\"\n") // SSClass expectPrinted(t, ".cl\\61ss {}", ".class {\n}\n", "") expectPrinted(t, ".\\2c class {}", ".\\,class {\n}\n", "") expectPrinted(t, ".\\,class {}", ".\\,class {\n}\n", "") // SSPseudoClass expectPrinted(t, ":pseudocl\\61ss {}", ":pseudoclass {\n}\n", "") expectPrinted(t, ":pseudo\\2c class {}", ":pseudo\\,class {\n}\n", "") expectPrinted(t, ":pseudo\\,class {}", ":pseudo\\,class {\n}\n", "") expectPrinted(t, ":pseudo(cl\\61ss) {}", ":pseudo(class) {\n}\n", "") expectPrinted(t, ":pseudo(cl\\2css) {}", ":pseudo(cl\\,ss) {\n}\n", "") expectPrinted(t, ":pseudo(cl\\,ss) {}", ":pseudo(cl\\,ss) {\n}\n", "") // SSAttribute expectPrinted(t, "[\\61ttr] {}", "[attr] {\n}\n", "") expectPrinted(t, "[\\2c attr] {}", "[\\,attr] {\n}\n", "") expectPrinted(t, "[\\,attr] {}", "[\\,attr] {\n}\n", "") expectPrinted(t, "[attr\\7e=x] {}", "[attr\\~=x] {\n}\n", "") expectPrinted(t, "[attr\\~=x] {}", "[attr\\~=x] {\n}\n", "") expectPrinted(t, "[attr=\\2c] {}", "[attr=\",\"] {\n}\n", "") expectPrinted(t, "[attr=\\,] {}", "[attr=\",\"] {\n}\n", "") expectPrinted(t, "[attr=\"-\"] {}", "[attr=\"-\"] {\n}\n", "") expectPrinted(t, "[attr=\"--\"] {}", "[attr=--] {\n}\n", "") expectPrinted(t, "[attr=\"-a\"] {}", "[attr=-a] {\n}\n", "") expectPrinted(t, "[\\6es|attr] {}", "[ns|attr] {\n}\n", "") expectPrinted(t, "[ns|\\61ttr] {}", "[ns|attr] {\n}\n", "") expectPrinted(t, "[\\2cns|attr] {}", "[\\,ns|attr] {\n}\n", "") expectPrinted(t, "[ns|\\2c attr] {}", "[ns|\\,attr] {\n}\n", "") expectPrinted(t, "[*|attr] {}", "[*|attr] {\n}\n", "") expectPrinted(t, "[\\2a|attr] {}", "[\\*|attr] {\n}\n", "") } func TestString(t *testing.T) { expectPrinted(t, "a:after { content: 'a\\\rb' }", "a:after {\n content: \"ab\";\n}\n", "") expectPrinted(t, "a:after { content: 'a\\\nb' }", "a:after {\n content: \"ab\";\n}\n", "") expectPrinted(t, "a:after { content: 'a\\\fb' }", "a:after {\n content: \"ab\";\n}\n", "") expectPrinted(t, "a:after { content: 'a\\\r\nb' }", "a:after {\n content: \"ab\";\n}\n", "") expectPrinted(t, "a:after { content: 'a\\62 c' }", "a:after {\n content: \"abc\";\n}\n", "") expectPrinted(t, "a:after { content: '\r' }", "a:after {\n content: '\n ' }\n ;\n}\n", `<stdin>: WARNING: Unterminated string token <stdin>: WARNING: Expected "}" to go with "{" <stdin>: NOTE: The unbalanced "{" is here: <stdin>: WARNING: Unterminated string token `) expectPrinted(t, "a:after { content: '\n' }", "a:after {\n content: '\n ' }\n ;\n}\n", `<stdin>: WARNING: Unterminated string token <stdin>: WARNING: Expected "}" to go with "{" <stdin>: NOTE: The unbalanced "{" is here: <stdin>: WARNING: Unterminated string token `) expectPrinted(t, "a:after { content: '\f' }", "a:after {\n content: '\n ' }\n ;\n}\n", `<stdin>: WARNING: Unterminated string token <stdin>: WARNING: Expected "}" to go with "{" <stdin>: NOTE: The unbalanced "{" is here: <stdin>: WARNING: Unterminated string token `) expectPrinted(t, "a:after { content: '\r\n' }", "a:after {\n content: '\n ' }\n ;\n}\n", `<stdin>: WARNING: Unterminated string token <stdin>: WARNING: Expected "}" to go with "{" <stdin>: NOTE: The unbalanced "{" is here: <stdin>: WARNING: Unterminated string token `) expectPrinted(t, "a:after { content: '\\1010101' }", "a:after {\n content: \"\U001010101\";\n}\n", "") expectPrinted(t, "a:after { content: '\\invalid' }", "a:after {\n content: \"invalid\";\n}\n", "") } func TestNumber(t *testing.T) { for _, ext := range []string{"", "%", "px+"} { expectPrinted(t, "a { width: .0"+ext+"; }", "a {\n width: .0"+ext+";\n}\n", "") expectPrinted(t, "a { width: .00"+ext+"; }", "a {\n width: .00"+ext+";\n}\n", "") expectPrinted(t, "a { width: .10"+ext+"; }", "a {\n width: .10"+ext+";\n}\n", "") expectPrinted(t, "a { width: 0."+ext+"; }", "a {\n width: 0."+ext+";\n}\n", "") expectPrinted(t, "a { width: 0.0"+ext+"; }", "a {\n width: 0.0"+ext+";\n}\n", "") expectPrinted(t, "a { width: 0.1"+ext+"; }", "a {\n width: 0.1"+ext+";\n}\n", "") expectPrinted(t, "a { width: +.0"+ext+"; }", "a {\n width: +.0"+ext+";\n}\n", "") expectPrinted(t, "a { width: +.00"+ext+"; }", "a {\n width: +.00"+ext+";\n}\n", "") expectPrinted(t, "a { width: +.10"+ext+"; }", "a {\n width: +.10"+ext+";\n}\n", "") expectPrinted(t, "a { width: +0."+ext+"; }", "a {\n width: +0."+ext+";\n}\n", "") expectPrinted(t, "a { width: +0.0"+ext+"; }", "a {\n width: +0.0"+ext+";\n}\n", "") expectPrinted(t, "a { width: +0.1"+ext+"; }", "a {\n width: +0.1"+ext+";\n}\n", "") expectPrinted(t, "a { width: -.0"+ext+"; }", "a {\n width: -.0"+ext+";\n}\n", "") expectPrinted(t, "a { width: -.00"+ext+"; }", "a {\n width: -.00"+ext+";\n}\n", "") expectPrinted(t, "a { width: -.10"+ext+"; }", "a {\n width: -.10"+ext+";\n}\n", "") expectPrinted(t, "a { width: -0."+ext+"; }", "a {\n width: -0."+ext+";\n}\n", "") expectPrinted(t, "a { width: -0.0"+ext+"; }", "a {\n width: -0.0"+ext+";\n}\n", "") expectPrinted(t, "a { width: -0.1"+ext+"; }", "a {\n width: -0.1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: .0"+ext+"; }", "a {\n width: 0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: .00"+ext+"; }", "a {\n width: 0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: .10"+ext+"; }", "a {\n width: .1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: 0."+ext+"; }", "a {\n width: 0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: 0.0"+ext+"; }", "a {\n width: 0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: 0.1"+ext+"; }", "a {\n width: .1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +.0"+ext+"; }", "a {\n width: +0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +.00"+ext+"; }", "a {\n width: +0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +.10"+ext+"; }", "a {\n width: +.1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +0."+ext+"; }", "a {\n width: +0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +0.0"+ext+"; }", "a {\n width: +0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: +0.1"+ext+"; }", "a {\n width: +.1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -.0"+ext+"; }", "a {\n width: -0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -.00"+ext+"; }", "a {\n width: -0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -.10"+ext+"; }", "a {\n width: -.1"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -0."+ext+"; }", "a {\n width: -0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -0.0"+ext+"; }", "a {\n width: -0"+ext+";\n}\n", "") expectPrintedMangle(t, "a { width: -0.1"+ext+"; }", "a {\n width: -.1"+ext+";\n}\n", "") } } func TestURL(t *testing.T) { expectPrinted(t, "a { background: url(foo.png) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url('foo.png') }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\" ) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\"\t) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\"\r) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\"\n) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\"\f) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\"\r\n) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url( \"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\t\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\r\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\n\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\f\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\r\n\"foo.png\") }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url( \"foo.png\" ) }", "a {\n background: url(foo.png);\n}\n", "") expectPrinted(t, "a { background: url(\"foo.png\" extra-stuff) }", "a {\n background: url(\"foo.png\" extra-stuff);\n}\n", "") expectPrinted(t, "a { background: url( \"foo.png\" extra-stuff ) }", "a {\n background: url(\"foo.png\" extra-stuff);\n}\n", "") } func TestHexColor(t *testing.T) { // "#RGBA" expectPrinted(t, "a { color: #1234 }", "a {\n color: #1234;\n}\n", "") expectPrinted(t, "a { color: #123f }", "a {\n color: #123f;\n}\n", "") expectPrinted(t, "a { color: #abcd }", "a {\n color: #abcd;\n}\n", "") expectPrinted(t, "a { color: #abcf }", "a {\n color: #abcf;\n}\n", "") expectPrinted(t, "a { color: #ABCD }", "a {\n color: #ABCD;\n}\n", "") expectPrinted(t, "a { color: #ABCF }", "a {\n color: #ABCF;\n}\n", "") expectPrintedMangle(t, "a { color: #1234 }", "a {\n color: #1234;\n}\n", "") expectPrintedMangle(t, "a { color: #123f }", "a {\n color: #123;\n}\n", "") expectPrintedMangle(t, "a { color: #abcd }", "a {\n color: #abcd;\n}\n", "") expectPrintedMangle(t, "a { color: #abcf }", "a {\n color: #abc;\n}\n", "") expectPrintedMangle(t, "a { color: #ABCD }", "a {\n color: #abcd;\n}\n", "") expectPrintedMangle(t, "a { color: #ABCF }", "a {\n color: #abc;\n}\n", "") // "#RRGGBB" expectPrinted(t, "a { color: #112233 }", "a {\n color: #112233;\n}\n", "") expectPrinted(t, "a { color: #122233 }", "a {\n color: #122233;\n}\n", "") expectPrinted(t, "a { color: #112333 }", "a {\n color: #112333;\n}\n", "") expectPrinted(t, "a { color: #112234 }", "a {\n color: #112234;\n}\n", "") expectPrintedMangle(t, "a { color: #112233 }", "a {\n color: #123;\n}\n", "") expectPrintedMangle(t, "a { color: #122233 }", "a {\n color: #122233;\n}\n", "") expectPrintedMangle(t, "a { color: #112333 }", "a {\n color: #112333;\n}\n", "") expectPrintedMangle(t, "a { color: #112234 }", "a {\n color: #112234;\n}\n", "") expectPrinted(t, "a { color: #aabbcc }", "a {\n color: #aabbcc;\n}\n", "") expectPrinted(t, "a { color: #abbbcc }", "a {\n color: #abbbcc;\n}\n", "") expectPrinted(t, "a { color: #aabccc }", "a {\n color: #aabccc;\n}\n", "") expectPrinted(t, "a { color: #aabbcd }", "a {\n color: #aabbcd;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbcc }", "a {\n color: #abc;\n}\n", "") expectPrintedMangle(t, "a { color: #abbbcc }", "a {\n color: #abbbcc;\n}\n", "") expectPrintedMangle(t, "a { color: #aabccc }", "a {\n color: #aabccc;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbcd }", "a {\n color: #aabbcd;\n}\n", "") expectPrinted(t, "a { color: #AABBCC }", "a {\n color: #AABBCC;\n}\n", "") expectPrinted(t, "a { color: #ABBBCC }", "a {\n color: #ABBBCC;\n}\n", "") expectPrinted(t, "a { color: #AABCCC }", "a {\n color: #AABCCC;\n}\n", "") expectPrinted(t, "a { color: #AABBCD }", "a {\n color: #AABBCD;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCC }", "a {\n color: #abc;\n}\n", "") expectPrintedMangle(t, "a { color: #ABBBCC }", "a {\n color: #abbbcc;\n}\n", "") expectPrintedMangle(t, "a { color: #AABCCC }", "a {\n color: #aabccc;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCD }", "a {\n color: #aabbcd;\n}\n", "") // "#RRGGBBAA" expectPrinted(t, "a { color: #11223344 }", "a {\n color: #11223344;\n}\n", "") expectPrinted(t, "a { color: #12223344 }", "a {\n color: #12223344;\n}\n", "") expectPrinted(t, "a { color: #11233344 }", "a {\n color: #11233344;\n}\n", "") expectPrinted(t, "a { color: #11223444 }", "a {\n color: #11223444;\n}\n", "") expectPrinted(t, "a { color: #11223345 }", "a {\n color: #11223345;\n}\n", "") expectPrintedMangle(t, "a { color: #11223344 }", "a {\n color: #1234;\n}\n", "") expectPrintedMangle(t, "a { color: #12223344 }", "a {\n color: #12223344;\n}\n", "") expectPrintedMangle(t, "a { color: #11233344 }", "a {\n color: #11233344;\n}\n", "") expectPrintedMangle(t, "a { color: #11223444 }", "a {\n color: #11223444;\n}\n", "") expectPrintedMangle(t, "a { color: #11223345 }", "a {\n color: #11223345;\n}\n", "") expectPrinted(t, "a { color: #aabbccdd }", "a {\n color: #aabbccdd;\n}\n", "") expectPrinted(t, "a { color: #abbbccdd }", "a {\n color: #abbbccdd;\n}\n", "") expectPrinted(t, "a { color: #aabcccdd }", "a {\n color: #aabcccdd;\n}\n", "") expectPrinted(t, "a { color: #aabbcddd }", "a {\n color: #aabbcddd;\n}\n", "") expectPrinted(t, "a { color: #aabbccde }", "a {\n color: #aabbccde;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbccdd }", "a {\n color: #abcd;\n}\n", "") expectPrintedMangle(t, "a { color: #abbbccdd }", "a {\n color: #abbbccdd;\n}\n", "") expectPrintedMangle(t, "a { color: #aabcccdd }", "a {\n color: #aabcccdd;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbcddd }", "a {\n color: #aabbcddd;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbccde }", "a {\n color: #aabbccde;\n}\n", "") expectPrinted(t, "a { color: #AABBCCDD }", "a {\n color: #AABBCCDD;\n}\n", "") expectPrinted(t, "a { color: #ABBBCCDD }", "a {\n color: #ABBBCCDD;\n}\n", "") expectPrinted(t, "a { color: #AABCCCDD }", "a {\n color: #AABCCCDD;\n}\n", "") expectPrinted(t, "a { color: #AABBCDDD }", "a {\n color: #AABBCDDD;\n}\n", "") expectPrinted(t, "a { color: #AABBCCDE }", "a {\n color: #AABBCCDE;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCCDD }", "a {\n color: #abcd;\n}\n", "") expectPrintedMangle(t, "a { color: #ABBBCCDD }", "a {\n color: #abbbccdd;\n}\n", "") expectPrintedMangle(t, "a { color: #AABCCCDD }", "a {\n color: #aabcccdd;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCDDD }", "a {\n color: #aabbcddd;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCCDE }", "a {\n color: #aabbccde;\n}\n", "") // "#RRGGBBFF" expectPrinted(t, "a { color: #112233ff }", "a {\n color: #112233ff;\n}\n", "") expectPrinted(t, "a { color: #122233ff }", "a {\n color: #122233ff;\n}\n", "") expectPrinted(t, "a { color: #112333ff }", "a {\n color: #112333ff;\n}\n", "") expectPrinted(t, "a { color: #112234ff }", "a {\n color: #112234ff;\n}\n", "") expectPrinted(t, "a { color: #112233ef }", "a {\n color: #112233ef;\n}\n", "") expectPrintedMangle(t, "a { color: #112233ff }", "a {\n color: #123;\n}\n", "") expectPrintedMangle(t, "a { color: #122233ff }", "a {\n color: #122233;\n}\n", "") expectPrintedMangle(t, "a { color: #112333ff }", "a {\n color: #112333;\n}\n", "") expectPrintedMangle(t, "a { color: #112234ff }", "a {\n color: #112234;\n}\n", "") expectPrintedMangle(t, "a { color: #112233ef }", "a {\n color: #112233ef;\n}\n", "") expectPrinted(t, "a { color: #aabbccff }", "a {\n color: #aabbccff;\n}\n", "") expectPrinted(t, "a { color: #abbbccff }", "a {\n color: #abbbccff;\n}\n", "") expectPrinted(t, "a { color: #aabcccff }", "a {\n color: #aabcccff;\n}\n", "") expectPrinted(t, "a { color: #aabbcdff }", "a {\n color: #aabbcdff;\n}\n", "") expectPrinted(t, "a { color: #aabbccef }", "a {\n color: #aabbccef;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbccff }", "a {\n color: #abc;\n}\n", "") expectPrintedMangle(t, "a { color: #abbbccff }", "a {\n color: #abbbcc;\n}\n", "") expectPrintedMangle(t, "a { color: #aabcccff }", "a {\n color: #aabccc;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbcdff }", "a {\n color: #aabbcd;\n}\n", "") expectPrintedMangle(t, "a { color: #aabbccef }", "a {\n color: #aabbccef;\n}\n", "") expectPrinted(t, "a { color: #AABBCCFF }", "a {\n color: #AABBCCFF;\n}\n", "") expectPrinted(t, "a { color: #ABBBCCFF }", "a {\n color: #ABBBCCFF;\n}\n", "") expectPrinted(t, "a { color: #AABCCCFF }", "a {\n color: #AABCCCFF;\n}\n", "") expectPrinted(t, "a { color: #AABBCDFF }", "a {\n color: #AABBCDFF;\n}\n", "") expectPrinted(t, "a { color: #AABBCCEF }", "a {\n color: #AABBCCEF;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCCFF }", "a {\n color: #abc;\n}\n", "") expectPrintedMangle(t, "a { color: #ABBBCCFF }", "a {\n color: #abbbcc;\n}\n", "") expectPrintedMangle(t, "a { color: #AABCCCFF }", "a {\n color: #aabccc;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCDFF }", "a {\n color: #aabbcd;\n}\n", "") expectPrintedMangle(t, "a { color: #AABBCCEF }", "a {\n color: #aabbccef;\n}\n", "") } func TestColorFunctions(t *testing.T) { expectPrinted(t, "a { color: color(display-p3 0.5 0.0 0.0%) }", "a {\n color: color(display-p3 0.5 0.0 0.0%);\n}\n", "") expectPrinted(t, "a { color: color(display-p3 0.5 0.0 0.0% / 0.5) }", "a {\n color: color(display-p3 0.5 0.0 0.0% / 0.5);\n}\n", "") // Check minification of tokens expectPrintedMangle(t, "a { color: color(display-p3 0.5 0.0 0.0%) }", "a {\n color: color(display-p3 .5 0 0%);\n}\n", "") expectPrintedMangle(t, "a { color: color(display-p3 0.5 0.0 0.0% / 0.5) }", "a {\n color: color(display-p3 .5 0 0% / .5);\n}\n", "") // Check out-of-range colors expectPrintedLower(t, "a { before: 0; color: color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n color: #ff0f0e;\n color: color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; color: color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n color: #ff0f0e;\n color: color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLower(t, "a { before: 0; color: color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n color: rgba(255, 15, 14, .5);\n color: color(display-p3 1 0 0 / 0.5);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; color: color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n color: rgba(255, 15, 14, .5);\n color: color(display-p3 1 0 0 / .5);\n after: 1;\n}\n", "") expectPrintedLower(t, "a { before: 0; background: color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n background: #ff0f0e;\n background: color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; background: color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n background: #ff0f0e;\n background: color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLower(t, "a { before: 0; background: color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n background: rgba(255, 15, 14, .5);\n background: color(display-p3 1 0 0 / 0.5);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; background: color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n background: rgba(255, 15, 14, .5);\n background: color(display-p3 1 0 0 / .5);\n after: 1;\n}\n", "") expectPrintedLower(t, "a { before: 0; box-shadow: 1px color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n box-shadow: 1px #ff0f0e;\n box-shadow: 1px color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; box-shadow: 1px color(display-p3 1 0 0); after: 1 }", "a {\n before: 0;\n box-shadow: 1px #ff0f0e;\n box-shadow: 1px color(display-p3 1 0 0);\n after: 1;\n}\n", "") expectPrintedLower(t, "a { before: 0; box-shadow: 1px color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n box-shadow: 1px rgba(255, 15, 14, .5);\n box-shadow: 1px color(display-p3 1 0 0 / 0.5);\n after: 1;\n}\n", "") expectPrintedLowerMangle(t, "a { before: 0; box-shadow: 1px color(display-p3 1 0 0 / 0.5); after: 1 }", "a {\n before: 0;\n box-shadow: 1px rgba(255, 15, 14, .5);\n box-shadow: 1px color(display-p3 1 0 0 / .5);\n after: 1;\n}\n", "") // Don't insert a fallback after a previous instance of the same property expectPrintedLower(t, "a { color: red; color: color(display-p3 1 0 0) }", "a {\n color: red;\n color: color(display-p3 1 0 0);\n}\n", "") expectPrintedLower(t, "a { color: color(display-p3 1 0 0); color: color(display-p3 0 1 0) }", "a {\n color: #ff0f0e;\n color: color(display-p3 1 0 0);\n color: color(display-p3 0 1 0);\n}\n", "") // Check case sensitivity expectPrintedLower(t, "a { color: color(srgb 0.87 0.98 0.807) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "A { Color: Color(Srgb 0.87 0.98 0.807) }", "A {\n Color: #deface;\n}\n", "") expectPrintedLower(t, "A { COLOR: COLOR(SRGB 0.87 0.98 0.807) }", "A {\n COLOR: #deface;\n}\n", "") // Check in-range colors in various color spaces expectPrintedLower(t, "a { color: color(a98-rgb 0.9 0.98 0.81) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(a98-rgb 90% 98% 81%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(display-p3 0.89 0.977 0.823) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(display-p3 89% 97.7% 82.3%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(prophoto-rgb 0.877 0.959 0.793) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(prophoto-rgb 87.7% 95.9% 79.3%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(rec2020 0.895 0.968 0.805) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(rec2020 89.5% 96.8% 80.5%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(srgb 0.87 0.98 0.807) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(srgb 87% 98% 80.7%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(srgb-linear 0.73 0.96 0.62) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(srgb-linear 73% 96% 62%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz 0.754 0.883 0.715) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz 75.4% 88.3% 71.5%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz-d50 0.773 0.883 0.545) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz-d50 77.3% 88.3% 54.5%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz-d65 0.754 0.883 0.715) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: color(xyz-d65 75.4% 88.3% 71.5%) }", "a {\n color: #deface;\n}\n", "") // Check color functions with unusual percent reference ranges expectPrintedLower(t, "a { color: lab(95.38 -15 18) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lab(95.38% -15 18) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lab(95.38 -12% 18) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lab(95.38% -15 14.4%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lch(95.38 23.57 130.22) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lch(95.38% 23.57 130.22) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lch(95.38 19% 130.22) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: lch(95.38 23.57 0.362turn) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklab(0.953 -0.045 0.046) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklab(95.3% -0.045 0.046) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklab(0.953 -11.2% 0.046) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklab(0.953 -0.045 11.5%) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklch(0.953 0.064 134) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklch(95.3% 0.064 134) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklch(0.953 16% 134) }", "a {\n color: #deface;\n}\n", "") expectPrintedLower(t, "a { color: oklch(0.953 0.064 0.372turn) }", "a {\n color: #deface;\n}\n", "") // Test alpha expectPrintedLower(t, "a { color: color(srgb 0.87 0.98 0.807 / 0.5) }", "a {\n color: rgba(222, 250, 206, .5);\n}\n", "") expectPrintedLower(t, "a { color: lab(95.38 -15 18 / 0.5) }", "a {\n color: rgba(222, 250, 206, .5);\n}\n", "") expectPrintedLower(t, "a { color: lch(95.38 23.57 130.22 / 0.5) }", "a {\n color: rgba(222, 250, 206, .5);\n}\n", "") expectPrintedLower(t, "a { color: oklab(0.953 -0.045 0.046 / 0.5) }", "a {\n color: rgba(222, 250, 206, .5);\n}\n", "") expectPrintedLower(t, "a { color: oklch(0.953 0.064 134 / 0.5) }", "a {\n color: rgba(222, 250, 206, .5);\n}\n", "") } func TestColorNames(t *testing.T) { expectPrinted(t, "a { color: #f00 }", "a {\n color: #f00;\n}\n", "") expectPrinted(t, "a { color: #f00f }", "a {\n color: #f00f;\n}\n", "") expectPrinted(t, "a { color: #ff0000 }", "a {\n color: #ff0000;\n}\n", "") expectPrinted(t, "a { color: #ff0000ff }", "a {\n color: #ff0000ff;\n}\n", "") expectPrintedMangle(t, "a { color: #f00 }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: #f00e }", "a {\n color: #f00e;\n}\n", "") expectPrintedMangle(t, "a { color: #f00f }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: #ff0000 }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: #ff0000ef }", "a {\n color: #ff0000ef;\n}\n", "") expectPrintedMangle(t, "a { color: #ff0000ff }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: #ffc0cb }", "a {\n color: pink;\n}\n", "") expectPrintedMangle(t, "a { color: #ffc0cbef }", "a {\n color: #ffc0cbef;\n}\n", "") expectPrintedMangle(t, "a { color: #ffc0cbff }", "a {\n color: pink;\n}\n", "") expectPrinted(t, "a { color: white }", "a {\n color: white;\n}\n", "") expectPrinted(t, "a { color: tUrQuOiSe }", "a {\n color: tUrQuOiSe;\n}\n", "") expectPrintedMangle(t, "a { color: white }", "a {\n color: #fff;\n}\n", "") expectPrintedMangle(t, "a { color: tUrQuOiSe }", "a {\n color: #40e0d0;\n}\n", "") } func TestColorRGBA(t *testing.T) { expectPrintedMangle(t, "a { color: rgba(1 2 3 / 0.5) }", "a {\n color: #01020380;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1 2 3 / 50%) }", "a {\n color: #0102037f;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1, 2, 3, 0.5) }", "a {\n color: #01020380;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1, 2, 3, 50%) }", "a {\n color: #0102037f;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1% 2% 3% / 0.5) }", "a {\n color: #03050880;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1% 2% 3% / 50%) }", "a {\n color: #0305087f;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1%, 2%, 3%, 0.5) }", "a {\n color: #03050880;\n}\n", "") expectPrintedMangle(t, "a { color: rgba(1%, 2%, 3%, 50%) }", "a {\n color: #0305087f;\n}\n", "") expectPrintedLowerMangle(t, "a { color: rgb(1, 2, 3, 0.4) }", "a {\n color: rgba(1, 2, 3, .4);\n}\n", "") expectPrintedLowerMangle(t, "a { color: rgba(1, 2, 3, 40%) }", "a {\n color: rgba(1, 2, 3, .4);\n}\n", "") expectPrintedLowerMangle(t, "a { color: rgb(var(--x) var(--y) var(--z)) }", "a {\n color: rgb(var(--x) var(--y) var(--z));\n}\n", "") } func TestColorHSLA(t *testing.T) { expectPrintedMangle(t, ".red { color: hsl(0, 100%, 50%) }", ".red {\n color: red;\n}\n", "") expectPrintedMangle(t, ".orange { color: hsl(30deg, 100%, 50%) }", ".orange {\n color: #ff8000;\n}\n", "") expectPrintedMangle(t, ".yellow { color: hsl(60 100% 50%) }", ".yellow {\n color: #ff0;\n}\n", "") expectPrintedMangle(t, ".green { color: hsl(120, 100%, 50%) }", ".green {\n color: #0f0;\n}\n", "") expectPrintedMangle(t, ".cyan { color: hsl(200grad, 100%, 50%) }", ".cyan {\n color: #0ff;\n}\n", "") expectPrintedMangle(t, ".blue { color: hsl(240, 100%, 50%) }", ".blue {\n color: #00f;\n}\n", "") expectPrintedMangle(t, ".purple { color: hsl(0.75turn 100% 50%) }", ".purple {\n color: #7f00ff;\n}\n", "") expectPrintedMangle(t, ".magenta { color: hsl(300, 100%, 50%) }", ".magenta {\n color: #f0f;\n}\n", "") expectPrintedMangle(t, "a { color: hsl(30 25% 50% / 50%) }", "a {\n color: #9f80607f;\n}\n", "") expectPrintedMangle(t, "a { color: hsla(30 25% 50% / 50%) }", "a {\n color: #9f80607f;\n}\n", "") expectPrintedLowerMangle(t, "a { color: hsl(1, 2%, 3%, 0.4) }", "a {\n color: rgba(8, 8, 7, .4);\n}\n", "") expectPrintedLowerMangle(t, "a { color: hsla(1, 2%, 3%, 40%) }", "a {\n color: rgba(8, 8, 7, .4);\n}\n", "") expectPrintedLowerMangle(t, "a { color: hsl(var(--x) var(--y) var(--z)) }", "a {\n color: hsl(var(--x) var(--y) var(--z));\n}\n", "") } func TestLowerColor(t *testing.T) { expectPrintedLower(t, "a { color: rebeccapurple }", "a {\n color: #663399;\n}\n", "") expectPrintedLower(t, "a { color: ReBeCcApUrPlE }", "a {\n color: #663399;\n}\n", "") expectPrintedLower(t, "a { color: #0123 }", "a {\n color: rgba(0, 17, 34, .2);\n}\n", "") expectPrintedLower(t, "a { color: #1230 }", "a {\n color: rgba(17, 34, 51, 0);\n}\n", "") expectPrintedLower(t, "a { color: #1234 }", "a {\n color: rgba(17, 34, 51, .267);\n}\n", "") expectPrintedLower(t, "a { color: #123f }", "a {\n color: #112233;\n}\n", "") expectPrintedLower(t, "a { color: #12345678 }", "a {\n color: rgba(18, 52, 86, .47);\n}\n", "") expectPrintedLower(t, "a { color: #ff00007f }", "a {\n color: rgba(255, 0, 0, .498);\n}\n", "") expectPrintedLower(t, "a { color: rgb(1 2 3) }", "a {\n color: rgb(1, 2, 3);\n}\n", "") expectPrintedLower(t, "a { color: hsl(1 2% 3%) }", "a {\n color: hsl(1, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: rgba(1% 2% 3%) }", "a {\n color: rgb(1%, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(1deg 2% 3%) }", "a {\n color: hsl(1, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(200grad 2% 3%) }", "a {\n color: hsl(180, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(6.28319rad 2% 3%) }", "a {\n color: hsl(360, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(0.5turn 2% 3%) }", "a {\n color: hsl(180, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(+200grad 2% 3%) }", "a {\n color: hsl(180, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: hsla(-200grad 2% 3%) }", "a {\n color: hsl(-180, 2%, 3%);\n}\n", "") expectPrintedLower(t, "a { color: rgb(1 2 3 / 4) }", "a {\n color: rgba(1, 2, 3, 4);\n}\n", "") expectPrintedLower(t, "a { color: RGB(1 2 3 / 4) }", "a {\n color: rgba(1, 2, 3, 4);\n}\n", "") expectPrintedLower(t, "a { color: rgba(1% 2% 3% / 4%) }", "a {\n color: rgba(1%, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: RGBA(1% 2% 3% / 4%) }", "a {\n color: RGBA(1%, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: hsl(1 2% 3% / 4) }", "a {\n color: hsla(1, 2%, 3%, 4);\n}\n", "") expectPrintedLower(t, "a { color: HSL(1 2% 3% / 4) }", "a {\n color: hsla(1, 2%, 3%, 4);\n}\n", "") expectPrintedLower(t, "a { color: hsla(1 2% 3% / 4%) }", "a {\n color: hsla(1, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: HSLA(1 2% 3% / 4%) }", "a {\n color: HSLA(1, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: rgb(1, 2, 3, 4) }", "a {\n color: rgba(1, 2, 3, 4);\n}\n", "") expectPrintedLower(t, "a { color: rgba(1%, 2%, 3%, 4%) }", "a {\n color: rgba(1%, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: rgb(1%, 2%, 3%, 0.4%) }", "a {\n color: rgba(1%, 2%, 3%, 0.004);\n}\n", "") expectPrintedLower(t, "a { color: hsl(1, 2%, 3%, 4) }", "a {\n color: hsla(1, 2%, 3%, 4);\n}\n", "") expectPrintedLower(t, "a { color: hsla(1deg, 2%, 3%, 4%) }", "a {\n color: hsla(1, 2%, 3%, 0.04);\n}\n", "") expectPrintedLower(t, "a { color: hsl(1deg, 2%, 3%, 0.4%) }", "a {\n color: hsla(1, 2%, 3%, 0.004);\n}\n", "") expectPrintedLower(t, "a { color: hwb(90deg 20% 40%) }", "a {\n color: #669933;\n}\n", "") expectPrintedLower(t, "a { color: HWB(90deg 20% 40%) }", "a {\n color: #669933;\n}\n", "") expectPrintedLower(t, "a { color: hwb(90deg 20% 40% / 0.2) }", "a {\n color: rgba(102, 153, 51, .2);\n}\n", "") expectPrintedLower(t, "a { color: hwb(1deg 40% 80%) }", "a {\n color: #555555;\n}\n", "") expectPrintedLower(t, "a { color: hwb(1deg 9000% 50%) }", "a {\n color: #aaaaaa;\n}\n", "") expectPrintedLower(t, "a { color: hwb(1deg 9000% 50% / 0.6) }", "a {\n color: rgba(170, 170, 170, .6);\n}\n", "") expectPrintedLower(t, "a { color: hwb(90deg, 20%, 40%) }", "a {\n color: hwb(90deg, 20%, 40%);\n}\n", "") // This is invalid expectPrintedLower(t, "a { color: hwb(none 20% 40%) }", "a {\n color: hwb(none 20% 40%);\n}\n", "") // Interpolation expectPrintedLower(t, "a { color: hwb(90deg none 40%) }", "a {\n color: hwb(90deg none 40%);\n}\n", "") // Interpolation expectPrintedLower(t, "a { color: hwb(90deg 20% none) }", "a {\n color: hwb(90deg 20% none);\n}\n", "") // Interpolation expectPrintedMangle(t, "a { color: hwb(90deg 20% 40%) }", "a {\n color: #693;\n}\n", "") expectPrintedMangle(t, "a { color: hwb(0.75turn 20% 40% / 0.75) }", "a {\n color: #663399bf;\n}\n", "") expectPrintedLowerMangle(t, "a { color: hwb(90deg 20% 40%) }", "a {\n color: #693;\n}\n", "") expectPrintedLowerMangle(t, "a { color: hwb(0.75turn 20% 40% / 0.75) }", "a {\n color: rgba(102, 51, 153, .75);\n}\n", "") } func TestBackground(t *testing.T) { expectPrinted(t, "a { background: #11223344 }", "a {\n background: #11223344;\n}\n", "") expectPrintedMangle(t, "a { background: #11223344 }", "a {\n background: #1234;\n}\n", "") expectPrintedLower(t, "a { background: #11223344 }", "a {\n background: rgba(17, 34, 51, .267);\n}\n", "") expectPrinted(t, "a { background: border-box #11223344 }", "a {\n background: border-box #11223344;\n}\n", "") expectPrintedMangle(t, "a { background: border-box #11223344 }", "a {\n background: border-box #1234;\n}\n", "") expectPrintedLower(t, "a { background: border-box #11223344 }", "a {\n background: border-box rgba(17, 34, 51, .267);\n}\n", "") } func TestGradient(t *testing.T) { gradientKinds := []string{ "linear-gradient", "radial-gradient", "conic-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "repeating-conic-gradient", } for _, gradient := range gradientKinds { var code string // Different properties expectPrinted(t, "a { background: "+gradient+"(red, blue) }", "a {\n background: "+gradient+"(red, blue);\n}\n", "") expectPrinted(t, "a { background-image: "+gradient+"(red, blue) }", "a {\n background-image: "+gradient+"(red, blue);\n}\n", "") expectPrinted(t, "a { border-image: "+gradient+"(red, blue) }", "a {\n border-image: "+gradient+"(red, blue);\n}\n", "") expectPrinted(t, "a { mask-image: "+gradient+"(red, blue) }", "a {\n mask-image: "+gradient+"(red, blue);\n}\n", "") // Basic code = "a { background: " + gradient + "(yellow, #11223344) }" expectPrinted(t, code, "a {\n background: "+gradient+"(yellow, #11223344);\n}\n", "") expectPrintedMangle(t, code, "a {\n background: "+gradient+"(#ff0, #1234);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(yellow,#11223344)}", "") expectPrintedLowerUnsupported(t, compat.HexRGBA, code, "a {\n background: "+gradient+"(yellow, rgba(17, 34, 51, .267));\n}\n", "") // Basic with positions code = "a { background: " + gradient + "(yellow 10%, #11223344 90%) }" expectPrinted(t, code, "a {\n background: "+gradient+"(yellow 10%, #11223344 90%);\n}\n", "") expectPrintedMangle(t, code, "a {\n background: "+gradient+"(#ff0 10%, #1234 90%);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(yellow 10%,#11223344 90%)}", "") expectPrintedLowerUnsupported(t, compat.HexRGBA, code, "a {\n background: "+gradient+"(yellow 10%, rgba(17, 34, 51, .267) 90%);\n}\n", "") // Basic with hints code = "a { background: " + gradient + "(yellow, 25%, #11223344) }" expectPrinted(t, code, "a {\n background:\n "+gradient+"(\n yellow,\n 25%,\n #11223344);\n}\n", "") expectPrintedMangle(t, code, "a {\n background:\n "+gradient+"(\n #ff0,\n 25%,\n #1234);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(yellow,25%,#11223344)}", "") expectPrintedLowerUnsupported(t, compat.HexRGBA, code, "a {\n background:\n "+gradient+"(\n yellow,\n 25%,\n rgba(17, 34, 51, .267));\n}\n", "") expectPrintedLowerUnsupported(t, compat.GradientMidpoints, code, "a {\n background:\n "+gradient+"(\n #ffff00,\n #f2f303de,\n #eced04d0 6.25%,\n "+ "#e1e306bd 12.5%,\n #cdd00ba2 25%,\n #a2a8147b,\n #6873205d,\n #11223344);\n}\n", "") // Double positions code = "a { background: " + gradient + "(green, red 10%, red 20%, yellow 70% 80%, black) }" expectPrinted(t, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n "+ "red 20%,\n yellow 70% 80%,\n black);\n}\n", "") expectPrintedMangle(t, code, "a {\n background:\n "+gradient+"(\n green,\n "+ "red 10% 20%,\n #ff0 70% 80%,\n #000);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(green,red 10%,red 20%,yellow 70% 80%,black)}", "") expectPrintedLowerUnsupported(t, compat.GradientDoublePosition, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n red 20%,\n "+ "yellow 70%,\n yellow 80%,\n black);\n}\n", "") // Double positions with hints code = "a { background: " + gradient + "(green, red 10%, red 20%, 30%, yellow 70% 80%, 85%, black) }" expectPrinted(t, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n red 20%,\n "+ "30%,\n yellow 70% 80%,\n 85%,\n black);\n}\n", "") expectPrintedMangle(t, code, "a {\n background:\n "+gradient+"(\n green,\n red 10% 20%,\n "+ "30%,\n #ff0 70% 80%,\n 85%,\n #000);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(green,red 10%,red 20%,30%,yellow 70% 80%,85%,black)}", "") expectPrintedLowerUnsupported(t, compat.GradientDoublePosition, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n red 20%,\n 30%,\n "+ "yellow 70%,\n yellow 80%,\n 85%,\n black);\n}\n", "") // Non-double positions with hints code = "a { background: " + gradient + "(green, red 10%, 1%, red 20%, black) }" expectPrinted(t, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n 1%,\n "+ "red 20%,\n black);\n}\n", "") expectPrintedMangle(t, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n "+ "1%,\n red 20%,\n #000);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(green,red 10%,1%,red 20%,black)}", "") expectPrintedLowerUnsupported(t, compat.GradientDoublePosition, code, "a {\n background:\n "+gradient+"(\n green,\n red 10%,\n 1%,\n red 20%,\n black);\n}\n", "") // Out-of-gamut colors code = "a { background: " + gradient + "(yellow, color(display-p3 1 0 0)) }" expectPrinted(t, code, "a {\n background: "+gradient+"(yellow, color(display-p3 1 0 0));\n}\n", "") expectPrintedMangle(t, code, "a {\n background: "+gradient+"(#ff0, color(display-p3 1 0 0));\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+"(yellow,color(display-p3 1 0 0))}", "") expectPrintedLowerUnsupported(t, compat.ColorFunctions, code, "a {\n background:\n "+gradient+"(\n #ffff00,\n #ffe971,\n #ffd472 25%,\n "+ "#ffab5f,\n #ff7b45 75%,\n #ff5e38 87.5%,\n #ff5534,\n #ff4c30,\n "+ "#ff412c,\n #ff0e0e);\n "+ "background:\n "+gradient+"(\n #ffff00,\n color(xyz 0.734 0.805 0.111),\n "+ "color(xyz 0.699 0.693 0.087) 25%,\n color(xyz 0.627 0.501 0.048),\n "+ "color(xyz 0.556 0.348 0.019) 75%,\n color(xyz 0.521 0.284 0.009) 87.5%,\n "+ "color(xyz 0.512 0.27 0.006),\n color(xyz 0.504 0.256 0.004),\n "+ "color(xyz 0.495 0.242 0.002),\n color(xyz 0.487 0.229 0));\n}\n", "") // Whitespace code = "a { background: " + gradient + "(color-mix(in lab,red,green)calc(1px)calc(2px),color-mix(in lab,blue,red)calc(98%)calc(99%)) }" expectPrinted(t, code, "a {\n background: "+gradient+ "(color-mix(in lab, red, green)calc(1px)calc(2px), color-mix(in lab, blue, red)calc(98%)calc(99%));\n}\n", "") expectPrintedMangle(t, code, "a {\n background: "+gradient+ "(color-mix(in lab, red, green) 1px 2px, color-mix(in lab, blue, red) 98% 99%);\n}\n", "") expectPrintedMinify(t, code, "a{background:"+gradient+ "(color-mix(in lab,red,green)calc(1px)calc(2px),color-mix(in lab,blue,red)calc(98%)calc(99%))}", "") expectPrintedLowerUnsupported(t, compat.GradientDoublePosition, code, "a {\n background:\n "+gradient+ "(\n color-mix(in lab, red, green) calc(1px),\n color-mix(in lab, red, green) calc(2px),"+ "\n color-mix(in lab, blue, red) calc(98%),\n color-mix(in lab, blue, red) calc(99%));\n}\n", "") expectPrintedLowerMangle(t, code, "a {\n background:\n "+gradient+ "(\n color-mix(in lab, red, green) 1px,\n color-mix(in lab, red, green) 2px,"+ "\n color-mix(in lab, blue, red) 98%,\n color-mix(in lab, blue, red) 99%);\n}\n", "") // Color space interpolation expectPrintedLowerUnsupported(t, compat.GradientInterpolation, "a { background: "+gradient+"(in srgb, red, green) }", "a {\n background: "+gradient+"(#ff0000, #008000);\n}\n", "") expectPrintedLowerUnsupported(t, compat.GradientInterpolation, "a { background: "+gradient+"(in srgb-linear, red, green) }", "a {\n background:\n "+gradient+"(\n #ff0000,\n #fb1300,\n #f81f00 6.25%,\n "+ "#f02e00 12.5%,\n #e14200 25%,\n #bc5c00,\n #897000 75%,\n #637800 87.5%,\n "+ "#477c00 93.75%,\n #317e00,\n #008000);\n}\n", "") expectPrintedLowerUnsupported(t, compat.GradientInterpolation, "a { background: "+gradient+"(in lab, red, green) }", "a {\n background:\n "+gradient+"(\n #ff0000,\n color(xyz 0.396 0.211 0.019),\n "+ "color(xyz 0.38 0.209 0.02) 6.25%,\n color(xyz 0.35 0.205 0.02) 12.5%,\n "+ "color(xyz 0.294 0.198 0.02) 25%,\n color(xyz 0.2 0.183 0.022),\n "+ "color(xyz 0.129 0.168 0.024) 75%,\n color(xyz 0.101 0.161 0.025) 87.5%,\n "+ "color(xyz 0.089 0.158 0.025) 93.75%,\n color(xyz 0.083 0.156 0.025),\n #008000);\n}\n", "") // Hue interpolation expectPrintedLowerUnsupported(t, compat.GradientInterpolation, "a { background: "+gradient+"(in hsl shorter hue, red, green) }", "a {\n background:\n "+gradient+"(\n #ff0000,\n #df7000,\n "+ "#bfbf00,\n #50a000,\n #008000);\n}\n", "") expectPrintedLowerUnsupported(t, compat.GradientInterpolation, "a { background: "+gradient+"(in hsl longer hue, red, green) }", "a {\n background:\n "+gradient+"(\n #ff0000,\n #ef0078,\n "+ "#df00df,\n #6800cf,\n #0000c0,\n #0058b0,\n "+ "#00a0a0,\n #009048,\n #008000);\n}\n", "") } } func TestDeclaration(t *testing.T) { expectPrinted(t, ".decl {}", ".decl {\n}\n", "") expectPrinted(t, ".decl { a: b }", ".decl {\n a: b;\n}\n", "") expectPrinted(t, ".decl { a: b; }", ".decl {\n a: b;\n}\n", "") expectPrinted(t, ".decl { a: b; c: d }", ".decl {\n a: b;\n c: d;\n}\n", "") expectPrinted(t, ".decl { a: b; c: d; }", ".decl {\n a: b;\n c: d;\n}\n", "") expectPrinted(t, ".decl { a { b: c; } }", ".decl {\n a {\n b: c;\n }\n}\n", "") expectPrinted(t, ".decl { & a { b: c; } }", ".decl {\n & a {\n b: c;\n }\n}\n", "") // See path_to_url expectPrinted(t, ".selector { (;property: value;); }", ".selector {\n (;property: value;);\n}\n", "<stdin>: WARNING: Expected identifier but found \"(\"\n") expectPrinted(t, ".selector { [;property: value;]; }", ".selector {\n [;property: value;];\n}\n", "<stdin>: WARNING: Expected identifier but found \"[\"\n") expectPrinted(t, ".selector, {}", ".selector, {\n}\n", "<stdin>: WARNING: Unexpected \"{\"\n") expectPrinted(t, ".selector\\ {}", ".selector\\ {\n}\n", "") expectPrinted(t, ".selector { property: value\\9; }", ".selector {\n property: value\\\t;\n}\n", "") expectPrinted(t, "@media \\0screen\\,screen\\9 {}", "@media \uFFFDscreen\\,screen\\\t {\n}\n", "") } func TestSelector(t *testing.T) { expectPrinted(t, "a{}", "a {\n}\n", "") expectPrinted(t, "a {}", "a {\n}\n", "") expectPrinted(t, "a b {}", "a b {\n}\n", "") expectPrinted(t, "a/**/b {}", "ab {\n}\n", "<stdin>: WARNING: Unexpected \"b\"\n") expectPrinted(t, "a/**/.b {}", "a.b {\n}\n", "") expectPrinted(t, "a/**/:b {}", "a:b {\n}\n", "") expectPrinted(t, "a/**/[b] {}", "a[b] {\n}\n", "") expectPrinted(t, "a>/**/b {}", "a > b {\n}\n", "") expectPrinted(t, "a+/**/b {}", "a + b {\n}\n", "") expectPrinted(t, "a~/**/b {}", "a ~ b {\n}\n", "") expectPrinted(t, "[b]{}", "[b] {\n}\n", "") expectPrinted(t, "[b] {}", "[b] {\n}\n", "") expectPrinted(t, "a[b] {}", "a[b] {\n}\n", "") expectPrinted(t, "a [b] {}", "a [b] {\n}\n", "") expectPrinted(t, "[] {}", "[] {\n}\n", "<stdin>: WARNING: Expected identifier but found \"]\"\n") expectPrinted(t, "[b {}", "[b] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b]] {}", "[b]] {\n}\n", "<stdin>: WARNING: Unexpected \"]\"\n") expectPrinted(t, "a[b {}", "a[b] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "a[b]] {}", "a[b]] {\n}\n", "<stdin>: WARNING: Unexpected \"]\"\n") expectPrinted(t, "[b]a {}", "[b]a {\n}\n", "<stdin>: WARNING: Unexpected \"a\"\n") expectPrinted(t, "[|b]{}", "[b] {\n}\n", "") // "[|b]" is equivalent to "[b]" expectPrinted(t, "[*|b]{}", "[*|b] {\n}\n", "") expectPrinted(t, "[a|b]{}", "[a|b] {\n}\n", "") expectPrinted(t, "[a|b|=\"c\"]{}", "[a|b|=c] {\n}\n", "") expectPrinted(t, "[a|b |= \"c\"]{}", "[a|b|=c] {\n}\n", "") expectPrinted(t, "[a||b] {}", "[a||b] {\n}\n", "<stdin>: WARNING: Expected identifier but found \"|\"\n") expectPrinted(t, "[* | b] {}", "[* | b] {\n}\n", "<stdin>: WARNING: Expected \"|\" but found whitespace\n") expectPrinted(t, "[a | b] {}", "[a | b] {\n}\n", "<stdin>: WARNING: Expected \"=\" but found whitespace\n") expectPrinted(t, "[b=\"c\"] {}", "[b=c] {\n}\n", "") expectPrinted(t, "[b=\"c d\"] {}", "[b=\"c d\"] {\n}\n", "") expectPrinted(t, "[b=\"0c\"] {}", "[b=\"0c\"] {\n}\n", "") expectPrinted(t, "[b~=\"c\"] {}", "[b~=c] {\n}\n", "") expectPrinted(t, "[b^=\"c\"] {}", "[b^=c] {\n}\n", "") expectPrinted(t, "[b$=\"c\"] {}", "[b$=c] {\n}\n", "") expectPrinted(t, "[b*=\"c\"] {}", "[b*=c] {\n}\n", "") expectPrinted(t, "[b|=\"c\"] {}", "[b|=c] {\n}\n", "") expectPrinted(t, "[b?=\"c\"] {}", "[b?=\"c\"] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b = \"c\"] {}", "[b=c] {\n}\n", "") expectPrinted(t, "[b ~= \"c\"] {}", "[b~=c] {\n}\n", "") expectPrinted(t, "[b ^= \"c\"] {}", "[b^=c] {\n}\n", "") expectPrinted(t, "[b $= \"c\"] {}", "[b$=c] {\n}\n", "") expectPrinted(t, "[b *= \"c\"] {}", "[b*=c] {\n}\n", "") expectPrinted(t, "[b |= \"c\"] {}", "[b|=c] {\n}\n", "") expectPrinted(t, "[b ?= \"c\"] {}", "[b ?= \"c\"] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b = \"c\" i] {}", "[b=c i] {\n}\n", "") expectPrinted(t, "[b = \"c\" I] {}", "[b=c I] {\n}\n", "") expectPrinted(t, "[b = \"c\" s] {}", "[b=c s] {\n}\n", "") expectPrinted(t, "[b = \"c\" S] {}", "[b=c S] {\n}\n", "") expectPrinted(t, "[b i] {}", "[b i] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b I] {}", "[b I] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b s] {}", "[b s] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "[b S] {}", "[b S] {\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "|b {}", "|b {\n}\n", "") expectPrinted(t, "|* {}", "|* {\n}\n", "") expectPrinted(t, "a|b {}", "a|b {\n}\n", "") expectPrinted(t, "a|* {}", "a|* {\n}\n", "") expectPrinted(t, "*|b {}", "*|b {\n}\n", "") expectPrinted(t, "*|* {}", "*|* {\n}\n", "") expectPrinted(t, "a||b {}", "a||b {\n}\n", "<stdin>: WARNING: Expected identifier but found \"|\"\n") expectPrinted(t, "a+b {}", "a + b {\n}\n", "") expectPrinted(t, "a>b {}", "a > b {\n}\n", "") expectPrinted(t, "a+b {}", "a + b {\n}\n", "") expectPrinted(t, "a~b {}", "a ~ b {\n}\n", "") expectPrinted(t, "a + b {}", "a + b {\n}\n", "") expectPrinted(t, "a > b {}", "a > b {\n}\n", "") expectPrinted(t, "a + b {}", "a + b {\n}\n", "") expectPrinted(t, "a ~ b {}", "a ~ b {\n}\n", "") expectPrinted(t, "::b {}", "::b {\n}\n", "") expectPrinted(t, "*::b {}", "*::b {\n}\n", "") expectPrinted(t, "a::b {}", "a::b {\n}\n", "") expectPrinted(t, "::b(c) {}", "::b(c) {\n}\n", "") expectPrinted(t, "*::b(c) {}", "*::b(c) {\n}\n", "") expectPrinted(t, "a::b(c) {}", "a::b(c) {\n}\n", "") expectPrinted(t, "a:b:c {}", "a:b:c {\n}\n", "") expectPrinted(t, "a:b(:c) {}", "a:b(:c) {\n}\n", "") expectPrinted(t, "a: b {}", "a: b {\n}\n", "<stdin>: WARNING: Expected identifier but found whitespace\n") expectPrinted(t, ":is(a)b {}", ":is(a)b {\n}\n", "<stdin>: WARNING: Unexpected \"b\"\n") expectPrinted(t, "a:b( c ) {}", "a:b(c) {\n}\n", "") expectPrinted(t, "a:b( c , d ) {}", "a:b(c, d) {\n}\n", "") expectPrinted(t, "a:is( c ) {}", "a:is(c) {\n}\n", "") expectPrinted(t, "a:is( c , d ) {}", "a:is(c, d) {\n}\n", "") // These test cases previously caused a hang (see path_to_url expectPrinted(t, ":x(", ":x() {\n}\n", "<stdin>: WARNING: Unexpected end of file\n") expectPrinted(t, ":x( {}", ":x({}) {\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, ":x(, :y() {}", ":x(, :y() {}) {\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, "#id {}", "#id {\n}\n", "") expectPrinted(t, "#--0 {}", "#--0 {\n}\n", "") expectPrinted(t, "#\\-0 {}", "#\\-0 {\n}\n", "") expectPrinted(t, "#\\30 {}", "#\\30 {\n}\n", "") expectPrinted(t, "div#id {}", "div#id {\n}\n", "") expectPrinted(t, "div#--0 {}", "div#--0 {\n}\n", "") expectPrinted(t, "div#\\-0 {}", "div#\\-0 {\n}\n", "") expectPrinted(t, "div#\\30 {}", "div#\\30 {\n}\n", "") expectPrinted(t, "#0 {}", "#0 {\n}\n", "<stdin>: WARNING: Unexpected \"#0\"\n") expectPrinted(t, "#-0 {}", "#-0 {\n}\n", "<stdin>: WARNING: Unexpected \"#-0\"\n") expectPrinted(t, "div#0 {}", "div#0 {\n}\n", "<stdin>: WARNING: Unexpected \"#0\"\n") expectPrinted(t, "div#-0 {}", "div#-0 {\n}\n", "<stdin>: WARNING: Unexpected \"#-0\"\n") expectPrinted(t, "div::before::after::selection::first-line::first-letter {color:red}", "div::before::after::selection::first-line::first-letter {\n color: red;\n}\n", "") expectPrintedMangle(t, "div::before::after::selection::first-line::first-letter {color:red}", "div:before:after::selection:first-line:first-letter {\n color: red;\n}\n", "") // Make sure '-' and '\\' consume an ident-like token instead of a name expectPrinted(t, "_:-ms-lang(x) {}", "_:-ms-lang(x) {\n}\n", "") expectPrinted(t, "_:\\ms-lang(x) {}", "_:ms-lang(x) {\n}\n", "") expectPrinted(t, ":local(a, b) {}", ":local(a, b) {\n}\n", "<stdin>: WARNING: Unexpected \",\" inside \":local(...)\"\n"+ "NOTE: Different CSS tools behave differently in this case, so esbuild doesn't allow it. Either remove "+ "this comma or split this selector up into multiple comma-separated \":local(...)\" selectors instead.\n") expectPrinted(t, ":global(a, b) {}", ":global(a, b) {\n}\n", "<stdin>: WARNING: Unexpected \",\" inside \":global(...)\"\n"+ "NOTE: Different CSS tools behave differently in this case, so esbuild doesn't allow it. Either remove "+ "this comma or split this selector up into multiple comma-separated \":global(...)\" selectors instead.\n") } func TestNestedSelector(t *testing.T) { sassWarningWrap := "NOTE: CSS nesting syntax does not allow the \"&\" selector to come before " + "a type selector. You can wrap this selector in \":is(...)\" as a workaround. " + "This restriction exists to avoid problems with SASS nesting, where the same syntax " + "means something very different that has no equivalent in real CSS (appending a suffix to the parent selector).\n" sassWarningMove := "NOTE: CSS nesting syntax does not allow the \"&\" selector to come before " + "a type selector. You can move the \"&\" to the end of this selector as a workaround. " + "This restriction exists to avoid problems with SASS nesting, where the same syntax " + "means something very different that has no equivalent in real CSS (appending a suffix to the parent selector).\n" expectPrinted(t, "& {}", "& {\n}\n", "") expectPrinted(t, "& b {}", "& b {\n}\n", "") expectPrinted(t, "&:b {}", "&:b {\n}\n", "") expectPrinted(t, "&* {}", "&* {\n}\n", "<stdin>: WARNING: Cannot use type selector \"*\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "&|b {}", "&|b {\n}\n", "<stdin>: WARNING: Cannot use type selector \"|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "&*|b {}", "&*|b {\n}\n", "<stdin>: WARNING: Cannot use type selector \"*|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "&a|b {}", "&a|b {\n}\n", "<stdin>: WARNING: Cannot use type selector \"a|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "&[a] {}", "&[a] {\n}\n", "") expectPrinted(t, "a { & {} }", "a {\n & {\n }\n}\n", "") expectPrinted(t, "a { & b {} }", "a {\n & b {\n }\n}\n", "") expectPrinted(t, "a { &:b {} }", "a {\n &:b {\n }\n}\n", "") expectPrinted(t, "a { &* {} }", "a {\n &* {\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"*\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "a { &|b {} }", "a {\n &|b {\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "a { &*|b {} }", "a {\n &*|b {\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"*|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "a { &a|b {} }", "a {\n &a|b {\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"a|b\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, "a { &[b] {} }", "a {\n &[b] {\n }\n}\n", "") expectPrinted(t, "a { && {} }", "a {\n & {\n }\n}\n", "") expectPrinted(t, "a { & + & {} }", "a {\n & + & {\n }\n}\n", "") expectPrinted(t, "a { & > & {} }", "a {\n & > & {\n }\n}\n", "") expectPrinted(t, "a { & ~ & {} }", "a {\n & ~ & {\n }\n}\n", "") expectPrinted(t, "a { & + c& {} }", "a {\n & + c& {\n }\n}\n", "") expectPrinted(t, "a { .b& + & {} }", "a {\n &.b + & {\n }\n}\n", "") expectPrinted(t, "a { .b& + c& {} }", "a {\n &.b + c& {\n }\n}\n", "") expectPrinted(t, "a { & + & > & ~ & {} }", "a {\n & + & > & ~ & {\n }\n}\n", "") // CSS nesting works for all tokens except identifiers and functions expectPrinted(t, "a { .b {} }", "a {\n .b {\n }\n}\n", "") expectPrinted(t, "a { #b {} }", "a {\n #b {\n }\n}\n", "") expectPrinted(t, "a { :b {} }", "a {\n :b {\n }\n}\n", "") expectPrinted(t, "a { [b] {} }", "a {\n [b] {\n }\n}\n", "") expectPrinted(t, "a { * {} }", "a {\n * {\n }\n}\n", "") expectPrinted(t, "a { |b {} }", "a {\n |b {\n }\n}\n", "") expectPrinted(t, "a { >b {} }", "a {\n > b {\n }\n}\n", "") expectPrinted(t, "a { +b {} }", "a {\n + b {\n }\n}\n", "") expectPrinted(t, "a { ~b {} }", "a {\n ~ b {\n }\n}\n", "") expectPrinted(t, "a { b {} }", "a {\n b {\n }\n}\n", "") expectPrinted(t, "a { b() {} }", "a {\n b() {\n }\n}\n", "<stdin>: WARNING: Unexpected \"b(\"\n") // Note: CSS nesting no longer requires each complex selector to contain "&" expectPrinted(t, "a { & b, c {} }", "a {\n & b,\n c {\n }\n}\n", "") expectPrinted(t, "a { & b, & c {} }", "a {\n & b,\n & c {\n }\n}\n", "") // Note: CSS nesting no longer requires the rule to be nested inside a parent // (instead un-nested CSS nesting refers to ":scope" or to ":root") expectPrinted(t, "& b, c {}", "& b,\nc {\n}\n", "") expectPrinted(t, "& b, & c {}", "& b,\n& c {\n}\n", "") expectPrinted(t, "b & {}", "b & {\n}\n", "") expectPrinted(t, "b &, c {}", "b &,\nc {\n}\n", "") expectPrinted(t, "a { .b & { color: red } }", "a {\n .b & {\n color: red;\n }\n}\n", "") expectPrinted(t, "a { .b& { color: red } }", "a {\n &.b {\n color: red;\n }\n}\n", "") expectPrinted(t, "a { .b&[c] { color: red } }", "a {\n &.b[c] {\n color: red;\n }\n}\n", "") expectPrinted(t, "a { &[c] { color: red } }", "a {\n &[c] {\n color: red;\n }\n}\n", "") expectPrinted(t, "a { [c]& { color: red } }", "a {\n &[c] {\n color: red;\n }\n}\n", "") expectPrintedMinify(t, "a { .b & { color: red } }", "a{.b &{color:red}}", "") expectPrintedMinify(t, "a { .b& { color: red } }", "a{&.b{color:red}}", "") // Nested at-rules expectPrinted(t, "a { @media screen { color: red } }", "a {\n @media screen {\n color: red;\n }\n}\n", "") expectPrinted(t, "a { @media screen { .b { color: green } color: red } }", "a {\n @media screen {\n .b {\n color: green;\n }\n color: red;\n }\n}\n", "") expectPrinted(t, "a { @media screen { color: red; .b { color: green } } }", "a {\n @media screen {\n color: red;\n .b {\n color: green;\n }\n }\n}\n", "") expectPrinted(t, "html { @layer base { block-size: 100%; @layer support { & body { min-block-size: 100%; } } } }", "html {\n @layer base {\n block-size: 100%;\n @layer support {\n & body {\n min-block-size: 100%;\n }\n }\n }\n}\n", "") expectPrinted(t, ".card { aspect-ratio: 3/4; @scope (&) { :scope { border: 1px solid white } } }", ".card {\n aspect-ratio: 3/4;\n @scope (&) {\n :scope {\n border: 1px solid white;\n }\n }\n}\n", "") // Minify an implicit leading "&" expectPrintedMangle(t, "& { color: red }", "& {\n color: red;\n}\n", "") expectPrintedMangle(t, "& a { color: red }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "& a, & b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "& a, b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a, & b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "& &a { color: red }", "& &a {\n color: red;\n}\n", "<stdin>: WARNING: Cannot use type selector \"a\" directly after nesting selector \"&\"\n"+sassWarningMove) expectPrintedMangle(t, "& .x { color: red }", ".x {\n color: red;\n}\n", "") expectPrintedMangle(t, "& &.x { color: red }", "& &.x {\n color: red;\n}\n", "") expectPrintedMangle(t, "& + a { color: red }", "+ a {\n color: red;\n}\n", "") expectPrintedMangle(t, "& + a& { color: red }", "+ a& {\n color: red;\n}\n", "") expectPrintedMangle(t, "&.x { color: red }", "&.x {\n color: red;\n}\n", "") expectPrintedMangle(t, "a & { color: red }", "a & {\n color: red;\n}\n", "") expectPrintedMangle(t, ".x & { color: red }", ".x & {\n color: red;\n}\n", "") expectPrintedMangle(t, "div { & a { color: red } }", "div {\n & a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & .x { color: red } }", "div {\n .x {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & .x, & a { color: red } }", "div {\n .x,\n a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { .x, & a { color: red } }", "div {\n .x,\n a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & a& { color: red } }", "div {\n & a& {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & .x { color: red } }", "div {\n .x {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & &.x { color: red } }", "div {\n & &.x {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & + a { color: red } }", "div {\n + a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { & + a& { color: red } }", "div {\n + a& {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div { .x & { color: red } }", "div {\n .x & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { & div { color: red } }", "@media screen {\n div {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "a { @media screen { & div { color: red } } }", "a {\n @media screen {\n & div {\n color: red;\n }\n }\n}\n", "") // Reorder selectors to enable removing "&" expectPrintedMangle(t, "reorder { & first, .second { color: red } }", "reorder {\n .second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, & .second { color: red } }", "reorder {\n .second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, #second { color: red } }", "reorder {\n #second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, [second] { color: red } }", "reorder {\n [second],\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, :second { color: red } }", "reorder {\n :second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, + second { color: red } }", "reorder {\n + second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, ~ second { color: red } }", "reorder {\n ~ second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, > second { color: red } }", "reorder {\n > second,\n first {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "reorder { & first, second, .third { color: red } }", "reorder {\n .third,\n second,\n first {\n color: red;\n }\n}\n", "") // Inline no-op nesting expectPrintedMangle(t, "div { & { color: red } }", "div {\n color: red;\n}\n", "") expectPrintedMangle(t, "div { && { color: red } }", "div {\n color: red;\n}\n", "") expectPrintedMangle(t, "div { zoom: 2; & { color: red } }", "div {\n zoom: 2;\n color: red;\n}\n", "") expectPrintedMangle(t, "div { zoom: 2; && { color: red } }", "div {\n zoom: 2;\n color: red;\n}\n", "") expectPrintedMangle(t, "div { &, && { color: red } zoom: 2 }", "div {\n zoom: 2;\n color: red;\n}\n", "") expectPrintedMangle(t, "div { &&, & { color: red } zoom: 2 }", "div {\n zoom: 2;\n color: red;\n}\n", "") expectPrintedMangle(t, "div { a: 1; & { b: 4 } b: 2; && { c: 5 } c: 3 }", "div {\n a: 1;\n b: 2;\n c: 3;\n b: 4;\n c: 5;\n}\n", "") expectPrintedMangle(t, "div { .b { x: 1 } & { x: 2 } }", "div {\n .b {\n x: 1;\n }\n x: 2;\n}\n", "") expectPrintedMangle(t, "div { & { & { & { color: red } } & { & { zoom: 2 } } } }", "div {\n color: red;\n zoom: 2;\n}\n", "") // Cannot inline no-op nesting with pseudo-elements (path_to_url expectPrintedMangle(t, "div, span:hover { & { color: red } }", "div,\nspan:hover {\n color: red;\n}\n", "") expectPrintedMangle(t, "div, span::before { & { color: red } }", "div,\nspan:before {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:before { & { color: red } }", "div,\nspan:before {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span::after { & { color: red } }", "div,\nspan:after {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:after { & { color: red } }", "div,\nspan:after {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span::first-line { & { color: red } }", "div,\nspan:first-line {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:first-line { & { color: red } }", "div,\nspan:first-line {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span::first-letter { & { color: red } }", "div,\nspan:first-letter {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:first-letter { & { color: red } }", "div,\nspan:first-letter {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span::pseudo { & { color: red } }", "div,\nspan::pseudo {\n & {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:hover { @layer foo { & { color: red } } }", "div,\nspan:hover {\n @layer foo {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span:hover { @media screen { & { color: red } } }", "div,\nspan:hover {\n @media screen {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "div, span::pseudo { @layer foo { & { color: red } } }", "div,\nspan::pseudo {\n @layer foo {\n & {\n color: red;\n }\n }\n}\n", "") expectPrintedMangle(t, "div, span::pseudo { @media screen { & { color: red } } }", "div,\nspan::pseudo {\n @media screen {\n & {\n color: red;\n }\n }\n}\n", "") // Lowering tests for nesting nestingWarningIs := "<stdin>: WARNING: Transforming this CSS nesting syntax is not supported in the configured target environment\n" + "NOTE: The nesting transform for this case must generate an \":is(...)\" but the configured target environment does not support the \":is\" pseudo-class.\n" nesting := compat.Nesting everything := ^compat.CSSFeature(0) expectPrintedLowerUnsupported(t, nesting, ".foo { .bar { color: red } }", ".foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { &.bar { color: red } }", ".foo.bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { & .bar { color: red } }", ".foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { .baz { color: red } }", ".foo .bar .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { &.baz { color: red } }", ".foo .bar.baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { & .baz { color: red } }", ".foo .bar .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { & > .baz { color: red } }", ".foo .bar > .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { .baz & { color: red } }", ".baz :is(.foo .bar) {\n color: red;\n}\n", "") // NOT the same as ".baz .foo .bar expectPrintedLowerUnsupported(t, nesting, ".foo .bar { & .baz & { color: red } }", ".foo .bar .baz :is(.foo .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, .bar { .baz & { color: red } }", ".baz :is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".foo, .bar { .baz & { color: red } }", ".baz .foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, [bar~='abc'] { .baz { color: red } }", ":is(.foo, [bar~=abc]) .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".foo, [bar~='abc'] { .baz { color: red } }", ".foo .baz,\n[bar~=abc] .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, [bar~='a b c'] { .baz { color: red } }", ":is(.foo, [bar~=\"a b c\"]) .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".foo, [bar~='a b c'] { .baz { color: red } }", ".foo .baz,\n[bar~=\"a b c\"] .baz {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { .foo, .bar { color: red } }", ".baz :is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { .foo, .bar { color: red } }", ".baz .foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { .foo, & .bar { color: red } }", ".baz :is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { .foo, & .bar { color: red } }", ".baz .foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { & .foo, .bar { color: red } }", ".baz :is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { & .foo, .bar { color: red } }", ".baz .foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { & .foo, & .bar { color: red } }", ".baz :is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { & .foo, & .bar { color: red } }", ".baz .foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { .foo, &.bar { color: red } }", ".baz .foo,\n.baz.bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { &.foo, .bar { color: red } }", ".baz.foo,\n.baz .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".baz { &.foo, &.bar { color: red } }", ".baz:is(.foo, .bar) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".baz { &.foo, &.bar { color: red } }", ".baz.foo,\n.baz.bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { color: blue; & .bar { color: red } }", ".foo {\n color: blue;\n}\n.foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { & .bar { color: red } color: blue }", ".foo {\n color: blue;\n}\n.foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { color: blue; & .bar { color: red } zoom: 2 }", ".foo {\n color: blue;\n zoom: 2;\n}\n.foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a, .b { .c, .d { color: red } }", ":is(.a, .b) :is(.c, .d) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".a, .b { .c, .d { color: red } }", ".a .c,\n.a .d,\n.b .c,\n.b .d {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a, .b { & > & { color: red } }", ":is(.a, .b) > :is(.a, .b) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".a, .b { & > & { color: red } }", ".a > .a,\n.a > .b,\n.b > .a,\n.b > .b {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a { color: red; > .b { color: green; > .c { color: blue } } }", ".a {\n color: red;\n}\n.a > .b {\n color: green;\n}\n.a > .b > .c {\n color: blue;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "> .a { color: red; > .b { color: green; > .c { color: blue } } }", "> .a {\n color: red;\n}\n> .a > .b {\n color: green;\n}\n> .a > .b > .c {\n color: blue;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, .bar, .foo:before, .bar:after { &:hover { color: red } }", ":is(.foo, .bar):hover {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".foo, .bar, .foo:before, .bar:after { &:hover { color: red } }", ".foo:hover,\n.bar:hover {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, .bar:before { &:hover { color: red } }", ".foo:hover {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo, .bar:before { :hover & { color: red } }", ":hover .foo {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".bar:before { &:hover { color: red } }", ":is():hover {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".bar:before { :hover & { color: red } }", ":hover :is() {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { &:after, & .bar { color: red } }", ".foo:after,\n.foo .bar {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo { & .bar, &:after { color: red } }", ".foo .bar,\n.foo:after {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(&.foo) { color: red } }", ":where(.xy.foo) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(&.foo) { color: red } }", ":where(div.foo) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(.foo&) { color: red } }", ":where(.xy.foo) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(.foo&) { color: red } }", ":where(div.foo) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where([href]&) { color: red } }", ":where(.xy[href]) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where([href]&) { color: red } }", ":where(div[href]) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(:hover&) { color: red } }", ":where(.xy:hover) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(:hover&) { color: red } }", ":where(div:hover) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(:is(.foo)&) { color: red } }", ":where(.xy:is(.foo)) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(:is(.foo)&) { color: red } }", ":where(div:is(.foo)) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(.foo + &) { color: red } }", ":where(.foo + .xy) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(.foo + &) { color: red } }", ":where(.foo + div) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".xy { :where(&, span:is(.foo &)) { color: red } }", ":where(.xy, span:is(.foo .xy)) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "div { :where(&, span:is(.foo &)) { color: red } }", ":where(div, span:is(.foo div)) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "&, a { color: red }", ":scope,\na {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "&, a { .b { color: red } }", ":is(:scope, a) .b {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "&, a { .b { color: red } }", ":scope .b,\na .b {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "&, a { .b { .c { color: red } } }", ":is(:scope, a) .b .c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "&, a { .b { .c { color: red } } }", ":scope .b .c,\na .b .c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { > b, > c { color: red } }", "a > :is(b, c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "a { > b, > c { color: red } }", "a > b,\na > c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { > b, + c { color: red } }", "a > b,\na + c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { & > b, & > c { color: red } }", "a > :is(b, c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "a { & > b, & > c { color: red } }", "a > b,\na > c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { & > b, & + c { color: red } }", "a > b,\na + c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { > b&, > c& { color: red } }", "a > :is(a:is(b), a:is(c)) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "a { > b&, > c& { color: red } }", "a > a:is(b),\na > a:is(c) {\n color: red;\n}\n", nestingWarningIs+nestingWarningIs) expectPrintedLowerUnsupported(t, nesting, "a { > b&, + c& { color: red } }", "a > a:is(b),\na + a:is(c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { > &.b, > &.c { color: red } }", "a > :is(a.b, a.c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "a { > &.b, > &.c { color: red } }", "a > a.b,\na > a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "a { > &.b, + &.c { color: red } }", "a > a.b,\na + a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a { > b&, > c& { color: red } }", ".a > :is(b.a, c.a) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".a { > b&, > c& { color: red } }", ".a > b.a,\n.a > c.a {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a { > b&, + c& { color: red } }", ".a > b.a,\n.a + c.a {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a { > &.b, > &.c { color: red } }", ".a > :is(.a.b, .a.c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".a { > &.b, > &.c { color: red } }", ".a > .a.b,\n.a > .a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".a { > &.b, + &.c { color: red } }", ".a > .a.b,\n.a + .a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "~ .a { > &.b, > &.c { color: red } }", "~ .a > :is(.a.b, .a.c) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, "~ .a { > &.b, > &.c { color: red } }", "~ .a > .a.b,\n~ .a > .a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, "~ .a { > &.b, + &.c { color: red } }", "~ .a > .a.b,\n~ .a + .a.c {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".foo .bar { > &.a, > &.b { color: red } }", ".foo .bar > :is(.foo .bar.a, .foo .bar.b) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, everything, ".foo .bar { > &.a, > &.b { color: red } }", ".foo .bar > :is(.foo .bar).a,\n.foo .bar > :is(.foo .bar).b {\n color: red;\n}\n", nestingWarningIs+nestingWarningIs) expectPrintedLowerUnsupported(t, nesting, ".foo .bar { > &.a, + &.b { color: red } }", ".foo .bar > :is(.foo .bar).a,\n.foo .bar + :is(.foo .bar).b {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".demo { .lg { &.triangle, &.circle { color: red } } }", ".demo .lg:is(.triangle, .circle) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".demo { .lg { .triangle, .circle { color: red } } }", ".demo .lg :is(.triangle, .circle) {\n color: red;\n}\n", "") expectPrintedLowerUnsupported(t, nesting, ".card { .featured & & & { color: red } }", ".featured .card .card .card {\n color: red;\n}\n", "") // These are invalid SASS-style nested suffixes expectPrintedLower(t, ".card { &--header { color: red } }", ".card {\n &--header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"--header\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrintedLower(t, ".card { &__header { color: red } }", ".card {\n &__header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"__header\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrintedLower(t, ".card { .nav &--header { color: red } }", ".card {\n .nav &--header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"--header\" directly after nesting selector \"&\"\n"+sassWarningMove) expectPrintedLower(t, ".card { .nav &__header { color: red } }", ".card {\n .nav &__header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"__header\" directly after nesting selector \"&\"\n"+sassWarningMove) expectPrinted(t, ".card { &__header { color: red } }", ".card {\n &__header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"__header\" directly after nesting selector \"&\"\n"+sassWarningWrap) expectPrinted(t, ".card { .nav &__header { color: red } }", ".card {\n .nav &__header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"__header\" directly after nesting selector \"&\"\n"+sassWarningMove) expectPrinted(t, ".card { .nav, &__header { color: red } }", ".card {\n .nav, &__header {\n color: red;\n }\n}\n", "<stdin>: WARNING: Cannot use type selector \"__header\" directly after nesting selector \"&\"\n"+sassWarningMove) // Check pseudo-elements (those coming through "&" must be dropped) expectPrintedLower(t, "a, b::before { &.foo { color: red } }", "a.foo {\n color: red;\n}\n", "") expectPrintedLower(t, "a, b::before { & .foo { color: red } }", "a .foo {\n color: red;\n}\n", "") expectPrintedLower(t, "a { &.foo, &::before { color: red } }", "a.foo,\na::before {\n color: red;\n}\n", "") expectPrintedLower(t, "a { & .foo, & ::before { color: red } }", "a .foo,\na ::before {\n color: red;\n}\n", "") expectPrintedLower(t, "a, b::before { color: blue; &.foo, &::after { color: red } }", "a,\nb::before {\n color: blue;\n}\na.foo,\na::after {\n color: red;\n}\n", "") // Test at-rules expectPrintedLower(t, ".foo { @media screen {} }", "", "") expectPrintedLower(t, ".foo { @media screen { color: red } }", "@media screen {\n .foo {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo { @media screen { &:hover { color: red } } }", "@media screen {\n .foo:hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo { @media screen { :hover { color: red } } }", "@media screen {\n .foo :hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @media screen { color: red } }", "@media screen {\n .foo,\n .bar {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @media screen { &:hover { color: red } } }", "@media screen {\n .foo:hover,\n .bar:hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @media screen { :hover { color: red } } }", "@media screen {\n .foo :hover,\n .bar :hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo { @layer xyz {} }", "@layer xyz;\n", "") expectPrintedLower(t, ".foo { @layer xyz { color: red } }", "@layer xyz {\n .foo {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo { @layer xyz { &:hover { color: red } } }", "@layer xyz {\n .foo:hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo { @layer xyz { :hover { color: red } } }", "@layer xyz {\n .foo :hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @layer xyz { color: red } }", "@layer xyz {\n .foo,\n .bar {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @layer xyz { &:hover { color: red } } }", "@layer xyz {\n .foo:hover,\n .bar:hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, ".foo, .bar { @layer xyz { :hover { color: red } } }", "@layer xyz {\n .foo :hover,\n .bar :hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, "@media screen { @media (min-width: 900px) { a, b { &:hover { color: red } } } }", "@media screen {\n @media (min-width: 900px) {\n a:hover,\n b:hover {\n color: red;\n }\n }\n}\n", "") expectPrintedLower(t, "@supports (display: flex) { @supports selector(h2 > p) { a, b { &:hover { color: red } } } }", "@supports (display: flex) {\n @supports selector(h2 > p) {\n a:hover,\n b:hover {\n color: red;\n }\n }\n}\n", "") expectPrintedLower(t, "@layer foo { @layer bar { a, b { &:hover { color: red } } } }", "@layer foo {\n @layer bar {\n a:hover,\n b:hover {\n color: red;\n }\n }\n}\n", "") expectPrintedLower(t, ".card { @supports (selector(&)) { &:hover { color: red } } }", "@supports (selector(&)) {\n .card:hover {\n color: red;\n }\n}\n", "") expectPrintedLower(t, "html { @layer base { color: blue; @layer support { & body { color: red } } } }", "@layer base {\n html {\n color: blue;\n }\n @layer support {\n html body {\n color: red;\n }\n }\n}\n", "") // path_to_url#issuecomment-1549874958 expectPrinted(t, "@media screen { a { x: y } x: y; b { x: y } }", "@media screen {\n a {\n x: y;\n }\n x: y;\n b {\n x: y;\n }\n}\n", "") expectPrinted(t, ":root { @media screen { a { x: y } x: y; b { x: y } } }", ":root {\n @media screen {\n a {\n x: y;\n }\n x: y;\n b {\n x: y;\n }\n }\n}\n", "") } func TestBadQualifiedRules(t *testing.T) { expectPrinted(t, "$bad: rule;", "$bad: rule; {\n}\n", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrinted(t, "$bad: rule; div { color: red }", "$bad: rule; div {\n color: red;\n}\n", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrinted(t, "$bad { color: red }", "$bad {\n color: red;\n}\n", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrinted(t, "a { div.major { color: blue } color: red }", "a {\n div.major {\n color: blue;\n }\n color: red;\n}\n", "") expectPrinted(t, "a { div:hover { color: blue } color: red }", "a {\n div:hover {\n color: blue;\n }\n color: red;\n}\n", "") expectPrinted(t, "a { div:hover { color: blue }; color: red }", "a {\n div:hover {\n color: blue;\n }\n color: red;\n}\n", "") expectPrinted(t, "a { div:hover { color: blue } ; color: red }", "a {\n div:hover {\n color: blue;\n }\n color: red;\n}\n", "") expectPrinted(t, "! { x: y; }", "! {\n x: y;\n}\n", "<stdin>: WARNING: Unexpected \"!\"\n") expectPrinted(t, "! { x: {} }", "! {\n x: {\n }\n}\n", "<stdin>: WARNING: Unexpected \"!\"\n<stdin>: WARNING: Expected identifier but found whitespace\n") expectPrinted(t, "a { *width: 100%; height: 1px }", "a {\n *width: 100%;\n height: 1px;\n}\n", "<stdin>: WARNING: Expected identifier but found \"*\"\n") expectPrinted(t, "a { garbage; height: 1px }", "a {\n garbage;\n height: 1px;\n}\n", "<stdin>: WARNING: Expected \":\"\n") expectPrinted(t, "a { !; height: 1px }", "a {\n !;\n height: 1px;\n}\n", "<stdin>: WARNING: Expected identifier but found \"!\"\n") } func TestAtRule(t *testing.T) { expectPrinted(t, "@unknown", "@unknown;\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "@unknown;", "@unknown;\n", "") expectPrinted(t, "@unknown{}", "@unknown {}\n", "") expectPrinted(t, "@unknown x;", "@unknown x;\n", "") expectPrinted(t, "@unknown{\na: b;\nc: d;\n}", "@unknown { a: b; c: d; }\n", "") expectPrinted(t, "@unknown", "@unknown;\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "@", "@ {\n}\n", "<stdin>: WARNING: Unexpected \"@\"\n") expectPrinted(t, "@;", "@; {\n}\n", "<stdin>: WARNING: Unexpected \"@\"\n") expectPrinted(t, "@{}", "@ {\n}\n", "<stdin>: WARNING: Unexpected \"@\"\n") expectPrinted(t, "@viewport { width: 100vw }", "@viewport {\n width: 100vw;\n}\n", "") expectPrinted(t, "@-ms-viewport { width: 100vw }", "@-ms-viewport {\n width: 100vw;\n}\n", "") expectPrinted(t, "@document url(\"path_to_url") { h1 { color: green } }", "@document url(path_to_url {\n h1 {\n color: green;\n }\n}\n", "") expectPrinted(t, "@-moz-document url-prefix() { h1 { color: green } }", "@-moz-document url-prefix() {\n h1 {\n color: green;\n }\n}\n", "") expectPrinted(t, "@media foo { bar }", "@media foo {\n bar {\n }\n}\n", "<stdin>: WARNING: Unexpected \"}\"\n") expectPrinted(t, "@media foo { bar {}", "@media foo {\n bar {\n }\n}\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "@media foo {", "@media foo {\n}\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "@media foo", "@media foo {\n}\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "@media", "@media {\n}\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") // path_to_url#syntax-page-selector expectPrinted(t, ` @page :first { margin: 0 } @page { @top-left-corner { content: 'tlc' } @top-left { content: 'tl' } @top-center { content: 'tc' } @top-right { content: 'tr' } @top-right-corner { content: 'trc' } @bottom-left-corner { content: 'blc' } @bottom-left { content: 'bl' } @bottom-center { content: 'bc' } @bottom-right { content: 'br' } @bottom-right-corner { content: 'brc' } @left-top { content: 'lt' } @left-middle { content: 'lm' } @left-bottom { content: 'lb' } @right-top { content: 'rt' } @right-middle { content: 'rm' } @right-bottom { content: 'rb' } } `, `@page :first { margin: 0; } @page { @top-left-corner { content: "tlc"; } @top-left { content: "tl"; } @top-center { content: "tc"; } @top-right { content: "tr"; } @top-right-corner { content: "trc"; } @bottom-left-corner { content: "blc"; } @bottom-left { content: "bl"; } @bottom-center { content: "bc"; } @bottom-right { content: "br"; } @bottom-right-corner { content: "brc"; } @left-top { content: "lt"; } @left-middle { content: "lm"; } @left-bottom { content: "lb"; } @right-top { content: "rt"; } @right-middle { content: "rm"; } @right-bottom { content: "rb"; } } `, "") // path_to_url#font-palette-values expectPrinted(t, ` @font-palette-values --Augusta { font-family: Handover Sans; base-palette: 3; override-colors: 1 rgb(43, 12, 9), 2 #000, 3 var(--highlight) } `, `@font-palette-values --Augusta { font-family: Handover Sans; base-palette: 3; override-colors: 1 rgb(43, 12, 9), 2 #000, 3 var(--highlight); } `, "") // path_to_url#container-rule expectPrinted(t, ` @container my-layout (inline-size > 45em) { .foo { color: skyblue; } } `, `@container my-layout (inline-size > 45em) { .foo { color: skyblue; } } `, "") expectPrintedMinify(t, `@container card ( inline-size > 30em ) and style( --responsive = true ) { .foo { color: skyblue; } }`, "@container card (inline-size > 30em) and style(--responsive = true){.foo{color:skyblue}}", "") expectPrintedMangleMinify(t, `@supports ( container-type: size ) { @container ( width <= 150px ) { #inner { background-color: skyblue; } } }`, "@supports (container-type: size){@container (width <= 150px){#inner{background-color:#87ceeb}}}", "") // path_to_url#defining-before-change-style-the-starting-style-rule expectPrinted(t, ` @starting-style { h1 { background-color: transparent; } @layer foo { div { height: 100px; } } } `, `@starting-style { h1 { background-color: transparent; } @layer foo { div { height: 100px; } } } `, "") expectPrintedMinify(t, `@starting-style { h1 { background-color: transparent; } }`, "@starting-style{h1{background-color:transparent}}", "") // path_to_url#the-counter-style-rule expectPrinted(t, ` @counter-style box-corner { system: fixed; symbols: ; suffix: ': ' } `, `@counter-style box-corner { system: fixed; symbols: ; suffix: ": "; } `, "") // path_to_url#font-feature-values expectPrinted(t, ` @font-feature-values Roboto { font-display: swap; } `, `@font-feature-values Roboto { font-display: swap; } `, "") expectPrinted(t, ` @font-feature-values Bongo { @swash { ornate: 1 } } `, `@font-feature-values Bongo { @swash { ornate: 1; } } `, "") // path_to_url#at-ruledef-position-try expectPrinted(t, `@position-try --foo { top: 0 }`, `@position-try --foo { top: 0; } `, "") expectPrintedMinify(t, `@position-try --foo { top: 0; }`, `@position-try --foo{top:0}`, "") } func TestAtCharset(t *testing.T) { expectPrinted(t, "@charset \"UTF-8\";", "@charset \"UTF-8\";\n", "") expectPrinted(t, "@charset 'UTF-8';", "@charset \"UTF-8\";\n", "") expectPrinted(t, "@charset \"utf-8\";", "@charset \"utf-8\";\n", "") expectPrinted(t, "@charset \"Utf-8\";", "@charset \"Utf-8\";\n", "") expectPrinted(t, "@charset \"US-ASCII\";", "@charset \"US-ASCII\";\n", "<stdin>: WARNING: \"UTF-8\" will be used instead of unsupported charset \"US-ASCII\"\n") expectPrinted(t, "@charset;", "@charset;\n", "<stdin>: WARNING: Expected whitespace but found \";\"\n") expectPrinted(t, "@charset ;", "@charset;\n", "<stdin>: WARNING: Expected string token but found \";\"\n") expectPrinted(t, "@charset\"UTF-8\";", "@charset \"UTF-8\";\n", "<stdin>: WARNING: Expected whitespace but found \"\\\"UTF-8\\\"\"\n") expectPrinted(t, "@charset \"UTF-8\"", "@charset \"UTF-8\";\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@charset url(UTF-8);", "@charset url(UTF-8);\n", "<stdin>: WARNING: Expected string token but found \"url(UTF-8)\"\n") expectPrinted(t, "@charset url(\"UTF-8\");", "@charset url(UTF-8);\n", "<stdin>: WARNING: Expected string token but found \"url(\"\n") expectPrinted(t, "@charset \"UTF-8\" ", "@charset \"UTF-8\";\n", "<stdin>: WARNING: Expected \";\" but found whitespace\n") expectPrinted(t, "@charset \"UTF-8\"{}", "@charset \"UTF-8\";\n {\n}\n", "<stdin>: WARNING: Expected \";\" but found \"{\"\n") } func TestAtImport(t *testing.T) { expectPrinted(t, "@import\"foo.css\";", "@import \"foo.css\";\n", "") expectPrinted(t, "@import \"foo.css\";", "@import \"foo.css\";\n", "") expectPrinted(t, "@import \"foo.css\" ;", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url();", "@import \"\";\n", "") expectPrinted(t, "@import url(foo.css);", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url(foo.css) ;", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url( foo.css );", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url(\"foo.css\");", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url(\"foo.css\") ;", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url( \"foo.css\" );", "@import \"foo.css\";\n", "") expectPrinted(t, "@import url(\"foo.css\") print;", "@import \"foo.css\" print;\n", "") expectPrinted(t, "@import url(\"foo.css\") screen and (orientation:landscape);", "@import \"foo.css\" screen and (orientation:landscape);\n", "") expectPrinted(t, "@import;", "@import;\n", "<stdin>: WARNING: Expected URL token but found \";\"\n") expectPrinted(t, "@import ;", "@import;\n", "<stdin>: WARNING: Expected URL token but found \";\"\n") expectPrinted(t, "@import \"foo.css\"", "@import \"foo.css\";\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@import url(\"foo.css\" extra-stuff);", "@import url(\"foo.css\" extra-stuff);\n", "<stdin>: WARNING: Expected URL token but found \"url(\"\n") expectPrinted(t, "@import url(\"foo.css\";", "@import url(\"foo.css\";);\n", "<stdin>: WARNING: Expected URL token but found \"url(\"\n<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, "@import noturl(\"foo.css\");", "@import noturl(\"foo.css\");\n", "<stdin>: WARNING: Expected URL token but found \"noturl(\"\n") expectPrinted(t, "@import url(foo.css", "@import \"foo.css\";\n", `<stdin>: WARNING: Expected ")" to end URL token <stdin>: NOTE: The unbalanced "(" is here: <stdin>: WARNING: Expected ";" but found end of file `) expectPrinted(t, "@import \"foo.css\" {}", "@import \"foo.css\" {}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrinted(t, "@import \"foo\"\na { color: red }\nb { color: blue }", "@import \"foo\" a { color: red }\nb {\n color: blue;\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrinted(t, "a { @import \"foo.css\" }", "a {\n @import \"foo.css\";\n}\n", "<stdin>: WARNING: \"@import\" is only valid at the top level\n<stdin>: WARNING: Expected \";\"\n") } func TestLegalComment(t *testing.T) { expectPrinted(t, "/*!*/@import \"x\";", "/*!*/\n@import \"x\";\n", "") expectPrinted(t, "/*!*/@charset \"UTF-8\";", "/*!*/\n@charset \"UTF-8\";\n", "") expectPrinted(t, "/*!*/ @import \"x\";", "/*!*/\n@import \"x\";\n", "") expectPrinted(t, "/*!*/ @charset \"UTF-8\";", "/*!*/\n@charset \"UTF-8\";\n", "") expectPrinted(t, "/*!*/ @charset \"UTF-8\"; @import \"x\";", "/*!*/\n@charset \"UTF-8\";\n@import \"x\";\n", "") expectPrinted(t, "/*!*/ @import \"x\"; @charset \"UTF-8\";", "/*!*/\n@import \"x\";\n@charset \"UTF-8\";\n", "<stdin>: WARNING: \"@charset\" must be the first rule in the file\n"+ "<stdin>: NOTE: This rule cannot come before a \"@charset\" rule\n") expectPrinted(t, "@import \"x\";/*!*/", "@import \"x\";\n/*!*/\n", "") expectPrinted(t, "@charset \"UTF-8\";/*!*/", "@charset \"UTF-8\";\n/*!*/\n", "") expectPrinted(t, "@import \"x\"; /*!*/", "@import \"x\";\n/*!*/\n", "") expectPrinted(t, "@charset \"UTF-8\"; /*!*/", "@charset \"UTF-8\";\n/*!*/\n", "") expectPrinted(t, "/*! before */ a { --b: var(--c, /*!*/ /*!*/); } /*! after */\n", "/*! before */\na {\n --b: var(--c, );\n}\n/*! after */\n", "") } func TestAtKeyframes(t *testing.T) { expectPrinted(t, "@keyframes {}", "@keyframes {}\n", "<stdin>: WARNING: Expected identifier but found \"{\"\n") expectPrinted(t, "@keyframes name{}", "@keyframes name {\n}\n", "") expectPrinted(t, "@keyframes name {}", "@keyframes name {\n}\n", "") expectPrinted(t, "@keyframes name{0%,50%{color:red}25%,75%{color:blue}}", "@keyframes name {\n 0%, 50% {\n color: red;\n }\n 25%, 75% {\n color: blue;\n }\n}\n", "") expectPrinted(t, "@keyframes name { 0%, 50% { color: red } 25%, 75% { color: blue } }", "@keyframes name {\n 0%, 50% {\n color: red;\n }\n 25%, 75% {\n color: blue;\n }\n}\n", "") expectPrinted(t, "@keyframes name{from{color:red}to{color:blue}}", "@keyframes name {\n from {\n color: red;\n }\n to {\n color: blue;\n }\n}\n", "") expectPrinted(t, "@keyframes name { from { color: red } to { color: blue } }", "@keyframes name {\n from {\n color: red;\n }\n to {\n color: blue;\n }\n}\n", "") // Note: Strings as names is allowed in the CSS specification and works in // Firefox and Safari but Chrome has strangely decided to deliberately not // support this. We always turn all string names into identifiers to avoid // them silently breaking in Chrome. expectPrinted(t, "@keyframes 'name' {}", "@keyframes name {\n}\n", "") expectPrinted(t, "@keyframes 'name 2' {}", "@keyframes name\\ 2 {\n}\n", "") expectPrinted(t, "@keyframes 'none' {}", "@keyframes \"none\" {}\n", "") expectPrinted(t, "@keyframes 'None' {}", "@keyframes \"None\" {}\n", "") expectPrinted(t, "@keyframes 'unset' {}", "@keyframes \"unset\" {}\n", "") expectPrinted(t, "@keyframes 'revert' {}", "@keyframes \"revert\" {}\n", "") expectPrinted(t, "@keyframes None {}", "@keyframes None {}\n", "<stdin>: WARNING: Cannot use \"None\" as a name for \"@keyframes\" without quotes\n"+ "NOTE: You can put \"None\" in quotes to prevent it from becoming a CSS keyword.\n") expectPrinted(t, "@keyframes REVERT {}", "@keyframes REVERT {}\n", "<stdin>: WARNING: Cannot use \"REVERT\" as a name for \"@keyframes\" without quotes\n"+ "NOTE: You can put \"REVERT\" in quotes to prevent it from becoming a CSS keyword.\n") expectPrinted(t, "@keyframes name { from { color: red } }", "@keyframes name {\n from {\n color: red;\n }\n}\n", "") expectPrinted(t, "@keyframes name { 100% { color: red } }", "@keyframes name {\n 100% {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@keyframes name { from { color: red } }", "@keyframes name {\n 0% {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@keyframes name { 100% { color: red } }", "@keyframes name {\n to {\n color: red;\n }\n}\n", "") expectPrinted(t, "@-webkit-keyframes name {}", "@-webkit-keyframes name {\n}\n", "") expectPrinted(t, "@-moz-keyframes name {}", "@-moz-keyframes name {\n}\n", "") expectPrinted(t, "@-ms-keyframes name {}", "@-ms-keyframes name {\n}\n", "") expectPrinted(t, "@-o-keyframes name {}", "@-o-keyframes name {\n}\n", "") expectPrinted(t, "@keyframes {}", "@keyframes {}\n", "<stdin>: WARNING: Expected identifier but found \"{\"\n") expectPrinted(t, "@keyframes name { 0% 100% {} }", "@keyframes name { 0% 100% {} }\n", "<stdin>: WARNING: Expected \",\" but found \"100%\"\n") expectPrinted(t, "@keyframes name { {} 0% {} }", "@keyframes name { {} 0% {} }\n", "<stdin>: WARNING: Expected percentage but found \"{\"\n") expectPrinted(t, "@keyframes name { 100 {} }", "@keyframes name { 100 {} }\n", "<stdin>: WARNING: Expected percentage but found \"100\"\n") expectPrinted(t, "@keyframes name { into {} }", "@keyframes name {\n into {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \"into\"\n") expectPrinted(t, "@keyframes name { 1,2 {} }", "@keyframes name { 1, 2 {} }\n", "<stdin>: WARNING: Expected percentage but found \"1\"\n") expectPrinted(t, "@keyframes name { 1, 2 {} }", "@keyframes name { 1, 2 {} }\n", "<stdin>: WARNING: Expected percentage but found \"1\"\n") expectPrinted(t, "@keyframes name { 1 ,2 {} }", "@keyframes name { 1, 2 {} }\n", "<stdin>: WARNING: Expected percentage but found \"1\"\n") expectPrinted(t, "@keyframes name { 1%, {} }", "@keyframes name { 1%, {} }\n", "<stdin>: WARNING: Expected percentage but found \"{\"\n") expectPrinted(t, "@keyframes name { 1%, x {} }", "@keyframes name {\n 1%, x {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \"x\"\n") expectPrinted(t, "@keyframes name { 1%, ! {} }", "@keyframes name { 1%, ! {} }\n", "<stdin>: WARNING: Expected percentage but found \"!\"\n") expectPrinted(t, "@keyframes name { .x {} }", "@keyframes name { .x {} }\n", "<stdin>: WARNING: Expected percentage but found \".\"\n") expectPrinted(t, "@keyframes name { {} }", "@keyframes name { {} }\n", "<stdin>: WARNING: Expected percentage but found \"{\"\n") expectPrinted(t, "@keyframes name { 1% }", "@keyframes name { 1% }\n", "<stdin>: WARNING: Expected \"{\" but found \"}\"\n") expectPrinted(t, "@keyframes name { 1%", "@keyframes name { 1% }\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "@keyframes name { 1%,,2% {} }", "@keyframes name { 1%,, 2% {} }\n", "<stdin>: WARNING: Expected percentage but found \",\"\n") expectPrinted(t, "@keyframes name {", "@keyframes name {}\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "@keyframes x { 1%, {} } @keyframes z { 1% {} }", "@keyframes x { 1%, {} }\n@keyframes z {\n 1% {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \"{\"\n") expectPrinted(t, "@keyframes x { .y {} } @keyframes z { 1% {} }", "@keyframes x { .y {} }\n@keyframes z {\n 1% {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \".\"\n") expectPrinted(t, "@keyframes x { x {} } @keyframes z { 1% {} }", "@keyframes x {\n x {\n }\n}\n@keyframes z {\n 1% {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \"x\"\n") expectPrinted(t, "@keyframes x { {} } @keyframes z { 1% {} }", "@keyframes x { {} }\n@keyframes z {\n 1% {\n }\n}\n", "<stdin>: WARNING: Expected percentage but found \"{\"\n") expectPrinted(t, "@keyframes x { 1% {}", "@keyframes x { 1% {} }\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "@keyframes x { 1% {", "@keyframes x { 1% {} }\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "@keyframes x { 1%", "@keyframes x { 1% }\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "@keyframes x {", "@keyframes x {}\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") } func TestAnimationName(t *testing.T) { // Note: Strings as names is allowed in the CSS specification and works in // Firefox and Safari but Chrome has strangely decided to deliberately not // support this. We always turn all string names into identifiers to avoid // them silently breaking in Chrome. expectPrinted(t, "div { animation-name: 'name' }", "div {\n animation-name: name;\n}\n", "") expectPrinted(t, "div { animation-name: 'name 2' }", "div {\n animation-name: name\\ 2;\n}\n", "") expectPrinted(t, "div { animation-name: 'none' }", "div {\n animation-name: \"none\";\n}\n", "") expectPrinted(t, "div { animation-name: 'None' }", "div {\n animation-name: \"None\";\n}\n", "") expectPrinted(t, "div { animation-name: 'unset' }", "div {\n animation-name: \"unset\";\n}\n", "") expectPrinted(t, "div { animation-name: 'revert' }", "div {\n animation-name: \"revert\";\n}\n", "") expectPrinted(t, "div { animation-name: none }", "div {\n animation-name: none;\n}\n", "") expectPrinted(t, "div { animation-name: unset }", "div {\n animation-name: unset;\n}\n", "") expectPrinted(t, "div { animation: 2s linear 'name 2', 3s infinite 'name 3' }", "div {\n animation: 2s linear name\\ 2, 3s infinite name\\ 3;\n}\n", "") } func TestAtRuleValidation(t *testing.T) { expectPrinted(t, "a {} b {} c {} @charset \"UTF-8\";", "a {\n}\nb {\n}\nc {\n}\n@charset \"UTF-8\";\n", "<stdin>: WARNING: \"@charset\" must be the first rule in the file\n"+ "<stdin>: NOTE: This rule cannot come before a \"@charset\" rule\n") expectPrinted(t, "a {} b {} c {} @import \"foo\";", "a {\n}\nb {\n}\nc {\n}\n@import \"foo\";\n", "<stdin>: WARNING: All \"@import\" rules must come first\n"+ "<stdin>: NOTE: This rule cannot come before an \"@import\" rule\n") } func TestAtLayer(t *testing.T) { expectPrinted(t, "@layer a, b;", "@layer a, b;\n", "") expectPrinted(t, "@layer a {}", "@layer a {\n}\n", "") expectPrinted(t, "@layer {}", "@layer {\n}\n", "") expectPrinted(t, "@layer a, b {}", "@layer a, b {\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrinted(t, "@layer;", "@layer;\n", "<stdin>: WARNING: Unexpected \";\"\n") expectPrinted(t, "@layer , b {}", "@layer , b {\n}\n", "<stdin>: WARNING: Unexpected \",\"\n") expectPrinted(t, "@layer a", "@layer a;\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@layer a { @layer b }", "@layer a {\n @layer b;\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrinted(t, "@layer a b", "@layer a b;\n", "<stdin>: WARNING: Unexpected \"b\"\n<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@layer a b ;", "@layer a b;\n", "<stdin>: WARNING: Unexpected \"b\"\n") expectPrinted(t, "@layer a b {}", "@layer a b {\n}\n", "<stdin>: WARNING: Unexpected \"b\"\n") expectPrinted(t, "@layer a, b;", "@layer a, b;\n", "") expectPrinted(t, "@layer a {}", "@layer a {\n}\n", "") expectPrinted(t, "@layer {}", "@layer {\n}\n", "") expectPrinted(t, "@layer foo { div { color: red } }", "@layer foo {\n div {\n color: red;\n }\n}\n", "") // Check semicolon error recovery expectPrinted(t, "@layer", "@layer;\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@layer a", "@layer a;\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrinted(t, "@layer a { @layer }", "@layer a {\n @layer;\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrinted(t, "@layer a { @layer b }", "@layer a {\n @layer b;\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrintedMangle(t, "@layer", "@layer;\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrintedMangle(t, "@layer a", "@layer a;\n", "<stdin>: WARNING: Expected \";\" but found end of file\n") expectPrintedMangle(t, "@layer a { @layer }", "@layer a {\n @layer;\n}\n", "<stdin>: WARNING: Expected \";\"\n") expectPrintedMangle(t, "@layer a { @layer b }", "@layer a.b;\n", "<stdin>: WARNING: Expected \";\"\n") // Check mangling expectPrintedMangle(t, "@layer foo { div {} }", "@layer foo;\n", "") expectPrintedMangle(t, "@layer foo { div { color: yellow } }", "@layer foo {\n div {\n color: #ff0;\n }\n}\n", "") expectPrintedMangle(t, "@layer a { @layer b {} }", "@layer a.b;\n", "") expectPrintedMangle(t, "@layer a { @layer {} }", "@layer a {\n @layer {\n }\n}\n", "") expectPrintedMangle(t, "@layer { @layer a {} }", "@layer {\n @layer a;\n}\n", "") expectPrintedMangle(t, "@layer a.b { @layer c.d {} }", "@layer a.b.c.d;\n", "") expectPrintedMangle(t, "@layer a.b { @layer c.d {} @layer e.f {} }", "@layer a.b {\n @layer c.d;\n @layer e.f;\n}\n", "") expectPrintedMangle(t, "@layer a.b { @layer c.d { e { f: g } } }", "@layer a.b.c.d {\n e {\n f: g;\n }\n}\n", "") // Invalid layer names should not be merged, since that causes the rule to // become invalid. It would be a change in semantics if we merged an invalid // rule with a valid rule since then the other valid rule would be invalid. initial := "<stdin>: WARNING: \"initial\" cannot be used as a layer name\n" inherit := "<stdin>: WARNING: \"inherit\" cannot be used as a layer name\n" unset := "<stdin>: WARNING: \"unset\" cannot be used as a layer name\n" expectPrinted(t, "@layer foo { @layer initial; }", "@layer foo {\n @layer initial;\n}\n", initial) expectPrinted(t, "@layer foo { @layer inherit; }", "@layer foo {\n @layer inherit;\n}\n", inherit) expectPrinted(t, "@layer foo { @layer unset; }", "@layer foo {\n @layer unset;\n}\n", unset) expectPrinted(t, "@layer initial { @layer foo; }", "@layer initial {\n @layer foo;\n}\n", initial) expectPrinted(t, "@layer inherit { @layer foo; }", "@layer inherit {\n @layer foo;\n}\n", inherit) expectPrinted(t, "@layer unset { @layer foo; }", "@layer unset {\n @layer foo;\n}\n", unset) expectPrintedMangle(t, "@layer foo { @layer initial { a { b: c } } }", "@layer foo {\n @layer initial {\n a {\n b: c;\n }\n }\n}\n", initial) expectPrintedMangle(t, "@layer initial { @layer foo { a { b: c } } }", "@layer initial {\n @layer foo {\n a {\n b: c;\n }\n }\n}\n", initial) // Order matters here. Do not drop the first "@layer a;" or the order will be changed. expectPrintedMangle(t, "@layer a; @layer b; @layer a;", "@layer a;\n@layer b;\n@layer a;\n", "") // Validate ordering with "@layer" and "@import" expectPrinted(t, "@layer a; @import url(b);", "@layer a;\n@import \"b\";\n", "") expectPrinted(t, "@layer a; @layer b; @import url(c);", "@layer a;\n@layer b;\n@import \"c\";\n", "") expectPrinted(t, "@layer a {} @import url(b);", "@layer a {\n}\n@import url(b);\n", "<stdin>: WARNING: All \"@import\" rules must come first\n<stdin>: NOTE: This rule cannot come before an \"@import\" rule\n") expectPrinted(t, "@import url(a); @layer b; @import url(c);", "@import \"a\";\n@layer b;\n@import url(c);\n", "<stdin>: WARNING: All \"@import\" rules must come first\n<stdin>: NOTE: This rule cannot come before an \"@import\" rule\n") expectPrinted(t, "@layer a; @charset \"UTF-8\";", "@layer a;\n@charset \"UTF-8\";\n", "<stdin>: WARNING: \"@charset\" must be the first rule in the file\n<stdin>: NOTE: This rule cannot come before a \"@charset\" rule\n") } func TestEmptyRule(t *testing.T) { expectPrinted(t, "div {}", "div {\n}\n", "") expectPrinted(t, "@media screen {}", "@media screen {\n}\n", "") expectPrinted(t, "@page { @top-left {} }", "@page {\n @top-left {\n }\n}\n", "") expectPrinted(t, "@keyframes test { from {} to {} }", "@keyframes test {\n from {\n }\n to {\n }\n}\n", "") expectPrintedMangle(t, "div {}", "", "") expectPrintedMangle(t, "@media screen {}", "", "") expectPrintedMangle(t, "@page { @top-left {} }", "", "") expectPrintedMangle(t, "@keyframes test { from {} to {} }", "@keyframes test {\n}\n", "") expectPrinted(t, "$invalid {}", "$invalid {\n}\n", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrinted(t, "@page { color: red; @top-left {} }", "@page {\n color: red;\n @top-left {\n }\n}\n", "") expectPrinted(t, "@keyframes test { from {} to { color: red } }", "@keyframes test {\n from {\n }\n to {\n color: red;\n }\n}\n", "") expectPrinted(t, "@keyframes test { from { color: red } to {} }", "@keyframes test {\n from {\n color: red;\n }\n to {\n }\n}\n", "") expectPrintedMangle(t, "$invalid {}", "$invalid {\n}\n", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrintedMangle(t, "@page { color: red; @top-left {} }", "@page {\n color: red;\n}\n", "") expectPrintedMangle(t, "@keyframes test { from {} to { color: red } }", "@keyframes test {\n to {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@keyframes test { from { color: red } to {} }", "@keyframes test {\n 0% {\n color: red;\n }\n}\n", "") expectPrintedMangleMinify(t, "$invalid {}", "$invalid{}", "<stdin>: WARNING: Unexpected \"$\"\n") expectPrintedMangleMinify(t, "@page { color: red; @top-left {} }", "@page{color:red}", "") expectPrintedMangleMinify(t, "@keyframes test { from {} to { color: red } }", "@keyframes test{to{color:red}}", "") expectPrintedMangleMinify(t, "@keyframes test { from { color: red } to {} }", "@keyframes test{0%{color:red}}", "") expectPrinted(t, "invalid", "invalid {\n}\n", "<stdin>: WARNING: Expected \"{\" but found end of file\n") expectPrinted(t, "invalid }", "invalid } {\n}\n", "<stdin>: WARNING: Unexpected \"}\"\n") } func TestMarginAndPaddingAndInset(t *testing.T) { for _, x := range []string{"margin", "padding", "inset"} { xTop := x + "-top" xRight := x + "-right" xBottom := x + "-bottom" xLeft := x + "-left" if x == "inset" { xTop = "top" xRight = "right" xBottom = "bottom" xLeft = "left" } expectPrinted(t, "a { "+x+": 0 1px 0 1px }", "a {\n "+x+": 0 1px 0 1px;\n}\n", "") expectPrinted(t, "a { "+x+": 0 1px 0px 1px }", "a {\n "+x+": 0 1px 0px 1px;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 0px }", "a {\n "+xTop+": 0;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 0px }", "a {\n "+xRight+": 0;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 0px }", "a {\n "+xBottom+": 0;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 0px }", "a {\n "+xLeft+": 0;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px }", "a {\n "+xTop+": 1px;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 1px }", "a {\n "+xRight+": 1px;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 1px }", "a {\n "+xBottom+": 1px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px }", "a {\n "+xLeft+": 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 0 0 }", "a {\n "+x+": 0 1px 0 0;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 2px 1px }", "a {\n "+x+": 0 1px 2px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 0 1px }", "a {\n "+x+": 0 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 0 0 0 }", "a {\n "+x+": 0;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 0 0 0 !important }", "a {\n "+x+": 0 !important;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 0px 1px }", "a {\n "+x+": 0 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1 0px 1px }", "a {\n "+x+": 0 1 0px 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xTop+": 5px }", "a {\n "+x+": 5px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xRight+": 5px }", "a {\n "+x+": 1px 5px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xBottom+": 5px }", "a {\n "+x+": 1px 2px 5px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xLeft+": 5px }", "a {\n "+x+": 1px 2px 3px 5px;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 5px; "+x+": 1px 2px 3px 4px }", "a {\n "+x+": 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 5px; "+x+": 1px 2px 3px 4px }", "a {\n "+x+": 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 5px; "+x+": 1px 2px 3px 4px }", "a {\n "+x+": 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 5px; "+x+": 1px 2px 3px 4px }", "a {\n "+x+": 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px; "+xTop+": 2px }", "a {\n "+xTop+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 1px; "+xRight+": 2px }", "a {\n "+xRight+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 1px; "+xBottom+": 2px }", "a {\n "+xBottom+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px; "+xLeft+": 2px }", "a {\n "+xLeft+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px; "+x+": 2px !important }", "a {\n "+x+": 1px;\n "+x+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px; "+xTop+": 2px !important }", "a {\n "+xTop+": 1px;\n "+xTop+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 1px; "+xRight+": 2px !important }", "a {\n "+xRight+": 1px;\n "+xRight+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 1px; "+xBottom+": 2px !important }", "a {\n "+xBottom+": 1px;\n "+xBottom+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px; "+xLeft+": 2px !important }", "a {\n "+xLeft+": 1px;\n "+xLeft+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px !important; "+x+": 2px }", "a {\n "+x+": 1px !important;\n "+x+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px !important; "+xTop+": 2px }", "a {\n "+xTop+": 1px !important;\n "+xTop+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xRight+": 1px !important; "+xRight+": 2px }", "a {\n "+xRight+": 1px !important;\n "+xRight+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xBottom+": 1px !important; "+xBottom+": 2px }", "a {\n "+xBottom+": 1px !important;\n "+xBottom+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px !important; "+xLeft+": 2px }", "a {\n "+xLeft+": 1px !important;\n "+xLeft+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px; "+xTop+": }", "a {\n "+xTop+": 1px;\n "+xTop+":;\n}\n", "") expectPrintedMangle(t, "a { "+xTop+": 1px; "+xTop+": 2px 3px }", "a {\n "+xTop+": 1px;\n "+xTop+": 2px 3px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xLeft+": -4px; "+xRight+": -2px }", "a {\n "+x+": 1px -2px 3px -4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px; "+xTop+": 5px }", "a {\n "+x+": 5px 2px 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px; "+xTop+": 5px }", "a {\n "+x+": 5px 1px 1px;\n}\n", "") // This doesn't collapse because if the "calc" has an error it // will be ignored and the original rule will show through expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xRight+": calc(1px + var(--x)) }", "a {\n "+x+": 1px 2px 3px 4px;\n "+xRight+": calc(1px + var(--x));\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px; "+xRight+": 2px; "+xTop+": 3px; "+xBottom+": 4px }", "a {\n "+x+": 3px 2px 4px 1px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px; "+xRight+": 5px !important }", "a {\n "+x+": 1px 2px 3px 4px;\n "+xRight+": 5px !important;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px 2px 3px 4px !important; "+xRight+": 5px }", "a {\n "+x+": 1px 2px 3px 4px !important;\n "+xRight+": 5px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px !important; "+xRight+": 2px; "+xTop+": 3px !important; "+xBottom+": 4px }", "a {\n "+xLeft+": 1px !important;\n "+xRight+": 2px;\n "+xTop+": 3px !important;\n "+xBottom+": 4px;\n}\n", "") // This should not be changed because "--x" and "--z" could be empty expectPrintedMangle(t, "a { "+x+": var(--x) var(--y) var(--z) var(--y) }", "a {\n "+x+": var(--x) var(--y) var(--z) var(--y);\n}\n", "") // Don't merge different units expectPrintedMangle(t, "a { "+x+": 1px; "+x+": 2px; }", "a {\n "+x+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 1px; "+x+": 2vw; }", "a {\n "+x+": 1px;\n "+x+": 2vw;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px; "+xLeft+": 2px; }", "a {\n "+xLeft+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1px; "+xLeft+": 2vw; }", "a {\n "+xLeft+": 1px;\n "+xLeft+": 2vw;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 2cm 3%; "+x+": 4px; }", "a {\n "+x+": 4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 2cm 3%; "+x+": 4vw; }", "a {\n "+x+": 0 1px 2cm 3%;\n "+x+": 4vw;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 2cm 3%; "+xLeft+": 4px; }", "a {\n "+x+": 0 1px 2cm 4px;\n}\n", "") expectPrintedMangle(t, "a { "+x+": 0 1px 2cm 3%; "+xLeft+": 4vw; }", "a {\n "+x+": 0 1px 2cm 3%;\n "+xLeft+": 4vw;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1Q; "+xRight+": 2Q; "+xTop+": 3Q; "+xBottom+": 4Q; }", "a {\n "+x+": 3Q 2Q 4Q 1Q;\n}\n", "") expectPrintedMangle(t, "a { "+xLeft+": 1Q; "+xRight+": 2Q; "+xTop+": 3Q; "+xBottom+": 0; }", "a {\n "+xLeft+": 1Q;\n "+xRight+": 2Q;\n "+xTop+": 3Q;\n "+xBottom+": 0;\n}\n", "") } // "auto" is the only keyword allowed in a quad, and only for "margin" and "inset" not for "padding" expectPrintedMangle(t, "a { margin: 1px auto 3px 4px; margin-left: auto }", "a {\n margin: 1px auto 3px;\n}\n", "") expectPrintedMangle(t, "a { inset: 1px auto 3px 4px; left: auto }", "a {\n inset: 1px auto 3px;\n}\n", "") expectPrintedMangle(t, "a { padding: 1px auto 3px 4px; padding-left: auto }", "a {\n padding: 1px auto 3px 4px;\n padding-left: auto;\n}\n", "") expectPrintedMangle(t, "a { margin: auto; margin-left: 1px }", "a {\n margin: auto auto auto 1px;\n}\n", "") expectPrintedMangle(t, "a { inset: auto; left: 1px }", "a {\n inset: auto auto auto 1px;\n}\n", "") expectPrintedMangle(t, "a { padding: auto; padding-left: 1px }", "a {\n padding: auto;\n padding-left: 1px;\n}\n", "") expectPrintedMangle(t, "a { margin: inherit; margin-left: 1px }", "a {\n margin: inherit;\n margin-left: 1px;\n}\n", "") expectPrintedMangle(t, "a { inset: inherit; left: 1px }", "a {\n inset: inherit;\n left: 1px;\n}\n", "") expectPrintedMangle(t, "a { padding: inherit; padding-left: 1px }", "a {\n padding: inherit;\n padding-left: 1px;\n}\n", "") expectPrintedLowerMangle(t, "a { top: 0; right: 0; bottom: 0; left: 0; }", "a {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n", "") // "inset" should be expanded when not supported expectPrintedLower(t, "a { inset: 0; }", "a {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n", "") expectPrintedLower(t, "a { inset: 0px; }", "a {\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n}\n", "") expectPrintedLower(t, "a { inset: 1px 2px; }", "a {\n top: 1px;\n right: 2px;\n bottom: 1px;\n left: 2px;\n}\n", "") expectPrintedLower(t, "a { inset: 1px 2px 3px; }", "a {\n top: 1px;\n right: 2px;\n bottom: 3px;\n left: 2px;\n}\n", "") expectPrintedLower(t, "a { inset: 1px 2px 3px 4px; }", "a {\n top: 1px;\n right: 2px;\n bottom: 3px;\n left: 4px;\n}\n", "") // When "inset" isn't supported, other mangling should still work expectPrintedLowerMangle(t, "a { top: 0px; }", "a {\n top: 0;\n}\n", "") expectPrintedLowerMangle(t, "a { right: 0px; }", "a {\n right: 0;\n}\n", "") expectPrintedLowerMangle(t, "a { bottom: 0px; }", "a {\n bottom: 0;\n}\n", "") expectPrintedLowerMangle(t, "a { left: 0px; }", "a {\n left: 0;\n}\n", "") expectPrintedLowerMangle(t, "a { inset: 0px; }", "a {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n", "") // When "inset" isn't supported, whitespace minifying should still work expectPrintedLowerMinify(t, "a { top: 0px; }", "a{top:0px}", "") expectPrintedLowerMinify(t, "a { right: 0px; }", "a{right:0px}", "") expectPrintedLowerMinify(t, "a { bottom: 0px; }", "a{bottom:0px}", "") expectPrintedLowerMinify(t, "a { left: 0px; }", "a{left:0px}", "") expectPrintedLowerMinify(t, "a { inset: 0px; }", "a{top:0px;right:0px;bottom:0px;left:0px}", "") expectPrintedLowerMinify(t, "a { inset: 1px 2px; }", "a{top:1px;right:2px;bottom:1px;left:2px}", "") expectPrintedLowerMinify(t, "a { inset: 1px 2px 3px; }", "a{top:1px;right:2px;bottom:3px;left:2px}", "") expectPrintedLowerMinify(t, "a { inset: 1px 2px 3px 4px; }", "a{top:1px;right:2px;bottom:3px;left:4px}", "") } func TestBorderRadius(t *testing.T) { expectPrinted(t, "a { border-top-left-radius: 0 0 }", "a {\n border-top-left-radius: 0 0;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 0 0 }", "a {\n border-top-left-radius: 0;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 0 0px }", "a {\n border-top-left-radius: 0;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 0 1px }", "a {\n border-top-left-radius: 0 1px;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 0; border-radius: 1px }", "a {\n border-radius: 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 2px 3px 4px }", "a {\n border-radius: 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 2px 1px 3px }", "a {\n border-radius: 1px 2px 1px 3px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 2px 3px 2px }", "a {\n border-radius: 1px 2px 3px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 2px 1px 2px }", "a {\n border-radius: 1px 2px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 1px 1px 1px }", "a {\n border-radius: 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 2px 3px 4px }", "a {\n border-radius: 0 / 1px 2px 3px 4px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 2px 1px 3px }", "a {\n border-radius: 0 / 1px 2px 1px 3px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 2px 3px 2px }", "a {\n border-radius: 0 / 1px 2px 3px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 2px 1px 2px }", "a {\n border-radius: 0 / 1px 2px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 1px 1px 1px }", "a {\n border-radius: 0 / 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px 2px; border-top-left-radius: 3px; }", "a {\n border-radius: 3px 2px 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px; border-top-left-radius: 3px; }", "a {\n border-radius: 3px 1px 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px; border-top-left-radius: 3px; }", "a {\n border-radius: 3px 0 0 / 3px 1px 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0/1px 2px; border-top-left-radius: 3px; }", "a {\n border-radius: 3px 0 0 / 3px 2px 1px;\n}\n", "") for _, x := range []string{"", "-top-left", "-top-right", "-bottom-left", "-bottom-right"} { y := "border" + x + "-radius" expectPrintedMangle(t, "a { "+y+": 1px; "+y+": 2px }", "a {\n "+y+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+y+": 1px !important; "+y+": 2px }", "a {\n "+y+": 1px !important;\n "+y+": 2px;\n}\n", "") expectPrintedMangle(t, "a { "+y+": 1px; "+y+": 2px !important }", "a {\n "+y+": 1px;\n "+y+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { "+y+": 1px !important; "+y+": 2px !important }", "a {\n "+y+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px; "+y+": 2px !important; }", "a {\n border-radius: 1px;\n "+y+": 2px !important;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px !important; "+y+": 2px; }", "a {\n border-radius: 1px !important;\n "+y+": 2px;\n}\n", "") } expectPrintedMangle(t, "a { border-top-left-radius: ; border-radius: 1px }", "a {\n border-top-left-radius:;\n border-radius: 1px;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 1px; border-radius: / }", "a {\n border-top-left-radius: 1px;\n border-radius: /;\n}\n", "") expectPrintedMangleMinify(t, "a { border-radius: 1px 2px 3px 4px; border-top-right-radius: 5px; }", "a{border-radius:1px 5px 3px 4px}", "") expectPrintedMangleMinify(t, "a { border-radius: 1px 2px 3px 4px; border-top-right-radius: 5px 6px; }", "a{border-radius:1px 5px 3px 4px/1px 6px 3px 4px}", "") // These should not be changed because "--x" and "--z" could be empty expectPrintedMangle(t, "a { border-radius: var(--x) var(--y) var(--z) var(--y) }", "a {\n border-radius: var(--x) var(--y) var(--z) var(--y);\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0 / var(--x) var(--y) var(--z) var(--y) }", "a {\n border-radius: 0 / var(--x) var(--y) var(--z) var(--y);\n}\n", "") // "inherit" should not be merged expectPrintedMangle(t, "a { border-radius: 1px; border-top-left-radius: 0 }", "a {\n border-radius: 0 1px 1px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: inherit; border-top-left-radius: 0 }", "a {\n border-radius: inherit;\n border-top-left-radius: 0;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0; border-top-left-radius: inherit }", "a {\n border-radius: 0;\n border-top-left-radius: inherit;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 0; border-radius: inherit }", "a {\n border-top-left-radius: 0;\n border-radius: inherit;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: inherit; border-radius: 0 }", "a {\n border-top-left-radius: inherit;\n border-radius: 0;\n}\n", "") // Don't merge different units expectPrintedMangle(t, "a { border-radius: 1px; border-radius: 2px; }", "a {\n border-radius: 2px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1px; border-top-left-radius: 2px; }", "a {\n border-radius: 2px 1px 1px;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 1px; border-radius: 2px; }", "a {\n border-radius: 2px;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 1px; border-top-left-radius: 2px; }", "a {\n border-top-left-radius: 2px;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1rem; border-radius: 1vw; }", "a {\n border-radius: 1rem;\n border-radius: 1vw;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 1rem; border-top-left-radius: 1vw; }", "a {\n border-radius: 1rem;\n border-top-left-radius: 1vw;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 1rem; border-radius: 1vw; }", "a {\n border-top-left-radius: 1rem;\n border-radius: 1vw;\n}\n", "") expectPrintedMangle(t, "a { border-top-left-radius: 1rem; border-top-left-radius: 1vw; }", "a {\n border-top-left-radius: 1rem;\n border-top-left-radius: 1vw;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0; border-top-left-radius: 2px; }", "a {\n border-radius: 2px 0 0;\n}\n", "") expectPrintedMangle(t, "a { border-radius: 0; border-top-left-radius: 2rem; }", "a {\n border-radius: 0;\n border-top-left-radius: 2rem;\n}\n", "") } func TestBoxShadow(t *testing.T) { expectPrinted(t, "a { box-shadow: inset 0px 0px 0px 0px black }", "a {\n box-shadow: inset 0px 0px 0px 0px black;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: 0px 0px 0px 0px inset black }", "a {\n box-shadow: 0 0 inset #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: 0px 0px 0px 0px black inset }", "a {\n box-shadow: 0 0 #000 inset;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: black 0px 0px 0px 0px inset }", "a {\n box-shadow: #000 0 0 inset;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: inset 0px 0px 0px 0px black }", "a {\n box-shadow: inset 0 0 #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: inset black 0px 0px 0px 0px }", "a {\n box-shadow: inset #000 0 0;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: black inset 0px 0px 0px 0px }", "a {\n box-shadow: #000 inset 0 0;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: yellow 1px 0px 0px 1px inset }", "a {\n box-shadow: #ff0 1px 0 0 1px inset;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: yellow 1px 0px 1px 0px inset }", "a {\n box-shadow: #ff0 1px 0 1px inset;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: rebeccapurple, yellow, black }", "a {\n box-shadow:\n #639,\n #ff0,\n #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: 0px 0px 0px var(--foo) black }", "a {\n box-shadow: 0 0 0 var(--foo) #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: 0px 0px 0px 0px var(--foo) black }", "a {\n box-shadow: 0 0 0 0 var(--foo) #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: calc(1px + var(--foo)) 0px 0px 0px black }", "a {\n box-shadow: calc(1px + var(--foo)) 0 0 0 #000;\n}\n", "") expectPrintedMangle(t, "a { box-shadow: inset 0px 0px 0px 0px 0px magenta; }", "a {\n box-shadow: inset 0 0 0 0 0 #f0f;\n}\n", "") expectPrintedMangleMinify(t, "a { box-shadow: rebeccapurple , yellow , black }", "a{box-shadow:#639,#ff0,#000}", "") expectPrintedMangleMinify(t, "a { box-shadow: rgb(255, 0, 17) 0 0 1 inset }", "a{box-shadow:#f01 0 0 1 inset}", "") } func TestMangleTime(t *testing.T) { expectPrintedMangle(t, "a { animation: b 1s }", "a {\n animation: b 1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1.s }", "a {\n animation: b 1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1.0s }", "a {\n animation: b 1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1.02s }", "a {\n animation: b 1.02s;\n}\n", "") expectPrintedMangle(t, "a { animation: b .1s }", "a {\n animation: b .1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b .01s }", "a {\n animation: b .01s;\n}\n", "") expectPrintedMangle(t, "a { animation: b .001s }", "a {\n animation: b 1ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b .0012s }", "a {\n animation: b 1.2ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b -.001s }", "a {\n animation: b -1ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b -.0012s }", "a {\n animation: b -1.2ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b .0001s }", "a {\n animation: b .1ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b .00012s }", "a {\n animation: b .12ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b .000123s }", "a {\n animation: b .123ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b .01S }", "a {\n animation: b .01S;\n}\n", "") expectPrintedMangle(t, "a { animation: b .001S }", "a {\n animation: b 1ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1ms }", "a {\n animation: b 1ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b 10ms }", "a {\n animation: b 10ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b 100ms }", "a {\n animation: b .1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 120ms }", "a {\n animation: b .12s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 123ms }", "a {\n animation: b 123ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1000ms }", "a {\n animation: b 1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1200ms }", "a {\n animation: b 1.2s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1230ms }", "a {\n animation: b 1.23s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1234ms }", "a {\n animation: b 1234ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b -100ms }", "a {\n animation: b -.1s;\n}\n", "") expectPrintedMangle(t, "a { animation: b -120ms }", "a {\n animation: b -.12s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 120mS }", "a {\n animation: b .12s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 120Ms }", "a {\n animation: b .12s;\n}\n", "") expectPrintedMangle(t, "a { animation: b 123mS }", "a {\n animation: b 123mS;\n}\n", "") expectPrintedMangle(t, "a { animation: b 123Ms }", "a {\n animation: b 123Ms;\n}\n", "") // Mangling times with exponents is not currently supported expectPrintedMangle(t, "a { animation: b 1e3ms }", "a {\n animation: b 1e3ms;\n}\n", "") expectPrintedMangle(t, "a { animation: b 1E3ms }", "a {\n animation: b 1E3ms;\n}\n", "") } func TestCalc(t *testing.T) { expectPrinted(t, "a { b: calc(+(2)) }", "a {\n b: calc(+(2));\n}\n", "<stdin>: WARNING: \"+\" can only be used as an infix operator, not a prefix operator\n") expectPrinted(t, "a { b: calc(-(2)) }", "a {\n b: calc(-(2));\n}\n", "<stdin>: WARNING: \"-\" can only be used as an infix operator, not a prefix operator\n") expectPrinted(t, "a { b: calc(*(2)) }", "a {\n b: calc(*(2));\n}\n", "") expectPrinted(t, "a { b: calc(/(2)) }", "a {\n b: calc(/(2));\n}\n", "") expectPrinted(t, "a { b: calc(1 + 2) }", "a {\n b: calc(1 + 2);\n}\n", "") expectPrinted(t, "a { b: calc(1 - 2) }", "a {\n b: calc(1 - 2);\n}\n", "") expectPrinted(t, "a { b: calc(1 * 2) }", "a {\n b: calc(1 * 2);\n}\n", "") expectPrinted(t, "a { b: calc(1 / 2) }", "a {\n b: calc(1 / 2);\n}\n", "") expectPrinted(t, "a { b: calc(1+ 2) }", "a {\n b: calc(1+ 2);\n}\n", "<stdin>: WARNING: The \"+\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1- 2) }", "a {\n b: calc(1- 2);\n}\n", "<stdin>: WARNING: The \"-\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1* 2) }", "a {\n b: calc(1* 2);\n}\n", "") expectPrinted(t, "a { b: calc(1/ 2) }", "a {\n b: calc(1/ 2);\n}\n", "") expectPrinted(t, "a { b: calc(1 +2) }", "a {\n b: calc(1 +2);\n}\n", "<stdin>: WARNING: The \"+\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1 -2) }", "a {\n b: calc(1 -2);\n}\n", "<stdin>: WARNING: The \"-\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1 *2) }", "a {\n b: calc(1 *2);\n}\n", "") expectPrinted(t, "a { b: calc(1 /2) }", "a {\n b: calc(1 /2);\n}\n", "") expectPrinted(t, "a { b: calc(1 +(2)) }", "a {\n b: calc(1 +(2));\n}\n", "<stdin>: WARNING: The \"+\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1 -(2)) }", "a {\n b: calc(1 -(2));\n}\n", "<stdin>: WARNING: The \"-\" operator only works if there is whitespace on both sides\n") expectPrinted(t, "a { b: calc(1 *(2)) }", "a {\n b: calc(1 *(2));\n}\n", "") expectPrinted(t, "a { b: calc(1 /(2)) }", "a {\n b: calc(1 /(2));\n}\n", "") } func TestMinifyCalc(t *testing.T) { expectPrintedMangleMinify(t, "a { b: calc(x + y) }", "a{b:calc(x + y)}", "") expectPrintedMangleMinify(t, "a { b: calc(x - y) }", "a{b:calc(x - y)}", "") expectPrintedMangleMinify(t, "a { b: calc(x * y) }", "a{b:calc(x*y)}", "") expectPrintedMangleMinify(t, "a { b: calc(x / y) }", "a{b:calc(x/y)}", "") } func TestMangleCalc(t *testing.T) { expectPrintedMangle(t, "a { b: calc(1) }", "a {\n b: 1;\n}\n", "") expectPrintedMangle(t, "a { b: calc((1)) }", "a {\n b: 1;\n}\n", "") expectPrintedMangle(t, "a { b: calc(calc(1)) }", "a {\n b: 1;\n}\n", "") expectPrintedMangle(t, "a { b: calc(x + y * z) }", "a {\n b: calc(x + y * z);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x * y + z) }", "a {\n b: calc(x * y + z);\n}\n", "") // Test sum expectPrintedMangle(t, "a { b: calc(2 + 3) }", "a {\n b: 5;\n}\n", "") expectPrintedMangle(t, "a { b: calc(6 - 2) }", "a {\n b: 4;\n}\n", "") // Test product expectPrintedMangle(t, "a { b: calc(2 * 3) }", "a {\n b: 6;\n}\n", "") expectPrintedMangle(t, "a { b: calc(6 / 2) }", "a {\n b: 3;\n}\n", "") expectPrintedMangle(t, "a { b: calc(2px * 3 + 4px * 5) }", "a {\n b: 26px;\n}\n", "") expectPrintedMangle(t, "a { b: calc(2 * 3px + 4 * 5px) }", "a {\n b: 26px;\n}\n", "") expectPrintedMangle(t, "a { b: calc(2px * 3 - 4px * 5) }", "a {\n b: -14px;\n}\n", "") expectPrintedMangle(t, "a { b: calc(2 * 3px - 4 * 5px) }", "a {\n b: -14px;\n}\n", "") // Test negation expectPrintedMangle(t, "a { b: calc(x + 1) }", "a {\n b: calc(x + 1);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x - 1) }", "a {\n b: calc(x - 1);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x + -1) }", "a {\n b: calc(x - 1);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x - -1) }", "a {\n b: calc(x + 1);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1 + x) }", "a {\n b: calc(1 + x);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1 - x) }", "a {\n b: calc(1 - x);\n}\n", "") expectPrintedMangle(t, "a { b: calc(-1 + x) }", "a {\n b: calc(-1 + x);\n}\n", "") expectPrintedMangle(t, "a { b: calc(-1 - x) }", "a {\n b: calc(-1 - x);\n}\n", "") // Test inversion expectPrintedMangle(t, "a { b: calc(x * 4) }", "a {\n b: calc(x * 4);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x / 4) }", "a {\n b: calc(x / 4);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x * 0.25) }", "a {\n b: calc(x / 4);\n}\n", "") expectPrintedMangle(t, "a { b: calc(x / 0.25) }", "a {\n b: calc(x * 4);\n}\n", "") // Test operator precedence expectPrintedMangle(t, "a { b: calc((a + b) + c) }", "a {\n b: calc(a + b + c);\n}\n", "") expectPrintedMangle(t, "a { b: calc(a + (b + c)) }", "a {\n b: calc(a + b + c);\n}\n", "") expectPrintedMangle(t, "a { b: calc((a - b) - c) }", "a {\n b: calc(a - b - c);\n}\n", "") expectPrintedMangle(t, "a { b: calc(a - (b - c)) }", "a {\n b: calc(a - (b - c));\n}\n", "") expectPrintedMangle(t, "a { b: calc((a * b) * c) }", "a {\n b: calc(a * b * c);\n}\n", "") expectPrintedMangle(t, "a { b: calc(a * (b * c)) }", "a {\n b: calc(a * b * c);\n}\n", "") expectPrintedMangle(t, "a { b: calc((a / b) / c) }", "a {\n b: calc(a / b / c);\n}\n", "") expectPrintedMangle(t, "a { b: calc(a / (b / c)) }", "a {\n b: calc(a / (b / c));\n}\n", "") expectPrintedMangle(t, "a { b: calc(a + b * c / d - e) }", "a {\n b: calc(a + b * c / d - e);\n}\n", "") expectPrintedMangle(t, "a { b: calc((a + ((b * c) / d)) - e) }", "a {\n b: calc(a + b * c / d - e);\n}\n", "") expectPrintedMangle(t, "a { b: calc((a + b) * c / (d - e)) }", "a {\n b: calc((a + b) * c / (d - e));\n}\n", "") // Using "var()" should bail because it can expand to any number of tokens expectPrintedMangle(t, "a { b: calc(1px - x + 2px) }", "a {\n b: calc(3px - x);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1px - var(x) + 2px) }", "a {\n b: calc(1px - var(x) + 2px);\n}\n", "") // Test values that can't be accurately represented as decimals expectPrintedMangle(t, "a { b: calc(100% / 1) }", "a {\n b: 100%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 2) }", "a {\n b: 50%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 3) }", "a {\n b: calc(100% / 3);\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 4) }", "a {\n b: 25%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 5) }", "a {\n b: 20%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 6) }", "a {\n b: calc(100% / 6);\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 7) }", "a {\n b: calc(100% / 7);\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 8) }", "a {\n b: 12.5%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 9) }", "a {\n b: calc(100% / 9);\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 10) }", "a {\n b: 10%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 100) }", "a {\n b: 1%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 1000) }", "a {\n b: .1%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 10000) }", "a {\n b: .01%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 100000) }", "a {\n b: .001%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / 1000000) }", "a {\n b: calc(100% / 1000000);\n}\n", "") // This actually ends up as "100% * (1 / 1000000)" which is less precise expectPrintedMangle(t, "a { b: calc(100% / -1000000) }", "a {\n b: calc(100% / -1000000);\n}\n", "") expectPrintedMangle(t, "a { b: calc(100% / -100000) }", "a {\n b: -.001%;\n}\n", "") expectPrintedMangle(t, "a { b: calc(3 * (2px + 1em / 7)) }", "a {\n b: calc(3 * (2px + 1em / 7));\n}\n", "") expectPrintedMangle(t, "a { b: calc(3 * (2px + 1em / 8)) }", "a {\n b: calc(3 * (2px + .125em));\n}\n", "") // Non-finite numbers expectPrintedMangle(t, "a { b: calc(0px / 0) }", "a {\n b: calc(0px / 0);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1px / 0) }", "a {\n b: calc(1px / 0);\n}\n", "") expectPrintedMangle(t, "a { b: calc(-1px / 0) }", "a {\n b: calc(-1px / 0);\n}\n", "") expectPrintedMangle(t, "a { b: calc(nan) }", "a {\n b: calc(nan);\n}\n", "") expectPrintedMangle(t, "a { b: calc(infinity) }", "a {\n b: calc(infinity);\n}\n", "") expectPrintedMangle(t, "a { b: calc(-infinity) }", "a {\n b: calc(-infinity);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1px / nan) }", "a {\n b: calc(1px / nan);\n}\n", "") expectPrintedMangle(t, "a { b: calc(1px / infinity) }", "a {\n b: 0px;\n}\n", "") expectPrintedMangle(t, "a { b: calc(1px / -infinity) }", "a {\n b: -0px;\n}\n", "") } func TestTransform(t *testing.T) { expectPrintedMangle(t, "a { transform: matrix(1, 0, 0, 1, 0, 0) }", "a {\n transform: scale(1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix(2, 0, 0, 1, 0, 0) }", "a {\n transform: scaleX(2);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix(1, 0, 0, 2, 0, 0) }", "a {\n transform: scaleY(2);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix(2, 0, 0, 3, 0, 0) }", "a {\n transform: scale(2, 3);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix(2, 0, 0, 2, 0, 0) }", "a {\n transform: scale(2);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix(1, 0, 0, 1, 1, 2) }", "a {\n transform:\n matrix(\n 1, 0,\n 0, 1,\n 1, 2);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0, 0) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0px, 0px) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0%, 0%) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(1px, 0) }", "a {\n transform: translate(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(1px, 0px) }", "a {\n transform: translate(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(1px, 0%) }", "a {\n transform: translate(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0, 1px) }", "a {\n transform: translateY(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0px, 1px) }", "a {\n transform: translateY(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(0%, 1px) }", "a {\n transform: translateY(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(1px, 2px) }", "a {\n transform: translate(1px, 2px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate(40%, 60%) }", "a {\n transform: translate(40%, 60%);\n}\n", "") expectPrintedMangle(t, "a { transform: translateX(0) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateX(0px) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateX(0%) }", "a {\n transform: translate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateX(1px) }", "a {\n transform: translate(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translateX(50%) }", "a {\n transform: translate(50%);\n}\n", "") expectPrintedMangle(t, "a { transform: translateY(0) }", "a {\n transform: translateY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateY(0px) }", "a {\n transform: translateY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateY(0%) }", "a {\n transform: translateY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateY(1px) }", "a {\n transform: translateY(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translateY(50%) }", "a {\n transform: translateY(50%);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(1) }", "a {\n transform: scale(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(100%) }", "a {\n transform: scale(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(10%) }", "a {\n transform: scale(.1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(99%) }", "a {\n transform: scale(99%);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(1, 1) }", "a {\n transform: scale(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(100%, 1) }", "a {\n transform: scale(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(10%, 0.1) }", "a {\n transform: scale(.1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(99%, 0.99) }", "a {\n transform: scale(99%, .99);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(60%, 40%) }", "a {\n transform: scale(.6, .4);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(3, 1) }", "a {\n transform: scaleX(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(300%, 1) }", "a {\n transform: scaleX(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(1, 3) }", "a {\n transform: scaleY(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scale(1, 300%) }", "a {\n transform: scaleY(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleX(1) }", "a {\n transform: scaleX(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleX(2) }", "a {\n transform: scaleX(2);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleX(300%) }", "a {\n transform: scaleX(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleX(99%) }", "a {\n transform: scaleX(99%);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleY(1) }", "a {\n transform: scaleY(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleY(2) }", "a {\n transform: scaleY(2);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleY(300%) }", "a {\n transform: scaleY(3);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleY(99%) }", "a {\n transform: scaleY(99%);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate(0) }", "a {\n transform: rotate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate(0deg) }", "a {\n transform: rotate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate(1deg) }", "a {\n transform: rotate(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(0) }", "a {\n transform: skew(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(0deg) }", "a {\n transform: skew(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(1deg) }", "a {\n transform: skew(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(1deg, 0) }", "a {\n transform: skew(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(1deg, 0deg) }", "a {\n transform: skew(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(0, 1deg) }", "a {\n transform: skew(0, 1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(0deg, 1deg) }", "a {\n transform: skew(0, 1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skew(1deg, 2deg) }", "a {\n transform: skew(1deg, 2deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skewX(0) }", "a {\n transform: skew(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skewX(0deg) }", "a {\n transform: skew(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skewX(1deg) }", "a {\n transform: skew(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: skewY(0) }", "a {\n transform: skewY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skewY(0deg) }", "a {\n transform: skewY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: skewY(1deg) }", "a {\n transform: skewY(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2) }", "a {\n transform:\n matrix3d(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 2);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1) }", "a {\n transform:\n matrix3d(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 2, 3, 4, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform:\n matrix3d(\n 1, 0, 1, 0,\n 0, 1, 0, 0,\n 1, 0, 1, 0,\n 0, 0, 0, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform: scaleZ(1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform: scale3d(2, 1, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform: scale3d(1, 2, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform: scale3d(2, 2, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) }", "a {\n transform: scale3d(2, 3, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1) }", "a {\n transform: scaleZ(2);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1) }", "a {\n transform: scale3d(1, 2, 3);\n}\n", "") expectPrintedMangle(t, "a { transform: matrix3d(2, 3, 0, 0, 4, 5, 0, 0, 0, 0, 1, 0, 6, 7, 0, 1) }", "a {\n transform:\n matrix3d(\n 2, 3, 0, 0,\n 4, 5, 0, 0,\n 0, 0, 1, 0,\n 6, 7, 0, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0, 0, 0) }", "a {\n transform: translateZ(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0%, 0%, 0) }", "a {\n transform: translateZ(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0px, 0px, 0px) }", "a {\n transform: translateZ(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(1px, 0px, 0px) }", "a {\n transform: translate3d(1px, 0, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0px, 1px, 0px) }", "a {\n transform: translate3d(0, 1px, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0px, 0px, 1px) }", "a {\n transform: translateZ(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(1px, 2px, 3px) }", "a {\n transform: translate3d(1px, 2px, 3px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(1px, 0, 3px) }", "a {\n transform: translate3d(1px, 0, 3px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(0, 2px, 3px) }", "a {\n transform: translate3d(0, 2px, 3px);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(1px, 2px, 0px) }", "a {\n transform: translate3d(1px, 2px, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: translate3d(40%, 60%, 0px) }", "a {\n transform: translate3d(40%, 60%, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateZ(0) }", "a {\n transform: translateZ(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateZ(0px) }", "a {\n transform: translateZ(0);\n}\n", "") expectPrintedMangle(t, "a { transform: translateZ(1px) }", "a {\n transform: translateZ(1px);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(1, 1, 1) }", "a {\n transform: scaleZ(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(2, 1, 1) }", "a {\n transform: scale3d(2, 1, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(1, 2, 1) }", "a {\n transform: scale3d(1, 2, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(1, 1, 2) }", "a {\n transform: scaleZ(2);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(1, 2, 3) }", "a {\n transform: scale3d(1, 2, 3);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(2, 3, 1) }", "a {\n transform: scale3d(2, 3, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(2, 2, 1) }", "a {\n transform: scale3d(2, 2, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(3, 300%, 100.00%) }", "a {\n transform: scale3d(3, 3, 1);\n}\n", "") expectPrintedMangle(t, "a { transform: scale3d(1%, 2%, 3%) }", "a {\n transform: scale3d(1%, 2%, 3%);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleZ(1) }", "a {\n transform: scaleZ(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleZ(100%) }", "a {\n transform: scaleZ(1);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleZ(2) }", "a {\n transform: scaleZ(2);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleZ(200%) }", "a {\n transform: scaleZ(2);\n}\n", "") expectPrintedMangle(t, "a { transform: scaleZ(99%) }", "a {\n transform: scaleZ(99%);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(0, 0, 0, 0) }", "a {\n transform: rotate3d(0, 0, 0, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(0, 0, 0, 0deg) }", "a {\n transform: rotate3d(0, 0, 0, 0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(0, 0, 0, 45deg) }", "a {\n transform: rotate3d(0, 0, 0, 45deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(1, 0, 0, 45deg) }", "a {\n transform: rotateX(45deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(0, 1, 0, 45deg) }", "a {\n transform: rotateY(45deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotate3d(0, 0, 1, 45deg) }", "a {\n transform: rotate3d(0, 0, 1, 45deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateX(0) }", "a {\n transform: rotateX(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateX(0deg) }", "a {\n transform: rotateX(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateX(1deg) }", "a {\n transform: rotateX(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateY(0) }", "a {\n transform: rotateY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateY(0deg) }", "a {\n transform: rotateY(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateY(1deg) }", "a {\n transform: rotateY(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateZ(0) }", "a {\n transform: rotate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateZ(0deg) }", "a {\n transform: rotate(0);\n}\n", "") expectPrintedMangle(t, "a { transform: rotateZ(1deg) }", "a {\n transform: rotate(1deg);\n}\n", "") expectPrintedMangle(t, "a { transform: perspective(0) }", "a {\n transform: perspective(0);\n}\n", "") expectPrintedMangle(t, "a { transform: perspective(0px) }", "a {\n transform: perspective(0);\n}\n", "") expectPrintedMangle(t, "a { transform: perspective(1px) }", "a {\n transform: perspective(1px);\n}\n", "") } func TestMangleAlpha(t *testing.T) { alphas := []string{ "0", ".004", ".008", ".01", ".016", ".02", ".024", ".027", ".03", ".035", ".04", ".043", ".047", ".05", ".055", ".06", ".063", ".067", ".07", ".075", ".08", ".082", ".086", ".09", ".094", ".098", ".1", ".106", ".11", ".114", ".118", ".12", ".125", ".13", ".133", ".137", ".14", ".145", ".15", ".153", ".157", ".16", ".165", ".17", ".173", ".176", ".18", ".184", ".19", ".192", ".196", ".2", ".204", ".208", ".21", ".216", ".22", ".224", ".227", ".23", ".235", ".24", ".243", ".247", ".25", ".255", ".26", ".263", ".267", ".27", ".275", ".28", ".282", ".286", ".29", ".294", ".298", ".3", ".306", ".31", ".314", ".318", ".32", ".325", ".33", ".333", ".337", ".34", ".345", ".35", ".353", ".357", ".36", ".365", ".37", ".373", ".376", ".38", ".384", ".39", ".392", ".396", ".4", ".404", ".408", ".41", ".416", ".42", ".424", ".427", ".43", ".435", ".44", ".443", ".447", ".45", ".455", ".46", ".463", ".467", ".47", ".475", ".48", ".482", ".486", ".49", ".494", ".498", ".5", ".506", ".51", ".514", ".518", ".52", ".525", ".53", ".533", ".537", ".54", ".545", ".55", ".553", ".557", ".56", ".565", ".57", ".573", ".576", ".58", ".584", ".59", ".592", ".596", ".6", ".604", ".608", ".61", ".616", ".62", ".624", ".627", ".63", ".635", ".64", ".643", ".647", ".65", ".655", ".66", ".663", ".667", ".67", ".675", ".68", ".682", ".686", ".69", ".694", ".698", ".7", ".706", ".71", ".714", ".718", ".72", ".725", ".73", ".733", ".737", ".74", ".745", ".75", ".753", ".757", ".76", ".765", ".77", ".773", ".776", ".78", ".784", ".79", ".792", ".796", ".8", ".804", ".808", ".81", ".816", ".82", ".824", ".827", ".83", ".835", ".84", ".843", ".847", ".85", ".855", ".86", ".863", ".867", ".87", ".875", ".88", ".882", ".886", ".89", ".894", ".898", ".9", ".906", ".91", ".914", ".918", ".92", ".925", ".93", ".933", ".937", ".94", ".945", ".95", ".953", ".957", ".96", ".965", ".97", ".973", ".976", ".98", ".984", ".99", ".992", ".996", } for i, alpha := range alphas { expectPrintedLowerMangle(t, fmt.Sprintf("a { color: #%08X }", i), "a {\n color: rgba(0, 0, 0, "+alpha+");\n}\n", "") } // An alpha value of 100% does not use "rgba(...)" expectPrintedLowerMangle(t, "a { color: #000000FF }", "a {\n color: #000;\n}\n", "") } func TestMangleDuplicateSelectors(t *testing.T) { expectPrinted(t, "a, a { color: red }", "a,\na {\n color: red;\n}\n", "") expectPrintedMangle(t, "a, a { color: red }", "a {\n color: red;\n}\n", "") expectPrintedMangle(t, "a, b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a, a.foo, a.foo, a.bar, a { color: red }", "a,\na.foo,\na.bar {\n color: red;\n}\n", "") expectPrintedMangle(t, "@media screen { a, a { color: red } }", "@media screen {\n a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { a, b { color: red } }", "@media screen {\n a,\n b {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { a, a.foo, a.foo, a.bar, a { color: red } }", "@media screen {\n a,\n a.foo,\n a.bar {\n color: red;\n }\n}\n", "") } func TestMangleDuplicateSelectorRules(t *testing.T) { expectPrinted(t, "a { color: red } b { color: red }", "a {\n color: red;\n}\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } div {} b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } div { color: red } b { color: red }", "a,\ndiv,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } div { color: red } a { color: red }", "a,\ndiv {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } div { color: blue } b { color: red }", "a {\n color: red;\n}\ndiv {\n color: #00f;\n}\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } div { color: blue } a { color: red }", "a {\n color: red;\n}\ndiv {\n color: #00f;\n}\na {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red; color: red } b { color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } b { color: red; color: red }", "a,\nb {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } b { color: blue }", "a {\n color: red;\n}\nb {\n color: #00f;\n}\n", "") // Do not merge duplicates if they are "unsafe" expectPrintedMangle(t, "a { color: red } unknown { color: red }", "a {\n color: red;\n}\nunknown {\n color: red;\n}\n", "") expectPrintedMangle(t, "unknown { color: red } a { color: red }", "unknown {\n color: red;\n}\na {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } video { color: red }", "a {\n color: red;\n}\nvideo {\n color: red;\n}\n", "") expectPrintedMangle(t, "video { color: red } a { color: red }", "video {\n color: red;\n}\na {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a:last-child { color: red }", "a {\n color: red;\n}\na:last-child {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a[b=c i] { color: red }", "a {\n color: red;\n}\na[b=c i] {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } & { color: red }", "a {\n color: red;\n}\n& {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a + b { color: red }", "a {\n color: red;\n}\na + b {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a|b { color: red }", "a {\n color: red;\n}\na|b {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a::hover { color: red }", "a {\n color: red;\n}\na::hover {\n color: red;\n}\n", "") // Still merge duplicates if they are "safe" expectPrintedMangle(t, "a { color: red } a:hover { color: red }", "a,\na:hover {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a[b=c] { color: red }", "a,\na[b=c] {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a#id { color: red }", "a,\na#id {\n color: red;\n}\n", "") expectPrintedMangle(t, "a { color: red } a.cls { color: red }", "a,\na.cls {\n color: red;\n}\n", "") // Skip over comments expectPrintedMangle(t, "c { color: green } a { color: red } /*!x*/ /*!y*/ b { color: blue }", "c {\n color: green;\n}\na {\n color: red;\n}\n/*!x*/\n/*!y*/\nb {\n color: #00f;\n}\n", "") expectPrintedMangle(t, "c { color: green } a { color: red } /*!x*/ /*!y*/ b { color: red }", "c {\n color: green;\n}\na,\nb {\n color: red;\n}\n/*!x*/\n/*!y*/\n", "") expectPrintedMangle(t, "c { color: green } a { color: red } /*!x*/ /*!y*/ a { color: red }", "c {\n color: green;\n}\na {\n color: red;\n}\n/*!x*/\n/*!y*/\n", "") } func TestMangleAtMedia(t *testing.T) { expectPrinted(t, "@media screen { @media screen { a { color: red } } }", "@media screen {\n @media screen {\n a {\n color: red;\n }\n }\n}\n", "") expectPrintedMangle(t, "@media screen { @media screen { a { color: red } } }", "@media screen {\n a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { @media not print { a { color: red } } }", "@media screen {\n @media not print {\n a {\n color: red;\n }\n }\n}\n", "") expectPrintedMangle(t, "@media screen { @media not print { @media screen { a { color: red } } } }", "@media screen {\n @media not print {\n a {\n color: red;\n }\n }\n}\n", "") expectPrintedMangle(t, "@media screen { a { color: red } @media screen { a { color: red } } }", "@media screen {\n a {\n color: red;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { a { color: red } @media screen { a { color: blue } } }", "@media screen {\n a {\n color: red;\n }\n a {\n color: #00f;\n }\n}\n", "") expectPrintedMangle(t, "@media screen { .a { color: red; @media screen { .b { color: blue } } } }", "@media screen {\n .a {\n color: red;\n .b {\n color: #00f;\n }\n }\n}\n", "") expectPrintedMangle(t, "@media screen { a { color: red } } @media screen { b { color: red } }", "@media screen {\n a {\n color: red;\n }\n}\n@media screen {\n b {\n color: red;\n }\n}\n", "") } func TestFontWeight(t *testing.T) { expectPrintedMangle(t, "a { font-weight: normal }", "a {\n font-weight: 400;\n}\n", "") expectPrintedMangle(t, "a { font-weight: bold }", "a {\n font-weight: 700;\n}\n", "") expectPrintedMangle(t, "a { font-weight: 400 }", "a {\n font-weight: 400;\n}\n", "") expectPrintedMangle(t, "a { font-weight: bolder }", "a {\n font-weight: bolder;\n}\n", "") expectPrintedMangle(t, "a { font-weight: var(--var) }", "a {\n font-weight: var(--var);\n}\n", "") expectPrintedMangleMinify(t, "a { font-weight: normal }", "a{font-weight:400}", "") } func TestFontFamily(t *testing.T) { expectPrintedMangle(t, "a {font-family: aaa }", "a {\n font-family: aaa;\n}\n", "") expectPrintedMangle(t, "a {font-family: serif }", "a {\n font-family: serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'serif' }", "a {\n font-family: \"serif\";\n}\n", "") expectPrintedMangle(t, "a {font-family: aaa bbb, serif }", "a {\n font-family: aaa bbb, serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa', serif }", "a {\n font-family: aaa, serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: '\"', serif }", "a {\n font-family: '\"', serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa ', serif }", "a {\n font-family: \"aaa \", serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', serif }", "a {\n font-family: aaa bbb, serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', 'ccc ddd' }", "a {\n font-family: aaa bbb, ccc ddd;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', serif }", "a {\n font-family: \"aaa bbb\", serif;\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa serif' }", "a {\n font-family: \"aaa serif\";\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', var(--var) }", "a {\n font-family: \"aaa bbb\", var(--var);\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', }", "a {\n font-family: \"aaa bbb\", ;\n}\n", "") expectPrintedMangle(t, "a {font-family: , 'aaa bbb' }", "a {\n font-family: , \"aaa bbb\";\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa',, 'bbb' }", "a {\n font-family:\n \"aaa\",,\n \"bbb\";\n}\n", "") expectPrintedMangle(t, "a {font-family: 'aaa bbb', x serif }", "a {\n font-family: \"aaa bbb\", x serif;\n}\n", "") expectPrintedMangleMinify(t, "a {font-family: 'aaa bbb', serif }", "a{font-family:aaa bbb,serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'aaa bbb', 'ccc ddd' }", "a{font-family:aaa bbb,ccc ddd}", "") expectPrintedMangleMinify(t, "a {font-family: 'initial', serif;}", "a{font-family:\"initial\",serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'inherit', serif;}", "a{font-family:\"inherit\",serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'unset', serif;}", "a{font-family:\"unset\",serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'revert', serif;}", "a{font-family:\"revert\",serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'revert-layer', 'Segoe UI', serif;}", "a{font-family:\"revert-layer\",Segoe UI,serif}", "") expectPrintedMangleMinify(t, "a {font-family: 'default', serif;}", "a{font-family:\"default\",serif}", "") } func TestFont(t *testing.T) { expectPrintedMangle(t, "a { font: caption }", "a {\n font: caption;\n}\n", "") expectPrintedMangle(t, "a { font: normal 1px }", "a {\n font: normal 1px;\n}\n", "") expectPrintedMangle(t, "a { font: normal bold }", "a {\n font: normal bold;\n}\n", "") expectPrintedMangle(t, "a { font: 1rem 'aaa bbb' }", "a {\n font: 1rem aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: 1rem/1.2 'aaa bbb' }", "a {\n font: 1rem/1.2 aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: normal 1rem 'aaa bbb' }", "a {\n font: 1rem aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: normal 1rem 'aaa bbb', serif }", "a {\n font: 1rem aaa bbb, serif;\n}\n", "") expectPrintedMangle(t, "a { font: italic small-caps bold ultra-condensed 1rem/1.2 'aaa bbb' }", "a {\n font: italic small-caps 700 ultra-condensed 1rem/1.2 aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: oblique 1px 'aaa bbb' }", "a {\n font: oblique 1px aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: oblique 45deg 1px 'aaa bbb' }", "a {\n font: oblique 45deg 1px aaa bbb;\n}\n", "") expectPrintedMangle(t, "a { font: var(--var) 'aaa bbb' }", "a {\n font: var(--var) \"aaa bbb\";\n}\n", "") expectPrintedMangle(t, "a { font: normal var(--var) 'aaa bbb' }", "a {\n font: normal var(--var) \"aaa bbb\";\n}\n", "") expectPrintedMangle(t, "a { font: normal 1rem var(--var), 'aaa bbb' }", "a {\n font: normal 1rem var(--var), \"aaa bbb\";\n}\n", "") expectPrintedMangleMinify(t, "a { font: italic small-caps bold ultra-condensed 1rem/1.2 'aaa bbb' }", "a{font:italic small-caps 700 ultra-condensed 1rem/1.2 aaa bbb}", "") expectPrintedMangleMinify(t, "a { font: italic small-caps bold ultra-condensed 1rem / 1.2 'aaa bbb' }", "a{font:italic small-caps 700 ultra-condensed 1rem/1.2 aaa bbb}", "") // See: path_to_url expectPrinted(t, "a { font: 10px'foo' }", "a {\n font: 10px\"foo\";\n}\n", "") expectPrinted(t, "a { font: 10px'123' }", "a {\n font: 10px\"123\";\n}\n", "") expectPrintedMangle(t, "a { font: 10px'foo' }", "a {\n font: 10px foo;\n}\n", "") expectPrintedMangle(t, "a { font: 10px'123' }", "a {\n font: 10px\"123\";\n}\n", "") expectPrintedMangleMinify(t, "a { font: 10px'foo' }", "a{font:10px foo}", "") expectPrintedMangleMinify(t, "a { font: 10px'123' }", "a{font:10px\"123\"}", "") } func TestWarningUnexpectedCloseBrace(t *testing.T) { expectPrinted(t, ".red {\n color: red;\n}\n}\n.blue {\n color: blue;\n}\n.green {\n color: green;\n}\n", `.red { color: red; } } .blue { color: blue; } .green { color: green; } `, `<stdin>: WARNING: Unexpected "}" `) } func TestPropertyTypoWarning(t *testing.T) { expectPrinted(t, "a { z-idnex: 0 }", "a {\n z-idnex: 0;\n}\n", "<stdin>: WARNING: \"z-idnex\" is not a known CSS property\nNOTE: Did you mean \"z-index\" instead?\n") expectPrinted(t, "a { x-index: 0 }", "a {\n x-index: 0;\n}\n", "<stdin>: WARNING: \"x-index\" is not a known CSS property\nNOTE: Did you mean \"z-index\" instead?\n") // CSS variables should not be corrected expectPrinted(t, "a { --index: 0 }", "a {\n --index: 0 ;\n}\n", "") // Short names should not be corrected ("alt" is actually valid in WebKit, and should not become "all") expectPrinted(t, "a { alt: \"\" }", "a {\n alt: \"\";\n}\n", "") } func TestParseErrorRecovery(t *testing.T) { expectPrinted(t, "x { y: z", "x {\n y: z;\n}\n", "<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "x { y: (", "x {\n y: ();\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, "x { y: [", "x {\n y: [];\n}\n", "<stdin>: WARNING: Expected \"]\" to go with \"[\"\n<stdin>: NOTE: The unbalanced \"[\" is here:\n") expectPrinted(t, "x { y: {", "x {\n y: {\n }\n}\n", "<stdin>: WARNING: Expected identifier but found whitespace\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "x { y: z(", "x {\n y: z();\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, "x { y: z(abc", "x {\n y: z(abc);\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, "x { y: url(", "x {\n y: url();\n}\n", "<stdin>: WARNING: Expected \")\" to end URL token\n<stdin>: NOTE: The unbalanced \"(\" is here:\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "x { y: url(abc", "x {\n y: url(abc);\n}\n", "<stdin>: WARNING: Expected \")\" to end URL token\n<stdin>: NOTE: The unbalanced \"(\" is here:\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "x { y: url(; }", "x {\n y: url(; };\n}\n", "<stdin>: WARNING: Expected \")\" to end URL token\n<stdin>: NOTE: The unbalanced \"(\" is here:\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "x { y: url(abc;", "x {\n y: url(abc;);\n}\n", "<stdin>: WARNING: Expected \")\" to end URL token\n<stdin>: NOTE: The unbalanced \"(\" is here:\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n") expectPrinted(t, "/* @license */ x {} /* @preserve", "/* @license */\nx {\n}\n", "<stdin>: ERROR: Expected \"*/\" to terminate multi-line comment\n<stdin>: NOTE: The multi-line comment starts here:\n") expectPrinted(t, "a { b: c; d: 'e\n f: g; h: i }", "a {\n b: c;\n d: 'e\n f: g;\n h: i;\n}\n", "<stdin>: WARNING: Unterminated string token\n") expectPrintedMinify(t, "a { b: c; d: 'e\n f: g; h: i }", "a{b:c;d:'e\nf: g;h:i}", "<stdin>: WARNING: Unterminated string token\n") } func TestPrefixInsertion(t *testing.T) { // General "-webkit-" tests for _, key := range []string{ "backdrop-filter", "box-decoration-break", "clip-path", "font-kerning", "initial-letter", "mask-image", "mask-origin", "mask-position", "mask-repeat", "mask-size", "print-color-adjust", "text-decoration-skip", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style", "text-orientation", } { expectPrintedWithAllPrefixes(t, "a { "+key+": url(x.png) }", "a {\n -webkit-"+key+": url(x.png);\n "+key+": url(x.png);\n}\n", "") expectPrintedWithAllPrefixes(t, "a { before: value; "+key+": url(x.png) }", "a {\n before: value;\n -webkit-"+key+": url(x.png);\n "+key+": url(x.png);\n}\n", "") expectPrintedWithAllPrefixes(t, "a { "+key+": url(x.png); after: value }", "a {\n -webkit-"+key+": url(x.png);\n "+key+": url(x.png);\n after: value;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { before: value; "+key+": url(x.png); after: value }", "a {\n before: value;\n -webkit-"+key+": url(x.png);\n "+key+": url(x.png);\n after: value;\n}\n", "") expectPrintedWithAllPrefixes(t, "a {\n -webkit-"+key+": url(x.png);\n "+key+": url(y.png);\n}\n", "a {\n -webkit-"+key+": url(x.png);\n "+key+": url(y.png);\n}\n", "") expectPrintedWithAllPrefixes(t, "a {\n "+key+": url(y.png);\n -webkit-"+key+": url(x.png);\n}\n", "a {\n "+key+": url(y.png);\n -webkit-"+key+": url(x.png);\n}\n", "") expectPrintedWithAllPrefixes(t, "a { "+key+": url(x.png); "+key+": url(y.png) }", "a {\n -webkit-"+key+": url(x.png);\n "+key+": url(x.png);\n -webkit-"+key+": url(y.png);\n "+key+": url(y.png);\n}\n", "") } // Special-case tests expectPrintedWithAllPrefixes(t, "a { appearance: none }", "a {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { background-clip: not-text }", "a {\n background-clip: not-text;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { background-clip: text !important }", "a {\n -webkit-background-clip: text !important;\n -ms-background-clip: text !important;\n background-clip: text !important;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { background-clip: text }", "a {\n -webkit-background-clip: text;\n -ms-background-clip: text;\n background-clip: text;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { hyphens: auto }", "a {\n -webkit-hyphens: auto;\n -moz-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { position: absolute }", "a {\n position: absolute;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { position: sticky !important }", "a {\n position: -webkit-sticky !important;\n position: sticky !important;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { position: sticky }", "a {\n position: -webkit-sticky;\n position: sticky;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { tab-size: 2 }", "a {\n -moz-tab-size: 2;\n -o-tab-size: 2;\n tab-size: 2;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { text-decoration-color: none }", "a {\n -webkit-text-decoration-color: none;\n -moz-text-decoration-color: none;\n text-decoration-color: none;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { text-decoration-line: none }", "a {\n -webkit-text-decoration-line: none;\n -moz-text-decoration-line: none;\n text-decoration-line: none;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { text-size-adjust: none }", "a {\n -webkit-text-size-adjust: none;\n -ms-text-size-adjust: none;\n text-size-adjust: none;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { user-select: none }", "a {\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: -moz-none;\n -ms-user-select: none;\n user-select: none;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { mask-composite: add, subtract, intersect, exclude }", "a {\n -webkit-mask-composite:\n source-over,\n source-out,\n source-in,\n xor;\n mask-composite:\n add,\n subtract,\n intersect,\n exclude;\n}\n", "") // Check that we insert prefixed rules each time an unprefixed rule is // encountered. This matches the behavior of the popular "autoprefixer" tool. expectPrintedWithAllPrefixes(t, "a { before: value; mask-image: a; middle: value; mask-image: b; after: value }", "a {\n before: value;\n -webkit-mask-image: a;\n mask-image: a;\n middle: value;\n -webkit-mask-image: b;\n mask-image: b;\n after: value;\n}\n", "") // Test that we don't insert duplicated rules when source code is processed // twice. This matches the behavior of the popular "autoprefixer" tool. expectPrintedWithAllPrefixes(t, "a { before: value; -webkit-text-size-adjust: 1; -ms-text-size-adjust: 2; text-size-adjust: 3; after: value }", "a {\n before: value;\n -webkit-text-size-adjust: 1;\n -ms-text-size-adjust: 2;\n text-size-adjust: 3;\n after: value;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { before: value; -webkit-text-size-adjust: 1; text-size-adjust: 3; after: value }", "a {\n before: value;\n -webkit-text-size-adjust: 1;\n -ms-text-size-adjust: 3;\n text-size-adjust: 3;\n after: value;\n}\n", "") expectPrintedWithAllPrefixes(t, "a { before: value; -ms-text-size-adjust: 2; text-size-adjust: 3; after: value }", "a {\n before: value;\n -ms-text-size-adjust: 2;\n -webkit-text-size-adjust: 3;\n text-size-adjust: 3;\n after: value;\n}\n", "") } func TestNthChild(t *testing.T) { for _, nth := range []string{"nth-child", "nth-last-child"} { expectPrinted(t, ":"+nth+"(x) {}", ":"+nth+"(x) {\n}\n", "<stdin>: WARNING: Unexpected \"x\"\n") expectPrinted(t, ":"+nth+"(1e2) {}", ":"+nth+"(1e2) {\n}\n", "<stdin>: WARNING: Unexpected \"1e2\"\n") expectPrinted(t, ":"+nth+"(-n-) {}", ":"+nth+"(-n-) {\n}\n", "<stdin>: WARNING: Expected number but found \")\"\n") expectPrinted(t, ":"+nth+"(-nn) {}", ":"+nth+"(-nn) {\n}\n", "<stdin>: WARNING: Unexpected \"-nn\"\n") expectPrinted(t, ":"+nth+"(-n-n) {}", ":"+nth+"(-n-n) {\n}\n", "<stdin>: WARNING: Unexpected \"-n-n\"\n") expectPrinted(t, ":"+nth+"(-2n-) {}", ":"+nth+"(-2n-) {\n}\n", "<stdin>: WARNING: Expected number but found \")\"\n") expectPrinted(t, ":"+nth+"(-2n-2n) {}", ":"+nth+"(-2n-2n) {\n}\n", "<stdin>: WARNING: Unexpected \"-2n-2n\"\n") expectPrinted(t, ":"+nth+"(+) {}", ":"+nth+"(+) {\n}\n", "<stdin>: WARNING: Unexpected \")\"\n") expectPrinted(t, ":"+nth+"(-) {}", ":"+nth+"(-) {\n}\n", "<stdin>: WARNING: Unexpected \"-\"\n") expectPrinted(t, ":"+nth+"(+ 2) {}", ":"+nth+"(+ 2) {\n}\n", "<stdin>: WARNING: Unexpected whitespace\n") expectPrinted(t, ":"+nth+"(- 2) {}", ":"+nth+"(- 2) {\n}\n", "<stdin>: WARNING: Unexpected \"-\"\n") expectPrinted(t, ":"+nth+"(0) {}", ":"+nth+"(0) {\n}\n", "") expectPrinted(t, ":"+nth+"(0 ) {}", ":"+nth+"(0) {\n}\n", "") expectPrinted(t, ":"+nth+"( 0) {}", ":"+nth+"(0) {\n}\n", "") expectPrinted(t, ":"+nth+"(00) {}", ":"+nth+"(0) {\n}\n", "") expectPrinted(t, ":"+nth+"(01) {}", ":"+nth+"(1) {\n}\n", "") expectPrinted(t, ":"+nth+"(0n) {}", ":"+nth+"(0n) {\n}\n", "") expectPrinted(t, ":"+nth+"(n) {}", ":"+nth+"(n) {\n}\n", "") expectPrinted(t, ":"+nth+"(-n) {}", ":"+nth+"(-n) {\n}\n", "") expectPrinted(t, ":"+nth+"(1n) {}", ":"+nth+"(n) {\n}\n", "") expectPrinted(t, ":"+nth+"(-1n) {}", ":"+nth+"(-n) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n) {}", ":"+nth+"(2n) {\n}\n", "") expectPrinted(t, ":"+nth+"(-2n) {}", ":"+nth+"(-2n) {\n}\n", "") expectPrinted(t, ":"+nth+"(odd) {}", ":"+nth+"(odd) {\n}\n", "") expectPrinted(t, ":"+nth+"(odd ) {}", ":"+nth+"(odd) {\n}\n", "") expectPrinted(t, ":"+nth+"( odd) {}", ":"+nth+"(odd) {\n}\n", "") expectPrinted(t, ":"+nth+"(even) {}", ":"+nth+"(even) {\n}\n", "") expectPrinted(t, ":"+nth+"(even ) {}", ":"+nth+"(even) {\n}\n", "") expectPrinted(t, ":"+nth+"( even) {}", ":"+nth+"(even) {\n}\n", "") expectPrinted(t, ":"+nth+"(n+3) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(n-3) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(n +3) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(n -3) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(n+ 3) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(n- 3) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( n + 3 ) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( n - 3 ) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(+n+3) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(+n-3) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(-n+3) {}", ":"+nth+"(-n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(-n-3) {}", ":"+nth+"(-n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( +n + 3 ) {}", ":"+nth+"(n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( +n - 3 ) {}", ":"+nth+"(n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( -n + 3 ) {}", ":"+nth+"(-n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( -n - 3 ) {}", ":"+nth+"(-n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n+3) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n-3) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n +3) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n -3) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n+ 3) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n- 3) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( 2n + 3 ) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( 2n - 3 ) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(+2n+3) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(+2n-3) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(-2n+3) {}", ":"+nth+"(-2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"(-2n-3) {}", ":"+nth+"(-2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( +2n + 3 ) {}", ":"+nth+"(2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( +2n - 3 ) {}", ":"+nth+"(2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"( -2n + 3 ) {}", ":"+nth+"(-2n+3) {\n}\n", "") expectPrinted(t, ":"+nth+"( -2n - 3 ) {}", ":"+nth+"(-2n-3) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of + .foo) {}", ":"+nth+"(2n of + .foo) {\n}\n", "<stdin>: WARNING: Unexpected \"+\"\n") expectPrinted(t, ":"+nth+"(2n of .foo, ~.bar) {}", ":"+nth+"(2n of .foo, ~.bar) {\n}\n", "<stdin>: WARNING: Unexpected \"~\"\n") expectPrinted(t, ":"+nth+"(2n of .foo) {}", ":"+nth+"(2n of .foo) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of.foo+.bar) {}", ":"+nth+"(2n of .foo + .bar) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of[href]) {}", ":"+nth+"(2n of [href]) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of.foo,.bar) {}", ":"+nth+"(2n of .foo, .bar) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of .foo, .bar) {}", ":"+nth+"(2n of .foo, .bar) {\n}\n", "") expectPrinted(t, ":"+nth+"(2n of .foo , .bar ) {}", ":"+nth+"(2n of .foo, .bar) {\n}\n", "") expectPrintedMinify(t, ":"+nth+"(2n of [foo] , [bar] ) {}", ":"+nth+"(2n of[foo],[bar]){}", "") expectPrintedMinify(t, ":"+nth+"(2n of .foo , .bar ) {}", ":"+nth+"(2n of.foo,.bar){}", "") expectPrintedMinify(t, ":"+nth+"(2n of #foo , #bar ) {}", ":"+nth+"(2n of#foo,#bar){}", "") expectPrintedMinify(t, ":"+nth+"(2n of :foo , :bar ) {}", ":"+nth+"(2n of:foo,:bar){}", "") expectPrintedMinify(t, ":"+nth+"(2n of div , span ) {}", ":"+nth+"(2n of div,span){}", "") expectPrintedMangle(t, ":"+nth+"(even) { color: red }", ":"+nth+"(2n) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(2n+1) { color: red }", ":"+nth+"(odd) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(0n) { color: red }", ":"+nth+"(0) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(0n+0) { color: red }", ":"+nth+"(0) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(1n+0) { color: red }", ":"+nth+"(n) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(0n-2) { color: red }", ":"+nth+"(-2) {\n color: red;\n}\n", "") expectPrintedMangle(t, ":"+nth+"(0n+2) { color: red }", ":"+nth+"(2) {\n color: red;\n}\n", "") } for _, nth := range []string{"nth-of-type", "nth-last-of-type"} { expectPrinted(t, ":"+nth+"(2n of .foo) {}", ":"+nth+"(2n of .foo) {\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n") expectPrinted(t, ":"+nth+"(+2n + 1) {}", ":"+nth+"(2n+1) {\n}\n", "") } } func TestComposes(t *testing.T) { expectPrinted(t, ".foo { composes: bar; color: red }", ".foo {\n composes: bar;\n color: red;\n}\n", "") expectPrinted(t, ".foo .bar { composes: bar; color: red }", ".foo .bar {\n composes: bar;\n color: red;\n}\n", "") expectPrinted(t, ".foo, .bar { composes: bar; color: red }", ".foo,\n.bar {\n composes: bar;\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar; color: red }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar baz; color: red }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar from global; color: red }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar from \"file.css\"; color: red }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar from url(file.css); color: red }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { & { composes: bar; color: red } }", ".foo {\n & {\n color: red;\n }\n}\n", "") expectPrintedLocal(t, ".foo { :local { composes: bar; color: red } }", ".foo {\n color: red;\n}\n", "") expectPrintedLocal(t, ".foo { :global { composes: bar; color: red } }", ".foo {\n color: red;\n}\n", "") expectPrinted(t, ".foo, .bar { composes: bar from github }", ".foo,\n.bar {\n composes: bar from github;\n}\n", "") expectPrintedLocal(t, ".foo { composes: bar from github }", ".foo {\n}\n", "<stdin>: WARNING: \"composes\" declaration uses invalid location \"github\"\n") badComposes := "<stdin>: WARNING: \"composes\" only works inside single class selectors\n" + "<stdin>: NOTE: The parent selector is not a single class selector because of the syntax here:\n" expectPrintedLocal(t, "& { composes: bar; color: red }", "& {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo& { composes: bar; color: red }", "&.foo {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo.bar { composes: bar; color: red }", ".foo.bar {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo:hover { composes: bar; color: red }", ".foo:hover {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo[href] { composes: bar; color: red }", ".foo[href] {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo .bar { composes: bar; color: red }", ".foo .bar {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo, div { composes: bar; color: red }", ".foo,\ndiv {\n color: red;\n}\n", badComposes) expectPrintedLocal(t, ".foo { .bar { composes: foo; color: red } }", ".foo {\n .bar {\n color: red;\n }\n}\n", badComposes) } ```
Wells Enterprises, Inc. is an American food company and was the largest family-owned and managed ice cream manufacturer in the United States, based in Le Mars, Iowa. It is the maker of Blue Bunny ice cream. Wells is the second largest ice cream maker in the United States behind Unilever. Wells produces the Blue Bunny brand, along with 2nd St. Creamery, Bomb Pop and several private label brands. In addition, Wells is the licensee for Weight Watchers Ice Cream. In 2007 and 2008, Wells sold its cultured dairy and fluid milk business to Dean Foods and its yogurt business to Grupo Lala. History Fred H. Wells Jr. opened a milk route in 1913 in Le Mars after purchasing a horse, delivery wagon, and a few cans and jars for $250 from local dairy farmer Ray Bowers. Around 1925, Wells and his sons began manufacturing ice cream and selling it in neighboring Iowa towns: Remsen, Alton and Sioux City. In 1928 Fairmont Ice Cream purchased the ice cream distribution system in Sioux City along with the right to use the Wells name. In 1935, the Wells family decided to sell ice cream in Sioux City again. Unable to sell their product under their own name "Wells", they decided to hold a “Name That Ice Cream” contest in the Sioux City Journal. A Sioux City man won the $25 cash prize for the winning entry of “Blue Bunny” after noticing how much his son enjoyed the blue bunnies in a department store window at Easter. After Fred H. Wells, Jr. died in 1954, his sons, Harold, Mike, Roy and Fay, and their cousin Fred D. Wells, son of Harry Cole Wells, ran the family business as a partnership. Meanwhile, new facilities were added in the postwar period. For example, the main part of the company, the North Plant, was built in Le Mars in the 1950s for the manufacture of ice cream products. In 1963, the company constructed its Milk Plant. The family retained ownership and management of the business after it was incorporated under Iowa law in 1977 as Wells' Dairy, Inc. The newly incorporated business expanded in the 1980s. New corporate offices were added in 1980, and Wells built new facilities for its growing fleet of trucks used to deliver milk around Iowa. In 1983, Wells purchased an Omaha plant and after being remodeled, it processed milk, yogurt and fruit juice. In the mid-1980s the firm's North Plant in Le Mars was enlarged through the purchase of five adjacent lots. New production lines, a mix department, and a high-rise freezer helped the company double the North Plant's capability. After completion, the expanded plant covered the equivalent of one city block, with the first floor taking up 109,000 square feet (10,100 m2) and its second floor comprising 44,000 square feet (4,100 m2). When D.S Abernethy's company Merritt Foods closed down in 1991, Wells' Dairy bought the business, including Bomb Pops. The ice cream had remained largely a regional brand until 1992 when it began an aggressive program to expand nationally. The centerpiece of the expansion is a 900,000-square-foot (84,000 m2) plant, which in addition to manufacturing includes a 12-story-tall freezer. The plant is referred to as the “South Ice Cream Plant” because of its physical location on the south side of Le Mars. Operating two ice cream plants in Le Mars, Wells is the world’s largest manufacturer of ice cream in one location (which in turn has prompted Le Mars to claim the title of “Ice Cream Capital of the World”). In 2003, an ice cream plant in St. George, Utah was opened to better meet the west coast market. In 2014 Wells announced it would be closing the St. George, UT facility. In November 2007, Mike Wells was named CEO of Wells. In 2008, Wells Enterprises launched the Blue Bunny Helmet of Hope Program in partnership with the Jimmie Johnson Foundation. It allows consumers across the United States to nominate educational charities to receive a $25,000 grant. On 7 December 2022, the company announced its acquisition by Ferrero Group, an Italian confectionery manufacturer. References External links Corporate Blue Bunny website Weight Watchers Ice Cream website Announced mergers and acquisitions Companies based in Iowa Manufacturing companies established in 1913 Ice cream brands Privately held companies based in Iowa 1913 establishments in Iowa Le Mars, Iowa Ferrero SpA
The Lotus 12 was a British racing car used in Formula Two and Formula One. It first debuted at the 1958 Monaco Grand Prix and was Colin Chapman's first single-seat racer. Design Colin Chapman's first foray into single-seater racing, the 12 appeared in 1958. It featured a number of important innovations Chapman would use on later models. To better use the power of the Coventry Climax engine, it was designed, as usual, for low weight and low drag, relying on a space frame. It placed the driver as low as possible, reducing the height of transmission tunnel by way of a "conceptually brilliant" five-speed sequential-shift transaxle located in the back. This transaxle was designed by Richard Ansdale and Harry Mundy. The gearbox had a (long-undiagnosed) oil starvation problem, thus earned the nickname "Queerbox" for its unreliability. Although the first two examples of Lotus 12 had De Dion rear suspension, it also introduced a new suspension configuration with what came to be called "Chapman struts" in the rear, essentially a MacPherson strut with a fixed length halfshaft with universal joints on the ends utilised as a suspension arm. Lotus 12 was the first Lotus to be fitted with the iconic wobbly-web wheels. Reflecting Chapman's emphasis on engineering for lightness, these were cast in magnesium alloy, a kind of crimped cylinder, resulting in minimum material and maximum strength, without the weaknesses induced by slots in conventional designs. Despite its engineering advances, the 12 was not a success in F1. In F2, the car won the class in the mixed F1/F2 1958 BRDC International Trophy, driven by Cliff Allison, but in spite of a small number of podiums, was usually drowned in a sea of Coopers. Gallery Complete Formula One World Championship results (key) (Results in bold indicate pole position; results in italics indicate fastest lap.) All points scored using the Lotus 16. * F2 driver Notes Sources Setright, L. J. K. Lotus: The golden mean, in Northey, Tom (ed.) World of Automobiles (London: Orbis, 1974), Volume 11, pp. 1221–34. Formula Two cars 12
```swift import Foundation import Shared class OnboardingAuthDetails: Equatable { var url: URL var scheme: String var exceptions: SecurityExceptions = .init() init(baseURL: URL) throws { guard var components = URLComponents(url: baseURL.sanitized(), resolvingAgainstBaseURL: false) else { throw OnboardingAuthError(kind: .invalidURL) } let redirectURI: String let scheme: String let clientID: String if Current.appConfiguration == .debug { clientID = "path_to_url" redirectURI = "homeassistant-dev://auth-callback" scheme = "homeassistant-dev" } else if Current.appConfiguration == .beta { clientID = "path_to_url" redirectURI = "homeassistant-beta://auth-callback" scheme = "homeassistant-beta" } else { clientID = "path_to_url" redirectURI = "homeassistant://auth-callback" scheme = "homeassistant" } components.path += "/auth/authorize" components.queryItems = [ URLQueryItem(name: "response_type", value: "code"), URLQueryItem(name: "client_id", value: clientID), URLQueryItem(name: "redirect_uri", value: redirectURI), ] guard let authURL = components.url else { throw OnboardingAuthError(kind: .invalidURL) } self.url = authURL self.scheme = scheme } static func == (lhs: OnboardingAuthDetails, rhs: OnboardingAuthDetails) -> Bool { lhs.url == rhs.url && lhs.scheme == rhs.scheme && lhs.exceptions == rhs.exceptions } } ```
is a railway station on the Shinetsu Main Line in the city of Nagaoka, Niigata, Japan, operated by East Japan Railway Company (JR East). Lines Kita-Nagaoka Station is served by the Shinetsu Main Line and is 75.5 kilometers from the starting point of the line at Naoetsu Station. Station layout The station consists of one ground-level island platform connected to the station building by a footbridge, serving two tracks, located adjacent to the elevated Joetsu Shinkansen tracks. The station is unattended. Platforms History The station opened on 1 November 1915 as . It was renamed Kita-Nagaoka on 20 June 1951. With the privatization of Japanese National Railways (JNR) on 1 April 1987, the station came under the control of JR East. A new station building was completed in July 2014. Surrounding area See also List of railway stations in Japan External links JR East station information Railway stations in Nagaoka, Niigata Shin'etsu Main Line Stations of East Japan Railway Company Railway stations in Japan opened in 1915
Dinhata Assembly constituency is an assembly constituency in Cooch Behar district in the Indian state of West Bengal. Overview As per orders of the Delimitation Commission, No. 7 Dinhata Assembly constituency covers Dinhata municipality, Dinhata II community development block, and Bhetaguri I, Dinhata Gram I, Dinhata Gram II and Putimari I gram panchayats of Dinhata I community development block. Dinhata Assembly constituency is part of No. 1 Cooch Behar (Lok Sabha constituency) (SC). Members of the Legislative Assembly ^: by-elections Election results 2023 Bye election 2021 2016 Udayan Guha, the Forward Bloc MLA from Dinhata, Joined Trinamool Congress on 1 October 2015. In the 2016 election, Udayan Guha of Trinamool Congress defeated his nearest rival Akshay Thakur of All India Forward Bloc. 2011 Udayan Guha, the Forward Bloc MLA from Dinhata, joined Trinamool Congress on 1 October 2015. . In the 2011 election, Udayan Guha of AIFB defeated his nearest rival Dr. Md Fazle Haque Independent. The outgoing Trinamool Congress MLA, Ashok Mondal, was publicly expelled by Mamata Banerjee for campaigning for Dr. Md. Fazle Haque, dissident Congress leader and MLA from Sitai. Dr. Md. Fazle Haque, contesting as an Independent Candidate, was a rebel congress leader. Nationalist Congress Party did not contest this seat in 2006. 2006 In the 2006 election, Ashok Mondal of AITC defeated his nearest rival Udayan Guha of AIFB 2001 In the 2001 election, Kamal Guha of AIFB defeated his nearest rival Dipak Sengupta of AITC 1972-2006 In the 2006 state assembly elections, Ashok Mandal of Trinamool Congress won the Dinhata seat defeating his nearest rival Udayan Guha of Forward Bloc. Contests in most years were multi cornered but only winners and runners are being mentioned. Kamal Guha won the seat in a row from 1977 to 2001 (and also earlier – see below). He represented Forward Bloc in all years except 1996, when he represented the break away Forward Bloc (Socialist), which subsequently was reunited with the parent body. He defeated Dipak Sengupta representing Trinamool Congress in 2001 and representing Forward Bloc in 1996, Alok Nandi of Congress in 1991 and 1987, Ramkrishna Pal of Congress in 1982 and Alok Nandy of Congress in 1977. 1951-1972 Jogesh Chandra Sarkar of Congress won the Dinhata seat in 1972 and 1971. Animesh Mukharjee of Congress won it in 1969. Kamal Guha of Forward Bloc won it 1967 and 1962. In 1957 Dinhata was double seat reserved for SC. Bhawani Prasanna Talukdar and Umesh Chandra Mandal (both of Congress) won. In independent India's first election in 1951, Satish Chandra Roy Singha and Umesh Chandra Mandal (both of Congress) won from Dinhata. References Assembly constituencies of West Bengal Politics of Cooch Behar district
Větrná hora is a 1955 Czechoslovak film. The film starred Josef Kemr. References External links 1955 films 1950s Czech-language films Czech adventure films Czechoslovak black-and-white films Czechoslovak adventure films 1955 adventure films 1950s Czech films Czech black-and-white films
Curling at the 2002 Winter Olympics took place from February 11 to February 18 in Ogden, Utah. The 2002 Winter Games were the third time that curling was on the Olympic program. Men's Men's tournament Teams * Hammy McMillan was replaced by Warwick Smith as skip after Draw 4. Final standings Draws Draw 1 February 11, 9:00 Draw 2 February 11, 19:00 Draw 3 February 12, 14:00 Draw 4 February 13, 9:00 Draw 5 February 13, 19:00 Draw 6 February 14, 14:00 Draw 7 February 15, 9:00 Draw 8 February 15, 19:00 Draw 9 February 16, 14:00 Draw 10 February 17, 9:00 Draw 11 February 17, 19:00 Draw 12 February 18, 14:00 Medal round Semifinals February 20, 14:00 Bronze medal game February 21, 9:00 Gold medal game February 22, 14:30 Top 5 player percentages Women's Women's tournament Teams Final standings Draws Draw 1 February 11, 14:00 Draw 2 February 12, 9:00 Draw 3 February 12, 19:00 Draw 4 February 13, 14:00 Draw 5 February 14, 9:00 Draw 6 February 14, 19:00 Draw 7 February 15, 14:00 Draw 8 February 16, 9:00 Draw 9 February 16, 19:00 Draw 10 February 17, 14:00 Draw 11 February 18, 9:00 Draw 12 February 18, 19:00 Tiebreaker 1 February 19, 9:00 Tiebreaker 2 February 19, 14:00 Medal round Semifinals February 20, 9:00 Bronze medal game February 21, 9:00 Gold medal game February 21, 14:00 Top 5 player percentages References External links Official Results Book – Curling 2002 Winter Olympics events 2002 2002 in curling International curling competitions hosted by the United States Curling competitions in Utah Sports competitions in Ogden, Utah
```xml /** * Get pathname from absolute path. * * @param absolutePath the absolute path * @returns the pathname */ export function getPathnameFromAbsolutePath(absolutePath: string) { // Remove prefix including app dir let appDir = '/app/' if (!absolutePath.includes(appDir)) { appDir = '\\app\\' } const [, ...parts] = absolutePath.split(appDir) const relativePath = appDir[0] + parts.join(appDir) // remove extension const pathname = relativePath.split('.').slice(0, -1).join('.') return pathname } ```
is a railway station on the Hachinohe Line in the town of Hirono, Kunohe District, Iwate Prefecture, Japan. It is operated by the East Japan Railway Company (JR East). Lines Uge Station is served by the Hachinohe Line, and is 45.8 kilometers from the terminus of the line at Hachinohe Station. Station layout Uge Station has a single ground-level side platform serving a single bidirectional track. There is a small rain shelter built on top of the platform, but there is no station building. The station is unattended. History Uge Station opened on December 25, 1961. On April 1, 1987, upon the privatization of Japanese National Railways (JNR), the station came under the operational control of JR East. Surrounding area National Route 45 See also List of railway stations in Japan References External links Railway stations in Iwate Prefecture Hirono, Iwate Hachinohe Line Railway stations in Japan opened in 1961 Stations of East Japan Railway Company
Jennifer Ann Abruzzo is an American attorney and government official who serves as General Counsel at the National Labor Relations Board (NLRB). She previously was Special Counsel for Strategic Initiatives for Communications Workers of America (CWA), the largest media and communications union in the United States. She had previously worked for the NLRB for over 20 years in a number of positions, including Deputy General Counsel and Acting General Counsel. Early life and career A native of Queens, New York City, Abruzzo was raised in a "large Roman Catholic family". Abruzzo began her nearly 23-year career at the National Labor Relations Board (NLRB) as a field attorney in Miami, eventually rising to the position of Deputy General Counsel during the Obama administration. Abruzzo later served as acting general counsel in advance of the confirmation of Peter B. Robb to the position. Abruzzo became special counsel for strategic initiatives at Communications Workers of America (CWA) in February 2018. In 2019, the AFL–CIO recommended Abruzzo for a vacant Democratic seat on the NLRB. During the presidential transition of Joe Biden, she served as an advisor to the President-elect on matters of labor policy. General Counsel of the National Labor Relations Board Nomination President Joe Biden nominated Jennifer Abruzzo to become the General Counsel of the NLRB on February 17, 2021 after firing the previous General Counsel, Peter B. Robb. Following her confirmation hearing, Abruzzo was confirmed by the Senate in a 51-50 vote, with all Democrats voting in favor and all Republicans voting against, and Vice President Kamala Harris breaking the tie in favor of Abruzzo's confirmation. She is the second woman to ever serve as NLRB general counsel, after Rosemary Collyer. The confirmation of Abruzzo received support from unions, and she is expected to improve the investigative and enforcement capacity of NLRB lawyers by reversing budget cuts and staffing reductions implemented during the tenure of her predecessor, as well as ratify actions taken by acting general counsel Peter Sung Ohr after Robb was fired. Tenure As General Counsel Abruzzo issued a memo declaring that college athletes have the right to organize. In office, Abruzzo has pushed for the NLRB to protect immigrants' rights to organize, regardless of their immigration status. In October 2021, Abruzzo stated that employees who participated in Black Lives Matter protests were protected under federal labor law. The success of the Amazon Labor Union organizing drive at the company's JFK8 facility in Staten Island, New York has been attributed in part to Abruzzo's leadership at the NLRB. In April 2022, Abruzzo issued a memorandum calling for the NLRB to find captive audience meetings unlawful. General Counsel Abruzzo notified Regional Offices in May of 2023 that non-compete clauses should generally be considered unlawful. References External links Living people Year of birth missing (living people) National Labor Relations Board officials Biden administration personnel Women government officials American labor lawyers Communications Workers of America people People from Queens, New York
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\DataCatalog; class GoogleCloudDatacatalogV1BigQueryTableSpec extends \Google\Model { /** * @var string */ public $tableSourceType; protected $tableSpecType = GoogleCloudDatacatalogV1TableSpec::class; protected $tableSpecDataType = ''; protected $viewSpecType = GoogleCloudDatacatalogV1ViewSpec::class; protected $viewSpecDataType = ''; /** * @param string */ public function setTableSourceType($tableSourceType) { $this->tableSourceType = $tableSourceType; } /** * @return string */ public function getTableSourceType() { return $this->tableSourceType; } /** * @param GoogleCloudDatacatalogV1TableSpec */ public function setTableSpec(GoogleCloudDatacatalogV1TableSpec $tableSpec) { $this->tableSpec = $tableSpec; } /** * @return GoogleCloudDatacatalogV1TableSpec */ public function getTableSpec() { return $this->tableSpec; } /** * @param GoogleCloudDatacatalogV1ViewSpec */ public function setViewSpec(GoogleCloudDatacatalogV1ViewSpec $viewSpec) { $this->viewSpec = $viewSpec; } /** * @return GoogleCloudDatacatalogV1ViewSpec */ public function getViewSpec() { return $this->viewSpec; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(GoogleCloudDatacatalogV1BigQueryTableSpec::class, your_sha256_hashSpec'); ```
```python # # This software may be used and distributed according to the terms of the """ integration with a native debugger like lldb Check path_to_url for APIs. This file runs standalone by lldb's Python interperter. It does not have access to `bindings` or other Sapling modules. Do not import Sapling modules here. There are 2 ways to use this feature, - Use `debugbt` command. - Use `lldb -p <pid>`, then run `command script import ./dbgutil.py`, then use the `bta` command. """ import functools import struct import subprocess import sys def backtrace_all(ui, pid: int): """write backtraces of all threads of the given pid. Runs inside Sapling Python environment. """ import inspect import os import tempfile import bindings python_source = inspect.getsource(sys.modules["sapling.dbgutil"]) with tempfile.TemporaryDirectory(prefix="saplinglldb") as dir: python_script_path = os.path.join(dir, "dbgutil.py") if ui.formatted: out_path = "" else: # Buffer output so we out_path = os.path.join(dir, "bta_output.txt") with open(python_script_path, "wb") as f: f.write(python_source.encode()) args = [ ui.config("ui", "lldb") or "lldb", "-b", "--source-quietly", "-o", f"command script import {python_script_path}", "-o", f"bta {pid}{out_path and ' ' + out_path}", ] subprocess.run(args, stdout=(subprocess.DEVNULL if out_path else None)) if out_path: with open(out_path, "rb") as f: data = f.read() ui.writebytes(data) def _lldb_backtrace_all_attach_pid(pid, write): """Attach to a pid and write its backtraces. Runs inside lldb Python environment, outside Sapling environment. """ import lldb debugger = lldb.debugger target = debugger.CreateTarget("") process = target.AttachToProcessWithID(lldb.SBListener(), pid, lldb.SBError()) try: _lldb_backtrace_all_for_process(target, process, write) finally: if sys.platform == "win32": # Attempt to resume the suspended process. "Detach()" alone does not # seem to resume it... debugger.SetAsync(True) process.Continue() process.Detach() def _lldb_backtrace_all_for_process(target, process, write): """Write backtraces for the given lldb target/process. Runs inside lldb Python environment, outside Sapling environment. """ import lldb if target.addr_size != 8: write("non-64-bit (%s) architecture is not yet supported\n" % target.addr_size) return def read_u64(address: int) -> int: """read u64 from an address""" return struct.unpack("Q", process.ReadMemory(address, 8, lldb.SBError()))[0] def resolve_frame(frame) -> str: """extract python stack info from a frame. The frame should be a Sapling_PyEvalFrame function call. """ # Sapling_PyEvalFrame(PyThreadState* tstate, PyFrameObject* f, int exc) # # x64: # pushq %rbp # movq %rsp, %rbp ; FP # subq $0x20, %rsp ; SP = FP - 0x20 # movq %rdi, -0x8(%rbp) # movq %rsi, -0x10(%rbp) ; PyFrame f at FP - 0x10, or SP + 0x10 # movl %edx, -0x14(%rbp) # movq -0x8(%rbp), %rdi # movq -0x10(%rbp), %rsi # movl -0x14(%rbp), %edx # callq 0x1034bddee ; symbol stub for: _PyEval_EvalFrameDefault # addq $0x20, %rsp # popq %rbp # retq # # arm64 (x29 is FP): # sub sp, sp, #0x30 # stp x29, x30, [sp, #0x20] # add x29, sp, #0x20 ; FP = SP + 0x20 # stur x0, [x29, #-0x8] ; x0 is 1st arg (tstate) # str x1, [sp, #0x10] ; x1 is 2nd arg, `f`, at SP + 0x10 # str w2, [sp, #0xc] # ldur x0, [x29, #-0x8] # ldr x1, [sp, #0x10] # ldr w2, [sp, #0xc] # bl 0x1046b6140 ; symbol stub for: _PyEval_EvalFrameDefault # ldp x29, x30, [sp, #0x20] # add sp, sp, #0x30 # ret # # x64 MSVC: # ; Sapling_PyEvalFrame(PyThreadState* tstate, PyFrame* f, int exc) { # push rbp # sub rsp,40h # lea rbp,[rsp+40h] # mov dword ptr [rbp-4],r8d # mov qword ptr [rbp-18h],rdx ; FP - 0x18 # mov qword ptr [rbp-10h],rcx # ; return _PyEval_EvalFrameDefault(tstate, f, exc); # mov r8d,dword ptr [exc] # mov rdx,qword ptr [f] # mov rcx,qword ptr [tstate] # call qword ptr [__imp__PyEval_EvalFrameDefault (07FF748CDDF40h)] # nop # add rsp,40h # pop rbp # ret fp: int = frame.fp sp: int = frame.sp ptr_addr = None if fp - sp == 0x40 and sys.platform == "win32": ptr_addr = fp - 0x18 elif fp - sp == 0x20: ptr_addr = fp - 0x10 if ptr_addr is not None: try: python_frame_address = read_u64(ptr_addr) return resolve_python_frame(python_frame_address) except Exception as e: return f"<error {e} {ptr_addr}>" return "" def resolve_python_frame(python_frame_address: int) -> str: # NOTE: `sapling_cext_evalframe_resolve_frame` needs the Python GIL # to be "safe". However, it is likely just reading a bunch of # objects (ex. frame, code, str) and those objects are not being # GC-ed (since the call stack need them). So it is probably okay. value = target.EvaluateExpression( f"(char *)(sapling_cext_evalframe_resolve_frame((size_t){python_frame_address}))" ) return (value.GetSummary() or "").strip('"') for thread in process.threads: write(("%r\n") % thread) frames = [] # [(frame | None, line)] has_resolved_python_frame = False for i, frame in enumerate(thread.frames): name = frame.GetDisplayFunctionName() if name == "Sapling_PyEvalFrame": resolved = resolve_frame(frame) if resolved: has_resolved_python_frame = True # The "frame #i" format matches the repr(frame) style. frames.append((None, f" frame #{i}: {resolved}\n")) continue if name: frames.append((frame, f" {repr(frame)}\n")) if has_resolved_python_frame: # If any Python frame is resolved, strip out noisy frames like _PyEval_EvalFrameDefault. frames = [ (frame, line) for frame, line in frames if not _is_cpython_function(frame) ] write("".join(line for _frame, line in frames)) write("\n") def _is_cpython_function(frame) -> bool: return frame is not None and "python" in (frame.module.file.basename or "").lower() def _lldb_backtrace_all_command(debugger, command, exe_ctx, result, internal_dict): """lldb command: bta [pid] [PATH]. Write Python+Rust traceback to stdout or PATH.""" args = command.split(" ", 1) if len(args) >= 1 and args[0]: pid = int(args[0]) impl = functools.partial(_lldb_backtrace_all_attach_pid, pid) else: target = exe_ctx.target process = exe_ctx.process impl = functools.partial(_lldb_backtrace_all_for_process, target, process) path = args[1].strip() if len(args) >= 2 else None if path: with open(path, "w", newline="\n") as f: impl(f.write) f.flush() else: impl(sys.stdout.write) def __lldb_init_module(debugger, internal_dict): # When imported by lldb 'command script import', this function is called. # Add a 'bta' command to call _lldb_backtrace_all. debugger.HandleCommand( f"command script add -f {__name__}._lldb_backtrace_all_command bta" ) ```
The 2013–14 Northern Colorado Bears men's basketball team represented the University of Northern Colorado during the 2013–14 NCAA Division I men's basketball season. The Bears were led by fourth year head coach B. J. Hill and played their home games at the Butler–Hancock Sports Pavilion. They were a member of the Big Sky Conference. They finished the season 18–14, 11–9 in Big Sky play to finish in a tie for fifth place. They advanced to the semifinals of the Big Sky Conference tournament where they lost to Weber State. They were invited to the CollegeInsdier.com Tournament where they lost in the first round to Texas A&M–Corpus Christi. Roster Schedule |- !colspan=9 style="background:#000066; color:#FFCC33;"| Regular season |- !colspan=9 style="background:#000066; color:#FFCC33;"| Big Sky tournament |- !colspan=9 style="background:#000066; color:#FFCC33;"| CIT References Northern Colorado Bears men's basketball seasons Northern Colorado Northern Colorado Northern Colorado Bears men's basketball Northern Colorado Bears men's basketball
FC Khimik Vanadzor (), is a defunct Armenian football club from the city of Vanadzor, Lori Province. The club was founded in 1950, representing the Kirovakan chemicals plant. The team won the Armenian SSR championship in 1955 and 1964. However, the club was dissolved in 1993, after the independence of Armenia. References Khimik Vanadzor Association football clubs established in 1950 Association football clubs disestablished in 1993 1950 establishments in Armenia 1993 disestablishments in Armenia
St. Matthew is an oil-on-canvas painting by the Dutch Golden Age painter Frans Hals, painted in 1625 and now in the Odesa Museum of Western and Eastern Art, Odesa. Painting The painting shows Saint Matthew sitting at a desk reading with an angel at his elbow. This painting was documented in the 18th century but was considered lost until the 1950s, when two tronies were discovered languishing in the storerooms of the Odesa Museum of Western and Eastern Art in 1958 by art historian Irina Linnik. At the time they were considered to be by unknown 19th-century painters, but Linnik recognized them as the work of a 17th-century master and eventually traced their history back to the 17th century, identifying them as two of four lost paintings by Hals of the evangelists, namely Luke and Matthew. After her work was published in 1959, the two paintings were included in the 1962 Frans Hals exhibition in the Frans Hals Museum. The international attention helped to spur art detectives and eventually the other two of John and Mark were also rediscovered. In his 1989 catalog of the international Frans Hals exhibition, Slive included a photo of Hals' Two singing boys with a lute and a music book to show that his theme of a main subject with a secondary witness was common to many of Hals' paintings of the 1620s and the models as secondary witness in these two paintings were clearly cousins. Two singing boys and Matthew: The four evangelists by Hals: See also List of paintings by Frans Hals References Paintings by Frans Hals Ukrainian art 1625 paintings Paintings in Ukraine Hals Books in art Angels in art
An acrostic is a type of word puzzle, related somewhat to crossword puzzles, that uses an acrostic form. It typically consists of two parts. The first part is a set of lettered clues, each of which has numbered blanks representing the letters of the answer. The second part is a long series of numbered blanks and spaces, representing a quotation or other text, into which the answers for the clues fit. In some forms of the puzzle, the first letters of each correct clue answer, read in order from clue A on down the list, will spell out the author of the quote and the title of the work it is taken from; this can be used as an additional solving aid. An example For example, two clues in the first part might be: The second part is initially blank: If the answer to clue A is JAPAN, then the second part fills in as follows: Letters 16 and 17 form a two-letter word ending in P. Since this has to be UP, letter 16 is a U, which can be filled into the appropriate clue answer in the list of clues. Likewise, a three-letter word starting with A could be and, any, all, or even a proper name like Ann. One might need more clue answers before daring to guess which it could be. If the answer to clue B is IDLE, one could narrow down the 5/6/7 word to AND and the following word starting with JI. Some people might already begin to recognize the phrase "Jack and Jill went up the hill." The numbers in the quotation are generally followed by letters corresponding to the clue answers, to aid solvers in working back and forth from the clues to the puzzle. History Elizabeth Kingsley is credited with inventing the puzzle for Saturday Review in 1934, under the name double-crostic. Since then, other nonce words ending in "-crostic" have been used. Anacrostic may be the most accurate term used, and hence most common, as it is a portmanteau of anagram and acrostic, referencing the fact that the solution is an anagram of the clue answers, and the author of the quote is hidden in the clue answers acrostically. Later Saturday Review constructors were Doris Nash Wortman, Thomas Middleton, and Barry Tunick. Thomas Middleton also produced many puzzles for Harpers Magazine. Kingsley, Wortman, and Middleton created additional puzzles for The New York Times from 1952–1999, but not more than one every other week. Emily Cox and Henry Rathvon took over the bi-weekly setting duties for the NYT in 1999. A similar puzzle, called a Trans-O-Gram, by Svend Petersen, and later, Kem Putney, appeared in National Review from 1963–1993. Trans-O-Grams were often themed puzzles, with clues related to the quote. The name Duo-Crostic was used by the Los Angeles Times for puzzles by Barry Tunick and Sylvia Bursztyn. Charles Preston created Quote-Acrostics for The Washington Post. Charles Duerr, who died in 1999, authored many "Dur-acrostic" books and was a contributor of acrostics to the Saturday Review. Michael Ashley's "Double Cross" acrostics have appeared in GAMES and GAMES World of Puzzles since 1978. Writer and academic Isaac Asimov enjoyed acrostics, comparing them favorably to crossword puzzles. In "Yours, Isaac Asimov", published 3 years after his 1992 death, he wrote, "As it happens, I don’t... have time for hobbies. But I am a fiend at Crostics. Crostics don’t have the public that crosswords do, because Crostics seem hard. They aren’t, and they’re infinitely more interesting than crosswords." External links AcrosticPuzzles.com American Acrostics Word puzzles
The Georgia International Convention Center or GICC, opened in April 2003, is the second largest convention center in the U.S. state of Georgia, the largest being the Georgia World Congress Center. It is located at 2000 Convention Center Concourse, just off Camp Creek Parkway (S.R. 6) and Roosevelt Highway (U.S. 29) in College Park. The Convention Center is accessible from the Airport MARTA station (via a connection to the ATL Skytrain), Interstate 285, and Interstate 85. It has a number of exhibit halls, meeting rooms and ballrooms that can be rented. Behind the Convention Center, the Atlanta Airport people-mover called ATL Skytrain, connects airport patrons with the new rental car complex, four hotel accommodations, and restaurants at the Gateway Center of the Georgia International Convention Center. It is connected via ATL Skytrain. In 2016, it was to be the home to the Atlanta Vultures of American Indoor Football but they never played a home game due to turf issues. On November 10, 2016, the Atlanta Hawks announced it had purchased an expansion team to play in the NBA Development League with the intentions of building a new 3,500-seat arena at the Gateway Center to be its home for the 2019–20 season. The expansion team then began play in 2017 as the Erie BayHawks in Erie, Pennsylvania, while the arena was being finished. On November 8, 2019, the Gateway Center Arena officially opened. The Gateway Center Arena will be home to the WNBA's Atlanta Dream for the 2020 season as well as the NBA G League team the College Park Skyhawks. Previous location Prior to 2003, the Georgia International Convention Center was located behind and connected with the Sheraton Atlanta Airport Hotel on Riverdale Road. However, because of runway expansion at the airport, they were forced to move to the current location. The previous location was demolished, followed by the implosion of the former Sheraton hotel. References External links Georgia International Convention Center website Gateway Center Arena website Buildings and structures in Atlanta Convention centers in Georgia (U.S. state) Tourist attractions in Atlanta College Park, Georgia Indoor arenas in Georgia (U.S. state) Basketball venues in Georgia (U.S. state) Sports venues completed in 2009 2009 establishments in Georgia (U.S. state)
State Highway 31 ( RJ SH 31) is a State Highway in Rajasthan state of India that connects Jalore in Jalore district of Rajasthan with Raniwara in same district. The total length of RJ SH 31 is 107 km. Other cities and towns on this highway are: Bagra, Akoli, Mandoli, Ramseen and Bhinmal. See also List of State Highways in Rajasthan References State Highway Jalore district State Highways in Rajasthan
John Bowyer Bell (November 15, 1931 – August 23, 2003) was an American historian, artist and art critic. He was best known as a terrorism expert. Background and early life Bell was born into an Episcopalian family in 1931 in New York City. The family later moved to Alabama, from where Bell attended Washington and Lee University in Lexington, Virginia, majoring in history. He also studied art, and discovered he had "total visual memory"—the equivalent of perfect pitch in a singer. His first solo art showing was in the college library in his senior year. He considered becoming a professional artist and made frequent visits to New York to visit other artists, including his hero Franz Kline, but committed to academia. Bell graduated in 1953, and began studying the Spanish Civil War at Duke University in North Carolina. Bell interrupted his studies at Duke after being awarded a Fulbright, and travelled to Italy to study at the University of Rome. Bell travelled Europe interviewing veterans of the Spanish Civil War, and in Rome he mixed with writers and artists including Cy Twombly. After returning to America, Bell completed his doctorate at Duke in 1958. Professional career After graduating, Bell began teaching at the Massachusetts Institute of Technology, Harvard University and Trinity School in Manhattan. In 1962, he married Charlotte Rockey, an Egyptologist, and they moved into an apartment in Manhattan. In New York, Bell socialised with the likes of Robert Rauschenberg, Jasper Johns, Jack Kerouac and Frank Stella at the Cedar Tavern. Bell exhibited his paintings and collages at the Allan Stone Gallery, and collected paintings and sculptures by artists including John Chamberlain. Bell was fascinated by global terrorism conflicts and decided to "write [his] way back into academia". While researching the Middle East, he discovered that the Irgun drew inspiration from the Irish Republican Army (IRA) and the Irish War of Independence, and began to study the IRA. Bell and his family travelled to County Carlow in the Republic of Ireland in 1965, where he spent several months researching the Republican Movement. He discovered little had been published on Irish history after 1922, and the state archives were closed until the 1980s. He began research in the National Library of Ireland, and also interviewed Irish republicans in a Kilkenny public house and hotels in Dublin. In 1966, his first book was published; Besieged: Seven Cities Under Siege. That same year he returned to Dublin with his family to continue his research. In 1967, he made his first visit to Northern Ireland where he attended a meeting of the banned Republican Clubs. In 1969, he published his second book on the Middle East; The Long War: Israel and the Arabs since 1946. The Troubles began in Northern Ireland in 1969, and Bell's The Secret Army: the IRA 1916–1970 was published the following year, and was one of the first detailed histories of the IRA, along with The IRA by Tim Pat Coogan, which was also published in 1970. After the publication of The Secret Army Bell lived mostly in New York and London and continued to visit Ireland annually. While researching in Ireland, Bell was tear gassed and shot at during riots in Belfast, which he described as "field work a bit too near the centre of the field". Bell continued to travel extensively, researching in the Middle East, Africa, Europe and Asia as part of a career described as "talking to terrorists, gunmen, mad dogs and mercenaries". He was held hostage in Jordan, shot at in Lebanon, kidnapped in Yemen and deported from Kenya. Horn of Africa: Strategic Magnet in the Seventies was published in 1973. In 1974, he began writing with the "Insight Team" of The Sunday Times about the war in Cyprus. This was followed by the 1976 publication of On Revolt: Strategies of National Liberation, for which he interviewed over a hundred participants from revolts against the British Empire. Terror Out of Zion, published in 1977, covered the Irgun and Lehi's guerrilla campaign in the British Mandate of Palestine. Following the death of his first wife in 1981, Bell married an Irishwoman, Norah Browne from County Kerry, whom he had met while filming his 1972 documentary, The Secret Army. He continued to work in other areas; he was an adjunct professor at Columbia University's School of International and Public Affairs, and he held the position of research associate at the university's Institute of War and Peace Studies. He was a member of the Council on Foreign Relations and founded a consultancy, the International Analysis Centre, whose clients included the United States Department of State, the United States Department of Justice, the Central Intelligence Agency and American television networks. He continued to work as an independent scholar, carrying out research with the aid of grants; he received over seven Guggenheim Fellowships and turned down a Rockefeller Humanities Award. Bell also continued his career in painting, receiving a Pollock-Krasner Fellowship and exhibiting work inspired by the conflicts he witnessed. From 1979 onward, his paintings were exhibited annually at the Taylor Gallery in Dublin, and he also held exhibitions in Manhattan and Hungary. Bell launched a career as an art critic in the 1990s, writing for New York-based journal Review, and he was also commissioned to write catalogue entries for galleries and museum retrospectives. Bell continued writing about the IRA and the ongoing events of the Troubles in Northern Ireland, and in 1994 he was a speaker at West Belfast Festival, where he suggested the IRA was the only organisation in Northern Ireland that understood its problems. In 1996, he made headlines in Ireland and abroad after meeting with the Army Council of the dissident republican splinter group Continuity IRA at a secret rural location in Ireland. Former IRA member Anthony McIntyre claimed Bell had a pro-Irish republican bias, with McIntyre stating "Bowyer Bell's long familiarity with Irish Republicanism once prompted the caustic comment that there are none more vindictive than a reformed gunman". As well as releasing updated versions of The Secret Army, Bell continued to write about other aspects of the conflicts in Ireland and the Middle East. Cheating and Deception was published in 1991, The Irish Troubles: A Generation of Violence 1967–1992 in 1993, In Dubious Battle: The Dublin and Monaghan Bombings 1972–1974 and Back to the Future: The Protestants and a United Ireland in 1996, and Dynamics of the Armed Struggle in 1998. With the aid of a grant from the Massachusetts Institute of Technology, Bell returned to the Middle East in 2000 to conduct research for his next book, on Egyptian Islamic terrorism. As with The Secret Army first being published shortly after the start of the Troubles, Bell's timing was again good with Murders on the Nile: The World Trade Center and Global Terrorism being published in 2002, shortly after the September 11, 2001, attacks on the United States by Al-Qaeda. Death Bell died from renal failure in a New York hospital on 23 August 2003. His paintings continue to be exhibited since his death. References 1931 births 2003 deaths American art critics American expatriates in Italy 20th-century American historians American male non-fiction writers 20th-century American painters American male painters 21st-century American painters Deaths from kidney failure Columbia University faculty Duke University alumni Harvard University faculty Massachusetts Institute of Technology faculty Sapienza University of Rome alumni Washington and Lee University alumni Painters from New York City 20th-century American male writers Historians from New York (state) Fulbright alumni
Commercial Resupply Services (CRS) are a series of flights awarded by NASA for the delivery of cargo and supplies to the International Space Station (ISS) on commercially operated spacecraft. The first CRS contracts were signed in 2008 and awarded $1.6 billion to SpaceX for twelve cargo Dragon and $1.9 billion to Orbital Sciences for eight Cygnus flights, covering deliveries to 2016. The Falcon 9 and Antares rockets were also developed under the CRS program to deliver cargo spacecraft to the ISS. The first operational resupply missions were flown by SpaceX in 2012 (SpaceX CRS-1) and Orbital Sciences in 2014 (Cygnus CRS Orb-1). A second phase of contracts (known as CRS-2) was solicited in 2014. In 2015, NASA extended CRS-1 to twenty flights for SpaceX and twelve flights for Orbital ATK. CRS-2 contracts were awarded in January 2016 to Orbital ATK Cygnus, Sierra Nevada Corporation Dream Chaser, and SpaceX Dragon 2, for cargo transport flights beginning in 2019 and expected to last through 2024. Phase 1 contract awards and demonstration flights NASA has been directed to pursue commercial spaceflight options since at least 1984, with the Commercial Space Launch Act of 1984 and Launch Services Purchase Act of 1990. By the 2000s funding was authorized for the Commercial Orbital Transportation Services program, followed by the Commercial Crew Development program. On 23 December 2008, NASA announced the initial awarding of cargo contracts - twelve flights to SpaceX and eight flights to Orbital Sciences Corporation. PlanetSpace, which was not selected, submitted a protest to the Government Accountability Office. On 22 April 2009, the GAO publicly released its decision to deny the protest, allowing the program to continue. The Antares and Falcon 9 launch vehicles and Cygnus and Dragon cargo spacecraft were developed using Space Act Agreements under NASA's Commercial Orbital Transportation Services (COTS) program. The first flight contracted by NASA, COTS Demo Flight 1, took place on 8 December 2010, demonstrating a Dragon capsule's ability to remain in orbit, receive and respond to ground commands, and communicate with NASA's Tracking and Data Relay Satellite System. On 15 August 2011, SpaceX announced that NASA had combined the objectives of the COTS Demo Flight 2 and following Flight 3 into a single mission. The rescoped COTS Demo Flight 2 successfully launched on 22 May 2012, delivering cargo to the ISS. The spacecraft reentered on 31 May, landed in the Pacific Ocean, and was recovered, completed CRS certification requirements. Orbital Sciences first launched the Antares rocket from the Mid-Atlantic Regional Spaceport on 21 April 2013 with a test payload. Orbital Sciences completed the Cygnus Orb-D1 demonstration flight on 29 September 2013, and the operational Cygnus CRS Orb-1 was launched 9 January 2014. Commercial Resupply Services phase 1 Transport flights began under Commercial Resupply Services phase 1 (CRS-1) in 2012: Cargo Dragon flights SpaceX CRS-1: 8 October 2012 SpaceX CRS-2: 1 March 2013 SpaceX CRS-3: 18 April 2014 SpaceX CRS-4: 21 September 2014. The capsule was subsequently reused on CRS-11. SpaceX CRS-5: 10 January 2015 SpaceX CRS-6: 14 April 2015 at 20:10:41 UTC SpaceX CRS-7: attempted on 28 June 2015. Launch failure 139 seconds after lift-off, IDA-1 destroyed. Investigation traced the accident to the failure of a strut inside the second stage's liquid-oxygen tank. NASA concluded that the most probable cause of the strut failure was a design error: instead of using a stainless-steel eye bolt made of aerospace-grade material, SpaceX chose an industrial-grade material without adequate screening and testing and overlooked the recommended safety margin. SpaceX CRS-8: 8 April 2016 SpaceX CRS-9: 18 July 2016 SpaceX CRS-10: 19 February 2017 SpaceX CRS-11: 3 June 2017 re-flew the CRS-4 capsule and was the 100th launch from LC-39A. The 2,708 kilograms of cargo included NICER. SpaceX CRS-12: 14 August 2017. First 'Block 4' Falcon 9, 2,349 kg (5,179 lb) pressurized mass, 961 kg (2,119 lb) unpressurized (CREAM cosmic-ray detector). Last flight of a newly built Dragon capsule. SpaceX CRS-13: 15 December 2017 SpaceX CRS-14: 2 April 2018 SpaceX CRS-15: 29 June 2018 SpaceX CRS-16: 5 December 2018 SpaceX CRS-17: 4 May 2019 SpaceX CRS-18: 25 July 2019 SpaceX CRS-19: 5 December 2019 SpaceX CRS-20: 7 March 2020 Cygnus flights Cygnus CRS Orb-1: 9 January 2014 Cygnus CRS Orb-2: 13 July 2014 Cygnus CRS Orb-3: 28 October 2014 - launch failure, food and care packages for the crew, parts, experiments, and the Arkyd-3 Flight Test (Non-optical) Satellite from Planetary Resources lost. Following the failure, the Antares 230 system was upgraded with newly built RD-181 first-stage engines to provide greater payload performance and increased reliability. The next two spacecraft were launched on the Atlas V, with the switch to more powerful launch vehicles and the introduction of Enhanced Cygnus enabling Orbital ATK to cover their initial CRS contracted payload obligation by OA-7. Cygnus CRS OA-4: 6 December 2015 - Atlas V, first Enhanced Cygnus Cygnus CRS OA-6: 23 March 2016 - Atlas V Cygnus CRS OA-5: 17 October 2016 - Antares 230 Cygnus CRS OA-7: 18 April 2017 - Atlas V During August 2015, Orbital ATK disclosed that they had received an extension of the resupply program for four extra missions. These flights enable NASA to cover ISS resupply needs until CRS-2 begins. Cygnus CRS OA-8E: 12 November 2017. Cygnus CRS OA-9E: 21 May 2018. Cygnus NG-10: 17 November 2018. Cygnus NG-11: 17 April 2019. CRS Phase 2 solicitation and requirements NASA began a formal process to initiate Phase 2 of the Commercial Resupply Services, or CRS-2, in early 2014. Later that year, an "Industry Day" was held in Houston, with seven high-level requirements disclosed to interested parties. Requirements The contracts were expected to include a variety of requirements: delivery of approximately per year of pressurized cargo in four or five transport trips delivery of 24–30 powered lockers per year, requiring continuous power of up to 120 watts at 28 volts, cooling, and two-way communications delivery of approximately per year of unpressurized cargo, consisting of 3 to 8 items, each item requiring continuous power of up to 250 watts at 28 volts, cooling, and two-way communications return/disposal of approximately per year of pressurized cargo disposal of per year of unpressurized cargo, consisting of 3 to 8 items various ground support services Proposals CRS-1 contractors Orbital Sciences and SpaceX each submitted CRS-2 proposals, joined by Sierra Nevada, Boeing, and Lockheed Martin. SNC's proposal would use a cargo version of its Dream Chaser crew vehicle, the 'Dream Chaser Cargo System'. The proposed cargo Dream Chaser included an additional expendable cargo module for uplift and trash disposal. Downmass would only be provided via the Dream Chaser spaceplane itself. Boeing's proposal likewise used a cargo version of its CST-100 crew vehicle. Lockheed Martin proposed a new cargo spacecraft called Jupiter, derived from the designs of the NASA's MAVEN and Juno spacecraft. It would have included a robotic arm based on Canadarm technology and a diameter cargo transport module called Exoliner based on the Automated Transfer Vehicle, to be jointly developed with Thales Alenia Space. Awards Three companies were awarded contracts on January 14, 2016. Sierra Nevada Corporation's Dream Chaser, the SpaceX Dragon 2, and Orbital ATK Cygnus were selected, each for a minimum of six launches. The maximum potential value of all the contracts was indicated to be $14 billion, but the minimum value is considerably less. CRS-2 launches commenced in 2019 and will extend to at least 2024. Three more CRS-2 missions for Dragon 2 covering up to CRS-29 were announced in December 2020. Commercial Resupply Services phase 2 - Awards and flights flown When NASA issued the CRS-2 request for proposal (RFP) in September 2014, it received interest from five companies – Lockheed Martin Corporation (Lockheed Martin), Boeing, Orbital ATK, Sierra Nevada, and SpaceX. NASA made a competitive range determination to remove Boeing and Lockheed Martin. Orbital ATK, Sierra Nevada, and SpaceX were awarded CRS-2 contracts in January 2016 with initial task orders awarded in June 2016. Each of the three companies is guaranteed at least six (6) cargo missions under the CRS-2 contract. As of December 2017, NASA had awarded $2.6 billion on three contracts with a combined, not-to-exceed value of $14 billion. NASA officials explained that selecting three companies rather than two for CRS-2 increases cargo capabilities and ensures more redundancy in the event of a contractor failure or schedule delay. The CRS-2 flights commenced in November 2019 with the launch of Cygnus NG-12 mission. Inside-cargo is typically transported to and from the space station in "the form factor of single Cargo Transfer Bag Equivalent (CTBE) [which is the] unit for size of bag used to transport cargo from visiting vehicles, such as SpaceX Dragon, Northrop Grumman Cygnus, or JAXA H-II Transfer Vehicle (HTV). The bags are sized at and limited in transport mass to each. CTBE units are also used to price, and charge, commercial users of US Orbital Segment stowage space. Cygnus flights Cygnus NG-12: 2 November 2019 Cygnus NG-13: 15 February 2020 Cygnus NG-14: 3 October 2020 Cygnus NG-15: 20 February 2021 Cygnus NG-16: 10 August 2021 Cygnus NG-17: 19 February 2022 Cygnus NG-18: 7 November 2022 Cygnus NG-19: 2 August 2023 As a result Russia's invasion of Ukraine, Northrop Grumman was left with only two remaining Antares 230+ launch vehicles which were used for the NG-18 and NG-19 missions. Northrop Grumman acquired three flights from SpaceX with the Falcon 9 rocket while a replacement first stage and its engine are developed for its Antares 330 rocket. Cygnus NG-20: 2023 (planned) Cygnus NG-21: 2024 (planned) Cygnus NG-22: 2024 (planned) Northrop Grumman plans to launch further missions using the new Antares 300 series (Antares 330) rockets with booster stage and engines developed by Firefly Aerospace. Cygnus NG-23 to NG-25: 2025–2026 (planned) Cargo Dragon flights SpaceX CRS-21: 6 December 2020 SpaceX CRS-22: 3 June 2021 SpaceX CRS-23: 29 August 2021 SpaceX CRS-24: 21 December 2021 SpaceX CRS-25: 15 July 2022 SpaceX CRS-26: 26 November 2022 SpaceX CRS-27: 14 March 2023 SpaceX CRS-28: 5 June 2023 SpaceX CRS-29: October 2023 (planned) SpaceX CRS-30 to CRS-35: 2024–2026 (planned) Cargo Dream Chaser flights SNC Demo-1: 2024 (second flight of Vulcan) SNC 1: Q1 2024 SNC 2: 2024 SNC 3: 2025 SNC 4: 2025 SNC 5: 2026 SNC 6: 2027 See also Cargo spacecraft Commercial Crew Development (CCDev) – development of crew vehicles Commercial Orbital Transportation Services Comparison of space station cargo vehicles Dream Chaser Cygnus (spacecraft) Crew Dragon Multi-Purpose Logistics Module (STS cargo container) Notes References External links NASA Commercial Crew and Cargo webpage SpaceX (Space Exploration Technologies Corporation) OSC (Orbital Sciences Corporation) CRS contracts and Space Act agreements Private spaceflight International Space Station NASA programs Spaceflight
```css `currentColor` improves code reusability Use pseudo-classes to describe a special state of an element Adjacent sibling selector Debug with `*` selector Conditional comments ```
```javascript var withBase64 = require('./source-map-base64.js'); var withMap = require('./source-map-external.js'); console.log(withBase64()); console.log(withMap.default()); console.log("Hello") ```
```html <!DOCTYPE html> <html class="writer-html5" lang="en" > <head> <meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: path_to_url" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Deploying Web Applications in the Cloud &mdash; Ring 1.21 documentation</title> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="_static/css/custom.css" type="text/css" /> <!--[if lt IE 9]> <script src="_static/js/html5shiv.min.js"></script> <![endif]--> <script src="_static/jquery.js"></script> <script src="_static/_sphinx_javascript_frameworks_compat.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/doctools.js"></script> <script src="_static/sphinx_highlight.js"></script> <script src="_static/js/theme.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="Graphics and 2D Games programming using RingAllegro" href="allegro.html" /> <link rel="prev" title="Web Development (CGI Library)" href="web.html" /> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href="index.html"> <img src="_static/ringdoclogo.jpg" class="logo" alt="Logo"/> </a> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="ringapps.html">Applications developed in a few hours</a></li> <li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="ringnotepad.html">Using Ring Notepad</a></li> <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started - First Style</a></li> <li class="toctree-l1"><a class="reference internal" href="getting_started2.html">Getting Started - Second Style</a></li> <li class="toctree-l1"><a class="reference internal" href="getting_started3.html">Getting Started - Third Style</a></li> <li class="toctree-l1"><a class="reference internal" href="variables.html">Variables</a></li> <li class="toctree-l1"><a class="reference internal" href="operators.html">Operators</a></li> <li class="toctree-l1"><a class="reference internal" href="controlstructures.html">Control Structures - First Style</a></li> <li class="toctree-l1"><a class="reference internal" href="controlstructures2.html">Control Structures - Second Style</a></li> <li class="toctree-l1"><a class="reference internal" href="controlstructures3.html">Control Structures - Third Style</a></li> <li class="toctree-l1"><a class="reference internal" href="getinput.html">Getting Input</a></li> <li class="toctree-l1"><a class="reference internal" href="functions.html">Functions - First Style</a></li> <li class="toctree-l1"><a class="reference internal" href="functions2.html">Functions - Second Style</a></li> <li class="toctree-l1"><a class="reference internal" href="functions3.html">Functions - Third Style</a></li> <li class="toctree-l1"><a class="reference internal" href="programstructure.html">Program Structure</a></li> <li class="toctree-l1"><a class="reference internal" href="lists.html">Lists</a></li> <li class="toctree-l1"><a class="reference internal" href="strings.html">Strings</a></li> <li class="toctree-l1"><a class="reference internal" href="dateandtime.html">Date and Time</a></li> <li class="toctree-l1"><a class="reference internal" href="checkandconvert.html">Check Data Type and Conversion</a></li> <li class="toctree-l1"><a class="reference internal" href="mathfunc.html">Mathematical Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="files.html">Files</a></li> <li class="toctree-l1"><a class="reference internal" href="systemfunc.html">System Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="evaldebug.html">Eval() and Debugging</a></li> <li class="toctree-l1"><a class="reference internal" href="demo.html">Demo Programs</a></li> <li class="toctree-l1"><a class="reference internal" href="odbc.html">ODBC Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="mysql.html">MySQL Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="sqlite.html">SQLite Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="postgresql.html">PostgreSQL Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="secfunc.html">Security and Internet Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="oop.html">Object Oriented Programming (OOP)</a></li> <li class="toctree-l1"><a class="reference internal" href="fp.html">Functional Programming (FP)</a></li> <li class="toctree-l1"><a class="reference internal" href="metaprog.html">Reflection and Meta-programming</a></li> <li class="toctree-l1"><a class="reference internal" href="declarative.html">Declarative Programming using Nested Structures</a></li> <li class="toctree-l1"><a class="reference internal" href="natural.html">Natural language programming</a></li> <li class="toctree-l1"><a class="reference internal" href="naturallibrary.html">Using the Natural Library</a></li> <li class="toctree-l1"><a class="reference internal" href="scope.html">Scope Rules for Variables and Attributes</a></li> <li class="toctree-l1"><a class="reference internal" href="scope2.html">Scope Rules for Functions and Methods</a></li> <li class="toctree-l1"><a class="reference internal" href="syntaxflexibility.html">Syntax Flexibility</a></li> <li class="toctree-l1"><a class="reference internal" href="typehints.html">The Type Hints Library</a></li> <li class="toctree-l1"><a class="reference internal" href="debug.html">The Trace Library and the Interactive Debugger</a></li> <li class="toctree-l1"><a class="reference internal" href="ringemb.html">Embedding Ring Language in Ring Programs</a></li> <li class="toctree-l1"><a class="reference internal" href="stdlib.html">Stdlib Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="stdlibclasses.html">Stdlib Classes</a></li> <li class="toctree-l1"><a class="reference internal" href="qt.html">Desktop, WebAssembly and Mobile development using RingQt</a></li> <li class="toctree-l1"><a class="reference internal" href="formdesigner.html">Using the Form Designer</a></li> <li class="toctree-l1"><a class="reference internal" href="qt3d.html">Graphics Programming using RingQt3D</a></li> <li class="toctree-l1"><a class="reference internal" href="ringqtobjects.html">Objects Library for RingQt Application</a></li> <li class="toctree-l1"><a class="reference internal" href="multilanguage.html">Multi-language Applications</a></li> <li class="toctree-l1"><a class="reference internal" href="qtmobile.html">Building RingQt Applications for Mobile</a></li> <li class="toctree-l1"><a class="reference internal" href="qtwebassembly.html">Building RingQt Applications for WebAssembly</a></li> <li class="toctree-l1"><a class="reference internal" href="web.html">Web Development (CGI Library)</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Deploying Web Applications in the Cloud</a><ul> <li class="toctree-l2"><a class="reference internal" href="#introduction">Introduction</a></li> <li class="toctree-l2"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l2"><a class="reference internal" href="#ring-source-code-files-and-permissions">Ring source code files and permissions</a></li> <li class="toctree-l2"><a class="reference internal" href="#hello-world-program">Hello World program</a></li> <li class="toctree-l2"><a class="reference internal" href="#application-database">Application Database</a></li> <li class="toctree-l2"><a class="reference internal" href="#deploying-after-updates">Deploying after updates</a></li> <li class="toctree-l2"><a class="reference internal" href="#local-tests">Local Tests</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="allegro.html">Graphics and 2D Games programming using RingAllegro</a></li> <li class="toctree-l1"><a class="reference internal" href="gameengine.html">Demo Project - Game Engine for 2D Games</a></li> <li class="toctree-l1"><a class="reference internal" href="gameengineandorid.html">Building Games For Android</a></li> <li class="toctree-l1"><a class="reference internal" href="ringraylib.html">Developing Games using RingRayLib</a></li> <li class="toctree-l1"><a class="reference internal" href="usingopengl.html">Using RingOpenGL and RingFreeGLUT for 3D Graphics</a></li> <li class="toctree-l1"><a class="reference internal" href="usingopengl2.html">Using RingOpenGL and RingAllegro for 3D Graphics</a></li> <li class="toctree-l1"><a class="reference internal" href="goldmagic800.html">Demo Project - The Gold Magic 800 Game</a></li> <li class="toctree-l1"><a class="reference internal" href="tilengine.html">Using RingTilengine</a></li> <li class="toctree-l1"><a class="reference internal" href="performancetips.html">Performance Tips</a></li> <li class="toctree-l1"><a class="reference internal" href="compiler.html">Command Line Options</a></li> <li class="toctree-l1"><a class="reference internal" href="distribute.html">Distributing Ring Applications (Manual)</a></li> <li class="toctree-l1"><a class="reference internal" href="distribute_ring2exe.html">Distributing Ring Applications using Ring2EXE</a></li> <li class="toctree-l1"><a class="reference internal" href="ringpm.html">The Ring Package Manager (RingPM)</a></li> <li class="toctree-l1"><a class="reference internal" href="zerolib.html">ZeroLib Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="foxringfuncsdoc.html">FoxRing Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="bignumber.html">BigNumber Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="csvlib.html">CSVLib Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="jsonlib.html">JSONLib Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="httplib.html">HTTPLib Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="tokenslib.html">TokensLib Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="libcurl.html">Using RingLibCurl</a></li> <li class="toctree-l1"><a class="reference internal" href="ringlibcurlfuncsdoc.html">RingLibCurl Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="socket.html">Using RingSockets</a></li> <li class="toctree-l1"><a class="reference internal" href="threads.html">Using RingThreads</a></li> <li class="toctree-l1"><a class="reference internal" href="libui.html">Using RingLibui</a></li> <li class="toctree-l1"><a class="reference internal" href="ringzip.html">Using RingZip</a></li> <li class="toctree-l1"><a class="reference internal" href="ringlibzipfuncsdoc.html">RingLibZip Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="ringmurmurhashfuncsdoc.html">RingMurmurHash Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="ringconsolecolorsfuncsdoc.html">RingConsoleColors Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="usingrogueutil.html">Using RingRogueUtil</a></li> <li class="toctree-l1"><a class="reference internal" href="ringallegrofuncsdoc.html">RingAllegro Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="libsdl.html">Using RingLibSDL</a></li> <li class="toctree-l1"><a class="reference internal" href="ringlibsdlfuncsdoc.html">RingLibSDL Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="libuv.html">Using Ringlibuv</a></li> <li class="toctree-l1"><a class="reference internal" href="ringlibuvfuncsdoc.html">RingLibuv Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="ringfreeglutfuncsdoc.html">RingFreeGLUT Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="ringstbimage.html">RingStbImage Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="ringopengl32funcsdoc.html">RingOpenGL (OpenGL 3.2) Functions Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="qtclassesdoc.html">RingQt Classes and Methods Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="usingfastpro.html">Using FastPro Extension</a></li> <li class="toctree-l1"><a class="reference internal" href="usingref.html">Using References</a></li> <li class="toctree-l1"><a class="reference internal" href="lowlevel.html">Low Level Functions</a></li> <li class="toctree-l1"><a class="reference internal" href="extension_tutorial.html">Tutorial: Ring Extensions in C/C++</a></li> <li class="toctree-l1"><a class="reference internal" href="extension.html">Extension using the C/C++ languages</a></li> <li class="toctree-l1"><a class="reference internal" href="embedding.html">Embedding Ring Language in C/C++ Programs</a></li> <li class="toctree-l1"><a class="reference internal" href="codegenerator.html">Code Generator for wrapping C/C++ Libraries</a></li> <li class="toctree-l1"><a class="reference internal" href="ringbeep.html">Create your first extension using the Code Generator</a></li> <li class="toctree-l1"><a class="reference internal" href="languagedesign.html">Release Notes: Version 1.0</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew.html">Release Notes: Version 1.1</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew2.html">Release Notes: Version 1.2</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew3.html">Release Notes: Version 1.3</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew4.html">Release Notes: Version 1.4</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew5.html">Release Notes: Version 1.5</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew6.html">Release Notes: Version 1.6</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew7.html">Release Notes: Version 1.7</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew8.html">Release Notes: Version 1.8</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew9.html">Release Notes: Version 1.9</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew10.html">Release Notes: Version 1.10</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew11.html">Release Notes: Version 1.11</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew12.html">Release Notes: Version 1.12</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew13.html">Release Notes: Version 1.13</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew14.html">Release Notes: Version 1.14</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew15.html">Release Notes: Version 1.15</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew16.html">Release Notes: Version 1.16</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew17.html">Release Notes: Version 1.17</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew18.html">Release Notes: Version 1.18</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew19.html">Release Notes: Version 1.19</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew20.html">Release Notes: Version 1.20</a></li> <li class="toctree-l1"><a class="reference internal" href="whatisnew21.html">Release Notes: Version 1.21</a></li> <li class="toctree-l1"><a class="reference internal" href="codeeditors.html">Using Other Code Editors</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions (FAQ)</a></li> <li class="toctree-l1"><a class="reference internal" href="sourcecode.html">Building From Source Code</a></li> <li class="toctree-l1"><a class="reference internal" href="contribute.html">How to contribute?</a></li> <li class="toctree-l1"><a class="reference internal" href="reference.html">Language Specification</a></li> <li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">Ring</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li> <li class="breadcrumb-item active">Deploying Web Applications in the Cloud</li> <li class="wy-breadcrumbs-aside"> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="path_to_url"> <div itemprop="articleBody"> <section id="deploying-web-applications-in-the-cloud"> <span id="index-0"></span><h1>Deploying Web Applications in the Cloud<a class="headerlink" href="#deploying-web-applications-in-the-cloud" title="Permalink to this heading"></a></h1> <p>In this chapter we will learn about deploying Ring Web Applications in the Cloud using Heroku</p> <section id="introduction"> <span id="index-1"></span><h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this heading"></a></h2> <p>We created a new project and tutorial to explain how to deploy Ring web applications in the Cloud using Heroku</p> <p>Project : <a class="reference external" href="path_to_url">path_to_url <p>Heroku Website : <a class="reference external" href="path_to_url">path_to_url <img alt="Ring Web Application in the Cloud" src="_images/ringincloud.png" /> </section> <section id="usage"> <span id="index-2"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this heading"></a></h2> <p>To use this project and deploy it on Heroku</p> <ol class="arabic simple"> <li><p>Create Heroku account</p></li> <li><p>Open your Heroku account and create new application</p></li> </ol> <p>Example : testring</p> <p>Note (You have to select a unique name for your application)</p> <ol class="arabic simple" start="3"> <li><p>Open the command prompt, Create new folder : MyApp</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>md MyApp </pre></div> </div> <ol class="arabic simple" start="4"> <li><p>Open the application folder</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd MyApp </pre></div> </div> <ol class="arabic simple" start="5"> <li><p>Clone this project using Git (Dont forget the dot in the end to clone in the current directory)</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git clone path_to_url . </pre></div> </div> <ol class="arabic simple" start="6"> <li><p>Login to Heroku (Enter your Email and Password)</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>heroku login </pre></div> </div> <ol class="arabic simple" start="7"> <li><p>Add heroku (remote) to your Git project</p></li> </ol> <p>change testring to your application name</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>heroku git:remote -a testring </pre></div> </div> <ol class="arabic simple" start="8"> <li><p>Set the buildpacks (So Heroku can know how to support your project)</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>heroku buildpacks:add --index 1 path_to_url heroku buildpacks:add --index 2 path_to_url </pre></div> </div> <ol class="arabic simple" start="9"> <li><p>Now build your project and deploy it</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git push heroku master </pre></div> </div> <ol class="arabic simple" start="10"> <li><p>Test your project (In the browser)</p></li> </ol> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>heroku open </pre></div> </div> </section> <section id="ring-source-code-files-and-permissions"> <span id="index-3"></span><h2>Ring source code files and permissions<a class="headerlink" href="#ring-source-code-files-and-permissions" title="Permalink to this heading"></a></h2> <p>To be able to run your new Ring scripts, Set the permission of the file to be executable using Git</p> <p>For example, if you created a file : myscript.ring</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git update-index --chmod=+x myscript.ring git commit -m &quot;Update file permission&quot; </pre></div> </div> <p>If you are using TortoiseGit, From windows explorer, select the file</p> <p>Right click &gt; Properties &gt; Git &gt; Executable (+x)</p> <p>Then commit and deploy!</p> </section> <section id="hello-world-program"> <span id="index-4"></span><h2>Hello World program<a class="headerlink" href="#hello-world-program" title="Permalink to this heading"></a></h2> <p>file : ringapp/helloworld.ring</p> <div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="c">#!/app/runring.sh -cgi</span> <span class="k">see</span> <span class="s">&quot;content-type: text/html&quot;</span> <span class="o">+</span><span class="n">nl</span><span class="o">+</span><span class="n">nl</span> <span class="k">see</span> <span class="s">&quot;Hello, World!&quot;</span> <span class="o">+</span> <span class="n">nl</span> </pre></div> </div> <p>file : ringapp/helloworld2.ring</p> <div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="c">#!/app/runring.sh -cgi</span> <span class="k">load</span> <span class="s">&quot;weblib.ring&quot;</span> <span class="k">import</span> <span class="n">System</span><span class="p">.</span><span class="n">Web</span> <span class="k">new</span> <span class="n">page</span> <span class="p">{</span> <span class="n">text</span><span class="p">(</span><span class="s">&quot;Hello, World!&quot;</span><span class="p">)</span> <span class="p">}</span> </pre></div> </div> </section> <section id="application-database"> <span id="index-5"></span><h2>Application Database<a class="headerlink" href="#application-database" title="Permalink to this heading"></a></h2> <p>When you deploy the application, Everything will works directly!</p> <p>No change is required, but in practice, You will need to update the next files to use your database</p> <p>There are two scripts to interact with the database (We are using PostgreSQL in the cloud)</p> <p>You will need to update the connection string in these files if you will use another database</p> <ul class="simple"> <li><p>file: ringapp/database/newdb.ring (We run it using the browser for one time to create the tables)</p></li> <li><p>file: ringapp/datalib.ring (Class: Database)</p></li> </ul> <p>In your practical projects, You can write better code (To be able to change the database)</p> <p>Also you can create configuration file (To write the connection string in one place)</p> <p>Database service : <a class="reference external" href="path_to_url">path_to_url </section> <section id="deploying-after-updates"> <span id="index-6"></span><h2>Deploying after updates<a class="headerlink" href="#deploying-after-updates" title="Permalink to this heading"></a></h2> <p>Just use Git and commit then push to heroku</p> <p>file: build.bat contains the next commands for quick tests</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git add . git commit -m &quot;Update RingWebAppOnHeroku&quot; git push heroku master heroku open </pre></div> </div> </section> <section id="local-tests"> <span id="index-7"></span><h2>Local Tests<a class="headerlink" href="#local-tests" title="Permalink to this heading"></a></h2> <p>Local tests using Ring Notepad on Windows (Using local Apache Web Server)</p> <p>Replace the first line in the file : ringapp/index.ring with</p> <div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="c">#!ring -cgi</span> </pre></div> </div> <p>Then run it from Ring Notepad (Ctrl+F6)</p> </section> </section> </div> </div> <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> <a href="web.html" class="btn btn-neutral float-left" title="Web Development (CGI Library)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> <a href="allegro.html" class="btn btn-neutral float-right" title="Graphics and 2D Games programming using RingAllegro" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> </div> <hr/> <div role="contentinfo"> </div> Built with <a href="path_to_url">Sphinx</a> using a <a href="path_to_url">theme</a> provided by <a href="path_to_url">Read the Docs</a>. </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(false); }); </script> </body> </html> ```
```objective-c /* $OpenBSD: if_ralreg.h,v 1.14 2019/01/13 14:27:15 mpi Exp $ */ /*- * Damien Bergamini <damien.bergamini@free.fr> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define RAL_RX_DESC_SIZE (sizeof (struct ural_rx_desc)) #define RAL_TX_DESC_SIZE (sizeof (struct ural_tx_desc)) #define RAL_CONFIG_NO 1 #define RAL_IFACE_NO 0 #define RAL_WRITE_MAC 0x02 #define RAL_READ_MAC 0x03 #define RAL_WRITE_MULTI_MAC 0x06 #define RAL_READ_MULTI_MAC 0x07 #define RAL_READ_EEPROM 0x09 /* * MAC registers. */ #define RAL_MAC_CSR0 0x0400 /* ASIC Version */ #define RAL_MAC_CSR1 0x0402 /* System control */ #define RAL_MAC_CSR2 0x0404 /* MAC addr0 */ #define RAL_MAC_CSR3 0x0406 /* MAC addr1 */ #define RAL_MAC_CSR4 0x0408 /* MAC addr2 */ #define RAL_MAC_CSR5 0x040a /* BSSID0 */ #define RAL_MAC_CSR6 0x040c /* BSSID1 */ #define RAL_MAC_CSR7 0x040e /* BSSID2 */ #define RAL_MAC_CSR8 0x0410 /* Max frame length */ #define RAL_MAC_CSR9 0x0412 /* Timer control */ #define RAL_MAC_CSR10 0x0414 /* Slot time */ #define RAL_MAC_CSR11 0x0416 /* IFS */ #define RAL_MAC_CSR12 0x0418 /* EIFS */ #define RAL_MAC_CSR13 0x041a /* Power mode0 */ #define RAL_MAC_CSR14 0x041c /* Power mode1 */ #define RAL_MAC_CSR15 0x041e /* Power saving transition0 */ #define RAL_MAC_CSR16 0x0420 /* Power saving transition1 */ #define RAL_MAC_CSR17 0x0422 /* Power state control */ #define RAL_MAC_CSR18 0x0424 /* Auto wake-up control */ #define RAL_MAC_CSR19 0x0426 /* GPIO control */ #define RAL_MAC_CSR20 0x0428 /* LED control0 */ #define RAL_MAC_CSR22 0x042c /* XXX not documented */ /* * Tx/Rx Registers. */ #define RAL_TXRX_CSR0 0x0440 /* Security control */ #define RAL_TXRX_CSR2 0x0444 /* Rx control */ #define RAL_TXRX_CSR5 0x044a /* CCK Tx BBP ID0 */ #define RAL_TXRX_CSR6 0x044c /* CCK Tx BBP ID1 */ #define RAL_TXRX_CSR7 0x044e /* OFDM Tx BBP ID0 */ #define RAL_TXRX_CSR8 0x0450 /* OFDM Tx BBP ID1 */ #define RAL_TXRX_CSR10 0x0454 /* Auto responder control */ #define RAL_TXRX_CSR11 0x0456 /* Auto responder basic rate */ #define RAL_TXRX_CSR18 0x0464 /* Beacon interval */ #define RAL_TXRX_CSR19 0x0466 /* Beacon/sync control */ #define RAL_TXRX_CSR20 0x0468 /* Beacon alignment */ #define RAL_TXRX_CSR21 0x046a /* XXX not documented */ /* * Security registers. */ #define RAL_SEC_CSR0 0x0480 /* Shared key 0, word 0 */ /* * PHY registers. */ #define RAL_PHY_CSR2 0x04c4 /* Tx MAC configuration */ #define RAL_PHY_CSR4 0x04c8 /* Interface configuration */ #define RAL_PHY_CSR5 0x04ca /* BBP Pre-Tx CCK */ #define RAL_PHY_CSR6 0x04cc /* BBP Pre-Tx OFDM */ #define RAL_PHY_CSR7 0x04ce /* BBP serial control */ #define RAL_PHY_CSR8 0x04d0 /* BBP serial status */ #define RAL_PHY_CSR9 0x04d2 /* RF serial control0 */ #define RAL_PHY_CSR10 0x04d4 /* RF serial control1 */ /* * Statistics registers. */ #define RAL_STA_CSR0 0x04e0 /* FCS error */ #define RAL_DISABLE_RX (1 << 0) #define RAL_DROP_CRC_ERROR (1 << 1) #define RAL_DROP_PHY_ERROR (1 << 2) #define RAL_DROP_CTL (1 << 3) #define RAL_DROP_NOT_TO_ME (1 << 4) #define RAL_DROP_TODS (1 << 5) #define RAL_DROP_VERSION_ERROR (1 << 6) #define RAL_DROP_MULTICAST (1 << 9) #define RAL_DROP_BROADCAST (1 << 10) #define RAL_SHORT_PREAMBLE (1 << 2) #define RAL_RESET_ASIC (1 << 0) #define RAL_RESET_BBP (1 << 1) #define RAL_HOST_READY (1 << 2) #define RAL_ENABLE_TSF (1 << 0) #define RAL_ENABLE_TSF_SYNC(x) (((x) & 0x3) << 1) #define RAL_ENABLE_TBCN (1 << 3) #define RAL_ENABLE_BEACON_GENERATOR (1 << 4) #define RAL_RF_AWAKE (3 << 7) #define RAL_BBP_AWAKE (3 << 5) #define RAL_BBP_WRITE (1 << 15) #define RAL_BBP_BUSY (1 << 0) #define RAL_RF1_AUTOTUNE 0x08000 #define RAL_RF3_AUTOTUNE 0x00040 #define RAL_RF_2522 0x00 #define RAL_RF_2523 0x01 #define RAL_RF_2524 0x02 #define RAL_RF_2525 0x03 #define RAL_RF_2525E 0x04 #define RAL_RF_2526 0x05 /* dual-band RF */ #define RAL_RF_5222 0x10 #define RAL_BBP_VERSION 0 #define RAL_BBP_TX 2 #define RAL_BBP_RX 14 #define RAL_BBP_ANTA 0x00 #define RAL_BBP_DIVERSITY 0x01 #define RAL_BBP_ANTB 0x02 #define RAL_BBP_ANTMASK 0x03 #define RAL_BBP_FLIPIQ 0x04 #define RAL_JAPAN_FILTER 0x08 struct ural_tx_desc { uint32_t flags; #define RAL_TX_RETRY(x) ((x) << 4) #define RAL_TX_MORE_FRAG (1 << 8) #define RAL_TX_NEED_ACK (1 << 9) #define RAL_TX_TIMESTAMP (1 << 10) #define RAL_TX_OFDM (1 << 11) #define RAL_TX_NEWSEQ (1 << 12) #define RAL_TX_IFS_MASK 0x00006000 #define RAL_TX_IFS_BACKOFF (0 << 13) #define RAL_TX_IFS_SIFS (1 << 13) #define RAL_TX_IFS_NEWBACKOFF (2 << 13) #define RAL_TX_IFS_NONE (3 << 13) uint16_t wme; #define RAL_LOGCWMAX(x) (((x) & 0xf) << 12) #define RAL_LOGCWMIN(x) (((x) & 0xf) << 8) #define RAL_AIFSN(x) (((x) & 0x3) << 6) #define RAL_IVOFFSET(x) (((x) & 0x3f)) uint16_t reserved; uint8_t plcp_signal; uint8_t plcp_service; #define RAL_PLCP_LENGEXT 0x80 uint8_t plcp_length_lo; uint8_t plcp_length_hi; uint32_t iv; uint32_t eiv; } __packed; struct ural_rx_desc { uint32_t flags; #define RAL_RX_CRC_ERROR (1 << 5) #define RAL_RX_OFDM (1 << 6) #define RAL_RX_PHY_ERROR (1 << 7) uint8_t rate; uint8_t rssi; uint16_t reserved; uint32_t iv; uint32_t eiv; } __packed; #define RAL_RF_LOBUSY (1 << 15) #define RAL_RF_BUSY (1U << 31) #define RAL_RF_20BIT (20 << 24) #define RAL_RF1 0 #define RAL_RF2 2 #define RAL_RF3 1 #define RAL_RF4 3 #define RAL_EEPROM_MACBBP 0x0000 #define RAL_EEPROM_ADDRESS 0x0004 #define RAL_EEPROM_TXPOWER 0x003c #define RAL_EEPROM_CONFIG0 0x0016 #define RAL_EEPROM_BBP_BASE 0x001c /* * Default values for MAC registers; values taken from the reference driver. */ #define RAL_DEF_MAC \ { RAL_TXRX_CSR5, 0x8c8d }, \ { RAL_TXRX_CSR6, 0x8b8a }, \ { RAL_TXRX_CSR7, 0x8687 }, \ { RAL_TXRX_CSR8, 0x0085 }, \ { RAL_MAC_CSR13, 0x1111 }, \ { RAL_MAC_CSR14, 0x1e11 }, \ { RAL_TXRX_CSR21, 0xe78f }, \ { RAL_MAC_CSR9, 0xff1d }, \ { RAL_MAC_CSR11, 0x0002 }, \ { RAL_MAC_CSR22, 0x0053 }, \ { RAL_MAC_CSR15, 0x0000 }, \ { RAL_MAC_CSR8, 0x0780 }, \ { RAL_TXRX_CSR19, 0x0000 }, \ { RAL_TXRX_CSR18, 0x005a }, \ { RAL_PHY_CSR2, 0x0000 }, \ { RAL_TXRX_CSR0, 0x1ec0 }, \ { RAL_PHY_CSR4, 0x000f } /* * Default values for BBP registers; values taken from the reference driver. */ #define RAL_DEF_BBP \ { 3, 0x02 }, \ { 4, 0x19 }, \ { 14, 0x1c }, \ { 15, 0x30 }, \ { 16, 0xac }, \ { 17, 0x48 }, \ { 18, 0x18 }, \ { 19, 0xff }, \ { 20, 0x1e }, \ { 21, 0x08 }, \ { 22, 0x08 }, \ { 23, 0x08 }, \ { 24, 0x80 }, \ { 25, 0x50 }, \ { 26, 0x08 }, \ { 27, 0x23 }, \ { 30, 0x10 }, \ { 31, 0x2b }, \ { 32, 0xb9 }, \ { 34, 0x12 }, \ { 35, 0x50 }, \ { 39, 0xc4 }, \ { 40, 0x02 }, \ { 41, 0x60 }, \ { 53, 0x10 }, \ { 54, 0x18 }, \ { 56, 0x08 }, \ { 57, 0x10 }, \ { 58, 0x08 }, \ { 61, 0x60 }, \ { 62, 0x10 }, \ { 75, 0xff } /* * Default values for RF register R2 indexed by channel numbers. */ #define RAL_RF2522_R2 \ { \ 0x307f6, 0x307fb, 0x30800, 0x30805, 0x3080a, 0x3080f, 0x30814, \ 0x30819, 0x3081e, 0x30823, 0x30828, 0x3082d, 0x30832, 0x3083e \ } #define RAL_RF2523_R2 \ { \ 0x00327, 0x00328, 0x00329, 0x0032a, 0x0032b, 0x0032c, 0x0032d, \ 0x0032e, 0x0032f, 0x00340, 0x00341, 0x00342, 0x00343, 0x00346 \ } #define RAL_RF2524_R2 \ { \ 0x00327, 0x00328, 0x00329, 0x0032a, 0x0032b, 0x0032c, 0x0032d, \ 0x0032e, 0x0032f, 0x00340, 0x00341, 0x00342, 0x00343, 0x00346 \ } #define RAL_RF2525_R2 \ { \ 0x20327, 0x20328, 0x20329, 0x2032a, 0x2032b, 0x2032c, 0x2032d, \ 0x2032e, 0x2032f, 0x20340, 0x20341, 0x20342, 0x20343, 0x20346 \ } #define RAL_RF2525_HI_R2 \ { \ 0x2032f, 0x20340, 0x20341, 0x20342, 0x20343, 0x20344, 0x20345, \ 0x20346, 0x20347, 0x20348, 0x20349, 0x2034a, 0x2034b, 0x2034e \ } #define RAL_RF2525E_R2 \ { \ 0x2044d, 0x2044e, 0x2044f, 0x20460, 0x20461, 0x20462, 0x20463, \ 0x20464, 0x20465, 0x20466, 0x20467, 0x20468, 0x20469, 0x2046b \ } #define RAL_RF2526_HI_R2 \ { \ 0x0022a, 0x0022b, 0x0022b, 0x0022c, 0x0022c, 0x0022d, 0x0022d, \ 0x0022e, 0x0022e, 0x0022f, 0x0022d, 0x00240, 0x00240, 0x00241 \ } #define RAL_RF2526_R2 \ { \ 0x00226, 0x00227, 0x00227, 0x00228, 0x00228, 0x00229, 0x00229, \ 0x0022a, 0x0022a, 0x0022b, 0x0022b, 0x0022c, 0x0022c, 0x0022d \ } ```
```haskell -- editorconfig-checker-disable-file {-# LANGUAGE BlockArguments #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE ViewPatterns #-} -- | Various analyses of events in mainnet script dumps. module Main (main) where import LoadScriptEvents (eventsOf, loadEvents) import PlutusCore.Data as Data (Data (..)) import PlutusCore.Default (DefaultUni (DefaultUniData), Some (..), ValueOf (..)) import PlutusCore.Evaluation.Machine.CostStream (sumCostStream) import PlutusCore.Evaluation.Machine.ExMemoryUsage (ExMemoryUsage, flattenCostRose, memoryUsage) import PlutusCore.Pretty (display) import PlutusLedgerApi.Common import PlutusLedgerApi.Test.EvaluationEvent import PlutusLedgerApi.V1 qualified as V1 import PlutusLedgerApi.V2 qualified as V2 import PlutusLedgerApi.V3 qualified as V3 import PlutusTx.AssocMap qualified as M import UntypedPlutusCore as UPLC import Control.Exception (throwIO) import Control.Lens hiding (List) import Control.Monad.Primitive (PrimState) import Control.Monad.Writer.Strict import Data.Int (Int64) import Data.List (find, intercalate) import Data.Primitive.PrimArray qualified as P import System.Directory.Extra (listFiles) import System.Environment (getArgs, getProgName) import System.FilePath (isExtensionOf, takeFileName) import System.IO (stderr) import Text.Printf (hPrintf, printf) -- | The type of a generic analysis function type EventAnalyser = EvaluationContext -> [Int64] -- cost parameters -> ScriptEvaluationEvent -> IO () -- Analyse values in ScriptContext -- Script purpose: this is the same for V1 and V2, but changes in V3 stringOfPurposeV1 :: V1.ScriptPurpose -> String stringOfPurposeV1 = \case V1.Minting _ -> "V1 Minting" -- Script arguments are [redeemer, context] V1.Spending _ -> "V1 Spending" -- Script arguments are [datum, redeemer, context] V1.Rewarding _ -> "V1 Rewarding" -- Script arguments appear to be [redeemer, context] V1.Certifying _ -> "V1 Certifying" -- Script arguments appear to be [redeemer, context] stringOfPurposeV2 :: V2.ScriptPurpose -> String stringOfPurposeV2 = \case V2.Minting _ -> "V2 Minting" V2.Spending _ -> "V2 Spending" V2.Rewarding _ -> "V2 Rewarding" V2.Certifying _ -> "V2 Certifying" stringOfPurposeV3 :: V3.ScriptInfo -> String stringOfPurposeV3 = \case V3.MintingScript{} -> "V3 Minting" V3.SpendingScript{} -> "V3 Spending" V3.RewardingScript{} -> "V3 Rewarding" V3.CertifyingScript{} -> "V3 Certifying" V3.VotingScript{} -> "V3 Voting" V3.ProposingScript{} -> "V3 Proposing" shapeOfValue :: V1.Value -> String shapeOfValue (V1.Value m) = let l = M.toList m in printf "[%d: %s]" (length l) (intercalate "," (fmap (printf "%d" . length . M.toList . snd) l)) analyseValue :: V1.Value -> IO () analyseValue v = do putStr $ shapeOfValue v printf "\n" analyseOutputs :: [a] -> (a -> V1.Value) -> IO () -- Luckily V1.Value is the same as V2.Value analyseOutputs outputs getValue = case outputs of [] -> putStrLn "No outputs" -- This happens in 0000000046344292-*.event l -> do putStr $ printf "Outputs %d " (length l) putStrLn $ intercalate ", " (fmap (shapeOfValue . getValue) l) analyseTxInfoV1 :: V1.TxInfo -> IO () analyseTxInfoV1 i = do putStr "Fee: " analyseValue $ V1.txInfoFee i putStr "Mint: " analyseValue $ V1.txInfoMint i analyseOutputs (V1.txInfoOutputs i) V1.txOutValue analyseTxInfoV2 :: V2.TxInfo -> IO () analyseTxInfoV2 i = do putStr "Fee: " analyseValue $ V2.txInfoFee i putStr "Mint: " analyseValue $ V2.txInfoMint i analyseOutputs (V2.txInfoOutputs i) V2.txOutValue analyseTxInfoV3 :: V3.TxInfo -> IO () analyseTxInfoV3 i = do putStr "Fee: " print $ V3.txInfoFee i putStr "Mint: " analyseValue $ V3.txInfoMint i analyseOutputs (V3.txInfoOutputs i) V3.txOutValue analyseScriptContext :: EventAnalyser analyseScriptContext _ctx _params ev = case ev of PlutusEvent PlutusV1 ScriptEvaluationData{..} _expected -> case dataInputs of [_,_,c] -> analyseCtxV1 c [_,c] -> analyseCtxV1 c l -> error $ printf "Unexpected number of V1 script arguments: %d" (length l) PlutusEvent PlutusV2 ScriptEvaluationData{..} _expected -> case dataInputs of [_,_,c] -> analyseCtxV2 c [_,c] -> analyseCtxV2 c l -> error $ printf "Unexpected number of V2 script arguments: %d" (length l) PlutusEvent PlutusV3 ScriptEvaluationData{..} _expected -> case dataInputs of [_,_,c] -> analyseCtxV3 c [_,c] -> analyseCtxV3 c l -> error $ printf "Unexpected number of V3 script arguments: %d" (length l) where analyseCtxV1 c = case V1.fromData @V1.ScriptContext c of Just p -> printV1info p Nothing -> do -- This really happens: there are V1 events in 0000000103367139-*.event with a V2 context putStrLn "\n* Failed to decode V1 ScriptContext for V1 event: trying V2" case V2.fromData @V2.ScriptContext c of Nothing -> putStrLn "* Failed to decode V2 ScriptContext for V1 event: giving up\n" Just p -> do putStrLn "* Successfully decoded V2 ScriptContext for V1 event" printV2info p analyseCtxV2 c = case V2.fromData @V2.ScriptContext c of Just p -> printV2info p Nothing -> do putStrLn "\n* Failed to decode V2 ScriptContext for V2 event: trying V1" case V1.fromData @V1.ScriptContext c of Nothing -> putStrLn "* Failed to decode V1 ScriptContext for V2 event: giving up\n" Just p -> do putStrLn "* Successfully decoded V1 ScriptContext for V2 event" printV1info p analyseCtxV3 c = case V3.fromData @V3.ScriptContext c of Just p -> printV3info p Nothing -> do putStrLn "\n* Failed to decode V3 ScriptContext for V3 event: trying V2" case V2.fromData @V2.ScriptContext c of Just p -> do putStrLn "* Successfully decoded V2 ScriptContext for V3 event" printV2info p Nothing -> putStrLn "* Failed to decode V3 ScriptContext for V2 event: trying V1\n" case V1.fromData @V1.ScriptContext c of Just p -> do putStrLn "* Successfully decoded V1 ScriptContext for V3 event" printV1info p Nothing -> putStrLn "* Failed to decode V1 ScriptContext for V3 event: giving up\n" printV1info p = do putStrLn "----------------" putStrLn $ stringOfPurposeV1 $ V1.scriptContextPurpose p analyseTxInfoV1 $ V1.scriptContextTxInfo p printV2info p = do putStrLn "----------------" putStrLn $ stringOfPurposeV2 $ V2.scriptContextPurpose p analyseTxInfoV2 $ V2.scriptContextTxInfo p printV3info p = do putStrLn "----------------" putStrLn $ stringOfPurposeV3 $ V3.scriptContextScriptInfo p analyseTxInfoV3 $ V3.scriptContextTxInfo p -- Data object analysis -- Statistics about a Data object data DataInfo = DataInfo { _memUsage :: Integer , _numNodes :: Integer , _depth :: Integer , _numInodes :: Integer , _maxIsize :: Integer -- Maximum memoryUsage of integers in I nodes , _totalIsize :: Integer -- Total memoryUsage of integers in I nodes , _numBnodes :: Integer , _maxBsize :: Integer -- Maximum memoryUsage of bytestrings in B nodes , _totalBsize :: Integer -- Total memoryUsage of bytestrings in B nodes , _numLnodes :: Integer , _maxLlen :: Integer -- Maximum list length , _numCnodes :: Integer , _maxClen :: Integer -- Maximum number of constructor arguments , _numMnodes :: Integer , _maxMlen :: Integer -- Maximum map length } deriving stock (Show) makeLenses ''DataInfo emptyInfo :: DataInfo emptyInfo = DataInfo 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- Memory usage as an Integer (in units of 64 bits / 8 bytes) memU :: ExMemoryUsage a => a -> Integer memU = fromSatInt . sumCostStream . flattenCostRose . memoryUsage -- Header (useful for R) printDataHeader :: IO () printDataHeader = printf "memUsage numNodes depth numI maxIsize totalIsize numB maxBsize totalBsize numL maxL numC maxC numM maxM\n" printDataInfo :: DataInfo -> IO () printDataInfo DataInfo{..} = printf "%4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d\n" _memUsage _numNodes _depth _numInodes _maxIsize _totalIsize _numBnodes _maxBsize _totalBsize _numLnodes _maxLlen _numCnodes _maxClen _numMnodes _maxMlen -- Traverse a Data object collecting information getDataInfo :: Data -> DataInfo getDataInfo d = let ilen = fromIntegral . length info = go d emptyInfo go x i = case x of I n -> i & numInodes +~ 1 & maxIsize %~ max s & totalIsize +~ s where s = memU n B b -> i & numBnodes +~ 1 & maxBsize %~ max s & totalBsize +~ s where s = memU b List l -> foldr go i' l where i' = i & numLnodes +~ 1 & maxLlen %~ max (ilen l) Data.Constr _ l -> foldr go i' l where i' = i & numCnodes %~ (+1) & maxClen %~ max (ilen l) Map l -> let (a,b) = unzip l in foldr go (foldr go i' a) b where i' = i & numMnodes +~ 1 & maxMlen %~ max (ilen l) getDepth = \case I _ -> 1 B _ -> 1 List l -> 1 + depthList l Data.Constr _ l -> 1 + depthList l Map l -> let (a,b) = unzip l in 1 + max (depthList a) (depthList b) depthList = foldl (\n a -> max n (getDepth a)) 0 totalNodes = sum $ info ^.. (numInodes <> numBnodes <> numLnodes <> numCnodes <> numMnodes) in info & memUsage .~ memU d & numNodes .~ totalNodes & depth .~ getDepth d printDataInfoFor :: Data -> IO () printDataInfoFor = printDataInfo <$> getDataInfo -- Analyse a redeemer (as a Data object) from a script evaluation event analyseRedeemer :: EventAnalyser analyseRedeemer _ctx _params ev = do case ev of PlutusEvent ledgerLanguage ScriptEvaluationData{..} _expected -> case dataInputs of [_d, r, _c] -> printDataInfoFor r [r, _c] -> printDataInfoFor r l -> printf "* Unexpected number of %s script arguments: %d" (show ledgerLanguage) (length l) -- Analyse a datum (as a Data object) from a script evaluation event analyseDatum :: EventAnalyser analyseDatum _ctx _params ev = do case ev of PlutusEvent ledgerLanguage ScriptEvaluationData{..} _expected -> case dataInputs of [d, _r, _c] -> printDataInfoFor d [_r, _c] -> pure () l -> printf "* Unexpected number of %s script arguments: %d" (show ledgerLanguage) (length l) -- Print statistics about Data objects in a Term analyseTermDataObjects :: Term NamedDeBruijn DefaultUni DefaultFun () -> IO () analyseTermDataObjects = go where go = \case Var _ _ -> pure () LamAbs _ _ t -> go t Apply _ t1 t2 -> go t1 >> go t2 Force _ t -> go t Delay _ t -> go t Constant _ c -> case c of Some (ValueOf DefaultUniData d) -> printDataInfoFor d _ -> pure () Builtin _ _ -> pure () Error _ -> pure () UPLC.Constr _ _ ts -> mapM_ go ts Case _ t1 t2 -> go t1 >> mapM_ go t2 -- Counting builtins type BuiltinCounts = P.MutablePrimArray (PrimState IO) Int countBuiltinsInTerm :: BuiltinCounts -> Term NamedDeBruijn DefaultUni DefaultFun () -> IO () countBuiltinsInTerm counts = go where go = \case Var _ _ -> pure () LamAbs _ _ t -> go t Apply _ t1 t2 -> go t1 >> go t2 Force _ t -> go t Delay _ t -> go t Constant _ _ -> pure () Builtin _ b -> incrCount $ fromEnum b Error _ -> pure () UPLC.Constr _ _ ts -> mapM_ go ts Case _ t1 t2 -> go t1 >> mapM_ go t2 incrCount i = do c <- P.readPrimArray counts i P.writePrimArray counts i (c+1) -- The other analyses just print out results as they proceed. It's a little -- more complicated here because we have to accumulate the results and print -- them out at the end. countBuiltins :: [FilePath] -> IO () countBuiltins eventFiles = do let numBuiltins = fromEnum (maxBound :: DefaultFun) - fromEnum (minBound :: DefaultFun) + 1 counts :: BuiltinCounts <- P.newPrimArray numBuiltins P.setPrimArray counts 0 numBuiltins 0 mapM_ (analyseOneFile (analyseUnappliedScript (countBuiltinsInTerm counts))) eventFiles finalCounts <- P.freezePrimArray counts 0 numBuiltins P.itraversePrimArray_ printEntry finalCounts where printEntry i = printf "%-35s %12d\n" (show (toEnum i :: DefaultFun)) data EvaluationResult = OK ExBudget | Failed | DeserialisationError -- Convert to a string for use in an R frame toRString :: EvaluationResult -> String toRString = \case OK _ -> "T" Failed -> "F" DeserialisationError -> "NA" -- Print out the actual and claimed CPU and memory cost of every script. analyseCosts :: EventAnalyser analyseCosts ctx _ ev = case ev of PlutusEvent PlutusV1 ScriptEvaluationData{..} _ -> let result = case deserialiseScript PlutusV1 dataProtocolVersion dataScript of Left _ -> DeserialisationError Right script -> case V1.evaluateScriptRestricting dataProtocolVersion V1.Quiet ctx dataBudget script dataInputs of (_, Left _) -> Failed (_, Right cost) -> OK cost in printCost result dataBudget PlutusEvent PlutusV2 ScriptEvaluationData{..} _ -> let result = case deserialiseScript PlutusV2 dataProtocolVersion dataScript of Left _ -> DeserialisationError Right script -> case V2.evaluateScriptRestricting dataProtocolVersion V2.Quiet ctx dataBudget script dataInputs of (_, Left _) -> Failed (_, Right cost) -> OK cost in printCost result dataBudget PlutusEvent PlutusV3 ScriptEvaluationData{..} _ -> do dataInput <- case dataInputs of [input] -> pure input _ -> throwIO $ userError "PlutusV3 script expects exactly one input" let result = case deserialiseScript PlutusV3 dataProtocolVersion dataScript of Left _ -> DeserialisationError Right script -> do case V3.evaluateScriptRestricting dataProtocolVersion V3.Quiet ctx dataBudget script dataInput of (_, Left _) -> Failed (_, Right cost) -> OK cost printCost result dataBudget where printCost :: EvaluationResult -> ExBudget -> IO () printCost result claimedCost = let (claimedCPU, claimedMem) = costAsInts claimedCost in case result of OK cost -> let (actualCPU, actualMem) = costAsInts cost in printf "%15d %15d %15d %15d %2s\n" actualCPU claimedCPU actualMem claimedMem (toRString result) -- Something went wrong; print the cost as "NA" ("Not Available" in R) so that R can -- still process it. _ -> printf "%15s %15d %15s %15d %2s\n" "NA" claimedCPU "NA" claimedMem (toRString result) costAsInts :: ExBudget -> (Int, Int) costAsInts (ExBudget (V2.ExCPU cpu) (V2.ExMemory mem)) = (fromSatInt cpu, fromSatInt mem) -- Extract the script from an evaluation event and apply some analysis function analyseUnappliedScript :: (Term NamedDeBruijn DefaultUni DefaultFun () -> IO ()) -> EventAnalyser analyseUnappliedScript analyse _ctx _params (PlutusEvent plutusLedgerLanguage ScriptEvaluationData{..} _expected) = case deserialiseScript plutusLedgerLanguage dataProtocolVersion dataScript of Left err -> print err Right (deserialisedScript -> ScriptNamedDeBruijn (Program _ _ t)) -> analyse t -- | Run some analysis function over the events from a single event dump file analyseOneFile :: EventAnalyser -> FilePath -> IO () analyseOneFile analyse eventFile = do events <- loadEvents eventFile printf "# %s\n" $ takeFileName eventFile -- Print the file in the output so we can narrow down the location of -- interesting/anomalous data. This may not be helpful for some of the -- analyses. case ( mkContext V1.mkEvaluationContext (eventsCostParamsV1 events) , mkContext V2.mkEvaluationContext (eventsCostParamsV2 events) , mkContext V3.mkEvaluationContext (eventsCostParamsV2 events) ) of (Right ctxV1, Right ctxV2, Right ctxV3) -> mapM_ (runSingleEvent ctxV1 ctxV2 ctxV3) (eventsOf events) (Left err, _, _) -> error $ display err (_, Left err, _) -> error $ display err (_, _, Left err) -> error $ display err where mkContext f = \case Nothing -> Right Nothing Just costParams -> Just . (,costParams) . fst <$> runWriterT (f costParams) runSingleEvent :: Maybe (EvaluationContext, [Int64]) -> Maybe (EvaluationContext, [Int64]) -> Maybe (EvaluationContext, [Int64]) -> ScriptEvaluationEvent -> IO () runSingleEvent ctxV1 ctxV2 ctxV3 event = case event of PlutusEvent PlutusV1 _ _ -> case ctxV1 of Just (ctx, params) -> analyse ctx params event Nothing -> putStrLn "*** ctxV1 missing ***" PlutusEvent PlutusV2 _ _ -> case ctxV2 of Just (ctx, params) -> analyse ctx params event Nothing -> putStrLn "*** ctxV2 missing ***" PlutusEvent PlutusV3 _ _ -> case ctxV3 of Just (ctx, params) -> analyse ctx params event Nothing -> putStrLn "*** ctxV3 missing ***" main :: IO () main = let analyses = [ ( "values" , "analyse shapes of Values" , doAnalysis analyseScriptContext ) , ( "redeemers" , "print statistics about redeemer Data objects" , printDataHeader `thenDoAnalysis` analyseRedeemer ) , ( "datums" , "print statistics about datum Data objects" , printDataHeader `thenDoAnalysis` analyseDatum ) , ( "script-data" , "print statistics about Data objects in validator scripts" , printDataHeader `thenDoAnalysis` analyseUnappliedScript analyseTermDataObjects ) , ( "count-builtins" , "count the total number of occurrences of each builtin in validator scripts" , countBuiltins ) , ( "costs" , "print actual and claimed costs of scripts" , putStrLn " cpuActual cpuClaimed memActual memClaimed status" `thenDoAnalysis` analyseCosts ) ] doAnalysis analyser = mapM_ (analyseOneFile analyser) (prelude `thenDoAnalysis` analyser) files = prelude >> doAnalysis analyser files usage = do getProgName >>= hPrintf stderr "Usage: %s <analysis> [<dir>]\n" hPrintf stderr "Analyse the .event files in <dir> (default = current directory)\n" hPrintf stderr "Avaliable analyses:\n" mapM_ printDescription analyses where printDescription (n,h,_) = hPrintf stderr " %-16s: %s\n" n h go name dir = case find (\(n, _, _) -> n == name) analyses of Nothing -> printf "Unknown analysis: %s\n" name >> usage Just (_, _, analysis) -> do files <- listFiles dir case filter ("event" `isExtensionOf`) files of [] -> printf "No .event files in %s\n" dir eventFiles -> analysis eventFiles in getArgs >>= \case [name] -> go name "." [name, dir] -> go name dir _ -> usage ```
DAPG may refer to: 2,4-DAPG (2,4-diacetylphloroglucinol), a chemical compound Dolphin Action and Protection Group, a non-governmental organization in South Africa which campaigns for the protection and conservation of dolphins and whales
Blepharis dhofarensis is a species of plant in the family Acanthaceae. It is a shrub that grows to around 5m tall and is found in Oman and Yemen. Blepharis dhofarensis grows on wet escarpment woodlands and it prefers dense thickets on steep slopes. It is threatened by habitat loss. Recent molecular work has placed it in the genus Acanthus instead of Blepharis. Uses Blepharis dhofarensis seeds in the prickly fruit heads were regarded as the very best fodder for camels by herders, especially milch camels. The leaves were also used as fodder. The fruits are mostly out of reach of the herds of goats, but herders would collect heads and extract the seeds to feed to sick or weak goats. The long slim branches provided spear shafts and could also be used as kohl sticks. They could also be made into wedge-shaped hair dividers to part and section hair. References G. Miller. Anthony and Morris. Miranda, 1988, Plants of Dhofar p. 6 dhofarensis Flora of Oman Flora of Yemen Vulnerable plants Taxonomy articles created by Polbot
The 147th Division() was a military formation of the People's Liberation Army of the People's Republic of China. The division was designated in November 1948 according to the Regulation of the Redesignations of All Organizations and Units of the Army, issued by Central Military Commission on November 1, 1948. from 36th Division, 12th Column of People's Liberation Army of Northeastern China. Its history could be traced to 5th Independent Division of Northeastern Democratic Coalition formed in July 1947. The division was a part of 49th Corps. Under the flag of 147th division it took part in several major battles during the Chinese Civil War, including the siege of Changchun, Liaoshen campaign, Pingjin campaign and Guangxi campaign. The division was then composed of 439th, 440th and 441st Regiments. In April 1952, the division was reorganized as 12th Public Security Division(). The division was then composed of 34th, 35th, 36th and 37th Public Security Regiments, stationing in Guangxi as a garrison unit. In September 1955 the division was disbanded. Headquarters, 12th Public Security Division was converted to Headquarters, 1st Air Defense Corps, and all its 4 regiments were attached to Guangxi Military District's control. References 建国后中国人民解放军步兵师的发展(2011版), http://www.360doc.com/content/14/0814/09/3872310_401714993.shtml S12 Military units and formations disestablished in 1955 Military units and formations established in 1948
Rokas Zaveckas (born 15 April 1996 in Vilnius, Lithuania) is a Lithuanian alpine and freestyle skier. In 2012 he competed at 2012 Winter Youth Olympics: 24th in slalom, 28th in super combined, 29th in giant slalom and 35th in Super-G. In 2014 Zaveckas was selected to represent Lithuania in 2014 Winter Olympic Games. In 2023 Zaveckas become first Lithuanian to compete at the FIS Freestyle Ski World Championships 2023. References External links 1996 births Living people Lithuanian male alpine skiers Lithuanian male freestyle skiers Olympic alpine skiers for Lithuania Alpine skiers at the 2014 Winter Olympics Alpine skiers at the 2012 Winter Youth Olympics Competitors at the 2017 Winter Universiade Sportspeople from Vilnius
Moonlight Dub Xperiment is a live dub band formed 2009 in San Jose, Costa Rica. Their music is in the Ethnic dub/world music genre which is similar to Kanka, Thievery Corporation, Lee Scratch Perry. Bio Moonlight Dub Xperiment create dub music, which although based originally on reggae, they usually mix with newer urban styles such as hip-hop, electronic music, and psychedelic rock/dub amongst others. The lyrics hold a strong militant message and will center around connection, positive evolution, ecology and in general a better and more aware self. Since it was brought to life, the band has been part of artistic festivals and the underground music scene with an increasing following. The band's debut album, Biodub, (Independent) appeared in 2009. The original album came with a seed attached to the case and the slogan: “In every seed a forest lies within.”, which was in line with the ecological message that the band wanted to exalt in this first production. This was also the official appearance of Huba, a local MC, as a militant part of the band. The album has song remixes done by Mad Professor (UK), one of Lee "Scratch" Perry’s students. Promotion of this album took MDX to El Salvador, Guatemala and Mexico, as well as opening shows for some of the most reputable artists within the reggae scene. Through the years the band also included more resources and integrated some of the best local artists to the collective, including elements like African percussion, didgeridoo, hip hop vocals, dj samples and live dub effects. In 2014 they present their second album, Day & Night (independent), which holds a double album. The Day album contains the original live performed dub versions of the tracks, whilst the Night album portrays versions of the original tracks by the band or remixed versions by different artists. The album was nominated in Costa Rican ACAM awards in the best reggae album category. Discography - Albums Biodub (2009) Day & Night (2014) Noon (2016) Pensamiento (2019) Gracias (2019) Cree-Siente (2019) References External links http://www.moonlightdub.com http://moonlightdub.bandcamp.com - Bands Bandcamp website Costa Rican musical groups
Opačić is a village in the municipality of Glamoč in Canton 10, the Federation of Bosnia and Herzegovina, Bosnia and Herzegovina. Demographics According to the 2013 census, its population was 0, down from 87 in 1991. Footnotes Bibliography Populated places in Glamoč
```html <div class="widgets"> <div class="row"> <div class="col-md-12"> <div ba-panel ba-panel-title="Form Wizard" ba-panel-class="with-scroll"> <ba-wizard> <ba-wizard-step title="Personal info" form="vm.personalInfoForm"> <form name="vm.personalInfoForm" novalidate> <div class="row"> <div class="col-md-6"> <div class="form-group has-feedback" ng-class="{'has-error': vm.personalInfoForm.username.$invalid && (vm.personalInfoForm.username.$dirty || vm.personalInfoForm.$submitted)}"> <label for="exampleUsername1">Username</label> <input type="text" class="form-control" id="exampleUsername1" name="username" placeholder="Username" ng-model="vm.personalInfo.username" required> <span class="help-block error-block basic-block">Required</span> </div> <div class="form-group" ng-class="{'has-error': vm.personalInfoForm.email.$invalid && (vm.personalInfoForm.email.$dirty || vm.personalInfoForm.$submitted)}"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="exampleInputEmail1" name="email" placeholder="Email" ng-model="vm.personalInfo.email" required> <span class="help-block error-block basic-block">Proper email required</span> </div> </div> <div class="col-md-6"> <div class="form-group" ng-class="{'has-error': vm.personalInfoForm.password.$invalid && (vm.personalInfoForm.password.$dirty || vm.personalInfoForm.$submitted)}"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="Password" ng-model="vm.personalInfo.password" required> <span class="help-block error-block basic-block">Required</span> </div> <div class="form-group" ng-class="{'has-error': !vm.arePersonalInfoPasswordsEqual() && (vm.personalInfoForm.confirmPassword.$dirty || vm.personalInfoForm.$submitted)}"> <label for="exampleInputConfirmPassword1">Confirm Password</label> <input type="password" class="form-control" id="exampleInputConfirmPassword1" name="confirmPassword" placeholder="Confirm Password" ng-model="vm.personalInfo.confirmPassword" required> <span class="help-block error-block basic-block">Passwords should match</span> </div> </div> </div> </form> </ba-wizard-step> <ba-wizard-step title="Product Info" form="vm.productInfoForm"> <form name="vm.productInfoForm" novalidate> <div class="row"> <div class="col-md-6"> <div class="form-group has-feedback" ng-class="{'has-error': vm.productInfoForm.productName.$invalid && (vm.productInfoForm.productName.$dirty || vm.productInfoForm.$submitted)}"> <label for="productName">Product name</label> <input type="text" class="form-control" id="productName" name="productName" placeholder="Product name" ng-model="vm.productInfo.productName" required> <span class="help-block error-block basic-block">Required</span> </div> <div class="form-group" ng-class="{'has-error': vm.productInfoForm.productId.$invalid && (vm.productInfoForm.productId.$dirty || vm.productInfoForm.$submitted)}"> <label for="productId">Product id</label> <input type="text" class="form-control" id="productId" name="productId" placeholder="productId" ng-model="vm.productInfo.productId" required> <span class="help-block error-block basic-block">Required</span> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="productName">Category</label> <select class="form-control" title="Category" selectpicker> <option selected>Electronics</option> <option>Toys</option> <option>Accessories</option> </select> </div> </div> </div> </form> </ba-wizard-step> <ba-wizard-step title="Shipment" form="vm.addressForm"> <form name="vm.addressForm" novalidate> <div class="row"> <div class="col-md-6"> <div class="form-group has-feedback" ng-class="{'has-error': vm.addressForm.address.$invalid && (vm.addressForm.address.$dirty || vm.addressForm.$submitted)}"> <label for="productName">Shipment address</label> <input type="text" class="form-control" id="address" name="address" placeholder="Shipment address" ng-model="vm.shipment.address" required> <span class="help-block error-block basic-block">Required</span> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="productName">Shipment method</label> <select class="form-control" title="Category" selectpicker> <option selected>Fast & expensive</option> <option>Cheap & free</option> </select> </div> </div> </div> <div class="checkbox"> <label class="custom-checkbox"> <input type="checkbox"> <span>Save shipment info</span> </label> </div> </form> </ba-wizard-step> <ba-wizard-step title="Finish"> <form class="form-horizontal" name="vm.finishForm" novalidate> Congratulations! You have successfully filled the form! </form> </ba-wizard-step> </ba-wizard> </div> </div> </div> </div> ```
Ilm-Kreis I is an electoral constituency (German: Wahlkreis) represented in the Landtag of Thuringia. It elects one member via first-past-the-post voting. Under the current constituency numbering system, it is designated as constituency 22. It covers the southern part of Ilm-Kreis. Ilm-Kreis I was created for the 1994 state election. Since 2014, it has been represented by Andreas Bühl of the Christian Democratic Union (CDU). Geography As of the 2019 state election, Ilm-Kreis I covers the southern part of Ilm-Kreis, specifically the municipalities of Angelroda, Elgersburg, Geratal (only Geraberg), Großbreitenbach, Ilmenau, Martinroda, and Plaue (only Neusiß). It also includes the village of Schmiedefeld am Rennsteig from Suhl. Members The constituency was held by the Christian Democratic Union from its creation in 1994 until 2009, during which time it was represented by Siegfried Jaschke. It was won by The Left in 2009, and represented by Petra Enders. The CDU's candidate Andreas Bühl won the constituency in 2014. He was re-elected in 2019. Election results 2019 election 2014 election 2009 election 2004 election 1999 election 1994 election References Electoral districts in Thuringia 1994 establishments in Germany Ilm-Kreis Constituencies established in 1994
Cu2+-exporting ATPase () is an enzyme with systematic name ATP phosphohydrolase (Cu2+-exporting). This enzyme catalyses the following chemical reaction ATP + H2O + Cu2+in ADP + phosphate + Cu2+out This P-type ATPase undergoes covalent phosphorylation during the transport cycle. See also ATP7A References External links EC 3.6.3
Balwinder Safri (15 December 1958 – 26 July 2022) was a United Kingdom–based Punjabi folk singer active since 1980s and founder of Safri Boyz Band (1990). He was best known as Bhangra Star for his contribution to Punjabi music industry. A few of his hit songs include "O Chan Mere Makhna", "Pao Bhangra", "Gal Sun Kuriye", "Nachdi nu", 'Rab Dian Rakhan" (1996), "Ishq Nachavye Gali Gali" (1996) and "Laali" (1998). Safri underwent triple bypass surgery and suffered brain damage while at New Cross Hospital. He died on 26 July 2022 in Wolverhampton, UK, shortly after being discharged from the hospital. References Further reading External links 1958 births 2022 deaths Punjabi singers Indian singers
```php <?php /* * This file is part of PhpSpec, A php toolset to drive emergent * design by specification. * * (c) Marcello Duarte <marcello.duarte@gmail.com> * (c) Konstantin Kudryashov <ever.zet@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PhpSpec\Exception\Fracture; /** * Class ClassNotFoundException holds information about class not found exception */ class ClassNotFoundException extends FractureException { /** * @var string */ private $classname; /** * @param string $message * @param string $classname */ public function __construct($message, $classname) { parent::__construct($message); $this->classname = $classname; } /** * @return string */ public function getClassname() { return $this->classname; } } ```
```python import tensorly as tl # Authors: Hratch Baghdassarian <hmbaghdassarian@gmail.com>, Erick Armingol <earmingol14@gmail.com> # similarity metrics for tensor decompositions def correlation_index( factors_1: list, factors_2: list, tol: float = 5e-16, method: str = "stacked" ) -> float: """CorrIndex implementation to assess tensor decomposition outputs. From [1] Sobhani et al 2022 (path_to_url Metric is scaling and column-permutation invariant, wherein each column is a factor. Parameters ---------- factors_1 : list The loading/factor matrices [A_1 ... A_N] for a low-rank tensor from its factors, output from first decomposition factors_2 : list The loading/factor matrices [A_1 ... A_N] for a low-rank tensor from its factors, output from second decomposition tol : float, optional Precision threshold below which to call the CorrIndex score 0, by default 5e-16 method : str, optional Method to obtain the CorrIndex by comparing the A matrices from two decompositions, by default 'stacked'. Possible options are: - 'stacked' : The original method implemented in [1]. Here all A matrices from the same decomposition are vertically concatenated, building a big A matrix for each decomposition. - 'max_score' : This computes the CorrIndex for each pair of A matrices (i.e. between A_1 in factors_1 and factors_2, between A_2 in factors_1 and factors_2, and so on). Then the max score is selected (the most conservative approach). In other words, it selects the max score among the CorrIndexes computed dimension-wise. - 'min_score' : Similar to 'max_score', but the min score is selected (the least conservative approach). - 'avg_score' : Similar to 'max_score', but the avg score is selected. Returns ------- score : float CorrIndex metric [0,1]; lower score indicates higher similarity between matrices """ # check input factors shape for factors in [factors_1, factors_2]: if len({tl.shape(A)[1] for A in factors}) != 1: raise ValueError( "Factors should be a list of loading matrices of the same rank" ) # check method options = ["stacked", "max_score", "min_score", "avg_score"] if method not in options: raise ValueError(f"The `method` must be either option among {options}") if method == "stacked": # vertically stack loading matrices -- shape sum(tensor.shape)xR) X_1 = [tl.concatenate(factors_1, 0)] X_2 = [tl.concatenate(factors_2, 0)] else: X_1 = factors_1 X_2 = factors_2 for x1, x2 in zip(X_1, X_2): if tl.shape(x1) != tl.shape(x2): raise ValueError("Factor matrices should be of the same shapes") # normalize columns to L2 norm - even if ran decomposition with normalize_factors=True col_norm_1 = [tl.norm(x1, axis=0) for x1 in X_1] col_norm_2 = [tl.norm(x2, axis=0) for x2 in X_2] for cn1, cn2 in zip(col_norm_1, col_norm_2): if tl.any(cn1 == 0) or tl.any(cn2 == 0): raise ValueError("Column norms must be non-zero") X_1 = [x1 / cn1 for x1, cn1 in zip(X_1, col_norm_1)] X_2 = [x2 / cn2 for x2, cn2 in zip(X_2, col_norm_2)] corr_idxs = [ _compute_correlation_index(x1, x2, tol=tol) for x1, x2 in zip(X_1, X_2) ] if method == "stacked": score = corr_idxs[0] elif method == "max_score": score = tl.max(corr_idxs) elif method == "min_score": score = tl.min(corr_idxs) elif method == "avg_score": score = tl.mean(corr_idxs) else: score = 1.0 return score def _compute_correlation_index(x1: list, x2: list, tol: float = 5e-16) -> float: """Computes the CorrIndex from the L2-normalized A matrices. Parameters ---------- x1 : list A list containing normalized A matrix(ces) from the first tensor decomposition. x2 : list A list containing normalized A matrix(ces) from the first tensor decomposition. tol : float, optional Precision threshold below which to call the CorrIndex score 0, by default 5e-16 Returns ------- score : float CorrIndex metric [0,1]; lower score indicates higher similarity between matrices """ # generate the correlation index input c_prod_mtx = tl.abs(tl.matmul(tl.conj(tl.transpose(x1)), x2)) # correlation index scoring n_elements = tl.shape(c_prod_mtx)[1] + tl.shape(c_prod_mtx)[0] score = (1 / (n_elements)) * ( tl.sum(tl.abs(tl.max(c_prod_mtx, 1) - 1)) + tl.sum(tl.abs(tl.max(c_prod_mtx, 0) - 1)) ) if score < tol: score = 0 return score ```
The California Hotel is a historic Oakland, California, hotel which opened in the early days of the Great Depression and became an important cultural center for the African-American community of San Francisco's East Bay during the 1940s, 50s and 60s. On June 30, 1988 the hotel was placed on the National Register of Historic Places. History The California Hotel opened its doors on May 18, 1930. A 5-story structure with mezzanine and penthouse, it was the tallest building in the area. It cost $265,000 to build the 150-room hotel with commercial space on the ground floor. Though situated 1 miles from Oakland's city center, the new hotel was within walking distance of the passenger stations for both the Santa Fe Railroad and the regional Key System streetcars. The hotel was located at 3501 San Pablo Avenue, near major highways, and passing traffic was increased in 1937 by the opening of the San Francisco–Oakland Bay Bridge. In 1962 construction of the elevated MacArthur Freeway blocked the street view of the hotel but made it visible to hundreds of thousands of bridge commuters. The hotel opened in difficult economic times. The hotel's first manager, Axel Bern, an experienced hotelier, was also an investor. Just four months after the grand opening, Bern was arrested and charged with disturbing the peace after a quarrel in the hotel's lobby. According to a story in the Oakland Tribune, Bern had reneged on his commitment to invest $35,000 into the hotel and had been relieved of his duties as general manager. However, Bern returned to work at the front desk on the day of his arrest. To attract the car driving public, the hotel's owners added a "motorists patio" in 1933, with a separate entrance from the parking area directly to the lobby. Next to the patio was a garage building, a service station and a repair shop. An advertisement in the 1943 Oakland City Directory described the hotel amenities as "commodious airy rooms, all with shower and tub baths, dining, banquet and meeting rooms, coffee shop and cocktail lounges, garage adjoining". During World War II, the hotel was known for the blues, jazz and similar 'race music' being played in its ground floor bars and ballrooms. African American patrons were denied rooms due to segregation, but they came in large numbers to hear the music. On January 16, 1953, new ownership took control, and the hotel ended its discrimination policies. A grand "reopening" was held with invited guests that included Oakland-born comedian Eddie "Rochester" Anderson, boxing champion Joe Louis and acclaimed singer Lena Horne. The hotel attracted many high profile black visitors to Oakland. At that time, it was the only full-service hotel that welcomed black people in the East Bay. The 1956 edition of The Negro Motorist Green Book also lists five smaller, less sophisticated Oakland hotels. African American entertainers who lodged and performed at the hotel included Big Mama Thornton, BB King, Lou Rawls, James Brown, Sam Cooke, Ray Charles and Richard Pryor. After the 1960s, the hotel, as with many dedicated African American institutions and businesses in the area, declined; black entertainers could now stay in any hotel, and patrons followed them to white-owned clubs and other venues. By the 1970s, the hotel was in bad condition and was boarded up. In the 1980s, it was repaired and rented out as subsidized housing. In 2012, a start was made on restoring the building and in 2014, after a renovation costing $43 million, it was once more opened as low-rental housing. References Historic hotels in the United States Hotels in the San Francisco Bay Area Buildings and structures in Oakland, California Music venues in the San Francisco Bay Area Residential buildings in Alameda County, California 1930 establishments in California Hotels established in 1930 Hotel buildings completed in 1930 African-American history in Oakland, California African-American segregation in the United States
Lana J. Marks (born November 18, 1953) is a South African-born American business executive who founded the eponymous fashion brand. She is the former United States Ambassador to South Africa, having served from 2020 to 2021. Early life and education Lana Bank was born in East London, South Africa. Her father, Alec Bank, had immigrated from Lithuania as a child; he was an affluent property developer and a leader in the Jewish community. She attended Clarendon High School for Girls in East London, and speaks Xhosa and Afrikaans. Marks is an avid tennis player, having played for Bermuda, having won bronze medals for the United States in the Maccabiah Games in 1985, playing in the South African Open, and also made it to the qualifying rounds of the French Open. Career Marks was the CEO and designer of Lana Marks, a fashion accessories brand which specializes in exotic leathers and is known for creating some of the world's most expensive handbags. When Helen Mirren won an Academy Award in 2007, she carried a handbag designed by Marks to the stage. Her daughter currently runs the brand. The Lana Marks company has stores in Palm Beach, New York, Beverly Hills, and Dubai. Ambassador to South Africa Marks’s rumored appointment to the ambassadorship was leaked from a source within the Department of International Relations and Cooperation, South Africa's foreign affairs department. On November 14, 2018, President Donald Trump nominated Marks to be the United States Ambassador to South Africa. Marks had known Trump for more than two decades and was a member of his Mar-a-Lago club. She was unanimously confirmed by the Senate on September 26, 2019. She was sworn into office on October 4, 2019, and arrived at her posting on November 9, 2019, and presented her diplomatic credentials to President Cyril Ramaphosa on January 28, 2020. Marks has been a member of Donald Trump's Mar-a-Lago resort since 2010. She was among several Mar-a-Lago members to be chosen by Trump for a role in his administration. Marks stated that her primary goals include youth and women’s empowerment. During her first sixty days, Marks launched two major initiatives, to invite all of Africa's leaders to a U.S.-Africa investment summit in Washington D.C., and to lift South Africa into a top-20 U.S. trading partner. In September 2020, anonymous U.S. intelligence sources claimed that Iran was planning an assassination attempt on Marks in South Africa. The plot, claimed the sources, was in retaliation for the U.S. drone strike in Baghdad, Iraq, that killed the former commander of Qods Force, Qasem Soleimani, and deputy leader of Iraqi Popular Mobilization Forces militia, Abu Mahdi al-Muhandis on January 3, 2020. The signing of a letter of intent between the U.S. International Development Finance Corporation (DFC) and NuScale, to develop 2,500 MW of nuclear power in South Africa, was cited as perhaps being one of her most significant accomplishments. In March 2020, Marks refused to quarantine after being exposed to COVID-19 at an event at Mar-a-Lago, President Trump’s club in Florida. In December 2020, Marks spent 10 days in intensive care with Covid-19. As a Trump political appointee ambassador, she resigned from the office following the inauguration of President Joe Biden on 20 January 2021 and was succeeded by John Groarke as Charge d'Affaires ad interim. Personal life Marks has been married to Dr. Neville Marks, a practicing psychiatrist affiliated with JFK Medical Center, since 1976. Marks and her husband later lived in Bermuda before moving to Florida in 1987. She has two children. Marks was a personal friend of Diana, Princess of Wales. According to Marks, the two women had planned a four-day trip to Italy for the end of August 1997. Marks canceled at the last minute when Marks's father had a heart attack. Diana went to Paris with her partner Dodi Fayed where they were killed in a car accident. Since 2010, Marks has been a member of Mar-a-Lago. According to Marks, she joined because other country clubs in Palm Beach did not admit Jewish members. References External links Lana Marks Official Website Lana Marks CFDA Profile 1953 births Ambassadors of the United States to South Africa American fashion designers American women ambassadors Artists from Florida Businesspeople from Florida High fashion brands Living people Luxury brands People from East London, South Africa People from Palm Beach, Florida South African emigrants to the United States South African people of Lithuanian-Jewish descent American women fashion designers South African female tennis players 21st-century American women Alumni of Clarendon High School for Girls
Genevieve Delves (born 21 September 1978) is an Australian international lawn and indoor bowler. Bowls career In 2019, she won the Australian National indoor title, which qualified her to represent Australia at the 2022 World Bowls Indoor Championships. The delay in representing Australia at the event was due to cancellations in 2020 and 2021 because of the COVID-19 pandemic In 2023, Delves won a second pairs title at the Australian Open but missed out on selection for the 2023 World Bowls Championship. References Australian female bowls players 1978 births Living people Place of birth missing (living people)
```objective-c // This is a part of the Microsoft Foundation Classes C++ library. // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #pragma once #include "afxcontrolbarutil.h" #ifdef _AFX_PACKING #pragma pack(push, _AFX_PACKING) #endif #ifdef _AFX_MINREBUILD #pragma component(minrebuild, off) #endif class CMFCFontInfo; /*============================================================================*/ // CMFCFontComboBox window class CMFCFontComboBox : public CComboBox { // Construction public: CMFCFontComboBox(); // Attributes public: AFX_IMPORT_DATA static BOOL m_bDrawUsingFont; protected: CImageList m_Images; BOOL m_bToolBarMode; // Operations public: BOOL Setup(int nFontType = DEVICE_FONTTYPE | RASTER_FONTTYPE | TRUETYPE_FONTTYPE, BYTE nCharSet = DEFAULT_CHARSET, BYTE nPitchAndFamily = DEFAULT_PITCH); BOOL SelectFont(CMFCFontInfo* pDesc); BOOL SelectFont(LPCTSTR lpszName, BYTE nCharSet = DEFAULT_CHARSET); CMFCFontInfo* GetSelFont() const; protected: void Init(); void CleanUp(); // Overrides public: int DeleteString(UINT nIndex); virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct); virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void PreSubclassWindow(); // Implementation public: virtual ~CMFCFontComboBox(); protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); afx_msg LRESULT OnInitControl(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() }; #ifdef _AFX_MINREBUILD #pragma component(minrebuild, on) #endif #ifdef _AFX_PACKING #pragma pack(pop) #endif ```
The fauna of Maine include several diverse land and aquatic animal species, especially those common to the North Atlantic Ocean and deciduous forests of North America. Some of these creatures' habitats has been reduced or fully removed. Mammals Even-toed ungulates Deer The deer of Maine include the moose, and the white-tailed deer. Caribou lived in Maine in the past. Whales Large baleen whales The large baleen whales of Maine include the blue whale, Bryde's whale, finback whale, humpback whale, minke whale, north atlantic right whale, and the sei whale Large toothed whales The large toothed whales of Maine include the beluga, beaked whale, false killer whale, grampus, killer whale, northern bottlenose whale, pygmy sperm whale, short-finned pilot whale, sperm whale, and the long-finned pilot whale. Dolphins and porpoises Rodents The rodents of Maine include the North American deermouse, White-footed mouse, meadow jumping mouse, woodland jumping mouse, meadow vole, southern red-backed vole, rock vole, woodland vole, southern bog lemming, northern bog lemming, northern flying squirrel, southern flying squirrel, eastern gray squirrel, American red squirrel and the American beaver. Lagomorphs Rabbits The rabbits of Maine include the New England cottontail, and the eastern cottontail. Hares The hares of Maine include the snowshoe hare. Carnivores The carnivores of Maine include the red fox, gray fox, bobcat, Canadian lynx, coyote, American black bear and the extirpated gray wolf and eastern cougar. Bats The bats of Maine include the eastern pipistrelle, big brown bat, little brown bat, eastern small-footed myotis, northern myotis, eastern red bat, hoary bat, and the silver-haired bat. Other small mammals Other small mammals of Maine include species of several different families. These include the following: hairy-tailed mole, star-nosed mole, water shrew, smoky shrew, long-tailed shrew, pygmy shrew, cinereus shrew, and the northern short-tailed shrew. Mustelids The various species of weasels include: northern river otter, American mink, long-tailed weasel, ermine or short-tailed weasel, fisher (in New England is known as a fisher cat), and the American marten (Known as pine marten in some areas of New England even though the pine marten is a separate species.). Other mammals Other mammals include the red squirrel, eastern gray squirrel, eastern chipmunk, woodchuck, northern raccoon, Virginia opossum, striped skunk, North American porcupine, and the common muskrat. Birds Maine is a huge state with a large coastline and hundreds of lakes, streams and rivers so there are many species of waterfowl, seabirds and shore birds. A few of the most common species include the mallard, wood duck, American black duck, Canada goose, common loon, pied-billed grebe, horned grebe, red-necked grebe, northern fulmar, greater shearwater, sooty shearwater, Manx shearwater, Wilson's storm-petrel, Leach's storm-petrel, piping plover, American pipit, Arctic tern, Atlantic puffin, black tern, and the razorbill. Maine is also home to a wide variety of birds of prey including the northern goshawk, bald eagle, sharp-shinned hawk, Cooper's hawk, northern harrier, and red-tailed hawk. great horned owl, barn owl, barred owl, long-eared owl, great gray owl and northern saw-whet owl. Maine also historically had a nesting population of golden eagles, though today it is only part of their winter range. Other common species include the common nighthawk, whip-poor-will, chimney swift, black-capped chickadee, indigo bunting, scarlet tanager, American goldfinch, tufted titmouse and the mourning dove. Reptiles Snakes The snakes of Maine include the common garter snake, common watersnake, eastern racer, DeKay's brown snake, milk snake, redbelly snake, ribbon snake, ring-necked snake, and the smooth green snake. The timber rattlesnake previously lived in Maine, but is now extirpated. Turtles Land Turtles The land turtles of Maine include Blanding's turtle, the box turtle, common musk turtle, common snapping turtle, painted turtle, spotted turtle, and the wood turtle. Marine Turtles The marine turtles of Maine include Kemp's ridley sea turtle, the leatherback sea turtle, and the loggerhead sea turtle. Fish Maine's state fish is the Landlocked Atlantic Salmon. Maine is considered the last stronghold for large lake dwelling and sea-run brook trout according to the Native Fish Coalition, these brook trout provide an important sports fishery throughout the state. Other native sports fish species include Lake Trout, Arctic Char, Burbot, Rainbow Smelt, Lake Whitefish, White Perch and Striped Bass. Molluscs There are 92 species of terrestrial gastropods in Maine. References External links Maine Department of Inland Fisheries and Wildlife Maine Natural history of Maine
The Bureij mosaic is a Byzantine-era mosaic floor discovered under an olive orchard in the Bureij refugee camp in the Gaza Strip in 2022. The mosaic was likely created between 390 and 634–636 A.D. The mosaic is described as a "sprawling grid" with cartouches containing 17 animals, including geese, ducks, dogs, insects, goats, deer, and an octopus. There are also geometric patterns and a border depicting a vine. The mosaic underlies a area from which three sections of earth have already been removed, with more remaining to be excavated. Farmer Salman al-Nabahin found the mosaic when he began investigating why his trees were not rooting properly. The French Biblical and Archaeological School of Jerusalem is assisting with the excavation. Archaeologist Rene Elter reported that the mosaic was in a "perfect state of conservation". Further research is needed to determine whether the mosaic floor was installed in a private villa, a religious structure, or for some other purpose. Earlier the same year, a different Gazan farmer unearthed a statue of the Canaanite goddess Anat that dated to approximately 2500 B.C. See also Early Byzantine mosaics in the Middle East 2022 in archaeology References Byzantine mosaics Holy Land during Byzantine rule 2022 archaeological discoveries Archaeological sites in the Gaza Strip Deir al-Balah Governorate
During the Middle Ages, a proprietary church (Latin ecclesia propria, German Eigenkirche) was a church, abbey or cloister built on private ground by a feudal lord, over which he retained proprietary interests, especially the right of what in English law is "advowson", that of nominating the ecclesiastic personnel. History In the later Roman Empire the church had been centrally organized: all monasteries and churches within a diocese, including their personnel and their properties, were under the jurisdiction of the local bishop. As early as the late 5th century, Pope Gelasius I listed conditions under which bishops could consecrate new churches within the metropolitan see of Rome. One of the conditions was that the new establishment be endowed with sufficient means to provide for vestments, lights, and the support of the priest serving there. Sometimes the church was part of a large estate; others were themselves vast landed estates. Early Middle Ages The development of proprietary churches was a product of feudalism. The founding lord or seigneur might be a layman, bishop, or abbot, but only the diocesan bishop had the authority to consecrate the church or ordain the priest to serve there. The Council of Trosly (909) defined such churches as the dominium of the seigneur, but the gubernatio of the bishop. It was the responsibility of the bishop to ensure that the building was kept in good repair and appropriately lighted, and to determine the parochial boundaries. Within the Carolingian empire, the rules concerning proprietary churches had been expressly formulated in the ninth century, at the reforming councils of 808, under Charlemagne and of 818/9, under Louis the Pious. Then proprietary churches had been officially recognized, but the capitulations identify some of the associated excesses, for it was agreed that the proprietor should not appoint nor depose priests without the assent of the bishop, nor appoint unfree persons. Every church was to be provided with a manse and its garden that were free of seigneurial dues, where the priest could support himself, providing spiritual services. The rights of proprietarial founders were also delimited and protected, for the bishop could not refuse to ordain a suitable candidate; the legislation also protected the founder's right over proprietary abbeys to appoint a member of the founding family. A practice developed in 8th-century Germany of donating a proprietary church to a larger church or cathedral with certain conditions, such as reserving the usufruct to a member of the family, sometimes for more than one generation. Sometimes the donation was revocable upon the possible return of a distant heir. Other conditions might preclude it as ever being awarded as a benefice, on penalty of reverting to the family. The usufruct might be reserved to a female (ancilla dei) or a male as yet unborn, let alone not yet in Holy Orders, and allowed the donor to make provision for the support of family members. A donation couched in such terms to a third party, served to provide some protection against subsequent challenges by other family members. Ulrich Stutz argued that the institution of the proprietary church existed particularly in areas that had never been Roman, among the Irish and the Slavs, and in the Eastern Roman Empire, but the proprietary church is best known in Germany, where the Grundherr, the landlord who had founded the church on his property and endowed it from his lands, maintained the right of investiture, as he was the advocatus (German Vogt) of the fief, and responsible for its security and good order. In the 9th and 10th centuries the establishment of proprietary churches in Germany swelled to their maximum. The layman who held the position was a lay abbot. The altar was the legal anchor to which the structures, the land, the rights and ties were attached. The proprietor and his heirs retained unabated legal rights to the ground on behalf of the saint whose relics lay beneath the altar. "He could sell, lend or lease the altar, leave it to his heirs, use it for dower, or mortgage it, provided that a church, once dedicated, continued to be used as a church." However, the founder could not alienate any of the land or appurtenances designated for the maintenance of the church and support of the priest. Dedicating land for a religious use was one way to preserve it from being partitioned into parcels too small for effective economic use. According to George W.O. Addleshaw, French historians attribute the development of proprietary churches to the decentralization that ensued with the collapse of the Roman Empire in the West and the increased authority of late Roman and Merovingian landowners, who assumed responsibility for rural churches in lieu of bishops in their urban sees. Later Middle Ages The proprietary right could be granted away or otherwise alienated, even for a sum of money, which compromised the position of the spiritual community that it served. In a small parish church this right may be trivial, but in the German territories of Otto the Great it was an essential check and control on the church, through which the Holy Roman Emperor largely ruled. Simony, the outright purchase of an ecclesiastic position through payment or barter, was an ever-present problem, one that was attacked over and over in all the synods of the 11th- and early 12th-century Gregorian reforms, and fuelled the Investiture Controversy. The benefice system grew out of the proprietary churches. The royal peculiars have remained proprietary churches until today. A Medieval example is the church of Littleham, Devon, mentioned in 1422. Lorsch Abbey An example of a proprietary church is Lorsch Abbey, founded in 764 by the Frankish Count Cancor and his widowed mother Williswinda as a church and monastery on their estate, Laurissa. They entrusted its administration to Cancor's nephew Chrodegang, Archbishop of Metz, who became its first abbot. In 766 Chrodegang resigned the office of abbot, in favour of his brother Gundeland. See also Proprietary chapel Staðamál Notes References Ulrich Stutz: Ausgewählte Kapitel aus der Geschichte der Eigenkirche und ihres Rechtes. Böhlau, Weimar 1937 Ulrich Stutz: Die Eigenkirche als Element des mittelalterlich-germanischen Kirchenrechts. Wissenschaftl. Buchgesellschaft, Darmstadt 1964 Ulrich Stutz, Hans Erich Feine: Forschungen zu Recht und Geschichte der Eigenkirche. Gesammelte Abhandlungen. Scientia, Aalen 1989, Ulrich Stutz: Geschichte des kirchlichen Benefizialwesens. Von seinen Anfängen bis auf die Zeit Alexanders III. Scientia, Aalen 1995, (Ergänzt von Hans Erich Feine) External links Wood, Susan. The Proprietary Church in the Medieval West, Oxford University Press, 2006 Christianity in the Middle Ages Feudalism Religious law