mirror of
				https://github.com/cmur2/python-veml6070.git
				synced 2025-11-03 18:25:07 +01:00 
			
		
		
		
	module: support Python 3 only
This commit is contained in:
		
							
								
								
									
										10
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -3,9 +3,9 @@ name: ci
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches: [master, three]
 | 
					    branches: [master]
 | 
				
			||||||
  pull_request:
 | 
					  pull_request:
 | 
				
			||||||
    branches: [master, three]
 | 
					    branches: [master]
 | 
				
			||||||
  workflow_dispatch:
 | 
					  workflow_dispatch:
 | 
				
			||||||
  schedule:
 | 
					  schedule:
 | 
				
			||||||
  - cron: '37 4 * * 4'  # weekly on thursday morning
 | 
					  - cron: '37 4 * * 4'  # weekly on thursday morning
 | 
				
			||||||
@@ -16,12 +16,8 @@ jobs:
 | 
				
			|||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        python-version:
 | 
					        python-version:
 | 
				
			||||||
        - '2.7'
 | 
					 | 
				
			||||||
        # Python 3.4 on GHA doesn't work due to fastdiff==0.2.0 failing with:
 | 
					 | 
				
			||||||
        #   pkg_resources.DistributionNotFound: The 'setuptools_scm>=1.15.0' distribution was not found and is required by the application
 | 
					 | 
				
			||||||
        #- '3.4'
 | 
					 | 
				
			||||||
        - '3.5'
 | 
					 | 
				
			||||||
        - '3.7'
 | 
					        - '3.7'
 | 
				
			||||||
 | 
					        - '3.8'
 | 
				
			||||||
        - '3.9'
 | 
					        - '3.9'
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
    - uses: actions/checkout@v2
 | 
					    - uses: actions/checkout@v2
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								.travis.yml
									
									
									
									
									
								
							@@ -1,13 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
os: linux
 | 
					 | 
				
			||||||
language: python
 | 
					 | 
				
			||||||
python:
 | 
					 | 
				
			||||||
- "3.4"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install:
 | 
					 | 
				
			||||||
- pip install poetry==1.0.10
 | 
					 | 
				
			||||||
- poetry install
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
script:
 | 
					 | 
				
			||||||
- make lint
 | 
					 | 
				
			||||||
- make test
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
									
									
									
									
								
							@@ -21,17 +21,6 @@ lint: ## Lint all source code
 | 
				
			|||||||
test: ## Run all tests
 | 
					test: ## Run all tests
 | 
				
			||||||
	poetry run pytest
 | 
						poetry run pytest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: rebase-three-branch
 | 
					 | 
				
			||||||
rebase-three-branch: ## Rebase the py3 branch with master contents
 | 
					 | 
				
			||||||
	git stash
 | 
					 | 
				
			||||||
	git checkout master
 | 
					 | 
				
			||||||
	git pull
 | 
					 | 
				
			||||||
	git checkout three
 | 
					 | 
				
			||||||
	git rebase -i origin/master
 | 
					 | 
				
			||||||
	git push --force-with-lease
 | 
					 | 
				
			||||||
	git checkout master
 | 
					 | 
				
			||||||
	git stash pop
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.PHONY: help
 | 
					.PHONY: help
 | 
				
			||||||
help: ## Print this help text
 | 
					help: ## Print this help text
 | 
				
			||||||
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
 | 
						@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
# python-veml6070
 | 
					# python-veml6070
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 [](https://travis-ci.com/cmur2/python-veml6070)
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A Python library for accessing the [VEML6070 digital UV light sensor](http://www.vishay.com/docs/84277/veml6070.pdf) from Vishay via `python-smbus` using the I2C interface.
 | 
					A Python library for accessing the [VEML6070 digital UV light sensor](http://www.vishay.com/docs/84277/veml6070.pdf) from Vishay via `python-smbus` using the I2C interface.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ license = "MIT"
 | 
				
			|||||||
homepage = "https://dev.mycrobase.de/gitea/cn/python-veml6070"
 | 
					homepage = "https://dev.mycrobase.de/gitea/cn/python-veml6070"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[tool.poetry.dependencies]
 | 
					[tool.poetry.dependencies]
 | 
				
			||||||
python = "^2.7 || ^3.4"
 | 
					python = "^3.7"
 | 
				
			||||||
smbus2 = "*"
 | 
					smbus2 = "*"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[tool.poetry.dev-dependencies]
 | 
					[tool.poetry.dev-dependencies]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import veml6070  # pylint: disable=wrong-import-position
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# inspired by https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/I2C.py
 | 
					# inspired by https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/I2C.py
 | 
				
			||||||
class MockSMBus(object): # pylint: disable=bad-option-value,useless-object-inheritance
 | 
					class MockSMBus():
 | 
				
			||||||
    def __init__(self, initial_read=None):
 | 
					    def __init__(self, initial_read=None):
 | 
				
			||||||
        self._log = []
 | 
					        self._log = []
 | 
				
			||||||
        self.initial_read = initial_read or {}
 | 
					        self.initial_read = initial_read or {}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ NORMALIZED_REFRESHTIME = 0.1
 | 
				
			|||||||
NORMALIZED_UVA_SENSITIVITY = 0.05
 | 
					NORMALIZED_UVA_SENSITIVITY = 0.05
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Veml6070(object):  # pylint: disable=bad-option-value,useless-object-inheritance
 | 
					class Veml6070():
 | 
				
			||||||
    def __init__(self, i2c_bus=1, sensor_address=ADDR_L, rset=RSET_270K, integration_time=INTEGRATIONTIME_1T):
 | 
					    def __init__(self, i2c_bus=1, sensor_address=ADDR_L, rset=RSET_270K, integration_time=INTEGRATIONTIME_1T):
 | 
				
			||||||
        self.bus = smbus.SMBus(i2c_bus)
 | 
					        self.bus = smbus.SMBus(i2c_bus)
 | 
				
			||||||
        self.sendor_address = sensor_address
 | 
					        self.sendor_address = sensor_address
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user