(self, name, name_or_dir="name")
| 260 | ) |
| 261 | |
| 262 | def validate_name(self, name, name_or_dir="name"): |
| 263 | if name is None: |
| 264 | raise CommandError( |
| 265 | "you must provide {an} {app} name".format( |
| 266 | an=self.a_or_an, |
| 267 | app=self.app_or_project, |
| 268 | ) |
| 269 | ) |
| 270 | # Check it's a valid directory name. |
| 271 | if not name.isidentifier(): |
| 272 | raise CommandError( |
| 273 | "'{name}' is not a valid {app} {type}. Please make sure the " |
| 274 | "{type} is a valid identifier.".format( |
| 275 | name=name, |
| 276 | app=self.app_or_project, |
| 277 | type=name_or_dir, |
| 278 | ) |
| 279 | ) |
| 280 | # Check that __spec__ doesn't exist. |
| 281 | if find_spec(name) is not None: |
| 282 | raise CommandError( |
| 283 | "'{name}' conflicts with the name of an existing Python " |
| 284 | "module and cannot be used as {an} {app} {type}. Please try " |
| 285 | "another {type}.".format( |
| 286 | name=name, |
| 287 | an=self.a_or_an, |
| 288 | app=self.app_or_project, |
| 289 | type=name_or_dir, |
| 290 | ) |
| 291 | ) |
| 292 | |
| 293 | def download(self, url): |
| 294 | """ |
no test coverage detected