Skip to content

Commit 8a0b7d7

Browse files
committed
Update dependencies and bugfix
1 parent 05a7e00 commit 8a0b7d7

File tree

12 files changed

+1064
-1009
lines changed

12 files changed

+1064
-1009
lines changed

Cargo.lock

Lines changed: 920 additions & 944 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/codeforces/contest_ids.csv

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,3 +1309,85 @@
13091309
1700
13101310
1696
13111311
1698
1312+
1699
1313+
1701
1314+
1702
1315+
1703
1316+
1705
1317+
1708
1318+
1707
1319+
1706
1320+
1709
1321+
1711
1322+
1704
1323+
1714
1324+
1716
1325+
1713
1326+
1712
1327+
1719
1328+
1718
1329+
1720
1330+
1715
1331+
1721
1332+
1722
1333+
1717
1334+
1728
1335+
1729
1336+
1733
1337+
1734
1338+
1730
1339+
1739
1340+
1738
1341+
1735
1342+
1737
1343+
1736
1344+
1741
1345+
1742
1346+
1746
1347+
1744
1348+
1743
1349+
1749
1350+
1754
1351+
1753
1352+
1732
1353+
1740
1354+
1747
1355+
1750
1356+
1748
1357+
1759
1358+
1761
1359+
1760
1360+
1758
1361+
1764
1362+
1771
1363+
1766
1364+
1762
1365+
1767
1366+
1774
1367+
1772
1368+
1763
1369+
1731
1370+
1770
1371+
1779
1372+
1768
1373+
1783
1374+
1775
1375+
1782
1376+
1781
1377+
1777
1378+
1792
1379+
1790
1380+
1787
1381+
1778
1382+
1791
1383+
1786
1384+
1785
1385+
1784
1386+
1788
1387+
1793
1388+
1795
1389+
1789
1390+
1799
1391+
1796
1392+
1800
1393+
1794

multi-skill/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ categories = ["algorithms", "mathematics", "game-development"]
1212
license = "MIT"
1313

1414
[dependencies]
15-
rayon = "1.5"
16-
reqwest = { version = "0.11.9", features = ["json", "blocking"] }
15+
rayon = "1.7"
16+
reqwest = { version = "0.11.14", features = ["json", "blocking"] }
1717
serde = { version = "1.0", features = ["derive"] }
1818
serde_json = "1.0"
19-
statrs = "0.15.0"
19+
statrs = "0.16.0"
2020
overload = "0.1.1"
21-
csv = "1.1"
22-
select = "0.6.0-alpha"
21+
csv = "1.2"
22+
select = "0.6.0"
2323
superslice = "1.0"
24-
tracing = "0.1.32"
25-
tracing-subscriber = "0.3.9"
26-
smallvec = { version = "1.8", features = ["union"] }
24+
tracing = "0.1.37"
25+
tracing-subscriber = "0.3.16"
26+
smallvec = { version = "1.10", features = ["union"] }
2727
rand = "0.8.5"
2828
json5 = "0.4.1"
2929
#f128 = "0.2.9" (formerly used to test high-precision TrueSkill, but requires GCC's __float128)
30-
num-traits = "0.2.14"
31-
itertools = "0.10.3"
32-
chrono = "0.4.19"
30+
num-traits = "0.2.15"
31+
itertools = "0.10.5"
32+
chrono = "0.4.23"
3333

3434
[[bin]]
3535
name = "rate"

multi-skill/src/bin/ctf.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'a, I: Iterator<Item = Node<'a>>> Iterator for ArchiveRows<'a, I> {
3131
// This contest has no scoreboard, so skip it
3232
self.next()
3333
} else {
34-
let node = url_cell.select(Name("a")).next().unwrap();
34+
let node = url_cell.find(Name("a")).next().unwrap();
3535
let path = node.attr("href").unwrap();
3636
let id = path.strip_prefix("/event/").unwrap();
3737
Some(id.parse().unwrap())
@@ -59,14 +59,14 @@ for (contest_url, title, time_string) in table {
5959
tracing::info!("{} {} {}", contest_url, title, time_string);
6060
let contest_req = client.get(contest_url);
6161
let contest_page = request(contest_req).expect("Failed HTTP status");
62-
let title2 = contest_page.select(Name("h2")).next().unwrap().text();
62+
let title2 = contest_page.find(Name("h2")).next().unwrap().text();
6363
assert_eq!(title, title2);
64-
let time2 = contest_page.select(Name("p")).next().unwrap().text();
64+
let time2 = contest_page.find(Name("p")).next().unwrap().text();
6565
let time2 = time2.split("— ").nth(1).unwrap();
6666
let time2 = time2.split(" UTC").next().unwrap();
6767
assert_eq!(time_string, time2);
6868
let table = ScoreboardRows {
69-
table: year_page.select(Name("td")),
69+
table: year_page.find(Name("td")),
7070
};
7171
}
7272
*/
@@ -85,7 +85,7 @@ fn main() {
8585
let req = client.get(url);
8686
let page = request(req).expect("Failed HTTP status");
8787
let table = ArchiveRows {
88-
table: page.select(Name("td")),
88+
table: page.find(Name("td")),
8989
};
9090
let urls = table.collect::<Vec<_>>();
9191
urls.into_iter().rev()

multi-skill/src/bin/dance.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn request(builder: RequestBuilder) -> Result<Document, StatusCode> {
5656

5757
fn get_range(page: &Document, property_name: &str) -> RangeInclusive<u32> {
5858
let node = page
59-
.select(Attr("name", property_name))
59+
.find(Attr("name", property_name))
6060
.next()
6161
.unwrap_or_else(|| panic!("Can't find node with name={}", property_name));
6262
let min: u32 = node
@@ -75,7 +75,7 @@ fn get_range(page: &Document, property_name: &str) -> RangeInclusive<u32> {
7575
fn get_dates_and_urls(page: &Document) -> Vec<(u32, String)> {
7676
let mut res: Vec<(u32, String)> = Vec::new();
7777
// Every second one is a date
78-
for row in page.select(And(Class("t1n"), Name("tr"))) {
78+
for row in page.find(And(Class("t1n"), Name("tr"))) {
7979
let children: Vec<_> = row.children().collect();
8080
assert_eq!(children.len(), 2);
8181

@@ -98,7 +98,7 @@ fn get_rounds(page: &Document) -> impl Iterator<Item = String> + '_ {
9898
And(Class("t2b"), Name("td")),
9999
Or(Name("a"), And(Class("t2n"), Name("td"))),
100100
);
101-
page.select(pred).skip(5).map(|node| {
101+
page.find(pred).skip(5).map(|node| {
102102
if node.name() == Some("a") {
103103
// Delimit round names with special characters
104104
"$ ".to_string() + &node.text()
@@ -179,7 +179,7 @@ fn main() {
179179
comp_url
180180
);
181181

182-
let contest_name = match comp_page.select(Class("h4")).next() {
182+
let contest_name = match comp_page.find(Class("h4")).next() {
183183
Some(node) => node.text(),
184184
None => "Nameless Contest".to_string(),
185185
};
@@ -197,7 +197,7 @@ fn main() {
197197
&round_name,
198198
&mut num_rounds,
199199
/*This can be scraped from the O2CM results search. We'll leave it for now*/
200-
Utc.ymd(inyear as i32, inmonth, inday).and_hms(0, 0, 0),
200+
Utc.with_ymd_and_hms(inyear as i32, inmonth, inday, 0, 0, 0).unwrap(),
201201
);
202202
}
203203
round_name = tokens[1..tokens.len()].join(" ").to_string();
@@ -235,7 +235,7 @@ fn main() {
235235
&contest_name,
236236
&round_name,
237237
&mut num_rounds,
238-
Utc.ymd(inyear as i32, inmonth, inday).and_hms(0, 0, 0),
238+
Utc.with_ymd_and_hms(inyear as i32, inmonth, inday, 0, 0, 0).unwrap(),
239239
);
240240
}
241241
Err(status) => {

multi-skill/src/data_processing/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ mod test {
283283
let first_contest = dataset.get(0);
284284
let first_winner = &first_contest.standings[0];
285285

286-
assert_eq!(first_contest.weight, 1.);
286+
assert_eq!(first_contest.rating_params.weight, 1.);
287287
assert_eq!(first_contest.standings.len(), 66);
288288
assert_eq!(first_winner.0, "vepifanov");
289289
assert_eq!(first_winner.1, 0);

multi-skill/src/systems/elo_mmr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl RatingSystem for EloMMR {
254254
.map(|(player, lo, _)| {
255255
let (sig_perf, discrete_drift) =
256256
self.sig_perf_and_drift(params.weight, player.times_played_excl());
257-
let continuous_drift = self.drift_per_sec * player.update_time as f64;
257+
let continuous_drift = self.drift_per_sec * player.delta_time as f64;
258258
let sig_drift = (discrete_drift + continuous_drift).sqrt();
259259
match self.variant {
260260
// if transfer_speed is infinite or the prior is Gaussian, the logistic

multi-skill/src/systems/simple_elo_mmr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl RatingSystem for SimpleEloMMR {
6767
fn individual_update(&self, params: ContestRatingParams, player: &mut Player, mu_perf: f64) {
6868
let (sig_perf, discrete_drift) =
6969
self.sig_perf_and_drift(params.weight, player.times_played_excl());
70-
let continuous_drift = self.drift_per_sec * player.update_time as f64;
70+
let continuous_drift = self.drift_per_sec * player.delta_time as f64;
7171
let sig_drift = (discrete_drift + continuous_drift).sqrt();
7272
player.add_noise_best(sig_drift, self.transfer_speed);
7373

@@ -94,7 +94,7 @@ impl RatingSystem for SimpleEloMMR {
9494
.map(|(player, _, _)| {
9595
let (sig_perf, discrete_drift) =
9696
self.sig_perf_and_drift(params.weight, player.times_played_excl());
97-
let continuous_drift = self.drift_per_sec * player.update_time as f64;
97+
let continuous_drift = self.drift_per_sec * player.delta_time as f64;
9898
let sig_drift = (discrete_drift + continuous_drift).sqrt();
9999
player.add_noise_best(sig_drift, self.transfer_speed);
100100
player.approx_posterior.with_noise(sig_perf).into()

worldrank-api/Cargo.toml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@ name = "worldrank-api"
1515
multi-skill = { path = "../multi-skill" }
1616

1717
serde = { version = "1.0", features = ["derive"]}
18-
sqlx = { version = "0.5.9", default-features = false, features = ["runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] }
19-
config = "0.11.0"
20-
#actix-http = "=3.0.0-beta.8"
21-
#actix-service = "=2.0"
22-
actix-web = "4.0"
23-
tokio = { version = "1.17", features = ["macros"] }
24-
uuid = { version = "0.8.2", features = ["v4"] }
25-
chrono = "0.4.19"
26-
reqwest = { version = "0.11.9", default-features = false, features = ["json", "rustls-tls"] }
27-
tracing = "0.1.32"
18+
sqlx = { version = "0.6.2", default-features = false, features = ["runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] }
19+
config = "0.13.3"
20+
#actix-http = "3.3"
21+
#actix-service = "2.0"
22+
actix-web = "4.3"
23+
tokio = { version = "1.26", features = ["macros"] }
24+
uuid = { version = "1.3", features = ["v4"] }
25+
chrono = "0.4.23"
26+
reqwest = { version = "0.11.14", default-features = false, features = ["json", "rustls-tls"] }
27+
tracing = "0.1.37"
2828
#tracing-futures = "0.2.5"
29-
tracing-subscriber = { version = "0.3.9", features = ["registry", "env-filter"] }
30-
tracing-bunyan-formatter = "0.3.2"
31-
tracing-log = "0.1.2"
32-
tracing-actix-web = "0.5.1"
33-
tracing-appender = "0.2.1"
34-
serde-aux = "3.0"
35-
unicode-segmentation = "1.9"
29+
tracing-subscriber = { version = "0.3.16", features = ["registry", "env-filter"] }
30+
tracing-bunyan-formatter = "0.3.6"
31+
tracing-log = "0.1.3"
32+
tracing-actix-web = "0.7.2"
33+
tracing-appender = "0.2.2"
34+
serde-aux = "4.1"
35+
unicode-segmentation = "1.10"
3636
thiserror = "1.0"
3737
anyhow = "1.0"
38-
csv = "1.1"
38+
csv = "1.2"
3939
superslice = "1.0"
4040

4141
[dev-dependencies]
42-
#actix-rt = "2.7"
43-
claim = "0.5.0"
44-
#fake = "2.4"
42+
#actix-rt = "2.8"
43+
claims = "0.7.1"
44+
#fake = "2.5"
4545
fake = "~2.3"
46-
once_cell = "1.10"
46+
once_cell = "1.17"
4747
#quickcheck = "1.0"
4848
quickcheck = "0.9.2"
4949
quickcheck_macros = "1.0"
5050
serde_json = "1.0"
51-
wiremock = "0.5.11"
51+
wiremock = "0.5.17"

worldrank-api/src/configuration.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use serde_aux::field_attributes::deserialize_number_from_string;
22
use sqlx::postgres::PgConnectOptions;
33
use sqlx::postgres::PgSslMode;
4-
use std::convert::{TryFrom, TryInto}; // TODO: remove this import after 2021 edition
54

65
#[derive(Clone, serde::Deserialize)]
76
pub struct Settings {
@@ -51,27 +50,26 @@ impl DatabaseSettings {
5150
}
5251

5352
pub fn get_configuration() -> Result<Settings, config::ConfigError> {
54-
let mut settings = config::Config::default();
55-
5653
// Detect the running environment.
5754
let base_path = std::env::current_dir().expect("Failed to determine the current directory");
5855
let configuration_directory = base_path.join("configuration");
59-
settings.merge(config::File::from(configuration_directory.join("base")).required(true))?;
60-
56+
6157
// Layer on the environment-specific values.
6258
let environment: Environment = std::env::var("APP_ENVIRONMENT")
6359
.unwrap_or_else(|_| "local".into())
6460
.try_into()
6561
.expect("Failed to parse APP_ENVIRONMENT.");
66-
settings.merge(
67-
config::File::from(configuration_directory.join(environment.as_str())).required(true),
68-
)?;
69-
70-
// Add in settings from environment variables (with a prefix of APP and '__' as separator)
71-
// E.g. `APP_APPLICATION__PORT=5001 would set `Settings.application.port`
72-
settings.merge(config::Environment::with_prefix("app").separator("__"))?;
62+
63+
let environment_filename = format!("{}.yml", environment.as_str());
64+
let settings = config::Config::builder()
65+
.add_source(config::File::from(configuration_directory.join("base.yml")))
66+
.add_source(config::File::from(configuration_directory.join(&environment_filename)))
67+
// Add in settings from environment variables (with a prefix of APP and '__' as separator)
68+
// E.g. `APP_APPLICATION__PORT=5001 would set `Settings.application.port`
69+
.add_source(config::Environment::with_prefix("APP").prefix_separator("_").separator("__"))
70+
.build()?;
7371

74-
settings.try_into()
72+
settings.try_deserialize::<Settings>()
7573
}
7674

7775
/// The runtime environment for our application.

0 commit comments

Comments
 (0)