Skip to content

Instantly share code, notes, and snippets.

name: CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
name: CI/CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
import unittest
from prime import is_prime
class Tests(unittest.TestCase):
def test_1(self):
"""Check that 1 is not prime."""
self.assertFalse(is_prime(1))
import math
def is_prime(n):
"""Determines if a non-negative integer is prime."""
if n < 2:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
def __scrap_tweets(self):
try:
sleep(2)
tweets = self.driver.find_elements_by_xpath("//article[@role=\"article\"]")
for tweet in tweets:
author = tweet.find_element_by_xpath(".//div[@dir=\"ltr\"]").text
text = tweet.find_element_by_xpath(".//div[@class=\"css-901oao r-hkyrab r-1qd0xha r-a023e6 r-16dba41 "
"r-ad9z0x r-bcqeeo r-bnwqim r-qvutc0\"]").text
data = tweet.find_elements_by_xpath(".//div[@class=\"css-1dbjc4n r-xoduu5 r-1udh08x\"]")
time = tweet.find_element_by_xpath(".//time").get_attribute("datetime")
def add(self):
session = Session()
session.add(self)
session.commit()
session.close()
if __name__ == "__main__":
Base.metadata.create_all(bind=engine)