Собрали в одном месте самые важные ссылки
читайте нас в Twitter
from pyriodic import DurationJob
from pyriodic import DatetimeJob
from pyriodic import Scheduler
now = datetime.now
s = Scheduler()
start = now()
def func1(arg1=None, arg2=None, arg3=None, arg4=None):
print('Func1', arg1, arg2, arg3, arg4, now() - start, now())
def func2():
print('Func2', now() - start, now())
def func3():
print('Func3', now() - start, now())
s.add_job(DurationJob(func1,
when='30m',
args=('This', 'is'),
kwargs={'arg3': 'the', 'arg4': 'first function'},
name='MyJob'))
s.add_job(DurationJob(func2, when='2h'))
s.add_job(DatetimeJob(func3, when='12:00 pm'))
print(s.next_run_times())
from gmusicapi import Mobileclient api = Mobileclient() api.login('user@gmail.com', 'my-password', Mobileclient.FROM_MAC_ADDRESS) # => True library = api.get_all_songs() sweet_track_ids = [track['id'] for track in library if track['artist'] == 'The Cat Empire'] playlist_id = api.create_playlist('Rad muzak') api.add_songs_to_playlist(playlist_id, sweet_track_ids)
import arduinoserial arduino = arduinoserial.SerialPort('/dev/ttyUSB0', 19200) print arduino.read_until('\n') arduino.write('a5050')
❯ pyq3 'class:extends(IntegerField)' django/forms
django/forms/fields.py:278 class FloatField(IntegerField):
django/forms/fields.py:315 class DecimalField(IntegerField):
Модуль ускоряет работу shutil.copyfile с помощью системного вызова sendfile