Giter VIP home page Giter VIP logo

rancat's Introduction

Welcome to RanCat

Master Build Status codecov PyPI version Documentation Status Open Source Helpers

Develop Build Status codecov

This is the full documentation of RanCat, an open source Python Random conCatenation engine.

Use Cases

RanCat is a string generator that can use multiple text sources, including files and native Python lists and tuples. What constitutes a word in a word list is simply an atomic entity in the source, e.g. a line in a file, or a value in a list. RanCat will generate pseudo-random strings that are suitable for use as :

  • VCS Branch Names
  • Database Names
  • Project/Repository Names
  • Online Avatar Names
  • Baby Names
  • and so on

Installation

pip install rancat

Basic Usage

from rancat import RanCat

r = RanCat()

# Load in our text sources
r.load(['red', 'orange', 'blue'])
r.load(['car', 'tractor', 'truck'])

# Generate a new string
r.next()
>>> orange_truck
r.next()
>>> red_tractor
r.next()
>>> orange_tractor

Contributing

Submitting an issue or feature request

If you find an issue or have a feature request please open an issue at Github RanCat Repo.

Working on issues

If you think that you can fix an issue or implement a feature, please make sure that it isn't assigned to someone or if it is you may ask for an update.

Once an issue is complete, open a pull request so that your contribution can be reviewed. A TravisCI build and CodeCov report will run and be attached to your pull request. Your code must pass these checks.

Helping others

At all times, please be polite with others who are working on issues. It may be their first ever patch and we want to foster a friendly and familiar open source environment.

rancat's People

Contributors

ashishkg0022 avatar codetriage-readme-bot avatar taml avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rancat's Issues

tech project name generator option

Have a boolean, default to false, that checks if you're generating project names.

If you are generating project names replace parts in words that have "*it" with "bit". Add -o to the end of words that end in to consonants or replace final vowel with o. Replace [H,P,C,K,T]-[AP,AC,AQ,Ak,AT] with Hack.

Ex:
Sphere -> Sphero
Capital -> Hackital

I will work on this shortly if @mattjegan would add it.

"Lazy loading" performance vs. randomness

This is a response to your blog post and modification to RanCat regarding a a supposed 100% performance improvement.

It's not acceptable to only consider the first 1000 elements of a file when selecting one at random when, more than likely, the dictionary will be presorted and have much more than 1000 elements.

I suggest you take the following approach:

  1. Get the size of the file in bytes size = os.stat(filename).st_size
  2. Open the file f= open(filename)
  3. Jump to a random spot in said file f.seek(random.randint(0, size)
  4. Move backward(or forward) until you hit a newline
  5. Read the entire line word = f.readLine()
  6. Close file f.close()

I wanted to see what you thought before putting together a PR.

Feature Requests

I am currently looking for feature requests for the next release of RanCat. If you think you have an interesting feature, with a plausible use case, please feel free to open an issue so we can discuss it before a pull request ๐Ÿ˜„

Allow injection of conversion function.

We want to be able to override the string conversion. E.g. the default will strip trailing whitespace, however a user should be able to do this:

r = RanCat()
r.set_convert_func(String.upper)

Provide more built in conversion methods for common use cases.

So users don't need to write their own conversion methods except for unusual cases, RanCat should support conversion methods for major use cases. Primarily:

ascii_lower - forces ascii and lowercase with RanCat._separator
ascii_upper - forces ascii and uppercase with RanCat._separator
camel_case - camel case separated by RanCat._separator

Add docs

I would like to investigate ways of documenting the project. At the moment I am leaning towards ReadTheDocs

total_combinations is unpopulated when file is loaded

The field total_combinations in the class RanCat (https://github.com/mattjegan/rancat/blob/master/rancat/RanCat.py#L34) seems to be populated only once a RanCat.next() is called which in turn triggers a call to RanCat.refresh_all.
This looks to me like a bug, because you have the information required to calculate this as soon as you load a new file and in the future if we were to make calls other than RanCat.next() which were to use this field, they would fail.

@mattjegan: If this seems acceptable I shall open a PR to fix this.

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.