text:
Pan American and Parapan American Teams.
Garbine Muguruza $6M 7.
It would have made things a lot easier, but I never thought I'd be in this situation where having a disability isn't enough to play disability sport.
22, will be a home game for Cleveland and air nationally ESPN's ll.
If we were to just go in and say we want to put Charles on a lacrosse field to sell a product – although that would be funny – it wouldn't make sense.
The NCAA said the working group would continue to gather feedback through April on how best to respond to the state and federal legislative environment and to refine its recommendations on the principles and regulatory framework.
We are 100% committed to the league, he said.
Plus, Turner originally cut its UEFA deal in 2017 as a way to build up its streaming service B R Live.
Also in London was commissioner Roger Goodell who made an appearance on NFL Network's , which also was based in London for the past week.
in 2021 to play in the MLB Little League Classic presented by Geico, according to MLB, the Major League Baseball Players Assn.
Highest Paid Women Athletes 2020 Per Forbes 1.
15 Arizona Cardinals at Seattle Seahawks Sun.
and Little League International.
To be eligible, all consumers need to do is register for Papa John's online customer loyalty program, Papa Points, at any time now until 11 PM ET Saturday, Feb.
Elina Sviolina tennis $6M 8.
• The Los Angeles Angels and Cleveland Indians will travel to Williamsport, Pa.
And so obviously at every position it's critical that we build that depth, but we know the offensive line in this offense is the heart and soul of this offense; we know that.
Emirates Old Trafford Cricket Ground is no stranger to big music events.
Bellator is a great franchise that has been developing over the past few years as a challenger to UFC, backed by Viacom.
NYSJ: A lot of the younger players in the league have spent their entire lives using or involved with social media, and even the veteran players are more tech-savvy than ever.
Tyga gets on, and pulls a lever that raises the rapper up.
series of ads found the catcher showing how not to make decisions – coming to the plate with an imaginary bat and acting custom baseball jerseys a mime, using a bull fighter's cape at the plate in place of a bat and having a temper tantrum as a two-year-old when he strikes out.
Then the virus and associated shutdowns hit and we saw 9% and 42% drops in March and April, leaving us personalized jerseys 16%.
Financial terms of the deal were not released.


text:
Q: Retrive html tag content using beautifulSoup I'm trying to get the plain text of a website article using python. I've heard about the BeautifulSoup library, but how to retrieve a specific tag in html page?
This is what I have done:
base_url = 'http://www.nytimes.com'
r = requests.get(base_url)
soup = BeautifulSoup(r.text, "html.parser")

A: Look this:
import bs4 as bs
import requests as rq

html = rq.get('site.com')

s = bs.BeautifulSoup(html.text, features="html.parser")
div = s.find('div', {'class': 'yourclass'}) # or id

print(str(div.text)) # print text

redpajama_set_name: RedPajamaStackExchange


text:
@interface LockViewController () <LockScreenDelegate>

@property (weak, nonatomic) IBOutlet UIImageView *backgroundImage;

@end

@implementation LockViewController {

}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        //
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    //lock screen view
    SPLockScreen *lockScreen = [[SPLockScreen alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width)];
    CGPoint center = self.view.center;
    center.y += 100;
    lockScreen.center = center;
	lockScreen.delegate = self;
	lockScreen.backgroundColor = [UIColor clearColor];
	[self.view addSubview:lockScreen];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma comment --- LockScreenDelegate -----
- (void)lockScreen:(SPLockScreen *)lockScreen didEndWithPattern:(NSNumber *)patternNumber
{
    NSLog(@"Lock is %ld...", [patternNumber longValue]);
    if (4253 == [patternNumber longValue]) {
        self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
    }
}

@end

redpajama_set_name: RedPajamaGithub


On this website we recommend many pictures abaout bathroom window curtains that we have collected from various sites Bathroom For Your Ideas, and of course what we recommend is the most excellent of picture for bathroom window curtains. If you like the picture on our website, please do not hesitate to visit again and get inspiration from our website.
And if you want to see more images more we recommend the gallery below, you can see the picture as a reference design from your bathroom window curtains.
Thank you for seeing gallery of bathroom window curtains, we would be very happy if you come back.
Similar Keyword bathroom window curtains : bathroom sets with matching window curtains, bathroom shower window curtains sets, bathroom window curtains amazon, bathroom window curtains gray, bathroom window curtains grey, bathroom window curtains ideas, bathroom window curtains kohls, bathroom window curtains sets, bathroom window curtains target, bathroom window curtains walmart, bathroom window curtains waterproof, bathroom window decorating ideas, black and gray bathroom window curtains, dark gray bathroom window curtains, gray and white bathroom window curtains, light grey bathroom window curtains, small bathroom window curtains ideas, small bathroom window decorating ideas, small waterproof bathroom window curtains, waterproof bathroom window curtains uk, yellow and gray bathroom window curtains, yellow and grey bathroom window curtains, and more.


text:
NHRA: Hight uncorks first 3.70 Funny Car run in history in Brainerd
By Tony DiZinnoAug 19, 2017, 10:35 AM EDT
Photo: Gary Nastase and Auto Imagery
Last night, Robert Hight and the John Force Racing team took an even bigger step in their recent run of form with a new record elapsed time in NHRA Mello Yello Drag Racing Series history for the Funny Car class.
With a 3.793-second pass at Brainerd International Raceway in Minnesota, Hight became the first Funny Car driver in history to run a pass under 3.80 seconds in the class' history.
The full team release is below.
Auto Club of Southern California driver Robert Hight is getting pretty good at making history.
Two races ago, the Chevrolet Camaro SS driver set the national speed record of 339.87 mph at Sonoma, Calif.
On Friday at Brainerd International Raceway, Hight again went to new heights. The John Force Racing driver became the first in Funny Car to run under the 3.8-second mark, making a pass of 3.793 seconds at 338.00 mph to earn the provisional No. 1 spot for the NHRA Nationals on Friday night.
"It's something you dream about," Hight said. "There are so many things that have to happen, and so many people that have to work together for it to happen. It's just not that easy. We've been on runs before that you think that, if it'd finished, it would have run in the .70s.
"To be the first – that's history. This is a big milestone. It's going to be a long time before we get into the 3.60s. To be a part of a milestone – I've been on John's teams when he's cracked barriers, but never done it as a driver – so this is big for me and the whole team. We're ecstatic."
Hight and his Auto Club team, led by crew chief Jimmy Prock and co-crew chief Chris Cunningham, have been on fire recently. Hight won in Denver and Seattle, earned No. 1 qualifiers in three of the last four races, qualified in the top three in each of the last nine races and now has set the national record for elapsed time and speed.
Hight sat in the No. 2 spot after the first session Friday with a run of 3.844 seconds at 335.07 mph but figured the "Prock Rocket" could go even quicker – and it certainly did.
"I could tell it was running fast," Hight said. "The clutch disc was boiling, and that's the way Jimmy runs it. That's how he wants to wear the clutch. It was hard to see, but I did see the 3.79 on the scoreboard, because we shut off at 1,000 feet, I had the chutes out, and I glanced up there but I didn't know the speed."
Hight led a solid 1-3-4 effort for JFR, as PEAK Coolant & Motor Oil driver John Force was No. 3 with a run of 3.852 seconds at 334.15 mph and Advance Auto Parts driver Courtney Force was No. 4 with a pass of 3.863 seconds at 335.98 mph.
Brittany Force was No. 2 in Top Fuel, making a brilliant run of 3.685 seconds at a track-record speed of 333.16 mph. That speed was matched the third-best in NHRA history.
JFR now owns six of the nine fastest speeds in Funny Car history, as well as three of the six quickest elapsed times in Funny Car history.
Additionally, JFR Funny Cars own 12 of the 21 track records for elapsed time.

redpajama_set_name: RedPajamaCommonCrawl


text:
Legal	2 min read
How Underinsured Motorist Coverage Works in Virginia
Randy Appleton	 Feb 2, 2019
A quirk in Virginia law allows drivers to operate without insurance as long they pay an annual fee. This, along with the ever-present danger of hit-and-run drivers (4,521 cases in 2017), put injured crash victims at risk for bearing all the financial costs of recovering from a wreck.
A Virginia Personal Injury Lawyer Discusses Hit-and-Run Injury Claims
More Guidance on Uninsured Motorist Coverage in Virginia
Virginia lawmakers partially addressed this unjust reality in 2011 by passing a law that requires every person who does purchase car insurance in the state to carry uninsured motorist coverage. During 2019, the minimums for what is often called UM coverage were
$20,000 for property damage,
$25,000 for a bodily injury to or the death of one person, and
$50,000 for a bodily injury to or the death of two or more people
Who Can Invoke Uninsured Motorist Coverage in Virginia
Uninsured motorist coverage extends to each of the individuals who is covered under the policy, meaning spouses, children and other listed family members have access to UM settlements when an uninsured, unknown or hit-and-run run driver injures them. Cases in which UM coverage can be invoked include, but are not limited to, those in which
The at-fault driver flees the scene and is never identified;
More than one driver other than the injured person may have caused the crash, but no clear assignment of fault can be made;
The at-fault driver has no liability coverage, either because the person paid the fee to operate without insurance or because the person carries no insurance at all; or
The injured crash victim has no access to the at-fault driver's insurance because the person who caused the accident is a government employee who was engaged in official duties.
The Way an Uninsured Motorist Claim Works
UM claims go directly to the company that insures the injured and covered individual. Virginia law requires the car insurance company to treat such a claim just as it would if the claim came from a person who was hit and injured by its policyholder. This ensures that the uninsured motorist claim will be taken seriously, but it also allows the insurer to contest the claim.
Before it settles a UM claim, the insurance company will demand
Proof that the person who submitted the claim did not cause the crash,
Proof that injuries occurred, and
Proof that the crash-related injuries required medical treatment that cost the victim money.
Partnering with an experienced Virginia personal injury attorney will help the injured person gather and present all the requested police reports and relevant medical records. My colleagues and I have handled cases in which the insurance company contested UM claims all the way through civil jury trials — moves that required the companies to hire defense attorneys to try to justify denials of coverage to their own policyholders. In such circumstances, a car crash victim will want a staunch legal ally.
Randy Appleton
Maker of Alleged Defective X-Lite Guardrail End Units Under DOJ Investigation
Lindsey Transportation Solutions, Inc. is under investigation by Department of Justice relating to its guardrail product, the X-Lite End terminal. According to the company's End…
Thomas Curcio
Jan 9, 2020	 2 min read


Niagara Regional politics got even stranger last week when a Niagara developer offered a lot of money – $50,000 – to the Niagara Region Audit Committee. His proposal was to get the Committee to recommend that Regional Council ask Pelham Council to audit two Town matters – a parkland over-dedication transaction and development charge credit agreement.
You will recall that some Regional Councillors started questioning Town issues on March 30, 2017 when Regional Councillors Barrick (Port Colborne) and Gale (Niagara Falls) put forward a motion that included 13 accusations about Pelham's debt, finances, and property taxes. Why at the Region? They said the Region could talk about Pelham because the Town's debt might impact the Region's Standard & Poor's AA Credit Rating. This was later disproved since the 2017 S&P report shows that the Region could borrow an additional $282 million before risking a credit rating downgrade.
Town Staff responded with a 335-page comprehensive report that refuted each of the 13 claims in the motion. Yet, instead of letting me respond to the March 30 motion as Pelham's rep, a majority of Regional Council referred the matter to a June meeting of the Regional Audit Committee.
On April 3, Town Council reviewed and endorsed the Town's response to the Regional motion. Worried that Pelham residents might have questions, Council directed Staff to organize an "Evening with the Experts." About 100 people attended the panel discussion on April 24, with 17 people asking questions of Town Staff and professional advisors.
Then Town Staff attended and answered all questions at the June 12 Regional Audit Committee meeting. Despite my insistence that the Region has no jurisdiction in Town matters, Committee Chair Quirk (Grimsby) allowed specific questions about Pelham including parkland over-dedication, property purchases, water and tax rates, development charges and credits, library budgets, and cemetery fees. After these Town responses, the Audit Committee approved a motion that removed all references to Pelham.
When that revised motion went to the June 29 Regional Council meeting, Rainer Hummel, a Niagara developer, made numerous accusations about Pelham regarding a parkland over-dedication and a development charge credit agreement with Fonthill Gardens. Despite my request, the Regional Chair refused to recognize that the presentation was outside the Region's jurisdiction. Following the presentation, a majority of Regional Council referred the matter to the September 18 Regional Audit Committee.
During the September 5 Town Council meeting, Staff and Callum Shedden, the Town's lawyer, reviewed and refuted each of the claims made by Mr. Hummel. Mr. Shedden also confirmed that the Region has no jurisdiction in these matters under the Ontario Municipal Act. The Town published the accusation's disproof and posted information about parkland over-dedication at www.pelham.ca/ParklandFAQ.
Town Council sent a strongly worded motion and Mr. Shedden to outline the Region's lack of jurisdiction to the September 18 Audit Committee meeting. Instead of heeding the legal advice, the majority of the Audit Committee voted to allow Mr. Hummel to speak again. During his presentation, Mr. Hummel admitted to never raising his concerns with the Town or myself directly. Instead, he said he had a cheque for $50,000 for the Region to pay for the Town to undertake an audit of the parkland over-dedication and development charge credit agreement.
The committee "endorsed" the funds and recommended that Regional Council ask the Town to undertake an independent audit, but with the involvement of Mr. Hummel and Regional Staff.
I have thought a lot about and spoke to many people about this matter since last week.
For example, neither Town Staff nor Fonthill Gardens fear an audit, because it will then clearly show that all parties handled the parkland over-dedication and credits appropriately and legally. Some folks asked me why the Region's Audit Committee was baited by the cash and agreed to the involvement of a developer in what should be an independent process. Others still cannot understand why some Regional Councillors interfere in Pelham business.
I will recommend to Pelham Council, therefore, that we initiate an independent, third-party audit of all transactions and documents related to the 3.3-acre Parkland Over-Dedication to the Town by Fonthill Gardens and a 2015 Development Charge Credit agreement between the Town of Pelham and Fonthill Gardens. While I am certain that we followed all laws and appropriate policies with these transactions, I hope than an independent audit will help satisfy those with questions.
Yet, I will not recommend that Pelham Council accept the lure of the money. I believe it is ethically inappropriate to accept the $50,000 because it sets an unacceptable precedent of granting wealth great influence and privilege in municipal decision-making. Further, it is beneath the high-standard that the public expects from Town and Regional Councillors and Staff.
Watch for Town Council to discuss these types of motions at our next meeting.


text:
The White House Just Weighed In on Making a Murderer
Its response: Read the Constitution, you ignorant whackjobs.
Fans of the Netflix documentary have signed a petition urging the president to pardon Steven Avery and his nephew Brendan Dassey.Carl Wagner/ZUMA
Ever since Netflix released the true-crime series Making a Murderer last month, internet dwellers have been in a tizzy dreaming up schemes to exonerate the protagonists of the show, arguing that they were framed by a corrupt justice system. Over 129,000 people have signed a petition on the White House's website requesting a presidential pardon, exceeding the 100,000 marks required to warrant White House feedback. The White House's response, issued Thursday night on its website, was simple: Go read the Constitution, you idiots.
The 10-episode Netflix documentary follows the murder accusations and subsequent trials of Steven Avery and his nephew Brendan Dassey in rural Wisconsin. Both were sentenced to serve life in person for the 2005 murder of Teresa Halbach. DNA evidence had previously exonerated Avery from a rape conviction—but only after he'd served 18 years in jail as an innocent man. At the time he was arrested for Halbach's murder, Avery was suing the local police department for misconduct in his initial arrest and prosecution. Throughout the show, the documentarians suggest that the Manitowoc County police were out to get Avery in order to dispense with the lawsuit, and that they planted DNA evidence on the crime scene to frame him. And while Avery is the primary focus of the series, the show is particularly damning of the way the police treated Dassey, who was just 16 years old when he was arrested and suffering from obvious mental impairment. His conviction was predicated entirely on a confession that was clearly coerced.
Convinced of their innocence—or at least the malfeasance of the criminal justice system in the investigation—fans have called for Avery and Dassey to be released. "This is a black mark on the justice system as a whole, and should be recognized as such, while also giving these men the ability to live as normal a life as possible," the petition on the White House website reads.
But there's nothing President Barack Obama can do to help out Avery or Dassey. As the White House's response notes, both were convicted in a Wisconsin state court, and the president's pardon authority applies only to people who have committed federal crimes. (As president, Obama has been hesitant to offer any pardons or clemency, though he's ramped up the number he's issued over the past year.)
So who could answer the pleas of Making a Murderer binge watchers? That'd be Wisconsin governor and erstwhile presidential candidate Scott Walker. Earlier this week, he shut down all speculation that he might intervene, by reaffirming his longstanding position of refusing to offer any pardons as governor.
Scott Walker Corruption Case Threatens to Implicate Wisconsin Supreme Court Justices
John Oliver Slams the Criminal Justice System for Setting Former Prisoners Up to Fail
The New Bipartisan Criminal-Justice Reform Bill Doesn't Live Up to Its Own Hype
Shane Bauer


text:
FTC Votes to File Suit to Block Microsoft's $69 Billion Activision Deal
Leah Nylen, Dina Bass and Cecilia D'Anastasio
(Bloomberg) -- The US Federal Trade Commission is seeking to block Microsoft Corp.'s $69 billion acquisition of Activision Blizzard Inc., saying the tie-up between the Xbox maker and popular gaming publisher would harm competition.
Is Putin Finally Getting Smart About His Ukraine Disaster?
Powell Says Fed Still Has a 'Ways to Go' After Half-Point Hike
Musk Loses World's Richest Title to Arnault With Tesla Unwinding
Who Is Bernard Arnault, the World's Richest Person?
The commission voted 3-1 in favor of the complaint, which was filed in its in-house court. Regulators said Microsoft's ownership of Activision could hurt other players in the $200 billion gaming market by limiting rivals' access to the company's biggest games. The transaction would turn Microsoft into the No. 3 gaming company, behind Tencent Holdings Ltd. and Sony Group Corp.
"Microsoft has already shown that it can and will withhold content from its gaming rivals," said Holly Vedova, director of the FTC's Bureau of Competition. "Today we seek to stop Microsoft from gaining control over a leading independent game studio and using it to harm competition in multiple dynamic and fast-growing gaming markets."
An FTC official, speaking anonymously to discuss the complaint, said the agency was concerned that Microsoft could deny access, delay availability or degrade the quality of Activision Blizzard's most popular titles to rival platforms. Those concerns relate not only to consoles, but also to subscription services and cloud-based gaming, two markets still in development, the official said.
Microsoft's proposed Activision Blizzard deal is the company's largest ever and one of the 30 biggest acquisitions of all time. The transaction would give Microsoft some of the most popular video game franchises, such as Call of Duty and World of Warcraft. The Xbox maker already owns the Halo franchise and Minecraft virtual-world-building game.
"We continue to believe that this deal will expand competition and create more opportunities for gamers and game developers," said Microsoft President Brad Smith. He said the company is committed to addressing competition concerns and that it offered concessions to the FTC earlier this week.
"We have complete confidence in our case and welcome the opportunity to present our case in court," Smith added.
Activision shares fell 1.5% to $74.76 after falling as much as 3.9% earlier. Microsoft shares rose 1.2% to $247.40.
In a letter, Activision Blizzard Chief Executive Officer Bobby Kotick assured employees he is confident that the deal will close.
"The allegations that this deal is anti-competitive doesn't align with the facts, and we believe we'll win this challenge," Kotick said, adding that the combined company would be "good for players," despite a regulatory environment that he says is "focused on ideology and misconceptions about the tech industry."
The FTC scheduled its in-house trial to begin on August 2, 2023. In prior merger challenges in the agency's in-house court, the judge issued an initial decision between seven and 12 months after the trial began, said Jennifer Rie, an analyst for Bloomberg Intelligence. That would likely put a decision by FTC Administrative Law Judge D. Michael Chappell in early 2024. After that, Microsoft or the FTC staff litigating the case can appeal his ruling to the agency's commissioners.
Microsoft and Activision have said the deal will close by June 30, the end of Microsoft's current fiscal year. The FTC would need to separately sue in federal court if it wants Microsoft to put off closing the deal until after the trial is over.
"With control of Activision's content, Microsoft would have the ability and increased incentive to withhold or degrade Activision's content in ways that substantially lessen competition — including competition on product quality, price, and innovation," the agency said in its complaint. "This loss of competition would likely result in significant harm to consumers in multiple markets at a pivotal time for the industry."
In its release announcing the lawsuit, the FTC cited Microsoft's decision to make two upcoming titles by newly acquired unit Bethesda Softworks exclusive to Microsoft's platforms despite assurances the company gave to EU regulators that it had no incentive to withhold games from rival consoles.
The lawsuit is part of an effort by FTC Chair Lina Khan to more aggressively police mergers, particularly those by the biggest tech platforms. Since President Joe Biden appointed her to helm the agency in June 2021, it has killed mergers between Lockheed Martin Corp. and Aerojet Rocketdyne Holdings Inc. as well as Nvidia Corp.'s bid to buy SoftBank Group Corp.'s Arm. The FTC heads to federal court Thursday in San Jose, California, in an effort to block Meta Platforms Inc. from buying a virtual reality startup.
Although Brazilian antitrust officials cleared the Microsoft-Activision deal in October, other competition regulators, including the UK and the European Union, have also raised concerns. Those two bodies aren't set to issue decisions on the deal until next year.
Microsoft on Tuesday announced a deal to bring Call of Duty to the Steam PC gaming platform and Nintendo Co. consoles. The company said it's also offered a proposal that would keep Call of Duty on Sony's PlayStation for the next 10 years, but the Japanese electronics giant has so far rebuffed efforts to work out a resolution. Sony has fiercely objected to the Activision acquisition, primarily because of concerns the US tech giant could make content like Call of Duty exclusive to its own gaming services.
"There's been one game industry participant that's really been raising all the objections, and that's Sony, and they've been fairly public about the things that don't meet their expectations," Xbox chief Phil Spencer said in an interview Tuesday. "From where we sit, it's clear they're spending more time with the regulators than they are with us to try and get this deal done."
Joost van Dreunen, a video games expert who teaches at New York University's Stern School of Business, said antitrust authorities have become skeptical of pledges, particularly by the tech platforms, about future behavior. Van Dreunen provided comments on the deal to UK competition officials.
"I don't think it's ultimately enough for the FTC to go on," van Dreunen said of Microsoft's pledge.
The Redmond, Washington, tech giant sought to placate possible labor concerns about the merger by reaching an agreement with the Communications Workers of America, which also represents employees in the gaming industry. In the pact, Microsoft pledged to take a neutral approach if employees express interest in joining a union.
The company also said it would stop using noncompete or confidentiality clauses to bar workers from talking about discrimination or harassment as part of a settlement or separation deal. The FTC has publicly raised concerns about the use of noncompetes and the impact of mergers on labor conditions.
(Updates with details on trial schedule from 11th paragraph.)
AmEx Hooked Big Spenders and Regained the Throne With a Pricier Platinum Card
Long Covid's Effects Go Beyond Respiratory Issues
Elon Musk's Twitter Is a Shakespearean Psychodrama Set in Silicon Valley
TikTok's Problem Child Has 7 Million Followers and One Proud Mom
The FUD Behind the Crypto Collapse
UPDATE 1-Russia vows to push Ukrainian army back in response to longer-range rockets
Deutsche Bank Misses as Debt Traders' Winning Streak Snaps
KKR Bids for Telecom Italia Grid as Carrier Aims to Cut Debt
Why Plug Power Stock Popped Almost 5% Today
Shares of hydrogen fuel cell star Plug Power (NASDAQ: PLUG) jumped 4.7% through 11:45 a.m. ET Tuesday morning after the company secured a long-term supply agreement with British hydrogen technologies company Johnson Matthey (LSE: JMAT). Under the terms of the agreement, Johnson Matthey will supply Plug with components for membrane electrode assemblies and specifically with "catalysts, membranes, and catalyst coated membranes (CCM)" -- essential parts for building fuel cells. Plug says that partnering with Johnson Matthey will "strengthen its supply chain and help meet the growing demand for fuel cells and electrolyzers."
Shell Adds $41 Billion in Profit to Record Annual Haul From Oil Majors
Shell became the latest oil giant to post a record annual profit last year, joining U.S. peers in surging back from early pandemic losses on soaring energy prices.
Hellish hat-trick: This ultrarich New York family lost billions on Enron, Bernie Madoff, and now FTX — here are 3 simple tricks to avoid getting scammed yourself
Talk about bad luck.


text:
Ел Саукал има више значења:

 Ел Саукал (Акахете), насеље у савезној држави Веракруз у Мексику
 Ел Саукал (Теночтитлан), насеље у савезној држави Веракруз у Мексику

redpajama_set_name: RedPajamaWikipedia


text:
import struct
import array
import sys

from air.air_common import *
from iri_exception import *

def field_width_get(field_name, attrs, field_values, remaining_bits=None):
    """
    @brief Get the width of a field based on current values

    @param field_name The name of the field (for debug messages only)
    @param attrs The attributes from the top level desc
    @param field_values A dict used in eval if width is an expression
    @param remaining_bits Number of bits remaining in header, if known

    @todo Consider changing semantics to return an error (None)
    and do not do the assert here

    If the width calculation is negative, 0 is returned.
    """
    if isinstance(attrs, int):
        return attrs
    if isinstance(attrs, dict):
        air_assert("width" in attrs.keys(), "Bad field attrs; no width")
        return field_width_get(field_name, attrs["width"], field_values)
    # Attempt to evaluate a string expression
    air_assert(isinstance(attrs, str),
               "Bad field attrs; not int, dict, string")
    try:
        width = eval(attrs, {"__builtins__":None}, field_values)
    except:  # @todo NameError?
        raise IriReferenceError("Bad width expression for %s" + field_name)

    # If calculation is negative, return 0
    if width < 0:
        return 0
    return width

class field_instance(object):
    """
    @brief A field is a value and a map of attributes

    @param name The name of the field as it appears in its parent header
    @param attrs Either a dict or an int; if an int, it is the width in bits
    @param width Width in bits of the field
    @param value An optional initial value of the field (host representation)

    Fields of width <= 64 bits are stored as integer values
    Fields of greater width are stored as "B" arrays. width must be
    divisible by 8.
    """

    # Masks for bit widths <= 8
    BYTE_MASK = [0, 1, 3, 7, 0xf, 0x1f, 0x3f, 0x7f, 0xff]

    def __init__(self, name, attrs, width, value=None):
        self.name = name
        self.attrs = attrs
        self.width = width
        self.value = value

    def extract(self, buf, header_offset, bit_offset):
        """
        @brief Extract the field value from the given header instance

        @param buf A byte array holding the header data
        @param header_offset Start of the header instance in the buf
        @param bit_offset The bit offset into the header where the field starts

        NOTE that bit_offset is the offset from the start of the header, so
        it may be greater than 8.

        @todo Assumes the field does not extend beyond the packet boundary
        """

        air_assert(self.width >= 0,
                   "Unknown width when extracting field %s" % self.name)
        byte_offset = header_offset + (bit_offset / 8)
        bit_offset = bit_offset % 8
        width = self.width

        # Easy cases:
        if bit_offset == 0:
            base = byte_offset
            if width == 8:
                self.value = struct.unpack("!B", buf[base:base+1])[0]
                return self.value
            elif width == 16:
                self.value = struct.unpack("!H", buf[base:base+2])[0]
                return self.value
            elif width == 32:
                self.value = struct.unpack("!L", buf[base:base+4])[0]
                return self.value
            elif width == 64:
                self.value = struct.unpack("!Q", buf[base:base+8])[0]
                return self.value
            elif width > 64:
                self.value = bytearray(buf[base: base+width/8])
                return self.value

        air_assert(width < 64, "Bad field width/offset %d, %d for %s" %
                   (width, bit_offset, self.name))
        # Extract bytes into an array
        # Iterate thru the array accumulating value
        # Note that bit offsets are from high order of byte
        bytes_needed = (width + bit_offset + 7) / 8
        low = header_offset + byte_offset
        high = low + bytes_needed
        bytes = bytearray(buf[low:high])
        value = 0
        while width > 0:
            if width + bit_offset <= 8:
                high_bit = 7 - bit_offset
                low_bit = high_bit - width + 1
                val_from_byte = (bytes[0] >> low_bit) & self.BYTE_MASK[width]
                shift = ((width < 8) and width) or 8
                value = (value << shift) + val_from_byte
                break
            else:
                if bit_offset == 0:
                    value = (value << 8) + bytes.pop(0)
                    width -= 8
                else:
                    high_bit = 7 - bit_offset
                    val_from_byte = bytes.pop(0) & self.BYTE_MASK[high_bit + 1]
                    width -= (high_bit + 1)
                    bit_offset = 0
                    shift = ((width < 8) and width) or 8
                    value = (value << shift) + val_from_byte
        self.value = value
        return value

    def update_header_bytes(self, byte_list, bit_offset):
        """
        @brief Update a header (a list of bytes) with the current field value

        @param byte_list A bytearray representing the entire header
        @param bit_offset The bit offset of the field from the start
        of the header
        """

        air_assert(self.width >= 0,
                   "Unknown field width for %s when updating header"
                   % self.name)

        byte_offset = (bit_offset / 8)
        bit_offset = bit_offset % 8
        width = self.width

        # Easy cases:
        if width == 0:
            return

        # Value is an array of bytes: copy them in
        if isinstance(self.value, bytearray):
            for idx in range(len(self.value)):
                byte_list[byte_offset + idx] = self.value[idx]
            return

        # Byte boundary and just bytes
        # @todo Assumes big endian in the packet
        value = self.value
        if bit_offset == 0 and width % 8 == 0:
            for idx in reversed(range(width / 8)):
                byte_list[byte_offset + idx] = value & 0xff
                value >>= 8
            return

        # Hard cases: Shift value appropriately and convert to bytes
        # @todo This will have a problem if value << shift overflows
        bytes_needed = (width + bit_offset + 7) / 8

        shift = 8 - ((bit_offset + width) % 8)
        if shift == 8: shift = 0

        value <<= shift

        for idx in range(bytes_needed):
            value_byte = (value >> (8 * (bytes_needed - 1 - idx))) & 0xFF
            #print "  VAL", value_byte, width, bit_offset
            if width + bit_offset <= 8: # Fits in this byte and done
                shift = 8 - (bit_offset + width)
                mask = self.BYTE_MASK[width] << shift
                #print "  MASK", mask, byte_offset
                byte_list[byte_offset + idx] &= ~mask
                byte_list[byte_offset + idx] |= value_byte
                # Should be last entry
                width = 0
            else: # Goes to end of byte
                if bit_offset == 0:  # Covers whole byte
                    # width > 8 by above
                    byte_list[byte_offset + idx] = value_byte
                    width -= 8
                else: # Covers lower bits of byte
                    # width + bit_offset > 8, so goes to end of byte
                    mask = self.BYTE_MASK[8 - bit_offset]
                    byte_list[byte_offset + idx] &= ~mask
                    byte_list[byte_offset + idx] |= value_byte
                    width -= (8 - bit_offset)
                    bit_offset = 0

################################################################
#
# Test code
#
################################################################

if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG, filename=sys.argv[1])
    logging.info("RUNNING MODULE: %s" % __file__)

    # Testing code for field class
    attrs = 17
    air_assert(field_width_get("fld", attrs, {}) == 17, "Failed field test 1")

    attrs = {"width" : 17}
    air_assert(field_width_get("fld", attrs, {}) == 17, "Failed field test 2")

    attrs = "10 + 7"
    air_assert(field_width_get("fld", attrs, {}) == 17, "Failed field test 3")

    attrs = "x + 7"
    air_assert(field_width_get("fld", attrs, {"x" : 10}) == 17,
               "Failed field test 4")

    attrs = {"width" : "x + 7"}
    air_assert(field_width_get("fld", attrs, {"x" : 10}) == 17,
               "Failed field test 5")

    try:
        field_width_get("fld", "bad string", {})
        air_assert(False, "Failed field test 6")
    except IriReferenceError:
        pass

    # Two VLAN tags w/ IDs 356 and 200; the first has priority 5
    data = struct.pack("BBBBBBBB", 0x81, 0, 0xa1, 0x64, 0x81, 0, 0, 0xc8)

    field = field_instance("fld", {}, 8)
    field.extract(data, 0, 0)
    air_assert(field.value == 0x81,  "Failed field test 7")

    field = field_instance("fld", {}, 16)
    field.extract(data, 0, 0)
    air_assert(field.value == 0x8100,  "Failed field test 7")

    field = field_instance("vid", {}, 12)
    field.extract(data, 0, 20)
    air_assert(field.value == 356,  "Failed field test 8")

    field = field_instance("pcp", {}, 3)
    field.extract(data, 0, 16)
    air_assert(field.value == 5,  "Failed field test 9")

    # @todo Write test cases for fields that are longer byte streams

    values = range(16)
    values.extend([0xaaaaaaaa, 0x55555555, 0xffffffff])

    # Test with all 1 bits as baseline
    for width in range(33):
        for offset in range(32):
            for value in values:
                field = field_instance("f%d_%d" % (width, offset), {}, width)
                value &= ((1 << width) - 1)
                field.value = value
                byte_list = bytearray(8)
                for idx in range(8): byte_list[idx] = 0xff
                #print "START", value, width, offset
                field.update_header_bytes(byte_list, offset)
                #print "    UPDATE", array.array("B", byte_list)
                field.extract(byte_list, 0, offset)
                #print "        EXTRACTED", field.value
                air_assert(field.value == value,
                           "Failed, all 1s, width %d, offset %d" %
                           (width, offset))

    # Test with all 0 bits as baseline
    for width in range(33):
        for offset in range(32):
            for value in values:
                field = field_instance("f%d_%d" % (width, offset), {}, width)
                value &= ((1 << width) - 1)
                field.value = value
                byte_list = bytearray(8)
                field.update_header_bytes(byte_list, offset)
                field.extract(byte_list, 0, offset)
                air_assert(field.value == value,
                           "Failed convert case width %d, offset %d" %
                           (width, offset))