This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
def load_data(filename): | |
with open(filename, 'r', encoding='UTF-8') as file: | |
reader = csv.reader(file) | |
for row in reader: | |
a.append(row[0]) | |
b.append(row[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
from tqdm import tqdm | |
import requests, zipfile, io | |
def load_data(filename): | |
arr = [] | |
with open(filename, 'r', encoding='UTF-8') as file: | |
reader = csv.reader(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
import argparse | |
import re | |
from pathlib import Path | |
def load_data(filename): | |
data = [] | |
with open(filename, 'r', encoding='latin-1') as file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, csv, requests, zipfile, io, re | |
from tqdm import tqdm | |
from pathlib import Path | |
def load_data(filename): | |
arr = [] | |
with open(filename, 'r', encoding='UTF-8') as file: | |
reader = csv.reader(file) | |
for row in reader: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
import argparse | |
import re | |
import io | |
import os | |
import os.path | |
from tqdm import tqdm | |
from pathlib import Path | |
from pdfminer.converter import TextConverter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, csv, requests, io, re, argparse, os | |
from tqdm import tqdm | |
from pathlib import Path | |
def load_data(filename): | |
arr = [] | |
with open(filename, 'r', encoding='UTF-8') as file: | |
reader = csv.reader(file) | |
for row in reader: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userService.change.subscribe((change) => | |
io.sockets.emit(SocketChannel.user, JSON.stringify(change)) | |
); | |
app.post("/users/join", (req, res) => { | |
try { | |
res.json(userService.join(<User>req.body)); | |
} catch (error) { | |
res.status(400).send(error); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class UserService { | |
private _change = new Subject<UserChange>(); | |
private _users = new Map<string, User>(); | |
public readonly change = this._change.asObservable(); | |
public get users(): User[] { | |
return Array.from(this._users.values()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable({ providedIn: 'root' }) | |
export class SocketService { | |
constructor(private socket: Socket) {} | |
public readonly userChange = this.socket | |
.fromEvent<string>(SocketChannel.user) | |
.pipe(map((x) => JSON.parse(x) as UserChange)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable({ providedIn: 'root' }) | |
constructor(private socketService: SocketService) { | |
this.subs.add( | |
this.socketService.userChange.subscribe((change: UserChange) => { | |
const {user, action} = change; | |
switch (change.action) { | |
case UserAction.join: | |
case TeamAction.position: | |
this._users.set(user.email, user); |
OlderNewer