Giter VIP home page Giter VIP logo

mo197_matrix_week4's Introduction

Matrix Build

GitHub Actions Matrix Build Demo

This repository demonstrates the power of GitHub Actions Matrix Build to test multiple versions of Python and operating systems. We test two different methods for merging dictionaries: one using Python 3.9's 'merge' operator and another using a loop.

Code Structure

src.merge_operation.py

Contains two methods for merging dictionaries:

  1. merge_dicts_new(dict1, dict2): Merges two dictionaries using Python 3.9's 'merge' operator (|). If there are overlapping keys, values from dict2 take precedence.

  2. merge_dicts_old(dict1, dict2): Merges two dictionaries into a new one using a loop. If there are overlapping keys, values from dict2 take precedence.

main.py

By uncommenting the line mentioned in the code comments, you can intentionally trigger a build failure when running your matrix build. This can be useful for testing your code and ensuring that the build process catches issues when using the merge_dicts_new_way function.

Matrix Build Failure on Uncommenting merge_dicts_new_way

In the main.py script, uncommenting the merge_dicts_new_way(dict1, dict2) function call will intentionally trigger a build failure. This is a helpful indicator for testing purposes or ensuring code quality.

Example in main.py

if __name__ == "__main__":
    dict1 = {'a': 1, 'b': 2}
    dict2 = {'b': 3, 'c': 4}
    
    # Uncomment the following line to see a build failure
    # merge_dicts_new_way(dict1, dict2)
    
    # Use the old way for a successful build
    merge_dicts_old_way(dict1, dict2)


mo197_matrix_week4's People

Contributors

markoke avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.