def _execute_pattern(self, pat, block, duration): self.info('executing pattern {}'.format(pat)) if not pat.endswith('.lp'): pat = '{}.lp'.format(pat) path = os.path.join(paths.pattern_dir, pat) if os.path.isfile(path): self.debug('Using local pattern {}'.format(pat)) pat = pickle.dumps(path) self.debug('Sending Pattern:{}'.format(pat)) self.debug('-------- laser version {}'.format(globalv.laser_version)) if globalv.laser_version > 0: cmd = {'command': 'DoPattern', 'name': pat, 'duration': duration} cmd = json.dumps(cmd) else: cmd = 'DoPattern {}'.format(pat) self._ask(cmd, verbose=True) if block: time.sleep(0.5) if not self._block('IsPatterning', period=1, timeout=100): self._ask('AbortPattern')
def extract(self, value, units='', process=None): self.info('set laser output') cmd = {'command': 'SetLaserOutput', 'value': value, 'units': units} return self._ask(json.dumps(cmd)) == 'OK'
def _put(self, cmd, **payload): headers = self._get_authorization() kw={} if globalv.cert_file: kw['verify'] = globalv.cert_file r = requests.put(cmd, data=json.dumps(payload), headers=headers, **kw) return r
def create_card(card): column_id = os.environ.get('GITHUB_BUG_CARD', 2279248) cmd = '{}/projects/columns/{}/cards'.format(GITHUB_API_URL, column_id) data = json.dumps(card) return git_post( cmd, data=data, headers={'accept': 'application/vnd.github.inertia-preview+json'})
def create_organization_repository(org, name, usr, pwd, **kw): cmd = '/orgs/{}/repos'.format(org) cmd = make_request(cmd) payload = {'name': name} payload.update(**kw) auth = base64.encodestring('{}:{}'.format(usr, pwd)).replace('\n', '') headers = {"Authorization": "Basic {}".format(auth)} r = requests.post(cmd, data=json.dumps(payload), headers=headers) print(cmd, payload, usr, pwd) print(r) return r
def create_issue(issue): org = os.environ.get('GITHUB_ORGANIZATION', 'NMGRL') cmd = '{}/repos/{}/pychron/issues'.format(GITHUB_API_URL, org) data = json.dumps(issue) return git_post(cmd, data=data)
def create_card(card): column_id = os.environ.get('GITHUB_BUG_CARD', 2279248) cmd = '{}/projects/columns/{}/cards'.format(GITHUB_API_URL, column_id) data = json.dumps(card) return git_post(cmd, data=data, headers={'accept': 'application/vnd.github.inertia-preview+json'})
def start_video_recording(self, name): self.info('Start Video Recording') cmd = {'command': 'StartVideoRecording', 'name': name} self._ask(json.dumps(cmd))