[#1320] English Check

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-04-21 14:28:05 +03:00 committed by LeL
parent d99800ee93
commit cc7a723d77
182 changed files with 802 additions and 802 deletions

View file

@ -26,7 +26,7 @@ type coordinateCode struct {
// of the location conforming to UN/LOCODE specification.
type LongitudeCode coordinateCode
// LongitudeHemisphere represents hemisphere of the earth
// LongitudeHemisphere represents the hemisphere of the earth
// // along the Greenwich meridian.
type LongitudeHemisphere [hemisphereSymbols]uint8
@ -34,7 +34,7 @@ type LongitudeHemisphere [hemisphereSymbols]uint8
// of the location conforming to UN/LOCODE specification.
type LatitudeCode coordinateCode
// LatitudeHemisphere represents hemisphere of the earth
// LatitudeHemisphere represents the hemisphere of the earth
// along the equator.
type LatitudeHemisphere [hemisphereSymbols]uint8
@ -66,7 +66,7 @@ loop:
}, nil
}
// LongitudeFromString parses string and returns location's longitude.
// LongitudeFromString parses a string and returns the location's longitude.
func LongitudeFromString(s string) (*LongitudeCode, error) {
cc, err := coordinateFromString(s, lngDegDigits, []uint8{'W', 'E'})
if err != nil {
@ -76,7 +76,7 @@ func LongitudeFromString(s string) (*LongitudeCode, error) {
return (*LongitudeCode)(cc), nil
}
// LatitudeFromString parses string and returns location's latitude.
// LatitudeFromString parses a string and returns the location's latitude.
func LatitudeFromString(s string) (*LatitudeCode, error) {
cc, err := coordinateFromString(s, latDegDigits, []uint8{'N', 'S'})
if err != nil {
@ -90,13 +90,13 @@ func (cc *coordinateCode) degrees() []uint8 {
return cc.value[:cc.degDigits]
}
// Degrees returns longitude's degrees.
// Degrees returns the longitude's degrees.
func (lc *LongitudeCode) Degrees() (l [lngDegDigits]uint8) {
copy(l[:], (*coordinateCode)(lc).degrees())
return
}
// Degrees returns latitude's degrees.
// Degrees returns the latitude's degrees.
func (lc *LatitudeCode) Degrees() (l [latDegDigits]uint8) {
copy(l[:], (*coordinateCode)(lc).degrees())
return
@ -110,22 +110,22 @@ func (cc *coordinateCode) minutes() (mnt [minutesDigits]uint8) {
return
}
// Minutes returns longitude's minutes.
// Minutes returns the longitude's minutes.
func (lc *LongitudeCode) Minutes() [minutesDigits]uint8 {
return (*coordinateCode)(lc).minutes()
}
// Minutes returns latitude's minutes.
// Minutes returns the latitude's minutes.
func (lc *LatitudeCode) Minutes() [minutesDigits]uint8 {
return (*coordinateCode)(lc).minutes()
}
// Hemisphere returns longitude's hemisphere code.
// Hemisphere returns the longitude's hemisphere code.
func (lc *LongitudeCode) Hemisphere() LongitudeHemisphere {
return (*coordinateCode)(lc).hemisphere()
}
// Hemisphere returns latitude's hemisphere code.
// Hemisphere returns the latitude's hemisphere code.
func (lc *LatitudeCode) Hemisphere() LatitudeHemisphere {
return (*coordinateCode)(lc).hemisphere()
}
@ -148,24 +148,24 @@ func (h LongitudeHemisphere) East() bool {
return h[0] == 'E'
}
// Coordinates represents coordinates of the location from UN/LOCODE table.
// Coordinates represents the coordinates of the location from UN/LOCODE table.
type Coordinates struct {
lat *LatitudeCode
lng *LongitudeCode
}
// Latitude returns location's latitude.
// Latitude returns the location's latitude.
func (c *Coordinates) Latitude() *LatitudeCode {
return c.lat
}
// Longitude returns location's longitude.
// Longitude returns the location's longitude.
func (c *Coordinates) Longitude() *LongitudeCode {
return c.lng
}
// CoordinatesFromString parses string and returns location's coordinates.
// CoordinatesFromString parses a string and returns the location's coordinates.
func CoordinatesFromString(s string) (*Coordinates, error) {
if len(s) == 0 {
return nil, nil

View file

@ -14,7 +14,7 @@ func (cc *CountryCode) Symbols() [countryCodeLen]uint8 {
return *cc
}
// CountryCodeFromString parses string and returns country code.
// CountryCodeFromString parses a string and returns the country code.
func CountryCodeFromString(s string) (*CountryCode, error) {
if len(s) != countryCodeLen {
return nil, locode.ErrInvalidString

View file

@ -14,7 +14,7 @@ func (lc *LocationCode) Symbols() [locationCodeLen]uint8 {
return *lc
}
// LocationCodeFromString parses string and returns location code.
// LocationCodeFromString parses a string and returns the location code.
func LocationCodeFromString(s string) (*LocationCode, error) {
if len(s) != locationCodeLen {
return nil, locode.ErrInvalidString

View file

@ -41,8 +41,8 @@ type record struct {
lng string
}
// Get scans records of the OpenFlights Airport to in-memory table (once),
// and returns entry that matches passed UN/LOCODE record.
// Get scans the records of the OpenFlights Airport to an in-memory table (once),
// and returns an entry that matches the passed UN/LOCODE record.
//
// Records are matched if they have the same country code and either
// same IATA code or same city name (location name in UN/LOCODE).
@ -90,8 +90,8 @@ const (
countryFldNum
)
// CountryName scans records of the OpenFlights Country table to in-memory table (once),
// and returns name of the country by code.
// CountryName scans the records of the OpenFlights Country table to an in-memory table (once),
// and returns the name of the country by code.
//
// Returns locodedb.ErrCountryNotFound if no entry matches.
func (db *DB) CountryName(code *locodedb.CountryCode) (name string, err error) {

View file

@ -11,7 +11,7 @@ import (
"go.etcd.io/bbolt"
)
// Open opens underlying BoltDB instance.
// Open opens an underlying BoltDB instance.
//
// Timeout of BoltDB opening is 3s (only for Linux or Darwin).
//
@ -33,7 +33,7 @@ func (db *DB) Open() error {
return nil
}
// Close closes underlying BoltDB instance.
// Close closes an underlying BoltDB instance.
//
// Must not be called before successful Open call.
func (db *DB) Close() error {
@ -94,10 +94,10 @@ func recordFromValue(data []byte) (*locodedb.Record, error) {
return r, nil
}
// Put saves the record by key in underlying BoltDB instance.
// Put saves the record by key in an underlying BoltDB instance.
//
// Country code from key is used for allocating the 1st level buckets.
// Records are stored in country buckets by location code from key.
// Country code from the key is used for allocating the 1st level buckets.
// Records are stored in country buckets by the location code from the key.
// The records are stored in internal binary JSON format.
//
// Must not be called before successful Open call.

View file

@ -58,7 +58,7 @@ func (c Continent) String() string {
}
// ContinentFromString returns Continent value
// corresponding to passed string representation.
// corresponding to the passed string representation.
func ContinentFromString(str string) Continent {
switch str {
default:

View file

@ -12,8 +12,8 @@ import (
const continentProperty = "Continent"
// PointContinent goes through all polygons, and returns continent
// in which point is located.
// PointContinent goes through all polygons and returns the continent
// in which the point is located.
//
// Returns locodedb.ContinentUnknown if no entry matches.
//

View file

@ -6,12 +6,12 @@ import (
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
)
// CountryCode represents country code for
// storage in the NeoFS location database.
// CountryCode represents a country code for
// the storage in the NeoFS location database.
type CountryCode locodecolumn.CountryCode
// CountryCodeFromString parses string UN/LOCODE country code
// and returns CountryCode.
// CountryCodeFromString parses a string UN/LOCODE country code
// and returns a CountryCode.
func CountryCodeFromString(s string) (*CountryCode, error) {
cc, err := locodecolumn.CountryCodeFromString(s)
if err != nil {
@ -21,7 +21,7 @@ func CountryCodeFromString(s string) (*CountryCode, error) {
return CountryFromColumn(cc)
}
// CountryFromColumn converts UN/LOCODE country code to CountryCode.
// CountryFromColumn converts a UN/LOCODE country code to a CountryCode.
func CountryFromColumn(cc *locodecolumn.CountryCode) (*CountryCode, error) {
return (*CountryCode)(cc), nil
}

View file

@ -59,14 +59,14 @@ var ErrCountryNotFound = errors.New("country not found")
// NamesDB is an interface of the NeoFS location namespace.
type NamesDB interface {
// Must resolve country code to country name.
// Must resolve a country code to a country name.
//
// Must return ErrCountryNotFound if there is no
// country with provided code.
// country with the provided code.
CountryName(*CountryCode) (string, error)
// Must resolve (country code, subdivision code) to
// subdivision name.
// a subdivision name.
//
// Must return ErrSubDivNotFound if either country or
// subdivision is not presented in database.
@ -152,8 +152,8 @@ func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB
})
}
// LocodeRecord returns record from the NeoFS location database
// corresponding to string representation of UN/LOCODE.
// LocodeRecord returns the record from the NeoFS location database
// corresponding to the string representation of UN/LOCODE.
func LocodeRecord(db DB, sLocode string) (*Record, error) {
lc, err := locode.FromString(sLocode)
if err != nil {

View file

@ -6,12 +6,12 @@ import (
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
)
// LocationCode represents location code for
// storage in the NeoFS location database.
// LocationCode represents a location code for
// the storage in the NeoFS location database.
type LocationCode locodecolumn.LocationCode
// LocationCodeFromString parses string UN/LOCODE location code
// and returns LocationCode.
// LocationCodeFromString parses a string UN/LOCODE location code
// and returns a LocationCode.
func LocationCodeFromString(s string) (*LocationCode, error) {
lc, err := locodecolumn.LocationCodeFromString(s)
if err != nil {
@ -21,7 +21,7 @@ func LocationCodeFromString(s string) (*LocationCode, error) {
return LocationFromColumn(lc)
}
// LocationFromColumn converts UN/LOCODE country code to LocationCode.
// LocationFromColumn converts a UN/LOCODE country code to a LocationCode.
func LocationFromColumn(cc *locodecolumn.LocationCode) (*LocationCode, error) {
return (*LocationCode)(cc), nil
}

View file

@ -7,12 +7,12 @@ import (
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
)
// Point represents 2D geographic point.
// Point represents a 2D geographic point.
type Point struct {
lat, lng float64
}
// NewPoint creates, initializes and returns new Point.
// NewPoint creates, initializes and returns a new Point.
func NewPoint(lat, lng float64) *Point {
return &Point{
lat: lat,
@ -20,17 +20,17 @@ func NewPoint(lat, lng float64) *Point {
}
}
// Latitude returns Point's latitude.
// Latitude returns the Point's latitude.
func (p Point) Latitude() float64 {
return p.lat
}
// Longitude returns Point's longitude.
// Longitude returns the Point's longitude.
func (p Point) Longitude() float64 {
return p.lng
}
// PointFromCoordinates converts UN/LOCODE coordinates to Point.
// PointFromCoordinates converts a UN/LOCODE coordinates to a Point.
func PointFromCoordinates(crd *locodecolumn.Coordinates) (*Point, error) {
if crd == nil {
return nil, nil

View file

@ -33,12 +33,12 @@ func NewKey(lc locode.LOCODE) (*Key, error) {
}, nil
}
// CountryCode returns location's country code.
// CountryCode returns the location's country code.
func (k *Key) CountryCode() *CountryCode {
return k.cc
}
// LocationCode returns location code.
// LocationCode returns the location code.
func (k *Key) LocationCode() *LocationCode {
return k.lc
}
@ -60,7 +60,7 @@ type Record struct {
var errParseCoordinates = errors.New("invalid coordinates")
// NewRecord calculates Record from UN/LOCODE table record.
// NewRecord calculates the Record from the UN/LOCODE table record.
func NewRecord(r locode.Record) (*Record, error) {
crd, err := locodecolumn.CoordinatesFromString(r.Coordinates)
if err != nil {
@ -79,42 +79,42 @@ func NewRecord(r locode.Record) (*Record, error) {
}, nil
}
// CountryName returns country name.
// CountryName returns the country name.
func (r *Record) CountryName() string {
return r.countryName
}
// SetCountryName sets country name.
// SetCountryName sets the country name.
func (r *Record) SetCountryName(name string) {
r.countryName = name
}
// LocationName returns location name.
// LocationName returns the location name.
func (r *Record) LocationName() string {
return r.locationName
}
// SetLocationName sets location name.
// SetLocationName sets the location name.
func (r *Record) SetLocationName(name string) {
r.locationName = name
}
// SubDivCode returns subdivision code.
// SubDivCode returns the subdivision code.
func (r *Record) SubDivCode() string {
return r.subDivCode
}
// SetSubDivCode sets subdivision code.
// SetSubDivCode sets the subdivision code.
func (r *Record) SetSubDivCode(name string) {
r.subDivCode = name
}
// SubDivName returns subdivision name.
// SubDivName returns the subdivision name.
func (r *Record) SubDivName() string {
return r.subDivName
}
// SetSubDivName sets subdivision name.
// SetSubDivName sets the subdivision name.
func (r *Record) SetSubDivName(name string) {
r.subDivName = name
}
@ -129,12 +129,12 @@ func (r *Record) SetGeoPoint(p *Point) {
r.p = p
}
// Continent returns location continent.
// Continent returns the location continent.
func (r *Record) Continent() *Continent {
return r.cont
}
// SetContinent sets location continent.
// SetContinent sets the location continent.
func (r *Record) SetContinent(c *Continent) {
r.cont = c
}

View file

@ -13,7 +13,7 @@ import (
var errInvalidRecord = errors.New("invalid table record")
// IterateAll scans table record one-by-one, parses UN/LOCODE record
// IterateAll scans a table record one-by-one, parses a UN/LOCODE record
// from it and passes it to f.
//
// Returns f's errors directly.
@ -64,8 +64,8 @@ type subDivRecord struct {
name string
}
// SubDivName scans table record to in-memory table (once),
// and returns subdivision name on country and subdivision codes match.
// SubDivName scans a table record to an in-memory table (once),
// and returns the subdivision name of the country and the subdivision codes match.
//
// Returns locodedb.ErrSubDivNotFound if no entry matches.
func (t *Table) SubDivName(countryCode *locodedb.CountryCode, code string) (string, error) {

View file

@ -19,7 +19,7 @@ func defaultOpts() *options {
}
}
// WithExtraPaths returns option to add extra paths
// WithExtraPaths returns an option to add extra paths
// to UN/LOCODE tables in csv format.
func WithExtraPaths(ps ...string) Option {
return func(o *options) {