v73 was too large, removing examples, .vscignore
This commit is contained in:
parent
7cd15e48d0
commit
1610328606
27 changed files with 2 additions and 6487 deletions
|
|
@ -22,4 +22,5 @@ react-app/src
|
|||
**/.pytest_cache
|
||||
**/__pycache__
|
||||
|
||||
scripts/data
|
||||
scripts/data
|
||||
scripts/env
|
||||
10
extension/examples/.gitignore
vendored
10
extension/examples/.gitignore
vendored
|
|
@ -1,10 +0,0 @@
|
|||
# ignore secrets, virtual environments and typical python compilation artifacts
|
||||
secrets.toml
|
||||
# ignore basic python artifacts
|
||||
.env
|
||||
**/__pycache__/
|
||||
**/*.py[cod]
|
||||
**/*$py.class
|
||||
# ignore duckdb
|
||||
*.duckdb
|
||||
*.wal
|
||||
6
extension/examples/MyProject/.gitignore
vendored
6
extension/examples/MyProject/.gitignore
vendored
|
|
@ -1,6 +0,0 @@
|
|||
.idea/
|
||||
.vscode/
|
||||
node_modules/
|
||||
build/
|
||||
tmp/
|
||||
temp/
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# Awesome Project Build with TypeORM
|
||||
|
||||
Steps to run this project:
|
||||
|
||||
1. Run `npm i` command
|
||||
2. Setup database settings inside `data-source.ts` file
|
||||
3. Run `npm start` command
|
||||
Binary file not shown.
3118
extension/examples/MyProject/package-lock.json
generated
3118
extension/examples/MyProject/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"name": "MyProject",
|
||||
"version": "0.0.1",
|
||||
"description": "Awesome project developed with TypeORM.",
|
||||
"type": "commonjs",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.10",
|
||||
"ts-node": "10.7.0",
|
||||
"typescript": "4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sqlite3": "^5.1.6",
|
||||
"typeorm": "0.3.15"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "ts-node src/index.ts",
|
||||
"typeorm": "typeorm-ts-node-commonjs"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import "reflect-metadata";
|
||||
import { DataSource } from "typeorm";
|
||||
import { User } from "./entity/User";
|
||||
|
||||
export const AppDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
database: "database.sqlite",
|
||||
synchronize: true,
|
||||
logging: false,
|
||||
entities: [User],
|
||||
migrations: [],
|
||||
subscribers: [],
|
||||
});
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column()
|
||||
name!: string;
|
||||
|
||||
@Column()
|
||||
email!: string;
|
||||
|
||||
@Column()
|
||||
password!: string;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import { AppDataSource } from "./data-source"
|
||||
import { User } from "./entity/User"
|
||||
|
||||
AppDataSource.initialize().then(async () => {
|
||||
|
||||
console.log("Inserting a new user into the database...")
|
||||
const user = new User()
|
||||
user.firstName = "Timber"
|
||||
user.lastName = "Saw"
|
||||
user.age = 25
|
||||
await AppDataSource.manager.save(user)
|
||||
console.log("Saved a new user with id: " + user.id)
|
||||
|
||||
console.log("Loading users from the database...")
|
||||
const users = await AppDataSource.manager.find(User)
|
||||
console.log("Loaded users: ", users)
|
||||
|
||||
console.log("Here you can setup and run express / fastify / any other framework.")
|
||||
|
||||
}).catch(error => console.log(error))
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import { AppDataSource } from "./data-source";
|
||||
import { Order } from "./entity/User";
|
||||
|
||||
async function getOrdersByCustomerId(customerId: number): Promise<Order[]> {
|
||||
const orderRepository = AppDataSource.getRepository(Order);
|
||||
const orders = await orderRepository.find({
|
||||
where: { customer_id: customerId },
|
||||
});
|
||||
return orders;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es5",
|
||||
"es6"
|
||||
],
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./build",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# Examples
|
||||
|
||||
This folder contains example code used in Continue demos.
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# This class contains functions to perform basic mathematical operations
|
||||
class Calculator:
|
||||
|
||||
# This function adds two numbers together
|
||||
def add(self, num1, num2):
|
||||
"""This function adds two numbers together"""
|
||||
return num1 + num2
|
||||
|
||||
# This function subtracts two numbers
|
||||
def sub(self, num1, num2):
|
||||
"""This function subtracts two numbers"""
|
||||
return num1 - num2
|
||||
|
||||
# This function multiplies two numbers
|
||||
def mul(self, num1, num2):
|
||||
"""This function multiplies two numbers"""
|
||||
return num1 * num2
|
||||
|
||||
# This function divides two numbers
|
||||
def div(self, num1, num2):
|
||||
"""This function divides two numbers"""
|
||||
return num1 / num2
|
||||
|
||||
# This function raises one number to the power of another
|
||||
def exp(self, num1, num2):
|
||||
"""This function raises one number to the power of another"""
|
||||
return num1 ** num2
|
||||
Binary file not shown.
|
|
@ -1,45 +0,0 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
|
||||
class FileSystem(ABC):
|
||||
"""An abstract filesystem that can read/write from a set of files."""
|
||||
@abstractmethod
|
||||
def read(self, path) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def readlines(self, path) -> List[str]:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def write(self, path, content):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def exists(self, path) -> bool:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def rename_file(self, filepath: str, new_filepath: str):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def walk(self, path: str) -> List[str]:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def rename_directory(self, path: str, new_path: str):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def delete_file(self, filepath: str):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def delete_directory(self, path: str):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def add_directory(self, path: str):
|
||||
raise NotImplementedError
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import os
|
||||
from typing import List
|
||||
from filesystem.filesystem import FileSystem
|
||||
|
||||
|
||||
class RealFileSystem(FileSystem):
|
||||
"""A filesystem that reads/writes from the actual filesystem."""
|
||||
|
||||
def read(self, path) -> str:
|
||||
with open(path, "r") as f:
|
||||
return f.read()
|
||||
|
||||
def readlines(self, path) -> List[str]:
|
||||
with open(path, "r") as f:
|
||||
return f.readlines()
|
||||
|
||||
def write(self, path, content):
|
||||
with open(path, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
def exists(self, path) -> bool:
|
||||
return os.path.exists(path)
|
||||
|
||||
def rename_file(self, filepath: str, new_filepath: str):
|
||||
os.rename(filepath, new_filepath)
|
||||
|
||||
def rename_directory(self, path: str, new_path: str):
|
||||
os.rename(path, new_path)
|
||||
|
||||
def delete_file(self, filepath: str):
|
||||
os.remove(filepath)
|
||||
|
||||
def add_directory(self, path: str):
|
||||
os.makedirs(path)
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
from typing import Dict, List
|
||||
from filesystem.filesystem import FileSystem
|
||||
|
||||
|
||||
class VirtualFileSystem(FileSystem):
|
||||
"""A simulated filesystem from a mapping of filepath to file contents."""
|
||||
files: Dict[str, str]
|
||||
|
||||
def __init__(self, files: Dict[str, str]):
|
||||
self.files = files
|
||||
|
||||
def read(self, path) -> str:
|
||||
return self.files[path]
|
||||
|
||||
def readlines(self, path) -> List[str]:
|
||||
return self.files[path].splitlines()
|
||||
|
||||
def write(self, path, content):
|
||||
self.files[path] = content
|
||||
|
||||
def exists(self, path) -> bool:
|
||||
return path in self.files
|
||||
|
||||
def rename_file(self, filepath: str, new_filepath: str):
|
||||
self.files[new_filepath] = self.files[filepath]
|
||||
del self.files[filepath]
|
||||
|
||||
def rename_directory(self, path: str, new_path: str):
|
||||
for filepath in self.files:
|
||||
if filepath.startswith(path):
|
||||
new_filepath = new_path + filepath[len(path):]
|
||||
self.files[new_filepath] = self.files[filepath]
|
||||
del self.files[filepath]
|
||||
|
||||
def delete_file(self, filepath: str):
|
||||
del self.files[filepath]
|
||||
|
||||
def add_directory(self, path: str):
|
||||
pass
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
class Calculator:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def add(self, a, b):
|
||||
return a + b
|
||||
|
||||
def sub(self, a, b):
|
||||
return a - b
|
||||
|
||||
def mul(self, a, b):
|
||||
return a * b
|
||||
|
||||
def div(self, a, b):
|
||||
return a / b
|
||||
|
||||
def exp(self, num1, num2):
|
||||
return num1 ** num2
|
||||
3013
extension/examples/package-lock.json
generated
3013
extension/examples/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "python",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"sqlite3": "^5.1.6",
|
||||
"typeorm": "^0.3.15"
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
dlt[duckdb]>=0.2.7
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
def sum(a, b):
|
||||
return a + b
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from ..calculator import Calculator
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def calculator():
|
||||
return Calculator()
|
||||
|
||||
|
||||
def test_add(calculator):
|
||||
assert calculator.add(2, 3) == 5
|
||||
assert calculator.add(10, -2) == 8
|
||||
assert calculator.add(0, 0) == 0
|
||||
|
||||
|
||||
def test_sub(calculator):
|
||||
assert calculator.sub(2, 3) == -1
|
||||
assert calculator.sub(10, -2) == 12
|
||||
assert calculator.sub(0, 0) == 0
|
||||
|
||||
|
||||
def test_mul(calculator):
|
||||
assert calculator.mul(2, 3) == 6
|
||||
assert calculator.mul(10, -2) == -20
|
||||
assert calculator.mul(0, 0) == 0
|
||||
|
||||
|
||||
def test_div(calculator):
|
||||
assert calculator.div(2, 3) == 0.6666666666666666
|
||||
assert calculator.div(10, -2) == -5
|
||||
assert calculator.div(0, 1) == 0
|
||||
|
||||
|
||||
def test_exp(calculator):
|
||||
assert calculator.exp(2, 3) == 8
|
||||
assert calculator.exp(10, -2) == 0.01
|
||||
assert calculator.exp(0, 0) == 1
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
import pytest
|
||||
# print(__name__)
|
||||
# from ..sum import sum as real_sum
|
||||
|
||||
def sum(a, b):
|
||||
return a + b
|
||||
|
||||
def test_sum():
|
||||
assert sum(1, 2) == 3
|
||||
|
||||
def test_abc():
|
||||
assert True
|
||||
Loading…
Add table
Reference in a new issue