prompt
large_stringlengths 72
9.34k
| completion
large_stringlengths 0
7.61k
|
---|---|
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def <|fim_middle|>(self):
return True if self._get_member() else False
def _get_startup(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def _get_member(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def _get_profile(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def has_a_finalist_role(self):
return len(self.finalist_user_roles()) > 0
def _is_expert(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | is_team_member |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def is_team_member(self):
return True if self._get_member() else False
def <|fim_middle|>(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def _get_member(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def _get_profile(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def has_a_finalist_role(self):
return len(self.finalist_user_roles()) > 0
def _is_expert(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | _get_startup |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def is_team_member(self):
return True if self._get_member() else False
def _get_startup(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def <|fim_middle|>(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def _get_profile(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def has_a_finalist_role(self):
return len(self.finalist_user_roles()) > 0
def _is_expert(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | _get_member |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def is_team_member(self):
return True if self._get_member() else False
def _get_startup(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def _get_member(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def <|fim_middle|>(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def has_a_finalist_role(self):
return len(self.finalist_user_roles()) > 0
def _is_expert(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | _get_profile |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def is_team_member(self):
return True if self._get_member() else False
def _get_startup(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def _get_member(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def _get_profile(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def <|fim_middle|>(self):
return len(self.finalist_user_roles()) > 0
def _is_expert(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | has_a_finalist_role |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile import EXPERT_USER_TYPE
MAX_USERNAME_LENGTH = 30
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
"""
Creates and saves an User with the given email and password.
"""
now = timezone.now()
if not email:
raise ValueError('An email address must be provided.')
email = self.normalize_email(email)
if "is_active" not in extra_fields:
extra_fields["is_active"] = True
if "username" not in extra_fields:
# For now we need to have a unique id that is at
# most 30 characters long. Using uuid and truncating.
# Ideally username goes away entirely at some point
# since we're really using email. If we have to keep
# username for some reason then we could switch over
# to a string version of the pk which is guaranteed
# be unique.
extra_fields["username"] = str(uuid.uuid4())[:MAX_USERNAME_LENGTH]
user = self.model(email=email,
is_staff=is_staff,
is_superuser=is_superuser,
last_login=None,
date_joined=now,
**extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email=None, password=None, **extra_fields):
return self._create_user(email, password, False, False,
**extra_fields)
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
**extra_fields)
class User(AbstractUser):
# Override the parent email field to add uniqueness constraint
email = models.EmailField(blank=True, unique=True)
objects = UserManager()
class Meta:
db_table = 'auth_user'
managed = settings.ACCELERATOR_MODELS_ARE_MANAGED
def __init__(self, *args, **kwargs):
super(User, self).__init__(*args, **kwargs)
self.startup = None
self.team_member = None
self.profile = None
self.user_finalist_roles = None
class AuthenticationException(Exception):
pass
def __str__(self):
return self.email
def full_name(self):
fn = self.first_name
ln = self.last_name
if fn and ln:
name = u"%s %s" % (fn, ln)
else:
name = str(self.email)
return name
def user_phone(self):
return self._get_profile().phone
def image_url(self):
return self._get_profile().image_url()
def team_member_id(self):
return self.team_member.id if self._get_member() else ''
def user_title(self):
return self._get_title_and_company()['title']
def user_twitter_handle(self):
return self._get_profile().twitter_handle
def user_linked_in_url(self):
return self._get_profile().linked_in_url
def user_facebook_url(self):
return self._get_profile().facebook_url
def user_personal_website_url(self):
return self._get_profile().personal_website_url
def type(self):
return self._get_profile().user_type
def startup_name(self):
return self._get_title_and_company()['company']
def _get_title_and_company(self):
if self._is_expert() and self._has_expert_details():
profile = self._get_profile()
title = profile.title
company = profile.company
return {
"title": title,
"company": company
}
self._get_member()
title = self.team_member.title if self.team_member else ""
company = self.startup.name if self._get_startup() else None
return {
"title": title,
"company": company
}
def _has_expert_details(self):
if self._is_expert():
profile = self._get_profile()
return True if profile.title or profile.company else False
def startup_industry(self):
return self.startup.primary_industry if self._get_startup() else None
def top_level_startup_industry(self):
industry = (
self.startup.primary_industry if self._get_startup() else None)
return industry.parent if industry and industry.parent else industry
def startup_status_names(self):
if self._get_startup():
return [startup_status.program_startup_status.startup_status
for startup_status in self.startup.startupstatus_set.all()]
def finalist_user_roles(self):
if not self.user_finalist_roles:
finalist_roles = BaseUserRole.FINALIST_USER_ROLES
self.user_finalist_roles = self.programrolegrant_set.filter(
program_role__user_role__name__in=finalist_roles
).values_list('program_role__name', flat=True).distinct()
return list(self.user_finalist_roles)
def program(self):
return self.startup.current_program() if self._get_startup() else None
def location(self):
program = self.program()
return program.program_family.name if program else None
def year(self):
program = self.program()
return program.start_date.year if program else None
def is_team_member(self):
return True if self._get_member() else False
def _get_startup(self):
if not self.startup:
self._get_member()
if self.team_member:
self.startup = self.team_member.startup
return self.startup
def _get_member(self):
if not self.team_member:
self.team_member = self.startupteammember_set.last()
return self.team_member
def _get_profile(self):
if self.profile:
return self.profile
self.profile = self.get_profile()
return self.profile
def has_a_finalist_role(self):
return len(self.finalist_user_roles()) > 0
def <|fim_middle|>(self):
profile = self._get_profile()
return profile.user_type == EXPERT_USER_TYPE.lower()
<|fim▁end|> | _is_expert |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.items('default'))
# select target AD container: default or user-specified with --mode?
if argp.a['mode'] is not None:
try:
container_conf_key = 'am_container_' + argp.a['mode']
c['am_container'] = c[container_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
container_conf_key
raise Exception(log_msg)
else:
c['am_container'] = c['am_container_default']
# select alternate flat file automount maps: default or user-specified
# set passed via --source?
if argp.a['source'] is not None:
try:
ff_map_dir_conf_key = 'flat_file_map_dir_' + argp.a['source']<|fim▁hole|> log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
ff_map_dir_conf_key
raise Exception(log_msg)
else:
c['flat_file_map_dir'] = c['flat_file_map_dir_default']<|fim▁end|> | c['flat_file_map_dir'] = c[ff_map_dir_conf_key]
except KeyError: |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.items('default'))
# select target AD container: default or user-specified with --mode?
if argp.a['mode'] is not None:
<|fim_middle|>
else:
c['am_container'] = c['am_container_default']
# select alternate flat file automount maps: default or user-specified
# set passed via --source?
if argp.a['source'] is not None:
try:
ff_map_dir_conf_key = 'flat_file_map_dir_' + argp.a['source']
c['flat_file_map_dir'] = c[ff_map_dir_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
ff_map_dir_conf_key
raise Exception(log_msg)
else:
c['flat_file_map_dir'] = c['flat_file_map_dir_default']
<|fim▁end|> | try:
container_conf_key = 'am_container_' + argp.a['mode']
c['am_container'] = c[container_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
container_conf_key
raise Exception(log_msg) |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.items('default'))
# select target AD container: default or user-specified with --mode?
if argp.a['mode'] is not None:
try:
container_conf_key = 'am_container_' + argp.a['mode']
c['am_container'] = c[container_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
container_conf_key
raise Exception(log_msg)
else:
<|fim_middle|>
# select alternate flat file automount maps: default or user-specified
# set passed via --source?
if argp.a['source'] is not None:
try:
ff_map_dir_conf_key = 'flat_file_map_dir_' + argp.a['source']
c['flat_file_map_dir'] = c[ff_map_dir_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
ff_map_dir_conf_key
raise Exception(log_msg)
else:
c['flat_file_map_dir'] = c['flat_file_map_dir_default']
<|fim▁end|> | c['am_container'] = c['am_container_default'] |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.items('default'))
# select target AD container: default or user-specified with --mode?
if argp.a['mode'] is not None:
try:
container_conf_key = 'am_container_' + argp.a['mode']
c['am_container'] = c[container_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
container_conf_key
raise Exception(log_msg)
else:
c['am_container'] = c['am_container_default']
# select alternate flat file automount maps: default or user-specified
# set passed via --source?
if argp.a['source'] is not None:
<|fim_middle|>
else:
c['flat_file_map_dir'] = c['flat_file_map_dir_default']
<|fim▁end|> | try:
ff_map_dir_conf_key = 'flat_file_map_dir_' + argp.a['source']
c['flat_file_map_dir'] = c[ff_map_dir_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
ff_map_dir_conf_key
raise Exception(log_msg) |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.items('default'))
# select target AD container: default or user-specified with --mode?
if argp.a['mode'] is not None:
try:
container_conf_key = 'am_container_' + argp.a['mode']
c['am_container'] = c[container_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
container_conf_key
raise Exception(log_msg)
else:
c['am_container'] = c['am_container_default']
# select alternate flat file automount maps: default or user-specified
# set passed via --source?
if argp.a['source'] is not None:
try:
ff_map_dir_conf_key = 'flat_file_map_dir_' + argp.a['source']
c['flat_file_map_dir'] = c[ff_map_dir_conf_key]
except KeyError:
log_msg = 'Terminating. No such parameter in ampush.conf: ' + \
ff_map_dir_conf_key
raise Exception(log_msg)
else:
<|fim_middle|>
<|fim▁end|> | c['flat_file_map_dir'] = c['flat_file_map_dir_default'] |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict<|fim▁hole|>
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)<|fim▁end|> | from setuptools import setup, find_packages
from engineer import version |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
<|fim_middle|>
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | """
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
<|fim_middle|>
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
<|fim_middle|>
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | with open('README.md') as file:
return file.read() |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
<|fim_middle|>
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
<|fim_middle|>
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
<|fim_middle|>
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
<|fim_middle|>
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | continue |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
<|fim_middle|>
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
<|fim_middle|>
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | new_package = name |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
<|fim_middle|>
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | new_package = package + '.' + name |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
<|fim_middle|>
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | stack.append((fn, prefix + name + '/', package, only_in_packages)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
<|fim_middle|>
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
<|fim_middle|>
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
<|fim_middle|>
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
<|fim_middle|>
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | continue |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
<|fim_middle|>
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | continue |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
<|fim_middle|>
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | requirements.append(line) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def <|fim_middle|>(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | find_package_data |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def <|fim_middle|>(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def get_readme():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | get_install_requirements |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version
PROJECT = 'engineer'
################################################################################
# find_package_data written by Ian Bicking.
# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
The dictionary looks like::
{'package': [files]}
Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.
If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).
Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.
If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
This function is by Ian Bicking.
"""
out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
################################################################################
# noinspection PyShadowingBuiltins
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
continue
else:
requirements.append(line)
return requirements
# noinspection PyShadowingBuiltins
def <|fim_middle|>():
with open('README.md') as file:
return file.read()
setup(
name=PROJECT,
version=version.string,
author='Tyler Butler',
author_email='[email protected]',
platforms='any',
packages=find_packages(),
entry_points={
'console_scripts': [
'engineer=engineer.engine:cmdline',
'engineer_dev=engineer.devtools:main [dev]'
],
},
url='http://github.com/tylerbutler/engineer',
license='MIT',
description='A static website generator.',
long_description=get_readme(),
install_requires=get_install_requirements(),
tests_require=get_install_requirements('requirements_tests.txt'),
extras_require={
'dev': ['argh', 'clint']
},
cmdclass=cmdclassdict,
include_package_data=True,
package_data=find_package_data(PROJECT,
package=PROJECT,
only_in_packages=False),
# Setting to False doesn't create an egg - easier to debug and hack on
zip_safe=True,
)
<|fim▁end|> | get_readme |
<|file_name|>application_gateway_ssl_predefined_policy.py<|end_file_name|><|fim▁begin|># coding=utf-8<|fim▁hole|># --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .sub_resource import SubResource
class ApplicationGatewaySslPredefinedPolicy(SubResource):
"""An Ssl predefined policy.
:param id: Resource ID.
:type id: str
:param name: Name of Ssl predefined policy.
:type name: str
:param cipher_suites: Ssl cipher suites to be enabled in the specified
order for application gateway.
:type cipher_suites: list[str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslCipherSuite]
:param min_protocol_version: Minimum version of Ssl protocol to be
supported on application gateway. Possible values include: 'TLSv1_0',
'TLSv1_1', 'TLSv1_2'
:type min_protocol_version: str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslProtocol
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'cipher_suites': {'key': 'properties.cipherSuites', 'type': '[str]'},
'min_protocol_version': {'key': 'properties.minProtocolVersion', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ApplicationGatewaySslPredefinedPolicy, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.cipher_suites = kwargs.get('cipher_suites', None)
self.min_protocol_version = kwargs.get('min_protocol_version', None)<|fim▁end|> | |
<|file_name|>application_gateway_ssl_predefined_policy.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .sub_resource import SubResource
class ApplicationGatewaySslPredefinedPolicy(SubResource):
<|fim_middle|>
<|fim▁end|> | """An Ssl predefined policy.
:param id: Resource ID.
:type id: str
:param name: Name of Ssl predefined policy.
:type name: str
:param cipher_suites: Ssl cipher suites to be enabled in the specified
order for application gateway.
:type cipher_suites: list[str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslCipherSuite]
:param min_protocol_version: Minimum version of Ssl protocol to be
supported on application gateway. Possible values include: 'TLSv1_0',
'TLSv1_1', 'TLSv1_2'
:type min_protocol_version: str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslProtocol
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'cipher_suites': {'key': 'properties.cipherSuites', 'type': '[str]'},
'min_protocol_version': {'key': 'properties.minProtocolVersion', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ApplicationGatewaySslPredefinedPolicy, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.cipher_suites = kwargs.get('cipher_suites', None)
self.min_protocol_version = kwargs.get('min_protocol_version', None) |
<|file_name|>application_gateway_ssl_predefined_policy.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .sub_resource import SubResource
class ApplicationGatewaySslPredefinedPolicy(SubResource):
"""An Ssl predefined policy.
:param id: Resource ID.
:type id: str
:param name: Name of Ssl predefined policy.
:type name: str
:param cipher_suites: Ssl cipher suites to be enabled in the specified
order for application gateway.
:type cipher_suites: list[str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslCipherSuite]
:param min_protocol_version: Minimum version of Ssl protocol to be
supported on application gateway. Possible values include: 'TLSv1_0',
'TLSv1_1', 'TLSv1_2'
:type min_protocol_version: str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslProtocol
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'cipher_suites': {'key': 'properties.cipherSuites', 'type': '[str]'},
'min_protocol_version': {'key': 'properties.minProtocolVersion', 'type': 'str'},
}
def __init__(self, **kwargs):
<|fim_middle|>
<|fim▁end|> | super(ApplicationGatewaySslPredefinedPolicy, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.cipher_suites = kwargs.get('cipher_suites', None)
self.min_protocol_version = kwargs.get('min_protocol_version', None) |
<|file_name|>application_gateway_ssl_predefined_policy.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .sub_resource import SubResource
class ApplicationGatewaySslPredefinedPolicy(SubResource):
"""An Ssl predefined policy.
:param id: Resource ID.
:type id: str
:param name: Name of Ssl predefined policy.
:type name: str
:param cipher_suites: Ssl cipher suites to be enabled in the specified
order for application gateway.
:type cipher_suites: list[str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslCipherSuite]
:param min_protocol_version: Minimum version of Ssl protocol to be
supported on application gateway. Possible values include: 'TLSv1_0',
'TLSv1_1', 'TLSv1_2'
:type min_protocol_version: str or
~azure.mgmt.network.v2017_10_01.models.ApplicationGatewaySslProtocol
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'cipher_suites': {'key': 'properties.cipherSuites', 'type': '[str]'},
'min_protocol_version': {'key': 'properties.minProtocolVersion', 'type': 'str'},
}
def <|fim_middle|>(self, **kwargs):
super(ApplicationGatewaySslPredefinedPolicy, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.cipher_suites = kwargs.get('cipher_suites', None)
self.min_protocol_version = kwargs.get('min_protocol_version', None)
<|fim▁end|> | __init__ |
<|file_name|>parse_args.py<|end_file_name|><|fim▁begin|>"""
atomorder/parse_args.py
Parses command line arguments and overwrites setting defaults
"""
from . import settings
import argparse<|fim▁hole|>import sys
description = ""
epilog = ""
parser = argparse.ArgumentParser(
description = description,
formatter_class = argparse.RawDescriptionHelpFormatter,
epilog = epilog)
parser = argparse.ArgumentParser(description='Fit probability density functions to data-files')
parser.add_argument('-r', '--reactants', help='Reactant structures in a coordinate file format.', action='store', type=str, nargs='+')
parser.add_argument('-p', '--products', help='Product structures in a coordinate file format.', action='store', type=str, nargs='+')
parser.add_argument('--print-level', help='Print-level - 0: quiet, 1: results and errors, 2: +warnings, 3: +progress, 4: excess, 5: EXTREME',
action='store', choices = range(0,6), default=1, type=int)
parser.add_argument('-f', '--format', help='File format', type=str, action='store', default='guess', choices=["guess","xyz","pdb"])
parser.add_argument('-m', '--method', help='Method to use.\n \
rotate: Ignore bond order, align a single reactant and product molecule and match all atoms\n \
no-bond: Atom matching by rotation and atomic similarity\n \
full: Atom matching by rotation and bond similarity\n \
info: Information about molecule sybyl atom types, bond types and conjugated sub systems',
choices = ['rotate', 'full', 'info', 'no-bond'], action='store', default='full')
parser.add_argument('-o', '--output', help='Given a filename, output the reordered product in xyz format instead of printing to stdout', action='store', type=str, default=sys.stdout)
parser.add_argument('--atomic-sybyl-weight', action='store', default=1, type=float)
parser.add_argument('--bond-weight', action='store', default=1, type=float)
# TODO output to folder
# TODO output atom mapping oneline, save reordered products
# TODO allow possibility to give pickle with reaction object
# TODO output sybyl
# TODO batch reactions
# TODO output aromatic/conjugated subgroups
args = parser.parse_args()
# override setting defaults
settings.update(args)<|fim▁end|> | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask<|fim▁hole|>app = Flask(__name__)
app.config.from_object('blog.config')
from blog import views<|fim▁end|> | |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
<|fim▁hole|>
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))<|fim▁end|> | )
|
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
<|fim_middle|>
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | _fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
<|fim_middle|>
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | _fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
<|fim_middle|>
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | _fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
<|fim_middle|>
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | _fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
<|fim_middle|>
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | _fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion)) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
<|fim_middle|>
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
<|fim_middle|>
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
<|fim_middle|>
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
<|fim_middle|>
<|fim▁end|> | i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT)) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
<|fim_middle|>
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return None |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
<|fim_middle|>
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return None |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
<|fim_middle|>
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return scriptHandler._makeKbEmulateScript(scriptName) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
<|fim_middle|>
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
<|fim_middle|>
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
<|fim_middle|>
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
<|fim_middle|>
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | func = getattr(app, "script_%s" % scriptName, None)
if func:
return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
<|fim_middle|>
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
<|fim_middle|>
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
<|fim_middle|>
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
<|fim_middle|>
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
<|fim_middle|>
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | return func |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
<|fim_middle|>
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | i.union.ki.wScan = scan |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
<|fim_middle|>
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC) |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
<|fim_middle|>
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | i.union.ki.dwFlags |= KEYEVENTF_KEYUP |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
<|fim_middle|>
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def <|fim_middle|>(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | __init__ |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def <|fim_middle|>(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def send_key(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | findScript |
<|file_name|>input.py<|end_file_name|><|fim▁begin|>import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE = 0x0004
class MOUSEINPUT(ctypes.Structure):
_fields_ = (
('dx', ctypes.c_long),
('dy', ctypes.c_long),
('mouseData', ctypes.DWORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class KEYBDINPUT(ctypes.Structure):
_fields_ = (
('wVk', ctypes.WORD),
('wScan', ctypes.WORD),
('dwFlags', ctypes.DWORD),
('time', ctypes.DWORD),
('dwExtraInfo', ctypes.POINTER(ctypes.c_ulong)),
)
class HARDWAREINPUT(ctypes.Structure):
_fields_ = (
('uMsg', ctypes.DWORD),
('wParamL', ctypes.WORD),
('wParamH', ctypes.WORD),
)
class INPUTUnion(ctypes.Union):
_fields_ = (
('mi', MOUSEINPUT),
('ki', KEYBDINPUT),
('hi', HARDWAREINPUT),
)
class INPUT(ctypes.Structure):
_fields_ = (
('type', ctypes.DWORD),
('union', INPUTUnion))
class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
def __init__(self, **kwargs):
super(BrailleInputGesture, self).__init__()
for key, value in kwargs.iteritems():
setattr(self, key, value)
self.source="remote{}{}".format(self.source[0].upper(),self.source[1:])
self.scriptPath=getattr(self,"scriptPath",None)
self.script=self.findScript() if self.scriptPath else None
def findScript(self):
if not (isinstance(self.scriptPath,list) and len(self.scriptPath)==3):
return None
module,cls,scriptName=self.scriptPath
focus = api.getFocusObject()
if not focus:
return None
if scriptName.startswith("kb:"):
# Emulate a key press.
return scriptHandler._makeKbEmulateScript(scriptName)
import globalCommands
# Global plugin level.
if cls=='GlobalPlugin':
for plugin in globalPluginHandler.runningPlugins:
if module==plugin.__module__:
func = getattr(plugin, "script_%s" % scriptName, None)
if func:
return func
# App module level.
app = focus.appModule
if app and cls=='AppModule' and module==app.__module__:
func = getattr(app, "script_%s" % scriptName, None)
if func:
return func
# Tree interceptor level.
treeInterceptor = focus.treeInterceptor
if treeInterceptor and treeInterceptor.isReady:
func = getattr(treeInterceptor , "script_%s" % scriptName, None)
# We are no keyboard input
return func
# NVDAObject level.
func = getattr(focus, "script_%s" % scriptName, None)
if func:
return func
for obj in reversed(api.getFocusAncestors()):
func = getattr(obj, "script_%s" % scriptName, None)
if func and getattr(func, 'canPropagate', False):
return func
# Global commands.
func = getattr(globalCommands.commands, "script_%s" % scriptName, None)
if func:
return func
return None
def <|fim_middle|>(vk=None, scan=None, extended=False, pressed=True):
i = INPUT()
i.union.ki.wVk = vk
if scan:
i.union.ki.wScan = scan
else: #No scancode provided, try to get one
i.union.ki.wScan = ctypes.windll.user32.MapVirtualKeyW(vk, MAPVK_VK_TO_VSC)
if not pressed:
i.union.ki.dwFlags |= KEYEVENTF_KEYUP
if extended:
i.union.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY
i.type = INPUT_KEYBOARD
ctypes.windll.user32.SendInput(1, ctypes.byref(i), ctypes.sizeof(INPUT))
<|fim▁end|> | send_key |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):<|fim▁hole|> config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()<|fim▁end|> | """Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError): |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
<|fim_middle|>
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config)) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
<|fim_middle|>
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
<|fim_middle|>
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
<|fim_middle|>
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
<|fim_middle|>
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
<|fim_middle|>
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
<|fim_middle|>
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
<|fim_middle|>
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
<|fim_middle|>
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | """Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config)) |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | absltest.main() |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def <|fim_middle|>(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_list_extra_index |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def <|fim_middle|>(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_list_out_of_range_get |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def <|fim_middle|>(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_list_out_of_range_set |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def <|fim_middle|>(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_reading_non_existing_key |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def <|fim_middle|>(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_reading_setting_existing_key_in_dict |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def <|fim_middle|>(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_empty_key |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def <|fim_middle|>(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def test_types(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_field_reference_types |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for config_path."""
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
class ConfigPathTest(parameterized.TestCase):
def test_list_extra_index(self):
"""Tries to index a non-indexable list element."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[0][0]', test_config)
def test_list_out_of_range_get(self):
"""Tries to access out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.get_value('dict.list[2][1]', test_config)
def test_list_out_of_range_set(self):
"""Tries to override out-of-range value in list."""
test_config = mock_config.get_config()
with self.assertRaises(IndexError):
config_path.set_value('dict.list[2][1]', test_config, -1)
def test_reading_non_existing_key(self):
"""Tests reading non existing key from config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key', test_config, 1)
def test_reading_setting_existing_key_in_dict(self):
"""Tests setting non existing key from dict inside config."""
test_config = mock_config.get_config()
with self.assertRaises(KeyError):
config_path.set_value('dict.not_existing_key.key', test_config, 1)
def test_empty_key(self):
"""Tests calling an empty key update."""
test_config = mock_config.get_config()
with self.assertRaises(ValueError):
config_path.set_value('', test_config, None)
def test_field_reference_types(self):
"""Tests whether types of FieldReference fields are valid."""
test_config = fieldreference_config.get_config()
paths = ['ref_nodefault', 'ref']
paths_types = [int, int]
config_types = [config_path.get_type(path, test_config) for path in paths]
self.assertEqual(paths_types, config_types)
@parameterized.parameters(
('float', float),
('integer', int),
('string', str),
('bool', bool),
('dict', dict),
('dict.float', float),
('dict.list', list),
('list', list),
('list[0]', int),
('object.float', float),
('object.integer', int),
('object.string', str),
('object.bool', bool),
('object.dict', dict),
('object.dict.float', float),
('object.dict.list', list),
('object.list', list),
('object.list[0]', int),
('object.tuple', tuple),
('object_reference.float', float),
('object_reference.integer', int),
('object_reference.string', str),
('object_reference.bool', bool),
('object_reference.dict', dict),
('object_reference.dict.float', float),
('object_copy.float', float),
('object_copy.integer', int),
('object_copy.string', str),
('object_copy.bool', bool),
('object_copy.dict', dict),
('object_copy.dict.float', float),
)
def <|fim_middle|>(self, path, path_type):
"""Tests whether various types of objects are valid."""
test_config = mock_config.get_config()
self.assertEqual(path_type, config_path.get_type(path, test_config))
if __name__ == '__main__':
absltest.main()
<|fim▁end|> | test_types |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})<|fim▁hole|> assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0<|fim▁end|> | response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0 |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
<|fim_middle|>
<|fim▁end|> | def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0 |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
<|fim_middle|>
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0
<|fim▁end|> | self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0 |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
<|fim_middle|>
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0
<|fim▁end|> | self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
<|fim_middle|>
<|fim▁end|> | self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0 |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def <|fim_middle|>(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0
<|fim▁end|> | test_simple |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def <|fim_middle|>(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def test_resolvable_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0
<|fim▁end|> | test_issues |
<|file_name|>test_project_processingissues.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (
ProcessingIssue, EventError, RawEvent, EventProcessingIssue
)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 1
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
def test_issues(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
raw_event = RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
issue, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abc',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2013, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
issue2, _ = ProcessingIssue.objects.get_or_create(
project_id=project1.id,
checksum='abcd',
type=EventError.NATIVE_MISSING_DSYM,
datetime=datetime(2014, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
)
EventProcessingIssue.objects.get_or_create(
raw_event=raw_event,
processing_issue=issue,
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert len(response.data['issues']) == 2
assert response.data['numIssues'] == 2
assert response.data['lastSeen'] == issue2.datetime
assert response.data['hasIssues'] is True
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['issuesProcessing'] == 0
assert response.data['resolveableIssues'] == 0
assert response.data['issues'][0]['checksum'] == issue.checksum
assert response.data['issues'][0]['numEvents'] == 1
assert response.data['issues'][0]['type'] == EventError.NATIVE_MISSING_DSYM
assert response.data['issues'][1]['checksum'] == issue2.checksum
def <|fim_middle|>(self):
self.login_as(user=self.user)
team = self.create_team()
project1 = self.create_project(team=team, name='foo')
RawEvent.objects.create(
project_id=project1.id,
event_id='abc'
)
url = reverse('sentry-api-0-project-processing-issues', kwargs={
'organization_slug': project1.organization.slug,
'project_slug': project1.slug,
})
response = self.client.get(url + '?detailed=1', format='json')
assert response.status_code == 200, response.content
assert response.data['numIssues'] == 0
assert response.data['resolveableIssues'] == 1
assert response.data['lastSeen'] is None
assert response.data['hasIssues'] is False
assert response.data['hasMoreResolveableIssues'] is False
assert response.data['numIssues'] == 0
assert response.data['issuesProcessing'] == 0
<|fim▁end|> | test_resolvable_issues |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as<|fim▁hole|># published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def setup_parser(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def cd(parser, args):
spack.modules.print_help()<|fim▁end|> | |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def setup_parser(subparser):
<|fim_middle|>
def cd(parser, args):
spack.modules.print_help()
<|fim▁end|> | """This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser) |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def setup_parser(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def cd(parser, args):
<|fim_middle|>
<|fim▁end|> | spack.modules.print_help() |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def <|fim_middle|>(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def cd(parser, args):
spack.modules.print_help()
<|fim▁end|> | setup_parser |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def setup_parser(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def <|fim_middle|>(parser, args):
spack.modules.print_help()
<|fim▁end|> | cd |
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|># © 2008-2020 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
<|fim▁hole|> "version": "14.0.3.0.3",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"license": "AGPL-3",
"category": "Generic Modules",
"depends": [
"base",
"account",
"l10n_ro_config",
"purchase",
# "deltatech_watermark"
],
"data": [
"views/invoice_report.xml",
"views/voucher_report.xml",
"views/payment_report.xml",
# 'views/account_invoice_view.xml',
"views/account_voucher_report.xml",
"views/account_bank_statement_view.xml",
"views/statement_report.xml",
# 'views/res_partner_view.xml',
],
}<|fim▁end|> | {
"name": "Romania - Invoice Report ",
"summary": "Localizare Terrabit", |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.