Best Python code snippet using molecule_python
farm.py
Source: farm.py
...37 nav.force_dir(nav.DIRS.FORWARD, 8)38 turtle.turnLeft()39 nav.force_dir(nav.DIRS.FORWARD, 9)40 [turtle.turnLeft() for i in range(2)]41def manage_inventory(crop):42 accepted_fuel = {'minecraft:coal', 'minecraft:charcoal'}43 inv.drop_all_except(accepted_fuel | {crop.seed}, turtle.dropDown)44 coal_qty = inv.count_items(accepted_fuel)45 if coal_qty < 64:46 turtle.turnLeft()47 turtle.suck(64 - coal_qty)48 turtle.turnRight()49 try:50 if inv.count_items(accepted_fuel) < 64:51 # The fuel chest has run out, alert main server52 net.request('main-server:FUEL/low', await_response=False)53 else:54 # The turtle has sufficient fuel. alert main server55 net.request('main-server:FUEL/ok', await_response=False)56 except Exception as e:57 print(f'ERROR: {str(e)}')58 seed_qty = inv.count_items({crop.seed})59 if seed_qty > 80:60 # 80 is the capacity of the farm61 inv.drop_some({crop.seed}, seed_qty-80, turtle.dropDown)62 inv.restack()63def initialize(initial_pos, initial_bearing):64 # TODO: this is a good canditat65 navigator = nav.Navigator(net.locate(), nav.get_bearing())66 navigator.go_to(initial_pos)67 navigator.turn_to(initial_bearing)68CROPS = [69 Crop('wheat', 'wheat', 'wheat_seeds', 7),70 Crop('carrots', 'carrot', 'carrot', 7),71 Crop('potatoes', 'potato', 'potato', 7),72 Crop('beetroots', 'beetroot', 'beetroot_seeds', 3),73]74if len(args) != 5:75 print('Usage: farm <crop> <x> <y> <z> <bearing>')76else:77 # Timer is reset on reboot, so always start with a farming pass78 active_crop = [c for c in CROPS if c.product == f'minecraft:{args[0]}'][0]79 print(f'Farming {active_crop.product}...')80 initial_pos = [int(x) for x in args[1:4]]81 initial_bearing = nav.CARDINALS(int(args[4]))82 initialize(initial_pos, initial_bearing)83 manage_inventory(active_crop)84 farm(active_crop)85 manage_inventory(active_crop)86 while True:87 os.sleep(30 * 60) # sleep 30 minutes between runs88 farm(active_crop)...
urls.py
Source: urls.py
1from django.urls import path2from django.conf import settings3from django.conf.urls.static import static4from . import views5from .import supervisor6from .import cashier7app_name = 'salon'8urlpatterns = [9 path('manage_category/', supervisor.manage_category, name='manage_category'),10 path('create_category/', supervisor.create_category, name='create_category'),11 path('edit_category/<str:pk>/', supervisor.edit_category, name='edit_category'),12 path('manage_product/', supervisor.manage_product, name='manage_product'),13 path('create_product/', supervisor.create_product, name='create_product'),14 path('edit_product/<str:pk>/', supervisor.edit_product, name='edit_product'),15 path('create_customer/', cashier.create_customer, name='create_customer'),16 path('orderitems/', cashier.orderitems.as_view(), name='orderitems'),17 path('delete_item/<str:pk>/', cashier.deletes, name='delete_item'),18 path('checkout/', cashier.checkout, name='checkout'),19 path('checkout_print/<str:pk>/', cashier.checkout_print, name='checkout_print'),20 path('Vew_order/<str:pk>/', cashier.Vew_order, name='Vew_order'),21 path('close_order', cashier.close_order, name='close_order'),22 path('close', cashier.close, name='close'),23 path('manage_order', cashier.manage_order, name='manage_order'),24 path('makepayment/<str:pk>/', cashier.makepayment, name='makepayment'),25 path('create_restock/', supervisor.create_restock, name='create_restock'),26 path('approve_restock/<str:pk>/',27 supervisor.approve_restock, name='approve_restock'),28 path('cancel_restock/<str:pk>/',29 supervisor.cancel_restock, name='cancel_restock'),30 path('manage_restock/', supervisor.manage_restock, name='manage_restock'),31 path('manage_inventory/', supervisor.manage_inventory, name='manage_inventory'),32 path('EditInventory/<str:pk>/', supervisor.EditInventory, name='EditInventory'),33 path('closing_stock/', supervisor.closing_stock, name='closing_stock'),34 path('closed_stock/', supervisor.closed_stock, name='closed_stock'),35 path('pending_restock/', supervisor.pending_restock, name='pending_restock'),36 path('daily_sales/', supervisor.daily_sales, name='daily_sales'),37 path('taxation/', supervisor.taxation, name='taxation'),...
inventory-manage.py
Source: inventory-manage.py
1#!/usr/bin/env python2#3# Copyright 2014, Rackspace US, Inc.4#5# Licensed under the Apache License, Version 2.0 (the "License");6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16#17# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>18# (c) 2015, Major Hayden <major@mhtx.net>19#20"""Returns data about containers and groups in tabular formats."""21# NOTE(nrb/palendae): The contents of this file were moved22# to manage_inventory.py in order to facilitate importing of the python code23# This file remains for backwards compatibility24import manage_inventory25if __name__ == "__main__":...
Check out the latest blogs from LambdaTest on this topic:
People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.
When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.
Most test automation tools just do test execution automation. Without test design involved in the whole test automation process, the test cases remain ad hoc and detect only simple bugs. This solution is just automation without real testing. In addition, test execution automation is very inefficient.
I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!