Пример #1
0
def run_apply(dataset, version, test_set, gpu=False):
    torch.cuda.empty_cache()
    args = SimpleNamespace(dataset=dataset,
                           version=version,
                           test_set=test_set,
                           gpu=gpu)
    define_config()
    apply(args)
Пример #2
0
 def __init__(self, filename, **kw):
     frame1 = Frame(1 * cm,
                    1 * cm,
                    18.5 * cm,
                    27 * cm,
                    id='F1',
                    showBoundary=False)
     self.allowSplitting = 0
     apply(BaseDocTemplate.__init__, (self, filename), kw)
     self.addPageTemplates(PageTemplate('normal', [frame1]))
Пример #3
0
def result():
    if xmlfile == '' or halfile == '':
        return jsonify({'result' : 'EtherCAT xml or hal file was not found'})
        
    app_time_period = ini.find('EMCMOT', 'BASE_PERIOD')
    if not app_time_period:
        app_time_period = ini.find('EMCMOT', 'SERVO_PERIOD')
    
    a = apply(request.json, app_time_period, xmlfile, halfile)
    return jsonify({'result' : a})
def main(sentences, force_retrain=False):
    if force_retrain:
        if Path(MODEL_PATH).is_dir():
            shutil.rmtree(MODEL_PATH)
        os.mkdir(MODEL_PATH)

    if not Path(MODEL_PATH).is_dir():  # not exists
        os.mkdir(MODEL_PATH)

    if not os.listdir(MODEL_PATH):  # blank
        train()

    pprint.pprint(apply(sentences))
Пример #5
0
def main(beginning, num_of_chars, force_retrain=False):
    if force_retrain:
        if Path(MODEL_PATH).is_dir():
            shutil.rmtree(MODEL_PATH)

    if Path(LOG_PATH).is_dir():
        shutil.rmtree(LOG_PATH)

    if not Path(MODEL_PATH).is_dir():  # not exists
        os.mkdir(MODEL_PATH)

    if not os.listdir(MODEL_PATH):  # blank
        train()

    print(beginning + ' ' + apply(beginning, num_of_chars))
Пример #6
0
def checkApply():
    code1 = '[+ 1 2]'
    ts1 = tokens(code1)
    result1 = apply(ts1)
    ensure(result1 == 3, 'apply test 1')

    code2 = '[* 2 3 4]'
    ts2 = tokens(code2)
    result2 = apply(ts2)
    ensure(result2 == 24, 'apply test 2')

    code3 = '[log "hello"]'
    ts3 = tokens(code3)
    result3 = apply(ts3)
    ensure(result3 == None, 'apply test 3')


    code4 = '[+ 1 [- 2 3]]'
    ts4 = tokens(code4)
    result4 = apply(ts4)
    ensure(result4 == 0, 'apply test 4')

    code5 = '[if [> 2 1] 3 4]'
    ts5 = tokens(code5)
    result5 = apply(ts5)
    print('result 5', result5)
    ensure(result5 == 3, 'apply test 5')



    code6 = '''
            [if yes
                [log "成功"]
                [log "没成功"]
            ]
        '''
    ts6 = tokens(code6)
    result6 = apply(ts6)
    ensure(result6 == None, 'apply test 6')
Пример #7
0
 def test_noargs(self):
     self.assertEqual(apply(func), (None, None))
Пример #8
0
#!/usr/bin/env python

# Copyright 2016 Parham Pourdavood

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
from apply import apply

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("html", help="The path to you html file", type=str)
    parser.add_argument("key",
                        help="Your Microsoft Cognitive Services Key",
                        type=str)
    args = parser.parse_args()
    apply(args.html, args.key)
Пример #9
0
 def run(self):
     print('starting', self.name, 'at:', ctime())
     self.res = apply.apply(self.func, self.args)
     print(self.name, 'finished at:', ctime())
Пример #10
0
 def test_apply(self):
     self.assertEqual(apply(func, (1,), {'bar': 2}), (1, 2))
 def test_args(self):
     self.assertEqual(apply(func, args=(1, )), (1, None))
 def test_noargs(self):
     self.assertEqual(apply(func), (None, None))
Пример #13
0
                     height=int((height / 2) * (2 / 7)),
                     bg="#404643")
middle_frame = tk.Frame(master=window,
                        height=int((height / 2) * (3 / 7)),
                        bg="#404643")
bottom_frame = tk.Frame(master=window,
                        height=int((height / 2) * (2 / 7)),
                        bg="#404643")

variable_country = tk.StringVar(master=middle_frame)
variable_city = tk.StringVar(master=middle_frame)
country_codes = ['Country']
city_codes = ['City']
variable_city.set('City')

city = apply(tk.OptionMenu,
             ((middle_frame, variable_city) + tuple(city_codes)))
city.grid(row=2, column=2, padx=60, pady=20)
selected_city = 'Bangalore'
temp = 0
speed = 1


def option_changed_city(*args):
    global selected_city
    selected_city = variable_city.get()


def option_changed_country(*args):
    if variable_country.get() == "India":
        city_codes.clear()
        city_codes.append("Delhi")
Пример #14
0
 def wrapper(*args, **kwargs):
     return apply(f, *args, **kwargs)
Пример #15
0
def applyUpdate(
    local, func, inp
):  # Applies an a function to an image found denoted by local. Uses a function passed to inp as the argument of the function.
    p.apply(local, func, inp(), path)
Пример #16
0
 def test_args(self):
     self.assertEqual(apply(func, args=(1,)), (1, None))
Пример #17
0
 def test_kwargs(self):
     self.assertEqual(apply(func, kwargs={'bar': 2}), (None, 2))
 def test_kwargs(self):
     self.assertEqual(apply(func, kwargs={'bar': 2}), (None, 2))
Пример #19
0
 def __call__(self):
     apply(self.func, self.args)
 def test_apply(self):
     self.assertEqual(apply(func, (1, ), {'bar': 2}), (1, 2))