Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)

src/p/o/portfoliyo-HEAD/portfoliyo/model/users/management/commands/import_users.py   portfoliyo(Download)
from django.core.management import BaseCommand, CommandError
 
from portfoliyo.model.users.bulk import import_from_csv
from portfoliyo.model import Profile
 
        if verbosity:
            self.stdout.write("\nLoading %s for %r:\n" % (fn, teacher_email))
        created, found = import_from_csv(teacher, fn, source_phone)
        if verbosity:
            for p in created:

src/p/o/portfoliyo-HEAD/portfoliyo/tests/model/users/test_bulk.py   portfoliyo(Download)
def test_import_from_csv_file(csvfile, teacher):
    created, found = bulk.import_from_csv(teacher, csvfile)
    assert [p.name for p in created] == ['First Person', 'Second Person']
    assert [
        {g.name for g in p.students[0].student_in_groups.all()}
def test_import_from_csv_url(csvfile, monkeypatch, teacher):
    monkeypatch.setattr(urllib, 'urlopen', lambda url: open(csvfile))
    created, found = bulk.import_from_csv(
        teacher, 'http://example.com/fake.csv')
    assert [p.name for p in created] == ['First Person', 'Second Person']
    f.RelationshipFactory.create(to_profile=s, from_profile=teacher)
    f.RelationshipFactory.create(to_profile=s, from_profile=p)
    created, found = bulk.import_from_csv(teacher, csvfile)
    assert [p.name for p in created] == ['First Person']
    assert [p.name for p in found] == ['Second Person']
    assert Profile.objects.count() == 5
 
 
def test_set_source_phone(csvfile, teacher):
    created, found = bulk.import_from_csv(teacher, csvfile, '+13216540987')