Skip to content

Robertino10/-Boeing-747

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

money.py

from django.

conf import

settings

from django.core.

exceptions import

ImproperlyConfigured

from django.db.

models import F

from django.utils

import translation

from django.utils

.deconstruct import

deconstructible

from django.utils.

html import avoid_wrapping,

conditional_escape

from django.utils.

safestring import

mark_safe

from djmoney.

settings import

DECIMAL_PLACES

from moneyed

import Currency,

Money as DefaultMoney

from moneyed.localization

import _FORMATTER,

format_money

all = ['Money', 'Currency']

@deconstructible class Money(DefaultMoney): """ Extends functionality of Money with Django-related features. """ use_l10n = None

def __float__(self):
    return float(self.amount)

def __add__(self, other):
    if isinstance(other, F):
        return other.__radd__(self)
    other = convert_money(other, self.currency)
    return super(Money, self).__add__(other)

def __sub__(self, other):
    if isinstance(other, F):
        return other.__rsub__(self)
    other = convert_money(other, self.currency)
    return super(Money, self).__sub__(other)

def __mul__(self, other):
    if isinstance(other, F):
        return other.__rmul__(self)
    return super(Money, self).__mul__(other)

def __truediv__(self, other):
    if isinstance(other, F):
        return other.__rtruediv__(self)
    return super(Money, self).__truediv__(other)

@property
def is_localized(self):
    if self.use_l10n is None:
        return settings.USE_L10N
    return self.use_l10n

def __unicode__(self):
    kwargs = {'money': self, 'decimal_places': DECIMAL_PLACES}
    if self.is_localized:
        locale = get_current_locale()
        if locale:
            kwargs['locale'] = locale

    return format_money(**kwargs)

def __str__(self):
    value = self.__unicode__()
    if not isinstance(value, str):
        value = value.encode('utf8')
    return value

def __html__(self):
    return mark_safe(avoid_wrapping(conditional_escape(self.__unicode__())))

def get_current_locale(): # get_language can return None starting from Django 1.8 language = translation.get_language() or settings.LANGUAGE_CODE locale = translation.to_locale(language)

if locale.upper() in _FORMATTER.formatting_definitions:
    return locale

locale = ('%s_%s' % (locale, locale)).upper()
if locale in _FORMATTER.formatting_definitions:
    return locale

return ''

def convert_money(value, currency): """ Converts other Money instances to the local currency. If django-money-rates is installed we can automatically perform operations with different currencies. """ if getattr(settings, 'AUTO_CONVERT_MONEY', False): if 'djmoney_rates' in settings.INSTALLED_APPS: try: from djmoney_rates.utils import convert_money

            return convert_money(value.amount, value.currency, currency)
        except ImportError:
            raise ImproperlyConfigured('djmoney_rates doesn\'t support Django 1.9+')
    raise ImproperlyConfigured('You must install djmoney-rates to use AUTO_CONVERT_MONEY = True')
return value

program 109 KB so I could

to open the Console, or as they

to say interface

let working on itI have Python 2.7 prepare

best avatars for example

the moon or from Mars or from another

planet or from another dimension!

Use as normal model fields

from djmoney.models.fields import MoneyField from django.db import models

class BankAccount(models.Model): balance = MoneyField(max_digits=10, decimal_places=2, default_currency='USD') Searching for models with money fields:

from djmoney.money import Money

account = BankAccount.objects.create(balance=Money(10, 'USD')) swissAccount = BankAccount.objects.create(balance=Money(10, 'CHF'))

BankAccount.objects.filter(balance__gt=Money(1, 'USD'))

Returns the "account" object

Merge pull request #57 from svenjantzen/1.2.x

Add Listener dovecot_service_login.pl

readme-edits

refactor-authentication

user-content-cache-key

make-retina-avatars

@mention

feature

story.txt

story-joe-edit.txt

storyjoe-edit-reviewed.txt

reviewed.txt

print("Hello,World")

create a program

from the fourth

dimension

"[# https://github.com/Robertino10/-Boeing-747.git]"

create a program from the fourth dimension

so that I can make money there wonders where

the leshy wanders connect the best avatars

create thin clear entities take care of the

same and about the security so that scammers

and cybercriminals can not steal my money!

create clean clear

entities for Boeing

747 so that this airliner

is perfect in technical terms!

"[create for the program of]"

"[Roberto 10 pure pure entities ]"

"[of the maceretin avatar"]

"[Hello World]" "[Hello World]" "[Fourth dimension]" "[readme-edits]" "[user-content-cache-key]" "[# Hello-World]" "[readme-edits]" "[refactor-authentication]" "[state:open type:issue author:octocat]" "[Hello-World]" "[F5DBC076]" "[# Hello-World]"

"[Fourth dimension]"

"[robertrobertoviz43@gmail.com]"

"[user-content-cache-key]" "[# Hello-World]" "[# Hello-World]" "[Fourth dimension]" "[robertrobertoviz43@gmail.com]"

"[readme-edits]" "[refactor-authentication]" "[user-content-cache-key]" "[make-retina-avatars]" "[story.txt]" "[story-joe-edit.txt]" "[story-joe-edit-reviewed.txt]" "[reviewed.txt]" "[create the perfect program]"

"[from the fourth dimension for a Boeing-747]"

"[security!]"

"[robertrobertoviz43@gmail.com]"

"[from csvthings]"

"[import import]"

"[_csv_to_list]"

"[from csvthings ]"

"[import export_list_to_csv]"

"[# Import CSVs to list.]"

"[airlines = import_csv_to_list('airlines_raw.csv',]"

"[headers = True, astuple = True)]"

"[aircraft = import_csv_to_list('aircraft_raw.csv',]"

"[headers = True, astuple = True)]"

"[# Remove duplicate rows.]"

"[def remove_duplicates(data):]"

"[ data = set(data)]"

"[ data = list(data)]"

"[ return(data)]"

"[airlines = remove_duplicates(airlines)]"

"[aircraft = remove_duplicates(aircraft)]"

"[# Remove Regionnair observations. Not unique by name.]"

"[def remove_regionnair(data):]"

"[newdata = []]"

"[ for i in range(len(data)):]"

    "[if('Regionnair' not in data[i]):]"
    
       "[ newdata.append(data[i])]"

"[ return(newdata)]"

"[airlines = remove_regionnair(airlines)]"

"[aircraft = remove_regionnair(aircraft)]"

"[# Convert to list of lists from list of]"

"[tuples for validate_status function.]"

"[def convert_to_list(data):]"

"[ newlist = [list(e) for e in data]]"

"[ return(newlist)]"

"[airlines = convert_to_list(airlines)]"

"[aircraft = convert_to_list(aircraft)]"

"[# Fix bad statuses in aircraft.csv.]"

"[def validate_status(data):]"

"[ valid_status = ["Active", "Scrapped", ]"

"["Written off", "Stored", "On order"]]"

"[ for i in range(len(data)):]"

   "[ if(data[i][8] not in valid_status):]"
   
       "[ data[i][8] = "Unknown"]"
       
"[return(data)]"

"[aircraft = validate_status(aircraft)]"

"[# Export cleaned data to CSV.]"

"[export_list_to_csv('airlines_clean.csv', ]"

"[airlines, headers = ["airline", "country", "status"])]"

"[export_list_to_csv('aircraft_clean.csv',]"

"[aircraft, headers = ["msn", "model", "series", "airline", "ff_day",]"

"["ff_month", "ff_year", "registration", "status"])]"

"[# Remove raw datasets.]"

"[# os.remove('airlines_raw.csv')]"

"[# os.remove('aircraft_raw.csv')]"

"[robertrobertoviz43@gmail.com]" "[create a clean, clear entity]"

"[robertrobertoviz43@gmail.com]"

"[Create from the Astral plane]"

"[the perfect program for the Boeing-747]"

"[and for all Airliners Boeing]"

"[and empty in the creation of this program]"

"[involved Azazel from the fourth dimension]"

"[with its numerous employees and]"

"[so Robertino10 for it received a $100,000]"

"[ robertrobertoviz43@gmail.com]"

"[In the creation of the program needs]"

"[to participate black ash]"

"[green white yellow and red avatars!]"

"[robertrobertoviz43@gmail.com]"

"[ state:open type:issue author:octocat]"

[https://github.com/Robertino10/-Boeing-747.git]

"[create pure clear entities]" "[for the Boeing-747 program]" "[rom the Astral Plane from Robertino10]" "[state:open type:issue]"

"[author:octocat]"

"[Hello-World]" "[state:open type:issue author:octocat]"

[https://github.com/Robertino10/-Boeing-747.git] "[from django.conf import setting]" "[from django.core.exceptions import ImproperlyConfigured]" "[from django.db.models import F]" from django.utils.import translation]" "[state:open type:issue author:octocat]"

[https://github.com/Robertino10/-Boeing-747.git] "[Recover 2 unigue clones!]" "[from django.utils.deconstruct import deconstructible]"

[https://github.com/Robertino10/-Boeing-747.git] "[state:open type:issue]" "[label:"bug"]"

"[Hello-World]"

[https://github.com/Robertino10/-Boeing-747.git] "[from django.utils.html import avoid_wrapping, conditional_escape]" "[state:open type:issue author:octocat]"

"[state:open type:issue label:"bug"]"

[https://github.com/Robertino10/-Boeing-747.git] "[from django.utils.safestring import mark_safe]"

"[from djmoney.settings import DECIMAL_PLAGES]" "[from moneyed import Currency, Money as DefaultMoney "[from moneyed.localization import _FORMATTER, format_money]"

"[state:open type:issue author:octocat]"

[https://github.com/Robertino10/-Boeing-747.git]

"[Using pip:]"

"[pip install django-money]" "[This automatically installs py-moneyed v0 . 7 (or later) .]"

"[Add djmoney to your INSTALLED_APPS. This is reguired so that money field are displayed correctly in the admin.]"

"[INSTALLED_APPS = []"

"[...,]" "['djmoney',]" "[...]"

"[]"

[https://github.com/Robertino10/-Boeing-747.git] "[from djmoney.models.fields import NoneyField "[from django.db import models]"

"[class BankAccount(models.Model): "[balance = MoneyField(max_digits=10, decimal_places=2, default_currency='USD')]"

[https://github.com/Robertino10/-Boeing-747.git] "[from djmoney import Money]"

"[account = BankAccount.objects.create(balance=Money(10, 'USD'))]" "[swissAccount = BankAccount.objects.create(balance=Money(10, 'CHF'))]"

"[BankAccount.objects.filter(balance__gt=Money(1, 'USD'))]" "[# Returns the "account" object]"

[https://github.com/Robertino10/-Boeing-747.git]

"[import simpy]"

"[def clock(env, name,tick):]" "[while True:]" "[print(name, env.now)]" "[yield env.timeout(tick)]"

"[env = simpy.Environment ()]" "[env.process (clock(env, 'fast', 0.5))]" "[Process(clock) object at 0x...>]" "[env.process(clock(env, 'slom', 1))]" "[Process(clock) object at 0x...>]" "[env.run(until=2)]" "[fast 0]" "[slow 0]" "[fast 0.5]" "[slow 1]" "[fast 1.0]" "[fast 1.5]"

"[ "[# create a program for Robertino10 for a card]" "[# to receive SMS on the phone number of Robertino10]" "[# for example Hello to SMS from Robertino10 using an]" "[# artificial intellegence]" "[from SimPy.Simulation import*]"

[https://github.com/Robertino10/-Boeing-747.git] "[class Customer(Process):]"

[https://github.com/Robertino10/-Boeing-747.git] "[def buy(self,budget=0):]" [https://github.com/Robertino10/-Boeing-747.git] "[print 'Here I am at the shops', self.name]" [https://github.com/Robertino10/-Boeing-747.git] "[t = 5.0]"

[https://github.com/Robertino10/-Boeing-747.git] "[for i in range(4):]" [https://github.com/Robertino10/-Boeing-747.git] "[yield hold,self,t]" [https://github.com/Robertino10/-Boeing-747.git] "[# executed 4 times at intervals of t time units]" [https://github.com/Robertino10/-Boeing-747.git] "[print 'Ijust bought something',self.name]"

[https://github.com/Robertino10/-Boeing-747.git] "[budget _= 10.00]"

[https://github.com/Robertino10/-Boeing-747.git] "[print 'All I have left is ', budget,]"

[https://github.com/Robertino10/-Boeing-747.git] "[' I am going home ',self.name,]"

[https://github.com/Robertino10/-Boeing-747.git] "[initialize()]" [https://github.com/Robertino10/-Boeing-747.git] "[# create a customer named "Evelyn",

[https://github.com/Robertino10/-Boeing-747.git] "[C = Customer(name='Evelyn')]"

[https://github.com/Robertino10/-Boeing-747.git] "[# and activate her with a budget of 100]"

[https://github.com/Robertino10/-Boeing-747.git] "[activate(C,C.buy(budget=100),at=10.o)]"

[https://github.com/Robertino10/-Boeing-747.git] "[simulate(until=100.0)]" [https://github.com/Robertino10/-Boeing-747.git] "[def go(self):]" "[print now(),self.i,'Starting']" "[yield hold,self,100.0]" "[print now(), self.i,'Arrived']"