repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
muntasirsyed/intellij-community | python/lib/Lib/encodings/utf_7.py | 116 | 1086 | """ Python 'utf-7' Codec
Written by Brian Quinlan (brian@sweetapp.com).
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is intended.
encode = codecs.utf_7_encode
decode = codecs.utf_7_decode
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.utf_7_encode(input, self.errors)[0]
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
def _buffer_decode(self, input, errors, final):
return codecs.utf_7_decode(input, self.errors)
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='utf-7',
encode=Codec.encode,
decode=Codec.decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
)
| apache-2.0 |
direvus/ansible | lib/ansible/modules/network/nuage/nuage_vspk.py | 50 | 42235 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Nokia
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: nuage_vspk
short_description: Manage Nuage VSP environments
description:
- Manage or find Nuage VSP entities, this includes create, update, delete, assign, unassign and find, with all supported properties.
version_added: "2.4"
author: Philippe Dellaert (@pdellaert)
options:
auth:
description:
- Dict with the authentication information required to connect to a Nuage VSP environment.
- Requires a I(api_username) parameter (example csproot).
- Requires either a I(api_password) parameter (example csproot) or a I(api_certificate) and I(api_key) parameters,
which point to the certificate and key files for certificate based authentication.
- Requires a I(api_enterprise) parameter (example csp).
- Requires a I(api_url) parameter (example https://10.0.0.10:8443).
- Requires a I(api_version) parameter (example v4_0).
required: true
type:
description:
- The type of entity you want to work on (example Enterprise).
- This should match the objects CamelCase class name in VSPK-Python.
- This Class name can be found on U(https://nuagenetworks.github.io/vspkdoc/index.html).
required: true
id:
description:
- The ID of the entity you want to work on.
- In combination with I(command=find), it will only return the single entity.
- In combination with I(state), it will either update or delete this entity.
- Will take precedence over I(match_filter) and I(properties) whenever an entity needs to be found.
parent_id:
description:
- The ID of the parent of the entity you want to work on.
- When I(state) is specified, the entity will be gathered from this parent, if it exists, unless an I(id) is specified.
- When I(command=find) is specified, the entity will be searched for in this parent, unless an I(id) is specified.
- If specified, I(parent_type) also needs to be specified.
parent_type:
description:
- The type of parent the ID is specified for (example Enterprise).
- This should match the objects CamelCase class name in VSPK-Python.
- This Class name can be found on U(https://nuagenetworks.github.io/vspkdoc/index.html).
- If specified, I(parent_id) also needs to be specified.
state:
description:
- Specifies the desired state of the entity.
- If I(state=present), in case the entity already exists, will update the entity if it is needed.
- If I(state=present), in case the relationship with the parent is a member relationship, will assign the entity as a member of the parent.
- If I(state=absent), in case the relationship with the parent is a member relationship, will unassign the entity as a member of the parent.
- Either I(state) or I(command) needs to be defined, both can not be defined at the same time.
choices:
- present
- absent
command:
description:
- Specifies a command to be executed.
- With I(command=find), if I(parent_id) and I(parent_type) are defined, it will only search within the parent. Otherwise, if allowed,
will search in the root object.
- With I(command=find), if I(id) is specified, it will only return the single entity matching the id.
- With I(command=find), otherwise, if I(match_filter) is define, it will use that filter to search.
- With I(command=find), otherwise, if I(properties) are defined, it will do an AND search using all properties.
- With I(command=change_password), a password of a user can be changed. Warning - In case the password is the same as the existing,
it will throw an error.
- With I(command=wait_for_job), the module will wait for a job to either have a status of SUCCESS or ERROR. In case an ERROR status is found,
the module will exit with an error.
- With I(command=wait_for_job), the job will always be returned, even if the state is ERROR situation.
- Either I(state) or I(command) needs to be defined, both can not be defined at the same time.
choices:
- find
- change_password
- wait_for_job
- get_csp_enterprise
match_filter:
description:
- A filter used when looking (both in I(command) and I(state) for entities, in the format the Nuage VSP API expects.
- If I(match_filter) is defined, it will take precedence over the I(properties), but not on the I(id)
properties:
description:
- Properties are the key, value pairs of the different properties an entity has.
- If no I(id) and no I(match_filter) is specified, these are used to find or determine if the entity exists.
children:
description:
- Can be used to specify a set of child entities.
- A mandatory property of each child is the I(type).
- Supported optional properties of each child are I(id), I(properties) and I(match_filter).
- The function of each of these properties is the same as in the general task definition.
- This can be used recursively
- Only useable in case I(state=present).
notes:
- Check mode is supported, but with some caveats. It will not do any changes, and if possible try to determine if it is able do what is requested.
- In case a parent id is provided from a previous task, it might be empty and if a search is possible on root, it will do so, which can impact performance.
requirements:
- Python 2.7
- Supports Nuage VSP 4.0Rx & 5.x.y
- Proper VSPK-Python installed for your Nuage version
- Tested with NuageX U(https://nuagex.io)
'''
EXAMPLES = '''
# This can be executed as a single role, with the following vars
# vars:
# auth:
# api_username: csproot
# api_password: csproot
# api_enterprise: csp
# api_url: https://10.0.0.10:8443
# api_version: v5_0
# enterprise_name: Ansible-Enterprise
# enterprise_new_name: Ansible-Updated-Enterprise
#
# or, for certificate based authentication
# vars:
# auth:
# api_username: csproot
# api_certificate: /path/to/user-certificate.pem
# api_key: /path/to/user-Key.pem
# api_enterprise: csp
# api_url: https://10.0.0.10:8443
# api_version: v5_0
# enterprise_name: Ansible-Enterprise
# enterprise_new_name: Ansible-Updated-Enterprise
# Creating a new enterprise
- name: Create Enterprise
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Enterprise
state: present
properties:
name: "{{ enterprise_name }}-basic"
register: nuage_enterprise
# Checking if an Enterprise with the new name already exists
- name: Check if an Enterprise exists with the new name
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Enterprise
command: find
properties:
name: "{{ enterprise_new_name }}-basic"
ignore_errors: yes
register: nuage_check_enterprise
# Updating an enterprise's name
- name: Update Enterprise name
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Enterprise
id: "{{ nuage_enterprise.id }}"
state: present
properties:
name: "{{ enterprise_new_name }}-basic"
when: nuage_check_enterprise is failed
# Creating a User in an Enterprise
- name: Create admin user
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: User
parent_id: "{{ nuage_enterprise.id }}"
parent_type: Enterprise
state: present
match_filter: "userName == 'ansible-admin'"
properties:
email: "ansible@localhost.local"
first_name: "Ansible"
last_name: "Admin"
password: "ansible-password"
user_name: "ansible-admin"
register: nuage_user
# Updating password for User
- name: Update admin password
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: User
id: "{{ nuage_user.id }}"
command: change_password
properties:
password: "ansible-new-password"
ignore_errors: yes
# Finding a group in an enterprise
- name: Find Administrators group in Enterprise
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Group
parent_id: "{{ nuage_enterprise.id }}"
parent_type: Enterprise
command: find
properties:
name: "Administrators"
register: nuage_group
# Assign the user to the group
- name: Assign admin user to administrators
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: User
id: "{{ nuage_user.id }}"
parent_id: "{{ nuage_group.id }}"
parent_type: Group
state: present
# Creating multiple DomainTemplates
- name: Create multiple DomainTemplates
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: DomainTemplate
parent_id: "{{ nuage_enterprise.id }}"
parent_type: Enterprise
state: present
properties:
name: "{{ item }}"
description: "Created by Ansible"
with_items:
- "Template-1"
- "Template-2"
# Finding all DomainTemplates
- name: Fetching all DomainTemplates
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: DomainTemplate
parent_id: "{{ nuage_enterprise.id }}"
parent_type: Enterprise
command: find
register: nuage_domain_templates
# Deleting all DomainTemplates
- name: Deleting all found DomainTemplates
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: DomainTemplate
state: absent
id: "{{ item.ID }}"
with_items: "{{ nuage_domain_templates.entities }}"
when: nuage_domain_templates.entities is defined
# Unassign user from group
- name: Unassign admin user to administrators
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: User
id: "{{ nuage_user.id }}"
parent_id: "{{ nuage_group.id }}"
parent_type: Group
state: absent
# Deleting an enterprise
- name: Delete Enterprise
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Enterprise
id: "{{ nuage_enterprise.id }}"
state: absent
# Setup an enterprise with Children
- name: Setup Enterprise and domain structure
connection: local
nuage_vspk:
auth: "{{ nuage_auth }}"
type: Enterprise
state: present
properties:
name: "Child-based-Enterprise"
children:
- type: L2DomainTemplate
properties:
name: "Unmanaged-Template"
children:
- type: EgressACLTemplate
match_filter: "name == 'Allow All'"
properties:
name: "Allow All"
active: true
default_allow_ip: true
default_allow_non_ip: true
default_install_acl_implicit_rules: true
description: "Created by Ansible"
priority_type: "TOP"
- type: IngressACLTemplate
match_filter: "name == 'Allow All'"
properties:
name: "Allow All"
active: true
default_allow_ip: true
default_allow_non_ip: true
description: "Created by Ansible"
priority_type: "TOP"
'''
RETURN = '''
id:
description: The id of the entity that was found, created, updated or assigned.
returned: On state=present and command=find in case one entity was found.
type: string
sample: bae07d8d-d29c-4e2b-b6ba-621b4807a333
entities:
description: A list of entities handled. Each element is the to_dict() of the entity.
returned: On state=present and find, with only one element in case of state=present or find=one.
type: list
sample: [{
"ID": acabc435-3946-4117-a719-b8895a335830",
"assocEntityType": "DOMAIN",
"command": "BEGIN_POLICY_CHANGES",
"creationDate": 1487515656000,
"entityScope": "ENTERPRISE",
"externalID": null,
"lastUpdatedBy": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
"lastUpdatedDate": 1487515656000,
"owner": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
"parameters": null,
"parentID": "a22fddb9-3da4-4945-bd2e-9d27fe3d62e0",
"parentType": "domain",
"progress": 0.0,
"result": null,
"status": "RUNNING"
}]
'''
import time
try:
import importlib
HAS_IMPORTLIB = True
except ImportError:
HAS_IMPORTLIB = False
try:
from bambou.exceptions import BambouHTTPError
HAS_BAMBOU = True
except ImportError:
HAS_BAMBOU = False
from ansible.module_utils.basic import AnsibleModule
SUPPORTED_COMMANDS = ['find', 'change_password', 'wait_for_job', 'get_csp_enterprise']
VSPK = None
class NuageEntityManager(object):
"""
This module is meant to manage an entity in a Nuage VSP Platform
"""
def __init__(self, module):
self.module = module
self.auth = module.params['auth']
self.api_username = None
self.api_password = None
self.api_enterprise = None
self.api_url = None
self.api_version = None
self.api_certificate = None
self.api_key = None
self.type = module.params['type']
self.state = module.params['state']
self.command = module.params['command']
self.match_filter = module.params['match_filter']
self.entity_id = module.params['id']
self.parent_id = module.params['parent_id']
self.parent_type = module.params['parent_type']
self.properties = module.params['properties']
self.children = module.params['children']
self.entity = None
self.entity_class = None
self.parent = None
self.parent_class = None
self.entity_fetcher = None
self.result = {
'state': self.state,
'id': self.entity_id,
'entities': []
}
self.nuage_connection = None
self._verify_api()
self._verify_input()
self._connect_vspk()
self._find_parent()
def _connect_vspk(self):
"""
Connects to a Nuage API endpoint
"""
try:
# Connecting to Nuage
if self.api_certificate and self.api_key:
self.nuage_connection = VSPK.NUVSDSession(username=self.api_username, enterprise=self.api_enterprise, api_url=self.api_url,
certificate=(self.api_certificate, self.api_key))
else:
self.nuage_connection = VSPK.NUVSDSession(username=self.api_username, password=self.api_password, enterprise=self.api_enterprise,
api_url=self.api_url)
self.nuage_connection.start()
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to connect to the API URL with given username, password and enterprise: {0}'.format(error))
def _verify_api(self):
"""
Verifies the API and loads the proper VSPK version
"""
# Checking auth parameters
if ('api_password' not in list(self.auth.keys()) or not self.auth['api_password']) and ('api_certificate' not in list(self.auth.keys()) or
'api_key' not in list(self.auth.keys()) or
not self.auth['api_certificate'] or not self.auth['api_key']):
self.module.fail_json(msg='Missing api_password or api_certificate and api_key parameter in auth')
self.api_username = self.auth['api_username']
if 'api_password' in list(self.auth.keys()) and self.auth['api_password']:
self.api_password = self.auth['api_password']
if 'api_certificate' in list(self.auth.keys()) and 'api_key' in list(self.auth.keys()) and self.auth['api_certificate'] and self.auth['api_key']:
self.api_certificate = self.auth['api_certificate']
self.api_key = self.auth['api_key']
self.api_enterprise = self.auth['api_enterprise']
self.api_url = self.auth['api_url']
self.api_version = self.auth['api_version']
try:
global VSPK
VSPK = importlib.import_module('vspk.{0:s}'.format(self.api_version))
except ImportError:
self.module.fail_json(msg='vspk is required for this module, or the API version specified does not exist.')
def _verify_input(self):
"""
Verifies the parameter input for types and parent correctness and necessary parameters
"""
# Checking if type exists
try:
self.entity_class = getattr(VSPK, 'NU{0:s}'.format(self.type))
except AttributeError:
self.module.fail_json(msg='Unrecognised type specified')
if self.module.check_mode:
return
if self.parent_type:
# Checking if parent type exists
try:
self.parent_class = getattr(VSPK, 'NU{0:s}'.format(self.parent_type))
except AttributeError:
# The parent type does not exist, fail
self.module.fail_json(msg='Unrecognised parent type specified')
fetcher = self.parent_class().fetcher_for_rest_name(self.entity_class.rest_name)
if fetcher is None:
# The parent has no fetcher, fail
self.module.fail_json(msg='Specified parent is not a valid parent for the specified type')
elif not self.entity_id:
# If there is an id, we do not need a parent because we'll interact directly with the entity
# If an assign needs to happen, a parent will have to be provided
# Root object is the parent
self.parent_class = VSPK.NUMe
fetcher = self.parent_class().fetcher_for_rest_name(self.entity_class.rest_name)
if fetcher is None:
self.module.fail_json(msg='No parent specified and root object is not a parent for the type')
# Verifying if a password is provided in case of the change_password command:
if self.command and self.command == 'change_password' and 'password' not in self.properties.keys():
self.module.fail_json(msg='command is change_password but the following are missing: password property')
def _find_parent(self):
"""
Fetches the parent if needed, otherwise configures the root object as parent. Also configures the entity fetcher
Important notes:
- If the parent is not set, the parent is automatically set to the root object
- It the root object does not hold a fetcher for the entity, you have to provide an ID
- If you want to assign/unassign, you have to provide a valid parent
"""
self.parent = self.nuage_connection.user
if self.parent_id:
self.parent = self.parent_class(id=self.parent_id)
try:
self.parent.fetch()
except BambouHTTPError as error:
self.module.fail_json(msg='Failed to fetch the specified parent: {0}'.format(error))
self.entity_fetcher = self.parent.fetcher_for_rest_name(self.entity_class.rest_name)
def _find_entities(self, entity_id=None, entity_class=None, match_filter=None, properties=None, entity_fetcher=None):
"""
Will return a set of entities matching a filter or set of properties if the match_filter is unset. If the
entity_id is set, it will return only the entity matching that ID as the single element of the list.
:param entity_id: Optional ID of the entity which should be returned
:param entity_class: Optional class of the entity which needs to be found
:param match_filter: Optional search filter
:param properties: Optional set of properties the entities should contain
:param entity_fetcher: The fetcher for the entity type
:return: List of matching entities
"""
search_filter = ''
if entity_id:
found_entity = entity_class(id=entity_id)
try:
found_entity.fetch()
except BambouHTTPError as error:
self.module.fail_json(msg='Failed to fetch the specified entity by ID: {0}'.format(error))
return [found_entity]
elif match_filter:
search_filter = match_filter
elif properties:
# Building filter
for num, property_name in enumerate(properties):
if num > 0:
search_filter += ' and '
search_filter += '{0:s} == "{1}"'.format(property_name, properties[property_name])
if entity_fetcher is not None:
try:
return entity_fetcher.get(filter=search_filter)
except BambouHTTPError:
pass
return []
def _find_entity(self, entity_id=None, entity_class=None, match_filter=None, properties=None, entity_fetcher=None):
"""
Finds a single matching entity that matches all the provided properties, unless an ID is specified, in which
case it just fetches the one item
:param entity_id: Optional ID of the entity which should be returned
:param entity_class: Optional class of the entity which needs to be found
:param match_filter: Optional search filter
:param properties: Optional set of properties the entities should contain
:param entity_fetcher: The fetcher for the entity type
:return: The first entity matching the criteria, or None if none was found
"""
search_filter = ''
if entity_id:
found_entity = entity_class(id=entity_id)
try:
found_entity.fetch()
except BambouHTTPError as error:
self.module.fail_json(msg='Failed to fetch the specified entity by ID: {0}'.format(error))
return found_entity
elif match_filter:
search_filter = match_filter
elif properties:
# Building filter
for num, property_name in enumerate(properties):
if num > 0:
search_filter += ' and '
search_filter += '{0:s} == "{1}"'.format(property_name, properties[property_name])
if entity_fetcher is not None:
try:
return entity_fetcher.get_first(filter=search_filter)
except BambouHTTPError:
pass
return None
def handle_main_entity(self):
"""
Handles the Ansible task
"""
if self.command and self.command == 'find':
self._handle_find()
elif self.command and self.command == 'change_password':
self._handle_change_password()
elif self.command and self.command == 'wait_for_job':
self._handle_wait_for_job()
elif self.command and self.command == 'get_csp_enterprise':
self._handle_get_csp_enterprise()
elif self.state == 'present':
self._handle_present()
elif self.state == 'absent':
self._handle_absent()
self.module.exit_json(**self.result)
def _handle_absent(self):
"""
Handles the Ansible task when the state is set to absent
"""
# Absent state
self.entity = self._find_entity(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties,
entity_fetcher=self.entity_fetcher)
if self.entity and (self.entity_fetcher is None or self.entity_fetcher.relationship in ['child', 'root']):
# Entity is present, deleting
if self.module.check_mode:
self.result['changed'] = True
else:
self._delete_entity(self.entity)
self.result['id'] = None
elif self.entity and self.entity_fetcher.relationship == 'member':
# Entity is a member, need to check if already present
if self._is_member(entity_fetcher=self.entity_fetcher, entity=self.entity):
# Entity is not a member yet
if self.module.check_mode:
self.result['changed'] = True
else:
self._unassign_member(entity_fetcher=self.entity_fetcher, entity=self.entity, entity_class=self.entity_class, parent=self.parent,
set_output=True)
def _handle_present(self):
"""
Handles the Ansible task when the state is set to present
"""
# Present state
self.entity = self._find_entity(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties,
entity_fetcher=self.entity_fetcher)
# Determining action to take
if self.entity_fetcher is not None and self.entity_fetcher.relationship == 'member' and not self.entity:
self.module.fail_json(msg='Trying to assign an entity that does not exist')
elif self.entity_fetcher is not None and self.entity_fetcher.relationship == 'member' and self.entity:
# Entity is a member, need to check if already present
if not self._is_member(entity_fetcher=self.entity_fetcher, entity=self.entity):
# Entity is not a member yet
if self.module.check_mode:
self.result['changed'] = True
else:
self._assign_member(entity_fetcher=self.entity_fetcher, entity=self.entity, entity_class=self.entity_class, parent=self.parent,
set_output=True)
elif self.entity_fetcher is not None and self.entity_fetcher.relationship in ['child', 'root'] and not self.entity:
# Entity is not present as a child, creating
if self.module.check_mode:
self.result['changed'] = True
else:
self.entity = self._create_entity(entity_class=self.entity_class, parent=self.parent, properties=self.properties)
self.result['id'] = self.entity.id
self.result['entities'].append(self.entity.to_dict())
# Checking children
if self.children:
for child in self.children:
self._handle_child(child=child, parent=self.entity)
elif self.entity:
# Need to compare properties in entity and found entity
changed = self._has_changed(entity=self.entity, properties=self.properties)
if self.module.check_mode:
self.result['changed'] = changed
elif changed:
self.entity = self._save_entity(entity=self.entity)
self.result['id'] = self.entity.id
self.result['entities'].append(self.entity.to_dict())
else:
self.result['id'] = self.entity.id
self.result['entities'].append(self.entity.to_dict())
# Checking children
if self.children:
for child in self.children:
self._handle_child(child=child, parent=self.entity)
elif not self.module.check_mode:
self.module.fail_json(msg='Invalid situation, verify parameters')
def _handle_get_csp_enterprise(self):
"""
Handles the Ansible task when the command is to get the csp enterprise
"""
self.entity_id = self.parent.enterprise_id
self.entity = VSPK.NUEnterprise(id=self.entity_id)
try:
self.entity.fetch()
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to fetch CSP enterprise: {0}'.format(error))
self.result['id'] = self.entity_id
self.result['entities'].append(self.entity.to_dict())
def _handle_wait_for_job(self):
"""
Handles the Ansible task when the command is to wait for a job
"""
# Command wait_for_job
self.entity = self._find_entity(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties,
entity_fetcher=self.entity_fetcher)
if self.module.check_mode:
self.result['changed'] = True
else:
self._wait_for_job(self.entity)
def _handle_change_password(self):
"""
Handles the Ansible task when the command is to change a password
"""
# Command change_password
self.entity = self._find_entity(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties,
entity_fetcher=self.entity_fetcher)
if self.module.check_mode:
self.result['changed'] = True
else:
try:
getattr(self.entity, 'password')
except AttributeError:
self.module.fail_json(msg='Entity does not have a password property')
try:
setattr(self.entity, 'password', self.properties['password'])
except AttributeError:
self.module.fail_json(msg='Password can not be changed for entity')
self.entity = self._save_entity(entity=self.entity)
self.result['id'] = self.entity.id
self.result['entities'].append(self.entity.to_dict())
def _handle_find(self):
"""
Handles the Ansible task when the command is to find an entity
"""
# Command find
entities = self._find_entities(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties,
entity_fetcher=self.entity_fetcher)
self.result['changed'] = False
if entities:
if len(entities) == 1:
self.result['id'] = entities[0].id
for entity in entities:
self.result['entities'].append(entity.to_dict())
elif not self.module.check_mode:
self.module.fail_json(msg='Unable to find matching entries')
def _handle_child(self, child, parent):
"""
Handles children of a main entity. Fields are similar to the normal fields
Currently only supported state: present
"""
if 'type' not in list(child.keys()):
self.module.fail_json(msg='Child type unspecified')
elif 'id' not in list(child.keys()) and 'properties' not in list(child.keys()):
self.module.fail_json(msg='Child ID or properties unspecified')
# Setting intern variables
child_id = None
if 'id' in list(child.keys()):
child_id = child['id']
child_properties = None
if 'properties' in list(child.keys()):
child_properties = child['properties']
child_filter = None
if 'match_filter' in list(child.keys()):
child_filter = child['match_filter']
# Checking if type exists
entity_class = None
try:
entity_class = getattr(VSPK, 'NU{0:s}'.format(child['type']))
except AttributeError:
self.module.fail_json(msg='Unrecognised child type specified')
entity_fetcher = parent.fetcher_for_rest_name(entity_class.rest_name)
if entity_fetcher is None and not child_id and not self.module.check_mode:
self.module.fail_json(msg='Unable to find a fetcher for child, and no ID specified.')
# Try and find the child
entity = self._find_entity(entity_id=child_id, entity_class=entity_class, match_filter=child_filter, properties=child_properties,
entity_fetcher=entity_fetcher)
# Determining action to take
if entity_fetcher.relationship == 'member' and not entity:
self.module.fail_json(msg='Trying to assign a child that does not exist')
elif entity_fetcher.relationship == 'member' and entity:
# Entity is a member, need to check if already present
if not self._is_member(entity_fetcher=entity_fetcher, entity=entity):
# Entity is not a member yet
if self.module.check_mode:
self.result['changed'] = True
else:
self._assign_member(entity_fetcher=entity_fetcher, entity=entity, entity_class=entity_class, parent=parent, set_output=False)
elif entity_fetcher.relationship in ['child', 'root'] and not entity:
# Entity is not present as a child, creating
if self.module.check_mode:
self.result['changed'] = True
else:
entity = self._create_entity(entity_class=entity_class, parent=parent, properties=child_properties)
elif entity_fetcher.relationship in ['child', 'root'] and entity:
changed = self._has_changed(entity=entity, properties=child_properties)
if self.module.check_mode:
self.result['changed'] = changed
elif changed:
entity = self._save_entity(entity=entity)
if entity:
self.result['entities'].append(entity.to_dict())
# Checking children
if 'children' in list(child.keys()) and not self.module.check_mode:
for subchild in child['children']:
self._handle_child(child=subchild, parent=entity)
def _has_changed(self, entity, properties):
"""
Compares a set of properties with a given entity, returns True in case the properties are different from the
values in the entity
:param entity: The entity to check
:param properties: The properties to check
:return: boolean
"""
# Need to compare properties in entity and found entity
changed = False
if properties:
for property_name in list(properties.keys()):
if property_name == 'password':
continue
entity_value = ''
try:
entity_value = getattr(entity, property_name)
except AttributeError:
self.module.fail_json(msg='Property {0:s} is not valid for this type of entity'.format(property_name))
if entity_value != properties[property_name]:
# Difference in values changing property
changed = True
try:
setattr(entity, property_name, properties[property_name])
except AttributeError:
self.module.fail_json(msg='Property {0:s} can not be changed for this type of entity'.format(property_name))
return changed
def _is_member(self, entity_fetcher, entity):
"""
Verifies if the entity is a member of the parent in the fetcher
:param entity_fetcher: The fetcher for the entity type
:param entity: The entity to look for as a member in the entity fetcher
:return: boolean
"""
members = entity_fetcher.get()
for member in members:
if member.id == entity.id:
return True
return False
def _assign_member(self, entity_fetcher, entity, entity_class, parent, set_output):
"""
Adds the entity as a member to a parent
:param entity_fetcher: The fetcher of the entity type
:param entity: The entity to add as a member
:param entity_class: The class of the entity
:param parent: The parent on which to add the entity as a member
:param set_output: If set to True, sets the Ansible result variables
"""
members = entity_fetcher.get()
members.append(entity)
try:
parent.assign(members, entity_class)
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to assign entity as a member: {0}'.format(error))
self.result['changed'] = True
if set_output:
self.result['id'] = entity.id
self.result['entities'].append(entity.to_dict())
def _unassign_member(self, entity_fetcher, entity, entity_class, parent, set_output):
"""
Removes the entity as a member of a parent
:param entity_fetcher: The fetcher of the entity type
:param entity: The entity to remove as a member
:param entity_class: The class of the entity
:param parent: The parent on which to add the entity as a member
:param set_output: If set to True, sets the Ansible result variables
"""
members = []
for member in entity_fetcher.get():
if member.id != entity.id:
members.append(member)
try:
parent.assign(members, entity_class)
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to remove entity as a member: {0}'.format(error))
self.result['changed'] = True
if set_output:
self.result['id'] = entity.id
self.result['entities'].append(entity.to_dict())
def _create_entity(self, entity_class, parent, properties):
"""
Creates a new entity in the parent, with all properties configured as in the file
:param entity_class: The class of the entity
:param parent: The parent of the entity
:param properties: The set of properties of the entity
:return: The entity
"""
entity = entity_class(**properties)
try:
parent.create_child(entity)
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to create entity: {0}'.format(error))
self.result['changed'] = True
return entity
def _save_entity(self, entity):
"""
Updates an existing entity
:param entity: The entity to save
:return: The updated entity
"""
try:
entity.save()
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to update entity: {0}'.format(error))
self.result['changed'] = True
return entity
def _delete_entity(self, entity):
"""
Deletes an entity
:param entity: The entity to delete
"""
try:
entity.delete()
except BambouHTTPError as error:
self.module.fail_json(msg='Unable to delete entity: {0}'.format(error))
self.result['changed'] = True
def _wait_for_job(self, entity):
"""
Waits for a job to finish
:param entity: The job to wait for
"""
running = False
if entity.status == 'RUNNING':
self.result['changed'] = True
running = True
while running:
time.sleep(1)
entity.fetch()
if entity.status != 'RUNNING':
running = False
self.result['entities'].append(entity.to_dict())
if entity.status == 'ERROR':
self.module.fail_json(msg='Job ended in an error')
def main():
"""
Main method
"""
module = AnsibleModule(
argument_spec=dict(
auth=dict(
required=True,
type='dict',
options=dict(
api_username=dict(required=True, type='str'),
api_enterprise=dict(required=True, type='str'),
api_url=dict(required=True, type='str'),
api_version=dict(required=True, type='str'),
api_password=dict(default=None, required=False, type='str', no_log=True),
api_certificate=dict(default=None, required=False, type='str', no_log=True),
api_key=dict(default=None, required=False, type='str', no_log=True)
)
),
type=dict(required=True, type='str'),
id=dict(default=None, required=False, type='str'),
parent_id=dict(default=None, required=False, type='str'),
parent_type=dict(default=None, required=False, type='str'),
state=dict(default=None, choices=['present', 'absent'], type='str'),
command=dict(default=None, choices=SUPPORTED_COMMANDS, type='str'),
match_filter=dict(default=None, required=False, type='str'),
properties=dict(default=None, required=False, type='dict'),
children=dict(default=None, required=False, type='list')
),
mutually_exclusive=[
['command', 'state']
],
required_together=[
['parent_id', 'parent_type']
],
required_one_of=[
['command', 'state']
],
required_if=[
['state', 'present', ['id', 'properties', 'match_filter'], True],
['state', 'absent', ['id', 'properties', 'match_filter'], True],
['command', 'change_password', ['id', 'properties']],
['command', 'wait_for_job', ['id']]
],
supports_check_mode=True
)
if not HAS_BAMBOU:
module.fail_json(msg='bambou is required for this module')
if not HAS_IMPORTLIB:
module.fail_json(msg='importlib (python 2.7) is required for this module')
entity_manager = NuageEntityManager(module)
entity_manager.handle_main_entity()
if __name__ == '__main__':
main()
| gpl-3.0 |
jmelett/pyFxTrader | trader/portfolio.py | 2 | 14052 | # -*- coding: utf-8 -*-
import csv
import os
from collections import OrderedDict
from decimal import Decimal
import itertools
import time
import logging
from .app_conf import settings
from .utils import assert_decimal
log = logging.getLogger('pyFx')
class Open(object):
def __init__(self, strategy, price, side, order_type='limit'):
self.strategy = strategy
self.price = assert_decimal(price)
self.side = side
self.order_type = order_type
def __call__(self, portfolio):
portfolio.open_order(
strategy=self.strategy,
side=self.side,
order_type=self.order_type,
price=self.price,
)
class Close(object):
def __init__(self, strategy, price):
self.strategy = strategy
self.price = assert_decimal(price)
def __call__(self, portfolio):
portfolio.close_trade(self.strategy, price=self.price)
class Portfolio(object):
def __init__(self, broker, mode='live'):
self.broker = broker
self.mode = mode
self.pending_order_list = [] # Pending orders
self.position_list = [] # Confirmed transactions
self.csv_out_file = 'logs/backtest_log-{}.csv'.format(
time.strftime("%Y%m%d-%H%M%S"))
if mode == 'live':
import telegram
self.telegram = telegram.Bot(token=settings.TELEGRAM_TOKEN)
def send_bot(self, message):
if self.mode == 'live' and self.telegram:
try:
self.telegram.sendMessage(
chat_id=settings.TELEGRAM_CHAT_ID,
text=message)
return True
except Exception, e:
log.warn("TELEGRAM ERROR: {}".format(e))
return False
def open_order(self, strategy, side, order_type,
price=None, expiry=None, stop_loss=None):
units = self.calculate_position_size(strategy.instrument)
if (not stop_loss and settings.PF_USE_STOPLOSS_CALC):
stoploss_price = self.calculate_stop_loss(strategy.instrument, side)
else:
stoploss_price = stop_loss
# stoploss_price = stop_loss
takeprofit_price = self.calculate_take_profit(strategy.instrument,
side)
if settings.PF_USE_TAKE_PROFIT_DOUBLE:
units = int(units / 2)
position_1 = self.broker.open_order(
instrument=strategy.instrument,
units=units,
side=side,
order_type=order_type,
price=price,
expiry=expiry,
stop_loss=stoploss_price,
take_profit=takeprofit_price,
)
position_2 = self.broker.open_order(
instrument=strategy.instrument,
units=units,
side=side,
order_type=order_type,
price=price,
expiry=expiry,
stop_loss=stoploss_price,
)
if position_1:
strategy.open_position(position_1)
self.pending_order_list.append(position_1)
open_msg = "Open 1/2 {} ORDER #{} for {}/{} at {}".format(
position_1.side,
position_1.order_id, position_1.instrument,
position_1.open_price,
position_1.open_time)
log.info(open_msg)
self.send_bot(open_msg)
if position_2:
strategy.open_position(position_2)
self.pending_order_list.append(position_2)
open_msg = "Open 2/2 {} ORDER #{} for {}/{} at {}".format(
position_2.side,
position_2.order_id, position_2.instrument,
position_2.open_price,
position_2.open_time)
log.info(open_msg)
self.send_bot(open_msg)
if position_1 and position_2:
return True
else:
position = self.broker.open_order(
instrument=strategy.instrument,
units=units,
side=side,
order_type=order_type,
price=price,
expiry=expiry,
stop_loss=stoploss_price,
take_profit=takeprofit_price,
)
if position:
strategy.open_position(position)
self.pending_order_list.append(position)
open_msg = "Open {} ORDER #{} for {}/{} at {}".format(
position.side,
position.order_id, position.instrument,
position.open_price,
position.open_time)
log.info(open_msg)
self.send_bot(open_msg)
return True
return False
def close_trade(self, strategy, price=None):
pos_to_remove = []
for pos in strategy.positions:
# Pending orders
if pos in self.pending_order_list:
if self.broker.delete_pending_order(pos):
self.pending_order_list.remove(pos)
# Active transaction
elif pos in self.position_list:
# Hack to make backtests work, will get overwritten by real broker
if price:
pos.close_price = assert_decimal(price)
ret = self.broker.close_trade(pos)
if ret:
pos.close()
close_msg = "Close TRADE #{} for {}/{} at {} [PROFIT: {}/Total: {}]".format(
pos.transaction_id, pos.instrument,
pos.close_price, pos.close_time,
pos.profit_cash, self.get_overall_profit())
log.info(close_msg)
self.send_bot(close_msg)
self.write_to_csv(pos)
pos_to_remove.append(pos)
else:
pos_to_remove.append(pos)
# raise ValueError("Critical error: Position was not "
# "registered with application.")
for pos in pos_to_remove:
strategy.close_position(pos)
return True
def run_operations(self, operations, strategies):
# TODO: Add risk management/operations consolidation here
# Limit by % of the whole portfolio when buying/selling
# Per instrument only one open position
# handling exit signals
# TODO: Check if there is a buy/sell, then ignore
# TODO: Run open()'s first, then update_transactions(), then close()'s
for ops in itertools.chain(*operations):
ops(self)
self.update_transactions(strategies)
def update_transactions(self, strategies):
# TODO Here we should check all orders and transactions
for pos in self.pending_order_list:
ret = self.broker.sync_transactions(pos)
if ret == 'PENDING':
continue
elif ret == 'CONFIRMED':
self.pending_order_list.remove(pos)
self.position_list.append(pos)
elif ret == 'NOTFOUND':
# TODO This can be done in a more elegant way
self.pending_order_list.remove(pos)
for s in strategies:
for p in s.positions:
if pos == p:
s.close_position(pos)
break
return True
def write_to_csv(self, position):
add_headings = not os.path.isfile(self.csv_out_file)
with open(self.csv_out_file, 'at') as fh:
items = OrderedDict(
open_time=position.open_time,
close_time=position.close_time,
instrument=position.instrument,
side=position.side,
open_price=position.open_price,
close_price=position.close_price,
profit_cash=position.profit_cash,
profit_pips=position.profit_pips,
max_profit_pips=position.max_profit_pips,
max_loss_pips=position.max_loss_pips,
)
writer = csv.writer(fh)
if add_headings:
writer.writerow(items.keys())
writer.writerow(items.values())
def get_overall_profit(self):
total_profit = 0
for pos in self.position_list:
profit = getattr(pos, 'profit_cash')
if profit:
total_profit += profit
return total_profit
def calculate_position_size(self, instrument):
# Based on http://fxtrade.oanda.com/analysis/margin-calculator
margin = settings.DEFAULT_POSITION_MARGIN
margin_ratio = 50
home_currency = 'CHF'
base_currency = instrument.from_curr
currency_switch_dict = {
'JP225_CHF': 12500,
'DE30_CHF': 10000,
'AUD_CHF': 0.68,
'BCO_CHF': 38.46,
'NZD_CHF': 0.61101,
'XAU_CHF': 1063.82,
'CHF_CHF': 1, # Meh
'GBP_CHF': 1.4749,
'USD_CHF': 0.93586,
'EUR_CHF': 1.08053,
'XAG_CHF': 13.736,
'HK33_CHF': 2631.57,
'UK100_CHF': 8333,
}
# (margin * leverage) / base = units
currency_pair = "{}_{}".format(base_currency, home_currency)
base_home_price = currency_switch_dict.get(currency_pair, None)
position_size = 10
if base_home_price:
position_size = int((margin * margin_ratio / (base_home_price)))
multiplier_dict = {
'EUR_USD' : 2,
'EUR_GBP' : 2,
'GBP_USD' : 2,
'NZD_JPY' : 2,
'USD_JPY' : 2,
'GBP_CHF' : 2,
'USD_CHF' : 2,
'USD_CAD' : 2,
'EUR_CHF' : 2,
}
position_size = position_size * multiplier_dict.get(currency_pair, 1)
return position_size
def calculate_stop_loss(self, instrument, side):
stop_loss_dict = {
'XAG_USD': 350,
'EUR_USD': 20,
'UK100_GBP': 9,
'NZD_JPY': 15,
'BCO_USD': 40,
'AUD_USD': 9,
'DE30_EUR': 40,
'HK33_USD': 70,
'USD_JPY': 20,
'XAU_USD': 300,
}
stop_loss_pips = float(stop_loss_dict.get(str(instrument), 20))
price = self.broker.get_price(instrument)
if price:
if side == 'buy':
return Decimal(price['bid']) - Decimal(
(stop_loss_pips * float(str(instrument.pip))))
return Decimal(price['ask']) + Decimal(
(stop_loss_pips * float(str(instrument.pip))))
return None
def calculate_take_profit(self, instrument, side):
take_profit_dict = {
'AUD_USD': 27,
'AUD_JPY': 8,
'EUR_CHF': 10,
'EUR_USD': 12,
'EUR_GBP': 12,
'GBP_CHF': 12,
'GBP_USD': 15,
'NZD_JPY': 8,
'USD_CAD': 12,
'USD_CHF': 15,
'USD_JPY': 8,
'BCO_USD': 25,
'DE30_EUR': 20,
'HK33_HKD': 9,
'JP225_USD': 25,
'UK100_GBP': 20,
'XAG_USD': 340,
'XAU_USD': 400,
}
take_profit_pips = float(take_profit_dict.get(str(instrument), 20))
price = self.broker.get_price(instrument)
if price:
if side == 'buy':
return Decimal(price['ask']) + Decimal(
(take_profit_pips * float(str(instrument.pip))))
return Decimal(price['bid']) - Decimal(
(take_profit_pips * float(str(instrument.pip))))
return None
class Position(object):
def __init__(self, side, instrument, open_price, open_time,
order_id, order_type, stop_loss=None, home_currency='CHF'):
self.side = side
self.instrument = instrument
self.open_price = assert_decimal(open_price)
self.open_time = open_time
self.order_id = order_id
self.order_type = order_type
if stop_loss:
self.stop_loss = assert_decimal(stop_loss)
self.home_currency = home_currency
self.is_open = True
self.profit_pips = None
self.profit_cash = None
self.transaction_id = None
self.close_price = None
self.close_time = None
self.max_profit = open_price
self.max_loss = open_price
# TODO If required, add order_type, stop_loss, expiry_date
def close(self):
self.is_open = False
def set_profit_loss(self, price):
# Min = Max Drawdown for StopLoss
# Max = Max Profit
# Both are initialised with the opening price
if self.side == 'buy':
if self.max_profit < Decimal(str(price.highBid)):
self.max_profit = Decimal(str(price.highBid))
if self.max_loss > Decimal(str(price.lowAsk)):
self.max_loss = Decimal(str(price.lowAsk))
else:
if self.max_profit > Decimal(str(price.lowBid)):
self.max_profit = Decimal(str(price.lowBid))
if self.max_loss < Decimal(str(price.highAsk)):
self.max_loss = Decimal(str(price.highAsk))
self.max_profit_pips = round(abs(
float(float(self.max_profit) - float(self.open_price)) / float(
str((self.instrument.pip)))), 1)
self.max_loss_pips = round(abs(
float(float(self.open_price) - float(self.max_loss)) / float(
str((self.instrument.pip)))), 1)
def __str__(self):
return "{} at {} [{}]".format(self.instrument, self.open_price,
self.open_time)
| mit |
bdcht/amoco | amoco/system/linux64/x64.py | 1 | 6623 | # -*- coding: utf-8 -*-
# This code is part of Amoco
# Copyright (C) 2006-2011 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
from amoco.system.elf import *
from amoco.system.core import CoreExec, DefineStub
from amoco.code import tag
import amoco.arch.x64.cpu_x64 as cpu
# AMD 64 specific definitions. #x86_64 relocs.
with Consts("r_type"):
R_X86_64_PLTOFF64 = 0x1F
R_X86_64_GOTPCREL64 = 0x1C
R_X86_64_GOTOFF64 = 0x19
R_X86_64_TPOFF64 = 0x12
R_X86_64_GOT32 = 0x3
R_X86_64_32 = 0xA
R_X86_64_DTPOFF64 = 0x11
R_X86_64_PC32 = 0x2
R_X86_64_16 = 0xC
R_X86_64_32S = 0xB
R_X86_64_TPOFF32 = 0x17
R_X86_64_64 = 0x1
R_X86_64_GOTPCREL = 0x9
R_X86_64_TLSDESC = 0x24
R_X86_64_TLSGD = 0x13
R_X86_64_GOTPC32 = 0x1A
R_X86_64_PC8 = 0xF
R_X86_64_DTPOFF32 = 0x15
R_X86_64_PLT32 = 0x4
R_X86_64_8 = 0xE
R_X86_64_GOTPC32_TLSDESC = 0x22
R_X86_64_IRELATIVE = 0x25
R_X86_64_PC16 = 0xD
R_X86_64_COPY = 0x5
R_X86_64_GLOB_DAT = 0x6
R_X86_64_GOT64 = 0x1B
R_X86_64_SIZE32 = 0x20
R_X86_64_TLSLD = 0x14
R_X86_64_JUMP_SLOT = 0x7
R_X86_64_TLSDESC_CALL = 0x23
R_X86_64_GOTTPOFF = 0x16
R_X86_64_NUM = 0x27
R_X86_64_SIZE64 = 0x21
R_X86_64_GOTPC64 = 0x1D
R_X86_64_PC64 = 0x18
R_X86_64_RELATIVE64 = 0x26
R_X86_64_RELATIVE = 0x8
R_X86_64_NONE = 0x0
R_X86_64_DTPMOD64 = 0x10
R_X86_64_GOTPLT64 = 0x1E
# ------------------------------------------------------------------------------
class OS(object):
"""OS class is a provider for all the environment in which a Task runs.
It is responsible for setting up the (virtual) memory of the Task as well
as providing stubs for dynamic library calls and possibly system calls.
In the specific case of linux64.x64, the OS class will stub all libc
functions including a simulated heap memory allocator API.
"""
stubs = {}
default_stub = DefineStub.warning
def __init__(self, conf=None):
if conf is None:
from amoco.config import System
conf = System()
self.PAGESIZE = conf.pagesize
self.ASLR = conf.aslr
self.NX = conf.nx
self.tasks = []
self.abi = None
self.symbols = {}
@classmethod
def loader(cls, bprm, conf=None):
return cls(conf).load_elf_binary(bprm)
def load_elf_binary(self, bprm):
"load the program into virtual memory (populate the mmap dict)"
p = Task(bprm, cpu)
p.OS = self
# create text and data segments according to elf header:
for s in bprm.Phdr:
if s.p_type == PT_INTERP:
interp = bprm.readsegment(s).strip(b"\0")
elif s.p_type == PT_LOAD:
ms = bprm.loadsegment(s, self.PAGESIZE)
if ms != None:
vaddr, data = ms.popitem()
p.state.mmap.write(vaddr, data)
elif s.p_type == PT_GNU_STACK:
# executable_stack = s.p_flags & PF_X
pass
# init task state:
p.state[cpu.rip] = cpu.cst(p.bin.entrypoints[0], 64)
p.state[cpu.rbp] = cpu.cst(0, 64)
p.state[cpu.rax] = cpu.cst(0, 64)
p.state[cpu.rbx] = cpu.cst(0, 64)
p.state[cpu.rcx] = cpu.cst(0, 64)
p.state[cpu.rdx] = cpu.cst(0, 64)
p.state[cpu.rsi] = cpu.cst(0, 64)
p.state[cpu.rdi] = cpu.cst(0, 64)
p.state[cpu.r8] = cpu.cst(0, 64)
p.state[cpu.r9] = cpu.cst(0, 64)
p.state[cpu.r10] = cpu.cst(0, 64)
p.state[cpu.r11] = cpu.cst(0, 64)
p.state[cpu.r12] = cpu.cst(0, 64)
p.state[cpu.r13] = cpu.cst(0, 64)
p.state[cpu.r14] = cpu.cst(0, 64)
p.state[cpu.r15] = cpu.cst(0, 64)
p.state[cpu.rflags] = cpu.cst(0, 64)
# create the stack space:
if self.ASLR:
p.state.mmap.newzone(p.cpu.rsp)
else:
stack_base = 0x00007FFFFFFFFFFF & ~(self.PAGESIZE - 1)
stack_size = 2 * self.PAGESIZE
p.state.mmap.write(stack_base - stack_size, b"\0" * stack_size)
p.state[cpu.rsp] = cpu.cst(stack_base, 64)
# create the dynamic segments:
if bprm.dynamic and interp:
self.load_elf_interp(p, interp)
# return task:
self.tasks.append(p)
return p
def load_elf_interp(self, p, interp):
for k, f in p.bin._Elf__dynamic(None).items():
xf = cpu.ext(f, size=64, task=p)
xf.stub = self.stub(xf.ref)
p.state.mmap.write(k, xf)
# we want to add .plt addresses as symbols as well
# to improve asm block views:
plt = got = None
for s in p.bin.Shdr:
if s.name=='.plt':
plt = s
elif s.name=='.got':
got = s
if plt and got:
address = plt.sh_addr
pltco = p.bin.readsection(plt)
while(pltco):
i = p.cpu.disassemble(pltco)
if i.mnemonic=='JMP' and i.operands[0]._is_mem:
target = i.operands[0].a
if target.base is p.cpu.rip:
target = address+target.disp
elif target.base._is_reg:
target = got.sh_addr+target.disp
elif target.base._is_cst:
target = target.base.value+target.disp
if target in p.bin.functions:
p.bin.functions[address] = p.bin.functions[target]
pltco = pltco[i.length:]
address += i.length
def stub(self, refname):
return self.stubs.get(refname, self.default_stub)
class Task(CoreExec):
pass
# ----------------------------------------------------------------------------
@DefineStub(OS, "*", default=True)
def pop_rip(m, **kargs):
cpu.pop(m, cpu.rip)
@DefineStub(OS, "__libc_start_main")
def libc_start_main(m, **kargs):
"tags: func_call"
m[cpu.rip] = m(cpu.rdi)
cpu.push(m, cpu.ext("exit", size=64))
@DefineStub(OS, "exit")
def libc_exit(m, **kargs):
m[cpu.rip] = top(64)
@DefineStub(OS, "abort")
def libc_abort(m, **kargs):
m[cpu.rip] = top(64)
@DefineStub(OS, "__assert")
def libc_assert(m, **kargs):
m[cpu.rip] = top(64)
@DefineStub(OS, "__assert_fail")
def libc_assert_fail(m, **kargs):
m[cpu.rip] = top(64)
@DefineStub(OS, "_assert_perror_fail")
def _assert_perror_fail(m, **kargs):
m[cpu.rip] = top(64)
# ----------------------------------------------------------------------------
| gpl-2.0 |
miing/mci_migo | identityprovider/context_processors.py | 1 | 2393 | # -*- coding: utf-8 -*-
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""
Request processors return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
import datetime
from django.conf import settings
from django.core import context_processors
import identityprovider.signed as signed
from identityprovider.utils import get_current_brand
def readonly(request):
return {'readonly': settings.READ_ONLY_MODE}
def i18n(request):
supported = [(x, settings.LANGUAGE_NAMES[x])
for x in settings.SUPPORTED_LANGUAGES]
return {'supported_languages': supported}
def detect_embedded(request):
"""Determine if this request should be rendered using the embedded theme.
For now, just check if this request is associated to a particular
trust root.
"""
embedded_trust_root = getattr(settings, 'EMBEDDED_TRUST_ROOT', 'invalid')
trust_root = None
token = getattr(request, 'token', None)
if token is not None:
try:
raw_orequest = request.session.get(token, None)
orequest = signed.loads(raw_orequest, settings.SECRET_KEY)
trust_root = orequest.trust_root
except:
pass
result = {'embedded': embedded_trust_root == trust_root}
return result
def google_analytics_id(request):
"""Adds the google analytics id to the context if it's present."""
return {
'google_analytics_id': getattr(settings, 'GOOGLE_ANALYTICS_ID', None),
}
def current_date(request):
return {'current_date': datetime.datetime.utcnow()}
def debug(request):
# override the core processor to avoid depending on the request
try:
context_extras = context_processors.debug(request)
except AttributeError:
context_extras = {}
return context_extras
def branding(request=None):
brand = get_current_brand()
return {
'brand': brand,
'brand_description': settings.BRAND_DESCRIPTIONS.get(brand, ''),
}
def combine(request):
return {
'combine': settings.COMBINE,
'combo_url': settings.COMBO_URL,
}
| agpl-3.0 |
pentestfail/TA-FireEye_TAP | bin/ta_fireeye_tap/solnlib/packages/requests/packages/chardet/langhungarianmodel.py | 2763 | 12536 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mark Pilgrim - port to Python
#
# This library 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; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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 GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
######################### END LICENSE BLOCK #########################
# 255: Control characters that usually does not exist in any text
# 254: Carriage/Return
# 253: symbol (punctuation) that does not belong to word
# 252: 0 - 9
# Character Mapping Table:
Latin2_HungarianCharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47,
46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253,
253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8,
23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253,
159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,
175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,
191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205,
79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,
221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231,
232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241,
82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85,
245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253,
)
win1250HungarianCharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47,
46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253,
253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8,
23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253,
161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,
177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190,
191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205,
81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,
221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231,
232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241,
84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87,
245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253,
)
# Model Table:
# total sequences: 100%
# first 512 sequences: 94.7368%
# first 1024 sequences:5.2623%
# rest sequences: 0.8894%
# negative sequences: 0.0009%
HungarianLangModel = (
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2,
3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,1,2,3,3,3,3,2,3,3,1,1,3,3,0,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,
3,2,1,3,3,3,3,3,2,3,3,3,3,3,1,1,2,3,3,3,3,3,3,3,1,1,3,2,0,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
3,3,3,3,3,3,3,3,3,3,3,1,1,2,3,3,3,1,3,3,3,3,3,1,3,3,2,2,0,3,2,3,
0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,
3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,3,3,2,3,3,2,2,3,2,3,2,0,3,2,2,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,1,2,3,2,2,3,1,2,3,3,2,2,0,3,3,3,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,0,2,3,2,
0,0,0,1,1,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,2,1,3,2,2,3,2,1,3,2,2,1,0,3,3,1,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,2,2,3,3,3,3,3,1,2,3,3,3,3,1,2,1,3,3,3,3,2,2,3,1,1,3,2,0,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,2,1,3,3,3,3,3,2,2,1,3,3,3,0,1,1,2,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,2,0,3,2,3,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,
3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,3,1,3,2,2,2,3,1,1,3,3,1,1,0,3,3,2,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,3,2,3,3,3,3,3,1,2,3,2,2,0,2,2,2,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,2,2,2,3,1,3,3,2,2,1,3,3,3,1,1,3,1,2,3,2,3,2,2,2,1,0,2,2,2,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,
3,1,1,3,3,3,3,3,1,2,3,3,3,3,1,2,1,3,3,3,2,2,3,2,1,0,3,2,0,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,1,1,3,3,3,3,3,1,2,3,3,3,3,1,1,0,3,3,3,3,0,2,3,0,0,2,1,0,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,2,2,3,3,2,2,2,2,3,3,0,1,2,3,2,3,2,2,3,2,1,2,0,2,2,2,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,
3,3,3,3,3,3,1,2,3,3,3,2,1,2,3,3,2,2,2,3,2,3,3,1,3,3,1,1,0,2,3,2,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,1,2,2,2,2,3,3,3,1,1,1,3,3,1,1,3,1,1,3,2,1,2,3,1,1,0,2,2,2,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,2,1,2,1,1,3,3,1,1,1,1,3,3,1,1,2,2,1,2,1,1,2,2,1,1,0,2,2,1,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,1,1,2,1,1,3,3,1,0,1,1,3,3,2,0,1,1,2,3,1,0,2,2,1,0,0,1,3,2,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,2,1,3,3,3,3,3,1,2,3,2,3,3,2,1,1,3,2,3,2,1,2,2,0,1,2,1,0,0,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
3,3,3,3,2,2,2,2,3,1,2,2,1,1,3,3,0,3,2,1,2,3,2,1,3,3,1,1,0,2,1,3,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,3,3,2,2,2,3,2,3,3,3,2,1,1,3,3,1,1,1,2,2,3,2,3,2,2,2,1,0,2,2,1,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
1,0,0,3,3,3,3,3,0,0,3,3,2,3,0,0,0,2,3,3,1,0,1,2,0,0,1,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,1,2,3,3,3,3,3,1,2,3,3,2,2,1,1,0,3,3,2,2,1,2,2,1,0,2,2,0,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,3,2,2,1,3,1,2,3,3,2,2,1,1,2,2,1,1,1,1,3,2,1,1,1,1,2,1,0,1,2,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
2,3,3,1,1,1,1,1,3,3,3,0,1,1,3,3,1,1,1,1,1,2,2,0,3,1,1,2,0,2,1,1,
0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
3,1,0,1,2,1,2,2,0,1,2,3,1,2,0,0,0,2,1,1,1,1,1,2,0,0,1,1,0,0,0,0,
1,2,1,2,2,2,1,2,1,2,0,2,0,2,2,1,1,2,1,1,2,1,1,1,0,1,0,0,0,1,1,0,
1,1,1,2,3,2,3,3,0,1,2,2,3,1,0,1,0,2,1,2,2,0,1,1,0,0,1,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,3,3,2,2,1,0,0,3,2,3,2,0,0,0,1,1,3,0,0,1,1,0,0,2,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,1,1,2,2,3,3,1,0,1,3,2,3,1,1,1,0,1,1,1,1,1,3,1,0,0,2,2,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,1,1,1,2,2,2,1,0,1,2,3,3,2,0,0,0,2,1,1,1,2,1,1,1,0,1,1,1,0,0,0,
1,2,2,2,2,2,1,1,1,2,0,2,1,1,1,1,1,2,1,1,1,1,1,1,0,1,1,1,0,0,1,1,
3,2,2,1,0,0,1,1,2,2,0,3,0,1,2,1,1,0,0,1,1,1,0,1,1,1,1,0,2,1,1,1,
2,2,1,1,1,2,1,2,1,1,1,1,1,1,1,2,1,1,1,2,3,1,1,1,1,1,1,1,1,1,0,1,
2,3,3,0,1,0,0,0,3,3,1,0,0,1,2,2,1,0,0,0,0,2,0,0,1,1,1,0,2,1,1,1,
2,1,1,1,1,1,1,2,1,1,0,1,1,0,1,1,1,0,1,2,1,1,0,1,1,1,1,1,1,1,0,1,
2,3,3,0,1,0,0,0,2,2,0,0,0,0,1,2,2,0,0,0,0,1,0,0,1,1,0,0,2,0,1,0,
2,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,0,1,1,1,1,1,0,1,
3,2,2,0,1,0,1,0,2,3,2,0,0,1,2,2,1,0,0,1,1,1,0,0,2,1,0,1,2,2,1,1,
2,1,1,1,1,1,1,2,1,1,1,1,1,1,0,2,1,0,1,1,0,1,1,1,0,1,1,2,1,1,0,1,
2,2,2,0,0,1,0,0,2,2,1,1,0,0,2,1,1,0,0,0,1,2,0,0,2,1,0,0,2,1,1,1,
2,1,1,1,1,2,1,2,1,1,1,2,2,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,
1,2,3,0,0,0,1,0,3,2,1,0,0,1,2,1,1,0,0,0,0,2,1,0,1,1,0,0,2,1,2,1,
1,1,0,0,0,1,0,1,1,1,1,1,2,0,0,1,0,0,0,2,0,0,1,1,1,1,1,1,1,1,0,1,
3,0,0,2,1,2,2,1,0,0,2,1,2,2,0,0,0,2,1,1,1,0,1,1,0,0,1,1,2,0,0,0,
1,2,1,2,2,1,1,2,1,2,0,1,1,1,1,1,1,1,1,1,2,1,1,0,0,1,1,1,1,0,0,1,
1,3,2,0,0,0,1,0,2,2,2,0,0,0,2,2,1,0,0,0,0,3,1,1,1,1,0,0,2,1,1,1,
2,1,0,1,1,1,0,1,1,1,1,1,1,1,0,2,1,0,0,1,0,1,1,0,1,1,1,1,1,1,0,1,
2,3,2,0,0,0,1,0,2,2,0,0,0,0,2,1,1,0,0,0,0,2,1,0,1,1,0,0,2,1,1,0,
2,1,1,1,1,2,1,2,1,2,0,1,1,1,0,2,1,1,1,2,1,1,1,1,0,1,1,1,1,1,0,1,
3,1,1,2,2,2,3,2,1,1,2,2,1,1,0,1,0,2,2,1,1,1,1,1,0,0,1,1,0,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,2,2,0,0,0,0,0,2,2,0,0,0,0,2,2,1,0,0,0,1,1,0,0,1,2,0,0,2,1,1,1,
2,2,1,1,1,2,1,2,1,1,0,1,1,1,1,2,1,1,1,2,1,1,1,1,0,1,2,1,1,1,0,1,
1,0,0,1,2,3,2,1,0,0,2,0,1,1,0,0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,
1,2,1,2,1,2,1,1,1,2,0,2,1,1,1,0,1,2,0,0,1,1,1,0,0,0,0,0,0,0,0,0,
2,3,2,0,0,0,0,0,1,1,2,1,0,0,1,1,1,0,0,0,0,2,0,0,1,1,0,0,2,1,1,1,
2,1,1,1,1,1,1,2,1,0,1,1,1,1,0,2,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,
1,2,2,0,1,1,1,0,2,2,2,0,0,0,3,2,1,0,0,0,1,1,0,0,1,1,0,1,1,1,0,0,
1,1,0,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,0,0,1,1,1,0,1,0,1,
2,1,0,2,1,1,2,2,1,1,2,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,0,0,0,
1,2,2,2,2,2,1,1,1,2,0,2,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,1,0,
1,2,3,0,0,0,1,0,2,2,0,0,0,0,2,2,0,0,0,0,0,1,0,0,1,0,0,0,2,0,1,0,
2,1,1,1,1,1,0,2,0,0,0,1,2,1,1,1,1,0,1,2,0,1,0,1,0,1,1,1,0,1,0,1,
2,2,2,0,0,0,1,0,2,1,2,0,0,0,1,1,2,0,0,0,0,1,0,0,1,1,0,0,2,1,0,1,
2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,1,1,1,1,1,0,1,
1,2,2,0,0,0,1,0,2,2,2,0,0,0,1,1,0,0,0,0,0,1,1,0,2,0,0,1,1,1,0,1,
1,0,1,1,1,1,1,1,0,1,1,1,1,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,0,0,1,
1,0,0,1,0,1,2,1,0,0,1,1,1,2,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,0,
0,2,1,2,1,1,1,1,1,2,0,2,0,1,1,0,1,2,1,0,1,1,1,0,0,0,0,0,0,1,0,0,
2,1,1,0,1,2,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,1,
2,2,1,1,1,1,1,2,1,1,0,1,1,1,1,2,1,1,1,2,1,1,0,1,0,1,1,1,1,1,0,1,
1,2,2,0,0,0,0,0,1,1,0,0,0,0,2,1,0,0,0,0,0,2,0,0,2,2,0,0,2,0,0,1,
2,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,
1,1,2,0,0,3,1,0,2,1,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0,
1,2,1,0,1,1,1,2,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,1,0,0,0,1,0,0,
2,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,2,0,0,0,
2,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,2,1,1,0,0,1,1,1,1,1,0,1,
2,1,1,1,2,1,1,1,0,1,1,2,1,0,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,1,1,1,1,1,0,0,1,1,2,1,0,0,0,1,1,0,0,0,1,1,0,0,1,0,1,0,0,0,
1,2,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,
2,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,2,0,0,1,0,0,1,0,1,0,0,0,
0,1,1,1,1,1,1,1,1,2,0,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,
1,0,0,1,1,1,1,1,0,0,2,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,
0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,
1,0,0,1,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,
0,1,1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,
0,0,0,1,0,0,0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,
2,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,
)
Latin2HungarianModel = {
'charToOrderMap': Latin2_HungarianCharToOrderMap,
'precedenceMatrix': HungarianLangModel,
'mTypicalPositiveRatio': 0.947368,
'keepEnglishLetter': True,
'charsetName': "ISO-8859-2"
}
Win1250HungarianModel = {
'charToOrderMap': win1250HungarianCharToOrderMap,
'precedenceMatrix': HungarianLangModel,
'mTypicalPositiveRatio': 0.947368,
'keepEnglishLetter': True,
'charsetName': "windows-1250"
}
# flake8: noqa
| mit |
MihaiMoldovanu/ansible | lib/ansible/modules/cloud/openstack/os_floating_ip.py | 7 | 9679 | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Author: Davide Guerri <davide.guerri@hp.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: os_floating_ip
version_added: "2.0"
author: "Davide Guerri <davide.guerri@hp.com>"
short_description: Add/Remove floating IP from an instance
extends_documentation_fragment: openstack
description:
- Add or Remove a floating IP to an instance
options:
server:
description:
- The name or ID of the instance to which the IP address
should be assigned.
required: true
network:
description:
- The name or ID of a neutron external network or a nova pool name.
required: false
floating_ip_address:
description:
- A floating IP address to attach or to detach. Required only if I(state)
is absent. When I(state) is present can be used to specify a IP address
to attach.
required: false
reuse:
description:
- When I(state) is present, and I(floating_ip_address) is not present,
this parameter can be used to specify whether we should try to reuse
a floating IP address already allocated to the project.
required: false
default: false
fixed_address:
description:
- To which fixed IP of server the floating IP address should be
attached to.
required: false
nat_destination:
description:
- The name or id of a neutron private network that the fixed IP to
attach floating IP is on
required: false
default: None
aliases: ["fixed_network", "internal_network"]
version_added: "2.3"
wait:
description:
- When attaching a floating IP address, specify whether we should
wait for it to appear as attached.
required: false
default: false
timeout:
description:
- Time to wait for an IP address to appear as attached. See wait.
required: false
default: 60
state:
description:
- Should the resource be present or absent.
choices: [present, absent]
required: false
default: present
purge:
description:
- When I(state) is absent, indicates whether or not to delete the floating
IP completely, or only detach it from the server. Default is to detach only.
required: false
default: false
version_added: "2.1"
availability_zone:
description:
- Ignored. Present for backwards compatibility
required: false
requirements: ["shade"]
'''
EXAMPLES = '''
# Assign a floating IP to the fist interface of `cattle001` from an exiting
# external network or nova pool. A new floating IP from the first available
# external network is allocated to the project.
- os_floating_ip:
cloud: dguerri
server: cattle001
# Assign a new floating IP to the instance fixed ip `192.0.2.3` of
# `cattle001`. If a free floating IP is already allocated to the project, it is
# reused; if not, a new one is created.
- os_floating_ip:
cloud: dguerri
state: present
reuse: yes
server: cattle001
network: ext_net
fixed_address: 192.0.2.3
wait: true
timeout: 180
# Assign a new floating IP from the network `ext_net` to the instance fixed
# ip in network `private_net` of `cattle001`.
- os_floating_ip:
cloud: dguerri
state: present
server: cattle001
network: ext_net
nat_destination: private_net
wait: true
timeout: 180
# Detach a floating IP address from a server
- os_floating_ip:
cloud: dguerri
state: absent
floating_ip_address: 203.0.113.2
server: cattle001
'''
from distutils.version import StrictVersion
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
from ansible.module_utils.basic import AnsibleModule, remove_values
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
def _get_floating_ip(cloud, floating_ip_address):
f_ips = cloud.search_floating_ips(
filters={'floating_ip_address': floating_ip_address})
if not f_ips:
return None
return f_ips[0]
def main():
argument_spec = openstack_full_argument_spec(
server=dict(required=True),
state=dict(default='present', choices=['absent', 'present']),
network=dict(required=False, default=None),
floating_ip_address=dict(required=False, default=None),
reuse=dict(required=False, type='bool', default=False),
fixed_address=dict(required=False, default=None),
nat_destination=dict(required=False, default=None,
aliases=['fixed_network', 'internal_network']),
wait=dict(required=False, type='bool', default=False),
timeout=dict(required=False, type='int', default=60),
purge=dict(required=False, type='bool', default=False),
)
module_kwargs = openstack_module_kwargs()
module = AnsibleModule(argument_spec, **module_kwargs)
if not HAS_SHADE:
module.fail_json(msg='shade is required for this module')
if (module.params['nat_destination'] and
StrictVersion(shade.__version__) < StrictVersion('1.8.0')):
module.fail_json(msg="To utilize nat_destination, the installed version of"
"the shade library MUST be >= 1.8.0")
server_name_or_id = module.params['server']
state = module.params['state']
network = module.params['network']
floating_ip_address = module.params['floating_ip_address']
reuse = module.params['reuse']
fixed_address = module.params['fixed_address']
nat_destination = module.params['nat_destination']
wait = module.params['wait']
timeout = module.params['timeout']
purge = module.params['purge']
cloud = shade.openstack_cloud(**module.params)
try:
server = cloud.get_server(server_name_or_id)
if server is None:
module.fail_json(
msg="server {0} not found".format(server_name_or_id))
if state == 'present':
# If f_ip already assigned to server, check that it matches
# requirements.
public_ip = cloud.get_server_public_ip(server)
f_ip = _get_floating_ip(cloud, public_ip) if public_ip else public_ip
if f_ip:
if network:
network_id = cloud.get_network(name_or_id=network)["id"]
else:
network_id = None
if all([(fixed_address and f_ip.fixed_ip_address == fixed_address) or
(nat_destination and f_ip.internal_network == fixed_address),
network, f_ip.network != network_id]):
# Current state definitely conflicts with requirements
module.fail_json(msg="server {server} already has a "
"floating-ip on requested "
"interface but it doesn't match "
"requested network {network}: {fip}"
.format(server=server_name_or_id,
network=network,
fip=remove_values(f_ip,
module.no_log_values)))
if not network or f_ip.network == network_id:
# Requirements are met
module.exit_json(changed=False, floating_ip=f_ip)
# Requirements are vague enough to ignore existing f_ip and try
# to create a new f_ip to the server.
server = cloud.add_ips_to_server(
server=server, ips=floating_ip_address, ip_pool=network,
reuse=reuse, fixed_address=fixed_address, wait=wait,
timeout=timeout, nat_destination=nat_destination)
fip_address = cloud.get_server_public_ip(server)
# Update the floating IP status
f_ip = _get_floating_ip(cloud, fip_address)
module.exit_json(changed=True, floating_ip=f_ip)
elif state == 'absent':
if floating_ip_address is None:
if not server_name_or_id:
module.fail_json(msg="either server or floating_ip_address are required")
server = cloud.get_server(server_name_or_id)
floating_ip_address = cloud.get_server_public_ip(server)
f_ip = _get_floating_ip(cloud, floating_ip_address)
if not f_ip:
# Nothing to detach
module.exit_json(changed=False)
changed = False
if f_ip["fixed_ip_address"]:
cloud.detach_ip_from_server(
server_id=server['id'], floating_ip_id=f_ip['id'])
# Update the floating IP status
f_ip = cloud.get_floating_ip(id=f_ip['id'])
changed = True
if purge:
cloud.delete_floating_ip(f_ip['id'])
module.exit_json(changed=True)
module.exit_json(changed=changed, floating_ip=f_ip)
except shade.OpenStackCloudException as e:
module.fail_json(msg=str(e), extra_data=e.extra_data)
if __name__ == '__main__':
main()
| gpl-3.0 |
glennhickey/hgvm-graph-bakeoff-evalutations | scripts/psl2maf.py | 6 | 35649 | #!/usr/bin/env python2.7
"""
psl2maf.py: Convert a series of PSLs to a single multiple alignment MAF, pulling
sequence from FASTA files. The PSLs must all be against the same reference
sequence, and the alignment to that reference is used to induce the multiple
alignment (i.e. nothing in the other sequences will align except as mediated by
alignment to the reference).
TODO: snake_case this file.
"""
import argparse, sys, os, os.path, random, subprocess, shutil, itertools
import doctest, logging, pprint
from Bio import SearchIO, AlignIO, SeqIO, Align
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
def parse_args(args):
"""
Takes in the command-line arguments list (args), and returns a nice argparse
result with fields for all the options.
Borrows heavily from the argparse documentation examples:
<http://docs.python.org/library/argparse.html>
"""
# Construct the parser (which is stored in parser)
# Module docstring lives in __doc__
# See http://python-forum.com/pythonforum/viewtopic.php?f=3&t=36847
# And a formatter class so our examples in the docstring look good. Isn't it
# convenient how we already wrapped it to 80 characters?
# See http://docs.python.org/library/argparse.html#formatter-class
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
# General options
parser.add_argument("--psls", nargs="+", required=True,
help="PSL file(s) to convert")
parser.add_argument("--maf", type=argparse.FileType("w"),
default=sys.stdout,
help="MAF file to save output to")
parser.add_argument("--fastas", nargs="+", required=True,
help=".fasta file(s) to obtain sequence from")
parser.add_argument("--referenceOffset", type=int, default=0,
help="offset all reference coordinates by the given amount")
parser.add_argument("--referenceSequence", type=str, default=None,
help="override reference sequence name with this one")
parser.add_argument("--noMismatch", action="store_true",
help="only align bases which match")
# The command line arguments start with the program name, which we don't
# want to treat as an argument for argparse. So we remove it.
args = args[1:]
return parser.parse_args(args)
def gapMismatches(alignment):
"""
Given an alignment (an MSA with just a reference and a query), replace any
mismatches with gaps in each sequence.
Return the processed alignment.
"""
# Make lists of characters that we will join into the new reference and
# query sequences.
gappedReference = []
gappedQuery = []
# How many mismatches did we gap?
mismatches_gapped = 0
# How many aligned bases did we check?
bases_checked = 0
# Where are we in the alignment?
for column in xrange(len(alignment[0])):
# Just go through all the columns in the alignment's reference.
# Pull out the reference and query characters at this position.
refChar = alignment[0, column]
queryChar = alignment[1, column]
bases_checked += 1
if "-" in [refChar, queryChar] or refChar == queryChar:
# We have a gap or a match. Pass it through to bioth sequences.
gappedReference.append(refChar)
gappedQuery.append(queryChar)
else:
# We have a mismatch. Gap one and then the other.
gappedReference.append("-")
gappedQuery.append(queryChar)
gappedReference.append(refChar)
gappedQuery.append("-")
mismatches_gapped += 1
# Now we need to manufacture the MultipleSeqAlignment to return from these
# lists of characters.
# What names do the sequences in this alignment have?
seqNames = [record.id for record in alignment]
# Make a SeqRecord for each list of properly gapped-out characters, with the
# appropriate name.
seqRecords = [SeqRecord(Seq("".join(alignedList)), name)
for alignedList, name in zip([gappedReference, gappedQuery], seqNames)]
for i in xrange(len(seqRecords)):
# Se tannotations on all the new records
seqRecords[i].annotations = alignment[i].annotations
if float(mismatches_gapped) / bases_checked > 0.5 and bases_checked > 100:
# If this gets too high, it means we have a bad offset somewhere. Yell
# at the user.
logging.warning("{}/{} bases gapped due to mismatch".format(
mismatches_gapped, bases_checked))
# Make the records into a proper MSA and return it.
return Align.MultipleSeqAlignment(seqRecords)
def tree_reduce(items, operator, default_value=None):
"""
Reduce the items in the given list using the given binary function. Unlike
the normal Python reduce, which reduces by a fold from the left, this reduce
reduces in a tree. This means that if the operation is, say, a list
concatenation, the reduction will be more efficient than if it were done in
a left to right order, as each input element will only be copied log(n)
times, instead of n for the leftmost element in a normal reduce.
If items is empty, the given default_value is returned.
"""
if len(items) == 0:
# Base case for an empty list
return None
elif len(items) == 1:
# Base case for a one-item list
return items[0]
else:
# We have two or more items (and will never have to deal with 0)
# Where is the middle? Do integer division.
middle = len(items) / 2
# Figure out the answers on the left and the right
left_answer = tree_reduce(items[0:middle], operator)
right_answer = tree_reduce(items[middle:], operator)
logging.info("Merging:")
logging.info(left_answer)
logging.info("And:")
logging.info(right_answer)
# Recurse down both sides, do the operator to combine them, and return.
to_return = operator(left_answer, right_answer)
logging.info("Yields:")
logging.info(to_return)
return to_return
def smart_adjoin(msa1, msa2, sequence_source):
"""
Given two Multiple Sequence Alignments (MSAs) on the same source sequences,
with correct annotations, concatenate them together, with the intervening
sequences unaligned.
Either MSA may be None, in which case the other is returned.
Requires a function that, when passed a sequence ID, returns the SeqRecord
for the full sequence.
Requires that there be a valid way to attach the two sequences together
(i.e. the same sequence doesn't run in different directions in the two
blocks).
Raises a RuntimeError if the two MSAs cannot be adjoined.
"""
if msa1 is None:
# Nothing plus something equals that thing.
return msa2
if msa2 is None:
# Nothing plus something equals that thing.
return msa1
logging.debug("Adjoining {}bp and {}bp reference alignments".format(
msa1[0].annotations["size"], msa2[0].annotations["size"]))
for seq1, seq2 in itertools.izip(msa1, msa2):
# Check all the sequences
if seq1.annotations["strand"] != seq2.annotations["strand"]:
# These alignments are to opposite reference strands and cannot be
# adjoined.
raise RuntimeError("Can't adjoin alignments on opposite strands")
if msa2[0].annotations["start"] < msa1[0].annotations["start"]:
# Whatever strand we're on for the first sequence, alignment 2 needs to
# happen first.
msa2, msa1 = msa1, msa2
# We're going to get the sequence needed to go from the end of MSA1 to the
# start of MSA2.
intervening_sequences = []
for seq1, seq2 in itertools.izip(msa1, msa2):
# For each pair of sequence pieces, we need the sequence from #1 to #2,
# on the appropriate strand.
# Where does the intervening sequence start along the strand in
# question? Remember MAF coordinates are 0-based.
intervening_start = seq1.annotations["start"] + seq1.annotations["size"]
# And where does it end? (1 past the end)
intervening_end = seq2.annotations["start"]
if intervening_end < intervening_start:
# We're always going up in strand-local coordinates.
raise RuntimeError("Sequence is trying to go backwards!")
if seq1.annotations["strand"] == -1:
# Convert to the correct strand.
intervening_start = seq1.annotations["srcSize"] - intervening_start
intervening_end = seq1.annotations["srcSize"] - intervening_end
intervening_start, intervening_end = (intervening_end,
intervening_start)
# Go get and clip out the intervening sequence.
intervening_sequence = sequence_source(seq1.id)[
intervening_start:intervening_end]
if seq1.annotations["strand"] == -1:
# Make sure it is on the correct strand
intervening_sequence = intervening_sequence.reverse_complement()
# Put the clipped-out, correctly-oriented unaligned sequence in the
# list.
intervening_sequences.append(intervening_sequence)
# We'll tack these additional alignments onto msa1
to_return = msa1
for i in xrange(len(intervening_sequences)):
# Now for each intervening sequence, I need an MSA consisting of that
# sequence in its correct row and gaps in all the other rows.
# Make all the rows for this bit of unaligned sequence, as SeqRecords.
alignment_rows = [SeqRecord(Seq("-" * len(intervening_sequences[i])))
if j != i else intervening_sequences[i]
for j in xrange(len(intervening_sequences))]
# Make them into an alignment and stick it on
to_return = to_return + Align.MultipleSeqAlignment(alignment_rows)
# Now stick on msa2
to_return = to_return + msa2
for i in xrange(len(to_return)):
# Do the annotations for each record in the alignment
# Set the ID
to_return[i].id = msa1[i].id
# Start with the annotations from msa1, so start is correct
to_return[i].annotations.update(msa1[i].annotations)
# Compute the actual sequence length that outght to be used here.
to_return[i].annotations["size"] = (msa2[i].annotations["start"] +
msa2[i].annotations["size"] - msa1[i].annotations["start"])
# Make sure size is correct correct.
assert(len(str(to_return[i].seq).replace("-","")) ==
to_return[i].annotations["size"])
# Give back the final adjoined alignment
return to_return
def reverse_msa(msa):
"""
Given a MultipleSeqAlignment with MAF annotations, reverse-complement it,
correcting the annotations.
>>> ref1 = SeqRecord(Seq("AT-ATATAT"), "first")
>>> ref1.annotations = {"strand": 1, "start": 0, "size": 8, "srcSize": 18}
>>> alt1 = SeqRecord(Seq("ATAATATAT"), "second")
>>> alt1.annotations = {"strand": -1, "start": 0, "size": 9, "srcSize": 9}
>>> msa1 = Align.MultipleSeqAlignment([ref1, alt1])
>>> rev = reverse_msa(msa1)
>>> print(msa1)
Alphabet() alignment with 2 rows and 9 columns
AT-ATATAT first
ATAATATAT second
>>> print(rev)
Alphabet() alignment with 2 rows and 9 columns
ATATAT-AT first
ATATATTAT second
>>> pprint.pprint(rev[0].annotations)
{'size': 8, 'srcSize': 18, 'start': 10, 'strand': -1}
>>> pprint.pprint(rev[1].annotations)
{'size': 9, 'srcSize': 9, 'start': 0, 'strand': 1}
>>> rev2 = reverse_msa(rev)
>>> print(rev2)
Alphabet() alignment with 2 rows and 9 columns
AT-ATATAT first
ATAATATAT second
>>> pprint.pprint(rev2[0].annotations)
{'size': 8, 'srcSize': 18, 'start': 0, 'strand': 1}
>>> pprint.pprint(rev2[1].annotations)
{'size': 9, 'srcSize': 9, 'start': 0, 'strand': -1}
"""
logging.debug("Reversing {}bp reference MSA".format(
msa[0].annotations["size"]))
# Make an alignment with all the sequences reversed.
to_return = Align.MultipleSeqAlignment((record.reverse_complement()
for record in msa))
for i in xrange(len(to_return)):
# Fix up the annotations on each sequence
# Start with the original annotations
to_return[i].annotations.update(msa[i].annotations)
# We need to flip the strand
to_return[i].annotations["strand"] = -msa[i].annotations["strand"]
# And count the start from the other end.
to_return[i].annotations["start"] = (msa[i].annotations["srcSize"] -
msa[i].annotations["start"] - msa[i].annotations["size"])
# Set the id
to_return[i].id = msa[i].id
# We finished it.
return to_return
def mergeMSAs(msa1, msa2, full_ref):
"""
Given two MultipleSeqAlignment objects sharing a first (reference) sequence,
merge them on the reference. Returns a MultipleSeqAlignment containing all
the sequences from each alignment, in the alignment induced by the shared
reference sequence.
Also needs access to the full reference SeqRecord in case it needs bases to
fill in a gap.
The first sequence may actually be only a subrange in either MSA, and either
MSA may be on either strand of it.
Either MSA may be None, in which case the other MSA is returned.
>>> ref = SeqRecord(Seq("ATATATATGCATATATAT"), "first")
>>> ref.annotations = {"strand": 1, "start": 0, "size": 18, "srcSize": 18}
>>> ref1 = SeqRecord(Seq("AT-ATATAT"), "first")
>>> ref1.annotations = {"strand": 1, "start": 0, "size": 8, "srcSize": 18}
>>> alt1 = SeqRecord(Seq("ATAATATAT"), "second")
>>> alt1.annotations = {"strand": -1, "start": 0, "size": 9, "srcSize": 9}
>>> ref2 = SeqRecord(Seq("ATATATAT--"), "first")
>>> ref2.annotations = {"strand": -1, "start": 0, "size": 8, "srcSize": 18}
>>> alt2 = SeqRecord(Seq("ATATGG--AT"), "third")
>>> alt2.annotations = {"strand": 1, "start": 0, "size": 8, "srcSize": 8}
>>> msa1 = Align.MultipleSeqAlignment([ref1, alt1])
>>> msa2 = Align.MultipleSeqAlignment([ref2, alt2])
>>> merged = mergeMSAs(msa1, msa2, ref)
>>> print(merged)
Alphabet() alignment with 3 rows and 21 columns
AT-ATATATGC--ATATATAT first
ATAATATAT------------ second
-----------AT--CCATAT third
>>> pprint.pprint(merged[0].annotations)
{'size': 18, 'srcSize': 18, 'start': 0, 'strand': 1}
>>> pprint.pprint(merged[1].annotations)
{'size': 9, 'srcSize': 9, 'start': 0, 'strand': -1}
>>> pprint.pprint(merged[2].annotations)
{'size': 8, 'srcSize': 8, 'start': 0, 'strand': -1}
>>> ref3 = SeqRecord(Seq("ATGCAT"), "first")
>>> ref3.annotations = {"strand": 1, "start": 6, "size": 6, "srcSize": 18}
>>> alt3 = SeqRecord(Seq("ATCCAT"), "fourth")
>>> alt3.annotations = {"strand": 1, "start": 5, "size": 6, "srcSize": 15}
>>> msa3 = Align.MultipleSeqAlignment([ref3, alt3])
>>> merged2 = mergeMSAs(merged, msa3, ref)
>>> print(merged2)
Alphabet() alignment with 4 rows and 21 columns
AT-ATATATGC--ATATATAT first
ATAATATAT------------ second
-----------AT--CCATAT third
-------ATCC--AT------ fourth
>>> pprint.pprint(merged2[0].annotations)
{'size': 18, 'srcSize': 18, 'start': 0, 'strand': 1}
>>> pprint.pprint(merged2[1].annotations)
{'size': 9, 'srcSize': 9, 'start': 0, 'strand': -1}
>>> pprint.pprint(merged2[2].annotations)
{'size': 8, 'srcSize': 8, 'start': 0, 'strand': -1}
>>> pprint.pprint(merged2[3].annotations)
{'size': 6, 'srcSize': 15, 'start': 5, 'strand': 1}
"""
if msa1 is None:
# No merging to do.
return msa2
if msa2 is None:
# No merging to do this way either.
return msa1
if msa1[0].annotations["strand"] == -1:
# MSA 1 needs to be on the + strand of the reference
msa1 = reverse_msa(msa1)
if msa2[0].annotations["strand"] == -1:
# MSA 2 also needs to be on the + strand of the reference
msa2 = reverse_msa(msa2)
if msa2[0].annotations["start"] < msa1[0].annotations["start"]:
# msa2 starts before msa1. We want msa1 to start first, so we need to
# flip them.
msa1, msa2 = msa2, msa1
logging.debug("Zipping {}bp/{} sequence and {}bp/{} sequence reference "
"alignments".format(msa1[0].annotations["size"], len(msa1),
msa2[0].annotations["size"], len(msa2)))
# Make sure we are joining on the right sequence.
assert(msa1[0].id == msa2[0].id)
logging.debug("Merging")
logging.debug(msa1)
logging.debug(msa1[0].annotations)
logging.debug(msa2)
logging.debug(msa2[0].annotations)
# Compute the offset: number of extra reference columns that msa2 needs in
# front of it. This will always be positive or 0.
msa2_leading_offset = (msa2[0].annotations["start"] -
msa1[0].annotations["start"])
logging.debug("{}bp between left and right alignment starts".format(
msa2_leading_offset))
# It would be nice if we could shortcut by adjoining compatible alignments,
# but the IDs wouldn't match up at all.
# Make lists for each sequence we are going to build: those in msa1, and
# then those in msa2 (except the duplicate reference).
merged = [list() for i in xrange(len(msa1) + len(msa2) - 1)]
# Start at the beginning of both alignments.
msa1Pos = 0
msa2Pos = 0
# How many reference characters have been used?
refChars = 0
while refChars < msa2_leading_offset and msa1Pos < len(msa1[0]):
# Until we're to the point that MSA 2 might have anything to say, we
# just copy MSA 1.
for i, character in enumerate(msa1[:, msa1Pos]):
# For each character in the first alignment in this column
# Put that character as the character for the appropriate
# sequence.
merged[i].append(character)
for i in xrange(len(msa1), len(msa1) + len(msa2) - 1):
# For each of the alignment rows that come from msa2, put a gap.
merged[i].append("-")
if msa1[0, msa1Pos] != "-":
# We consumed a reference character.
refChars += 1
# We used some of MSA1
msa1Pos += 1
logging.debug("Used {}/{} offset".format(refChars, msa2_leading_offset))
while refChars < msa2_leading_offset:
# We have a gap between the first MSA and the second, and we need to
# fill it with reference sequence.
# We know we are refChars after the beginning of the first reference, so
# we use that to know what base to put here.
merged[0].append(full_ref[msa1[0].annotations["start"] + refChars])
for i in xrange(1, len(msa1) + len(msa2) - 1):
# And gap out all the other sequences.
merged[i].append("-")
# We consumed (or made up) a reference character
refChars += 1
while msa1Pos < len(msa1[0]) and msa2Pos < len(msa2[0]):
# Until we hit the end of both sequences
if refChars % 10000 == 0:
logging.debug("Now at {} in alignment 1, {} in alignment 2, {} in "
"reference".format(msa1Pos, msa2Pos, refChars))
if(msa1[0, msa1Pos] == "-"):
# We have a gap in the first reference. Put this column from the
# first alignment alongside a gap for every sequence in the second
# alignment.
for i, character in enumerate(msa1[:, msa1Pos]):
# For each character in the first alignment in this column
# Put that character as the character for the appropriate
# sequence.
merged[i].append(character)
for i in xrange(len(msa1), len(msa1) + len(msa2) - 1):
# For each of the alignment rows that come from msa2, put a gap.
merged[i].append("-")
# Advance in msa1. We'll keep doing this until it doesn't have a gap
# in its reference.
msa1Pos += 1
elif(msa2[0, msa2Pos] == "-"):
# We have a letter in the first reference but a gap in the second.
# Gap out the merged reference and all the columns from alignment 1,
# and take the non-reference characters from alignment 2.
for i in xrange(len(msa1)):
# For the reference and all the sequences in msa1, add gaps
merged[i].append("-")
for i, character in zip(xrange(len(msa1),
len(msa1) + len(msa2) - 1), msa2[1:, msa2Pos]):
# For each of the alignment rows that come from msa2, put the
# character from that row.
merged[i].append(character)
# Advance in msa2. We'll keep doing this until both msa1 and msa2
# have a non-gap character in their references. We make it an
# invariant that this will always be the same character.
msa2Pos += 1
else:
# Neither has a gap. They both have real characters.
if(msa1[0, msa1Pos] != msa2[0, msa2Pos]):
logging.error(msa1)
logging.error(msa2)
raise RuntimeError("{} in reference 1 does not match {} "
"in reference 2".format(msa1[0, msa1Pos], msa2[0, msa2Pos]))
for i, character in enumerate(msa1[:, msa1Pos]):
# Copy all the characters from msa1's column
merged[i].append(character)
for character, i in zip(msa2[1:, msa2Pos], xrange(len(msa1),
len(msa1) + len(msa2) - 1)):
# Copy all the characters from msa2's column, except its
# reference
merged[i].append(character)
# Advance both alignments
msa1Pos += 1
msa2Pos += 1
# Say we used a reference character
refChars += 1
for otherMerged in merged[1:]:
# Make sure we aren't dropping characters anywhere.
assert(len(otherMerged) == len(merged[0]))
logging.debug("At {}/{} of msa2, {}/{} of msa1".format(msa2Pos,
len(msa2[0]), msa1Pos, len(msa1[0])))
# By here, we must have finished one of the MSAs. Only one can have anything
# left.
assert(msa1Pos == len(msa1[0]) or msa2Pos == len(msa2[0]))
while msa1Pos < len(msa1[0]):
# MSA2 finished first and now we have to finish up with the tail end of
# MSA1
for i, character in enumerate(msa1[:, msa1Pos]):
# For each character in the first alignment in this column
# Put that character as the character for the appropriate
# sequence.
merged[i].append(character)
for i in xrange(len(msa1), len(msa1) + len(msa2) - 1):
# For each of the alignment rows that come from msa2, put a gap.
merged[i].append("-")
# Advance in msa1, until we finish it.
msa1Pos += 1
while msa2Pos < len(msa2[0]):
# MSA1 finished first and now we have to finish up with the tail end of
# MSA2
# For the reference, put whatever it has in MSA2
merged[0].append(msa2[0][msa2Pos])
for i in xrange(1, len(msa1)):
# For all the sequences in msa1, add gaps
merged[i].append("-")
for i, character in zip(xrange(len(msa1),
len(msa1) + len(msa2) - 1), msa2[1:, msa2Pos]):
# For each of the alignment rows that come from msa2, put the
# character from that row.
merged[i].append(character)
# Advance in msa2, until we finish it.
msa2Pos += 1
# Now we have finished populating these aligned lists. We need to make a
# MultipleSeqAlignment from them.
# What names do the sequences in this alignment have? All the ones from
# msa1, and then all the ones from msa2 except the first (which is the
# reference)
seqNames = [record.id for record in msa1] + [record.id
for record in msa2[1:]]
# Make a SeqRecord for each list of properly gapped-out characters, with the
# appropriate name.
seqRecords = [SeqRecord(Seq("".join(alignedList)), name)
for alignedList, name in zip(merged, seqNames)]
# Make the records into a proper MSA
merged = Align.MultipleSeqAlignment(seqRecords)
# Do the annotations for the reference
merged[0].annotations.update(msa1[0].annotations)
# Calculate the total reference bases used. It will be the distance between
# the rightmost alignment end and the start of msa1, along the reference.
merged[0].annotations["size"] = (max(msa2[0].annotations["start"] +
msa2[0].annotations["size"], msa1[0].annotations["start"] +
msa1[0].annotations["size"]) - msa1[0].annotations["start"])
for i in xrange(1, len(msa1)):
# Copy over annotations from MSA1
merged[i].annotations.update(msa1[i].annotations)
for i in xrange(len(msa1), len(msa1) + len(msa2) - 1):
# Copy over annotations from MSA2, starting after the reference.
merged[i].annotations.update(msa2[i - len(msa1) + 1].annotations)
# The merged result reverence needs to be longer than the input references.
#assert(len(merged[0]) >= len(msa1[0]))
#assert(len(merged[0]) >= len(msa2[0]))
# Give back the merged MSA
return merged
def main(args):
"""
Parses command line arguments and do the work of the program.
"args" specifies the program arguments, with args[0] being the executable
name. The return value should be used as the program's exit code.
"""
if len(args) == 2 and args[1] == "--test":
# Turn on debug logging
logging.basicConfig(level=logging.DEBUG)
# Run the tests
return doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
# Set up logging
logging.basicConfig(level=logging.INFO)
options = parse_args(args) # This holds the nicely-parsed options object
# Load all the FASTAs, indexed
fastaDicts = [SeqIO.index(fasta, "fasta") for fasta in options.fastas]
# Cache sequences from getSequence. Will waste memory but save disk IO.
cache = {}
def getSequence(name):
"""
Get a sequence by ID from the first FASTA that has it.
"""
if cache.has_key(name):
return cache[name]
for fastaDict in fastaDicts:
if fastaDict.has_key(name):
cache[name] = fastaDict[name]
return cache[name]
raise ValueError("No sequence {} in any FASTA".format(name))
# Save them all here
all_msas = []
for psl in options.psls:
logging.debug("Processing {}".format(psl))
# For each PSL we want in out MAF
for result in SearchIO.parse(psl, "blat-psl"):
# Parse the PSL and go through the results
for hit in result:
# For every hit in the result
if options.referenceSequence is not None:
# Override the reference (i.e. query) sequence first.
# TODO: why is reference actually query and query actually
# hit???
hit.query_id = options.referenceSequence
# Grab the query that matched in this hit (ends up being the
# thing we hit with the alignment somehow)
queryID = hit.query_id
querySeqRecord = getSequence(queryID)
# Grab the hit ID, which is the thing it hit, and the
# sequence for that.
hitID = hit.id
hitSeqRecord = getSequence(hitID)
for hsp in hit:
# For every HSP (high-scoring pair) in the hit (which
# corresponds to a PSL line, and will be on a consistent
# strand)
# Let's make an MSA describing the entire HSP.
hsp_msa = None
logging.info("Starting a new HSP")
for fragment in hsp:
# For every HSP fragment in the HSP (actual alignment
# bit. Why is it so insanely nested?)
# Offset the reference (i.e. query) coordinates
fragment.query_start += options.referenceOffset
fragment.query_end += options.referenceOffset
# Fix up the fragment by going and fetching its hit
# sequence piece from the appropriate SeqRecord.
hitFragment = hitSeqRecord[fragment.hit_start:
fragment.hit_end]
if fragment.hit_strand == -1:
# We meant to get the other strand.
hitFragment = hitFragment.reverse_complement()
# Make sure we got the right number of bases.
assert(len(hitFragment) == fragment.hit_span)
# Work out the start on the appropriate strand
if fragment.hit_strand == 1:
# On the forward strand we can use the normal start
hit_start = fragment.hit_start
else:
# We have to calculate the start index on the
# reverse strand. Do it for 0-based coordinates.
hit_start = (len(hitSeqRecord) -
fragment.hit_start - fragment.hit_span)
# Annotate the hit (alt) with strand, start, size, and
# srcSize, as MafIO uses
hitFragment.annotations = {
"strand": fragment.hit_strand,
"size": fragment.hit_span,
"start": hit_start,
"srcSize": len(hitSeqRecord)
}
# Put it in.
fragment.hit = hitFragment
# Now grab the bit of the query sequence involved in
# this fragment.
queryFragment = querySeqRecord[fragment.query_start:
fragment.query_end]
if fragment.query_strand == -1:
# We meant to get the other strand
queryFragment = queryFragment.reverse_complement()
# Make sure we got the right number of bases.
if len(queryFragment) != fragment.query_span:
raise RuntimeError("Query fragment has {} bases "
"instead of {}".format(len(queryFragment),
fragment.query_span))
# Work out the start on the appropriate strand
if fragment.query_strand == 1:
# On the forward strand we can use the normal start
query_start = fragment.query_start
else:
# We have to calculate the start index on the
# reverse strand. Do it for 0-based coordinates.
query_start = (len(querySeqRecord) -
fragment.query_start - fragment.query_span)
# Annotate the query (ref) with strand, start, size, and
# srcSize, as MafIO uses
queryFragment.annotations = {
"strand": fragment.query_strand,
"size": fragment.query_span,
"start": query_start,
"srcSize": len(querySeqRecord)
}
# Put it in
fragment.query = queryFragment
# Get the MultipleSeqAlignment which the fragment then
# creates. Query (ref) is first.
alignment = fragment.aln
if options.noMismatch:
# We only want to have match operations in our
# alignment. If two bases don't match, we need to
# gap them apart.
alignment = gapMismatches(alignment)
# Add in the alignment for this hit to its MSA, doing
# whatever reordering is needed to make it work.
hsp_msa = smart_adjoin(hsp_msa, alignment, getSequence)
# Save the HSP MSA
all_msas.append(hsp_msa)
logging.info("Produced MSA:")
logging.info(hsp_msa)
logging.info("Merging MSAs...")
# Now merge all the MSAs together with a tree reduce.
combined_msa = tree_reduce(all_msas, lambda a, b: mergeMSAs(a, b,
getSequence(a[0].id)))
logging.info("Writing output")
# Save all the alignments in one MAF.
AlignIO.write(combined_msa, options.maf, "maf")
if __name__ == "__main__" :
sys.exit(main(sys.argv))
| mit |
occho/infer | infer/lib/capture/ant.py | 4 | 2470 | import os
import logging
import util
MODULE_NAME = __name__
MODULE_DESCRIPTION = '''Run analysis of code built with a command like:
ant [options] [target]
Analysis examples:
infer -- ant compile'''
def gen_instance(*args):
return AntCapture(*args)
# This creates an empty argparser for the module, which provides only
# description/usage information and no arguments.
create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class AntCapture:
def __init__(self, args, cmd):
self.args = args
util.log_java_version()
logging.info(util.run_cmd_ignore_fail(['ant', '-version']))
# TODO: make the extraction of targets smarter
self.build_cmd = ['ant', '-verbose'] + cmd[1:]
def is_interesting(self, content):
return self.is_quoted(content) or content.endswith('.java')
def is_quoted(self, argument):
quote = '\''
return len(argument) > 2 and argument[0] == quote\
and argument[-1] == quote
def remove_quotes(self, argument):
if self.is_quoted(argument):
return argument[1:-1]
else:
return argument
def get_inferJ_commands(self, verbose_output):
javac_pattern = '[javac]'
argument_start_pattern = 'Compilation arguments'
calls = []
javac_arguments = []
collect = False
for line in verbose_output:
if javac_pattern in line:
if argument_start_pattern in line:
collect = True
if javac_arguments != []:
capture = util.create_inferJ_command(self.args,
javac_arguments)
calls.append(capture)
javac_arguments = []
if collect:
pos = line.index(javac_pattern) + len(javac_pattern)
content = line[pos:].strip()
if self.is_interesting(content):
arg = self.remove_quotes(content)
javac_arguments.append(arg)
if javac_arguments != []:
capture = util.create_inferJ_command(self.args, javac_arguments)
calls.append(capture)
javac_arguments = []
return calls
def capture(self):
cmds = self.get_inferJ_commands(util.get_build_output(self.build_cmd))
return util.run_commands(cmds)
| bsd-3-clause |
haamoon/tensorpack | tensorpack/callbacks/saver.py | 1 | 6283 | # -*- coding: UTF-8 -*-
# File: saver.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import tensorflow as tf
import os
import shutil
import glob
from .base import Callback
from ..utils import logger
from ..utils.develop import log_deprecated
from ..tfutils.common import get_tf_version_number
__all__ = ['ModelSaver', 'MinSaver', 'MaxSaver']
class ModelSaver(Callback):
"""
Save the model every epoch.
"""
def __init__(self, max_to_keep=10,
keep_checkpoint_every_n_hours=0.5,
checkpoint_dir=None,
var_collections=tf.GraphKeys.GLOBAL_VARIABLES,
keep_recent=None, keep_freq=None):
"""
Args:
max_to_keep, keep_checkpoint_every_n_hours(int): the same as in ``tf.train.Saver``.
checkpoint_dir (str): Defaults to ``logger.LOG_DIR``.
var_collections (str or list of str): collection of the variables (or list of collections) to save.
"""
self._max_to_keep = max_to_keep
self._keep_every_n_hours = keep_checkpoint_every_n_hours
if keep_recent is not None or keep_freq is not None:
log_deprecated("ModelSaver(keep_recent=, keep_freq=)", "Use max_to_keep and keep_checkpoint_every_n_hours!")
if keep_recent is not None:
self._max_to_keep = keep_recent
if keep_freq is not None:
self._keep_every_n_hours = keep_freq
if not isinstance(var_collections, list):
var_collections = [var_collections]
self.var_collections = var_collections
if checkpoint_dir is None:
checkpoint_dir = logger.LOG_DIR
assert os.path.isdir(checkpoint_dir), checkpoint_dir
self.checkpoint_dir = checkpoint_dir
def _setup_graph(self):
vars = []
for key in self.var_collections:
vars.extend(tf.get_collection(key))
vars = list(set(vars))
self.path = os.path.join(self.checkpoint_dir, 'model')
if get_tf_version_number() <= 1.1:
self.saver = tf.train.Saver(
var_list=vars,
max_to_keep=self._max_to_keep,
keep_checkpoint_every_n_hours=self._keep_every_n_hours,
write_version=tf.train.SaverDef.V2)
else:
self.saver = tf.train.Saver(
var_list=vars,
max_to_keep=self._max_to_keep,
keep_checkpoint_every_n_hours=self._keep_every_n_hours,
write_version=tf.train.SaverDef.V2,
save_relative_paths=True)
self.meta_graph_written = False
def _trigger(self):
try:
if not self.meta_graph_written:
self.saver.export_meta_graph(
os.path.join(self.checkpoint_dir,
'graph-{}.meta'.format(logger.get_time_str())),
collection_list=self.graph.get_all_collection_keys())
self.meta_graph_written = True
self.saver.save(
tf.get_default_session(),
self.path,
global_step=tf.train.get_global_step(),
write_meta_graph=False)
logger.info("Model saved to %s." % tf.train.get_checkpoint_state(self.checkpoint_dir).model_checkpoint_path)
except (OSError, IOError, tf.errors.PermissionDeniedError,
tf.errors.ResourceExhaustedError): # disk error sometimes.. just ignore it
logger.exception("Exception in ModelSaver!")
class MinSaver(Callback):
"""
Separately save the model with minimum value of some statistics.
"""
def __init__(self, monitor_stat, reverse=False, filename=None):
"""
Args:
monitor_stat(str): the name of the statistics.
reverse (bool): if True, will save the maximum.
filename (str): the name for the saved model.
Defaults to ``min-{monitor_stat}.tfmodel``.
Example:
Save the model with minimum validation error to
"min-val-error.tfmodel":
.. code-block:: python
MinSaver('val-error')
Note:
It assumes that :class:`ModelSaver` is used with
``checkpoint_dir=logger.LOG_DIR`` (the default). And it will save
the model to that directory as well.
"""
self.monitor_stat = monitor_stat
self.reverse = reverse
self.filename = filename
self.min = None
def _get_stat(self):
try:
v = self.trainer.monitors.get_latest(self.monitor_stat)
except KeyError:
v = None
return v
def _need_save(self):
v = self._get_stat()
if not v:
return False
return v > self.min if self.reverse else v < self.min
def _trigger(self):
if self.min is None or self._need_save():
self.min = self._get_stat()
if self.min:
self._save()
def _save(self):
ckpt = tf.train.get_checkpoint_state(logger.LOG_DIR)
if ckpt is None:
raise RuntimeError(
"Cannot find a checkpoint state. Do you forget to use ModelSaver?")
path = ckpt.model_checkpoint_path
newname = os.path.join(logger.LOG_DIR,
self.filename or
('max-' + self.monitor_stat if self.reverse else 'min-' + self.monitor_stat))
files_to_copy = glob.glob(path + '*')
for file_to_copy in files_to_copy:
shutil.copy(file_to_copy, file_to_copy.replace(path, newname))
#shutil.copy(path, newname)
logger.info("Model with {} '{}' saved.".format(
'maximum' if self.reverse else 'minimum', self.monitor_stat))
class MaxSaver(MinSaver):
"""
Separately save the model with maximum value of some statistics.
"""
def __init__(self, monitor_stat, filename=None):
"""
Args:
monitor_stat(str): the name of the statistics.
filename (str): the name for the saved model.
Defaults to ``max-{monitor_stat}.tfmodel``.
"""
super(MaxSaver, self).__init__(monitor_stat, True, filename=filename)
| apache-2.0 |
AllisonWang/incubator-airflow | airflow/contrib/operators/sftp_operator.py | 7 | 3976 | # -*- coding: utf-8 -*-
#
# 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.
import logging
from airflow.contrib.hooks.ssh_hook import SSHHook
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class SFTPOperation(object):
PUT = 'put'
GET = 'get'
class SFTPOperator(BaseOperator):
"""
SFTPOperator for transferring files from remote host to local or vice a versa.
This operator uses ssh_hook to open sftp trasport channel that serve as basis
for file transfer.
:param ssh_hook: predefined ssh_hook to use for remote execution
:type ssh_hook: :class:`SSHHook`
:param ssh_conn_id: connection id from airflow Connections
:type ssh_conn_id: str
:param remote_host: remote host to connect
:type remote_host: str
:param local_filepath: local file path to get or put
:type local_filepath: str
:param remote_filepath: remote file path to get or put
:type remote_filepath: str
:param operation: specify operation 'get' or 'put', defaults to get
:type get: bool
"""
template_fields = ('local_filepath', 'remote_filepath')
@apply_defaults
def __init__(self,
ssh_hook=None,
ssh_conn_id=None,
remote_host=None,
local_filepath=None,
remote_filepath=None,
operation=SFTPOperation.PUT,
*args,
**kwargs):
super(SFTPOperator, self).__init__(*args, **kwargs)
self.ssh_hook = ssh_hook
self.ssh_conn_id = ssh_conn_id
self.remote_host = remote_host
self.local_filepath = local_filepath
self.remote_filepath = remote_filepath
self.operation = operation
if not (self.operation.lower() == SFTPOperation.GET or self.operation.lower() == SFTPOperation.PUT):
raise TypeError("unsupported operation value {0}, expected {1} or {2}"
.format(self.operation, SFTPOperation.GET, SFTPOperation.PUT))
def execute(self, context):
file_msg = None
try:
if self.ssh_conn_id and not self.ssh_hook:
self.ssh_hook = SSHHook(ssh_conn_id=self.ssh_conn_id)
if not self.ssh_hook:
raise AirflowException("can not operate without ssh_hook or ssh_conn_id")
if self.remote_host is not None:
self.ssh_hook.remote_host = self.remote_host
ssh_client = self.ssh_hook.get_conn()
sftp_client = ssh_client.open_sftp()
if self.operation.lower() == SFTPOperation.GET:
file_msg = "from {0} to {1}".format(self.remote_filepath,
self.local_filepath)
logging.debug("Starting to transfer {0}".format(file_msg))
sftp_client.get(self.remote_filepath, self.local_filepath)
else:
file_msg = "from {0} to {1}".format(self.local_filepath,
self.remote_filepath)
logging.debug("Starting to transfer file {0}".format(file_msg))
sftp_client.put(self.local_filepath, self.remote_filepath)
except Exception as e:
raise AirflowException("Error while transferring {0}, error: {1}"
.format(file_msg, str(e)))
return None
| apache-2.0 |
qizenguf/MLC-STT | src/sim/System.py | 3 | 5331 | # Copyright (c) 2005-2007 The Regents of The University of Michigan
# Copyright (c) 2011 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Nathan Binkert
# Rick Strong
from m5.SimObject import SimObject
from m5.defines import buildEnv
from m5.params import *
from m5.proxy import *
from DVFSHandler import *
from SimpleMemory import *
class MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
'atomic_noncaching']
class System(MemObject):
type = 'System'
cxx_header = "sim/system.hh"
system_port = MasterPort("System port")
@classmethod
def export_methods(cls, code):
code('''
Enums::MemoryMode getMemoryMode() const;
void setMemoryMode(Enums::MemoryMode mode);
''')
memories = VectorParam.AbstractMemory(Self.all,
"All memories in the system")
mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
thermal_model = Param.ThermalModel(NULL, "Thermal model")
thermal_components = VectorParam.SimObject([],
"A collection of all thermal components in the system.")
# When reserving memory on the host, we have the option of
# reserving swap space or not (by passing MAP_NORESERVE to
# mmap). By enabling this flag, we accommodate cases where a large
# (but sparse) memory is simulated.
mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
"without reserving swap")
# The memory ranges are to be populated when creating the system
# such that these can be passed from the I/O subsystem through an
# I/O bridge or cache
mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
"encountering work item annotations.")
work_item_id = Param.Int(-1, "specific work item id")
num_work_ids = Param.Int(16, "Number of distinct work item types")
work_begin_cpu_id_exit = Param.Int(-1,
"work started on specific id, now exit simulation")
work_begin_ckpt_count = Param.Counter(0,
"create checkpoint when work items begin count value is reached")
work_begin_exit_count = Param.Counter(0,
"exit simulation when work items begin count value is reached")
work_end_ckpt_count = Param.Counter(0,
"create checkpoint when work items end count value is reached")
work_end_exit_count = Param.Counter(0,
"exit simulation when work items end count value is reached")
work_cpus_ckpt_count = Param.Counter(0,
"create checkpoint when active cpu count value is reached")
init_param = Param.UInt64(0, "numerical value to pass into simulator")
boot_osflags = Param.String("a", "boot flags to pass to the kernel")
kernel = Param.String("", "file that contains the kernel code")
kernel_addr_check = Param.Bool(True,
"whether to address check on kernel (disable for baremetal)")
readfile = Param.String("", "file to read startup script from")
symbolfile = Param.String("", "file to get the symbols from")
load_addr_mask = Param.UInt64(0xffffffffff,
"Address to mask loading binaries with")
load_offset = Param.UInt64(0, "Address to offset loading binaries with")
multi_thread = Param.Bool(False,
"Supports multi-threaded CPUs? Impacts Thread/Context IDs")
# Dynamic voltage and frequency handler for the system, disabled by default
# Provide list of domains that need to be controlled by the handler
dvfs_handler = DVFSHandler()
if buildEnv['USE_KVM']:
kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)')
| bsd-3-clause |
Gitlab11/odoo | addons/fetchmail/__openerp__.py | 260 | 2887 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# mga@openerp.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name' : 'Email Gateway',
'version' : '1.0',
'depends' : ['mail'],
'author' : 'OpenERP SA',
'category': 'Tools',
'description': """
Retrieve incoming email on POP/IMAP servers.
============================================
Enter the parameters of your POP/IMAP account(s), and any incoming emails on
these accounts will be automatically downloaded into your OpenERP system. All
POP3/IMAP-compatible servers are supported, included those that require an
encrypted SSL/TLS connection.
This can be used to easily create email-based workflows for many email-enabled OpenERP documents, such as:
----------------------------------------------------------------------------------------------------------
* CRM Leads/Opportunities
* CRM Claims
* Project Issues
* Project Tasks
* Human Resource Recruitments (Applicants)
Just install the relevant application, and you can assign any of these document
types (Leads, Project Issues) to your incoming email accounts. New emails will
automatically spawn new documents of the chosen type, so it's a snap to create a
mailbox-to-OpenERP integration. Even better: these documents directly act as mini
conversations synchronized by email. You can reply from within OpenERP, and the
answers will automatically be collected when they come back, and attached to the
same *conversation* document.
For more specific needs, you may also assign custom-defined actions
(technically: Server Actions) to be triggered for each incoming mail.
""",
'website': 'https://www.odoo.com/page/mailing',
'data': [
'fetchmail_data.xml',
'fetchmail_view.xml',
'security/ir.model.access.csv',
'fetchmail_installer_view.xml'
],
'demo': [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| agpl-3.0 |
thanhacun/odoo | addons/sale_margin/__init__.py | 441 | 1042 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import sale_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| agpl-3.0 |
fullfanta/mxnet | example/fcn-xs/fcn_xs.py | 45 | 3773 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# pylint: skip-file
import sys, os
import argparse
import mxnet as mx
import numpy as np
import logging
import symbol_fcnxs
import init_fcnxs
from data import FileIter
from solver import Solver
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ctx = mx.gpu(0)
def main():
fcnxs = symbol_fcnxs.get_fcn32s_symbol(numclass=21, workspace_default=1536)
fcnxs_model_prefix = "model_pascal/FCN32s_VGG16"
if args.model == "fcn16s":
fcnxs = symbol_fcnxs.get_fcn16s_symbol(numclass=21, workspace_default=1536)
fcnxs_model_prefix = "model_pascal/FCN16s_VGG16"
elif args.model == "fcn8s":
fcnxs = symbol_fcnxs.get_fcn8s_symbol(numclass=21, workspace_default=1536)
fcnxs_model_prefix = "model_pascal/FCN8s_VGG16"
arg_names = fcnxs.list_arguments()
_, fcnxs_args, fcnxs_auxs = mx.model.load_checkpoint(args.prefix, args.epoch)
if not args.retrain:
if args.init_type == "vgg16":
fcnxs_args, fcnxs_auxs = init_fcnxs.init_from_vgg16(ctx, fcnxs, fcnxs_args, fcnxs_auxs)
elif args.init_type == "fcnxs":
fcnxs_args, fcnxs_auxs = init_fcnxs.init_from_fcnxs(ctx, fcnxs, fcnxs_args, fcnxs_auxs)
train_dataiter = FileIter(
root_dir = "./VOC2012",
flist_name = "train.lst",
# cut_off_size = 400,
rgb_mean = (123.68, 116.779, 103.939),
)
val_dataiter = FileIter(
root_dir = "./VOC2012",
flist_name = "val.lst",
rgb_mean = (123.68, 116.779, 103.939),
)
model = Solver(
ctx = ctx,
symbol = fcnxs,
begin_epoch = 0,
num_epoch = 50,
arg_params = fcnxs_args,
aux_params = fcnxs_auxs,
learning_rate = 1e-10,
momentum = 0.99,
wd = 0.0005)
model.fit(
train_data = train_dataiter,
eval_data = val_dataiter,
batch_end_callback = mx.callback.Speedometer(1, 10),
epoch_end_callback = mx.callback.do_checkpoint(fcnxs_model_prefix))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Convert vgg16 model to vgg16fc model.')
parser.add_argument('--model', default='fcnxs',
help='The type of fcn-xs model, e.g. fcnxs, fcn16s, fcn8s.')
parser.add_argument('--prefix', default='VGG_FC_ILSVRC_16_layers',
help='The prefix(include path) of vgg16 model with mxnet format.')
parser.add_argument('--epoch', type=int, default=74,
help='The epoch number of vgg16 model.')
parser.add_argument('--init-type', default="vgg16",
help='the init type of fcn-xs model, e.g. vgg16, fcnxs')
parser.add_argument('--retrain', action='store_true', default=False,
help='true means continue training.')
args = parser.parse_args()
logging.info(args)
main()
| apache-2.0 |
vicalloy/lbutils | translations.py | 1 | 1080 | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=(
'lbutils',
'lbutils.tests',
),
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3"
}
},
SILENCED_SYSTEM_CHECKS=["1_7.W001"],
)
def run(command):
if not settings.configured:
settings.configure(**DEFAULT_SETTINGS)
# Compatibility with Django 1.7's stricter initialization
if hasattr(django, 'setup'):
django.setup()
parent = os.path.dirname(os.path.abspath(__file__))
appdir = os.path.join(parent, 'lbutils')
os.chdir(appdir)
from django.core.management import call_command
params = {}
if command == 'make':
params['locale'] = ['zh-Hans']
call_command('%smessages' % command, **params)
if __name__ == '__main__':
if (len(sys.argv)) < 2 or (sys.argv[1] not in {'make', 'compile'}):
print("Run `translations.py make` or `translations.py compile`.")
sys.exit(1)
run(sys.argv[1])
| mit |
mathspace/django | tests/admin_changelist/models.py | 276 | 2890 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Event(models.Model):
# Oracle can have problems with a column named "date"
date = models.DateField(db_column="event_date")
class Parent(models.Model):
name = models.CharField(max_length=128)
class Child(models.Model):
parent = models.ForeignKey(Parent, models.SET_NULL, editable=False, null=True)
name = models.CharField(max_length=30, blank=True)
age = models.IntegerField(null=True, blank=True)
class Genre(models.Model):
name = models.CharField(max_length=20)
class Band(models.Model):
name = models.CharField(max_length=20)
nr_of_members = models.PositiveIntegerField()
genres = models.ManyToManyField(Genre)
@python_2_unicode_compatible
class Musician(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return self.name
@python_2_unicode_compatible
class Group(models.Model):
name = models.CharField(max_length=30)
members = models.ManyToManyField(Musician, through='Membership')
def __str__(self):
return self.name
class Concert(models.Model):
name = models.CharField(max_length=30)
group = models.ForeignKey(Group, models.CASCADE)
class Membership(models.Model):
music = models.ForeignKey(Musician, models.CASCADE)
group = models.ForeignKey(Group, models.CASCADE)
role = models.CharField(max_length=15)
class Quartet(Group):
pass
class ChordsMusician(Musician):
pass
class ChordsBand(models.Model):
name = models.CharField(max_length=30)
members = models.ManyToManyField(ChordsMusician, through='Invitation')
class Invitation(models.Model):
player = models.ForeignKey(ChordsMusician, models.CASCADE)
band = models.ForeignKey(ChordsBand, models.CASCADE)
instrument = models.CharField(max_length=15)
class Swallow(models.Model):
origin = models.CharField(max_length=255)
load = models.FloatField()
speed = models.FloatField()
class Meta:
ordering = ('speed', 'load')
class SwallowOneToOne(models.Model):
swallow = models.OneToOneField(Swallow, models.CASCADE)
class UnorderedObject(models.Model):
"""
Model without any defined `Meta.ordering`.
Refs #17198.
"""
bool = models.BooleanField(default=True)
class OrderedObjectManager(models.Manager):
def get_queryset(self):
return super(OrderedObjectManager, self).get_queryset().order_by('number')
class OrderedObject(models.Model):
"""
Model with Manager that defines a default order.
Refs #17198.
"""
name = models.CharField(max_length=255)
bool = models.BooleanField(default=True)
number = models.IntegerField(default=0, db_column='number_val')
objects = OrderedObjectManager()
class CustomIdUser(models.Model):
uuid = models.AutoField(primary_key=True)
| bsd-3-clause |
thauser/pnc-cli | pnc_cli/swagger_client/models/error_response_rest.py | 2 | 4108 | # coding: utf-8
"""
Copyright 2015 SmartBear Software
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.
Ref: https://github.com/swagger-api/swagger-codegen
"""
from datetime import datetime
from pprint import pformat
from six import iteritems
class ErrorResponseRest(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
ErrorResponseRest - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'error_type': 'str',
'error_message': 'str',
'details': 'object'
}
self.attribute_map = {
'error_type': 'errorType',
'error_message': 'errorMessage',
'details': 'details'
}
self._error_type = None
self._error_message = None
self._details = None
@property
def error_type(self):
"""
Gets the error_type of this ErrorResponseRest.
:return: The error_type of this ErrorResponseRest.
:rtype: str
"""
return self._error_type
@error_type.setter
def error_type(self, error_type):
"""
Sets the error_type of this ErrorResponseRest.
:param error_type: The error_type of this ErrorResponseRest.
:type: str
"""
self._error_type = error_type
@property
def error_message(self):
"""
Gets the error_message of this ErrorResponseRest.
:return: The error_message of this ErrorResponseRest.
:rtype: str
"""
return self._error_message
@error_message.setter
def error_message(self, error_message):
"""
Sets the error_message of this ErrorResponseRest.
:param error_message: The error_message of this ErrorResponseRest.
:type: str
"""
self._error_message = error_message
@property
def details(self):
"""
Gets the details of this ErrorResponseRest.
:return: The details of this ErrorResponseRest.
:rtype: object
"""
return self._details
@details.setter
def details(self, details):
"""
Sets the details of this ErrorResponseRest.
:param details: The details of this ErrorResponseRest.
:type: object
"""
self._details = details
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, datetime):
result[attr] = str(value.date())
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
| apache-2.0 |
ltilve/ChromiumGStreamerBackend | tools/telemetry/telemetry/testing/page_test_test_case.py | 9 | 3817 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provide a TestCase base class for PageTest subclasses' unittests."""
import unittest
from telemetry import benchmark
from telemetry import story
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.results import results_options
from telemetry.internal import story_runner
from telemetry.page import page as page_module
from telemetry.page import page_test
from telemetry.testing import options_for_unittests
class BasicTestPage(page_module.Page):
def __init__(self, url, story_set, base_dir):
super(BasicTestPage, self).__init__(url, story_set, base_dir)
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
action_runner.ScrollPage()
class EmptyMetadataForTest(benchmark.BenchmarkMetadata):
def __init__(self):
super(EmptyMetadataForTest, self).__init__('')
class PageTestTestCase(unittest.TestCase):
"""A base class to simplify writing unit tests for PageTest subclasses."""
def CreateStorySetFromFileInUnittestDataDir(self, test_filename):
ps = self.CreateEmptyPageSet()
page = BasicTestPage('file://' + test_filename, ps, base_dir=ps.base_dir)
ps.AddStory(page)
return ps
def CreateEmptyPageSet(self):
base_dir = util.GetUnittestDataDir()
ps = story.StorySet(base_dir=base_dir)
return ps
def RunMeasurement(self, measurement, ps,
options=None):
"""Runs a measurement against a pageset, returning the rows its outputs."""
if options is None:
options = options_for_unittests.GetCopy()
assert options
temp_parser = options.CreateParser()
story_runner.AddCommandLineArgs(temp_parser)
defaults = temp_parser.get_default_values()
for k, v in defaults.__dict__.items():
if hasattr(options, k):
continue
setattr(options, k, v)
measurement.CustomizeBrowserOptions(options.browser_options)
options.output_file = None
options.output_formats = ['none']
options.suppress_gtest_report = True
options.output_trace_tag = None
story_runner.ProcessCommandLineArgs(temp_parser, options)
results = results_options.CreateResults(EmptyMetadataForTest(), options)
story_runner.Run(measurement, ps, options, results)
return results
def TestTracingCleanedUp(self, measurement_class, options=None):
ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html')
start_tracing_called = [False]
stop_tracing_called = [False]
class BuggyMeasurement(measurement_class):
def __init__(self, *args, **kwargs):
measurement_class.__init__(self, *args, **kwargs)
# Inject fake tracing methods to tracing_controller
def TabForPage(self, page, browser):
ActualStartTracing = browser.platform.tracing_controller.Start
def FakeStartTracing(*args, **kwargs):
ActualStartTracing(*args, **kwargs)
start_tracing_called[0] = True
raise exceptions.IntentionalException
browser.StartTracing = FakeStartTracing
ActualStopTracing = browser.platform.tracing_controller.Stop
def FakeStopTracing(*args, **kwargs):
result = ActualStopTracing(*args, **kwargs)
stop_tracing_called[0] = True
return result
browser.platform.tracing_controller.Stop = FakeStopTracing
return measurement_class.TabForPage(self, page, browser)
measurement = BuggyMeasurement()
try:
self.RunMeasurement(measurement, ps, options=options)
except page_test.TestNotSupportedOnPlatformError:
pass
if start_tracing_called[0]:
self.assertTrue(stop_tracing_called[0])
| bsd-3-clause |
rajalokan/keystone | keystone_tempest_plugin/tests/base.py | 3 | 1735 | # Copyright 2016 Red Hat, Inc.
#
# 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.
from tempest.common import credentials_factory as common_creds
from tempest import test
from keystone_tempest_plugin import clients
class BaseIdentityTest(test.BaseTestCase):
# The version of the identity that will be used in the tests.
identity_version = 'v3'
# NOTE(rodrigods): for now, all tests are in the admin scope, if
# necessary, another class can be created to handle non-admin tests.
credential_type = 'identity_admin'
@classmethod
def setup_clients(cls):
super(BaseIdentityTest, cls).setup_clients()
credentials = common_creds.get_configured_admin_credentials(
cls.credential_type, identity_version=cls.identity_version)
cls.keystone_manager = clients.Manager(credentials)
cls.auth_client = cls.keystone_manager.auth_client
cls.idps_client = cls.keystone_manager.identity_providers_client
cls.mappings_client = cls.keystone_manager.mapping_rules_client
cls.saml2_client = cls.keystone_manager.saml2_client
cls.sps_client = cls.keystone_manager.service_providers_client
cls.tokens_client = cls.keystone_manager.token_v3_client
| apache-2.0 |
mweisman/QGIS | python/plugins/processing/gdal/slope.py | 4 | 3660 | # -*- coding: utf-8 -*-
"""
***************************************************************************
slope.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Alexander Bruy'
__date__ = 'October 2013'
__copyright__ = '(C) 2013, Alexander Bruy'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtGui import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputRaster import OutputRaster
from processing.gdal.GdalUtils import GdalUtils
from processing.tools.system import *
class slope(GeoAlgorithm):
INPUT = 'INPUT'
BAND = 'BAND'
COMPUTE_EDGES = 'COMPUTE_EDGES'
ZEVENBERGEN = 'ZEVENBERGEN'
AS_PERCENT = 'AS_PERCENT'
SCALE = 'SCALE'
OUTPUT = 'OUTPUT'
#def getIcon(self):
# filepath = os.path.dirname(__file__) + '/icons/dem.png'
# return QIcon(filepath)
def defineCharacteristics(self):
self.name = 'Slope'
self.group = '[GDAL] Analysis'
self.addParameter(ParameterRaster(self.INPUT, 'Input layer'))
self.addParameter(ParameterNumber(self.BAND, 'Band number', 1, 99, 1))
self.addParameter(ParameterBoolean(self.COMPUTE_EDGES, 'Compute edges',
False))
self.addParameter(ParameterBoolean(self.ZEVENBERGEN,
"Use Zevenbergen&Thorne formula (instead of the Horn's one)",
False))
self.addParameter(ParameterBoolean(self.AS_PERCENT,
'Slope expressed as percent (instead of degrees)',
False))
self.addParameter(ParameterNumber(self.SCALE,
'Scale (ratio of vert. units to horiz.)', 0.0,
99999999.999999, 1.0))
self.addOutput(OutputRaster(self.OUTPUT, 'Output file'))
def processAlgorithm(self, progress):
arguments = ['slope']
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
arguments.append('-b')
arguments.append(str(self.getParameterValue(self.BAND)))
arguments.append('-s')
arguments.append(str(self.getParameterValue(self.SCALE)))
if self.getParameterValue(self.COMPUTE_EDGES):
arguments.append('-compute_edges')
if self.getParameterValue(self.ZEVENBERGEN):
arguments.append('-alg')
arguments.append('ZevenbergenThorne')
if self.getParameterValue(self.AS_PERCENT):
arguments.append('-p')
GdalUtils.runGdal(['gdaldem',
GdalUtils.escapeAndJoin(arguments)], progress)
| gpl-2.0 |
electron/libchromiumcontent | script/build-clang.py | 2 | 34353 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is used to download prebuilt clang binaries.
It is also used by clang-package.py to build the prebuilt clang binaries."""
import argparse
import distutils.spawn
import glob
import os
import pipes
import re
import shutil
import subprocess
import stat
import sys
import tarfile
import tempfile
import time
import urllib2
import zipfile
from lib.config import IS_ARM64_HOST, IS_ARMV7_HOST
# Do NOT CHANGE this if you don't know what you're doing -- see
# https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md
# Reverting problematic clang rolls is safe, though.
CLANG_REVISION = '312679'
use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ
if use_head_revision:
CLANG_REVISION = 'HEAD'
# This is incremented when pushing a new build of Clang at the same revision.
CLANG_SUB_REVISION=1
PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
# Path constants. (All of these should be absolute paths.)
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', 'src'))
THIRD_PARTY_DIR = os.path.join(CHROMIUM_DIR, 'third_party')
LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm')
LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap')
LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR,
'llvm-bootstrap-install')
LLVM_LTO_LLD_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-lto-lld')
CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools')
LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
'Release+Asserts')
COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt')
CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang')
LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld')
# compiler-rt is built as part of the regular LLVM build on Windows to get
# the 64-bit runtime, and out-of-tree elsewhere.
# TODO(thakis): Try to unify this.
if sys.platform == 'win32':
COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt')
else:
COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt')
LIBCXX_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxx')
LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi')
LLVM_BUILD_TOOLS_DIR = os.path.abspath(
os.path.join(LLVM_DIR, '..', 'llvm-build-tools'))
STAMP_FILE = os.path.normpath(
os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision'))
VERSION = '6.0.0'
ANDROID_NDK_DIR = os.path.join(
CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk')
# URL for pre-built binaries.
CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE',
'https://commondatastorage.googleapis.com/chromium-browser-clang')
LLVM_REPO_URL='https://llvm.org/svn/llvm-project'
if 'LLVM_REPO_URL' in os.environ:
LLVM_REPO_URL = os.environ['LLVM_REPO_URL']
# Bump after VC updates.
DIA_DLL = {
'2013': 'msdia120.dll',
'2015': 'msdia140.dll',
'2017': 'msdia140.dll',
}
def DownloadUrl(url, output_file):
"""Download url into output_file."""
CHUNK_SIZE = 4096
TOTAL_DOTS = 10
num_retries = 3
retry_wait_s = 5 # Doubled at each retry.
while True:
try:
sys.stdout.write('Downloading %s ' % url)
sys.stdout.flush()
response = urllib2.urlopen(url)
total_size = int(response.info().getheader('Content-Length').strip())
bytes_done = 0
dots_printed = 0
while True:
chunk = response.read(CHUNK_SIZE)
if not chunk:
break
output_file.write(chunk)
bytes_done += len(chunk)
num_dots = TOTAL_DOTS * bytes_done / total_size
sys.stdout.write('.' * (num_dots - dots_printed))
sys.stdout.flush()
dots_printed = num_dots
if bytes_done != total_size:
raise urllib2.URLError("only got %d of %d bytes" %
(bytes_done, total_size))
print ' Done.'
return
except urllib2.URLError as e:
sys.stdout.write('\n')
print e
if num_retries == 0 or isinstance(e, urllib2.HTTPError) and e.code == 404:
raise e
num_retries -= 1
print 'Retrying in %d s ...' % retry_wait_s
time.sleep(retry_wait_s)
retry_wait_s *= 2
def EnsureDirExists(path):
if not os.path.exists(path):
print "Creating directory %s" % path
os.makedirs(path)
def DownloadAndUnpack(url, output_dir):
with tempfile.TemporaryFile() as f:
DownloadUrl(url, f)
f.seek(0)
EnsureDirExists(output_dir)
if url.endswith('.zip'):
zipfile.ZipFile(f).extractall(path=output_dir)
else:
tarfile.open(mode='r:gz', fileobj=f).extractall(path=output_dir)
def ReadStampFile(path=STAMP_FILE):
"""Return the contents of the stamp file, or '' if it doesn't exist."""
try:
with open(path, 'r') as f:
return f.read().rstrip()
except IOError:
return ''
def WriteStampFile(s, path=STAMP_FILE):
"""Write s to the stamp file."""
EnsureDirExists(os.path.dirname(path))
with open(path, 'w') as f:
f.write(s)
f.write('\n')
def GetSvnRevision(svn_repo):
"""Returns current revision of the svn repo at svn_repo."""
svn_info = subprocess.check_output('svn info ' + svn_repo, shell=True)
m = re.search(r'Revision: (\d+)', svn_info)
return m.group(1)
def RmTree(dir):
"""Delete dir."""
def ChmodAndRetry(func, path, _):
# Subversion can leave read-only files around.
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
return func(path)
raise
shutil.rmtree(dir, onerror=ChmodAndRetry)
def RmCmakeCache(dir):
"""Delete CMake cache related files from dir."""
for dirpath, dirs, files in os.walk(dir):
if 'CMakeCache.txt' in files:
os.remove(os.path.join(dirpath, 'CMakeCache.txt'))
if 'CMakeFiles' in dirs:
RmTree(os.path.join(dirpath, 'CMakeFiles'))
def RunCommand(command, msvc_arch=None, env=None, fail_hard=True):
"""Run command and return success (True) or failure; or if fail_hard is
True, exit on failure. If msvc_arch is set, runs the command in a
shell with the msvc tools for that architecture."""
if msvc_arch and sys.platform == 'win32':
command = GetVSVersion().SetupScript(msvc_arch) + ['&&'] + command
# https://docs.python.org/2/library/subprocess.html:
# "On Unix with shell=True [...] if args is a sequence, the first item
# specifies the command string, and any additional items will be treated as
# additional arguments to the shell itself. That is to say, Popen does the
# equivalent of:
# Popen(['/bin/sh', '-c', args[0], args[1], ...])"
#
# We want to pass additional arguments to command[0], not to the shell,
# so manually join everything into a single string.
# Annoyingly, for "svn co url c:\path", pipes.quote() thinks that it should
# quote c:\path but svn can't handle quoted paths on Windows. Since on
# Windows follow-on args are passed to args[0] instead of the shell, don't
# do the single-string transformation there.
if sys.platform != 'win32':
command = ' '.join([pipes.quote(c) for c in command])
print 'Running', command
if subprocess.call(command, env=env, shell=True) == 0:
return True
print 'Failed.'
if fail_hard:
sys.exit(1)
return False
def CopyFile(src, dst):
"""Copy a file from src to dst."""
print "Copying %s to %s" % (src, dst)
shutil.copy(src, dst)
def CopyDirectoryContents(src, dst, filename_filter=None):
"""Copy the files from directory src to dst
with an optional filename filter."""
dst = os.path.realpath(dst) # realpath() in case dst ends in /..
EnsureDirExists(dst)
for root, _, files in os.walk(src):
for f in files:
if filename_filter and not re.match(filename_filter, f):
continue
CopyFile(os.path.join(root, f), dst)
def Checkout(name, url, dir):
"""Checkout the SVN module at url into dir. Use name for the log message."""
print "Checking out %s r%s into '%s'" % (name, CLANG_REVISION, dir)
command = ['svn', 'checkout', '--force', url + '@' + CLANG_REVISION, dir]
if RunCommand(command, fail_hard=False):
return
if os.path.isdir(dir):
print "Removing %s." % (dir)
RmTree(dir)
print "Retrying."
RunCommand(command)
def DeleteChromeToolsShim():
OLD_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'zzz-chrometools')
shutil.rmtree(OLD_SHIM_DIR, ignore_errors=True)
shutil.rmtree(CHROME_TOOLS_SHIM_DIR, ignore_errors=True)
def CreateChromeToolsShim():
"""Hooks the Chrome tools into the LLVM build.
Several Chrome tools have dependencies on LLVM/Clang libraries. The LLVM build
detects implicit tools in the tools subdirectory, so this helper install a
shim CMakeLists.txt that forwards to the real directory for the Chrome tools.
Note that the shim directory name intentionally has no - or _. The implicit
tool detection logic munges them in a weird way."""
assert not any(i in os.path.basename(CHROME_TOOLS_SHIM_DIR) for i in '-_')
os.mkdir(CHROME_TOOLS_SHIM_DIR)
with file(os.path.join(CHROME_TOOLS_SHIM_DIR, 'CMakeLists.txt'), 'w') as f:
f.write('# Automatically generated by tools/clang/scripts/update.py. ' +
'Do not edit.\n')
f.write('# Since tools/clang is located in another directory, use the \n')
f.write('# two arg version to specify where build artifacts go. CMake\n')
f.write('# disallows reuse of the same binary dir for multiple source\n')
f.write('# dirs, so the build artifacts need to go into a subdirectory.\n')
f.write('if (CHROMIUM_TOOLS_SRC)\n')
f.write(' add_subdirectory(${CHROMIUM_TOOLS_SRC} ' +
'${CMAKE_CURRENT_BINARY_DIR}/a)\n')
f.write('endif (CHROMIUM_TOOLS_SRC)\n')
def DownloadHostGcc(args):
"""Downloads gcc 4.8.5 and makes sure args.gcc_toolchain is set."""
if not sys.platform.startswith('linux') or args.gcc_toolchain:
return
gcc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gcc485precise')
if not os.path.exists(gcc_dir):
print 'Downloading pre-built GCC 4.8.5...'
DownloadAndUnpack(
CDS_URL + '/tools/gcc485precise.tgz', LLVM_BUILD_TOOLS_DIR)
args.gcc_toolchain = gcc_dir
def AddSvnToPathOnWin():
"""Download svn.exe and add it to PATH."""
if sys.platform != 'win32':
return
svn_ver = 'svn-1.6.6-win'
svn_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, svn_ver)
if not os.path.exists(svn_dir):
DownloadAndUnpack(CDS_URL + '/tools/%s.zip' % svn_ver, LLVM_BUILD_TOOLS_DIR)
os.environ['PATH'] = svn_dir + os.pathsep + os.environ.get('PATH', '')
def AddCMakeToPath():
"""Download CMake and add it to PATH."""
if sys.platform == 'win32':
zip_name = 'cmake-3.4.3-win32-x86.zip'
cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR,
'cmake-3.4.3-win32-x86', 'bin')
else:
suffix = 'Darwin' if sys.platform == 'darwin' else 'Linux'
zip_name = 'cmake343_%s.tgz' % suffix
cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'cmake343', 'bin')
if not os.path.exists(cmake_dir):
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '')
def AddGnuWinToPath():
"""Download some GNU win tools and add them to PATH."""
if sys.platform != 'win32':
return
gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin')
GNUWIN_VERSION = '7'
GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp')
if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION:
print 'GNU Win tools already up to date.'
else:
zip_name = 'gnuwin-%s.zip' % GNUWIN_VERSION
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
WriteStampFile(GNUWIN_VERSION, GNUWIN_STAMP)
os.environ['PATH'] = gnuwin_dir + os.pathsep + os.environ.get('PATH', '')
vs_version = None
def GetVSVersion():
global vs_version
if vs_version:
return vs_version
# Try using the toolchain in depot_tools.
# This sets environment variables used by SelectVisualStudioVersion below.
sys.path.append(os.path.join(CHROMIUM_DIR, 'build'))
import vs_toolchain
vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
# Use gyp to find the MSVS installation, either in depot_tools as per above,
# or a system-wide installation otherwise.
sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib'))
import gyp.MSVSVersion
vs_version = gyp.MSVSVersion.SelectVisualStudioVersion(
vs_toolchain.GetVisualStudioVersion())
return vs_version
def CopyDiaDllTo(target_dir):
# This script always wants to use the 64-bit msdia*.dll.
dia_path = os.path.join(GetVSVersion().Path(), 'DIA SDK', 'bin', 'amd64')
dia_dll = os.path.join(dia_path, DIA_DLL[GetVSVersion().ShortName()])
CopyFile(dia_dll, target_dir)
def VeryifyVersionOfBuiltClangMatchesVERSION():
"""Checks that `clang --version` outputs VERSION. If this fails, VERSION
in this file is out-of-date and needs to be updated (possibly in an
`if use_head_revision:` block in main() first)."""
clang = os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')
if sys.platform == 'win32':
# TODO: Parse `clang-cl /?` output for built clang's version and check that
# to check the binary we're actually shipping? But clang-cl.exe is just
# a copy of clang.exe, so this does check the same thing.
clang += '.exe'
version_out = subprocess.check_output([clang, '--version'])
version_out = re.match(r'clang version ([0-9.]+)', version_out).group(1)
if version_out != VERSION:
print ('unexpected clang version %s (not %s), update VERSION in update.py'
% (version_out, VERSION))
sys.exit(1)
def UpdateClang(args):
print 'Updating Clang to %s...' % PACKAGE_VERSION
if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build:
print 'Clang is already up to date.'
return 0
# Reset the stamp file in case the build is unsuccessful.
WriteStampFile('')
if not args.force_local_build:
cds_file = "clang-%s.tgz" % PACKAGE_VERSION
if sys.platform == 'win32' or sys.platform == 'cygwin':
cds_full_url = CDS_URL + '/Win/' + cds_file
elif sys.platform == 'darwin':
cds_full_url = CDS_URL + '/Mac/' + cds_file
else:
assert sys.platform.startswith('linux')
cds_full_url = CDS_URL + '/Linux_x64/' + cds_file
print 'Downloading prebuilt clang'
if os.path.exists(LLVM_BUILD_DIR):
RmTree(LLVM_BUILD_DIR)
try:
DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR)
print 'clang %s unpacked' % PACKAGE_VERSION
if sys.platform == 'win32':
CopyDiaDllTo(os.path.join(LLVM_BUILD_DIR, 'bin'))
WriteStampFile(PACKAGE_VERSION)
return 0
except urllib2.URLError:
print 'Failed to download prebuilt clang %s' % cds_file
print 'Use --force-local-build if you want to build locally.'
print 'Exiting.'
return 1
if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
print 'Android NDK not found at ' + ANDROID_NDK_DIR
print 'The Android NDK is needed to build a Clang whose -fsanitize=address'
print 'works on Android. See '
print 'https://www.chromium.org/developers/how-tos/android-build-instructions'
print 'for how to install the NDK, or pass --without-android.'
return 1
DownloadHostGcc(args)
if not IS_ARM64_HOST and not IS_ARMV7_HOST:
AddCMakeToPath()
AddGnuWinToPath()
DeleteChromeToolsShim()
Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR)
# Back out previous local patches. This needs to be kept around a bit
# until all bots have cycled. See https://crbug.com/755777.
files = [
'lib/Transforms/InstCombine/InstructionCombining.cpp',
'test/DebugInfo/X86/formal_parameter.ll',
'test/DebugInfo/X86/instcombine-instrinsics.ll',
'test/Transforms/InstCombine/debuginfo-skip.ll',
'test/Transforms/InstCombine/debuginfo.ll',
'test/Transforms/Util/simplify-dbg-declare-load.ll',
]
for f in [os.path.join(LLVM_DIR, f) for f in files]:
RunCommand(['svn', 'revert', f])
Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR)
if sys.platform != 'darwin':
Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR)
elif os.path.exists(LLD_DIR):
# In case someone sends a tryjob that temporary adds lld to the checkout,
# make sure it's not around on future builds.
RmTree(LLD_DIR)
Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR)
if sys.platform == 'darwin':
# clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
# (i.e. this is needed for bootstrap builds).
Checkout('libcxx', LLVM_REPO_URL + '/libcxx/trunk', LIBCXX_DIR)
# We used to check out libcxxabi on OS X; we no longer need that.
if os.path.exists(LIBCXXABI_DIR):
RmTree(LIBCXXABI_DIR)
cc, cxx = None, None
libstdcpp = None
if args.gcc_toolchain: # This option is only used on Linux.
# Use the specified gcc installation for building.
cc = os.path.join(args.gcc_toolchain, 'bin', 'gcc')
cxx = os.path.join(args.gcc_toolchain, 'bin', 'g++')
if not os.access(cc, os.X_OK):
print 'Invalid --gcc-toolchain: "%s"' % args.gcc_toolchain
print '"%s" does not appear to be valid.' % cc
return 1
# Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap
# compiler, etc.) find the .so.
libstdcpp = subprocess.check_output(
[cxx, '-print-file-name=libstdc++.so.6']).rstrip()
os.environ['LD_LIBRARY_PATH'] = os.path.dirname(libstdcpp)
cflags = []
cxxflags = []
ldflags = []
base_cmake_args = ['-GNinja',
'-DCMAKE_BUILD_TYPE=Release',
'-DLLVM_ENABLE_ASSERTIONS=ON',
# Statically link MSVCRT to avoid DLL dependencies.
'-DLLVM_USE_CRT_RELEASE=MT',
]
if args.bootstrap:
print 'Building bootstrap compiler'
EnsureDirExists(LLVM_BOOTSTRAP_DIR)
os.chdir(LLVM_BOOTSTRAP_DIR)
bootstrap_args = base_cmake_args + [
'-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64',
'-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR,
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
]
if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
RmCmakeCache('.')
RunCommand(['cmake'] + bootstrap_args + [LLVM_DIR], msvc_arch='x64')
RunCommand(['ninja'], msvc_arch='x64')
if args.run_tests:
if sys.platform == 'win32':
CopyDiaDllTo(os.path.join(LLVM_BOOTSTRAP_DIR, 'bin'))
RunCommand(['ninja', 'check-all'], msvc_arch='x64')
RunCommand(['ninja', 'install'], msvc_arch='x64')
if sys.platform == 'win32':
cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
# CMake has a hard time with backslashes in compiler paths:
# https://stackoverflow.com/questions/13050827
cc = cc.replace('\\', '/')
cxx = cxx.replace('\\', '/')
else:
cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang')
cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++')
if args.gcc_toolchain:
# Tell the bootstrap compiler to use a specific gcc prefix to search
# for standard library headers and shared object files.
cflags = ['--gcc-toolchain=' + args.gcc_toolchain]
cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain]
print 'Building final compiler'
# Build lld with LTO. That speeds up the linker by ~10%.
# We only use LTO for Linux now.
if args.bootstrap and args.lto_lld:
print 'Building LTO lld'
if os.path.exists(LLVM_LTO_LLD_DIR):
RmTree(LLVM_LTO_LLD_DIR)
EnsureDirExists(LLVM_LTO_LLD_DIR)
os.chdir(LLVM_LTO_LLD_DIR)
# The linker expects all archive members to have symbol tables, so the
# archiver needs to be able to create symbol tables for bitcode files.
# GNU ar and ranlib don't understand bitcode files, but llvm-ar and
# llvm-ranlib do, so use them.
ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar')
ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib')
lto_cmake_args = base_cmake_args + [
'-DCMAKE_C_COMPILER=' + cc,
'-DCMAKE_CXX_COMPILER=' + cxx,
'-DCMAKE_AR=' + ar,
'-DCMAKE_RANLIB=' + ranlib,
'-DLLVM_ENABLE_LTO=thin',
'-DLLVM_USE_LINKER=lld',
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)]
RmCmakeCache('.')
RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR])
RunCommand(['ninja', 'lld'])
# LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
# needed, on OS X it requires libc++. clang only automatically links to libc++
# when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run
# on OS X versions as old as 10.7.
deployment_target = ''
if sys.platform == 'darwin' and args.bootstrap:
# When building on 10.9, /usr/include usually doesn't exist, and while
# Xcode's clang automatically sets a sysroot, self-built clangs don't.
cflags = ['-isysroot', subprocess.check_output(
['xcrun', '--show-sdk-path']).rstrip()]
cxxflags = ['-stdlib=libc++'] + cflags
ldflags += ['-stdlib=libc++']
deployment_target = '10.7'
# Running libc++ tests takes a long time. Since it was only needed for
# the install step above, don't build it as part of the main build.
# This makes running package.py over 10% faster (30 min instead of 34 min)
RmTree(LIBCXX_DIR)
# Build clang.
# If building at head, define a macro that plugins can use for #ifdefing
# out code that builds at head, but not at CLANG_REVISION or vice versa.
if use_head_revision:
cflags += ['-DLLVM_FORCE_HEAD_REVISION']
cxxflags += ['-DLLVM_FORCE_HEAD_REVISION']
# Build PDBs for archival on Windows. Don't use RelWithDebInfo since it
# has different optimization defaults than Release.
if sys.platform == 'win32':
cflags += ['/Zi']
cxxflags += ['/Zi']
ldflags += ['/DEBUG', '/OPT:REF', '/OPT:ICF']
CreateChromeToolsShim()
deployment_env = None
if deployment_target:
deployment_env = os.environ.copy()
deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
cmake_args = []
# TODO(thakis): Unconditionally append this to base_cmake_args instead once
# compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698)
cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args
if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit']
chrome_tools = list(set(default_tools + args.extra_tools))
cmake_args += base_cmake_args + [
'-DLLVM_ENABLE_THREADS=OFF',
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
'-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags),
'-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags),
'-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags),
'-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
'-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
'-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
EnsureDirExists(LLVM_BUILD_DIR)
os.chdir(LLVM_BUILD_DIR)
RmCmakeCache('.')
RunCommand(['cmake'] + cmake_args + [LLVM_DIR],
msvc_arch='x64', env=deployment_env)
RunCommand(['ninja'], msvc_arch='x64')
# Copy LTO-optimized lld, if any.
if args.bootstrap and args.lto_lld:
CopyFile(os.path.join(LLVM_LTO_LLD_DIR, 'bin', 'lld'),
os.path.join(LLVM_BUILD_DIR, 'bin'))
if chrome_tools:
# If any Chromium tools were built, install those now.
RunCommand(['ninja', 'cr-install'], msvc_arch='x64')
if sys.platform == 'darwin':
# See http://crbug.com/256342
RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
elif sys.platform.startswith('linux'):
RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
VeryifyVersionOfBuiltClangMatchesVERSION()
# Do an out-of-tree build of compiler-rt.
# On Windows, this is used to get the 32-bit ASan run-time.
# TODO(hans): Remove once the regular build above produces this.
# On Mac and Linux, this is used to get the regular 64-bit run-time.
# Do a clobbered build due to cmake changes.
if os.path.isdir(COMPILER_RT_BUILD_DIR):
RmTree(COMPILER_RT_BUILD_DIR)
os.makedirs(COMPILER_RT_BUILD_DIR)
os.chdir(COMPILER_RT_BUILD_DIR)
# TODO(thakis): Add this once compiler-rt can build with clang-cl (see
# above).
#if args.bootstrap and sys.platform == 'win32':
# The bootstrap compiler produces 64-bit binaries by default.
#cflags += ['-m32']
#cxxflags += ['-m32']
compiler_rt_args = base_cmake_args + [
'-DLLVM_ENABLE_THREADS=OFF',
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)]
if sys.platform == 'darwin':
compiler_rt_args += ['-DCOMPILER_RT_ENABLE_IOS=ON']
if sys.platform != 'win32':
compiler_rt_args += ['-DLLVM_CONFIG_PATH=' +
os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'),
'-DSANITIZER_MIN_OSX_VERSION="10.7"']
# compiler-rt is part of the llvm checkout on Windows but a stand-alone
# directory elsewhere, see the TODO above COMPILER_RT_DIR.
RmCmakeCache('.')
RunCommand(['cmake'] + compiler_rt_args +
[LLVM_DIR if sys.platform == 'win32' else COMPILER_RT_DIR],
msvc_arch='x86', env=deployment_env)
RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86')
# Copy select output to the main tree.
# TODO(hans): Make this (and the .gypi and .isolate files) version number
# independent.
if sys.platform == 'win32':
platform = 'windows'
elif sys.platform == 'darwin':
platform = 'darwin'
else:
assert sys.platform.startswith('linux')
platform = 'linux'
asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', platform)
if sys.platform == 'win32':
# TODO(thakis): This too is due to compiler-rt being part of the checkout
# on Windows, see TODO above COMPILER_RT_DIR.
asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang',
VERSION, 'lib', platform)
asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
VERSION, 'lib', platform)
# Blacklists:
CopyDirectoryContents(os.path.join(asan_rt_lib_src_dir, '..', '..'),
os.path.join(asan_rt_lib_dst_dir, '..', '..'),
r'^.*blacklist\.txt$')
# Headers:
if sys.platform != 'win32':
CopyDirectoryContents(
os.path.join(COMPILER_RT_BUILD_DIR, 'include/sanitizer'),
os.path.join(LLVM_BUILD_DIR, 'lib/clang', VERSION, 'include/sanitizer'))
# Static and dynamic libraries:
CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir)
if sys.platform == 'darwin':
for dylib in glob.glob(os.path.join(asan_rt_lib_dst_dir, '*.dylib')):
# Fix LC_ID_DYLIB for the ASan dynamic libraries to be relative to
# @executable_path.
# TODO(glider): this is transitional. We'll need to fix the dylib
# name either in our build system, or in Clang. See also
# http://crbug.com/344836.
subprocess.call(['install_name_tool', '-id',
'@executable_path/' + os.path.basename(dylib), dylib])
if args.with_android:
make_toolchain = os.path.join(
ANDROID_NDK_DIR, 'build', 'tools', 'make_standalone_toolchain.py')
for target_arch in ['aarch64', 'arm', 'i686']:
# Make standalone Android toolchain for target_arch.
toolchain_dir = os.path.join(
LLVM_BUILD_DIR, 'android-toolchain-' + target_arch)
RunCommand([
make_toolchain,
'--api=' + ('21' if target_arch == 'aarch64' else '19'),
'--force',
'--install-dir=%s' % toolchain_dir,
'--stl=stlport',
'--arch=' + {
'aarch64': 'arm64',
'arm': 'arm',
'i686': 'x86',
}[target_arch]])
# Android NDK r9d copies a broken unwind.h into the toolchain, see
# http://crbug.com/357890
for f in glob.glob(os.path.join(toolchain_dir, 'include/c++/*/unwind.h')):
os.remove(f)
# Build ASan runtime for Android in a separate build tree.
build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch)
if not os.path.exists(build_dir):
os.mkdir(os.path.join(build_dir))
os.chdir(build_dir)
cflags = ['--target=%s-linux-androideabi' % target_arch,
'--sysroot=%s/sysroot' % toolchain_dir,
'-B%s' % toolchain_dir]
android_args = base_cmake_args + [
'-DLLVM_ENABLE_THREADS=OFF',
'-DCMAKE_C_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'),
'-DCMAKE_CXX_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang++'),
'-DLLVM_CONFIG_PATH=' + os.path.join(LLVM_BUILD_DIR, 'bin/llvm-config'),
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cflags),
'-DANDROID=1']
RmCmakeCache('.')
RunCommand(['cmake'] + android_args + [COMPILER_RT_DIR])
RunCommand(['ninja', 'libclang_rt.asan-%s-android.so' % target_arch])
# And copy it into the main build tree.
runtime = 'libclang_rt.asan-%s-android.so' % target_arch
for root, _, files in os.walk(build_dir):
if runtime in files:
shutil.copy(os.path.join(root, runtime), asan_rt_lib_dst_dir)
# Run tests.
if args.run_tests or use_head_revision:
os.chdir(LLVM_BUILD_DIR)
RunCommand(['ninja', 'cr-check-all'], msvc_arch='x64')
if args.run_tests:
if sys.platform == 'win32':
CopyDiaDllTo(os.path.join(LLVM_BUILD_DIR, 'bin'))
os.chdir(LLVM_BUILD_DIR)
RunCommand(['ninja', 'check-all'], msvc_arch='x64')
WriteStampFile(PACKAGE_VERSION)
print 'Clang update was successful.'
return 0
def main():
parser = argparse.ArgumentParser(description='Build Clang.')
parser.add_argument('--bootstrap', action='store_true',
help='first build clang with CC, then with itself.')
parser.add_argument('--if-needed', action='store_true',
help="run only if the script thinks clang is needed")
parser.add_argument('--force-local-build', action='store_true',
help="don't try to download prebuild binaries")
parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
'version be used for building; --gcc-toolchain=/opt/foo '
'picks /opt/foo/bin/gcc')
parser.add_argument('--lto-lld', action='store_true',
help='build lld with LTO')
parser.add_argument('--llvm-force-head-revision', action='store_true',
help=('use the revision in the repo when printing '
'the revision'))
parser.add_argument('--print-revision', action='store_true',
help='print current clang revision and exit.')
parser.add_argument('--print-clang-version', action='store_true',
help='print current clang version (e.g. x.y.z) and exit.')
parser.add_argument('--run-tests', action='store_true',
help='run tests after building; only for local builds')
parser.add_argument('--extra-tools', nargs='*', default=[],
help='select additional chrome tools to build')
parser.add_argument('--without-android', action='store_false',
help='don\'t build Android ASan runtime (linux only)',
dest='with_android',
default=sys.platform.startswith('linux'))
parser.add_argument('--clang-revision', help='Clang revision to build')
parser.add_argument('--clang-sub-revision',
help='Clang sub revision to build')
args = parser.parse_args()
if args.lto_lld and not args.bootstrap:
print '--lto-lld requires --bootstrap'
return 1
if args.lto_lld and not sys.platform.startswith('linux'):
print '--lto-lld is only effective on Linux. Ignoring the option.'
args.lto_lld = False
if args.if_needed:
# TODO(thakis): Can probably remove this and --if-needed altogether.
if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
return 0
# Get svn if we're going to use it to check the revision or do a local build.
if (use_head_revision or args.llvm_force_head_revision or
args.force_local_build):
AddSvnToPathOnWin()
global CLANG_REVISION, PACKAGE_VERSION
CLANG_REVISION = args.clang_revision
PACKAGE_VERSION = "%s-%s" % (args.clang_revision, args.clang_sub_revision)
if args.print_revision:
if use_head_revision or args.llvm_force_head_revision:
print GetSvnRevision(LLVM_DIR)
else:
print PACKAGE_VERSION
return 0
if args.print_clang_version:
sys.stdout.write(VERSION)
return 0
# Don't buffer stdout, so that print statements are immediately flushed.
# Do this only after --print-revision has been handled, else we'll get
# an error message when this script is run from gn for some reason.
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
if use_head_revision:
# Use a real revision number rather than HEAD to make sure that the stamp
# file logic works.
CLANG_REVISION = GetSvnRevision(LLVM_REPO_URL)
PACKAGE_VERSION = CLANG_REVISION + '-0'
args.force_local_build = True
if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
# Only build the Android ASan rt on ToT bots when targetting Android.
args.with_android = False
return UpdateClang(args)
if __name__ == '__main__':
sys.exit(main())
| mit |
SPKian/Testing | erpnext/patches/v5_4/notify_system_managers_regarding_wrong_tax_calculation.py | 45 | 1433 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.email import sendmail_to_system_managers
from frappe.utils import get_link_to_form
def execute():
wrong_records = []
for dt in ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice",
"Purchase Order", "Purchase Receipt", "Purchase Invoice"):
records = frappe.db.sql_list("""select name from `tab{0}`
where apply_discount_on = 'Net Total' and ifnull(discount_amount, 0) != 0
and modified >= '2015-02-17' and docstatus=1""".format(dt))
if records:
records = [get_link_to_form(dt, d) for d in records]
wrong_records.append([dt, records])
if wrong_records:
content = """Dear System Manager,
Due to an error related to Discount Amount on Net Total, tax calculation might be wrong in the following records. We did not fix the tax amount automatically because it can corrupt the entries, so we request you to check these records and amend if you found the calculation wrong.
Please check following Entries:
%s
Regards,
Administrator""" % "\n".join([(d[0] + ": " + ", ".join(d[1])) for d in wrong_records])
try:
sendmail_to_system_managers("[Important] [ERPNext] Tax calculation might be wrong, please check.", content)
except:
pass
print "="*50
print content
print "="*50 | agpl-3.0 |
Glasgow2015/team-10 | env/lib/python2.7/site-packages/cms/test_utils/project/pluginapp/plugins/meta/migrations/0001_initial.py | 66 | 1385 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='TestPluginModel',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, to='cms.CMSPlugin', auto_created=True, parent_link=True, serialize=False)),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
migrations.CreateModel(
name='TestPluginModel2',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, to='cms.CMSPlugin', auto_created=True, parent_link=True, serialize=False)),
],
options={
'db_table': 'meta_testpluginmodel2',
},
bases=('cms.cmsplugin',),
),
migrations.CreateModel(
name='TestPluginModel4',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, to='cms.CMSPlugin', auto_created=True, parent_link=True, serialize=False)),
],
options={
'db_table': 'or_another_4',
},
bases=('cms.cmsplugin',),
),
]
| apache-2.0 |
Abjad/abjad | abjad/indicators/StartPianoPedal.py | 1 | 6151 | import typing
from ..bundle import LilyPondFormatBundle
from ..overrides import TweakInterface
from ..storage import StorageFormatManager
class StartPianoPedal:
r"""
LilyPond ``\sustainOn``, ``\sostenutoOn``, ``\unaCorda`` commands.
.. container:: example
>>> staff = abjad.Staff("c'4 d' e' r")
>>> start_piano_pedal = abjad.StartPianoPedal()
>>> abjad.tweak(start_piano_pedal).color = "#blue"
>>> abjad.tweak(start_piano_pedal).parent_alignment_X = abjad.Center
>>> abjad.attach(start_piano_pedal, staff[0])
>>> stop_piano_pedal = abjad.StopPianoPedal()
>>> abjad.attach(stop_piano_pedal, staff[1])
>>> start_piano_pedal = abjad.StartPianoPedal()
>>> abjad.tweak(start_piano_pedal).color = "#red"
>>> abjad.attach(start_piano_pedal, staff[1])
>>> stop_piano_pedal = abjad.StopPianoPedal()
>>> abjad.attach(stop_piano_pedal, staff[2])
>>> start_piano_pedal = abjad.StartPianoPedal()
>>> abjad.tweak(start_piano_pedal).color = "#green"
>>> abjad.attach(start_piano_pedal, staff[2])
>>> stop_piano_pedal = abjad.StopPianoPedal()
>>> abjad.attach(stop_piano_pedal, staff[3])
>>> abjad.override(staff).SustainPedalLineSpanner.staff_padding = 5
>>> abjad.setting(staff).pedalSustainStyle = "#'mixed"
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> string = abjad.lilypond(staff)
>>> print(string)
\new Staff
\with
{
\override SustainPedalLineSpanner.staff-padding = 5
pedalSustainStyle = #'mixed
}
{
c'4
- \tweak color #blue
- \tweak parent-alignment-X #center
\sustainOn
d'4
\sustainOff
- \tweak color #red
\sustainOn
e'4
\sustainOff
- \tweak color #green
\sustainOn
r4
\sustainOff
}
"""
### CLASS VARIABLES ###
__slots__ = ("_kind", "_tweaks")
_context = "StaffGroup"
_persistent = True
_parameter = "PEDAL"
### INITIALIZER ###
def __init__(self, kind: str = None, *, tweaks: TweakInterface = None) -> None:
if kind is not None:
assert kind in ("sustain", "sostenuto", "corda")
self._kind = kind
if tweaks is not None:
assert isinstance(tweaks, TweakInterface), repr(tweaks)
self._tweaks = TweakInterface.set_tweaks(self, tweaks)
### SPECIAL METHODS ###
def __eq__(self, argument) -> bool:
"""
Is true when all initialization values of Abjad value object equal
the initialization values of ``argument``.
"""
return StorageFormatManager.compare_objects(self, argument)
def __hash__(self) -> int:
"""
Hashes Abjad value object.
"""
hash_values = StorageFormatManager(self).get_hash_values()
try:
result = hash(hash_values)
except TypeError:
raise TypeError(f"unhashable type: {self}")
return result
def __repr__(self) -> str:
"""
Gets interpreter representation.
"""
return StorageFormatManager(self).get_repr_format()
### PRIVATE METHODS ###
def _get_lilypond_format_bundle(self, component=None):
bundle = LilyPondFormatBundle()
if self.tweaks:
tweaks = self.tweaks._list_format_contributions()
bundle.after.spanner_starts.extend(tweaks)
if self.kind == "corda":
string = r"\unaCorda"
elif self.kind == "sostenuto":
string = r"\sostenutoOn"
else:
assert self.kind in ("sustain", None)
string = r"\sustainOn"
bundle.after.spanner_starts.append(string)
return bundle
### PUBLIC PROPERTIES ###
@property
def context(self) -> str:
"""
Returns (historically conventional) context ``'StaffGroup'``.
.. container:: example
>>> abjad.StartPianoPedal().context
'StaffGroup'
Class constant.
Override with ``abjad.attach(..., context='...')``.
"""
return self._context
@property
def kind(self) -> typing.Optional[str]:
"""
Gets kind.
"""
return self._kind
@property
def parameter(self) -> str:
"""
Returns ``'PEDAL'``.
.. container:: example
>>> abjad.StartPianoPedal().parameter
'PEDAL'
Class constant.
"""
return self._parameter
@property
def persistent(self) -> bool:
"""
Is true.
.. container:: example
>>> abjad.StartPianoPedal().persistent
True
Class constant.
"""
return self._persistent
@property
def spanner_start(self) -> bool:
"""
Is true.
.. container:: example
>>> abjad.StartPianoPedal().spanner_start
True
"""
return True
@property
def tweaks(self) -> typing.Optional[TweakInterface]:
r"""
Gets tweaks
.. container:: example
REGRESSION. Tweaks survive copy:
>>> import copy
>>> start_piano_pedal = abjad.StartPianoPedal()
>>> abjad.tweak(start_piano_pedal).color = "#blue"
>>> string = abjad.storage(start_piano_pedal)
>>> print(string)
abjad.StartPianoPedal(
tweaks=TweakInterface(('_literal', None), ('color', '#blue')),
)
>>> start_piano_pedal_2 = copy.copy(start_piano_pedal)
>>> string = abjad.storage(start_piano_pedal_2)
>>> print(string)
abjad.StartPianoPedal(
tweaks=TweakInterface(('_literal', None), ('color', '#blue')),
)
"""
return self._tweaks
| gpl-3.0 |
redhat-openstack/nova | nova/consoleauth/manager.py | 12 | 5289 | #!/usr/bin/env python
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# 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.
"""Auth Components for Consoles."""
import time
from oslo.config import cfg
from oslo import messaging
from nova.cells import rpcapi as cells_rpcapi
from nova.compute import rpcapi as compute_rpcapi
from nova.i18n import _, _LW
from nova import manager
from nova import objects
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
LOG = logging.getLogger(__name__)
consoleauth_opts = [
cfg.IntOpt('console_token_ttl',
default=600,
help='How many seconds before deleting tokens')
]
CONF = cfg.CONF
CONF.register_opts(consoleauth_opts)
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
class ConsoleAuthManager(manager.Manager):
"""Manages token based authentication."""
target = messaging.Target(version='2.0')
def __init__(self, scheduler_driver=None, *args, **kwargs):
super(ConsoleAuthManager, self).__init__(service_name='consoleauth',
*args, **kwargs)
self.mc = memorycache.get_client()
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
self.cells_rpcapi = cells_rpcapi.CellsAPI()
def _get_tokens_for_instance(self, instance_uuid):
tokens_str = self.mc.get(instance_uuid.encode('UTF-8'))
if not tokens_str:
tokens = []
else:
tokens = jsonutils.loads(tokens_str)
return tokens
def authorize_console(self, context, token, console_type, host, port,
internal_access_path, instance_uuid):
token_dict = {'token': token,
'instance_uuid': instance_uuid,
'console_type': console_type,
'host': host,
'port': port,
'internal_access_path': internal_access_path,
'last_activity_at': time.time()}
data = jsonutils.dumps(token_dict)
# We need to log the warning message if the token is not cached
# successfully, because the failure will cause the console for
# instance to not be usable.
if not self.mc.set(token.encode('UTF-8'),
data, CONF.console_token_ttl):
LOG.warning(_LW("Token: %(token)s failed to save into memcached."),
{'token': token})
tokens = self._get_tokens_for_instance(instance_uuid)
# Remove the expired tokens from cache.
for tok in tokens:
token_str = self.mc.get(tok.encode('UTF-8'))
if not token_str:
tokens.remove(tok)
tokens.append(token)
if not self.mc.set(instance_uuid.encode('UTF-8'),
jsonutils.dumps(tokens)):
LOG.warning(_LW("Instance: %(instance_uuid)s failed to save "
"into memcached"),
{'instance_uuid': instance_uuid})
LOG.audit(_("Received Token: %(token)s, %(token_dict)s"),
{'token': token, 'token_dict': token_dict})
def _validate_token(self, context, token):
instance_uuid = token['instance_uuid']
if instance_uuid is None:
return False
# NOTE(comstud): consoleauth was meant to run in API cells. So,
# if cells is enabled, we must call down to the child cell for
# the instance.
if CONF.cells.enable:
return self.cells_rpcapi.validate_console_port(context,
instance_uuid, token['port'], token['console_type'])
instance = objects.Instance.get_by_uuid(context, instance_uuid)
return self.compute_rpcapi.validate_console_port(context,
instance,
token['port'],
token['console_type'])
def check_token(self, context, token):
token_str = self.mc.get(token.encode('UTF-8'))
token_valid = (token_str is not None)
LOG.audit(_("Checking Token: %(token)s, %(token_valid)s"),
{'token': token, 'token_valid': token_valid})
if token_valid:
token = jsonutils.loads(token_str)
if self._validate_token(context, token):
return token
def delete_tokens_for_instance(self, context, instance_uuid):
tokens = self._get_tokens_for_instance(instance_uuid)
for token in tokens:
self.mc.delete(token.encode('UTF-8'))
self.mc.delete(instance_uuid.encode('UTF-8'))
| apache-2.0 |
Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/site-packages/numpy/ma/tests/test_subclassing.py | 36 | 6334 | # pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
__author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)"
__version__ = '1.0'
__revision__ = "$Revision: 3473 $"
__date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $'
import numpy as np
from numpy.testing import *
from numpy.ma.testutils import *
from numpy.ma.core import *
class SubArray(np.ndarray):
"""Defines a generic np.ndarray subclass, that stores some metadata
in the dictionary `info`."""
def __new__(cls,arr,info={}):
x = np.asanyarray(arr).view(cls)
x.info = info
return x
def __array_finalize__(self, obj):
self.info = getattr(obj,'info',{})
return
def __add__(self, other):
result = np.ndarray.__add__(self, other)
result.info.update({'added':result.info.pop('added',0)+1})
return result
subarray = SubArray
class MSubArray(SubArray,MaskedArray):
def __new__(cls, data, info={}, mask=nomask):
subarr = SubArray(data, info)
_data = MaskedArray.__new__(cls, data=subarr, mask=mask)
_data.info = subarr.info
return _data
def __array_finalize__(self,obj):
MaskedArray.__array_finalize__(self,obj)
SubArray.__array_finalize__(self, obj)
return
def _get_series(self):
_view = self.view(MaskedArray)
_view._sharedmask = False
return _view
_series = property(fget=_get_series)
msubarray = MSubArray
class MMatrix(MaskedArray, np.matrix,):
def __new__(cls, data, mask=nomask):
mat = np.matrix(data)
_data = MaskedArray.__new__(cls, data=mat, mask=mask)
return _data
def __array_finalize__(self,obj):
np.matrix.__array_finalize__(self, obj)
MaskedArray.__array_finalize__(self,obj)
return
def _get_series(self):
_view = self.view(MaskedArray)
_view._sharedmask = False
return _view
_series = property(fget=_get_series)
mmatrix = MMatrix
class TestSubclassing(TestCase):
"""Test suite for masked subclasses of ndarray."""
def setUp(self):
x = np.arange(5)
mx = mmatrix(x, mask=[0, 1, 0, 0, 0])
self.data = (x, mx)
def test_data_subclassing(self):
"Tests whether the subclass is kept."
x = np.arange(5)
m = [0,0,1,0,0]
xsub = SubArray(x)
xmsub = masked_array(xsub, mask=m)
self.assertTrue(isinstance(xmsub, MaskedArray))
assert_equal(xmsub._data, xsub)
self.assertTrue(isinstance(xmsub._data, SubArray))
def test_maskedarray_subclassing(self):
"Tests subclassing MaskedArray"
(x, mx) = self.data
self.assertTrue(isinstance(mx._data, np.matrix))
def test_masked_unary_operations(self):
"Tests masked_unary_operation"
(x, mx) = self.data
olderr = np.seterr(divide='ignore')
try:
self.assertTrue(isinstance(log(mx), mmatrix))
assert_equal(log(x), np.log(x))
finally:
np.seterr(**olderr)
def test_masked_binary_operations(self):
"Tests masked_binary_operation"
(x, mx) = self.data
# Result should be a mmatrix
self.assertTrue(isinstance(add(mx,mx), mmatrix))
self.assertTrue(isinstance(add(mx,x), mmatrix))
# Result should work
assert_equal(add(mx,x), mx+x)
self.assertTrue(isinstance(add(mx,mx)._data, np.matrix))
self.assertTrue(isinstance(add.outer(mx,mx), mmatrix))
self.assertTrue(isinstance(hypot(mx,mx), mmatrix))
self.assertTrue(isinstance(hypot(mx,x), mmatrix))
def test_masked_binary_operations(self):
"Tests domained_masked_binary_operation"
(x, mx) = self.data
xmx = masked_array(mx.data.__array__(), mask=mx.mask)
self.assertTrue(isinstance(divide(mx,mx), mmatrix))
self.assertTrue(isinstance(divide(mx,x), mmatrix))
assert_equal(divide(mx, mx), divide(xmx, xmx))
def test_attributepropagation(self):
x = array(arange(5), mask=[0]+[1]*4)
my = masked_array(subarray(x))
ym = msubarray(x)
#
z = (my+1)
self.assertTrue(isinstance(z,MaskedArray))
self.assertTrue(not isinstance(z, MSubArray))
self.assertTrue(isinstance(z._data, SubArray))
assert_equal(z._data.info, {})
#
z = (ym+1)
self.assertTrue(isinstance(z, MaskedArray))
self.assertTrue(isinstance(z, MSubArray))
self.assertTrue(isinstance(z._data, SubArray))
self.assertTrue(z._data.info['added'] > 0)
#
ym._set_mask([1,0,0,0,1])
assert_equal(ym._mask, [1,0,0,0,1])
ym._series._set_mask([0,0,0,0,1])
assert_equal(ym._mask, [0,0,0,0,1])
#
xsub = subarray(x, info={'name':'x'})
mxsub = masked_array(xsub)
self.assertTrue(hasattr(mxsub, 'info'))
assert_equal(mxsub.info, xsub.info)
def test_subclasspreservation(self):
"Checks that masked_array(...,subok=True) preserves the class."
x = np.arange(5)
m = [0,0,1,0,0]
xinfo = [(i,j) for (i,j) in zip(x,m)]
xsub = MSubArray(x, mask=m, info={'xsub':xinfo})
#
mxsub = masked_array(xsub, subok=False)
self.assertTrue(not isinstance(mxsub, MSubArray))
self.assertTrue(isinstance(mxsub, MaskedArray))
assert_equal(mxsub._mask, m)
#
mxsub = asarray(xsub)
self.assertTrue(not isinstance(mxsub, MSubArray))
self.assertTrue(isinstance(mxsub, MaskedArray))
assert_equal(mxsub._mask, m)
#
mxsub = masked_array(xsub, subok=True)
self.assertTrue(isinstance(mxsub, MSubArray))
assert_equal(mxsub.info, xsub.info)
assert_equal(mxsub._mask, xsub._mask)
#
mxsub = asanyarray(xsub)
self.assertTrue(isinstance(mxsub, MSubArray))
assert_equal(mxsub.info, xsub.info)
assert_equal(mxsub._mask, m)
################################################################################
if __name__ == '__main__':
run_module_suite()
| mit |
piffey/ansible | test/units/modules/network/edgeos/test_edgeos_config.py | 40 | 3747 | #
# (c) 2018 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.edgeos import edgeos_config
from units.modules.utils import set_module_args
from .edgeos_module import TestEdgeosModule, load_fixture
class TestEdgeosConfigModule(TestEdgeosModule):
module = edgeos_config
def setUp(self):
super(TestEdgeosConfigModule, self).setUp()
self.mock_get_config = patch('ansible.modules.network.edgeos.edgeos_config.get_config')
self.get_config = self.mock_get_config.start()
self.mock_load_config = patch('ansible.modules.network.edgeos.edgeos_config.load_config')
self.load_config = self.mock_load_config.start()
self.mock_run_commands = patch('ansible.modules.network.edgeos.edgeos_config.run_commands')
self.run_commands = self.mock_run_commands.start()
def tearDown(self):
super(TestEdgeosConfigModule, self).tearDown()
self.mock_get_config.stop()
self.mock_load_config.stop()
self.mock_run_commands.stop()
def load_fixtures(self, commands=None):
config_file = 'edgeos_config_config.cfg'
self.get_config.return_value = load_fixture(config_file)
self.load_config.return_value = None
def test_edgeos_config_unchanged(self):
src = load_fixture('edgeos_config_config.cfg')
set_module_args(dict(src=src))
self.execute_module()
def test_edgeos_config_src(self):
src = load_fixture('edgeos_config_src.cfg')
set_module_args(dict(src=src))
commands = ['set system host-name er01', 'delete interfaces ethernet eth0 address']
self.execute_module(changed=True, commands=commands)
def test_edgeos_config_src_brackets(self):
src = load_fixture('edgeos_config_src_brackets.cfg')
set_module_args(dict(src=src))
commands = ['set interfaces ethernet eth0 address 10.10.10.10/24', 'set system host-name er01']
self.execute_module(changed=True, commands=commands)
def test_edgeos_config_backup(self):
set_module_args(dict(backup=True))
result = self.execute_module()
self.assertIn('__backup__', result)
def test_edgeos_config_lines(self):
commands = ['set system host-name er01']
set_module_args(dict(lines=commands))
self.execute_module(changed=True, commands=commands)
def test_edgeos_config_config(self):
config = 'set system host-name localhost'
new_config = ['set system host-name er01']
set_module_args(dict(lines=new_config, config=config))
self.execute_module(changed=True, commands=new_config)
def test_edgeos_config_match_none(self):
lines = ['set system interfaces ethernet eth0 address 1.2.3.4/24',
'set system interfaces ethernet eth0 description Outside']
set_module_args(dict(lines=lines, match='none'))
self.execute_module(changed=True, commands=lines, sort=False)
| gpl-3.0 |
jcoady9/python-for-android | python-modules/twisted/twisted/scripts/tap2rpm.py | 56 | 9049 | # -*- test-case-name: twisted.scripts.test.test_tap2rpm -*-
# Copyright (c) 2003-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
import sys, os, shutil, time, glob
import subprocess
import tempfile
import tarfile
from StringIO import StringIO
from twisted.python import usage, log
#################################
# data that goes in /etc/inittab
initFileData = '''\
#!/bin/sh
#
# Startup script for a Twisted service.
#
# chkconfig: - 85 15
# description: Start-up script for the Twisted service "%(tap_file)s".
PATH=/usr/bin:/bin:/usr/sbin:/sbin
pidfile=/var/run/%(rpm_file)s.pid
rundir=/var/lib/twisted-taps/%(rpm_file)s/
file=/etc/twisted-taps/%(tap_file)s
logfile=/var/log/%(rpm_file)s.log
# load init function library
. /etc/init.d/functions
[ -r /etc/default/%(rpm_file)s ] && . /etc/default/%(rpm_file)s
# check for required files
if [ ! -x /usr/bin/twistd ]
then
echo "$0: Aborting, no /usr/bin/twistd found"
exit 0
fi
if [ ! -r "$file" ]
then
echo "$0: Aborting, no file $file found."
exit 0
fi
# set up run directory if necessary
if [ ! -d "${rundir}" ]
then
mkdir -p "${rundir}"
fi
case "$1" in
start)
echo -n "Starting %(rpm_file)s: twistd"
daemon twistd \\
--pidfile=$pidfile \\
--rundir=$rundir \\
--%(twistd_option)s=$file \\
--logfile=$logfile
status %(rpm_file)s
;;
stop)
echo -n "Stopping %(rpm_file)s: twistd"
kill `cat "${pidfile}"`
status %(rpm_file)s
;;
restart)
"${0}" stop
"${0}" start
;;
*)
echo "Usage: ${0} {start|stop|restart|}" >&2
exit 1
;;
esac
exit 0
'''
#######################################
# the data for creating the spec file
specFileData = '''\
Summary: %(description)s
Name: %(rpm_file)s
Version: %(version)s
Release: 1
License: Unknown
Group: Networking/Daemons
Source: %(tarfile_basename)s
BuildRoot: %%{_tmppath}/%%{name}-%%{version}-root
Requires: /usr/bin/twistd
BuildArch: noarch
%%description
%(long_description)s
%%prep
%%setup
%%build
%%install
[ ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != '/' ] \
&& rm -rf "$RPM_BUILD_ROOT"
mkdir -p "$RPM_BUILD_ROOT"/etc/twisted-taps
mkdir -p "$RPM_BUILD_ROOT"/etc/init.d
mkdir -p "$RPM_BUILD_ROOT"/var/lib/twisted-taps
cp "%(tap_file)s" "$RPM_BUILD_ROOT"/etc/twisted-taps/
cp "%(rpm_file)s.init" "$RPM_BUILD_ROOT"/etc/init.d/"%(rpm_file)s"
%%clean
[ ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != '/' ] \
&& rm -rf "$RPM_BUILD_ROOT"
%%post
/sbin/chkconfig --add %(rpm_file)s
/sbin/chkconfig --level 35 %(rpm_file)s
/etc/init.d/%(rpm_file)s start
%%preun
/etc/init.d/%(rpm_file)s stop
/sbin/chkconfig --del %(rpm_file)s
%%files
%%defattr(-,root,root)
%%attr(0755,root,root) /etc/init.d/%(rpm_file)s
%%attr(0660,root,root) /etc/twisted-taps/%(tap_file)s
%%changelog
* %(date)s %(maintainer)s
- Created by tap2rpm: %(rpm_file)s (%(version)s)
'''
###############################
class MyOptions(usage.Options):
optFlags = [["unsigned", "u"], ['quiet', 'q']]
optParameters = [
["tapfile", "t", "twistd.tap"],
["maintainer", "m", "tap2rpm"],
["protocol", "p", None],
["description", "e", None],
["long_description", "l",
"Automatically created by tap2rpm"],
["set-version", "V", "1.0"],
["rpmfile", "r", None],
["type", "y", "tap", "type of configuration: 'tap', 'xml, "
"'source' or 'python'"],
]
#zsh_altArgDescr = {"foo":"use this description for foo instead"}
#zsh_multiUse = ["foo", "bar"]
#zsh_mutuallyExclusive = [("foo", "bar"), ("bar", "baz")]
zsh_actions = {"type":"(tap xml source python)",
"rpmfile":'_files -g "*.rpm"'}
#zsh_actionDescr = {"logfile":"log file name", "random":"random seed"}
def postOptions(self):
"""
Calculate the default values for certain command-line options.
"""
# Options whose defaults depend on other parameters.
if self['protocol'] is None:
base_tapfile = os.path.basename(self['tapfile'])
self['protocol'] = os.path.splitext(base_tapfile)[0]
if self['description'] is None:
self['description'] = "A TCP server for %s" % (self['protocol'],)
if self['rpmfile'] is None:
self['rpmfile'] = 'twisted-%s' % (self['protocol'],)
# Values that aren't options, but are calculated from options and are
# handy to have around.
self['twistd_option'] = type_dict[self['type']]
self['release-name'] = '%s-%s' % (self['rpmfile'], self['set-version'])
type_dict = {
'tap': 'file',
'python': 'python',
'source': 'source',
'xml': 'xml',
}
##########################
def makeBuildDir():
"""
Set up the temporary directory for building RPMs.
Returns: buildDir, a randomly-named subdirectory of baseDir.
"""
tmpDir = tempfile.mkdtemp()
# set up initial directory contents
os.makedirs(os.path.join(tmpDir, 'RPMS', 'noarch'))
os.makedirs(os.path.join(tmpDir, 'SPECS'))
os.makedirs(os.path.join(tmpDir, 'BUILD'))
os.makedirs(os.path.join(tmpDir, 'SOURCES'))
os.makedirs(os.path.join(tmpDir, 'SRPMS'))
log.msg(format="Created RPM build structure in %(path)r",
path=tmpDir)
return tmpDir
def setupBuildFiles(buildDir, config):
"""
Create files required to build an RPM in the build directory.
"""
# Create the source tarball in the SOURCES directory.
tarballName = "%s.tar" % (config['release-name'],)
tarballPath = os.path.join(buildDir, "SOURCES", tarballName)
tarballHandle = tarfile.open(tarballPath, "w")
sourceDirInfo = tarfile.TarInfo(config['release-name'])
sourceDirInfo.type = tarfile.DIRTYPE
sourceDirInfo.mode = 0755
tarballHandle.addfile(sourceDirInfo)
tapFileBase = os.path.basename(config['tapfile'])
initFileInfo = tarfile.TarInfo(
os.path.join(
config['release-name'],
'%s.init' % config['rpmfile'],
)
)
initFileInfo.type = tarfile.REGTYPE
initFileInfo.mode = 0755
initFileRealData = initFileData % {
'tap_file': tapFileBase,
'rpm_file': config['release-name'],
'twistd_option': config['twistd_option'],
}
initFileInfo.size = len(initFileRealData)
tarballHandle.addfile(initFileInfo, StringIO(initFileRealData))
tapFileHandle = open(config['tapfile'], 'rb')
tapFileInfo = tarballHandle.gettarinfo(
arcname=os.path.join(config['release-name'], tapFileBase),
fileobj=tapFileHandle,
)
tapFileInfo.mode = 0644
tarballHandle.addfile(tapFileInfo, tapFileHandle)
tarballHandle.close()
log.msg(format="Created dummy source tarball %(tarballPath)r",
tarballPath=tarballPath)
# Create the spec file in the SPECS directory.
specName = "%s.spec" % (config['release-name'],)
specPath = os.path.join(buildDir, "SPECS", specName)
specHandle = open(specPath, "w")
specFileRealData = specFileData % {
'description': config['description'],
'rpm_file': config['rpmfile'],
'version': config['set-version'],
'tarfile_basename': tarballName,
'tap_file': tapFileBase,
'date': time.strftime('%a %b %d %Y', time.localtime(time.time())),
'maintainer': config['maintainer'],
'long_description': config['long_description'],
}
specHandle.write(specFileRealData)
specHandle.close()
log.msg(format="Created RPM spec file %(specPath)r",
specPath=specPath)
return specPath
def run(options=None):
# parse options
try:
config = MyOptions()
config.parseOptions(options)
except usage.error, ue:
sys.exit("%s: %s" % (sys.argv[0], ue))
# create RPM build environment
tmpDir = makeBuildDir()
specPath = setupBuildFiles(tmpDir, config)
# build rpm
job = subprocess.Popen([
"rpmbuild",
"-vv",
"--define", "_topdir %s" % (tmpDir,),
"-ba", specPath,
], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, _ = job.communicate()
# If there was a problem, show people what it was.
if job.returncode != 0:
print stdout
# copy the RPMs to the local directory
rpmPath = glob.glob(os.path.join(tmpDir, 'RPMS', 'noarch', '*'))[0]
srpmPath = glob.glob(os.path.join(tmpDir, 'SRPMS', '*'))[0]
if not config['quiet']:
print 'Writing "%s"...' % os.path.basename(rpmPath)
shutil.copy(rpmPath, '.')
if not config['quiet']:
print 'Writing "%s"...' % os.path.basename(srpmPath)
shutil.copy(srpmPath, '.')
# remove the build directory
shutil.rmtree(tmpDir)
return [os.path.basename(rpmPath), os.path.basename(srpmPath)]
| apache-2.0 |
xuvw/viewfinder | backend/prod/ec2_utils.py | 13 | 12125 | #!/usr/bin/env python
#
# Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Utilities for EC2 interaction.
Basic wrappers around boto EC2 libraries. Can be run in standalone or as a library.
Examples:
# List all instances.
$ python -m viewfinder.backend.prod.ec2_utils --op=list
# List running PROD instances.
$ python -m viewfinder.backend.prod.ec2_utils --op=list --states=running --node_types=PROD
"""
__author__ = 'marc@emailscrubbed.com (Marc Berhault)'
import boto
from boto.ec2 import elb, regions
from boto.exception import EC2ResponseError
from collections import defaultdict
from tornado import options
kValidNodeTypes = ['PROD', 'STAGING']
kValidRegions = sorted([i.name for i in regions()])
kValidStateNames = ['pending', 'running', 'shutting-down', 'terminated', 'stopping', 'stopped']
kLoadBalancerNames = {'PROD': 'www-elb', 'STAGING': 'www-elb-staging'}
def _Connect(region):
"""Verify region and return an EC2 connection object."""
ec2_region = None
for r in regions():
if r.name == region:
ec2_region = r
break
assert ec2_region is not None, '"%s" not in the list of ec2 regions: %s' % \
(region, ', '.join(kValidRegions))
return boto.connect_ec2(region=ec2_region)
def _ConnectELB(region_name):
"""Connect to a given region for load balancer queries."""
return elb.connect_to_region(region_name)
#################### Functions performing actual EC2 requests ########################
def ListInstances(region, instances=None, node_types=[], states=[], names=[]):
"""List instance DNS names in a given region. By default, return all instances.
Defailed list of available filters can be found at:
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html
Can be filtered by:
- instance_id
- node_type (PROD or STAGING)
- state (running, pending, etc...)
- instance name (STAGING_0001, PROD_0004, etc...)
Returns a list of matching instances (boto.ec2.instance.Instance).
If instance IDs are specified and one or more is not found, an EC2ResponseError exception is thrown.
"""
ec2 = _Connect(region)
filters = {}
if node_types:
for i in node_types:
assert i in kValidNodeTypes, '"%s" not in the list of valid node types: %s' % (i, ', '.join(kValidNodeTypes))
filters['tag:NodeType'] = node_types
if names:
filters['tag:Name'] = names
if states:
for i in states:
assert i in kValidStateNames, '"%s" not in the list of valid state names: %s' % (i, ', '.join(kValidStateNames))
filters['instance-state-name'] = states
matches = []
for r in ec2.get_all_instances(instance_ids=instances, filters=filters):
matches.extend(r.instances)
return matches
def GetOwnerIDs(region):
"""Return the list of owner IDs in this region's security groups."""
ec2 = _Connect(region)
return [g.owner_id for g in ec2.get_all_security_groups()]
def GetImages(region, owner_ids=None):
"""Return the list of images owned IDs from 'owner_ids'. If None or empty, we return nothing."""
ec2 = _Connect(region)
if not owner_ids:
return None
return ec2.get_all_images(owners=owner_ids)
def GetLoadBalancers(region, node_types=None):
"""Return all load balancers in a given region. 'node_types' is an optional list of node-types; if not None,
we will only lookup load balancers for those types.
"""
elb_names = []
if node_types is not None:
for n in node_types:
assert n in kLoadBalancerNames.keys(), \
'node_type %s does not have an associated load balancer (%r)' % (n, kLoadBalancerNames)
elb_names.append(kLoadBalancerNames[n])
if not elb_names:
elb_names = None
ec2_elb = _ConnectELB(region)
return ec2_elb.get_all_load_balancers(load_balancer_names=elb_names)
def CreateTag(region, resource_id, tag_name, tag_value):
"""Create a tag for 'resource_id' with specified name and value. 'tag_value' can be None."""
ec2 = _Connect(region)
ec2.create_tags([resource_id], {tag_name: tag_value})
def GetAvailabilityZones(region):
"""Retrieve the list of availability zones for 'region'. Returns list of names."""
ec2 = _Connect(region)
return [z.name for z in ec2.get_all_zones()]
def RunInstance(region, ami_id, keypair_name, instance_type, availability_zone=None, user_data=None):
"""Run a new instance in the given region. Returns the created instance ID."""
ec2 = _Connect(region)
ret = ec2.run_instances(ami_id, key_name=keypair_name, user_data=user_data, instance_type=instance_type,
placement=availability_zone)
assert ret and len(ret.instances) == 1
return ret.instances[0].id
def TerminateInstance(region, instance_id):
"""Terminate instance_id in region."""
ec2 = _Connect(region)
ec2.terminate_instances([instance_id])
#################### Convenience wrappers ########################
def ListInstancesDNS(region, instances=None, node_types=[], states=[], names=[]):
"""Return a list of DNS names for instances matching the arguments.
If instance IDs are specified and one or more is not found, an EC2ResponseError exception is thrown.
"""
return [i.public_dns_name for i in ListInstances(region, instances=instances,
node_types=node_types, states=states, names=names)]
def GetInstance(region, instance_id):
"""Find a specific instance given its ID. Returns a boto.ec2.instance.Instance object if found, else None."""
try:
matches = ListInstances(region, instances=[instance_id])
except EC2ResponseError as e:
if e.error_code == 'InvalidInstanceID.NotFound':
return None
raise
if len(matches) == 0:
return None
assert len(matches) == 1
return matches[0]
def ListImages(region):
"""Display the list of images in a given region."""
all_images = GetImages(region, GetOwnerIDs(region))
running_images = set([i.image_id for i in ListInstances(region)])
if len(all_images) == 0:
print 'No images in region %s' % region
return
print '# %-14s %-8s %-40s %-40s' % ('ID', 'Active', 'Name', 'Description')
for i in all_images:
active_str = 'ACTIVE' if i.id in running_images else ''
print '%-16s %-8s %-40s %-40s' % (i.id, active_str, i.name, i.description)
def ListELB(region, node_types=None):
"""Print load balancer configuration in this region. If 'node_types' is not None, only return the corresponding
load balancers.
"""
elbs = GetLoadBalancers(region, node_types)
for l in elbs:
zone_count = {z:0 for z in l.availability_zones}
instances = ListInstances(region, instances=[i.id for i in l.instances])
instances_dict = {i.id: i for i in instances}
unknown = 0
for i in instances:
if i.placement in zone_count.keys():
zone_count[i.placement] += 1
else:
unknown += 1
zone_str = 'zones: ' + ' '.join(['%s[%d]' % (k, v) for k, v in zone_count.iteritems()])
if unknown > 0:
zone_str += ' unknown[%d]' % unknown
print '%s: %s' % (l.name, zone_str)
states = l.get_instance_health()
for s in states:
print ' %-16s %-20s %-30s' % (s.instance_id, instances_dict[s.instance_id].placement, s.state)
def GetELBInstanceHealth(region, instance_id, node_types=None):
"""Lookup an instance in the load balancers in a region and return its health status. Returns None if no
load balancers are found or if the instance is not found.
If node_types is specified, only look for load balancers for those types.
Possible return values are None, 'InService', or 'OutOfService'.
"""
balancers = GetLoadBalancers(region, node_types=node_types)
if not balancers:
return None
for b in balancers:
for state in b.get_instance_health():
if state.instance_id == instance_id:
return state.state
return None
def GetELBInstancesByHealth(region, node_types=None):
"""Return a dict of instance IDs by health state for the load balancers in a given region.
If node_types is not None, only query load balancers for those types.
"""
balancers = GetLoadBalancers(region, node_types=node_types)
res = defaultdict(list)
for b in balancers:
for state in b.get_instance_health():
res[state.state].append(state.instance_id)
return res
def GetELBZones(region, node_types=None):
"""Return a list of availability zone names covered by the load balancers in a given region.
If node_types is not None, only query load balancers for those types.
"""
balancers = GetLoadBalancers(region, node_types=node_types)
res = []
for b in balancers:
res.extend(b.availability_zones)
return res
def RemoveELBInstance(region, instance_id, node_type):
"""Add an instance to the load balancer in 'region'. 'node_type' is one of STAGING or PROD.
Adding an existing instance does nothing.
Asserts if the load balancer was not found or the instance was not previously registered.
"""
balancers = GetLoadBalancers(region, node_types=[node_type])
assert balancers, 'No %s load balancer in region %s' % (node_type, region)
assert len(balancers) == 1
b = balancers[0]
balancer_instances = set([i.id for i in b.instances])
if instance_id not in balancer_instances:
print 'Instance %s not found in %s load balancer in regions %s' % (instance_id, node_type, region)
return
b.deregister_instances([instance_id])
print 'Removed instance %s from %s load balancer in region %s' % (instance_id, node_type, region)
def AddELBInstance(region, instance_id, node_type):
"""Add an instance to the load balancer in 'region'. 'node_type' is one of STAGING or PROD.
Adding an existing instance does nothing.
"""
balancers = GetLoadBalancers(region, node_types=[node_type])
assert balancers, 'No %s load balancer in region %s' % (node_type, region)
assert len(balancers) == 1
b = balancers[0]
b.register_instances([instance_id])
print 'Added instance %s to %s load balancer in region %s' % (instance_id, node_type, region)
def main():
options.define('op', default=None, help='Operation: elb-list, elb-add-instance, elb-del-instance, '
'list, list-images')
options.define('region', default='us-east-1',
help='Region. One of %s' % ', '.join(kValidRegions))
options.define('instances', default=None, multiple=True,
help='List of EC2 instance IDs to lookup')
options.define('names', default=None, multiple=True,
help='Instance names.')
options.define('node_types', default=None, multiple=True,
help='Node types. One or more of: %s' % ', '.join(kValidNodeTypes))
options.define('states', default=None, multiple=True,
help='Instance states. One or more of: %s' % ', '.join(kValidStateNames))
options.parse_command_line()
op = options.options.op
assert op is not None
if op == 'list':
# We should probably display more useful information.
dns = ListInstancesDNS(options.options.region,
options.options.instances,
options.options.node_types,
options.options.states,
options.options.names)
print '\n'.join(dns)
elif op == 'elb-list':
ListELB(options.options.region, options.options.node_types)
elif op == 'elb-add-instance':
assert len(options.options.instances) == 1, 'Must specify exactly one instance on --instances'
assert len(options.options.node_types) == 1, 'Must specify exactly one --node_types'
AddELBInstance(options.options.region, options.options.instances[0], options.options.node_types[0])
elif op == 'elb-del-instance':
assert len(options.options.instances) == 1, 'Must specify exactly one instance on --instances'
assert len(options.options.node_types) == 1, 'Must specify exactly one --node_types'
RemoveELBInstance(options.options.region, options.options.instances[0], options.options.node_types[0])
elif op == 'list-images':
ListImages(options.options.region)
if __name__ == "__main__":
main()
| apache-2.0 |
karllessard/tensorflow | configure.py | 1 | 54634 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
"""configure script to get build parameters from user."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import errno
import os
import platform
import re
import subprocess
import sys
# pylint: disable=g-import-not-at-top
try:
from shutil import which
except ImportError:
from distutils.spawn import find_executable as which
# pylint: enable=g-import-not-at-top
_DEFAULT_CUDA_VERSION = '10'
_DEFAULT_CUDNN_VERSION = '7'
_DEFAULT_TENSORRT_VERSION = '6'
_DEFAULT_CUDA_COMPUTE_CAPABILITIES = '3.5,7.0'
_SUPPORTED_ANDROID_NDK_VERSIONS = [10, 11, 12, 13, 14, 15, 16, 17, 18]
_DEFAULT_PROMPT_ASK_ATTEMPTS = 10
_TF_BAZELRC_FILENAME = '.tf_configure.bazelrc'
_TF_WORKSPACE_ROOT = ''
_TF_BAZELRC = ''
_TF_CURRENT_BAZEL_VERSION = None
_TF_MIN_BAZEL_VERSION = '3.1.0'
_TF_MAX_BAZEL_VERSION = '3.99.0'
NCCL_LIB_PATHS = [
'lib64/', 'lib/powerpc64le-linux-gnu/', 'lib/x86_64-linux-gnu/', ''
]
# List of files to configure when building Bazel on Apple platforms.
APPLE_BAZEL_FILES = [
'tensorflow/lite/experimental/ios/BUILD',
'tensorflow/lite/experimental/objc/BUILD',
'tensorflow/lite/experimental/swift/BUILD',
'tensorflow/lite/tools/benchmark/experimental/ios/BUILD'
]
# List of files to move when building for iOS.
IOS_FILES = [
'tensorflow/lite/experimental/objc/TensorFlowLiteObjC.podspec',
'tensorflow/lite/experimental/swift/TensorFlowLiteSwift.podspec',
]
class UserInputError(Exception):
pass
def is_windows():
return platform.system() == 'Windows'
def is_linux():
return platform.system() == 'Linux'
def is_macos():
return platform.system() == 'Darwin'
def is_ppc64le():
return platform.machine() == 'ppc64le'
def is_cygwin():
return platform.system().startswith('CYGWIN_NT')
def get_input(question):
try:
try:
answer = raw_input(question)
except NameError:
answer = input(question) # pylint: disable=bad-builtin
except EOFError:
answer = ''
return answer
def symlink_force(target, link_name):
"""Force symlink, equivalent of 'ln -sf'.
Args:
target: items to link to.
link_name: name of the link.
"""
try:
os.symlink(target, link_name)
except OSError as e:
if e.errno == errno.EEXIST:
os.remove(link_name)
os.symlink(target, link_name)
else:
raise e
def sed_in_place(filename, old, new):
"""Replace old string with new string in file.
Args:
filename: string for filename.
old: string to replace.
new: new string to replace to.
"""
with open(filename, 'r') as f:
filedata = f.read()
newdata = filedata.replace(old, new)
with open(filename, 'w') as f:
f.write(newdata)
def write_to_bazelrc(line):
with open(_TF_BAZELRC, 'a') as f:
f.write(line + '\n')
def write_action_env_to_bazelrc(var_name, var):
write_to_bazelrc('build --action_env {}="{}"'.format(var_name, str(var)))
def run_shell(cmd, allow_non_zero=False, stderr=None):
if stderr is None:
stderr = sys.stdout
if allow_non_zero:
try:
output = subprocess.check_output(cmd, stderr=stderr)
except subprocess.CalledProcessError as e:
output = e.output
else:
output = subprocess.check_output(cmd, stderr=stderr)
return output.decode('UTF-8').strip()
def cygpath(path):
"""Convert path from posix to windows."""
return os.path.abspath(path).replace('\\', '/')
def get_python_path(environ_cp, python_bin_path):
"""Get the python site package paths."""
python_paths = []
if environ_cp.get('PYTHONPATH'):
python_paths = environ_cp.get('PYTHONPATH').split(':')
try:
stderr = open(os.devnull, 'wb')
library_paths = run_shell([
python_bin_path, '-c',
'import site; print("\\n".join(site.getsitepackages()))'
],
stderr=stderr).split('\n')
except subprocess.CalledProcessError:
library_paths = [
run_shell([
python_bin_path, '-c',
'from distutils.sysconfig import get_python_lib;'
'print(get_python_lib())'
])
]
all_paths = set(python_paths + library_paths)
paths = []
for path in all_paths:
if os.path.isdir(path):
paths.append(path)
return paths
def get_python_major_version(python_bin_path):
"""Get the python major version."""
return run_shell([python_bin_path, '-c', 'import sys; print(sys.version[0])'])
def setup_python(environ_cp):
"""Setup python related env variables."""
# Get PYTHON_BIN_PATH, default is the current running python.
default_python_bin_path = sys.executable
ask_python_bin_path = ('Please specify the location of python. [Default is '
'{}]: ').format(default_python_bin_path)
while True:
python_bin_path = get_from_env_or_user_or_default(environ_cp,
'PYTHON_BIN_PATH',
ask_python_bin_path,
default_python_bin_path)
# Check if the path is valid
if os.path.isfile(python_bin_path) and os.access(python_bin_path, os.X_OK):
break
elif not os.path.exists(python_bin_path):
print('Invalid python path: {} cannot be found.'.format(python_bin_path))
else:
print('{} is not executable. Is it the python binary?'.format(
python_bin_path))
environ_cp['PYTHON_BIN_PATH'] = ''
# Convert python path to Windows style before checking lib and version
if is_windows() or is_cygwin():
python_bin_path = cygpath(python_bin_path)
# Get PYTHON_LIB_PATH
python_lib_path = environ_cp.get('PYTHON_LIB_PATH')
if not python_lib_path:
python_lib_paths = get_python_path(environ_cp, python_bin_path)
if environ_cp.get('USE_DEFAULT_PYTHON_LIB_PATH') == '1':
python_lib_path = python_lib_paths[0]
else:
print('Found possible Python library paths:\n %s' %
'\n '.join(python_lib_paths))
default_python_lib_path = python_lib_paths[0]
python_lib_path = get_input(
'Please input the desired Python library path to use. '
'Default is [{}]\n'.format(python_lib_paths[0]))
if not python_lib_path:
python_lib_path = default_python_lib_path
environ_cp['PYTHON_LIB_PATH'] = python_lib_path
python_major_version = get_python_major_version(python_bin_path)
if python_major_version == '2':
write_to_bazelrc('build --host_force_python=PY2')
# Convert python path to Windows style before writing into bazel.rc
if is_windows() or is_cygwin():
python_lib_path = cygpath(python_lib_path)
# Set-up env variables used by python_configure.bzl
write_action_env_to_bazelrc('PYTHON_BIN_PATH', python_bin_path)
write_action_env_to_bazelrc('PYTHON_LIB_PATH', python_lib_path)
write_to_bazelrc('build --python_path=\"{}"'.format(python_bin_path))
environ_cp['PYTHON_BIN_PATH'] = python_bin_path
# If choosen python_lib_path is from a path specified in the PYTHONPATH
# variable, need to tell bazel to include PYTHONPATH
if environ_cp.get('PYTHONPATH'):
python_paths = environ_cp.get('PYTHONPATH').split(':')
if python_lib_path in python_paths:
write_action_env_to_bazelrc('PYTHONPATH', environ_cp.get('PYTHONPATH'))
# Write tools/python_bin_path.sh
with open(
os.path.join(_TF_WORKSPACE_ROOT, 'tools', 'python_bin_path.sh'),
'w') as f:
f.write('export PYTHON_BIN_PATH="{}"'.format(python_bin_path))
def reset_tf_configure_bazelrc():
"""Reset file that contains customized config settings."""
open(_TF_BAZELRC, 'w').close()
def cleanup_makefile():
"""Delete any leftover BUILD files from the Makefile build.
These files could interfere with Bazel parsing.
"""
makefile_download_dir = os.path.join(_TF_WORKSPACE_ROOT, 'tensorflow',
'contrib', 'makefile', 'downloads')
if os.path.isdir(makefile_download_dir):
for root, _, filenames in os.walk(makefile_download_dir):
for f in filenames:
if f.endswith('BUILD'):
os.remove(os.path.join(root, f))
def get_var(environ_cp,
var_name,
query_item,
enabled_by_default,
question=None,
yes_reply=None,
no_reply=None):
"""Get boolean input from user.
If var_name is not set in env, ask user to enable query_item or not. If the
response is empty, use the default.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
query_item: string for feature related to the variable, e.g. "CUDA for
Nvidia GPUs".
enabled_by_default: boolean for default behavior.
question: optional string for how to ask for user input.
yes_reply: optional string for reply when feature is enabled.
no_reply: optional string for reply when feature is disabled.
Returns:
boolean value of the variable.
Raises:
UserInputError: if an environment variable is set, but it cannot be
interpreted as a boolean indicator, assume that the user has made a
scripting error, and will continue to provide invalid input.
Raise the error to avoid infinitely looping.
"""
if not question:
question = 'Do you wish to build TensorFlow with {} support?'.format(
query_item)
if not yes_reply:
yes_reply = '{} support will be enabled for TensorFlow.'.format(query_item)
if not no_reply:
no_reply = 'No {}'.format(yes_reply)
yes_reply += '\n'
no_reply += '\n'
if enabled_by_default:
question += ' [Y/n]: '
else:
question += ' [y/N]: '
var = environ_cp.get(var_name)
if var is not None:
var_content = var.strip().lower()
true_strings = ('1', 't', 'true', 'y', 'yes')
false_strings = ('0', 'f', 'false', 'n', 'no')
if var_content in true_strings:
var = True
elif var_content in false_strings:
var = False
else:
raise UserInputError(
'Environment variable %s must be set as a boolean indicator.\n'
'The following are accepted as TRUE : %s.\n'
'The following are accepted as FALSE: %s.\n'
'Current value is %s.' %
(var_name, ', '.join(true_strings), ', '.join(false_strings), var))
while var is None:
user_input_origin = get_input(question)
user_input = user_input_origin.strip().lower()
if user_input == 'y':
print(yes_reply)
var = True
elif user_input == 'n':
print(no_reply)
var = False
elif not user_input:
if enabled_by_default:
print(yes_reply)
var = True
else:
print(no_reply)
var = False
else:
print('Invalid selection: {}'.format(user_input_origin))
return var
def set_build_var(environ_cp,
var_name,
query_item,
option_name,
enabled_by_default,
bazel_config_name=None):
"""Set if query_item will be enabled for the build.
Ask user if query_item will be enabled. Default is used if no input is given.
Set subprocess environment variable and write to .bazelrc if enabled.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
query_item: string for feature related to the variable, e.g. "CUDA for
Nvidia GPUs".
option_name: string for option to define in .bazelrc.
enabled_by_default: boolean for default behavior.
bazel_config_name: Name for Bazel --config argument to enable build feature.
"""
var = str(int(get_var(environ_cp, var_name, query_item, enabled_by_default)))
environ_cp[var_name] = var
if var == '1':
write_to_bazelrc('build:%s --define %s=true' %
(bazel_config_name, option_name))
write_to_bazelrc('build --config=%s' % bazel_config_name)
elif bazel_config_name is not None:
# TODO(mikecase): Migrate all users of configure.py to use --config Bazel
# options and not to set build configs through environment variables.
write_to_bazelrc('build:%s --define %s=true' %
(bazel_config_name, option_name))
def set_action_env_var(environ_cp,
var_name,
query_item,
enabled_by_default,
question=None,
yes_reply=None,
no_reply=None,
bazel_config_name=None):
"""Set boolean action_env variable.
Ask user if query_item will be enabled. Default is used if no input is given.
Set environment variable and write to .bazelrc.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
query_item: string for feature related to the variable, e.g. "CUDA for
Nvidia GPUs".
enabled_by_default: boolean for default behavior.
question: optional string for how to ask for user input.
yes_reply: optional string for reply when feature is enabled.
no_reply: optional string for reply when feature is disabled.
bazel_config_name: adding config to .bazelrc instead of action_env.
"""
var = int(
get_var(environ_cp, var_name, query_item, enabled_by_default, question,
yes_reply, no_reply))
if not bazel_config_name:
write_action_env_to_bazelrc(var_name, var)
elif var:
write_to_bazelrc('build --config=%s' % bazel_config_name)
environ_cp[var_name] = str(var)
def convert_version_to_int(version):
"""Convert a version number to a integer that can be used to compare.
Version strings of the form X.YZ and X.Y.Z-xxxxx are supported. The
'xxxxx' part, for instance 'homebrew' on OS/X, is ignored.
Args:
version: a version to be converted
Returns:
An integer if converted successfully, otherwise return None.
"""
version = version.split('-')[0]
version_segments = version.split('.')
# Treat "0.24" as "0.24.0"
if len(version_segments) == 2:
version_segments.append('0')
for seg in version_segments:
if not seg.isdigit():
return None
version_str = ''.join(['%03d' % int(seg) for seg in version_segments])
return int(version_str)
def check_bazel_version(min_version, max_version):
"""Check installed bazel version is between min_version and max_version.
Args:
min_version: string for minimum bazel version (must exist!).
max_version: string for maximum bazel version (must exist!).
Returns:
The bazel version detected.
"""
if which('bazel') is None:
print('Cannot find bazel. Please install bazel.')
sys.exit(1)
stderr = open(os.devnull, 'wb')
curr_version = run_shell(['bazel', '--version'],
allow_non_zero=True,
stderr=stderr)
if curr_version.startswith('bazel '):
curr_version = curr_version.split('bazel ')[1]
min_version_int = convert_version_to_int(min_version)
curr_version_int = convert_version_to_int(curr_version)
max_version_int = convert_version_to_int(max_version)
# Check if current bazel version can be detected properly.
if not curr_version_int:
print('WARNING: current bazel installation is not a release version.')
print('Make sure you are running at least bazel %s' % min_version)
return curr_version
print('You have bazel %s installed.' % curr_version)
if curr_version_int < min_version_int:
print('Please upgrade your bazel installation to version %s or higher to '
'build TensorFlow!' % min_version)
sys.exit(1)
if (curr_version_int > max_version_int and
'TF_IGNORE_MAX_BAZEL_VERSION' not in os.environ):
print('Please downgrade your bazel installation to version %s or lower to '
'build TensorFlow! To downgrade: download the installer for the old '
'version (from https://github.com/bazelbuild/bazel/releases) then '
'run the installer.' % max_version)
sys.exit(1)
return curr_version
def set_cc_opt_flags(environ_cp):
"""Set up architecture-dependent optimization flags.
Also append CC optimization flags to bazel.rc..
Args:
environ_cp: copy of the os.environ.
"""
if is_ppc64le():
# gcc on ppc64le does not support -march, use mcpu instead
default_cc_opt_flags = '-mcpu=native'
elif is_windows():
default_cc_opt_flags = '/arch:AVX'
else:
default_cc_opt_flags = '-march=native -Wno-sign-compare'
question = ('Please specify optimization flags to use during compilation when'
' bazel option "--config=opt" is specified [Default is %s]: '
) % default_cc_opt_flags
cc_opt_flags = get_from_env_or_user_or_default(environ_cp, 'CC_OPT_FLAGS',
question, default_cc_opt_flags)
for opt in cc_opt_flags.split():
write_to_bazelrc('build:opt --copt=%s' % opt)
# It should be safe on the same build host.
if not is_ppc64le() and not is_windows():
write_to_bazelrc('build:opt --host_copt=-march=native')
write_to_bazelrc('build:opt --define with_default_optimizations=true')
def set_tf_cuda_clang(environ_cp):
"""set TF_CUDA_CLANG action_env.
Args:
environ_cp: copy of the os.environ.
"""
question = 'Do you want to use clang as CUDA compiler?'
yes_reply = 'Clang will be used as CUDA compiler.'
no_reply = 'nvcc will be used as CUDA compiler.'
set_action_env_var(
environ_cp,
'TF_CUDA_CLANG',
None,
False,
question=question,
yes_reply=yes_reply,
no_reply=no_reply,
bazel_config_name='cuda_clang')
def set_tf_download_clang(environ_cp):
"""Set TF_DOWNLOAD_CLANG action_env."""
question = 'Do you wish to download a fresh release of clang? (Experimental)'
yes_reply = 'Clang will be downloaded and used to compile tensorflow.'
no_reply = 'Clang will not be downloaded.'
set_action_env_var(
environ_cp,
'TF_DOWNLOAD_CLANG',
None,
False,
question=question,
yes_reply=yes_reply,
no_reply=no_reply,
bazel_config_name='download_clang')
def get_from_env_or_user_or_default(environ_cp, var_name, ask_for_var,
var_default):
"""Get var_name either from env, or user or default.
If var_name has been set as environment variable, use the preset value, else
ask for user input. If no input is provided, the default is used.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
ask_for_var: string for how to ask for user input.
var_default: default value string.
Returns:
string value for var_name
"""
var = environ_cp.get(var_name)
if not var:
var = get_input(ask_for_var)
print('\n')
if not var:
var = var_default
return var
def set_clang_cuda_compiler_path(environ_cp):
"""Set CLANG_CUDA_COMPILER_PATH."""
default_clang_path = which('clang') or ''
ask_clang_path = ('Please specify which clang should be used as device and '
'host compiler. [Default is %s]: ') % default_clang_path
while True:
clang_cuda_compiler_path = get_from_env_or_user_or_default(
environ_cp, 'CLANG_CUDA_COMPILER_PATH', ask_clang_path,
default_clang_path)
if os.path.exists(clang_cuda_compiler_path):
break
# Reset and retry
print('Invalid clang path: %s cannot be found.' % clang_cuda_compiler_path)
environ_cp['CLANG_CUDA_COMPILER_PATH'] = ''
# Set CLANG_CUDA_COMPILER_PATH
environ_cp['CLANG_CUDA_COMPILER_PATH'] = clang_cuda_compiler_path
write_action_env_to_bazelrc('CLANG_CUDA_COMPILER_PATH',
clang_cuda_compiler_path)
def prompt_loop_or_load_from_env(environ_cp,
var_name,
var_default,
ask_for_var,
check_success,
error_msg,
suppress_default_error=False,
resolve_symlinks=False,
n_ask_attempts=_DEFAULT_PROMPT_ASK_ATTEMPTS):
"""Loop over user prompts for an ENV param until receiving a valid response.
For the env param var_name, read from the environment or verify user input
until receiving valid input. When done, set var_name in the environ_cp to its
new value.
Args:
environ_cp: (Dict) copy of the os.environ.
var_name: (String) string for name of environment variable, e.g. "TF_MYVAR".
var_default: (String) default value string.
ask_for_var: (String) string for how to ask for user input.
check_success: (Function) function that takes one argument and returns a
boolean. Should return True if the value provided is considered valid. May
contain a complex error message if error_msg does not provide enough
information. In that case, set suppress_default_error to True.
error_msg: (String) String with one and only one '%s'. Formatted with each
invalid response upon check_success(input) failure.
suppress_default_error: (Bool) Suppress the above error message in favor of
one from the check_success function.
resolve_symlinks: (Bool) Translate symbolic links into the real filepath.
n_ask_attempts: (Integer) Number of times to query for valid input before
raising an error and quitting.
Returns:
[String] The value of var_name after querying for input.
Raises:
UserInputError: if a query has been attempted n_ask_attempts times without
success, assume that the user has made a scripting error, and will
continue to provide invalid input. Raise the error to avoid infinitely
looping.
"""
default = environ_cp.get(var_name) or var_default
full_query = '%s [Default is %s]: ' % (
ask_for_var,
default,
)
for _ in range(n_ask_attempts):
val = get_from_env_or_user_or_default(environ_cp, var_name, full_query,
default)
if check_success(val):
break
if not suppress_default_error:
print(error_msg % val)
environ_cp[var_name] = ''
else:
raise UserInputError('Invalid %s setting was provided %d times in a row. '
'Assuming to be a scripting mistake.' %
(var_name, n_ask_attempts))
if resolve_symlinks and os.path.islink(val):
val = os.path.realpath(val)
environ_cp[var_name] = val
return val
def create_android_ndk_rule(environ_cp):
"""Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule."""
if is_windows() or is_cygwin():
default_ndk_path = cygpath('%s/Android/Sdk/ndk-bundle' %
environ_cp['APPDATA'])
elif is_macos():
default_ndk_path = '%s/library/Android/Sdk/ndk-bundle' % environ_cp['HOME']
else:
default_ndk_path = '%s/Android/Sdk/ndk-bundle' % environ_cp['HOME']
def valid_ndk_path(path):
return (os.path.exists(path) and
os.path.exists(os.path.join(path, 'source.properties')))
android_ndk_home_path = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_NDK_HOME',
var_default=default_ndk_path,
ask_for_var='Please specify the home path of the Android NDK to use.',
check_success=valid_ndk_path,
error_msg=('The path %s or its child file "source.properties" '
'does not exist.'))
write_action_env_to_bazelrc('ANDROID_NDK_HOME', android_ndk_home_path)
write_action_env_to_bazelrc(
'ANDROID_NDK_API_LEVEL',
get_ndk_api_level(environ_cp, android_ndk_home_path))
def create_android_sdk_rule(environ_cp):
"""Set Android variables and write Android SDK WORKSPACE rule."""
if is_windows() or is_cygwin():
default_sdk_path = cygpath('%s/Android/Sdk' % environ_cp['APPDATA'])
elif is_macos():
default_sdk_path = '%s/library/Android/Sdk' % environ_cp['HOME']
else:
default_sdk_path = '%s/Android/Sdk' % environ_cp['HOME']
def valid_sdk_path(path):
return (os.path.exists(path) and
os.path.exists(os.path.join(path, 'platforms')) and
os.path.exists(os.path.join(path, 'build-tools')))
android_sdk_home_path = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_SDK_HOME',
var_default=default_sdk_path,
ask_for_var='Please specify the home path of the Android SDK to use.',
check_success=valid_sdk_path,
error_msg=('Either %s does not exist, or it does not contain the '
'subdirectories "platforms" and "build-tools".'))
platforms = os.path.join(android_sdk_home_path, 'platforms')
api_levels = sorted(os.listdir(platforms))
api_levels = [x.replace('android-', '') for x in api_levels]
def valid_api_level(api_level):
return os.path.exists(
os.path.join(android_sdk_home_path, 'platforms',
'android-' + api_level))
android_api_level = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_API_LEVEL',
var_default=api_levels[-1],
ask_for_var=('Please specify the Android SDK API level to use. '
'[Available levels: %s]') % api_levels,
check_success=valid_api_level,
error_msg='Android-%s is not present in the SDK path.')
build_tools = os.path.join(android_sdk_home_path, 'build-tools')
versions = sorted(os.listdir(build_tools))
def valid_build_tools(version):
return os.path.exists(
os.path.join(android_sdk_home_path, 'build-tools', version))
android_build_tools_version = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_BUILD_TOOLS_VERSION',
var_default=versions[-1],
ask_for_var=('Please specify an Android build tools version to use. '
'[Available versions: %s]') % versions,
check_success=valid_build_tools,
error_msg=('The selected SDK does not have build-tools version %s '
'available.'))
write_action_env_to_bazelrc('ANDROID_BUILD_TOOLS_VERSION',
android_build_tools_version)
write_action_env_to_bazelrc('ANDROID_SDK_API_LEVEL', android_api_level)
write_action_env_to_bazelrc('ANDROID_SDK_HOME', android_sdk_home_path)
def get_ndk_api_level(environ_cp, android_ndk_home_path):
"""Gets the appropriate NDK API level to use for the provided Android NDK path."""
# First check to see if we're using a blessed version of the NDK.
properties_path = '%s/source.properties' % android_ndk_home_path
if is_windows() or is_cygwin():
properties_path = cygpath(properties_path)
with open(properties_path, 'r') as f:
filedata = f.read()
revision = re.search(r'Pkg.Revision = (\d+)', filedata)
if revision:
ndk_version = revision.group(1)
else:
raise Exception('Unable to parse NDK revision.')
if int(ndk_version) not in _SUPPORTED_ANDROID_NDK_VERSIONS:
print('WARNING: The NDK version in %s is %s, which is not '
'supported by Bazel (officially supported versions: %s). Please use '
'another version. Compiling Android targets may result in confusing '
'errors.\n' %
(android_ndk_home_path, ndk_version, _SUPPORTED_ANDROID_NDK_VERSIONS))
# Now grab the NDK API level to use. Note that this is different from the
# SDK API level, as the NDK API level is effectively the *min* target SDK
# version.
platforms = os.path.join(android_ndk_home_path, 'platforms')
api_levels = sorted(os.listdir(platforms))
api_levels = [
x.replace('android-', '') for x in api_levels if 'android-' in x
]
def valid_api_level(api_level):
return os.path.exists(
os.path.join(android_ndk_home_path, 'platforms',
'android-' + api_level))
android_ndk_api_level = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_NDK_API_LEVEL',
var_default='21', # 21 is required for ARM64 support.
ask_for_var=('Please specify the (min) Android NDK API level to use. '
'[Available levels: %s]') % api_levels,
check_success=valid_api_level,
error_msg='Android-%s is not present in the NDK path.')
return android_ndk_api_level
def set_gcc_host_compiler_path(environ_cp):
"""Set GCC_HOST_COMPILER_PATH."""
default_gcc_host_compiler_path = which('gcc') or ''
cuda_bin_symlink = '%s/bin/gcc' % environ_cp.get('CUDA_TOOLKIT_PATH')
if os.path.islink(cuda_bin_symlink):
# os.readlink is only available in linux
default_gcc_host_compiler_path = os.path.realpath(cuda_bin_symlink)
gcc_host_compiler_path = prompt_loop_or_load_from_env(
environ_cp,
var_name='GCC_HOST_COMPILER_PATH',
var_default=default_gcc_host_compiler_path,
ask_for_var='Please specify which gcc should be used by nvcc as the host compiler.',
check_success=os.path.exists,
resolve_symlinks=True,
error_msg='Invalid gcc path. %s cannot be found.',
)
write_action_env_to_bazelrc('GCC_HOST_COMPILER_PATH', gcc_host_compiler_path)
def reformat_version_sequence(version_str, sequence_count):
"""Reformat the version string to have the given number of sequences.
For example:
Given (7, 2) -> 7.0
(7.0.1, 2) -> 7.0
(5, 1) -> 5
(5.0.3.2, 1) -> 5
Args:
version_str: String, the version string.
sequence_count: int, an integer.
Returns:
string, reformatted version string.
"""
v = version_str.split('.')
if len(v) < sequence_count:
v = v + (['0'] * (sequence_count - len(v)))
return '.'.join(v[:sequence_count])
def set_tf_cuda_paths(environ_cp):
"""Set TF_CUDA_PATHS."""
ask_cuda_paths = (
'Please specify the comma-separated list of base paths to look for CUDA '
'libraries and headers. [Leave empty to use the default]: ')
tf_cuda_paths = get_from_env_or_user_or_default(environ_cp, 'TF_CUDA_PATHS',
ask_cuda_paths, '')
if tf_cuda_paths:
environ_cp['TF_CUDA_PATHS'] = tf_cuda_paths
def set_tf_cuda_version(environ_cp):
"""Set TF_CUDA_VERSION."""
ask_cuda_version = (
'Please specify the CUDA SDK version you want to use. '
'[Leave empty to default to CUDA %s]: ') % _DEFAULT_CUDA_VERSION
tf_cuda_version = get_from_env_or_user_or_default(environ_cp,
'TF_CUDA_VERSION',
ask_cuda_version,
_DEFAULT_CUDA_VERSION)
environ_cp['TF_CUDA_VERSION'] = tf_cuda_version
def set_tf_cudnn_version(environ_cp):
"""Set TF_CUDNN_VERSION."""
ask_cudnn_version = (
'Please specify the cuDNN version you want to use. '
'[Leave empty to default to cuDNN %s]: ') % _DEFAULT_CUDNN_VERSION
tf_cudnn_version = get_from_env_or_user_or_default(environ_cp,
'TF_CUDNN_VERSION',
ask_cudnn_version,
_DEFAULT_CUDNN_VERSION)
environ_cp['TF_CUDNN_VERSION'] = tf_cudnn_version
def is_cuda_compatible(lib, cuda_ver, cudnn_ver):
"""Check compatibility between given library and cudnn/cudart libraries."""
ldd_bin = which('ldd') or '/usr/bin/ldd'
ldd_out = run_shell([ldd_bin, lib], True)
ldd_out = ldd_out.split(os.linesep)
cudnn_pattern = re.compile('.*libcudnn.so\\.?(.*) =>.*$')
cuda_pattern = re.compile('.*libcudart.so\\.?(.*) =>.*$')
cudnn = None
cudart = None
cudnn_ok = True # assume no cudnn dependency by default
cuda_ok = True # assume no cuda dependency by default
for line in ldd_out:
if 'libcudnn.so' in line:
cudnn = cudnn_pattern.search(line)
cudnn_ok = False
elif 'libcudart.so' in line:
cudart = cuda_pattern.search(line)
cuda_ok = False
if cudnn and len(cudnn.group(1)):
cudnn = convert_version_to_int(cudnn.group(1))
if cudart and len(cudart.group(1)):
cudart = convert_version_to_int(cudart.group(1))
if cudnn is not None:
cudnn_ok = (cudnn == cudnn_ver)
if cudart is not None:
cuda_ok = (cudart == cuda_ver)
return cudnn_ok and cuda_ok
def set_tf_tensorrt_version(environ_cp):
"""Set TF_TENSORRT_VERSION."""
if not is_linux():
raise ValueError('Currently TensorRT is only supported on Linux platform.')
if not int(environ_cp.get('TF_NEED_TENSORRT', False)):
return
ask_tensorrt_version = (
'Please specify the TensorRT version you want to use. '
'[Leave empty to default to TensorRT %s]: ') % _DEFAULT_TENSORRT_VERSION
tf_tensorrt_version = get_from_env_or_user_or_default(
environ_cp, 'TF_TENSORRT_VERSION', ask_tensorrt_version,
_DEFAULT_TENSORRT_VERSION)
environ_cp['TF_TENSORRT_VERSION'] = tf_tensorrt_version
def set_tf_nccl_version(environ_cp):
"""Set TF_NCCL_VERSION."""
if not is_linux():
raise ValueError('Currently NCCL is only supported on Linux platform.')
if 'TF_NCCL_VERSION' in environ_cp:
return
ask_nccl_version = (
'Please specify the locally installed NCCL version you want to use. '
'[Leave empty to use http://github.com/nvidia/nccl]: ')
tf_nccl_version = get_from_env_or_user_or_default(environ_cp,
'TF_NCCL_VERSION',
ask_nccl_version, '')
environ_cp['TF_NCCL_VERSION'] = tf_nccl_version
def get_native_cuda_compute_capabilities(environ_cp):
"""Get native cuda compute capabilities.
Args:
environ_cp: copy of the os.environ.
Returns:
string of native cuda compute capabilities, separated by comma.
"""
device_query_bin = os.path.join(
environ_cp.get('CUDA_TOOLKIT_PATH'), 'extras/demo_suite/deviceQuery')
if os.path.isfile(device_query_bin) and os.access(device_query_bin, os.X_OK):
try:
output = run_shell(device_query_bin).split('\n')
pattern = re.compile('[0-9]*\\.[0-9]*')
output = [pattern.search(x) for x in output if 'Capability' in x]
output = ','.join(x.group() for x in output if x is not None)
except subprocess.CalledProcessError:
output = ''
else:
output = ''
return output
def set_tf_cuda_compute_capabilities(environ_cp):
"""Set TF_CUDA_COMPUTE_CAPABILITIES."""
while True:
native_cuda_compute_capabilities = get_native_cuda_compute_capabilities(
environ_cp)
if not native_cuda_compute_capabilities:
default_cuda_compute_capabilities = _DEFAULT_CUDA_COMPUTE_CAPABILITIES
else:
default_cuda_compute_capabilities = native_cuda_compute_capabilities
ask_cuda_compute_capabilities = (
'Please specify a list of comma-separated CUDA compute capabilities '
'you want to build with.\nYou can find the compute capability of your '
'device at: https://developer.nvidia.com/cuda-gpus. Each capability '
'can be specified as "x.y" or "compute_xy" to include both virtual and'
' binary GPU code, or as "sm_xy" to only include the binary '
'code.\nPlease note that each additional compute capability '
'significantly increases your build time and binary size, and that '
'TensorFlow only supports compute capabilities >= 3.5 [Default is: '
'%s]: ' % default_cuda_compute_capabilities)
tf_cuda_compute_capabilities = get_from_env_or_user_or_default(
environ_cp, 'TF_CUDA_COMPUTE_CAPABILITIES',
ask_cuda_compute_capabilities, default_cuda_compute_capabilities)
# Check whether all capabilities from the input is valid
all_valid = True
# Remove all whitespace characters before splitting the string
# that users may insert by accident, as this will result in error
tf_cuda_compute_capabilities = ''.join(tf_cuda_compute_capabilities.split())
for compute_capability in tf_cuda_compute_capabilities.split(','):
m = re.match('[0-9]+.[0-9]+', compute_capability)
if not m:
# We now support sm_35,sm_50,sm_60,compute_70.
sm_compute_match = re.match('(sm|compute)_?([0-9]+[0-9]+)',
compute_capability)
if not sm_compute_match:
print('Invalid compute capability: %s' % compute_capability)
all_valid = False
else:
ver = int(sm_compute_match.group(2))
if ver < 30:
print(
'ERROR: TensorFlow only supports small CUDA compute'
' capabilities of sm_30 and higher. Please re-specify the list'
' of compute capabilities excluding version %s.' % ver)
all_valid = False
if ver < 35:
print('WARNING: XLA does not support CUDA compute capabilities '
'lower than sm_35. Disable XLA when running on older GPUs.')
else:
ver = float(m.group(0))
if ver < 3.0:
print('ERROR: TensorFlow only supports CUDA compute capabilities 3.0 '
'and higher. Please re-specify the list of compute '
'capabilities excluding version %s.' % ver)
all_valid = False
if ver < 3.5:
print('WARNING: XLA does not support CUDA compute capabilities '
'lower than 3.5. Disable XLA when running on older GPUs.')
if all_valid:
break
# Reset and Retry
environ_cp['TF_CUDA_COMPUTE_CAPABILITIES'] = ''
# Set TF_CUDA_COMPUTE_CAPABILITIES
environ_cp['TF_CUDA_COMPUTE_CAPABILITIES'] = tf_cuda_compute_capabilities
write_action_env_to_bazelrc('TF_CUDA_COMPUTE_CAPABILITIES',
tf_cuda_compute_capabilities)
def set_other_cuda_vars(environ_cp):
"""Set other CUDA related variables."""
# If CUDA is enabled, always use GPU during build and test.
if environ_cp.get('TF_CUDA_CLANG') == '1':
write_to_bazelrc('build --config=cuda_clang')
else:
write_to_bazelrc('build --config=cuda')
def set_host_cxx_compiler(environ_cp):
"""Set HOST_CXX_COMPILER."""
default_cxx_host_compiler = which('g++') or ''
host_cxx_compiler = prompt_loop_or_load_from_env(
environ_cp,
var_name='HOST_CXX_COMPILER',
var_default=default_cxx_host_compiler,
ask_for_var=('Please specify which C++ compiler should be used as the '
'host C++ compiler.'),
check_success=os.path.exists,
error_msg='Invalid C++ compiler path. %s cannot be found.',
)
write_action_env_to_bazelrc('HOST_CXX_COMPILER', host_cxx_compiler)
def set_host_c_compiler(environ_cp):
"""Set HOST_C_COMPILER."""
default_c_host_compiler = which('gcc') or ''
host_c_compiler = prompt_loop_or_load_from_env(
environ_cp,
var_name='HOST_C_COMPILER',
var_default=default_c_host_compiler,
ask_for_var=('Please specify which C compiler should be used as the host '
'C compiler.'),
check_success=os.path.exists,
error_msg='Invalid C compiler path. %s cannot be found.',
)
write_action_env_to_bazelrc('HOST_C_COMPILER', host_c_compiler)
def system_specific_test_config(environ_cp):
"""Add default build and test flags required for TF tests to bazelrc."""
write_to_bazelrc('test --flaky_test_attempts=3')
write_to_bazelrc('test --test_size_filters=small,medium')
# Each instance of --test_tag_filters or --build_tag_filters overrides all
# previous instances, so we need to build up a complete list and write a
# single list of filters for the .bazelrc file.
# Filters to use with both --test_tag_filters and --build_tag_filters
test_and_build_filters = ['-benchmark-test', '-no_oss']
# Additional filters for --test_tag_filters beyond those in
# test_and_build_filters
test_only_filters = ['-oss_serial']
if is_windows():
test_and_build_filters.append('-no_windows')
if ((environ_cp.get('TF_NEED_CUDA', None) == '1') or
(environ_cp.get('TF_NEED_ROCM', None) == '1')):
test_and_build_filters += ['-no_windows_gpu', '-no_gpu']
else:
test_and_build_filters.append('-gpu')
elif is_macos():
test_and_build_filters += ['-gpu', '-nomac', '-no_mac']
elif is_linux():
if ((environ_cp.get('TF_NEED_CUDA', None) == '1') or
(environ_cp.get('TF_NEED_ROCM', None) == '1')):
test_and_build_filters.append('-no_gpu')
write_to_bazelrc('test --test_env=LD_LIBRARY_PATH')
else:
test_and_build_filters.append('-gpu')
# Disable tests with "v1only" tag in "v2" Bazel config, but not in "v1" config
write_to_bazelrc('test:v1 --test_tag_filters=%s' %
','.join(test_and_build_filters + test_only_filters))
write_to_bazelrc('test:v1 --build_tag_filters=%s' %
','.join(test_and_build_filters))
write_to_bazelrc(
'test:v2 --test_tag_filters=%s' %
','.join(test_and_build_filters + test_only_filters + ['-v1only']))
write_to_bazelrc('test:v2 --build_tag_filters=%s' %
','.join(test_and_build_filters + ['-v1only']))
def set_system_libs_flag(environ_cp):
syslibs = environ_cp.get('TF_SYSTEM_LIBS', '')
if syslibs:
if ',' in syslibs:
syslibs = ','.join(sorted(syslibs.split(',')))
else:
syslibs = ','.join(sorted(syslibs.split()))
write_action_env_to_bazelrc('TF_SYSTEM_LIBS', syslibs)
if 'PREFIX' in environ_cp:
write_to_bazelrc('build --define=PREFIX=%s' % environ_cp['PREFIX'])
if 'LIBDIR' in environ_cp:
write_to_bazelrc('build --define=LIBDIR=%s' % environ_cp['LIBDIR'])
if 'INCLUDEDIR' in environ_cp:
write_to_bazelrc('build --define=INCLUDEDIR=%s' % environ_cp['INCLUDEDIR'])
def is_reduced_optimize_huge_functions_available(environ_cp):
"""Check to see if the system supports /d2ReducedOptimizeHugeFunctions.
The above compiler flag is a new compiler flag introduced to the Visual Studio
compiler in version 16.4 (available in Visual Studio 2019, Preview edition
only, as of 2019-11-19). TensorFlow needs this flag to massively reduce
compile times, but until 16.4 is officially released, we can't depend on it.
See also
https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion
Because it's very annoying to check this manually (to check the MSVC installed
versions, you need to use the registry, and it's not clear if Bazel will be
using that install version anyway), we expect enviroments who know they may
use this flag to export TF_VC_VERSION=16.4
TODO(angerson, gunan): Remove this function when TensorFlow's minimum VS
version is upgraded to 16.4.
Arguments:
environ_cp: Environment of the current execution
Returns:
boolean, whether or not /d2ReducedOptimizeHugeFunctions is available on this
machine.
"""
return float(environ_cp.get('TF_VC_VERSION', '0')) >= 16.4
def set_windows_build_flags(environ_cp):
"""Set Windows specific build options."""
if is_reduced_optimize_huge_functions_available(environ_cp):
write_to_bazelrc(
'build --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions'
)
if get_var(
environ_cp, 'TF_OVERRIDE_EIGEN_STRONG_INLINE', 'Eigen strong inline',
True, ('Would you like to override eigen strong inline for some C++ '
'compilation to reduce the compilation time?'),
'Eigen strong inline overridden.', 'Not overriding eigen strong inline, '
'some compilations could take more than 20 mins.'):
# Due to a known MSVC compiler issue
# https://github.com/tensorflow/tensorflow/issues/10521
# Overriding eigen strong inline speeds up the compiling of
# conv_grad_ops_3d.cc and conv_ops_3d.cc by 20 minutes,
# but this also hurts the performance. Let users decide what they want.
write_to_bazelrc('build --define=override_eigen_strong_inline=true')
def config_info_line(name, help_text):
"""Helper function to print formatted help text for Bazel config options."""
print('\t--config=%-12s\t# %s' % (name, help_text))
def configure_ios():
"""Configures TensorFlow for iOS builds.
This function will only be executed if `is_macos()` is true.
"""
if not is_macos():
return
for filepath in APPLE_BAZEL_FILES:
existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple')
renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath)
symlink_force(existing_filepath, renamed_filepath)
for filepath in IOS_FILES:
filename = os.path.basename(filepath)
new_filepath = os.path.join(_TF_WORKSPACE_ROOT, filename)
symlink_force(filepath, new_filepath)
def validate_cuda_config(environ_cp):
"""Run find_cuda_config.py and return cuda_toolkit_path, or None."""
def maybe_encode_env(env):
"""Encodes unicode in env to str on Windows python 2.x."""
if not is_windows() or sys.version_info[0] != 2:
return env
for k, v in env.items():
if isinstance(k, unicode):
k = k.encode('ascii')
if isinstance(v, unicode):
v = v.encode('ascii')
env[k] = v
return env
cuda_libraries = ['cuda', 'cudnn']
if is_linux():
if int(environ_cp.get('TF_NEED_TENSORRT', False)):
cuda_libraries.append('tensorrt')
if environ_cp.get('TF_NCCL_VERSION', None):
cuda_libraries.append('nccl')
proc = subprocess.Popen(
[environ_cp['PYTHON_BIN_PATH'], 'third_party/gpus/find_cuda_config.py'] +
cuda_libraries,
stdout=subprocess.PIPE,
env=maybe_encode_env(environ_cp))
if proc.wait():
# Errors from find_cuda_config.py were sent to stderr.
print('Asking for detailed CUDA configuration...\n')
return False
config = dict(
tuple(line.decode('ascii').rstrip().split(': ')) for line in proc.stdout)
print('Found CUDA %s in:' % config['cuda_version'])
print(' %s' % config['cuda_library_dir'])
print(' %s' % config['cuda_include_dir'])
print('Found cuDNN %s in:' % config['cudnn_version'])
print(' %s' % config['cudnn_library_dir'])
print(' %s' % config['cudnn_include_dir'])
if 'tensorrt_version' in config:
print('Found TensorRT %s in:' % config['tensorrt_version'])
print(' %s' % config['tensorrt_library_dir'])
print(' %s' % config['tensorrt_include_dir'])
if config.get('nccl_version', None):
print('Found NCCL %s in:' % config['nccl_version'])
print(' %s' % config['nccl_library_dir'])
print(' %s' % config['nccl_include_dir'])
print('\n')
environ_cp['CUDA_TOOLKIT_PATH'] = config['cuda_toolkit_path']
return True
def main():
global _TF_WORKSPACE_ROOT
global _TF_BAZELRC
global _TF_CURRENT_BAZEL_VERSION
parser = argparse.ArgumentParser()
parser.add_argument(
'--workspace',
type=str,
default=os.path.abspath(os.path.dirname(__file__)),
help='The absolute path to your active Bazel workspace.')
args = parser.parse_args()
_TF_WORKSPACE_ROOT = args.workspace
_TF_BAZELRC = os.path.join(_TF_WORKSPACE_ROOT, _TF_BAZELRC_FILENAME)
# Make a copy of os.environ to be clear when functions and getting and setting
# environment variables.
environ_cp = dict(os.environ)
try:
current_bazel_version = check_bazel_version(_TF_MIN_BAZEL_VERSION,
_TF_MAX_BAZEL_VERSION)
except subprocess.CalledProcessError as e:
print('Error checking bazel version: ', e.output.decode('UTF-8').strip())
raise e
_TF_CURRENT_BAZEL_VERSION = convert_version_to_int(current_bazel_version)
reset_tf_configure_bazelrc()
cleanup_makefile()
setup_python(environ_cp)
if is_windows():
environ_cp['TF_NEED_OPENCL'] = '0'
environ_cp['TF_CUDA_CLANG'] = '0'
environ_cp['TF_NEED_TENSORRT'] = '0'
# TODO(ibiryukov): Investigate using clang as a cpu or cuda compiler on
# Windows.
environ_cp['TF_DOWNLOAD_CLANG'] = '0'
environ_cp['TF_NEED_MPI'] = '0'
if is_macos():
environ_cp['TF_NEED_TENSORRT'] = '0'
else:
environ_cp['TF_CONFIGURE_IOS'] = '0'
if environ_cp.get('TF_ENABLE_XLA', '1') == '1':
write_to_bazelrc('build --config=xla')
set_action_env_var(
environ_cp, 'TF_NEED_ROCM', 'ROCm', False, bazel_config_name='rocm')
if (environ_cp.get('TF_NEED_ROCM') == '1' and
'LD_LIBRARY_PATH' in environ_cp and
environ_cp.get('LD_LIBRARY_PATH') != '1'):
write_action_env_to_bazelrc('LD_LIBRARY_PATH',
environ_cp.get('LD_LIBRARY_PATH'))
if (environ_cp.get('TF_NEED_ROCM') == '1' and environ_cp.get('ROCM_PATH')):
write_action_env_to_bazelrc('ROCM_PATH', environ_cp.get('ROCM_PATH'))
write_action_env_to_bazelrc('ROCM_ROOT', environ_cp.get('ROCM_PATH'))
if ((environ_cp.get('TF_NEED_ROCM') == '1') and
(environ_cp.get('TF_ENABLE_MLIR_GENERATED_GPU_KERNELS') == '1')):
write_to_bazelrc(
'build:rocm --define tensorflow_enable_mlir_generated_gpu_kernels=1')
environ_cp['TF_NEED_CUDA'] = str(
int(get_var(environ_cp, 'TF_NEED_CUDA', 'CUDA', False)))
if (environ_cp.get('TF_NEED_CUDA') == '1' and
'TF_CUDA_CONFIG_REPO' not in environ_cp):
set_action_env_var(
environ_cp,
'TF_NEED_TENSORRT',
'TensorRT',
False,
bazel_config_name='tensorrt')
environ_save = dict(environ_cp)
for _ in range(_DEFAULT_PROMPT_ASK_ATTEMPTS):
if validate_cuda_config(environ_cp):
cuda_env_names = [
'TF_CUDA_VERSION',
'TF_CUBLAS_VERSION',
'TF_CUDNN_VERSION',
'TF_TENSORRT_VERSION',
'TF_NCCL_VERSION',
'TF_CUDA_PATHS',
# Items below are for backwards compatibility when not using
# TF_CUDA_PATHS.
'CUDA_TOOLKIT_PATH',
'CUDNN_INSTALL_PATH',
'NCCL_INSTALL_PATH',
'NCCL_HDR_PATH',
'TENSORRT_INSTALL_PATH'
]
# Note: set_action_env_var above already writes to bazelrc.
for name in cuda_env_names:
if name in environ_cp:
write_action_env_to_bazelrc(name, environ_cp[name])
break
# Restore settings changed below if CUDA config could not be validated.
environ_cp = dict(environ_save)
set_tf_cuda_version(environ_cp)
set_tf_cudnn_version(environ_cp)
if is_linux():
set_tf_tensorrt_version(environ_cp)
set_tf_nccl_version(environ_cp)
set_tf_cuda_paths(environ_cp)
else:
raise UserInputError(
'Invalid CUDA setting were provided %d '
'times in a row. Assuming to be a scripting mistake.' %
_DEFAULT_PROMPT_ASK_ATTEMPTS)
set_tf_cuda_compute_capabilities(environ_cp)
if 'LD_LIBRARY_PATH' in environ_cp and environ_cp.get(
'LD_LIBRARY_PATH') != '1':
write_action_env_to_bazelrc('LD_LIBRARY_PATH',
environ_cp.get('LD_LIBRARY_PATH'))
set_tf_cuda_clang(environ_cp)
if environ_cp.get('TF_CUDA_CLANG') == '1':
# Ask whether we should download the clang toolchain.
set_tf_download_clang(environ_cp)
if environ_cp.get('TF_DOWNLOAD_CLANG') != '1':
# Set up which clang we should use as the cuda / host compiler.
set_clang_cuda_compiler_path(environ_cp)
else:
# Use downloaded LLD for linking.
write_to_bazelrc('build:cuda_clang --config=download_clang_use_lld')
else:
# Set up which gcc nvcc should use as the host compiler
# No need to set this on Windows
if not is_windows():
set_gcc_host_compiler_path(environ_cp)
set_other_cuda_vars(environ_cp)
else:
# CUDA not required. Ask whether we should download the clang toolchain and
# use it for the CPU build.
set_tf_download_clang(environ_cp)
# ROCm / CUDA are mutually exclusive.
# At most 1 GPU platform can be configured.
gpu_platform_count = 0
if environ_cp.get('TF_NEED_ROCM') == '1':
gpu_platform_count += 1
if environ_cp.get('TF_NEED_CUDA') == '1':
gpu_platform_count += 1
if gpu_platform_count >= 2:
raise UserInputError('CUDA / ROCm are mututally exclusive. '
'At most 1 GPU platform can be configured.')
set_cc_opt_flags(environ_cp)
set_system_libs_flag(environ_cp)
if is_windows():
set_windows_build_flags(environ_cp)
if get_var(environ_cp, 'TF_SET_ANDROID_WORKSPACE', 'android workspace', False,
('Would you like to interactively configure ./WORKSPACE for '
'Android builds?'), 'Searching for NDK and SDK installations.',
'Not configuring the WORKSPACE for Android builds.'):
create_android_ndk_rule(environ_cp)
create_android_sdk_rule(environ_cp)
system_specific_test_config(environ_cp)
set_action_env_var(environ_cp, 'TF_CONFIGURE_IOS', 'iOS', False)
if environ_cp.get('TF_CONFIGURE_IOS') == '1':
configure_ios()
print('Preconfigured Bazel build configs. You can use any of the below by '
'adding "--config=<>" to your build command. See .bazelrc for more '
'details.')
config_info_line('mkl', 'Build with MKL support.')
config_info_line('mkl_aarch64', 'Build with oneDNN support for Aarch64.')
config_info_line('monolithic', 'Config for mostly static monolithic build.')
config_info_line('ngraph', 'Build with Intel nGraph support.')
config_info_line('numa', 'Build with NUMA support.')
config_info_line(
'dynamic_kernels',
'(Experimental) Build kernels into separate shared objects.')
config_info_line('v2', 'Build TensorFlow 2.x instead of 1.x.')
print('Preconfigured Bazel build configs to DISABLE default on features:')
config_info_line('noaws', 'Disable AWS S3 filesystem support.')
config_info_line('nogcp', 'Disable GCP support.')
config_info_line('nohdfs', 'Disable HDFS support.')
config_info_line('nonccl', 'Disable NVIDIA NCCL support.')
if __name__ == '__main__':
main()
| apache-2.0 |
Ezeer/VegaStrike_win32FR | vegastrike/boost/1_28/src/gen_caller.py | 2 | 4192 | # (C) Copyright David Abrahams 2000. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears
# in all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
#
# The author gratefully acknowleges the support of Dragon Systems, Inc., in
# producing this work.
from gen_function import *
import string
header = '''// (C) Copyright David Abrahams 2000. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
// producing this work.
//
// This file generated for %d-argument member functions and %d-argument free
// functions by gen_caller.python
'''
body_sections = (
'''
#ifndef CALLER_DWA05090_H_
# define CALLER_DWA05090_H_
# include <boost/python/detail/config.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/config.hpp>
# include <boost/python/detail/signatures.hpp>
# include <boost/python/detail/none.hpp>
namespace boost { namespace python {
// Calling C++ from Python
template <class R>
struct caller
{
''',
'''
''',
''' // Free functions
''',
'''};
template <>
struct caller<void>
{
''',
'''
''',
'''
// Free functions
''',
'''};
}} // namespace boost::python
#endif
''')
#'
member_function = ''' template <class T%(, class A%n%)>
static PyObject* call(%1 (T::*pmf)(%(A%n%:, %))%2, PyObject* args, PyObject* /* keywords */ ) {
PyObject* self;
%( PyObject* a%n;
%) if (!PyArg_ParseTuple(args, const_cast<char*>("O%(O%)"), &self%(, &a%n%)))
return 0;
T& target = from_python(self, type<T&>());
%3(target.*pmf)(%(from_python(a%n, type<A%n>())%:,
%))%4
}
'''
free_function = '''%{ template <%(class A%n%:, %)>
%} static PyObject* call(%1 (*f)(%(A%n%:, %)), PyObject* args, PyObject* /* keywords */ ) {
%( PyObject* a%n;
%) if (!PyArg_ParseTuple(args, const_cast<char*>("%(O%)")%(, &a%n%)))
return 0;
%2f(%(from_python(a%n, type<A%n>())%:,
%))%3
}
'''
def gen_caller(member_function_args, free_function_args = None):
if free_function_args is None:
free_function_args = member_function_args + 1
return_none = ''';
return detail::none();'''
return (header % (member_function_args, free_function_args)
+ body_sections[0]
+ gen_functions(member_function, member_function_args,
'R', '', 'return to_python(', ');')
+ body_sections[1]
+ gen_functions(member_function, member_function_args,
'R', ' const', 'return to_python(', ');')
+ body_sections[2]
+ gen_functions(free_function, free_function_args,
'R', 'return to_python(', ');')
+ body_sections[3]
# specialized part for void return values begins here
+ gen_functions(member_function, member_function_args,
'void', '', '', return_none)
+ body_sections[4]
+ gen_functions(member_function, member_function_args,
'void', ' const', '', return_none)
+ body_sections[5]
+ gen_functions(free_function, free_function_args,
'void', '', return_none)
+ body_sections[6]
)
if __name__ == '__main__':
import sys
if len(sys.argv) == 1:
member_function_args = 5
free_function_args = 6
else:
member_function_args = int(sys.argv[1])
if len(sys.argv) > 2:
free_function_args = int(sys.argv[2])
else:
free_function_args = member_function_args
print gen_caller(member_function_args, free_function_args)
| mit |
endlessm/chromium-browser | components/exo/wayland/fuzzer/wayland_templater.py | 2 | 7550 | # Copyright (c) 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Templatize a file based on wayland specifications.
The templating engine takes an input template and one or more wayland
specifications (see third_party/wayland/src/protocol/wayland.dtd), and
instantiates the template based on the wayland content.
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import subprocess
import sys
import jinja2
import wayland_utils as wlu
proto_type_conversions = {
'array': 'bytes',
'fixed': 'double',
'fd': 'small_value',
'int': 'int32',
'new_id': None,
'object': 'small_value',
'string': 'string',
'uint': 'uint32',
}
cpp_type_conversions = {
'array': 'struct wl_array*',
'fd': 'int',
'fixed': 'wl_fixed_t',
'int': 'int32_t',
'string': 'const char*',
'uint': 'uint32_t',
}
def GetClangFormatPath():
"""Returns the path to clang-format, for formatting the output."""
if sys.platform.startswith('linux'):
platform, exe_suffix = 'linux64', ''
exe_suffix = ""
elif sys.platform == 'darwin':
platform, exe_suffix = 'mac', ''
elif sys.platform == 'win32':
platform, exe_suffix = 'win', '.exe'
else:
assert False, 'Unknown platform: ' + sys.platform
this_dir = os.path.abspath(os.path.dirname(__file__))
root_src_dir = os.path.abspath(
os.path.join(this_dir, '..', '..', '..', '..'))
buildtools_platform_dir = os.path.join(root_src_dir, 'buildtools', platform)
return os.path.join(buildtools_platform_dir, 'clang-format' + exe_suffix)
def ClangFormat(source, filename):
"""Runs clang-format on source and returns the result."""
# clang-format the output, for better readability and for
# -Wmisleading-indentation.
clang_format_cmd = [GetClangFormatPath(), '--assume-filename=' + filename]
proc = subprocess.Popen(
clang_format_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdout_output, stderr_output = proc.communicate(input=source)
retcode = proc.wait()
if retcode != 0:
raise CalledProcessError(retcode, 'clang-format error: ' + stderr_output)
return stdout_output
def WriteIfChanged(contents, filename):
"""Writes contents to filename.
If filename already has the right contents, nothing is written so that
the mtime on filename doesn't change.
"""
if os.path.exists(filename):
with open(filename) as in_fi:
if in_fi.read() == contents:
return
with open(filename, 'w') as out_fi:
out_fi.write(contents)
def GetCppPtrType(interface_name):
"""Returns the c++ type associated with interfaces of the given name.
Args:
interface_name: the name of the interface you want the type for, or None.
Returns:
the c++ type which wayland will generate for this interface, or void* if
the interface_name is none. We use "struct foo*" due to a collision between
typenames and function names (specifically, wp_presentation has a feedback()
method and there is also a wp_presentation_feedback interface).
"""
if not interface_name:
return 'void*'
return 'struct ' + interface_name + '*'
def GetCppType(arg):
ty = arg.attrib['type']
if ty in ['object', 'new_id']:
return GetCppPtrType(arg.get('interface'))
return cpp_type_conversions[ty]
class TemplaterContext(object):
"""The context object used for recording stateful/expensive things.
An instance of this class is used when generating the template data, we use
it to cache pre-computed information, as well as to side-effect stateful
queries (such as counters) while generating the template data.
"""
def __init__(self, protocols):
self.non_global_names = {
wlu.GetConstructedInterface(m) for _, _, m in wlu.AllMessages(protocols)
} - {None}
self.interfaces_with_listeners = {
i.attrib['name']
for p, i in wlu.AllInterfaces(protocols)
if wlu.NeedsListener(i)
}
self.counts = {}
def GetAndIncrementCount(self, counter):
"""Return the number of times the given key has been counted.
Args:
counter: the key used to identify this count value.
Returns:
An int which is the number of times this method has been called before
with this counter's key.
"""
self.counts[counter] = self.counts.get(counter, 0) + 1
return self.counts[counter] - 1
def GetArg(arg):
ty = arg.attrib['type']
return {
'name': arg.attrib['name'],
'type': ty,
'nullable': arg.get('allow-null', 'false') == 'true',
'proto_type': proto_type_conversions[ty],
'cpp_type': GetCppType(arg),
'interface': arg.get('interface'),
'doc': wlu.GetDocumentation(arg),
}
def GetMessage(message, context):
name = message.attrib['name']
constructed = wlu.GetConstructedInterface(message)
return {
'name':
name,
'tag':
message.tag,
'idx':
context.GetAndIncrementCount('message_index'),
'args': [GetArg(a) for a in message.findall('arg')],
'is_constructor':
wlu.IsConstructor(message),
'is_destructor':
wlu.IsDestructor(message),
'constructed':
constructed,
'constructed_has_listener':
constructed in context.interfaces_with_listeners,
'doc':
wlu.GetDocumentation(message),
}
def GetInterface(interface, context):
name = interface.attrib['name']
return {
'name':
name,
'idx':
context.GetAndIncrementCount('interface_index'),
'cpp_type':
GetCppPtrType(name),
'is_global':
name not in context.non_global_names,
'events': [GetMessage(m, context) for m in interface.findall('event')],
'requests': [
GetMessage(m, context) for m in interface.findall('request')
],
'has_listener':
wlu.NeedsListener(interface),
'doc':
wlu.GetDocumentation(interface),
}
def GetTemplateData(protocol_paths):
protocols = wlu.ReadProtocols(protocol_paths)
context = TemplaterContext(protocols)
interfaces = []
for p in protocols:
for i in p.findall('interface'):
interfaces.append(GetInterface(i, context))
assert all(p.endswith('.xml') for p in protocol_paths)
return {
'protocol_names': [str(os.path.basename(p))[:-4] for p in protocol_paths],
'interfaces':
interfaces,
}
def InstantiateTemplate(in_tmpl, in_ctx, output, in_directory):
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(in_directory),
keep_trailing_newline=True, # newline-terminate generated files
lstrip_blocks=True,
trim_blocks=True) # so don't need {%- -%} everywhere
template = env.get_template(in_tmpl)
raw_output = template.render(in_ctx)
# For readability, and for -Wmisleading-indentation.
if output.endswith(('.h', '.cc', '.proto')):
formatted_output = ClangFormat(raw_output, filename=output)
else:
formatted_output = raw_output
WriteIfChanged(formatted_output, filename=output)
def main(argv):
"""Execute the templater, based on the user provided args.
Args:
argv: the command line arguments (including the script name)
"""
parsed_args = wlu.ParseOpts(argv)
InstantiateTemplate(parsed_args.input, GetTemplateData(parsed_args.spec),
parsed_args.output, parsed_args.directory)
if __name__ == '__main__':
main(sys.argv)
| bsd-3-clause |
shsingh/ansible | lib/ansible/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py | 23 | 1808 | #
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is auto generated by the resource
# module builder playbook.
#
# Do not edit this file manually.
#
# Changes to this file will be over written
# by the resource module builder.
#
# Changes should be made in the model used to
# generate this file or in the resource module
# builder template.
#
#############################################
"""
The arg spec for the junos_l2_interfaces module
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class L2_interfacesArgs(object):
"""The arg spec for the junos_l2_interfaces module
"""
def __init__(self, **kwargs):
pass
argument_spec = {'config': {'elements': 'dict',
'options': {'access': {'type': 'dict', 'options': {'vlan': {'type': 'str'}}},
'name': {'required': True, 'type': 'str'},
'trunk': {'type': 'dict', 'options': {'allowed_vlans': {'type': 'list'},
'native_vlan': {'type': 'str'}}},
'unit': {'type': 'int'},
'enhanced_layer': {'type': 'bool'}},
'type': 'list'},
'state': {'choices': ['merged', 'replaced', 'overridden', 'deleted'],
'default': 'merged',
'type': 'str'}}
| gpl-3.0 |
Ziqi-Li/bknqgis | pandas/pandas/tests/indexes/test_frozen.py | 18 | 2435 | import numpy as np
from pandas.util import testing as tm
from pandas.tests.test_base import CheckImmutable, CheckStringMixin
from pandas.core.indexes.frozen import FrozenList, FrozenNDArray
from pandas.compat import u
class TestFrozenList(CheckImmutable, CheckStringMixin):
mutable_methods = ('extend', 'pop', 'remove', 'insert')
unicode_container = FrozenList([u("\u05d0"), u("\u05d1"), "c"])
def setup_method(self, method):
self.lst = [1, 2, 3, 4, 5]
self.container = FrozenList(self.lst)
self.klass = FrozenList
def test_add(self):
result = self.container + (1, 2, 3)
expected = FrozenList(self.lst + [1, 2, 3])
self.check_result(result, expected)
result = (1, 2, 3) + self.container
expected = FrozenList([1, 2, 3] + self.lst)
self.check_result(result, expected)
def test_inplace(self):
q = r = self.container
q += [5]
self.check_result(q, self.lst + [5])
# other shouldn't be mutated
self.check_result(r, self.lst)
class TestFrozenNDArray(CheckImmutable, CheckStringMixin):
mutable_methods = ('put', 'itemset', 'fill')
unicode_container = FrozenNDArray([u("\u05d0"), u("\u05d1"), "c"])
def setup_method(self, method):
self.lst = [3, 5, 7, -2]
self.container = FrozenNDArray(self.lst)
self.klass = FrozenNDArray
def test_shallow_copying(self):
original = self.container.copy()
assert isinstance(self.container.view(), FrozenNDArray)
assert not isinstance(self.container.view(np.ndarray), FrozenNDArray)
assert self.container.view() is not self.container
tm.assert_numpy_array_equal(self.container, original)
# Shallow copy should be the same too
assert isinstance(self.container._shallow_copy(), FrozenNDArray)
# setting should not be allowed
def testit(container):
container[0] = 16
self.check_mutable_error(testit, self.container)
def test_values(self):
original = self.container.view(np.ndarray).copy()
n = original[0] + 15
vals = self.container.values()
tm.assert_numpy_array_equal(original, vals)
assert original is not vals
vals[0] = n
assert isinstance(self.container, FrozenNDArray)
tm.assert_numpy_array_equal(self.container.values(), original)
assert vals[0] == n
| gpl-2.0 |
Azure/azure-sdk-for-python | sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cli_mgmt_cosmosdb_gremlin.py | 1 | 11131 | # 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.
#--------------------------------------------------------------------------
# Current Operation Coverage:
# GremlinResources: 16/16
import unittest
import azure.mgmt.cosmosdb
from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer, ResourceGroupPreparer
AZURE_LOCATION = 'eastus'
class MgmtCosmosDBTest(AzureMgmtTestCase):
def setUp(self):
super(MgmtCosmosDBTest, self).setUp()
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.cosmosdb.CosmosDBManagementClient
)
@unittest.skip('hard to test')
@ResourceGroupPreparer(location=AZURE_LOCATION)
def test_gremlin_resource(self, resource_group):
RESOURCE_GROUP = resource_group.name
ACCOUNT_NAME = "myaccountxxyyzzz"
DATABASE_NAME = "myDatabase"
GRAPH_NAME = "myGraph"
#--------------------------------------------------------------------------
# /DatabaseAccounts/put/CosmosDBDatabaseAccountCreateMin[put]
#--------------------------------------------------------------------------
BODY = {
"location": AZURE_LOCATION,
"kind": "GlobalDocumentDB",
"database_account_offer_type": "Standard",
"locations": [
{
"location_name": "eastus",
"is_zone_redundant": False,
"failover_priority": "0"
},
],
"capabilities": [
{
"name": "EnableGremlin"
}
],
"api_properties": {}
}
result = self.mgmt_client.database_accounts.begin_create_or_update(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, create_update_parameters=BODY)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/put/CosmosDBGremlinDatabaseCreateUpdate[put]
#--------------------------------------------------------------------------
BODY = {
"location": AZURE_LOCATION,
"resource": {
"id": DATABASE_NAME
},
"options": {
"throughput": "2000"
}
}
result = self.mgmt_client.gremlin_resources.begin_create_update_gremlin_database(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, create_update_gremlin_database_parameters=BODY)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/put/CosmosDBGremlinGraphCreateUpdate[put]
#--------------------------------------------------------------------------
BODY = {
"location": AZURE_LOCATION,
"resource": {
"id": GRAPH_NAME,
"indexing_policy": {
"indexing_mode": "Consistent",
"automatic": True,
"included_paths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"data_type": "String",
"precision": "-1"
},
{
"kind": "Range",
"data_type": "Number",
"precision": "-1"
}
]
}
],
"excluded_paths": []
},
"partition_key": {
"paths": [
"/AccountNumber"
],
"kind": "Hash"
},
"default_ttl": "100",
"conflict_resolution_policy": {
"mode": "LastWriterWins",
"conflict_resolution_path": "/path"
}
},
"options": {
"throughput": "2000"
}
}
result = self.mgmt_client.gremlin_resources.begin_create_update_gremlin_graph(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME, create_update_gremlin_graph_parameters=BODY)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/put/CosmosDBGremlinDatabaseThroughputUpdate[put]
#--------------------------------------------------------------------------
BODY = {
"location": AZURE_LOCATION,
"resource": {
"throughput": "400"
}
}
result = self.mgmt_client.gremlin_resources.begin_update_gremlin_database_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, update_throughput_parameters=BODY)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/put/CosmosDBGremlinGraphThroughputUpdate[put]
#--------------------------------------------------------------------------
BODY = {
"location": AZURE_LOCATION,
"resource": {
"throughput": "400"
}
}
result = self.mgmt_client.gremlin_resources.begin_update_gremlin_graph_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME, update_throughput_parameters=BODY)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinGraphThroughputGet[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.get_gremlin_graph_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinDatabaseThroughputGet[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.get_gremlin_database_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinGraphGet[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.get_gremlin_graph(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinGraphList[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.list_gremlin_graphs(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinDatabaseGet[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.get_gremlin_database(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/get/CosmosDBGremlinDatabaseList[get]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.list_gremlin_databases(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME)
#--------------------------------------------------------------------------
# /GremlinResources/post/CosmosDBGremlinGraphMigrateToAutoscale[post]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_migrate_gremlin_graph_to_autoscale(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/post/CosmosDBGremlinGraphMigrateToManualThroughput[post]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_migrate_gremlin_graph_to_manual_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/post/CosmosDBGremlinDatabaseMigrateToAutoscale[post]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_migrate_gremlin_database_to_autoscale(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/post/CosmosDBGremlinDatabaseMigrateToManualThroughput[post]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_migrate_gremlin_database_to_manual_throughput(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/delete/CosmosDBGremlinGraphDelete[delete]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_delete_gremlin_graph(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME, graph_name=GRAPH_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /GremlinResources/delete/CosmosDBGremlinDatabaseDelete[delete]
#--------------------------------------------------------------------------
result = self.mgmt_client.gremlin_resources.begin_delete_gremlin_database(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, database_name=DATABASE_NAME)
result = result.result()
#--------------------------------------------------------------------------
# /DatabaseAccounts/delete/CosmosDBDatabaseAccountDelete[delete]
#--------------------------------------------------------------------------
result = self.mgmt_client.database_accounts.begin_delete(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME)
result = result.result()
| mit |
soundcloud/essentia | test/src/unittest/sfx/test_derivativesfx.py | 10 | 1765 | #!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), either version 3 of the License, or (at your
# option) any later version.
#
# 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 GNU General Public License for more
# details.
#
# You should have received a copy of the Affero GNU General Public License
# version 3 along with this program. If not, see http://www.gnu.org/licenses/
from essentia_test import *
import numpy
class TestDerivativeSfx(TestCase):
def testEmpty(self):
self.assertComputeFails(DerivativeSFX(), [])
def testZero(self):
self.assertEqual(DerivativeSFX()([0]*100), (0.0, 0.0))
def testOne(self):
self.assertEqual(DerivativeSFX()([1234]), (1.0, 1234))
def testAscending(self):
derAvAfterMax, maxDerBeforeMax = DerivativeSFX()(list(numpy.linspace(0.0, 1.0, 100)))
self.assertEqual(derAvAfterMax, maxDerBeforeMax)
def testDescending(self):
self.assertEqual(DerivativeSFX()(list(numpy.linspace(1.0, 0.0, 100))), (0.0, 1.0))
def testRegression(self):
input = list(numpy.linspace(0.0, 1.0, 100)) + list(numpy.linspace(1.0, 0.0, 100))
self.assertAlmostEqualVector(DerivativeSFX()(input), [-0.0194097850471735, 0.010101020336151123])
suite = allTests(TestDerivativeSfx)
if __name__ == '__main__':
TextTestRunner(verbosity=2).run(suite)
| agpl-3.0 |
pytorch/vision | torchvision/datasets/cifar.py | 1 | 6094 | from PIL import Image
import os
import os.path
import numpy as np
import pickle
import torch
from typing import Any, Callable, Optional, Tuple
from .vision import VisionDataset
from .utils import check_integrity, download_and_extract_archive
class CIFAR10(VisionDataset):
"""`CIFAR10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ Dataset.
Args:
root (string): Root directory of dataset where directory
``cifar-10-batches-py`` exists or will be saved to if download is set to True.
train (bool, optional): If True, creates dataset from training set, otherwise
creates from test set.
transform (callable, optional): A function/transform that takes in an PIL image
and returns a transformed version. E.g, ``transforms.RandomCrop``
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
download (bool, optional): If true, downloads the dataset from the internet and
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
"""
base_folder = 'cifar-10-batches-py'
url = "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
filename = "cifar-10-python.tar.gz"
tgz_md5 = 'c58f30108f718f92721af3b95e74349a'
train_list = [
['data_batch_1', 'c99cafc152244af753f735de768cd75f'],
['data_batch_2', 'd4bba439e000b95fd0a9bffe97cbabec'],
['data_batch_3', '54ebc095f3ab1f0389bbae665268c751'],
['data_batch_4', '634d18415352ddfa80567beed471001a'],
['data_batch_5', '482c414d41f54cd18b22e5b47cb7c3cb'],
]
test_list = [
['test_batch', '40351d587109b95175f43aff81a1287e'],
]
meta = {
'filename': 'batches.meta',
'key': 'label_names',
'md5': '5ff9c542aee3614f3951f8cda6e48888',
}
def __init__(
self,
root: str,
train: bool = True,
transform: Optional[Callable] = None,
target_transform: Optional[Callable] = None,
download: bool = False,
) -> None:
super(CIFAR10, self).__init__(root, transform=transform,
target_transform=target_transform)
torch._C._log_api_usage_once(f"torchvision.datasets.{self.__class__.__name__}")
self.train = train # training set or test set
if download:
self.download()
if not self._check_integrity():
raise RuntimeError('Dataset not found or corrupted.' +
' You can use download=True to download it')
if self.train:
downloaded_list = self.train_list
else:
downloaded_list = self.test_list
self.data: Any = []
self.targets = []
# now load the picked numpy arrays
for file_name, checksum in downloaded_list:
file_path = os.path.join(self.root, self.base_folder, file_name)
with open(file_path, 'rb') as f:
entry = pickle.load(f, encoding='latin1')
self.data.append(entry['data'])
if 'labels' in entry:
self.targets.extend(entry['labels'])
else:
self.targets.extend(entry['fine_labels'])
self.data = np.vstack(self.data).reshape(-1, 3, 32, 32)
self.data = self.data.transpose((0, 2, 3, 1)) # convert to HWC
self._load_meta()
def _load_meta(self) -> None:
path = os.path.join(self.root, self.base_folder, self.meta['filename'])
if not check_integrity(path, self.meta['md5']):
raise RuntimeError('Dataset metadata file not found or corrupted.' +
' You can use download=True to download it')
with open(path, 'rb') as infile:
data = pickle.load(infile, encoding='latin1')
self.classes = data[self.meta['key']]
self.class_to_idx = {_class: i for i, _class in enumerate(self.classes)}
def __getitem__(self, index: int) -> Tuple[Any, Any]:
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""
img, target = self.data[index], self.targets[index]
# doing this so that it is consistent with all other datasets
# to return a PIL Image
img = Image.fromarray(img)
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target
def __len__(self) -> int:
return len(self.data)
def _check_integrity(self) -> bool:
root = self.root
for fentry in (self.train_list + self.test_list):
filename, md5 = fentry[0], fentry[1]
fpath = os.path.join(root, self.base_folder, filename)
if not check_integrity(fpath, md5):
return False
return True
def download(self) -> None:
if self._check_integrity():
print('Files already downloaded and verified')
return
download_and_extract_archive(self.url, self.root, filename=self.filename, md5=self.tgz_md5)
def extra_repr(self) -> str:
return "Split: {}".format("Train" if self.train is True else "Test")
class CIFAR100(CIFAR10):
"""`CIFAR100 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ Dataset.
This is a subclass of the `CIFAR10` Dataset.
"""
base_folder = 'cifar-100-python'
url = "https://www.cs.toronto.edu/~kriz/cifar-100-python.tar.gz"
filename = "cifar-100-python.tar.gz"
tgz_md5 = 'eb9058c3a382ffc7106e4002c42a8d85'
train_list = [
['train', '16019d7e3df5f24257cddd939b257f8d'],
]
test_list = [
['test', 'f0ef6b0ae62326f3e7ffdfab6717acfc'],
]
meta = {
'filename': 'meta',
'key': 'fine_label_names',
'md5': '7973b15100ade9c7d40fb424638fde48',
}
| bsd-3-clause |
10clouds/edx-platform | cms/djangoapps/contentstore/features/video.py | 7 | 2089 | # pylint: disable=missing-docstring
from lettuce import world, step
SELECTORS = {
'spinner': '.video-wrapper .spinner',
'controls': 'section.video-controls',
}
# We should wait 300 ms for event handler invocation + 200ms for safety.
DELAY = 0.5
@step('I have uploaded subtitles "([^"]*)"$')
def i_have_uploaded_subtitles(_step, sub_id):
_step.given('I go to the files and uploads page')
_step.given('I upload the test file "subs_{}.srt.sjson"'.format(sub_id.strip()))
@step('I have created a Video component$')
def i_created_a_video_component(step):
step.given('I am in Studio editing a new unit')
world.create_component_instance(
step=step,
category='video',
)
world.wait_for_xmodule()
world.disable_jquery_animations()
world.wait_for_present('.is-initialized')
world.wait(DELAY)
world.wait_for_invisible(SELECTORS['spinner'])
if not world.youtube.config.get('youtube_api_blocked'):
world.wait_for_visible(SELECTORS['controls'])
@step('I have created a Video component with subtitles$')
def i_created_a_video_with_subs(_step):
_step.given('I have created a Video component with subtitles "3_yD_cEKoCk"')
@step('I have created a Video component with subtitles "([^"]*)"$')
def i_created_a_video_with_subs_with_name(_step, sub_id):
_step.given('I have created a Video component')
# Store the current URL so we can return here
video_url = world.browser.url
# Upload subtitles for the video using the upload interface
_step.given('I have uploaded subtitles "{}"'.format(sub_id))
# Return to the video
world.visit(video_url)
world.wait_for_xmodule()
# update .sub filed with proper subs name (which mimics real Studio/XML behavior)
# this is needed only for that videos which are created in acceptance tests.
_step.given('I edit the component')
world.wait_for_ajax_complete()
_step.given('I save changes')
world.disable_jquery_animations()
world.wait_for_present('.is-initialized')
world.wait_for_invisible(SELECTORS['spinner'])
| agpl-3.0 |
sparkslabs/kamaelia | Sketches/RJL/Kamaelia/Community/RJL/Kamaelia/Util/UnseenOnly.py | 3 | 1576 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# 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.
# -------------------------------------------------------------------------
#
"""\
=================
UnseenOnly component
=================
This component forwards on any messages it receives that it has not
seen before.
Example Usage
-------------
Lines entered into this setup will only be duplicated on screen the
first time they are entered.
pipeline(
ConsoleReader()
UnseenOnly()
ConsoleEchoer()
).run()
"""
from PureTransformer import PureTransformer
class UnseenOnly(PureTransformer):
def __init__(self):
super(UnseenOnly, self).__init__()
self.seen = {}
def processMessage(self, msg):
if not self.seen.get(msg, False):
self.seen[msg] = True
return msg
| apache-2.0 |
grigorisg9gr/menpofit | menpofit/sdm/algorithm/fullyparametric.py | 6 | 16364 | import numpy as np
from functools import partial
from menpo.feature import no_op
from menpo.model import PCAVectorModel
from menpofit.error import euclidean_bb_normalised_error
from menpofit.result import MultiScaleParametricIterativeResult
from menpofit.math import IIRLRegression, IRLRegression, OPPRegression
from menpofit.modelinstance import OrthoPDM
from menpofit.visualize import print_progress
from .base import (BaseSupervisedDescentAlgorithm,
compute_parametric_delta_x, features_per_patch,
update_parametric_estimates, print_parametric_info,
build_appearance_model, fit_parametric_shape)
class FullyParametricSDAlgorithm(BaseSupervisedDescentAlgorithm):
r"""
Abstract class for training a cascaded-regression Supervised Descent
algorithm that employs parametric shape and appearance models.
Parameters
----------
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
"""
def __init__(self, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel):
super(FullyParametricSDAlgorithm, self).__init__()
self.regressors = []
self.shape_model_cls = shape_model_cls
self.appearance_model_cls = appearance_model_cls
self.appearance_model = None
self.shape_model = None
@property
def _multi_scale_fitter_result(self):
# The result class to be used by a multi-scale fitter
return MultiScaleParametricIterativeResult
def _compute_delta_x(self, gt_shapes, current_shapes):
# This is called first - so train shape model here
if self.shape_model is None:
self.shape_model = self.shape_model_cls(gt_shapes)
return compute_parametric_delta_x(gt_shapes, current_shapes,
self.shape_model)
def _update_estimates(self, estimated_delta_x, delta_x, gt_x,
current_shapes):
update_parametric_estimates(estimated_delta_x, delta_x, gt_x,
current_shapes, self.shape_model)
def _compute_training_features(self, images, gt_shapes, current_shapes,
prefix='', verbose=False):
if self.appearance_model is None:
self.appearance_model = build_appearance_model(
images, gt_shapes, self.patch_shape, self.patch_features,
self.appearance_model_cls, verbose=verbose, prefix=prefix)
wrap = partial(print_progress,
prefix='{}Extracting patches'.format(prefix),
end_with_newline=not prefix, verbose=verbose)
features = []
for im, shapes in wrap(list(zip(images, current_shapes))):
for s in shapes:
param_feature = self._compute_test_features(im, s)
features.append(param_feature)
return np.vstack(features)
def _compute_parametric_features(self, patch):
raise NotImplementedError()
def _compute_test_features(self, image, current_shape):
patch_feature = features_per_patch(
image, current_shape, self.patch_shape, self.patch_features)
return self._compute_parametric_features(patch_feature)
def _print_regression_info(self, _, gt_shapes, n_perturbations,
delta_x, estimated_delta_x, level_index,
prefix=''):
print_parametric_info(self.shape_model, gt_shapes, n_perturbations,
delta_x, estimated_delta_x, level_index,
self._compute_error, prefix=prefix)
def run(self, image, initial_shape, gt_shape=None, return_costs=False,
**kwargs):
r"""
Run the algorithm to an image given an initial shape.
Parameters
----------
image : `menpo.image.Image` or subclass
The image to be fitted.
initial_shape : `menpo.shape.PointCloud`
The initial shape from which the fitting procedure will start.
gt_shape : `menpo.shape.PointCloud` or ``None``, optional
The ground truth shape associated to the image.
return_costs : `bool`, optional
If ``True``, then the cost function values will be computed
during the fitting procedure. Then these cost values will be
assigned to the returned `fitting_result`. *Note that this
argument currently has no effect and will raise a warning if set
to ``True``. This is because it is not possible to evaluate the
cost function of this algorithm.*
Returns
-------
fitting_result: :map:`ParametricIterativeResult`
The result of the fitting procedure.
"""
return fit_parametric_shape(image, initial_shape, self,
gt_shape=gt_shape,
return_costs=return_costs)
class ParametricAppearanceProjectOut(FullyParametricSDAlgorithm):
r"""
Abstract class for training a cascaded-regression Supervised Descent
algorithm that employs parametric shape and appearance models. The algorithm
uses the projected-out appearance vectors as features in the regression.
"""
def _compute_parametric_features(self, patch):
return self.appearance_model.project_out(patch.ravel())
class ParametricAppearanceWeights(FullyParametricSDAlgorithm):
r"""
Abstract class for training a cascaded-regression Supervised Descent
algorithm that employs parametric shape and appearance models. The algorithm
uses the projection weights of the appearance vectors as features in the
regression.
"""
def _compute_parametric_features(self, patch):
return self.appearance_model.project(patch.ravel())
class ParametricAppearanceMeanTemplate(FullyParametricSDAlgorithm):
r"""
Abstract class for training a cascaded-regression Supervised Descent
algorithm that employs parametric shape and appearance models. The algorithm
uses the centered appearance vectors as features in the regression.
"""
def _compute_parametric_features(self, patch):
return patch.ravel() - self.appearance_model.mean().ravel()
class FullyParametricWeightsNewton(ParametricAppearanceWeights):
r"""
Class for training a cascaded-regression algorithm that employs parametric
shape and appearance models using Incremental Regularized Linear
Regression (:map:`IRLRegression`). The algorithm uses the projection
weights of the appearance vectors as features in the regression.
Parameters
----------
patch_features : `callable`, optional
The features to be extracted from the patches of an image.
patch_shape : `(int, int)`, optional
The shape of the extracted patches.
n_iterations : `int`, optional
The number of iterations (cascades).
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
compute_error : `callable`, optional
The function to be used for computing the fitting error when training
each cascade.
alpha : `float`, optional
The regularization parameter.
bias : `bool`, optional
Flag that controls whether to use a bias term.
"""
def __init__(self, patch_features=no_op, patch_shape=(17, 17),
n_iterations=3, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel,
compute_error=euclidean_bb_normalised_error,
alpha=0, bias=True):
super(FullyParametricWeightsNewton, self).__init__(
shape_model_cls=shape_model_cls,
appearance_model_cls=appearance_model_cls)
self._regressor_cls = partial(IRLRegression, alpha=alpha, bias=bias)
self.patch_shape = patch_shape
self.patch_features = patch_features
self.n_iterations = n_iterations
self._compute_error = compute_error
class FullyParametricMeanTemplateNewton(ParametricAppearanceMeanTemplate):
r"""
Class for training a cascaded-regression algorithm that employs parametric
shape and appearance models using Incremental Regularized Linear
Regression (:map:`IRLRegression`). The algorithm uses the centered
appearance vectors as features in the regression.
Parameters
----------
patch_features : `callable`, optional
The features to be extracted from the patches of an image.
patch_shape : `(int, int)`, optional
The shape of the extracted patches.
n_iterations : `int`, optional
The number of iterations (cascades).
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
compute_error : `callable`, optional
The function to be used for computing the fitting error when training
each cascade.
alpha : `float`, optional
The regularization parameter.
bias : `bool`, optional
Flag that controls whether to use a bias term.
"""
def __init__(self, patch_features=no_op, patch_shape=(17, 17),
n_iterations=3, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel,
compute_error=euclidean_bb_normalised_error,
alpha=0, bias=True):
super(FullyParametricMeanTemplateNewton, self).__init__(
shape_model_cls=shape_model_cls,
appearance_model_cls=appearance_model_cls)
self._regressor_cls = partial(IRLRegression, alpha=alpha, bias=bias)
self.patch_shape = patch_shape
self.patch_features = patch_features
self.n_iterations = n_iterations
self._compute_error = compute_error
class FullyParametricProjectOutNewton(ParametricAppearanceProjectOut):
r"""
Class for training a cascaded-regression algorithm that employs
parametric shape and appearance models using Incremental Regularized Linear
Regression (:map:`IRLRegression`). The algorithm uses the projected-out
appearance vectors as features in the regression.
Parameters
----------
patch_features : `callable`, optional
The features to be extracted from the patches of an image.
patch_shape : `(int, int)`, optional
The shape of the extracted patches.
n_iterations : `int`, optional
The number of iterations (cascades).
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
compute_error : `callable`, optional
The function to be used for computing the fitting error when training
each cascade.
alpha : `float`, optional
The regularization parameter.
bias : `bool`, optional
Flag that controls whether to use a bias term.
"""
def __init__(self, patch_features=no_op, patch_shape=(17, 17),
n_iterations=3, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel,
compute_error=euclidean_bb_normalised_error,
alpha=0, bias=True):
super(FullyParametricProjectOutNewton, self).__init__(
shape_model_cls=shape_model_cls,
appearance_model_cls=appearance_model_cls)
self._regressor_cls = partial(IRLRegression, alpha=alpha, bias=bias)
self.patch_shape = patch_shape
self.patch_features = patch_features
self.n_iterations = n_iterations
self._compute_error = compute_error
class FullyParametricProjectOutGaussNewton(ParametricAppearanceProjectOut):
r"""
Class for training a cascaded-regression algorithm that employs parametric
shape and appearance models using Indirect Incremental Regularized Linear
Regression (:map:`IIRLRegression`). The algorithm uses the projected-out
appearance vectors as features in the regression.
Parameters
----------
patch_features : `callable`, optional
The features to be extracted from the patches of an image.
patch_shape : `(int, int)`, optional
The shape of the extracted patches.
n_iterations : `int`, optional
The number of iterations (cascades).
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
compute_error : `callable`, optional
The function to be used for computing the fitting error when training
each cascade.
alpha : `float`, optional
The regularization parameter.
bias : `bool`, optional
Flag that controls whether to use a bias term.
alpha2 : `float`, optional
The regularization parameter of the Hessian matrix.
"""
def __init__(self, patch_features=no_op, patch_shape=(17, 17),
n_iterations=3, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel,
compute_error=euclidean_bb_normalised_error,
alpha=0, bias=True, alpha2=0):
super(FullyParametricProjectOutGaussNewton, self).__init__(
shape_model_cls=shape_model_cls,
appearance_model_cls=appearance_model_cls)
self._regressor_cls = partial(IIRLRegression, alpha=alpha, bias=bias,
alpha2=alpha2)
self.patch_shape = patch_shape
self.patch_features = patch_features
self.n_iterations = n_iterations
self._compute_error = compute_error
class FullyParametricProjectOutOPP(ParametricAppearanceProjectOut):
r"""
Class for training a cascaded-regression algorithm that employs parametric
shape and appearance models using Multivariate Linear Regression with
Orthogonal Procrustes Problem reconstructions (:map:`OPPRegression`).
Parameters
----------
patch_features : `callable`, optional
The features to be extracted from the patches of an image.
patch_shape : `(int, int)`, optional
The shape of the extracted patches.
n_iterations : `int`, optional
The number of iterations (cascades).
shape_model_cls : `subclass` of :map:`PDM`, optional
The class to be used for building the shape model. The most common
choice is :map:`OrthoPDM`.
appearance_model_cls : `menpo.model.PCAVectorModel` or `subclass`
The class to be used for building the appearance model.
compute_error : `callable`, optional
The function to be used for computing the fitting error when training
each cascade.
bias : `bool`, optional
Flag that controls whether to use a bias term.
"""
def __init__(self, patch_features=no_op, patch_shape=(17, 17),
n_iterations=3, shape_model_cls=OrthoPDM,
appearance_model_cls=PCAVectorModel,
compute_error=euclidean_bb_normalised_error,
bias=True):
super(FullyParametricProjectOutOPP, self).__init__(
shape_model_cls=shape_model_cls,
appearance_model_cls=appearance_model_cls)
self._regressor_cls = partial(OPPRegression, bias=bias)
self.patch_shape = patch_shape
self.patch_features = patch_features
self.n_iterations = n_iterations
self._compute_error = compute_error
| bsd-3-clause |
nhomar/odoo-mirror | addons/website/models/ir_actions.py | 363 | 3074 | # -*- coding: utf-8 -*-
import urlparse
from openerp.http import request
from openerp.osv import fields, osv
class actions_server(osv.Model):
""" Add website option in server actions. """
_name = 'ir.actions.server'
_inherit = ['ir.actions.server']
def _compute_website_url(self, cr, uid, id, website_path, xml_id, context=None):
base_url = self.pool['ir.config_parameter'].get_param(cr, uid, 'web.base.url', context=context)
link = website_path or xml_id or (id and '%d' % id) or ''
if base_url and link:
path = '%s/%s' % ('/website/action', link)
return '%s' % urlparse.urljoin(base_url, path)
return ''
def _get_website_url(self, cr, uid, ids, name, args, context=None):
res = dict.fromkeys(ids, False)
for action in self.browse(cr, uid, ids, context=context):
if action.state == 'code' and action.website_published:
res[action.id] = self._compute_website_url(cr, uid, action.id, action.website_path, action.xml_id, context=context)
return res
_columns = {
'xml_id': fields.function(
osv.osv.get_xml_id, type='char', string="External ID",
help="ID of the action if defined in a XML file"),
'website_path': fields.char('Website Path'),
'website_url': fields.function(
_get_website_url, type='char', string='Website URL',
help='The full URL to access the server action through the website.'),
'website_published': fields.boolean(
'Available on the Website', copy=False,
help='A code server action can be executed from the website, using a dedicated'
'controller. The address is <base>/website/action/<website_path>.'
'Set this field as True to allow users to run this action. If it'
'set to is False the action cannot be run through the website.'),
}
def on_change_website_path(self, cr, uid, ids, website_path, xml_id, context=None):
values = {
'website_url': self._compute_website_url(cr, uid, ids and ids[0] or None, website_path, xml_id, context=context)
}
return {'value': values}
def _get_eval_context(self, cr, uid, action, context=None):
""" Override to add the request object in eval_context. """
eval_context = super(actions_server, self)._get_eval_context(cr, uid, action, context=context)
if action.state == 'code':
eval_context['request'] = request
return eval_context
def run_action_code_multi(self, cr, uid, action, eval_context=None, context=None):
""" Override to allow returning response the same way action is already
returned by the basic server action behavior. Note that response has
priority over action, avoid using both. """
res = super(actions_server, self).run_action_code_multi(cr, uid, action, eval_context, context)
if 'response' in eval_context:
return eval_context['response']
return res
| agpl-3.0 |
jmighion/ansible | lib/ansible/modules/packaging/os/pkg5.py | 26 | 4800 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014 Peter Oliver <ansible@mavit.org.uk>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: pkg5
author: "Peter Oliver (@mavit)"
short_description: Manages packages with the Solaris 11 Image Packaging System
version_added: 1.9
description:
- IPS packages are the native packages in Solaris 11 and higher.
notes:
- The naming of IPS packages is explained at U(http://www.oracle.com/technetwork/articles/servers-storage-admin/ips-package-versioning-2232906.html).
options:
name:
description:
- An FRMI of the package(s) to be installed/removed/updated.
- Multiple packages may be specified, separated by C(,).
required: true
state:
description:
- Whether to install (I(present), I(latest)), or remove (I(absent)) a
package.
required: false
default: present
choices: [ present, latest, absent ]
accept_licenses:
description:
- Accept any licences.
required: false
default: false
choices: [ true, false ]
aliases: [ accept_licences, accept ]
'''
EXAMPLES = '''
# Install Vim:
- pkg5:
name: editor/vim
# Remove finger daemon:
- pkg5:
name: service/network/finger
state: absent
# Install several packages at once:
- pkg5:
name:
- /file/gnu-findutils
- /text/gnu-grep
'''
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(required=True, type='list'),
state=dict(
default='present',
choices=[
'present',
'installed',
'latest',
'absent',
'uninstalled',
'removed',
]
),
accept_licenses=dict(
type='bool',
default=False,
aliases=['accept_licences', 'accept'],
),
),
supports_check_mode=True,
)
params = module.params
packages = []
# pkg(5) FRMIs include a comma before the release number, but
# AnsibleModule will have split this into multiple items for us.
# Try to spot where this has happened and fix it.
for fragment in params['name']:
if (
re.search('^\d+(?:\.\d+)*', fragment)
and packages and re.search('@[^,]*$', packages[-1])
):
packages[-1] += ',' + fragment
else:
packages.append(fragment)
if params['state'] in ['present', 'installed']:
ensure(module, 'present', packages, params)
elif params['state'] in ['latest']:
ensure(module, 'latest', packages, params)
elif params['state'] in ['absent', 'uninstalled', 'removed']:
ensure(module, 'absent', packages, params)
def ensure(module, state, packages, params):
response = {
'results': [],
'msg': '',
}
behaviour = {
'present': {
'filter': lambda p: not is_installed(module, p),
'subcommand': 'install',
},
'latest': {
'filter': lambda p: (
not is_installed(module, p) or not is_latest(module, p)
),
'subcommand': 'install',
},
'absent': {
'filter': lambda p: is_installed(module, p),
'subcommand': 'uninstall',
},
}
if module.check_mode:
dry_run = ['-n']
else:
dry_run = []
if params['accept_licenses']:
accept_licenses = ['--accept']
else:
accept_licenses = []
to_modify = filter(behaviour[state]['filter'], packages)
if to_modify:
rc, out, err = module.run_command(
[
'pkg', behaviour[state]['subcommand']
]
+ dry_run
+ accept_licenses
+ [
'-q', '--'
] + to_modify
)
response['rc'] = rc
response['results'].append(out)
response['msg'] += err
response['changed'] = True
if rc != 0:
module.fail_json(**response)
module.exit_json(**response)
def is_installed(module, package):
rc, out, err = module.run_command(['pkg', 'list', '--', package])
return not bool(int(rc))
def is_latest(module, package):
rc, out, err = module.run_command(['pkg', 'list', '-u', '--', package])
return bool(int(rc))
from ansible.module_utils.basic import *
if __name__ == '__main__':
main()
| gpl-3.0 |
collabspot/muninn | lib/requests/packages/chardet/__init__.py | 745 | 1295 | ######################## BEGIN LICENSE BLOCK ########################
# This library 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; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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 GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
######################### END LICENSE BLOCK #########################
__version__ = "2.2.1"
from sys import version_info
def detect(aBuf):
if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or
(version_info >= (3, 0) and not isinstance(aBuf, bytes))):
raise ValueError('Expected a bytes object, not a unicode object')
from . import universaldetector
u = universaldetector.UniversalDetector()
u.reset()
u.feed(aBuf)
u.close()
return u.result
| mit |
SravanthiSinha/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_store_utilities.py | 194 | 2142 | """
Tests for store_utilities.py
"""
import unittest
from mock import Mock
import ddt
from xmodule.modulestore.store_utilities import (
get_draft_subtree_roots, draft_node_constructor
)
@ddt.ddt
class TestUtils(unittest.TestCase):
"""
Tests for store_utilities
ASCII trees for ONLY_ROOTS and SOME_TREES:
ONLY_ROOTS:
1)
vertical (not draft)
|
url1
2)
sequential (not draft)
|
url2
SOME_TREES:
1)
sequential_1 (not draft)
|
vertical_1
/ \
/ \
child_1 child_2
2)
great_grandparent_vertical (not draft)
|
grandparent_vertical
|
vertical_2
/ \
/ \
child_3 child_4
"""
ONLY_ROOTS = [
draft_node_constructor(Mock(), 'url1', 'vertical'),
draft_node_constructor(Mock(), 'url2', 'sequential'),
]
ONLY_ROOTS_URLS = ['url1', 'url2']
SOME_TREES = [
draft_node_constructor(Mock(), 'child_1', 'vertical_1'),
draft_node_constructor(Mock(), 'child_2', 'vertical_1'),
draft_node_constructor(Mock(), 'vertical_1', 'sequential_1'),
draft_node_constructor(Mock(), 'child_3', 'vertical_2'),
draft_node_constructor(Mock(), 'child_4', 'vertical_2'),
draft_node_constructor(Mock(), 'vertical_2', 'grandparent_vertical'),
draft_node_constructor(Mock(), 'grandparent_vertical', 'great_grandparent_vertical'),
]
SOME_TREES_ROOTS_URLS = ['vertical_1', 'grandparent_vertical']
@ddt.data(
(ONLY_ROOTS, ONLY_ROOTS_URLS),
(SOME_TREES, SOME_TREES_ROOTS_URLS),
)
@ddt.unpack
def test_get_draft_subtree_roots(self, module_nodes, expected_roots_urls):
"""tests for get_draft_subtree_roots"""
subtree_roots_urls = [root.url for root in get_draft_subtree_roots(module_nodes)]
# check that we return the expected urls
self.assertEqual(set(subtree_roots_urls), set(expected_roots_urls))
| agpl-3.0 |
raghavsethi/presto | presto-docs/src/main/sphinx/conf.py | 8 | 2265 | #
# 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.
#
#
# Presto documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
#
import os
import sys
import xml.dom.minidom
try:
sys.dont_write_bytecode = True
except:
pass
sys.path.insert(0, os.path.abspath('ext'))
def child_node(node, name):
for i in node.childNodes:
if (i.nodeType == i.ELEMENT_NODE) and (i.tagName == name):
return i
return None
def node_text(node):
return node.childNodes[0].data
def maven_version(pom):
dom = xml.dom.minidom.parse(pom)
project = dom.childNodes[0]
version = child_node(project, 'version')
if version:
return node_text(version)
parent = child_node(project, 'parent')
version = child_node(parent, 'version')
return node_text(version)
def get_version():
version = os.environ.get('PRESTO_VERSION', '').strip()
return version or maven_version('../../../pom.xml')
# -- General configuration -----------------------------------------------------
needs_sphinx = '1.1'
extensions = ['download', 'issue']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Presto'
version = get_version()
release = version
exclude_patterns = ['_build', 'rest*']
pygments_style = 'sphinx'
highlight_language = 'sql'
rst_epilog = """
.. |presto_server_release| replace:: ``presto-server-{release}``
""".replace('{release}', release)
# -- Options for HTML output ---------------------------------------------------
html_theme_path = ['./themes']
html_theme = 'presto'
html_title = '%s %s Documentation' % (project, release)
html_add_permalinks = ''
html_show_copyright = False
html_show_sphinx = False
| apache-2.0 |
igboyes/virtool | tests/hmm/test_api.py | 2 | 3583 | import aiohttp
import pytest
from aiohttp.test_utils import make_mocked_coro
import virtool.errors
async def test_find(mocker, spawn_client, hmm_document):
"""
Check that a request with no URL parameters returns a list of HMM annotation documents.
"""
m = mocker.patch("virtool.hmm.db.get_status", make_mocked_coro({"id": "hmm"}))
client = await spawn_client(authorize=True)
hmm_document["hidden"] = False
await client.db.hmm.insert_one(hmm_document)
resp = await client.get("/api/hmms")
assert resp.status == 200
assert await resp.json() == {
"total_count": 1,
"found_count": 1,
"page": 1,
"page_count": 1,
"per_page": 25,
"documents": [
{
"names": [
"ORF-63",
"ORF67",
"hypothetical protein"
],
"id": "f8666902",
"cluster": 3463,
"count": 4,
"families": {
"Baculoviridae": 3
}
}
],
"status": {
"id": "hmm"
}
}
m.assert_called_with(client.db)
async def test_get_status(mocker, spawn_client):
client = await spawn_client(authorize=True)
mocker.patch("virtool.hmm.db.get_status", make_mocked_coro({"id": "hmm", "updating": True}))
resp = await client.get("/api/hmms/status")
assert resp.status == 200
assert await resp.json() == {
"id": "hmm",
"updating": True
}
@pytest.mark.parametrize("error", [None, "502_repo", "502_github", "404"])
async def test_get_release(error, mocker, spawn_client, resp_is):
"""
Test that the endpoint returns the latest HMM release. Check that error responses are sent in all expected
situations.
"""
client = await spawn_client(authorize=True)
m_fetch = make_mocked_coro(None if error == "404" else {"name": "v2.0.1", "newer": False})
mocker.patch("virtool.hmm.db.fetch_and_update_release", new=m_fetch)
if error == "502_repo":
m_fetch.side_effect = virtool.errors.GitHubError("404 Not found")
if error == "502_github":
m_fetch.side_effect = aiohttp.ClientConnectorError("foo", OSError("Bar"))
resp = await client.get("/api/hmms/status/release")
m_fetch.assert_called_with(client.app)
if error == "404":
assert await resp_is.not_found(resp, "Release not found")
return
if error == "502_repo":
assert await resp_is.bad_gateway(resp, "GitHub repository does not exist")
return
if error == "502_github":
assert await resp_is.bad_gateway(resp, "Could not reach GitHub")
return
assert resp.status == 200
assert await resp.json() == {
"name": "v2.0.1",
"newer": False
}
@pytest.mark.parametrize("error", [None, "404"])
async def test_get(error, spawn_client, hmm_document, resp_is):
"""
Check that a ``GET`` request for a valid annotation document results in a response containing that complete
document.
Check that a `404` is returned if the HMM does not exist.
"""
client = await spawn_client(authorize=True)
if not error:
await client.db.hmm.insert_one(hmm_document)
resp = await client.get("/api/hmms/f8666902")
if error:
assert await resp_is.not_found(resp)
return
assert resp.status == 200
expected = dict(hmm_document, id=hmm_document["_id"])
expected.pop("_id")
assert await resp.json() == expected
| mit |
ibotty/ansible | lib/ansible/utils/module_docs_fragments/aws.py | 232 | 3156 | # (c) 2014, Will Thames <will@thames.id.au>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
class ModuleDocFragment(object):
# AWS only documentation fragment
DOCUMENTATION = """
options:
ec2_url:
description:
- Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used.
required: false
default: null
aliases: []
aws_secret_key:
description:
- AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used.
required: false
default: null
aliases: [ 'ec2_secret_key', 'secret_key' ]
aws_access_key:
description:
- AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used.
required: false
default: null
aliases: [ 'ec2_access_key', 'access_key' ]
security_token:
description:
- AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used.
required: false
default: null
aliases: [ 'access_token' ]
version_added: "1.6"
validate_certs:
description:
- When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0.
required: false
default: "yes"
choices: ["yes", "no"]
aliases: []
version_added: "1.5"
profile:
description:
- uses a boto profile. Only works with boto >= 2.24.0
required: false
default: null
aliases: []
version_added: "1.6"
requirements:
- "python >= 2.6"
- boto
notes:
- If parameters are not set within the module, the following
environment variables can be used in decreasing order of precedence
C(AWS_URL) or C(EC2_URL),
C(AWS_ACCESS_KEY_ID) or C(AWS_ACCESS_KEY) or C(EC2_ACCESS_KEY),
C(AWS_SECRET_ACCESS_KEY) or C(AWS_SECRET_KEY) or C(EC2_SECRET_KEY),
C(AWS_SECURITY_TOKEN) or C(EC2_SECURITY_TOKEN),
C(AWS_REGION) or C(EC2_REGION)
- Ansible uses the boto configuration file (typically ~/.boto) if no
credentials are provided. See http://boto.readthedocs.org/en/latest/boto_config_tut.html
- C(AWS_REGION) or C(EC2_REGION) can be typically be used to specify the
AWS region, when required, but this can also be configured in the boto config file
"""
| gpl-3.0 |
christer155/Django-facebook | docs/docs_env/Lib/locale.py | 116 | 73200 | """ Locale support.
The module provides low-level access to the C lib's locale APIs
and adds high level number formatting APIs as well as a locale
aliasing engine to complement these.
The aliasing engine includes support for many commonly used locale
names and maps them to values suitable for passing to the C lib's
setlocale() function. It also includes default encodings for all
supported locale names.
"""
import sys, encodings, encodings.aliases
# Try importing the _locale module.
#
# If this fails, fall back on a basic 'C' locale emulation.
# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
# trying the import. So __all__ is also fiddled at the end of the file.
__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
"setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
"str", "atof", "atoi", "format", "format_string", "currency",
"normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
"LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
try:
from _locale import *
except ImportError:
# Locale emulation
CHAR_MAX = 127
LC_ALL = 6
LC_COLLATE = 3
LC_CTYPE = 0
LC_MESSAGES = 5
LC_MONETARY = 4
LC_NUMERIC = 1
LC_TIME = 2
Error = ValueError
def localeconv():
""" localeconv() -> dict.
Returns numeric and monetary locale-specific parameters.
"""
# 'C' locale default values
return {'grouping': [127],
'currency_symbol': '',
'n_sign_posn': 127,
'p_cs_precedes': 127,
'n_cs_precedes': 127,
'mon_grouping': [],
'n_sep_by_space': 127,
'decimal_point': '.',
'negative_sign': '',
'positive_sign': '',
'p_sep_by_space': 127,
'int_curr_symbol': '',
'p_sign_posn': 127,
'thousands_sep': '',
'mon_thousands_sep': '',
'frac_digits': 127,
'mon_decimal_point': '',
'int_frac_digits': 127}
def setlocale(category, value=None):
""" setlocale(integer,string=None) -> string.
Activates/queries locale processing.
"""
if value not in (None, '', 'C'):
raise Error, '_locale emulation only supports "C" locale'
return 'C'
def strcoll(a,b):
""" strcoll(string,string) -> int.
Compares two strings according to the locale.
"""
return cmp(a,b)
def strxfrm(s):
""" strxfrm(string) -> string.
Returns a string that behaves for cmp locale-aware.
"""
return s
### Number formatting APIs
# Author: Martin von Loewis
# improved by Georg Brandl
#perform the grouping from right to left
def _group(s, monetary=False):
conv = localeconv()
thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
grouping = conv[monetary and 'mon_grouping' or 'grouping']
if not grouping:
return (s, 0)
result = ""
seps = 0
spaces = ""
if s[-1] == ' ':
sp = s.find(' ')
spaces = s[sp:]
s = s[:sp]
while s and grouping:
# if grouping is -1, we are done
if grouping[0] == CHAR_MAX:
break
# 0: re-use last group ad infinitum
elif grouping[0] != 0:
#process last group
group = grouping[0]
grouping = grouping[1:]
if result:
result = s[-group:] + thousands_sep + result
seps += 1
else:
result = s[-group:]
s = s[:-group]
if s and s[-1] not in "0123456789":
# the leading string is only spaces and signs
return s + result + spaces, seps
if not result:
return s + spaces, seps
if s:
result = s + thousands_sep + result
seps += 1
return result + spaces, seps
def format(percent, value, grouping=False, monetary=False, *additional):
"""Returns the locale-aware substitution of a %? specifier
(percent).
additional is for format strings which contain one or more
'*' modifiers."""
# this is only for one-percent-specifier strings and this should be checked
if percent[0] != '%':
raise ValueError("format() must be given exactly one %char "
"format specifier")
if additional:
formatted = percent % ((value,) + additional)
else:
formatted = percent % value
# floats and decimal ints need special action!
if percent[-1] in 'eEfFgG':
seps = 0
parts = formatted.split('.')
if grouping:
parts[0], seps = _group(parts[0], monetary=monetary)
decimal_point = localeconv()[monetary and 'mon_decimal_point'
or 'decimal_point']
formatted = decimal_point.join(parts)
while seps:
sp = formatted.find(' ')
if sp == -1: break
formatted = formatted[:sp] + formatted[sp+1:]
seps -= 1
elif percent[-1] in 'diu':
if grouping:
formatted = _group(formatted, monetary=monetary)[0]
return formatted
import re, operator
_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
def format_string(f, val, grouping=False):
"""Formats a string in the same way that the % formatting would use,
but takes the current locale into account.
Grouping is applied if the third parameter is true."""
percents = list(_percent_re.finditer(f))
new_f = _percent_re.sub('%s', f)
if isinstance(val, tuple):
new_val = list(val)
i = 0
for perc in percents:
starcount = perc.group('modifiers').count('*')
new_val[i] = format(perc.group(), new_val[i], grouping, False, *new_val[i+1:i+1+starcount])
del new_val[i+1:i+1+starcount]
i += (1 + starcount)
val = tuple(new_val)
elif operator.isMappingType(val):
for perc in percents:
key = perc.group("key")
val[key] = format(perc.group(), val[key], grouping)
else:
# val is a single value
val = format(percents[0].group(), val, grouping)
return new_f % val
def currency(val, symbol=True, grouping=False, international=False):
"""Formats val according to the currency settings
in the current locale."""
conv = localeconv()
# check for illegal values
digits = conv[international and 'int_frac_digits' or 'frac_digits']
if digits == 127:
raise ValueError("Currency formatting is not possible using "
"the 'C' locale.")
s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
# '<' and '>' are markers if the sign must be inserted between symbol and value
s = '<' + s + '>'
if symbol:
smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
if precedes:
s = smb + (separated and ' ' or '') + s
else:
s = s + (separated and ' ' or '') + smb
sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
sign = conv[val<0 and 'negative_sign' or 'positive_sign']
if sign_pos == 0:
s = '(' + s + ')'
elif sign_pos == 1:
s = sign + s
elif sign_pos == 2:
s = s + sign
elif sign_pos == 3:
s = s.replace('<', sign)
elif sign_pos == 4:
s = s.replace('>', sign)
else:
# the default if nothing specified;
# this should be the most fitting sign position
s = sign + s
return s.replace('<', '').replace('>', '')
def str(val):
"""Convert float to integer, taking the locale into account."""
return format("%.12g", val)
def atof(string, func=float):
"Parses a string as a float according to the locale settings."
#First, get rid of the grouping
ts = localeconv()['thousands_sep']
if ts:
string = string.replace(ts, '')
#next, replace the decimal point with a dot
dd = localeconv()['decimal_point']
if dd:
string = string.replace(dd, '.')
#finally, parse the string
return func(string)
def atoi(str):
"Converts a string to an integer according to the locale settings."
return atof(str, int)
def _test():
setlocale(LC_ALL, "")
#do grouping
s1 = format("%d", 123456789,1)
print s1, "is", atoi(s1)
#standard formatting
s1 = str(3.14)
print s1, "is", atof(s1)
### Locale name aliasing engine
# Author: Marc-Andre Lemburg, mal@lemburg.com
# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
# store away the low-level version of setlocale (it's
# overridden below)
_setlocale = setlocale
def normalize(localename):
""" Returns a normalized locale code for the given locale
name.
The returned locale code is formatted for use with
setlocale().
If normalization fails, the original name is returned
unchanged.
If the given encoding is not known, the function defaults to
the default encoding for the locale code just like setlocale()
does.
"""
# Normalize the locale name and extract the encoding
fullname = localename.lower()
if ':' in fullname:
# ':' is sometimes used as encoding delimiter.
fullname = fullname.replace(':', '.')
if '.' in fullname:
langname, encoding = fullname.split('.')[:2]
fullname = langname + '.' + encoding
else:
langname = fullname
encoding = ''
# First lookup: fullname (possibly with encoding)
norm_encoding = encoding.replace('-', '')
norm_encoding = norm_encoding.replace('_', '')
lookup_name = langname + '.' + encoding
code = locale_alias.get(lookup_name, None)
if code is not None:
return code
#print 'first lookup failed'
# Second try: langname (without encoding)
code = locale_alias.get(langname, None)
if code is not None:
#print 'langname lookup succeeded'
if '.' in code:
langname, defenc = code.split('.')
else:
langname = code
defenc = ''
if encoding:
# Convert the encoding to a C lib compatible encoding string
norm_encoding = encodings.normalize_encoding(encoding)
#print 'norm encoding: %r' % norm_encoding
norm_encoding = encodings.aliases.aliases.get(norm_encoding,
norm_encoding)
#print 'aliased encoding: %r' % norm_encoding
encoding = locale_encoding_alias.get(norm_encoding,
norm_encoding)
else:
encoding = defenc
#print 'found encoding %r' % encoding
if encoding:
return langname + '.' + encoding
else:
return langname
else:
return localename
def _parse_localename(localename):
""" Parses the locale code for localename and returns the
result as tuple (language code, encoding).
The localename is normalized and passed through the locale
alias engine. A ValueError is raised in case the locale name
cannot be parsed.
The language code corresponds to RFC 1766. code and encoding
can be None in case the values cannot be determined or are
unknown to this implementation.
"""
code = normalize(localename)
if '@' in code:
# Deal with locale modifiers
code, modifier = code.split('@')
if modifier == 'euro' and '.' not in code:
# Assume Latin-9 for @euro locales. This is bogus,
# since some systems may use other encodings for these
# locales. Also, we ignore other modifiers.
return code, 'iso-8859-15'
if '.' in code:
return tuple(code.split('.')[:2])
elif code == 'C':
return None, None
raise ValueError, 'unknown locale: %s' % localename
def _build_localename(localetuple):
""" Builds a locale code from the given tuple (language code,
encoding).
No aliasing or normalizing takes place.
"""
language, encoding = localetuple
if language is None:
language = 'C'
if encoding is None:
return language
else:
return language + '.' + encoding
def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
""" Tries to determine the default locale settings and returns
them as tuple (language code, encoding).
According to POSIX, a program which has not called
setlocale(LC_ALL, "") runs using the portable 'C' locale.
Calling setlocale(LC_ALL, "") lets it use the default locale as
defined by the LANG variable. Since we don't want to interfere
with the current locale setting we thus emulate the behavior
in the way described above.
To maintain compatibility with other platforms, not only the
LANG variable is tested, but a list of variables given as
envvars parameter. The first found to be defined will be
used. envvars defaults to the search path used in GNU gettext;
it must always contain the variable name 'LANG'.
Except for the code 'C', the language code corresponds to RFC
1766. code and encoding can be None in case the values cannot
be determined.
"""
try:
# check if it's supported by the _locale module
import _locale
code, encoding = _locale._getdefaultlocale()
except (ImportError, AttributeError):
pass
else:
# make sure the code/encoding values are valid
if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name
code = windows_locale.get(int(code, 0))
# ...add other platform-specific processing here, if
# necessary...
return code, encoding
# fall back on POSIX behaviour
import os
lookup = os.environ.get
for variable in envvars:
localename = lookup(variable,None)
if localename:
if variable == 'LANGUAGE':
localename = localename.split(':')[0]
break
else:
localename = 'C'
return _parse_localename(localename)
def getlocale(category=LC_CTYPE):
""" Returns the current setting for the given locale category as
tuple (language code, encoding).
category may be one of the LC_* value except LC_ALL. It
defaults to LC_CTYPE.
Except for the code 'C', the language code corresponds to RFC
1766. code and encoding can be None in case the values cannot
be determined.
"""
localename = _setlocale(category)
if category == LC_ALL and ';' in localename:
raise TypeError, 'category LC_ALL is not supported'
return _parse_localename(localename)
def setlocale(category, locale=None):
""" Set the locale for the given category. The locale can be
a string, a locale tuple (language code, encoding), or None.
Locale tuples are converted to strings the locale aliasing
engine. Locale strings are passed directly to the C lib.
category may be given as one of the LC_* values.
"""
if locale and type(locale) is not type(""):
# convert to string
locale = normalize(_build_localename(locale))
return _setlocale(category, locale)
def resetlocale(category=LC_ALL):
""" Sets the locale for category to the default setting.
The default setting is determined by calling
getdefaultlocale(). category defaults to LC_ALL.
"""
_setlocale(category, _build_localename(getdefaultlocale()))
if sys.platform in ('win32', 'darwin', 'mac'):
# On Win32, this will return the ANSI code page
# On the Mac, it should return the system encoding;
# it might return "ascii" instead
def getpreferredencoding(do_setlocale = True):
"""Return the charset that the user is likely using."""
import _locale
return _locale._getdefaultlocale()[1]
else:
# On Unix, if CODESET is available, use that.
try:
CODESET
except NameError:
# Fall back to parsing environment variables :-(
def getpreferredencoding(do_setlocale = True):
"""Return the charset that the user is likely using,
by looking at environment variables."""
return getdefaultlocale()[1]
else:
def getpreferredencoding(do_setlocale = True):
"""Return the charset that the user is likely using,
according to the system configuration."""
if do_setlocale:
oldloc = setlocale(LC_CTYPE)
setlocale(LC_CTYPE, "")
result = nl_langinfo(CODESET)
setlocale(LC_CTYPE, oldloc)
return result
else:
return nl_langinfo(CODESET)
### Database
#
# The following data was extracted from the locale.alias file which
# comes with X11 and then hand edited removing the explicit encoding
# definitions and adding some more aliases. The file is usually
# available as /usr/lib/X11/locale/locale.alias.
#
#
# The local_encoding_alias table maps lowercase encoding alias names
# to C locale encoding names (case-sensitive). Note that normalize()
# first looks up the encoding in the encodings.aliases dictionary and
# then applies this mapping to find the correct C lib name for the
# encoding.
#
locale_encoding_alias = {
# Mappings for non-standard encoding names used in locale names
'437': 'C',
'c': 'C',
'en': 'ISO8859-1',
'jis': 'JIS7',
'jis7': 'JIS7',
'ajec': 'eucJP',
# Mappings from Python codec names to C lib encoding names
'ascii': 'ISO8859-1',
'latin_1': 'ISO8859-1',
'iso8859_1': 'ISO8859-1',
'iso8859_10': 'ISO8859-10',
'iso8859_11': 'ISO8859-11',
'iso8859_13': 'ISO8859-13',
'iso8859_14': 'ISO8859-14',
'iso8859_15': 'ISO8859-15',
'iso8859_2': 'ISO8859-2',
'iso8859_3': 'ISO8859-3',
'iso8859_4': 'ISO8859-4',
'iso8859_5': 'ISO8859-5',
'iso8859_6': 'ISO8859-6',
'iso8859_7': 'ISO8859-7',
'iso8859_8': 'ISO8859-8',
'iso8859_9': 'ISO8859-9',
'iso2022_jp': 'JIS7',
'shift_jis': 'SJIS',
'tactis': 'TACTIS',
'euc_jp': 'eucJP',
'euc_kr': 'eucKR',
'utf_8': 'UTF8',
'koi8_r': 'KOI8-R',
'koi8_u': 'KOI8-U',
# XXX This list is still incomplete. If you know more
# mappings, please file a bug report. Thanks.
}
#
# The locale_alias table maps lowercase alias names to C locale names
# (case-sensitive). Encodings are always separated from the locale
# name using a dot ('.'); they should only be given in case the
# language name is needed to interpret the given encoding alias
# correctly (CJK codes often have this need).
#
# Note that the normalize() function which uses this tables
# removes '_' and '-' characters from the encoding part of the
# locale name before doing the lookup. This saves a lot of
# space in the table.
#
# MAL 2004-12-10:
# Updated alias mapping to most recent locale.alias file
# from X.org distribution using makelocalealias.py.
#
# These are the differences compared to the old mapping (Python 2.4
# and older):
#
# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
#
locale_alias = {
'a3': 'a3_AZ.KOI8-C',
'a3_az': 'a3_AZ.KOI8-C',
'a3_az.koi8c': 'a3_AZ.KOI8-C',
'af': 'af_ZA.ISO8859-1',
'af_za': 'af_ZA.ISO8859-1',
'af_za.iso88591': 'af_ZA.ISO8859-1',
'am': 'am_ET.UTF-8',
'american': 'en_US.ISO8859-1',
'american.iso88591': 'en_US.ISO8859-1',
'ar': 'ar_AA.ISO8859-6',
'ar_aa': 'ar_AA.ISO8859-6',
'ar_aa.iso88596': 'ar_AA.ISO8859-6',
'ar_ae': 'ar_AE.ISO8859-6',
'ar_bh': 'ar_BH.ISO8859-6',
'ar_dz': 'ar_DZ.ISO8859-6',
'ar_eg': 'ar_EG.ISO8859-6',
'ar_eg.iso88596': 'ar_EG.ISO8859-6',
'ar_iq': 'ar_IQ.ISO8859-6',
'ar_jo': 'ar_JO.ISO8859-6',
'ar_kw': 'ar_KW.ISO8859-6',
'ar_lb': 'ar_LB.ISO8859-6',
'ar_ly': 'ar_LY.ISO8859-6',
'ar_ma': 'ar_MA.ISO8859-6',
'ar_om': 'ar_OM.ISO8859-6',
'ar_qa': 'ar_QA.ISO8859-6',
'ar_sa': 'ar_SA.ISO8859-6',
'ar_sa.iso88596': 'ar_SA.ISO8859-6',
'ar_sd': 'ar_SD.ISO8859-6',
'ar_sy': 'ar_SY.ISO8859-6',
'ar_tn': 'ar_TN.ISO8859-6',
'ar_ye': 'ar_YE.ISO8859-6',
'arabic': 'ar_AA.ISO8859-6',
'arabic.iso88596': 'ar_AA.ISO8859-6',
'az': 'az_AZ.ISO8859-9E',
'az_az': 'az_AZ.ISO8859-9E',
'az_az.iso88599e': 'az_AZ.ISO8859-9E',
'be': 'be_BY.CP1251',
'be_by': 'be_BY.CP1251',
'be_by.cp1251': 'be_BY.CP1251',
'be_by.microsoftcp1251': 'be_BY.CP1251',
'bg': 'bg_BG.CP1251',
'bg_bg': 'bg_BG.CP1251',
'bg_bg.cp1251': 'bg_BG.CP1251',
'bg_bg.iso88595': 'bg_BG.ISO8859-5',
'bg_bg.koi8r': 'bg_BG.KOI8-R',
'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
'bokmal': 'nb_NO.ISO8859-1',
'bokm\xe5l': 'nb_NO.ISO8859-1',
'br': 'br_FR.ISO8859-1',
'br_fr': 'br_FR.ISO8859-1',
'br_fr.iso88591': 'br_FR.ISO8859-1',
'br_fr.iso885914': 'br_FR.ISO8859-14',
'br_fr.iso885915': 'br_FR.ISO8859-15',
'br_fr@euro': 'br_FR.ISO8859-15',
'bulgarian': 'bg_BG.CP1251',
'c': 'C',
'c-french': 'fr_CA.ISO8859-1',
'c-french.iso88591': 'fr_CA.ISO8859-1',
'c.en': 'C',
'c.iso88591': 'en_US.ISO8859-1',
'c_c': 'C',
'c_c.c': 'C',
'ca': 'ca_ES.ISO8859-1',
'ca_es': 'ca_ES.ISO8859-1',
'ca_es.iso88591': 'ca_ES.ISO8859-1',
'ca_es.iso885915': 'ca_ES.ISO8859-15',
'ca_es@euro': 'ca_ES.ISO8859-15',
'catalan': 'ca_ES.ISO8859-1',
'cextend': 'en_US.ISO8859-1',
'cextend.en': 'en_US.ISO8859-1',
'chinese-s': 'zh_CN.eucCN',
'chinese-t': 'zh_TW.eucTW',
'croatian': 'hr_HR.ISO8859-2',
'cs': 'cs_CZ.ISO8859-2',
'cs_cs': 'cs_CZ.ISO8859-2',
'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
'cs_cz': 'cs_CZ.ISO8859-2',
'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
'cy': 'cy_GB.ISO8859-1',
'cy_gb': 'cy_GB.ISO8859-1',
'cy_gb.iso88591': 'cy_GB.ISO8859-1',
'cy_gb.iso885914': 'cy_GB.ISO8859-14',
'cy_gb.iso885915': 'cy_GB.ISO8859-15',
'cy_gb@euro': 'cy_GB.ISO8859-15',
'cz': 'cs_CZ.ISO8859-2',
'cz_cz': 'cs_CZ.ISO8859-2',
'czech': 'cs_CZ.ISO8859-2',
'da': 'da_DK.ISO8859-1',
'da_dk': 'da_DK.ISO8859-1',
'da_dk.88591': 'da_DK.ISO8859-1',
'da_dk.885915': 'da_DK.ISO8859-15',
'da_dk.iso88591': 'da_DK.ISO8859-1',
'da_dk.iso885915': 'da_DK.ISO8859-15',
'da_dk@euro': 'da_DK.ISO8859-15',
'danish': 'da_DK.ISO8859-1',
'danish.iso88591': 'da_DK.ISO8859-1',
'dansk': 'da_DK.ISO8859-1',
'de': 'de_DE.ISO8859-1',
'de_at': 'de_AT.ISO8859-1',
'de_at.iso88591': 'de_AT.ISO8859-1',
'de_at.iso885915': 'de_AT.ISO8859-15',
'de_at@euro': 'de_AT.ISO8859-15',
'de_be': 'de_BE.ISO8859-1',
'de_be.iso88591': 'de_BE.ISO8859-1',
'de_be.iso885915': 'de_BE.ISO8859-15',
'de_be@euro': 'de_BE.ISO8859-15',
'de_ch': 'de_CH.ISO8859-1',
'de_ch.iso88591': 'de_CH.ISO8859-1',
'de_ch.iso885915': 'de_CH.ISO8859-15',
'de_ch@euro': 'de_CH.ISO8859-15',
'de_de': 'de_DE.ISO8859-1',
'de_de.88591': 'de_DE.ISO8859-1',
'de_de.885915': 'de_DE.ISO8859-15',
'de_de.885915@euro': 'de_DE.ISO8859-15',
'de_de.iso88591': 'de_DE.ISO8859-1',
'de_de.iso885915': 'de_DE.ISO8859-15',
'de_de@euro': 'de_DE.ISO8859-15',
'de_lu': 'de_LU.ISO8859-1',
'de_lu.iso88591': 'de_LU.ISO8859-1',
'de_lu.iso885915': 'de_LU.ISO8859-15',
'de_lu@euro': 'de_LU.ISO8859-15',
'deutsch': 'de_DE.ISO8859-1',
'dutch': 'nl_NL.ISO8859-1',
'dutch.iso88591': 'nl_BE.ISO8859-1',
'ee': 'ee_EE.ISO8859-4',
'ee_ee': 'ee_EE.ISO8859-4',
'ee_ee.iso88594': 'ee_EE.ISO8859-4',
'eesti': 'et_EE.ISO8859-1',
'el': 'el_GR.ISO8859-7',
'el_gr': 'el_GR.ISO8859-7',
'el_gr.iso88597': 'el_GR.ISO8859-7',
'el_gr@euro': 'el_GR.ISO8859-15',
'en': 'en_US.ISO8859-1',
'en.iso88591': 'en_US.ISO8859-1',
'en_au': 'en_AU.ISO8859-1',
'en_au.iso88591': 'en_AU.ISO8859-1',
'en_be': 'en_BE.ISO8859-1',
'en_be@euro': 'en_BE.ISO8859-15',
'en_bw': 'en_BW.ISO8859-1',
'en_ca': 'en_CA.ISO8859-1',
'en_ca.iso88591': 'en_CA.ISO8859-1',
'en_gb': 'en_GB.ISO8859-1',
'en_gb.88591': 'en_GB.ISO8859-1',
'en_gb.iso88591': 'en_GB.ISO8859-1',
'en_gb.iso885915': 'en_GB.ISO8859-15',
'en_gb@euro': 'en_GB.ISO8859-15',
'en_hk': 'en_HK.ISO8859-1',
'en_ie': 'en_IE.ISO8859-1',
'en_ie.iso88591': 'en_IE.ISO8859-1',
'en_ie.iso885915': 'en_IE.ISO8859-15',
'en_ie@euro': 'en_IE.ISO8859-15',
'en_in': 'en_IN.ISO8859-1',
'en_nz': 'en_NZ.ISO8859-1',
'en_nz.iso88591': 'en_NZ.ISO8859-1',
'en_ph': 'en_PH.ISO8859-1',
'en_sg': 'en_SG.ISO8859-1',
'en_uk': 'en_GB.ISO8859-1',
'en_us': 'en_US.ISO8859-1',
'en_us.88591': 'en_US.ISO8859-1',
'en_us.885915': 'en_US.ISO8859-15',
'en_us.iso88591': 'en_US.ISO8859-1',
'en_us.iso885915': 'en_US.ISO8859-15',
'en_us.iso885915@euro': 'en_US.ISO8859-15',
'en_us@euro': 'en_US.ISO8859-15',
'en_us@euro@euro': 'en_US.ISO8859-15',
'en_za': 'en_ZA.ISO8859-1',
'en_za.88591': 'en_ZA.ISO8859-1',
'en_za.iso88591': 'en_ZA.ISO8859-1',
'en_za.iso885915': 'en_ZA.ISO8859-15',
'en_za@euro': 'en_ZA.ISO8859-15',
'en_zw': 'en_ZW.ISO8859-1',
'eng_gb': 'en_GB.ISO8859-1',
'eng_gb.8859': 'en_GB.ISO8859-1',
'english': 'en_EN.ISO8859-1',
'english.iso88591': 'en_EN.ISO8859-1',
'english_uk': 'en_GB.ISO8859-1',
'english_uk.8859': 'en_GB.ISO8859-1',
'english_united-states': 'en_US.ISO8859-1',
'english_united-states.437': 'C',
'english_us': 'en_US.ISO8859-1',
'english_us.8859': 'en_US.ISO8859-1',
'english_us.ascii': 'en_US.ISO8859-1',
'eo': 'eo_XX.ISO8859-3',
'eo_eo': 'eo_EO.ISO8859-3',
'eo_eo.iso88593': 'eo_EO.ISO8859-3',
'eo_xx': 'eo_XX.ISO8859-3',
'eo_xx.iso88593': 'eo_XX.ISO8859-3',
'es': 'es_ES.ISO8859-1',
'es_ar': 'es_AR.ISO8859-1',
'es_ar.iso88591': 'es_AR.ISO8859-1',
'es_bo': 'es_BO.ISO8859-1',
'es_bo.iso88591': 'es_BO.ISO8859-1',
'es_cl': 'es_CL.ISO8859-1',
'es_cl.iso88591': 'es_CL.ISO8859-1',
'es_co': 'es_CO.ISO8859-1',
'es_co.iso88591': 'es_CO.ISO8859-1',
'es_cr': 'es_CR.ISO8859-1',
'es_cr.iso88591': 'es_CR.ISO8859-1',
'es_do': 'es_DO.ISO8859-1',
'es_do.iso88591': 'es_DO.ISO8859-1',
'es_ec': 'es_EC.ISO8859-1',
'es_ec.iso88591': 'es_EC.ISO8859-1',
'es_es': 'es_ES.ISO8859-1',
'es_es.88591': 'es_ES.ISO8859-1',
'es_es.iso88591': 'es_ES.ISO8859-1',
'es_es.iso885915': 'es_ES.ISO8859-15',
'es_es@euro': 'es_ES.ISO8859-15',
'es_gt': 'es_GT.ISO8859-1',
'es_gt.iso88591': 'es_GT.ISO8859-1',
'es_hn': 'es_HN.ISO8859-1',
'es_hn.iso88591': 'es_HN.ISO8859-1',
'es_mx': 'es_MX.ISO8859-1',
'es_mx.iso88591': 'es_MX.ISO8859-1',
'es_ni': 'es_NI.ISO8859-1',
'es_ni.iso88591': 'es_NI.ISO8859-1',
'es_pa': 'es_PA.ISO8859-1',
'es_pa.iso88591': 'es_PA.ISO8859-1',
'es_pa.iso885915': 'es_PA.ISO8859-15',
'es_pa@euro': 'es_PA.ISO8859-15',
'es_pe': 'es_PE.ISO8859-1',
'es_pe.iso88591': 'es_PE.ISO8859-1',
'es_pe.iso885915': 'es_PE.ISO8859-15',
'es_pe@euro': 'es_PE.ISO8859-15',
'es_pr': 'es_PR.ISO8859-1',
'es_pr.iso88591': 'es_PR.ISO8859-1',
'es_py': 'es_PY.ISO8859-1',
'es_py.iso88591': 'es_PY.ISO8859-1',
'es_py.iso885915': 'es_PY.ISO8859-15',
'es_py@euro': 'es_PY.ISO8859-15',
'es_sv': 'es_SV.ISO8859-1',
'es_sv.iso88591': 'es_SV.ISO8859-1',
'es_sv.iso885915': 'es_SV.ISO8859-15',
'es_sv@euro': 'es_SV.ISO8859-15',
'es_us': 'es_US.ISO8859-1',
'es_uy': 'es_UY.ISO8859-1',
'es_uy.iso88591': 'es_UY.ISO8859-1',
'es_uy.iso885915': 'es_UY.ISO8859-15',
'es_uy@euro': 'es_UY.ISO8859-15',
'es_ve': 'es_VE.ISO8859-1',
'es_ve.iso88591': 'es_VE.ISO8859-1',
'es_ve.iso885915': 'es_VE.ISO8859-15',
'es_ve@euro': 'es_VE.ISO8859-15',
'estonian': 'et_EE.ISO8859-1',
'et': 'et_EE.ISO8859-15',
'et_ee': 'et_EE.ISO8859-15',
'et_ee.iso88591': 'et_EE.ISO8859-1',
'et_ee.iso885913': 'et_EE.ISO8859-13',
'et_ee.iso885915': 'et_EE.ISO8859-15',
'et_ee.iso88594': 'et_EE.ISO8859-4',
'et_ee@euro': 'et_EE.ISO8859-15',
'eu': 'eu_ES.ISO8859-1',
'eu_es': 'eu_ES.ISO8859-1',
'eu_es.iso88591': 'eu_ES.ISO8859-1',
'eu_es.iso885915': 'eu_ES.ISO8859-15',
'eu_es@euro': 'eu_ES.ISO8859-15',
'fa': 'fa_IR.UTF-8',
'fa_ir': 'fa_IR.UTF-8',
'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
'fi': 'fi_FI.ISO8859-15',
'fi_fi': 'fi_FI.ISO8859-15',
'fi_fi.88591': 'fi_FI.ISO8859-1',
'fi_fi.iso88591': 'fi_FI.ISO8859-1',
'fi_fi.iso885915': 'fi_FI.ISO8859-15',
'fi_fi.utf8@euro': 'fi_FI.UTF-8',
'fi_fi@euro': 'fi_FI.ISO8859-15',
'finnish': 'fi_FI.ISO8859-1',
'finnish.iso88591': 'fi_FI.ISO8859-1',
'fo': 'fo_FO.ISO8859-1',
'fo_fo': 'fo_FO.ISO8859-1',
'fo_fo.iso88591': 'fo_FO.ISO8859-1',
'fo_fo.iso885915': 'fo_FO.ISO8859-15',
'fo_fo@euro': 'fo_FO.ISO8859-15',
'fr': 'fr_FR.ISO8859-1',
'fr_be': 'fr_BE.ISO8859-1',
'fr_be.88591': 'fr_BE.ISO8859-1',
'fr_be.iso88591': 'fr_BE.ISO8859-1',
'fr_be.iso885915': 'fr_BE.ISO8859-15',
'fr_be@euro': 'fr_BE.ISO8859-15',
'fr_ca': 'fr_CA.ISO8859-1',
'fr_ca.88591': 'fr_CA.ISO8859-1',
'fr_ca.iso88591': 'fr_CA.ISO8859-1',
'fr_ca.iso885915': 'fr_CA.ISO8859-15',
'fr_ca@euro': 'fr_CA.ISO8859-15',
'fr_ch': 'fr_CH.ISO8859-1',
'fr_ch.88591': 'fr_CH.ISO8859-1',
'fr_ch.iso88591': 'fr_CH.ISO8859-1',
'fr_ch.iso885915': 'fr_CH.ISO8859-15',
'fr_ch@euro': 'fr_CH.ISO8859-15',
'fr_fr': 'fr_FR.ISO8859-1',
'fr_fr.88591': 'fr_FR.ISO8859-1',
'fr_fr.iso88591': 'fr_FR.ISO8859-1',
'fr_fr.iso885915': 'fr_FR.ISO8859-15',
'fr_fr@euro': 'fr_FR.ISO8859-15',
'fr_lu': 'fr_LU.ISO8859-1',
'fr_lu.88591': 'fr_LU.ISO8859-1',
'fr_lu.iso88591': 'fr_LU.ISO8859-1',
'fr_lu.iso885915': 'fr_LU.ISO8859-15',
'fr_lu@euro': 'fr_LU.ISO8859-15',
'fran\xe7ais': 'fr_FR.ISO8859-1',
'fre_fr': 'fr_FR.ISO8859-1',
'fre_fr.8859': 'fr_FR.ISO8859-1',
'french': 'fr_FR.ISO8859-1',
'french.iso88591': 'fr_CH.ISO8859-1',
'french_france': 'fr_FR.ISO8859-1',
'french_france.8859': 'fr_FR.ISO8859-1',
'ga': 'ga_IE.ISO8859-1',
'ga_ie': 'ga_IE.ISO8859-1',
'ga_ie.iso88591': 'ga_IE.ISO8859-1',
'ga_ie.iso885914': 'ga_IE.ISO8859-14',
'ga_ie.iso885915': 'ga_IE.ISO8859-15',
'ga_ie@euro': 'ga_IE.ISO8859-15',
'galego': 'gl_ES.ISO8859-1',
'galician': 'gl_ES.ISO8859-1',
'gd': 'gd_GB.ISO8859-1',
'gd_gb': 'gd_GB.ISO8859-1',
'gd_gb.iso88591': 'gd_GB.ISO8859-1',
'gd_gb.iso885914': 'gd_GB.ISO8859-14',
'gd_gb.iso885915': 'gd_GB.ISO8859-15',
'gd_gb@euro': 'gd_GB.ISO8859-15',
'ger_de': 'de_DE.ISO8859-1',
'ger_de.8859': 'de_DE.ISO8859-1',
'german': 'de_DE.ISO8859-1',
'german.iso88591': 'de_CH.ISO8859-1',
'german_germany': 'de_DE.ISO8859-1',
'german_germany.8859': 'de_DE.ISO8859-1',
'gl': 'gl_ES.ISO8859-1',
'gl_es': 'gl_ES.ISO8859-1',
'gl_es.iso88591': 'gl_ES.ISO8859-1',
'gl_es.iso885915': 'gl_ES.ISO8859-15',
'gl_es@euro': 'gl_ES.ISO8859-15',
'greek': 'el_GR.ISO8859-7',
'greek.iso88597': 'el_GR.ISO8859-7',
'gv': 'gv_GB.ISO8859-1',
'gv_gb': 'gv_GB.ISO8859-1',
'gv_gb.iso88591': 'gv_GB.ISO8859-1',
'gv_gb.iso885914': 'gv_GB.ISO8859-14',
'gv_gb.iso885915': 'gv_GB.ISO8859-15',
'gv_gb@euro': 'gv_GB.ISO8859-15',
'he': 'he_IL.ISO8859-8',
'he_il': 'he_IL.ISO8859-8',
'he_il.cp1255': 'he_IL.CP1255',
'he_il.iso88598': 'he_IL.ISO8859-8',
'he_il.microsoftcp1255': 'he_IL.CP1255',
'hebrew': 'iw_IL.ISO8859-8',
'hebrew.iso88598': 'iw_IL.ISO8859-8',
'hi': 'hi_IN.ISCII-DEV',
'hi_in': 'hi_IN.ISCII-DEV',
'hi_in.isciidev': 'hi_IN.ISCII-DEV',
'hr': 'hr_HR.ISO8859-2',
'hr_hr': 'hr_HR.ISO8859-2',
'hr_hr.iso88592': 'hr_HR.ISO8859-2',
'hrvatski': 'hr_HR.ISO8859-2',
'hu': 'hu_HU.ISO8859-2',
'hu_hu': 'hu_HU.ISO8859-2',
'hu_hu.iso88592': 'hu_HU.ISO8859-2',
'hungarian': 'hu_HU.ISO8859-2',
'icelandic': 'is_IS.ISO8859-1',
'icelandic.iso88591': 'is_IS.ISO8859-1',
'id': 'id_ID.ISO8859-1',
'id_id': 'id_ID.ISO8859-1',
'in': 'id_ID.ISO8859-1',
'in_id': 'id_ID.ISO8859-1',
'is': 'is_IS.ISO8859-1',
'is_is': 'is_IS.ISO8859-1',
'is_is.iso88591': 'is_IS.ISO8859-1',
'is_is.iso885915': 'is_IS.ISO8859-15',
'is_is@euro': 'is_IS.ISO8859-15',
'iso-8859-1': 'en_US.ISO8859-1',
'iso-8859-15': 'en_US.ISO8859-15',
'iso8859-1': 'en_US.ISO8859-1',
'iso8859-15': 'en_US.ISO8859-15',
'iso_8859_1': 'en_US.ISO8859-1',
'iso_8859_15': 'en_US.ISO8859-15',
'it': 'it_IT.ISO8859-1',
'it_ch': 'it_CH.ISO8859-1',
'it_ch.iso88591': 'it_CH.ISO8859-1',
'it_ch.iso885915': 'it_CH.ISO8859-15',
'it_ch@euro': 'it_CH.ISO8859-15',
'it_it': 'it_IT.ISO8859-1',
'it_it.88591': 'it_IT.ISO8859-1',
'it_it.iso88591': 'it_IT.ISO8859-1',
'it_it.iso885915': 'it_IT.ISO8859-15',
'it_it@euro': 'it_IT.ISO8859-15',
'italian': 'it_IT.ISO8859-1',
'italian.iso88591': 'it_IT.ISO8859-1',
'iu': 'iu_CA.NUNACOM-8',
'iu_ca': 'iu_CA.NUNACOM-8',
'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
'iw': 'he_IL.ISO8859-8',
'iw_il': 'he_IL.ISO8859-8',
'iw_il.iso88598': 'he_IL.ISO8859-8',
'ja': 'ja_JP.eucJP',
'ja.jis': 'ja_JP.JIS7',
'ja.sjis': 'ja_JP.SJIS',
'ja_jp': 'ja_JP.eucJP',
'ja_jp.ajec': 'ja_JP.eucJP',
'ja_jp.euc': 'ja_JP.eucJP',
'ja_jp.eucjp': 'ja_JP.eucJP',
'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
'ja_jp.iso2022jp': 'ja_JP.JIS7',
'ja_jp.jis': 'ja_JP.JIS7',
'ja_jp.jis7': 'ja_JP.JIS7',
'ja_jp.mscode': 'ja_JP.SJIS',
'ja_jp.sjis': 'ja_JP.SJIS',
'ja_jp.ujis': 'ja_JP.eucJP',
'japan': 'ja_JP.eucJP',
'japanese': 'ja_JP.eucJP',
'japanese-euc': 'ja_JP.eucJP',
'japanese.euc': 'ja_JP.eucJP',
'japanese.sjis': 'ja_JP.SJIS',
'jp_jp': 'ja_JP.eucJP',
'ka': 'ka_GE.GEORGIAN-ACADEMY',
'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
'kl': 'kl_GL.ISO8859-1',
'kl_gl': 'kl_GL.ISO8859-1',
'kl_gl.iso88591': 'kl_GL.ISO8859-1',
'kl_gl.iso885915': 'kl_GL.ISO8859-15',
'kl_gl@euro': 'kl_GL.ISO8859-15',
'ko': 'ko_KR.eucKR',
'ko_kr': 'ko_KR.eucKR',
'ko_kr.euc': 'ko_KR.eucKR',
'ko_kr.euckr': 'ko_KR.eucKR',
'korean': 'ko_KR.eucKR',
'korean.euc': 'ko_KR.eucKR',
'kw': 'kw_GB.ISO8859-1',
'kw_gb': 'kw_GB.ISO8859-1',
'kw_gb.iso88591': 'kw_GB.ISO8859-1',
'kw_gb.iso885914': 'kw_GB.ISO8859-14',
'kw_gb.iso885915': 'kw_GB.ISO8859-15',
'kw_gb@euro': 'kw_GB.ISO8859-15',
'lithuanian': 'lt_LT.ISO8859-13',
'lo': 'lo_LA.MULELAO-1',
'lo_la': 'lo_LA.MULELAO-1',
'lo_la.cp1133': 'lo_LA.IBM-CP1133',
'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
'lo_la.mulelao1': 'lo_LA.MULELAO-1',
'lt': 'lt_LT.ISO8859-13',
'lt_lt': 'lt_LT.ISO8859-13',
'lt_lt.iso885913': 'lt_LT.ISO8859-13',
'lt_lt.iso88594': 'lt_LT.ISO8859-4',
'lv': 'lv_LV.ISO8859-13',
'lv_lv': 'lv_LV.ISO8859-13',
'lv_lv.iso885913': 'lv_LV.ISO8859-13',
'lv_lv.iso88594': 'lv_LV.ISO8859-4',
'mi': 'mi_NZ.ISO8859-1',
'mi_nz': 'mi_NZ.ISO8859-1',
'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
'mk': 'mk_MK.ISO8859-5',
'mk_mk': 'mk_MK.ISO8859-5',
'mk_mk.cp1251': 'mk_MK.CP1251',
'mk_mk.iso88595': 'mk_MK.ISO8859-5',
'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
'ms': 'ms_MY.ISO8859-1',
'ms_my': 'ms_MY.ISO8859-1',
'ms_my.iso88591': 'ms_MY.ISO8859-1',
'mt': 'mt_MT.ISO8859-3',
'mt_mt': 'mt_MT.ISO8859-3',
'mt_mt.iso88593': 'mt_MT.ISO8859-3',
'nb': 'nb_NO.ISO8859-1',
'nb_no': 'nb_NO.ISO8859-1',
'nb_no.88591': 'nb_NO.ISO8859-1',
'nb_no.iso88591': 'nb_NO.ISO8859-1',
'nb_no.iso885915': 'nb_NO.ISO8859-15',
'nb_no@euro': 'nb_NO.ISO8859-15',
'nl': 'nl_NL.ISO8859-1',
'nl_be': 'nl_BE.ISO8859-1',
'nl_be.88591': 'nl_BE.ISO8859-1',
'nl_be.iso88591': 'nl_BE.ISO8859-1',
'nl_be.iso885915': 'nl_BE.ISO8859-15',
'nl_be@euro': 'nl_BE.ISO8859-15',
'nl_nl': 'nl_NL.ISO8859-1',
'nl_nl.88591': 'nl_NL.ISO8859-1',
'nl_nl.iso88591': 'nl_NL.ISO8859-1',
'nl_nl.iso885915': 'nl_NL.ISO8859-15',
'nl_nl@euro': 'nl_NL.ISO8859-15',
'nn': 'nn_NO.ISO8859-1',
'nn_no': 'nn_NO.ISO8859-1',
'nn_no.88591': 'nn_NO.ISO8859-1',
'nn_no.iso88591': 'nn_NO.ISO8859-1',
'nn_no.iso885915': 'nn_NO.ISO8859-15',
'nn_no@euro': 'nn_NO.ISO8859-15',
'no': 'no_NO.ISO8859-1',
'no@nynorsk': 'ny_NO.ISO8859-1',
'no_no': 'no_NO.ISO8859-1',
'no_no.88591': 'no_NO.ISO8859-1',
'no_no.iso88591': 'no_NO.ISO8859-1',
'no_no.iso885915': 'no_NO.ISO8859-15',
'no_no@euro': 'no_NO.ISO8859-15',
'norwegian': 'no_NO.ISO8859-1',
'norwegian.iso88591': 'no_NO.ISO8859-1',
'ny': 'ny_NO.ISO8859-1',
'ny_no': 'ny_NO.ISO8859-1',
'ny_no.88591': 'ny_NO.ISO8859-1',
'ny_no.iso88591': 'ny_NO.ISO8859-1',
'ny_no.iso885915': 'ny_NO.ISO8859-15',
'ny_no@euro': 'ny_NO.ISO8859-15',
'nynorsk': 'nn_NO.ISO8859-1',
'oc': 'oc_FR.ISO8859-1',
'oc_fr': 'oc_FR.ISO8859-1',
'oc_fr.iso88591': 'oc_FR.ISO8859-1',
'oc_fr.iso885915': 'oc_FR.ISO8859-15',
'oc_fr@euro': 'oc_FR.ISO8859-15',
'pd': 'pd_US.ISO8859-1',
'pd_de': 'pd_DE.ISO8859-1',
'pd_de.iso88591': 'pd_DE.ISO8859-1',
'pd_de.iso885915': 'pd_DE.ISO8859-15',
'pd_de@euro': 'pd_DE.ISO8859-15',
'pd_us': 'pd_US.ISO8859-1',
'pd_us.iso88591': 'pd_US.ISO8859-1',
'pd_us.iso885915': 'pd_US.ISO8859-15',
'pd_us@euro': 'pd_US.ISO8859-15',
'ph': 'ph_PH.ISO8859-1',
'ph_ph': 'ph_PH.ISO8859-1',
'ph_ph.iso88591': 'ph_PH.ISO8859-1',
'pl': 'pl_PL.ISO8859-2',
'pl_pl': 'pl_PL.ISO8859-2',
'pl_pl.iso88592': 'pl_PL.ISO8859-2',
'polish': 'pl_PL.ISO8859-2',
'portuguese': 'pt_PT.ISO8859-1',
'portuguese.iso88591': 'pt_PT.ISO8859-1',
'portuguese_brazil': 'pt_BR.ISO8859-1',
'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
'posix': 'C',
'posix-utf2': 'C',
'pp': 'pp_AN.ISO8859-1',
'pp_an': 'pp_AN.ISO8859-1',
'pp_an.iso88591': 'pp_AN.ISO8859-1',
'pt': 'pt_PT.ISO8859-1',
'pt_br': 'pt_BR.ISO8859-1',
'pt_br.88591': 'pt_BR.ISO8859-1',
'pt_br.iso88591': 'pt_BR.ISO8859-1',
'pt_br.iso885915': 'pt_BR.ISO8859-15',
'pt_br@euro': 'pt_BR.ISO8859-15',
'pt_pt': 'pt_PT.ISO8859-1',
'pt_pt.88591': 'pt_PT.ISO8859-1',
'pt_pt.iso88591': 'pt_PT.ISO8859-1',
'pt_pt.iso885915': 'pt_PT.ISO8859-15',
'pt_pt.utf8@euro': 'pt_PT.UTF-8',
'pt_pt@euro': 'pt_PT.ISO8859-15',
'ro': 'ro_RO.ISO8859-2',
'ro_ro': 'ro_RO.ISO8859-2',
'ro_ro.iso88592': 'ro_RO.ISO8859-2',
'romanian': 'ro_RO.ISO8859-2',
'ru': 'ru_RU.ISO8859-5',
'ru_ru': 'ru_RU.ISO8859-5',
'ru_ru.cp1251': 'ru_RU.CP1251',
'ru_ru.iso88595': 'ru_RU.ISO8859-5',
'ru_ru.koi8r': 'ru_RU.KOI8-R',
'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
'ru_ua': 'ru_UA.KOI8-U',
'ru_ua.cp1251': 'ru_UA.CP1251',
'ru_ua.koi8u': 'ru_UA.KOI8-U',
'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
'rumanian': 'ro_RO.ISO8859-2',
'russian': 'ru_RU.ISO8859-5',
'se_no': 'se_NO.UTF-8',
'serbocroatian': 'sh_YU.ISO8859-2',
'sh': 'sh_YU.ISO8859-2',
'sh_hr': 'sh_HR.ISO8859-2',
'sh_hr.iso88592': 'sh_HR.ISO8859-2',
'sh_sp': 'sh_YU.ISO8859-2',
'sh_yu': 'sh_YU.ISO8859-2',
'sk': 'sk_SK.ISO8859-2',
'sk_sk': 'sk_SK.ISO8859-2',
'sk_sk.iso88592': 'sk_SK.ISO8859-2',
'sl': 'sl_SI.ISO8859-2',
'sl_cs': 'sl_CS.ISO8859-2',
'sl_si': 'sl_SI.ISO8859-2',
'sl_si.iso88592': 'sl_SI.ISO8859-2',
'slovak': 'sk_SK.ISO8859-2',
'slovene': 'sl_SI.ISO8859-2',
'slovenian': 'sl_SI.ISO8859-2',
'sp': 'sp_YU.ISO8859-5',
'sp_yu': 'sp_YU.ISO8859-5',
'spanish': 'es_ES.ISO8859-1',
'spanish.iso88591': 'es_ES.ISO8859-1',
'spanish_spain': 'es_ES.ISO8859-1',
'spanish_spain.8859': 'es_ES.ISO8859-1',
'sq': 'sq_AL.ISO8859-2',
'sq_al': 'sq_AL.ISO8859-2',
'sq_al.iso88592': 'sq_AL.ISO8859-2',
'sr': 'sr_YU.ISO8859-5',
'sr@cyrillic': 'sr_YU.ISO8859-5',
'sr_sp': 'sr_SP.ISO8859-2',
'sr_yu': 'sr_YU.ISO8859-5',
'sr_yu.cp1251@cyrillic': 'sr_YU.CP1251',
'sr_yu.iso88592': 'sr_YU.ISO8859-2',
'sr_yu.iso88595': 'sr_YU.ISO8859-5',
'sr_yu.iso88595@cyrillic': 'sr_YU.ISO8859-5',
'sr_yu.microsoftcp1251@cyrillic': 'sr_YU.CP1251',
'sr_yu.utf8@cyrillic': 'sr_YU.UTF-8',
'sr_yu@cyrillic': 'sr_YU.ISO8859-5',
'sv': 'sv_SE.ISO8859-1',
'sv_fi': 'sv_FI.ISO8859-1',
'sv_fi.iso88591': 'sv_FI.ISO8859-1',
'sv_fi.iso885915': 'sv_FI.ISO8859-15',
'sv_fi@euro': 'sv_FI.ISO8859-15',
'sv_se': 'sv_SE.ISO8859-1',
'sv_se.88591': 'sv_SE.ISO8859-1',
'sv_se.iso88591': 'sv_SE.ISO8859-1',
'sv_se.iso885915': 'sv_SE.ISO8859-15',
'sv_se@euro': 'sv_SE.ISO8859-15',
'swedish': 'sv_SE.ISO8859-1',
'swedish.iso88591': 'sv_SE.ISO8859-1',
'ta': 'ta_IN.TSCII-0',
'ta_in': 'ta_IN.TSCII-0',
'ta_in.tscii': 'ta_IN.TSCII-0',
'ta_in.tscii0': 'ta_IN.TSCII-0',
'tg': 'tg_TJ.KOI8-C',
'tg_tj': 'tg_TJ.KOI8-C',
'tg_tj.koi8c': 'tg_TJ.KOI8-C',
'th': 'th_TH.ISO8859-11',
'th_th': 'th_TH.ISO8859-11',
'th_th.iso885911': 'th_TH.ISO8859-11',
'th_th.tactis': 'th_TH.TIS620',
'th_th.tis620': 'th_TH.TIS620',
'thai': 'th_TH.ISO8859-11',
'tl': 'tl_PH.ISO8859-1',
'tl_ph': 'tl_PH.ISO8859-1',
'tl_ph.iso88591': 'tl_PH.ISO8859-1',
'tr': 'tr_TR.ISO8859-9',
'tr_tr': 'tr_TR.ISO8859-9',
'tr_tr.iso88599': 'tr_TR.ISO8859-9',
'tt': 'tt_RU.TATAR-CYR',
'tt_ru': 'tt_RU.TATAR-CYR',
'tt_ru.koi8c': 'tt_RU.KOI8-C',
'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
'turkish': 'tr_TR.ISO8859-9',
'turkish.iso88599': 'tr_TR.ISO8859-9',
'uk': 'uk_UA.KOI8-U',
'uk_ua': 'uk_UA.KOI8-U',
'uk_ua.cp1251': 'uk_UA.CP1251',
'uk_ua.iso88595': 'uk_UA.ISO8859-5',
'uk_ua.koi8u': 'uk_UA.KOI8-U',
'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
'univ': 'en_US.utf',
'universal': 'en_US.utf',
'universal.utf8@ucs4': 'en_US.UTF-8',
'ur': 'ur_PK.CP1256',
'ur_pk': 'ur_PK.CP1256',
'ur_pk.cp1256': 'ur_PK.CP1256',
'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
'uz': 'uz_UZ.UTF-8',
'uz_uz': 'uz_UZ.UTF-8',
'vi': 'vi_VN.TCVN',
'vi_vn': 'vi_VN.TCVN',
'vi_vn.tcvn': 'vi_VN.TCVN',
'vi_vn.tcvn5712': 'vi_VN.TCVN',
'vi_vn.viscii': 'vi_VN.VISCII',
'vi_vn.viscii111': 'vi_VN.VISCII',
'wa': 'wa_BE.ISO8859-1',
'wa_be': 'wa_BE.ISO8859-1',
'wa_be.iso88591': 'wa_BE.ISO8859-1',
'wa_be.iso885915': 'wa_BE.ISO8859-15',
'wa_be@euro': 'wa_BE.ISO8859-15',
'yi': 'yi_US.CP1255',
'yi_us': 'yi_US.CP1255',
'yi_us.cp1255': 'yi_US.CP1255',
'yi_us.microsoftcp1255': 'yi_US.CP1255',
'zh': 'zh_CN.eucCN',
'zh_cn': 'zh_CN.gb2312',
'zh_cn.big5': 'zh_TW.big5',
'zh_cn.euc': 'zh_CN.eucCN',
'zh_cn.gb18030': 'zh_CN.gb18030',
'zh_cn.gb2312': 'zh_CN.gb2312',
'zh_cn.gbk': 'zh_CN.gbk',
'zh_hk': 'zh_HK.big5hkscs',
'zh_hk.big5': 'zh_HK.big5',
'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
'zh_tw': 'zh_TW.big5',
'zh_tw.big5': 'zh_TW.big5',
'zh_tw.euc': 'zh_TW.eucTW',
}
#
# This maps Windows language identifiers to locale strings.
#
# This list has been updated from
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
# to include every locale up to Windows XP.
#
# NOTE: this mapping is incomplete. If your language is missing, please
# submit a bug report to Python bug manager, which you can find via:
# http://www.python.org/dev/
# Make sure you include the missing language identifier and the suggested
# locale code.
#
windows_locale = {
0x0436: "af_ZA", # Afrikaans
0x041c: "sq_AL", # Albanian
0x0401: "ar_SA", # Arabic - Saudi Arabia
0x0801: "ar_IQ", # Arabic - Iraq
0x0c01: "ar_EG", # Arabic - Egypt
0x1001: "ar_LY", # Arabic - Libya
0x1401: "ar_DZ", # Arabic - Algeria
0x1801: "ar_MA", # Arabic - Morocco
0x1c01: "ar_TN", # Arabic - Tunisia
0x2001: "ar_OM", # Arabic - Oman
0x2401: "ar_YE", # Arabic - Yemen
0x2801: "ar_SY", # Arabic - Syria
0x2c01: "ar_JO", # Arabic - Jordan
0x3001: "ar_LB", # Arabic - Lebanon
0x3401: "ar_KW", # Arabic - Kuwait
0x3801: "ar_AE", # Arabic - United Arab Emirates
0x3c01: "ar_BH", # Arabic - Bahrain
0x4001: "ar_QA", # Arabic - Qatar
0x042b: "hy_AM", # Armenian
0x042c: "az_AZ", # Azeri Latin
0x082c: "az_AZ", # Azeri - Cyrillic
0x042d: "eu_ES", # Basque
0x0423: "be_BY", # Belarusian
0x0445: "bn_IN", # Begali
0x201a: "bs_BA", # Bosnian
0x141a: "bs_BA", # Bosnian - Cyrillic
0x047e: "br_FR", # Breton - France
0x0402: "bg_BG", # Bulgarian
0x0403: "ca_ES", # Catalan
0x0004: "zh_CHS",# Chinese - Simplified
0x0404: "zh_TW", # Chinese - Taiwan
0x0804: "zh_CN", # Chinese - PRC
0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
0x1004: "zh_SG", # Chinese - Singapore
0x1404: "zh_MO", # Chinese - Macao S.A.R.
0x7c04: "zh_CHT",# Chinese - Traditional
0x041a: "hr_HR", # Croatian
0x101a: "hr_BA", # Croatian - Bosnia
0x0405: "cs_CZ", # Czech
0x0406: "da_DK", # Danish
0x048c: "gbz_AF",# Dari - Afghanistan
0x0465: "div_MV",# Divehi - Maldives
0x0413: "nl_NL", # Dutch - The Netherlands
0x0813: "nl_BE", # Dutch - Belgium
0x0409: "en_US", # English - United States
0x0809: "en_GB", # English - United Kingdom
0x0c09: "en_AU", # English - Australia
0x1009: "en_CA", # English - Canada
0x1409: "en_NZ", # English - New Zealand
0x1809: "en_IE", # English - Ireland
0x1c09: "en_ZA", # English - South Africa
0x2009: "en_JA", # English - Jamaica
0x2409: "en_CB", # English - Carribbean
0x2809: "en_BZ", # English - Belize
0x2c09: "en_TT", # English - Trinidad
0x3009: "en_ZW", # English - Zimbabwe
0x3409: "en_PH", # English - Phillippines
0x0425: "et_EE", # Estonian
0x0438: "fo_FO", # Faroese
0x0464: "fil_PH",# Filipino
0x040b: "fi_FI", # Finnish
0x040c: "fr_FR", # French - France
0x080c: "fr_BE", # French - Belgium
0x0c0c: "fr_CA", # French - Canada
0x100c: "fr_CH", # French - Switzerland
0x140c: "fr_LU", # French - Luxembourg
0x180c: "fr_MC", # French - Monaco
0x0462: "fy_NL", # Frisian - Netherlands
0x0456: "gl_ES", # Galician
0x0437: "ka_GE", # Georgian
0x0407: "de_DE", # German - Germany
0x0807: "de_CH", # German - Switzerland
0x0c07: "de_AT", # German - Austria
0x1007: "de_LU", # German - Luxembourg
0x1407: "de_LI", # German - Liechtenstein
0x0408: "el_GR", # Greek
0x0447: "gu_IN", # Gujarati
0x040d: "he_IL", # Hebrew
0x0439: "hi_IN", # Hindi
0x040e: "hu_HU", # Hungarian
0x040f: "is_IS", # Icelandic
0x0421: "id_ID", # Indonesian
0x045d: "iu_CA", # Inuktitut
0x085d: "iu_CA", # Inuktitut - Latin
0x083c: "ga_IE", # Irish - Ireland
0x0434: "xh_ZA", # Xhosa - South Africa
0x0435: "zu_ZA", # Zulu
0x0410: "it_IT", # Italian - Italy
0x0810: "it_CH", # Italian - Switzerland
0x0411: "ja_JP", # Japanese
0x044b: "kn_IN", # Kannada - India
0x043f: "kk_KZ", # Kazakh
0x0457: "kok_IN",# Konkani
0x0412: "ko_KR", # Korean
0x0440: "ky_KG", # Kyrgyz
0x0426: "lv_LV", # Latvian
0x0427: "lt_LT", # Lithuanian
0x046e: "lb_LU", # Luxembourgish
0x042f: "mk_MK", # FYRO Macedonian
0x043e: "ms_MY", # Malay - Malaysia
0x083e: "ms_BN", # Malay - Brunei
0x044c: "ml_IN", # Malayalam - India
0x043a: "mt_MT", # Maltese
0x0481: "mi_NZ", # Maori
0x047a: "arn_CL",# Mapudungun
0x044e: "mr_IN", # Marathi
0x047c: "moh_CA",# Mohawk - Canada
0x0450: "mn_MN", # Mongolian
0x0461: "ne_NP", # Nepali
0x0414: "nb_NO", # Norwegian - Bokmal
0x0814: "nn_NO", # Norwegian - Nynorsk
0x0482: "oc_FR", # Occitan - France
0x0448: "or_IN", # Oriya - India
0x0463: "ps_AF", # Pashto - Afghanistan
0x0429: "fa_IR", # Persian
0x0415: "pl_PL", # Polish
0x0416: "pt_BR", # Portuguese - Brazil
0x0816: "pt_PT", # Portuguese - Portugal
0x0446: "pa_IN", # Punjabi
0x046b: "quz_BO",# Quechua (Bolivia)
0x086b: "quz_EC",# Quechua (Ecuador)
0x0c6b: "quz_PE",# Quechua (Peru)
0x0418: "ro_RO", # Romanian - Romania
0x0417: "rm_CH", # Raeto-Romanese
0x0419: "ru_RU", # Russian
0x243b: "smn_FI",# Sami Finland
0x103b: "smj_NO",# Sami Norway
0x143b: "smj_SE",# Sami Sweden
0x043b: "se_NO", # Sami Northern Norway
0x083b: "se_SE", # Sami Northern Sweden
0x0c3b: "se_FI", # Sami Northern Finland
0x203b: "sms_FI",# Sami Skolt
0x183b: "sma_NO",# Sami Southern Norway
0x1c3b: "sma_SE",# Sami Southern Sweden
0x044f: "sa_IN", # Sanskrit
0x0c1a: "sr_SP", # Serbian - Cyrillic
0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
0x081a: "sr_SP", # Serbian - Latin
0x181a: "sr_BA", # Serbian - Bosnia Latin
0x046c: "ns_ZA", # Northern Sotho
0x0432: "tn_ZA", # Setswana - Southern Africa
0x041b: "sk_SK", # Slovak
0x0424: "sl_SI", # Slovenian
0x040a: "es_ES", # Spanish - Spain
0x080a: "es_MX", # Spanish - Mexico
0x0c0a: "es_ES", # Spanish - Spain (Modern)
0x100a: "es_GT", # Spanish - Guatemala
0x140a: "es_CR", # Spanish - Costa Rica
0x180a: "es_PA", # Spanish - Panama
0x1c0a: "es_DO", # Spanish - Dominican Republic
0x200a: "es_VE", # Spanish - Venezuela
0x240a: "es_CO", # Spanish - Colombia
0x280a: "es_PE", # Spanish - Peru
0x2c0a: "es_AR", # Spanish - Argentina
0x300a: "es_EC", # Spanish - Ecuador
0x340a: "es_CL", # Spanish - Chile
0x380a: "es_UR", # Spanish - Uruguay
0x3c0a: "es_PY", # Spanish - Paraguay
0x400a: "es_BO", # Spanish - Bolivia
0x440a: "es_SV", # Spanish - El Salvador
0x480a: "es_HN", # Spanish - Honduras
0x4c0a: "es_NI", # Spanish - Nicaragua
0x500a: "es_PR", # Spanish - Puerto Rico
0x0441: "sw_KE", # Swahili
0x041d: "sv_SE", # Swedish - Sweden
0x081d: "sv_FI", # Swedish - Finland
0x045a: "syr_SY",# Syriac
0x0449: "ta_IN", # Tamil
0x0444: "tt_RU", # Tatar
0x044a: "te_IN", # Telugu
0x041e: "th_TH", # Thai
0x041f: "tr_TR", # Turkish
0x0422: "uk_UA", # Ukrainian
0x0420: "ur_PK", # Urdu
0x0820: "ur_IN", # Urdu - India
0x0443: "uz_UZ", # Uzbek - Latin
0x0843: "uz_UZ", # Uzbek - Cyrillic
0x042a: "vi_VN", # Vietnamese
0x0452: "cy_GB", # Welsh
}
def _print_locale():
""" Test function.
"""
categories = {}
def _init_categories(categories=categories):
for k,v in globals().items():
if k[:3] == 'LC_':
categories[k] = v
_init_categories()
del categories['LC_ALL']
print 'Locale defaults as determined by getdefaultlocale():'
print '-'*72
lang, enc = getdefaultlocale()
print 'Language: ', lang or '(undefined)'
print 'Encoding: ', enc or '(undefined)'
print
print 'Locale settings on startup:'
print '-'*72
for name,category in categories.items():
print name, '...'
lang, enc = getlocale(category)
print ' Language: ', lang or '(undefined)'
print ' Encoding: ', enc or '(undefined)'
print
print
print 'Locale settings after calling resetlocale():'
print '-'*72
resetlocale()
for name,category in categories.items():
print name, '...'
lang, enc = getlocale(category)
print ' Language: ', lang or '(undefined)'
print ' Encoding: ', enc or '(undefined)'
print
try:
setlocale(LC_ALL, "")
except:
print 'NOTE:'
print 'setlocale(LC_ALL, "") does not support the default locale'
print 'given in the OS environment variables.'
else:
print
print 'Locale settings after calling setlocale(LC_ALL, ""):'
print '-'*72
for name,category in categories.items():
print name, '...'
lang, enc = getlocale(category)
print ' Language: ', lang or '(undefined)'
print ' Encoding: ', enc or '(undefined)'
print
###
try:
LC_MESSAGES
except NameError:
pass
else:
__all__.append("LC_MESSAGES")
if __name__=='__main__':
print 'Locale aliasing:'
print
_print_locale()
print
print 'Number formatting:'
print
_test()
| bsd-3-clause |
lauraE3/laura-smith-developement.co.uk | wp-content/themes/ls-dev/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py | 1788 | 1435 | #!/usr/bin/env python
import re
import json
# https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
highSurrogate = int((codePoint - 0x10000) / 0x400) + 0xD800
lowSurrogate = int((codePoint - 0x10000) % 0x400) + 0xDC00
return unichr(highSurrogate) + unichr(lowSurrogate)
else:
return 'Error'
def hexify(codePoint):
return 'U+' + hex(codePoint)[2:].upper().zfill(6)
def writeFile(filename, contents):
print filename
with open(filename, 'w') as f:
f.write(contents.strip() + '\n')
data = []
for codePoint in range(0x000000, 0x10FFFF + 1):
# Skip non-scalar values.
if codePoint >= 0xD800 and codePoint <= 0xDFFF:
continue
symbol = unisymbol(codePoint)
# http://stackoverflow.com/a/17199950/96656
bytes = symbol.encode('utf8').decode('latin1')
data.append({
'codePoint': codePoint,
'decoded': symbol,
'encoded': bytes
});
jsonData = json.dumps(data, sort_keys=False, indent=2, separators=(',', ': '))
# Use tabs instead of double spaces for indentation
jsonData = jsonData.replace(' ', '\t')
# Escape hexadecimal digits in escape sequences
jsonData = re.sub(
r'\\u([a-fA-F0-9]{4})',
lambda match: r'\u{}'.format(match.group(1).upper()),
jsonData
)
writeFile('data.json', jsonData)
| gpl-2.0 |
Vignesh2208/Awlsim | awlsim/core/offset.py | 1 | 3522 | # -*- coding: utf-8 -*-
#
# AWL data offset
#
# Copyright 2012-2015 Michael Buesch <m@bues.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.datatypehelpers import *
#from awlsim.core.dynattrs cimport * #@cy
from awlsim.core.dynattrs import * #@nocy
from awlsim.core.util import *
class AwlOffset(DynAttrs): #+cdef
"Memory area offset"
dynAttrs = {
# A DB-number for fully qualified access, or None.
"dbNumber" : None,
# A symbolic DB-name for fully qualified access, or None.
"dbName" : None,
# An AwlDataIdentChain, or None.
# Used for fully qualified (DBx.VAR) or named local (#VAR)
# global symbolic ("VAR") accesses.
# For global symbols the chain only has one element.
"identChain" : None,
# A (S)FB-number for multi-instance calls, or None.
"fbNumber" : None,
# Additional sub-offset that is added to this offset.
# Defaults to 0.0
# This is used for arrays and structs.
"subOffset" : lambda self, name: AwlOffset(),
}
def __init__(self, byteOffset=0, bitOffset=0):
self.byteOffset, self.bitOffset =\
byteOffset, bitOffset
def dup(self):
offset = AwlOffset(self.byteOffset,
self.bitOffset)
offset.dbNumber = self.dbNumber
return offset
# ** Creates a new AWL Offset object
@classmethod
def fromPointerValue(cls, value):
return cls((value & 0x0007FFF8) >> 3,
(value & 0x7))
def toPointerValue(self):
return ((self.byteOffset << 3) & 0x0007FFF8) |\
(self.bitOffset & 0x7)
@classmethod
def fromBitOffset(cls, bitOffset):
return cls(bitOffset // 8, bitOffset % 8)
def toBitOffset(self):
return self.byteOffset * 8 + self.bitOffset
def __add__(self, other):
bitOffset = (self.byteOffset + other.byteOffset) * 8 +\
self.bitOffset + other.bitOffset
return AwlOffset(bitOffset // 8, bitOffset % 8)
def __iadd__(self, other):
bitOffset = (self.byteOffset + other.byteOffset) * 8 +\
self.bitOffset + other.bitOffset
self.byteOffset = bitOffset // 8
self.bitOffset = bitOffset % 8
return self
# Round the offset to a multiple of 'byteBase' bytes.
# Returns an AwlOffset.
def roundUp(self, byteBase):
byteOffset = self.byteOffset
if self.bitOffset:
byteOffset += 1
byteOffset = roundUp(byteOffset, byteBase)
return AwlOffset(byteOffset)
def __repr__(self):
prefix = ""
if self.dbNumber is not None:
prefix = "DB%d" % self.dbNumber
if self.dbName is not None:
prefix = '"%s"' % self.dbName
if self.identChain is not None:
if prefix:
return prefix + "." + self.identChain.getString()
return "#" + self.identChain.getString()
else:
if prefix:
prefix = prefix + ".DBX "
return "%s%d.%d" % (prefix,
self.byteOffset,
self.bitOffset)
| gpl-2.0 |
DickJ/kate | addons/pate/src/plugins/python_utils/python_checkers/pep8_checker.py | 3 | 4799 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com> and
# Alejandro Blanco <alejandro.b.e@gmail.com>
#
# This software 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, either version 3 of the License, or
# (at your option) any later version.
#
# This software 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
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this software. If not, see <http://www.gnu.org/licenses/>.
# This file originally was in this repository:
# <https://github.com/goinnn/Kate-plugins/tree/master/kate_plugins/pyte_plugins/check_plugins/pep8_plugins.py>
import sys
import kate
import pep8
from PyKDE4.kdecore import i18n
from libkatepate.errors import showOk, showErrors, showError
from python_checkers.all_checker import checkAll
from python_checkers.utils import canCheckDocument
from python_settings import (KATE_ACTIONS,
DEFAULT_IGNORE_PEP8_ERRORS,
_IGNORE_PEP8_ERRORS)
OLD_PEP8_VERSIONS = ['1.0.1', '1.1', '1.2']
if pep8.__version__ not in OLD_PEP8_VERSIONS:
class KateReport(pep8.BaseReport):
def __init__(self, options):
super(KateReport, self).__init__(options)
self.error_list = []
self.ignore = options.ignore
def error(self, line_number, offset, text, check):
code = super(KateReport, self).error(line_number, offset, text, check)
self.error_list.append([line_number, offset, text[0:4], text])
return code
def get_errors(self):
"""
Get the errors, and reset the checker
"""
result, self.error_list = self.error_list, []
return result
else:
class StoreErrorsChecker(pep8.Checker):
def __init__(self, *args, **kwargs):
super(StoreErrorsChecker, self).__init__(*args, **kwargs)
self.error_list = []
def report_error(self, line_number, offset, text, check):
"""
Store the error
"""
self.file_errors += 1
error_code = text[0:4]
if not pep8.ignore_code(error_code):
self.error_list.append([line_number, offset, error_code, text])
def get_errors(self):
"""
Get the errors, and reset the checker
"""
result, self.error_list = self.error_list, []
self.file_errors = 0
return result
def saveFirst():
showError(i18n('You must save the file first'))
@kate.action(**KATE_ACTIONS['checkPep8'])
def checkPep8(currentDocument=None, refresh=True):
"""Check the pep8 errors of the document"""
if not canCheckDocument(currentDocument):
return
if refresh:
checkAll.f(currentDocument, ['checkPep8'],
exclude_all=not currentDocument)
move_cursor = not currentDocument
currentDocument = currentDocument or kate.activeDocument()
if currentDocument.isModified():
saveFirst()
return
path = currentDocument.url().path()
if not path:
saveFirst()
return
mark_key = '%s-pep8' % currentDocument.url().path()
# Check the file for errors with PEP8
sys.argv = [path]
pep8.process_options([path])
python_utils_conf = kate.configuration.root.get('python_utils', {})
ignore_pep8_errors = python_utils_conf.get(_IGNORE_PEP8_ERRORS, DEFAULT_IGNORE_PEP8_ERRORS)
if ignore_pep8_errors:
ignore_pep8_errors = ignore_pep8_errors.split(",")
else:
ignore_pep8_errors = []
if pep8.__version__ in OLD_PEP8_VERSIONS:
checker = StoreErrorsChecker(path)
pep8.options.ignore = ignore_pep8_errors
checker.check_all()
errors = checker.get_errors()
else:
checker = pep8.Checker(path, reporter=KateReport, ignore=ignore_pep8_errors)
checker.check_all()
errors = checker.report.get_errors()
if len(errors) == 0:
showOk(i18n('Pep8 Ok'))
return
errors_to_show = []
# Paint errors found
for error in errors:
errors_to_show.append({
"line": error[0],
"column": error[1] + 1,
"message": error[3],
})
showErrors(i18n('Pep8 Errors:'),
errors_to_show,
mark_key,
currentDocument,
move_cursor=move_cursor)
# kate: space-indent on; indent-width 4;
| lgpl-2.1 |
OpenDrift/opendrift | tests/readers/test_variables.py | 1 | 2108 | import numpy as np
import pytest
from . import *
from datetime import datetime, timedelta
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.readers import reader_constant
from opendrift.models.oceandrift import OceanDrift
def test_covers_positions(test_data):
reader_arome = reader_netCDF_CF_generic.Reader(
test_data +
'2Feb2016_Nordic_sigma_3d/AROME_MetCoOp_00_DEF_20160202_subset.nc')
ts = reader_arome.get_timeseries_at_position(
lon=12, lat=68, variables=['x_wind', 'y_wind'])
assert len(ts['time']) == 49
x_wind = ts['x_wind']
assert len(x_wind) == 49
np.testing.assert_almost_equal(x_wind[0], 2.836, 2)
np.testing.assert_almost_equal(x_wind[-1], -0.667, 2)
def test_environment_mapping(test_data):
# Wind from NE
r = reader_constant.Reader({'wind_speed':5, 'wind_from_direction': 45,
'land_binary_mask': 0})
o = OceanDrift(loglevel=50)
o.set_config('general:use_auto_landmask', False)
o.add_reader(r)
o.seed_elements(lon=4, lat=60, time=datetime.now())
o.run(steps=15)
np.testing.assert_almost_equal(o.elements.lon, 3.932, 3)
np.testing.assert_almost_equal(o.elements.lat, 59.966, 3)
# Wind from SW
r = reader_constant.Reader({'wind_speed':5, 'wind_from_direction': 225,
'land_binary_mask': 0})
o = OceanDrift(loglevel=50)
o.set_config('general:use_auto_landmask', False)
o.add_reader(r)
o.seed_elements(lon=4, lat=60, time=datetime.now())
o.run(steps=15)
np.testing.assert_almost_equal(o.elements.lon, 4.068, 3)
np.testing.assert_almost_equal(o.elements.lat, 60.034, 3)
# land_binary_mask mapped from sea_floor_depth_below_sea_level
r = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
'14Jan2016_NorKyst_z_3d/NorKyst-800m_ZDEPTHS_his_00_3Dsubset.nc')
assert 'land_binary_mask' not in r.derived_variables # Disabled by default
r.activate_environment_mapping('land_binary_mask_from_ocean_depth')
assert 'land_binary_mask' in r.derived_variables
| gpl-2.0 |
zhjunlang/kbengine | kbe/src/lib/python/Lib/test/test_importlib/builtin/test_finder.py | 81 | 2798 | from .. import abc
from .. import util
from . import util as builtin_util
frozen_machinery, source_machinery = util.import_importlib('importlib.machinery')
import sys
import unittest
class FindSpecTests(abc.FinderTests):
"""Test find_spec() for built-in modules."""
def test_module(self):
# Common case.
with util.uncache(builtin_util.NAME):
found = self.machinery.BuiltinImporter.find_spec(builtin_util.NAME)
self.assertTrue(found)
self.assertEqual(found.origin, 'built-in')
# Built-in modules cannot be a package.
test_package = None
# Built-in modules cannobt be in a package.
test_module_in_package = None
# Built-in modules cannot be a package.
test_package_in_package = None
# Built-in modules cannot be a package.
test_package_over_module = None
def test_failure(self):
name = 'importlib'
assert name not in sys.builtin_module_names
spec = self.machinery.BuiltinImporter.find_spec(name)
self.assertIsNone(spec)
def test_ignore_path(self):
# The value for 'path' should always trigger a failed import.
with util.uncache(builtin_util.NAME):
spec = self.machinery.BuiltinImporter.find_spec(builtin_util.NAME,
['pkg'])
self.assertIsNone(spec)
Frozen_FindSpecTests, Source_FindSpecTests = util.test_both(FindSpecTests,
machinery=[frozen_machinery, source_machinery])
class FinderTests(abc.FinderTests):
"""Test find_module() for built-in modules."""
def test_module(self):
# Common case.
with util.uncache(builtin_util.NAME):
found = self.machinery.BuiltinImporter.find_module(builtin_util.NAME)
self.assertTrue(found)
self.assertTrue(hasattr(found, 'load_module'))
# Built-in modules cannot be a package.
test_package = test_package_in_package = test_package_over_module = None
# Built-in modules cannot be in a package.
test_module_in_package = None
def test_failure(self):
assert 'importlib' not in sys.builtin_module_names
loader = self.machinery.BuiltinImporter.find_module('importlib')
self.assertIsNone(loader)
def test_ignore_path(self):
# The value for 'path' should always trigger a failed import.
with util.uncache(builtin_util.NAME):
loader = self.machinery.BuiltinImporter.find_module(builtin_util.NAME,
['pkg'])
self.assertIsNone(loader)
Frozen_FinderTests, Source_FinderTests = util.test_both(FinderTests,
machinery=[frozen_machinery, source_machinery])
if __name__ == '__main__':
unittest.main()
| lgpl-3.0 |
rickerc/glance_audit | glance/openstack/common/notifier/rpc_notifier.py | 5 | 1693 | # Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# 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.
from oslo.config import cfg
from glance.openstack.common import context as req_context
from glance.openstack.common.gettextutils import _
from glance.openstack.common import log as logging
from glance.openstack.common import rpc
LOG = logging.getLogger(__name__)
notification_topic_opt = cfg.ListOpt(
'notification_topics', default=['notifications', ],
help='AMQP topic used for openstack notifications')
CONF = cfg.CONF
CONF.register_opt(notification_topic_opt)
def notify(context, message):
"""Sends a notification via RPC"""
if not context:
context = req_context.get_admin_context()
priority = message.get('priority',
CONF.default_notification_level)
priority = priority.lower()
for topic in CONF.notification_topics:
topic = '%s.%s' % (topic, priority)
try:
rpc.notify(context, topic, message)
except Exception:
LOG.exception(_("Could not send notification to %(topic)s. "
"Payload=%(message)s"), locals())
| apache-2.0 |
Thraxis/SickRage | lib/ndg/httpsclient/ssl_peer_verification.py | 63 | 9649 | """ndg_httpsclient - module containing SSL peer verification class.
"""
__author__ = "P J Kershaw (STFC)"
__date__ = "09/12/11"
__copyright__ = "(C) 2012 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = '$Id$'
import re
import logging
log = logging.getLogger(__name__)
try:
from ndg.httpsclient.subj_alt_name import SubjectAltName
from pyasn1.codec.der import decoder as der_decoder
SUBJ_ALT_NAME_SUPPORT = True
except ImportError, e:
SUBJ_ALT_NAME_SUPPORT = False
SUBJ_ALT_NAME_SUPPORT_MSG = (
'SubjectAltName support is disabled - check pyasn1 package '
'installation to enable'
)
import warnings
warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)
class ServerSSLCertVerification(object):
"""Check server identity. If hostname doesn't match, allow match of
host's Distinguished Name against server DN setting"""
DN_LUT = {
'commonName': 'CN',
'organisationalUnitName': 'OU',
'organisation': 'O',
'countryName': 'C',
'emailAddress': 'EMAILADDRESS',
'localityName': 'L',
'stateOrProvinceName': 'ST',
'streetAddress': 'STREET',
'domainComponent': 'DC',
'userid': 'UID'
}
SUBJ_ALT_NAME_EXT_NAME = 'subjectAltName'
PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values())
PARSER_RE = re.compile(PARSER_RE_STR)
__slots__ = ('__hostname', '__certDN', '__subj_alt_name_match')
def __init__(self, certDN=None, hostname=None, subj_alt_name_match=True):
"""Override parent class __init__ to enable setting of certDN
setting
@type certDN: string
@param certDN: Set the expected Distinguished Name of the
server to avoid errors matching hostnames. This is useful
where the hostname is not fully qualified
@type hostname: string
@param hostname: hostname to match against peer certificate
subjectAltNames or subject common name
@type subj_alt_name_match: bool
@param subj_alt_name_match: flag to enable/disable matching of hostname
against peer certificate subjectAltNames. Nb. A setting of True will
be ignored if the pyasn1 package is not installed
"""
self.__certDN = None
self.__hostname = None
if certDN is not None:
self.certDN = certDN
if hostname is not None:
self.hostname = hostname
if subj_alt_name_match:
if not SUBJ_ALT_NAME_SUPPORT:
log.warning('Overriding "subj_alt_name_match" keyword setting: '
'peer verification with subjectAltNames is disabled')
self.__subj_alt_name_match = False
else:
self.__subj_alt_name_match = True
else:
log.debug('Disabling peer verification with subject '
'subjectAltNames!')
self.__subj_alt_name_match = False
def __call__(self, connection, peerCert, errorStatus, errorDepth,
preverifyOK):
"""Verify server certificate
@type connection: OpenSSL.SSL.Connection
@param connection: SSL connection object
@type peerCert: basestring
@param peerCert: server host certificate as OpenSSL.crypto.X509
instance
@type errorStatus: int
@param errorStatus: error status passed from caller. This is the value
returned by the OpenSSL C function X509_STORE_CTX_get_error(). Look-up
x509_vfy.h in the OpenSSL source to get the meanings of the different
codes. PyOpenSSL doesn't help you!
@type errorDepth: int
@param errorDepth: a non-negative integer representing where in the
certificate chain the error occurred. If it is zero it occured in the
end entity certificate, one if it is the certificate which signed the
end entity certificate and so on.
@type preverifyOK: int
@param preverifyOK: the error status - 0 = Error, 1 = OK of the current
SSL context irrespective of any verification checks done here. If this
function yields an OK status, it should enforce the preverifyOK value
so that any error set upstream overrides and is honoured.
@rtype: int
@return: status code - 0/False = Error, 1/True = OK
"""
if peerCert.has_expired():
# Any expired certificate in the chain should result in an error
log.error('Certificate %r in peer certificate chain has expired',
peerCert.get_subject())
return False
elif errorDepth == 0:
# Only interested in DN of last certificate in the chain - this must
# match the expected Server DN setting
peerCertSubj = peerCert.get_subject()
peerCertDN = peerCertSubj.get_components()
peerCertDN.sort()
if self.certDN is None:
# Check hostname against peer certificate CN field instead:
if self.hostname is None:
log.error('No "hostname" or "certDN" set to check peer '
'certificate against')
return False
# Check for subject alternative names
if self.__subj_alt_name_match:
dns_names = self._get_subj_alt_name(peerCert)
if self.hostname in dns_names:
return preverifyOK
# If no subjectAltNames, default to check of subject Common Name
if peerCertSubj.commonName == self.hostname:
return preverifyOK
else:
log.error('Peer certificate CN %r doesn\'t match the '
'expected CN %r', peerCertSubj.commonName,
self.hostname)
return False
else:
if peerCertDN == self.certDN:
return preverifyOK
else:
log.error('Peer certificate DN %r doesn\'t match the '
'expected DN %r', peerCertDN, self.certDN)
return False
else:
return preverifyOK
def get_verify_server_cert_func(self):
def verify_server_cert(connection, peerCert, errorStatus, errorDepth,
preverifyOK):
return self.__call__(connection, peerCert, errorStatus,
errorDepth, preverifyOK)
return verify_server_cert
@classmethod
def _get_subj_alt_name(cls, peer_cert):
'''Extract subjectAltName DNS name settings from certificate extensions
@param peer_cert: peer certificate in SSL connection. subjectAltName
settings if any will be extracted from this
@type peer_cert: OpenSSL.crypto.X509
'''
# Search through extensions
dns_name = []
general_names = SubjectAltName()
for i in range(peer_cert.get_extension_count()):
ext = peer_cert.get_extension(i)
ext_name = ext.get_short_name()
if ext_name == cls.SUBJ_ALT_NAME_EXT_NAME:
# PyOpenSSL returns extension data in ASN.1 encoded form
ext_dat = ext.get_data()
decoded_dat = der_decoder.decode(ext_dat,
asn1Spec=general_names)
for name in decoded_dat:
if isinstance(name, SubjectAltName):
for entry in range(len(name)):
component = name.getComponentByPosition(entry)
dns_name.append(str(component.getComponent()))
return dns_name
def _getCertDN(self):
return self.__certDN
def _setCertDN(self, val):
if isinstance(val, basestring):
# Allow for quoted DN
certDN = val.strip('"')
dnFields = self.__class__.PARSER_RE.split(certDN)
if len(dnFields) < 2:
raise TypeError('Error parsing DN string: "%s"' % certDN)
self.__certDN = zip(dnFields[1::2], dnFields[2::2])
self.__certDN.sort()
elif not isinstance(val, list):
for i in val:
if not len(i) == 2:
raise TypeError('Expecting list of two element DN field, '
'DN field value pairs for "certDN" '
'attribute')
self.__certDN = val
else:
raise TypeError('Expecting list or string type for "certDN" '
'attribute')
certDN = property(fget=_getCertDN,
fset=_setCertDN,
doc="Distinguished Name for Server Certificate")
# Get/Set Property methods
def _getHostname(self):
return self.__hostname
def _setHostname(self, val):
if not isinstance(val, basestring):
raise TypeError("Expecting string type for hostname "
"attribute")
self.__hostname = val
hostname = property(fget=_getHostname,
fset=_setHostname,
doc="hostname of server")
| gpl-3.0 |
allenta/splunk-stomp | stomp/bin/stomppy/utils.py | 3 | 3613 | import re
import xml.dom
try:
import hashlib
except ImportError:
import md5 as hashlib
#
# Used to parse STOMP header lines in the format "key:value",
#
HEADER_LINE_RE = re.compile('(?P<key>[^:]+)[:](?P<value>.*)')
def parse_headers(lines, offset=0):
headers = {}
for header_line in lines[offset:]:
header_match = HEADER_LINE_RE.match(header_line)
if header_match:
key = header_match.group('key')
if key not in headers:
headers[key] = header_match.group('value')
return headers
def parse_frame(frame):
"""
Parse a STOMP frame into a (frame_type, headers, body) tuple,
where frame_type is the frame type as a string (e.g. MESSAGE),
headers is a map containing all header key/value pairs, and
body is a string containing the frame's payload.
"""
if frame == '\x0a':
return ('heartbeat', {}, None)
preamble_end = frame.find('\n\n')
if preamble_end == -1:
preamble_end = len(frame)
preamble = frame[0:preamble_end]
preamble_lines = preamble.split('\n')
body = frame[preamble_end + 2:]
# Skip any leading newlines
first_line = 0
while first_line < len(preamble_lines) and len(preamble_lines[first_line]) == 0:
first_line += 1
# Extract frame type
frame_type = preamble_lines[first_line]
# Put headers into a key/value map
headers = parse_headers(preamble_lines, first_line + 1)
if 'transformation' in headers:
body = transform(body, headers['transformation'])
return (frame_type, headers, body)
def transform(body, trans_type):
"""
Perform body transformation. Currently, the only supported transformation is
'jms-map-xml', which converts a map into python dictionary. This can be extended
to support other transformation types.
The body has the following format:
<map>
<entry>
<string>name</string>
<string>Dejan</string>
</entry>
<entry>
<string>city</string>
<string>Belgrade</string>
</entry>
</map>
(see http://docs.codehaus.org/display/STOMP/Stomp+v1.1+Ideas)
\param body the content of a message
\param trans_type the type transformation
"""
if trans_type != 'jms-map-xml':
return body
try:
entries = {}
doc = xml.dom.minidom.parseString(body)
rootElem = doc.documentElement
for entryElem in rootElem.getElementsByTagName("entry"):
pair = []
for node in entryElem.childNodes:
if not isinstance(node, xml.dom.minidom.Element): continue
pair.append(node.firstChild.nodeValue)
assert len(pair) == 2
entries[pair[0]] = pair[1]
return entries
except Exception:
#
# unable to parse message. return original
#
return body
def merge_headers(header_map_list):
"""
Helper function for combining multiple header maps into one.
"""
headers = {}
for header_map in header_map_list:
for header_key in header_map.keys():
headers[header_key] = header_map[header_key]
return headers
def calculate_heartbeats(shb, chb):
"""
Given a heartbeat string from the server, and a heartbeat tuple from the client,
calculate what the actual heartbeat settings should be.
"""
(sx, sy) = shb
(cx, cy) = chb
x = 0
y = 0
if cx != 0 and sy != '0':
x = max(cx, int(sy))
if cy != 0 and sx != '0':
y = max(cy, int(sx))
return (x, y) | gpl-3.0 |
ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/PyQt4/uic/driver.py | 6 | 4587 | #############################################################################
##
## Copyright (c) 2014 Riverbank Computing Limited <info@riverbankcomputing.com>
##
## This file is part of PyQt.
##
## This file may be used under the terms of the GNU General Public
## License versions 2.0 or 3.0 as published by the Free Software
## Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
## included in the packaging of this file. Alternatively you may (at
## your option) use any later version of the GNU General Public
## License if such license has been publicly approved by Riverbank
## Computing Limited (or its successors, if any) and the KDE Free Qt
## Foundation. In addition, as a special exception, Riverbank gives you
## certain additional rights. These rights are described in the Riverbank
## GPL Exception version 1.1, which can be found in the file
## GPL_EXCEPTION.txt in this package.
##
## If you are unsure which license is appropriate for your use, please
## contact the sales department at sales@riverbankcomputing.com.
##
## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
#############################################################################
import sys
import logging
from PyQt4.uic import compileUi, loadUi
class Driver(object):
""" This encapsulates access to the pyuic functionality so that it can be
called by code that is Python v2/v3 specific.
"""
LOGGER_NAME = 'PyQt4.uic'
def __init__(self, opts, ui_file):
""" Initialise the object. opts is the parsed options. ui_file is the
name of the .ui file.
"""
if opts.debug:
logger = logging.getLogger(self.LOGGER_NAME)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(name)s: %(message)s"))
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
self._opts = opts
self._ui_file = ui_file
def invoke(self):
""" Invoke the action as specified by the parsed options. Returns 0 if
there was no error.
"""
if self._opts.preview:
return self._preview()
self._generate()
return 0
def _preview(self):
""" Preview the .ui file. Return the exit status to be passed back to
the parent process.
"""
from PyQt4 import QtGui
app = QtGui.QApplication([self._ui_file])
widget = loadUi(self._ui_file)
widget.show()
return app.exec_()
def _generate(self):
""" Generate the Python code. """
if sys.hexversion >= 0x03000000:
if self._opts.output == '-':
from io import TextIOWrapper
pyfile = TextIOWrapper(sys.stdout.buffer, encoding='utf8')
else:
pyfile = open(self._opts.output, 'wt', encoding='utf8')
else:
if self._opts.output == '-':
pyfile = sys.stdout
else:
pyfile = open(self._opts.output, 'wt')
compileUi(self._ui_file, pyfile, self._opts.execute, self._opts.indent,
self._opts.pyqt3_wrapper, self._opts.from_imports,
self._opts.resource_suffix)
def on_IOError(self, e):
""" Handle an IOError exception. """
sys.stderr.write("Error: %s: \"%s\"\n" % (e.strerror, e.filename))
def on_SyntaxError(self, e):
""" Handle a SyntaxError exception. """
sys.stderr.write("Error in input file: %s\n" % e)
def on_NoSuchWidgetError(self, e):
""" Handle a NoSuchWidgetError exception. """
if e.args[0].startswith("Q3"):
sys.stderr.write("Error: Q3Support widgets are not supported by PyQt4.\n")
else:
sys.stderr.write(str(e) + "\n")
def on_Exception(self, e):
""" Handle a generic exception. """
if logging.getLogger(self.LOGGER_NAME).level == logging.DEBUG:
import traceback
traceback.print_exception(*sys.exc_info())
else:
from PyQt4 import QtCore
sys.stderr.write("""An unexpected error occurred.
Check that you are using the latest version of PyQt and send an error report to
support@riverbankcomputing.com, including the following information:
* your version of PyQt (%s)
* the UI file that caused this error
* the debug output of pyuic4 (use the -d flag when calling pyuic4)
""" % QtCore.PYQT_VERSION_STR)
| gpl-3.0 |
2014c2g4/2015cda0623 | static/Brython3.1.1-20150328-091302/Lib/sre_constants.py | 692 | 7172 | #
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# update when constants are added or removed
MAGIC = 20031017
#MAXREPEAT = 2147483648
#from _sre import MAXREPEAT
# SRE standard exception (access as sre.error)
# should this really be here?
class error(Exception):
pass
# operators
FAILURE = "failure"
SUCCESS = "success"
ANY = "any"
ANY_ALL = "any_all"
ASSERT = "assert"
ASSERT_NOT = "assert_not"
AT = "at"
BIGCHARSET = "bigcharset"
BRANCH = "branch"
CALL = "call"
CATEGORY = "category"
CHARSET = "charset"
GROUPREF = "groupref"
GROUPREF_IGNORE = "groupref_ignore"
GROUPREF_EXISTS = "groupref_exists"
IN = "in"
IN_IGNORE = "in_ignore"
INFO = "info"
JUMP = "jump"
LITERAL = "literal"
LITERAL_IGNORE = "literal_ignore"
MARK = "mark"
MAX_REPEAT = "max_repeat"
MAX_UNTIL = "max_until"
MIN_REPEAT = "min_repeat"
MIN_UNTIL = "min_until"
NEGATE = "negate"
NOT_LITERAL = "not_literal"
NOT_LITERAL_IGNORE = "not_literal_ignore"
RANGE = "range"
REPEAT = "repeat"
REPEAT_ONE = "repeat_one"
SUBPATTERN = "subpattern"
MIN_REPEAT_ONE = "min_repeat_one"
# positions
AT_BEGINNING = "at_beginning"
AT_BEGINNING_LINE = "at_beginning_line"
AT_BEGINNING_STRING = "at_beginning_string"
AT_BOUNDARY = "at_boundary"
AT_NON_BOUNDARY = "at_non_boundary"
AT_END = "at_end"
AT_END_LINE = "at_end_line"
AT_END_STRING = "at_end_string"
AT_LOC_BOUNDARY = "at_loc_boundary"
AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"
AT_UNI_BOUNDARY = "at_uni_boundary"
AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"
# categories
CATEGORY_DIGIT = "category_digit"
CATEGORY_NOT_DIGIT = "category_not_digit"
CATEGORY_SPACE = "category_space"
CATEGORY_NOT_SPACE = "category_not_space"
CATEGORY_WORD = "category_word"
CATEGORY_NOT_WORD = "category_not_word"
CATEGORY_LINEBREAK = "category_linebreak"
CATEGORY_NOT_LINEBREAK = "category_not_linebreak"
CATEGORY_LOC_WORD = "category_loc_word"
CATEGORY_LOC_NOT_WORD = "category_loc_not_word"
CATEGORY_UNI_DIGIT = "category_uni_digit"
CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"
CATEGORY_UNI_SPACE = "category_uni_space"
CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"
CATEGORY_UNI_WORD = "category_uni_word"
CATEGORY_UNI_NOT_WORD = "category_uni_not_word"
CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"
CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"
OPCODES = [
# failure=0 success=1 (just because it looks better that way :-)
FAILURE, SUCCESS,
ANY, ANY_ALL,
ASSERT, ASSERT_NOT,
AT,
BRANCH,
CALL,
CATEGORY,
CHARSET, BIGCHARSET,
GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE,
IN, IN_IGNORE,
INFO,
JUMP,
LITERAL, LITERAL_IGNORE,
MARK,
MAX_UNTIL,
MIN_UNTIL,
NOT_LITERAL, NOT_LITERAL_IGNORE,
NEGATE,
RANGE,
REPEAT,
REPEAT_ONE,
SUBPATTERN,
MIN_REPEAT_ONE
]
ATCODES = [
AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,
AT_UNI_NON_BOUNDARY
]
CHCODES = [
CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,
CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,
CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,
CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,
CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,
CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,
CATEGORY_UNI_NOT_LINEBREAK
]
def makedict(list):
d = {}
i = 0
for item in list:
d[item] = i
i = i + 1
return d
OPCODES = makedict(OPCODES)
ATCODES = makedict(ATCODES)
CHCODES = makedict(CHCODES)
# replacement operations for "ignore case" mode
OP_IGNORE = {
GROUPREF: GROUPREF_IGNORE,
IN: IN_IGNORE,
LITERAL: LITERAL_IGNORE,
NOT_LITERAL: NOT_LITERAL_IGNORE
}
AT_MULTILINE = {
AT_BEGINNING: AT_BEGINNING_LINE,
AT_END: AT_END_LINE
}
AT_LOCALE = {
AT_BOUNDARY: AT_LOC_BOUNDARY,
AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY
}
AT_UNICODE = {
AT_BOUNDARY: AT_UNI_BOUNDARY,
AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY
}
CH_LOCALE = {
CATEGORY_DIGIT: CATEGORY_DIGIT,
CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,
CATEGORY_SPACE: CATEGORY_SPACE,
CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,
CATEGORY_WORD: CATEGORY_LOC_WORD,
CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,
CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,
CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK
}
CH_UNICODE = {
CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,
CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,
CATEGORY_SPACE: CATEGORY_UNI_SPACE,
CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,
CATEGORY_WORD: CATEGORY_UNI_WORD,
CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,
CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,
CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK
}
# flags
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
SRE_FLAG_IGNORECASE = 2 # case insensitive
SRE_FLAG_LOCALE = 4 # honour system locale
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
SRE_FLAG_DOTALL = 16 # treat target as a single string
SRE_FLAG_UNICODE = 32 # use unicode "locale"
SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments
SRE_FLAG_DEBUG = 128 # debugging
SRE_FLAG_ASCII = 256 # use ascii "locale"
# flags for INFO primitive
SRE_INFO_PREFIX = 1 # has prefix
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
SRE_INFO_CHARSET = 4 # pattern starts with character from given set
if __name__ == "__main__":
def dump(f, d, prefix):
items = sorted(d.items(), key=lambda a: a[1])
for k, v in items:
f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))
f = open("sre_constants.h", "w")
f.write("""\
/*
* Secret Labs' Regular Expression Engine
*
* regular expression matching engine
*
* NOTE: This file is generated by sre_constants.py. If you need
* to change anything in here, edit sre_constants.py and run it.
*
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
*
* See the _sre.c file for information on usage and redistribution.
*/
""")
f.write("#define SRE_MAGIC %d\n" % MAGIC)
dump(f, OPCODES, "SRE_OP")
dump(f, ATCODES, "SRE")
dump(f, CHCODES, "SRE")
f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)
f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)
f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)
f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)
f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)
f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)
f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)
f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)
f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)
f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)
f.close()
print("done")
| gpl-3.0 |
vrsys/avango | attic/examples/3d-menu/contextmenu.py | 6 | 18610 | # -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# #
# Copyright 1997 - 2010 Fraunhofer-Gesellschaft zur Foerderung der #
# angewandten Forschung (FhG), Munich, Germany. #
# #
# AVANGO 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 3. #
# #
# AVANGO 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 #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU Lesser General Public #
# License along with AVANGO. If not, see <http://www.gnu.org/licenses/>. #
# #
##########################################################################
'''
Example of how to use the avango.menu as a context-menu/context-control
This example demonstrates one possibility of how to use the avango 3d-menu
as a context control for creating and manipulating objects. Many features of
basic_tutorial.py are used and more functionality is introduced:
- use the menu as a context control
- add custom fields to objects for defining a context menu behavior
- create a simple color tool class, that can be added as a menu container
After the app is launched, you will see a blank black window. Right-click on
the background to open a context menu. There you can create simple objects,
that can be dragged around. Right-clicking an object does open a context
control for manipulating the objects fields like size, scale and color.
As the menus are created just in time, the limits of having complex context
menus are visible: creating menu structures with lots of field connections is
somewhat slow. For more complex applications, it is recommended to create all
available context menus at startup time and just connect, show and hide them
when needed.
'''
import avango.menu.widget
import avango.menu.Preferences
import avango.osg.viewer
import avango.script
from avango.script import field_has_changed
import avango.moving
from os.path import join
import math
# Setup world
# Create a catch-all-sphere to hanlde clicks in 'free space'
catch_all_sphere = avango.osg.nodes.Sphere(
Radius=500,
StateSet=avango.osg.nodes.StateSet(
CullFaceMode=True,
CullFace = avango.osg.nodes.CullFace(Mode=0x408)))
scene_root = avango.osg.nodes.Group(Children=[catch_all_sphere])
# Setup viewer
window = avango.osg.viewer.nodes.GraphicsWindow(NumStencilBits=1)
camera = avango.osg.viewer.nodes.Camera(Window=window)
viewer = avango.osg.viewer.nodes.Viewer(MasterCamera=camera)
viewer.Scene.value = scene_root
# Setup event handler and connect certain events to window
eventfields = avango.osg.viewer.nodes.EventFields(View = viewer)
window.ToggleFullScreen.connect_from(eventfields.KeyAltReturn)
window.DragEvent.connect_from(eventfields.DragEvent)
window.MoveEvent.connect_from(eventfields.MoveEvent)
# Edit menu preferences
# When re-opening a menu panel, no entry should be highlighted
avango.menu.Preferences.panel.RemoveHighlightOnHide.value = True
# Setup context menu panel
context_menu = avango.menu.Panel(Title='Context Menu', Name='contextmenu')
# Setup panel group and placement tool
placement_tool = avango.menu.PlacementBase()
placement_tool.set_head_transform(camera.ViewerTransform)
placement_tool.SceneRoot.value = scene_root
panel_group = avango.menu.PanelGroup()
panel_group.add_panel(context_menu)
panel_group.PlacementTool.value = placement_tool
scene_root.Children.value.append(panel_group.root)
# Set up menu tools to interact with the menu and open a context menu
tools = avango.menu.Tool(Enable=True, MenuRootNode=scene_root)
tools.PickTrigger.connect_from(eventfields.MouseButtons_OnlyLeft)
tools.ContextTrigger.connect_from(eventfields.MouseButtons_OnlyRight)
tools.Transform.connect_from(camera.MouseNearTransform)
# Set up tools for dragging objects with name 'draggable'
pick_selector = avango.tools.nodes.PickSelector(RootNode=scene_root)
name_selector = avango.tools.nodes.NameSelector(SelectableNames=['draggable'])
drag_tool = avango.tools.nodes.DragTool()
name_selector.Targets.connect_from(pick_selector.SelectedTargets)
drag_tool.Targets.connect_from(name_selector.SelectedTargets)
pick_selector.PickTrigger.connect_from(eventfields.MouseButtons_OnlyLeft)
pick_selector.PickRayTransform.connect_from(camera.MouseNearTransform)
drag_tool.DragTransform.connect_from(camera.MouseNearTransform)
# Define a context menu behavior for the catch-all-sphere
# This behavior opens the context menu with a button to add a sphere object to the scene
#
# Adding a field called "MenuToolBehavior" to an object triggers some basic functionality
# in conjunction with the menu.Tool:
# - Context-clicking (usually with right mouse button) calls the show_context_menu method
# with the target-holder as an argument. That allows to react on the context click
# and open a context menu in the right position and for the appropriate object
class CatchAllSphereContextBehavior(avango.script.Script):
ActivePanel = avango.SFObject()
CreateSphere = avango.SFBool()
CreatePanel = avango.SFBool()
def __init__(self):
self.super(CatchAllSphereContextBehavior).__init__()
self.old_sphere_state = False
self.old_panel_state = False
# The menus build-in icon files can be reached through a join of the preference-datapath and the filename
self.create_sphere_button = avango.menu.widget.PushButton(
Title="Create New Sphere",
IconFilenames=[join(avango.menu.Preferences.datapath,"plus.png")])
self.create_panel_button = avango.menu.widget.PushButton(
Title="Create New Panel",
IconFilenames=[join(avango.menu.Preferences.datapath,"plus.png")])
# to react on the button presses, just connect the widgets Select fields to internal fields
self.CreateSphere.connect_from(self.create_sphere_button.Select)
self.CreatePanel.connect_from(self.create_panel_button.Select)
def show_context_menu(self, target_holder=None):
context_menu.Title.value = "World Menu"
hit_point = target_holder.Intersection.value.Point.value
# close and empty menu before adding widgets
# closing the menu triggers ActivePanel=None and helps cleaning up
# old context panel contents
panel_group.hide_panels()
# add buttons to menu
context_menu.add_widget(self.create_sphere_button)
context_menu.add_widget(self.create_panel_button)
# show panel
panel_group.show_placed_panel(context_menu, hit_point)
self.ActivePanel.connect_from(panel_group.ActivePanel)
@field_has_changed(CreateSphere)
def create_sphere_changed(self):
if self.CreateSphere.value:
new_sphere = avango.osg.nodes.Sphere(Radius=0.05,
Name="draggable")
new_sphere.add_and_init_field(avango.script.SFObject(), "MenuToolBehavior", object_behavior)
scene_root.Children.value.append(new_sphere)
# wait for button release to close menu - otherwise the widget will miss the button release,
# because the widget is removed from panel before the button was released.
if self.old_sphere_state and not self.CreateSphere.value:
panel_group.hide_panels()
self.old_sphere_state = self.CreateSphere.value
@field_has_changed(CreatePanel)
def create_panel_changed(self):
if self.CreatePanel.value:
new_panel = avango.osg.nodes.Panel(BorderWidth=0.001,
BorderColor=avango.osg.Vec4(0.3,0.3,0.3,1),
EdgeRadius=0.002)
new_geode = avango.osg.nodes.Geode(Drawables=[new_panel], Name="draggable")
new_geode.add_and_init_field(avango.SFBool(), "PickIgnore", True)
new_transform = avango.osg.nodes.MatrixTransform(Children=[new_geode], Name="draggable")
# to have easier access to the fields of the panel, we add intermediate fields to the
# MatrixTransform. When picking the panel, the MatrixTransform is returned, not the panel
new_transform.add_and_init_field(avango.SFFloat(), "Width", 0.05)
new_panel.Width.connect_from(new_transform.Width)
new_transform.add_and_init_field(avango.SFFloat(), "Height", 0.05)
new_panel.Height.connect_from(new_transform.Height)
new_transform.add_and_init_field(avango.osg.SFVec4(), "Color", avango.osg.Vec4(0.8,0.8,0.2,1))
new_panel.PanelColor.connect_from(new_transform.Color)
# As every object should have it's own context menu, just add the MenuToolBehavior field
# described above and save an instance of an appropriate behavior class into.
# In this example, there is only one type of context menu, so it's possible to reuse one
# instance, created globally below.
new_transform.add_and_init_field(avango.script.SFObject(), "MenuToolBehavior", object_behavior)
# add new object to scene
scene_root.Children.value.append(new_transform)
if self.old_panel_state and not self.CreatePanel.value:
panel_group.hide_panels()
self.old_panel_state = self.CreatePanel.value
@field_has_changed(ActivePanel)
def active_panel_changed(self):
if self.ActivePanel.value == None:
context_menu.remove_all_widgets()
self.ActivePanel.disconnect()
# Here is the context menu behavior class for the object. Like above, it's main purpose is to
# open a context menu when an object is right-clicked. But this one uses a real "context" for
# showing the needed controls (widgets): It asks the clicked object for available fields and
# creates and connects widgets for manipulating these fields.
class ObjectBehavior(avango.script.Script):
ActivePanel = avango.SFObject()
DeleteObject = avango.SFBool()
def __init__(self):
self.super(ObjectBehavior).__init__()
self.radius_slider = avango.menu.widget.Slider(Min=0.01, Max=0.1, Title="Radius")
self.width_slider = avango.menu.widget.Slider(Min=0.01, Max=0.1, Title="Width")
self.height_slider = avango.menu.widget.Slider(Min=0.01, Max=0.1, Title="Height")
self.color_tool = ColorTool()
self.size_tool = SizeTool()
self.divider = avango.menu.widget.Divider()
self.delete_button = avango.menu.widget.PushButton(
Title="Delete Object",
IconFilenames=[join(avango.menu.Preferences.datapath,"delete.png")])
self.delete_old_state = False
def show_context_menu(self, target_holder=None):
panel_group.hide_panels()
# Instead of calling it "Object Menu", you can make the menu title dependent of
# object types or names.
context_menu.Title.value = "Object Menu"
hit_point = target_holder.Intersection.value.Point.value
self.hit_object = target_holder.Target.value
# connect widgets to object and add widgets to menu
if hasattr(self.hit_object, "Radius"):
self.radius_slider.Value.value = self.hit_object.Radius.value
self.hit_object.Radius.connect_from(self.radius_slider.Value)
context_menu.add_widget(self.radius_slider)
if hasattr(self.hit_object, "Width"):
self.width_slider.Value.value = self.hit_object.Width.value
self.hit_object.Width.connect_from(self.width_slider.Value)
context_menu.add_widget(self.width_slider)
if hasattr(self.hit_object, "Height"):
self.height_slider.Value.value = self.hit_object.Height.value
self.hit_object.Height.connect_from(self.height_slider.Value)
context_menu.add_widget(self.height_slider)
if hasattr(self.hit_object, "Matrix"):
self.size_tool.Object.value = self.hit_object
self.hit_object.Matrix.connect_from(self.size_tool.MatrixOut)
context_menu.add_widget(self.size_tool.size_slider)
if hasattr(self.hit_object, "Color"):
self.color_tool.ColorIn.value = self.hit_object.Color.value
self.hit_object.Color.connect_from(self.color_tool.ColorOut)
context_menu.add_widget(self.color_tool.container)
context_menu.add_widgets([self.divider, self.delete_button])
self.DeleteObject.connect_from(self.delete_button.Select)
# show panel
panel_group.show_placed_panel(context_menu, hit_point)
self.ActivePanel.connect_from(panel_group.ActivePanel)
@field_has_changed(ActivePanel)
def active_panel_changed(self):
if self.ActivePanel.value == None:
context_menu.remove_all_widgets()
self.disconnect_all_fields()
self.hit_object.disconnect_all_fields()
@field_has_changed(DeleteObject)
def delete_object_changed(self):
# react on butten release: close panel and delete object
if self.delete_old_state and not self.DeleteObject.value:
scene_root.Children.value.remove(self.hit_object)
self.delete_old_state = False
panel_group.hide_panels()
self.delete_old_state = self.DeleteObject.value
# Define a very simple RGB color tool as a menu container with slider for each color component
class ColorTool(avango.script.Script):
ColorOut = avango.osg.SFVec4()
ColorIn = avango.osg.SFVec4()
R = avango.SFFloat()
G = avango.SFFloat()
B = avango.SFFloat()
def __init__(self):
self.super(ColorTool).__init__()
self.divider = avango.menu.widget.Divider()
# Small, yellow, non-clickable textlabel
# Remember to set the IconFilenames to empty list AND TextOnly to True to have a simple textlabel
self.label = avango.menu.widget.PushButton(Title="RGB Color",
TextSize=0.07,
Enable=False,
IconFilenames=[],
TextOnly=True,
TextDisabledColor=avango.osg.Vec4(1,1,0,1))
# The slider label is hidden if it is set to empty string.
# If your slider icon is description enough, hide the label to save space
self.r_slider = avango.menu.widget.Slider(Min=0.1, Max=1.0,
Title="", IconFilenames=[join(avango.menu.Preferences.datapath,"red.png")])
self.g_slider = avango.menu.widget.Slider(Min=0.1, Max=1.0,
Title="", IconFilenames=[join(avango.menu.Preferences.datapath,"green.png")])
self.b_slider = avango.menu.widget.Slider(Min=0.1, Max=1.0,
Title="", IconFilenames=[join(avango.menu.Preferences.datapath,"blue.png")])
self.container = avango.menu.widget.Container()
self.container.add_widgets([self.divider, self.label, self.r_slider, self.g_slider, self.b_slider])
self.R.connect_from(self.r_slider.Value)
self.G.connect_from(self.g_slider.Value)
self.B.connect_from(self.b_slider.Value)
@field_has_changed(R)
def r_changed(self):
self.ColorOut.value = avango.osg.Vec4(self.R.value,self.ColorOut.value.y,self.ColorOut.value.z,self.ColorIn.value.w)
@field_has_changed(G)
def g_changed(self):
self.ColorOut.value = avango.osg.Vec4(self.ColorOut.value.x,self.G.value,self.ColorOut.value.z,self.ColorIn.value.w)
@field_has_changed(B)
def b_changed(self):
self.ColorOut.value = avango.osg.Vec4(self.ColorOut.value.x,self.ColorOut.value.y,self.B.value,self.ColorIn.value.w)
@field_has_changed(ColorIn)
def color_in_changed(self):
self.r_slider.Value.value = self.ColorIn.value.x
self.g_slider.Value.value = self.ColorIn.value.y
self.b_slider.Value.value = self.ColorIn.value.z
# Define a tool for object resizing, obtaining the actual size and position
class SizeTool(avango.script.Script):
Object = avango.SFObject()
MatrixOut = avango.osg.SFMatrix()
Size = avango.SFFloat()
def __init__(self):
self.super(SizeTool).__init__()
self.size_slider = avango.menu.widget.Slider(Min=0.1, Max=2.5, Title="Transform Size")
self.Size.connect_from(self.size_slider.Value)
@field_has_changed(Object)
def matrix_in_changed(self):
if self.Object.value is not None:
self.size_slider.Value.value = self.Object.value.Matrix.value.get_scale().length()
@field_has_changed(Size)
def size_changed(self):
if self.Object.value is None:
return
original_mat = self.Object.value.Matrix.value
trans_mat = avango.osg.make_trans_mat(original_mat.get_translate())
inv_trans_mat = avango.osg.Matrix()
inv_trans_mat.invert(trans_mat)
old_scale_mat = avango.osg.make_scale_mat(original_mat.get_scale().length())
inv_old_scale_mat = avango.osg.Matrix()
inv_old_scale_mat.invert(old_scale_mat)
new_scale_mat = avango.osg.make_scale_mat(self.Size.value)
self.MatrixOut.value = original_mat * inv_trans_mat * inv_old_scale_mat * new_scale_mat * trans_mat
# create behavior instances
object_behavior = ObjectBehavior()
catch_all_sphere_behavior = CatchAllSphereContextBehavior()
catch_all_sphere.add_and_init_field(avango.script.SFObject(), "MenuToolBehavior", catch_all_sphere_behavior)
# Start application
viewer.run()
| lgpl-3.0 |
geekboxzone/lollipop_external_chromium_org | tools/perf/page_sets/alexa1-10000.py | 34 | 666264 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.page_set import PageSet
from telemetry.page.page import Page
class Alexa1To10000Page(Page):
def __init__(self, url, page_set):
super(Alexa1To10000Page, self).__init__(url=url, page_set=page_set)
self.make_javascript_deterministic = True
def RunSmoothness(self, action_runner):
interaction = action_runner.BeginGestureInteraction(
'ScrollAction', is_smooth=True)
action_runner.ScrollPage()
interaction.End()
class Alexa1To10000PageSet(PageSet):
""" Top 1-10000 Alexa global.
Generated on 2013-09-03 13:59:53.459117 by rmistry using
create_page_set.py.
"""
def __init__(self):
super(Alexa1To10000PageSet, self).__init__(
make_javascript_deterministic=True,
user_agent_type='desktop')
urls_list = [
# Why: #1 in Alexa global
'http://www.facebook.com/',
# Why: #2 in Alexa global
'http://www.google.com/',
# Why: #3 in Alexa global
'http://www.youtube.com/',
# Why: #4 in Alexa global
'http://www.yahoo.com/',
# Why: #5 in Alexa global
'http://baidu.com/',
# Why: #6 in Alexa global
'http://www.amazon.com/',
# Why: #7 in Alexa global
'http://www.wikipedia.org/',
# Why: #8 in Alexa global
'http://www.qq.com/',
# Why: #9 in Alexa global
'http://www.live.com/',
# Why: #10 in Alexa global
'http://www.taobao.com/',
# Why: #11 in Alexa global
'http://www.google.co.in/',
# Why: #12 in Alexa global
'http://www.twitter.com/',
# Why: #13 in Alexa global
'http://www.blogspot.com/',
# Why: #14 in Alexa global
'http://www.linkedin.com/',
# Why: #15 in Alexa global
'http://www.yahoo.co.jp/',
# Why: #16 in Alexa global
'http://www.bing.com/',
# Why: #17 in Alexa global
'http://sina.com.cn/',
# Why: #18 in Alexa global
'http://www.yandex.ru/',
# Why: #19 in Alexa global
'http://www.vk.com/',
# Why: #20 in Alexa global
'http://www.ask.com/',
# Why: #21 in Alexa global
'http://www.ebay.com/',
# Why: #22 in Alexa global
'http://www.wordpress.com/',
# Why: #23 in Alexa global
'http://www.google.de/',
# Why: #24 in Alexa global
'http://www.msn.com/',
# Why: #25 in Alexa global
'http://www.tumblr.com/',
# Why: #26 in Alexa global
'http://163.com/',
# Why: #27 in Alexa global
'http://www.google.com.hk/',
# Why: #28 in Alexa global
'http://www.mail.ru/',
# Why: #29 in Alexa global
'http://www.google.co.uk/',
# Why: #30 in Alexa global
'http://hao123.com/',
# Why: #31 in Alexa global
'http://www.google.com.br/',
# Why: #32 in Alexa global
'http://www.amazon.co.jp/',
# Why: #33 in Alexa global
'http://www.weibo.com/',
# Why: #34 in Alexa global
'http://www.xvideos.com/',
# Why: #35 in Alexa global
'http://www.google.co.jp/',
# Why: #36 in Alexa global
'http://www.microsoft.com/',
# Why: #38 in Alexa global
'http://www.delta-search.com/',
# Why: #39 in Alexa global
'http://www.google.fr/',
# Why: #40 in Alexa global
'http://www.conduit.com/',
# Why: #41 in Alexa global
'http://www.fc2.com/',
# Why: #42 in Alexa global
'http://www.craigslist.org/',
# Why: #43 in Alexa global
'http://www.google.ru/',
# Why: #44 in Alexa global
'http://www.pinterest.com/',
# Why: #45 in Alexa global
'http://www.instagram.com/',
# Why: #46 in Alexa global
'http://www.tmall.com/',
# Why: #47 in Alexa global
'http://www.xhamster.com/',
# Why: #48 in Alexa global
'http://www.odnoklassniki.ru/',
# Why: #49 in Alexa global
'http://www.google.it/',
# Why: #50 in Alexa global
'http://www.sohu.com/',
# Why: #51 in Alexa global
'http://www.paypal.com/',
# Why: #52 in Alexa global
'http://www.babylon.com/',
# Why: #53 in Alexa global
'http://www.google.es/',
# Why: #54 in Alexa global
'http://www.imdb.com/',
# Why: #55 in Alexa global
'http://www.apple.com/',
# Why: #56 in Alexa global
'http://www.amazon.de/',
# Why: #58 in Alexa global
'http://www.bbc.co.uk/',
# Why: #59 in Alexa global
'http://www.adobe.com/',
# Why: #60 in Alexa global
'http://www.soso.com/',
# Why: #61 in Alexa global
'http://www.pornhub.com/',
# Why: #62 in Alexa global
'http://www.google.com.mx/',
# Why: #63 in Alexa global
'http://www.blogger.com/',
# Why: #64 in Alexa global
'http://www.neobux.com/',
# Why: #65 in Alexa global
'http://www.amazon.co.uk/',
# Why: #66 in Alexa global
'http://www.ifeng.com/',
# Why: #67 in Alexa global
'http://www.google.ca/',
# Why: #68 in Alexa global
'http://www.avg.com/',
# Why: #69 in Alexa global
'http://www.go.com/',
# Why: #70 in Alexa global
'http://www.xnxx.com/',
# Why: #71 in Alexa global
'http://www.blogspot.in/',
# Why: #72 in Alexa global
'http://www.alibaba.com/',
# Why: #73 in Alexa global
'http://www.aol.com/',
# Why: #74 in Alexa global
'http://www.buildathome.info/',
# Why: #75 in Alexa global
'http://www.cnn.com/',
# Why: #76 in Alexa global
'http://www.mywebsearch.com/',
# Why: #77 in Alexa global
'http://www.ku6.com/',
# Why: #79 in Alexa global
'http://www.alipay.com/',
# Why: #80 in Alexa global
'http://www.vube.com/',
# Why: #81 in Alexa global
'http://www.google.com.tr/',
# Why: #82 in Alexa global
'http://www.youku.com/',
# Why: #83 in Alexa global
'http://www.redtube.com/',
# Why: #84 in Alexa global
'http://www.dailymotion.com/',
# Why: #85 in Alexa global
'http://www.google.com.au/',
# Why: #86 in Alexa global
'http://www.adf.ly/',
# Why: #87 in Alexa global
'http://www.netflix.com/',
# Why: #88 in Alexa global
'http://www.adcash.com/',
# Why: #89 in Alexa global
'http://www.about.com/',
# Why: #90 in Alexa global
'http://www.google.pl/',
# Why: #91 in Alexa global
'http://www.imgur.com/',
# Why: #92 in Alexa global
'http://www.ebay.de/',
# Why: #93 in Alexa global
'http://www.amazon.fr/',
# Why: #94 in Alexa global
'http://www.flickr.com/',
# Why: #95 in Alexa global
'http://www.thepiratebay.sx/',
# Why: #96 in Alexa global
'http://www.youporn.com/',
# Why: #97 in Alexa global
'http://www.uol.com.br/',
# Why: #98 in Alexa global
'http://www.huffingtonpost.com/',
# Why: #99 in Alexa global
'http://www.stackoverflow.com/',
# Why: #100 in Alexa global
'http://www.jd.com/',
# Why: #101 in Alexa global
'http://t.co/',
# Why: #102 in Alexa global
'http://www.rakuten.co.jp/',
# Why: #103 in Alexa global
'http://www.livejasmin.com/',
# Why: #105 in Alexa global
'http://www.ebay.co.uk/',
# Why: #106 in Alexa global
'http://www.yieldmanager.com/',
# Why: #107 in Alexa global
'http://www.sogou.com/',
# Why: #108 in Alexa global
'http://www.globo.com/',
# Why: #109 in Alexa global
'http://www.softonic.com/',
# Why: #110 in Alexa global
'http://www.cnet.com/',
# Why: #111 in Alexa global
'http://www.livedoor.com/',
# Why: #112 in Alexa global
'http://www.nicovideo.jp/',
# Why: #113 in Alexa global
'http://www.directrev.com/',
# Why: #114 in Alexa global
'http://www.espn.go.com/',
# Why: #115 in Alexa global
'http://www.ameblo.jp/',
# Why: #116 in Alexa global
'http://www.indiatimes.com/',
# Why: #117 in Alexa global
'http://www.wordpress.org/',
# Why: #118 in Alexa global
'http://www.weather.com/',
# Why: #119 in Alexa global
'http://www.pixnet.net/',
# Why: #120 in Alexa global
'http://www.google.com.sa/',
# Why: #122 in Alexa global
'http://www.clkmon.com/',
# Why: #123 in Alexa global
'http://www.reddit.com/',
# Why: #124 in Alexa global
'http://www.amazon.it/',
# Why: #125 in Alexa global
'http://www.google.com.eg/',
# Why: #126 in Alexa global
'http://www.booking.com/',
# Why: #127 in Alexa global
'http://www.google.nl/',
# Why: #128 in Alexa global
'http://www.douban.com/',
# Why: #129 in Alexa global
'http://www.amazon.cn/',
# Why: #130 in Alexa global
'http://www.slideshare.net/',
# Why: #131 in Alexa global
'http://www.google.com.ar/',
# Why: #132 in Alexa global
'http://www.badoo.com/',
# Why: #133 in Alexa global
'http://www.dailymail.co.uk/',
# Why: #134 in Alexa global
'http://www.google.co.th/',
# Why: #135 in Alexa global
'http://www.ask.fm/',
# Why: #136 in Alexa global
'http://www.wikia.com/',
# Why: #137 in Alexa global
'http://www.godaddy.com/',
# Why: #138 in Alexa global
'http://www.google.com.tw/',
# Why: #139 in Alexa global
'http://www.xinhuanet.com/',
# Why: #140 in Alexa global
'http://www.mediafire.com/',
# Why: #141 in Alexa global
'http://www.deviantart.com/',
# Why: #142 in Alexa global
'http://www.google.com.pk/',
# Why: #143 in Alexa global
'http://www.bankofamerica.com/',
# Why: #144 in Alexa global
'http://www.amazon.es/',
# Why: #145 in Alexa global
'http://www.blogfa.com/',
# Why: #146 in Alexa global
'http://www.nytimes.com/',
# Why: #147 in Alexa global
'http://www.4shared.com/',
# Why: #148 in Alexa global
'http://www.google.co.id/',
# Why: #149 in Alexa global
'http://www.youjizz.com/',
# Why: #150 in Alexa global
'http://www.amazonaws.com/',
# Why: #151 in Alexa global
'http://www.tube8.com/',
# Why: #152 in Alexa global
'http://www.kickass.to/',
# Why: #154 in Alexa global
'http://www.livejournal.com/',
# Why: #155 in Alexa global
'http://www.snapdo.com/',
# Why: #156 in Alexa global
'http://www.google.co.za/',
# Why: #158 in Alexa global
'http://www.vimeo.com/',
# Why: #160 in Alexa global
'http://www.wigetmedia.com/',
# Why: #161 in Alexa global
'http://www.yelp.com/',
# Why: #162 in Alexa global
'http://www.outbrain.com/',
# Why: #163 in Alexa global
'http://www.dropbox.com/',
# Why: #164 in Alexa global
'http://www.siteadvisor.com/',
# Why: #165 in Alexa global
'http://www.foxnews.com/',
# Why: #166 in Alexa global
'http://www.renren.com/',
# Why: #167 in Alexa global
'http://www.aliexpress.com/',
# Why: #168 in Alexa global
'http://www.walmart.com/',
# Why: #169 in Alexa global
'http://www.skype.com/',
# Why: #170 in Alexa global
'http://www.ilivid.com/',
# Why: #171 in Alexa global
'http://www.bizcoaching.info/',
# Why: #172 in Alexa global
'http://www.google.cn/',
# Why: #173 in Alexa global
'http://www.wikimedia.org/',
# Why: #174 in Alexa global
'http://people.com.cn/',
# Why: #175 in Alexa global
'http://www.flipkart.com/',
# Why: #176 in Alexa global
'http://www.zedo.com/',
# Why: #177 in Alexa global
'http://tianya.cn/',
# Why: #178 in Alexa global
'http://www.searchnu.com/',
# Why: #179 in Alexa global
'http://www.indeed.com/',
# Why: #180 in Alexa global
'http://www.leboncoin.fr/',
# Why: #181 in Alexa global
'http://www.goo.ne.jp/',
# Why: #182 in Alexa global
'http://www.liveinternet.ru/',
# Why: #183 in Alexa global
'http://www.google.co.ve/',
# Why: #184 in Alexa global
'http://www.56.com/',
# Why: #185 in Alexa global
'http://www.google.com.vn/',
# Why: #186 in Alexa global
'http://www.google.gr/',
# Why: #187 in Alexa global
'http://www.comcast.net/',
# Why: #188 in Alexa global
'http://www.torrentz.eu/',
# Why: #189 in Alexa global
'http://www.etsy.com/',
# Why: #190 in Alexa global
'http://www.orange.fr/',
# Why: #191 in Alexa global
'http://www.systweak.com/',
# Why: #192 in Alexa global
'http://www.onet.pl/',
# Why: #193 in Alexa global
'http://www.wellsfargo.com/',
# Why: #194 in Alexa global
'http://pconline.com.cn/',
# Why: #195 in Alexa global
'http://www.letv.com/',
# Why: #196 in Alexa global
'http://www.goodgamestudios.com/',
# Why: #197 in Alexa global
'http://www.secureserver.net/',
# Why: #198 in Alexa global
'http://www.allegro.pl/',
# Why: #199 in Alexa global
'http://www.themeforest.net/',
# Why: #200 in Alexa global
'http://www.china.com.cn/',
# Why: #201 in Alexa global
'http://www.tripadvisor.com/',
# Why: #202 in Alexa global
'http://www.web.de/',
# Why: #203 in Alexa global
'http://www.answers.com/',
# Why: #204 in Alexa global
'http://www.amazon.ca/',
# Why: #205 in Alexa global
'http://www.mozilla.org/',
# Why: #206 in Alexa global
'http://www.guardian.co.uk/',
# Why: #207 in Alexa global
'http://www.stumbleupon.com/',
# Why: #208 in Alexa global
'http://www.hardsextube.com/',
# Why: #209 in Alexa global
'http://www.espncricinfo.com/',
# Why: #210 in Alexa global
'http://www.gmx.net/',
# Why: #211 in Alexa global
'http://www.photobucket.com/',
# Why: #212 in Alexa global
'http://www.ehow.com/',
# Why: #213 in Alexa global
'http://www.rediff.com/',
# Why: #214 in Alexa global
'http://www.popads.net/',
# Why: #215 in Alexa global
'http://www.wikihow.com/',
# Why: #216 in Alexa global
'http://www.search-results.com/',
# Why: #217 in Alexa global
'http://www.fiverr.com/',
# Why: #218 in Alexa global
'http://www.google.com.ua/',
# Why: #219 in Alexa global
'http://www.files.wordpress.com/',
# Why: #220 in Alexa global
'http://www.onlineaway.net/',
# Why: #221 in Alexa global
'http://www.nbcnews.com/',
# Why: #222 in Alexa global
'http://www.google.com.co/',
# Why: #223 in Alexa global
'http://www.hootsuite.com/',
# Why: #224 in Alexa global
'http://www.4dsply.com/',
# Why: #225 in Alexa global
'http://www.google.ro/',
# Why: #227 in Alexa global
'http://www.sourceforge.net/',
# Why: #228 in Alexa global
'http://www.cnzz.com/',
# Why: #229 in Alexa global
'http://www.java.com/',
# Why: #230 in Alexa global
'http://www.hudong.com/',
# Why: #231 in Alexa global
'http://www.ucoz.ru/',
# Why: #232 in Alexa global
'http://www.tudou.com/',
# Why: #233 in Alexa global
'http://www.addthis.com/',
# Why: #234 in Alexa global
'http://zol.com.cn/',
# Why: #235 in Alexa global
'http://www.google.com.ng/',
# Why: #236 in Alexa global
'http://www.soundcloud.com/',
# Why: #237 in Alexa global
'http://www.onclickads.net/',
# Why: #238 in Alexa global
'http://www.google.com.ph/',
# Why: #239 in Alexa global
'http://www.dmm.co.jp/',
# Why: #240 in Alexa global
'http://www.reference.com/',
# Why: #241 in Alexa global
'http://www.google.be/',
# Why: #242 in Alexa global
'http://www.wp.pl/',
# Why: #243 in Alexa global
'http://www.interbiz.me/',
# Why: #244 in Alexa global
'http://www.beeg.com/',
# Why: #245 in Alexa global
'http://www.rambler.ru/',
# Why: #246 in Alexa global
'http://www.sweetim.com/',
# Why: #247 in Alexa global
'http://www.aweber.com/',
# Why: #248 in Alexa global
'http://www.google.com.my/',
# Why: #249 in Alexa global
'http://www.pandora.com/',
# Why: #250 in Alexa global
'http://www.w3schools.com/',
# Why: #251 in Alexa global
'http://www.pengyou.com/',
# Why: #252 in Alexa global
'http://www.archive.org/',
# Why: #253 in Alexa global
'http://www.qvo6.com/',
# Why: #254 in Alexa global
'http://www.bet365.com/',
# Why: #255 in Alexa global
'http://www.etao.com/',
# Why: #256 in Alexa global
'http://www.lollipop-network.com/',
# Why: #257 in Alexa global
'http://www.qtrax.com/',
# Why: #258 in Alexa global
'http://www.naver.jp/',
# Why: #259 in Alexa global
'http://www.google.se/',
# Why: #260 in Alexa global
'http://www.google.dz/',
# Why: #261 in Alexa global
'http://www.usatoday.com/',
# Why: #262 in Alexa global
'http://www.zillow.com/',
# Why: #263 in Alexa global
'http://www.goal.com/',
# Why: #264 in Alexa global
'http://www.avito.ru/',
# Why: #265 in Alexa global
'http://kaixin001.com/',
# Why: #266 in Alexa global
'http://yesky.com/',
# Why: #267 in Alexa global
'http://www.mobile01.com/',
# Why: #268 in Alexa global
'http://www.soufun.com/',
# Why: #269 in Alexa global
'http://www.tagged.com/',
# Why: #270 in Alexa global
'http://www.warriorforum.com/',
# Why: #271 in Alexa global
'http://www.statcounter.com/',
# Why: #272 in Alexa global
'http://www.google.com.pe/',
# Why: #273 in Alexa global
'http://www.libero.it/',
# Why: #274 in Alexa global
'http://www.thefreedictionary.com/',
# Why: #275 in Alexa global
'http://www.soku.com/',
# Why: #276 in Alexa global
'http://www.incredibar.com/',
# Why: #277 in Alexa global
'http://www.kaskus.co.id/',
# Why: #278 in Alexa global
'http://www.likes.com/',
# Why: #279 in Alexa global
'http://www.weebly.com/',
# Why: #280 in Alexa global
'http://iqiyi.com/',
# Why: #281 in Alexa global
'http://www.pch.com/',
# Why: #282 in Alexa global
'http://www.ameba.jp/',
# Why: #284 in Alexa global
'http://www.samsung.com/',
# Why: #285 in Alexa global
'http://www.linkbucks.com/',
# Why: #286 in Alexa global
'http://www.uploaded.net/',
# Why: #287 in Alexa global
'http://www.bild.de/',
# Why: #288 in Alexa global
'http://www.google.com.bd/',
# Why: #289 in Alexa global
'http://www.google.at/',
# Why: #290 in Alexa global
'http://www.webcrawler.com/',
# Why: #291 in Alexa global
'http://www.t-online.de/',
# Why: #292 in Alexa global
'http://www.iminent.com/',
# Why: #293 in Alexa global
'http://www.google.pt/',
# Why: #294 in Alexa global
'http://www.detik.com/',
# Why: #295 in Alexa global
'http://www.ganji.com/',
# Why: #296 in Alexa global
'http://www.milliyet.com.tr/',
# Why: #297 in Alexa global
'http://www.bleacherreport.com/',
# Why: #298 in Alexa global
'http://www.forbes.com/',
# Why: #299 in Alexa global
'http://www.twoo.com/',
# Why: #300 in Alexa global
'http://www.olx.in/',
# Why: #301 in Alexa global
'http://www.mercadolivre.com.br/',
# Why: #302 in Alexa global
'http://www.hurriyet.com.tr/',
# Why: #303 in Alexa global
'http://www.pof.com/',
# Why: #304 in Alexa global
'http://www.wsj.com/',
# Why: #305 in Alexa global
'http://www.hostgator.com/',
# Why: #306 in Alexa global
'http://www.naver.com/',
# Why: #307 in Alexa global
'http://www.putlocker.com/',
# Why: #308 in Alexa global
'http://www.varzesh3.com/',
# Why: #309 in Alexa global
'http://www.rutracker.org/',
# Why: #311 in Alexa global
'http://www.optmd.com/',
# Why: #312 in Alexa global
'http://www.youm7.com/',
# Why: #313 in Alexa global
'http://www.google.cl/',
# Why: #314 in Alexa global
'http://www.ikea.com/',
# Why: #316 in Alexa global
'http://www.4399.com/',
# Why: #317 in Alexa global
'http://www.salesforce.com/',
# Why: #318 in Alexa global
'http://www.scribd.com/',
# Why: #319 in Alexa global
'http://www.google.com.sg/',
# Why: #320 in Alexa global
'http://it168.com/',
# Why: #321 in Alexa global
'http://www.goodreads.com/',
# Why: #322 in Alexa global
'http://www.target.com/',
# Why: #323 in Alexa global
'http://www.xunlei.com/',
# Why: #324 in Alexa global
'http://www.hulu.com/',
# Why: #325 in Alexa global
'http://www.github.com/',
# Why: #326 in Alexa global
'http://www.hp.com/',
# Why: #327 in Alexa global
'http://www.buzzfeed.com/',
# Why: #328 in Alexa global
'http://www.google.ch/',
# Why: #329 in Alexa global
'http://www.youdao.com/',
# Why: #330 in Alexa global
'http://www.blogspot.com.es/',
# Why: #331 in Alexa global
'http://so.com/',
# Why: #332 in Alexa global
'http://www.ups.com/',
# Why: #333 in Alexa global
'http://www.google.co.kr/',
# Why: #334 in Alexa global
'http://www.extratorrent.com/',
# Why: #335 in Alexa global
'http://www.match.com/',
# Why: #336 in Alexa global
'http://www.seznam.cz/',
# Why: #337 in Alexa global
'http://autohome.com.cn/',
# Why: #338 in Alexa global
'http://www.naukri.com/',
# Why: #339 in Alexa global
'http://www.gmw.cn/',
# Why: #340 in Alexa global
'http://www.drtuber.com/',
# Why: #341 in Alexa global
'http://www.spiegel.de/',
# Why: #342 in Alexa global
'http://www.marca.com/',
# Why: #343 in Alexa global
'http://www.ign.com/',
# Why: #344 in Alexa global
'http://www.domaintools.com/',
# Why: #345 in Alexa global
'http://www.free.fr/',
# Why: #346 in Alexa global
'http://www.telegraph.co.uk/',
# Why: #347 in Alexa global
'http://www.mypcbackup.com/',
# Why: #348 in Alexa global
'http://www.kakaku.com/',
# Why: #349 in Alexa global
'http://www.imageshack.us/',
# Why: #350 in Alexa global
'http://www.reuters.com/',
# Why: #351 in Alexa global
'http://www.ndtv.com/',
# Why: #352 in Alexa global
'http://www.ig.com.br/',
# Why: #353 in Alexa global
'http://www.bestbuy.com/',
# Why: #354 in Alexa global
'http://www.glispa.com/',
# Why: #355 in Alexa global
'http://www.quikr.com/',
# Why: #356 in Alexa global
'http://www.deadlyblessing.com/',
# Why: #357 in Alexa global
'http://www.wix.com/',
# Why: #358 in Alexa global
'http://xcar.com.cn/',
# Why: #359 in Alexa global
'http://paipai.com/',
# Why: #360 in Alexa global
'http://www.ebay.com.au/',
# Why: #361 in Alexa global
'http://www.yandex.ua/',
# Why: #362 in Alexa global
'http://chinanews.com/',
# Why: #363 in Alexa global
'http://www.clixsense.com/',
# Why: #364 in Alexa global
'http://nih.gov/',
# Why: #365 in Alexa global
'http://www.aili.com/',
# Why: #366 in Alexa global
'http://www.zing.vn/',
# Why: #367 in Alexa global
'http://pchome.net/',
# Why: #369 in Alexa global
'http://www.webmd.com/',
# Why: #370 in Alexa global
'http://www.terra.com.br/',
# Why: #371 in Alexa global
'http://pixiv.net/',
# Why: #372 in Alexa global
'http://www.in.com/',
# Why: #373 in Alexa global
'http://csdn.net/',
# Why: #374 in Alexa global
'http://www.pcpop.com/',
# Why: #375 in Alexa global
'http://www.google.co.hu/',
# Why: #376 in Alexa global
'http://www.lnksr.com/',
# Why: #377 in Alexa global
'http://www.jobrapido.com/',
# Why: #378 in Alexa global
'http://inbox.com/',
# Why: #379 in Alexa global
'http://dianping.com/',
# Why: #380 in Alexa global
'http://www.gsmarena.com/',
# Why: #381 in Alexa global
'http://www.mlb.com/',
# Why: #382 in Alexa global
'http://www.clicksor.com/',
# Why: #383 in Alexa global
'http://www.hdfcbank.com/',
# Why: #384 in Alexa global
'http://www.acesse.com/',
# Why: #385 in Alexa global
'http://www.homedepot.com/',
# Why: #386 in Alexa global
'http://www.twitch.tv/',
# Why: #387 in Alexa global
'http://www.morefreecamsecrets.com/',
# Why: #388 in Alexa global
'http://www.groupon.com/',
# Why: #389 in Alexa global
'http://www.lnksdata.com/',
# Why: #390 in Alexa global
'http://enet.com.cn/',
# Why: #391 in Alexa global
'http://www.google.cz/',
# Why: #392 in Alexa global
'http://www.usps.com/',
# Why: #393 in Alexa global
'http://xyxy.net/',
# Why: #394 in Alexa global
'http://www.att.com/',
# Why: #395 in Alexa global
'http://webs.com/',
# Why: #396 in Alexa global
'http://51job.com/',
# Why: #397 in Alexa global
'http://www.mashable.com/',
# Why: #398 in Alexa global
'http://www.yihaodian.com/',
# Why: #399 in Alexa global
'http://taringa.net/',
# Why: #400 in Alexa global
'http://www.fedex.com/',
# Why: #401 in Alexa global
'http://blogspot.co.uk/',
# Why: #402 in Alexa global
'http://www.ck101.com/',
# Why: #403 in Alexa global
'http://www.abcnews.go.com/',
# Why: #404 in Alexa global
'http://www.washingtonpost.com/',
# Why: #405 in Alexa global
'http://www.narod.ru/',
# Why: #406 in Alexa global
'http://www.china.com/',
# Why: #407 in Alexa global
'http://www.doubleclick.com/',
# Why: #409 in Alexa global
'http://www.cam4.com/',
# Why: #410 in Alexa global
'http://www.google.ie/',
# Why: #411 in Alexa global
'http://dangdang.com/',
# Why: #412 in Alexa global
'http://americanexpress.com/',
# Why: #413 in Alexa global
'http://www.disqus.com/',
# Why: #414 in Alexa global
'http://www.ixxx.com/',
# Why: #415 in Alexa global
'http://39.net/',
# Why: #416 in Alexa global
'http://www.isohunt.com/',
# Why: #417 in Alexa global
'http://php.net/',
# Why: #418 in Alexa global
'http://www.exoclick.com/',
# Why: #419 in Alexa global
'http://www.shutterstock.com/',
# Why: #420 in Alexa global
'http://www.dell.com/',
# Why: #421 in Alexa global
'http://www.google.ae/',
# Why: #422 in Alexa global
'http://histats.com/',
# Why: #423 in Alexa global
'http://www.outlook.com/',
# Why: #424 in Alexa global
'http://www.wordreference.com/',
# Why: #425 in Alexa global
'http://sahibinden.com/',
# Why: #426 in Alexa global
'http://www.126.com/',
# Why: #427 in Alexa global
'http://oyodomo.com/',
# Why: #428 in Alexa global
'http://www.gazeta.pl/',
# Why: #429 in Alexa global
'http://www.expedia.com/',
# Why: #430 in Alexa global
'http://cntv.cn/',
# Why: #431 in Alexa global
'http://www.kijiji.ca/',
# Why: #432 in Alexa global
'http://www.myfreecams.com/',
# Why: #433 in Alexa global
'http://rednet.cn/',
# Why: #434 in Alexa global
'http://www.capitalone.com/',
# Why: #435 in Alexa global
'http://moz.com/',
# Why: #436 in Alexa global
'http://qunar.com/',
# Why: #437 in Alexa global
'http://www.taleo.net/',
# Why: #438 in Alexa global
'http://www.google.co.il/',
# Why: #439 in Alexa global
'http://www.microsoftonline.com/',
# Why: #440 in Alexa global
'http://datasrvrs.com/',
# Why: #441 in Alexa global
'http://www.zippyshare.com/',
# Why: #442 in Alexa global
'http://google.no/',
# Why: #444 in Alexa global
'http://justdial.com/',
# Why: #445 in Alexa global
'http://www.2345.com/',
# Why: #446 in Alexa global
'http://adultfriendfinder.com/',
# Why: #447 in Alexa global
'http://www.shaadi.com/',
# Why: #448 in Alexa global
'http://www.mobile.de/',
# Why: #449 in Alexa global
'http://abril.com.br/',
# Why: #450 in Alexa global
'http://empowernetwork.com/',
# Why: #451 in Alexa global
'http://www.icicibank.com/',
# Why: #452 in Alexa global
'http://xe.com/',
# Why: #454 in Alexa global
'http://www.mailchimp.com/',
# Why: #455 in Alexa global
'http://fbcdn.net/',
# Why: #456 in Alexa global
'http://www.ccb.com/',
# Why: #457 in Alexa global
'http://huanqiu.com/',
# Why: #458 in Alexa global
'http://www.seesaa.net/',
# Why: #459 in Alexa global
'http://jimdo.com/',
# Why: #460 in Alexa global
'http://fucked-tube.com/',
# Why: #461 in Alexa global
'http://google.dk/',
# Why: #462 in Alexa global
'http://www.yellowpages.com/',
# Why: #463 in Alexa global
'http://www.constantcontact.com/',
# Why: #464 in Alexa global
'http://www.tinyurl.com/',
# Why: #465 in Alexa global
'http://mysearchresults.com/',
# Why: #466 in Alexa global
'http://www.friv.com/',
# Why: #467 in Alexa global
'http://www.ebay.it/',
# Why: #468 in Alexa global
'http://www.aizhan.com/',
# Why: #469 in Alexa global
'http://accuweather.com/',
# Why: #470 in Alexa global
'http://www.51buy.com/',
# Why: #472 in Alexa global
'http://www.snapdeal.com/',
# Why: #473 in Alexa global
'http://google.az/',
# Why: #474 in Alexa global
'http://pogo.com/',
# Why: #475 in Alexa global
'http://www.adultadworld.com/',
# Why: #476 in Alexa global
'http://www.nifty.com/',
# Why: #477 in Alexa global
'http://bitauto.com/',
# Why: #478 in Alexa global
'http://drudgereport.com/',
# Why: #479 in Alexa global
'http://www.bloomberg.com/',
# Why: #480 in Alexa global
'http://www.vnexpress.net/',
# Why: #481 in Alexa global
'http://eastmoney.com/',
# Why: #482 in Alexa global
'http://www.verizonwireless.com/',
# Why: #483 in Alexa global
'http://pcauto.com.cn/',
# Why: #485 in Alexa global
'http://www.onlinesbi.com/',
# Why: #486 in Alexa global
'http://www.2ch.net/',
# Why: #487 in Alexa global
'http://speedtest.net/',
# Why: #488 in Alexa global
'http://www.largeporntube.com/',
# Why: #489 in Alexa global
'http://www.stackexchange.com/',
# Why: #490 in Alexa global
'http://roblox.com/',
# Why: #492 in Alexa global
'http://pclady.com.cn/',
# Why: #493 in Alexa global
'http://miniclip.com/',
# Why: #495 in Alexa global
'http://www.tmz.com/',
# Why: #496 in Alexa global
'http://google.fi/',
# Why: #497 in Alexa global
'http://ning.com/',
# Why: #498 in Alexa global
'http://monster.com/',
# Why: #499 in Alexa global
'http://www.jrj.com.cn/',
# Why: #500 in Alexa global
'http://www.mihanblog.com/',
# Why: #501 in Alexa global
'http://www.biglobe.ne.jp/',
# Why: #502 in Alexa global
'http://steampowered.com/',
# Why: #503 in Alexa global
'http://www.nuvid.com/',
# Why: #504 in Alexa global
'http://kooora.com/',
# Why: #505 in Alexa global
'http://ebay.in/',
# Why: #506 in Alexa global
'http://mp3skull.com/',
# Why: #507 in Alexa global
'http://www.icbc.com.cn/',
# Why: #508 in Alexa global
'http://blogspot.ru/',
# Why: #509 in Alexa global
'http://duowan.com/',
# Why: #510 in Alexa global
'http://www.blogspot.de/',
# Why: #511 in Alexa global
'http://www.fhserve.com/',
# Why: #512 in Alexa global
'http://moneycontrol.com/',
# Why: #513 in Alexa global
'http://pornerbros.com/',
# Why: #514 in Alexa global
'http://eazel.com/',
# Why: #515 in Alexa global
'http://xgo.com.cn/',
# Why: #516 in Alexa global
'http://daum.net/',
# Why: #517 in Alexa global
'http://www.10086.cn/',
# Why: #518 in Alexa global
'http://lady8844.com/',
# Why: #519 in Alexa global
'http://www.rapidgator.net/',
# Why: #520 in Alexa global
'http://thesun.co.uk/',
# Why: #521 in Alexa global
'http://youtube-mp3.org/',
# Why: #522 in Alexa global
'http://www.v9.com/',
# Why: #523 in Alexa global
'http://www.disney.go.com/',
# Why: #524 in Alexa global
'http://www.homeway.com.cn/',
# Why: #525 in Alexa global
'http://porntube.com/',
# Why: #526 in Alexa global
'http://www.surveymonkey.com/',
# Why: #527 in Alexa global
'http://www.meetup.com/',
# Why: #528 in Alexa global
'http://www.ero-advertising.com/',
# Why: #529 in Alexa global
'http://www.bravotube.net/',
# Why: #530 in Alexa global
'http://appround.biz/',
# Why: #531 in Alexa global
'http://blogspot.it/',
# Why: #532 in Alexa global
'http://ctrip.com/',
# Why: #533 in Alexa global
'http://www.9gag.com/',
# Why: #534 in Alexa global
'http://www.odesk.com/',
# Why: #535 in Alexa global
'http://www.kinopoisk.ru/',
# Why: #536 in Alexa global
'http://www.trulia.com/',
# Why: #537 in Alexa global
'http://www.mercadolibre.com.ar/',
# Why: #538 in Alexa global
'http://www.repubblica.it/',
# Why: #539 in Alexa global
'http://hupu.com/',
# Why: #540 in Alexa global
'http://www.imesh.com/',
# Why: #541 in Alexa global
'http://searchfunmoods.com/',
# Why: #542 in Alexa global
'http://www.backpage.com/',
# Why: #543 in Alexa global
'http://latimes.com/',
# Why: #544 in Alexa global
'http://www.news.com.au/',
# Why: #545 in Alexa global
'http://www.gc.ca/',
# Why: #546 in Alexa global
'http://ce.cn/',
# Why: #547 in Alexa global
'http://www.hubpages.com/',
# Why: #548 in Alexa global
'http://www.clickbank.com/',
# Why: #549 in Alexa global
'http://www.mapquest.com/',
# Why: #550 in Alexa global
'http://www.sweetpacks.com/',
# Why: #551 in Alexa global
'http://www.hypergames.net/',
# Why: #552 in Alexa global
'http://alimama.com/',
# Why: #553 in Alexa global
'http://www.cnblogs.com/',
# Why: #554 in Alexa global
'http://www.vancl.com/',
# Why: #555 in Alexa global
'http://www.bitly.com/',
# Why: #556 in Alexa global
'http://www.tokobagus.com/',
# Why: #557 in Alexa global
'http://www.webmoney.ru/',
# Why: #558 in Alexa global
'http://www.google.sk/',
# Why: #559 in Alexa global
'http://www.shopathome.com/',
# Why: #560 in Alexa global
'http://elpais.com/',
# Why: #561 in Alexa global
'http://www.oneindia.in/',
# Why: #562 in Alexa global
'http://www.codecanyon.net/',
# Why: #563 in Alexa global
'http://www.businessinsider.com/',
# Why: #564 in Alexa global
'http://www.blackhatworld.com/',
# Why: #565 in Alexa global
'http://www.farsnews.com/',
# Why: #566 in Alexa global
'http://www.spankwire.com/',
# Why: #567 in Alexa global
'http://www.mynet.com/',
# Why: #568 in Alexa global
'http://www.sape.ru/',
# Why: #569 in Alexa global
'http://www.bhaskar.com/',
# Why: #570 in Alexa global
'http://www.lenta.ru/',
# Why: #571 in Alexa global
'http://www.gutefrage.net/',
# Why: #572 in Alexa global
'http://www.nba.com/',
# Why: #573 in Alexa global
'http://www.feedly.com/',
# Why: #574 in Alexa global
'http://www.chaturbate.com/',
# Why: #575 in Alexa global
'http://elmundo.es/',
# Why: #576 in Alexa global
'http://www.ad6media.fr/',
# Why: #577 in Alexa global
'http://www.sberbank.ru/',
# Why: #578 in Alexa global
'http://www.lockyourhome.com/',
# Why: #579 in Alexa global
'http://kinox.to/',
# Why: #580 in Alexa global
'http://www.subito.it/',
# Why: #581 in Alexa global
'http://www.rbc.ru/',
# Why: #582 in Alexa global
'http://sfr.fr/',
# Why: #584 in Alexa global
'http://www.skyrock.com/',
# Why: #585 in Alexa global
'http://priceline.com/',
# Why: #586 in Alexa global
'http://www.jabong.com/',
# Why: #587 in Alexa global
'http://www.y8.com/',
# Why: #588 in Alexa global
'http://www.wunderground.com/',
# Why: #589 in Alexa global
'http://mixi.jp/',
# Why: #590 in Alexa global
'http://www.habrahabr.ru/',
# Why: #591 in Alexa global
'http://www.softpedia.com/',
# Why: #592 in Alexa global
'http://www.ancestry.com/',
# Why: #593 in Alexa global
'http://bluehost.com/',
# Why: #594 in Alexa global
'http://www.123rf.com/',
# Why: #595 in Alexa global
'http://lowes.com/',
# Why: #596 in Alexa global
'http://www.free-tv-video-online.me/',
# Why: #597 in Alexa global
'http://tabelog.com/',
# Why: #598 in Alexa global
'http://www.vehnix.com/',
# Why: #599 in Alexa global
'http://55bbs.com/',
# Why: #600 in Alexa global
'http://www.swagbucks.com/',
# Why: #601 in Alexa global
'http://www.speedanalysis.net/',
# Why: #603 in Alexa global
'http://www.virgilio.it/',
# Why: #604 in Alexa global
'http://www.peyvandha.ir/',
# Why: #605 in Alexa global
'http://www.infusionsoft.com/',
# Why: #606 in Alexa global
'http://newegg.com/',
# Why: #608 in Alexa global
'http://www.sulekha.com/',
# Why: #609 in Alexa global
'http://myspace.com/',
# Why: #610 in Alexa global
'http://yxlady.com/',
# Why: #611 in Alexa global
'http://www.haber7.com/',
# Why: #612 in Alexa global
'http://www.w3.org/',
# Why: #613 in Alexa global
'http://squidoo.com/',
# Why: #614 in Alexa global
'http://www.hotels.com/',
# Why: #615 in Alexa global
'http://oracle.com/',
# Why: #616 in Alexa global
'http://fatakat.com/',
# Why: #617 in Alexa global
'http://www.joomla.org/',
# Why: #618 in Alexa global
'http://qidian.com/',
# Why: #619 in Alexa global
'http://hatena.ne.jp/',
# Why: #620 in Alexa global
'http://adbooth.net/',
# Why: #621 in Alexa global
'http://wretch.cc/',
# Why: #622 in Alexa global
'http://www.freelancer.com/',
# Why: #623 in Alexa global
'http://www.typepad.com/',
# Why: #624 in Alexa global
'http://foxsports.com/',
# Why: #625 in Alexa global
'http://www.allrecipes.com/',
# Why: #626 in Alexa global
'http://www.searchengines.ru/',
# Why: #628 in Alexa global
'http://babytree.com/',
# Why: #629 in Alexa global
'http://interia.pl/',
# Why: #630 in Alexa global
'http://xhamstercams.com/',
# Why: #632 in Alexa global
'http://www.verizon.com/',
# Why: #633 in Alexa global
'http://intoday.in/',
# Why: #634 in Alexa global
'http://sears.com/',
# Why: #635 in Alexa global
'http://www.okcupid.com/',
# Why: #636 in Alexa global
'http://6.cn/',
# Why: #637 in Alexa global
'http://kompas.com/',
# Why: #638 in Alexa global
'http://cj.com/',
# Why: #639 in Alexa global
'http://www.4tube.com/',
# Why: #640 in Alexa global
'http://www.chip.de/',
# Why: #641 in Alexa global
'http://force.com/',
# Why: #643 in Alexa global
'http://www.advertserve.com/',
# Why: #644 in Alexa global
'http://maktoob.com/',
# Why: #645 in Alexa global
'http://www.24h.com.vn/',
# Why: #646 in Alexa global
'http://foursquare.com/',
# Why: #647 in Alexa global
'http://cbsnews.com/',
# Why: #648 in Alexa global
'http://pornhublive.com/',
# Why: #649 in Alexa global
'http://www.xda-developers.com/',
# Why: #651 in Alexa global
'http://www.milanuncios.com/',
# Why: #652 in Alexa global
'http://retailmenot.com/',
# Why: #653 in Alexa global
'http://www.keezmovies.com/',
# Why: #654 in Alexa global
'http://nydailynews.com/',
# Why: #655 in Alexa global
'http://h2porn.com/',
# Why: #656 in Alexa global
'http://www.careerbuilder.com/',
# Why: #657 in Alexa global
'http://xing.com/',
# Why: #658 in Alexa global
'http://www.sakura.ne.jp/',
# Why: #659 in Alexa global
'http://citibank.com/',
# Why: #660 in Alexa global
'http://www.linkwithin.com/',
# Why: #661 in Alexa global
'http://www.blogspot.jp/',
# Why: #662 in Alexa global
'http://singlessalad.com/',
# Why: #663 in Alexa global
'http://www.altervista.org/',
# Why: #664 in Alexa global
'http://www.turbobit.net/',
# Why: #665 in Alexa global
'http://www.zoosk.com/',
# Why: #666 in Alexa global
'http://www.digg.com/',
# Why: #667 in Alexa global
'http://hespress.com/',
# Why: #668 in Alexa global
'http://bigpoint.com/',
# Why: #669 in Alexa global
'http://www.yourlust.com/',
# Why: #670 in Alexa global
'http://www.myntra.com/',
# Why: #671 in Alexa global
'http://issuu.com/',
# Why: #672 in Alexa global
'http://macys.com/',
# Why: #673 in Alexa global
'http://google.bg/',
# Why: #674 in Alexa global
'http://github.io/',
# Why: #675 in Alexa global
'http://filestube.com/',
# Why: #677 in Alexa global
'http://cmbchina.com/',
# Why: #678 in Alexa global
'http://irctc.co.in/',
# Why: #679 in Alexa global
'http://filehippo.com/',
# Why: #680 in Alexa global
'http://mop.com/',
# Why: #681 in Alexa global
'http://bodybuilding.com/',
# Why: #682 in Alexa global
'http://www.paidui.com/',
# Why: #683 in Alexa global
'http://zimbio.com/',
# Why: #684 in Alexa global
'http://www.panet.co.il/',
# Why: #685 in Alexa global
'http://www.mgid.com/',
# Why: #686 in Alexa global
'http://www.ya.ru/',
# Why: #687 in Alexa global
'http://probux.com/',
# Why: #688 in Alexa global
'http://haberturk.com/',
# Why: #689 in Alexa global
'http://persianblog.ir/',
# Why: #690 in Alexa global
'http://meituan.com/',
# Why: #691 in Alexa global
'http://www.mercadolibre.com.mx/',
# Why: #692 in Alexa global
'http://ppstream.com/',
# Why: #693 in Alexa global
'http://www.atwiki.jp/',
# Why: #694 in Alexa global
'http://sunporno.com/',
# Why: #695 in Alexa global
'http://vodly.to/',
# Why: #696 in Alexa global
'http://forgeofempires.com/',
# Why: #697 in Alexa global
'http://elance.com/',
# Why: #698 in Alexa global
'http://adscale.de/',
# Why: #699 in Alexa global
'http://vipshop.com/',
# Why: #700 in Alexa global
'http://babycenter.com/',
# Why: #701 in Alexa global
'http://istockphoto.com/',
# Why: #702 in Alexa global
'http://www.commentcamarche.net/',
# Why: #704 in Alexa global
'http://upworthy.com/',
# Why: #705 in Alexa global
'http://www.download.com/',
# Why: #706 in Alexa global
'http://www.so-net.ne.jp/',
# Why: #707 in Alexa global
'http://battle.net/',
# Why: #708 in Alexa global
'http://beva.com/',
# Why: #709 in Alexa global
'http://list-manage.com/',
# Why: #710 in Alexa global
'http://www.corriere.it/',
# Why: #711 in Alexa global
'http://noticias24.com/',
# Why: #712 in Alexa global
'http://www.ucoz.com/',
# Why: #713 in Alexa global
'http://www.porn.com/',
# Why: #714 in Alexa global
'http://www.google.lk/',
# Why: #715 in Alexa global
'http://www.lifehacker.com/',
# Why: #716 in Alexa global
'http://www.today.com/',
# Why: #717 in Alexa global
'http://chinabyte.com/',
# Why: #718 in Alexa global
'http://southwest.com/',
# Why: #719 in Alexa global
'http://www.ca.gov/',
# Why: #720 in Alexa global
'http://nudevista.com/',
# Why: #721 in Alexa global
'http://www.yandex.com.tr/',
# Why: #722 in Alexa global
'http://people.com/',
# Why: #723 in Alexa global
'http://www.docin.com/',
# Why: #724 in Alexa global
'http://www.norton.com/',
# Why: #725 in Alexa global
'http://perfectgirls.net/',
# Why: #726 in Alexa global
'http://www.engadget.com/',
# Why: #727 in Alexa global
'http://www.realtor.com/',
# Why: #728 in Alexa global
'http://www.techcrunch.com/',
# Why: #729 in Alexa global
'http://www.time.com/',
# Why: #730 in Alexa global
'http://indianrail.gov.in/',
# Why: #731 in Alexa global
'http://www.dtiblog.com/',
# Why: #732 in Alexa global
'http://www.way2sms.com/',
# Why: #733 in Alexa global
'http://foodnetwork.com/',
# Why: #735 in Alexa global
'http://subscene.com/',
# Why: #736 in Alexa global
'http://www.worldstarhiphop.com/',
# Why: #737 in Alexa global
'http://tabnak.ir/',
# Why: #738 in Alexa global
'http://weather.com.cn/',
# Why: #739 in Alexa global
'http://aeriagames.com/',
# Why: #741 in Alexa global
'http://leagueoflegends.com/',
# Why: #742 in Alexa global
'http://51.la/',
# Why: #743 in Alexa global
'http://www.facenama.com/',
# Why: #744 in Alexa global
'http://189.cn/',
# Why: #745 in Alexa global
'http://sapo.pt/',
# Why: #746 in Alexa global
'http://www.bitshare.com/',
# Why: #748 in Alexa global
'http://gamespot.com/',
# Why: #749 in Alexa global
'http://cy-pr.com/',
# Why: #750 in Alexa global
'http://kankan.com/',
# Why: #751 in Alexa global
'http://google.co.nz/',
# Why: #752 in Alexa global
'http://www.liveleak.com/',
# Why: #753 in Alexa global
'http://video-one.com/',
# Why: #754 in Alexa global
'http://marktplaats.nl/',
# Why: #755 in Alexa global
'http://elwatannews.com/',
# Why: #756 in Alexa global
'http://www.roulettebotplus.com/',
# Why: #757 in Alexa global
'http://www.adserverplus.com/',
# Why: #758 in Alexa global
'http://www.akhbarak.net/',
# Why: #759 in Alexa global
'http://gumtree.com/',
# Why: #760 in Alexa global
'http://weheartit.com/',
# Why: #761 in Alexa global
'http://www.openadserving.com/',
# Why: #762 in Alexa global
'http://sporx.com/',
# Why: #763 in Alexa global
'http://www.focus.cn/',
# Why: #764 in Alexa global
'http://www.mercadolibre.com.ve/',
# Why: #765 in Alexa global
'http://www.zendesk.com/',
# Why: #766 in Alexa global
'http://www.houzz.com/',
# Why: #767 in Alexa global
'http://asos.com/',
# Why: #768 in Alexa global
'http://www.letitbit.net/',
# Why: #769 in Alexa global
'http://www.geocities.jp/',
# Why: #770 in Alexa global
'http://www.ocn.ne.jp/',
# Why: #771 in Alexa global
'http://quora.com/',
# Why: #772 in Alexa global
'http://www.yandex.kz/',
# Why: #773 in Alexa global
'http://www.mcafee.com/',
# Why: #774 in Alexa global
'http://www.ensonhaber.com/',
# Why: #775 in Alexa global
'http://www.gamefaqs.com/',
# Why: #776 in Alexa global
'http://vk.me/',
# Why: #777 in Alexa global
'http://avast.com/',
# Why: #778 in Alexa global
'http://website-unavailable.com/',
# Why: #779 in Alexa global
'http://www.22find.com/',
# Why: #780 in Alexa global
'http://www.admagnet.net/',
# Why: #781 in Alexa global
'http://rottentomatoes.com/',
# Why: #782 in Alexa global
'http://google.com.kw/',
# Why: #783 in Alexa global
'http://www.cloob.com/',
# Why: #784 in Alexa global
'http://www.nokia.com/',
# Why: #785 in Alexa global
'http://wetter.com/',
# Why: #786 in Alexa global
'http://www.taboola.com/',
# Why: #787 in Alexa global
'http://www.tenpay.com/',
# Why: #788 in Alexa global
'http://www.888.com/',
# Why: #789 in Alexa global
'http://flipora.com/',
# Why: #790 in Alexa global
'http://www.adhitprofits.com/',
# Why: #791 in Alexa global
'http://www.timeanddate.com/',
# Why: #792 in Alexa global
'http://www.as.com/',
# Why: #793 in Alexa global
'http://www.fanpop.com/',
# Why: #794 in Alexa global
'http://informer.com/',
# Why: #795 in Alexa global
'http://www.blogimg.jp/',
# Why: #796 in Alexa global
'http://exblog.jp/',
# Why: #797 in Alexa global
'http://www.over-blog.com/',
# Why: #798 in Alexa global
'http://www.itau.com.br/',
# Why: #799 in Alexa global
'http://balagana.net/',
# Why: #800 in Alexa global
'http://www.ellechina.com/',
# Why: #801 in Alexa global
'http://avazutracking.net/',
# Why: #802 in Alexa global
'http://www.gap.com/',
# Why: #803 in Alexa global
'http://www.examiner.com/',
# Why: #804 in Alexa global
'http://www.vporn.com/',
# Why: #805 in Alexa global
'http://lenovo.com/',
# Why: #806 in Alexa global
'http://www.eonline.com/',
# Why: #807 in Alexa global
'http://r7.com/',
# Why: #808 in Alexa global
'http://majesticseo.com/',
# Why: #809 in Alexa global
'http://immobilienscout24.de/',
# Why: #810 in Alexa global
'http://www.google.kz/',
# Why: #811 in Alexa global
'http://goo.gl/',
# Why: #812 in Alexa global
'http://zwaar.net/',
# Why: #814 in Alexa global
'http://www.bankmellat.ir/',
# Why: #815 in Alexa global
'http://alphaporno.com/',
# Why: #816 in Alexa global
'http://whitepages.com/',
# Why: #817 in Alexa global
'http://viva.co.id/',
# Why: #818 in Alexa global
'http://www.rutor.org/',
# Why: #819 in Alexa global
'http://wiktionary.org/',
# Why: #820 in Alexa global
'http://intuit.com/',
# Why: #821 in Alexa global
'http://www.gismeteo.ru/',
# Why: #822 in Alexa global
'http://dantri.com.vn/',
# Why: #823 in Alexa global
'http://www.xbox.com/',
# Why: #824 in Alexa global
'http://www.myegy.com/',
# Why: #825 in Alexa global
'http://www.xtube.com/',
# Why: #826 in Alexa global
'http://masrawy.com/',
# Why: #827 in Alexa global
'http://www.urbandictionary.com/',
# Why: #828 in Alexa global
'http://agoda.com/',
# Why: #829 in Alexa global
'http://www.ebay.fr/',
# Why: #830 in Alexa global
'http://www.kickstarter.com/',
# Why: #831 in Alexa global
'http://www.6park.com/',
# Why: #832 in Alexa global
'http://www.metacafe.com/',
# Why: #833 in Alexa global
'http://www.yamahaonlinestore.com/',
# Why: #834 in Alexa global
'http://www.anysex.com/',
# Why: #835 in Alexa global
'http://www.azlyrics.com/',
# Why: #836 in Alexa global
'http://www.rt.com/',
# Why: #837 in Alexa global
'http://www.ibm.com/',
# Why: #838 in Alexa global
'http://www.nordstrom.com/',
# Why: #839 in Alexa global
'http://ezinearticles.com/',
# Why: #840 in Alexa global
'http://www.cnbc.com/',
# Why: #841 in Alexa global
'http://redtubelive.com/',
# Why: #842 in Alexa global
'http://clicksvenue.com/',
# Why: #843 in Alexa global
'http://www.tradus.com/',
# Why: #844 in Alexa global
'http://www.gamer.com.tw/',
# Why: #846 in Alexa global
'http://www.m2newmedia.com/',
# Why: #848 in Alexa global
'http://www.custhelp.com/',
# Why: #849 in Alexa global
'http://www.4chan.org/',
# Why: #850 in Alexa global
'http://www.kioskea.net/',
# Why: #851 in Alexa global
'http://yoka.com/',
# Why: #852 in Alexa global
'http://www.7k7k.com/',
# Why: #853 in Alexa global
'http://www.opensiteexplorer.org/',
# Why: #854 in Alexa global
'http://www.musica.com/',
# Why: #855 in Alexa global
'http://www.coupons.com/',
# Why: #856 in Alexa global
'http://cracked.com/',
# Why: #857 in Alexa global
'http://www.caixa.gov.br/',
# Why: #858 in Alexa global
'http://www.skysports.com/',
# Why: #859 in Alexa global
'http://www.kizi.com/',
# Why: #860 in Alexa global
'http://www.getresponse.com/',
# Why: #861 in Alexa global
'http://www.sky.com/',
# Why: #862 in Alexa global
'http://www.marketwatch.com/',
# Why: #863 in Alexa global
'http://www.google.com.ec/',
# Why: #864 in Alexa global
'http://www.cbslocal.com/',
# Why: #865 in Alexa global
'http://www.zhihu.com/',
# Why: #866 in Alexa global
'http://www.888poker.com/',
# Why: #867 in Alexa global
'http://www.digitalpoint.com/',
# Why: #868 in Alexa global
'http://www.blog.163.com/',
# Why: #869 in Alexa global
'http://www.rantsports.com/',
# Why: #870 in Alexa global
'http://videosexarchive.com/',
# Why: #871 in Alexa global
'http://www.who.is/',
# Why: #875 in Alexa global
'http://www.gogetlinks.net/',
# Why: #876 in Alexa global
'http://www.idnes.cz/',
# Why: #877 in Alexa global
'http://www.king.com/',
# Why: #878 in Alexa global
'http://www.say-move.org/',
# Why: #879 in Alexa global
'http://www.motherless.com/',
# Why: #880 in Alexa global
'http://www.npr.org/',
# Why: #881 in Alexa global
'http://www.legacy.com/',
# Why: #882 in Alexa global
'http://www.aljazeera.net/',
# Why: #883 in Alexa global
'http://barnesandnoble.com/',
# Why: #884 in Alexa global
'http://www.overstock.com/',
# Why: #885 in Alexa global
'http://www.drom.ru/',
# Why: #886 in Alexa global
'http://www.weather.gov/',
# Why: #887 in Alexa global
'http://gstatic.com/',
# Why: #888 in Alexa global
'http://www.amung.us/',
# Why: #889 in Alexa global
'http://www.traidnt.net/',
# Why: #890 in Alexa global
'http://www.ovh.net/',
# Why: #891 in Alexa global
'http://www.rtl.de/',
# Why: #892 in Alexa global
'http://howstuffworks.com/',
# Why: #893 in Alexa global
'http://digikala.com/',
# Why: #894 in Alexa global
'http://www.bannersbroker.com/',
# Why: #895 in Alexa global
'http://www.kohls.com/',
# Why: #896 in Alexa global
'http://www.google.com.do/',
# Why: #897 in Alexa global
'http://www.dealfish.co.th/',
# Why: #899 in Alexa global
'http://19lou.com/',
# Why: #900 in Alexa global
'http://www.okwave.jp/',
# Why: #901 in Alexa global
'http://www.ezpowerads.com/',
# Why: #902 in Alexa global
'http://www.lemonde.fr/',
# Why: #904 in Alexa global
'http://www.chexun.com/',
# Why: #905 in Alexa global
'http://folha.uol.com.br/',
# Why: #906 in Alexa global
'http://www.imagebam.com/',
# Why: #907 in Alexa global
'http://viooz.co/',
# Why: #908 in Alexa global
'http://www.prothom-alo.com/',
# Why: #909 in Alexa global
'http://360doc.com/',
# Why: #910 in Alexa global
'http://m-w.com/',
# Why: #912 in Alexa global
'http://fanfiction.net/',
# Why: #914 in Alexa global
'http://semrush.com/',
# Why: #915 in Alexa global
'http://www.mama.cn/',
# Why: #916 in Alexa global
'http://ci123.com/',
# Why: #917 in Alexa global
'http://www.plugrush.com/',
# Why: #918 in Alexa global
'http://www.cafemom.com/',
# Why: #919 in Alexa global
'http://mangareader.net/',
# Why: #920 in Alexa global
'http://haizhangs.com/',
# Why: #921 in Alexa global
'http://cdiscount.com/',
# Why: #922 in Alexa global
'http://zappos.com/',
# Why: #923 in Alexa global
'http://www.manta.com/',
# Why: #924 in Alexa global
'http://www.novinky.cz/',
# Why: #925 in Alexa global
'http://www.hi5.com/',
# Why: #926 in Alexa global
'http://www.blogspot.kr/',
# Why: #927 in Alexa global
'http://www.pr-cy.ru/',
# Why: #928 in Alexa global
'http://movie4k.to/',
# Why: #929 in Alexa global
'http://www.patch.com/',
# Why: #930 in Alexa global
'http://alarabiya.net/',
# Why: #931 in Alexa global
'http://indiamart.com/',
# Why: #932 in Alexa global
'http://www.nhk.or.jp/',
# Why: #933 in Alexa global
'http://cartrailor.com/',
# Why: #934 in Alexa global
'http://almasryalyoum.com/',
# Why: #935 in Alexa global
'http://315che.com/',
# Why: #936 in Alexa global
'http://www.google.by/',
# Why: #937 in Alexa global
'http://tomshardware.com/',
# Why: #938 in Alexa global
'http://minecraft.net/',
# Why: #939 in Alexa global
'http://www.gulfup.com/',
# Why: #940 in Alexa global
'http://www.rr.com/',
# Why: #942 in Alexa global
'http://www.spotify.com/',
# Why: #943 in Alexa global
'http://www.airtel.in/',
# Why: #944 in Alexa global
'http://www.espnfc.com/',
# Why: #945 in Alexa global
'http://sanook.com/',
# Why: #946 in Alexa global
'http://ria.ru/',
# Why: #947 in Alexa global
'http://google.com.qa/',
# Why: #948 in Alexa global
'http://jquery.com/',
# Why: #950 in Alexa global
'http://pinshan.com/',
# Why: #951 in Alexa global
'http://onlylady.com/',
# Why: #952 in Alexa global
'http://www.pornoxo.com/',
# Why: #953 in Alexa global
'http://cookpad.com/',
# Why: #954 in Alexa global
'http://www.pagesjaunes.fr/',
# Why: #955 in Alexa global
'http://www.usmagazine.com/',
# Why: #956 in Alexa global
'http://www.google.lt/',
# Why: #957 in Alexa global
'http://www.nu.nl/',
# Why: #958 in Alexa global
'http://www.hm.com/',
# Why: #959 in Alexa global
'http://fixya.com/',
# Why: #960 in Alexa global
'http://theblaze.com/',
# Why: #961 in Alexa global
'http://cbssports.com/',
# Why: #962 in Alexa global
'http://www.eyny.com/',
# Why: #963 in Alexa global
'http://17173.com/',
# Why: #964 in Alexa global
'http://www.excite.co.jp/',
# Why: #965 in Alexa global
'http://hc360.com/',
# Why: #966 in Alexa global
'http://www.cbs.com/',
# Why: #967 in Alexa global
'http://www.telegraaf.nl/',
# Why: #968 in Alexa global
'http://netlog.com/',
# Why: #969 in Alexa global
'http://voc.com.cn/',
# Why: #970 in Alexa global
'http://slickdeals.net/',
# Why: #971 in Alexa global
'http://www.ldblog.jp/',
# Why: #972 in Alexa global
'http://ruten.com.tw/',
# Why: #973 in Alexa global
'http://yobt.com/',
# Why: #974 in Alexa global
'http://certified-toolbar.com/',
# Why: #975 in Alexa global
'http://miercn.com/',
# Why: #976 in Alexa global
'http://aparat.com/',
# Why: #977 in Alexa global
'http://billdesk.com/',
# Why: #978 in Alexa global
'http://yandex.by/',
# Why: #979 in Alexa global
'http://888casino.com/',
# Why: #980 in Alexa global
'http://twitpic.com/',
# Why: #981 in Alexa global
'http://google.hr/',
# Why: #982 in Alexa global
'http://tubegalore.com/',
# Why: #983 in Alexa global
'http://dhgate.com/',
# Why: #984 in Alexa global
'http://makemytrip.com/',
# Why: #986 in Alexa global
'http://shop.com/',
# Why: #987 in Alexa global
'http://www.nike.com/',
# Why: #988 in Alexa global
'http://kayak.com/',
# Why: #989 in Alexa global
'http://pcbaby.com.cn/',
# Why: #990 in Alexa global
'http://fandango.com/',
# Why: #991 in Alexa global
'http://tutsplus.com/',
# Why: #992 in Alexa global
'http://gotomeeting.com/',
# Why: #994 in Alexa global
'http://shareasale.com/',
# Why: #995 in Alexa global
'http://www.boc.cn/',
# Why: #996 in Alexa global
'http://mpnrs.com/',
# Why: #997 in Alexa global
'http://keepvid.com/',
# Why: #998 in Alexa global
'http://www.lequipe.fr/',
# Why: #999 in Alexa global
'http://namecheap.com/',
# Why: #1000 in Alexa global
'http://doublepimp.com/',
# Why: #1001 in Alexa global
'http://softigloo.com/',
# Why: #1002 in Alexa global
'http://givemesport.com/',
# Why: #1003 in Alexa global
'http://mtime.com/',
# Why: #1004 in Alexa global
'http://letras.mus.br/',
# Why: #1005 in Alexa global
'http://pole-emploi.fr/',
# Why: #1006 in Alexa global
'http://biblegateway.com/',
# Why: #1007 in Alexa global
'http://independent.co.uk/',
# Why: #1009 in Alexa global
'http://e-hentai.org/',
# Why: #1010 in Alexa global
'http://www.gumtree.com.au/',
# Why: #1011 in Alexa global
'http://livestrong.com/',
# Why: #1012 in Alexa global
'http://game321.com/',
# Why: #1014 in Alexa global
'http://www.comcast.com/',
# Why: #1015 in Alexa global
'http://clubpenguin.com/',
# Why: #1016 in Alexa global
'http://rightmove.co.uk/',
# Why: #1017 in Alexa global
'http://steamcommunity.com/',
# Why: #1018 in Alexa global
'http://sockshare.com/',
# Why: #1019 in Alexa global
'http://globalconsumersurvey.com/',
# Why: #1020 in Alexa global
'http://rapidshare.com/',
# Why: #1021 in Alexa global
'http://auto.ru/',
# Why: #1022 in Alexa global
'http://www.staples.com/',
# Why: #1023 in Alexa global
'http://anitube.se/',
# Why: #1024 in Alexa global
'http://rozblog.com/',
# Why: #1025 in Alexa global
'http://reliancenetconnect.co.in/',
# Why: #1026 in Alexa global
'http://credit-agricole.fr/',
# Why: #1027 in Alexa global
'http://exposedwebcams.com/',
# Why: #1028 in Alexa global
'http://www.webalta.ru/',
# Why: #1029 in Alexa global
'http://www.usbank.com/',
# Why: #1030 in Alexa global
'http://www.google.com.ly/',
# Why: #1031 in Alexa global
'http://www.pantip.com/',
# Why: #1032 in Alexa global
'http://aftonbladet.se/',
# Why: #1033 in Alexa global
'http://scoop.it/',
# Why: #1034 in Alexa global
'http://www.mayoclinic.com/',
# Why: #1035 in Alexa global
'http://www.evernote.com/',
# Why: #1036 in Alexa global
'http://www.nyaa.eu/',
# Why: #1037 in Alexa global
'http://www.livingsocial.com/',
# Why: #1038 in Alexa global
'http://www.noaa.gov/',
# Why: #1039 in Alexa global
'http://www.imagefap.com/',
# Why: #1040 in Alexa global
'http://www.abchina.com/',
# Why: #1041 in Alexa global
'http://www.google.rs/',
# Why: #1042 in Alexa global
'http://www.amazon.in/',
# Why: #1043 in Alexa global
'http://www.tnaflix.com/',
# Why: #1044 in Alexa global
'http://www.xici.net/',
# Why: #1045 in Alexa global
'http://www.united.com/',
# Why: #1046 in Alexa global
'http://www.templatemonster.com/',
# Why: #1047 in Alexa global
'http://www.deezer.com/',
# Why: #1048 in Alexa global
'http://www.pixlr.com/',
# Why: #1049 in Alexa global
'http://www.tradedoubler.com/',
# Why: #1050 in Alexa global
'http://www.gumtree.co.za/',
# Why: #1051 in Alexa global
'http://www.r10.net/',
# Why: #1052 in Alexa global
'http://www.kongregate.com/',
# Why: #1053 in Alexa global
'http://www.jeuxvideo.com/',
# Why: #1054 in Alexa global
'http://www.gawker.com/',
# Why: #1055 in Alexa global
'http://chewen.com/',
# Why: #1056 in Alexa global
'http://www.r2games.com/',
# Why: #1057 in Alexa global
'http://www.mayajo.com/',
# Why: #1058 in Alexa global
'http://www.topix.com/',
# Why: #1059 in Alexa global
'http://www.easyhits4u.com/',
# Why: #1060 in Alexa global
'http://www.netteller.com/',
# Why: #1061 in Alexa global
'http://www.ing.nl/',
# Why: #1062 in Alexa global
'http://www.tripadvisor.co.uk/',
# Why: #1063 in Alexa global
'http://www.udn.com/',
# Why: #1064 in Alexa global
'http://www.cheezburger.com/',
# Why: #1065 in Alexa global
'http://www.fotostrana.ru/',
# Why: #1066 in Alexa global
'http://www.bbc.com/',
# Why: #1067 in Alexa global
'http://www.behance.net/',
# Why: #1068 in Alexa global
'http://www.lefigaro.fr/',
# Why: #1069 in Alexa global
'http://www.nikkei.com/',
# Why: #1070 in Alexa global
'http://www.fidelity.com/',
# Why: #1071 in Alexa global
'http://www.baomihua.com/',
# Why: #1072 in Alexa global
'http://www.fool.com/',
# Why: #1073 in Alexa global
'http://www.nairaland.com/',
# Why: #1074 in Alexa global
'http://www.sendspace.com/',
# Why: #1075 in Alexa global
'http://www.woot.com/',
# Why: #1076 in Alexa global
'http://www.travelocity.com/',
# Why: #1077 in Alexa global
'http://www.shopclues.com/',
# Why: #1078 in Alexa global
'http://www.sureonlinefind.com/',
# Why: #1080 in Alexa global
'http://www.gizmodo.com/',
# Why: #1081 in Alexa global
'http://www.hidemyass.com/',
# Why: #1082 in Alexa global
'http://www.o2.pl/',
# Why: #1083 in Alexa global
'http://www.clickbank.net/',
# Why: #1084 in Alexa global
'http://www.fotolia.com/',
# Why: #1085 in Alexa global
'http://www.opera.com/',
# Why: #1086 in Alexa global
'http://www.sabah.com.tr/',
# Why: #1087 in Alexa global
'http://www.n-mobile.net/',
# Why: #1088 in Alexa global
'http://www.chacha.com/',
# Why: #1089 in Alexa global
'http://www.autotrader.com/',
# Why: #1090 in Alexa global
'http://www.anonym.to/',
# Why: #1091 in Alexa global
'http://www.walmart.com.br/',
# Why: #1092 in Alexa global
'http://www.yjc.ir/',
# Why: #1093 in Alexa global
'http://www.autoscout24.de/',
# Why: #1094 in Alexa global
'http://www.gobookee.net/',
# Why: #1096 in Alexa global
'http://www.yaolan.com/',
# Why: #1097 in Alexa global
'http://www.india.com/',
# Why: #1098 in Alexa global
'http://www.tribalfusion.com/',
# Why: #1099 in Alexa global
'http://www.gittigidiyor.com/',
# Why: #1100 in Alexa global
'http://www.otto.de/',
# Why: #1101 in Alexa global
'http://www.adclickxpress.com/',
# Why: #1102 in Alexa global
'http://www.made-in-china.com/',
# Why: #1103 in Alexa global
'http://www.ahram.org.eg/',
# Why: #1104 in Alexa global
'http://www.asriran.com/',
# Why: #1105 in Alexa global
'http://www.blackberry.com/',
# Why: #1106 in Alexa global
'http://www.beytoote.com/',
# Why: #1107 in Alexa global
'http://www.piriform.com/',
# Why: #1108 in Alexa global
'http://www.ilmeteo.it/',
# Why: #1109 in Alexa global
'http://www.att.net/',
# Why: #1110 in Alexa global
'http://www.brainyquote.com/',
# Why: #1111 in Alexa global
'http://www.last.fm/',
# Why: #1112 in Alexa global
'http://www.directadvert.ru/',
# Why: #1113 in Alexa global
'http://www.slate.com/',
# Why: #1114 in Alexa global
'http://www.mangahere.com/',
# Why: #1115 in Alexa global
'http://www.jalan.net/',
# Why: #1116 in Alexa global
'http://www.blog.com/',
# Why: #1117 in Alexa global
'http://www.tuvaro.com/',
# Why: #1118 in Alexa global
'http://www.doc88.com/',
# Why: #1119 in Alexa global
'http://www.mbc.net/',
# Why: #1120 in Alexa global
'http://www.europa.eu/',
# Why: #1121 in Alexa global
'http://www.onlinedown.net/',
# Why: #1122 in Alexa global
'http://www.jcpenney.com/',
# Why: #1123 in Alexa global
'http://www.myplaycity.com/',
# Why: #1124 in Alexa global
'http://www.bahn.de/',
# Why: #1125 in Alexa global
'http://www.laredoute.fr/',
# Why: #1126 in Alexa global
'http://www.alexa.com/',
# Why: #1127 in Alexa global
'http://www.rakuten.ne.jp/',
# Why: #1128 in Alexa global
'http://www.flashx.tv/',
# Why: #1129 in Alexa global
'http://51.com/',
# Why: #1130 in Alexa global
'http://www.mail.com/',
# Why: #1131 in Alexa global
'http://www.costco.com/',
# Why: #1132 in Alexa global
'http://www.mirror.co.uk/',
# Why: #1133 in Alexa global
'http://www.chinadaily.com.cn/',
# Why: #1134 in Alexa global
'http://www.japanpost.jp/',
# Why: #1135 in Alexa global
'http://www.hubspot.com/',
# Why: #1136 in Alexa global
'http://www.tf1.fr/',
# Why: #1137 in Alexa global
'http://www.merdeka.com/',
# Why: #1138 in Alexa global
'http://www.nypost.com/',
# Why: #1139 in Alexa global
'http://www.1mall.com/',
# Why: #1140 in Alexa global
'http://www.wmtransfer.com/',
# Why: #1141 in Alexa global
'http://www.pcmag.com/',
# Why: #1142 in Alexa global
'http://www.univision.com/',
# Why: #1143 in Alexa global
'http://www.nationalgeographic.com/',
# Why: #1144 in Alexa global
'http://www.sourtimes.org/',
# Why: #1145 in Alexa global
'http://www.iciba.com/',
# Why: #1146 in Alexa global
'http://www.petardas.com/',
# Why: #1147 in Alexa global
'http://www.wmmail.ru/',
# Why: #1148 in Alexa global
'http://www.light-dark.net/',
# Why: #1149 in Alexa global
'http://www.ultimate-guitar.com/',
# Why: #1150 in Alexa global
'http://www.koramgame.com/',
# Why: #1151 in Alexa global
'http://www.megavod.fr/',
# Why: #1152 in Alexa global
'http://www.smh.com.au/',
# Why: #1153 in Alexa global
'http://www.ticketmaster.com/',
# Why: #1154 in Alexa global
'http://www.admin5.com/',
# Why: #1155 in Alexa global
'http://get-a-fuck-tonight.com/',
# Why: #1156 in Alexa global
'http://www.eenadu.net/',
# Why: #1157 in Alexa global
'http://www.argos.co.uk/',
# Why: #1159 in Alexa global
'http://www.nipic.com/',
# Why: #1160 in Alexa global
'http://www.google.iq/',
# Why: #1161 in Alexa global
'http://www.alhea.com/',
# Why: #1162 in Alexa global
'http://www.citrixonline.com/',
# Why: #1163 in Alexa global
'http://www.girlsgogames.com/',
# Why: #1164 in Alexa global
'http://www.fanatik.com.tr/',
# Why: #1165 in Alexa global
'http://www.yahoo-mbga.jp/',
# Why: #1166 in Alexa global
'http://www.google.tn/',
# Why: #1167 in Alexa global
'http://www.usaa.com/',
# Why: #1168 in Alexa global
'http://www.earthlink.net/',
# Why: #1169 in Alexa global
'http://www.ryanair.com/',
# Why: #1170 in Alexa global
'http://www.city-data.com/',
# Why: #1171 in Alexa global
'http://www.lloydstsb.co.uk/',
# Why: #1173 in Alexa global
'http://www.pornsharia.com/',
# Why: #1174 in Alexa global
'http://www.blogspot.tw/',
# Why: #1175 in Alexa global
'http://www.baixing.com/',
# Why: #1176 in Alexa global
'http://www.all-free-download.com/',
# Why: #1177 in Alexa global
'http://www.qianyan001.com/',
# Why: #1178 in Alexa global
'http://www.hellporno.com/',
# Why: #1179 in Alexa global
'http://www.pornmd.com/',
# Why: #1180 in Alexa global
'http://www.conferenceplus.com/',
# Why: #1181 in Alexa global
'http://www.docstoc.com/',
# Why: #1182 in Alexa global
'http://www.christian-dogma.com/',
# Why: #1183 in Alexa global
'http://www.sinaimg.cn/',
# Why: #1184 in Alexa global
'http://www.dmoz.org/',
# Why: #1185 in Alexa global
'http://www.perezhilton.com/',
# Why: #1186 in Alexa global
'http://www.mega.co.nz/',
# Why: #1187 in Alexa global
'http://www.pchome.com.tw/',
# Why: #1188 in Alexa global
'http://www.zazzle.com/',
# Why: #1189 in Alexa global
'http://www.echoroukonline.com/',
# Why: #1190 in Alexa global
'http://www.ea.com/',
# Why: #1191 in Alexa global
'http://www.yiqifa.com/',
# Why: #1193 in Alexa global
'http://www.mysearchdial.com/',
# Why: #1194 in Alexa global
'http://www.hotwire.com/',
# Why: #1195 in Alexa global
'http://www.ninemsn.com.au/',
# Why: #1196 in Alexa global
'http://www.tablica.pl/',
# Why: #1197 in Alexa global
'http://www.brazzers.com/',
# Why: #1198 in Alexa global
'http://www.americanas.com.br/',
# Why: #1199 in Alexa global
'http://www.extremetube.com/',
# Why: #1200 in Alexa global
'http://www.zynga.com/',
# Why: #1201 in Alexa global
'http://www.buscape.com.br/',
# Why: #1202 in Alexa global
'http://www.t-mobile.com/',
# Why: #1204 in Alexa global
'http://www.portaldosites.com/',
# Why: #1205 in Alexa global
'http://www.businessweek.com/',
# Why: #1206 in Alexa global
'http://www.feedburner.com/',
# Why: #1207 in Alexa global
'http://www.contenko.com/',
# Why: #1208 in Alexa global
'http://www.homeshop18.com/',
# Why: #1209 in Alexa global
'http://www.bmi.ir/',
# Why: #1210 in Alexa global
'http://www.wwe.com/',
# Why: #1211 in Alexa global
'http://www.adult-empire.com/',
# Why: #1212 in Alexa global
'http://www.nfl.com/',
# Why: #1213 in Alexa global
'http://www.globososo.com/',
# Why: #1214 in Alexa global
'http://www.sfgate.com/',
# Why: #1215 in Alexa global
'http://www.mmotraffic.com/',
# Why: #1216 in Alexa global
'http://www.zalando.de/',
# Why: #1217 in Alexa global
'http://www.warthunder.com/',
# Why: #1218 in Alexa global
'http://www.icloud.com/',
# Why: #1219 in Alexa global
'http://www.xiami.com/',
# Why: #1220 in Alexa global
'http://www.newsmax.com/',
# Why: #1221 in Alexa global
'http://www.solarmovie.so/',
# Why: #1222 in Alexa global
'http://www.junglee.com/',
# Why: #1223 in Alexa global
'http://www.discovercard.com/',
# Why: #1224 in Alexa global
'http://www.hh.ru/',
# Why: #1225 in Alexa global
'http://www.searchengineland.com/',
# Why: #1226 in Alexa global
'http://www.labanquepostale.fr/',
# Why: #1227 in Alexa global
'http://www.51cto.com/',
# Why: #1228 in Alexa global
'http://www.appledaily.com.tw/',
# Why: #1229 in Alexa global
'http://www.fling.com/',
# Why: #1230 in Alexa global
'http://www.liveperson.net/',
# Why: #1231 in Alexa global
'http://www.sulit.com.ph/',
# Why: #1232 in Alexa global
'http://www.tinypic.com/',
# Why: #1233 in Alexa global
'http://www.meilishuo.com/',
# Why: #1234 in Alexa global
'http://googleadservices.com/',
# Why: #1235 in Alexa global
'http://www.boston.com/',
# Why: #1236 in Alexa global
'http://www.chron.com/',
# Why: #1237 in Alexa global
'http://www.breitbart.com/',
# Why: #1238 in Alexa global
'http://www.youjizzlive.com/',
# Why: #1239 in Alexa global
'http://www.commbank.com.au/',
# Why: #1240 in Alexa global
'http://www.axisbank.com/',
# Why: #1241 in Alexa global
'http://www.wired.com/',
# Why: #1242 in Alexa global
'http://www.trialpay.com/',
# Why: #1243 in Alexa global
'http://www.berniaga.com/',
# Why: #1244 in Alexa global
'http://cnmo.com/',
# Why: #1245 in Alexa global
'http://www.tunein.com/',
# Why: #1246 in Alexa global
'http://www.hotfile.com/',
# Why: #1247 in Alexa global
'http://www.dubizzle.com/',
# Why: #1248 in Alexa global
'http://www.olx.com.br/',
# Why: #1249 in Alexa global
'http://haxiu.com/',
# Why: #1250 in Alexa global
'http://www.zulily.com/',
# Why: #1251 in Alexa global
'http://www.infolinks.com/',
# Why: #1252 in Alexa global
'http://www.yourgirlfriends.com/',
# Why: #1253 in Alexa global
'http://www.logmein.com/',
# Why: #1255 in Alexa global
'http://www.irs.gov/',
# Why: #1256 in Alexa global
'http://www.noticiadeldia.com/',
# Why: #1257 in Alexa global
'http://www.nbcsports.com/',
# Why: #1258 in Alexa global
'http://www.holasearch.com/',
# Why: #1259 in Alexa global
'http://www.wo.com.cn/',
# Why: #1260 in Alexa global
'http://www.indianexpress.com/',
# Why: #1261 in Alexa global
'http://www.depositfiles.com/',
# Why: #1262 in Alexa global
'http://www.elfagr.org/',
# Why: #1263 in Alexa global
'http://himado.in/',
# Why: #1264 in Alexa global
'http://www.lumosity.com/',
# Why: #1265 in Alexa global
'http://www.mbank.com.pl/',
# Why: #1266 in Alexa global
'http://www.primewire.ag/',
# Why: #1267 in Alexa global
'http://www.dreamstime.com/',
# Why: #1268 in Alexa global
'http://sootoo.com/',
# Why: #1269 in Alexa global
'http://www.souq.com/',
# Why: #1270 in Alexa global
'http://www.weblio.jp/',
# Why: #1272 in Alexa global
'http://www.craigslist.ca/',
# Why: #1273 in Alexa global
'http://www.zara.com/',
# Why: #1274 in Alexa global
'http://www.cheshi.com.cn/',
# Why: #1275 in Alexa global
'http://www.groupon.it/',
# Why: #1276 in Alexa global
'http://www.mangafox.me/',
# Why: #1277 in Alexa global
'http://www.casino.com/',
# Why: #1278 in Alexa global
'http://www.armorgames.com/',
# Why: #1279 in Alexa global
'http://www.zanox.com/',
# Why: #1280 in Alexa global
'http://www.finn.no/',
# Why: #1281 in Alexa global
'http://www.qihoo.com/',
# Why: #1282 in Alexa global
'http://www.toysrus.com/',
# Why: #1283 in Alexa global
'http://www.airasia.com/',
# Why: #1284 in Alexa global
'http://www.dafont.com/',
# Why: #1285 in Alexa global
'http://www.tvmuse.eu/',
# Why: #1286 in Alexa global
'http://www.pnc.com/',
# Why: #1287 in Alexa global
'http://www.donanimhaber.com/',
# Why: #1288 in Alexa global
'http://cnbeta.com/',
# Why: #1289 in Alexa global
'http://www.prntscr.com/',
# Why: #1290 in Alexa global
'http://www.cox.net/',
# Why: #1291 in Alexa global
'http://www.bloglovin.com/',
# Why: #1292 in Alexa global
'http://www.picmonkey.com/',
# Why: #1293 in Alexa global
'http://www.zoho.com/',
# Why: #1294 in Alexa global
'http://www.glassdoor.com/',
# Why: #1295 in Alexa global
'http://www.myfitnesspal.com/',
# Why: #1296 in Alexa global
'http://www.change.org/',
# Why: #1297 in Alexa global
'http://www.aa.com/',
# Why: #1298 in Alexa global
'http://www.playstation.com/',
# Why: #1300 in Alexa global
'http://www.b1.org/',
# Why: #1301 in Alexa global
'http://www.correios.com.br/',
# Why: #1302 in Alexa global
'http://www.hindustantimes.com/',
# Why: #1303 in Alexa global
'http://www.softlayer.com/',
# Why: #1304 in Alexa global
'http://www.imagevenue.com/',
# Why: #1305 in Alexa global
'http://www.windowsphone.com/',
# Why: #1306 in Alexa global
'http://www.wikimapia.org/',
# Why: #1307 in Alexa global
'http://www.transfermarkt.de/',
# Why: #1308 in Alexa global
'http://www.dict.cc/',
# Why: #1309 in Alexa global
'http://www.blocket.se/',
# Why: #1310 in Alexa global
'http://www.lacaixa.es/',
# Why: #1311 in Alexa global
'http://www.hilton.com/',
# Why: #1312 in Alexa global
'http://www.mtv.com/',
# Why: #1313 in Alexa global
'http://www.cbc.ca/',
# Why: #1314 in Alexa global
'http://www.msn.ca/',
# Why: #1315 in Alexa global
'http://www.box.com/',
# Why: #1316 in Alexa global
'http://www.szn.cz/',
# Why: #1317 in Alexa global
'http://www.haodf.com/',
# Why: #1318 in Alexa global
'http://www.monsterindia.com/',
# Why: #1319 in Alexa global
'http://www.okezone.com/',
# Why: #1320 in Alexa global
'http://www.entertainment-factory.com/',
# Why: #1321 in Alexa global
'http://www.linternaute.com/',
# Why: #1322 in Alexa global
'http://www.break.com/',
# Why: #1323 in Alexa global
'http://www.ustream.tv/',
# Why: #1324 in Alexa global
'http://www.songspk.name/',
# Why: #1325 in Alexa global
'http://www.bilibili.tv/',
# Why: #1326 in Alexa global
'http://www.avira.com/',
# Why: #1327 in Alexa global
'http://www.thehindu.com/',
# Why: #1328 in Alexa global
'http://www.watchmygf.com/',
# Why: #1329 in Alexa global
'http://www.google.co.ma/',
# Why: #1330 in Alexa global
'http://www.nick.com/',
# Why: #1331 in Alexa global
'http://www.sp.gov.br/',
# Why: #1332 in Alexa global
'http://www.zeobit.com/',
# Why: #1333 in Alexa global
'http://www.sprint.com/',
# Why: #1334 in Alexa global
'http://www.khabaronline.ir/',
# Why: #1335 in Alexa global
'http://www.magentocommerce.com/',
# Why: #1336 in Alexa global
'http://www.hsbc.co.uk/',
# Why: #1337 in Alexa global
'http://www.trafficholder.com/',
# Why: #1338 in Alexa global
'http://www.gamestop.com/',
# Why: #1339 in Alexa global
'http://www.cartoonnetwork.com/',
# Why: #1340 in Alexa global
'http://www.fifa.com/',
# Why: #1341 in Alexa global
'http://www.ebay.ca/',
# Why: #1342 in Alexa global
'http://www.vatanim.com.tr/',
# Why: #1343 in Alexa global
'http://www.qvc.com/',
# Why: #1344 in Alexa global
'http://www.marriott.com/',
# Why: #1345 in Alexa global
'http://www.eventbrite.com/',
# Why: #1346 in Alexa global
'http://www.gi-akademie.com/',
# Why: #1347 in Alexa global
'http://www.intel.com/',
# Why: #1348 in Alexa global
'http://www.oschina.net/',
# Why: #1349 in Alexa global
'http://www.dojki.com/',
# Why: #1350 in Alexa global
'http://www.thechive.com/',
# Why: #1351 in Alexa global
'http://www.viadeo.com/',
# Why: #1352 in Alexa global
'http://www.walgreens.com/',
# Why: #1353 in Alexa global
'http://www.leo.org/',
# Why: #1354 in Alexa global
'http://www.statscrop.com/',
# Why: #1355 in Alexa global
'http://www.brothersoft.com/',
# Why: #1356 in Alexa global
'http://www.allocine.fr/',
# Why: #1357 in Alexa global
'http://www.slutload.com/',
# Why: #1358 in Alexa global
'http://www.google.com.gt/',
# Why: #1359 in Alexa global
'http://www.santabanta.com/',
# Why: #1360 in Alexa global
'http://www.stardoll.com/',
# Why: #1361 in Alexa global
'http://www.polyvore.com/',
# Why: #1362 in Alexa global
'http://www.focus.de/',
# Why: #1363 in Alexa global
'http://www.duckduckgo.com/',
# Why: #1364 in Alexa global
'http://www.funshion.com/',
# Why: #1365 in Alexa global
'http://www.marieclairechina.com/',
# Why: #1366 in Alexa global
'http://www.internethaber.com/',
# Why: #1367 in Alexa global
'http://www.worldoftanks.ru/',
# Why: #1369 in Alexa global
'http://www.1und1.de/',
# Why: #1370 in Alexa global
'http://www.anyporn.com/',
# Why: #1371 in Alexa global
'http://www.17u.cn/',
# Why: #1372 in Alexa global
'http://www.cars.com/',
# Why: #1373 in Alexa global
'http://www.asg.to/',
# Why: #1374 in Alexa global
'http://www.alice.it/',
# Why: #1375 in Alexa global
'http://www.hongkiat.com/',
# Why: #1376 in Alexa global
'http://www.bhphotovideo.com/',
# Why: #1377 in Alexa global
'http://www.bdnews24.com/',
# Why: #1378 in Alexa global
'http://sdo.com/',
# Why: #1379 in Alexa global
'http://www.cerdas.com/',
# Why: #1380 in Alexa global
'http://www.clarin.com/',
# Why: #1381 in Alexa global
'http://www.victoriassecret.com/',
# Why: #1382 in Alexa global
'http://www.instructables.com/',
# Why: #1383 in Alexa global
'http://www.state.gov/',
# Why: #1384 in Alexa global
'http://www.agame.com/',
# Why: #1385 in Alexa global
'http://www.xiaomi.com/',
# Why: #1386 in Alexa global
'http://esporte.uol.com.br/',
# Why: #1387 in Alexa global
'http://www.adfoc.us/',
# Why: #1388 in Alexa global
'http://www.telekom.com/',
# Why: #1389 in Alexa global
'http://www.skycn.com/',
# Why: #1390 in Alexa global
'http://www.orbitz.com/',
# Why: #1391 in Alexa global
'http://www.nhl.com/',
# Why: #1392 in Alexa global
'http://www.vistaprint.com/',
# Why: #1393 in Alexa global
'http://trklnks.com/',
# Why: #1394 in Alexa global
'http://www.basecamp.com/',
# Why: #1395 in Alexa global
'http://www.hot-sex-tube.com/',
# Why: #1396 in Alexa global
'http://www.incredibar-search.com/',
# Why: #1397 in Alexa global
'http://www.qingdaonews.com/',
# Why: #1398 in Alexa global
'http://www.sabq.org/',
# Why: #1399 in Alexa global
'http://www.nasa.gov/',
# Why: #1400 in Alexa global
'http://www.dx.com/',
# Why: #1401 in Alexa global
'http://www.addmefast.com/',
# Why: #1402 in Alexa global
'http://www.yepi.com/',
# Why: #1403 in Alexa global
'http://www.xxx-ok.com/',
# Why: #1405 in Alexa global
'http://www.sex.com/',
# Why: #1406 in Alexa global
'http://www.food.com/',
# Why: #1407 in Alexa global
'http://www.freeones.com/',
# Why: #1408 in Alexa global
'http://www.tesco.com/',
# Why: #1409 in Alexa global
'http://www.a10.com/',
# Why: #1410 in Alexa global
'http://www.mynavi.jp/',
# Why: #1411 in Alexa global
'http://www.abc.net.au/',
# Why: #1412 in Alexa global
'http://www.internetdownloadmanager.com/',
# Why: #1413 in Alexa global
'http://www.seowhy.com/',
# Why: #1414 in Alexa global
'http://114so.cn/',
# Why: #1415 in Alexa global
'http://www.otomoto.pl/',
# Why: #1416 in Alexa global
'http://www.idealo.de/',
# Why: #1417 in Alexa global
'http://www.laposte.net/',
# Why: #1418 in Alexa global
'http://www.eroprofile.com/',
# Why: #1419 in Alexa global
'http://www.bbb.org/',
# Why: #1420 in Alexa global
'http://www.gnavi.co.jp/',
# Why: #1421 in Alexa global
'http://www.tiu.ru/',
# Why: #1422 in Alexa global
'http://www.blogsky.com/',
# Why: #1423 in Alexa global
'http://www.bigfishgames.com/',
# Why: #1424 in Alexa global
'http://www.weiphone.com/',
# Why: #1425 in Alexa global
'http://www.livescore.com/',
# Why: #1426 in Alexa global
'http://www.tubepleasure.com/',
# Why: #1427 in Alexa global
'http://www.net.cn/',
# Why: #1428 in Alexa global
'http://www.jagran.com/',
# Why: #1429 in Alexa global
'http://www.livestream.com/',
# Why: #1430 in Alexa global
'http://stagram.com/',
# Why: #1431 in Alexa global
'http://www.vine.co/',
# Why: #1432 in Alexa global
'http://www.olx.com.pk/',
# Why: #1433 in Alexa global
'http://www.edmunds.com/',
# Why: #1434 in Alexa global
'http://www.banglanews24.com/',
# Why: #1435 in Alexa global
'http://www.reverso.net/',
# Why: #1436 in Alexa global
'http://www.stargames.at/',
# Why: #1437 in Alexa global
'http://www.postimg.org/',
# Why: #1438 in Alexa global
'http://www.overthumbs.com/',
# Why: #1439 in Alexa global
'http://www.iteye.com/',
# Why: #1440 in Alexa global
'http://www.yify-torrents.com/',
# Why: #1441 in Alexa global
'http://www.forexfactory.com/',
# Why: #1442 in Alexa global
'http://www.jugem.jp/',
# Why: #1443 in Alexa global
'http://www.hefei.cc/',
# Why: #1444 in Alexa global
'http://www.thefreecamsecret.com/',
# Why: #1445 in Alexa global
'http://www.sponichi.co.jp/',
# Why: #1446 in Alexa global
'http://www.lanacion.com.ar/',
# Why: #1447 in Alexa global
'http://www.jeu-a-telecharger.com/',
# Why: #1448 in Alexa global
'http://www.spartoo.com/',
# Why: #1449 in Alexa global
'http://www.adv-adserver.com/',
# Why: #1450 in Alexa global
'http://www.asus.com/',
# Why: #1451 in Alexa global
'http://www.91.com/',
# Why: #1452 in Alexa global
'http://www.wimbledon.com/',
# Why: #1454 in Alexa global
'http://www.yam.com/',
# Why: #1455 in Alexa global
'http://www.grooveshark.com/',
# Why: #1456 in Alexa global
'http://www.tdcanadatrust.com/',
# Why: #1457 in Alexa global
'http://www.lovetime.com/',
# Why: #1458 in Alexa global
'http://www.iltalehti.fi/',
# Why: #1459 in Alexa global
'http://www.alnaddy.com/',
# Why: #1460 in Alexa global
'http://www.bb.com.br/',
# Why: #1461 in Alexa global
'http://www.msn.co.jp/',
# Why: #1462 in Alexa global
'http://www.tebyan.net/',
# Why: #1463 in Alexa global
'http://www.redbox.com/',
# Why: #1464 in Alexa global
'http://www.filecrop.com/',
# Why: #1465 in Alexa global
'http://www.aliyun.com/',
# Why: #1466 in Alexa global
'http://www.21cn.com/',
# Why: #1467 in Alexa global
'http://www.news24.com/',
# Why: #1468 in Alexa global
'http://www.infowars.com/',
# Why: #1469 in Alexa global
'http://www.thetaoofbadass.com/',
# Why: #1470 in Alexa global
'http://www.juegos.com/',
# Why: #1471 in Alexa global
'http://www.p5w.net/',
# Why: #1472 in Alexa global
'http://www.vg.no/',
# Why: #1473 in Alexa global
'http://www.discovery.com/',
# Why: #1474 in Alexa global
'http://www.gazzetta.it/',
# Why: #1475 in Alexa global
'http://www.tvguide.com/',
# Why: #1476 in Alexa global
'http://www.khabarfarsi.com/',
# Why: #1477 in Alexa global
'http://www.bradesco.com.br/',
# Why: #1478 in Alexa global
'http://www.autotrader.co.uk/',
# Why: #1479 in Alexa global
'http://www.wetransfer.com/',
# Why: #1480 in Alexa global
'http://jinti.com/',
# Why: #1481 in Alexa global
'http://www.xhamsterhq.com/',
# Why: #1482 in Alexa global
'http://www.appround.net/',
# Why: #1483 in Alexa global
'http://lotour.com/',
# Why: #1484 in Alexa global
'http://www.reverbnation.com/',
# Why: #1485 in Alexa global
'http://www.thedailybeast.com/',
# Why: #1486 in Alexa global
'http://www.vente-privee.com/',
# Why: #1487 in Alexa global
'http://www.subscribe.ru/',
# Why: #1488 in Alexa global
'http://www.clickjogos.uol.com.br/',
# Why: #1489 in Alexa global
'http://www.marketgid.com/',
# Why: #1490 in Alexa global
'http://www.super.cz/',
# Why: #1491 in Alexa global
'http://www.jvzoo.com/',
# Why: #1492 in Alexa global
'http://www.shine.com/',
# Why: #1493 in Alexa global
'http://www.screencast.com/',
# Why: #1494 in Alexa global
'http://www.picofile.com/',
# Why: #1495 in Alexa global
'http://www.manoramaonline.com/',
# Why: #1496 in Alexa global
'http://www.kbb.com/',
# Why: #1497 in Alexa global
'http://www.seasonvar.ru/',
# Why: #1498 in Alexa global
'http://www.android.com/',
# Why: #1499 in Alexa global
'http://www.egrana.com.br/',
# Why: #1501 in Alexa global
'http://www.ettoday.net/',
# Why: #1502 in Alexa global
'http://www.webstatsdomain.net/',
# Why: #1503 in Alexa global
'http://www.haberler.com/',
# Why: #1504 in Alexa global
'http://www.vesti.ru/',
# Why: #1505 in Alexa global
'http://www.fastpic.ru/',
# Why: #1506 in Alexa global
'http://www.dpreview.com/',
# Why: #1507 in Alexa global
'http://www.google.si/',
# Why: #1508 in Alexa global
'http://www.ouedkniss.com/',
# Why: #1509 in Alexa global
'http://www.crackle.com/',
# Why: #1510 in Alexa global
'http://www.chefkoch.de/',
# Why: #1511 in Alexa global
'http://www.mogujie.com/',
# Why: #1513 in Alexa global
'http://www.brassring.com/',
# Why: #1514 in Alexa global
'http://www.govome.com/',
# Why: #1515 in Alexa global
'http://www.copyscape.com/',
# Why: #1516 in Alexa global
'http://www.minecraftforum.net/',
# Why: #1517 in Alexa global
'http://www.mit.edu/',
# Why: #1518 in Alexa global
'http://www.cvs.com/',
# Why: #1519 in Alexa global
'http://www.timesjobs.com/',
# Why: #1520 in Alexa global
'http://www.ksl.com/',
# Why: #1521 in Alexa global
'http://www.verizon.net/',
# Why: #1522 in Alexa global
'http://www.direct.gov.uk/',
# Why: #1523 in Alexa global
'http://www.miralinks.ru/',
# Why: #1524 in Alexa global
'http://www.elheddaf.com/',
# Why: #1525 in Alexa global
'http://www.stockphoto9.com/',
# Why: #1526 in Alexa global
'http://www.ashemaletube.com/',
# Why: #1527 in Alexa global
'http://www.dmm.com/',
# Why: #1528 in Alexa global
'http://www.abckj123.com/',
# Why: #1529 in Alexa global
'http://www.smzdm.com/',
# Why: #1530 in Alexa global
'http://www.china.cn/',
# Why: #1531 in Alexa global
'http://www.cox.com/',
# Why: #1532 in Alexa global
'http://www.welt.de/',
# Why: #1533 in Alexa global
'http://www.guyspy.com/',
# Why: #1534 in Alexa global
'http://www.makeuseof.com/',
# Why: #1535 in Alexa global
'http://www.tiscali.it/',
# Why: #1536 in Alexa global
'http://www.178.com/',
# Why: #1537 in Alexa global
'http://www.metrolyrics.com/',
# Why: #1538 in Alexa global
'http://www.vsuch.com/',
# Why: #1539 in Alexa global
'http://www.seosprint.net/',
# Why: #1540 in Alexa global
'http://www.samanyoluhaber.com/',
# Why: #1541 in Alexa global
'http://www.garanti.com.tr/',
# Why: #1542 in Alexa global
'http://www.chicagotribune.com/',
# Why: #1543 in Alexa global
'http://www.hinet.net/',
# Why: #1544 in Alexa global
'http://www.kp.ru/',
# Why: #1545 in Alexa global
'http://www.chomikuj.pl/',
# Why: #1546 in Alexa global
'http://www.nk.pl/',
# Why: #1547 in Alexa global
'http://www.webhostingtalk.com/',
# Why: #1548 in Alexa global
'http://www.dnaindia.com/',
# Why: #1550 in Alexa global
'http://www.programme-tv.net/',
# Why: #1551 in Alexa global
'http://www.ievbz.com/',
# Why: #1552 in Alexa global
'http://www.mysql.com/',
# Why: #1553 in Alexa global
'http://www.perfectmoney.is/',
# Why: #1554 in Alexa global
'http://www.liveundnackt.com/',
# Why: #1555 in Alexa global
'http://www.flippa.com/',
# Why: #1556 in Alexa global
'http://www.vevo.com/',
# Why: #1557 in Alexa global
'http://www.jappy.de/',
# Why: #1558 in Alexa global
'http://www.bidvertiser.com/',
# Why: #1559 in Alexa global
'http://www.bankmandiri.co.id/',
# Why: #1560 in Alexa global
'http://www.letour.fr/',
# Why: #1561 in Alexa global
'http://www.yr.no/',
# Why: #1562 in Alexa global
'http://www.suning.com/',
# Why: #1563 in Alexa global
'http://www.nosub.tv/',
# Why: #1564 in Alexa global
'http://www.delicious.com/',
# Why: #1565 in Alexa global
'http://www.pornpoly.com/',
# Why: #1566 in Alexa global
'http://www.echo.msk.ru/',
# Why: #1567 in Alexa global
'http://www.coingeneration.com/',
# Why: #1568 in Alexa global
'http://www.shutterfly.com/',
# Why: #1569 in Alexa global
'http://www.royalbank.com/',
# Why: #1570 in Alexa global
'http://www.techradar.com/',
# Why: #1571 in Alexa global
'http://www.114la.com/',
# Why: #1572 in Alexa global
'http://www.bizrate.com/',
# Why: #1573 in Alexa global
'http://www.srvey.net/',
# Why: #1574 in Alexa global
'http://www.heavy-r.com/',
# Why: #1575 in Alexa global
'http://www.telexfree.com/',
# Why: #1576 in Alexa global
'http://www.lego.com/',
# Why: #1577 in Alexa global
'http://www.battlefield.com/',
# Why: #1578 in Alexa global
'http://www.shahrekhabar.com/',
# Why: #1579 in Alexa global
'http://www.tuenti.com/',
# Why: #1580 in Alexa global
'http://www.bookmyshow.com/',
# Why: #1581 in Alexa global
'http://www.gamme.com.tw/',
# Why: #1582 in Alexa global
'http://www.ft.com/',
# Why: #1583 in Alexa global
'http://www.prweb.com/',
# Why: #1584 in Alexa global
'http://www.1337x.org/',
# Why: #1585 in Alexa global
'http://www.networkedblogs.com/',
# Why: #1586 in Alexa global
'http://www.pbskids.org/',
# Why: #1587 in Alexa global
'http://aipai.com/',
# Why: #1588 in Alexa global
'http://www.jang.com.pk/',
# Why: #1589 in Alexa global
'http://www.dribbble.com/',
# Why: #1590 in Alexa global
'http://www.ezdownloadpro.info/',
# Why: #1591 in Alexa global
'http://www.gonzoxxxmovies.com/',
# Why: #1592 in Alexa global
'http://www.aufeminin.com/',
# Why: #1594 in Alexa global
'http://www.6pm.com/',
# Why: #1596 in Alexa global
'http://www.azet.sk/',
# Why: #1597 in Alexa global
'http://www.trustedoffer.com/',
# Why: #1598 in Alexa global
'http://www.simplyhired.com/',
# Why: #1599 in Alexa global
'http://www.adserverpub.com/',
# Why: #1600 in Alexa global
'http://www.privalia.com/',
# Why: #1601 in Alexa global
'http://www.bedbathandbeyond.com/',
# Why: #1602 in Alexa global
'http://www.yyets.com/',
# Why: #1603 in Alexa global
'http://verycd.com/',
# Why: #1604 in Alexa global
'http://www.sbnation.com/',
# Why: #1605 in Alexa global
'http://www.blogspot.nl/',
# Why: #1606 in Alexa global
'http://www.ikariam.com/',
# Why: #1607 in Alexa global
'http://www.sitepoint.com/',
# Why: #1608 in Alexa global
'http://www.gazeta.ru/',
# Why: #1609 in Alexa global
'http://www.tataindicom.com/',
# Why: #1610 in Alexa global
'http://chekb.com/',
# Why: #1611 in Alexa global
'http://www.literotica.com/',
# Why: #1612 in Alexa global
'http://www.ah-me.com/',
# Why: #1613 in Alexa global
'http://eztv.it/',
# Why: #1614 in Alexa global
'http://www.onliner.by/',
# Why: #1615 in Alexa global
'http://pptv.com/',
# Why: #1616 in Alexa global
'http://www.macrumors.com/',
# Why: #1617 in Alexa global
'http://www.xvideo-jp.com/',
# Why: #1618 in Alexa global
'http://www.state.tx.us/',
# Why: #1619 in Alexa global
'http://www.jamnews.ir/',
# Why: #1620 in Alexa global
'http://etoro.com/',
# Why: #1621 in Alexa global
'http://www.ny.gov/',
# Why: #1622 in Alexa global
'http://www.searchenginewatch.com/',
# Why: #1623 in Alexa global
'http://www.google.co.cr/',
# Why: #1624 in Alexa global
'http://www.td.com/',
# Why: #1625 in Alexa global
'http://www.ahrefs.com/',
# Why: #1626 in Alexa global
'http://www.337.com/',
# Why: #1627 in Alexa global
'http://www.klout.com/',
# Why: #1628 in Alexa global
'http://www.ebay.es/',
# Why: #1629 in Alexa global
'http://www.theverge.com/',
# Why: #1631 in Alexa global
'http://www.kapook.com/',
# Why: #1632 in Alexa global
'http://www.barclays.co.uk/',
# Why: #1634 in Alexa global
'http://nuomi.com/',
# Why: #1635 in Alexa global
'http://www.index-of-mp3s.com/',
# Why: #1636 in Alexa global
'http://www.ohfreesex.com/',
# Why: #1637 in Alexa global
'http://www.mts.ru/',
# Why: #1638 in Alexa global
'http://www.itmedia.co.jp/',
# Why: #1639 in Alexa global
'http://www.instantcheckmate.com/',
# Why: #1640 in Alexa global
'http://www.sport.es/',
# Why: #1641 in Alexa global
'http://www.sitescout.com/',
# Why: #1642 in Alexa global
'http://www.irr.ru/',
# Why: #1643 in Alexa global
'http://tuniu.com/',
# Why: #1644 in Alexa global
'http://www.startimes.com/',
# Why: #1645 in Alexa global
'http://www.tvn24.pl/',
# Why: #1646 in Alexa global
'http://www.kenh14.vn/',
# Why: #1647 in Alexa global
'http://www.myvideo.de/',
# Why: #1648 in Alexa global
'http://www.speedbit.com/',
# Why: #1649 in Alexa global
'http://www.aljazeera.com/',
# Why: #1650 in Alexa global
'http://www.pudelek.pl/',
# Why: #1651 in Alexa global
'http://www.mmgp.ru/',
# Why: #1652 in Alexa global
'http://www.empflix.com/',
# Why: #1653 in Alexa global
'http://www.tigerdirect.com/',
# Why: #1655 in Alexa global
'http://www.elegantthemes.com/',
# Why: #1657 in Alexa global
'http://www.ted.com/',
# Why: #1658 in Alexa global
'http://www.carview.co.jp/',
# Why: #1659 in Alexa global
'http://www.down1oads.com/',
# Why: #1660 in Alexa global
'http://www.bancobrasil.com.br/',
# Why: #1661 in Alexa global
'http://www.qip.ru/',
# Why: #1662 in Alexa global
'http://www.nikkeibp.co.jp/',
# Why: #1663 in Alexa global
'http://www.fapdu.com/',
# Why: #1664 in Alexa global
'http://www.softango.com/',
# Why: #1665 in Alexa global
'http://www.ap.org/',
# Why: #1666 in Alexa global
'http://www.meteofrance.com/',
# Why: #1667 in Alexa global
'http://www.gentenocturna.com/',
# Why: #1668 in Alexa global
'http://www.2ch-c.net/',
# Why: #1669 in Alexa global
'http://www.orf.at/',
# Why: #1670 in Alexa global
'http://www.maybank2u.com.my/',
# Why: #1671 in Alexa global
'http://www.minecraftwiki.net/',
# Why: #1672 in Alexa global
'http://www.tv.com/',
# Why: #1673 in Alexa global
'http://www.orkut.com/',
# Why: #1674 in Alexa global
'http://www.adp.com/',
# Why: #1675 in Alexa global
'http://www.woorank.com/',
# Why: #1676 in Alexa global
'http://www.imagetwist.com/',
# Why: #1677 in Alexa global
'http://www.pastebin.com/',
# Why: #1678 in Alexa global
'http://www.airtel.com/',
# Why: #1679 in Alexa global
'http://www.ew.com/',
# Why: #1680 in Alexa global
'http://www.forever21.com/',
# Why: #1681 in Alexa global
'http://www.adam4adam.com/',
# Why: #1682 in Alexa global
'http://www.voyages-sncf.com/',
# Why: #1683 in Alexa global
'http://www.nextag.com/',
# Why: #1684 in Alexa global
'http://www.usnews.com/',
# Why: #1685 in Alexa global
'http://www.dinamalar.com/',
# Why: #1686 in Alexa global
'http://www.impress.co.jp/',
# Why: #1687 in Alexa global
'http://www.virginmedia.com/',
# Why: #1688 in Alexa global
'http://www.investopedia.com/',
# Why: #1689 in Alexa global
'http://www.seekingalpha.com/',
# Why: #1690 in Alexa global
'http://www.jumponhottie.com/',
# Why: #1691 in Alexa global
'http://www.national-lottery.co.uk/',
# Why: #1692 in Alexa global
'http://www.mobifiesta.com/',
# Why: #1693 in Alexa global
'http://www.kapanlagi.com/',
# Why: #1694 in Alexa global
'http://www.segundamano.es/',
# Why: #1695 in Alexa global
'http://gfan.com/',
# Why: #1696 in Alexa global
'http://www.xdating.com/',
# Why: #1697 in Alexa global
'http://www.ynet.com/',
# Why: #1698 in Alexa global
'http://www.medu.ir/',
# Why: #1699 in Alexa global
'http://www.hsn.com/',
# Why: #1700 in Alexa global
'http://www.newsru.com/',
# Why: #1701 in Alexa global
'http://www.minus.com/',
# Why: #1702 in Alexa global
'http://www.sitetalk.com/',
# Why: #1703 in Alexa global
'http://www.aarp.org/',
# Why: #1704 in Alexa global
'http://www.clickpaid.com/',
# Why: #1705 in Alexa global
'http://www.panoramio.com/',
# Why: #1706 in Alexa global
'http://www.webcamo.com/',
# Why: #1707 in Alexa global
'http://www.yobt.tv/',
# Why: #1708 in Alexa global
'http://www.slutfinder.com/',
# Why: #1709 in Alexa global
'http://www.freelotto.com/',
# Why: #1710 in Alexa global
'http://www.mudah.my/',
# Why: #1711 in Alexa global
'http://www.toptenreviews.com/',
# Why: #1712 in Alexa global
'http://www.caisse-epargne.fr/',
# Why: #1713 in Alexa global
'http://www.wimp.com/',
# Why: #1714 in Alexa global
'http://www.woothemes.com/',
# Why: #1715 in Alexa global
'http://www.css-tricks.com/',
# Why: #1716 in Alexa global
'http://www.coolmath-games.com/',
# Why: #1717 in Alexa global
'http://www.tagu.com.ar/',
# Why: #1718 in Alexa global
'http://www.sheknows.com/',
# Why: #1719 in Alexa global
'http://www.advancedfileoptimizer.com/',
# Why: #1720 in Alexa global
'http://www.drupal.org/',
# Why: #1721 in Alexa global
'http://www.centrum.cz/',
# Why: #1722 in Alexa global
'http://www.charter.net/',
# Why: #1724 in Alexa global
'http://adxhosting.net/',
# Why: #1725 in Alexa global
'http://www.squarespace.com/',
# Why: #1726 in Alexa global
'http://www.trademe.co.nz/',
# Why: #1727 in Alexa global
'http://www.sitesell.com/',
# Why: #1728 in Alexa global
'http://www.birthrecods.com/',
# Why: #1729 in Alexa global
'http://www.megashare.info/',
# Why: #1730 in Alexa global
'http://www.freepornvs.com/',
# Why: #1731 in Alexa global
'http://www.isna.ir/',
# Why: #1732 in Alexa global
'http://www.ziddu.com/',
# Why: #1733 in Alexa global
'http://www.airtelforum.com/',
# Why: #1734 in Alexa global
'http://www.justin.tv/',
# Why: #1735 in Alexa global
'http://www.01net.com/',
# Why: #1736 in Alexa global
'http://www.ed.gov/',
# Why: #1737 in Alexa global
'http://www.no-ip.com/',
# Why: #1738 in Alexa global
'http://www.nikkansports.com/',
# Why: #1739 in Alexa global
'http://www.smashingmagazine.com/',
# Why: #1740 in Alexa global
'http://www.salon.com/',
# Why: #1741 in Alexa global
'http://www.nmisr.com/',
# Why: #1742 in Alexa global
'http://www.wanggou.com/',
# Why: #1743 in Alexa global
'http://www.bayt.com/',
# Why: #1744 in Alexa global
'http://www.codeproject.com/',
# Why: #1745 in Alexa global
'http://www.downloadha.com/',
# Why: #1746 in Alexa global
'http://www.local.com/',
# Why: #1747 in Alexa global
'http://www.abola.pt/',
# Why: #1748 in Alexa global
'http://www.delta-homes.com/',
# Why: #1749 in Alexa global
'http://www.filmweb.pl/',
# Why: #1750 in Alexa global
'http://www.gov.uk/',
# Why: #1751 in Alexa global
'http://www.worldoftanks.eu/',
# Why: #1752 in Alexa global
'http://www.ads-id.com/',
# Why: #1753 in Alexa global
'http://www.sergey-mavrodi.com/',
# Why: #1754 in Alexa global
'http://www.pornoid.com/',
# Why: #1755 in Alexa global
'http://www.freakshare.com/',
# Why: #1756 in Alexa global
'http://www.51fanli.com/',
# Why: #1757 in Alexa global
'http://www.bankrate.com/',
# Why: #1758 in Alexa global
'http://www.grindtv.com/',
# Why: #1759 in Alexa global
'http://www.webmasterworld.com/',
# Why: #1760 in Alexa global
'http://www.torrentz.in/',
# Why: #1761 in Alexa global
'http://www.bwin.com/',
# Why: #1762 in Alexa global
'http://www.watchtower.com/',
# Why: #1763 in Alexa global
'http://www.payza.com/',
# Why: #1764 in Alexa global
'http://www.eol.cn/',
# Why: #1765 in Alexa global
'http://www.anz.com/',
# Why: #1766 in Alexa global
'http://www.vagalume.com.br/',
# Why: #1767 in Alexa global
'http://www.ozon.ru/',
# Why: #1768 in Alexa global
'http://www.cnr.cn/',
# Why: #1769 in Alexa global
'http://www.tonicmovies.com/',
# Why: #1771 in Alexa global
'http://www.arbeitsagentur.de/',
# Why: #1772 in Alexa global
'http://www.graphicriver.net/',
# Why: #1773 in Alexa global
'http://www.theweathernetwork.com/',
# Why: #1774 in Alexa global
'http://www.samsclub.com/',
# Why: #1775 in Alexa global
'http://www.tribunnews.com/',
# Why: #1776 in Alexa global
'http://www.soldonsmart.com/',
# Why: #1777 in Alexa global
'http://www.tut.by/',
# Why: #1778 in Alexa global
'http://www.voila.fr/',
# Why: #1779 in Alexa global
'http://www.doctissimo.fr/',
# Why: #1780 in Alexa global
'http://www.sueddeutsche.de/',
# Why: #1781 in Alexa global
'http://www.mamba.ru/',
# Why: #1782 in Alexa global
'http://www.kmart.com/',
# Why: #1783 in Alexa global
'http://www.noticias.uol.com.br/',
# Why: #1784 in Alexa global
'http://www.abc.es/',
# Why: #1785 in Alexa global
'http://www.manager.co.th/',
# Why: #1786 in Alexa global
'http://www.spokeo.com/',
# Why: #1787 in Alexa global
'http://www.apache.org/',
# Why: #1788 in Alexa global
'http://www.tdbank.com/',
# Why: #1789 in Alexa global
'http://www.asklaila.com/',
# Why: #1790 in Alexa global
'http://admin5.net/',
# Why: #1791 in Alexa global
'http://www.rtve.es/',
# Why: #1792 in Alexa global
'http://www.ynet.co.il/',
# Why: #1793 in Alexa global
'http://www.infospace.com/',
# Why: #1794 in Alexa global
'http://yimg.com/',
# Why: #1795 in Alexa global
'http://www.torcache.net/',
# Why: #1796 in Alexa global
'http://www.zap2it.com/',
# Why: #1797 in Alexa global
'http://www.smallseotools.com/',
# Why: #1798 in Alexa global
'http://www.privatbank.ua/',
# Why: #1799 in Alexa global
'http://www.nnm-club.ru/',
# Why: #1800 in Alexa global
'http://www.payoneer.com/',
# Why: #1801 in Alexa global
'http://www.bidorbuy.co.za/',
# Why: #1802 in Alexa global
'http://www.islamweb.net/',
# Why: #1803 in Alexa global
'http://www.juicyads.com/',
# Why: #1804 in Alexa global
'http://www.vid2c.com/',
# Why: #1805 in Alexa global
'http://rising.cn/',
# Why: #1806 in Alexa global
'http://www.dnsrsearch.com/',
# Why: #1807 in Alexa global
'http://www.the-bux.net/',
# Why: #1808 in Alexa global
'http://www.yaplakal.com/',
# Why: #1809 in Alexa global
'http://www.ex.ua/',
# Why: #1810 in Alexa global
'http://www.mtsindia.in/',
# Why: #1811 in Alexa global
'http://www.reclameaqui.com.br/',
# Why: #1812 in Alexa global
'http://www.postbank.de/',
# Why: #1813 in Alexa global
'http://www.gogvo.com/',
# Why: #1814 in Alexa global
'http://www.bearshare.net/',
# Why: #1815 in Alexa global
'http://www.socialsex.com/',
# Why: #1816 in Alexa global
'http://www.yebhi.com/',
# Why: #1817 in Alexa global
'http://www.mktmobi.com/',
# Why: #1818 in Alexa global
'http://www.hotpepper.jp/',
# Why: #1819 in Alexa global
'http://www.dfiles.eu/',
# Why: #1820 in Alexa global
'http://www.citibank.co.in/',
# Why: #1821 in Alexa global
'http://gamersky.com/',
# Why: #1822 in Alexa global
'http://www.kotaku.com/',
# Why: #1823 in Alexa global
'http://www.teamviewer.com/',
# Why: #1824 in Alexa global
'http://www.kwejk.pl/',
# Why: #1825 in Alexa global
'http://www.hamariweb.com/',
# Why: #1826 in Alexa global
'http://www.tom.com/',
# Why: #1827 in Alexa global
'http://www.gayromeo.com/',
# Why: #1828 in Alexa global
'http://www.sony.com/',
# Why: #1829 in Alexa global
'http://www.westpac.com.au/',
# Why: #1830 in Alexa global
'http://www.gtmetrix.com/',
# Why: #1831 in Alexa global
'http://www.shorouknews.com/',
# Why: #1832 in Alexa global
'http://www.xl.pt/',
# Why: #1833 in Alexa global
'http://www.networksolutions.com/',
# Why: #1834 in Alexa global
'http://www.500px.com/',
# Why: #1835 in Alexa global
'http://www.ypmate.com/',
# Why: #1836 in Alexa global
'http://www.indowebster.com/',
# Why: #1837 in Alexa global
'http://www.sports.ru/',
# Why: #1838 in Alexa global
'http://www.netshoes.com.br/',
# Why: #1839 in Alexa global
'http://familydoctor.com.cn/',
# Why: #1840 in Alexa global
'http://www.dfiles.ru/',
# Why: #1841 in Alexa global
'http://www.cpasbien.me/',
# Why: #1842 in Alexa global
'http://www.webgame.web.id/',
# Why: #1843 in Alexa global
'http://www.tuto4pc.com/',
# Why: #1844 in Alexa global
'http://www.poponclick.com/',
# Why: #1845 in Alexa global
'http://www.complex.com/',
# Why: #1846 in Alexa global
'http://www.sakshi.com/',
# Why: #1847 in Alexa global
'http://www.infobae.com/',
# Why: #1848 in Alexa global
'http://www.allabout.co.jp/',
# Why: #1849 in Alexa global
'http://www.sify.com/',
# Why: #1850 in Alexa global
'http://www.4pda.ru/',
# Why: #1851 in Alexa global
'http://www.starsue.net/',
# Why: #1852 in Alexa global
'http://www.newgrounds.com/',
# Why: #1853 in Alexa global
'http://www.mehrnews.com/',
# Why: #1854 in Alexa global
'http://www.depositphotos.com/',
# Why: #1855 in Alexa global
'http://www.keek.com/',
# Why: #1856 in Alexa global
'http://www.indeed.co.in/',
# Why: #1857 in Alexa global
'http://www.stanford.edu/',
# Why: #1858 in Alexa global
'http://www.hepsiburada.com/',
# Why: #1859 in Alexa global
'http://www.20minutos.es/',
# Why: #1860 in Alexa global
'http://www.paper.li/',
# Why: #1861 in Alexa global
'http://www.prizee.com/',
# Why: #1862 in Alexa global
'http://www.xlovecam.com/',
# Why: #1863 in Alexa global
'http://www.criteo.com/',
# Why: #1864 in Alexa global
'http://www.endlessmatches.com/',
# Why: #1865 in Alexa global
'http://www.dyndns.org/',
# Why: #1866 in Alexa global
'http://www.lightinthebox.com/',
# Why: #1867 in Alexa global
'http://www.easyjet.com/',
# Why: #1869 in Alexa global
'http://www.vice.com/',
# Why: #1870 in Alexa global
'http://tiexue.net/',
# Why: #1871 in Alexa global
'http://www.monstermarketplace.com/',
# Why: #1872 in Alexa global
'http://www.mojang.com/',
# Why: #1873 in Alexa global
'http://www.cams.com/',
# Why: #1874 in Alexa global
'http://www.pingdom.com/',
# Why: #1875 in Alexa global
'http://www.askmen.com/',
# Why: #1876 in Alexa global
'http://www.list-manage1.com/',
# Why: #1878 in Alexa global
'http://www.express.com.pk/',
# Why: #1879 in Alexa global
'http://www.priceminister.com/',
# Why: #1880 in Alexa global
'http://www.duba.com/',
# Why: #1881 in Alexa global
'http://www.meinestadt.de/',
# Why: #1882 in Alexa global
'http://www.mediatakeout.com/',
# Why: #1883 in Alexa global
'http://www.w3school.com.cn/',
# Why: #1884 in Alexa global
'http://www.terere.info/',
# Why: #1885 in Alexa global
'http://www.streamate.com/',
# Why: #1886 in Alexa global
'http://www.garmin.com/',
# Why: #1887 in Alexa global
'http://www.a-telecharger.com/',
# Why: #1888 in Alexa global
'http://www.vipzona.info/',
# Why: #1889 in Alexa global
'http://www.coffetube.com/',
# Why: #1890 in Alexa global
'http://www.discuz.net/',
# Why: #1891 in Alexa global
'http://www.directv.com/',
# Why: #1892 in Alexa global
'http://www.foreningssparbanken.se/',
# Why: #1893 in Alexa global
'http://www.fatwallet.com/',
# Why: #1894 in Alexa global
'http://www.mackolik.com/',
# Why: #1895 in Alexa global
'http://www.megacinema.fr/',
# Why: #1896 in Alexa global
'http://www.chess.com/',
# Why: #1897 in Alexa global
'http://www.suntrust.com/',
# Why: #1898 in Alexa global
'http://www.investing.com/',
# Why: #1899 in Alexa global
'http://www.whois.com/',
# Why: #1900 in Alexa global
'http://www.dummies.com/',
# Why: #1901 in Alexa global
'http://www.yinyuetai.com/',
# Why: #1902 in Alexa global
'http://www.mihandownload.com/',
# Why: #1903 in Alexa global
'http://www.freapp.com/',
# Why: #1904 in Alexa global
'http://www.theage.com.au/',
# Why: #1905 in Alexa global
'http://www.audible.com/',
# Why: #1906 in Alexa global
'http://www.hangame.co.jp/',
# Why: #1907 in Alexa global
'http://www.hotelurbano.com.br/',
# Why: #1908 in Alexa global
'http://www.vatgia.com/',
# Why: #1909 in Alexa global
'http://www.wizard101.com/',
# Why: #1910 in Alexa global
'http://www.ceneo.pl/',
# Why: #1911 in Alexa global
'http://1ting.com/',
# Why: #1912 in Alexa global
'http://www.meetic.fr/',
# Why: #1913 in Alexa global
'http://www.cardekho.com/',
# Why: #1914 in Alexa global
'http://www.tripadvisor.it/',
# Why: #1915 in Alexa global
'http://www.dhl.com/',
# Why: #1916 in Alexa global
'http://www.aibang.com/',
# Why: #1917 in Alexa global
'http://www.asp.net/',
# Why: #1918 in Alexa global
'http://www.toing.com.br/',
# Why: #1920 in Alexa global
'http://zhubajie.com/',
# Why: #1921 in Alexa global
'http://www.telecomitalia.it/',
# Why: #1922 in Alexa global
'http://www.claro-search.com/',
# Why: #1923 in Alexa global
'http://www.nickjr.com/',
# Why: #1924 in Alexa global
'http://www.iconfinder.com/',
# Why: #1925 in Alexa global
'http://www.mobile9.com/',
# Why: #1926 in Alexa global
'http://www.mainichi.jp/',
# Why: #1927 in Alexa global
'http://www.cisco.com/',
# Why: #1928 in Alexa global
'http://www.cpanel.net/',
# Why: #1929 in Alexa global
'http://www.indiegogo.com/',
# Why: #1930 in Alexa global
'http://www.egotastic.com/',
# Why: #1931 in Alexa global
'http://www.hforcare.com/',
# Why: #1932 in Alexa global
'http://www.pbs.org/',
# Why: #1933 in Alexa global
'http://www.realestate.com.au/',
# Why: #1934 in Alexa global
'http://www.abv.bg/',
# Why: #1935 in Alexa global
'http://www.drugs.com/',
# Why: #1936 in Alexa global
'http://www.bt.com/',
# Why: #1937 in Alexa global
'http://www.wildberries.ru/',
# Why: #1938 in Alexa global
'http://www.edreams.it/',
# Why: #1939 in Alexa global
'http://www.statigr.am/',
# Why: #1940 in Alexa global
'http://www.prestashop.com/',
# Why: #1941 in Alexa global
'http://www.adxite.com/',
# Why: #1942 in Alexa global
'http://www.birthdaypeoms.com/',
# Why: #1943 in Alexa global
'http://www.exbii.com/',
# Why: #1944 in Alexa global
'http://www.blogmura.com/',
# Why: #1945 in Alexa global
'http://www.sciencedirect.com/',
# Why: #1946 in Alexa global
'http://www.sanspo.com/',
# Why: #1947 in Alexa global
'http://www.nextmedia.com/',
# Why: #1948 in Alexa global
'http://www.tvoyauda4a.ru/',
# Why: #1949 in Alexa global
'http://tangdou.com/',
# Why: #1950 in Alexa global
'http://www.blackboard.com/',
# Why: #1951 in Alexa global
'http://qiyou.com/',
# Why: #1952 in Alexa global
'http://www.youth.cn/',
# Why: #1953 in Alexa global
'http://www.prezentacya.ru/',
# Why: #1954 in Alexa global
'http://www.clicrbs.com.br/',
# Why: #1955 in Alexa global
'http://www.wayfair.com/',
# Why: #1956 in Alexa global
'http://www.xvideos-field.com/',
# Why: #1957 in Alexa global
'http://www.national.com.au/',
# Why: #1958 in Alexa global
'http://www.friendfeed.com/',
# Why: #1959 in Alexa global
'http://www.plurk.com/',
# Why: #1960 in Alexa global
'http://www.lolmake.com/',
# Why: #1961 in Alexa global
'http://www.b9dm.com/',
# Why: #1962 in Alexa global
'http://www.afkarnews.ir/',
# Why: #1963 in Alexa global
'http://www.dhl.de/',
# Why: #1964 in Alexa global
'http://www.championat.com/',
# Why: #1965 in Alexa global
'http://www.moviefone.com/',
# Why: #1966 in Alexa global
'http://www.popcash.net/',
# Why: #1967 in Alexa global
'http://www.cliphunter.com/',
# Why: #1968 in Alexa global
'http://www.sharebeast.com/',
# Why: #1969 in Alexa global
'http://www.wowhead.com/',
# Why: #1970 in Alexa global
'http://www.firstpost.com/',
# Why: #1971 in Alexa global
'http://www.lloydstsb.com/',
# Why: #1972 in Alexa global
'http://www.fazenda.gov.br/',
# Why: #1973 in Alexa global
'http://www.lonelyplanet.com/',
# Why: #1974 in Alexa global
'http://www.freenet.de/',
# Why: #1975 in Alexa global
'http://www.justanswer.com/',
# Why: #1977 in Alexa global
'http://www.qiwi.com/',
# Why: #1978 in Alexa global
'http://www.shufuni.com/',
# Why: #1979 in Alexa global
'http://www.drive2.ru/',
# Why: #1980 in Alexa global
'http://www.slando.ua/',
# Why: #1981 in Alexa global
'http://www.caribbeancom.com/',
# Why: #1982 in Alexa global
'http://www.uniblue.com/',
# Why: #1983 in Alexa global
'http://www.real.com/',
# Why: #1984 in Alexa global
'http://www.addictinggames.com/',
# Why: #1985 in Alexa global
'http://www.wnd.com/',
# Why: #1986 in Alexa global
'http://www.col3negoriginal.org/',
# Why: #1987 in Alexa global
'http://www.loltrk.com/',
# Why: #1988 in Alexa global
'http://www.videodownloadconverter.com/',
# Why: #1989 in Alexa global
'http://www.google.lv/',
# Why: #1990 in Alexa global
'http://www.seriesyonkis.com/',
# Why: #1991 in Alexa global
'http://www.ryushare.com/',
# Why: #1992 in Alexa global
'http://s1979.com/',
# Why: #1993 in Alexa global
'http://www.cheapoair.com/',
# Why: #1994 in Alexa global
'http://www.plala.or.jp/',
# Why: #1995 in Alexa global
'http://www.submarino.com.br/',
# Why: #1996 in Alexa global
'http://www.topface.com/',
# Why: #1998 in Alexa global
'http://www.hotelscombined.com/',
# Why: #1999 in Alexa global
'http://www.whatismyipaddress.com/',
# Why: #2000 in Alexa global
'http://www.z6.com/',
# Why: #2001 in Alexa global
'http://www.sozcu.com.tr/',
# Why: #2002 in Alexa global
'http://www.sonymobile.com/',
# Why: #2003 in Alexa global
'http://www.planetminecraft.com/',
# Why: #2004 in Alexa global
'http://www.optimum.net/',
# Why: #2005 in Alexa global
'http://www.google.com.pr/',
# Why: #2006 in Alexa global
'http://mthai.com/',
# Why: #2007 in Alexa global
'http://www.onlinecreditcenter6.com/',
# Why: #2008 in Alexa global
'http://www.tharunaya.co.uk/',
# Why: #2009 in Alexa global
'http://www.sfimg.com/',
# Why: #2010 in Alexa global
'http://www.natwest.com/',
# Why: #2011 in Alexa global
'http://www.zergnet.com/',
# Why: #2012 in Alexa global
'http://www.alotporn.com/',
# Why: #2013 in Alexa global
'http://www.urbanspoon.com/',
# Why: #2014 in Alexa global
'http://www.punishtube.com/',
# Why: #2015 in Alexa global
'http://www.proboards.com/',
# Why: #2016 in Alexa global
'http://www.betfair.com/',
# Why: #2017 in Alexa global
'http://www.iltasanomat.fi/',
# Why: #2018 in Alexa global
'http://www.ssisurveys.com/',
# Why: #2019 in Alexa global
'http://www.mapion.co.jp/',
# Why: #2020 in Alexa global
'http://www.harvard.edu/',
# Why: #2021 in Alexa global
'http://www.blic.rs/',
# Why: #2022 in Alexa global
'http://www.clicksia.com/',
# Why: #2023 in Alexa global
'http://www.skillpages.com/',
# Why: #2024 in Alexa global
'http://www.mobilewap.com/',
# Why: #2025 in Alexa global
'http://www.fiducia.de/',
# Why: #2026 in Alexa global
'http://www.torntvz.org/',
# Why: #2027 in Alexa global
'http://www.leparisien.fr/',
# Why: #2028 in Alexa global
'http://anjuke.com/',
# Why: #2029 in Alexa global
'http://www.rabobank.nl/',
# Why: #2030 in Alexa global
'http://www.sport.pl/',
# Why: #2031 in Alexa global
'http://www.schwab.com/',
# Why: #2032 in Alexa global
'http://www.buenastareas.com/',
# Why: #2033 in Alexa global
'http://www.befuck.com/',
# Why: #2034 in Alexa global
'http://www.smart-search.com/',
# Why: #2035 in Alexa global
'http://www.ivi.ru/',
# Why: #2036 in Alexa global
'http://www.2z.cn/',
# Why: #2037 in Alexa global
'http://www.dvdvideosoft.com/',
# Why: #2038 in Alexa global
'http://www.ubi.com/',
# Why: #2039 in Alexa global
'http://makepolo.com/',
# Why: #2040 in Alexa global
'http://www.1and1.com/',
# Why: #2041 in Alexa global
'http://www.anipo.jp/',
# Why: #2042 in Alexa global
'http://www.pcworld.com/',
# Why: #2043 in Alexa global
'http://www.caf.fr/',
# Why: #2044 in Alexa global
'http://www.fnb.co.za/',
# Why: #2045 in Alexa global
'http://www.vanguardngr.com/',
# Why: #2046 in Alexa global
'http://www.floozycity.com/',
# Why: #2047 in Alexa global
'http://www.ubuntu.com/',
# Why: #2048 in Alexa global
'http://www.my-link.pro/',
# Why: #2049 in Alexa global
'http://www.daily.co.jp/',
# Why: #2050 in Alexa global
'http://www.centurylink.com/',
# Why: #2051 in Alexa global
'http://www.slashdot.org/',
# Why: #2052 in Alexa global
'http://www.mirrorcreator.com/',
# Why: #2053 in Alexa global
'http://www.rutube.ru/',
# Why: #2054 in Alexa global
'http://www.tubeplus.me/',
# Why: #2055 in Alexa global
'http://www.kicker.de/',
# Why: #2056 in Alexa global
'http://www.unibet.com/',
# Why: #2057 in Alexa global
'http://www.pornyaz.com/',
# Why: #2058 in Alexa global
'http://www.learntotradethemarket.com/',
# Why: #2059 in Alexa global
'http://www.tokyo-porn-tube.com/',
# Why: #2060 in Alexa global
'http://www.luvcow.com/',
# Why: #2061 in Alexa global
'http://www.i.ua/',
# Why: #2062 in Alexa global
'http://www.ole.com.ar/',
# Why: #2063 in Alexa global
'http://www.redfin.com/',
# Why: #2064 in Alexa global
'http://www.cnki.net/',
# Why: #2065 in Alexa global
'http://www.2shared.com/',
# Why: #2066 in Alexa global
'http://www.infibeam.com/',
# Why: #2067 in Alexa global
'http://www.zdnet.com/',
# Why: #2068 in Alexa global
'http://www.fishki.net/',
# Why: #2069 in Alexa global
'http://msn.com.cn/',
# Why: #2070 in Alexa global
'http://www.ukr.net/',
# Why: #2071 in Alexa global
'http://www.scol.com.cn/',
# Why: #2072 in Alexa global
'http://www.jiameng.com/',
# Why: #2073 in Alexa global
'http://www.utorrent.com/',
# Why: #2074 in Alexa global
'http://www.elkhabar.com/',
# Why: #2075 in Alexa global
'http://www.anime44.com/',
# Why: #2076 in Alexa global
'http://www.societegenerale.fr/',
# Why: #2077 in Alexa global
'http://www.livememe.com/',
# Why: #2078 in Alexa global
'http://www.warning.or.kr/',
# Why: #2079 in Alexa global
'http://www.startertv.fr/',
# Why: #2080 in Alexa global
'http://www.pingomatic.com/',
# Why: #2081 in Alexa global
'http://www.indeed.co.uk/',
# Why: #2082 in Alexa global
'http://www.dpstream.net/',
# Why: #2083 in Alexa global
'http://www.mundodeportivo.com/',
# Why: #2084 in Alexa global
'http://www.gravatar.com/',
# Why: #2085 in Alexa global
'http://www.ip138.com/',
# Why: #2086 in Alexa global
'http://www.zcool.com.cn/',
# Why: #2087 in Alexa global
'http://www.yandex.net/',
# Why: #2088 in Alexa global
'http://www.barbie.com/',
# Why: #2089 in Alexa global
'http://www.wattpad.com/',
# Why: #2090 in Alexa global
'http://www.dzwww.com/',
# Why: #2091 in Alexa global
'http://www.technorati.com/',
# Why: #2092 in Alexa global
'http://meishichina.com/',
# Why: #2093 in Alexa global
'http://www.russianpost.ru/',
# Why: #2094 in Alexa global
'http://www.kboing.com.br/',
# Why: #2095 in Alexa global
'http://www.lzjl.com/',
# Why: #2096 in Alexa global
'http://www.newsnow.co.uk/',
# Why: #2097 in Alexa global
'http://www.dw.de/',
# Why: #2098 in Alexa global
'http://www.inetglobal.com/',
# Why: #2099 in Alexa global
'http://www.tripadvisor.in/',
# Why: #2100 in Alexa global
'http://www.ashleyrnadison.com/',
# Why: #2101 in Alexa global
'http://www.rapgenius.com/',
# Why: #2102 in Alexa global
'http://www.xuite.net/',
# Why: #2103 in Alexa global
'http://www.nowvideo.eu/',
# Why: #2104 in Alexa global
'http://www.search.us.com/',
# Why: #2105 in Alexa global
'http://www.usagc.org/',
# Why: #2106 in Alexa global
'http://www.santander.co.uk/',
# Why: #2107 in Alexa global
'http://www.99acres.com/',
# Why: #2108 in Alexa global
'http://www.bigcartel.com/',
# Why: #2109 in Alexa global
'http://www.haivl.com/',
# Why: #2110 in Alexa global
'http://www.jsfiddle.net/',
# Why: #2111 in Alexa global
'http://www.io9.com/',
# Why: #2112 in Alexa global
'http://www.lg.com/',
# Why: #2113 in Alexa global
'http://www.veoh.com/',
# Why: #2114 in Alexa global
'http://www.dafiti.com.br/',
# Why: #2115 in Alexa global
'http://www.heise.de/',
# Why: #2117 in Alexa global
'http://www.wikispaces.com/',
# Why: #2118 in Alexa global
'http://www.google.com.bo/',
# Why: #2119 in Alexa global
'http://www.skyscrapercity.com/',
# Why: #2120 in Alexa global
'http://www.zaobao.com/',
# Why: #2121 in Alexa global
'http://www.pirateproxy.net/',
# Why: #2122 in Alexa global
'http://www.muyzorras.com/',
# Why: #2123 in Alexa global
'http://www.iza.ne.jp/',
# Why: #2124 in Alexa global
'http://www.entrepreneur.com/',
# Why: #2125 in Alexa global
'http://www.sxc.hu/',
# Why: #2126 in Alexa global
'http://www.superuser.com/',
# Why: #2127 in Alexa global
'http://www.jb51.net/',
# Why: #2128 in Alexa global
'http://www.bitsnoop.com/',
# Why: #2129 in Alexa global
'http://www.index.hu/',
# Why: #2130 in Alexa global
'http://www.tubexclips.com/',
# Why: #2131 in Alexa global
'http://www.symantec.com/',
# Why: #2132 in Alexa global
'http://www.sedo.com/',
# Why: #2133 in Alexa global
'http://www.gongchang.com/',
# Why: #2134 in Alexa global
'http://www.haibao.cn/',
# Why: #2135 in Alexa global
'http://www.newsmth.net/',
# Why: #2136 in Alexa global
'http://srclick.ru/',
# Why: #2137 in Alexa global
'http://www.bomnegocio.com/',
# Why: #2138 in Alexa global
'http://www.omegle.com/',
# Why: #2139 in Alexa global
'http://www.sweetpacks-search.com/',
# Why: #2140 in Alexa global
'http://www.000webhost.com/',
# Why: #2141 in Alexa global
'http://www.rencontreshard.com/',
# Why: #2142 in Alexa global
'http://www.jumei.com/',
# Why: #2143 in Alexa global
'http://www.acfun.tv/',
# Why: #2144 in Alexa global
'http://www.celebuzz.com/',
# Why: #2145 in Alexa global
'http://www.el-balad.com/',
# Why: #2146 in Alexa global
'http://www.wajam.com/',
# Why: #2147 in Alexa global
'http://www.zoopla.co.uk/',
# Why: #2148 in Alexa global
'http://sc4888.com/',
# Why: #2149 in Alexa global
'http://www.mobileaziende.it/',
# Why: #2150 in Alexa global
'http://www.officialsurvey.org/',
# Why: #2151 in Alexa global
'http://googleapis.com/',
# Why: #2152 in Alexa global
'http://www.mufg.jp/',
# Why: #2153 in Alexa global
'http://www.jobsdb.com/',
# Why: #2154 in Alexa global
'http://www.yahoo.com.cn/',
# Why: #2155 in Alexa global
'http://www.google.com.sv/',
# Why: #2156 in Alexa global
'http://www.freejobalert.com/',
# Why: #2157 in Alexa global
'http://www.walla.co.il/',
# Why: #2158 in Alexa global
'http://www.hollywoodreporter.com/',
# Why: #2159 in Alexa global
'http://www.shop-pro.jp/',
# Why: #2160 in Alexa global
'http://www.inc.com/',
# Why: #2161 in Alexa global
'http://www.bbandt.com/',
# Why: #2162 in Alexa global
'http://www.williamhill.com/',
# Why: #2163 in Alexa global
'http://www.jeu.info/',
# Why: #2164 in Alexa global
'http://www.vrbo.com/',
# Why: #2165 in Alexa global
'http://www.arabseed.com/',
# Why: #2166 in Alexa global
'http://www.spielaffe.de/',
# Why: #2167 in Alexa global
'http://www.wykop.pl/',
# Why: #2168 in Alexa global
'http://www.name.com/',
# Why: #2169 in Alexa global
'http://www.web-opinions.com/',
# Why: #2170 in Alexa global
'http://www.ehowenespanol.com/',
# Why: #2171 in Alexa global
'http://www.uuzu.com/',
# Why: #2173 in Alexa global
'http://www.cafepress.com/',
# Why: #2174 in Alexa global
'http://www.beeline.ru/',
# Why: #2175 in Alexa global
'http://www.searchenginejournal.com/',
# Why: #2176 in Alexa global
'http://mafengwo.cn/',
# Why: #2177 in Alexa global
'http://www.webex.com/',
# Why: #2178 in Alexa global
'http://www.zerohedge.com/',
# Why: #2179 in Alexa global
'http://www.cityads.ru/',
# Why: #2180 in Alexa global
'http://www.columbia.edu/',
# Why: #2181 in Alexa global
'http://jia.com/',
# Why: #2182 in Alexa global
'http://www.tistory.com/',
# Why: #2183 in Alexa global
'http://www.100bestbuy.com/',
# Why: #2184 in Alexa global
'http://www.realitykings.com/',
# Why: #2185 in Alexa global
'http://www.shopify.com/',
# Why: #2186 in Alexa global
'http://www.gametop.com/',
# Why: #2187 in Alexa global
'http://www.eharmony.com/',
# Why: #2188 in Alexa global
'http://www.ngoisao.net/',
# Why: #2189 in Alexa global
'http://www.angieslist.com/',
# Why: #2190 in Alexa global
'http://www.grotal.com/',
# Why: #2191 in Alexa global
'http://www.manhunt.net/',
# Why: #2192 in Alexa global
'http://www.adslgate.com/',
# Why: #2193 in Alexa global
'http://www.demotywatory.pl/',
# Why: #2194 in Alexa global
'http://www.enfemenino.com/',
# Why: #2195 in Alexa global
'http://www.yallakora.com/',
# Why: #2196 in Alexa global
'http://www.careesma.in/',
# Why: #2197 in Alexa global
'http://www.draugiem.lv/',
# Why: #2198 in Alexa global
'http://www.greatandhra.com/',
# Why: #2199 in Alexa global
'http://www.lifescript.com/',
# Why: #2201 in Alexa global
'http://www.androidcentral.com/',
# Why: #2202 in Alexa global
'http://www.wiley.com/',
# Why: #2203 in Alexa global
'http://www.alot.com/',
# Why: #2204 in Alexa global
'http://www.10010.com/',
# Why: #2205 in Alexa global
'http://www.next.co.uk/',
# Why: #2206 in Alexa global
'http://115.com/',
# Why: #2207 in Alexa global
'http://www.omgpm.com/',
# Why: #2208 in Alexa global
'http://www.mycalendarbook.com/',
# Why: #2209 in Alexa global
'http://www.playxn.com/',
# Why: #2210 in Alexa global
'http://www.niksalehi.com/',
# Why: #2211 in Alexa global
'http://www.serviporno.com/',
# Why: #2212 in Alexa global
'http://www.poste.it/',
# Why: #2213 in Alexa global
'http://kimiss.com/',
# Why: #2214 in Alexa global
'http://www.bearshare.com/',
# Why: #2215 in Alexa global
'http://www.clickpoint.com/',
# Why: #2216 in Alexa global
'http://www.seek.com.au/',
# Why: #2217 in Alexa global
'http://www.bab.la/',
# Why: #2218 in Alexa global
'http://www.ads8.com/',
# Why: #2219 in Alexa global
'http://www.viewster.com/',
# Why: #2220 in Alexa global
'http://www.ideacellular.com/',
# Why: #2221 in Alexa global
'http://www.tympanus.net/',
# Why: #2222 in Alexa global
'http://www.wwwblogto.com/',
# Why: #2223 in Alexa global
'http://www.tblop.com/',
# Why: #2224 in Alexa global
'http://elong.com/',
# Why: #2225 in Alexa global
'http://www.funnyordie.com/',
# Why: #2226 in Alexa global
'http://www.radikal.ru/',
# Why: #2227 in Alexa global
'http://www.rk.com/',
# Why: #2228 in Alexa global
'http://www.alarab.net/',
# Why: #2229 in Alexa global
'http://www.willhaben.at/',
# Why: #2230 in Alexa global
'http://www.infoseek.co.jp/',
# Why: #2231 in Alexa global
'http://www.beyond.com/',
# Why: #2232 in Alexa global
'http://www.punchng.com/',
# Why: #2233 in Alexa global
'http://www.viglink.com/',
# Why: #2234 in Alexa global
'http://www.microsoftstore.com/',
# Why: #2235 in Alexa global
'http://www.tripleclicks.com/',
# Why: #2236 in Alexa global
'http://www.m1905.com/',
# Why: #2237 in Alexa global
'http://www.ofreegames.com/',
# Why: #2238 in Alexa global
'http://www.s2d6.com/',
# Why: #2239 in Alexa global
'http://www.360buy.com/',
# Why: #2240 in Alexa global
'http://www.rakuten.com/',
# Why: #2241 in Alexa global
'http://www.evite.com/',
# Why: #2242 in Alexa global
'http://www.kompasiana.com/',
# Why: #2243 in Alexa global
'http://www.dailycaller.com/',
# Why: #2246 in Alexa global
'http://www.holidaycheck.de/',
# Why: #2248 in Alexa global
'http://www.imvu.com/',
# Why: #2249 in Alexa global
'http://www.unfranchise.com.tw/',
# Why: #2250 in Alexa global
'http://www.nate.com/',
# Why: #2251 in Alexa global
'http://fnac.com/',
# Why: #2252 in Alexa global
'http://www.htc.com/',
# Why: #2253 in Alexa global
'http://www.savenkeep.com/',
# Why: #2254 in Alexa global
'http://www.alfabank.ru/',
# Why: #2255 in Alexa global
'http://www.zaycev.net/',
# Why: #2256 in Alexa global
'http://www.vidtomp3.com/',
# Why: #2257 in Alexa global
'http://www.eluniversal.com.mx/',
# Why: #2258 in Alexa global
'http://haiwainet.cn/',
# Why: #2259 in Alexa global
'http://www.theatlantic.com/',
# Why: #2260 in Alexa global
'http://www.gamigo.de/',
# Why: #2261 in Alexa global
'http://www.lolking.net/',
# Why: #2262 in Alexa global
'http://www.wer-kennt-wen.de/',
# Why: #2263 in Alexa global
'http://www.stern.de/',
# Why: #2264 in Alexa global
'http://sport1.de/',
# Why: #2265 in Alexa global
'http://www.goalunited.org/',
# Why: #2266 in Alexa global
'http://www.discogs.com/',
# Why: #2267 in Alexa global
'http://www.whirlpool.net.au/',
# Why: #2268 in Alexa global
'http://www.savefrom.net/',
# Why: #2269 in Alexa global
'http://www.eurosport.fr/',
# Why: #2270 in Alexa global
'http://www.juegosjuegos.com/',
# Why: #2271 in Alexa global
'http://www.open24news.tv/',
# Why: #2272 in Alexa global
'http://www.zozo.jp/',
# Why: #2273 in Alexa global
'http://sinaapp.com/',
# Why: #2274 in Alexa global
'http://www.fuq.com/',
# Why: #2275 in Alexa global
'http://www.index.hr/',
# Why: #2276 in Alexa global
'http://www.realpopbid.com/',
# Why: #2277 in Alexa global
'http://www.rollingstone.com/',
# Why: #2278 in Alexa global
'http://www.globaltestmarket.com/',
# Why: #2279 in Alexa global
'http://www.seopult.ru/',
# Why: #2280 in Alexa global
'http://www.wumii.com/',
# Why: #2281 in Alexa global
'http://www.ford.com/',
# Why: #2282 in Alexa global
'http://www.cabelas.com/',
# Why: #2283 in Alexa global
'http://www.securepaynet.net/',
# Why: #2284 in Alexa global
'http://www.zhibo8.cc/',
# Why: #2285 in Alexa global
'http://www.jiji.com/',
# Why: #2286 in Alexa global
'http://www.gezinti.com/',
# Why: #2287 in Alexa global
'http://www.meb.gov.tr/',
# Why: #2288 in Alexa global
'http://www.classifiedads.com/',
# Why: #2289 in Alexa global
'http://www.kitco.com/',
# Why: #2290 in Alexa global
'http://www.incredimail.com/',
# Why: #2291 in Alexa global
'http://www.esmas.com/',
# Why: #2292 in Alexa global
'http://www.soccerway.com/',
# Why: #2293 in Alexa global
'http://www.rivals.com/',
# Why: #2294 in Alexa global
'http://www.prezi.com/',
# Why: #2295 in Alexa global
'http://www.shopping.com/',
# Why: #2296 in Alexa global
'http://www.superjob.ru/',
# Why: #2297 in Alexa global
'http://chinaacc.com/',
# Why: #2298 in Alexa global
'http://www.amoureux.com/',
# Why: #2299 in Alexa global
'http://www.mysmartprice.com/',
# Why: #2300 in Alexa global
'http://www.eleconomista.es/',
# Why: #2301 in Alexa global
'http://www.mercola.com/',
# Why: #2302 in Alexa global
'http://www.imlive.com/',
# Why: #2303 in Alexa global
'http://www.teacup.com/',
# Why: #2304 in Alexa global
'http://www.modelmayhem.com/',
# Why: #2305 in Alexa global
'http://www.nic.ru/',
# Why: #2306 in Alexa global
'http://www.brazzersnetwork.com/',
# Why: #2307 in Alexa global
'http://www.everything.org.uk/',
# Why: #2308 in Alexa global
'http://www.bhg.com/',
# Why: #2309 in Alexa global
'http://www.longhoo.net/',
# Why: #2311 in Alexa global
'http://www.superpages.com/',
# Why: #2312 in Alexa global
'http://www.tny.cz/',
# Why: #2313 in Alexa global
'http://www.yourfilezone.com/',
# Why: #2314 in Alexa global
'http://www.tuan800.com/',
# Why: #2315 in Alexa global
'http://www.streev.com/',
# Why: #2316 in Alexa global
'http://www.sedty.com/',
# Why: #2317 in Alexa global
'http://www.bol.uol.com.br/',
# Why: #2318 in Alexa global
'http://www.boxofficemojo.com/',
# Why: #2319 in Alexa global
'http://www.hollyscoop.com/',
# Why: #2320 in Alexa global
'http://www.safecart.com/',
# Why: #2321 in Alexa global
'http://www.almogaz.com/',
# Why: #2322 in Alexa global
'http://www.cashnhits.com/',
# Why: #2323 in Alexa global
'http://www.wetplace.com/',
# Why: #2324 in Alexa global
'http://www.freepik.com/',
# Why: #2325 in Alexa global
'http://www.rarbg.com/',
# Why: #2326 in Alexa global
'http://www.xxxbunker.com/',
# Why: #2327 in Alexa global
'http://www.prchecker.info/',
# Why: #2328 in Alexa global
'http://www.halifax-online.co.uk/',
# Why: #2329 in Alexa global
'http://www.trafficfactory.biz/',
# Why: #2330 in Alexa global
'http://www.telecinco.es/',
# Why: #2331 in Alexa global
'http://www.searchtermresults.com/',
# Why: #2332 in Alexa global
'http://www.unam.mx/',
# Why: #2333 in Alexa global
'http://www.akhbar-elwatan.com/',
# Why: #2335 in Alexa global
'http://lynda.com/',
# Why: #2336 in Alexa global
'http://www.yougetlaid.com/',
# Why: #2337 in Alexa global
'http://www.smart.com.au/',
# Why: #2338 in Alexa global
'http://www.advfn.com/',
# Why: #2339 in Alexa global
'http://www.unicredit.it/',
# Why: #2340 in Alexa global
'http://www.zomato.com/',
# Why: #2341 in Alexa global
'http://www.flirt.com/',
# Why: #2342 in Alexa global
'http://netease.com/',
# Why: #2343 in Alexa global
'http://www.bnpparibas.net/',
# Why: #2344 in Alexa global
'http://www.elcomercio.pe/',
# Why: #2345 in Alexa global
'http://www.mathrubhumi.com/',
# Why: #2346 in Alexa global
'http://www.koyotesoft.com/',
# Why: #2347 in Alexa global
'http://www.filmix.net/',
# Why: #2348 in Alexa global
'http://www.xnxxhdtube.com/',
# Why: #2349 in Alexa global
'http://www.ennaharonline.com/',
# Why: #2350 in Alexa global
'http://www.junbi-tracker.com/',
# Why: #2351 in Alexa global
'http://www.buzzdock.com/',
# Why: #2352 in Alexa global
'http://www.emirates.com/',
# Why: #2353 in Alexa global
'http://wikiwiki.jp/',
# Why: #2354 in Alexa global
'http://www.vivanuncios.com.mx/',
# Why: #2355 in Alexa global
'http://www.infojobs.net/',
# Why: #2356 in Alexa global
'http://www.smi2.ru/',
# Why: #2357 in Alexa global
'http://www.lotterypost.com/',
# Why: #2358 in Alexa global
'http://www.bandcamp.com/',
# Why: #2359 in Alexa global
'http://www.ekstrabladet.dk/',
# Why: #2360 in Alexa global
'http://www.nownews.com/',
# Why: #2361 in Alexa global
'http://www.bc.vc/',
# Why: #2362 in Alexa global
'http://www.google.com.af/',
# Why: #2364 in Alexa global
'http://www.ulmart.ru/',
# Why: #2365 in Alexa global
'http://www.estadao.com.br/',
# Why: #2366 in Alexa global
'http://www.politico.com/',
# Why: #2367 in Alexa global
'http://kl688.com/',
# Why: #2368 in Alexa global
'http://www.resellerclub.com/',
# Why: #2369 in Alexa global
'http://www.whois.net/',
# Why: #2370 in Alexa global
'http://www.seobuilding.ru/',
# Why: #2371 in Alexa global
'http://www.t411.me/',
# Why: #2372 in Alexa global
'http://googlesyndication.com/',
# Why: #2373 in Alexa global
'http://delfi.lt/',
# Why: #2374 in Alexa global
'http://www.eqla3.com/',
# Why: #2375 in Alexa global
'http://www.ali213.net/',
# Why: #2376 in Alexa global
'http://www.jma.go.jp/',
# Why: #2377 in Alexa global
'http://www.xvideos.jp/',
# Why: #2378 in Alexa global
'http://www.fanpage.it/',
# Why: #2379 in Alexa global
'http://www.uptobox.com/',
# Why: #2380 in Alexa global
'http://www.shinobi.jp/',
# Why: #2381 in Alexa global
'http://www.google.jo/',
# Why: #2382 in Alexa global
'http://cncn.com/',
# Why: #2383 in Alexa global
'http://www.sme.sk/',
# Why: #2384 in Alexa global
'http://www.kinozal.tv/',
# Why: #2385 in Alexa global
'http://www.ceconline.com/',
# Why: #2386 in Alexa global
'http://www.billboard.com/',
# Why: #2387 in Alexa global
'http://www.citi.com/',
# Why: #2388 in Alexa global
'http://www.naughtyamerica.com/',
# Why: #2389 in Alexa global
'http://www.classmates.com/',
# Why: #2390 in Alexa global
'http://www.coursera.org/',
# Why: #2391 in Alexa global
'http://www.pingan.com/',
# Why: #2392 in Alexa global
'http://www.voanews.com/',
# Why: #2393 in Alexa global
'http://www.tankionline.com/',
# Why: #2394 in Alexa global
'http://www.jetblue.com/',
# Why: #2395 in Alexa global
'http://www.spainshtranslation.com/',
# Why: #2396 in Alexa global
'http://www.ebookbrowse.com/',
# Why: #2397 in Alexa global
'http://www.met-art.com/',
# Why: #2398 in Alexa global
'http://www.megafon.ru/',
# Why: #2399 in Alexa global
'http://www.quibids.com/',
# Why: #2400 in Alexa global
'http://www.prcm.jp/',
# Why: #2401 in Alexa global
'http://www.smartfren.com/',
# Why: #2402 in Alexa global
'http://www.cleartrip.com/',
# Why: #2403 in Alexa global
'http://www.pixmania.com/',
# Why: #2405 in Alexa global
'http://www.vivastreet.com/',
# Why: #2406 in Alexa global
'http://www.thegfnetwork.com/',
# Why: #2407 in Alexa global
'http://www.paytm.com/',
# Why: #2408 in Alexa global
'http://www.meinsextagebuch.net/',
# Why: #2409 in Alexa global
'http://www.memecenter.com/',
# Why: #2410 in Alexa global
'http://www.ixbt.com/',
# Why: #2411 in Alexa global
'http://www.dagbladet.no/',
# Why: #2412 in Alexa global
'http://www.basecamphq.com/',
# Why: #2413 in Alexa global
'http://www.chinatimes.com/',
# Why: #2414 in Alexa global
'http://www.bubblews.com/',
# Why: #2415 in Alexa global
'http://www.xtool.ru/',
# Why: #2416 in Alexa global
'http://yoho.cn/',
# Why: #2417 in Alexa global
'http://www.opodo.co.uk/',
# Why: #2418 in Alexa global
'http://www.hattrick.org/',
# Why: #2419 in Alexa global
'http://www.zopim.com/',
# Why: #2420 in Alexa global
'http://www.aol.co.uk/',
# Why: #2421 in Alexa global
'http://www.gazzetta.gr/',
# Why: #2422 in Alexa global
'http://www.18andabused.com/',
# Why: #2423 in Alexa global
'http://www.panasonic.jp/',
# Why: #2424 in Alexa global
'http://www.mcssl.com/',
# Why: #2425 in Alexa global
'http://www.economist.com/',
# Why: #2426 in Alexa global
'http://www.zeit.de/',
# Why: #2427 in Alexa global
'http://www.google.com.uy/',
# Why: #2428 in Alexa global
'http://www.pinoy-ako.info/',
# Why: #2429 in Alexa global
'http://www.lazada.co.id/',
# Why: #2430 in Alexa global
'http://www.filgoal.com/',
# Why: #2431 in Alexa global
'http://www.rozetka.com.ua/',
# Why: #2432 in Alexa global
'http://www.almesryoon.com/',
# Why: #2433 in Alexa global
'http://www.csmonitor.com/',
# Why: #2434 in Alexa global
'http://www.bizjournals.com/',
# Why: #2435 in Alexa global
'http://www.rackspace.com/',
# Why: #2436 in Alexa global
'http://www.webgozar.com/',
# Why: #2437 in Alexa global
'http://www.opencart.com/',
# Why: #2438 in Alexa global
'http://www.mediaplex.com/',
# Why: #2439 in Alexa global
'http://www.deutsche-bank.de/',
# Why: #2440 in Alexa global
'http://www.similarsites.com/',
# Why: #2441 in Alexa global
'http://www.sotmarket.ru/',
# Why: #2442 in Alexa global
'http://www.chatzum.com/',
# Why: #2443 in Alexa global
'http://www.huffingtonpost.co.uk/',
# Why: #2444 in Alexa global
'http://www.carwale.com/',
# Why: #2445 in Alexa global
'http://www.memez.com/',
# Why: #2446 in Alexa global
'http://www.hostmonster.com/',
# Why: #2447 in Alexa global
'http://www.muzofon.com/',
# Why: #2448 in Alexa global
'http://www.elephanttube.com/',
# Why: #2449 in Alexa global
'http://www.crunchbase.com/',
# Why: #2450 in Alexa global
'http://www.imhonet.ru/',
# Why: #2451 in Alexa global
'http://www.lusongsong.com/',
# Why: #2452 in Alexa global
'http://www.filmesonlinegratis.net/',
# Why: #2453 in Alexa global
'http://www.giaoduc.net.vn/',
# Why: #2454 in Alexa global
'http://www.manhub.com/',
# Why: #2455 in Alexa global
'http://www.tatadocomo.com/',
# Why: #2458 in Alexa global
'http://www.realitatea.net/',
# Why: #2459 in Alexa global
'http://www.freemp3x.com/',
# Why: #2460 in Alexa global
'http://www.freemail.hu/',
# Why: #2461 in Alexa global
'http://www.ganool.com/',
# Why: #2462 in Alexa global
'http://www.feedreader.com/',
# Why: #2463 in Alexa global
'http://www.sportsdirect.com/',
# Why: #2464 in Alexa global
'http://www.videolan.org/',
# Why: #2465 in Alexa global
'http://www.watchseries.lt/',
# Why: #2466 in Alexa global
'http://www.rotapost.ru/',
# Why: #2467 in Alexa global
'http://www.nwolb.com/',
# Why: #2468 in Alexa global
'http://www.searchquotes.com/',
# Why: #2469 in Alexa global
'http://www.kaspersky.com/',
# Why: #2470 in Alexa global
'http://www.go2cloud.org/',
# Why: #2471 in Alexa global
'http://www.grepolis.com/',
# Why: #2472 in Alexa global
'http://fh21.com.cn/',
# Why: #2473 in Alexa global
'http://www.profit-partner.ru/',
# Why: #2475 in Alexa global
'http://www.articlesbase.com/',
# Why: #2476 in Alexa global
'http://www.dns-shop.ru/',
# Why: #2477 in Alexa global
'http://www.radikal.com.tr/',
# Why: #2478 in Alexa global
'http://www.justjared.com/',
# Why: #2479 in Alexa global
'http://www.lancenet.com.br/',
# Why: #2480 in Alexa global
'http://www.mangapanda.com/',
# Why: #2481 in Alexa global
'http://www.theglobeandmail.com/',
# Why: #2483 in Alexa global
'http://www.ecollege.com/',
# Why: #2484 in Alexa global
'http://www.myanimelist.net/',
# Why: #2485 in Alexa global
'http://www.immoral.jp/',
# Why: #2486 in Alexa global
'http://www.fotomac.com.tr/',
# Why: #2487 in Alexa global
'http://imanhua.com/',
# Why: #2488 in Alexa global
'http://www.travelzoo.com/',
# Why: #2489 in Alexa global
'http://www.jjwxc.net/',
# Why: #2490 in Alexa global
'http://www.q.gs/',
# Why: #2491 in Alexa global
'http://www.naaptol.com/',
# Why: #2492 in Alexa global
'http://www.sambaporno.com/',
# Why: #2493 in Alexa global
'http://www.macrojuegos.com/',
# Why: #2494 in Alexa global
'http://www.ooo-sex.com/',
# Why: #2495 in Alexa global
'http://www.fab.com/',
# Why: #2496 in Alexa global
'http://www.roflzone.com/',
# Why: #2497 in Alexa global
'http://www.searchcompletion.com/',
# Why: #2498 in Alexa global
'http://www.jezebel.com/',
# Why: #2499 in Alexa global
'http://bizdec.ru/',
# Why: #2500 in Alexa global
'http://www.torrentino.com/',
# Why: #2501 in Alexa global
'http://www.multitran.ru/',
# Why: #2502 in Alexa global
'http://www.tune-up.com/',
# Why: #2503 in Alexa global
'http://www.sparkpeople.com/',
# Why: #2505 in Alexa global
'http://www.desi-tashan.com/',
# Why: #2506 in Alexa global
'http://www.mashreghnews.ir/',
# Why: #2507 in Alexa global
'http://www.talktalk.co.uk/',
# Why: #2508 in Alexa global
'http://www.hinkhoj.com/',
# Why: #2509 in Alexa global
'http://www.20minutes.fr/',
# Why: #2510 in Alexa global
'http://www.sulia.com/',
# Why: #2511 in Alexa global
'http://www.icims.com/',
# Why: #2512 in Alexa global
'http://www.dizi-mag.com/',
# Why: #2513 in Alexa global
'http://www.webaslan.com/',
# Why: #2514 in Alexa global
'http://www.en.wordpress.com/',
# Why: #2515 in Alexa global
'http://www.funmoods.com/',
# Why: #2516 in Alexa global
'http://www.softgozar.com/',
# Why: #2517 in Alexa global
'http://www.starwoodhotels.com/',
# Why: #2518 in Alexa global
'http://www.studiopress.com/',
# Why: #2519 in Alexa global
'http://www.click.in/',
# Why: #2520 in Alexa global
'http://www.meetcheap.com/',
# Why: #2521 in Alexa global
'http://www.angel-live.com/',
# Why: #2522 in Alexa global
'http://www.beforeitsnews.com/',
# Why: #2524 in Alexa global
'http://www.trello.com/',
# Why: #2525 in Alexa global
'http://www.icontact.com/',
# Why: #2526 in Alexa global
'http://www.prlog.org/',
# Why: #2527 in Alexa global
'http://www.incentria.com/',
# Why: #2528 in Alexa global
'http://www.bouyguestelecom.fr/',
# Why: #2529 in Alexa global
'http://www.dstv.com/',
# Why: #2530 in Alexa global
'http://www.arstechnica.com/',
# Why: #2531 in Alexa global
'http://www.diigo.com/',
# Why: #2532 in Alexa global
'http://www.consumers-research.com/',
# Why: #2533 in Alexa global
'http://www.metaffiliation.com/',
# Why: #2534 in Alexa global
'http://www.telekom.de/',
# Why: #2535 in Alexa global
'http://www.izlesene.com/',
# Why: #2536 in Alexa global
'http://www.newsit.gr/',
# Why: #2537 in Alexa global
'http://www.fuckingawesome.com/',
# Why: #2538 in Alexa global
'http://www.osym.gov.tr/',
# Why: #2539 in Alexa global
'http://www.svyaznoy.ru/',
# Why: #2540 in Alexa global
'http://www.watchfreemovies.ch/',
# Why: #2541 in Alexa global
'http://www.gumtree.pl/',
# Why: #2542 in Alexa global
'http://www.sportbox.ru/',
# Why: #2543 in Alexa global
'http://www.reserverunessai.com/',
# Why: #2544 in Alexa global
'http://www.hsbc.com.hk/',
# Why: #2546 in Alexa global
'http://www.cricbuzz.com/',
# Why: #2547 in Alexa global
'http://www.djelfa.info/',
# Why: #2548 in Alexa global
'http://www.nouvelobs.com/',
# Why: #2549 in Alexa global
'http://www.aruba.it/',
# Why: #2550 in Alexa global
'http://www.homes.com/',
# Why: #2551 in Alexa global
'http://www.allezleslions.com/',
# Why: #2552 in Alexa global
'http://www.orkut.com.br/',
# Why: #2553 in Alexa global
'http://www.aionfreetoplay.com/',
# Why: #2554 in Alexa global
'http://www.academia.edu/',
# Why: #2555 in Alexa global
'http://www.blogosfera.uol.com.br/',
# Why: #2556 in Alexa global
'http://www.consumerreports.org/',
# Why: #2557 in Alexa global
'http://www.ilsole24ore.com/',
# Why: #2558 in Alexa global
'http://www.sephora.com/',
# Why: #2559 in Alexa global
'http://www.lds.org/',
# Why: #2560 in Alexa global
'http://vmall.com/',
# Why: #2561 in Alexa global
'http://www.ultimasnoticias.com.ve/',
# Why: #2562 in Alexa global
'http://www.healthgrades.com/',
# Why: #2563 in Alexa global
'http://www.imgbox.com/',
# Why: #2564 in Alexa global
'http://www.dlsite.com/',
# Why: #2565 in Alexa global
'http://www.whitesmoke.com/',
# Why: #2566 in Alexa global
'http://www.thenextweb.com/',
# Why: #2567 in Alexa global
'http://www.qire123.com/',
# Why: #2568 in Alexa global
'http://www.peeplo.com/',
# Why: #2569 in Alexa global
'http://www.chitika.com/',
# Why: #2570 in Alexa global
'http://www.alwafd.org/',
# Why: #2571 in Alexa global
'http://www.phonearena.com/',
# Why: #2572 in Alexa global
'http://www.ovh.com/',
# Why: #2573 in Alexa global
'http://www.tusfiles.net/',
# Why: #2574 in Alexa global
'http://www.18schoolgirlz.com/',
# Why: #2575 in Alexa global
'http://www.bongacams.com/',
# Why: #2576 in Alexa global
'http://www.home.pl/',
# Why: #2577 in Alexa global
'http://www.footmercato.net/',
# Why: #2579 in Alexa global
'http://www.sprashivai.ru/',
# Why: #2580 in Alexa global
'http://www.megafilmeshd.net/',
# Why: #2581 in Alexa global
'http://www.premium-display.com/',
# Why: #2582 in Alexa global
'http://www.clickey.com/',
# Why: #2584 in Alexa global
'http://www.tokyo-tube.com/',
# Why: #2585 in Alexa global
'http://www.watch32.com/',
# Why: #2586 in Alexa global
'http://www.pornolab.net/',
# Why: #2587 in Alexa global
'http://www.timewarnercable.com/',
# Why: #2588 in Alexa global
'http://www.naturalnews.com/',
# Why: #2589 in Alexa global
'http://www.afimet.com/',
# Why: #2590 in Alexa global
'http://www.telderi.ru/',
# Why: #2591 in Alexa global
'http://www.ioffer.com/',
# Why: #2592 in Alexa global
'http://www.lapatilla.com/',
# Why: #2593 in Alexa global
'http://www.livetv.ru/',
# Why: #2594 in Alexa global
'http://www.cloudflare.com/',
# Why: #2595 in Alexa global
'http://www.lupoporno.com/',
# Why: #2597 in Alexa global
'http://www.nhaccuatui.com/',
# Why: #2598 in Alexa global
'http://www.thepostgame.com/',
# Why: #2599 in Alexa global
'http://www.ipage.com/',
# Why: #2600 in Alexa global
'http://www.banesconline.com/',
# Why: #2601 in Alexa global
'http://www.cdc.gov/',
# Why: #2602 in Alexa global
'http://www.adonweb.ru/',
# Why: #2603 in Alexa global
'http://www.zone-telechargement.com/',
# Why: #2604 in Alexa global
'http://www.intellicast.com/',
# Why: #2605 in Alexa global
'http://www.uloz.to/',
# Why: #2606 in Alexa global
'http://www.pikabu.ru/',
# Why: #2607 in Alexa global
'http://www.megogo.net/',
# Why: #2608 in Alexa global
'http://www.wenxuecity.com/',
# Why: #2609 in Alexa global
'http://www.xml-sitemaps.com/',
# Why: #2610 in Alexa global
'http://www.webdunia.com/',
# Why: #2611 in Alexa global
'http://www.justhost.com/',
# Why: #2612 in Alexa global
'http://www.starbucks.com/',
# Why: #2613 in Alexa global
'http://www.wargaming.net/',
# Why: #2614 in Alexa global
'http://www.hugedomains.com/',
# Why: #2615 in Alexa global
'http://magicbricks.com/',
# Why: #2616 in Alexa global
'http://gigporno.com/',
# Why: #2617 in Alexa global
'http://www.rikunabi.com/',
# Why: #2618 in Alexa global
'http://www.51auto.com/',
# Why: #2619 in Alexa global
'http://www.warriorplus.com/',
# Why: #2620 in Alexa global
'http://www.gudvin.tv/',
# Why: #2621 in Alexa global
'http://www.bigmir.net/',
# Why: #2622 in Alexa global
'http://twipple.jp/',
# Why: #2623 in Alexa global
'http://www.ansa.it/',
# Why: #2624 in Alexa global
'http://www.standardbank.co.za/',
# Why: #2625 in Alexa global
'http://www.toshiba.com/',
# Why: #2626 in Alexa global
'http://www.xinnet.com/',
# Why: #2627 in Alexa global
'http://www.geico.com/',
# Why: #2629 in Alexa global
'http://www.funnyjunk.com/',
# Why: #2630 in Alexa global
'http://affaritaliani.it/',
# Why: #2631 in Alexa global
'http://www.cityheaven.net/',
# Why: #2632 in Alexa global
'http://www.tubewolf.com/',
# Why: #2633 in Alexa global
'http://www.google.org/',
# Why: #2634 in Alexa global
'http://www.ad.nl/',
# Why: #2635 in Alexa global
'http://www.tutorialspoint.com/',
# Why: #2638 in Alexa global
'http://www.uidai.gov.in/',
# Why: #2639 in Alexa global
'http://www.everydayhealth.com/',
# Why: #2640 in Alexa global
'http://www.jzip.com/',
# Why: #2641 in Alexa global
'http://www.lolspotsarticles.com/',
# Why: #2642 in Alexa global
'http://www.ana.co.jp/',
# Why: #2643 in Alexa global
'http://www.rueducommerce.fr/',
# Why: #2644 in Alexa global
'http://www.lvmama.com/',
# Why: #2645 in Alexa global
'http://www.roboform.com/',
# Why: #2646 in Alexa global
'http://www.zoznam.sk/',
# Why: #2647 in Alexa global
'http://www.livesmi.com/',
# Why: #2648 in Alexa global
'http://www.die-boersenformel.com/',
# Why: #2649 in Alexa global
'http://www.watchcartoononline.com/',
# Why: #2650 in Alexa global
'http://www.abclocal.go.com/',
# Why: #2651 in Alexa global
'http://www.techrepublic.com/',
# Why: #2652 in Alexa global
'http://www.just-fuck.com/',
# Why: #2653 in Alexa global
'http://www.camster.com/',
# Why: #2654 in Alexa global
'http://www.akairan.com/',
# Why: #2655 in Alexa global
'http://www.yeslibertin.com/',
# Why: #2656 in Alexa global
'http://www.abc.go.com/',
# Why: #2657 in Alexa global
'http://www.searchtherightwords.com/',
# Why: #2658 in Alexa global
'http://www.scotiabank.com/',
# Why: #2659 in Alexa global
'http://www.justclick.ru/',
# Why: #2660 in Alexa global
'http://www.douguo.com/',
# Why: #2661 in Alexa global
'http://www.discover.com/',
# Why: #2662 in Alexa global
'http://www.britishairways.com/',
# Why: #2663 in Alexa global
'http://www.mobafire.com/',
# Why: #2664 in Alexa global
'http://www.gi-akademie.ning.com/',
# Why: #2666 in Alexa global
'http://www.desirulez.net/',
# Why: #2667 in Alexa global
'http://www.qiushibaike.com/',
# Why: #2668 in Alexa global
'http://www.moonbasa.com/',
# Why: #2669 in Alexa global
'http://www.all.biz/',
# Why: #2670 in Alexa global
'http://www.tbs.co.jp/',
# Why: #2671 in Alexa global
'http://www.springer.com/',
# Why: #2672 in Alexa global
'http://www.emai.com/',
# Why: #2673 in Alexa global
'http://www.deadspin.com/',
# Why: #2674 in Alexa global
'http://www.hulkshare.com/',
# Why: #2675 in Alexa global
'http://www.fast-torrent.ru/',
# Why: #2676 in Alexa global
'http://www.oriflame.com/',
# Why: #2677 in Alexa global
'http://www.imgchili.net/',
# Why: #2678 in Alexa global
'http://www.mega-juegos.mx/',
# Why: #2679 in Alexa global
'http://www.gyazo.com/',
# Why: #2680 in Alexa global
'http://www.persianv.com/',
# Why: #2681 in Alexa global
'http://www.adk2.com/',
# Why: #2682 in Alexa global
'http://www.ingbank.pl/',
# Why: #2683 in Alexa global
'http://www.nationalconsumercenter.com/',
# Why: #2684 in Alexa global
'http://www.xxxkinky.com/',
# Why: #2685 in Alexa global
'http://www.mywot.com/',
# Why: #2686 in Alexa global
'http://www.gaymaletube.com/',
# Why: #2687 in Alexa global
'http://www.1tv.ru/',
# Why: #2688 in Alexa global
'http://www.manutd.com/',
# Why: #2689 in Alexa global
'http://www.merchantcircle.com/',
# Why: #2691 in Alexa global
'http://www.canalblog.com/',
# Why: #2692 in Alexa global
'http://www.capitalone360.com/',
# Why: #2693 in Alexa global
'http://www.tlbb8.com/',
# Why: #2694 in Alexa global
'http://www.softonic.fr/',
# Why: #2695 in Alexa global
'http://www.ccavenue.com/',
# Why: #2696 in Alexa global
'http://www.vector.co.jp/',
# Why: #2697 in Alexa global
'http://www.tyroodr.com/',
# Why: #2698 in Alexa global
'http://exam8.com/',
# Why: #2699 in Alexa global
'http://www.allmusic.com/',
# Why: #2700 in Alexa global
'http://www.stubhub.com/',
# Why: #2701 in Alexa global
'http://www.arcor.de/',
# Why: #2702 in Alexa global
'http://www.yolasite.com/',
# Why: #2703 in Alexa global
'http://www.haraj.com.sa/',
# Why: #2704 in Alexa global
'http://www.mypopup.ir/',
# Why: #2705 in Alexa global
'http://www.memurlar.net/',
# Why: #2706 in Alexa global
'http://www.smugmug.com/',
# Why: #2707 in Alexa global
'http://www.filefactory.com/',
# Why: #2708 in Alexa global
'http://www.fantasti.cc/',
# Why: #2709 in Alexa global
'http://www.bokra.net/',
# Why: #2710 in Alexa global
'http://www.goarticles.com/',
# Why: #2711 in Alexa global
'http://www.empowernetwork.com/2Se8w/',
# Why: #2712 in Alexa global
'http://www.moneysavingexpert.com/',
# Why: #2713 in Alexa global
'http://www.donga.com/',
# Why: #2714 in Alexa global
'http://www.lastminute.com/',
# Why: #2715 in Alexa global
'http://www.xkcd.com/',
# Why: #2716 in Alexa global
'http://www.sou300.com/',
# Why: #2717 in Alexa global
'http://www.magnovideo.com/',
# Why: #2718 in Alexa global
'http://www.inquirer.net/',
# Why: #2719 in Alexa global
'http://www.phoenix.edu/',
# Why: #2721 in Alexa global
'http://www.videogenesis.com/',
# Why: #2722 in Alexa global
'http://www.thestar.com/',
# Why: #2723 in Alexa global
'http://www.tripadvisor.es/',
# Why: #2724 in Alexa global
'http://www.blankrefer.com/',
# Why: #2725 in Alexa global
'http://www.yle.fi/',
# Why: #2726 in Alexa global
'http://www.beamtele.com/',
# Why: #2727 in Alexa global
'http://www.oanda.com/',
# Why: #2728 in Alexa global
'http://www.yaplog.jp/',
# Why: #2729 in Alexa global
'http://www.iheart.com/',
# Why: #2730 in Alexa global
'http://www.google.co.tz/',
# Why: #2731 in Alexa global
'http://www.stargazete.com/',
# Why: #2732 in Alexa global
'http://www.bossip.com/',
# Why: #2733 in Alexa global
'http://www.defaultsear.ch/',
# Why: #2734 in Alexa global
'http://www.thaiseoboard.com/',
# Why: #2735 in Alexa global
'http://www.qinbei.com/',
# Why: #2736 in Alexa global
'http://www.ninisite.com/',
# Why: #2737 in Alexa global
'http://www.j.gs/',
# Why: #2738 in Alexa global
'http://www.xinmin.cn/',
# Why: #2739 in Alexa global
'http://www.nos.nl/',
# Why: #2740 in Alexa global
'http://www.qualtrics.com/',
# Why: #2741 in Alexa global
'http://www.kommersant.ru/',
# Why: #2743 in Alexa global
'http://www.urban-rivals.com/',
# Why: #2744 in Alexa global
'http://www.computerbild.de/',
# Why: #2745 in Alexa global
'http://www.fararu.com/',
# Why: #2746 in Alexa global
'http://www.menshealth.com/',
# Why: #2747 in Alexa global
'http://www.jobstreet.com/',
# Why: #2749 in Alexa global
'http://www.rbcroyalbank.com/',
# Why: #2750 in Alexa global
'http://www.inmotionhosting.com/',
# Why: #2751 in Alexa global
'http://www.surveyrouter.com/',
# Why: #2752 in Alexa global
'http://www.kankanews.com/',
# Why: #2753 in Alexa global
'http://www.aol.de/',
# Why: #2754 in Alexa global
'http://www.bol.com/',
# Why: #2755 in Alexa global
'http://www.datpiff.com/',
# Why: #2757 in Alexa global
'http://mplife.com/',
# Why: #2758 in Alexa global
'http://www.sale-fire.com/',
# Why: #2759 in Alexa global
'http://www.inbox.lv/',
# Why: #2760 in Alexa global
'http://www.offeratum.com/',
# Why: #2761 in Alexa global
'http://www.pandora.tv/',
# Why: #2762 in Alexa global
'http://www.eltiempo.com/',
# Why: #2763 in Alexa global
'http://www.indiarailinfo.com/',
# Why: #2764 in Alexa global
'http://www.solidtrustpay.com/',
# Why: #2765 in Alexa global
'http://www.warthunder.ru/',
# Why: #2766 in Alexa global
'http://www.kuronekoyamato.co.jp/',
# Why: #2767 in Alexa global
'http://www.novamov.com/',
# Why: #2768 in Alexa global
'http://www.folkd.com/',
# Why: #2769 in Alexa global
'http://www.envato.com/',
# Why: #2770 in Alexa global
'http://www.wetpaint.com/',
# Why: #2771 in Alexa global
'http://www.tempo.co/',
# Why: #2772 in Alexa global
'http://www.howtogeek.com/',
# Why: #2773 in Alexa global
'http://www.foundationapi.com/',
# Why: #2774 in Alexa global
'http://www.zjol.com.cn/',
# Why: #2775 in Alexa global
'http://www.care2.com/',
# Why: #2776 in Alexa global
'http://www.bendibao.com/',
# Why: #2777 in Alexa global
'http://www.mazika2day.com/',
# Why: #2779 in Alexa global
'http://www.asda.com/',
# Why: #2780 in Alexa global
'http://www.nowvideo.ch/',
# Why: #2781 in Alexa global
'http://www.hiapk.com/',
# Why: #2782 in Alexa global
'http://17u.com/',
# Why: #2783 in Alexa global
'http://www.tutu.ru/',
# Why: #2784 in Alexa global
'http://www.ncdownloader.com/',
# Why: #2785 in Alexa global
'http://www.warez-bb.org/',
# Why: #2786 in Alexa global
'http://www.jsoftj.com/',
# Why: #2787 in Alexa global
'http://www.batepapo.uol.com.br/',
# Why: #2788 in Alexa global
'http://www.xmarks.com/',
# Why: #2789 in Alexa global
'http://www.36kr.com/',
# Why: #2790 in Alexa global
'http://www.runetki.com/',
# Why: #2791 in Alexa global
'http://www.quoka.de/',
# Why: #2792 in Alexa global
'http://www.heureka.cz/',
# Why: #2793 in Alexa global
'http://www.sbisec.co.jp/',
# Why: #2794 in Alexa global
'http://www.monografias.com/',
# Why: #2796 in Alexa global
'http://www.zhenai.com/',
# Why: #2797 in Alexa global
'http://www.4porn.com/',
# Why: #2798 in Alexa global
'http://www.antena3.com/',
# Why: #2799 in Alexa global
'http://lintas.me/',
# Why: #2800 in Alexa global
'http://www.seroundtable.com/',
# Why: #2802 in Alexa global
'http://www.e1.ru/',
# Why: #2803 in Alexa global
'http://www.berkeley.edu/',
# Why: #2804 in Alexa global
'http://www.officedepot.com/',
# Why: #2805 in Alexa global
'http://www.myflorida.com/',
# Why: #2806 in Alexa global
'http://www.parispornmovies.com/',
# Why: #2807 in Alexa global
'http://www.uniqlo.com/',
# Why: #2808 in Alexa global
'http://www.topky.sk/',
# Why: #2809 in Alexa global
'http://www.lumovies.com/',
# Why: #2810 in Alexa global
'http://www.buysellads.com/',
# Why: #2811 in Alexa global
'http://www.stirileprotv.ro/',
# Why: #2812 in Alexa global
'http://www.scottrade.com/',
# Why: #2813 in Alexa global
'http://www.tiboo.cn/',
# Why: #2814 in Alexa global
'http://www.mmtrends.net/',
# Why: #2815 in Alexa global
'http://www.wholesale-dress.net/',
# Why: #2816 in Alexa global
'http://www.metacritic.com/',
# Why: #2817 in Alexa global
'http://www.pichunter.com/',
# Why: #2818 in Alexa global
'http://www.moneybookers.com/',
# Why: #2819 in Alexa global
'http://www.idealista.com/',
# Why: #2820 in Alexa global
'http://www.buzzle.com/',
# Why: #2821 in Alexa global
'http://www.rcom.co.in/',
# Why: #2822 in Alexa global
'http://www.weightwatchers.com/',
# Why: #2823 in Alexa global
'http://www.itv.com/',
# Why: #2824 in Alexa global
'http://www.inilah.com/',
# Why: #2825 in Alexa global
'http://www.vic.gov.au/',
# Why: #2826 in Alexa global
'http://www.prom.ua/',
# Why: #2827 in Alexa global
'http://www.with2.net/',
# Why: #2828 in Alexa global
'http://www.suumo.jp/',
# Why: #2830 in Alexa global
'http://www.doodle.com/',
# Why: #2831 in Alexa global
'http://www.trafficbroker.com/',
# Why: #2832 in Alexa global
'http://www.h33t.com/',
# Why: #2833 in Alexa global
'http://www.avaaz.org/',
# Why: #2834 in Alexa global
'http://www.maultalk.com/',
# Why: #2835 in Alexa global
'http://www.bmo.com/',
# Why: #2836 in Alexa global
'http://www.nerdbux.com/',
# Why: #2837 in Alexa global
'http://www.abnamro.nl/',
# Why: #2838 in Alexa global
'http://www.didigames.com/',
# Why: #2839 in Alexa global
'http://www.pornorama.com/',
# Why: #2840 in Alexa global
'http://www.forumotion.com/',
# Why: #2841 in Alexa global
'http://www.woman.ru/',
# Why: #2843 in Alexa global
'http://www.thaivisa.com/',
# Why: #2844 in Alexa global
'http://www.lexpress.fr/',
# Why: #2845 in Alexa global
'http://www.forumcommunity.net/',
# Why: #2846 in Alexa global
'http://www.regions.com/',
# Why: #2847 in Alexa global
'http://www.sf-express.com/',
# Why: #2848 in Alexa global
'http://www.donkeymails.com/',
# Why: #2849 in Alexa global
'http://www.clubic.com/',
# Why: #2850 in Alexa global
'http://www.aucfan.com/',
# Why: #2851 in Alexa global
'http://www.enterfactory.com/',
# Why: #2852 in Alexa global
'http://www.yandex.com/',
# Why: #2853 in Alexa global
'http://www.iherb.com/',
# Why: #2854 in Alexa global
'http://www.in.gr/',
# Why: #2855 in Alexa global
'http://www.olx.pt/',
# Why: #2856 in Alexa global
'http://www.fbdownloader.com/',
# Why: #2857 in Alexa global
'http://www.autoscout24.it/',
# Why: #2858 in Alexa global
'http://www.siteground.com/',
# Why: #2859 in Alexa global
'http://www.psicofxp.com/',
# Why: #2860 in Alexa global
'http://www.persiangig.com/',
# Why: #2861 in Alexa global
'http://www.metroer.com/',
# Why: #2862 in Alexa global
'http://www.tokopedia.com/',
# Why: #2863 in Alexa global
'http://www.seccam.info/',
# Why: #2864 in Alexa global
'http://www.sport-express.ru/',
# Why: #2865 in Alexa global
'http://www.vodafone.it/',
# Why: #2866 in Alexa global
'http://www.blekko.com/',
# Why: #2867 in Alexa global
'http://www.entekhab.ir/',
# Why: #2868 in Alexa global
'http://www.expressen.se/',
# Why: #2869 in Alexa global
'http://www.zalando.fr/',
# Why: #2870 in Alexa global
'http://525j.com.cn/',
# Why: #2871 in Alexa global
'http://www.hawaaworld.com/',
# Why: #2872 in Alexa global
'http://www.freeonlinegames.com/',
# Why: #2873 in Alexa global
'http://www.google.com.lb/',
# Why: #2874 in Alexa global
'http://www.oricon.co.jp/',
# Why: #2875 in Alexa global
'http://www.apple.com.cn/',
# Why: #2876 in Alexa global
'http://www.ab-in-den-urlaub.de/',
# Why: #2877 in Alexa global
'http://www.android4tw.com/',
# Why: #2879 in Alexa global
'http://www.alriyadh.com/',
# Why: #2880 in Alexa global
'http://www.drugstore.com/',
# Why: #2881 in Alexa global
'http://www.iobit.com/',
# Why: #2882 in Alexa global
'http://www.rei.com/',
# Why: #2883 in Alexa global
'http://www.racing-games.com/',
# Why: #2884 in Alexa global
'http://www.mommyfucktube.com/',
# Why: #2885 in Alexa global
'http://www.pideo.net/',
# Why: #2886 in Alexa global
'http://www.gogoanime.com/',
# Why: #2887 in Alexa global
'http://www.avaxho.me/',
# Why: #2888 in Alexa global
'http://www.christianmingle.com/',
# Why: #2889 in Alexa global
'http://www.activesearchresults.com/',
# Why: #2890 in Alexa global
'http://www.trendsonline.biz/',
# Why: #2891 in Alexa global
'http://www.planetsuzy.org/',
# Why: #2892 in Alexa global
'http://www.rubias19.com/',
# Why: #2893 in Alexa global
'http://www.cleverbridge.com/',
# Why: #2894 in Alexa global
'http://www.jeevansathi.com/',
# Why: #2895 in Alexa global
'http://www.washingtontimes.com/',
# Why: #2896 in Alexa global
'http://www.lcl.fr/',
# Why: #2897 in Alexa global
'http://www.98ia.com/',
# Why: #2899 in Alexa global
'http://www.mercadolibre.com.co/',
# Why: #2900 in Alexa global
'http://www.caijing.com.cn/',
# Why: #2902 in Alexa global
'http://www.n-tv.de/',
# Why: #2903 in Alexa global
'http://www.divyabhaskar.co.in/',
# Why: #2905 in Alexa global
'http://www.airbnb.com/',
# Why: #2907 in Alexa global
'http://www.mybrowserbar.com/',
# Why: #2908 in Alexa global
'http://www.travian.com/',
# Why: #2909 in Alexa global
'http://www.autoblog.com/',
# Why: #2910 in Alexa global
'http://www.blesk.cz/',
# Why: #2911 in Alexa global
'http://www.playboy.com/',
# Why: #2912 in Alexa global
'http://www.p30download.com/',
# Why: #2913 in Alexa global
'http://www.pazienti.net/',
# Why: #2914 in Alexa global
'http://www.uast.ac.ir/',
# Why: #2915 in Alexa global
'http://www.logsoku.com/',
# Why: #2916 in Alexa global
'http://www.zedge.net/',
# Why: #2917 in Alexa global
'http://www.creditmutuel.fr/',
# Why: #2918 in Alexa global
'http://www.absa.co.za/',
# Why: #2919 in Alexa global
'http://www.milliyet.tv/',
# Why: #2920 in Alexa global
'http://www.jiathis.com/',
# Why: #2921 in Alexa global
'http://www.liverpoolfc.tv/',
# Why: #2922 in Alexa global
'http://www.104.com.tw/',
# Why: #2923 in Alexa global
'http://www.dospy.com/',
# Why: #2924 in Alexa global
'http://www.ems.com.cn/',
# Why: #2925 in Alexa global
'http://www.calameo.com/',
# Why: #2926 in Alexa global
'http://www.netsuite.com/',
# Why: #2927 in Alexa global
'http://www.angelfire.com/',
# Why: #2929 in Alexa global
'http://www.snagajob.com/',
# Why: #2930 in Alexa global
'http://www.hollywoodlife.com/',
# Why: #2931 in Alexa global
'http://www.techtudo.com.br/',
# Why: #2932 in Alexa global
'http://www.payserve.com/',
# Why: #2933 in Alexa global
'http://www.portalnet.cl/',
# Why: #2934 in Alexa global
'http://www.worldadult-videos.info/',
# Why: #2935 in Alexa global
'http://www.indianpornvideos.com/',
# Why: #2936 in Alexa global
'http://www.france24.com/',
# Why: #2937 in Alexa global
'http://www.discuss.com.hk/',
# Why: #2938 in Alexa global
'http://www.theplanet.com/',
# Why: #2939 in Alexa global
'http://www.advego.ru/',
# Why: #2940 in Alexa global
'http://www.dion.ne.jp/',
# Why: #2941 in Alexa global
'http://starbaby.cn/',
# Why: #2942 in Alexa global
'http://www.eltiempo.es/',
# Why: #2943 in Alexa global
'http://www.55tuan.com/',
# Why: #2944 in Alexa global
'http://www.snopes.com/',
# Why: #2945 in Alexa global
'http://www.startnow.com/',
# Why: #2946 in Alexa global
'http://www.tucarro.com/',
# Why: #2947 in Alexa global
'http://www.skyscanner.net/',
# Why: #2948 in Alexa global
'http://www.wchonline.com/',
# Why: #2949 in Alexa global
'http://www.gaadi.com/',
# Why: #2950 in Alexa global
'http://www.lindaikeji.blogspot.com/',
# Why: #2952 in Alexa global
'http://www.keywordblocks.com/',
# Why: #2953 in Alexa global
'http://www.apsense.com/',
# Why: #2954 in Alexa global
'http://www.avangate.com/',
# Why: #2955 in Alexa global
'http://www.gandul.info/',
# Why: #2956 in Alexa global
'http://www.google.com.gh/',
# Why: #2957 in Alexa global
'http://www.mybigcommerce.com/',
# Why: #2958 in Alexa global
'http://www.homeaway.com/',
# Why: #2959 in Alexa global
'http://www.wikitravel.org/',
# Why: #2960 in Alexa global
'http://www.etxt.ru/',
# Why: #2961 in Alexa global
'http://www.zerx.ru/',
# Why: #2962 in Alexa global
'http://www.sidereel.com/',
# Why: #2963 in Alexa global
'http://www.edreams.es/',
# Why: #2964 in Alexa global
'http://www.india-forums.com/',
# Why: #2966 in Alexa global
'http://www.infonews.com/',
# Why: #2967 in Alexa global
'http://www.zoominfo.com/',
# Why: #2968 in Alexa global
'http://www.stylebistro.com/',
# Why: #2969 in Alexa global
'http://www.dominos.com/',
# Why: #2970 in Alexa global
'http://591hx.com/',
# Why: #2971 in Alexa global
'http://www.authorize.net/',
# Why: #2972 in Alexa global
'http://www.61baobao.com/',
# Why: #2973 in Alexa global
'http://www.digitalspy.co.uk/',
# Why: #2974 in Alexa global
'http://www.godvine.com/',
# Why: #2975 in Alexa global
'http://www.rednowtube.com/',
# Why: #2976 in Alexa global
'http://www.sony.jp/',
# Why: #2977 in Alexa global
'http://www.appbank.net/',
# Why: #2978 in Alexa global
'http://www.woozgo.fr/',
# Why: #2979 in Alexa global
'http://www.expireddomains.net/',
# Why: #2980 in Alexa global
'http://www.my-uq.com/',
# Why: #2981 in Alexa global
'http://www.peliculasyonkis.com/',
# Why: #2982 in Alexa global
'http://www.forumfree.it/',
# Why: #2983 in Alexa global
'http://www.shangdu.com/',
# Why: #2984 in Alexa global
'http://www.startmyripple.com/',
# Why: #2985 in Alexa global
'http://www.hottube.me/',
# Why: #2986 in Alexa global
'http://www.members.webs.com/',
# Why: #2987 in Alexa global
'http://www.blick.ch/',
# Why: #2988 in Alexa global
'http://www.google.cm/',
# Why: #2989 in Alexa global
'http://iautos.cn/',
# Why: #2990 in Alexa global
'http://www.tomtom.com/',
# Why: #2992 in Alexa global
'http://www.rzd.ru/',
# Why: #2993 in Alexa global
'http://www.opensooq.com/',
# Why: #2995 in Alexa global
'http://www.pizzahut.com/',
# Why: #2996 in Alexa global
'http://www.marksandspencer.com/',
# Why: #2997 in Alexa global
'http://www.filenuke.com/',
# Why: #2998 in Alexa global
'http://www.filelist.ro/',
# Why: #2999 in Alexa global
'http://www.akharinnews.com/',
# Why: #3000 in Alexa global
'http://www.etrade.com/',
# Why: #3002 in Alexa global
'http://www.planetromeo.com/',
# Why: #3003 in Alexa global
'http://www.wpbeginner.com/',
# Why: #3004 in Alexa global
'http://www.bancomercantil.com/',
# Why: #3005 in Alexa global
'http://www.pastdate.com/',
# Why: #3006 in Alexa global
'http://www.webutation.net/',
# Why: #3007 in Alexa global
'http://www.mywebgrocer.com/',
# Why: #3008 in Alexa global
'http://www.mobile.ir/',
# Why: #3009 in Alexa global
'http://www.seemorgh.com/',
# Why: #3010 in Alexa global
'http://www.nhs.uk/',
# Why: #3011 in Alexa global
'http://www.google.ba/',
# Why: #3012 in Alexa global
'http://ileehoo.com/',
# Why: #3013 in Alexa global
'http://www.seobook.com/',
# Why: #3014 in Alexa global
'http://www.wetteronline.de/',
# Why: #3015 in Alexa global
'http://www.happy-porn.com/',
# Why: #3016 in Alexa global
'http://www.theonion.com/',
# Why: #3017 in Alexa global
'http://www.webnode.com/',
# Why: #3018 in Alexa global
'http://www.svaiza.com/',
# Why: #3019 in Alexa global
'http://www.newsbomb.gr/',
# Why: #3020 in Alexa global
'http://www.t88u.com/',
# Why: #3021 in Alexa global
'http://www.tsn.ca/',
# Why: #3022 in Alexa global
'http://www.unity3d.com/',
# Why: #3023 in Alexa global
'http://www.nseindia.com/',
# Why: #3024 in Alexa global
'http://www.juegosdiarios.com/',
# Why: #3025 in Alexa global
'http://www.genieo.com/',
# Why: #3026 in Alexa global
'http://www.kelkoo.com/',
# Why: #3027 in Alexa global
'http://gome.com.cn/',
# Why: #3028 in Alexa global
'http://www.shabdkosh.com/',
# Why: #3029 in Alexa global
'http://www.tecmundo.com.br/',
# Why: #3030 in Alexa global
'http://www.chinaunix.net/',
# Why: #3031 in Alexa global
'http://pchouse.com.cn/',
# Why: #3032 in Alexa global
'http://www.goo-net.com/',
# Why: #3033 in Alexa global
'http://www.asana.com/',
# Why: #3035 in Alexa global
'http://www.hdporn.in/',
# Why: #3036 in Alexa global
'http://www.bannersbroker.com/user/adpubcombo_dashboard/',
# Why: #3037 in Alexa global
'http://www.virtapay.com/',
# Why: #3038 in Alexa global
'http://www.jobdiagnosis.com/',
# Why: #3039 in Alexa global
'http://guokr.com/',
# Why: #3040 in Alexa global
'http://www.clickpoint.it/',
# Why: #3041 in Alexa global
'http://3dmgame.com/',
# Why: #3042 in Alexa global
'http://www.ashleymadison.com/',
# Why: #3043 in Alexa global
'http://www.utsprofitads.com/',
# Why: #3044 in Alexa global
'http://www.google.ee/',
# Why: #3045 in Alexa global
'http://www.365jia.cn/',
# Why: #3046 in Alexa global
'http://www.oyunskor.com/',
# Why: #3047 in Alexa global
'http://www.metro.co.uk/',
# Why: #3048 in Alexa global
'http://www.ebaumsworld.com/',
# Why: #3049 in Alexa global
'http://www.realsimple.com/',
# Why: #3050 in Alexa global
'http://www.3file.info/',
# Why: #3051 in Alexa global
'http://www.xcams.com/',
# Why: #3052 in Alexa global
'http://www.cyberforum.ru/',
# Why: #3053 in Alexa global
'http://www.babble.com/',
# Why: #3054 in Alexa global
'http://www.lidl.de/',
# Why: #3055 in Alexa global
'http://www.pixer.mobi/',
# Why: #3056 in Alexa global
'http://www.yell.com/',
# Why: #3057 in Alexa global
'http://www.alnilin.com/',
# Why: #3058 in Alexa global
'http://www.lurkmore.to/',
# Why: #3059 in Alexa global
'http://www.olx.co.za/',
# Why: #3060 in Alexa global
'http://www.eorezo.com/',
# Why: #3061 in Alexa global
'http://www.baby.ru/',
# Why: #3062 in Alexa global
'http://www.xdf.cn/',
# Why: #3063 in Alexa global
'http://www.redporntube.com/',
# Why: #3064 in Alexa global
'http://www.extabit.com/',
# Why: #3065 in Alexa global
'http://www.wayn.com/',
# Why: #3066 in Alexa global
'http://www.gaana.com/',
# Why: #3067 in Alexa global
'http://www.islamicfinder.org/',
# Why: #3068 in Alexa global
'http://www.venturebeat.com/',
# Why: #3069 in Alexa global
'http://www.played.to/',
# Why: #3070 in Alexa global
'http://www.alrakoba.net/',
# Why: #3071 in Alexa global
'http://www.mouthshut.com/',
# Why: #3072 in Alexa global
'http://www.banquepopulaire.fr/',
# Why: #3073 in Alexa global
'http://www.jal.co.jp/',
# Why: #3074 in Alexa global
'http://www.dasoertliche.de/',
# Why: #3075 in Alexa global
'http://www.1stwebdesigner.com/',
# Why: #3076 in Alexa global
'http://www.tam.com.br/',
# Why: #3077 in Alexa global
'http://www.nature.com/',
# Why: #3078 in Alexa global
'http://www.camfrog.com/',
# Why: #3079 in Alexa global
'http://www.philly.com/',
# Why: #3080 in Alexa global
'http://www.zemtv.com/',
# Why: #3081 in Alexa global
'http://www.oprah.com/',
# Why: #3082 in Alexa global
'http://www.wmaraci.com/',
# Why: #3083 in Alexa global
'http://www.ruvr.ru/',
# Why: #3084 in Alexa global
'http://www.gsn.com/',
# Why: #3085 in Alexa global
'http://www.acrobat.com/',
# Why: #3086 in Alexa global
'http://www.depositfiles.org/',
# Why: #3087 in Alexa global
'http://www.smartresponder.ru/',
# Why: #3088 in Alexa global
'http://www.huxiu.com/',
# Why: #3089 in Alexa global
'http://www.porn-wanted.com/',
# Why: #3090 in Alexa global
'http://www.tripadvisor.fr/',
# Why: #3091 in Alexa global
'http://3366.com/',
# Why: #3092 in Alexa global
'http://www.ranker.com/',
# Why: #3093 in Alexa global
'http://www.cibc.com/',
# Why: #3094 in Alexa global
'http://www.trend.az/',
# Why: #3095 in Alexa global
'http://www.whatsapp.com/',
# Why: #3096 in Alexa global
'http://07073.com/',
# Why: #3097 in Alexa global
'http://www.netload.in/',
# Why: #3098 in Alexa global
'http://www.channel4.com/',
# Why: #3099 in Alexa global
'http://www.yatra.com/',
# Why: #3100 in Alexa global
'http://www.elconfidencial.com/',
# Why: #3101 in Alexa global
'http://www.labnol.org/',
# Why: #3102 in Alexa global
'http://www.google.co.ke/',
# Why: #3103 in Alexa global
'http://www.disneylatino.com/',
# Why: #3104 in Alexa global
'http://www.pconverter.com/',
# Why: #3105 in Alexa global
'http://www.cqnews.net/',
# Why: #3106 in Alexa global
'http://www.blog.co.uk/',
# Why: #3107 in Alexa global
'http://www.immowelt.de/',
# Why: #3108 in Alexa global
'http://www.crunchyroll.com/',
# Why: #3109 in Alexa global
'http://www.gamesgames.com/',
# Why: #3110 in Alexa global
'http://www.protothema.gr/',
# Why: #3111 in Alexa global
'http://www.vmoptions.com/',
# Why: #3112 in Alexa global
'http://www.go2jump.org/',
# Why: #3113 in Alexa global
'http://www.psu.edu/',
# Why: #3114 in Alexa global
'http://www.sanjesh.org/',
# Why: #3115 in Alexa global
'http://www.sportingnews.com/',
# Why: #3116 in Alexa global
'http://www.televisionfanatic.com/',
# Why: #3117 in Alexa global
'http://www.fansshare.com/',
# Why: #3118 in Alexa global
'http://www.xcams4u.com/',
# Why: #3119 in Alexa global
'http://www.dict.cn/',
# Why: #3120 in Alexa global
'http://www.madthumbs.com/',
# Why: #3121 in Alexa global
'http://www.ebates.com/',
# Why: #3122 in Alexa global
'http://www.eromon.net/',
# Why: #3123 in Alexa global
'http://www.copyblogger.com/',
# Why: #3124 in Alexa global
'http://www.flirt4free.com/',
# Why: #3125 in Alexa global
'http://www.gaytube.com/',
# Why: #3126 in Alexa global
'http://www.notdoppler.com/',
# Why: #3127 in Alexa global
'http://www.allmyvideos.net/',
# Why: #3128 in Alexa global
'http://www.cam4.de.com/',
# Why: #3129 in Alexa global
'http://www.chosun.com/',
# Why: #3130 in Alexa global
'http://www.adme.ru/',
# Why: #3131 in Alexa global
'http://www.codeplex.com/',
# Why: #3132 in Alexa global
'http://www.jumia.com.ng/',
# Why: #3133 in Alexa global
'http://www.digitaltrends.com/',
# Why: #3134 in Alexa global
'http://www.b92.net/',
# Why: #3135 in Alexa global
'http://www.miniinthebox.com/',
# Why: #3136 in Alexa global
'http://www.radaronline.com/',
# Why: #3137 in Alexa global
'http://www.hujiang.com/',
# Why: #3138 in Alexa global
'http://www.gardenweb.com/',
# Why: #3139 in Alexa global
'http://www.pizap.com/',
# Why: #3140 in Alexa global
'http://www.iptorrents.com/',
# Why: #3141 in Alexa global
'http://www.yuku.com/',
# Why: #3142 in Alexa global
'http://www.mega-giochi.it/',
# Why: #3143 in Alexa global
'http://www.nrk.no/',
# Why: #3144 in Alexa global
'http://www.99designs.com/',
# Why: #3145 in Alexa global
'http://www.uscis.gov/',
# Why: #3146 in Alexa global
'http://www.lostfilm.tv/',
# Why: #3147 in Alexa global
'http://www.mileroticos.com/',
# Why: #3148 in Alexa global
'http://www.republika.co.id/',
# Why: #3149 in Alexa global
'http://www.sharethis.com/',
# Why: #3150 in Alexa global
'http://www.samplicio.us/',
# Why: #3151 in Alexa global
'http://www.1saleaday.com/',
# Why: #3152 in Alexa global
'http://www.vonelo.com/',
# Why: #3153 in Alexa global
'http://www.oyunmoyun.com/',
# Why: #3154 in Alexa global
'http://www.flightradar24.com/',
# Why: #3155 in Alexa global
'http://www.geo.tv/',
# Why: #3156 in Alexa global
'http://www.nexusmods.com/',
# Why: #3157 in Alexa global
'http://www.mizuhobank.co.jp/',
# Why: #3158 in Alexa global
'http://www.blogspot.fi/',
# Why: #3159 in Alexa global
'http://www.directtrack.com/',
# Why: #3160 in Alexa global
'http://www.media.net/',
# Why: #3161 in Alexa global
'http://www.bigresource.com/',
# Why: #3162 in Alexa global
'http://www.free-lance.ru/',
# Why: #3163 in Alexa global
'http://www.loveplanet.ru/',
# Why: #3164 in Alexa global
'http://www.ilfattoquotidiano.it/',
# Why: #3165 in Alexa global
'http://www.coolmovs.com/',
# Why: #3166 in Alexa global
'http://www.mango.com/',
# Why: #3167 in Alexa global
'http://www.nj.com/',
# Why: #3168 in Alexa global
'http://www.magazineluiza.com.br/',
# Why: #3169 in Alexa global
'http://www.datehookup.com/',
# Why: #3170 in Alexa global
'http://www.registro.br/',
# Why: #3171 in Alexa global
'http://www.debenhams.com/',
# Why: #3172 in Alexa global
'http://www.jqueryui.com/',
# Why: #3173 in Alexa global
'http://www.palcomp3.com/',
# Why: #3174 in Alexa global
'http://www.opensubtitles.org/',
# Why: #3175 in Alexa global
'http://www.socialmediatoday.com/',
# Why: #3176 in Alexa global
'http://3158.cn/',
# Why: #3178 in Alexa global
'http://www.allgameshome.com/',
# Why: #3179 in Alexa global
'http://www.pricegrabber.com/',
# Why: #3180 in Alexa global
'http://www.lufthansa.com/',
# Why: #3181 in Alexa global
'http://www.ip-adress.com/',
# Why: #3182 in Alexa global
'http://www.business-standard.com/',
# Why: #3183 in Alexa global
'http://www.games.com/',
# Why: #3184 in Alexa global
'http://www.zaman.com.tr/',
# Why: #3185 in Alexa global
'http://www.jagranjosh.com/',
# Why: #3186 in Alexa global
'http://www.mint.com/',
# Why: #3187 in Alexa global
'http://www.gorillavid.in/',
# Why: #3188 in Alexa global
'http://www.google.com.om/',
# Why: #3189 in Alexa global
'http://www.blogbigtime.com/',
# Why: #3190 in Alexa global
'http://www.books.com.tw/',
# Why: #3191 in Alexa global
'http://www.korrespondent.net/',
# Why: #3192 in Alexa global
'http://www.nymag.com/',
# Why: #3193 in Alexa global
'http://www.proporn.com/',
# Why: #3194 in Alexa global
'http://ycasmd.info/',
# Why: #3195 in Alexa global
'http://www.persiantools.com/',
# Why: #3196 in Alexa global
'http://www.torrenthound.com/',
# Why: #3197 in Alexa global
'http://www.bestsexo.com/',
# Why: #3198 in Alexa global
'http://www.alwatanvoice.com/',
# Why: #3199 in Alexa global
'http://www.jahannews.com/',
# Why: #3200 in Alexa global
'http://www.bluewin.ch/',
# Why: #3201 in Alexa global
'http://www.sap.com/',
# Why: #3203 in Alexa global
'http://www.rzb.ir/',
# Why: #3204 in Alexa global
'http://www.myorderbox.com/',
# Why: #3205 in Alexa global
'http://www.dealsandsavings.net/',
# Why: #3206 in Alexa global
'http://www.goldenline.pl/',
# Why: #3207 in Alexa global
'http://www.stuff.co.nz/',
# Why: #3208 in Alexa global
'http://www.opentable.com/',
# Why: #3209 in Alexa global
'http://www.4738.com/',
# Why: #3210 in Alexa global
'http://www.freshersworld.com/',
# Why: #3211 in Alexa global
'http://www.state.pa.us/',
# Why: #3212 in Alexa global
'http://www.lavanguardia.com/',
# Why: #3213 in Alexa global
'http://www.sudu.cn/',
# Why: #3214 in Alexa global
'http://www.mob.org/',
# Why: #3215 in Alexa global
'http://www.vodafone.in/',
# Why: #3216 in Alexa global
'http://www.blogdetik.com/',
# Why: #3217 in Alexa global
'http://www.888.it/',
# Why: #3218 in Alexa global
'http://www.passportindia.gov.in/',
# Why: #3219 in Alexa global
'http://www.ssa.gov/',
# Why: #3220 in Alexa global
'http://www.desitvforum.net/',
# Why: #3221 in Alexa global
'http://www.8684.cn/',
# Why: #3222 in Alexa global
'http://www.rajasthan.gov.in/',
# Why: #3223 in Alexa global
'http://www.youtube.com/user/PewDiePie/',
# Why: #3224 in Alexa global
'http://www.zonealarm.com/',
# Why: #3225 in Alexa global
'http://www.locaweb.com.br/',
# Why: #3226 in Alexa global
'http://logme.in/',
# Why: #3227 in Alexa global
'http://www.fetlife.com/',
# Why: #3228 in Alexa global
'http://www.lyricsfreak.com/',
# Why: #3229 in Alexa global
'http://www.te3p.com/',
# Why: #3230 in Alexa global
'http://www.hmrc.gov.uk/',
# Why: #3231 in Alexa global
'http://www.bravoerotica.com/',
# Why: #3232 in Alexa global
'http://www.kolesa.kz/',
# Why: #3233 in Alexa global
'http://www.vinescope.com/',
# Why: #3234 in Alexa global
'http://www.shoplocal.com/',
# Why: #3236 in Alexa global
'http://b2b.cn/',
# Why: #3237 in Alexa global
'http://www.mydrivers.com/',
# Why: #3238 in Alexa global
'http://www.xhamster.com/user/video/',
# Why: #3239 in Alexa global
'http://www.bigideamastermind.com/',
# Why: #3240 in Alexa global
'http://www.uncoverthenet.com/',
# Why: #3241 in Alexa global
'http://www.ragecomic.com/',
# Why: #3242 in Alexa global
'http://www.yodobashi.com/',
# Why: #3243 in Alexa global
'http://titan24.com/',
# Why: #3244 in Alexa global
'http://www.nocoty.pl/',
# Why: #3245 in Alexa global
'http://www.turkishairlines.com/',
# Why: #3246 in Alexa global
'http://www.liputan6.com/',
# Why: #3247 in Alexa global
'http://www.3suisses.fr/',
# Why: #3248 in Alexa global
'http://www.cancan.ro/',
# Why: #3249 in Alexa global
'http://www.apetube.com/',
# Why: #3250 in Alexa global
'http://www.kurir-info.rs/',
# Why: #3251 in Alexa global
'http://www.wow.com/',
# Why: #3252 in Alexa global
'http://www.myblogguest.com/',
# Why: #3253 in Alexa global
'http://www.wp.com/',
# Why: #3254 in Alexa global
'http://www.tre.it/',
# Why: #3255 in Alexa global
'http://www.livrariasaraiva.com.br/',
# Why: #3256 in Alexa global
'http://www.ubuntuforums.org/',
# Why: #3257 in Alexa global
'http://www.fujitv.co.jp/',
# Why: #3258 in Alexa global
'http://www.serverfault.com/',
# Why: #3259 in Alexa global
'http://www.princeton.edu/',
# Why: #3260 in Alexa global
'http://www.experienceproject.com/',
# Why: #3261 in Alexa global
'http://www.ero-video.net/',
# Why: #3262 in Alexa global
'http://www.west263.com/',
# Why: #3263 in Alexa global
'http://www.nguoiduatin.vn/',
# Why: #3264 in Alexa global
'http://www.findthebest.com/',
# Why: #3265 in Alexa global
'http://www.iol.pt/',
# Why: #3266 in Alexa global
'http://www.hotukdeals.com/',
# Why: #3267 in Alexa global
'http://www.filmifullizle.com/',
# Why: #3268 in Alexa global
'http://www.blog.hu/',
# Why: #3269 in Alexa global
'http://www.dailyfinance.com/',
# Why: #3270 in Alexa global
'http://www.bigxvideos.com/',
# Why: #3271 in Alexa global
'http://www.adreactor.com/',
# Why: #3272 in Alexa global
'http://www.fmworld.net/',
# Why: #3273 in Alexa global
'http://www.fumu.com/',
# Why: #3274 in Alexa global
'http://www.ntv.ru/',
# Why: #3275 in Alexa global
'http://www.poringa.net/',
# Why: #3276 in Alexa global
'http://www.syosetu.com/',
# Why: #3277 in Alexa global
'http://www.giantsextube.com/',
# Why: #3278 in Alexa global
'http://www.uuu9.com/',
# Why: #3279 in Alexa global
'http://www.babosas.com/',
# Why: #3280 in Alexa global
'http://www.square-enix.com/',
# Why: #3281 in Alexa global
'http://www.bankia.es/',
# Why: #3282 in Alexa global
'http://www.freedownloadmanager.org/',
# Why: #3283 in Alexa global
'http://www.add-anime.net/',
# Why: #3284 in Alexa global
'http://www.tuttomercatoweb.com/',
# Why: #3285 in Alexa global
'http://www.192.com/',
# Why: #3286 in Alexa global
'http://www.freekaamaal.com/',
# Why: #3287 in Alexa global
'http://www.youngpornvideos.com/',
# Why: #3288 in Alexa global
'http://www.nbc.com/',
# Why: #3289 in Alexa global
'http://www.jne.co.id/',
# Why: #3290 in Alexa global
'http://www.fobshanghai.com/',
# Why: #3291 in Alexa global
'http://www.johnlewis.com/',
# Why: #3292 in Alexa global
'http://www.mvideo.ru/',
# Why: #3293 in Alexa global
'http://www.bhinneka.com/',
# Why: #3294 in Alexa global
'http://www.gooddrama.net/',
# Why: #3295 in Alexa global
'http://www.lobstertube.com/',
# Why: #3296 in Alexa global
'http://www.ovguide.com/',
# Why: #3297 in Alexa global
'http://www.joemonster.org/',
# Why: #3298 in Alexa global
'http://editor.wix.com/',
# Why: #3299 in Alexa global
'http://www.wechat.com/',
# Why: #3300 in Alexa global
'http://www.locanto.in/',
# Why: #3301 in Alexa global
'http://www.video2mp3.net/',
# Why: #3303 in Alexa global
'http://www.couchsurfing.org/',
# Why: #3304 in Alexa global
'http://www.tchibo.de/',
# Why: #3305 in Alexa global
'http://rol.ro/',
# Why: #3306 in Alexa global
'http://www.toroporno.com/',
# Why: #3307 in Alexa global
'http://www.backlinkwatch.com/',
# Why: #3308 in Alexa global
'http://www.greatergood.com/',
# Why: #3309 in Alexa global
'http://www.smartaddressbar.com/',
# Why: #3310 in Alexa global
'http://www.getgoodlinks.ru/',
# Why: #3311 in Alexa global
'http://www.fitbit.com/',
# Why: #3312 in Alexa global
'http://www.elcorteingles.es/',
# Why: #3313 in Alexa global
'http://www.up2c.com/',
# Why: #3314 in Alexa global
'http://www.rg.ru/',
# Why: #3315 in Alexa global
'http://www.ftalk.com/',
# Why: #3316 in Alexa global
'http://www.apartmenttherapy.com/',
# Why: #3317 in Alexa global
'http://www.blogspot.hu/',
# Why: #3318 in Alexa global
'http://www.e-rewards.com/',
# Why: #3319 in Alexa global
'http://weloveshopping.com/',
# Why: #3320 in Alexa global
'http://www.swtor.com/',
# Why: #3321 in Alexa global
'http://www.abs-cbnnews.com/',
# Why: #3322 in Alexa global
'http://www.webpagetest.org/',
# Why: #3323 in Alexa global
'http://www.ricardo.ch/',
# Why: #3324 in Alexa global
'http://www.ghatreh.com/',
# Why: #3325 in Alexa global
'http://www.ibps.in/',
# Why: #3326 in Alexa global
'http://www.moneymakergroup.com/',
# Why: #3327 in Alexa global
'http://www.exist.ru/',
# Why: #3328 in Alexa global
'http://www.kakprosto.ru/',
# Why: #3329 in Alexa global
'http://www.gradeuptube.com/',
# Why: #3330 in Alexa global
'http://lastampa.it/',
# Why: #3331 in Alexa global
'http://www.medicinenet.com/',
# Why: #3332 in Alexa global
'http://www.theknot.com/',
# Why: #3333 in Alexa global
'http://www.yale.edu/',
# Why: #3334 in Alexa global
'http://www.mail.uol.com.br/',
# Why: #3335 in Alexa global
'http://www.okazii.ro/',
# Why: #3336 in Alexa global
'http://www.wa.gov/',
# Why: #3337 in Alexa global
'http://www.gmhuowan.com/',
# Why: #3338 in Alexa global
'http://www.cnhubei.com/',
# Why: #3339 in Alexa global
'http://www.dickssportinggoods.com/',
# Why: #3340 in Alexa global
'http://instaforex.com/',
# Why: #3341 in Alexa global
'http://www.zdf.de/',
# Why: #3342 in Alexa global
'http://www.getpocket.com/',
# Why: #3343 in Alexa global
'http://www.takungpao.com/',
# Why: #3344 in Alexa global
'http://www.junkmail.co.za/',
# Why: #3345 in Alexa global
'http://www.tripwiremagazine.com/',
# Why: #3346 in Alexa global
'http://www.popcap.com/',
# Why: #3347 in Alexa global
'http://www.kotobank.jp/',
# Why: #3348 in Alexa global
'http://www.bangbros.com/',
# Why: #3349 in Alexa global
'http://www.shtyle.fm/',
# Why: #3350 in Alexa global
'http://www.jungle.gr/',
# Why: #3351 in Alexa global
'http://www.apserver.net/',
# Why: #3352 in Alexa global
'http://www.mzamin.com/',
# Why: #3353 in Alexa global
'http://www.google.lu/',
# Why: #3354 in Alexa global
'http://www.squarebux.com/',
# Why: #3355 in Alexa global
'http://www.bollywoodhungama.com/',
# Why: #3356 in Alexa global
'http://www.milfmovs.com/',
# Why: #3357 in Alexa global
'http://www.softonic.it/',
# Why: #3358 in Alexa global
'http://www.hsw.cn/',
# Why: #3359 in Alexa global
'http://www.cyberciti.biz/',
# Why: #3360 in Alexa global
'http://www.scout.com/',
# Why: #3361 in Alexa global
'http://www.teensnow.com/',
# Why: #3362 in Alexa global
'http://www.pornper.com/',
# Why: #3363 in Alexa global
'http://www.torrentreactor.net/',
# Why: #3364 in Alexa global
'http://www.smotri.com/',
# Why: #3365 in Alexa global
'http://www.startpage.com/',
# Why: #3366 in Alexa global
'http://www.climatempo.com.br/',
# Why: #3367 in Alexa global
'http://www.bigrock.in/',
# Why: #3368 in Alexa global
'http://www.kajabi.com/',
# Why: #3369 in Alexa global
'http://www.imgchili.com/',
# Why: #3370 in Alexa global
'http://www.dogpile.com/',
# Why: #3371 in Alexa global
'http://www.thestreet.com/',
# Why: #3372 in Alexa global
'http://www.sport24.gr/',
# Why: #3373 in Alexa global
'http://www.tophotels.ru/',
# Why: #3374 in Alexa global
'http://www.shopping.uol.com.br/',
# Why: #3375 in Alexa global
'http://www.bbva.es/',
# Why: #3376 in Alexa global
'http://www.perfectmoney.com/',
# Why: #3377 in Alexa global
'http://www.cashmachines2.com/',
# Why: #3378 in Alexa global
'http://www.skroutz.gr/',
# Why: #3379 in Alexa global
'http://www.logitech.com/',
# Why: #3380 in Alexa global
'http://www.seriescoco.com/',
# Why: #3381 in Alexa global
'http://www.fastclick.com/',
# Why: #3382 in Alexa global
'http://www.cambridge.org/',
# Why: #3383 in Alexa global
'http://www.fark.com/',
# Why: #3384 in Alexa global
'http://www.krypt.com/',
# Why: #3385 in Alexa global
'http://www.indiangilma.com/',
# Why: #3386 in Alexa global
'http://www.safe-swaps.com/',
# Why: #3387 in Alexa global
'http://www.trenitalia.com/',
# Why: #3388 in Alexa global
'http://www.flycell.com.mx/',
# Why: #3389 in Alexa global
'http://www.livefreefun.com/',
# Why: #3390 in Alexa global
'http://www.ourtoolbar.com/',
# Why: #3391 in Alexa global
'http://www.anandtech.com/',
# Why: #3392 in Alexa global
'http://www.neimanmarcus.com/',
# Why: #3393 in Alexa global
'http://www.lelong.com.my/',
# Why: #3394 in Alexa global
'http://www.pulscen.ru/',
# Why: #3395 in Alexa global
'http://www.paginegialle.it/',
# Why: #3396 in Alexa global
'http://www.intelius.com/',
# Why: #3397 in Alexa global
'http://www.orange.pl/',
# Why: #3398 in Alexa global
'http://www.aktuality.sk/',
# Why: #3399 in Alexa global
'http://www.webgame.in.th/',
# Why: #3400 in Alexa global
'http://www.runescape.com/',
# Why: #3401 in Alexa global
'http://www.rocketnews24.com/',
# Why: #3402 in Alexa global
'http://www.lineadirecta.com/',
# Why: #3403 in Alexa global
'http://www.origin.com/',
# Why: #3404 in Alexa global
'http://www.newsbeast.gr/',
# Why: #3405 in Alexa global
'http://www.justhookup.com/',
# Why: #3406 in Alexa global
'http://www.rakuten-bank.co.jp/',
# Why: #3407 in Alexa global
'http://www.lifenews.ru/',
# Why: #3408 in Alexa global
'http://www.sitemeter.com/',
# Why: #3410 in Alexa global
'http://www.isbank.com.tr/',
# Why: #3411 in Alexa global
'http://www.commerzbanking.de/',
# Why: #3412 in Alexa global
'http://www.marthastewart.com/',
# Why: #3413 in Alexa global
'http://www.ntvmsnbc.com/',
# Why: #3414 in Alexa global
'http://www.seloger.com/',
# Why: #3415 in Alexa global
'http://www.vend-o.com/',
# Why: #3416 in Alexa global
'http://www.almanar.com.lb/',
# Why: #3417 in Alexa global
'http://www.sifyitest.com/',
# Why: #3418 in Alexa global
'http://taojindi.com/',
# Why: #3419 in Alexa global
'http://www.mylife.com/',
# Why: #3420 in Alexa global
'http://www.talkfusion.com/',
# Why: #3421 in Alexa global
'http://www.hichina.com/',
# Why: #3422 in Alexa global
'http://www.paruvendu.fr/',
# Why: #3423 in Alexa global
'http://www.admcsport.com/',
# Why: #3424 in Alexa global
'http://www.tudogostoso.uol.com.br/',
# Why: #3425 in Alexa global
'http://www.faz.net/',
# Why: #3426 in Alexa global
'http://www.narutoget.com/',
# Why: #3427 in Alexa global
'http://www.wufoo.com/',
# Why: #3428 in Alexa global
'http://www.feedads-srv.com/',
# Why: #3429 in Alexa global
'http://www.gophoto.it/',
# Why: #3430 in Alexa global
'http://www.tgju.org/',
# Why: #3431 in Alexa global
'http://www.dynamicdrive.com/',
# Why: #3432 in Alexa global
'http://www.centurylink.net/',
# Why: #3433 in Alexa global
'http://www.ngs.ru/',
# Why: #3434 in Alexa global
'http://anyap.info/',
# Why: #3435 in Alexa global
'http://www.dailykos.com/',
# Why: #3437 in Alexa global
'http://www.95559.com.cn/',
# Why: #3438 in Alexa global
'http://www.malaysiakini.com/',
# Why: #3439 in Alexa global
'http://www.uefa.com/',
# Why: #3440 in Alexa global
'http://www.socialmediaexaminer.com/',
# Why: #3441 in Alexa global
'http://www.empowernetwork.com/qokpPCiefhWcRT/',
# Why: #3442 in Alexa global
'http://www.peperonity.de/',
# Why: #3443 in Alexa global
'http://www.support.wordpress.com/',
# Why: #3444 in Alexa global
'http://www.hola.com/',
# Why: #3445 in Alexa global
'http://www.readmanga.eu/',
# Why: #3446 in Alexa global
'http://www.jstv.com/',
# Why: #3447 in Alexa global
'http://www.irib.ir/',
# Why: #3448 in Alexa global
'http://www.bookingbuddy.com/',
# Why: #3449 in Alexa global
'http://www.computerhope.com/',
# Why: #3450 in Alexa global
'http://www.ilovemobi.com/',
# Why: #3451 in Alexa global
'http://www.pinkrod.com/',
# Why: #3452 in Alexa global
'http://www.videobash.com/',
# Why: #3453 in Alexa global
'http://www.alfemminile.com/',
# Why: #3454 in Alexa global
'http://www.tu.tv/',
# Why: #3455 in Alexa global
'http://www.utro.ru/',
# Why: #3456 in Alexa global
'http://www.urbanoutfitters.com/',
# Why: #3457 in Alexa global
'http://www.autozone.com/',
# Why: #3458 in Alexa global
'http://www.gilt.com/',
# Why: #3459 in Alexa global
'http://www.atpworldtour.com/',
# Why: #3460 in Alexa global
'http://www.goibibo.com/',
# Why: #3461 in Alexa global
'http://www.propellerpops.com/',
# Why: #3462 in Alexa global
'http://www.cornell.edu/',
# Why: #3463 in Alexa global
'http://www.flashscore.com/',
# Why: #3464 in Alexa global
'http://www.babyblog.ru/',
# Why: #3465 in Alexa global
'http://www.sport-fm.gr/',
# Why: #3466 in Alexa global
'http://www.viamichelin.fr/',
# Why: #3467 in Alexa global
'http://www.newyorker.com/',
# Why: #3468 in Alexa global
'http://www.tagesschau.de/',
# Why: #3469 in Alexa global
'http://www.guiamais.com.br/',
# Why: #3470 in Alexa global
'http://www.jeux.fr/',
# Why: #3471 in Alexa global
'http://www.pontofrio.com.br/',
# Why: #3472 in Alexa global
'http://www.dm5.com/',
# Why: #3474 in Alexa global
'http://www.ss.lv/',
# Why: #3475 in Alexa global
'http://www.mirtesen.ru/',
# Why: #3476 in Alexa global
'http://www.money.pl/',
# Why: #3477 in Alexa global
'http://www.tlbsearch.com/',
# Why: #3478 in Alexa global
'http://www.usembassy.gov/',
# Why: #3479 in Alexa global
'http://www.cineblog01.net/',
# Why: #3480 in Alexa global
'http://www.nur.kz/',
# Why: #3481 in Alexa global
'http://www.hotnewhiphop.com/',
# Why: #3482 in Alexa global
'http://www.mp3sheriff.com/',
# Why: #3483 in Alexa global
'http://www.games.co.id/',
# Why: #3485 in Alexa global
'http://www.deviantclip.com/',
# Why: #3486 in Alexa global
'http://www.list.ru/',
# Why: #3487 in Alexa global
'http://www.xitek.com/',
# Why: #3488 in Alexa global
'http://www.netvibes.com/',
# Why: #3489 in Alexa global
'http://www.24sata.hr/',
# Why: #3490 in Alexa global
'http://www.usda.gov/',
# Why: #3491 in Alexa global
'http://www.zerofreeporn.com/',
# Why: #3492 in Alexa global
'http://www.tvb.com/',
# Why: #3493 in Alexa global
'http://www.decolar.com/',
# Why: #3494 in Alexa global
'http://www.worldfree4u.com/',
# Why: #3495 in Alexa global
'http://www.dzone.com/',
# Why: #3496 in Alexa global
'http://www.wikiquote.org/',
# Why: #3497 in Alexa global
'http://www.techtunes.com.bd/',
# Why: #3498 in Alexa global
'http://www.pornup.me/',
# Why: #3499 in Alexa global
'http://www.blogutils.net/',
# Why: #3500 in Alexa global
'http://www.yupoo.com/',
# Why: #3501 in Alexa global
'http://www.peoplesmart.com/',
# Why: #3502 in Alexa global
'http://www.kijiji.it/',
# Why: #3503 in Alexa global
'http://usairways.com/',
# Why: #3504 in Alexa global
'http://www.betfred.com/',
# Why: #3505 in Alexa global
'http://www.ow.ly/',
# Why: #3506 in Alexa global
'http://www.nsw.gov.au/',
# Why: #3507 in Alexa global
'http://www.mci.ir/',
# Why: #3508 in Alexa global
'http://www.iranecar.com/',
# Why: #3509 in Alexa global
'http://www.wisegeek.com/',
# Why: #3510 in Alexa global
'http://www.gocomics.com/',
# Why: #3511 in Alexa global
'http://www.bramjnet.com/',
# Why: #3512 in Alexa global
'http://www.bit.ly/',
# Why: #3514 in Alexa global
'http://www.timesofindia.com/',
# Why: #3515 in Alexa global
'http://www.xingcloud.com/',
# Why: #3516 in Alexa global
'http://www.geocities.co.jp/',
# Why: #3517 in Alexa global
'http://www.tfl.gov.uk/',
# Why: #3518 in Alexa global
'http://www.derstandard.at/',
# Why: #3519 in Alexa global
'http://www.icq.com/',
# Why: #3520 in Alexa global
'http://www.orange.co.uk/',
# Why: #3521 in Alexa global
'http://www.pornokopilka.info/',
# Why: #3522 in Alexa global
'http://www.88db.com/',
# Why: #3524 in Alexa global
'http://www.house365.com/',
# Why: #3525 in Alexa global
'http://www.collegehumor.com/',
# Why: #3526 in Alexa global
'http://www.gfxtra.com/',
# Why: #3527 in Alexa global
'http://www.borsapernegati.com/',
# Why: #3528 in Alexa global
'http://pensador.uol.com.br/',
# Why: #3529 in Alexa global
'http://www.surveygifters.com/',
# Why: #3531 in Alexa global
'http://bmail.uol.com.br/',
# Why: #3532 in Alexa global
'http://www.ec21.com/',
# Why: #3533 in Alexa global
'http://www.seoprofiler.com/',
# Why: #3534 in Alexa global
'http://www.goldporntube.com/',
# Why: #3535 in Alexa global
'http://www.tvtropes.org/',
# Why: #3536 in Alexa global
'http://www.techtarget.com/',
# Why: #3537 in Alexa global
'http://www.juno.com/',
# Why: #3538 in Alexa global
'http://www.visual.ly/',
# Why: #3539 in Alexa global
'http://www.dardarkom.com/',
# Why: #3540 in Alexa global
'http://www.showup.tv/',
# Why: #3541 in Alexa global
'http://www.three.co.uk/',
# Why: #3543 in Alexa global
'http://www.shopstyle.com/',
# Why: #3544 in Alexa global
'http://www.penguinvids.com/',
# Why: #3545 in Alexa global
'http://www.trainenquiry.com/',
# Why: #3546 in Alexa global
'http://www.soha.vn/',
# Why: #3547 in Alexa global
'http://www.fengniao.com/',
# Why: #3548 in Alexa global
'http://carschina.com/',
# Why: #3549 in Alexa global
'http://www.500wan.com/',
# Why: #3550 in Alexa global
'http://www.perfectinter.net/',
# Why: #3551 in Alexa global
'http://www.elog-ch.com/',
# Why: #3552 in Alexa global
'http://www.thetoptens.com/',
# Why: #3553 in Alexa global
'http://www.ecnavi.jp/',
# Why: #3554 in Alexa global
'http://www.1616.net/',
# Why: #3555 in Alexa global
'http://www.nationwide.co.uk/',
# Why: #3556 in Alexa global
'http://www.myhabit.com/',
# Why: #3557 in Alexa global
'http://www.kinomaniak.tv/',
# Why: #3558 in Alexa global
'http://www.googlecode.com/',
# Why: #3559 in Alexa global
'http://www.kddi.com/',
# Why: #3560 in Alexa global
'http://www.wyborcza.biz/',
# Why: #3561 in Alexa global
'http://www.gtbank.com/',
# Why: #3562 in Alexa global
'http://zigwheels.com/',
# Why: #3563 in Alexa global
'http://www.lepoint.fr/',
# Why: #3564 in Alexa global
'http://www.formula1.com/',
# Why: #3565 in Alexa global
'http://www.nissen.co.jp/',
# Why: #3566 in Alexa global
'http://www.baomoi.com/',
# Why: #3567 in Alexa global
'http://www.apa.az/',
# Why: #3568 in Alexa global
'http://www.movie2k.to/',
# Why: #3569 in Alexa global
'http://www.irpopup.ir/',
# Why: #3570 in Alexa global
'http://www.nps.gov/',
# Why: #3571 in Alexa global
'http://www.lachainemeteo.com/',
# Why: #3572 in Alexa global
'http://www.x-art.com/',
# Why: #3573 in Alexa global
'http://www.bakecaincontrii.com/',
# Why: #3574 in Alexa global
'http://www.longtailvideo.com/',
# Why: #3575 in Alexa global
'http://www.yengo.com/',
# Why: #3576 in Alexa global
'http://www.listentoyoutube.com/',
# Why: #3577 in Alexa global
'http://www.dreamhost.com/',
# Why: #3578 in Alexa global
'http://www.cari.com.my/',
# Why: #3579 in Alexa global
'http://www.sergeymavrodi.com/',
# Why: #3580 in Alexa global
'http://www.boursorama.com/',
# Why: #3581 in Alexa global
'http://www.extra.com.br/',
# Why: #3582 in Alexa global
'http://www.msnbc.com/',
# Why: #3583 in Alexa global
'http://www.xiaomi.cn/',
# Why: #3585 in Alexa global
'http://www.uwants.com/',
# Why: #3586 in Alexa global
'http://www.utexas.edu/',
# Why: #3587 in Alexa global
'http://www.alc.co.jp/',
# Why: #3588 in Alexa global
'http://www.minijuegos.com/',
# Why: #3589 in Alexa global
'http://www.mumayi.com/',
# Why: #3590 in Alexa global
'http://www.sogi.com.tw/',
# Why: #3591 in Alexa global
'http://www.skorer.tv/',
# Why: #3592 in Alexa global
'http://ddmap.com/',
# Why: #3593 in Alexa global
'http://www.ebog.com/',
# Why: #3594 in Alexa global
'http://www.artlebedev.ru/',
# Why: #3595 in Alexa global
'http://www.venere.com/',
# Why: #3596 in Alexa global
'http://www.academic.ru/',
# Why: #3597 in Alexa global
'http://www.mako.co.il/',
# Why: #3598 in Alexa global
'http://www.nabble.com/',
# Why: #3599 in Alexa global
'http://www.autodesk.com/',
# Why: #3600 in Alexa global
'http://www.vertitechnologygroup.com/',
# Why: #3601 in Alexa global
'http://www.leaseweb.com/',
# Why: #3602 in Alexa global
'http://www.yoox.com/',
# Why: #3603 in Alexa global
'http://www.papajohns.com/',
# Why: #3604 in Alexa global
'http://www.unmillondeutilidades.com/',
# Why: #3605 in Alexa global
'http://www.webmasters.ru/',
# Why: #3606 in Alexa global
'http://www.seoclerks.com/',
# Why: #3607 in Alexa global
'http://www.yootheme.com/',
# Why: #3608 in Alexa global
'http://www.google.com.py/',
# Why: #3609 in Alexa global
'http://www.beemp3.com/',
# Why: #3610 in Alexa global
'http://www.yepme.com/',
# Why: #3611 in Alexa global
'http://www.alef.ir/',
# Why: #3613 in Alexa global
'http://www.gotowebinar.com/',
# Why: #3614 in Alexa global
'http://www.onec.dz/',
# Why: #3615 in Alexa global
'http://www.bonprix.de/',
# Why: #3616 in Alexa global
'http://www.landsend.com/',
# Why: #3617 in Alexa global
'http://www.libertatea.ro/',
# Why: #3618 in Alexa global
'http://www.timeout.com/',
# Why: #3619 in Alexa global
'http://www.appnexus.com/',
# Why: #3620 in Alexa global
'http://www.uproxx.com/',
# Why: #3622 in Alexa global
'http://www.alohatube.com/',
# Why: #3623 in Alexa global
'http://www.citilink.ru/',
# Why: #3624 in Alexa global
'http://www.askubuntu.com/',
# Why: #3625 in Alexa global
'http://www.freemake.com/',
# Why: #3626 in Alexa global
'http://www.rockettheme.com/',
# Why: #3627 in Alexa global
'http://www.tupaki.com/',
# Why: #3628 in Alexa global
'http://www.53.com/',
# Why: #3629 in Alexa global
'http://www.tune.pk/',
# Why: #3630 in Alexa global
'http://www.standardchartered.com/',
# Why: #3631 in Alexa global
'http://www.video-i365.com/',
# Why: #3632 in Alexa global
'http://www.knowyourmeme.com/',
# Why: #3633 in Alexa global
'http://www.gofeminin.de/',
# Why: #3634 in Alexa global
'http://www.vmware.com/',
# Why: #3635 in Alexa global
'http://www.vbox7.com/',
# Why: #3636 in Alexa global
'http://www.webfail.com/',
# Why: #3637 in Alexa global
'http://www.onewebsearch.com/',
# Why: #3638 in Alexa global
'http://www.xnxxmovies.com/',
# Why: #3639 in Alexa global
'http://www.blogspot.hk/',
# Why: #3640 in Alexa global
'http://www.hgtv.com/',
# Why: #3641 in Alexa global
'http://www.findagrave.com/',
# Why: #3642 in Alexa global
'http://www.yoast.com/',
# Why: #3643 in Alexa global
'http://www.audiopoisk.com/',
# Why: #3644 in Alexa global
'http://www.sexytube.me/',
# Why: #3645 in Alexa global
'http://www.centerblog.net/',
# Why: #3646 in Alexa global
'http://www.webpronews.com/',
# Why: #3647 in Alexa global
'http://www.prnewswire.com/',
# Why: #3648 in Alexa global
'http://www.vietnamnet.vn/',
# Why: #3649 in Alexa global
'http://www.groupon.co.in/',
# Why: #3650 in Alexa global
'http://www.bom.gov.au/',
# Why: #3651 in Alexa global
'http://www.loxblog.com/',
# Why: #3652 in Alexa global
'http://www.llnw.com/',
# Why: #3653 in Alexa global
'http://www.jcrew.com/',
# Why: #3654 in Alexa global
'http://www.carsensor.net/',
# Why: #3655 in Alexa global
'http://www.aukro.cz/',
# Why: #3656 in Alexa global
'http://www.zoomby.ru/',
# Why: #3657 in Alexa global
'http://www.wallstcheatsheet.com/',
# Why: #3658 in Alexa global
'http://www.17k.com/',
# Why: #3659 in Alexa global
'http://www.secondlife.com/',
# Why: #3660 in Alexa global
'http://www.marmiton.org/',
# Why: #3661 in Alexa global
'http://www.zorpia.com/',
# Why: #3662 in Alexa global
'http://www.searchya.com/',
# Why: #3663 in Alexa global
'http://www.rtl2.de/',
# Why: #3664 in Alexa global
'http://www.wiocha.pl/',
# Why: #3665 in Alexa global
'http://www.28tui.com/',
# Why: #3666 in Alexa global
'http://www.shopzilla.com/',
# Why: #3667 in Alexa global
'http://www.google.com.ni/',
# Why: #3668 in Alexa global
'http://www.lycos.com/',
# Why: #3669 in Alexa global
'http://www.gucheng.com/',
# Why: #3670 in Alexa global
'http://www.rajanews.com/',
# Why: #3671 in Alexa global
'http://www.blackhatteam.com/',
# Why: #3672 in Alexa global
'http://www.mp3.es/',
# Why: #3673 in Alexa global
'http://www.forums.wordpress.com/',
# Why: #3674 in Alexa global
'http://www.micromaxinfo.com/',
# Why: #3675 in Alexa global
'http://www.sub.jp/',
# Why: #3676 in Alexa global
'http://www.duden.de/',
# Why: #3677 in Alexa global
'http://www.nyc.gov/',
# Why: #3679 in Alexa global
'http://www.monova.org/',
# Why: #3680 in Alexa global
'http://www.al-wlid.com/',
# Why: #3681 in Alexa global
'http://www.dastelefonbuch.de/',
# Why: #3682 in Alexa global
'http://www.cam4ultimate.com/',
# Why: #3683 in Alexa global
'http://www.inps.it/',
# Why: #3684 in Alexa global
'http://www.nazwa.pl/',
# Why: #3685 in Alexa global
'http://www.beatport.com/',
# Why: #3686 in Alexa global
'http://www.wizzair.com/',
# Why: #3687 in Alexa global
'http://www.thomann.de/',
# Why: #3688 in Alexa global
'http://www.juntadeandalucia.es/',
# Why: #3689 in Alexa global
'http://www.oficialsurveyscenter.co/',
# Why: #3690 in Alexa global
'http://www.zaluu.com/',
# Why: #3691 in Alexa global
'http://www.videarn.com/',
# Why: #3692 in Alexa global
'http://www.azcentral.com/',
# Why: #3693 in Alexa global
'http://www.xvideosmovie.com/',
# Why: #3694 in Alexa global
'http://www.eforosh.com/',
# Why: #3696 in Alexa global
'http://www.movie25.com/',
# Why: #3697 in Alexa global
'http://www.creditkarma.com/',
# Why: #3698 in Alexa global
'http://upi.com/',
# Why: #3699 in Alexa global
'http://www.mozook.com/',
# Why: #3700 in Alexa global
'http://www.heavy.com/',
# Why: #3701 in Alexa global
'http://www.worldoftanks.com/',
# Why: #3702 in Alexa global
'http://www.vkrugudruzei.ru/',
# Why: #3704 in Alexa global
'http://www.hourlyrevshare.net/',
# Why: #3705 in Alexa global
'http://www.walkerplus.com/',
# Why: #3706 in Alexa global
'http://www.btyou.com/',
# Why: #3707 in Alexa global
'http://www.adzibiz.com/',
# Why: #3708 in Alexa global
'http://www.tryflirting.com/',
# Why: #3709 in Alexa global
'http://www.moi.gov.sa/',
# Why: #3710 in Alexa global
'http://www.cooltext.com/',
# Why: #3711 in Alexa global
'http://www.dawanda.com/',
# Why: #3712 in Alexa global
'http://www.travian.com.sa/',
# Why: #3713 in Alexa global
'http://www.va.gov/',
# Why: #3714 in Alexa global
'http://www.sunmaker.com/',
# Why: #3715 in Alexa global
'http://www.aaa.com/',
# Why: #3716 in Alexa global
'http://www.dinodirect.com/',
# Why: #3717 in Alexa global
'http://www.cima4u.com/',
# Why: #3718 in Alexa global
'http://www.huaban.com/',
# Why: #3719 in Alexa global
'http://www.nzherald.co.nz/',
# Why: #3720 in Alexa global
'http://www.plotek.pl/',
# Why: #3722 in Alexa global
'http://www.chow.com/',
# Why: #3723 in Alexa global
'http://www.rincondelvago.com/',
# Why: #3724 in Alexa global
'http://uzai.com/',
# Why: #3725 in Alexa global
'http://www.dbw.cn/',
# Why: #3727 in Alexa global
'http://www.stayfriends.de/',
# Why: #3728 in Alexa global
'http://www.reed.co.uk/',
# Why: #3729 in Alexa global
'http://www.rainpow.com/',
# Why: #3730 in Alexa global
'http://www.dallasnews.com/',
# Why: #3731 in Alexa global
'http://www.ntvspor.net/',
# Why: #3732 in Alexa global
'http://www.fonearena.com/',
# Why: #3733 in Alexa global
'http://www.forocoches.com/',
# Why: #3734 in Alexa global
'http://www.myfonts.com/',
# Why: #3735 in Alexa global
'http://www.fenopy.se/',
# Why: #3736 in Alexa global
'http://www.animefreak.tv/',
# Why: #3737 in Alexa global
'http://www.websitewelcome.com/',
# Why: #3738 in Alexa global
'http://www.indonetwork.co.id/',
# Why: #3739 in Alexa global
'http://www.mapsofindia.com/',
# Why: #3740 in Alexa global
'http://www.newlook.com/',
# Why: #3741 in Alexa global
'http://www.holiday-weather.com/',
# Why: #3742 in Alexa global
'http://zhe800.com/',
# Why: #3743 in Alexa global
'http://www.recipesfinder.com/',
# Why: #3744 in Alexa global
'http://www.bankrate.com.cn/',
# Why: #3745 in Alexa global
'http://www.bbom.com.br/',
# Why: #3746 in Alexa global
'http://www.dahe.cn/',
# Why: #3747 in Alexa global
'http://www.jalopnik.com/',
# Why: #3748 in Alexa global
'http://www.canon.com/',
# Why: #3750 in Alexa global
'http://www.freshbooks.com/',
# Why: #3751 in Alexa global
'http://www.clickcompare.info/',
# Why: #3752 in Alexa global
'http://www.aprod.hu/',
# Why: #3753 in Alexa global
'http://www.thisav.com/',
# Why: #3754 in Alexa global
'http://www.boerse.bz/',
# Why: #3755 in Alexa global
'http://www.orange.es/',
# Why: #3756 in Alexa global
'http://www.forobeta.com/',
# Why: #3757 in Alexa global
'http://www.surfactif.fr/',
# Why: #3758 in Alexa global
'http://www.listverse.com/',
# Why: #3759 in Alexa global
'http://www.feedjit.com/',
# Why: #3760 in Alexa global
'http://www.ntv.co.jp/',
# Why: #3761 in Alexa global
'http://www.bni.co.id/',
# Why: #3762 in Alexa global
'http://www.gamemazing.com/',
# Why: #3763 in Alexa global
'http://www.mbalib.com/',
# Why: #3764 in Alexa global
'http://www.topsy.com/',
# Why: #3765 in Alexa global
'http://www.torchbrowser.com/',
# Why: #3766 in Alexa global
'http://www.ieee.org/',
# Why: #3767 in Alexa global
'http://www.tinydeal.com/',
# Why: #3768 in Alexa global
'http://www.playdom.com/',
# Why: #3769 in Alexa global
'http://www.redorbit.com/',
# Why: #3770 in Alexa global
'http://www.inboxdollars.com/',
# Why: #3771 in Alexa global
'http://www.google.com.bh/',
# Why: #3772 in Alexa global
'http://www.pcanalysis.net/',
# Why: #3773 in Alexa global
'http://www.acer.com/',
# Why: #3774 in Alexa global
'http://www.jizzbell.com/',
# Why: #3775 in Alexa global
'http://www.google.com.kh/',
# Why: #3776 in Alexa global
'http://www.mappy.com/',
# Why: #3777 in Alexa global
'http://www.day.az/',
# Why: #3778 in Alexa global
'http://www.euronews.com/',
# Why: #3779 in Alexa global
'http://www.wikidot.com/',
# Why: #3780 in Alexa global
'http://www.creativecommons.org/',
# Why: #3781 in Alexa global
'http://www.quantcast.com/',
# Why: #3782 in Alexa global
'http://www.iconarchive.com/',
# Why: #3783 in Alexa global
'http://www.iyaya.com/',
# Why: #3784 in Alexa global
'http://www.jetstar.com/',
# Why: #3786 in Alexa global
'http://diandian.com/',
# Why: #3787 in Alexa global
'http://www.winzip.com/',
# Why: #3788 in Alexa global
'http://www.clixzor.com/',
# Why: #3789 in Alexa global
'http://www.teebik.com/',
# Why: #3790 in Alexa global
'http://meilele.com/',
# Why: #3791 in Alexa global
'http://www.gsm.ir/',
# Why: #3792 in Alexa global
'http://dek-d.com/',
# Why: #3793 in Alexa global
'http://www.giantbomb.com/',
# Why: #3794 in Alexa global
'http://www.tala.ir/',
# Why: #3795 in Alexa global
'http://www.extremetracking.com/',
# Why: #3796 in Alexa global
'http://www.homevv.com/',
# Why: #3797 in Alexa global
'http://www.truthaboutabs.com/',
# Why: #3798 in Alexa global
'http://www.psychologytoday.com/',
# Why: #3800 in Alexa global
'http://www.vod.pl/',
# Why: #3801 in Alexa global
'http://www.macromill.com/',
# Why: #3802 in Alexa global
'http://www.pagseguro.uol.com.br/',
# Why: #3804 in Alexa global
'http://www.amd.com/',
# Why: #3805 in Alexa global
'http://www.livescience.com/',
# Why: #3806 in Alexa global
'http://dedecms.com/',
# Why: #3807 in Alexa global
'http://www.jin115.com/',
# Why: #3808 in Alexa global
'http://www.ampxchange.com/',
# Why: #3809 in Alexa global
'http://www.profitcentr.com/',
# Why: #3810 in Alexa global
'http://www.webmotors.com.br/',
# Why: #3811 in Alexa global
'http://www.lan.com/',
# Why: #3812 in Alexa global
'http://www.fileice.net/',
# Why: #3813 in Alexa global
'http://www.ingdirect.es/',
# Why: #3814 in Alexa global
'http://www.amtrak.com/',
# Why: #3815 in Alexa global
'http://www.emag.ro/',
# Why: #3816 in Alexa global
'http://www.progressive.com/',
# Why: #3817 in Alexa global
'http://www.balatarin.com/',
# Why: #3818 in Alexa global
'http://www.immonet.de/',
# Why: #3819 in Alexa global
'http://www.e-travel.com/',
# Why: #3820 in Alexa global
'http://www.studymode.com/',
# Why: #3821 in Alexa global
'http://www.go2000.com/',
# Why: #3822 in Alexa global
'http://www.shopbop.com/',
# Why: #3823 in Alexa global
'http://www.filesfetcher.com/',
# Why: #3824 in Alexa global
'http://www.euroresidentes.com/',
# Why: #3825 in Alexa global
'http://www.movistar.es/',
# Why: #3826 in Alexa global
'http://lefeng.com/',
# Why: #3827 in Alexa global
'http://www.google.hn/',
# Why: #3828 in Alexa global
'http://www.homestead.com/',
# Why: #3829 in Alexa global
'http://www.filesonar.com/',
# Why: #3830 in Alexa global
'http://www.hsbccreditcard.com/',
# Why: #3831 in Alexa global
'http://www.google.com.np/',
# Why: #3832 in Alexa global
'http://www.parperfeito.com.br/',
# Why: #3833 in Alexa global
'http://www.sciencedaily.com/',
# Why: #3834 in Alexa global
'http://www.realgfporn.com/',
# Why: #3835 in Alexa global
'http://www.wonderhowto.com/',
# Why: #3836 in Alexa global
'http://www.rakuten-card.co.jp/',
# Why: #3837 in Alexa global
'http://www.coolrom.com/',
# Why: #3838 in Alexa global
'http://www.wikibooks.org/',
# Why: #3839 in Alexa global
'http://www.archdaily.com/',
# Why: #3840 in Alexa global
'http://www.gigazine.net/',
# Why: #3841 in Alexa global
'http://www.totaljerkface.com/',
# Why: #3842 in Alexa global
'http://www.bezaat.com/',
# Why: #3843 in Alexa global
'http://www.eurosport.com/',
# Why: #3844 in Alexa global
'http://www.fontspace.com/',
# Why: #3845 in Alexa global
'http://www.tirage24.com/',
# Why: #3846 in Alexa global
'http://www.bancomer.com.mx/',
# Why: #3847 in Alexa global
'http://www.nasdaq.com/',
# Why: #3848 in Alexa global
'http://www.bravoteens.com/',
# Why: #3849 in Alexa global
'http://www.bdjobs.com/',
# Why: #3850 in Alexa global
'http://www.zimbra.free.fr/',
# Why: #3851 in Alexa global
'http://www.arsenal.com/',
# Why: #3852 in Alexa global
'http://www.rabota.ru/',
# Why: #3853 in Alexa global
'http://www.lovefilm.com/',
# Why: #3854 in Alexa global
'http://www.artemisweb.jp/',
# Why: #3855 in Alexa global
'http://www.tsetmc.com/',
# Why: #3856 in Alexa global
'http://www.movshare.net/',
# Why: #3857 in Alexa global
'http://www.debonairblog.com/',
# Why: #3858 in Alexa global
'http://www.zmovie.co/',
# Why: #3859 in Alexa global
'http://www.peoplefinders.com/',
# Why: #3860 in Alexa global
'http://www.mercadolibre.com/',
# Why: #3861 in Alexa global
'http://www.connectlondoner.com/',
# Why: #3862 in Alexa global
'http://www.forbes.ru/',
# Why: #3863 in Alexa global
'http://www.gagnezauxoptions.com/',
# Why: #3864 in Alexa global
'http://www.taikang.com/',
# Why: #3865 in Alexa global
'http://www.mywapblog.com/',
# Why: #3866 in Alexa global
'http://www.citysearch.com/',
# Why: #3867 in Alexa global
'http://www.novafinanza.com/',
# Why: #3868 in Alexa global
'http://www.gruposantander.es/',
# Why: #3869 in Alexa global
'http://www.relianceada.com/',
# Why: #3870 in Alexa global
'http://www.rankingsandreviews.com/',
# Why: #3871 in Alexa global
'http://www.p-world.co.jp/',
# Why: #3872 in Alexa global
'http://hjenglish.com/',
# Why: #3873 in Alexa global
'http://www.state.nj.us/',
# Why: #3874 in Alexa global
'http://www.comdirect.de/',
# Why: #3875 in Alexa global
'http://www.claro.com.br/',
# Why: #3876 in Alexa global
'http://www.alluc.to/',
# Why: #3877 in Alexa global
'http://www.godlikeproductions.com/',
# Why: #3878 in Alexa global
'http://www.lowyat.net/',
# Why: #3879 in Alexa global
'http://www.dawn.com/',
# Why: #3880 in Alexa global
'http://www.18xgirls.com/',
# Why: #3881 in Alexa global
'http://www.origo.hu/',
# Why: #3882 in Alexa global
'http://www.loopnet.com/',
# Why: #3883 in Alexa global
'http://www.payu.in/',
# Why: #3884 in Alexa global
'http://www.digitalmedia-comunicacion.com/',
# Why: #3885 in Alexa global
'http://www.newsvine.com/',
# Why: #3886 in Alexa global
'http://www.petfinder.com/',
# Why: #3887 in Alexa global
'http://www.kuaibo.com/',
# Why: #3888 in Alexa global
'http://www.soft32.com/',
# Why: #3889 in Alexa global
'http://www.yellowpages.ca/',
# Why: #3890 in Alexa global
'http://www.1fichier.com/',
# Why: #3891 in Alexa global
'http://www.egyup.com/',
# Why: #3892 in Alexa global
'http://www.iskullgames.com/',
# Why: #3893 in Alexa global
'http://www.androidforums.com/',
# Why: #3894 in Alexa global
'http://www.blogspot.cz/',
# Why: #3895 in Alexa global
'http://www.umich.edu/',
# Why: #3896 in Alexa global
'http://www.madsextube.com/',
# Why: #3897 in Alexa global
'http://www.bigcinema.tv/',
# Why: #3898 in Alexa global
'http://www.donedeal.ie/',
# Why: #3899 in Alexa global
'http://www.winporn.com/',
# Why: #3900 in Alexa global
'http://www.cosmopolitan.com/',
# Why: #3901 in Alexa global
'http://www.reg.ru/',
# Why: #3902 in Alexa global
'http://www.localmoxie.com/',
# Why: #3903 in Alexa global
'http://www.kootation.com/',
# Why: #3904 in Alexa global
'http://www.gidonline.ru/',
# Why: #3905 in Alexa global
'http://www.clipconverter.cc/',
# Why: #3906 in Alexa global
'http://www.gioco.it/',
# Why: #3907 in Alexa global
'http://www.ravelry.com/',
# Why: #3908 in Alexa global
'http://www.gettyimages.com/',
# Why: #3909 in Alexa global
'http://www.nanapi.jp/',
# Why: #3910 in Alexa global
'http://www.medicalnewsreporter.com/',
# Why: #3911 in Alexa global
'http://www.shop411.com/',
# Why: #3912 in Alexa global
'http://www.aif.ru/',
# Why: #3913 in Alexa global
'http://www.journaldesfemmes.com/',
# Why: #3914 in Alexa global
'http://www.blogcu.com/',
# Why: #3915 in Alexa global
'http://www.vanguard.com/',
# Why: #3916 in Alexa global
'http://www.freemp3go.com/',
# Why: #3917 in Alexa global
'http://www.google.ci/',
# Why: #3918 in Alexa global
'http://www.findicons.com/',
# Why: #3919 in Alexa global
'http://www.tineye.com/',
# Why: #3920 in Alexa global
'http://www.webdesignerdepot.com/',
# Why: #3921 in Alexa global
'http://www.nomorerack.com/',
# Why: #3922 in Alexa global
'http://www.iqoo.me/',
# Why: #3923 in Alexa global
'http://www.amarujala.com/',
# Why: #3924 in Alexa global
'http://pengfu.com/',
# Why: #3925 in Alexa global
'http://www.leadpages.net/',
# Why: #3926 in Alexa global
'http://www.zalukaj.tv/',
# Why: #3927 in Alexa global
'http://www.avon.com/',
# Why: #3928 in Alexa global
'http://www.casasbahia.com.br/',
# Why: #3929 in Alexa global
'http://www.juegosdechicas.com/',
# Why: #3930 in Alexa global
'http://www.tvrain.ru/',
# Why: #3931 in Alexa global
'http://www.askmefast.com/',
# Why: #3932 in Alexa global
'http://www.stockcharts.com/',
# Why: #3934 in Alexa global
'http://www.footlocker.com/',
# Why: #3935 in Alexa global
'http://www.allanalpass.com/',
# Why: #3936 in Alexa global
'http://www.theoatmeal.com/',
# Why: #3937 in Alexa global
'http://www.storify.com/',
# Why: #3938 in Alexa global
'http://www.santander.com.br/',
# Why: #3939 in Alexa global
'http://www.laughnfiddle.com/',
# Why: #3940 in Alexa global
'http://www.lomadee.com/',
# Why: #3941 in Alexa global
'http://aftenposten.no/',
# Why: #3942 in Alexa global
'http://www.lamoda.ru/',
# Why: #3943 in Alexa global
'http://www.tasteofhome.com/',
# Why: #3944 in Alexa global
'http://www.news247.gr/',
# Why: #3946 in Alexa global
'http://www.sherdog.com/',
# Why: #3947 in Alexa global
'http://www.milb.com/',
# Why: #3948 in Alexa global
'http://www.3djuegos.com/',
# Why: #3949 in Alexa global
'http://www.dreammovies.com/',
# Why: #3950 in Alexa global
'http://www.commonfloor.com/',
# Why: #3951 in Alexa global
'http://www.tharunee.lk/',
# Why: #3952 in Alexa global
'http://www.chatrandom.com/',
# Why: #3953 in Alexa global
'http://xs8.cn/',
# Why: #3955 in Alexa global
'http://www.rechargeitnow.com/',
# Why: #3956 in Alexa global
'http://am15.net/',
# Why: #3957 in Alexa global
'http://www.sexad.net/',
# Why: #3958 in Alexa global
'http://www.herokuapp.com/',
# Why: #3959 in Alexa global
'http://www.apontador.com.br/',
# Why: #3960 in Alexa global
'http://www.rfi.fr/',
# Why: #3961 in Alexa global
'http://www.woozworld.com/',
# Why: #3962 in Alexa global
'http://www.hitta.se/',
# Why: #3963 in Alexa global
'http://www.comedycentral.com/',
# Why: #3964 in Alexa global
'http://www.fbsbx.com/',
# Why: #3965 in Alexa global
'http://www.aftabnews.ir/',
# Why: #3966 in Alexa global
'http://www.stepstone.de/',
# Why: #3967 in Alexa global
'http://www.filmon.com/',
# Why: #3969 in Alexa global
'http://www.smbc.co.jp/',
# Why: #3970 in Alexa global
'http://www.ameritrade.com/',
# Why: #3971 in Alexa global
'http://www.ecitic.com/',
# Why: #3972 in Alexa global
'http://www.bola.net/',
# Why: #3973 in Alexa global
'http://www.nexon.co.jp/',
# Why: #3974 in Alexa global
'http://www.hellowork.go.jp/',
# Why: #3975 in Alexa global
'http://www.hq-sex-tube.com/',
# Why: #3976 in Alexa global
'http://www.gsp.ro/',
# Why: #3977 in Alexa global
'http://www.groupon.co.uk/',
# Why: #3978 in Alexa global
'http://www.20min.ch/',
# Why: #3979 in Alexa global
'http://www.barclaycardus.com/',
# Why: #3980 in Alexa global
'http://www.dice.com/',
# Why: #3981 in Alexa global
'http://himasoku.com/',
# Why: #3982 in Alexa global
'http://www.nwsource.com/',
# Why: #3983 in Alexa global
'http://www.gougou.com/',
# Why: #3984 in Alexa global
'http://www.iol.co.za/',
# Why: #3985 in Alexa global
'http://www.thinkgeek.com/',
# Why: #3986 in Alexa global
'http://www.governmentjobs.com/',
# Why: #3987 in Alexa global
'http://www.500.com/',
# Why: #3988 in Alexa global
'http://www.caixin.com/',
# Why: #3989 in Alexa global
'http://www.elsevier.com/',
# Why: #3990 in Alexa global
'http://www.navitime.co.jp/',
# Why: #3991 in Alexa global
'http://www.rafflecopter.com/',
# Why: #3992 in Alexa global
'http://www.auctiva.com/',
# Why: #3994 in Alexa global
'http://www.pracuj.pl/',
# Why: #3995 in Alexa global
'http://www.strato.de/',
# Why: #3996 in Alexa global
'http://www.ricardoeletro.com.br/',
# Why: #3997 in Alexa global
'http://www.vodafone.de/',
# Why: #3998 in Alexa global
'http://www.jike.com/',
# Why: #3999 in Alexa global
'http://www.smosh.com/',
# Why: #4000 in Alexa global
'http://www.downlite.net/',
# Why: #4001 in Alexa global
'http://to8to.com/',
# Why: #4003 in Alexa global
'http://www.tikona.in/',
# Why: #4004 in Alexa global
'http://www.royalmail.com/',
# Why: #4005 in Alexa global
'http://www.tripadvisor.de/',
# Why: #4006 in Alexa global
'http://www.realclearpolitics.com/',
# Why: #4007 in Alexa global
'http://www.pubdirecte.com/',
# Why: #4008 in Alexa global
'http://www.rassd.com/',
# Why: #4009 in Alexa global
'http://www.ptt.cc/',
# Why: #4010 in Alexa global
'http://www.townhall.com/',
# Why: #4011 in Alexa global
'http://www.theoldreader.com/',
# Why: #4012 in Alexa global
'http://www.viki.com/',
# Why: #4013 in Alexa global
'http://www.one.com/',
# Why: #4014 in Alexa global
'http://www.peopleperhour.com/',
# Why: #4015 in Alexa global
'http://www.desidime.com/',
# Why: #4016 in Alexa global
'http://www.17track.net/',
# Why: #4017 in Alexa global
'http://www.duote.com/',
# Why: #4018 in Alexa global
'http://www.emuch.net/',
# Why: #4019 in Alexa global
'http://www.mlgame.co.uk/',
# Why: #4020 in Alexa global
'http://www.rockstargames.com/',
# Why: #4021 in Alexa global
'http://www.slaati.com/',
# Why: #4022 in Alexa global
'http://www.ibibo.com/',
# Why: #4023 in Alexa global
'http://www.journaldunet.com/',
# Why: #4024 in Alexa global
'http://www.ria.ua/',
# Why: #4025 in Alexa global
'http://www.odatv.com/',
# Why: #4026 in Alexa global
'http://www.comodo.com/',
# Why: #4027 in Alexa global
'http://www.clickfair.com/',
# Why: #4028 in Alexa global
'http://www.system500.com/',
# Why: #4029 in Alexa global
'http://www.wordstream.com/',
# Why: #4030 in Alexa global
'http://www.alexaboostup.com/',
# Why: #4031 in Alexa global
'http://www.yjbys.com/',
# Why: #4032 in Alexa global
'http://www.hsbc.com/',
# Why: #4033 in Alexa global
'http://www.online-convert.com/',
# Why: #4034 in Alexa global
'http://www.miui.com/',
# Why: #4035 in Alexa global
'http://www.totaljobs.com/',
# Why: #4036 in Alexa global
'http://www.travian.fr/',
# Why: #4037 in Alexa global
'http://www.funda.nl/',
# Why: #4038 in Alexa global
'http://www.bazos.sk/',
# Why: #4039 in Alexa global
'http://www.efukt.com/',
# Why: #4040 in Alexa global
'http://www.startlap.com/',
# Why: #4041 in Alexa global
'http://www.hir24.hu/',
# Why: #4042 in Alexa global
'http://www.mrskin.com/',
# Why: #4043 in Alexa global
'http://dbs.com/',
# Why: #4044 in Alexa global
'http://www.sevenforums.com/',
# Why: #4045 in Alexa global
'http://www.admitad.com/',
# Why: #4046 in Alexa global
'http://www.graaam.com/',
# Why: #4047 in Alexa global
'http://www.exactme.com/',
# Why: #4048 in Alexa global
'http://www.roadrunner.com/',
# Why: #4049 in Alexa global
'http://www.liberation.fr/',
# Why: #4050 in Alexa global
'http://www.cas.sk/',
# Why: #4051 in Alexa global
'http://www.redbubble.com/',
# Why: #4052 in Alexa global
'http://www.ezilon.com/',
# Why: #4053 in Alexa global
'http://www.hihi2.com/',
# Why: #4054 in Alexa global
'http://www.net.hr/',
# Why: #4055 in Alexa global
'http://www.mediaite.com/',
# Why: #4056 in Alexa global
'http://www.clip2net.com/',
# Why: #4057 in Alexa global
'http://www.wapka.mobi/',
# Why: #4058 in Alexa global
'http://www.dailybasis.com/',
# Why: #4059 in Alexa global
'http://www.o2online.de/',
# Why: #4060 in Alexa global
'http://www.tweetdeck.com/',
# Why: #4061 in Alexa global
'http://www.tripadvisor.jp/',
# Why: #4062 in Alexa global
'http://www.fakt.pl/',
# Why: #4063 in Alexa global
'http://www.service-public.fr/',
# Why: #4064 in Alexa global
'http://www.shueisha.co.jp/',
# Why: #4065 in Alexa global
'http://www.searchina.ne.jp/',
# Why: #4066 in Alexa global
'http://www.bodisparking.com/',
# Why: #4067 in Alexa global
'http://www.corporationwiki.com/',
# Why: #4068 in Alexa global
'http://www.jandan.net/',
# Why: #4069 in Alexa global
'http://www.chsi.com.cn/',
# Why: #4070 in Alexa global
'http://www.alisoft.com/',
# Why: #4071 in Alexa global
'http://www.gosuslugi.ru/',
# Why: #4072 in Alexa global
'http://www.grxf.com/',
# Why: #4073 in Alexa global
'http://www.daserste.de/',
# Why: #4074 in Alexa global
'http://www.freedigitalphotos.net/',
# Why: #4075 in Alexa global
'http://www.flirchi.ru/',
# Why: #4076 in Alexa global
'http://www.seesaa.jp/',
# Why: #4077 in Alexa global
'http://www.htmlbook.ru/',
# Why: #4078 in Alexa global
'http://www.independent.ie/',
# Why: #4079 in Alexa global
'http://www.bufferapp.com/',
# Why: #4080 in Alexa global
'http://www.panzar.com/',
# Why: #4081 in Alexa global
'http://www.sport.cz/',
# Why: #4082 in Alexa global
'http://matomeantena.com/',
# Why: #4083 in Alexa global
'http://www.thenewporn.com/',
# Why: #4084 in Alexa global
'http://www.iran-tejarat.com/',
# Why: #4085 in Alexa global
'http://www.rotoworld.com/',
# Why: #4086 in Alexa global
'http://maalaimalar.com/',
# Why: #4087 in Alexa global
'http://www.poppen.de/',
# Why: #4088 in Alexa global
'http://www.tenki.jp/',
# Why: #4089 in Alexa global
'http://www.homes.co.jp/',
# Why: #4090 in Alexa global
'http://www.csfd.cz/',
# Why: #4091 in Alexa global
'http://www.2ip.ru/',
# Why: #4092 in Alexa global
'http://www.hawamer.com/',
# Why: #4093 in Alexa global
'http://www.telkomsel.com/',
# Why: #4094 in Alexa global
'http://www.un.org/',
# Why: #4095 in Alexa global
'http://www.autobinaryea.com/',
# Why: #4096 in Alexa global
'http://www.emgoldex.com/',
# Why: #4097 in Alexa global
'http://www.saksfifthavenue.com/',
# Why: #4098 in Alexa global
'http://www.realtor.ca/',
# Why: #4099 in Alexa global
'http://www.hdwallpapers.in/',
# Why: #4100 in Alexa global
'http://www.chinahr.com/',
# Why: #4101 in Alexa global
'http://www.niazerooz.com/',
# Why: #4102 in Alexa global
'http://www.sina.com/',
# Why: #4103 in Alexa global
'http://www.kinopod.ru/',
# Why: #4104 in Alexa global
'http://www.funweek.it/',
# Why: #4105 in Alexa global
'http://www.pornsake.com/',
# Why: #4106 in Alexa global
'http://www.vitacost.com/',
# Why: #4107 in Alexa global
'http://www.band.uol.com.br/',
# Why: #4108 in Alexa global
'http://www.110.com/',
# Why: #4109 in Alexa global
'http://www.jobomas.com/',
# Why: #4110 in Alexa global
'http://www.joyreactor.cc/',
# Why: #4111 in Alexa global
'http://www.3dnews.ru/',
# Why: #4112 in Alexa global
'http://www.vedomosti.ru/',
# Why: #4113 in Alexa global
'http://www.stansberryresearch.com/',
# Why: #4114 in Alexa global
'http://www.performersoft.com/',
# Why: #4115 in Alexa global
'http://www.codecademy.com/',
# Why: #4116 in Alexa global
'http://www.petsmart.com/',
# Why: #4118 in Alexa global
'http://www.kissmetrics.com/',
# Why: #4119 in Alexa global
'http://www.infojobs.it/',
# Why: #4120 in Alexa global
'http://www.wealink.com/',
# Why: #4121 in Alexa global
'http://www.rapidtrk.com/',
# Why: #4122 in Alexa global
'http://www.enterprise.com/',
# Why: #4123 in Alexa global
'http://www.iran-forum.ir/',
# Why: #4124 in Alexa global
'http://www.express-files.com/',
# Why: #4126 in Alexa global
'http://www.cyberpresse.ca/',
# Why: #4127 in Alexa global
'http://www.dobreprogramy.pl/',
# Why: #4128 in Alexa global
'http://www.uploading.com/',
# Why: #4129 in Alexa global
'http://www.profitclicking.com/',
# Why: #4130 in Alexa global
'http://www.playwartune.com/',
# Why: #4131 in Alexa global
'http://www.toluna.com/',
# Why: #4132 in Alexa global
'http://www.shoptime.com.br/',
# Why: #4134 in Alexa global
'http://www.totaladperformance.com/',
# Why: #4135 in Alexa global
'http://www.handelsblatt.com/',
# Why: #4136 in Alexa global
'http://www.hamshahrionline.ir/',
# Why: #4137 in Alexa global
'http://www.15min.lt/',
# Why: #4138 in Alexa global
'http://www.wyborcza.pl/',
# Why: #4139 in Alexa global
'http://www.flvto.com/',
# Why: #4140 in Alexa global
'http://www.microsofttranslator.com/',
# Why: #4141 in Alexa global
'http://www.trovaprezzi.it/',
# Why: #4142 in Alexa global
'http://www.eversave.com/',
# Why: #4143 in Alexa global
'http://www.wmzona.com/',
# Why: #4144 in Alexa global
'http://www.hardwarezone.com.sg/',
# Why: #4145 in Alexa global
'http://thestar.com.my/',
# Why: #4146 in Alexa global
'http://www.siliconindia.com/',
# Why: #4147 in Alexa global
'http://www.jfranews.com/',
# Why: #4148 in Alexa global
'http://www.emol.com/',
# Why: #4149 in Alexa global
'http://www.nordea.fi/',
# Why: #4150 in Alexa global
'http://hers.com.cn/',
# Why: #4151 in Alexa global
'http://www.heroturko.me/',
# Why: #4152 in Alexa global
'http://www.xat.com/',
# Why: #4153 in Alexa global
'http://www.3asq.com/',
# Why: #4154 in Alexa global
'http://www.hlntv.com/',
# Why: #4155 in Alexa global
'http://incruit.com/',
# Why: #4156 in Alexa global
'http://www.list-manage2.com/',
# Why: #4157 in Alexa global
'http://www.bulbagarden.net/',
# Why: #4158 in Alexa global
'http://www.blogdohotelurbano.com/',
# Why: #4159 in Alexa global
'http://www.suomi24.fi/',
# Why: #4160 in Alexa global
'http://www.nicozon.net/',
# Why: #4161 in Alexa global
'http://www.tuporno.tv/',
# Why: #4162 in Alexa global
'http://www.perfectworld.com/',
# Why: #4163 in Alexa global
'http://www.ayosdito.ph/',
# Why: #4164 in Alexa global
'http://www.gmx.at/',
# Why: #4165 in Alexa global
'http://www.123greetings.com/',
# Why: #4166 in Alexa global
'http://www.metafilter.com/',
# Why: #4167 in Alexa global
'http://www.g9g.com/',
# Why: #4168 in Alexa global
'http://www.searchnfind.org/',
# Why: #4169 in Alexa global
'http://www.pcgamer.com/',
# Why: #4170 in Alexa global
'http://economia.uol.com.br/',
# Why: #4171 in Alexa global
'http://www.on.cc/',
# Why: #4172 in Alexa global
'http://www.rentalcars.com/',
# Why: #4173 in Alexa global
'http://www.mail2web.com/',
# Why: #4174 in Alexa global
'http://www.zalando.it/',
# Why: #4175 in Alexa global
'http://www.freevideo.cz/',
# Why: #4176 in Alexa global
'http://www.source-wave.com/',
# Why: #4177 in Alexa global
'http://www.iranjib.ir/',
# Why: #4178 in Alexa global
'http://www.societe.com/',
# Why: #4179 in Alexa global
'http://www.160by2.com/',
# Why: #4180 in Alexa global
'http://www.berooztarinha.com/',
# Why: #4181 in Alexa global
'http://www.popmog.com/',
# Why: #4182 in Alexa global
'http://www.fantasy8.com/',
# Why: #4183 in Alexa global
'http://www.motortrend.com/',
# Why: #4184 in Alexa global
'http://www.huffingtonpost.ca/',
# Why: #4185 in Alexa global
'http://51test.net/',
# Why: #4186 in Alexa global
'http://www.ringtonematcher.com/',
# Why: #4187 in Alexa global
'http://www.ourtime.com/',
# Why: #4188 in Alexa global
'http://www.standardchartered.co.in/',
# Why: #4189 in Alexa global
'http://www.rdio.com/',
# Why: #4190 in Alexa global
'http://www.parsiblog.com/',
# Why: #4191 in Alexa global
'http://www.btvguide.com/',
# Why: #4192 in Alexa global
'http://www.sport.ro/',
# Why: #4193 in Alexa global
'http://www.freep.com/',
# Why: #4194 in Alexa global
'http://www.gismeteo.ua/',
# Why: #4195 in Alexa global
'http://www.rojadirecta.me/',
# Why: #4196 in Alexa global
'http://www.babol.pl/',
# Why: #4198 in Alexa global
'http://www.lun.com/',
# Why: #4199 in Alexa global
'http://www.epicurious.com/',
# Why: #4200 in Alexa global
'http://www.fetishok.com/',
# Why: #4201 in Alexa global
'http://www.mystart.com/',
# Why: #4202 in Alexa global
'http://www.wn.com/',
# Why: #4203 in Alexa global
'http://www.nationalrail.co.uk/',
# Why: #4204 in Alexa global
'http://www.feedsportal.com/',
# Why: #4205 in Alexa global
'http://www.rai.it/',
# Why: #4206 in Alexa global
'http://www.sportlemon.tv/',
# Why: #4207 in Alexa global
'http://www.groupon.com.br/',
# Why: #4208 in Alexa global
'http://www.ebay.at/',
# Why: #4209 in Alexa global
'http://www.yourdictionary.com/',
# Why: #4210 in Alexa global
'http://www.360safe.com/',
# Why: #4211 in Alexa global
'http://www.statefarm.com/',
# Why: #4212 in Alexa global
'http://www.desjardins.com/',
# Why: #4213 in Alexa global
'http://www.biblehub.com/',
# Why: #4214 in Alexa global
'http://www.mercadolibre.cl/',
# Why: #4215 in Alexa global
'http://www.eluniversal.com/',
# Why: #4216 in Alexa global
'http://www.lrytas.lt/',
# Why: #4217 in Alexa global
'http://www.youboy.com/',
# Why: #4218 in Alexa global
'http://www.gratka.pl/',
# Why: #4219 in Alexa global
'http://etype.com/',
# Why: #4220 in Alexa global
'http://www.reallifecam.com/',
# Why: #4221 in Alexa global
'http://www.imp.free.fr/',
# Why: #4222 in Alexa global
'http://www.jobstreet.co.id/',
# Why: #4223 in Alexa global
'http://www.geenstijl.nl/',
# Why: #4224 in Alexa global
'http://www.aebn.net/',
# Why: #4225 in Alexa global
'http://www.openoffice.org/',
# Why: #4226 in Alexa global
'http://www.diythemes.com/',
# Why: #4227 in Alexa global
'http://www.2gis.ru/',
# Why: #4228 in Alexa global
'http://www.wpmu.org/',
# Why: #4229 in Alexa global
'http://www.scrubtheweb.com/',
# Why: #4230 in Alexa global
'http://www.domain.com.au/',
# Why: #4231 in Alexa global
'http://www.buyma.com/',
# Why: #4232 in Alexa global
'http://www.ccbill.com/',
# Why: #4233 in Alexa global
'http://www.tui18.com/',
# Why: #4234 in Alexa global
'http://www.duga.jp/',
# Why: #4235 in Alexa global
'http://www.goforfiles.com/',
# Why: #4236 in Alexa global
'http://www.billionuploads.com/',
# Why: #4237 in Alexa global
'http://www.blogtalkradio.com/',
# Why: #4238 in Alexa global
'http://www.pipl.com/',
# Why: #4239 in Alexa global
'http://www.wallpaperswide.com/',
# Why: #4240 in Alexa global
'http://www.tuttosport.com/',
# Why: #4241 in Alexa global
'http://www.astucecherry.com/',
# Why: #4242 in Alexa global
'http://www.tradingfornewbies.com/',
# Why: #4243 in Alexa global
'http://www.umn.edu/',
# Why: #4244 in Alexa global
'http://www.rj.gov.br/',
# Why: #4245 in Alexa global
'http://www.mlive.com/',
# Why: #4246 in Alexa global
'http://www.justfab.com/',
# Why: #4247 in Alexa global
'http://www.ijreview.com/',
# Why: #4248 in Alexa global
'http://www.daniweb.com/',
# Why: #4249 in Alexa global
'http://www.quickmeme.com/',
# Why: #4250 in Alexa global
'http://www.safeway.com/',
# Why: #4251 in Alexa global
'http://www.virtualedge.com/',
# Why: #4252 in Alexa global
'http://www.saudiairlines.com/',
# Why: #4253 in Alexa global
'http://www.elbotola.com/',
# Why: #4254 in Alexa global
'http://www.holtgames.com/',
# Why: #4255 in Alexa global
'http://www.boots.com/',
# Why: #4256 in Alexa global
'http://www.potterybarn.com/',
# Why: #4257 in Alexa global
'http://www.mediamarkt.de/',
# Why: #4258 in Alexa global
'http://www.mangastream.com/',
# Why: #4259 in Alexa global
'http://www.mypoints.com/',
# Why: #4260 in Alexa global
'http://www.torrentdownloads.me/',
# Why: #4261 in Alexa global
'http://www.subtitleseeker.com/',
# Why: #4262 in Alexa global
'http://www.idlebrain.com/',
# Why: #4263 in Alexa global
'http://www.ekantipur.com/',
# Why: #4264 in Alexa global
'http://www.nowgamez.com/',
# Why: #4265 in Alexa global
'http://www.neoseeker.com/',
# Why: #4266 in Alexa global
'http://www.christianpost.com/',
# Why: #4267 in Alexa global
'http://www.joystiq.com/',
# Why: #4268 in Alexa global
'http://acesso.uol.com.br/',
# Why: #4269 in Alexa global
'http://www.bakufu.jp/',
# Why: #4270 in Alexa global
'http://www.iphone-winners.info/',
# Why: #4271 in Alexa global
'http://www.quizlet.com/',
# Why: #4272 in Alexa global
'http://www.prosport.ro/',
# Why: #4273 in Alexa global
'http://www.quanjing.com/',
# Why: #4274 in Alexa global
'http://autov.com.cn/',
# Why: #4275 in Alexa global
'http://www.gamechit.com/',
# Why: #4276 in Alexa global
'http://www.teleshow.pl/',
# Why: #4277 in Alexa global
'http://www.corrieredellosport.it/',
# Why: #4278 in Alexa global
'http://www.yoo7.com/',
# Why: #4279 in Alexa global
'http://fotocasa.es/',
# Why: #4280 in Alexa global
'http://www.attracta.com/',
# Why: #4281 in Alexa global
'http://www.hyatt.com/',
# Why: #4282 in Alexa global
'http://www.confirmit.com/',
# Why: #4283 in Alexa global
'http://www.xyu.tv/',
# Why: #4284 in Alexa global
'http://www.yoolplay.com/',
# Why: #4285 in Alexa global
'http://www.active.com/',
# Why: #4286 in Alexa global
'http://www.gizmag.com/',
# Why: #4287 in Alexa global
'http://www.hostelworld.com/',
# Why: #4288 in Alexa global
'http://www.pc6.com/',
# Why: #4289 in Alexa global
'http://www.lacentrale.fr/',
# Why: #4290 in Alexa global
'http://www.megasesso.com/',
# Why: #4291 in Alexa global
'http://www.thairath.co.th/',
# Why: #4292 in Alexa global
'http://www.thinkprogress.org/',
# Why: #4293 in Alexa global
'http://www.400gb.com/',
# Why: #4294 in Alexa global
'http://www.manageflitter.com/',
# Why: #4295 in Alexa global
'http://www.pronto.com/',
# Why: #4296 in Alexa global
'http://www.erotube.org/',
# Why: #4297 in Alexa global
'http://luxtarget.com/',
# Why: #4298 in Alexa global
'http://www.vui.vn/',
# Why: #4299 in Alexa global
'http://www.screenrant.com/',
# Why: #4300 in Alexa global
'http://www.nationalreview.com/',
# Why: #4301 in Alexa global
'http://www.ikman.lk/',
# Why: #4302 in Alexa global
'http://www.aboutus.org/',
# Why: #4303 in Alexa global
'http://www.booloo.com/',
# Why: #4304 in Alexa global
'http://www.klm.com/',
# Why: #4305 in Alexa global
'http://www.aukro.ua/',
# Why: #4307 in Alexa global
'http://www.skladchik.com/',
# Why: #4308 in Alexa global
'http://alfalfalfa.com/',
# Why: #4309 in Alexa global
'http://www.ghanaweb.com/',
# Why: #4310 in Alexa global
'http://www.cheetahmail.com/',
# Why: #4311 in Alexa global
'http://www.celebritynetworth.com/',
# Why: #4312 in Alexa global
'http://www.honda.com/',
# Why: #4313 in Alexa global
'http://www.regnum.ru/',
# Why: #4314 in Alexa global
'http://www.mediabistro.com/',
# Why: #4315 in Alexa global
'http://www.template-help.com/',
# Why: #4316 in Alexa global
'http://www.elektroda.pl/',
# Why: #4317 in Alexa global
'http://www.howlifeworks.com/',
# Why: #4318 in Alexa global
'http://avjavjav.com/',
# Why: #4319 in Alexa global
'http://www.justunfollow.com/',
# Why: #4320 in Alexa global
'http://www.kindgirls.com/',
# Why: #4321 in Alexa global
'http://www.xrea.com/',
# Why: #4322 in Alexa global
'http://www.songspk.cc/',
# Why: #4323 in Alexa global
'http://www.softbank.jp/',
# Why: #4324 in Alexa global
'http://www.pcstore.com.tw/',
# Why: #4325 in Alexa global
'http://www.impiego24.it/',
# Why: #4326 in Alexa global
'http://www.health.com/',
# Why: #4327 in Alexa global
'http://www.whitehouse.gov/',
# Why: #4328 in Alexa global
'http://www.ulozto.cz/',
# Why: #4329 in Alexa global
'http://www.clickindia.com/',
# Why: #4330 in Alexa global
'http://www.zoosnet.net/',
# Why: #4331 in Alexa global
'http://huihui.cn/',
# Why: #4332 in Alexa global
'http://yingjiesheng.com/',
# Why: #4333 in Alexa global
'http://www.copacet.com/',
# Why: #4334 in Alexa global
'http://www.fluege.de/',
# Why: #4335 in Alexa global
'http://www.uiuc.edu/',
# Why: #4336 in Alexa global
'http://www.funnymama.com/',
# Why: #4337 in Alexa global
'http://www.main.jp/',
# Why: #4338 in Alexa global
'http://www.popsugar.com/',
# Why: #4339 in Alexa global
'http://www.siyahgazete.com/',
# Why: #4340 in Alexa global
'http://www.ligatus.com/',
# Why: #4342 in Alexa global
'http://www.seomastering.com/',
# Why: #4343 in Alexa global
'http://www.nintendo.com/',
# Why: #4344 in Alexa global
'http://www.kuaidi100.com/',
# Why: #4345 in Alexa global
'http://www.motor-talk.de/',
# Why: #4346 in Alexa global
'http://www.p.ht/',
# Why: #4347 in Alexa global
'http://www.care.com/',
# Why: #4348 in Alexa global
'http://www.ttnet.com.tr/',
# Why: #4349 in Alexa global
'http://www.cifraclub.com.br/',
# Why: #4350 in Alexa global
'http://www.yunfile.com/',
# Why: #4351 in Alexa global
'http://www.telechargement-de-ouf.fr/',
# Why: #4352 in Alexa global
'http://www.hotpornshow.com/',
# Why: #4353 in Alexa global
'http://www.jra.go.jp/',
# Why: #4354 in Alexa global
'http://www.upenn.edu/',
# Why: #4355 in Alexa global
'http://www.brg8.com/',
# Why: #4356 in Alexa global
'http://www.techspot.com/',
# Why: #4357 in Alexa global
'http://www.citytalk.tw/',
# Why: #4358 in Alexa global
'http://www.milli.az/',
# Why: #4359 in Alexa global
'http://www.segundamano.mx/',
# Why: #4360 in Alexa global
'http://www.n4g.com/',
# Why: #4361 in Alexa global
'http://www.blogspot.no/',
# Why: #4362 in Alexa global
'http://www.frys.com/',
# Why: #4363 in Alexa global
'http://www.pixhost.org/',
# Why: #4364 in Alexa global
'http://www.washington.edu/',
# Why: #4365 in Alexa global
'http://www.rte.ie/',
# Why: #4366 in Alexa global
'http://www.lockerdome.com/',
# Why: #4367 in Alexa global
'http://www.sblo.jp/',
# Why: #4368 in Alexa global
'http://www.qassimy.com/',
# Why: #4369 in Alexa global
'http://www.signup.wordpress.com/',
# Why: #4370 in Alexa global
'http://www.sochiset.com/',
# Why: #4371 in Alexa global
'http://www.mycokerewards.com/',
# Why: #4372 in Alexa global
'http://www.collegeboard.org/',
# Why: #4373 in Alexa global
'http://www.fengyunzhibo.com/',
# Why: #4374 in Alexa global
'http://www.twickerz.com/',
# Why: #4375 in Alexa global
'http://www.bikroy.com/',
# Why: #4376 in Alexa global
'http://www.apkmania.co/',
# Why: #4378 in Alexa global
'http://www.webrankstats.com/',
# Why: #4379 in Alexa global
'http://www.dl-protect.com/',
# Why: #4380 in Alexa global
'http://www.dr.dk/',
# Why: #4381 in Alexa global
'http://www.emoneyspace.com/',
# Why: #4382 in Alexa global
'http://www.zakzak.co.jp/',
# Why: #4383 in Alexa global
'http://www.rae.es/',
# Why: #4384 in Alexa global
'http://www.theexgirlfriends.com/',
# Why: #4385 in Alexa global
'http://www.gigaom.com/',
# Why: #4386 in Alexa global
'http://www.burmeseclassic.com/',
# Why: #4387 in Alexa global
'http://www.wisc.edu/',
# Why: #4388 in Alexa global
'http://www.ocnk.net/',
# Why: #4389 in Alexa global
'http://www.arcot.com/',
# Why: #4390 in Alexa global
'http://www.paginasamarillas.es/',
# Why: #4391 in Alexa global
'http://www.tunisia-sat.com/',
# Why: #4392 in Alexa global
'http://www.medscape.com/',
# Why: #4393 in Alexa global
'http://www.gameninja.com/',
# Why: #4394 in Alexa global
'http://www.imperiaonline.org/',
# Why: #4395 in Alexa global
'http://www.2ememain.be/',
# Why: #4396 in Alexa global
'http://www.myshopping.com.au/',
# Why: #4397 in Alexa global
'http://www.nvidia.com/',
# Why: #4398 in Alexa global
'http://fanhuan.com/',
# Why: #4399 in Alexa global
'http://www.vista.ir/',
# Why: #4400 in Alexa global
'http://www.dish.com/',
# Why: #4401 in Alexa global
'http://www.cartrade.com/',
# Why: #4402 in Alexa global
'http://www.egopay.com/',
# Why: #4403 in Alexa global
'http://www.sonyentertainmentnetwork.com/',
# Why: #4404 in Alexa global
'http://www.myway.com/',
# Why: #4405 in Alexa global
'http://www.kariyer.net/',
# Why: #4406 in Alexa global
'http://www.thanhnien.com.vn/',
# Why: #4407 in Alexa global
'http://www.gulfnews.com/',
# Why: #4409 in Alexa global
'http://www.flagcounter.com/',
# Why: #4410 in Alexa global
'http://www.yfrog.com/',
# Why: #4411 in Alexa global
'http://www.bigstockphoto.com/',
# Why: #4412 in Alexa global
'http://www.occ.com.mx/',
# Why: #4413 in Alexa global
'http://www.3911.net/',
# Why: #4414 in Alexa global
'http://naszemiasto.pl/',
# Why: #4415 in Alexa global
'http://www.pgatour.com/',
# Why: #4416 in Alexa global
'http://zgjrw.com/',
# Why: #4417 in Alexa global
'http://www.fdj.fr/',
# Why: #4418 in Alexa global
'http://www.motogp.com/',
# Why: #4419 in Alexa global
'http://www.organogold.com/',
# Why: #4420 in Alexa global
'http://www.tamindir.com/',
# Why: #4421 in Alexa global
'http://www.ykb.com/',
# Why: #4422 in Alexa global
'http://www.biglion.ru/',
# Why: #4423 in Alexa global
'http://www.yourfiledownloader.com/',
# Why: #4424 in Alexa global
'http://www.publika.az/',
# Why: #4425 in Alexa global
'http://www.dealnews.com/',
# Why: #4426 in Alexa global
'http://www.warnerbros.com/',
# Why: #4427 in Alexa global
'http://www.ne10.uol.com.br/',
# Why: #4428 in Alexa global
'http://www.wpmudev.org/',
# Why: #4429 in Alexa global
'http://autotimes.com.cn/',
# Why: #4430 in Alexa global
'http://www.pu-results.info/',
# Why: #4431 in Alexa global
'http://www.usajobs.gov/',
# Why: #4432 in Alexa global
'http://www.adsprofitwiz.es/',
# Why: #4433 in Alexa global
'http://www.parallels.com/',
# Why: #4434 in Alexa global
'http://www.thqafawe3lom.com/',
# Why: #4435 in Alexa global
'http://www.xiazaiba.com/',
# Why: #4436 in Alexa global
'http://www.enikos.gr/',
# Why: #4437 in Alexa global
'http://www.m5zn.com/',
# Why: #4438 in Alexa global
'http://www.dir.bg/',
# Why: #4439 in Alexa global
'http://www.ripoffreport.com/',
# Why: #4440 in Alexa global
'http://www.jusbrasil.com.br/',
# Why: #4441 in Alexa global
'http://www.maxifoot.fr/',
# Why: #4442 in Alexa global
'http://www.eva.vn/',
# Why: #4443 in Alexa global
'http://www.dfnhk8.net/',
# Why: #4444 in Alexa global
'http://www.api.ning.com/',
# Why: #4445 in Alexa global
'http://www.ligtv.com.tr/',
# Why: #4446 in Alexa global
'http://www.openrice.com/',
# Why: #4448 in Alexa global
'http://www.999120.net/',
# Why: #4449 in Alexa global
'http://www.pho.to/',
# Why: #4450 in Alexa global
'http://www.indiblogger.in/',
# Why: #4451 in Alexa global
'http://1hai.cn/',
# Why: #4452 in Alexa global
'http://www.jtb.co.jp/',
# Why: #4453 in Alexa global
'http://tfile.me/',
# Why: #4454 in Alexa global
'http://kotak.com/',
# Why: #4455 in Alexa global
'http://www.katproxy.com/',
# Why: #4456 in Alexa global
'http://www.calottery.com/',
# Why: #4457 in Alexa global
'http://www.klmty.net/',
# Why: #4458 in Alexa global
'http://www.endomondo.com/',
# Why: #4459 in Alexa global
'http://www.uploadboy.com/',
# Why: #4460 in Alexa global
'http://www.8tracks.com/',
# Why: #4461 in Alexa global
'http://www.toranoana.jp/',
# Why: #4462 in Alexa global
'http://www.blox.pl/',
# Why: #4463 in Alexa global
'http://www.conrad.de/',
# Why: #4464 in Alexa global
'http://www.sonico.com/',
# Why: #4465 in Alexa global
'http://www.windguru.cz/',
# Why: #4467 in Alexa global
'http://tinhte.vn/',
# Why: #4468 in Alexa global
'http://www.jorudan.co.jp/',
# Why: #4469 in Alexa global
'http://www.grantland.com/',
# Why: #4470 in Alexa global
'http://www.seratnews.ir/',
# Why: #4471 in Alexa global
'http://www.solomono.ru/',
# Why: #4472 in Alexa global
'http://www.foreca.com/',
# Why: #4473 in Alexa global
'http://www.ziprecruiter.com/',
# Why: #4474 in Alexa global
'http://www.chime.in/',
# Why: #4475 in Alexa global
'http://www.intesasanpaolo.com/',
# Why: #4476 in Alexa global
'http://www.softonic.de/',
# Why: #4477 in Alexa global
'http://www.adtech.info/',
# Why: #4478 in Alexa global
'http://www.appgame.com/',
# Why: #4479 in Alexa global
'http://www.opendns.com/',
# Why: #4480 in Alexa global
'http://www.tubekitty.com/',
# Why: #4481 in Alexa global
'http://www.linguee.de/',
# Why: #4482 in Alexa global
'http://www.pepperfry.com/',
# Why: #4483 in Alexa global
'http://www.egou.com/',
# Why: #4484 in Alexa global
'http://www.tweakers.net/',
# Why: #4485 in Alexa global
'http://alfavita.gr/',
# Why: #4486 in Alexa global
'http://www.plusnetwork.com/',
# Why: #4487 in Alexa global
'http://www.timeweb.ru/',
# Why: #4488 in Alexa global
'http://www.maybeporn.com/',
# Why: #4489 in Alexa global
'http://www.gharreh.com/',
# Why: #4490 in Alexa global
'http://www.canoe.ca/',
# Why: #4491 in Alexa global
'http://parsine.com/',
# Why: #4492 in Alexa global
'http://www.yto.net.cn/',
# Why: #4493 in Alexa global
'http://www.ucla.edu/',
# Why: #4494 in Alexa global
'http://www.freeridegames.com/',
# Why: #4495 in Alexa global
'http://www.doctoroz.com/',
# Why: #4496 in Alexa global
'http://www.tradeindia.com/',
# Why: #4497 in Alexa global
'http://www.socialmediabar.com/',
# Why: #4498 in Alexa global
'http://www.yaske.net/',
# Why: #4499 in Alexa global
'http://www.miniih.com/',
# Why: #4500 in Alexa global
'http://www.blog.me/',
# Why: #4501 in Alexa global
'http://www.dn.se/',
# Why: #4502 in Alexa global
'http://www.almos3a.com/',
# Why: #4503 in Alexa global
'http://www.bbvanet.com.mx/',
# Why: #4504 in Alexa global
'http://www.fcbarcelona.com/',
# Why: #4505 in Alexa global
'http://www.web.com/',
# Why: #4506 in Alexa global
'http://www.raaga.com/',
# Why: #4507 in Alexa global
'http://www.yad2.co.il/',
# Why: #4508 in Alexa global
'http://2cto.com/',
# Why: #4509 in Alexa global
'http://www.nx8.com/',
# Why: #4510 in Alexa global
'http://www.modcloth.com/',
# Why: #4511 in Alexa global
'http://www.carsales.com.au/',
# Why: #4512 in Alexa global
'http://www.cooks.com/',
# Why: #4513 in Alexa global
'http://www.fileswap.com/',
# Why: #4514 in Alexa global
'http://www.egyptiansnews.com/',
# Why: #4515 in Alexa global
'http://www.azyya.com/',
# Why: #4516 in Alexa global
'http://www.masreat.com/',
# Why: #4517 in Alexa global
'http://airliners.net/',
# Why: #4518 in Alexa global
'http://www.com-1b.info/',
# Why: #4519 in Alexa global
'http://www.virginmobileusa.com/',
# Why: #4520 in Alexa global
'http://www.pleasantharborrv.com/',
# Why: #4521 in Alexa global
'http://www.gsmhosting.com/',
# Why: #4522 in Alexa global
'http://www.foxbusiness.com/',
# Why: #4523 in Alexa global
'http://www.delfi.lv/',
# Why: #4524 in Alexa global
'http://www.flightaware.com/',
# Why: #4525 in Alexa global
'http://www.ameli.fr/',
# Why: #4526 in Alexa global
'http://fbxtk.com/',
# Why: #4527 in Alexa global
'http://www.purdue.edu/',
# Why: #4528 in Alexa global
'http://www.sbi.co.in/',
# Why: #4529 in Alexa global
'http://www.fotka.pl/',
# Why: #4530 in Alexa global
'http://www.quicksprout.com/',
# Why: #4531 in Alexa global
'http://www.arjwana.com/',
# Why: #4533 in Alexa global
'http://www.affili.net/',
# Why: #4535 in Alexa global
'http://www.5sing.com/',
# Why: #4536 in Alexa global
'http://www.mozilla.com/',
# Why: #4537 in Alexa global
'http://www.apk.tw/',
# Why: #4538 in Alexa global
'http://www.taaza.com/',
# Why: #4539 in Alexa global
'http://www.onetad.com/',
# Why: #4540 in Alexa global
'http://www.vivastreet.it/',
# Why: #4541 in Alexa global
'http://www.leguide.com/',
# Why: #4542 in Alexa global
'http://www.casualclub.com/',
# Why: #4543 in Alexa global
'http://www.wanelo.com/',
# Why: #4544 in Alexa global
'http://www.ipsosinteractive.com/',
# Why: #4545 in Alexa global
'http://www.videohive.net/',
# Why: #4546 in Alexa global
'http://www.fenzhi.com/',
# Why: #4547 in Alexa global
'http://www.lefrecce.it/',
# Why: #4548 in Alexa global
'http://www.bugun.com.tr/',
# Why: #4549 in Alexa global
'http://www.p30world.com/',
# Why: #4550 in Alexa global
'http://www.cuevana.tv/',
# Why: #4551 in Alexa global
'http://www.joins.com/',
# Why: #4552 in Alexa global
'http://www.tvnet.lv/',
# Why: #4553 in Alexa global
'http://aliimg.com/',
# Why: #4554 in Alexa global
'http://www.bellanaija.com/',
# Why: #4555 in Alexa global
'http://www.startpagina.nl/',
# Why: #4556 in Alexa global
'http://www.incometaxindiaefiling.gov.in/',
# Why: #4557 in Alexa global
'http://www.bellemaison.jp/',
# Why: #4558 in Alexa global
'http://www.michigan.gov/',
# Why: #4559 in Alexa global
'http://www.harborfreight.com/',
# Why: #4560 in Alexa global
'http://www.fineartamerica.com/',
# Why: #4561 in Alexa global
'http://www.mysurvey.com/',
# Why: #4562 in Alexa global
'http://www.kapaza.be/',
# Why: #4563 in Alexa global
'http://www.adxpansion.com/',
# Why: #4564 in Alexa global
'http://www.thefind.com/',
# Why: #4565 in Alexa global
'http://www.priyo.com/',
# Why: #4567 in Alexa global
'http://www.burrp.com/',
# Why: #4568 in Alexa global
'http://www.sky.it/',
# Why: #4569 in Alexa global
'http://www.ipad-winners.info/',
# Why: #4570 in Alexa global
'http://www.usgs.gov/',
# Why: #4571 in Alexa global
'http://www.gavick.com/',
# Why: #4572 in Alexa global
'http://www.ellislab.com/',
# Why: #4573 in Alexa global
'http://www.voegol.com.br/',
# Why: #4574 in Alexa global
'http://www.paginebianche.it/',
# Why: #4575 in Alexa global
'http://www.getwebcake.com/',
# Why: #4576 in Alexa global
'http://www.zeroredirect1.com/',
# Why: #4577 in Alexa global
'http://www.gaiaonline.com/',
# Why: #4578 in Alexa global
'http://iqilu.com/',
# Why: #4579 in Alexa global
'http://www.bright.com/',
# Why: #4580 in Alexa global
'http://www.comunidades.net/',
# Why: #4581 in Alexa global
'http://www.webgains.com/',
# Why: #4582 in Alexa global
'http://www.overdrive.com/',
# Why: #4583 in Alexa global
'http://www.bigcommerce.com/',
# Why: #4584 in Alexa global
'http://www.paperpkads.com/',
# Why: #4585 in Alexa global
'http://www.imageporter.com/',
# Why: #4586 in Alexa global
'http://www.lenovo.com.cn/',
# Why: #4587 in Alexa global
'http://www.listal.com/',
# Why: #4588 in Alexa global
'http://www.virgula.uol.com.br/',
# Why: #4589 in Alexa global
'http://www.rbcdaily.ru/',
# Why: #4590 in Alexa global
'http://www.redbus.in/',
# Why: #4591 in Alexa global
'http://www.3bmeteo.com/',
# Why: #4592 in Alexa global
'http://www.earn-on.com/',
# Why: #4593 in Alexa global
'http://www.ae.com/',
# Why: #4594 in Alexa global
'http://www.shoutmeloud.com/',
# Why: #4595 in Alexa global
'http://www.oeeee.com/',
# Why: #4596 in Alexa global
'http://www.usenet.nl/',
# Why: #4597 in Alexa global
'http://www.mediotiempo.com/',
# Why: #4599 in Alexa global
'http://www.prostoporno.net/',
# Why: #4600 in Alexa global
'http://www.bangyoulater.com/',
# Why: #4601 in Alexa global
'http://www.comunio.de/',
# Why: #4602 in Alexa global
'http://www.pureleads.com/',
# Why: #4603 in Alexa global
'http://www.bakeca.it/',
# Why: #4604 in Alexa global
'http://www.trovit.it/',
# Why: #4605 in Alexa global
'http://www.fakku.net/',
# Why: #4606 in Alexa global
'http://www.indeed.fr/',
# Why: #4607 in Alexa global
'http://www.inquisitr.com/',
# Why: #4608 in Alexa global
'http://www.wizards.com/',
# Why: #4609 in Alexa global
'http://www.straightdope.com/',
# Why: #4610 in Alexa global
'http://www.pornpros.com/',
# Why: #4611 in Alexa global
'http://www.s-oman.net/',
# Why: #4612 in Alexa global
'http://www.facilisimo.com/',
# Why: #4613 in Alexa global
'http://www.dostor.org/',
# Why: #4614 in Alexa global
'http://tabloidpulsa.co.id/',
# Why: #4615 in Alexa global
'http://www.shafaf.ir/',
# Why: #4616 in Alexa global
'http://www.bt.dk/',
# Why: #4617 in Alexa global
'http://www.lent.az/',
# Why: #4618 in Alexa global
'http://www.filmaffinity.com/',
# Why: #4619 in Alexa global
'http://www.wjunction.com/',
# Why: #4620 in Alexa global
'http://www.gamefront.com/',
# Why: #4621 in Alexa global
'http://www.photoshelter.com/',
# Why: #4622 in Alexa global
'http://www.cheaptickets.com/',
# Why: #4623 in Alexa global
'http://www.meetic.it/',
# Why: #4624 in Alexa global
'http://www.seochat.com/',
# Why: #4625 in Alexa global
'http://www.livemixtapes.com/',
# Why: #4626 in Alexa global
'http://www.deadline.com/',
# Why: #4627 in Alexa global
'http://www.boingboing.net/',
# Why: #4628 in Alexa global
'http://www.lecai.com/',
# Why: #4629 in Alexa global
'http://www.onetravel.com/',
# Why: #4631 in Alexa global
'http://www.erotictube.me/',
# Why: #4632 in Alexa global
'http://www.svd.se/',
# Why: #4633 in Alexa global
'http://www.pcadvisor.co.uk/',
# Why: #4634 in Alexa global
'http://www.pravda.com.ua/',
# Why: #4636 in Alexa global
'http://www.afisha.ru/',
# Why: #4637 in Alexa global
'http://www.dressupgamesite.com/',
# Why: #4638 in Alexa global
'http://www.mercadopago.com/',
# Why: #4640 in Alexa global
'http://www.bangkokpost.com/',
# Why: #4641 in Alexa global
'http://www.dumpert.nl/',
# Why: #4642 in Alexa global
'http://www.monotaro.com/',
# Why: #4643 in Alexa global
'http://www.bloomingdales.com/',
# Why: #4644 in Alexa global
'http://www.ebayclassifieds.com/',
# Why: #4645 in Alexa global
'http://www.t-online.hu/',
# Why: #4646 in Alexa global
'http://www.2dbook.com/',
# Why: #4647 in Alexa global
'http://www.golfdigest.co.jp/',
# Why: #4648 in Alexa global
'http://www.thekitchn.com/',
# Why: #4649 in Alexa global
'http://www.halifax.co.uk/',
# Why: #4650 in Alexa global
'http://www.tanx.com/',
# Why: #4651 in Alexa global
'http://www.jutarnji.hr/',
# Why: #4652 in Alexa global
'http://www.petardashd.com/',
# Why: #4653 in Alexa global
'http://www.rookee.ru/',
# Why: #4654 in Alexa global
'http://www.showroomprive.com/',
# Why: #4655 in Alexa global
'http://www.sharepoint.com/',
# Why: #4656 in Alexa global
'http://liebiao.com/',
# Why: #4657 in Alexa global
'http://www.miibeian.gov.cn/',
# Why: #4658 in Alexa global
'http://www.pumbaporn.com/',
# Why: #4659 in Alexa global
'http://www.dwnews.com/',
# Why: #4660 in Alexa global
'http://www.sanguosha.com/',
# Why: #4661 in Alexa global
'http://www.pp.cc/',
# Why: #4662 in Alexa global
'http://www.myfc.ir/',
# Why: #4663 in Alexa global
'http://www.alicdn.com/',
# Why: #4664 in Alexa global
'http://www.carmax.com/',
# Why: #4665 in Alexa global
'http://www.defencenet.gr/',
# Why: #4666 in Alexa global
'http://www.cuantarazon.com/',
# Why: #4667 in Alexa global
'http://www.westernunion.com/',
# Why: #4668 in Alexa global
'http://www.links.cn/',
# Why: #4669 in Alexa global
'http://www.natunbarta.com/',
# Why: #4670 in Alexa global
'http://www.sekindo.com/',
# Why: #4671 in Alexa global
'http://78.cn/',
# Why: #4672 in Alexa global
'http://www.edublogs.org/',
# Why: #4673 in Alexa global
'http://www.hotmail.com/',
# Why: #4674 in Alexa global
'http://www.problogger.net/',
# Why: #4675 in Alexa global
'http://www.amardeshonline.com/',
# Why: #4676 in Alexa global
'http://www.gemius.com/',
# Why: #4677 in Alexa global
'http://www.egynews.net/',
# Why: #4678 in Alexa global
'http://www.indiabix.com/',
# Why: #4679 in Alexa global
'http://www.provincial.com/',
# Why: #4680 in Alexa global
'http://www.play.com/',
# Why: #4681 in Alexa global
'http://www.beslist.nl/',
# Why: #4682 in Alexa global
'http://www.nttdocomo.co.jp/',
# Why: #4683 in Alexa global
'http://www.shape.com/',
# Why: #4684 in Alexa global
'http://www.alhilal.com/',
# Why: #4685 in Alexa global
'http://www.irecommend.ru/',
# Why: #4686 in Alexa global
'http://www.cmmnts.com/',
# Why: #4687 in Alexa global
'http://www.1news.az/',
# Why: #4688 in Alexa global
'http://www.kinobanda.net/',
# Why: #4689 in Alexa global
'http://www.banamex.com.mx/',
# Why: #4690 in Alexa global
'http://www.cleanfiles.net/',
# Why: #4691 in Alexa global
'http://www.algeriaforum.net/',
# Why: #4692 in Alexa global
'http://www.zumi.pl/',
# Why: #4693 in Alexa global
'http://www.giallozafferano.it/',
# Why: #4694 in Alexa global
'http://www.news-postseven.com/',
# Why: #4695 in Alexa global
'http://www.firstcry.com/',
# Why: #4696 in Alexa global
'http://www.mhlw.go.jp/',
# Why: #4697 in Alexa global
'http://www.lookforporn.com/',
# Why: #4698 in Alexa global
'http://www.xxsy.net/',
# Why: #4699 in Alexa global
'http://www.scriptmafia.org/',
# Why: #4700 in Alexa global
'http://www.intodns.com/',
# Why: #4701 in Alexa global
'http://www.famitsu.com/',
# Why: #4702 in Alexa global
'http://www.eclipse.org/',
# Why: #4704 in Alexa global
'http://www.net-a-porter.com/',
# Why: #4705 in Alexa global
'http://www.btemplates.com/',
# Why: #4706 in Alexa global
'http://www.topshop.com/',
# Why: #4707 in Alexa global
'http://www.myvidster.com/',
# Why: #4708 in Alexa global
'http://www.calciomercato.com/',
# Why: #4709 in Alexa global
'http://www.arabyonline.com/',
# Why: #4710 in Alexa global
'http://www.lesechos.fr/',
# Why: #4711 in Alexa global
'http://www.empireavenue.com/',
# Why: #4712 in Alexa global
'http://www.damnlol.com/',
# Why: #4713 in Alexa global
'http://www.nukistream.com/',
# Why: #4714 in Alexa global
'http://www.wayport.net/',
# Why: #4715 in Alexa global
'http://www.buienradar.nl/',
# Why: #4716 in Alexa global
'http://www.vivastreet.co.in/',
# Why: #4717 in Alexa global
'http://www.kroger.com/',
# Why: #4718 in Alexa global
'http://www.geocaching.com/',
# Why: #4719 in Alexa global
'http://www.hunantv.com/',
# Why: #4720 in Alexa global
'http://www.fotolog.net/',
# Why: #4721 in Alexa global
'http://www.gunbroker.com/',
# Why: #4722 in Alexa global
'http://www.flalottery.com/',
# Why: #4723 in Alexa global
'http://www.priples.com/',
# Why: #4724 in Alexa global
'http://www.nlayer.net/',
# Why: #4725 in Alexa global
'http://www.trafficshop.com/',
# Why: #4726 in Alexa global
'http://www.standardmedia.co.ke/',
# Why: #4727 in Alexa global
'http://www.finanzen.net/',
# Why: #4728 in Alexa global
'http://www.meta.ua/',
# Why: #4729 in Alexa global
'http://www.gfy.com/',
# Why: #4730 in Alexa global
'http://www.playground.ru/',
# Why: #4731 in Alexa global
'http://www.rp5.ru/',
# Why: #4732 in Alexa global
'http://otnnetwork.net/',
# Why: #4733 in Alexa global
'http://tvmao.com/',
# Why: #4734 in Alexa global
'http://www.hir.ma/',
# Why: #4735 in Alexa global
'http://www.twilightsex.com/',
# Why: #4736 in Alexa global
'http://www.haodou.com/',
# Why: #4737 in Alexa global
'http://www.virgin-atlantic.com/',
# Why: #4738 in Alexa global
'http://www.ankieta-online.pl/',
# Why: #4739 in Alexa global
'http://www.kinkytube.me/',
# Why: #4740 in Alexa global
'http://www.123mplayer.com/',
# Why: #4741 in Alexa global
'http://www.elifting.com/',
# Why: #4742 in Alexa global
'http://www.akiba-online.com/',
# Why: #4743 in Alexa global
'http://www.tcsbank.ru/',
# Why: #4744 in Alexa global
'http://www.gametrailers.com/',
# Why: #4745 in Alexa global
'http://www.dihitt.com/',
# Why: #4746 in Alexa global
'http://www.momoshop.com.tw/',
# Why: #4747 in Alexa global
'http://www.fancy.com/',
# Why: #4748 in Alexa global
'http://admaimai.com/',
# Why: #4749 in Alexa global
'http://www.61.com/',
# Why: #4750 in Alexa global
'http://www.hotchatdirect.com/',
# Why: #4751 in Alexa global
'http://www.penesalud.com/',
# Why: #4752 in Alexa global
'http://www.adsupplyads.com/',
# Why: #4753 in Alexa global
'http://www.robokassa.ru/',
# Why: #4754 in Alexa global
'http://www.brooonzyah.net/',
# Why: #4755 in Alexa global
'http://www.moviesmobile.net/',
# Why: #4756 in Alexa global
'http://www.fuck-mates.com/',
# Why: #4757 in Alexa global
'http://www.ch-news.com/',
# Why: #4758 in Alexa global
'http://www.cwan.com/',
# Why: #4759 in Alexa global
'http://enorth.com.cn/',
# Why: #4760 in Alexa global
'http://www.mec.gov.br/',
# Why: #4761 in Alexa global
'http://www.libertytimes.com.tw/',
# Why: #4762 in Alexa global
'http://www.musiciansfriend.com/',
# Why: #4763 in Alexa global
'http://www.angrybirds.com/',
# Why: #4764 in Alexa global
'http://www.ebrun.com/',
# Why: #4765 in Alexa global
'http://www.kienthuc.net.vn/',
# Why: #4766 in Alexa global
'http://www.morningstar.com/',
# Why: #4767 in Alexa global
'http://www.rasekhoon.net/',
# Why: #4768 in Alexa global
'http://www.techsmith.com/',
# Why: #4769 in Alexa global
'http://www.diy.com/',
# Why: #4770 in Alexa global
'http://www.awwwards.com/',
# Why: #4771 in Alexa global
'http://www.ajc.com/',
# Why: #4772 in Alexa global
'http://www.akismet.com/',
# Why: #4773 in Alexa global
'http://www.itar-tass.com/',
# Why: #4774 in Alexa global
'http://www.60secprofit.com/',
# Why: #4775 in Alexa global
'http://www.videoweed.es/',
# Why: #4776 in Alexa global
'http://www.life.com.tw/',
# Why: #4777 in Alexa global
'http://www.guitarcenter.com/',
# Why: #4778 in Alexa global
'http://www.tv2.dk/',
# Why: #4779 in Alexa global
'http://www.narutom.com/',
# Why: #4780 in Alexa global
'http://www.bittorrent.com/',
# Why: #4781 in Alexa global
'http://www.unionpaysecure.com/',
# Why: #4782 in Alexa global
'http://www.91jm.com/',
# Why: #4783 in Alexa global
'http://www.licindia.in/',
# Why: #4784 in Alexa global
'http://www.bama.ir/',
# Why: #4785 in Alexa global
'http://www.hertz.com/',
# Why: #4786 in Alexa global
'http://www.propertyguru.com.sg/',
# Why: #4787 in Alexa global
'http://city8.com/',
# Why: #4788 in Alexa global
'http://www.blu-ray.com/',
# Why: #4789 in Alexa global
'http://www.abebooks.com/',
# Why: #4790 in Alexa global
'http://www.adidas.com/',
# Why: #4791 in Alexa global
'http://www.weathernews.jp/',
# Why: #4792 in Alexa global
'http://www.sing365.com/',
# Why: #4793 in Alexa global
'http://www.qq163.com/',
# Why: #4794 in Alexa global
'http://www.fashionandyou.com/',
# Why: #4795 in Alexa global
'http://www.lietou.com/',
# Why: #4796 in Alexa global
'http://pia.jp/',
# Why: #4797 in Alexa global
'http://www.eniro.se/',
# Why: #4798 in Alexa global
'http://pengpeng.com/',
# Why: #4799 in Alexa global
'http://haibao.com/',
# Why: #4800 in Alexa global
'http://www.jxedt.com/',
# Why: #4801 in Alexa global
'http://www.crsky.com/',
# Why: #4802 in Alexa global
'http://www.nyu.edu/',
# Why: #4803 in Alexa global
'http://www.minecraftskins.com/',
# Why: #4804 in Alexa global
'http://yangtse.com/',
# Why: #4805 in Alexa global
'http://www.almstba.co/',
# Why: #4806 in Alexa global
'http://parsnews.com/',
# Why: #4807 in Alexa global
'http://www.twiends.com/',
# Why: #4808 in Alexa global
'http://www.dkb.de/',
# Why: #4809 in Alexa global
'http://www.friendscout24.de/',
# Why: #4810 in Alexa global
'http://www.aviny.com/',
# Why: #4811 in Alexa global
'http://www.dig.do/',
# Why: #4812 in Alexa global
'http://www.gamestorrents.com/',
# Why: #4813 in Alexa global
'http://www.guru.com/',
# Why: #4814 in Alexa global
'http://www.bostonglobe.com/',
# Why: #4815 in Alexa global
'http://www.brandalley.fr/',
# Why: #4816 in Alexa global
'http://www.tn.com.ar/',
# Why: #4817 in Alexa global
'http://www.yourwebsite.com/',
# Why: #4818 in Alexa global
'http://www.istgah.com/',
# Why: #4819 in Alexa global
'http://www.cib.com.cn/',
# Why: #4820 in Alexa global
'http://www.e-familynet.com/',
# Why: #4821 in Alexa global
'http://www.hotshame.com/',
# Why: #4822 in Alexa global
'http://www.volkskrant.nl/',
# Why: #4823 in Alexa global
'http://www.karnaval.com/',
# Why: #4824 in Alexa global
'http://www.team-bhp.com/',
# Why: #4825 in Alexa global
'http://www.sinemalar.com/',
# Why: #4826 in Alexa global
'http://www.ipko.pl/',
# Why: #4827 in Alexa global
'http://www.fastcompany.com/',
# Why: #4828 in Alexa global
'http://www.embedupload.com/',
# Why: #4829 in Alexa global
'http://www.gzmama.com/',
# Why: #4830 in Alexa global
'http://www.icicidirect.com/',
# Why: #4831 in Alexa global
'http://www.whatismyip.com/',
# Why: #4832 in Alexa global
'http://www.siasat.pk/',
# Why: #4833 in Alexa global
'http://www.rbi.org.in/',
# Why: #4834 in Alexa global
'http://www.amarillasinternet.com/',
# Why: #4835 in Alexa global
'http://www.netvasco.com.br/',
# Why: #4836 in Alexa global
'http://www.ctvnews.ca/',
# Why: #4837 in Alexa global
'http://www.gad.de/',
# Why: #4838 in Alexa global
'http://www.dailyfx.com/',
# Why: #4839 in Alexa global
'http://www.smartklicks.com/',
# Why: #4840 in Alexa global
'http://www.qoo10.sg/',
# Why: #4841 in Alexa global
'http://www.mlit.go.jp/',
# Why: #4842 in Alexa global
'http://www.cmbc.com.cn/',
# Why: #4843 in Alexa global
'http://www.loc.gov/',
# Why: #4845 in Alexa global
'http://www.playerflv.com/',
# Why: #4846 in Alexa global
'http://www.uta-net.com/',
# Why: #4847 in Alexa global
'http://www.afl.com.au/',
# Why: #4848 in Alexa global
'http://www.mainlink.ru/',
# Why: #4849 in Alexa global
'http://www.pricedekho.com/',
# Why: #4850 in Alexa global
'http://www.wickedfire.com/',
# Why: #4851 in Alexa global
'http://www.rlslog.net/',
# Why: #4852 in Alexa global
'http://www.raiffeisen.at/',
# Why: #4853 in Alexa global
'http://www.easports.com/',
# Why: #4854 in Alexa global
'http://www.groupon.fr/',
# Why: #4855 in Alexa global
'http://www.o2.co.uk/',
# Why: #4856 in Alexa global
'http://www.irangrand.ir/',
# Why: #4857 in Alexa global
'http://www.vuku.tv/',
# Why: #4858 in Alexa global
'http://www.play.pl/',
# Why: #4859 in Alexa global
'http://www.mxtoolbox.com/',
# Why: #4860 in Alexa global
'http://www.promiflash.de/',
# Why: #4861 in Alexa global
'http://www.linode.com/',
# Why: #4862 in Alexa global
'http://www.familysearch.org/',
# Why: #4863 in Alexa global
'http://www.publico.pt/',
# Why: #4864 in Alexa global
'http://www.freepornvideo.me/',
# Why: #4865 in Alexa global
'http://www.uploadbaz.com/',
# Why: #4866 in Alexa global
'http://www.tocmai.ro/',
# Why: #4867 in Alexa global
'http://www.cimbclicks.com.my/',
# Why: #4868 in Alexa global
'http://www.bestporntube.me/',
# Why: #4869 in Alexa global
'http://www.lainformacion.com/',
# Why: #4870 in Alexa global
'http://herschina.com/',
# Why: #4871 in Alexa global
'http://www.fontsquirrel.com/',
# Why: #4872 in Alexa global
'http://www.blip.tv/',
# Why: #4873 in Alexa global
'http://www.caranddriver.com/',
# Why: #4874 in Alexa global
'http://www.qld.gov.au/',
# Why: #4876 in Alexa global
'http://www.pons.eu/',
# Why: #4877 in Alexa global
'http://nascar.com/',
# Why: #4878 in Alexa global
'http://www.hrsmart.com/',
# Why: #4879 in Alexa global
'http://www.tripadvisor.com.au/',
# Why: #4880 in Alexa global
'http://www.hs.fi/',
# Why: #4881 in Alexa global
'http://www.auspost.com.au/',
# Why: #4882 in Alexa global
'http://www.sponsoredreviews.com/',
# Why: #4883 in Alexa global
'http://www.webopedia.com/',
# Why: #4884 in Alexa global
'http://www.sovsport.ru/',
# Why: #4885 in Alexa global
'http://www.firestorage.jp/',
# Why: #4886 in Alexa global
'http://www.bancsabadell.com/',
# Why: #4887 in Alexa global
'http://www.prettyporntube.com/',
# Why: #4888 in Alexa global
'http://www.sodahead.com/',
# Why: #4889 in Alexa global
'http://www.ovi.com/',
# Why: #4890 in Alexa global
'http://www.aleseriale.pl/',
# Why: #4891 in Alexa global
'http://www.mnwan.com/',
# Why: #4892 in Alexa global
'http://www.callofduty.com/',
# Why: #4893 in Alexa global
'http://www.sportskeeda.com/',
# Why: #4894 in Alexa global
'http://cp.cx/',
# Why: #4895 in Alexa global
'http://www.researchgate.net/',
# Why: #4896 in Alexa global
'http://www.michaels.com/',
# Why: #4897 in Alexa global
'http://www.createspace.com/',
# Why: #4898 in Alexa global
'http://www.sprintrade.com/',
# Why: #4899 in Alexa global
'http://www.anonymouse.org/',
# Why: #4900 in Alexa global
'http://www.hautelook.com/',
# Why: #4902 in Alexa global
'http://4gamer.net/',
# Why: #4903 in Alexa global
'http://www.accorhotels.com/',
# Why: #4904 in Alexa global
'http://www.roomkey.com/',
# Why: #4905 in Alexa global
'http://www.guildwars2.com/',
# Why: #4906 in Alexa global
'http://www.poco.cn/',
# Why: #4908 in Alexa global
'http://www.diamond.jp/',
# Why: #4909 in Alexa global
'http://www.cargurus.com/',
# Why: #4910 in Alexa global
'http://www.wpengine.com/',
# Why: #4911 in Alexa global
'http://www.iis.net/',
# Why: #4912 in Alexa global
'http://www.vendaria.com/',
# Why: #4913 in Alexa global
'http://www.argentinawarez.com/',
# Why: #4914 in Alexa global
'http://www.webdesigntunes.com/',
# Why: #4916 in Alexa global
'http://www.allvoices.com/',
# Why: #4917 in Alexa global
'http://www.eprize.com/',
# Why: #4918 in Alexa global
'http://www.pmu.fr/',
# Why: #4919 in Alexa global
'http://www.carrefour.fr/',
# Why: #4922 in Alexa global
'http://www.tax.gov.ir/',
# Why: #4924 in Alexa global
'http://www.ruelala.com/',
# Why: #4925 in Alexa global
'http://www.mainspy.ru/',
# Why: #4926 in Alexa global
'http://www.phpwind.net/',
# Why: #4927 in Alexa global
'http://www.loteriasyapuestas.es/',
# Why: #4928 in Alexa global
'http://www.musavat.com/',
# Why: #4929 in Alexa global
'http://www.lenskart.com/',
# Why: #4930 in Alexa global
'http://www.tv-asahi.co.jp/',
# Why: #4931 in Alexa global
'http://www.refinery29.com/',
# Why: #4932 in Alexa global
'http://www.888poker.es/',
# Why: #4933 in Alexa global
'http://www.denverpost.com/',
# Why: #4934 in Alexa global
'http://www.who.int/',
# Why: #4935 in Alexa global
'http://www.thesims3.com/',
# Why: #4936 in Alexa global
'http://www.jerkhour.com/',
# Why: #4937 in Alexa global
'http://www.lyricsmode.com/',
# Why: #4938 in Alexa global
'http://www.ivillage.com/',
# Why: #4939 in Alexa global
'http://qyer.com/',
# Why: #4940 in Alexa global
'http://www.hktdc.com/',
# Why: #4941 in Alexa global
'http://www.pornoload.com/',
# Why: #4942 in Alexa global
'http://www.bluedart.com/',
# Why: #4943 in Alexa global
'http://www.here.com/',
# Why: #4944 in Alexa global
'http://www.philips.com/',
# Why: #4945 in Alexa global
'http://www.dsebd.org/',
# Why: #4946 in Alexa global
'http://www.tubidy.mobi/',
# Why: #4947 in Alexa global
'http://www.stream.cz/',
# Why: #4948 in Alexa global
'http://www.infojobs.com.br/',
# Why: #4949 in Alexa global
'http://www.soft98.ir/',
# Why: #4950 in Alexa global
'http://www.bolsaparanovatos.com/',
# Why: #4951 in Alexa global
'http://www.mercador.ro/',
# Why: #4952 in Alexa global
'http://www.neogaf.com/',
# Why: #4953 in Alexa global
'http://www.yardbarker.com/',
# Why: #4954 in Alexa global
'http://www.rapidlibrary.com/',
# Why: #4955 in Alexa global
'http://www.xxeronetxx.info/',
# Why: #4956 in Alexa global
'http://www.kaiserpermanente.org/',
# Why: #4957 in Alexa global
'http://www.telstra.com.au/',
# Why: #4958 in Alexa global
'http://www.contra.gr/',
# Why: #4959 in Alexa global
'http://www.laredoute.it/',
# Why: #4960 in Alexa global
'http://www.lipsum.com/',
# Why: #4961 in Alexa global
'http://www.twitlonger.com/',
# Why: #4962 in Alexa global
'http://www.hln.be/',
# Why: #4963 in Alexa global
'http://www.53kf.com/',
# Why: #4964 in Alexa global
'http://www.gofundme.com/',
# Why: #4965 in Alexa global
'http://www.carigold.com/',
# Why: #4966 in Alexa global
'http://www.clips4sale.com/',
# Why: #4967 in Alexa global
'http://www.focalprice.com/',
# Why: #4968 in Alexa global
'http://www.1111.com.tw/',
# Why: #4969 in Alexa global
'http://www.gameaholic.com/',
# Why: #4970 in Alexa global
'http://www.presstv.ir/',
# Why: #4971 in Alexa global
'http://www.puu.sh/',
# Why: #4973 in Alexa global
'http://www.filmlinks4u.net/',
# Why: #4974 in Alexa global
'http://www.traffic-delivery.com/',
# Why: #4975 in Alexa global
'http://www.bebo.com/',
# Why: #4976 in Alexa global
'http://enter.ru/',
# Why: #4977 in Alexa global
'http://www.shufoo.net/',
# Why: #4978 in Alexa global
'http://www.vivo.com.br/',
# Why: #4979 in Alexa global
'http://www.jizzhut.com/',
# Why: #4980 in Alexa global
'http://www.1jux.net/',
# Why: #4981 in Alexa global
'http://www.serebii.net/',
# Why: #4982 in Alexa global
'http://www.translate.ru/',
# Why: #4983 in Alexa global
'http://www.mtv3.fi/',
# Why: #4984 in Alexa global
'http://www.njuskalo.hr/',
# Why: #4985 in Alexa global
'http://www.bell.ca/',
# Why: #4986 in Alexa global
'http://www.myheritage.com/',
# Why: #4987 in Alexa global
'http://www.cic.fr/',
# Why: #4988 in Alexa global
'http://www.mercurynews.com/',
# Why: #4989 in Alexa global
'http://www.alaan.tv/',
# Why: #4990 in Alexa global
'http://www.econsultancy.com/',
# Why: #4991 in Alexa global
'http://www.pornhost.com/',
# Why: #4992 in Alexa global
'http://www.a8.net/',
# Why: #4994 in Alexa global
'http://www.netzero.net/',
# Why: #4995 in Alexa global
'http://www.tracklab101.com/',
# Why: #4996 in Alexa global
'http://www.spanishdict.com/',
# Why: #4997 in Alexa global
'http://www.amctv.com/',
# Why: #4998 in Alexa global
'http://www.erepublik.com/',
# Why: #4999 in Alexa global
'http://www.mk.ru/',
# Why: #5000 in Alexa global
'http://www.publico.es/',
# Why: #5001 in Alexa global
'http://www.newegg.com.cn/',
# Why: #5002 in Alexa global
'http://www.fux.com/',
# Why: #5003 in Alexa global
'http://www.webcamtoy.com/',
# Why: #5004 in Alexa global
'http://www.rahnama.com/',
# Why: #5005 in Alexa global
'http://www.wanyh.com/',
# Why: #5006 in Alexa global
'http://www.ecplaza.net/',
# Why: #5007 in Alexa global
'http://www.mol.gov.sa/',
# Why: #5008 in Alexa global
'http://www.torrentday.com/',
# Why: #5009 in Alexa global
'http://www.hsbc.com.br/',
# Why: #5010 in Alexa global
'http://www.interoperabilitybridges.com/',
# Why: #5011 in Alexa global
'http://www.billmelater.com/',
# Why: #5012 in Alexa global
'http://www.speedanalysis.com/',
# Why: #5013 in Alexa global
'http://www.volusion.com/',
# Why: #5014 in Alexa global
'http://www.mixcloud.com/',
# Why: #5015 in Alexa global
'http://www.weeronline.nl/',
# Why: #5016 in Alexa global
'http://www.tiancity.com/',
# Why: #5017 in Alexa global
'http://www.thehun.com/',
# Why: #5018 in Alexa global
'http://www.comparisons.org/',
# Why: #5019 in Alexa global
'http://www.eurosport.ru/',
# Why: #5020 in Alexa global
'http://www.trendyol.com/',
# Why: #5021 in Alexa global
'http://www.7120.com/',
# Why: #5022 in Alexa global
'http://www.eldiariodeamerica.com/',
# Why: #5023 in Alexa global
'http://www.fap8.com/',
# Why: #5024 in Alexa global
'http://www.joyme.com/',
# Why: #5025 in Alexa global
'http://www.ufl.edu/',
# Why: #5026 in Alexa global
'http://www.cuantocabron.com/',
# Why: #5027 in Alexa global
'http://www.hotmart.com.br/',
# Why: #5028 in Alexa global
'http://www.wolframalpha.com/',
# Why: #5029 in Alexa global
'http://www.cpasbien.com/',
# Why: #5030 in Alexa global
'http://www.sanalpazar.com/',
# Why: #5031 in Alexa global
'http://www.publipt.com/',
# Why: #5032 in Alexa global
'http://www.9ku.com/',
# Why: #5033 in Alexa global
'http://www.officemax.com/',
# Why: #5034 in Alexa global
'http://www.cuny.edu/',
# Why: #5035 in Alexa global
'http://www.gem.pl/',
# Why: #5036 in Alexa global
'http://www.waelelebrashy.com/',
# Why: #5037 in Alexa global
'http://www.coinmill.com/',
# Why: #5038 in Alexa global
'http://www.bet.com/',
# Why: #5039 in Alexa global
'http://www.moskva.fm/',
# Why: #5040 in Alexa global
'http://www.groupalia.com/',
# Why: #5041 in Alexa global
'http://131.com/',
# Why: #5042 in Alexa global
'http://www.pichak.net/',
# Why: #5043 in Alexa global
'http://www.theatlanticwire.com/',
# Why: #5044 in Alexa global
'http://tokyo-sports.co.jp/',
# Why: #5045 in Alexa global
'http://www.laptopmag.com/',
# Why: #5046 in Alexa global
'http://www.worldpay.com/',
# Why: #5047 in Alexa global
'http://www.groupon.pl/',
# Why: #5048 in Alexa global
'http://www.imeimama.com/',
# Why: #5049 in Alexa global
'http://www.torrents.net/',
# Why: #5051 in Alexa global
'http://www.britishcouncil.org/',
# Why: #5052 in Alexa global
'http://www.letsbonus.com/',
# Why: #5053 in Alexa global
'http://www.e-monsite.com/',
# Why: #5054 in Alexa global
'http://www.url.org/',
# Why: #5055 in Alexa global
'http://www.discuz.com/',
# Why: #5056 in Alexa global
'http://www.freepornsite.me/',
# Why: #5057 in Alexa global
'http://www.cheatcc.com/',
# Why: #5058 in Alexa global
'http://www.magicmovies.com/',
# Why: #5059 in Alexa global
'http://www.laterooms.com/',
# Why: #5060 in Alexa global
'http://www.du.ac.in/',
# Why: #5062 in Alexa global
'http://www.uservoice.com/',
# Why: #5063 in Alexa global
'http://www.discas.net/',
# Why: #5064 in Alexa global
'http://www.d1g.com/',
# Why: #5065 in Alexa global
'http://www.explicittube.com/',
# Why: #5066 in Alexa global
'http://www.e-autopay.com/',
# Why: #5067 in Alexa global
'http://3lian.com/',
# Why: #5068 in Alexa global
'http://www.oopsmovs.com/',
# Why: #5069 in Alexa global
'http://www.agenziaentrate.gov.it/',
# Why: #5070 in Alexa global
'http://www.ufc.com/',
# Why: #5071 in Alexa global
'http://www.mooshare.biz/',
# Why: #5072 in Alexa global
'http://www.ankang06.org/',
# Why: #5073 in Alexa global
'http://www.betradar.com/',
# Why: #5074 in Alexa global
'http://www.explosm.net/',
# Why: #5075 in Alexa global
'http://www.silkroad.com/',
# Why: #5076 in Alexa global
'http://www.crackberry.com/',
# Why: #5078 in Alexa global
'http://www.toyota.com/',
# Why: #5079 in Alexa global
'http://www.bongda.com.vn/',
# Why: #5080 in Alexa global
'http://www.europapress.es/',
# Why: #5081 in Alexa global
'http://www.mlxchange.com/',
# Why: #5082 in Alexa global
'http://www.plius.lt/',
# Why: #5083 in Alexa global
'http://www.pitchfork.com/',
# Why: #5084 in Alexa global
'http://www.groupon.de/',
# Why: #5085 in Alexa global
'http://www.hollisterco.com/',
# Why: #5086 in Alexa global
'http://www.hasoffers.com/',
# Why: #5087 in Alexa global
'http://www.miami.com/',
# Why: #5089 in Alexa global
'http://www.dslreports.com/',
# Why: #5090 in Alexa global
'http://www.blinkweb.com/',
# Why: #5091 in Alexa global
'http://www.alamaula.com/',
# Why: #5092 in Alexa global
'http://www.leonardo.it/',
# Why: #5093 in Alexa global
'http://www.very.co.uk/',
# Why: #5094 in Alexa global
'http://www.globalsources.com/',
# Why: #5095 in Alexa global
'http://www.viator.com/',
# Why: #5096 in Alexa global
'http://www.greenwichmeantime.com/',
# Why: #5097 in Alexa global
'http://www.appannie.com/',
# Why: #5099 in Alexa global
'http://www.eldorado.ru/',
# Why: #5100 in Alexa global
'http://www.canadiantire.ca/',
# Why: #5101 in Alexa global
'http://www.enjin.com/',
# Why: #5102 in Alexa global
'http://szhome.com/',
# Why: #5103 in Alexa global
'http://www.news-us.jp/',
# Why: #5104 in Alexa global
'http://www.phim3s.net/',
# Why: #5105 in Alexa global
'http://www.bash.im/',
# Why: #5106 in Alexa global
'http://www.immi.gov.au/',
# Why: #5107 in Alexa global
'http://www.cwb.gov.tw/',
# Why: #5108 in Alexa global
'http://www.enjoydressup.com/',
# Why: #5109 in Alexa global
'http://www.thesuperficial.com/',
# Why: #5110 in Alexa global
'http://www.bunshun.jp/',
# Why: #5111 in Alexa global
'http://www.91mobiles.com/',
# Why: #5112 in Alexa global
'http://www.libertaddigital.com/',
# Why: #5113 in Alexa global
'http://www.po-kaki-to.com/',
# Why: #5114 in Alexa global
'http://www.truelocal.com.au/',
# Why: #5115 in Alexa global
'http://www.centrum24.pl/',
# Why: #5116 in Alexa global
'http://www.zylom.com/',
# Why: #5117 in Alexa global
'http://www.mypornmotion.com/',
# Why: #5118 in Alexa global
'http://www.skybet.com/',
# Why: #5119 in Alexa global
'http://www.soccermanager.com/',
# Why: #5120 in Alexa global
'http://www.styleauto.com.cn/',
# Why: #5121 in Alexa global
'http://www.poriborton.com/',
# Why: #5122 in Alexa global
'http://www.mozzi.com/',
# Why: #5123 in Alexa global
'http://www.eset.com/',
# Why: #5124 in Alexa global
'http://www.chelseafc.com/',
# Why: #5125 in Alexa global
'http://www.amulyam.in/',
# Why: #5126 in Alexa global
'http://www.argaam.com/',
# Why: #5127 in Alexa global
'http://www.mnn.com/',
# Why: #5128 in Alexa global
'http://www.papystreaming.com/',
# Why: #5129 in Alexa global
'http://www.hostelbookers.com/',
# Why: #5130 in Alexa global
'http://www.vatera.hu/',
# Why: #5131 in Alexa global
'http://www.pciconcursos.com.br/',
# Why: #5132 in Alexa global
'http://www.milenio.com/',
# Why: #5133 in Alexa global
'http://www.yellowbook.com/',
# Why: #5134 in Alexa global
'http://www.mobilepriceindia.co.in/',
# Why: #5135 in Alexa global
'http://www.naked.com/',
# Why: #5136 in Alexa global
'http://www.lazada.vn/',
# Why: #5137 in Alexa global
'http://www.70e.com/',
# Why: #5138 in Alexa global
'http://www.mapy.cz/',
# Why: #5139 in Alexa global
'http://www.vodafone.es/',
# Why: #5140 in Alexa global
'http://www.zbiornik.com/',
# Why: #5142 in Alexa global
'http://www.fc2web.com/',
# Why: #5143 in Alexa global
'http://www.rghost.ru/',
# Why: #5144 in Alexa global
'http://www.avvo.com/',
# Why: #5145 in Alexa global
'http://www.fardanews.com/',
# Why: #5146 in Alexa global
'http://www.pcbeta.com/',
# Why: #5147 in Alexa global
'http://www.hibapress.com/',
# Why: #5148 in Alexa global
'http://www.gamehouse.com/',
# Why: #5149 in Alexa global
'http://www.macworld.com/',
# Why: #5150 in Alexa global
'http://www.qantas.com.au/',
# Why: #5151 in Alexa global
'http://www.dba.dk/',
# Why: #5152 in Alexa global
'http://www.inttrax.com/',
# Why: #5153 in Alexa global
'http://www.conejox.com/',
# Why: #5154 in Alexa global
'http://www.immobiliare.it/',
# Why: #5155 in Alexa global
'http://www.sparkasse.at/',
# Why: #5156 in Alexa global
'http://www.udemy.com/',
# Why: #5157 in Alexa global
'http://www.accenture.com/',
# Why: #5158 in Alexa global
'http://www.pokerstrategy.com/',
# Why: #5159 in Alexa global
'http://www.leroymerlin.fr/',
# Why: #5160 in Alexa global
'http://www.sweetkiss.me/',
# Why: #5161 in Alexa global
'http://www.siriusxm.com/',
# Why: #5162 in Alexa global
'http://www.nieuwsblad.be/',
# Why: #5163 in Alexa global
'http://www.blogun.ru/',
# Why: #5164 in Alexa global
'http://www.ojogos.com.br/',
# Why: #5165 in Alexa global
'http://www.lexilogos.com/',
# Why: #5166 in Alexa global
'http://www.c-and-a.com/',
# Why: #5167 in Alexa global
'http://www.authorstream.com/',
# Why: #5168 in Alexa global
'http://www.newser.com/',
# Why: #5169 in Alexa global
'http://www.minube.com/',
# Why: #5170 in Alexa global
'http://www.lawtime.cn/',
# Why: #5171 in Alexa global
'http://www.yellowpages.com.au/',
# Why: #5172 in Alexa global
'http://www.torrentfreak.com/',
# Why: #5173 in Alexa global
'http://www.expatriates.com/',
# Why: #5174 in Alexa global
'http://51credit.com/',
# Why: #5175 in Alexa global
'http://www.rawstory.com/',
# Why: #5176 in Alexa global
'http://www.crictime.com/',
# Why: #5177 in Alexa global
'http://www.ladolcevitae.com/',
# Why: #5178 in Alexa global
'http://www.astro.com/',
# Why: #5179 in Alexa global
'http://www.riverisland.com/',
# Why: #5180 in Alexa global
'http://www.myzamana.com/',
# Why: #5181 in Alexa global
'http://www.xpg.com.br/',
# Why: #5182 in Alexa global
'http://www.svt.se/',
# Why: #5183 in Alexa global
'http://www.ymlp.com/',
# Why: #5184 in Alexa global
'http://www.coupondunia.in/',
# Why: #5185 in Alexa global
'http://www.mymovies.it/',
# Why: #5186 in Alexa global
'http://www.portaleducacao.com.br/',
# Why: #5187 in Alexa global
'http://watchabc.go.com/',
# Why: #5188 in Alexa global
'http://www.scrabblefinder.com/',
# Why: #5189 in Alexa global
'http://www.2hua.com/',
# Why: #5190 in Alexa global
'http://www.guiaconsumidor.com/',
# Why: #5191 in Alexa global
'http://jzpt.com/',
# Why: #5192 in Alexa global
'http://www.jino.ru/',
# Why: #5193 in Alexa global
'http://www.google.tt/',
# Why: #5194 in Alexa global
'http://www.addwallet.com/',
# Why: #5195 in Alexa global
'http://www.enom.com/',
# Why: #5197 in Alexa global
'http://www.searchfreemp3.com/',
# Why: #5198 in Alexa global
'http://www.spox.com/',
# Why: #5199 in Alexa global
'http://www.ename.net/',
# Why: #5200 in Alexa global
'http://www.researchnow.com/',
# Why: #5201 in Alexa global
'http://www.decathlon.fr/',
# Why: #5202 in Alexa global
'http://www.j-cast.com/',
# Why: #5203 in Alexa global
'http://www.updatetube.com/',
# Why: #5204 in Alexa global
'http://www.polo.com/',
# Why: #5205 in Alexa global
'http://www.asiaone.com/',
# Why: #5206 in Alexa global
'http://www.kkiste.to/',
# Why: #5207 in Alexa global
'http://www.frmtr.com/',
# Why: #5208 in Alexa global
'http://www.skai.gr/',
# Why: #5209 in Alexa global
'http://www.zovi.com/',
# Why: #5210 in Alexa global
'http://www.qiwi.ru/',
# Why: #5211 in Alexa global
'http://www.stfucollege.com/',
# Why: #5212 in Alexa global
'http://www.carros.com.br/',
# Why: #5213 in Alexa global
'http://www.privatejobshub.blogspot.in/',
# Why: #5214 in Alexa global
'http://www.englishtown.com/',
# Why: #5215 in Alexa global
'http://www.info.com/',
# Why: #5216 in Alexa global
'http://www.multiclickbrasil.com.br/',
# Why: #5217 in Alexa global
'http://www.gazeteoku.com/',
# Why: #5218 in Alexa global
'http://www.kinghost.com/',
# Why: #5219 in Alexa global
'http://www.izismile.com/',
# Why: #5220 in Alexa global
'http://www.gopro.com/',
# Why: #5221 in Alexa global
'http://www.uspto.gov/',
# Why: #5222 in Alexa global
'http://www.testberichte.de/',
# Why: #5223 in Alexa global
'http://www.fs.to/',
# Why: #5224 in Alexa global
'http://www.sketchtoy.com/',
# Why: #5225 in Alexa global
'http://www.sinarharian.com.my/',
# Why: #5226 in Alexa global
'http://www.stylemode.com/',
# Why: #5227 in Alexa global
'http://www.v7n.com/',
# Why: #5228 in Alexa global
'http://www.livenation.com/',
# Why: #5229 in Alexa global
'http://www.firstrow1.eu/',
# Why: #5230 in Alexa global
'http://www.joomlaforum.ru/',
# Why: #5231 in Alexa global
'http://www.sharecare.com/',
# Why: #5232 in Alexa global
'http://www.vetogate.com/',
# Why: #5233 in Alexa global
'http://www.series.ly/',
# Why: #5234 in Alexa global
'http://www.property24.com/',
# Why: #5235 in Alexa global
'http://www.payamsara.com/',
# Why: #5236 in Alexa global
'http://www.webstarts.com/',
# Why: #5237 in Alexa global
'http://www.renfe.es/',
# Why: #5238 in Alexa global
'http://www.fatcow.com/',
# Why: #5239 in Alexa global
'http://www.24ur.com/',
# Why: #5240 in Alexa global
'http://www.lide.cz/',
# Why: #5241 in Alexa global
'http://www.sabayacafe.com/',
# Why: #5242 in Alexa global
'http://www.prodavalnik.com/',
# Why: #5243 in Alexa global
'http://www.hyves.nl/',
# Why: #5244 in Alexa global
'http://www.groupon.jp/',
# Why: #5245 in Alexa global
'http://www.almaany.com/',
# Why: #5246 in Alexa global
'http://www.xero.com/',
# Why: #5247 in Alexa global
'http://www.celluway.com/',
# Why: #5248 in Alexa global
'http://www.mapbar.com/',
# Why: #5249 in Alexa global
'http://www.vecernji.hr/',
# Why: #5250 in Alexa global
'http://www.konga.com/',
# Why: #5251 in Alexa global
'http://www.fresherslive.com/',
# Why: #5252 in Alexa global
'http://www.nova.cz/',
# Why: #5253 in Alexa global
'http://www.onlinefwd.com/',
# Why: #5254 in Alexa global
'http://www.petco.com/',
# Why: #5255 in Alexa global
'http://www.benisonapparel.com/',
# Why: #5256 in Alexa global
'http://www.jango.com/',
# Why: #5257 in Alexa global
'http://mangocity.com/',
# Why: #5258 in Alexa global
'http://www.gamefly.com/',
# Why: #5259 in Alexa global
'http://www.igma.tv/',
# Why: #5260 in Alexa global
'http://www.21cineplex.com/',
# Why: #5261 in Alexa global
'http://www.fblife.com/',
# Why: #5262 in Alexa global
'http://www.moe.gov.eg/',
# Why: #5263 in Alexa global
'http://www.heydouga.com/',
# Why: #5264 in Alexa global
'http://buildhr.com/',
# Why: #5265 in Alexa global
'http://www.mmo-champion.com/',
# Why: #5266 in Alexa global
'http://www.ithome.com/',
# Why: #5267 in Alexa global
'http://www.krakow.pl/',
# Why: #5268 in Alexa global
'http://www.history.com/',
# Why: #5269 in Alexa global
'http://www.jc001.cn/',
# Why: #5270 in Alexa global
'http://www.privatehomeclips.com/',
# Why: #5271 in Alexa global
'http://www.wasu.cn/',
# Why: #5272 in Alexa global
'http://www.bazos.cz/',
# Why: #5273 in Alexa global
'http://www.appchina.com/',
# Why: #5274 in Alexa global
'http://www.helpster.de/',
# Why: #5275 in Alexa global
'http://www.51hejia.com/',
# Why: #5276 in Alexa global
'http://www.fuckbadbitches.com/',
# Why: #5277 in Alexa global
'http://www.toyota-autocenter.com/',
# Why: #5278 in Alexa global
'http://www.alnaharegypt.com/',
# Why: #5280 in Alexa global
'http://www.eastbay.com/',
# Why: #5281 in Alexa global
'http://www.softonic.com.br/',
# Why: #5282 in Alexa global
'http://www.translit.ru/',
# Why: #5283 in Alexa global
'http://www.justcloud.com/',
# Why: #5284 in Alexa global
'http://www.validclick.net/',
# Why: #5285 in Alexa global
'http://www.seneweb.com/',
# Why: #5286 in Alexa global
'http://www.fsiblog.com/',
# Why: #5287 in Alexa global
'http://www.williamhill.it/',
# Why: #5288 in Alexa global
'http://www.twitchy.com/',
# Why: #5289 in Alexa global
'http://www.y4yy.com/',
# Why: #5290 in Alexa global
'http://www.gouv.qc.ca/',
# Why: #5291 in Alexa global
'http://www.nubiles.net/',
# Why: #5292 in Alexa global
'http://www.marvel.com/',
# Why: #5293 in Alexa global
'http://www.helpmefindyour.info/',
# Why: #5294 in Alexa global
'http://www.tripadvisor.ca/',
# Why: #5295 in Alexa global
'http://www.joomlart.com/',
# Why: #5296 in Alexa global
'http://www.m18.com/',
# Why: #5297 in Alexa global
'http://www.orgasmatrix.com/',
# Why: #5298 in Alexa global
'http://www.bidoo.com/',
# Why: #5299 in Alexa global
'http://www.rogers.com/',
# Why: #5300 in Alexa global
'http://www.informationng.com/',
# Why: #5301 in Alexa global
'http://www.voyage-prive.com/',
# Why: #5302 in Alexa global
'http://www.comingsoon.net/',
# Why: #5303 in Alexa global
'http://www.searchmetrics.com/',
# Why: #5304 in Alexa global
'http://www.jetztspielen.de/',
# Why: #5305 in Alexa global
'http://www.mathxl.com/',
# Why: #5306 in Alexa global
'http://www.telmex.com/',
# Why: #5307 in Alexa global
'http://www.purpleporno.com/',
# Why: #5308 in Alexa global
'http://www.coches.net/',
# Why: #5309 in Alexa global
'http://hamusoku.com/',
# Why: #5310 in Alexa global
'http://www.link-assistant.com/',
# Why: #5311 in Alexa global
'http://www.gosur.com/',
# Why: #5312 in Alexa global
'http://www.torrentcrazy.com/',
# Why: #5313 in Alexa global
'http://www.funny-games.biz/',
# Why: #5314 in Alexa global
'http://www.bseindia.com/',
# Why: #5315 in Alexa global
'http://www.promosite.ru/',
# Why: #5316 in Alexa global
'http://www.google.mn/',
# Why: #5317 in Alexa global
'http://www.cartoonnetworkarabic.com/',
# Why: #5318 in Alexa global
'http://www.icm.edu.pl/',
# Why: #5319 in Alexa global
'http://ttt4.com/',
# Why: #5321 in Alexa global
'http://www.pepperjamnetwork.com/',
# Why: #5322 in Alexa global
'http://www.lolzbook.com/',
# Why: #5323 in Alexa global
'http://www.nationalpost.com/',
# Why: #5324 in Alexa global
'http://www.tukif.com/',
# Why: #5325 in Alexa global
'http://www.club-asteria.com/',
# Why: #5326 in Alexa global
'http://www.7search.com/',
# Why: #5327 in Alexa global
'http://www.kasikornbank.com/',
# Why: #5328 in Alexa global
'http://www.ebay.ie/',
# Why: #5329 in Alexa global
'http://www.sexlunch.com/',
# Why: #5330 in Alexa global
'http://www.qype.com/',
# Why: #5331 in Alexa global
'http://www.sankakucomplex.com/',
# Why: #5333 in Alexa global
'http://www.flashback.org/',
# Why: #5334 in Alexa global
'http://www.streamhunter.eu/',
# Why: #5335 in Alexa global
'http://www.rsb.ru/',
# Why: #5336 in Alexa global
'http://www.royalporntube.com/',
# Why: #5337 in Alexa global
'http://www.diretta.it/',
# Why: #5338 in Alexa global
'http://www.yummly.com/',
# Why: #5339 in Alexa global
'http://www.dom2.ru/',
# Why: #5340 in Alexa global
'http://www.2144.cn/',
# Why: #5341 in Alexa global
'http://www.metoffice.gov.uk/',
# Why: #5342 in Alexa global
'http://www.goodbaby.com/',
# Why: #5343 in Alexa global
'http://www.pornbb.org/',
# Why: #5344 in Alexa global
'http://www.formspring.me/',
# Why: #5345 in Alexa global
'http://www.google.com.cy/',
# Why: #5346 in Alexa global
'http://www.purepeople.com/',
# Why: #5347 in Alexa global
'http://www.epnet.com/',
# Why: #5348 in Alexa global
'http://www.penny-arcade.com/',
# Why: #5349 in Alexa global
'http://www.onlinekhabar.com/',
# Why: #5350 in Alexa global
'http://www.vcommission.com/',
# Why: #5351 in Alexa global
'http://www.zimabdk.com/',
# Why: #5352 in Alexa global
'http://www.car.gr/',
# Why: #5353 in Alexa global
'http://www.wat.tv/',
# Why: #5354 in Alexa global
'http://www.nnn.ru/',
# Why: #5355 in Alexa global
'http://www.arvixe.com/',
# Why: #5356 in Alexa global
'http://www.buxp.org/',
# Why: #5357 in Alexa global
'http://www.shaw.ca/',
# Why: #5358 in Alexa global
'http://cnyes.com/',
# Why: #5359 in Alexa global
'http://www.casa.it/',
# Why: #5360 in Alexa global
'http://233.com/',
# Why: #5361 in Alexa global
'http://www.text.ru/',
# Why: #5362 in Alexa global
'http://www.800notes.com/',
# Why: #5363 in Alexa global
'http://www.banki.ru/',
# Why: #5364 in Alexa global
'http://www.marinetraffic.com/',
# Why: #5365 in Alexa global
'http://www.meteo.gr/',
# Why: #5366 in Alexa global
'http://www.thetrainline.com/',
# Why: #5367 in Alexa global
'http://www.blogspot.ch/',
# Why: #5368 in Alexa global
'http://www.netaffiliation.com/',
# Why: #5370 in Alexa global
'http://www.olx.co.id/',
# Why: #5371 in Alexa global
'http://www.slando.kz/',
# Why: #5372 in Alexa global
'http://www.nordea.se/',
# Why: #5373 in Alexa global
'http://www.xbabe.com/',
# Why: #5374 in Alexa global
'http://www.bibsonomy.org/',
# Why: #5375 in Alexa global
'http://www.moneynews.com/',
# Why: #5376 in Alexa global
'http://265g.com/',
# Why: #5377 in Alexa global
'http://www.horoscope.com/',
# Why: #5378 in Alexa global
'http://www.home.ne.jp/',
# Why: #5379 in Alexa global
'http://www.cztv.com.cn/',
# Why: #5380 in Alexa global
'http://www.yammer.com/',
# Why: #5381 in Alexa global
'http://www.sextgem.com/',
# Why: #5382 in Alexa global
'http://www.tribune.com.pk/',
# Why: #5383 in Alexa global
'http://www.topeuro.biz/',
# Why: #5385 in Alexa global
'http://www.perfectgirls.xxx/',
# Why: #5386 in Alexa global
'http://ssc.nic.in/',
# Why: #5387 in Alexa global
'http://www.8264.com/',
# Why: #5388 in Alexa global
'http://www.flvrunner.com/',
# Why: #5389 in Alexa global
'http://www.gry.pl/',
# Why: #5390 in Alexa global
'http://www.sto.cn/',
# Why: #5391 in Alexa global
'http://www.pravda.ru/',
# Why: #5392 in Alexa global
'http://www.fulltiltpoker.com/',
# Why: #5393 in Alexa global
'http://www.kure.tv/',
# Why: #5394 in Alexa global
'http://www.turbo.az/',
# Why: #5395 in Alexa global
'http://www.ujian.cc/',
# Why: #5396 in Alexa global
'http://www.mustseeindia.com/',
# Why: #5397 in Alexa global
'http://www.thithtoolwin.com/',
# Why: #5398 in Alexa global
'http://www.chiphell.com/',
# Why: #5399 in Alexa global
'http://www.baidu.cn/',
# Why: #5400 in Alexa global
'http://www.spieletipps.de/',
# Why: #5401 in Alexa global
'http://www.portail.free.fr/',
# Why: #5402 in Alexa global
'http://www.hbr.org/',
# Why: #5403 in Alexa global
'http://www.sex-hq.com/',
# Why: #5404 in Alexa global
'http://www.webdeveloper.com/',
# Why: #5405 in Alexa global
'http://www.cloudzer.net/',
# Why: #5406 in Alexa global
'http://www.vagas.com.br/',
# Why: #5407 in Alexa global
'http://www.anspress.com/',
# Why: #5408 in Alexa global
'http://www.beitaichufang.com/',
# Why: #5409 in Alexa global
'http://www.songkick.com/',
# Why: #5410 in Alexa global
'http://www.tsite.jp/',
# Why: #5411 in Alexa global
'http://www.oyunlari.net/',
# Why: #5412 in Alexa global
'http://www.unfollowers.me/',
# Why: #5413 in Alexa global
'http://www.computrabajo.com.mx/',
# Why: #5414 in Alexa global
'http://www.usp.br/',
# Why: #5415 in Alexa global
'http://www.parseek.com/',
# Why: #5416 in Alexa global
'http://www.salary.com/',
# Why: #5417 in Alexa global
'http://www.navyfcu.org/',
# Why: #5418 in Alexa global
'http://www.bigpond.com/',
# Why: #5419 in Alexa global
'http://www.joann.com/',
# Why: #5420 in Alexa global
'http://www.ajansspor.com/',
# Why: #5421 in Alexa global
'http://www.burnews.com/',
# Why: #5422 in Alexa global
'http://www.myrecipes.com/',
# Why: #5423 in Alexa global
'http://www.mt5.com/',
# Why: #5424 in Alexa global
'http://www.webconfs.com/',
# Why: #5425 in Alexa global
'http://www.offcn.com/',
# Why: #5426 in Alexa global
'http://www.travian.com.tr/',
# Why: #5427 in Alexa global
'http://www.animenewsnetwork.com/',
# Why: #5428 in Alexa global
'http://www.smartshopping.com/',
# Why: #5429 in Alexa global
'http://www.twojapogoda.pl/',
# Why: #5430 in Alexa global
'http://www.tigerairways.com/',
# Why: #5431 in Alexa global
'http://www.qoo10.jp/',
# Why: #5432 in Alexa global
'http://www.archiveofourown.org/',
# Why: #5433 in Alexa global
'http://www.qq937.com/',
# Why: #5434 in Alexa global
'http://www.meneame.net/',
# Why: #5436 in Alexa global
'http://www.joyclub.de/',
# Why: #5437 in Alexa global
'http://www.yy.com/',
# Why: #5438 in Alexa global
'http://www.weddingwire.com/',
# Why: #5439 in Alexa global
'http://www.moddb.com/',
# Why: #5440 in Alexa global
'http://www.acervoamador.com/',
# Why: #5441 in Alexa global
'http://www.stgeorge.com.au/',
# Why: #5442 in Alexa global
'http://www.forumhouse.ru/',
# Why: #5443 in Alexa global
'http://www.mp3xd.com/',
# Why: #5444 in Alexa global
'http://www.nomura.co.jp/',
# Why: #5445 in Alexa global
'http://www.lionair.co.id/',
# Why: #5446 in Alexa global
'http://www.needtoporn.com/',
# Why: #5447 in Alexa global
'http://www.playcast.ru/',
# Why: #5448 in Alexa global
'http://www.paheal.net/',
# Why: #5449 in Alexa global
'http://www.finishline.com/',
# Why: #5450 in Alexa global
'http://www.sep.gob.mx/',
# Why: #5451 in Alexa global
'http://www.comenity.net/',
# Why: #5452 in Alexa global
'http://www.tqn.com/',
# Why: #5453 in Alexa global
'http://www.eroticads.com/',
# Why: #5454 in Alexa global
'http://www.svpressa.ru/',
# Why: #5455 in Alexa global
'http://www.dtvideo.com/',
# Why: #5456 in Alexa global
'http://www.mobile.free.fr/',
# Why: #5457 in Alexa global
'http://www.privat24.ua/',
# Why: #5458 in Alexa global
'http://www.mp3sk.net/',
# Why: #5459 in Alexa global
'http://www.atlas.sk/',
# Why: #5460 in Alexa global
'http://www.aib.ie/',
# Why: #5461 in Alexa global
'http://www.shockwave.com/',
# Why: #5462 in Alexa global
'http://www.qatarairways.com/',
# Why: #5463 in Alexa global
'http://www.theladders.com/',
# Why: #5464 in Alexa global
'http://www.dsnetwb.com/',
# Why: #5465 in Alexa global
'http://www.expansiondirecto.com/',
# Why: #5466 in Alexa global
'http://www.povarenok.ru/',
# Why: #5467 in Alexa global
'http://www.moneysupermarket.com/',
# Why: #5468 in Alexa global
'http://www.getchu.com/',
# Why: #5469 in Alexa global
'http://www.gay.com/',
# Why: #5470 in Alexa global
'http://www.hsbc.com.mx/',
# Why: #5471 in Alexa global
'http://www.textsale.ru/',
# Why: #5472 in Alexa global
'http://www.kadinlarkulubu.com/',
# Why: #5473 in Alexa global
'http://www.scientificamerican.com/',
# Why: #5474 in Alexa global
'http://www.hillnews.com/',
# Why: #5475 in Alexa global
'http://www.tori.fi/',
# Why: #5476 in Alexa global
'http://www.6tie.com/',
# Why: #5477 in Alexa global
'http://www.championselect.net/',
# Why: #5478 in Alexa global
'http://gtobal.com/',
# Why: #5479 in Alexa global
'http://www.bangkokbank.com/',
# Why: #5481 in Alexa global
'http://www.akakce.com/',
# Why: #5482 in Alexa global
'http://www.smarter.com/',
# Why: #5483 in Alexa global
'http://www.totalvideoplugin.com/',
# Why: #5484 in Alexa global
'http://www.dmir.ru/',
# Why: #5485 in Alexa global
'http://www.rpp.com.pe/',
# Why: #5486 in Alexa global
'http://www.uhaul.com/',
# Why: #5487 in Alexa global
'http://www.kayako.com/',
# Why: #5488 in Alexa global
'http://www.buyvip.com/',
# Why: #5489 in Alexa global
'http://www.sixrevisions.com/',
# Why: #5490 in Alexa global
'http://www.army.mil/',
# Why: #5491 in Alexa global
'http://www.rediffmail.com/',
# Why: #5492 in Alexa global
'http://www.gsis.gr/',
# Why: #5494 in Alexa global
'http://www.destinia.com/',
# Why: #5495 in Alexa global
'http://www.behindwoods.com/',
# Why: #5496 in Alexa global
'http://www.wearehairy.com/',
# Why: #5497 in Alexa global
'http://www.coqnu.com/',
# Why: #5498 in Alexa global
'http://www.soundclick.com/',
# Why: #5499 in Alexa global
'http://www.drive.ru/',
# Why: #5501 in Alexa global
'http://www.cam4.fr/',
# Why: #5502 in Alexa global
'http://www.jschina.com.cn/',
# Why: #5503 in Alexa global
'http://www.bakusai.com/',
# Why: #5504 in Alexa global
'http://www.thailandtorrent.com/',
# Why: #5505 in Alexa global
'http://www.videosz.com/',
# Why: #5506 in Alexa global
'http://www.eporner.com/',
# Why: #5507 in Alexa global
'http://www.rakuten-sec.co.jp/',
# Why: #5508 in Alexa global
'http://www.stltoday.com/',
# Why: #5509 in Alexa global
'http://www.ilmessaggero.it/',
# Why: #5510 in Alexa global
'http://www.theregister.co.uk/',
# Why: #5511 in Alexa global
'http://www.bloggang.com/',
# Why: #5512 in Alexa global
'http://www.eonet.jp/',
# Why: #5513 in Alexa global
'http://www.nastyvideotube.com/',
# Why: #5514 in Alexa global
'http://www.doityourself.com/',
# Why: #5515 in Alexa global
'http://www.rp-online.de/',
# Why: #5516 in Alexa global
'http://www.wow-impulse.ru/',
# Why: #5517 in Alexa global
'http://www.kar.nic.in/',
# Why: #5518 in Alexa global
'http://www.bershka.com/',
# Why: #5519 in Alexa global
'http://www.neteller.com/',
# Why: #5520 in Alexa global
'http://www.adevarul.ro/',
# Why: #5521 in Alexa global
'http://www.divxtotal.com/',
# Why: #5522 in Alexa global
'http://www.bolshoyvopros.ru/',
# Why: #5523 in Alexa global
'http://www.letudiant.fr/',
# Why: #5524 in Alexa global
'http://www.xinshipu.com/',
# Why: #5525 in Alexa global
'http://www.vh1.com/',
# Why: #5526 in Alexa global
'http://www.excite.com/',
# Why: #5527 in Alexa global
'http://www.somewhereinblog.net/',
# Why: #5529 in Alexa global
'http://www.mcgraw-hill.com/',
# Why: #5530 in Alexa global
'http://www.patheos.com/',
# Why: #5531 in Alexa global
'http://www.webdesignledger.com/',
# Why: #5532 in Alexa global
'http://www.plus28.com/',
# Why: #5533 in Alexa global
'http://www.adultwork.com/',
# Why: #5534 in Alexa global
'http://www.dajuegos.com/',
# Why: #5535 in Alexa global
'http://www.blogs.com/',
# Why: #5536 in Alexa global
'http://www.glopart.ru/',
# Why: #5537 in Alexa global
'http://www.donews.com/',
# Why: #5538 in Alexa global
'http://www.nation.co.ke/',
# Why: #5539 in Alexa global
'http://www.delfi.ee/',
# Why: #5540 in Alexa global
'http://www.lacuerda.net/',
# Why: #5541 in Alexa global
'http://www.jjshouse.com/',
# Why: #5542 in Alexa global
'http://www.megaindex.ru/',
# Why: #5543 in Alexa global
'http://www.darty.com/',
# Why: #5544 in Alexa global
'http://www.maturetube.com/',
# Why: #5545 in Alexa global
'http://www.jokeroo.com/',
# Why: #5546 in Alexa global
'http://www.estekhtam.com/',
# Why: #5547 in Alexa global
'http://www.fnac.es/',
# Why: #5548 in Alexa global
'http://www.ninjakiwi.com/',
# Why: #5549 in Alexa global
'http://www.tovima.gr/',
# Why: #5550 in Alexa global
'http://www.timinternet.it/',
# Why: #5551 in Alexa global
'http://www.citizensbankonline.com/',
# Why: #5552 in Alexa global
'http://www.builtwith.com/',
# Why: #5553 in Alexa global
'http://www.ko499.com/',
# Why: #5554 in Alexa global
'http://www.tastyblacks.com/',
# Why: #5555 in Alexa global
'http://www.currys.co.uk/',
# Why: #5556 in Alexa global
'http://www.jobui.com/',
# Why: #5557 in Alexa global
'http://www.notebookreview.com/',
# Why: #5558 in Alexa global
'http://www.meishij.net/',
# Why: #5559 in Alexa global
'http://www.filerio.in/',
# Why: #5560 in Alexa global
'http://gohappy.com.tw/',
# Why: #5561 in Alexa global
'http://www.cheapflights.co.uk/',
# Why: #5562 in Alexa global
'http://www.puls24.mk/',
# Why: #5563 in Alexa global
'http://www.rumbo.es/',
# Why: #5564 in Alexa global
'http://www.newsbusters.org/',
# Why: #5565 in Alexa global
'http://www.imgdino.com/',
# Why: #5566 in Alexa global
'http://www.oxforddictionaries.com/',
# Why: #5567 in Alexa global
'http://www.ftdownloads.com/',
# Why: #5568 in Alexa global
'http://ciudad.com.ar/',
# Why: #5569 in Alexa global
'http://www.latercera.cl/',
# Why: #5570 in Alexa global
'http://www.lankadeepa.lk/',
# Why: #5571 in Alexa global
'http://www.47news.jp/',
# Why: #5572 in Alexa global
'http://www.bankier.pl/',
# Why: #5573 in Alexa global
'http://www.hawahome.com/',
# Why: #5574 in Alexa global
'http://www.comicvine.com/',
# Why: #5575 in Alexa global
'http://www.cam4.it/',
# Why: #5576 in Alexa global
'http://www.fok.nl/',
# Why: #5577 in Alexa global
'http://www.iknowthatgirl.com/',
# Why: #5578 in Alexa global
'http://www.hizliresim.com/',
# Why: #5579 in Alexa global
'http://www.ebizmba.com/',
# Why: #5580 in Alexa global
'http://www.twistys.com/',
# Why: #5581 in Alexa global
'http://minkchan.com/',
# Why: #5582 in Alexa global
'http://www.dnevnik.hr/',
# Why: #5583 in Alexa global
'http://www.peliculascoco.com/',
# Why: #5584 in Alexa global
'http://www.new-xhamster.com/',
# Why: #5585 in Alexa global
'http://www.freelancer.in/',
# Why: #5586 in Alexa global
'http://www.globalgrind.com/',
# Why: #5587 in Alexa global
'http://www.rbc.cn/',
# Why: #5588 in Alexa global
'http://www.talkgold.com/',
# Why: #5589 in Alexa global
'http://www.p1.cn/',
# Why: #5590 in Alexa global
'http://www.kanui.com.br/',
# Why: #5591 in Alexa global
'http://www.woxikon.de/',
# Why: #5592 in Alexa global
'http://www.cinematoday.jp/',
# Why: #5593 in Alexa global
'http://www.jobstreet.com.my/',
# Why: #5594 in Alexa global
'http://www.job.ru/',
# Why: #5595 in Alexa global
'http://www.wowbiz.ro/',
# Why: #5596 in Alexa global
'http://www.yiyi.cc/',
# Why: #5597 in Alexa global
'http://www.sinoptik.ua/',
# Why: #5598 in Alexa global
'http://www.parents.com/',
# Why: #5599 in Alexa global
'http://www.forblabla.com/',
# Why: #5600 in Alexa global
'http://www.trojmiasto.pl/',
# Why: #5601 in Alexa global
'http://www.anyoption.com/',
# Why: #5602 in Alexa global
'http://www.wplocker.com/',
# Why: #5603 in Alexa global
'http://www.paytm.in/',
# Why: #5604 in Alexa global
'http://www.elespectador.com/',
# Why: #5605 in Alexa global
'http://www.mysitecost.ru/',
# Why: #5606 in Alexa global
'http://www.startribune.com/',
# Why: #5607 in Alexa global
'http://www.cam4.co.uk/',
# Why: #5608 in Alexa global
'http://www.bestcoolmobile.com/',
# Why: #5609 in Alexa global
'http://www.soup.io/',
# Why: #5610 in Alexa global
'http://www.starfall.com/',
# Why: #5611 in Alexa global
'http://www.ixl.com/',
# Why: #5612 in Alexa global
'http://www.oreilly.com/',
# Why: #5613 in Alexa global
'http://www.dansmovies.com/',
# Why: #5614 in Alexa global
'http://www.facemoods.com/',
# Why: #5615 in Alexa global
'http://www.google.ge/',
# Why: #5616 in Alexa global
'http://www.sat.gob.mx/',
# Why: #5617 in Alexa global
'http://www.weatherbug.com/',
# Why: #5618 in Alexa global
'http://www.majorgeeks.com/',
# Why: #5619 in Alexa global
'http://www.llbean.com/',
# Why: #5620 in Alexa global
'http://www.catho.com.br/',
# Why: #5621 in Alexa global
'http://www.gungho.jp/',
# Why: #5622 in Alexa global
'http://www.mk.co.kr/',
# Why: #5623 in Alexa global
'http://www.googlegroups.com/',
# Why: #5624 in Alexa global
'http://www.animoto.com/',
# Why: #5625 in Alexa global
'http://www.alquds.co.uk/',
# Why: #5626 in Alexa global
'http://www.newsday.com/',
# Why: #5627 in Alexa global
'http://www.games2girls.com/',
# Why: #5628 in Alexa global
'http://www.youporngay.com/',
# Why: #5629 in Alexa global
'http://www.spaces.ru/',
# Why: #5630 in Alexa global
'http://www.seriespepito.com/',
# Why: #5631 in Alexa global
'http://www.gelbeseiten.de/',
# Why: #5632 in Alexa global
'http://www.thethirdmedia.com/',
# Why: #5633 in Alexa global
'http://www.watchfomny.com/',
# Why: #5634 in Alexa global
'http://www.freecamsexposed.com/',
# Why: #5635 in Alexa global
'http://www.dinakaran.com/',
# Why: #5636 in Alexa global
'http://www.xxxhost.me/',
# Why: #5637 in Alexa global
'http://www.smartprix.com/',
# Why: #5638 in Alexa global
'http://www.thoughtcatalog.com/',
# Why: #5639 in Alexa global
'http://www.soccersuck.com/',
# Why: #5640 in Alexa global
'http://www.vivanuncios.com/',
# Why: #5641 in Alexa global
'http://www.liba.com/',
# Why: #5642 in Alexa global
'http://www.gog.com/',
# Why: #5643 in Alexa global
'http://www.philstar.com/',
# Why: #5644 in Alexa global
'http://www.cian.ru/',
# Why: #5645 in Alexa global
'http://www.avclub.com/',
# Why: #5646 in Alexa global
'http://www.slon.ru/',
# Why: #5647 in Alexa global
'http://www.stc.com.sa/',
# Why: #5648 in Alexa global
'http://www.jstor.org/',
# Why: #5649 in Alexa global
'http://www.wehkamp.nl/',
# Why: #5650 in Alexa global
'http://www.vodafone.co.uk/',
# Why: #5651 in Alexa global
'http://www.deser.pl/',
# Why: #5652 in Alexa global
'http://www.adscendmedia.com/',
# Why: #5653 in Alexa global
'http://www.getcashforsurveys.com/',
# Why: #5654 in Alexa global
'http://www.glamsham.com/',
# Why: #5655 in Alexa global
'http://www.dressupgames.com/',
# Why: #5656 in Alexa global
'http://www.lifo.gr/',
# Why: #5657 in Alexa global
'http://www.37signals.com/',
# Why: #5658 in Alexa global
'http://www.pdfonline.com/',
# Why: #5659 in Alexa global
'http://www.flipkey.com/',
# Why: #5660 in Alexa global
'http://www.epochtimes.com/',
# Why: #5662 in Alexa global
'http://www.futhead.com/',
# Why: #5663 in Alexa global
'http://www.inlinkz.com/',
# Why: #5664 in Alexa global
'http://www.fx-trend.com/',
# Why: #5665 in Alexa global
'http://www.yasdl.com/',
# Why: #5666 in Alexa global
'http://www.techbang.com/',
# Why: #5667 in Alexa global
'http://www.narenji.ir/',
# Why: #5668 in Alexa global
'http://www.szonline.net/',
# Why: #5669 in Alexa global
'http://www.perfil.com.ar/',
# Why: #5670 in Alexa global
'http://www.mywebface.com/',
# Why: #5671 in Alexa global
'http://www.taknaz.ir/',
# Why: #5672 in Alexa global
'http://www.tradera.com/',
# Why: #5673 in Alexa global
'http://www.golem.de/',
# Why: #5674 in Alexa global
'http://www.its-mo.com/',
# Why: #5675 in Alexa global
'http://www.arabnet5.com/',
# Why: #5676 in Alexa global
'http://www.freerepublic.com/',
# Why: #5677 in Alexa global
'http://www.britannica.com/',
# Why: #5678 in Alexa global
'http://www.deccanchronicle.com/',
# Why: #5679 in Alexa global
'http://www.ohio.gov/',
# Why: #5680 in Alexa global
'http://www.busuu.com/',
# Why: #5681 in Alexa global
'http://www.pricecheck.co.za/',
# Why: #5682 in Alexa global
'http://www.paltalk.com/',
# Why: #5683 in Alexa global
'http://www.sportinglife.com/',
# Why: #5684 in Alexa global
'http://www.google.sn/',
# Why: #5685 in Alexa global
'http://www.meteomedia.com/',
# Why: #5686 in Alexa global
'http://www.push2check.net/',
# Why: #5687 in Alexa global
'http://www.ing-diba.de/',
# Why: #5688 in Alexa global
'http://www.immoweb.be/',
# Why: #5689 in Alexa global
'http://www.oregonlive.com/',
# Why: #5690 in Alexa global
'http://www.ge.tt/',
# Why: #5691 in Alexa global
'http://www.bbspink.com/',
# Why: #5692 in Alexa global
'http://www.business2community.com/',
# Why: #5693 in Alexa global
'http://www.viidii.com/',
# Why: #5694 in Alexa global
'http://www.hrloo.com/',
# Why: #5695 in Alexa global
'http://www.mglradio.com/',
# Why: #5696 in Alexa global
'http://www.cosme.net/',
# Why: #5697 in Alexa global
'http://www.xilu.com/',
# Why: #5698 in Alexa global
'http://www.scbeasy.com/',
# Why: #5699 in Alexa global
'http://www.biglots.com/',
# Why: #5700 in Alexa global
'http://www.dhakatimes24.com/',
# Why: #5701 in Alexa global
'http://www.spankbang.com/',
# Why: #5702 in Alexa global
'http://www.hitleap.com/',
# Why: #5703 in Alexa global
'http://www.proz.com/',
# Why: #5704 in Alexa global
'http://www.php100.com/',
# Why: #5705 in Alexa global
'http://www.tvtoday.de/',
# Why: #5706 in Alexa global
'http://www.funnie.st/',
# Why: #5707 in Alexa global
'http://www.velvet.hu/',
# Why: #5708 in Alexa global
'http://www.dhnet.be/',
# Why: #5709 in Alexa global
'http://www.capital.gr/',
# Why: #5710 in Alexa global
'http://www.inosmi.ru/',
# Why: #5711 in Alexa global
'http://www.healthkart.com/',
# Why: #5712 in Alexa global
'http://www.amway.com/',
# Why: #5713 in Alexa global
'http://www.madmimi.com/',
# Why: #5714 in Alexa global
'http://www.dramafever.com/',
# Why: #5715 in Alexa global
'http://www.oodle.com/',
# Why: #5716 in Alexa global
'http://www.spreadshirt.com/',
# Why: #5717 in Alexa global
'http://www.google.mg/',
# Why: #5718 in Alexa global
'http://www.utarget.ru/',
# Why: #5719 in Alexa global
'http://www.matomy.com/',
# Why: #5720 in Alexa global
'http://www.medhelp.org/',
# Why: #5721 in Alexa global
'http://www.cumlouder.com/',
# Why: #5723 in Alexa global
'http://www.aliorbank.pl/',
# Why: #5724 in Alexa global
'http://www.takepart.com/',
# Why: #5725 in Alexa global
'http://www.myfreshnet.com/',
# Why: #5726 in Alexa global
'http://www.adorama.com/',
# Why: #5727 in Alexa global
'http://www.dhs.gov/',
# Why: #5728 in Alexa global
'http://www.suruga-ya.jp/',
# Why: #5729 in Alexa global
'http://www.mivo.tv/',
# Why: #5730 in Alexa global
'http://www.nchsoftware.com/',
# Why: #5731 in Alexa global
'http://www.gnc.com/',
# Why: #5732 in Alexa global
'http://www.spiceworks.com/',
# Why: #5734 in Alexa global
'http://www.jeu.fr/',
# Why: #5735 in Alexa global
'http://www.tv-tokyo.co.jp/',
# Why: #5736 in Alexa global
'http://www.terra.com/',
# Why: #5737 in Alexa global
'http://www.irishtimes.com/',
# Why: #5738 in Alexa global
'http://www.kleiderkreisel.de/',
# Why: #5739 in Alexa global
'http://www.ebay.be/',
# Why: #5740 in Alexa global
'http://www.rt.ru/',
# Why: #5741 in Alexa global
'http://www.radiofarda.com/',
# Why: #5742 in Alexa global
'http://www.atrapalo.com/',
# Why: #5743 in Alexa global
'http://www.southcn.com/',
# Why: #5744 in Alexa global
'http://www.turkcell.com.tr/',
# Why: #5745 in Alexa global
'http://www.themetapicture.com/',
# Why: #5746 in Alexa global
'http://www.aujourdhui.com/',
# Why: #5747 in Alexa global
'http://www.ato.gov.au/',
# Why: #5748 in Alexa global
'http://www.pelis24.com/',
# Why: #5749 in Alexa global
'http://www.saaid.net/',
# Why: #5750 in Alexa global
'http://www.bradsdeals.com/',
# Why: #5751 in Alexa global
'http://www.pirate101.com/',
# Why: #5752 in Alexa global
'http://www.saturn.de/',
# Why: #5753 in Alexa global
'http://www.thisissouthwales.co.uk/',
# Why: #5754 in Alexa global
'http://www.cyberlink.com/',
# Why: #5755 in Alexa global
'http://www.internationalredirects.com/',
# Why: #5756 in Alexa global
'http://www.radardedescontos.com.br/',
# Why: #5758 in Alexa global
'http://www.rapidcontentwizard.com/',
# Why: #5759 in Alexa global
'http://www.kabum.com.br/',
# Why: #5761 in Alexa global
'http://www.athome.co.jp/',
# Why: #5762 in Alexa global
'http://www.webrankinfo.com/',
# Why: #5763 in Alexa global
'http://www.kiabi.com/',
# Why: #5764 in Alexa global
'http://www.farecompare.com/',
# Why: #5765 in Alexa global
'http://www.xinjunshi.com/',
# Why: #5766 in Alexa global
'http://www.youtube.com/user/SkyDoesMinecraft/',
# Why: #5767 in Alexa global
'http://www.vidxden.com/',
# Why: #5768 in Alexa global
'http://www.pvrcinemas.com/',
# Why: #5769 in Alexa global
'http://chachaba.com/',
# Why: #5770 in Alexa global
'http://www.wanmei.com/',
# Why: #5771 in Alexa global
'http://alternet.org/',
# Why: #5772 in Alexa global
'http://www.rozklad-pkp.pl/',
# Why: #5773 in Alexa global
'http://www.omniture.com/',
# Why: #5774 in Alexa global
'http://www.childrensplace.com/',
# Why: #5775 in Alexa global
'http://www.menards.com/',
# Why: #5776 in Alexa global
'http://www.zhcw.com/',
# Why: #5777 in Alexa global
'http://www.ouest-france.fr/',
# Why: #5778 in Alexa global
'http://www.vitorrent.org/',
# Why: #5779 in Alexa global
'http://www.xanga.com/',
# Why: #5780 in Alexa global
'http://www.zbozi.cz/',
# Why: #5781 in Alexa global
'http://www.dnspod.cn/',
# Why: #5782 in Alexa global
'http://www.radioshack.com/',
# Why: #5783 in Alexa global
'http://www.startv.in/',
# Why: #5784 in Alexa global
'http://www.affiliatewindow.com/',
# Why: #5785 in Alexa global
'http://www.gov.on.ca/',
# Why: #5786 in Alexa global
'http://www.grainger.com/',
# Why: #5787 in Alexa global
'http://www.3rat.com/',
# Why: #5788 in Alexa global
'http://www.indeed.co.za/',
# Why: #5789 in Alexa global
'http://www.rtbf.be/',
# Why: #5790 in Alexa global
'http://www.strava.com/',
# Why: #5791 in Alexa global
'http://www.disneystore.com/',
# Why: #5792 in Alexa global
'http://www.travelagency.travel/',
# Why: #5793 in Alexa global
'http://www.ekitan.com/',
# Why: #5794 in Alexa global
'http://www.66law.cn/',
# Why: #5795 in Alexa global
'http://www.volagratis.com/',
# Why: #5796 in Alexa global
'http://www.yiiframework.com/',
# Why: #5797 in Alexa global
'http://www.dramacrazy.net/',
# Why: #5798 in Alexa global
'http://www.addtoany.com/',
# Why: #5799 in Alexa global
'http://www.uzmantv.com/',
# Why: #5800 in Alexa global
'http://www.uline.com/',
# Why: #5801 in Alexa global
'http://www.fitnessmagazine.com/',
# Why: #5802 in Alexa global
'http://www.khmerload.com/',
# Why: #5803 in Alexa global
'http://www.italiafilm.tv/',
# Why: #5804 in Alexa global
'http://www.baseball-reference.com/',
# Why: #5805 in Alexa global
'http://www.neopets.com/',
# Why: #5806 in Alexa global
'http://www.multiupload.nl/',
# Why: #5807 in Alexa global
'http://www.lakii.com/',
# Why: #5808 in Alexa global
'http://www.downloadmaster.ru/',
# Why: #5809 in Alexa global
'http://www.babbel.com/',
# Why: #5810 in Alexa global
'http://www.gossip-tv.gr/',
# Why: #5811 in Alexa global
'http://www.laban.vn/',
# Why: #5812 in Alexa global
'http://www.computerbase.de/',
# Why: #5813 in Alexa global
'http://www.juyouqu.com/',
# Why: #5814 in Alexa global
'http://www.markt.de/',
# Why: #5815 in Alexa global
'http://www.linuxquestions.org/',
# Why: #5816 in Alexa global
'http://www.giveawayoftheday.com/',
# Why: #5817 in Alexa global
'http://www.176.com/',
# Why: #5818 in Alexa global
'http://www.cs.com.cn/',
# Why: #5819 in Alexa global
'http://www.homemademoviez.com/',
# Why: #5820 in Alexa global
'http://www.huffingtonpost.fr/',
# Why: #5821 in Alexa global
'http://www.movieweb.com/',
# Why: #5822 in Alexa global
'http://www.pornzeus.com/',
# Why: #5823 in Alexa global
'http://www.posta.com.tr/',
# Why: #5824 in Alexa global
'http://www.biography.com/',
# Why: #5825 in Alexa global
'http://www.bukkit.org/',
# Why: #5826 in Alexa global
'http://www.spirit.com/',
# Why: #5827 in Alexa global
'http://www.vemale.com/',
# Why: #5828 in Alexa global
'http://www.elnuevodia.com/',
# Why: #5829 in Alexa global
'http://www.pof.com.br/',
# Why: #5830 in Alexa global
'http://www.iranproud.com/',
# Why: #5831 in Alexa global
'http://www.molodost.bz/',
# Why: #5832 in Alexa global
'http://www.netcarshow.com/',
# Why: #5833 in Alexa global
'http://www.ardmediathek.de/',
# Why: #5834 in Alexa global
'http://www.fabfurnish.com/',
# Why: #5835 in Alexa global
'http://www.myfreeblack.com/',
# Why: #5836 in Alexa global
'http://www.antichat.ru/',
# Why: #5837 in Alexa global
'http://www.crocko.com/',
# Why: #5838 in Alexa global
'http://www.cocacola.co.jp/',
# Why: #5839 in Alexa global
'http://b5m.com/',
# Why: #5840 in Alexa global
'http://www.entrance-exam.net/',
# Why: #5841 in Alexa global
'http://www.benaughty.com/',
# Why: #5842 in Alexa global
'http://www.sierratradingpost.com/',
# Why: #5843 in Alexa global
'http://www.apartmentguide.com/',
# Why: #5844 in Alexa global
'http://www.slimspots.com/',
# Why: #5845 in Alexa global
'http://www.sondakika.com/',
# Why: #5846 in Alexa global
'http://www.glamour.com/',
# Why: #5847 in Alexa global
'http://www.zto.cn/',
# Why: #5848 in Alexa global
'http://www.ilyke.net/',
# Why: #5849 in Alexa global
'http://www.mybroadband.co.za/',
# Why: #5850 in Alexa global
'http://www.alaskaair.com/',
# Why: #5851 in Alexa global
'http://www.virtualtourist.com/',
# Why: #5852 in Alexa global
'http://www.rexxx.com/',
# Why: #5853 in Alexa global
'http://www.fullhdfilmizle.org/',
# Why: #5854 in Alexa global
'http://www.starpulse.com/',
# Why: #5855 in Alexa global
'http://www.winkal.com/',
# Why: #5856 in Alexa global
'http://www.ad-feeds.net/',
# Why: #5857 in Alexa global
'http://www.irannaz.com/',
# Why: #5858 in Alexa global
'http://www.elahmad.com/',
# Why: #5859 in Alexa global
'http://www.dealspl.us/',
# Why: #5860 in Alexa global
'http://www.moikrug.ru/',
# Why: #5861 in Alexa global
'http://www.olx.com.mx/',
# Why: #5862 in Alexa global
'http://www.rd.com/',
# Why: #5863 in Alexa global
'http://www.newone.org/',
# Why: #5864 in Alexa global
'http://www.naijapals.com/',
# Why: #5865 in Alexa global
'http://www.forgifs.com/',
# Why: #5866 in Alexa global
'http://www.fsjgw.com/',
# Why: #5867 in Alexa global
'http://edeng.cn/',
# Why: #5868 in Alexa global
'http://www.nicoviewer.net/',
# Why: #5869 in Alexa global
'http://www.topeleven.com/',
# Why: #5870 in Alexa global
'http://www.peerfly.com/',
# Why: #5871 in Alexa global
'http://www.softportal.com/',
# Why: #5872 in Alexa global
'http://www.clker.com/',
# Why: #5873 in Alexa global
'http://www.tehran98.com/',
# Why: #5874 in Alexa global
'http://weather2umbrella.com/',
# Why: #5875 in Alexa global
'http://www.jreast.co.jp/',
# Why: #5876 in Alexa global
'http://www.kuxun.cn/',
# Why: #5877 in Alexa global
'http://www.lookbook.nu/',
# Why: #5878 in Alexa global
'http://www.futureshop.ca/',
# Why: #5879 in Alexa global
'http://www.blackpeoplemeet.com/',
# Why: #5880 in Alexa global
'http://www.adworkmedia.com/',
# Why: #5881 in Alexa global
'http://www.entire.xxx/',
# Why: #5882 in Alexa global
'http://www.bitbucket.org/',
# Why: #5884 in Alexa global
'http://www.transfermarkt.co.uk/',
# Why: #5885 in Alexa global
'http://www.moshimonsters.com/',
# Why: #5886 in Alexa global
'http://www.4travel.jp/',
# Why: #5887 in Alexa global
'http://www.baimao.com/',
# Why: #5888 in Alexa global
'http://www.khanacademy.org/',
# Why: #5889 in Alexa global
'http://www.2chan.net/',
# Why: #5890 in Alexa global
'http://www.adopteunmec.com/',
# Why: #5891 in Alexa global
'http://www.mochimedia.com/',
# Why: #5892 in Alexa global
'http://www.strawberrynet.com/',
# Why: #5893 in Alexa global
'http://www.gdeivse.com/',
# Why: #5894 in Alexa global
'http://www.speckyboy.com/',
# Why: #5895 in Alexa global
'http://www.radical-foto.ru/',
# Why: #5896 in Alexa global
'http://www.softcoin.com/',
# Why: #5897 in Alexa global
'http://www.cnews.ru/',
# Why: #5898 in Alexa global
'http://www.ubs.com/',
# Why: #5899 in Alexa global
'http://www.lankasri.com/',
# Why: #5900 in Alexa global
'http://www.cylex.de/',
# Why: #5901 in Alexa global
'http://www.imtranslator.net/',
# Why: #5902 in Alexa global
'http://www.homeoffice.gov.uk/',
# Why: #5903 in Alexa global
'http://www.answerbag.com/',
# Why: #5904 in Alexa global
'http://www.chainreactioncycles.com/',
# Why: #5905 in Alexa global
'http://www.sportal.bg/',
# Why: #5906 in Alexa global
'http://www.livemaster.ru/',
# Why: #5907 in Alexa global
'http://www.mercadolibre.com.pe/',
# Why: #5908 in Alexa global
'http://www.mentalfloss.com/',
# Why: #5909 in Alexa global
'http://www.google.am/',
# Why: #5910 in Alexa global
'http://www.mawaly.com/',
# Why: #5911 in Alexa global
'http://www.douban.fm/',
# Why: #5912 in Alexa global
'http://www.abidjan.net/',
# Why: #5913 in Alexa global
'http://www.pricegong.com/',
# Why: #5914 in Alexa global
'http://www.brother.com/',
# Why: #5915 in Alexa global
'http://www.basspro.com/',
# Why: #5916 in Alexa global
'http://popsci.com/',
# Why: #5917 in Alexa global
'http://www.olx.com.ar/',
# Why: #5918 in Alexa global
'http://www.python.org/',
# Why: #5919 in Alexa global
'http://www.voetbalzone.nl/',
# Why: #5920 in Alexa global
'http://www.518.com.tw/',
# Why: #5921 in Alexa global
'http://www.aztecaporno.com/',
# Why: #5922 in Alexa global
'http://www.d-h.st/',
# Why: #5923 in Alexa global
'http://www.voyeurweb.com/',
# Why: #5924 in Alexa global
'http://www.storenvy.com/',
# Why: #5925 in Alexa global
'http://www.aftabir.com/',
# Why: #5926 in Alexa global
'http://www.imgsrc.ru/',
# Why: #5927 in Alexa global
'http://www.peru.com/',
# Why: #5928 in Alexa global
'http://www.mindbodygreen.com/',
# Why: #5929 in Alexa global
'http://www.stereotude.com/',
# Why: #5930 in Alexa global
'http://www.ar15.com/',
# Why: #5931 in Alexa global
'http://www.gogecapital.com/',
# Why: #5932 in Alexa global
'http://xipin.me/',
# Why: #5933 in Alexa global
'http://www.gvt.com.br/',
# Why: #5934 in Alexa global
'http://www.today.it/',
# Why: #5935 in Alexa global
'http://www.mastercard.com.au/',
# Why: #5936 in Alexa global
'http://www.hobbyking.com/',
# Why: #5937 in Alexa global
'http://www.hawkhost.com/',
# Why: #5938 in Alexa global
'http://www.thebump.com/',
# Why: #5939 in Alexa global
'http://www.alpari.ru/',
# Why: #5940 in Alexa global
'http://www.gamma-ic.com/',
# Why: #5941 in Alexa global
'http://www.mundome.com/',
# Why: #5942 in Alexa global
'http://www.televisao.uol.com.br/',
# Why: #5943 in Alexa global
'http://www.quotev.com/',
# Why: #5944 in Alexa global
'http://www.animaljam.com/',
# Why: #5945 in Alexa global
'http://www.ohozaa.com/',
# Why: #5946 in Alexa global
'http://www.sayyac.com/',
# Why: #5947 in Alexa global
'http://www.kobobooks.com/',
# Why: #5948 in Alexa global
'http://www.muslima.com/',
# Why: #5949 in Alexa global
'http://www.digsitesvalue.net/',
# Why: #5950 in Alexa global
'http://www.colourlovers.com/',
# Why: #5951 in Alexa global
'http://www.uludagsozluk.com/',
# Why: #5952 in Alexa global
'http://www.mercadolibre.com.uy/',
# Why: #5953 in Alexa global
'http://www.oem.com.mx/',
# Why: #5954 in Alexa global
'http://www.self.com/',
# Why: #5955 in Alexa global
'http://www.kyohk.net/',
# Why: #5957 in Alexa global
'http://www.dillards.com/',
# Why: #5958 in Alexa global
'http://www.eduu.com/',
# Why: #5959 in Alexa global
'http://www.replays.net/',
# Why: #5960 in Alexa global
'http://www.bnpparibasfortis.be/',
# Why: #5961 in Alexa global
'http://www.express.co.uk/',
# Why: #5962 in Alexa global
'http://www.levelupgames.uol.com.br/',
# Why: #5963 in Alexa global
'http://www.guaixun.com/',
# Why: #5964 in Alexa global
'http://www.750g.com/',
# Why: #5965 in Alexa global
'http://www.craveonline.com/',
# Why: #5966 in Alexa global
'http://www.markafoni.com/',
# Why: #5968 in Alexa global
'http://www.ename.com/',
# Why: #5969 in Alexa global
'http://www.abercrombie.com/',
# Why: #5970 in Alexa global
'http://www.noticiaaldia.com/',
# Why: #5971 in Alexa global
'http://www.seniorpeoplemeet.com/',
# Why: #5972 in Alexa global
'http://www.dhingana.com/',
# Why: #5974 in Alexa global
'http://www.prokerala.com/',
# Why: #5975 in Alexa global
'http://www.iefimerida.gr/',
# Why: #5976 in Alexa global
'http://www.wprazzi.com/',
# Why: #5977 in Alexa global
'http://www.pantipmarket.com/',
# Why: #5978 in Alexa global
'http://www.vueling.com/',
# Why: #5979 in Alexa global
'http://www.newsonlineweekly.com/',
# Why: #5980 in Alexa global
'http://cr173.com/',
# Why: #5981 in Alexa global
'http://www.ecp888.com/',
# Why: #5982 in Alexa global
'http://www.diary.ru/',
# Why: #5983 in Alexa global
'http://www.pervclips.com/',
# Why: #5984 in Alexa global
'http://www.sudaneseonline.com/',
# Why: #5985 in Alexa global
'http://www.personal.com.ar/',
# Why: #5986 in Alexa global
'http://www.articlesnatch.com/',
# Why: #5987 in Alexa global
'http://www.mitbbs.com/',
# Why: #5988 in Alexa global
'http://www.techsupportalert.com/',
# Why: #5989 in Alexa global
'http://www.filepost.com/',
# Why: #5990 in Alexa global
'http://www.unblockyoutube.co.uk/',
# Why: #5991 in Alexa global
'http://www.hasznaltauto.hu/',
# Why: #5992 in Alexa global
'http://www.dmv.org/',
# Why: #5993 in Alexa global
'http://www.port.hu/',
# Why: #5995 in Alexa global
'http://www.anastasiadate.com/',
# Why: #5996 in Alexa global
'http://www.adtgs.com/',
# Why: #5997 in Alexa global
'http://www.namejet.com/',
# Why: #5998 in Alexa global
'http://www.ally.com/',
# Why: #5999 in Alexa global
'http://www.djmaza.com/',
# Why: #6001 in Alexa global
'http://www.asstr.org/',
# Why: #6002 in Alexa global
'http://www.corel.com/',
# Why: #6003 in Alexa global
'http://www.interfax.ru/',
# Why: #6004 in Alexa global
'http://www.rozee.pk/',
# Why: #6005 in Alexa global
'http://www.akinator.com/',
# Why: #6006 in Alexa global
'http://www.dominos.co.in/',
# Why: #6007 in Alexa global
'http://boardgamegeek.com/',
# Why: #6008 in Alexa global
'http://www.teamliquid.net/',
# Why: #6009 in Alexa global
'http://www.sbrf.ru/',
# Why: #6010 in Alexa global
'http://www.l99.com/',
# Why: #6011 in Alexa global
'http://www.eatingwell.com/',
# Why: #6012 in Alexa global
'http://www.mid-day.com/',
# Why: #6013 in Alexa global
'http://www.blinkogold.it/',
# Why: #6014 in Alexa global
'http://www.rosbalt.ru/',
# Why: #6015 in Alexa global
'http://copadomundo.uol.com.br/',
# Why: #6016 in Alexa global
'http://www.islammemo.cc/',
# Why: #6017 in Alexa global
'http://www.bettycrocker.com/',
# Why: #6018 in Alexa global
'http://www.womenshealthmag.com/',
# Why: #6019 in Alexa global
'http://www.asandownload.com/',
# Why: #6020 in Alexa global
'http://www.twitcasting.tv/',
# Why: #6021 in Alexa global
'http://www.10and9.com/',
# Why: #6022 in Alexa global
'http://www.youngleafs.com/',
# Why: #6023 in Alexa global
'http://www.saharareporters.com/',
# Why: #6024 in Alexa global
'http://www.overclock.net/',
# Why: #6025 in Alexa global
'http://www.mapsgalaxy.com/',
# Why: #6026 in Alexa global
'http://www.internetslang.com/',
# Why: #6027 in Alexa global
'http://www.sokmil.com/',
# Why: #6028 in Alexa global
'http://www.yousendit.com/',
# Why: #6029 in Alexa global
'http://www.forex-mmcis.com/',
# Why: #6030 in Alexa global
'http://www.vador.com/',
# Why: #6031 in Alexa global
'http://www.pagewash.com/',
# Why: #6032 in Alexa global
'http://www.pringotrack.com/',
# Why: #6033 in Alexa global
'http://www.cpmstar.com/',
# Why: #6034 in Alexa global
'http://www.yxdown.com/',
# Why: #6035 in Alexa global
'http://www.surfingbird.ru/',
# Why: #6036 in Alexa global
'http://kyodo-d.jp/',
# Why: #6037 in Alexa global
'http://www.identi.li/',
# Why: #6038 in Alexa global
'http://www.n4hr.com/',
# Why: #6039 in Alexa global
'http://www.elitetorrent.net/',
# Why: #6040 in Alexa global
'http://www.livechatinc.com/',
# Why: #6041 in Alexa global
'http://www.anzhi.com/',
# Why: #6042 in Alexa global
'http://www.2checkout.com/',
# Why: #6043 in Alexa global
'http://www.bancoestado.cl/',
# Why: #6044 in Alexa global
'http://www.epson.com/',
# Why: #6045 in Alexa global
'http://www.twodollarclick.com/',
# Why: #6046 in Alexa global
'http://www.okaz.com.sa/',
# Why: #6047 in Alexa global
'http://china-sss.com/',
# Why: #6048 in Alexa global
'http://www.sagawa-exp.co.jp/',
# Why: #6049 in Alexa global
'http://www.xforex.com/',
# Why: #6050 in Alexa global
'http://www.salliemae.com/',
# Why: #6051 in Alexa global
'http://www.acunn.com/',
# Why: #6052 in Alexa global
'http://www.navyfederal.org/',
# Why: #6053 in Alexa global
'http://www.forumactif.com/',
# Why: #6054 in Alexa global
'http://www.affaire.com/',
# Why: #6055 in Alexa global
'http://www.mediatemple.net/',
# Why: #6056 in Alexa global
'http://www.qdmm.com/',
# Why: #6057 in Alexa global
'http://www.urlm.co/',
# Why: #6058 in Alexa global
'http://www.toofab.com/',
# Why: #6059 in Alexa global
'http://www.yola.com/',
# Why: #6060 in Alexa global
'http://www.sheldonsfans.com/',
# Why: #6061 in Alexa global
'http://www.piratestreaming.com/',
# Why: #6062 in Alexa global
'http://www.frontier.com/',
# Why: #6063 in Alexa global
'http://www.jxnews.com.cn/',
# Why: #6064 in Alexa global
'http://www.businesswire.com/',
# Why: #6065 in Alexa global
'http://www.rue89.com/',
# Why: #6066 in Alexa global
'http://www.yenisafak.com.tr/',
# Why: #6067 in Alexa global
'http://www.wikimart.ru/',
# Why: #6068 in Alexa global
'http://www.22.cn/',
# Why: #6069 in Alexa global
'http://www.xpressvids.info/',
# Why: #6070 in Alexa global
'http://www.medicalnewstoday.com/',
# Why: #6071 in Alexa global
'http://www.express.de/',
# Why: #6072 in Alexa global
'http://www.grid.mk/',
# Why: #6073 in Alexa global
'http://www.mass.gov/',
# Why: #6074 in Alexa global
'http://www.onlinefinder.net/',
# Why: #6075 in Alexa global
'http://www.yllix.com/',
# Why: #6076 in Alexa global
'http://www.aksam.com.tr/',
# Why: #6077 in Alexa global
'http://www.telegraf.rs/',
# Why: #6078 in Alexa global
'http://www.templatic.com/',
# Why: #6079 in Alexa global
'http://www.kandao.com/',
# Why: #6080 in Alexa global
'http://www.policymic.com/',
# Why: #6081 in Alexa global
'http://www.farfesh.com/',
# Why: #6082 in Alexa global
'http://www.alza.cz/',
# Why: #6083 in Alexa global
'http://www.judgeporn.com/',
# Why: #6084 in Alexa global
'http://townwork.net/',
# Why: #6085 in Alexa global
'http://3dcartstores.com/',
# Why: #6086 in Alexa global
'http://www.marketingland.com/',
# Why: #6087 in Alexa global
'http://okooo.com/',
# Why: #6088 in Alexa global
'http://www.siteduzero.com/',
# Why: #6089 in Alexa global
'http://www.cellbazaar.com/',
# Why: #6090 in Alexa global
'http://www.omb100.com/',
# Why: #6091 in Alexa global
'http://www.danarimedia.com/',
# Why: #6092 in Alexa global
'http://www.nlcafe.hu/',
# Why: #6093 in Alexa global
'http://www.qz.com/',
# Why: #6094 in Alexa global
'http://www.indiapost.gov.in/',
# Why: #6095 in Alexa global
'http://www.kinogo.net/',
# Why: #6096 in Alexa global
'http://www.neverblue.com/',
# Why: #6097 in Alexa global
'http://www.spyfu.com/',
# Why: #6098 in Alexa global
'http://www.shindanmaker.com/',
# Why: #6099 in Alexa global
'http://bankpasargad.com/',
# Why: #6100 in Alexa global
'http://www.techweb.com.cn/',
# Why: #6101 in Alexa global
'http://internetautoguide.com/',
# Why: #6102 in Alexa global
'http://www.allover30.com/',
# Why: #6103 in Alexa global
'http://www.metric-conversions.org/',
# Why: #6104 in Alexa global
'http://www.carid.com/',
# Why: #6105 in Alexa global
'http://www.mofos.com/',
# Why: #6106 in Alexa global
'http://www.kanald.com.tr/',
# Why: #6107 in Alexa global
'http://www.mobikwik.com/',
# Why: #6108 in Alexa global
'http://www.checkpagerank.net/',
# Why: #6109 in Alexa global
'http://www.hotscripts.com/',
# Why: #6110 in Alexa global
'http://www.hornywife.com/',
# Why: #6111 in Alexa global
'http://www.prixmoinscher.com/',
# Why: #6112 in Alexa global
'http://www.worldbank.org/',
# Why: #6113 in Alexa global
'http://www.wsodownloads.info/',
# Why: #6114 in Alexa global
'http://www.his-j.com/',
# Why: #6115 in Alexa global
'http://www.powned.tv/',
# Why: #6116 in Alexa global
'http://www.redmondpie.com/',
# Why: #6117 in Alexa global
'http://www.molotok.ru/',
# Why: #6118 in Alexa global
'http://www.whatmobile.com.pk/',
# Why: #6119 in Alexa global
'http://www.wiziq.com/',
# Why: #6120 in Alexa global
'http://www.excelsior.com.mx/',
# Why: #6121 in Alexa global
'http://www.tradetang.com/',
# Why: #6122 in Alexa global
'http://www.terra.es/',
# Why: #6123 in Alexa global
'http://www.sdchina.com/',
# Why: #6124 in Alexa global
'http://www.rai.tv/',
# Why: #6125 in Alexa global
'http://www.indiansexstories.net/',
# Why: #6127 in Alexa global
'http://www.upbulk.com/',
# Why: #6128 in Alexa global
'http://www.surveygizmo.com/',
# Why: #6129 in Alexa global
'http://www.ulta.com/',
# Why: #6130 in Alexa global
'http://www.tera-europe.com/',
# Why: #6131 in Alexa global
'http://www.tuoitre.vn/',
# Why: #6132 in Alexa global
'http://www.onedio.com/',
# Why: #6133 in Alexa global
'http://www.jz123.cn/',
# Why: #6134 in Alexa global
'http://www.canon.jp/',
# Why: #6135 in Alexa global
'http://www.favim.com/',
# Why: #6136 in Alexa global
'http://www.seo-fast.ru/',
# Why: #6137 in Alexa global
'http://www.twitterfeed.com/',
# Why: #6138 in Alexa global
'http://www.trustedreviews.com/',
# Why: #6139 in Alexa global
'http://www.ztgame.com/',
# Why: #6140 in Alexa global
'http://www.radiojavan.com/',
# Why: #6141 in Alexa global
'http://fun698.com/',
# Why: #6142 in Alexa global
'http://www.126.net/',
# Why: #6143 in Alexa global
'http://www.indiaglitz.com/',
# Why: #6144 in Alexa global
'http://www.jdouga.com/',
# Why: #6145 in Alexa global
'http://www.lofter.com/',
# Why: #6146 in Alexa global
'http://www.mysavings.com/',
# Why: #6147 in Alexa global
'http://www.snapfish.com/',
# Why: #6148 in Alexa global
'http://www.i-sux.com/',
# Why: #6149 in Alexa global
'http://www.cebbank.com/',
# Why: #6150 in Alexa global
'http://www.ethnos.gr/',
# Why: #6151 in Alexa global
'http://www.desktop2ch.tv/',
# Why: #6152 in Alexa global
'http://www.expedia.ca/',
# Why: #6153 in Alexa global
'http://www.kinja.com/',
# Why: #6154 in Alexa global
'http://www.rusfolder.com/',
# Why: #6155 in Alexa global
'http://www.expat-blog.com/',
# Why: #6156 in Alexa global
'http://www.8teenxxx.com/',
# Why: #6157 in Alexa global
'http://www.variety.com/',
# Why: #6158 in Alexa global
'http://www.natemat.pl/',
# Why: #6159 in Alexa global
'http://www.niazpardaz.com/',
# Why: #6160 in Alexa global
'http://www.gezginler.net/',
# Why: #6161 in Alexa global
'http://www.baur.de/',
# Why: #6162 in Alexa global
'http://www.tv2.no/',
# Why: #6163 in Alexa global
'http://www.realgm.com/',
# Why: #6164 in Alexa global
'http://www.zamzar.com/',
# Why: #6165 in Alexa global
'http://www.freecharge.in/',
# Why: #6166 in Alexa global
'http://www.ahlamontada.com/',
# Why: #6167 in Alexa global
'http://www.salespider.com/',
# Why: #6168 in Alexa global
'http://www.beanfun.com/',
# Why: #6169 in Alexa global
'http://www.cleveland.com/',
# Why: #6173 in Alexa global
'http://www.truecaller.com/',
# Why: #6174 in Alexa global
'http://www.walmart.ca/',
# Why: #6175 in Alexa global
'http://www.fanbox.com/',
# Why: #6176 in Alexa global
'http://www.designmodo.com/',
# Why: #6177 in Alexa global
'http://www.frip.com/',
# Why: #6178 in Alexa global
'http://www.sammobile.com/',
# Why: #6179 in Alexa global
'http://www.minnano-av.com/',
# Why: #6180 in Alexa global
'http://www.bri.co.id/',
# Why: #6181 in Alexa global
'http://www.creativebloq.com/',
# Why: #6182 in Alexa global
'http://www.anthropologie.com/',
# Why: #6183 in Alexa global
'http://www.afpbb.com/',
# Why: #6184 in Alexa global
'http://www.kingsera.ir/',
# Why: #6185 in Alexa global
'http://www.songspk.co/',
# Why: #6186 in Alexa global
'http://www.sexsearch.com/',
# Why: #6187 in Alexa global
'http://www.dailydot.com/',
# Why: #6188 in Alexa global
'http://www.hayah.cc/',
# Why: #6189 in Alexa global
'http://www.angolotesti.it/',
# Why: #6190 in Alexa global
'http://www.si.kz/',
# Why: #6191 in Alexa global
'http://www.allthingsd.com/',
# Why: #6192 in Alexa global
'http://www.paddypower.com/',
# Why: #6193 in Alexa global
'http://www.canadapost.ca/',
# Why: #6194 in Alexa global
'http://www.qq.cc/',
# Why: #6195 in Alexa global
'http://www.amctheatres.com/',
# Why: #6196 in Alexa global
'http://www.alltop.com/',
# Why: #6197 in Alexa global
'http://www.allkpop.com/',
# Why: #6198 in Alexa global
'http://www.nalog.ru/',
# Why: #6199 in Alexa global
'http://www.dynadot.com/',
# Why: #6200 in Alexa global
'http://www.copart.com/',
# Why: #6201 in Alexa global
'http://www.mexat.com/',
# Why: #6202 in Alexa global
'http://www.skelbiu.lt/',
# Why: #6203 in Alexa global
'http://www.kerala.gov.in/',
# Why: #6204 in Alexa global
'http://www.cathaypacific.com/',
# Why: #6205 in Alexa global
'http://www.clip2ni.com/',
# Why: #6206 in Alexa global
'http://www.tribune.com/',
# Why: #6207 in Alexa global
'http://www.acidcow.com/',
# Why: #6208 in Alexa global
'http://www.amkspor.com/',
# Why: #6209 in Alexa global
'http://www.shiksha.com/',
# Why: #6211 in Alexa global
'http://www.180upload.com/',
# Why: #6212 in Alexa global
'http://www.vietgiaitri.com/',
# Why: #6213 in Alexa global
'http://www.sportsauthority.com/',
# Why: #6214 in Alexa global
'http://www.banki.ir/',
# Why: #6215 in Alexa global
'http://www.vancouversun.com/',
# Why: #6216 in Alexa global
'http://www.hackforums.net/',
# Why: #6217 in Alexa global
'http://www.t-mobile.de/',
# Why: #6218 in Alexa global
'http://www.gree.jp/',
# Why: #6219 in Alexa global
'http://www.simplyrecipes.com/',
# Why: #6220 in Alexa global
'http://www.crazyhomesex.com/',
# Why: #6221 in Alexa global
'http://www.thehindubusinessline.com/',
# Why: #6222 in Alexa global
'http://www.kriesi.at/',
# Why: #6223 in Alexa global
'http://deyi.com/',
# Why: #6224 in Alexa global
'http://www.plimus.com/',
# Why: #6225 in Alexa global
'http://www.websyndic.com/',
# Why: #6226 in Alexa global
'http://www.northnews.cn/',
# Why: #6228 in Alexa global
'http://www.express.com/',
# Why: #6229 in Alexa global
'http://www.dougasouko.com/',
# Why: #6230 in Alexa global
'http://www.mmstat.com/',
# Why: #6231 in Alexa global
'http://www.womai.com/',
# Why: #6232 in Alexa global
'http://www.alrajhibank.com.sa/',
# Why: #6233 in Alexa global
'http://www.ice-porn.com/',
# Why: #6234 in Alexa global
'http://www.benchmarkemail.com/',
# Why: #6235 in Alexa global
'http://www.ringcentral.com/',
# Why: #6236 in Alexa global
'http://www.erail.in/',
# Why: #6237 in Alexa global
'http://www.poptropica.com/',
# Why: #6238 in Alexa global
'http://www.search.ch/',
# Why: #6239 in Alexa global
'http://www.meteo.it/',
# Why: #6240 in Alexa global
'http://www.adriver.ru/',
# Why: #6241 in Alexa global
'http://www.ipeen.com.tw/',
# Why: #6242 in Alexa global
'http://www.ratp.fr/',
# Why: #6243 in Alexa global
'http://www.orgasm.com/',
# Why: #6244 in Alexa global
'http://www.pornme.com/',
# Why: #6245 in Alexa global
'http://www.gameinformer.com/',
# Why: #6246 in Alexa global
'http://www.woobox.com/',
# Why: #6247 in Alexa global
'http://www.advertising.com/',
# Why: #6248 in Alexa global
'http://www.flyflv.com/',
# Why: #6249 in Alexa global
'http://www.chinaren.com/',
# Why: #6250 in Alexa global
'http://www.tube2012.com/',
# Why: #6251 in Alexa global
'http://www.ikhwanonline.com/',
# Why: #6252 in Alexa global
'http://www.iwebtool.com/',
# Why: #6253 in Alexa global
'http://www.ucdavis.edu/',
# Why: #6254 in Alexa global
'http://www.boyfriendtv.com/',
# Why: #6255 in Alexa global
'http://www.rurubu.travel/',
# Why: #6256 in Alexa global
'http://www.kabam.com/',
# Why: #6257 in Alexa global
'http://www.talkingpointsmemo.com/',
# Why: #6258 in Alexa global
'http://www.detnews.com/',
# Why: #6259 in Alexa global
'http://www.sibnet.ru/',
# Why: #6260 in Alexa global
'http://www.camztube.net/',
# Why: #6261 in Alexa global
'http://www.madamenoire.com/',
# Why: #6262 in Alexa global
'http://www.evz.ro/',
# Why: #6263 in Alexa global
'http://www.staseraintv.com/',
# Why: #6264 in Alexa global
'http://www.che168.com/',
# Why: #6265 in Alexa global
'http://www.kidshealth.org/',
# Why: #6266 in Alexa global
'http://www.m24.ru/',
# Why: #6267 in Alexa global
'http://www.zenfolio.com/',
# Why: #6268 in Alexa global
'http://www.webtretho.com/',
# Why: #6269 in Alexa global
'http://www.postjung.com/',
# Why: #6270 in Alexa global
'http://www.supersport.com/',
# Why: #6271 in Alexa global
'http://www.cshtracker.com/',
# Why: #6272 in Alexa global
'http://www.jeuxjeuxjeux.fr/',
# Why: #6273 in Alexa global
'http://www.foxtv.es/',
# Why: #6274 in Alexa global
'http://www.postjoint.com/',
# Why: #6275 in Alexa global
'http://www.honda.co.jp/',
# Why: #6276 in Alexa global
'http://www.podnapisi.net/',
# Why: #6277 in Alexa global
'http://www.prav.tv/',
# Why: #6278 in Alexa global
'http://www.realmadrid.com/',
# Why: #6279 in Alexa global
'http://www.mbs-potsdam.de/',
# Why: #6280 in Alexa global
'http://www.tim.it/',
# Why: #6281 in Alexa global
'http://uplus.metroer.com/~content/',
# Why: #6282 in Alexa global
'http://www.esquire.com/',
# Why: #6283 in Alexa global
'http://ooopic.com/',
# Why: #6284 in Alexa global
'http://www.castorama.fr/',
# Why: #6285 in Alexa global
'http://brides.com.cn/',
# Why: #6286 in Alexa global
'http://www.afamily.vn/',
# Why: #6287 in Alexa global
'http://www.findlaw.com/',
# Why: #6288 in Alexa global
'http://www.smartpassiveincome.com/',
# Why: #6289 in Alexa global
'http://www.sa.ae/',
# Why: #6290 in Alexa global
'http://www.hemnet.se/',
# Why: #6291 in Alexa global
'http://www.diytrade.com/',
# Why: #6292 in Alexa global
'http://www.weblancer.net/',
# Why: #6293 in Alexa global
'http://www.zapmeta.de/',
# Why: #6294 in Alexa global
'http://www.bizsugar.com/',
# Why: #6295 in Alexa global
'http://www.banesco.com/',
# Why: #6296 in Alexa global
'http://www.ideeli.com/',
# Why: #6297 in Alexa global
'http://www.lnx.lu/',
# Why: #6298 in Alexa global
'http://www.divxplanet.com/',
# Why: #6299 in Alexa global
'http://www.aircanada.com/',
# Why: #6300 in Alexa global
'http://uzise.com/',
# Why: #6301 in Alexa global
'http://www.sabay.com.kh/',
# Why: #6302 in Alexa global
'http://www.football365.com/',
# Why: #6303 in Alexa global
'http://www.crazydomains.com.au/',
# Why: #6304 in Alexa global
'http://www.qxox.org/',
# Why: #6305 in Alexa global
'http://www.thesmokinggun.com/',
# Why: #6306 in Alexa global
'http://www.w8n3.info/',
# Why: #6307 in Alexa global
'http://www.po.st/',
# Why: #6308 in Alexa global
'http://www.debian.org/',
# Why: #6309 in Alexa global
'http://www.flypgs.com/',
# Why: #6310 in Alexa global
'http://www.craigslist.co.in/',
# Why: #6311 in Alexa global
'http://www.islamway.net/',
# Why: #6312 in Alexa global
'http://www.research-panel.jp/',
# Why: #6313 in Alexa global
'http://www.debate.com.mx/',
# Why: #6314 in Alexa global
'http://www.bitdefender.com/',
# Why: #6315 in Alexa global
'http://www.listindiario.com/',
# Why: #6316 in Alexa global
'http://www.123telugu.com/',
# Why: #6317 in Alexa global
'http://www.ilbe.com/',
# Why: #6318 in Alexa global
'http://www.wordlinx.com/',
# Why: #6319 in Alexa global
'http://www.ebc.com.br/',
# Why: #6320 in Alexa global
'http://www.pr.gov.br/',
# Why: #6321 in Alexa global
'http://www.videoyoum7.com/',
# Why: #6322 in Alexa global
'http://www.ets.org/',
# Why: #6323 in Alexa global
'http://www.exteen.com/',
# Why: #6324 in Alexa global
'http://www.comicbookresources.com/',
# Why: #6325 in Alexa global
'http://www.grammarly.com/',
# Why: #6326 in Alexa global
'http://www.pdapi.com/',
# Why: #6327 in Alexa global
'http://adultflash01.com/',
# Why: #6328 in Alexa global
'http://www.orlandosentinel.com/',
# Why: #6330 in Alexa global
'http://www.24option.com/',
# Why: #6331 in Alexa global
'http://www.moviepilot.de/',
# Why: #6332 in Alexa global
'http://www.rfa.org/',
# Why: #6333 in Alexa global
'http://www.crateandbarrel.com/',
# Why: #6334 in Alexa global
'http://www.srv2trking.com/',
# Why: #6335 in Alexa global
'http://www.mercusuar.info/',
# Why: #6336 in Alexa global
'http://www.dofus.com/',
# Why: #6337 in Alexa global
'http://www.myfxbook.com/',
# Why: #6338 in Alexa global
'http://www.madmovs.com/',
# Why: #6339 in Alexa global
'http://www.myffi.biz/',
# Why: #6340 in Alexa global
'http://www.peru21.pe/',
# Why: #6341 in Alexa global
'http://www.bollywoodlife.com/',
# Why: #6342 in Alexa global
'http://www.gametracker.com/',
# Why: #6343 in Alexa global
'http://www.terra.com.mx/',
# Why: #6344 in Alexa global
'http://www.antenam.info/',
# Why: #6345 in Alexa global
'http://www.ihotelier.com/',
# Why: #6346 in Alexa global
'http://www.hypebeast.com/',
# Why: #6348 in Alexa global
'http://www.dramasonline.com/',
# Why: #6349 in Alexa global
'http://www.wordtracker.com/',
# Why: #6350 in Alexa global
'http://www.11st.co.kr/',
# Why: #6351 in Alexa global
'http://www.thefrisky.com/',
# Why: #6352 in Alexa global
'http://www.meritnation.com/',
# Why: #6353 in Alexa global
'http://www.irna.ir/',
# Why: #6354 in Alexa global
'http://www.trovit.com/',
# Why: #6355 in Alexa global
'http://cngold.org/',
# Why: #6356 in Alexa global
'http://www.optymalizacja.com/',
# Why: #6357 in Alexa global
'http://www.flexmls.com/',
# Why: #6358 in Alexa global
'http://www.softarchive.net/',
# Why: #6359 in Alexa global
'http://www.divxonline.info/',
# Why: #6360 in Alexa global
'http://www.malaysian-inc.com/',
# Why: #6361 in Alexa global
'http://www.dsw.com/',
# Why: #6362 in Alexa global
'http://www.fantastigames.com/',
# Why: #6363 in Alexa global
'http://www.mattcutts.com/',
# Why: #6364 in Alexa global
'http://www.ziprealty.com/',
# Why: #6365 in Alexa global
'http://www.saavn.com/',
# Why: #6366 in Alexa global
'http://www.ruporn.tv/',
# Why: #6367 in Alexa global
'http://www.e-estekhdam.com/',
# Why: #6368 in Alexa global
'http://www.novafile.com/',
# Why: #6369 in Alexa global
'http://tomsguide.fr/',
# Why: #6370 in Alexa global
'http://www.softonic.jp/',
# Why: #6371 in Alexa global
'http://www.tomshardware.co.uk/',
# Why: #6372 in Alexa global
'http://www.crosswalk.com/',
# Why: #6373 in Alexa global
'http://www.businessdictionary.com/',
# Why: #6374 in Alexa global
'http://www.sharesix.com/',
# Why: #6375 in Alexa global
'http://www.ascii.jp/',
# Why: #6376 in Alexa global
'http://www.travian.cl/',
# Why: #6377 in Alexa global
'http://www.indiastudychannel.com/',
# Why: #6378 in Alexa global
'http://www.m7shsh.com/',
# Why: #6379 in Alexa global
'http://www.hbogo.com/',
# Why: #6380 in Alexa global
'http://www.888casino.it/',
# Why: #6381 in Alexa global
'http://www.fm-p.jp/',
# Why: #6382 in Alexa global
'http://www.keywordspy.com/',
# Why: #6383 in Alexa global
'http://www.pureleverage.com/',
# Why: #6384 in Alexa global
'http://www.photodune.net/',
# Why: #6385 in Alexa global
'http://www.foreignpolicy.com/',
# Why: #6386 in Alexa global
'http://www.shiftdelete.net/',
# Why: #6387 in Alexa global
'http://www.living360.net/',
# Why: #6388 in Alexa global
'http://webmasterhome.cn/',
# Why: #6389 in Alexa global
'http://www.paixie.net/',
# Why: #6390 in Alexa global
'http://www.barstoolsports.com/',
# Why: #6391 in Alexa global
'http://www.babyhome.com.tw/',
# Why: #6392 in Alexa global
'http://www.aemet.es/',
# Why: #6393 in Alexa global
'http://www.local.ch/',
# Why: #6394 in Alexa global
'http://www.spermyporn.com/',
# Why: #6395 in Alexa global
'http://www.tasnimnews.com/',
# Why: #6396 in Alexa global
'http://www.imgserve.net/',
# Why: #6397 in Alexa global
'http://www.huawei.com/',
# Why: #6398 in Alexa global
'http://www.pik.ba/',
# Why: #6399 in Alexa global
'http://www.info-dvd.ru/',
# Why: #6400 in Alexa global
'http://www.2domains.ru/',
# Why: #6401 in Alexa global
'http://www.sextube.fm/',
# Why: #6402 in Alexa global
'http://www.searchrocket.info/',
# Why: #6403 in Alexa global
'http://www.dicio.com.br/',
# Why: #6404 in Alexa global
'http://www.ittefaq.com.bd/',
# Why: #6405 in Alexa global
'http://www.fileserve.com/',
# Why: #6406 in Alexa global
'http://www.genteflow.com/',
# Why: #6407 in Alexa global
'http://www.5giay.vn/',
# Why: #6408 in Alexa global
'http://www.elbadil.com/',
# Why: #6409 in Alexa global
'http://www.wizaz.pl/',
# Why: #6410 in Alexa global
'http://www.cyclingnews.com/',
# Why: #6411 in Alexa global
'http://www.southparkstudios.com/',
# Why: #6412 in Alexa global
'http://www.domain.cn/',
# Why: #6413 in Alexa global
'http://www.hangseng.com/',
# Why: #6414 in Alexa global
'http://www.sankeibiz.jp/',
# Why: #6415 in Alexa global
'http://www.mapsofworld.com/',
# Why: #6416 in Alexa global
'http://gaokao.com/',
# Why: #6417 in Alexa global
'http://www.antarvasna.com/',
# Why: #6418 in Alexa global
'http://www.televisa.com/',
# Why: #6419 in Alexa global
'http://www.dressupwho.com/',
# Why: #6420 in Alexa global
'http://www.goldprice.org/',
# Why: #6421 in Alexa global
'http://www.directlyrics.com/',
# Why: #6422 in Alexa global
'http://www.amway.com.cn/',
# Why: #6423 in Alexa global
'http://www.v2cigar.net/',
# Why: #6424 in Alexa global
'http://www.peopleclick.com/',
# Why: #6425 in Alexa global
'http://www.moudamepo.com/',
# Why: #6426 in Alexa global
'http://www.baijob.com/',
# Why: #6427 in Alexa global
'http://www.geni.com/',
# Why: #6428 in Alexa global
'http://huangye88.com/',
# Why: #6429 in Alexa global
'http://www.phun.org/',
# Why: #6430 in Alexa global
'http://www.kasikornbankgroup.com/',
# Why: #6431 in Alexa global
'http://www.angrymovs.com/',
# Why: #6432 in Alexa global
'http://www.bibliocommons.com/',
# Why: #6433 in Alexa global
'http://www.melateiran.com/',
# Why: #6434 in Alexa global
'http://www.gigya.com/',
# Why: #6435 in Alexa global
'http://17ok.com/',
# Why: #6436 in Alexa global
'http://www.ename.cn/',
# Why: #6437 in Alexa global
'http://www.xdowns.com/',
# Why: #6438 in Alexa global
'http://www.tportal.hr/',
# Why: #6439 in Alexa global
'http://www.dreamteammoney.com/',
# Why: #6440 in Alexa global
'http://www.prevention.com/',
# Why: #6441 in Alexa global
'http://www.terra.cl/',
# Why: #6442 in Alexa global
'http://www.blinklist.com/',
# Why: #6443 in Alexa global
'http://www.51seer.com/',
# Why: #6444 in Alexa global
'http://www.ruelsoft.com/',
# Why: #6445 in Alexa global
'http://www.kulichki.net/',
# Why: #6446 in Alexa global
'http://vippers.jp/',
# Why: #6447 in Alexa global
'http://www.tatatele.in/',
# Why: #6448 in Alexa global
'http://www.mybloggertricks.com/',
# Why: #6449 in Alexa global
'http://www.ma-bimbo.com/',
# Why: #6450 in Alexa global
'http://www.ftchinese.com/',
# Why: #6451 in Alexa global
'http://www.sergey-mavrodi-mmm.net/',
# Why: #6452 in Alexa global
'http://www.wp.tv/',
# Why: #6453 in Alexa global
'http://www.chevrolet.com/',
# Why: #6454 in Alexa global
'http://www.razerzone.com/',
# Why: #6455 in Alexa global
'http://www.submanga.com/',
# Why: #6456 in Alexa global
'http://www.thomson.co.uk/',
# Why: #6457 in Alexa global
'http://www.syosetu.org/',
# Why: #6458 in Alexa global
'http://www.olx.com/',
# Why: #6459 in Alexa global
'http://www.vplay.ro/',
# Why: #6460 in Alexa global
'http://www.rtnn.net/',
# Why: #6461 in Alexa global
'http://www.55.la/',
# Why: #6462 in Alexa global
'http://www.instructure.com/',
# Why: #6463 in Alexa global
'http://lvse.com/',
# Why: #6464 in Alexa global
'http://www.hvg.hu/',
# Why: #6465 in Alexa global
'http://www.androidpolice.com/',
# Why: #6466 in Alexa global
'http://www.cookinglight.com/',
# Why: #6467 in Alexa global
'http://www.madadsmedia.com/',
# Why: #6468 in Alexa global
'http://www.inews.gr/',
# Why: #6469 in Alexa global
'http://www.ktxp.com/',
# Why: #6470 in Alexa global
'http://www.socialsecurity.gov/',
# Why: #6471 in Alexa global
'http://www.equifax.com/',
# Why: #6472 in Alexa global
'http://www.ceskatelevize.cz/',
# Why: #6473 in Alexa global
'http://www.gaaks.com/',
# Why: #6474 in Alexa global
'http://www.chillingeffects.org/',
# Why: #6476 in Alexa global
'http://www.komando.com/',
# Why: #6477 in Alexa global
'http://www.nowpublic.com/',
# Why: #6478 in Alexa global
'http://www.khanwars.ae/',
# Why: #6479 in Alexa global
'http://www.berlin.de/',
# Why: #6480 in Alexa global
'http://www.bleepingcomputer.com/',
# Why: #6481 in Alexa global
'http://www.military.com/',
# Why: #6482 in Alexa global
'http://www.zero10.net/',
# Why: #6483 in Alexa global
'http://www.onekingslane.com/',
# Why: #6484 in Alexa global
'http://www.beget.ru/',
# Why: #6486 in Alexa global
'http://www.get-tune.net/',
# Why: #6487 in Alexa global
'http://www.freewebs.com/',
# Why: #6489 in Alexa global
'http://www.591.com.tw/',
# Why: #6490 in Alexa global
'http://www.pcfinancial.ca/',
# Why: #6491 in Alexa global
'http://www.sparknotes.com/',
# Why: #6492 in Alexa global
'http://www.tinychat.com/',
# Why: #6493 in Alexa global
'http://luxup.ru/',
# Why: #6494 in Alexa global
'http://www.geforce.com/',
# Why: #6495 in Alexa global
'http://www.tatts.com.au/',
# Why: #6496 in Alexa global
'http://www.alweeam.com.sa/',
# Why: #6497 in Alexa global
'http://www.123-reg.co.uk/',
# Why: #6498 in Alexa global
'http://www.sexyswingertube.com/',
# Why: #6499 in Alexa global
'http://www.groupon.es/',
# Why: #6500 in Alexa global
'http://www.guardianlv.com/',
# Why: #6501 in Alexa global
'http://www.hypovereinsbank.de/',
# Why: #6502 in Alexa global
'http://www.game2.com.cn/',
# Why: #6503 in Alexa global
'http://www.mofcom.gov.cn/',
# Why: #6504 in Alexa global
'http://www.usc.edu/',
# Why: #6505 in Alexa global
'http://www.ard.de/',
# Why: #6506 in Alexa global
'http://www.hoovers.com/',
# Why: #6507 in Alexa global
'http://www.tdameritrade.com/',
# Why: #6508 in Alexa global
'http://www.userscripts.org/',
# Why: #6509 in Alexa global
'http://app111.com/',
# Why: #6510 in Alexa global
'http://www.al.com/',
# Why: #6511 in Alexa global
'http://www.op.fi/',
# Why: #6512 in Alexa global
'http://www.adbkm.com/',
# Why: #6513 in Alexa global
'http://www.i-part.com.tw/',
# Why: #6514 in Alexa global
'http://www.pivithurutv.info/',
# Why: #6515 in Alexa global
'http://www.haber3.com/',
# Why: #6516 in Alexa global
'http://www.shatel.ir/',
# Why: #6517 in Alexa global
'http://www.camonster.com/',
# Why: #6518 in Alexa global
'http://www.weltbild.de/',
# Why: #6519 in Alexa global
'http://www.pingan.com.cn/',
# Why: #6520 in Alexa global
'http://www.advanceautoparts.com/',
# Why: #6521 in Alexa global
'http://www.mplssaturn.com/',
# Why: #6522 in Alexa global
'http://www.weeklystandard.com/',
# Why: #6523 in Alexa global
'http://www.cna.com.tw/',
# Why: #6524 in Alexa global
'http://www.popscreen.com/',
# Why: #6525 in Alexa global
'http://www.freelifetimefuckbook.com/',
# Why: #6526 in Alexa global
'http://www.peixeurbano.com.br/',
# Why: #6527 in Alexa global
'http://www.2258.com/',
# Why: #6528 in Alexa global
'http://www.proxfree.com/',
# Why: #6529 in Alexa global
'http://www.zend.com/',
# Why: #6530 in Alexa global
'http://www.garena.tw/',
# Why: #6531 in Alexa global
'http://www.citehr.com/',
# Why: #6532 in Alexa global
'http://www.gadyd.com/',
# Why: #6533 in Alexa global
'http://www.tvspielfilm.de/',
# Why: #6534 in Alexa global
'http://www.skapiec.pl/',
# Why: #6535 in Alexa global
'http://www.9see.com/',
# Why: #6536 in Alexa global
'http://cndns.com/',
# Why: #6537 in Alexa global
'http://www.hurriyetemlak.com/',
# Why: #6538 in Alexa global
'http://www.census.gov/',
# Why: #6539 in Alexa global
'http://www.collider.com/',
# Why: #6540 in Alexa global
'http://www.cinaplay.com/',
# Why: #6542 in Alexa global
'http://www.aq.com/',
# Why: #6543 in Alexa global
'http://www.aolsearch.com/',
# Why: #6544 in Alexa global
'http://www.ce4arab.com/',
# Why: #6546 in Alexa global
'http://www.cbi.ir/',
# Why: #6547 in Alexa global
'http://cjol.com/',
# Why: #6548 in Alexa global
'http://www.brandporno.com/',
# Why: #6549 in Alexa global
'http://www.yicheshi.com/',
# Why: #6550 in Alexa global
'http://www.mydealz.de/',
# Why: #6551 in Alexa global
'http://www.xiachufang.com/',
# Why: #6552 in Alexa global
'http://www.sun-sentinel.com/',
# Why: #6553 in Alexa global
'http://www.flashkhor.com/',
# Why: #6554 in Alexa global
'http://www.join.me/',
# Why: #6555 in Alexa global
'http://www.hankyung.com/',
# Why: #6556 in Alexa global
'http://www.oneandone.co.uk/',
# Why: #6557 in Alexa global
'http://www.derwesten.de/',
# Why: #6558 in Alexa global
'http://www.gammae.com/',
# Why: #6559 in Alexa global
'http://www.webadultdating.biz/',
# Why: #6560 in Alexa global
'http://www.pokerstars.com/',
# Why: #6561 in Alexa global
'http://www.fucked-sex.com/',
# Why: #6562 in Alexa global
'http://www.antaranews.com/',
# Why: #6563 in Alexa global
'http://www.banorte.com/',
# Why: #6564 in Alexa global
'http://www.travian.it/',
# Why: #6565 in Alexa global
'http://www.msu.edu/',
# Why: #6566 in Alexa global
'http://www.ozbargain.com.au/',
# Why: #6567 in Alexa global
'http://www.77vcd.com/',
# Why: #6568 in Alexa global
'http://www.bestooxx.com/',
# Why: #6569 in Alexa global
'http://www.siemens.com/',
# Why: #6570 in Alexa global
'http://www.en-japan.com/',
# Why: #6571 in Alexa global
'http://www.akbank.com/',
# Why: #6572 in Alexa global
'http://www.srf.ch/',
# Why: #6573 in Alexa global
'http://www.meijer.com/',
# Why: #6574 in Alexa global
'http://www.htmldrive.net/',
# Why: #6575 in Alexa global
'http://www.peoplestylewatch.com/',
# Why: #6576 in Alexa global
'http://www.4008823823.com.cn/',
# Why: #6577 in Alexa global
'http://www.boards.ie/',
# Why: #6578 in Alexa global
'http://www.zhulong.com/',
# Why: #6579 in Alexa global
'http://www.svyaznoybank.ru/',
# Why: #6580 in Alexa global
'http://www.myfilestore.com/',
# Why: #6581 in Alexa global
'http://www.sucuri.net/',
# Why: #6582 in Alexa global
'http://www.redflagdeals.com/',
# Why: #6583 in Alexa global
'http://www.gxnews.com.cn/',
# Why: #6584 in Alexa global
'http://www.javascriptkit.com/',
# Why: #6585 in Alexa global
'http://www.edreams.fr/',
# Why: #6586 in Alexa global
'http://www.wral.com/',
# Why: #6587 in Alexa global
'http://www.togetter.com/',
# Why: #6588 in Alexa global
'http://www.dmi.dk/',
# Why: #6589 in Alexa global
'http://www.thinkdigit.com/',
# Why: #6590 in Alexa global
'http://www.barclaycard.co.uk/',
# Why: #6591 in Alexa global
'http://www.comm100.com/',
# Why: #6592 in Alexa global
'http://www.christianbook.com/',
# Why: #6593 in Alexa global
'http://www.popularmechanics.com/',
# Why: #6594 in Alexa global
'http://www.taste.com.au/',
# Why: #6595 in Alexa global
'http://www.tripadvisor.ru/',
# Why: #6596 in Alexa global
'http://www.colissimo.fr/',
# Why: #6597 in Alexa global
'http://www.gdposir.info/',
# Why: #6598 in Alexa global
'http://www.rarlab.com/',
# Why: #6599 in Alexa global
'http://www.dcnepalevent.com/',
# Why: #6600 in Alexa global
'http://www.sagepub.com/',
# Why: #6601 in Alexa global
'http://www.markosweb.com/',
# Why: #6602 in Alexa global
'http://www.france3.fr/',
# Why: #6603 in Alexa global
'http://www.mindbodyonline.com/',
# Why: #6604 in Alexa global
'http://www.yapo.cl/',
# Why: #6605 in Alexa global
'http://www.0-6.com/',
# Why: #6606 in Alexa global
'http://www.dilbert.com/',
# Why: #6607 in Alexa global
'http://www.searchqu.com/',
# Why: #6608 in Alexa global
'http://www.usa.gov/',
# Why: #6609 in Alexa global
'http://www.vatandownload.com/',
# Why: #6610 in Alexa global
'http://www.nastymovs.com/',
# Why: #6611 in Alexa global
'http://www.santanderrio.com.ar/',
# Why: #6612 in Alexa global
'http://www.notebookcheck.net/',
# Why: #6613 in Alexa global
'http://www.canalplus.fr/',
# Why: #6614 in Alexa global
'http://www.coocan.jp/',
# Why: #6615 in Alexa global
'http://www.goodreads.com/user/show/',
# Why: #6616 in Alexa global
'http://www.epa.gov/',
# Why: #6617 in Alexa global
'http://www.disp.cc/',
# Why: #6618 in Alexa global
'http://www.hotsales.net/',
# Why: #6619 in Alexa global
'http://www.interpals.net/',
# Why: #6620 in Alexa global
'http://www.vz.ru/',
# Why: #6621 in Alexa global
'http://www.flyertalk.com/',
# Why: #6622 in Alexa global
'http://www.pjmedia.com/',
# Why: #6623 in Alexa global
'http://www.solomid.net/',
# Why: #6624 in Alexa global
'http://www.megaplan.ru/',
# Why: #6625 in Alexa global
'http://www.hatenablog.com/',
# Why: #6626 in Alexa global
'http://www.getsatisfaction.com/',
# Why: #6627 in Alexa global
'http://www.hotline.ua/',
# Why: #6628 in Alexa global
'http://www.alternativeto.net/',
# Why: #6629 in Alexa global
'http://www.hipfile.com/',
# Why: #6630 in Alexa global
'http://www.247sports.com/',
# Why: #6631 in Alexa global
'http://www.phpnuke.org/',
# Why: #6632 in Alexa global
'http://www.indiaresults.com/',
# Why: #6633 in Alexa global
'http://www.prisjakt.nu/',
# Why: #6634 in Alexa global
'http://www.1tvlive.in/',
# Why: #6635 in Alexa global
'http://www.e-mai.net/',
# Why: #6636 in Alexa global
'http://www.trafficg.com/',
# Why: #6637 in Alexa global
'http://www.ojogo.pt/',
# Why: #6638 in Alexa global
'http://www.totaldomination.com/',
# Why: #6639 in Alexa global
'http://www.eroino.net/',
# Why: #6640 in Alexa global
'http://www.network-tools.com/',
# Why: #6641 in Alexa global
'http://www.unibytes.com/',
# Why: #6642 in Alexa global
'http://www.seriouseats.com/',
# Why: #6643 in Alexa global
'http://www.twicsy.com/',
# Why: #6644 in Alexa global
'http://www.smbc-card.com/',
# Why: #6645 in Alexa global
'http://toocle.com/',
# Why: #6646 in Alexa global
'http://www.unbounce.com/',
# Why: #6647 in Alexa global
'http://www.2tu.cc/',
# Why: #6648 in Alexa global
'http://www.computerworld.com/',
# Why: #6649 in Alexa global
'http://www.clicktrackprofit.com/',
# Why: #6650 in Alexa global
'http://www.serialu.net/',
# Why: #6651 in Alexa global
'http://www.realfarmacy.com/',
# Why: #6652 in Alexa global
'http://metrodeal.com/',
# Why: #6653 in Alexa global
'http://www.binzhi.com/',
# Why: #6654 in Alexa global
'http://www.smilebox.com/',
# Why: #6655 in Alexa global
'http://www.coderanch.com/',
# Why: #6656 in Alexa global
'http://www.uptodown.com/',
# Why: #6657 in Alexa global
'http://www.vbulletin.com/',
# Why: #6658 in Alexa global
'http://www.teasernet.com/',
# Why: #6659 in Alexa global
'http://www.hulu.jp/',
# Why: #6660 in Alexa global
'http://www.admob.com/',
# Why: #6661 in Alexa global
'http://www.fingerhut.com/',
# Why: #6662 in Alexa global
'http://www.urlopener.com/',
# Why: #6663 in Alexa global
'http://www.vi.nl/',
# Why: #6664 in Alexa global
'http://www.gamebase.com.tw/',
# Why: #6665 in Alexa global
'http://www.expedia.de/',
# Why: #6666 in Alexa global
'http://www.thekrazycouponlady.com/',
# Why: #6667 in Alexa global
'http://www.linezing.com/',
# Why: #6668 in Alexa global
'http://www.metropcs.com/',
# Why: #6670 in Alexa global
'http://www.draugas.lt/',
# Why: #6671 in Alexa global
'http://www.minecraftdl.com/',
# Why: #6672 in Alexa global
'http://www.airberlin.com/',
# Why: #6673 in Alexa global
'http://www.eelly.com/',
# Why: #6674 in Alexa global
'http://www.siamsport.co.th/',
# Why: #6675 in Alexa global
'http://www.e-junkie.com/',
# Why: #6676 in Alexa global
'http://www.gulte.com/',
# Why: #6677 in Alexa global
'http://www.lazada.com.ph/',
# Why: #6678 in Alexa global
'http://www.cnwnews.com/',
# Why: #6679 in Alexa global
'http://www.tekstowo.pl/',
# Why: #6680 in Alexa global
'http://www.flavorwire.com/',
# Why: #6681 in Alexa global
'http://www.settrade.com/',
# Why: #6682 in Alexa global
'http://www.francetv.fr/',
# Why: #6683 in Alexa global
'http://www.experian.com/',
# Why: #6684 in Alexa global
'http://www.bravenet.com/',
# Why: #6685 in Alexa global
'http://www.mytoys.de/',
# Why: #6686 in Alexa global
'http://www.inkthemes.com/',
# Why: #6687 in Alexa global
'http://www.brobible.com/',
# Why: #6688 in Alexa global
'http://www.sarenza.com/',
# Why: #6689 in Alexa global
'http://www.curse.com/',
# Why: #6690 in Alexa global
'http://www.iresearch.cn/',
# Why: #6691 in Alexa global
'http://www.lohaco.jp/',
# Why: #6692 in Alexa global
'http://www.7sur7.be/',
# Why: #6693 in Alexa global
'http://www.iberia.com/',
# Why: #6694 in Alexa global
'http://www.trovit.es/',
# Why: #6695 in Alexa global
'http://www.eiga.com/',
# Why: #6696 in Alexa global
'http://saga123.cn/',
# Why: #6697 in Alexa global
'http://www.getuploader.com/',
# Why: #6698 in Alexa global
'http://www.sevendollarptc.com/',
# Why: #6699 in Alexa global
'http://www.amadeus.com/',
# Why: #6700 in Alexa global
'http://www.thedailystar.net/',
# Why: #6701 in Alexa global
'http://www.gofuckbiz.com/',
# Why: #6702 in Alexa global
'http://www.codepen.io/',
# Why: #6703 in Alexa global
'http://www.virginia.gov/',
# Why: #6704 in Alexa global
'http://www.linguee.fr/',
# Why: #6705 in Alexa global
'http://www.space.com/',
# Why: #6706 in Alexa global
'http://www.astrology.com/',
# Why: #6707 in Alexa global
'http://www.whmcs.com/',
# Why: #6708 in Alexa global
'http://www.blogher.com/',
# Why: #6709 in Alexa global
'http://www.netpnb.com/',
# Why: #6710 in Alexa global
'http://www.mojo-themes.com/',
# Why: #6711 in Alexa global
'http://www.cam4.es/',
# Why: #6712 in Alexa global
'http://www.bestwestern.com/',
# Why: #6713 in Alexa global
'http://www.gencat.cat/',
# Why: #6714 in Alexa global
'http://www.healthcentral.com/',
# Why: #6715 in Alexa global
'http://www.ru-board.com/',
# Why: #6716 in Alexa global
'http://www.tjsp.jus.br/',
# Why: #6717 in Alexa global
'http://www.scene7.com/',
# Why: #6718 in Alexa global
'http://www.bukalapak.com/',
# Why: #6720 in Alexa global
'http://www.intporn.com/',
# Why: #6721 in Alexa global
'http://www.xe.gr/',
# Why: #6722 in Alexa global
'http://www.leprosorium.ru/',
# Why: #6723 in Alexa global
'http://www.dytt8.net/',
# Why: #6724 in Alexa global
'http://www.wpcentral.com/',
# Why: #6725 in Alexa global
'http://www.fasttrafficformula.com/',
# Why: #6726 in Alexa global
'http://www.hugefiles.net/',
# Why: #6727 in Alexa global
'http://www.you-sex-tube.com/',
# Why: #6728 in Alexa global
'http://www.naukrigulf.com/',
# Why: #6729 in Alexa global
'http://5173.com/',
# Why: #6730 in Alexa global
'http://www.comicvip.com/',
# Why: #6731 in Alexa global
'http://www.jossandmain.com/',
# Why: #6732 in Alexa global
'http://www.motherjones.com/',
# Why: #6733 in Alexa global
'http://www.planet.fr/',
# Why: #6734 in Alexa global
'http://www.thomascook.com/',
# Why: #6735 in Alexa global
'http://www.deseretnews.com/',
# Why: #6736 in Alexa global
'http://www.aawsat.com/',
# Why: #6737 in Alexa global
'http://www.huntington.com/',
# Why: #6738 in Alexa global
'http://www.desimartini.com/',
# Why: #6739 in Alexa global
'http://www.maloumaa.blogspot.com/',
# Why: #6740 in Alexa global
'http://www.rutgers.edu/',
# Why: #6741 in Alexa global
'http://www.gratisjuegos.org/',
# Why: #6742 in Alexa global
'http://www.carsforsale.com/',
# Why: #6743 in Alexa global
'http://www.filestore72.info/',
# Why: #6744 in Alexa global
'http://www.neowin.net/',
# Why: #6745 in Alexa global
'http://www.ilgiornale.it/',
# Why: #6746 in Alexa global
'http://www.download0098.com/',
# Why: #6747 in Alexa global
'http://www.providesupport.com/',
# Why: #6748 in Alexa global
'http://www.postini.com/',
# Why: #6749 in Alexa global
'http://www.sinowaypromo.com/',
# Why: #6750 in Alexa global
'http://www.watchop.com/',
# Why: #6751 in Alexa global
'http://www.docusign.net/',
# Why: #6752 in Alexa global
'http://www.sourcenext.com/',
# Why: #6753 in Alexa global
'http://www.finviz.com/',
# Why: #6754 in Alexa global
'http://www.babyoye.com/',
# Why: #6755 in Alexa global
'http://www.andhrajyothy.com/',
# Why: #6756 in Alexa global
'http://www.gamezer.com/',
# Why: #6757 in Alexa global
'http://www.baozoumanhua.com/',
# Why: #6758 in Alexa global
'http://www.niusnews.com/',
# Why: #6759 in Alexa global
'http://www.yabancidiziizle.net/',
# Why: #6760 in Alexa global
'http://www.fodors.com/',
# Why: #6761 in Alexa global
'http://www.moonsy.com/',
# Why: #6762 in Alexa global
'http://www.lidl.it/',
# Why: #6763 in Alexa global
'http://www.betanews.com/',
# Why: #6764 in Alexa global
'http://www.auone.jp/',
# Why: #6765 in Alexa global
'http://www.escapistmagazine.com/',
# Why: #6766 in Alexa global
'http://www.markethealth.com/',
# Why: #6767 in Alexa global
'http://www.clicksure.com/',
# Why: #6768 in Alexa global
'http://www.aircel.com/',
# Why: #6769 in Alexa global
'http://www.metacrawler.com/',
# Why: #6770 in Alexa global
'http://www.aeat.es/',
# Why: #6771 in Alexa global
'http://www.allafrica.com/',
# Why: #6772 in Alexa global
'http://www.watchseries-online.eu/',
# Why: #6773 in Alexa global
'http://www.adpost.com/',
# Why: #6774 in Alexa global
'http://www.adac.de/',
# Why: #6775 in Alexa global
'http://www.similarweb.com/',
# Why: #6776 in Alexa global
'http://www.offervault.com/',
# Why: #6777 in Alexa global
'http://www.uolhost.com.br/',
# Why: #6778 in Alexa global
'http://www.moviestarplanet.com/',
# Why: #6779 in Alexa global
'http://www.overclockers.ru/',
# Why: #6780 in Alexa global
'http://www.rocketlanguages.com/',
# Why: #6781 in Alexa global
'http://www.finya.de/',
# Why: #6782 in Alexa global
'http://www.shahvani.com/',
# Why: #6783 in Alexa global
'http://www.firmy.cz/',
# Why: #6784 in Alexa global
'http://www.incometaxindia.gov.in/',
# Why: #6785 in Alexa global
'http://www.ecostream.tv/',
# Why: #6786 in Alexa global
'http://www.pcwelt.de/',
# Why: #6787 in Alexa global
'http://www.arcadesafari.com/',
# Why: #6788 in Alexa global
'http://www.shoghlanty.com/',
# Why: #6789 in Alexa global
'http://www.videosection.com/',
# Why: #6790 in Alexa global
'http://www.jcb.co.jp/',
# Why: #6792 in Alexa global
'http://www.centauro.com.br/',
# Why: #6793 in Alexa global
'http://www.eroanimedouga.net/',
# Why: #6794 in Alexa global
'http://www.orientaltrading.com/',
# Why: #6795 in Alexa global
'http://www.tsutaya.co.jp/',
# Why: #6796 in Alexa global
'http://www.ogone.com/',
# Why: #6798 in Alexa global
'http://www.sexlog.com/',
# Why: #6799 in Alexa global
'http://www.hotair.com/',
# Why: #6800 in Alexa global
'http://www.egypt.gov.eg/',
# Why: #6801 in Alexa global
'http://www.thomasnet.com/',
# Why: #6802 in Alexa global
'http://www.virustotal.com/',
# Why: #6803 in Alexa global
'http://www.hayneedle.com/',
# Why: #6804 in Alexa global
'http://www.fatburningfurnace.com/',
# Why: #6805 in Alexa global
'http://www.lovedgames.com/',
# Why: #6806 in Alexa global
'http://www.gov.cn/',
# Why: #6807 in Alexa global
'http://www.23us.com/',
# Why: #6808 in Alexa global
'http://www.trafficcaptain.com/',
# Why: #6810 in Alexa global
'http://www.v2cigs.com/',
# Why: #6811 in Alexa global
'http://www.teknosa.com.tr/',
# Why: #6812 in Alexa global
'http://www.skrill.com/',
# Why: #6813 in Alexa global
'http://www.puritanas.com/',
# Why: #6814 in Alexa global
'http://www.selfgrowth.com/',
# Why: #6815 in Alexa global
'http://www.ikco.com/',
# Why: #6816 in Alexa global
'http://www.saisoncard.co.jp/',
# Why: #6817 in Alexa global
'http://www.cuisineaz.com/',
# Why: #6818 in Alexa global
'http://www.causes.com/',
# Why: #6819 in Alexa global
'http://www.democraticunderground.com/',
# Why: #6820 in Alexa global
'http://www.placesexy.com/',
# Why: #6821 in Alexa global
'http://www.expedia.co.uk/',
# Why: #6822 in Alexa global
'http://www.www-com.co/',
# Why: #6823 in Alexa global
'http://www.topmongol.com/',
# Why: #6824 in Alexa global
'http://www.hikaritube.com/',
# Why: #6825 in Alexa global
'http://www.amakings.com/',
# Why: #6826 in Alexa global
'http://www.fxstreet.com/',
# Why: #6827 in Alexa global
'http://www.consultant.ru/',
# Why: #6828 in Alexa global
'http://www.sacbee.com/',
# Why: #6829 in Alexa global
'http://www.supercheats.com/',
# Why: #6830 in Alexa global
'http://www.sofunnylol.com/',
# Why: #6831 in Alexa global
'http://www.muzy.com/',
# Why: #6832 in Alexa global
'http://www.sparda.de/',
# Why: #6833 in Alexa global
'http://www.caughtoffside.com/',
# Why: #6834 in Alexa global
'http://www.chinawomendating.asia/',
# Why: #6835 in Alexa global
'http://www.xmeeting.com/',
# Why: #6836 in Alexa global
'http://www.google.al/',
# Why: #6837 in Alexa global
'http://www.sovereignbank.com/',
# Why: #6838 in Alexa global
'http://www.animeflv.net/',
# Why: #6839 in Alexa global
'http://www.sky.de/',
# Why: #6840 in Alexa global
'http://www.huatu.com/',
# Why: #6841 in Alexa global
'http://www.payscale.com/',
# Why: #6842 in Alexa global
'http://www.quotidiano.net/',
# Why: #6843 in Alexa global
'http://www.pol.ir/',
# Why: #6844 in Alexa global
'http://www.digital-photography-school.com/',
# Why: #6845 in Alexa global
'http://www.screencrush.com/',
# Why: #6846 in Alexa global
'http://www.battlenet.com.cn/',
# Why: #6847 in Alexa global
'http://www.netgear.com/',
# Why: #6848 in Alexa global
'http://www.thebiglistofporn.com/',
# Why: #6849 in Alexa global
'http://www.similarsitesearch.com/',
# Why: #6850 in Alexa global
'http://www.peb.pl/',
# Why: #6851 in Alexa global
'http://www.lanrentuku.com/',
# Why: #6852 in Alexa global
'http://www.ksu.edu.sa/',
# Why: #6853 in Alexa global
'http://www.tradetracker.com/',
# Why: #6855 in Alexa global
'http://www.d.cn/',
# Why: #6856 in Alexa global
'http://www.avito.ma/',
# Why: #6857 in Alexa global
'http://www.projectfree.tv/',
# Why: #6858 in Alexa global
'http://www.cmu.edu/',
# Why: #6859 in Alexa global
'http://www.imore.com/',
# Why: #6860 in Alexa global
'http://www.tickld.com/',
# Why: #6861 in Alexa global
'http://www.fitday.com/',
# Why: #6862 in Alexa global
'http://www.dulcebank.com/',
# Why: #6863 in Alexa global
'http://www.careerdonkey.com/',
# Why: #6864 in Alexa global
'http://www.pf.pl/',
# Why: #6865 in Alexa global
'http://www.otzovik.com/',
# Why: #6866 in Alexa global
'http://www.baltimoresun.com/',
# Why: #6867 in Alexa global
'http://www.ponpare.jp/',
# Why: #6868 in Alexa global
'http://www.jobvite.com/',
# Why: #6869 in Alexa global
'http://www.ratemyprofessors.com/',
# Why: #6870 in Alexa global
'http://www.bancodevenezuela.com/',
# Why: #6871 in Alexa global
'http://www.linkafarin.com/',
# Why: #6872 in Alexa global
'http://www.ufxmarkets.com/',
# Why: #6873 in Alexa global
'http://www.lavozdegalicia.es/',
# Why: #6874 in Alexa global
'http://www.99bill.com/',
# Why: #6875 in Alexa global
'http://www.punyu.com/',
# Why: #6876 in Alexa global
'http://www.otodom.pl/',
# Why: #6877 in Alexa global
'http://www.entireweb.com/',
# Why: #6878 in Alexa global
'http://www.fastshop.com.br/',
# Why: #6879 in Alexa global
'http://www.imgnip.com/',
# Why: #6880 in Alexa global
'http://www.goodlife.com/',
# Why: #6881 in Alexa global
'http://www.caringbridge.org/',
# Why: #6882 in Alexa global
'http://www.pistonheads.com/',
# Why: #6883 in Alexa global
'http://www.gun.az/',
# Why: #6884 in Alexa global
'http://www.1and1.es/',
# Why: #6885 in Alexa global
'http://www.photofunia.com/',
# Why: #6886 in Alexa global
'http://www.nme.com/',
# Why: #6887 in Alexa global
'http://www.japannetbank.co.jp/',
# Why: #6888 in Alexa global
'http://www.carfax.com/',
# Why: #6889 in Alexa global
'http://www.gutenberg.org/',
# Why: #6890 in Alexa global
'http://www.youxixiazai.org/',
# Why: #6891 in Alexa global
'http://www.webmastersitesi.com/',
# Why: #6892 in Alexa global
'http://www.skynet.be/',
# Why: #6893 in Alexa global
'http://www.afrointroductions.com/',
# Why: #6894 in Alexa global
'http://www.mp3slash.net/',
# Why: #6895 in Alexa global
'http://www.netzwelt.de/',
# Why: #6896 in Alexa global
'http://www.ecrater.com/',
# Why: #6897 in Alexa global
'http://www.livemint.com/',
# Why: #6898 in Alexa global
'http://www.worldwinner.com/',
# Why: #6899 in Alexa global
'http://www.echosign.com/',
# Why: #6900 in Alexa global
'http://www.cromaretail.com/',
# Why: #6901 in Alexa global
'http://www.freewebcamporntube.com/',
# Why: #6902 in Alexa global
'http://www.admin.ch/',
# Why: #6903 in Alexa global
'http://www.allstate.com/',
# Why: #6904 in Alexa global
'http://www.photoscape.org/',
# Why: #6905 in Alexa global
'http://www.cv-library.co.uk/',
# Why: #6906 in Alexa global
'http://www.voici.fr/',
# Why: #6907 in Alexa global
'http://www.wdr.de/',
# Why: #6908 in Alexa global
'http://www.pbase.com/',
# Why: #6909 in Alexa global
'http://www.mycenturylink.com/',
# Why: #6910 in Alexa global
'http://www.sonicomusica.com/',
# Why: #6911 in Alexa global
'http://www.schema.org/',
# Why: #6912 in Alexa global
'http://www.smashwords.com/',
# Why: #6913 in Alexa global
'http://www.al3ab.net/',
# Why: #6914 in Alexa global
'http://muryouav.net/',
# Why: #6915 in Alexa global
'http://www.mocospace.com/',
# Why: #6916 in Alexa global
'http://www.fundsxpress.com/',
# Why: #6917 in Alexa global
'http://www.chrisc.com/',
# Why: #6918 in Alexa global
'http://www.poemhunter.com/',
# Why: #6919 in Alexa global
'http://www.cupid.com/',
# Why: #6920 in Alexa global
'http://www.timescity.com/',
# Why: #6921 in Alexa global
'http://www.banglamail24.com/',
# Why: #6922 in Alexa global
'http://www.motika.com.mk/',
# Why: #6923 in Alexa global
'http://www.sec.gov/',
# Why: #6924 in Alexa global
'http://www.go.cn/',
# Why: #6925 in Alexa global
'http://www.whatculture.com/',
# Why: #6926 in Alexa global
'http://www.namepros.com/',
# Why: #6927 in Alexa global
'http://www.vsemayki.ru/',
# Why: #6928 in Alexa global
'http://www.hip2save.com/',
# Why: #6929 in Alexa global
'http://www.hotnews.ro/',
# Why: #6930 in Alexa global
'http://www.vietbao.vn/',
# Why: #6931 in Alexa global
'http://inazumanews2.com/',
# Why: #6932 in Alexa global
'http://www.irokotv.com/',
# Why: #6933 in Alexa global
'http://www.appthemes.com/',
# Why: #6934 in Alexa global
'http://www.tirerack.com/',
# Why: #6935 in Alexa global
'http://www.maxpark.com/',
# Why: #6936 in Alexa global
'http://wed114.cn/',
# Why: #6937 in Alexa global
'http://www.successfactors.com/',
# Why: #6938 in Alexa global
'http://www.sba.gov/',
# Why: #6939 in Alexa global
'http://www.hk-porno.com/',
# Why: #6940 in Alexa global
'http://www.setlinks.ru/',
# Why: #6941 in Alexa global
'http://www.travel24.com/',
# Why: #6942 in Alexa global
'http://www.qatarliving.com/',
# Why: #6943 in Alexa global
'http://www.hotlog.ru/',
# Why: #6944 in Alexa global
'http://rapmls.com/',
# Why: #6945 in Alexa global
'http://www.qualityhealth.com/',
# Why: #6946 in Alexa global
'http://www.linkcollider.com/',
# Why: #6947 in Alexa global
'http://www.kashtanka.com/',
# Why: #6948 in Alexa global
'http://www.hightail.com/',
# Why: #6949 in Alexa global
'http://www.appszoom.com/',
# Why: #6950 in Alexa global
'http://www.armagedomfilmes.biz/',
# Why: #6951 in Alexa global
'http://www.pnu.ac.ir/',
# Why: #6952 in Alexa global
'http://www.globalbux.net/',
# Why: #6953 in Alexa global
'http://www.ebay.com.hk/',
# Why: #6954 in Alexa global
'http://www.ladenzeile.de/',
# Why: #6955 in Alexa global
'http://www.thedomainfo.com/',
# Why: #6956 in Alexa global
'http://www.naosalvo.com.br/',
# Why: #6957 in Alexa global
'http://www.perfectcamgirls.com/',
# Why: #6958 in Alexa global
'http://www.verticalresponse.com/',
# Why: #6959 in Alexa global
'http://www.khabardehi.com/',
# Why: #6960 in Alexa global
'http://www.oszone.net/',
# Why: #6961 in Alexa global
'http://www.teamtreehouse.com/',
# Why: #6962 in Alexa global
'http://www.youtube.com/user/BlueXephos/',
# Why: #6963 in Alexa global
'http://www.humanservices.gov.au/',
# Why: #6964 in Alexa global
'http://www.bostonherald.com/',
# Why: #6965 in Alexa global
'http://www.kafeteria.pl/',
# Why: #6966 in Alexa global
'http://www.society6.com/',
# Why: #6967 in Alexa global
'http://www.gamevicio.com/',
# Why: #6968 in Alexa global
'http://www.crazyegg.com/',
# Why: #6969 in Alexa global
'http://www.logitravel.com/',
# Why: #6970 in Alexa global
'http://www.williams-sonoma.com/',
# Why: #6972 in Alexa global
'http://www.htmlgoodies.com/',
# Why: #6973 in Alexa global
'http://www.fontanka.ru/',
# Why: #6974 in Alexa global
'http://www.islamuon.com/',
# Why: #6975 in Alexa global
'http://www.tcs.com/',
# Why: #6976 in Alexa global
'http://www.elyrics.net/',
# Why: #6978 in Alexa global
'http://www.vip-prom.net/',
# Why: #6979 in Alexa global
'http://www.jobstreet.com.ph/',
# Why: #6980 in Alexa global
'http://www.designfloat.com/',
# Why: #6981 in Alexa global
'http://www.lavasoft.com/',
# Why: #6982 in Alexa global
'http://www.tianjinwe.com/',
# Why: #6983 in Alexa global
'http://www.telelistas.net/',
# Why: #6984 in Alexa global
'http://www.taglol.com/',
# Why: #6985 in Alexa global
'http://www.jacquieetmicheltv.net/',
# Why: #6986 in Alexa global
'http://www.esprit-online-shop.com/',
# Why: #6987 in Alexa global
'http://www.theeroticreview.com/',
# Why: #6988 in Alexa global
'http://www.boo-box.com/',
# Why: #6989 in Alexa global
'http://www.wandoujia.com/',
# Why: #6990 in Alexa global
'http://www.vgsgaming.com/',
# Why: #6991 in Alexa global
'http://www.yourtango.com/',
# Why: #6992 in Alexa global
'http://www.tianji.com/',
# Why: #6993 in Alexa global
'http://www.jpost.com/',
# Why: #6994 in Alexa global
'http://www.mythemeshop.com/',
# Why: #6995 in Alexa global
'http://www.seattlepi.com/',
# Why: #6996 in Alexa global
'http://www.nintendo.co.jp/',
# Why: #6997 in Alexa global
'http://bultannews.com/',
# Why: #6998 in Alexa global
'http://www.youlikehits.com/',
# Why: #6999 in Alexa global
'http://www.partycity.com/',
# Why: #7000 in Alexa global
'http://www.18qt.com/',
# Why: #7001 in Alexa global
'http://www.yuvutu.com/',
# Why: #7002 in Alexa global
'http://www.gq.com/',
# Why: #7003 in Alexa global
'http://www.wiziwig.tv/',
# Why: #7004 in Alexa global
'http://www.cinejosh.com/',
# Why: #7005 in Alexa global
'http://www.technet.com/',
# Why: #7006 in Alexa global
'http://www.vatanbilgisayar.com/',
# Why: #7007 in Alexa global
'http://www.guangjiela.com/',
# Why: #7008 in Alexa global
'http://www.shooter.com.cn/',
# Why: #7009 in Alexa global
'http://www.siteheart.com/',
# Why: #7010 in Alexa global
'http://www.in.gov/',
# Why: #7011 in Alexa global
'http://www.nulled.cc/',
# Why: #7012 in Alexa global
'http://www.mafiashare.net/',
# Why: #7013 in Alexa global
'http://www.tizag.com/',
# Why: #7014 in Alexa global
'http://www.hkjc.com/',
# Why: #7015 in Alexa global
'http://www.restaurant.com/',
# Why: #7016 in Alexa global
'http://www.consumersurveygroup.org/',
# Why: #7017 in Alexa global
'http://www.lolipop.jp/',
# Why: #7018 in Alexa global
'http://www.spin.de/',
# Why: #7019 in Alexa global
'http://www.silverlinetrips.com/',
# Why: #7020 in Alexa global
'http://www.triberr.com/',
# Why: #7021 in Alexa global
'http://www.gamesgirl.net/',
# Why: #7022 in Alexa global
'http://www.qqt38.com/',
# Why: #7023 in Alexa global
'http://www.xiaoshuomm.com/',
# Why: #7024 in Alexa global
'http://www.theopen.com/',
# Why: #7025 in Alexa global
'http://www.campograndenews.com.br/',
# Why: #7026 in Alexa global
'http://bshare.cn/',
# Why: #7028 in Alexa global
'http://www.soonnight.com/',
# Why: #7029 in Alexa global
'http://www.safaribooksonline.com/',
# Why: #7030 in Alexa global
'http://www.main-hosting.com/',
# Why: #7031 in Alexa global
'http://www.caclubindia.com/',
# Why: #7032 in Alexa global
'http://www.alibado.com/',
# Why: #7033 in Alexa global
'http://www.autorambler.ru/',
# Why: #7034 in Alexa global
'http://www.kafan.cn/',
# Why: #7035 in Alexa global
'http://www.tnt.com/',
# Why: #7036 in Alexa global
'http://www.chatango.com/',
# Why: #7037 in Alexa global
'http://www.satrk.com/',
# Why: #7039 in Alexa global
'http://www.pagesperso-orange.fr/',
# Why: #7040 in Alexa global
'http://www.cgbchina.com.cn/',
# Why: #7041 in Alexa global
'http://www.houseoffraser.co.uk/',
# Why: #7042 in Alexa global
'http://www.nullrefer.com/',
# Why: #7043 in Alexa global
'http://www.work.ua/',
# Why: #7044 in Alexa global
'http://www.inagist.com/',
# Why: #7045 in Alexa global
'http://www.kaban.tv/',
# Why: #7046 in Alexa global
'http://www.cnxad.com/',
# Why: #7047 in Alexa global
'http://www.tarad.com/',
# Why: #7048 in Alexa global
'http://www.masteetv.com/',
# Why: #7049 in Alexa global
'http://www.noblesamurai.com/',
# Why: #7050 in Alexa global
'http://www.businessweekly.com.tw/',
# Why: #7051 in Alexa global
'http://www.lifehacker.ru/',
# Why: #7052 in Alexa global
'http://www.anakbnet.com/',
# Why: #7053 in Alexa global
'http://www.google.co.ug/',
# Why: #7054 in Alexa global
'http://www.webcamsex.nl/',
# Why: #7055 in Alexa global
'http://kaoyan.com/',
# Why: #7056 in Alexa global
'http://www.ml.com/',
# Why: #7057 in Alexa global
'http://up.nic.in/',
# Why: #7058 in Alexa global
'http://www.bounceme.net/',
# Why: #7059 in Alexa global
'http://www.netfirms.com/',
# Why: #7060 in Alexa global
'http://www.idokep.hu/',
# Why: #7061 in Alexa global
'http://www.wambie.com/',
# Why: #7062 in Alexa global
'http://www.funpatogh.com/',
# Why: #7063 in Alexa global
'http://hmv.co.jp/',
# Why: #7064 in Alexa global
'http://www.bcash.com.br/',
# Why: #7065 in Alexa global
'http://www.sedo.co.uk/',
# Why: #7066 in Alexa global
'http://www.game2.cn/',
# Why: #7067 in Alexa global
'http://www.noupe.com/',
# Why: #7068 in Alexa global
'http://www.mydirtyhobby.com/',
# Why: #7069 in Alexa global
'http://www.neswangy.net/',
# Why: #7070 in Alexa global
'http://www.downloadprovider.me/',
# Why: #7071 in Alexa global
'http://www.utah.gov/',
# Why: #7072 in Alexa global
'http://www.consumerintelligenceusa.com/',
# Why: #7073 in Alexa global
'http://www.itimes.com/',
# Why: #7074 in Alexa global
'http://www.picroma.com/',
# Why: #7075 in Alexa global
'http://www.lustagenten.com/',
# Why: #7076 in Alexa global
'http://www.monex.co.jp/',
# Why: #7077 in Alexa global
'http://www.kemdiknas.go.id/',
# Why: #7078 in Alexa global
'http://www.sitepronews.com/',
# Why: #7079 in Alexa global
'http://www.ruseller.com/',
# Why: #7080 in Alexa global
'http://www.tradecarview.com/',
# Why: #7081 in Alexa global
'http://www.favstar.fm/',
# Why: #7082 in Alexa global
'http://www.bestbuy.ca/',
# Why: #7083 in Alexa global
'http://www.yelp.ca/',
# Why: #7084 in Alexa global
'http://www.stop-sex.com/',
# Why: #7085 in Alexa global
'http://www.rewity.com/',
# Why: #7086 in Alexa global
'http://www.qiqigames.com/',
# Why: #7087 in Alexa global
'http://www.suntimes.com/',
# Why: #7088 in Alexa global
'http://www.hardware.fr/',
# Why: #7089 in Alexa global
'http://www.rxlist.com/',
# Why: #7090 in Alexa global
'http://www.bgr.com/',
# Why: #7091 in Alexa global
'http://www.zalora.co.id/',
# Why: #7092 in Alexa global
'http://www.mandatory.com/',
# Why: #7094 in Alexa global
'http://www.collarme.com/',
# Why: #7095 in Alexa global
'http://www.mycommerce.com/',
# Why: #7096 in Alexa global
'http://www.holidayiq.com/',
# Why: #7097 in Alexa global
'http://www.filecloud.io/',
# Why: #7098 in Alexa global
'http://www.vconnect.com/',
# Why: #7099 in Alexa global
'http://66163.com/',
# Why: #7100 in Alexa global
'http://www.tlen.pl/',
# Why: #7101 in Alexa global
'http://www.mmbang.com/',
# Why: #7102 in Alexa global
'http://7c.com/',
# Why: #7103 in Alexa global
'http://www.digitalriver.com/',
# Why: #7104 in Alexa global
'http://www.24video.net/',
# Why: #7105 in Alexa global
'http://www.worthofweb.com/',
# Why: #7106 in Alexa global
'http://www.clasicooo.com/',
# Why: #7107 in Alexa global
'http://www.greatschools.net/',
# Why: #7108 in Alexa global
'http://www.tagesanzeiger.ch/',
# Why: #7109 in Alexa global
'http://www.video.az/',
# Why: #7110 in Alexa global
'http://www.osu.edu/',
# Why: #7111 in Alexa global
'http://www.careers360.com/',
# Why: #7112 in Alexa global
'http://www.101.ru/',
# Why: #7113 in Alexa global
'http://www.conforama.fr/',
# Why: #7114 in Alexa global
'http://www.apollo.lv/',
# Why: #7115 in Alexa global
'http://www.netcq.net/',
# Why: #7116 in Alexa global
'http://www.jofogas.hu/',
# Why: #7117 in Alexa global
'http://www.niftylink.com/',
# Why: #7118 in Alexa global
'http://www.midwayusa.com/',
# Why: #7119 in Alexa global
'http://www.collegeteensex.net/',
# Why: #7120 in Alexa global
'http://www.search.com/',
# Why: #7121 in Alexa global
'http://www.naftemporiki.gr/',
# Why: #7122 in Alexa global
'http://www.sainsburys.co.uk/',
# Why: #7123 in Alexa global
'http://www.fitsugar.com/',
# Why: #7124 in Alexa global
'http://www.ifixit.com/',
# Why: #7125 in Alexa global
'http://www.uid.me/',
# Why: #7126 in Alexa global
'http://www.malwarebytes.org/',
# Why: #7127 in Alexa global
'http://www.maxbounty.com/',
# Why: #7128 in Alexa global
'http://www.mensfitness.com/',
# Why: #7129 in Alexa global
'http://www.rtl.be/',
# Why: #7130 in Alexa global
'http://www.yidio.com/',
# Why: #7131 in Alexa global
'http://www.dostorasly.com/',
# Why: #7132 in Alexa global
'http://www.abovetopsecret.com/',
# Why: #7133 in Alexa global
'http://www.sm3na.com/',
# Why: #7134 in Alexa global
'http://www.cam.ac.uk/',
# Why: #7135 in Alexa global
'http://www.gamegape.com/',
# Why: #7136 in Alexa global
'http://www.ocioso.com.br/',
# Why: #7138 in Alexa global
'http://www.register.com/',
# Why: #7139 in Alexa global
'http://www.wwitv.com/',
# Why: #7140 in Alexa global
'http://www.ishangman.com/',
# Why: #7141 in Alexa global
'http://www.gry-online.pl/',
# Why: #7142 in Alexa global
'http://www.ogli.org/',
# Why: #7143 in Alexa global
'http://www.redbull.com/',
# Why: #7144 in Alexa global
'http://www.dyn.com/',
# Why: #7145 in Alexa global
'http://www.freeservers.com/',
# Why: #7146 in Alexa global
'http://www.brandsoftheworld.com/',
# Why: #7147 in Alexa global
'http://www.lorddownload.com/',
# Why: #7148 in Alexa global
'http://www.epson.co.jp/',
# Why: #7149 in Alexa global
'http://www.mybet.com/',
# Why: #7150 in Alexa global
'http://www.brothalove.com/',
# Why: #7151 in Alexa global
'http://www.inchallah.com/',
# Why: #7153 in Alexa global
'http://www.lottomatica.it/',
# Why: #7154 in Alexa global
'http://www.indiamp3.com/',
# Why: #7155 in Alexa global
'http://www.qianbao666.com/',
# Why: #7156 in Alexa global
'http://www.zurb.com/',
# Why: #7157 in Alexa global
'http://www.synxis.com/',
# Why: #7158 in Alexa global
'http://www.baskino.com/',
# Why: #7159 in Alexa global
'http://www.swefilmer.com/',
# Why: #7160 in Alexa global
'http://www.hotstartsearch.com/',
# Why: #7161 in Alexa global
'http://www.cloudmoney.info/',
# Why: #7162 in Alexa global
'http://www.polldaddy.com/',
# Why: #7163 in Alexa global
'http://www.moheet.com/',
# Why: #7164 in Alexa global
'http://www.idhostinger.com/',
# Why: #7166 in Alexa global
'http://www.mp3chief.com/',
# Why: #7167 in Alexa global
'http://www.7netshopping.jp/',
# Why: #7168 in Alexa global
'http://www.tao123.com/',
# Why: #7169 in Alexa global
'http://www.channelnewsasia.com/',
# Why: #7170 in Alexa global
'http://www.yahoo-help.jp/',
# Why: #7171 in Alexa global
'http://www.galeon.com/',
# Why: #7172 in Alexa global
'http://www.aviasales.ru/',
# Why: #7173 in Alexa global
'http://www.datafilehost.com/',
# Why: #7174 in Alexa global
'http://www.travian.com.eg/',
# Why: #7175 in Alexa global
'http://www.ebookee.org/',
# Why: #7176 in Alexa global
'http://www.filmstarts.de/',
# Why: #7177 in Alexa global
'http://www.inccel.com/',
# Why: #7178 in Alexa global
'http://www.chatroulette.com/',
# Why: #7179 in Alexa global
'http://www.it-ebooks.info/',
# Why: #7180 in Alexa global
'http://www.sina.com.tw/',
# Why: #7181 in Alexa global
'http://www.nix.ru/',
# Why: #7182 in Alexa global
'http://www.antena3.ro/',
# Why: #7183 in Alexa global
'http://www.mylifetime.com/',
# Why: #7184 in Alexa global
'http://www.desitorrents.com/',
# Why: #7185 in Alexa global
'http://www.mydigitallife.info/',
# Why: #7186 in Alexa global
'http://www.aeropostale.com/',
# Why: #7187 in Alexa global
'http://www.anilos.com/',
# Why: #7188 in Alexa global
'http://www.macadogru.com/',
# Why: #7189 in Alexa global
'http://www.premiere.fr/',
# Why: #7190 in Alexa global
'http://www.estorebuilder.com/',
# Why: #7191 in Alexa global
'http://www.eventim.de/',
# Why: #7192 in Alexa global
'http://www.expert-offers.com/',
# Why: #7193 in Alexa global
'http://www.deloitte.com/',
# Why: #7194 in Alexa global
'http://www.thetimenow.com/',
# Why: #7195 in Alexa global
'http://www.spicybigbutt.com/',
# Why: #7196 in Alexa global
'http://www.gistmania.com/',
# Why: #7197 in Alexa global
'http://www.pekao24.pl/',
# Why: #7198 in Alexa global
'http://www.mbok.jp/',
# Why: #7199 in Alexa global
'http://www.linkfeed.ru/',
# Why: #7200 in Alexa global
'http://www.carnival.com/',
# Why: #7201 in Alexa global
'http://www.apherald.com/',
# Why: #7202 in Alexa global
'http://www.choicehotels.com/',
# Why: #7203 in Alexa global
'http://www.revolvermaps.com/',
# Why: #7204 in Alexa global
'http://digu.com/',
# Why: #7205 in Alexa global
'http://www.yekmobile.com/',
# Why: #7206 in Alexa global
'http://www.barbarianmovies.com/',
# Why: #7207 in Alexa global
'http://www.jogos.uol.com.br/',
# Why: #7208 in Alexa global
'http://www.poyopara.com/',
# Why: #7209 in Alexa global
'http://www.vse.kz/',
# Why: #7210 in Alexa global
'http://www.socialspark.com/',
# Why: #7211 in Alexa global
'http://www.deutschepost.de/',
# Why: #7212 in Alexa global
'http://www.nokaut.pl/',
# Why: #7214 in Alexa global
'http://www.farpost.ru/',
# Why: #7215 in Alexa global
'http://www.shoebuy.com/',
# Why: #7216 in Alexa global
'http://www.1c-bitrix.ru/',
# Why: #7217 in Alexa global
'http://www.pimproll.com/',
# Why: #7218 in Alexa global
'http://www.startxchange.com/',
# Why: #7219 in Alexa global
'http://www.seocentro.com/',
# Why: #7220 in Alexa global
'http://www.kporno.com/',
# Why: #7221 in Alexa global
'http://www.izvestia.ru/',
# Why: #7222 in Alexa global
'http://www.bathandbodyworks.com/',
# Why: #7223 in Alexa global
'http://www.allhyipmonitors.com/',
# Why: #7224 in Alexa global
'http://www.europe1.fr/',
# Why: #7225 in Alexa global
'http://www.charter.com/',
# Why: #7226 in Alexa global
'http://www.sixflags.com/',
# Why: #7227 in Alexa global
'http://www.abcjuegos.net/',
# Why: #7228 in Alexa global
'http://www.wind.it/',
# Why: #7229 in Alexa global
'http://www.femjoy.com/',
# Why: #7230 in Alexa global
'http://www.humanmetrics.com/',
# Why: #7231 in Alexa global
'http://www.myrealgames.com/',
# Why: #7232 in Alexa global
'http://www.cosmiq.de/',
# Why: #7233 in Alexa global
'http://www.bangbrosteenporn.com/',
# Why: #7234 in Alexa global
'http://www.kir.jp/',
# Why: #7235 in Alexa global
'http://www.thepetitionsite.com/',
# Why: #7236 in Alexa global
'http://laprensa.com.ni/',
# Why: #7237 in Alexa global
'http://www.investors.com/',
# Why: #7238 in Alexa global
'http://www.techpowerup.com/',
# Why: #7239 in Alexa global
'http://www.prosperityteam.com/',
# Why: #7240 in Alexa global
'http://www.autogidas.lt/',
# Why: #7241 in Alexa global
'http://www.state.ny.us/',
# Why: #7242 in Alexa global
'http://www.techbargains.com/',
# Why: #7243 in Alexa global
'http://www.takvim.com.tr/',
# Why: #7244 in Alexa global
'http://www.kko-appli.com/',
# Why: #7245 in Alexa global
'http://www.liex.ru/',
# Why: #7246 in Alexa global
'http://www.cafe24.com/',
# Why: #7247 in Alexa global
'http://www.definebabe.com/',
# Why: #7248 in Alexa global
'http://www.egirlgames.net/',
# Why: #7249 in Alexa global
'http://www.avangard.ru/',
# Why: #7250 in Alexa global
'http://www.sina.com.hk/',
# Why: #7251 in Alexa global
'http://www.freexcafe.com/',
# Why: #7252 in Alexa global
'http://www.vesti.bg/',
# Why: #7253 in Alexa global
'http://www.francetvinfo.fr/',
# Why: #7254 in Alexa global
'http://www.mathsisfun.com/',
# Why: #7255 in Alexa global
'http://www.easymobilerecharge.com/',
# Why: #7256 in Alexa global
'http://www.dapink.com/',
# Why: #7257 in Alexa global
'http://www.propellerads.com/',
# Why: #7258 in Alexa global
'http://www.devshed.com/',
# Why: #7259 in Alexa global
'http://www.clip.vn/',
# Why: #7260 in Alexa global
'http://www.vidivodo.com/',
# Why: #7262 in Alexa global
'http://www.blogspot.dk/',
# Why: #7263 in Alexa global
'http://www.foxnewsinsider.com/',
# Why: #7264 in Alexa global
'http://www.instapaper.com/',
# Why: #7265 in Alexa global
'http://www.premierleague.com/',
# Why: #7266 in Alexa global
'http://www.elo7.com.br/',
# Why: #7267 in Alexa global
'http://www.teenee.com/',
# Why: #7268 in Alexa global
'http://www.clien.net/',
# Why: #7269 in Alexa global
'http://www.computrabajo.com.co/',
# Why: #7270 in Alexa global
'http://www.komputronik.pl/',
# Why: #7271 in Alexa global
'http://www.livesurf.ru/',
# Why: #7272 in Alexa global
'http://www.123cha.com/',
# Why: #7273 in Alexa global
'http://www.cgg.gov.in/',
# Why: #7274 in Alexa global
'http://www.leadimpact.com/',
# Why: #7275 in Alexa global
'http://www.socialmonkee.com/',
# Why: #7276 in Alexa global
'http://www.speeddate.com/',
# Why: #7277 in Alexa global
'http://www.bet-at-home.com/',
# Why: #7278 in Alexa global
'http://www.todaoferta.uol.com.br/',
# Why: #7279 in Alexa global
'http://www.huanqiuauto.com/',
# Why: #7280 in Alexa global
'http://www.tadawul.com.sa/',
# Why: #7281 in Alexa global
'http://www.ucsd.edu/',
# Why: #7282 in Alexa global
'http://www.fda.gov/',
# Why: #7283 in Alexa global
'http://www.asahi-net.or.jp/',
# Why: #7284 in Alexa global
'http://www.cint.com/',
# Why: #7285 in Alexa global
'http://www.homedepot.ca/',
# Why: #7286 in Alexa global
'http://www.webcars.com.cn/',
# Why: #7288 in Alexa global
'http://www.ciao.de/',
# Why: #7289 in Alexa global
'http://www.gigglesglore.com/',
# Why: #7290 in Alexa global
'http://www.warframe.com/',
# Why: #7291 in Alexa global
'http://www.mulher.uol.com.br/',
# Why: #7292 in Alexa global
'http://www.prosieben.de/',
# Why: #7293 in Alexa global
'http://www.vistaprint.in/',
# Why: #7294 in Alexa global
'http://www.mapple.net/',
# Why: #7295 in Alexa global
'http://www.usafis.org/',
# Why: #7296 in Alexa global
'http://www.kuaipan.cn/',
# Why: #7297 in Alexa global
'http://www.truelife.com/',
# Why: #7298 in Alexa global
'http://1o26.com/',
# Why: #7299 in Alexa global
'http://www.boldsky.com/',
# Why: #7300 in Alexa global
'http://www.freeforums.org/',
# Why: #7301 in Alexa global
'http://www.lolnexus.com/',
# Why: #7302 in Alexa global
'http://ti-da.net/',
# Why: #7303 in Alexa global
'http://www.handelsbanken.se/',
# Why: #7304 in Alexa global
'http://www.khamsat.com/',
# Why: #7305 in Alexa global
'http://www.futbol24.com/',
# Why: #7306 in Alexa global
'http://www.wikifeet.com/',
# Why: #7307 in Alexa global
'http://www.dev-point.com/',
# Why: #7308 in Alexa global
'http://www.ibotoolbox.com/',
# Why: #7309 in Alexa global
'http://www.indeed.de/',
# Why: #7310 in Alexa global
'http://www.ct10000.com/',
# Why: #7311 in Alexa global
'http://www.appleinsider.com/',
# Why: #7312 in Alexa global
'http://www.lyoness.net/',
# Why: #7313 in Alexa global
'http://www.vodafone.com.eg/',
# Why: #7314 in Alexa global
'http://www.aifang.com/',
# Why: #7315 in Alexa global
'http://www.tripadvisor.com.br/',
# Why: #7316 in Alexa global
'http://www.hbo.com/',
# Why: #7317 in Alexa global
'http://www.pricerunner.com/',
# Why: #7318 in Alexa global
'http://www.4everproxy.com/',
# Why: #7319 in Alexa global
'http://www.fc-perspolis.com/',
# Why: #7320 in Alexa global
'http://www.themobileindian.com/',
# Why: #7321 in Alexa global
'http://www.gimp.org/',
# Why: #7322 in Alexa global
'http://www.novayagazeta.ru/',
# Why: #7323 in Alexa global
'http://www.dnfight.com/',
# Why: #7324 in Alexa global
'http://www.coco.fr/',
# Why: #7325 in Alexa global
'http://www.thestudentroom.co.uk/',
# Why: #7326 in Alexa global
'http://www.tiin.vn/',
# Why: #7327 in Alexa global
'http://www.dailystar.co.uk/',
# Why: #7328 in Alexa global
'http://www.empowernetwork.com/commissionloophole.php/',
# Why: #7329 in Alexa global
'http://www.unfollowed.me/',
# Why: #7330 in Alexa global
'http://www.wanfangdata.com.cn/',
# Why: #7331 in Alexa global
'http://www.aljazeerasport.net/',
# Why: #7332 in Alexa global
'http://www.nasygnale.pl/',
# Why: #7333 in Alexa global
'http://www.somethingawful.com/',
# Why: #7334 in Alexa global
'http://www.ddo.jp/',
# Why: #7335 in Alexa global
'http://www.scamadviser.com/',
# Why: #7336 in Alexa global
'http://www.mcanime.net/',
# Why: #7337 in Alexa global
'http://www.9stock.com/',
# Why: #7338 in Alexa global
'http://www.boostmobile.com/',
# Why: #7339 in Alexa global
'http://www.oyunkolu.com/',
# Why: #7340 in Alexa global
'http://www.beliefnet.com/',
# Why: #7341 in Alexa global
'http://www.lyrics007.com/',
# Why: #7342 in Alexa global
'http://www.rtv.net/',
# Why: #7343 in Alexa global
'http://www.hasbro.com/',
# Why: #7344 in Alexa global
'http://www.vcp.ir/',
# Why: #7345 in Alexa global
'http://www.fj-p.com/',
# Why: #7346 in Alexa global
'http://www.jetbrains.com/',
# Why: #7347 in Alexa global
'http://www.empowernetwork.com/almostasecret.php/',
# Why: #7348 in Alexa global
'http://www.cpalead.com/',
# Why: #7349 in Alexa global
'http://www.zetaboards.com/',
# Why: #7350 in Alexa global
'http://www.sbobet.com/',
# Why: #7351 in Alexa global
'http://www.v2ex.com/',
# Why: #7352 in Alexa global
'http://xsrv.jp/',
# Why: #7353 in Alexa global
'http://www.toggle.com/',
# Why: #7354 in Alexa global
'http://www.lanebryant.com/',
# Why: #7355 in Alexa global
'http://www.girlgames4u.com/',
# Why: #7356 in Alexa global
'http://www.amadershomoy1.com/',
# Why: #7357 in Alexa global
'http://www.planalto.gov.br/',
# Why: #7358 in Alexa global
'http://news-choice.net/',
# Why: #7359 in Alexa global
'http://sarkarinaukriblog.com/',
# Why: #7360 in Alexa global
'http://www.sudouest.fr/',
# Why: #7361 in Alexa global
'http://www.zdomo.com/',
# Why: #7362 in Alexa global
'http://www.egy-nn.com/',
# Why: #7363 in Alexa global
'http://www.pizzaplot.com/',
# Why: #7364 in Alexa global
'http://www.topgear.com/',
# Why: #7365 in Alexa global
'http://www.sony.co.in/',
# Why: #7366 in Alexa global
'http://www.nosv.org/',
# Why: #7367 in Alexa global
'http://www.beppegrillo.it/',
# Why: #7368 in Alexa global
'http://www.sakshieducation.com/',
# Why: #7370 in Alexa global
'http://www.temagay.com/',
# Why: #7371 in Alexa global
'http://www.stepashka.com/',
# Why: #7372 in Alexa global
'http://www.tmart.com/',
# Why: #7373 in Alexa global
'http://www.readwrite.com/',
# Why: #7374 in Alexa global
'http://www.tudiscoverykids.com/',
# Why: #7375 in Alexa global
'http://www.belfius.be/',
# Why: #7376 in Alexa global
'http://www.submitexpress.com/',
# Why: #7377 in Alexa global
'http://www.autoscout24.ch/',
# Why: #7378 in Alexa global
'http://www.aetna.com/',
# Why: #7379 in Alexa global
'http://www.torrent-anime.com/',
# Why: #7380 in Alexa global
'http://www.superhqporn.com/',
# Why: #7381 in Alexa global
'http://www.kaufda.de/',
# Why: #7382 in Alexa global
'http://www.adorocinema.com/',
# Why: #7383 in Alexa global
'http://www.burning-seri.es/',
# Why: #7384 in Alexa global
'http://www.rlsbb.com/',
# Why: #7385 in Alexa global
'http://www.lativ.com.tw/',
# Why: #7386 in Alexa global
'http://www.housing.co.in/',
# Why: #7387 in Alexa global
'http://www.taiwanlottery.com.tw/',
# Why: #7388 in Alexa global
'http://www.invisionfree.com/',
# Why: #7389 in Alexa global
'http://www.istruzione.it/',
# Why: #7390 in Alexa global
'http://www.desk.com/',
# Why: #7391 in Alexa global
'http://www.lyricsmint.com/',
# Why: #7392 in Alexa global
'http://www.taohuopu.com/',
# Why: #7393 in Alexa global
'http://www.silverdaddies.com/',
# Why: #7394 in Alexa global
'http://www.gov.cl/',
# Why: #7395 in Alexa global
'http://www.vtc.vn/',
# Why: #7397 in Alexa global
'http://www.tanea.gr/',
# Why: #7398 in Alexa global
'http://www.labirint.ru/',
# Why: #7399 in Alexa global
'http://www.sns104.com/',
# Why: #7400 in Alexa global
'http://www.plu.cn/',
# Why: #7401 in Alexa global
'http://www.bigpicture.ru/',
# Why: #7402 in Alexa global
'http://www.marketo.com/',
# Why: #7403 in Alexa global
'http://www.ismmagic.com/',
# Why: #7404 in Alexa global
'http://www.c-sharpcorner.com/',
# Why: #7405 in Alexa global
'http://www.synacor.com/',
# Why: #7406 in Alexa global
'http://www.answered-questions.com/',
# Why: #7407 in Alexa global
'http://www.prlog.ru/',
# Why: #7408 in Alexa global
'http://www.vodafone.com.tr/',
# Why: #7409 in Alexa global
'http://www.yofoto.cn/',
# Why: #7410 in Alexa global
'http://www.thenews.com.pk/',
# Why: #7411 in Alexa global
'http://www.galaxygiftcard.com/',
# Why: #7412 in Alexa global
'http://www.job-search-engine.com/',
# Why: #7413 in Alexa global
'http://www.se.pl/',
# Why: #7414 in Alexa global
'http://www.consumercomplaints.in/',
# Why: #7415 in Alexa global
'http://www.265.com/',
# Why: #7416 in Alexa global
'http://www.cba.pl/',
# Why: #7417 in Alexa global
'http://www.humoron.com/',
# Why: #7418 in Alexa global
'http://www.uscourts.gov/',
# Why: #7419 in Alexa global
'http://www.blog.pl/',
# Why: #7421 in Alexa global
'http://youtu.be/',
# Why: #7422 in Alexa global
'http://www.play4free.com/',
# Why: #7423 in Alexa global
'http://www.blizko.ru/',
# Why: #7424 in Alexa global
'http://www.uswebproxy.com/',
# Why: #7425 in Alexa global
'http://www.housefun.com.tw/',
# Why: #7426 in Alexa global
'http://www.winning-play.com/',
# Why: #7427 in Alexa global
'http://www.yourstory.in/',
# Why: #7428 in Alexa global
'http://www.tinmoi.vn/',
# Why: #7429 in Alexa global
'http://www.yongchuntang.net/',
# Why: #7430 in Alexa global
'http://www.artofmanliness.com/',
# Why: #7431 in Alexa global
'http://www.nadaguides.com/',
# Why: #7432 in Alexa global
'http://www.ndr.de/',
# Why: #7433 in Alexa global
'http://www.kuidle.com/',
# Why: #7434 in Alexa global
'http://www.hopy.com/',
# Why: #7435 in Alexa global
'http://www.roi.ru/',
# Why: #7436 in Alexa global
'http://www.sdpnoticias.com/',
# Why: #7437 in Alexa global
'http://www.nation.com/',
# Why: #7438 in Alexa global
'http://www.gnu.org/',
# Why: #7439 in Alexa global
'http://www.vogue.co.uk/',
# Why: #7440 in Alexa global
'http://www.letsebuy.com/',
# Why: #7441 in Alexa global
'http://www.preloved.co.uk/',
# Why: #7442 in Alexa global
'http://www.yatedo.com/',
# Why: #7443 in Alexa global
'http://www.rs-online.com/',
# Why: #7444 in Alexa global
'http://www.kino-teatr.ru/',
# Why: #7445 in Alexa global
'http://www.meeticaffinity.fr/',
# Why: #7446 in Alexa global
'http://www.clip.dj/',
# Why: #7447 in Alexa global
'http://www.j-sen.jp/',
# Why: #7448 in Alexa global
'http://www.compete.com/',
# Why: #7449 in Alexa global
'http://pravda.sk/',
# Why: #7450 in Alexa global
'http://www.oursogo.com/',
# Why: #7451 in Alexa global
'http://www.designyourway.net/',
# Why: #7452 in Alexa global
'http://www.elcorreo.com/',
# Why: #7453 in Alexa global
'http://www.williamhill.es/',
# Why: #7454 in Alexa global
'http://www.lavenir.net/',
# Why: #7455 in Alexa global
'http://www.voyage-prive.es/',
# Why: #7456 in Alexa global
'http://www.teambeachbody.com/',
# Why: #7457 in Alexa global
'http://www.sportdog.gr/',
# Why: #7458 in Alexa global
'http://www.klicktel.de/',
# Why: #7459 in Alexa global
'http://www.ktonanovenkogo.ru/',
# Why: #7460 in Alexa global
'http://www.sbwire.com/',
# Why: #7461 in Alexa global
'http://www.pearsoncmg.com/',
# Why: #7462 in Alexa global
'http://www.bankifsccode.com/',
# Why: #7463 in Alexa global
'http://www.thenationonlineng.net/',
# Why: #7464 in Alexa global
'http://www.itp.ne.jp/',
# Why: #7465 in Alexa global
'http://www.bangbros1.com/',
# Why: #7466 in Alexa global
'http://www.tarot.com/',
# Why: #7467 in Alexa global
'http://www.acdsee.com/',
# Why: #7468 in Alexa global
'http://www.blogos.com/',
# Why: #7469 in Alexa global
'http://www.dinnerwithmariah.com/',
# Why: #7470 in Alexa global
'http://www.japan-women-dating.com/',
# Why: #7471 in Alexa global
'http://www.sarzamindownload.com/',
# Why: #7472 in Alexa global
'http://www.timesonline.co.uk/',
# Why: #7473 in Alexa global
'http://okbuy.com/',
# Why: #7474 in Alexa global
'http://www.sbb.ch/',
# Why: #7475 in Alexa global
'http://www.mundogaturro.com/',
# Why: #7476 in Alexa global
'http://www.meinvz.net/',
# Why: #7477 in Alexa global
'http://www.trafficadbar.com/',
# Why: #7478 in Alexa global
'http://www.9minecraft.net/',
# Why: #7479 in Alexa global
'http://www.suntory.co.jp/',
# Why: #7480 in Alexa global
'http://www.nextbigwhat.com/',
# Why: #7481 in Alexa global
'http://www.eshetab.com/',
# Why: #7482 in Alexa global
'http://www.meristation.com/',
# Why: #7483 in Alexa global
'http://www.kalahari.com/',
# Why: #7484 in Alexa global
'http://www.pimpandhost.com/',
# Why: #7485 in Alexa global
'http://www.pbworks.com/',
# Why: #7486 in Alexa global
'http://www.peopledaily.com.cn/',
# Why: #7487 in Alexa global
'http://www.bokee.net/',
# Why: #7488 in Alexa global
'http://www.google.ps/',
# Why: #7489 in Alexa global
'http://www.seccionamarilla.com.mx/',
# Why: #7490 in Alexa global
'http://www.foroactivo.com/',
# Why: #7491 in Alexa global
'http://www.gizmodo.jp/',
# Why: #7492 in Alexa global
'http://www.kalaydo.de/',
# Why: #7493 in Alexa global
'http://www.gomaji.com/',
# Why: #7494 in Alexa global
'http://www.exactseek.com/',
# Why: #7495 in Alexa global
'http://www.cashtaller.ru/',
# Why: #7496 in Alexa global
'http://www.blogspot.co.nz/',
# Why: #7497 in Alexa global
'http://www.volvocars.com/',
# Why: #7498 in Alexa global
'http://www.marathonbet.com/',
# Why: #7499 in Alexa global
'http://www.cityhouse.cn/',
# Why: #7500 in Alexa global
'http://www.hk-pub.com/',
# Why: #7501 in Alexa global
'http://www.seriouslyfacts.me/',
# Why: #7502 in Alexa global
'http://www.streetdirectory.com/',
# Why: #7504 in Alexa global
'http://www.mediamasr.tv/',
# Why: #7505 in Alexa global
'http://www.straitstimes.com/',
# Why: #7506 in Alexa global
'http://www.promodj.com/',
# Why: #7507 in Alexa global
'http://www.3dwwwgame.com/',
# Why: #7508 in Alexa global
'http://www.autovit.ro/',
# Why: #7509 in Alexa global
'http://www.ahlalhdeeth.com/',
# Why: #7510 in Alexa global
'http://www.forum-auto.com/',
# Why: #7511 in Alexa global
'http://www.stooorage.com/',
# Why: #7512 in Alexa global
'http://www.mobilism.org/',
# Why: #7513 in Alexa global
'http://www.hideref.org/',
# Why: #7514 in Alexa global
'http://www.mn66.com/',
# Why: #7515 in Alexa global
'http://www.internations.org/',
# Why: #7516 in Alexa global
'http://www.dhc.co.jp/',
# Why: #7517 in Alexa global
'http://www.sbicard.com/',
# Why: #7518 in Alexa global
'http://www.dayoo.com/',
# Why: #7519 in Alexa global
'http://biquge.com/',
# Why: #7520 in Alexa global
'http://www.theme.wordpress.com/',
# Why: #7521 in Alexa global
'http://www.mrdoob.com/',
# Why: #7522 in Alexa global
'http://www.vpls.net/',
# Why: #7523 in Alexa global
'http://www.alquma-a.com/',
# Why: #7524 in Alexa global
'http://www.bankmillennium.pl/',
# Why: #7525 in Alexa global
'http://www.mitele.es/',
# Why: #7526 in Alexa global
'http://www.tro-ma-ktiko.blogspot.gr/',
# Why: #7527 in Alexa global
'http://www.bookmark4you.com/',
# Why: #7530 in Alexa global
'http://www.tencent.com/',
# Why: #7531 in Alexa global
'http://www.bsi.ir/',
# Why: #7532 in Alexa global
'http://t.cn/',
# Why: #7533 in Alexa global
'http://www.fox.com/',
# Why: #7534 in Alexa global
'http://www.payback.de/',
# Why: #7535 in Alexa global
'http://www.tubepornfilm.com/',
# Why: #7536 in Alexa global
'http://www.herold.at/',
# Why: #7537 in Alexa global
'http://www.elperiodico.com/',
# Why: #7538 in Alexa global
'http://www.lolesports.com/',
# Why: #7539 in Alexa global
'http://www.hrs.de/',
# Why: #7540 in Alexa global
'http://www.trustlink.ru/',
# Why: #7541 in Alexa global
'http://www.pricemachine.com/',
# Why: #7542 in Alexa global
'http://www.zombie.jp/',
# Why: #7543 in Alexa global
'http://www.socialadr.com/',
# Why: #7544 in Alexa global
'http://www.anandabazar.com/',
# Why: #7545 in Alexa global
'http://www.jacquieetmicheltv2.net/',
# Why: #7546 in Alexa global
'http://www.monster.de/',
# Why: #7547 in Alexa global
'http://www.allposters.com/',
# Why: #7548 in Alexa global
'http://www.blog.ir/',
# Why: #7549 in Alexa global
'http://www.ad4game.com/',
# Why: #7550 in Alexa global
'http://www.alkislarlayasiyorum.com/',
# Why: #7551 in Alexa global
'http://www.ptcsolution.com/',
# Why: #7552 in Alexa global
'http://www.moviepilot.com/',
# Why: #7553 in Alexa global
'http://www.ddizi.org/',
# Why: #7554 in Alexa global
'http://dmzj.com/',
# Why: #7555 in Alexa global
'http://www.onvasortir.com/',
# Why: #7556 in Alexa global
'http://www.ferronetwork.com/',
# Why: #7557 in Alexa global
'http://www.seagate.com/',
# Why: #7558 in Alexa global
'http://www.starmedia.com/',
# Why: #7559 in Alexa global
'http://www.topit.me/',
# Why: #7560 in Alexa global
'http://www.alexa.cn/',
# Why: #7561 in Alexa global
'http://www.developpez.net/',
# Why: #7562 in Alexa global
'http://www.papajogos.com.br/',
# Why: #7563 in Alexa global
'http://www.btalah.com/',
# Why: #7564 in Alexa global
'http://www.gateway.gov.uk/',
# Why: #7565 in Alexa global
'http://www.fotki.com/',
# Why: #7566 in Alexa global
'http://www.holidaylettings.co.uk/',
# Why: #7567 in Alexa global
'http://www.rzeczpospolita.pl/',
# Why: #7569 in Alexa global
'http://www.charter97.org/',
# Why: #7570 in Alexa global
'http://www.robtex.com/',
# Why: #7571 in Alexa global
'http://bestadbid.com/',
# Why: #7572 in Alexa global
'http://www.unblog.fr/',
# Why: #7573 in Alexa global
'http://www.archive.is/',
# Why: #7574 in Alexa global
'http://www.microworkers.com/',
# Why: #7575 in Alexa global
'http://www.vbulletin.org/',
# Why: #7576 in Alexa global
'http://www.jetswap.com/',
# Why: #7577 in Alexa global
'http://www.badoink.com/',
# Why: #7578 in Alexa global
'http://www.adobeconnect.com/',
# Why: #7579 in Alexa global
'http://www.cutt.us/',
# Why: #7580 in Alexa global
'http://lovemake.biz/',
# Why: #7581 in Alexa global
'http://www.xpress.com/',
# Why: #7582 in Alexa global
'http://www.di.se/',
# Why: #7583 in Alexa global
'http://www.ppomppu.co.kr/',
# Why: #7584 in Alexa global
'http://www.jacquielawson.com/',
# Why: #7585 in Alexa global
'http://www.sat1.de/',
# Why: #7586 in Alexa global
'http://www.adshuffle.com/',
# Why: #7587 in Alexa global
'http://www.homepage.com.tr/',
# Why: #7588 in Alexa global
'http://www.treehugger.com/',
# Why: #7589 in Alexa global
'http://www.selectornews.com/',
# Why: #7590 in Alexa global
'http://www.dap-news.com/',
# Why: #7591 in Alexa global
'http://www.tvline.com/',
# Why: #7592 in Alexa global
'http://www.co188.com/',
# Why: #7593 in Alexa global
'http://www.bfmtv.com/',
# Why: #7594 in Alexa global
'http://www.nastygal.com/',
# Why: #7595 in Alexa global
'http://www.cebupacificair.com/',
# Why: #7596 in Alexa global
'http://www.spr.ru/',
# Why: #7597 in Alexa global
'http://www.vazeh.com/',
# Why: #7598 in Alexa global
'http://www.worldmarket.com/',
# Why: #7599 in Alexa global
'http://www.americanlivewire.com/',
# Why: #7600 in Alexa global
'http://www.befunky.com/',
# Why: #7601 in Alexa global
'http://www.movie2k.tl/',
# Why: #7602 in Alexa global
'http://www.coach.com/',
# Why: #7603 in Alexa global
'http://www.whattoexpect.com/',
# Why: #7604 in Alexa global
'http://www.share-online.biz/',
# Why: #7605 in Alexa global
'http://www.fishwrapper.com/',
# Why: #7606 in Alexa global
'http://www.aktifhaber.com/',
# Why: #7607 in Alexa global
'http://www.downxsoft.com/',
# Why: #7608 in Alexa global
'http://www.websurf.ru/',
# Why: #7609 in Alexa global
'http://www.belluna.jp/',
# Why: #7610 in Alexa global
'http://www.bbcgoodfood.com/',
# Why: #7611 in Alexa global
'http://www.france2.fr/',
# Why: #7612 in Alexa global
'http://www.gyakorikerdesek.hu/',
# Why: #7614 in Alexa global
'http://www.lidovky.cz/',
# Why: #7615 in Alexa global
'http://www.thithtoolwin.info/',
# Why: #7616 in Alexa global
'http://www.psbc.com/',
# Why: #7617 in Alexa global
'http://www.766.com/',
# Why: #7618 in Alexa global
'http://www.co-operativebank.co.uk/',
# Why: #7619 in Alexa global
'http://www.iwriter.com/',
# Why: #7620 in Alexa global
'http://www.bravotv.com/',
# Why: #7621 in Alexa global
'http://www.e23.cn/',
# Why: #7622 in Alexa global
'http://www.empowernetwork.com/ublQXbhzgWgGAF9/',
# Why: #7623 in Alexa global
'http://www.sbs.com.au/',
# Why: #7624 in Alexa global
'http://www.dtiserv2.com/',
# Why: #7625 in Alexa global
'http://www.watchever.de/',
# Why: #7626 in Alexa global
'http://www.playhub.com/',
# Why: #7627 in Alexa global
'http://www.globovision.com/',
# Why: #7628 in Alexa global
'http://www.intereconomia.com/',
# Why: #7629 in Alexa global
'http://www.poznan.pl/',
# Why: #7630 in Alexa global
'http://www.comicbookmovie.com/',
# Why: #7632 in Alexa global
'http://www.ocomico.net/',
# Why: #7634 in Alexa global
'http://www.housetrip.com/',
# Why: #7635 in Alexa global
'http://www.freewebsubmission.com/',
# Why: #7636 in Alexa global
'http://www.karmaloop.com/',
# Why: #7637 in Alexa global
'http://www.savevid.com/',
# Why: #7638 in Alexa global
'http://www.lastpass.com/',
# Why: #7639 in Alexa global
'http://yougou.com/',
# Why: #7640 in Alexa global
'http://www.iafd.com/',
# Why: #7641 in Alexa global
'http://www.casertex.com/',
# Why: #7642 in Alexa global
'http://www.gmail.com/',
# Why: #7643 in Alexa global
'http://www.modhoster.de/',
# Why: #7644 in Alexa global
'http://www.post-gazette.com/',
# Why: #7645 in Alexa global
'http://www.digikey.com/',
# Why: #7646 in Alexa global
'http://www.torrentleech.org/',
# Why: #7647 in Alexa global
'http://www.stamps.com/',
# Why: #7648 in Alexa global
'http://www.lifestyleinsights.org/',
# Why: #7649 in Alexa global
'http://www.pandawill.com/',
# Why: #7650 in Alexa global
'http://www.wm-panel.com/',
# Why: #7651 in Alexa global
'http://www.um-per.com/',
# Why: #7652 in Alexa global
'http://www.straighttalk.com/',
# Why: #7653 in Alexa global
'http://www.xpersonals.com/',
# Why: #7655 in Alexa global
'http://www.bondfaro.com.br/',
# Why: #7656 in Alexa global
'http://www.tvrage.com/',
# Why: #7657 in Alexa global
'http://www.rockongags.com/',
# Why: #7658 in Alexa global
'http://www.4jok.com/',
# Why: #7659 in Alexa global
'http://www.zoom.com.br/',
# Why: #7660 in Alexa global
'http://www.cnn.co.jp/',
# Why: #7661 in Alexa global
'http://www.pixabay.com/',
# Why: #7662 in Alexa global
'http://www.path.com/',
# Why: #7663 in Alexa global
'http://www.hiphopdx.com/',
# Why: #7664 in Alexa global
'http://www.ptbus.com/',
# Why: #7665 in Alexa global
'http://www.fussball.de/',
# Why: #7666 in Alexa global
'http://www.windows.net/',
# Why: #7667 in Alexa global
'http://www.adweek.com/',
# Why: #7668 in Alexa global
'http://www.kraftrecipes.com/',
# Why: #7669 in Alexa global
'http://www.redtram.com/',
# Why: #7670 in Alexa global
'http://www.youravon.com/',
# Why: #7671 in Alexa global
'http://www.ladepeche.fr/',
# Why: #7672 in Alexa global
'http://www.jiwu.com/',
# Why: #7673 in Alexa global
'http://www.hobbylobby.com/',
# Why: #7674 in Alexa global
'http://www.otzyv.ru/',
# Why: #7675 in Alexa global
'http://www.sky-fire.com/',
# Why: #7676 in Alexa global
'http://www.fileguru.com/',
# Why: #7677 in Alexa global
'http://www.vandal.net/',
# Why: #7678 in Alexa global
'http://www.haozu.com/',
# Why: #7679 in Alexa global
'http://www.syd.com.cn/',
# Why: #7680 in Alexa global
'http://www.laxteams.net/',
# Why: #7681 in Alexa global
'http://www.cpvtrack202.com/',
# Why: #7682 in Alexa global
'http://www.libraryreserve.com/',
# Why: #7683 in Alexa global
'http://www.tvigle.ru/',
# Why: #7684 in Alexa global
'http://www.hoopshype.com/',
# Why: #7685 in Alexa global
'http://www.worldcat.org/',
# Why: #7686 in Alexa global
'http://www.eventful.com/',
# Why: #7687 in Alexa global
'http://www.nettiauto.com/',
# Why: #7688 in Alexa global
'http://www.generalfiles.org/',
# Why: #7689 in Alexa global
'http://www.ojooo.com/',
# Why: #7690 in Alexa global
'http://www.thatisnotasport.com/',
# Why: #7691 in Alexa global
'http://www.thepioneerwoman.com/',
# Why: #7692 in Alexa global
'http://www.social-bookmarking.net/',
# Why: #7693 in Alexa global
'http://www.lookforithere.info/',
# Why: #7694 in Alexa global
'http://www.americanapparel.net/',
# Why: #7695 in Alexa global
'http://www.protv.ro/',
# Why: #7696 in Alexa global
'http://www.jeux-gratuits.com/',
# Why: #7697 in Alexa global
'http://www.tomoson.com/',
# Why: #7698 in Alexa global
'http://www.jpn.org/',
# Why: #7699 in Alexa global
'http://www.cpz.to/',
# Why: #7700 in Alexa global
'http://www.vrisko.gr/',
# Why: #7701 in Alexa global
'http://www.cbox.ws/',
# Why: #7702 in Alexa global
'http://www.vandelaydesign.com/',
# Why: #7703 in Alexa global
'http://www.macmillandictionary.com/',
# Why: #7704 in Alexa global
'http://www.eventure.com/',
# Why: #7705 in Alexa global
'http://www.niniweblog.com/',
# Why: #7706 in Alexa global
'http://www.ecwid.com/',
# Why: #7708 in Alexa global
'http://www.garuda-indonesia.com/',
# Why: #7709 in Alexa global
'http://www.education.com/',
# Why: #7710 in Alexa global
'http://www.natalie.mu/',
# Why: #7711 in Alexa global
'http://www.gigsandfestivals.co.uk/',
# Why: #7712 in Alexa global
'http://www.onlainfilm.ucoz.ua/',
# Why: #7713 in Alexa global
'http://www.hotwords.com/',
# Why: #7714 in Alexa global
'http://www.jagobd.com/',
# Why: #7715 in Alexa global
'http://www.pageset.com/',
# Why: #7716 in Alexa global
'http://www.sagepay.com/',
# Why: #7717 in Alexa global
'http://www.runkeeper.com/',
# Why: #7718 in Alexa global
'http://www.beeztube.com/',
# Why: #7719 in Alexa global
'http://www.pinla.com/',
# Why: #7720 in Alexa global
'http://www.blizzard.com/',
# Why: #7721 in Alexa global
'http://www.unc.edu/',
# Why: #7722 in Alexa global
'http://www.makememarvellous.com/',
# Why: #7723 in Alexa global
'http://www.wer-weiss-was.de/',
# Why: #7724 in Alexa global
'http://www.ubc.ca/',
# Why: #7725 in Alexa global
'http://www.utoronto.ca/',
# Why: #7726 in Alexa global
'http://www.avsforum.com/',
# Why: #7727 in Alexa global
'http://www.newrelic.com/',
# Why: #7728 in Alexa global
'http://www.orkut.co.in/',
# Why: #7729 in Alexa global
'http://www.wawa-mania.ec/',
# Why: #7730 in Alexa global
'http://www.tvuol.uol.com.br/',
# Why: #7731 in Alexa global
'http://www.ncsu.edu/',
# Why: #7732 in Alexa global
'http://www.ne.jp/',
# Why: #7733 in Alexa global
'http://www.redhat.com/',
# Why: #7734 in Alexa global
'http://www.toyota.jp/',
# Why: #7735 in Alexa global
'http://www.nsdl.co.in/',
# Why: #7736 in Alexa global
'http://www.lavoz.com.ar/',
# Why: #7737 in Alexa global
'http://www.navy.mil/',
# Why: #7738 in Alexa global
'http://www.mg.gov.br/',
# Why: #7739 in Alexa global
'http://gizmodo.uol.com.br/',
# Why: #7740 in Alexa global
'http://www.psychcentral.com/',
# Why: #7741 in Alexa global
'http://www.ultipro.com/',
# Why: #7742 in Alexa global
'http://www.unisa.ac.za/',
# Why: #7743 in Alexa global
'http://www.sooperarticles.com/',
# Why: #7744 in Alexa global
'http://www.wondershare.com/',
# Why: #7745 in Alexa global
'http://www.wholefoodsmarket.com/',
# Why: #7746 in Alexa global
'http://www.dumpaday.com/',
# Why: #7747 in Alexa global
'http://www.littlewoods.com/',
# Why: #7748 in Alexa global
'http://www.carscom.net/',
# Why: #7749 in Alexa global
'http://www.meitu.com/',
# Why: #7750 in Alexa global
'http://www.9lwan.com/',
# Why: #7751 in Alexa global
'http://www.emailmeform.com/',
# Why: #7752 in Alexa global
'http://www.arte.tv/',
# Why: #7753 in Alexa global
'http://www.tribalfootball.com/',
# Why: #7754 in Alexa global
'http://www.howtoforge.com/',
# Why: #7755 in Alexa global
'http://www.cvent.com/',
# Why: #7756 in Alexa global
'http://www.fujitsu.com/',
# Why: #7757 in Alexa global
'http://www.silvergames.com/',
# Why: #7758 in Alexa global
'http://www.tp-link.com.cn/',
# Why: #7759 in Alexa global
'http://www.fatlossfactor.com/',
# Why: #7760 in Alexa global
'http://www.nusport.nl/',
# Why: #7761 in Alexa global
'http://www.todo1.com/',
# Why: #7762 in Alexa global
'http://www.see-tube.com/',
# Why: #7763 in Alexa global
'http://www.lolspots.com/',
# Why: #7764 in Alexa global
'http://www.sucksex.com/',
# Why: #7765 in Alexa global
'http://www.encontreinarede.com/',
# Why: #7766 in Alexa global
'http://www.myarabylinks.com/',
# Why: #7767 in Alexa global
'http://www.v-39.net/',
# Why: #7769 in Alexa global
'http://www.soompi.com/',
# Why: #7770 in Alexa global
'http://www.mltdb.com/',
# Why: #7771 in Alexa global
'http://www.websitetonight.com/',
# Why: #7772 in Alexa global
'http://www.bu.edu/',
# Why: #7773 in Alexa global
'http://www.lazada.co.th/',
# Why: #7774 in Alexa global
'http://www.mature-money.com/',
# Why: #7775 in Alexa global
'http://www.simplemachines.org/',
# Why: #7776 in Alexa global
'http://www.tnt-online.ru/',
# Why: #7777 in Alexa global
'http://www.disput.az/',
# Why: #7779 in Alexa global
'http://www.flirtcafe.de/',
# Why: #7780 in Alexa global
'http://www.d1net.com/',
# Why: #7781 in Alexa global
'http://www.infoplease.com/',
# Why: #7782 in Alexa global
'http://www.unseenimages.co.in/',
# Why: #7783 in Alexa global
'http://www.downloadatoz.com/',
# Why: #7784 in Alexa global
'http://www.norwegian.com/',
# Why: #7785 in Alexa global
'http://www.youtradefx.com/',
# Why: #7786 in Alexa global
'http://www.petapixel.com/',
# Why: #7787 in Alexa global
'http://www.bytes.com/',
# Why: #7788 in Alexa global
'http://ht.ly/',
# Why: #7789 in Alexa global
'http://www.jobberman.com/',
# Why: #7790 in Alexa global
'http://www.xenforo.com/',
# Why: #7791 in Alexa global
'http://www.pomponik.pl/',
# Why: #7792 in Alexa global
'http://www.siambit.org/',
# Why: #7793 in Alexa global
'http://www.twoplustwo.com/',
# Why: #7794 in Alexa global
'http://www.videoslasher.com/',
# Why: #7795 in Alexa global
'http://www.onvista.de/',
# Why: #7796 in Alexa global
'http://www.shopping-search.jp/',
# Why: #7797 in Alexa global
'http://www.canstockphoto.com/',
# Why: #7798 in Alexa global
'http://www.cash4flirt.com/',
# Why: #7799 in Alexa global
'http://www.flashgames.it/',
# Why: #7800 in Alexa global
'http://www.xxxdessert.com/',
# Why: #7801 in Alexa global
'http://www.cda.pl/',
# Why: #7803 in Alexa global
'http://www.costco.ca/',
# Why: #7804 in Alexa global
'http://www.elnuevodiario.com.ni/',
# Why: #7805 in Alexa global
'http://www.svtplay.se/',
# Why: #7806 in Alexa global
'http://www.ftc.gov/',
# Why: #7807 in Alexa global
'http://www.supersonicads.com/',
# Why: #7808 in Alexa global
'http://www.openstreetmap.org/',
# Why: #7809 in Alexa global
'http://www.chinamobile.com/',
# Why: #7810 in Alexa global
'http://www.fastspring.com/',
# Why: #7811 in Alexa global
'http://www.eprice.com.tw/',
# Why: #7813 in Alexa global
'http://www.mcdonalds.com/',
# Why: #7814 in Alexa global
'http://www.egloos.com/',
# Why: #7815 in Alexa global
'http://www.mouser.com/',
# Why: #7816 in Alexa global
'http://livemook.com/',
# Why: #7817 in Alexa global
'http://www.woxiu.com/',
# Why: #7818 in Alexa global
'http://www.pingler.com/',
# Why: #7819 in Alexa global
'http://www.ruelsoft.org/',
# Why: #7820 in Alexa global
'http://www.krone.at/',
# Why: #7821 in Alexa global
'http://www.internetbookshop.it/',
# Why: #7822 in Alexa global
'http://www.alibaba-inc.com/',
# Why: #7823 in Alexa global
'http://www.kimsufi.com/',
# Why: #7824 in Alexa global
'http://www.summitracing.com/',
# Why: #7826 in Alexa global
'http://www.parsfootball.com/',
# Why: #7827 in Alexa global
'http://www.standard.co.uk/',
# Why: #7828 in Alexa global
'http://www.photoblog.pl/',
# Why: #7829 in Alexa global
'http://www.bicaps.com/',
# Why: #7830 in Alexa global
'http://www.digitalplayground.com/',
# Why: #7831 in Alexa global
'http://www.zerochan.net/',
# Why: #7832 in Alexa global
'http://www.whosay.com/',
# Why: #7833 in Alexa global
'http://www.qualityseek.org/',
# Why: #7834 in Alexa global
'http://www.say7.info/',
# Why: #7835 in Alexa global
'http://www.rs.gov.br/',
# Why: #7836 in Alexa global
'http://www.wps.cn/',
# Why: #7837 in Alexa global
'http://www.google.co.mz/',
# Why: #7838 in Alexa global
'http://www.yourlustmovies.com/',
# Why: #7839 in Alexa global
'http://www.zalando.nl/',
# Why: #7840 in Alexa global
'http://www.jn.pt/',
# Why: #7841 in Alexa global
'http://www.homebase.co.uk/',
# Why: #7842 in Alexa global
'http://www.avis.com/',
# Why: #7843 in Alexa global
'http://www.healthboards.com/',
# Why: #7844 in Alexa global
'http://www.filmizlesene.com.tr/',
# Why: #7845 in Alexa global
'http://www.shoutcast.com/',
# Why: #7846 in Alexa global
'http://www.konami.jp/',
# Why: #7847 in Alexa global
'http://www.indiafreestuff.in/',
# Why: #7848 in Alexa global
'http://www.avval.ir/',
# Why: #7849 in Alexa global
'http://www.gamingwonderland.com/',
# Why: #7850 in Alexa global
'http://www.adage.com/',
# Why: #7851 in Alexa global
'http://www.asu.edu/',
# Why: #7852 in Alexa global
'http://www.froma.com/',
# Why: #7853 in Alexa global
'http://www.bezuzyteczna.pl/',
# Why: #7854 in Alexa global
'http://www.workopolis.com/',
# Why: #7855 in Alexa global
'http://extranetinvestment.com/',
# Why: #7856 in Alexa global
'http://www.lablue.de/',
# Why: #7857 in Alexa global
'http://www.geotauaisay.com/',
# Why: #7858 in Alexa global
'http://www.bestchange.ru/',
# Why: #7859 in Alexa global
'http://www.ptp22.com/',
# Why: #7860 in Alexa global
'http://www.tehparadox.com/',
# Why: #7861 in Alexa global
'http://www.ox.ac.uk/',
# Why: #7862 in Alexa global
'http://www.radaris.com/',
# Why: #7863 in Alexa global
'http://www.domdigger.com/',
# Why: #7864 in Alexa global
'http://www.lizads.com/',
# Why: #7865 in Alexa global
'http://www.chatvl.com/',
# Why: #7866 in Alexa global
'http://www.elle.com/',
# Why: #7867 in Alexa global
'http://www.soloaqui.es/',
# Why: #7868 in Alexa global
'http://www.tubejuggs.com/',
# Why: #7869 in Alexa global
'http://www.jsonline.com/',
# Why: #7870 in Alexa global
'http://www.ut.ac.ir/',
# Why: #7871 in Alexa global
'http://www.iitv.info/',
# Why: #7872 in Alexa global
'http://www.runetki.tv/',
# Why: #7873 in Alexa global
'http://www.hyundai.com/',
# Why: #7874 in Alexa global
'http://www.turkiye.gov.tr/',
# Why: #7875 in Alexa global
'http://www.jobstreet.com.sg/',
# Why: #7877 in Alexa global
'http://www.jp-sex.com/',
# Why: #7878 in Alexa global
'http://www.soccer.ru/',
# Why: #7879 in Alexa global
'http://www.slashfilm.com/',
# Why: #7880 in Alexa global
'http://www.couchtuner.eu/',
# Why: #7881 in Alexa global
'http://quanfan.com/',
# Why: #7882 in Alexa global
'http://www.porsche.com/',
# Why: #7883 in Alexa global
'http://www.craftsy.com/',
# Why: #7884 in Alexa global
'http://www.geizhals.at/',
# Why: #7885 in Alexa global
'http://www.spartoo.it/',
# Why: #7886 in Alexa global
'http://yxku.com/',
# Why: #7887 in Alexa global
'http://www.vodonet.net/',
# Why: #7888 in Alexa global
'http://www.photo.net/',
# Why: #7889 in Alexa global
'http://www.raiffeisen.ru/',
# Why: #7890 in Alexa global
'http://www.tablotala.com/',
# Why: #7891 in Alexa global
'http://www.theaa.com/',
# Why: #7892 in Alexa global
'http://www.idownloadblog.com/',
# Why: #7894 in Alexa global
'http://www.rodfile.com/',
# Why: #7895 in Alexa global
'http://www.alabout.com/',
# Why: #7896 in Alexa global
'http://www.f1news.ru/',
# Why: #7897 in Alexa global
'http://www.divxstage.eu/',
# Why: #7898 in Alexa global
'http://www.itusozluk.com/',
# Why: #7899 in Alexa global
'http://www.tokyodisneyresort.co.jp/',
# Why: #7900 in Alexa global
'http://www.hicdma.com/',
# Why: #7901 in Alexa global
'http://www.dota2lounge.com/',
# Why: #7902 in Alexa global
'http://www.meizu.cn/',
# Why: #7903 in Alexa global
'http://www.greensmut.com/',
# Why: #7904 in Alexa global
'http://www.bharatiyamobile.com/',
# Why: #7905 in Alexa global
'http://www.handycafe.com/',
# Why: #7906 in Alexa global
'http://www.regarder-film-gratuit.com/',
# Why: #7907 in Alexa global
'http://www.adultgeek.net/',
# Why: #7908 in Alexa global
'http://www.yintai.com/',
# Why: #7909 in Alexa global
'http://www.brasilescola.com/',
# Why: #7910 in Alexa global
'http://www.verisign.com/',
# Why: #7911 in Alexa global
'http://www.dnslink.com/',
# Why: #7912 in Alexa global
'http://www.standaard.be/',
# Why: #7913 in Alexa global
'http://www.cbengine.com/',
# Why: #7914 in Alexa global
'http://www.pchealthboost.com/',
# Why: #7915 in Alexa global
'http://www.dealdey.com/',
# Why: #7916 in Alexa global
'http://www.cnnturk.com/',
# Why: #7917 in Alexa global
'http://www.trutv.com/',
# Why: #7918 in Alexa global
'http://www.tahrirnews.com/',
# Why: #7919 in Alexa global
'http://www.getit.in/',
# Why: #7920 in Alexa global
'http://www.jquerymobile.com/',
# Why: #7921 in Alexa global
'http://www.girlgames.com/',
# Why: #7922 in Alexa global
'http://www.alhayat.com/',
# Why: #7923 in Alexa global
'http://www.ilpvideo.com/',
# Why: #7924 in Alexa global
'http://www.stihi.ru/',
# Why: #7925 in Alexa global
'http://www.skyscanner.ru/',
# Why: #7926 in Alexa global
'http://www.jamejamonline.ir/',
# Why: #7927 in Alexa global
'http://www.t3n.de/',
# Why: #7928 in Alexa global
'http://www.rent.com/',
# Why: #7929 in Alexa global
'http://www.telerik.com/',
# Why: #7930 in Alexa global
'http://www.tandfonline.com/',
# Why: #7931 in Alexa global
'http://www.argonas.com/',
# Why: #7932 in Alexa global
'http://www.ludokado.com/',
# Why: #7933 in Alexa global
'http://www.luvgag.com/',
# Why: #7934 in Alexa global
'http://www.myspongebob.ru/',
# Why: #7935 in Alexa global
'http://www.z5x.net/',
# Why: #7936 in Alexa global
'http://www.allhyipmon.ru/',
# Why: #7937 in Alexa global
'http://www.fanswong.com/',
# Why: #7939 in Alexa global
'http://www.oddee.com/',
# Why: #7940 in Alexa global
'http://guoli.com/',
# Why: #7942 in Alexa global
'http://www.wpzoom.com/',
# Why: #7943 in Alexa global
'http://www.2gheroon.com/',
# Why: #7944 in Alexa global
'http://www.artisteer.com/',
# Why: #7945 in Alexa global
'http://www.share-links.biz/',
# Why: #7946 in Alexa global
'http://www.flightstats.com/',
# Why: #7947 in Alexa global
'http://www.wisegeek.org/',
# Why: #7948 in Alexa global
'http://www.shuangtv.net/',
# Why: #7949 in Alexa global
'http://www.mylikes.com/',
# Why: #7950 in Alexa global
'http://www.0zz0.com/',
# Why: #7951 in Alexa global
'http://www.xiu.com/',
# Why: #7952 in Alexa global
'http://www.pornizle69.com/',
# Why: #7953 in Alexa global
'http://www.sendgrid.com/',
# Why: #7954 in Alexa global
'http://theweek.com/',
# Why: #7955 in Alexa global
'http://www.veetle.com/',
# Why: #7956 in Alexa global
'http://www.theanimalrescuesite.com/',
# Why: #7957 in Alexa global
'http://www.sears.ca/',
# Why: #7958 in Alexa global
'http://www.tianpin.com/',
# Why: #7959 in Alexa global
'http://www.thisdaylive.com/',
# Why: #7960 in Alexa global
'http://www.myfunlife.com/',
# Why: #7961 in Alexa global
'http://www.furaffinity.net/',
# Why: #7962 in Alexa global
'http://www.politiken.dk/',
# Why: #7963 in Alexa global
'http://www.youwatch.org/',
# Why: #7965 in Alexa global
'http://www.lesoir.be/',
# Why: #7966 in Alexa global
'http://www.toyokeizai.net/',
# Why: #7967 in Alexa global
'http://www.centos.org/',
# Why: #7968 in Alexa global
'http://www.sunnyplayer.com/',
# Why: #7969 in Alexa global
'http://www.knuddels.de/',
# Why: #7970 in Alexa global
'http://www.mturk.com/',
# Why: #7971 in Alexa global
'http://www.egymodern.com/',
# Why: #7972 in Alexa global
'http://www.semprot.com/',
# Why: #7973 in Alexa global
'http://www.monsterhigh.com/',
# Why: #7974 in Alexa global
'http://www.kompass.com/',
# Why: #7975 in Alexa global
'http://www.olx.com.ve/',
# Why: #7976 in Alexa global
'http://www.hq-xnxx.com/',
# Why: #7977 in Alexa global
'http://www.whorush.com/',
# Why: #7978 in Alexa global
'http://www.bongdaso.com/',
# Why: #7979 in Alexa global
'http://www.centrelink.gov.au/',
# Why: #7980 in Alexa global
'http://www.folha.com.br/',
# Why: #7981 in Alexa global
'http://www.getjetso.com/',
# Why: #7982 in Alexa global
'http://www.ycombinator.com/',
# Why: #7983 in Alexa global
'http://www.chouti.com/',
# Why: #7984 in Alexa global
'http://www.33lc.com/',
# Why: #7985 in Alexa global
'http://www.empowernetwork.com/+LO9YhVOjRPGiarC7uA9iA==/',
# Why: #7986 in Alexa global
'http://www.hostgator.com.br/',
# Why: #7987 in Alexa global
'http://www.emirates247.com/',
# Why: #7988 in Alexa global
'http://www.itpub.net/',
# Why: #7989 in Alexa global
'http://www.fsymbols.com/',
# Why: #7990 in Alexa global
'http://www.bestproducttesters.com/',
# Why: #7991 in Alexa global
'http://daodao.com/',
# Why: #7992 in Alexa global
'http://www.virtuemart.net/',
# Why: #7993 in Alexa global
'http://www.hindilinks4u.net/',
# Why: #7994 in Alexa global
'http://www.nnm.me/',
# Why: #7995 in Alexa global
'http://www.xplocial.com/',
# Why: #7996 in Alexa global
'http://www.apartments.com/',
# Why: #7997 in Alexa global
'http://www.ekolay.net/',
# Why: #7998 in Alexa global
'http://www.doviz.com/',
# Why: #7999 in Alexa global
'http://www.flixya.com/',
# Why: #8000 in Alexa global
'http://www.3almthqafa.com/',
# Why: #8001 in Alexa global
'http://www.zamalekfans.com/',
# Why: #8002 in Alexa global
'http://www.imeigu.com/',
# Why: #8003 in Alexa global
'http://www.wikibit.net/',
# Why: #8004 in Alexa global
'http://www.windstream.net/',
# Why: #8005 in Alexa global
'http://www.matichon.co.th/',
# Why: #8006 in Alexa global
'http://www.appshopper.com/',
# Why: #8007 in Alexa global
'http://www.socialbakers.com/',
# Why: #8008 in Alexa global
'http://www.1popov.ru/',
# Why: #8009 in Alexa global
'http://www.blikk.hu/',
# Why: #8010 in Alexa global
'http://www.bdr130.net/',
# Why: #8011 in Alexa global
'http://www.arizona.edu/',
# Why: #8012 in Alexa global
'http://www.madhyamam.com/',
# Why: #8013 in Alexa global
'http://www.mweb.co.za/',
# Why: #8014 in Alexa global
'http://www.affiliates.de/',
# Why: #8015 in Alexa global
'http://www.ebs.in/',
# Why: #8016 in Alexa global
'http://www.bestgfx.com/',
# Why: #8017 in Alexa global
'http://www.share-games.com/',
# Why: #8018 in Alexa global
'http://www.informador.com.mx/',
# Why: #8019 in Alexa global
'http://www.jobsite.co.uk/',
# Why: #8020 in Alexa global
'http://www.carters.com/',
# Why: #8021 in Alexa global
'http://www.kinghost.net/',
# Why: #8022 in Alexa global
'http://www.us1.com/',
# Why: #8024 in Alexa global
'http://www.archives.com/',
# Why: #8025 in Alexa global
'http://www.forosdelweb.com/',
# Why: #8026 in Alexa global
'http://www.siteslike.com/',
# Why: #8027 in Alexa global
'http://www.thedailyshow.com/',
# Why: #8028 in Alexa global
'http://www.68design.net/',
# Why: #8029 in Alexa global
'http://www.imtalk.org/',
# Why: #8030 in Alexa global
'http://www.visualwebsiteoptimizer.com/',
# Why: #8031 in Alexa global
'http://www.glarysoft.com/',
# Why: #8032 in Alexa global
'http://xhby.net/',
# Why: #8033 in Alexa global
'http://www.cosp.jp/',
# Why: #8034 in Alexa global
'http://www.email.cz/',
# Why: #8035 in Alexa global
'http://www.amateurs-gone-wild.com/',
# Why: #8036 in Alexa global
'http://www.davidwalsh.name/',
# Why: #8037 in Alexa global
'http://www.finalfantasyxiv.com/',
# Why: #8038 in Alexa global
'http://www.aa.com.tr/',
# Why: #8039 in Alexa global
'http://www.legalzoom.com/',
# Why: #8040 in Alexa global
'http://www.lifehack.org/',
# Why: #8041 in Alexa global
'http://www.mca.gov.in/',
# Why: #8042 in Alexa global
'http://www.hidrvids.com/',
# Why: #8043 in Alexa global
'http://netaatoz.jp/',
# Why: #8044 in Alexa global
'http://www.key.com/',
# Why: #8045 in Alexa global
'http://www.thumbtack.com/',
# Why: #8046 in Alexa global
'http://www.nujij.nl/',
# Why: #8047 in Alexa global
'http://www.cinetux.org/',
# Why: #8048 in Alexa global
'http://www.hmetro.com.my/',
# Why: #8049 in Alexa global
'http://www.ignou.ac.in/',
# Why: #8051 in Alexa global
'http://www.affilorama.com/',
# Why: #8052 in Alexa global
'http://www.pokemon.com/',
# Why: #8053 in Alexa global
'http://www.sportsnewsinternational.com/',
# Why: #8054 in Alexa global
'http://www.geek.com/',
# Why: #8055 in Alexa global
'http://www.larepublica.pe/',
# Why: #8056 in Alexa global
'http://www.europacasino.com/',
# Why: #8058 in Alexa global
'http://www.ok-porn.com/',
# Why: #8059 in Alexa global
'http://www.tutorialzine.com/',
# Why: #8060 in Alexa global
'http://www.google.com.bn/',
# Why: #8061 in Alexa global
'http://www.site5.com/',
# Why: #8062 in Alexa global
'http://www.trafficjunky.net/',
# Why: #8063 in Alexa global
'http://www.xueqiu.com/',
# Why: #8064 in Alexa global
'http://www.yournewscorner.com/',
# Why: #8065 in Alexa global
'http://www.metrotvnews.com/',
# Why: #8066 in Alexa global
'http://www.nichegalz.com/',
# Why: #8067 in Alexa global
'http://www.job.com/',
# Why: #8068 in Alexa global
'http://www.koimoi.com/',
# Why: #8069 in Alexa global
'http://www.questionablecontent.net/',
# Why: #8070 in Alexa global
'http://www.volaris.mx/',
# Why: #8071 in Alexa global
'http://www.rakuten.de/',
# Why: #8072 in Alexa global
'http://www.cyworld.com/',
# Why: #8073 in Alexa global
'http://www.yudu.com/',
# Why: #8074 in Alexa global
'http://www.zakon.kz/',
# Why: #8075 in Alexa global
'http://www.msi.com/',
# Why: #8076 in Alexa global
'http://www.darkxxxtube.com/',
# Why: #8077 in Alexa global
'http://www.samakal.net/',
# Why: #8078 in Alexa global
'http://www.appstorm.net/',
# Why: #8079 in Alexa global
'http://www.vulture.com/',
# Why: #8080 in Alexa global
'http://www.lswb.com.cn/',
# Why: #8081 in Alexa global
'http://www.racingpost.com/',
# Why: #8082 in Alexa global
'http://www.classicrummy.com/',
# Why: #8083 in Alexa global
'http://www.iegallery.com/',
# Why: #8084 in Alexa global
'http://www.cinemagia.ro/',
# Why: #8085 in Alexa global
'http://nullpoantenna.com/',
# Why: #8086 in Alexa global
'http://www.ihned.cz/',
# Why: #8087 in Alexa global
'http://vdolady.com/',
# Why: #8088 in Alexa global
'http://www.babes.com/',
# Why: #8089 in Alexa global
'http://www.komli.com/',
# Why: #8090 in Alexa global
'http://www.asianbeauties.com/',
# Why: #8091 in Alexa global
'http://www.onedate.com/',
# Why: #8092 in Alexa global
'http://www.adhitz.com/',
# Why: #8093 in Alexa global
'http://www.jjgirls.com/',
# Why: #8094 in Alexa global
'http://www.dot.tk/',
# Why: #8095 in Alexa global
'http://caras.uol.com.br/',
# Why: #8096 in Alexa global
'http://www.autobild.de/',
# Why: #8097 in Alexa global
'http://www.jobs-to-careers.com/',
# Why: #8098 in Alexa global
'http://movietickets.com/',
# Why: #8099 in Alexa global
'http://www.net4.in/',
# Why: #8100 in Alexa global
'http://www.crutchfield.com/',
# Why: #8101 in Alexa global
'http://www.subdivx.com/',
# Why: #8102 in Alexa global
'http://www.damai.cn/',
# Why: #8103 in Alexa global
'http://www.sirarcade.com/',
# Why: #8104 in Alexa global
'http://sitescoutadserver.com/',
# Why: #8105 in Alexa global
'http://www.fantasy-rivals.com/',
# Why: #8106 in Alexa global
'http://www.chegg.com/',
# Why: #8107 in Alexa global
'http://www.sportsmansguide.com/',
# Why: #8108 in Alexa global
'http://www.extremetech.com/',
# Why: #8109 in Alexa global
'http://www.loft.com/',
# Why: #8110 in Alexa global
'http://www.dirtyamateurtube.com/',
# Why: #8111 in Alexa global
'http://painelhost.uol.com.br/',
# Why: #8112 in Alexa global
'http://www.socialsex.biz/',
# Why: #8113 in Alexa global
'http://www.opensubtitles.us/',
# Why: #8114 in Alexa global
'http://www.infomoney.com.br/',
# Why: #8115 in Alexa global
'http://www.openstat.ru/',
# Why: #8116 in Alexa global
'http://www.adlandpro.com/',
# Why: #8117 in Alexa global
'http://www.trivago.de/',
# Why: #8118 in Alexa global
'http://feiren.com/',
# Why: #8119 in Alexa global
'http://www.lespac.com/',
# Why: #8120 in Alexa global
'http://www.icook.tw/',
# Why: #8121 in Alexa global
'http://www.iceporn.com/',
# Why: #8122 in Alexa global
'http://www.animehere.com/',
# Why: #8123 in Alexa global
'http://www.klix.ba/',
# Why: #8124 in Alexa global
'http://www.elitepvpers.com/',
# Why: #8125 in Alexa global
'http://www.mrconservative.com/',
# Why: #8126 in Alexa global
'http://www.tamu.edu/',
# Why: #8127 in Alexa global
'http://www.startv.com.tr/',
# Why: #8128 in Alexa global
'http://www.haber1903.com/',
# Why: #8129 in Alexa global
'http://www.apa.tv/',
# Why: #8130 in Alexa global
'http://uc.cn/',
# Why: #8131 in Alexa global
'http://www.idbi.com/',
# Why: #8132 in Alexa global
'http://www.golfchannel.com/',
# Why: #8133 in Alexa global
'http://www.pep.ph/',
# Why: #8134 in Alexa global
'http://www.toukoucity.to/',
# Why: #8135 in Alexa global
'http://www.empiremoney.com/',
# Why: #8136 in Alexa global
'http://www.androidauthority.com/',
# Why: #8137 in Alexa global
'http://www.ref4bux.com/',
# Why: #8138 in Alexa global
'http://www.digitaljournal.com/',
# Why: #8139 in Alexa global
'http://www.sporcle.com/',
# Why: #8141 in Alexa global
'http://www.183.com.cn/',
# Why: #8142 in Alexa global
'http://www.bzwbk.pl/',
# Why: #8143 in Alexa global
'http://lalamao.com/',
# Why: #8144 in Alexa global
'http://www.ziare.com/',
# Why: #8145 in Alexa global
'http://www.cliti.com/',
# Why: #8146 in Alexa global
'http://www.thatguywiththeglasses.com/',
# Why: #8147 in Alexa global
'http://www.vodu.ch/',
# Why: #8148 in Alexa global
'http://www.ycwb.com/',
# Why: #8149 in Alexa global
'http://www.bls.gov/',
# Why: #8150 in Alexa global
'http://www.matsui.co.jp/',
# Why: #8151 in Alexa global
'http://xmrc.com.cn/',
# Why: #8152 in Alexa global
'http://1tubenews.com/',
# Why: #8153 in Alexa global
'http://www.cl.ly/',
# Why: #8154 in Alexa global
'http://www.ing.be/',
# Why: #8155 in Alexa global
'http://www.bitterstrawberry.com/',
# Why: #8156 in Alexa global
'http://www.fubar.com/',
# Why: #8157 in Alexa global
'http://www.arabic-keyboard.org/',
# Why: #8158 in Alexa global
'http://www.mejortorrent.com/',
# Why: #8159 in Alexa global
'http://www.trendmicro.com/',
# Why: #8160 in Alexa global
'http://www.ap7am.com/',
# Why: #8161 in Alexa global
'http://www.windowsazure.com/',
# Why: #8162 in Alexa global
'http://www.q8yat.com/',
# Why: #8163 in Alexa global
'http://www.yyv.co/',
# Why: #8164 in Alexa global
'http://www.tvoy-start.com/',
# Why: #8165 in Alexa global
'http://www.creativetoolbars.com/',
# Why: #8166 in Alexa global
'http://www.forrent.com/',
# Why: #8167 in Alexa global
'http://www.mlstatic.com/',
# Why: #8168 in Alexa global
'http://www.like4like.org/',
# Why: #8169 in Alexa global
'http://www.alpha.gr/',
# Why: #8170 in Alexa global
'http://www.amkey.net/',
# Why: #8172 in Alexa global
'http://www.iwiw.hu/',
# Why: #8173 in Alexa global
'http://www.routard.com/',
# Why: #8174 in Alexa global
'http://www.teacherspayteachers.com/',
# Why: #8175 in Alexa global
'http://www.ahashare.com/',
# Why: #8176 in Alexa global
'http://www.ultoo.com/',
# Why: #8177 in Alexa global
'http://www.oakley.com/',
# Why: #8178 in Alexa global
'http://www.upforit.com/',
# Why: #8179 in Alexa global
'http://www.trafficbee.com/',
# Why: #8180 in Alexa global
'http://www.monster.co.uk/',
# Why: #8181 in Alexa global
'http://www.boulanger.fr/',
# Why: #8182 in Alexa global
'http://www.bloglines.com/',
# Why: #8183 in Alexa global
'http://www.wdc.com/',
# Why: #8184 in Alexa global
'http://www.backpackers.com.tw/',
# Why: #8185 in Alexa global
'http://www.el-nacional.com/',
# Why: #8186 in Alexa global
'http://www.bloggertipstricks.com/',
# Why: #8187 in Alexa global
'http://www.oreillyauto.com/',
# Why: #8188 in Alexa global
'http://www.hotpads.com/',
# Why: #8189 in Alexa global
'http://www.tubexvideo.com/',
# Why: #8190 in Alexa global
'http://www.mudainodocument.com/',
# Why: #8191 in Alexa global
'http://www.17car.com.cn/',
# Why: #8192 in Alexa global
'http://www.discoverpedia.info/',
# Why: #8193 in Alexa global
'http://www.noobteens.com/',
# Why: #8194 in Alexa global
'http://www.shockmansion.com/',
# Why: #8195 in Alexa global
'http://www.qudsonline.ir/',
# Why: #8196 in Alexa global
'http://www.mec.es/',
# Why: #8197 in Alexa global
'http://www.vt.edu/',
# Why: #8198 in Alexa global
'http://www.akelite.com/',
# Why: #8199 in Alexa global
'http://www.travelandleisure.com/',
# Why: #8200 in Alexa global
'http://www.sunnewsonline.com/',
# Why: #8201 in Alexa global
'http://www.tok2.com/',
# Why: #8202 in Alexa global
'http://www.truste.org/',
# Why: #8203 in Alexa global
'http://www.2dehands.be/',
# Why: #8204 in Alexa global
'http://www.hf365.com/',
# Why: #8205 in Alexa global
'http://www.westelm.com/',
# Why: #8206 in Alexa global
'http://www.radiko.jp/',
# Why: #8207 in Alexa global
'http://www.real.gr/',
# Why: #8208 in Alexa global
'http://www.blogcms.jp/',
# Why: #8209 in Alexa global
'http://www.downloadming.me/',
# Why: #8210 in Alexa global
'http://www.citromail.hu/',
# Why: #8211 in Alexa global
'http://www.fotocommunity.de/',
# Why: #8212 in Alexa global
'http://www.zapjuegos.com/',
# Why: #8213 in Alexa global
'http://www.aastocks.com/',
# Why: #8214 in Alexa global
'http://www.unb.br/',
# Why: #8215 in Alexa global
'http://www.adchakra.net/',
# Why: #8216 in Alexa global
'http://www.check24.de/',
# Why: #8217 in Alexa global
'http://www.vidto.me/',
# Why: #8218 in Alexa global
'http://www.peekyou.com/',
# Why: #8219 in Alexa global
'http://www.urssaf.fr/',
# Why: #8220 in Alexa global
'http://www.alixixi.com/',
# Why: #8221 in Alexa global
'http://www.winamp.com/',
# Why: #8222 in Alexa global
'http://www.xianguo.com/',
# Why: #8223 in Alexa global
'http://www.indiasextube.net/',
# Why: #8224 in Alexa global
'http://www.fitnea.com/',
# Why: #8225 in Alexa global
'http://www.telemundo.com/',
# Why: #8226 in Alexa global
'http://www.webnode.cz/',
# Why: #8227 in Alexa global
'http://www.kliksaya.com/',
# Why: #8228 in Alexa global
'http://www.wikileaks.org/',
# Why: #8229 in Alexa global
'http://www.myblog.it/',
# Why: #8231 in Alexa global
'http://www.99wed.com/',
# Why: #8232 in Alexa global
'http://www.adorika.com/',
# Why: #8233 in Alexa global
'http://www.siliconrus.com/',
# Why: #8235 in Alexa global
'http://www.dealmoon.com/',
# Why: #8236 in Alexa global
'http://www.ricanadfunds.com/',
# Why: #8237 in Alexa global
'http://www.vietcombank.com.vn/',
# Why: #8238 in Alexa global
'http://www.chemistry.com/',
# Why: #8239 in Alexa global
'http://www.reisen.de/',
# Why: #8240 in Alexa global
'http://www.torlock.com/',
# Why: #8241 in Alexa global
'http://www.wsop.com/',
# Why: #8242 in Alexa global
'http://www.travian.co.id/',
# Why: #8243 in Alexa global
'http://www.ipoll.com/',
# Why: #8244 in Alexa global
'http://www.bpiexpressonline.com/',
# Why: #8245 in Alexa global
'http://www.neeu.com/',
# Why: #8246 in Alexa global
'http://www.atmarkit.co.jp/',
# Why: #8247 in Alexa global
'http://www.beyondtherack.com/',
# Why: #8248 in Alexa global
'http://blueidea.com/',
# Why: #8249 in Alexa global
'http://www.tedata.net/',
# Why: #8250 in Alexa global
'http://www.gamesradar.com/',
# Why: #8251 in Alexa global
'http://www.big.az/',
# Why: #8252 in Alexa global
'http://www.h-douga.net/',
# Why: #8253 in Alexa global
'http://www.runnersworld.com/',
# Why: #8254 in Alexa global
'http://www.lumfile.com/',
# Why: #8255 in Alexa global
'http://ccoo.cn/',
# Why: #8256 in Alexa global
'http://www.u17.com/',
# Why: #8257 in Alexa global
'http://www.badjojo.com/',
# Why: #8259 in Alexa global
'http://eplus.jp/',
# Why: #8260 in Alexa global
'http://www.nginx.org/',
# Why: #8261 in Alexa global
'http://www.filmfanatic.com/',
# Why: #8262 in Alexa global
'http://www.filmey.com/',
# Why: #8263 in Alexa global
'http://www.mousebreaker.com/',
# Why: #8264 in Alexa global
'http://www.mihanstore.net/',
# Why: #8265 in Alexa global
'http://www.sharebuilder.com/',
# Why: #8266 in Alexa global
'http://cnhan.com/',
# Why: #8267 in Alexa global
'http://www.partnerwithtom.com/',
# Why: #8268 in Alexa global
'http://www.synonym.com/',
# Why: #8269 in Alexa global
'http://www.areaconnect.com/',
# Why: #8271 in Alexa global
'http://www.one.lt/',
# Why: #8272 in Alexa global
'http://www.mp3quran.net/',
# Why: #8273 in Alexa global
'http://www.anz.co.nz/',
# Why: #8274 in Alexa global
'http://www.buyincoins.com/',
# Why: #8275 in Alexa global
'http://www.surfline.com/',
# Why: #8276 in Alexa global
'http://www.packtpub.com/',
# Why: #8277 in Alexa global
'http://www.informe21.com/',
# Why: #8278 in Alexa global
'http://www.d4000.com/',
# Why: #8279 in Alexa global
'http://www.blog.cz/',
# Why: #8280 in Alexa global
'http://www.myredbook.com/',
# Why: #8281 in Alexa global
'http://www.seslisozluk.net/',
# Why: #8282 in Alexa global
'http://www.simple2advertise.com/',
# Why: #8283 in Alexa global
'http://www.bookit.com/',
# Why: #8284 in Alexa global
'http://www.eranico.com/',
# Why: #8285 in Alexa global
'http://www.pakwheels.com/',
# Why: #8286 in Alexa global
'http://www.x-rates.com/',
# Why: #8287 in Alexa global
'http://www.ilmatieteenlaitos.fi/',
# Why: #8288 in Alexa global
'http://www.vozforums.com/',
# Why: #8289 in Alexa global
'http://www.galerieslafayette.com/',
# Why: #8290 in Alexa global
'http://www.trafficswirl.com/',
# Why: #8291 in Alexa global
'http://www.mql4.com/',
# Why: #8292 in Alexa global
'http://www.torontosun.com/',
# Why: #8293 in Alexa global
'http://www.channel.or.jp/',
# Why: #8295 in Alexa global
'http://www.lebuteur.com/',
# Why: #8296 in Alexa global
'http://www.cruisecritic.com/',
# Why: #8297 in Alexa global
'http://www.rateyourmusic.com/',
# Why: #8298 in Alexa global
'http://www.binsearch.info/',
# Why: #8299 in Alexa global
'http://www.nrj.fr/',
# Why: #8300 in Alexa global
'http://www.megaflix.net/',
# Why: #8301 in Alexa global
'http://www.dosug.cz/',
# Why: #8302 in Alexa global
'http://www.spdb.com.cn/',
# Why: #8303 in Alexa global
'http://www.stop55.com/',
# Why: #8304 in Alexa global
'http://www.qqnz.com/',
# Why: #8305 in Alexa global
'http://ibuonline.com/',
# Why: #8306 in Alexa global
'http://www.jobego.com/',
# Why: #8307 in Alexa global
'http://www.euro.com.pl/',
# Why: #8308 in Alexa global
'http://www.quran.com/',
# Why: #8309 in Alexa global
'http://www.ad1.ru/',
# Why: #8310 in Alexa global
'http://www.avaz.ba/',
# Why: #8311 in Alexa global
'http://www.eloqua.com/',
# Why: #8312 in Alexa global
'http://www.educationconnection.com/',
# Why: #8313 in Alexa global
'http://www.dbank.com/',
# Why: #8314 in Alexa global
'http://www.whois.sc/',
# Why: #8315 in Alexa global
'http://www.youmob.com/',
# Why: #8316 in Alexa global
'http://www.101greatgoals.com/',
# Why: #8317 in Alexa global
'http://www.livefyre.com/',
# Why: #8318 in Alexa global
'http://www.sextubebox.com/',
# Why: #8319 in Alexa global
'http://www.shooshtime.com/',
# Why: #8320 in Alexa global
'http://www.tapuz.co.il/',
# Why: #8321 in Alexa global
'http://www.auchan.fr/',
# Why: #8322 in Alexa global
'http://www.pinkvilla.com/',
# Why: #8323 in Alexa global
'http://www.perspolisnews.com/',
# Why: #8324 in Alexa global
'http://www.scholastic.com/',
# Why: #8325 in Alexa global
'http://www.google.mu/',
# Why: #8326 in Alexa global
'http://www.forex4you.org/',
# Why: #8327 in Alexa global
'http://www.mandtbank.com/',
# Why: #8328 in Alexa global
'http://www.gnezdo.ru/',
# Why: #8329 in Alexa global
'http://www.lulu.com/',
# Why: #8330 in Alexa global
'http://www.anniezhang.com/',
# Why: #8331 in Alexa global
'http://www.bharian.com.my/',
# Why: #8332 in Alexa global
'http://www.comprafacil.com.br/',
# Why: #8333 in Alexa global
'http://www.mmafighting.com/',
# Why: #8334 in Alexa global
'http://www.autotrader.ca/',
# Why: #8335 in Alexa global
'http://www.vectorstock.com/',
# Why: #8336 in Alexa global
'http://www.convio.com/',
# Why: #8337 in Alexa global
'http://www.ktunnel.com/',
# Why: #8338 in Alexa global
'http://www.hbs.edu/',
# Why: #8339 in Alexa global
'http://www.mindspark.com/',
# Why: #8340 in Alexa global
'http://www.trovit.com.mx/',
# Why: #8341 in Alexa global
'http://www.thomsonreuters.com/',
# Why: #8342 in Alexa global
'http://www.yupptv.com/',
# Why: #8343 in Alexa global
'http://www.fullsail.edu/',
# Why: #8344 in Alexa global
'http://www.perfectworld.eu/',
# Why: #8345 in Alexa global
'http://www.ju51.com/',
# Why: #8346 in Alexa global
'http://www.newssnip.com/',
# Why: #8347 in Alexa global
'http://www.livemocha.com/',
# Why: #8348 in Alexa global
'http://www.nespresso.com/',
# Why: #8349 in Alexa global
'http://www.uinvest.com.ua/',
# Why: #8350 in Alexa global
'http://www.yazete.com/',
# Why: #8351 in Alexa global
'http://www.malaysiaairlines.com/',
# Why: #8352 in Alexa global
'http://www.clikseguro.com/',
# Why: #8353 in Alexa global
'http://www.marksdailyapple.com/',
# Why: #8354 in Alexa global
'http://www.topnewsquick.com/',
# Why: #8355 in Alexa global
'http://www.ikyu.com/',
# Why: #8356 in Alexa global
'http://www.mydocomo.com/',
# Why: #8357 in Alexa global
'http://www.tampabay.com/',
# Why: #8358 in Alexa global
'http://www.mo.gov/',
# Why: #8359 in Alexa global
'http://www.daiwa.co.jp/',
# Why: #8360 in Alexa global
'http://www.amiami.jp/',
# Why: #8361 in Alexa global
'http://www.oxfordjournals.org/',
# Why: #8362 in Alexa global
'http://www.manageyourloans.com/',
# Why: #8363 in Alexa global
'http://www.couponcabin.com/',
# Why: #8364 in Alexa global
'http://www.qmnnk.blog.163.com/',
# Why: #8365 in Alexa global
'http://www.mrmlsmatrix.com/',
# Why: #8366 in Alexa global
'http://www.knowd.com/',
# Why: #8367 in Alexa global
'http://www.ladbrokes.com/',
# Why: #8368 in Alexa global
'http://www.ikoo.com/',
# Why: #8369 in Alexa global
'http://www.devhub.com/',
# Why: #8370 in Alexa global
'http://www.dropjack.com/',
# Why: #8371 in Alexa global
'http://www.sadistic.pl/',
# Why: #8372 in Alexa global
'http://www.8comic.com/',
# Why: #8373 in Alexa global
'http://www.optimizepress.com/',
# Why: #8374 in Alexa global
'http://ofweek.com/',
# Why: #8375 in Alexa global
'http://www.msn.com.tw/',
# Why: #8376 in Alexa global
'http://www.donya-e-eqtesad.com/',
# Why: #8377 in Alexa global
'http://www.arabam.com/',
# Why: #8378 in Alexa global
'http://www.playtv.fr/',
# Why: #8379 in Alexa global
'http://www.yourtv.com.au/',
# Why: #8380 in Alexa global
'http://www.teamtalk.com/',
# Why: #8381 in Alexa global
'http://www.createsend.com/',
# Why: #8382 in Alexa global
'http://www.bitcointalk.org/',
# Why: #8383 in Alexa global
'http://www.microcenter.com/',
# Why: #8384 in Alexa global
'http://www.arcadeprehacks.com/',
# Why: #8385 in Alexa global
'http://www.sublimetext.com/',
# Why: #8386 in Alexa global
'http://www.posindonesia.co.id/',
# Why: #8387 in Alexa global
'http://www.paymaster.ru/',
# Why: #8388 in Alexa global
'http://www.ncore.cc/',
# Why: #8390 in Alexa global
'http://www.wikisource.org/',
# Why: #8391 in Alexa global
'http://www.wowgame.jp/',
# Why: #8392 in Alexa global
'http://www.notebooksbilliger.de/',
# Why: #8393 in Alexa global
'http://www.nayakhabar.com/',
# Why: #8394 in Alexa global
'http://www.tim.com.br/',
# Why: #8395 in Alexa global
'http://www.leggo.it/',
# Why: #8396 in Alexa global
'http://www.swoodoo.com/',
# Why: #8397 in Alexa global
'http://www.perfectgirls.es/',
# Why: #8398 in Alexa global
'http://www.beautystyleliving.com/',
# Why: #8399 in Alexa global
'http://www.xmaduras.com/',
# Why: #8400 in Alexa global
'http://www.e-shop.gr/',
# Why: #8401 in Alexa global
'http://www.k8.cn/',
# Why: #8402 in Alexa global
'http://www.27.cn/',
# Why: #8403 in Alexa global
'http://www.belastingdienst.nl/',
# Why: #8404 in Alexa global
'http://www.urbia.de/',
# Why: #8405 in Alexa global
'http://www.lovoo.net/',
# Why: #8406 in Alexa global
'http://www.citizensbank.com/',
# Why: #8407 in Alexa global
'http://www.gulesider.no/',
# Why: #8408 in Alexa global
'http://zhongsou.net/',
# Why: #8409 in Alexa global
'http://www.cinemablend.com/',
# Why: #8410 in Alexa global
'http://www.joydownload.com/',
# Why: #8411 in Alexa global
'http://www.cncmax.cn/',
# Why: #8412 in Alexa global
'http://www.telkom.co.id/',
# Why: #8413 in Alexa global
'http://www.nangaspace.com/',
# Why: #8414 in Alexa global
'http://www.panerabread.com/',
# Why: #8415 in Alexa global
'http://www.cinechest.com/',
# Why: #8416 in Alexa global
'http://www.flixjunky.com/',
# Why: #8417 in Alexa global
'http://www.berlin1.de/',
# Why: #8418 in Alexa global
'http://www.tabonito.pt/',
# Why: #8419 in Alexa global
'http://www.snob.ru/',
# Why: #8420 in Alexa global
'http://www.audiovkontakte.ru/',
# Why: #8421 in Alexa global
'http://www.linuxmint.com/',
# Why: #8422 in Alexa global
'http://www.freshdesk.com/',
# Why: #8423 in Alexa global
'http://www.professionali.ru/',
# Why: #8425 in Alexa global
'http://www.primelocation.com/',
# Why: #8426 in Alexa global
'http://www.femina.hu/',
# Why: #8427 in Alexa global
'http://www.jecontacte.com/',
# Why: #8428 in Alexa global
'http://www.celebritytoob.com/',
# Why: #8429 in Alexa global
'http://www.streamiz-filmze.com/',
# Why: #8430 in Alexa global
'http://l-tike.com/',
# Why: #8431 in Alexa global
'http://www.collegeconfidential.com/',
# Why: #8432 in Alexa global
'http://hafiz.gov.sa/',
# Why: #8433 in Alexa global
'http://www.mega-porno.ru/',
# Why: #8434 in Alexa global
'http://www.ivoox.com/',
# Why: #8435 in Alexa global
'http://www.lmgtfy.com/',
# Why: #8436 in Alexa global
'http://www.pclab.pl/',
# Why: #8437 in Alexa global
'http://www.preisvergleich.de/',
# Why: #8438 in Alexa global
'http://www.weeb.tv/',
# Why: #8439 in Alexa global
'http://www.80018.cn/',
# Why: #8440 in Alexa global
'http://www.tnews.ir/',
# Why: #8441 in Alexa global
'http://www.johnnys-net.jp/',
# Why: #8442 in Alexa global
'http://www.wwtdd.com/',
# Why: #8444 in Alexa global
'http://www.totalfilm.com/',
# Why: #8445 in Alexa global
'http://www.girlfriendvideos.com/',
# Why: #8446 in Alexa global
'http://www.wgt.com/',
# Why: #8447 in Alexa global
'http://www.iu.edu/',
# Why: #8448 in Alexa global
'http://www.topictorch.com/',
# Why: #8449 in Alexa global
'http://www.wenweipo.com/',
# Why: #8450 in Alexa global
'http://duitang.com/',
# Why: #8452 in Alexa global
'http://www.madrid.org/',
# Why: #8453 in Alexa global
'http://www.retrogamer.com/',
# Why: #8454 in Alexa global
'http://www.pantheranetwork.com/',
# Why: #8455 in Alexa global
'http://www.someecards.com/',
# Why: #8456 in Alexa global
'http://www.visafone.com.ng/',
# Why: #8457 in Alexa global
'http://www.infopraca.pl/',
# Why: #8458 in Alexa global
'http://www.nrelate.com/',
# Why: #8459 in Alexa global
'http://www.sia.az/',
# Why: #8460 in Alexa global
'http://www.wallbase.cc/',
# Why: #8461 in Alexa global
'http://www.shareflare.net/',
# Why: #8462 in Alexa global
'http://www.sammydress.com/',
# Why: #8463 in Alexa global
'http://www.goldesel.to/',
# Why: #8464 in Alexa global
'http://www.thefiscaltimes.com/',
# Why: #8465 in Alexa global
'http://www.freelogoservices.com/',
# Why: #8467 in Alexa global
'http://www.dealigg.com/',
# Why: #8468 in Alexa global
'http://www.babypips.com/',
# Why: #8469 in Alexa global
'http://www.diynetwork.com/',
# Why: #8470 in Alexa global
'http://www.porn99.net/',
# Why: #8471 in Alexa global
'http://www.skynewsarabia.com/',
# Why: #8472 in Alexa global
'http://www.eweb4.com/',
# Why: #8473 in Alexa global
'http://www.fedoraproject.org/',
# Why: #8474 in Alexa global
'http://www.nolo.com/',
# Why: #8475 in Alexa global
'http://www.homelink.com.cn/',
# Why: #8476 in Alexa global
'http://www.megabus.com/',
# Why: #8477 in Alexa global
'http://www.fao.org/',
# Why: #8478 in Alexa global
'http://www.am.ru/',
# Why: #8479 in Alexa global
'http://www.sportowefakty.pl/',
# Why: #8481 in Alexa global
'http://www.kidstaff.com.ua/',
# Why: #8482 in Alexa global
'http://www.jhu.edu/',
# Why: #8483 in Alexa global
'http://www.which.co.uk/',
# Why: #8484 in Alexa global
'http://www.sextubehd.xxx/',
# Why: #8485 in Alexa global
'http://www.swansonvitamins.com/',
# Why: #8486 in Alexa global
'http://www.iran-eng.com/',
# Why: #8487 in Alexa global
'http://www.fakenamegenerator.com/',
# Why: #8488 in Alexa global
'http://www.gosong.net/',
# Why: #8489 in Alexa global
'http://www.pep.com.cn/',
# Why: #8490 in Alexa global
'http://www.24open.ru/',
# Why: #8491 in Alexa global
'http://www.123sdfsdfsdfsd.ru/',
# Why: #8492 in Alexa global
'http://www.gotgayporn.com/',
# Why: #8493 in Alexa global
'http://www.zaq.ne.jp/',
# Why: #8494 in Alexa global
'http://www.casadellibro.com/',
# Why: #8495 in Alexa global
'http://www.ixwebhosting.com/',
# Why: #8496 in Alexa global
'http://www.buyorbury.com/',
# Why: #8497 in Alexa global
'http://www.getglue.com/',
# Why: #8498 in Alexa global
'http://www.864321.com/',
# Why: #8499 in Alexa global
'http://www.alivv.com/',
# Why: #8500 in Alexa global
'http://www.4.cn/',
# Why: #8501 in Alexa global
'http://www.competitor.com/',
# Why: #8502 in Alexa global
'http://www.iheima.com/',
# Why: #8503 in Alexa global
'http://www.submarinoviagens.com.br/',
# Why: #8504 in Alexa global
'http://emailsrvr.com/',
# Why: #8505 in Alexa global
'http://www.udacity.com/',
# Why: #8506 in Alexa global
'http://www.mcafeesecure.com/',
# Why: #8507 in Alexa global
'http://www.laposte.fr/',
# Why: #8508 in Alexa global
'http://olhardigital.uol.com.br/',
# Why: #8509 in Alexa global
'http://ppy.sh/',
# Why: #8510 in Alexa global
'http://www.rumah.com/',
# Why: #8511 in Alexa global
'http://www.pullbear.com/',
# Why: #8512 in Alexa global
'http://www.pkt.pl/',
# Why: #8513 in Alexa global
'http://www.jayde.com/',
# Why: #8514 in Alexa global
'http://www.myjoyonline.com/',
# Why: #8515 in Alexa global
'http://www.locopengu.com/',
# Why: #8516 in Alexa global
'http://www.vsnl.net.in/',
# Why: #8517 in Alexa global
'http://www.hornbunny.com/',
# Why: #8518 in Alexa global
'http://www.royalcaribbean.com/',
# Why: #8520 in Alexa global
'http://www.football.ua/',
# Why: #8521 in Alexa global
'http://www.thaifriendly.com/',
# Why: #8522 in Alexa global
'http://www.bankofthewest.com/',
# Why: #8523 in Alexa global
'http://www.indianprice.com/',
# Why: #8524 in Alexa global
'http://www.chodientu.vn/',
# Why: #8525 in Alexa global
'http://www.alison.com/',
# Why: #8526 in Alexa global
'http://www.eveonline.com/',
# Why: #8527 in Alexa global
'http://www.blogg.se/',
# Why: #8528 in Alexa global
'http://www.jetairways.com/',
# Why: #8529 in Alexa global
'http://www.larousse.fr/',
# Why: #8530 in Alexa global
'http://www.noticierodigital.com/',
# Why: #8531 in Alexa global
'http://mkfst.com/',
# Why: #8532 in Alexa global
'http://www.anyfiledownloader.com/',
# Why: #8533 in Alexa global
'http://www.tiramillas.net/',
# Why: #8534 in Alexa global
'http://www.telus.com/',
# Why: #8535 in Alexa global
'http://www.paperblog.com/',
# Why: #8536 in Alexa global
'http://www.songsterr.com/',
# Why: #8537 in Alexa global
'http://www.entremujeres.com/',
# Why: #8538 in Alexa global
'http://www.startsiden.no/',
# Why: #8539 in Alexa global
'http://www.hotspotshield.com/',
# Why: #8540 in Alexa global
'http://www.hosteurope.de/',
# Why: #8541 in Alexa global
'http://www.ebags.com/',
# Why: #8542 in Alexa global
'http://www.eenadupratibha.net/',
# Why: #8543 in Alexa global
'http://www.uppit.com/',
# Why: #8544 in Alexa global
'http://www.piaohua.com/',
# Why: #8545 in Alexa global
'http://www.xxxymovies.com/',
# Why: #8546 in Alexa global
'http://www.netbarg.com/',
# Why: #8547 in Alexa global
'http://www.chip.com.tr/',
# Why: #8548 in Alexa global
'http://xl.co.id/',
# Why: #8549 in Alexa global
'http://www.kowalskypage.com/',
# Why: #8550 in Alexa global
'http://www.afterdawn.com/',
# Why: #8551 in Alexa global
'http://www.locanto.com/',
# Why: #8552 in Alexa global
'http://www.liilas.com/',
# Why: #8553 in Alexa global
'http://www.superboy.com/',
# Why: #8554 in Alexa global
'http://www.indiavisiontv.com/',
# Why: #8555 in Alexa global
'http://www.ixquick.com/',
# Why: #8556 in Alexa global
'http://www.hotelium.com/',
# Why: #8557 in Alexa global
'http://www.twsela.com/',
# Why: #8558 in Alexa global
'http://www.newsmeback.com/',
# Why: #8559 in Alexa global
'http://www.perfectliving.com/',
# Why: #8560 in Alexa global
'http://www.laughingsquid.com/',
# Why: #8561 in Alexa global
'http://www.designboom.com/',
# Why: #8562 in Alexa global
'http://www.zigil.ir/',
# Why: #8563 in Alexa global
'http://www.coachfactory.com/',
# Why: #8564 in Alexa global
'http://www.wst.cn/',
# Why: #8565 in Alexa global
'http://www.kaboodle.com/',
# Why: #8566 in Alexa global
'http://www.fastmail.fm/',
# Why: #8567 in Alexa global
'http://www.threadless.com/',
# Why: #8568 in Alexa global
'http://www.wiseconvert.com/',
# Why: #8569 in Alexa global
'http://www.br.de/',
# Why: #8570 in Alexa global
'http://www.promovacances.com/',
# Why: #8572 in Alexa global
'http://www.wrzuta.pl/',
# Why: #8573 in Alexa global
'http://www.fromdoctopdf.com/',
# Why: #8574 in Alexa global
'http://www.ono.es/',
# Why: #8575 in Alexa global
'http://www.zinio.com/',
# Why: #8576 in Alexa global
'http://netcoc.com/',
# Why: #8577 in Alexa global
'http://www.eanswers.com/',
# Why: #8578 in Alexa global
'http://www.wallst.com/',
# Why: #8579 in Alexa global
'http://www.ipiccy.com/',
# Why: #8580 in Alexa global
'http://www.fastweb.it/',
# Why: #8581 in Alexa global
'http://www.kaufmich.com/',
# Why: #8582 in Alexa global
'http://www.groupon.co.za/',
# Why: #8583 in Alexa global
'http://www.cyzo.com/',
# Why: #8584 in Alexa global
'http://www.addic7ed.com/',
# Why: #8585 in Alexa global
'http://www.liuliangbao.cn/',
# Why: #8586 in Alexa global
'http://www.alintibaha.net/',
# Why: #8587 in Alexa global
'http://www.indiewire.com/',
# Why: #8588 in Alexa global
'http://www.needforspeed.com/',
# Why: #8590 in Alexa global
'http://www.e24.no/',
# Why: #8591 in Alexa global
'http://www.hupso.com/',
# Why: #8592 in Alexa global
'http://www.kathimerini.gr/',
# Why: #8593 in Alexa global
'http://www.worldoffiles.net/',
# Why: #8594 in Alexa global
'http://www.express.pk/',
# Why: #8595 in Alexa global
'http://www.wieszjak.pl/',
# Why: #8597 in Alexa global
'http://www.mobile.bg/',
# Why: #8598 in Alexa global
'http://www.subway.com/',
# Why: #8599 in Alexa global
'http://www.akhbarelyom.com/',
# Why: #8600 in Alexa global
'http://www.thisoldhouse.com/',
# Why: #8601 in Alexa global
'http://www.autoevolution.com/',
# Why: #8602 in Alexa global
'http://www.public-api.wordpress.com/',
# Why: #8603 in Alexa global
'http://www.airarabia.com/',
# Why: #8604 in Alexa global
'http://www.powerball.com/',
# Why: #8605 in Alexa global
'http://www.mais.uol.com.br/',
# Why: #8606 in Alexa global
'http://www.visa.com/',
# Why: #8607 in Alexa global
'http://www.gendai.net/',
# Why: #8608 in Alexa global
'http://www.gymboree.com/',
# Why: #8609 in Alexa global
'http://www.tvp.pl/',
# Why: #8610 in Alexa global
'http://www.sinhayasocialreader.com/',
# Why: #8611 in Alexa global
'http://a963.com/',
# Why: #8612 in Alexa global
'http://www.gamgos.ae/',
# Why: #8613 in Alexa global
'http://www.fx678.com/',
# Why: #8614 in Alexa global
'http://www.mp3round.com/',
# Why: #8615 in Alexa global
'http://www.komonews.com/',
# Why: #8616 in Alexa global
'http://www.contactcars.com/',
# Why: #8617 in Alexa global
'http://www.pdftoword.com/',
# Why: #8618 in Alexa global
'http://www.songtaste.com/',
# Why: #8620 in Alexa global
'http://www.squareup.com/',
# Why: #8621 in Alexa global
'http://www.newsevent24.com/',
# Why: #8622 in Alexa global
'http://www.dti.ne.jp/',
# Why: #8623 in Alexa global
'http://www.livestation.com/',
# Why: #8624 in Alexa global
'http://www.oldertube.com/',
# Why: #8625 in Alexa global
'http://www.rtl.fr/',
# Why: #8626 in Alexa global
'http://www.gather.com/',
# Why: #8627 in Alexa global
'http://www.liderendeportes.com/',
# Why: #8628 in Alexa global
'http://www.thewrap.com/',
# Why: #8629 in Alexa global
'http://www.viber.com/',
# Why: #8630 in Alexa global
'http://www.reklama5.mk/',
# Why: #8631 in Alexa global
'http://www.fonts.com/',
# Why: #8632 in Alexa global
'http://www.hrsaccount.com/',
# Why: #8633 in Alexa global
'http://www.bizcommunity.com/',
# Why: #8634 in Alexa global
'http://www.favicon.cc/',
# Why: #8635 in Alexa global
'http://www.totalping.com/',
# Why: #8636 in Alexa global
'http://www.live365.com/',
# Why: #8637 in Alexa global
'http://www.tlife.gr/',
# Why: #8638 in Alexa global
'http://www.imasters.com.br/',
# Why: #8639 in Alexa global
'http://www.n11.com/',
# Why: #8640 in Alexa global
'http://www.iam.ma/',
# Why: #8641 in Alexa global
'http://www.qq5.com/',
# Why: #8642 in Alexa global
'http://www.tvboxnow.com/',
# Why: #8643 in Alexa global
'http://www.limetorrents.com/',
# Why: #8644 in Alexa global
'http://www.bancopopular.es/',
# Why: #8645 in Alexa global
'http://www.ray-ban.com/',
# Why: #8646 in Alexa global
'http://www.drweb.com/',
# Why: #8647 in Alexa global
'http://www.hushmail.com/',
# Why: #8648 in Alexa global
'http://www.resuelvetudeuda.com/',
# Why: #8649 in Alexa global
'http://www.sharpnews.ru/',
# Why: #8650 in Alexa global
'http://www.hellocoton.fr/',
# Why: #8651 in Alexa global
'http://buysub.com/',
# Why: #8652 in Alexa global
'http://www.homemoviestube.com/',
# Why: #8653 in Alexa global
'http://www.utsandiego.com/',
# Why: #8654 in Alexa global
'http://www.learn4good.com/',
# Why: #8655 in Alexa global
'http://www.nii.ac.jp/',
# Why: #8656 in Alexa global
'http://www.girlsgogames.ru/',
# Why: #8657 in Alexa global
'http://www.talksport.co.uk/',
# Why: #8658 in Alexa global
'http://fap.to/',
# Why: #8659 in Alexa global
'http://www.teennick.com/',
# Why: #8660 in Alexa global
'http://www.seitwert.de/',
# Why: #8661 in Alexa global
'http://www.celebritymoviearchive.com/',
# Why: #8662 in Alexa global
'http://www.sukar.com/',
# Why: #8663 in Alexa global
'http://www.astromeridian.ru/',
# Why: #8664 in Alexa global
'http://www.zen-cart.com/',
# Why: #8665 in Alexa global
'http://www.1phads.com/',
# Why: #8666 in Alexa global
'http://www.plaisio.gr/',
# Why: #8667 in Alexa global
'http://www.photozou.jp/',
# Why: #8668 in Alexa global
'http://www.cplusplus.com/',
# Why: #8669 in Alexa global
'http://www.ewebse.com/',
# Why: #8670 in Alexa global
'http://6eat.com/',
# Why: #8672 in Alexa global
'http://www.payless.com/',
# Why: #8673 in Alexa global
'http://www.subaonet.com/',
# Why: #8674 in Alexa global
'http://www.dlisted.com/',
# Why: #8675 in Alexa global
'http://www.kia.com/',
# Why: #8676 in Alexa global
'http://www.lankahotnews.net/',
# Why: #8677 in Alexa global
'http://www.vg247.com/',
# Why: #8678 in Alexa global
'http://www.formstack.com/',
# Why: #8679 in Alexa global
'http://www.jobs.net/',
# Why: #8680 in Alexa global
'http://www.coolchaser.com/',
# Why: #8681 in Alexa global
'http://www.blackplanet.com/',
# Why: #8682 in Alexa global
'http://www.unionbank.com/',
# Why: #8683 in Alexa global
'http://www.record.com.mx/',
# Why: #8684 in Alexa global
'http://www.121ware.com/',
# Why: #8685 in Alexa global
'http://www.inkfrog.com/',
# Why: #8686 in Alexa global
'http://cnstock.com/',
# Why: #8687 in Alexa global
'http://www.marineaquariumfree.com/',
# Why: #8688 in Alexa global
'http://www.encuentra24.com/',
# Why: #8689 in Alexa global
'http://www.mixturecloud.com/',
# Why: #8690 in Alexa global
'http://www.yninfo.com/',
# Why: #8691 in Alexa global
'http://www.lesnumeriques.com/',
# Why: #8692 in Alexa global
'http://www.autopartswarehouse.com/',
# Why: #8693 in Alexa global
'http://www.lijit.com/',
# Why: #8694 in Alexa global
'http://www.ti.com/',
# Why: #8695 in Alexa global
'http://www.umd.edu/',
# Why: #8696 in Alexa global
'http://www.zdnet.co.uk/',
# Why: #8697 in Alexa global
'http://www.begin-download.com/',
# Why: #8698 in Alexa global
'http://www.showsiteinfo.us/',
# Why: #8699 in Alexa global
'http://www.uchicago.edu/',
# Why: #8700 in Alexa global
'http://www.whatsmyserp.com/',
# Why: #8701 in Alexa global
'http://www.asos.fr/',
# Why: #8702 in Alexa global
'http://www.ibosocial.com/',
# Why: #8703 in Alexa global
'http://www.amorenlinea.com/',
# Why: #8704 in Alexa global
'http://www.videopremium.tv/',
# Why: #8705 in Alexa global
'http://www.trkjmp.com/',
# Why: #8706 in Alexa global
'http://www.creativecow.net/',
# Why: #8707 in Alexa global
'http://www.webartex.ru/',
# Why: #8708 in Alexa global
'http://www.olx.com.ng/',
# Why: #8709 in Alexa global
'http://www.overclockzone.com/',
# Why: #8710 in Alexa global
'http://www.rongbay.com/',
# Why: #8711 in Alexa global
'http://www.maximustube.com/',
# Why: #8712 in Alexa global
'http://www.priberam.pt/',
# Why: #8713 in Alexa global
'http://www.comsenz.com/',
# Why: #8714 in Alexa global
'http://www.prensaescrita.com/',
# Why: #8715 in Alexa global
'http://www.gameslist.com/',
# Why: #8716 in Alexa global
'http://www.lingualeo.com/',
# Why: #8717 in Alexa global
'http://www.epfoservices.in/',
# Why: #8718 in Alexa global
'http://www.webbirga.net/',
# Why: #8719 in Alexa global
'http://www.pb.com/',
# Why: #8720 in Alexa global
'http://www.fineco.it/',
# Why: #8721 in Alexa global
'http://www.highrisehq.com/',
# Why: #8722 in Alexa global
'http://www.hotgoo.com/',
# Why: #8723 in Alexa global
'http://www.netdoctor.co.uk/',
# Why: #8725 in Alexa global
'http://domain.com/',
# Why: #8726 in Alexa global
'http://www.aramex.com/',
# Why: #8727 in Alexa global
'http://www.google.co.uz/',
# Why: #8728 in Alexa global
'http://www.savings.com/',
# Why: #8729 in Alexa global
'http://www.airtelbroadband.in/',
# Why: #8730 in Alexa global
'http://www.postimees.ee/',
# Why: #8731 in Alexa global
'http://www.wallsave.com/',
# Why: #8732 in Alexa global
'http://www.df.gob.mx/',
# Why: #8733 in Alexa global
'http://www.flashgames247.com/',
# Why: #8735 in Alexa global
'http://www.libsyn.com/',
# Why: #8736 in Alexa global
'http://www.goobike.com/',
# Why: #8737 in Alexa global
'http://www.trivago.com/',
# Why: #8738 in Alexa global
'http://www.mt.co.kr/',
# Why: #8739 in Alexa global
'http://www.android-hilfe.de/',
# Why: #8740 in Alexa global
'http://www.anquan.org/',
# Why: #8741 in Alexa global
'http://www.dota2.com/',
# Why: #8742 in Alexa global
'http://www.vladtv.com/',
# Why: #8743 in Alexa global
'http://www.oovoo.com/',
# Why: #8744 in Alexa global
'http://www.mybrowsercash.com/',
# Why: #8745 in Alexa global
'http://www.stafaband.info/',
# Why: #8746 in Alexa global
'http://www.vsao.vn/',
# Why: #8747 in Alexa global
'http://www.smithsonianmag.com/',
# Why: #8748 in Alexa global
'http://www.feedblitz.com/',
# Why: #8749 in Alexa global
'http://www.kibeloco.com.br/',
# Why: #8750 in Alexa global
'http://www.burningcamel.com/',
# Why: #8751 in Alexa global
'http://www.northwestern.edu/',
# Why: #8752 in Alexa global
'http://www.tucows.com/',
# Why: #8753 in Alexa global
'http://www.porn-granny-tube.com/',
# Why: #8754 in Alexa global
'http://www.linksys.com/',
# Why: #8755 in Alexa global
'http://www.avea.com.tr/',
# Why: #8756 in Alexa global
'http://www.ams.se/',
# Why: #8757 in Alexa global
'http://www.canadanepalvid.com/',
# Why: #8758 in Alexa global
'http://www.venmobulo.com/',
# Why: #8759 in Alexa global
'http://www.levi.com/',
# Why: #8760 in Alexa global
'http://www.freshome.com/',
# Why: #8761 in Alexa global
'http://www.loja2.com.br/',
# Why: #8762 in Alexa global
'http://www.gameduell.de/',
# Why: #8763 in Alexa global
'http://www.reserveamerica.com/',
# Why: #8764 in Alexa global
'http://www.fakings.com/',
# Why: #8765 in Alexa global
'http://www.akb48newstimes.jp/',
# Why: #8766 in Alexa global
'http://www.polygon.com/',
# Why: #8767 in Alexa global
'http://www.mtwebcenters.com.tw/',
# Why: #8768 in Alexa global
'http://www.news.mn/',
# Why: #8769 in Alexa global
'http://www.addictinginfo.org/',
# Why: #8770 in Alexa global
'http://www.bonanza.com/',
# Why: #8771 in Alexa global
'http://www.adlock.in/',
# Why: #8772 in Alexa global
'http://www.apni.tv/',
# Why: #8773 in Alexa global
'http://www.3m.com/',
# Why: #8774 in Alexa global
'http://www.gendama.jp/',
# Why: #8775 in Alexa global
'http://www.usingenglish.com/',
# Why: #8776 in Alexa global
'http://www.sammsoft.com/',
# Why: #8777 in Alexa global
'http://www.pedaily.cn/',
# Why: #8778 in Alexa global
'http://www.thevault.bz/',
# Why: #8779 in Alexa global
'http://www.groupon.my/',
# Why: #8780 in Alexa global
'http://www.banamex.com/',
# Why: #8781 in Alexa global
'http://hualongxiang.com/',
# Why: #8782 in Alexa global
'http://www.bodis.com/',
# Why: #8783 in Alexa global
'http://www.dqx.jp/',
# Why: #8784 in Alexa global
'http://www.io.ua/',
# Why: #8785 in Alexa global
'http://joy.cn/',
# Why: #8786 in Alexa global
'http://www.minglebox.com/',
# Why: #8787 in Alexa global
'http://www.forumspecialoffers.com/',
# Why: #8788 in Alexa global
'http://www.remax.com/',
# Why: #8789 in Alexa global
'http://www.makaan.com/',
# Why: #8790 in Alexa global
'http://www.voglioporno.com/',
# Why: #8791 in Alexa global
'http://www.chinaluxus.com/',
# Why: #8792 in Alexa global
'http://www.parenting.com/',
# Why: #8793 in Alexa global
'http://www.superdownloads.com.br/',
# Why: #8794 in Alexa global
'http://www.aeon.co.jp/',
# Why: #8795 in Alexa global
'http://www.nettavisen.no/',
# Why: #8796 in Alexa global
'http://www.21cbh.com/',
# Why: #8797 in Alexa global
'http://www.mobilestan.net/',
# Why: #8798 in Alexa global
'http://www.cheathappens.com/',
# Why: #8799 in Alexa global
'http://www.azxeber.com/',
# Why: #8800 in Alexa global
'http://www.foodgawker.com/',
# Why: #8801 in Alexa global
'http://www.miitbeian.gov.cn/',
# Why: #8802 in Alexa global
'http://www.eb80.com/',
# Why: #8803 in Alexa global
'http://www.dudamobile.com/',
# Why: #8804 in Alexa global
'http://www.sahafah.net/',
# Why: #8805 in Alexa global
'http://www.ait-themes.com/',
# Why: #8806 in Alexa global
'http://www.house.gov/',
# Why: #8807 in Alexa global
'http://www.ffffound.com/',
# Why: #8808 in Alexa global
'http://sssc.cn/',
# Why: #8809 in Alexa global
'http://www.khanwars.ir/',
# Why: #8810 in Alexa global
'http://www.wowslider.com/',
# Why: #8811 in Alexa global
'http://www.fashionara.com/',
# Why: #8812 in Alexa global
'http://www.pornxxxhub.com/',
# Why: #8813 in Alexa global
'http://www.minhavida.com.br/',
# Why: #8814 in Alexa global
'http://www.senzapudore.it/',
# Why: #8815 in Alexa global
'http://www.extra.cz/',
# Why: #8816 in Alexa global
'http://www.cinemark.com/',
# Why: #8817 in Alexa global
'http://www.career.ru/',
# Why: #8818 in Alexa global
'http://www.realself.com/',
# Why: #8819 in Alexa global
'http://www.i4455.com/',
# Why: #8820 in Alexa global
'http://www.ntlworld.com/',
# Why: #8821 in Alexa global
'http://chinaw3.com/',
# Why: #8822 in Alexa global
'http://www.berliner-sparkasse.de/',
# Why: #8823 in Alexa global
'http://www.autoscout24.be/',
# Why: #8824 in Alexa global
'http://www.heureka.sk/',
# Why: #8825 in Alexa global
'http://tienphong.vn/',
# Why: #8826 in Alexa global
'http://www.1001freefonts.com/',
# Why: #8827 in Alexa global
'http://www.bluestacks.com/',
# Why: #8828 in Alexa global
'http://www.livesports.pl/',
# Why: #8829 in Alexa global
'http://www.bd-pratidin.com/',
# Why: #8831 in Alexa global
'http://www.es.tl/',
# Why: #8832 in Alexa global
'http://www.backcountry.com/',
# Why: #8833 in Alexa global
'http://www.fourhourworkweek.com/',
# Why: #8834 in Alexa global
'http://ebay.cn/',
# Why: #8835 in Alexa global
'http://www.pointclicktrack.com/',
# Why: #8836 in Alexa global
'http://www.joomlacode.org/',
# Why: #8837 in Alexa global
'http://www.fantage.com/',
# Why: #8838 in Alexa global
'http://www.seowizard.ru/',
# Why: #8839 in Alexa global
'http://military38.com/',
# Why: #8840 in Alexa global
'http://www.wenkang.cn/',
# Why: #8842 in Alexa global
'http://www.swedbank.lt/',
# Why: #8843 in Alexa global
'http://www.govoyages.com/',
# Why: #8844 in Alexa global
'http://www.fgov.be/',
# Why: #8845 in Alexa global
'http://www.dengeki.com/',
# Why: #8846 in Alexa global
'http://www.3773.com.cn/',
# Why: #8847 in Alexa global
'http://www.ed4.net/',
# Why: #8848 in Alexa global
'http://www.mql5.com/',
# Why: #8849 in Alexa global
'http://www.gottabemobile.com/',
# Why: #8850 in Alexa global
'http://www.kdslife.com/',
# Why: #8851 in Alexa global
'http://5yi.com/',
# Why: #8852 in Alexa global
'http://www.bforex.com/',
# Why: #8853 in Alexa global
'http://www.eurogamer.net/',
# Why: #8854 in Alexa global
'http://www.az.pl/',
# Why: #8855 in Alexa global
'http://www.partypoker.com/',
# Why: #8856 in Alexa global
'http://www.cinapalace.com/',
# Why: #8857 in Alexa global
'http://www.sbt.com.br/',
# Why: #8858 in Alexa global
'http://www.nanos.jp/',
# Why: #8859 in Alexa global
'http://www.phpcms.cn/',
# Why: #8860 in Alexa global
'http://www.weatherzone.com.au/',
# Why: #8861 in Alexa global
'http://www.cutv.com/',
# Why: #8862 in Alexa global
'http://www.sweetwater.com/',
# Why: #8863 in Alexa global
'http://www.vodacom.co.za/',
# Why: #8864 in Alexa global
'http://www.hostgator.in/',
# Why: #8865 in Alexa global
'http://www.mojim.com/',
# Why: #8866 in Alexa global
'http://www.getnews.jp/',
# Why: #8868 in Alexa global
'http://www.eklablog.com/',
# Why: #8869 in Alexa global
'http://www.divaina.com/',
# Why: #8870 in Alexa global
'http://www.acces-charme.com/',
# Why: #8871 in Alexa global
'http://www.airfrance.fr/',
# Why: #8872 in Alexa global
'http://www.widgeo.net/',
# Why: #8873 in Alexa global
'http://www.whosdatedwho.com/',
# Why: #8874 in Alexa global
'http://www.funtrivia.com/',
# Why: #8875 in Alexa global
'http://www.servis24.cz/',
# Why: #8876 in Alexa global
'http://www.emagister.com/',
# Why: #8877 in Alexa global
'http://www.torrentkitty.com/',
# Why: #8878 in Alexa global
'http://www.abc.com.py/',
# Why: #8879 in Alexa global
'http://www.farfetch.com/',
# Why: #8880 in Alexa global
'http://www.gamestar.de/',
# Why: #8881 in Alexa global
'http://www.careers24.com/',
# Why: #8882 in Alexa global
'http://www.styleblazer.com/',
# Why: #8883 in Alexa global
'http://www.ibtesama.com/',
# Why: #8884 in Alexa global
'http://ifunny.mobi/',
# Why: #8885 in Alexa global
'http://www.antpedia.com/',
# Why: #8886 in Alexa global
'http://www.fivb.org/',
# Why: #8887 in Alexa global
'http://www.littleone.ru/',
# Why: #8888 in Alexa global
'http://www.rainbowdressup.com/',
# Why: #8889 in Alexa global
'http://www.zerozero.pt/',
# Why: #8890 in Alexa global
'http://www.edreams.com/',
# Why: #8891 in Alexa global
'http://www.whoishostingthis.com/',
# Why: #8892 in Alexa global
'http://www.gucci.com/',
# Why: #8893 in Alexa global
'http://www.animeplus.tv/',
# Why: #8894 in Alexa global
'http://www.five.tv/',
# Why: #8895 in Alexa global
'http://www.vacationstogo.com/',
# Why: #8896 in Alexa global
'http://www.dikaiologitika.gr/',
# Why: #8897 in Alexa global
'http://www.mmorpg.com/',
# Why: #8898 in Alexa global
'http://www.jcwhitney.com/',
# Why: #8899 in Alexa global
'http://www.russiandatingbeauties.com/',
# Why: #8900 in Alexa global
'http://www.xrstats.com/',
# Why: #8901 in Alexa global
'http://www.gm99.com/',
# Why: #8902 in Alexa global
'http://www.megashares.com/',
# Why: #8903 in Alexa global
'http://www.oscaro.com/',
# Why: #8904 in Alexa global
'http://www.yezizhu.com/',
# Why: #8905 in Alexa global
'http://www.get2ch.net/',
# Why: #8906 in Alexa global
'http://www.cheaperthandirt.com/',
# Why: #8907 in Alexa global
'http://www.telcel.com/',
# Why: #8908 in Alexa global
'http://www.themefuse.com/',
# Why: #8909 in Alexa global
'http://www.addictivetips.com/',
# Why: #8910 in Alexa global
'http://www.designshack.net/',
# Why: #8911 in Alexa global
'http://www.eurobank.gr/',
# Why: #8912 in Alexa global
'http://www.nexon.net/',
# Why: #8913 in Alexa global
'http://www.rakuya.com.tw/',
# Why: #8914 in Alexa global
'http://www.fulltiltpoker.eu/',
# Why: #8915 in Alexa global
'http://www.pimei.com/',
# Why: #8916 in Alexa global
'http://www.photoshop.com/',
# Why: #8917 in Alexa global
'http://www.domainnamesales.com/',
# Why: #8918 in Alexa global
'http://www.sky.fm/',
# Why: #8919 in Alexa global
'http://www.yasni.de/',
# Why: #8920 in Alexa global
'http://www.travian.ru/',
# Why: #8921 in Alexa global
'http://www.stickpage.com/',
# Why: #8922 in Alexa global
'http://www.joomla-master.org/',
# Why: #8923 in Alexa global
'http://www.sarkari-naukri.in/',
# Why: #8924 in Alexa global
'http://www.iphones.ru/',
# Why: #8925 in Alexa global
'http://www.foto.ru/',
# Why: #8927 in Alexa global
'http://www.smude.edu.in/',
# Why: #8928 in Alexa global
'http://www.gothamist.com/',
# Why: #8929 in Alexa global
'http://www.teslamotors.com/',
# Why: #8930 in Alexa global
'http://www.seobudget.ru/',
# Why: #8931 in Alexa global
'http://www.tiantian.com/',
# Why: #8932 in Alexa global
'http://www.smarter.co.jp/',
# Why: #8933 in Alexa global
'http://www.videohelp.com/',
# Why: #8934 in Alexa global
'http://www.textbroker.com/',
# Why: #8935 in Alexa global
'http://www.garena.com/',
# Why: #8936 in Alexa global
'http://www.patient.co.uk/',
# Why: #8937 in Alexa global
'http://www.20minutepayday.com/',
# Why: #8938 in Alexa global
'http://www.bgames.com/',
# Why: #8939 in Alexa global
'http://www.superherohype.com/',
# Why: #8940 in Alexa global
'http://www.sephora.com.br/',
# Why: #8941 in Alexa global
'http://www.interest.me/',
# Why: #8942 in Alexa global
'http://www.inhabitat.com/',
# Why: #8943 in Alexa global
'http://www.downloads.nl/',
# Why: #8944 in Alexa global
'http://www.rusnovosti.ru/',
# Why: #8945 in Alexa global
'http://www.mr-guangdong.com/',
# Why: #8946 in Alexa global
'http://www.greyhound.com/',
# Why: #8947 in Alexa global
'http://www.qd8.com.cn/',
# Why: #8948 in Alexa global
'http://www.okpay.com/',
# Why: #8949 in Alexa global
'http://www.amateurcommunity.com/',
# Why: #8950 in Alexa global
'http://www.jeunesseglobal.com/',
# Why: #8951 in Alexa global
'http://www.nigma.ru/',
# Why: #8952 in Alexa global
'http://www.brightcove.com/',
# Why: #8953 in Alexa global
'http://www.wabei.cn/',
# Why: #8954 in Alexa global
'http://www.safesearch.net/',
# Why: #8955 in Alexa global
'http://www.teluguone.com/',
# Why: #8956 in Alexa global
'http://www.custojusto.pt/',
# Why: #8957 in Alexa global
'http://www.telebank.ru/',
# Why: #8958 in Alexa global
'http://www.kuwait.tt/',
# Why: #8959 in Alexa global
'http://www.acs.org/',
# Why: #8960 in Alexa global
'http://www.sverigesradio.se/',
# Why: #8961 in Alexa global
'http://www.mps.it/',
# Why: #8963 in Alexa global
'http://www.utanbaby.com/',
# Why: #8964 in Alexa global
'http://www.junocloud.me/',
# Why: #8965 in Alexa global
'http://www.expedia.co.in/',
# Why: #8966 in Alexa global
'http://www.rosnet.ru/',
# Why: #8967 in Alexa global
'http://www.kanoon.ir/',
# Why: #8968 in Alexa global
'http://www.website.ws/',
# Why: #8969 in Alexa global
'http://www.bagittoday.com/',
# Why: #8970 in Alexa global
'http://www.gooya.com/',
# Why: #8971 in Alexa global
'http://www.travelchannel.com/',
# Why: #8972 in Alexa global
'http://www.chooseauto.com.cn/',
# Why: #8973 in Alexa global
'http://www.flix247.com/',
# Why: #8974 in Alexa global
'http://www.momsbangteens.com/',
# Why: #8975 in Alexa global
'http://www.photofacefun.com/',
# Why: #8976 in Alexa global
'http://www.vistaprint.fr/',
# Why: #8977 in Alexa global
'http://www.vidbux.com/',
# Why: #8978 in Alexa global
'http://www.edu.ro/',
# Why: #8979 in Alexa global
'http://www.hd-xvideos.com/',
# Why: #8980 in Alexa global
'http://www.woodworking4home.com/',
# Why: #8981 in Alexa global
'http://www.reformal.ru/',
# Why: #8982 in Alexa global
'http://www.morodora.com/',
# Why: #8983 in Alexa global
'http://www.gelbooru.com/',
# Why: #8984 in Alexa global
'http://www.porntalk.com/',
# Why: #8985 in Alexa global
'http://www.assurland.com/',
# Why: #8986 in Alexa global
'http://www.amalgama-lab.com/',
# Why: #8987 in Alexa global
'http://www.showtime.jp/',
# Why: #8988 in Alexa global
'http://www.9to5mac.com/',
# Why: #8989 in Alexa global
'http://www.linux.org.ru/',
# Why: #8990 in Alexa global
'http://www.dolartoday.com/',
# Why: #8991 in Alexa global
'http://www.theme-junkie.com/',
# Why: #8992 in Alexa global
'http://www.seolib.ru/',
# Why: #8993 in Alexa global
'http://www.unesco.org/',
# Why: #8994 in Alexa global
'http://www.porncontrol.com/',
# Why: #8995 in Alexa global
'http://www.topdocumentaryfilms.com/',
# Why: #8996 in Alexa global
'http://www.tvmovie.de/',
# Why: #8997 in Alexa global
'http://adsl.free.fr/',
# Why: #8998 in Alexa global
'http://www.sprinthost.ru/',
# Why: #8999 in Alexa global
'http://www.reason.com/',
# Why: #9000 in Alexa global
'http://www.morazzia.com/',
# Why: #9001 in Alexa global
'http://www.yellowmoxie.com/',
# Why: #9002 in Alexa global
'http://www.banggood.com/',
# Why: #9003 in Alexa global
'http://www.pex.jp/',
# Why: #9004 in Alexa global
'http://www.espn.com.br/',
# Why: #9005 in Alexa global
'http://www.memedad.com/',
# Why: #9006 in Alexa global
'http://www.lovebuddyhookup.com/',
# Why: #9007 in Alexa global
'http://www.scmp.com/',
# Why: #9008 in Alexa global
'http://www.kjendis.no/',
# Why: #9010 in Alexa global
'http://www.metro-cc.ru/',
# Why: #9011 in Alexa global
'http://www.disdus.com/',
# Why: #9012 in Alexa global
'http://www.nola.com/',
# Why: #9013 in Alexa global
'http://www.tubesplash.com/',
# Why: #9014 in Alexa global
'http://crx7601.com/',
# Why: #9015 in Alexa global
'http://www.iana.org/',
# Why: #9016 in Alexa global
'http://www.howrse.com/',
# Why: #9017 in Alexa global
'http://www.anime-sharing.com/',
# Why: #9018 in Alexa global
'http://www.geny.com/',
# Why: #9019 in Alexa global
'http://www.carrefour.es/',
# Why: #9020 in Alexa global
'http://www.kemalistgazete.net/',
# Why: #9021 in Alexa global
'http://www.freedirectory-list.com/',
# Why: #9022 in Alexa global
'http://www.girlgamey.com/',
# Why: #9023 in Alexa global
'http://www.blogbus.com/',
# Why: #9024 in Alexa global
'http://www.funlolx.com/',
# Why: #9025 in Alexa global
'http://www.zyue.com/',
# Why: #9026 in Alexa global
'http://www.freepeople.com/',
# Why: #9027 in Alexa global
'http://www.tgareed.com/',
# Why: #9028 in Alexa global
'http://www.lifestreetmedia.com/',
# Why: #9029 in Alexa global
'http://www.fybersearch.com/',
# Why: #9030 in Alexa global
'http://www.livefreefun.org/',
# Why: #9031 in Alexa global
'http://www.cairodar.com/',
# Why: #9032 in Alexa global
'http://www.suite101.com/',
# Why: #9033 in Alexa global
'http://www.elcinema.com/',
# Why: #9034 in Alexa global
'http://leiting001.com/',
# Why: #9035 in Alexa global
'http://www.ifttt.com/',
# Why: #9036 in Alexa global
'http://www.google.com.mm/',
# Why: #9037 in Alexa global
'http://www.gizbot.com/',
# Why: #9038 in Alexa global
'http://www.games2win.com/',
# Why: #9040 in Alexa global
'http://www.stiforp.com/',
# Why: #9041 in Alexa global
'http://www.nrc.nl/',
# Why: #9042 in Alexa global
'http://www.slashgear.com/',
# Why: #9043 in Alexa global
'http://www.girlsgames123.com/',
# Why: #9044 in Alexa global
'http://www.mmajunkie.com/',
# Why: #9045 in Alexa global
'http://www.cadenaser.com/',
# Why: #9046 in Alexa global
'http://www.frombar.com/',
# Why: #9047 in Alexa global
'http://www.katmirror.com/',
# Why: #9048 in Alexa global
'http://www.cnsnews.com/',
# Why: #9049 in Alexa global
'http://www.duolingo.com/',
# Why: #9050 in Alexa global
'http://www.afterbuy.de/',
# Why: #9051 in Alexa global
'http://www.jpc.com/',
# Why: #9052 in Alexa global
'http://www.publix.com/',
# Why: #9053 in Alexa global
'http://www.ehealthforum.com/',
# Why: #9054 in Alexa global
'http://www.budget.com/',
# Why: #9055 in Alexa global
'http://www.ipma.pt/',
# Why: #9056 in Alexa global
'http://www.meetladies.me/',
# Why: #9057 in Alexa global
'http://www.adroll.com/',
# Why: #9058 in Alexa global
'http://www.renxo.com/',
# Why: #9059 in Alexa global
'http://www.empireonline.com/',
# Why: #9060 in Alexa global
'http://www.modareb.com/',
# Why: #9061 in Alexa global
'http://www.gamedesign.jp/',
# Why: #9062 in Alexa global
'http://www.topmoviesdirect.com/',
# Why: #9063 in Alexa global
'http://www.mforos.com/',
# Why: #9064 in Alexa global
'http://www.pubarticles.com/',
# Why: #9065 in Alexa global
'http://www.primeshare.tv/',
# Why: #9066 in Alexa global
'http://www.flycell.com.tr/',
# Why: #9067 in Alexa global
'http://www.rapidvidz.com/',
# Why: #9068 in Alexa global
'http://www.kouclo.com/',
# Why: #9069 in Alexa global
'http://www.photography-on-the.net/',
# Why: #9070 in Alexa global
'http://www.tsn.ua/',
# Why: #9071 in Alexa global
'http://www.dreamamateurs.com/',
# Why: #9072 in Alexa global
'http://www.avenues.info/',
# Why: #9073 in Alexa global
'http://www.coolmath.com/',
# Why: #9074 in Alexa global
'http://www.pegast.ru/',
# Why: #9075 in Alexa global
'http://www.myplayyard.com/',
# Why: #9076 in Alexa global
'http://www.myscore.ru/',
# Why: #9077 in Alexa global
'http://www.theync.com/',
# Why: #9078 in Alexa global
'http://www.ducktoursoftampabay.com/',
# Why: #9079 in Alexa global
'http://www.marunadanmalayali.com/',
# Why: #9080 in Alexa global
'http://www.tribune.com.ng/',
# Why: #9081 in Alexa global
'http://www.83suncity.com/',
# Why: #9082 in Alexa global
'http://www.nissanusa.com/',
# Why: #9083 in Alexa global
'http://www.radio.de/',
# Why: #9084 in Alexa global
'http://www.diapers.com/',
# Why: #9086 in Alexa global
'http://myherbalife.com/',
# Why: #9087 in Alexa global
'http://www.flibusta.net/',
# Why: #9088 in Alexa global
'http://www.daft.ie/',
# Why: #9089 in Alexa global
'http://www.buycheapr.com/',
# Why: #9090 in Alexa global
'http://www.sportmaster.ru/',
# Why: #9091 in Alexa global
'http://www.wordhippo.com/',
# Why: #9092 in Alexa global
'http://www.gva.es/',
# Why: #9093 in Alexa global
'http://www.sport24.co.za/',
# Why: #9094 in Alexa global
'http://www.putariabrasileira.com/',
# Why: #9095 in Alexa global
'http://www.suddenlink.net/',
# Why: #9096 in Alexa global
'http://www.bangbrosnetwork.com/',
# Why: #9097 in Alexa global
'http://www.creaders.net/',
# Why: #9098 in Alexa global
'http://www.dailysteals.com/',
# Why: #9099 in Alexa global
'http://www.karakartal.com/',
# Why: #9100 in Alexa global
'http://www.tv-series.me/',
# Why: #9101 in Alexa global
'http://www.bongdaplus.vn/',
# Why: #9102 in Alexa global
'http://www.one.co.il/',
# Why: #9103 in Alexa global
'http://www.giga.de/',
# Why: #9104 in Alexa global
'http://www.contactmusic.com/',
# Why: #9105 in Alexa global
'http://www.informationweek.com/',
# Why: #9106 in Alexa global
'http://www.iqbank.ru/',
# Why: #9107 in Alexa global
'http://www.duapp.com/',
# Why: #9108 in Alexa global
'http://www.cgd.pt/',
# Why: #9109 in Alexa global
'http://www.yepporn.com/',
# Why: #9110 in Alexa global
'http://www.sharekhan.com/',
# Why: #9111 in Alexa global
'http://www.365online.com/',
# Why: #9112 in Alexa global
'http://www.thedailymeal.com/',
# Why: #9113 in Alexa global
'http://www.ag.ru/',
# Why: #9114 in Alexa global
'http://www.claro.com.ar/',
# Why: #9115 in Alexa global
'http://www.mediaworld.it/',
# Why: #9116 in Alexa global
'http://www.bestgore.com/',
# Why: #9117 in Alexa global
'http://www.mohajerist.com/',
# Why: #9118 in Alexa global
'http://www.passion-hd.com/',
# Why: #9119 in Alexa global
'http://www.smallbiztrends.com/',
# Why: #9120 in Alexa global
'http://www.vitals.com/',
# Why: #9121 in Alexa global
'http://www.rocketlawyer.com/',
# Why: #9122 in Alexa global
'http://www.vr-zone.com/',
# Why: #9123 in Alexa global
'http://www.doridro.com/',
# Why: #9124 in Alexa global
'http://www.expedia.it/',
# Why: #9125 in Alexa global
'http://www.aflam4you.tv/',
# Why: #9126 in Alexa global
'http://www.wisconsin.gov/',
# Why: #9127 in Alexa global
'http://www.chinavasion.com/',
# Why: #9128 in Alexa global
'http://www.bigpara.com/',
# Why: #9129 in Alexa global
'http://www.hightrafficacademy.com/',
# Why: #9130 in Alexa global
'http://www.novaposhta.ua/',
# Why: #9131 in Alexa global
'http://www.pearl.de/',
# Why: #9133 in Alexa global
'http://www.boobpedia.com/',
# Why: #9134 in Alexa global
'http://www.mycmapp.com/',
# Why: #9135 in Alexa global
'http://www.89.com/',
# Why: #9136 in Alexa global
'http://www.foxsportsla.com/',
# Why: #9137 in Alexa global
'http://www.annauniv.edu/',
# Why: #9138 in Alexa global
'http://www.tri.co.id/',
# Why: #9139 in Alexa global
'http://www.browsershots.org/',
# Why: #9140 in Alexa global
'http://www.newindianexpress.com/',
# Why: #9141 in Alexa global
'http://www.washingtonexaminer.com/',
# Why: #9142 in Alexa global
'http://www.mozillazine.org/',
# Why: #9143 in Alexa global
'http://www.mg.co.za/',
# Why: #9144 in Alexa global
'http://www.newalbumreleases.net/',
# Why: #9145 in Alexa global
'http://www.trombi.com/',
# Why: #9146 in Alexa global
'http://www.pimsleurapproach.com/',
# Why: #9147 in Alexa global
'http://www.decathlon.es/',
# Why: #9149 in Alexa global
'http://www.shopmania.ro/',
# Why: #9150 in Alexa global
'http://www.brokenlinkcheck.com/',
# Why: #9151 in Alexa global
'http://www.forumeiros.com/',
# Why: #9152 in Alexa global
'http://www.moreniche.com/',
# Why: #9153 in Alexa global
'http://www.falabella.com/',
# Why: #9154 in Alexa global
'http://www.turner.com/',
# Why: #9155 in Alexa global
'http://vogue.com.cn/',
# Why: #9156 in Alexa global
'http://www.reachlocal.net/',
# Why: #9157 in Alexa global
'http://www.upsc.gov.in/',
# Why: #9158 in Alexa global
'http://www.allday2.com/',
# Why: #9159 in Alexa global
'http://www.dtiserv.com/',
# Why: #9160 in Alexa global
'http://www.singaporeair.com/',
# Why: #9161 in Alexa global
'http://www.patoghu.com/',
# Why: #9162 in Alexa global
'http://www.intercambiosvirtuales.org/',
# Why: #9163 in Alexa global
'http://www.bored.com/',
# Why: #9164 in Alexa global
'http://www.nn.ru/',
# Why: #9165 in Alexa global
'http://www.24smi.org/',
# Why: #9166 in Alexa global
'http://www.mobile-review.com/',
# Why: #9167 in Alexa global
'http://www.rbs.co.uk/',
# Why: #9168 in Alexa global
'http://www.westeros.org/',
# Why: #9169 in Alexa global
'http://www.dragonfable.com/',
# Why: #9170 in Alexa global
'http://www.wg-gesucht.de/',
# Why: #9171 in Alexa global
'http://www.ebaypartnernetwork.com/',
# Why: #9172 in Alexa global
'http://www.smartsheet.com/',
# Why: #9173 in Alexa global
'http://www.askul.co.jp/',
# Why: #9174 in Alexa global
'http://www.filmai.in/',
# Why: #9175 in Alexa global
'http://www.iranianuk.com/',
# Why: #9176 in Alexa global
'http://www.zhulang.com/',
# Why: #9177 in Alexa global
'http://www.game-game.com.ua/',
# Why: #9178 in Alexa global
'http://www.jigzone.com/',
# Why: #9179 in Alexa global
'http://www.vidbull.com/',
# Why: #9180 in Alexa global
'http://www.trustpilot.com/',
# Why: #9181 in Alexa global
'http://www.baodatviet.vn/',
# Why: #9182 in Alexa global
'http://www.haaretz.com/',
# Why: #9183 in Alexa global
'http://careerbuilder.co.in/',
# Why: #9184 in Alexa global
'http://www.veikkaus.fi/',
# Why: #9185 in Alexa global
'http://www.bmw.com.cn/',
# Why: #9186 in Alexa global
'http://www.potterybarnkids.com/',
# Why: #9187 in Alexa global
'http://www.freegamelot.com/',
# Why: #9188 in Alexa global
'http://www.worldtimeserver.com/',
# Why: #9189 in Alexa global
'http://www.jigsy.com/',
# Why: #9190 in Alexa global
'http://www.widgetbox.com/',
# Why: #9191 in Alexa global
'http://www.lasexta.com/',
# Why: #9192 in Alexa global
'http://www.mediav.com/',
# Why: #9193 in Alexa global
'http://www.aintitcool.com/',
# Why: #9194 in Alexa global
'http://www.youwillfind.info/',
# Why: #9195 in Alexa global
'http://www.bharatmatrimony.com/',
# Why: #9196 in Alexa global
'http://www.translated.net/',
# Why: #9197 in Alexa global
'http://www.virginia.edu/',
# Why: #9198 in Alexa global
'http://www.5566.net/',
# Why: #9199 in Alexa global
'http://www.questionmarket.com/',
# Why: #9200 in Alexa global
'http://www.587766.com/',
# Why: #9201 in Alexa global
'http://newspickup.com/',
# Why: #9202 in Alexa global
'http://www.womansday.com/',
# Why: #9203 in Alexa global
'http://www.segodnya.ua/',
# Why: #9204 in Alexa global
'http://www.reagancoalition.com/',
# Why: #9206 in Alexa global
'http://www.trafficswarm.com/',
# Why: #9207 in Alexa global
'http://www.orbitdownloader.com/',
# Why: #9208 in Alexa global
'http://www.filmehd.net/',
# Why: #9209 in Alexa global
'http://www.porn-star.com/',
# Why: #9210 in Alexa global
'http://www.lawyers.com/',
# Why: #9211 in Alexa global
'http://www.life.hu/',
# Why: #9212 in Alexa global
'http://www.listenonrepeat.com/',
# Why: #9213 in Alexa global
'http://www.phpfox.com/',
# Why: #9214 in Alexa global
'http://www.campusexplorer.com/',
# Why: #9215 in Alexa global
'http://www.eprothomalo.com/',
# Why: #9216 in Alexa global
'http://www.linekong.com/',
# Why: #9217 in Alexa global
'http://www.blogjava.net/',
# Why: #9218 in Alexa global
'http://www.qzone.cc/',
# Why: #9219 in Alexa global
'http://www.gamespassport.com/',
# Why: #9220 in Alexa global
'http://www.bet365.es/',
# Why: #9221 in Alexa global
'http://www.bikeradar.com/',
# Why: #9222 in Alexa global
'http://www.allmonitors.net/',
# Why: #9223 in Alexa global
'http://xwh.cn/',
# Why: #9224 in Alexa global
'http://www.naijaloaded.com/',
# Why: #9225 in Alexa global
'http://www.chazidian.com/',
# Why: #9226 in Alexa global
'http://www.channeladvisor.com/',
# Why: #9227 in Alexa global
'http://www.arenabg.com/',
# Why: #9228 in Alexa global
'http://www.briian.com/',
# Why: #9230 in Alexa global
'http://www.cucirca.eu/',
# Why: #9231 in Alexa global
'http://www.mamsy.ru/',
# Why: #9232 in Alexa global
'http://www.dl4all.com/',
# Why: #9233 in Alexa global
'http://www.wethreegreens.com/',
# Why: #9234 in Alexa global
'http://www.hsbc.co.in/',
# Why: #9235 in Alexa global
'http://www.squirt.org/',
# Why: #9236 in Alexa global
'http://www.sisal.it/',
# Why: #9237 in Alexa global
'http://www.bonprix.ru/',
# Why: #9238 in Alexa global
'http://www.odn.ne.jp/',
# Why: #9239 in Alexa global
'http://www.awd.ru/',
# Why: #9240 in Alexa global
'http://www.a-q-f.com/',
# Why: #9241 in Alexa global
'http://www.4game.com/',
# Why: #9242 in Alexa global
'http://www.24timezones.com/',
# Why: #9243 in Alexa global
'http://www.fgv.br/',
# Why: #9244 in Alexa global
'http://www.topnews.in/',
# Why: #9245 in Alexa global
'http://www.roku.com/',
# Why: #9246 in Alexa global
'http://www.ulub.pl/',
# Why: #9247 in Alexa global
'http://www.launchpad.net/',
# Why: #9248 in Alexa global
'http://www.simplyhired.co.in/',
# Why: #9249 in Alexa global
'http://www.response.jp/',
# Why: #9250 in Alexa global
'http://click.ro/',
# Why: #9251 in Alexa global
'http://www.thisis50.com/',
# Why: #9252 in Alexa global
'http://www.horoscopofree.com/',
# Why: #9253 in Alexa global
'http://www.comoeumesintoquando.tumblr.com/',
# Why: #9254 in Alexa global
'http://www.dlvr.it/',
# Why: #9255 in Alexa global
'http://www.4umf.com/',
# Why: #9256 in Alexa global
'http://www.picresize.com/',
# Why: #9257 in Alexa global
'http://www.aleqt.com/',
# Why: #9258 in Alexa global
'http://www.correos.es/',
# Why: #9259 in Alexa global
'http://www.pog.com/',
# Why: #9260 in Alexa global
'http://www.dlsoftware.org/',
# Why: #9261 in Alexa global
'http://www.primekhobor.com/',
# Why: #9262 in Alexa global
'http://www.dicionarioinformal.com.br/',
# Why: #9263 in Alexa global
'http://www.flixxy.com/',
# Why: #9264 in Alexa global
'http://www.hotklix.com/',
# Why: #9265 in Alexa global
'http://www.mglclub.com/',
# Why: #9266 in Alexa global
'http://www.airdroid.com/',
# Why: #9267 in Alexa global
'http://www.9281.net/',
# Why: #9268 in Alexa global
'http://faxingw.cn/',
# Why: #9269 in Alexa global
'http://www.satu.kz/',
# Why: #9270 in Alexa global
'http://www.carambatv.ru/',
# Why: #9271 in Alexa global
'http://www.autonews.ru/',
# Why: #9272 in Alexa global
'http://www.playerinstaller.com/',
# Why: #9273 in Alexa global
'http://www.swedbank.lv/',
# Why: #9274 in Alexa global
'http://www.enladisco.com/',
# Why: #9275 in Alexa global
'http://www.lib.ru/',
# Why: #9276 in Alexa global
'http://www.revolveclothing.com/',
# Why: #9277 in Alexa global
'http://www.aftermarket.pl/',
# Why: #9278 in Alexa global
'http://www.copy.com/',
# Why: #9279 in Alexa global
'http://www.muchgames.com/',
# Why: #9280 in Alexa global
'http://www.brigitte.de/',
# Why: #9281 in Alexa global
'http://www.ticketmaster.co.uk/',
# Why: #9282 in Alexa global
'http://www.cultofmac.com/',
# Why: #9283 in Alexa global
'http://www.bankontraffic.com/',
# Why: #9284 in Alexa global
'http://www.cnnamador.com/',
# Why: #9285 in Alexa global
'http://www.dwayir.com/',
# Why: #9286 in Alexa global
'http://www.davidicke.com/',
# Why: #9287 in Alexa global
'http://www.autosport.com/',
# Why: #9288 in Alexa global
'http://www.file.org/',
# Why: #9289 in Alexa global
'http://www.subtlepatterns.com/',
# Why: #9290 in Alexa global
'http://www.playmillion.com/',
# Why: #9291 in Alexa global
'http://www.gexing.com/',
# Why: #9292 in Alexa global
'http://www.thinkphp.cn/',
# Why: #9293 in Alexa global
'http://www.zum.com/',
# Why: #9294 in Alexa global
'http://www.eskimotube.com/',
# Why: #9295 in Alexa global
'http://www.guenstiger.de/',
# Why: #9296 in Alexa global
'http://www.diesiedleronline.de/',
# Why: #9297 in Alexa global
'http://www.nelly.com/',
# Why: #9298 in Alexa global
'http://www.press24.mk/',
# Why: #9299 in Alexa global
'http://www.psdgraphics.com/',
# Why: #9300 in Alexa global
'http://www.makeupalley.com/',
# Why: #9301 in Alexa global
'http://www.cloudify.cc/',
# Why: #9302 in Alexa global
'http://www.3a6aayer.com/',
# Why: #9303 in Alexa global
'http://www.apspsc.gov.in/',
# Why: #9304 in Alexa global
'http://www.dxy.cn/',
# Why: #9305 in Alexa global
'http://www.hotnews25.com/',
# Why: #9306 in Alexa global
'http://www.symbaloo.com/',
# Why: #9307 in Alexa global
'http://www.hiroimono.org/',
# Why: #9308 in Alexa global
'http://www.enbac.com/',
# Why: #9309 in Alexa global
'http://www.pornravage.com/',
# Why: #9310 in Alexa global
'http://abcfamily.go.com/',
# Why: #9311 in Alexa global
'http://www.fewo-direkt.de/',
# Why: #9312 in Alexa global
'http://www.elog-ch.net/',
# Why: #9313 in Alexa global
'http://www.n24.de/',
# Why: #9314 in Alexa global
'http://www.englishclub.com/',
# Why: #9315 in Alexa global
'http://www.ibicn.com/',
# Why: #9316 in Alexa global
'http://www.anibis.ch/',
# Why: #9317 in Alexa global
'http://www.tehran.ir/',
# Why: #9318 in Alexa global
'http://www.streamsex.com/',
# Why: #9319 in Alexa global
'http://www.drjays.com/',
# Why: #9320 in Alexa global
'http://www.islamqa.info/',
# Why: #9321 in Alexa global
'http://www.techandgaming247.com/',
# Why: #9322 in Alexa global
'http://www.apunkachoice.com/',
# Why: #9323 in Alexa global
'http://16888.com/',
# Why: #9324 in Alexa global
'http://www.morguefile.com/',
# Why: #9325 in Alexa global
'http://www.dalealplay.com/',
# Why: #9326 in Alexa global
'http://www.spinrewriter.com/',
# Why: #9327 in Alexa global
'http://www.newsmaxhealth.com/',
# Why: #9328 in Alexa global
'http://www.myvi.ru/',
# Why: #9329 in Alexa global
'http://www.moneysavingmom.com/',
# Why: #9331 in Alexa global
'http://www.jeux-fille-gratuit.com/',
# Why: #9332 in Alexa global
'http://www.swiki.jp/',
# Why: #9333 in Alexa global
'http://nowec.com/',
# Why: #9334 in Alexa global
'http://www.opn.com/',
# Why: #9335 in Alexa global
'http://www.idiva.com/',
# Why: #9336 in Alexa global
'http://www.bnc.ca/',
# Why: #9337 in Alexa global
'http://www.eater.com/',
# Why: #9338 in Alexa global
'http://www.designcrowd.com/',
# Why: #9339 in Alexa global
'http://www.jkforum.net/',
# Why: #9340 in Alexa global
'http://www.netkeiba.com/',
# Why: #9341 in Alexa global
'http://www.practicalecommerce.com/',
# Why: #9342 in Alexa global
'http://www.genuineptr.com/',
# Why: #9343 in Alexa global
'http://www.bloog.pl/',
# Why: #9344 in Alexa global
'http://www.ladunliadi.blogspot.com/',
# Why: #9345 in Alexa global
'http://www.stclick.ir/',
# Why: #9346 in Alexa global
'http://www.anwb.nl/',
# Why: #9347 in Alexa global
'http://www.mkyong.com/',
# Why: #9348 in Alexa global
'http://www.lavoixdunord.fr/',
# Why: #9349 in Alexa global
'http://www.top-inspector.ru/',
# Why: #9350 in Alexa global
'http://www.pornicom.com/',
# Why: #9351 in Alexa global
'http://www.yithemes.com/',
# Why: #9352 in Alexa global
'http://www.canada411.ca/',
# Why: #9353 in Alexa global
'http://www.mos.ru/',
# Why: #9354 in Alexa global
'http://www.somuch.com/',
# Why: #9355 in Alexa global
'http://www.nen.com.cn/',
# Why: #9356 in Alexa global
'http://www.runtastic.com/',
# Why: #9357 in Alexa global
'http://www.cadoinpiedi.it/',
# Why: #9358 in Alexa global
'http://www.google.co.bw/',
# Why: #9359 in Alexa global
'http://www.shkolazhizni.ru/',
# Why: #9360 in Alexa global
'http://www.heroku.com/',
# Why: #9361 in Alexa global
'http://www.net114.com/',
# Why: #9362 in Alexa global
'http://www.proprofs.com/',
# Why: #9363 in Alexa global
'http://www.banathi.com/',
# Why: #9364 in Alexa global
'http://www.bunte.de/',
# Why: #9365 in Alexa global
'http://pso2.jp/',
# Why: #9366 in Alexa global
'http://www.ncsecu.org/',
# Why: #9367 in Alexa global
'http://www.globalpost.com/',
# Why: #9368 in Alexa global
'http://www.comscore.com/',
# Why: #9370 in Alexa global
'http://www.wrapbootstrap.com/',
# Why: #9371 in Alexa global
'http://www.directupload.net/',
# Why: #9372 in Alexa global
'http://www.gpotato.eu/',
# Why: #9373 in Alexa global
'http://vipsister23.com/',
# Why: #9374 in Alexa global
'http://www.shopatron.com/',
# Why: #9375 in Alexa global
'http://www.aeroflot.ru/',
# Why: #9376 in Alexa global
'http://www.asiandatingbeauties.com/',
# Why: #9377 in Alexa global
'http://www.egooad.com/',
# Why: #9378 in Alexa global
'http://www.annunci69.it/',
# Why: #9379 in Alexa global
'http://www.yext.com/',
# Why: #9380 in Alexa global
'http://www.gruenderszene.de/',
# Why: #9382 in Alexa global
'http://www.veengle.com/',
# Why: #9383 in Alexa global
'http://www.reelzhot.com/',
# Why: #9384 in Alexa global
'http://www.enstage.com/',
# Why: #9385 in Alexa global
'http://www.icnetwork.co.uk/',
# Why: #9386 in Alexa global
'http://www.scarlet-clicks.info/',
# Why: #9388 in Alexa global
'http://www.brands4friends.de/',
# Why: #9389 in Alexa global
'http://www.watchersweb.com/',
# Why: #9390 in Alexa global
'http://www.music-clips.net/',
# Why: #9391 in Alexa global
'http://www.pornyeah.com/',
# Why: #9392 in Alexa global
'http://www.thehollywoodgossip.com/',
# Why: #9393 in Alexa global
'http://www.e5.ru/',
# Why: #9394 in Alexa global
'http://www.boldchat.com/',
# Why: #9395 in Alexa global
'http://www.maskolis.com/',
# Why: #9396 in Alexa global
'http://www.ba-k.com/',
# Why: #9397 in Alexa global
'http://www.monoprice.com/',
# Why: #9398 in Alexa global
'http://www.lacoste.com/',
# Why: #9399 in Alexa global
'http://www.byu.edu/',
# Why: #9400 in Alexa global
'http://www.zqgame.com/',
# Why: #9401 in Alexa global
'http://www.mofosex.com/',
# Why: #9402 in Alexa global
'http://www.roboxchange.com/',
# Why: #9403 in Alexa global
'http://www.elnuevoherald.com/',
# Why: #9404 in Alexa global
'http://www.joblo.com/',
# Why: #9405 in Alexa global
'http://www.songtexte.com/',
# Why: #9406 in Alexa global
'http://www.goodsearch.com/',
# Why: #9407 in Alexa global
'http://www.dnevnik.bg/',
# Why: #9408 in Alexa global
'http://www.tv.nu/',
# Why: #9409 in Alexa global
'http://www.movies.com/',
# Why: #9410 in Alexa global
'http://www.ganeshaspeaks.com/',
# Why: #9411 in Alexa global
'http://www.vonage.com/',
# Why: #9412 in Alexa global
'http://www.dawhois.com/',
# Why: #9413 in Alexa global
'http://www.companieshouse.gov.uk/',
# Why: #9414 in Alexa global
'http://www.ofertix.com/',
# Why: #9415 in Alexa global
'http://www.amaderforum.com/',
# Why: #9416 in Alexa global
'http://www.directorycritic.com/',
# Why: #9417 in Alexa global
'http://www.quickfilmz.com/',
# Why: #9418 in Alexa global
'http://www.youpornos.info/',
# Why: #9419 in Alexa global
'http://www.animeultima.tv/',
# Why: #9420 in Alexa global
'http://www.php.su/',
# Why: #9421 in Alexa global
'http://www.inciswf.com/',
# Why: #9422 in Alexa global
'http://www.bayern.de/',
# Why: #9423 in Alexa global
'http://www.hotarabchat.com/',
# Why: #9424 in Alexa global
'http://www.goodlayers.com/',
# Why: #9425 in Alexa global
'http://www.billiger.de/',
# Why: #9426 in Alexa global
'http://www.ponparemall.com/',
# Why: #9427 in Alexa global
'http://www.portaltvto.com/',
# Why: #9428 in Alexa global
'http://www.filesend.to/',
# Why: #9429 in Alexa global
'http://www.isimtescil.net/',
# Why: #9430 in Alexa global
'http://www.animeid.tv/',
# Why: #9431 in Alexa global
'http://www.trivago.es/',
# Why: #9433 in Alexa global
'http://www.17u.net/',
# Why: #9434 in Alexa global
'http://www.enekas.info/',
# Why: #9435 in Alexa global
'http://www.trendsonline.mobi/',
# Why: #9436 in Alexa global
'http://www.hostinger.ru/',
# Why: #9437 in Alexa global
'http://www.navad.net/',
# Why: #9438 in Alexa global
'http://www.mysupermarket.co.uk/',
# Why: #9440 in Alexa global
'http://www.webkinz.com/',
# Why: #9441 in Alexa global
'http://askfrank.net/',
# Why: #9442 in Alexa global
'http://www.pokernews.com/',
# Why: #9443 in Alexa global
'http://www.lyricsmania.com/',
# Why: #9444 in Alexa global
'http://www.chronicle.com/',
# Why: #9446 in Alexa global
'http://www.ns.nl/',
# Why: #9447 in Alexa global
'http://www.gaopeng.com/',
# Why: #9449 in Alexa global
'http://www.lifehacker.jp/',
# Why: #9450 in Alexa global
'http://www.96down.com/',
# Why: #9451 in Alexa global
'http://www.2500sz.com/',
# Why: #9453 in Alexa global
'http://www.paginasamarillas.com/',
# Why: #9454 in Alexa global
'http://www.kproxy.com/',
# Why: #9455 in Alexa global
'http://www.irantvto.ir/',
# Why: #9456 in Alexa global
'http://www.stuffgate.com/',
# Why: #9457 in Alexa global
'http://www.exler.ru/',
# Why: #9458 in Alexa global
'http://www.disney.es/',
# Why: #9459 in Alexa global
'http://www.turbocashsurfin.com/',
# Why: #9460 in Alexa global
'http://www.xmbs.jp/',
# Why: #9461 in Alexa global
'http://www.steadyhealth.com/',
# Why: #9462 in Alexa global
'http://www.thebotnet.com/',
# Why: #9463 in Alexa global
'http://www.newscientist.com/',
# Why: #9464 in Alexa global
'http://www.ampnetzwerk.de/',
# Why: #9465 in Alexa global
'http://www.htcmania.com/',
# Why: #9466 in Alexa global
'http://www.proceso.com.mx/',
# Why: #9468 in Alexa global
'http://www.teenport.com/',
# Why: #9469 in Alexa global
'http://www.tfilm.tv/',
# Why: #9470 in Alexa global
'http://www.trck.me/',
# Why: #9471 in Alexa global
'http://www.lifestartsat21.com/',
# Why: #9472 in Alexa global
'http://www.9show.com/',
# Why: #9473 in Alexa global
'http://www.expert.ru/',
# Why: #9474 in Alexa global
'http://www.mangalam.com/',
# Why: #9475 in Alexa global
'http://beyebe.com/',
# Why: #9476 in Alexa global
'http://www.ctrls.in/',
# Why: #9477 in Alexa global
'http://www.despegar.com.mx/',
# Why: #9478 in Alexa global
'http://www.bazingamob.com/',
# Why: #9479 in Alexa global
'http://www.netmagazine.com/',
# Why: #9480 in Alexa global
'http://www.sportssnip.com/',
# Why: #9481 in Alexa global
'http://www.lik.cl/',
# Why: #9483 in Alexa global
'http://www.targobank.de/',
# Why: #9484 in Alexa global
'http://www.hamsterporn.tv/',
# Why: #9485 in Alexa global
'http://www.lastfm.ru/',
# Why: #9486 in Alexa global
'http://www.wallinside.com/',
# Why: #9487 in Alexa global
'http://www.alawar.ru/',
# Why: #9488 in Alexa global
'http://www.ogame.org/',
# Why: #9489 in Alexa global
'http://www.guardiannews.com/',
# Why: #9490 in Alexa global
'http://www.intensedebate.com/',
# Why: #9491 in Alexa global
'http://www.citrix.com/',
# Why: #9492 in Alexa global
'http://www.ppt.cc/',
# Why: #9493 in Alexa global
'http://www.kavanga.ru/',
# Why: #9494 in Alexa global
'http://www.wotif.com/',
# Why: #9495 in Alexa global
'http://www.terapeak.com/',
# Why: #9496 in Alexa global
'http://www.swalif.com/',
# Why: #9497 in Alexa global
'http://www.demotivation.me/',
# Why: #9498 in Alexa global
'http://www.liquidweb.com/',
# Why: #9499 in Alexa global
'http://www.whydontyoutrythis.com/',
# Why: #9500 in Alexa global
'http://www.techhive.com/',
# Why: #9501 in Alexa global
'http://www.stylelist.com/',
# Why: #9502 in Alexa global
'http://www.shoppersstop.com/',
# Why: #9503 in Alexa global
'http://www.muare.vn/',
# Why: #9504 in Alexa global
'http://www.filezilla-project.org/',
# Why: #9505 in Alexa global
'http://www.wowwiki.com/',
# Why: #9506 in Alexa global
'http://www.ucm.es/',
# Why: #9507 in Alexa global
'http://www.plus.pl/',
# Why: #9509 in Alexa global
'http://www.goclips.tv/',
# Why: #9510 in Alexa global
'http://www.jeddahbikers.com/',
# Why: #9511 in Alexa global
'http://www.themalaysianinsider.com/',
# Why: #9512 in Alexa global
'http://www.buzznet.com/',
# Why: #9513 in Alexa global
'http://www.moonfruit.com/',
# Why: #9514 in Alexa global
'http://www.zivame.com/',
# Why: #9515 in Alexa global
'http://www.sproutsocial.com/',
# Why: #9516 in Alexa global
'http://www.evony.com/',
# Why: #9517 in Alexa global
'http://www.valuecommerce.com/',
# Why: #9518 in Alexa global
'http://www.cecile.co.jp/',
# Why: #9519 in Alexa global
'http://www.onlineconversion.com/',
# Why: #9520 in Alexa global
'http://www.adbooth.com/',
# Why: #9521 in Alexa global
'http://www.clubpartners.ru/',
# Why: #9522 in Alexa global
'http://www.rumah123.com/',
# Why: #9523 in Alexa global
'http://www.searspartsdirect.com/',
# Why: #9524 in Alexa global
'http://www.hollywood.com/',
# Why: #9525 in Alexa global
'http://www.divx.com/',
# Why: #9526 in Alexa global
'http://www.adverts.ie/',
# Why: #9527 in Alexa global
'http://www.filfan.com/',
# Why: #9528 in Alexa global
'http://www.t3.com/',
# Why: #9529 in Alexa global
'http://www.123vidz.com/',
# Why: #9530 in Alexa global
'http://www.technicpack.net/',
# Why: #9531 in Alexa global
'http://www.mightydeals.com/',
# Why: #9532 in Alexa global
'http://www.techgig.com/',
# Why: #9533 in Alexa global
'http://www.business.gov.au/',
# Why: #9534 in Alexa global
'http://www.phys.org/',
# Why: #9535 in Alexa global
'http://www.tweepi.com/',
# Why: #9536 in Alexa global
'http://www.bobfilm.net/',
# Why: #9537 in Alexa global
'http://www.phandroid.com/',
# Why: #9538 in Alexa global
'http://www.obozrevatel.com/',
# Why: #9539 in Alexa global
'http://www.elitedaily.com/',
# Why: #9540 in Alexa global
'http://www.tcfexpress.com/',
# Why: #9541 in Alexa global
'http://www.softaculous.com/',
# Why: #9542 in Alexa global
'http://www.xo.gr/',
# Why: #9543 in Alexa global
'http://www.cargocollective.com/',
# Why: #9544 in Alexa global
'http://www.airchina.com.cn/',
# Why: #9545 in Alexa global
'http://www.epicgameads.com/',
# Why: #9546 in Alexa global
'http://www.billigfluege.de/',
# Why: #9547 in Alexa global
'http://www.google.co.zm/',
# Why: #9548 in Alexa global
'http://www.flamingtext.com/',
# Why: #9549 in Alexa global
'http://www.mediatraffic.com/',
# Why: #9550 in Alexa global
'http://www.redboxinstant.com/',
# Why: #9551 in Alexa global
'http://www.tvquran.com/',
# Why: #9552 in Alexa global
'http://www.mstaml.com/',
# Why: #9553 in Alexa global
'http://www.polskieradio.pl/',
# Why: #9554 in Alexa global
'http://www.ipower.com/',
# Why: #9555 in Alexa global
'http://www.magicjack.com/',
# Why: #9556 in Alexa global
'http://www.linuxidc.com/',
# Why: #9557 in Alexa global
'http://www.audiojungle.net/',
# Why: #9558 in Alexa global
'http://www.zoomit.ir/',
# Why: #9559 in Alexa global
'http://www.celebritygossiplive.com/',
# Why: #9560 in Alexa global
'http://www.entheosweb.com/',
# Why: #9561 in Alexa global
'http://www.duke.edu/',
# Why: #9562 in Alexa global
'http://www.lamchame.com/',
# Why: #9563 in Alexa global
'http://www.trinixy.ru/',
# Why: #9564 in Alexa global
'http://www.heroeswm.ru/',
# Why: #9565 in Alexa global
'http://www.leovegas.com/',
# Why: #9566 in Alexa global
'http://www.redvak.com/',
# Why: #9567 in Alexa global
'http://www.wpexplorer.com/',
# Why: #9568 in Alexa global
'http://www.pornosexxxtits.com/',
# Why: #9569 in Alexa global
'http://www.thatrendsystem.com/',
# Why: #9570 in Alexa global
'http://www.minutouno.com/',
# Why: #9571 in Alexa global
'http://www.dnes.bg/',
# Why: #9572 in Alexa global
'http://www.raqq.com/',
# Why: #9573 in Alexa global
'http://www.misr5.com/',
# Why: #9574 in Alexa global
'http://www.m6replay.fr/',
# Why: #9575 in Alexa global
'http://www.ciao.es/',
# Why: #9576 in Alexa global
'http://www.indiatvnews.com/',
# Why: #9577 in Alexa global
'http://www.transunion.com/',
# Why: #9578 in Alexa global
'http://www.mha.nic.in/',
# Why: #9579 in Alexa global
'http://www.listia.com/',
# Why: #9580 in Alexa global
'http://www.duba.net/',
# Why: #9581 in Alexa global
'http://www.apec.fr/',
# Why: #9582 in Alexa global
'http://www.dexknows.com/',
# Why: #9583 in Alexa global
'http://www.americangirl.com/',
# Why: #9584 in Alexa global
'http://www.seekbang.com/',
# Why: #9585 in Alexa global
'http://www.greenmangaming.com/',
# Why: #9586 in Alexa global
'http://www.ptfish.com/',
# Why: #9587 in Alexa global
'http://www.myjob.com.cn/',
# Why: #9588 in Alexa global
'http://www.mistrzowie.org/',
# Why: #9589 in Alexa global
'http://www.chinatrust.com.tw/',
# Why: #9590 in Alexa global
'http://kongfz.com/',
# Why: #9591 in Alexa global
'http://www.finam.ru/',
# Why: #9592 in Alexa global
'http://www.tapiture.com/',
# Why: #9593 in Alexa global
'http://www.beon.ru/',
# Why: #9594 in Alexa global
'http://www.redsurf.ru/',
# Why: #9595 in Alexa global
'http://www.jamiiforums.com/',
# Why: #9596 in Alexa global
'http://www.grannysextubez.com/',
# Why: #9597 in Alexa global
'http://www.adlux.com/',
# Why: #9598 in Alexa global
'http://www.just-eat.co.uk/',
# Why: #9599 in Alexa global
'http://www.live24.gr/',
# Why: #9600 in Alexa global
'http://www.moip.com.br/',
# Why: #9601 in Alexa global
'http://www.chanel.com/',
# Why: #9602 in Alexa global
'http://www.sbs.co.kr/',
# Why: #9603 in Alexa global
'http://www.screwfix.com/',
# Why: #9604 in Alexa global
'http://www.trivago.it/',
# Why: #9605 in Alexa global
'http://airw.net/',
# Why: #9606 in Alexa global
'http://www.dietnavi.com/',
# Why: #9607 in Alexa global
'http://www.spartoo.es/',
# Why: #9608 in Alexa global
'http://www.game-debate.com/',
# Why: #9609 in Alexa global
'http://www.rotahaber.com/',
# Why: #9611 in Alexa global
'http://www.google.md/',
# Why: #9612 in Alexa global
'http://www.pornsex69.com/',
# Why: #9613 in Alexa global
'http://tmgonlinemedia.nl/',
# Why: #9614 in Alexa global
'http://www.myvoffice.com/',
# Why: #9615 in Alexa global
'http://www.wroclaw.pl/',
# Why: #9616 in Alexa global
'http://www.finansbank.com.tr/',
# Why: #9617 in Alexa global
'http://www.govdelivery.com/',
# Why: #9618 in Alexa global
'http://www.gamesbox.com/',
# Why: #9619 in Alexa global
'http://37wan.com/',
# Why: #9620 in Alexa global
'http://www.portableapps.com/',
# Why: #9621 in Alexa global
'http://www.dateinasia.com/',
# Why: #9623 in Alexa global
'http://www.northerntool.com/',
# Why: #9624 in Alexa global
'http://www.51pinwei.com/',
# Why: #9625 in Alexa global
'http://www.ocregister.com/',
# Why: #9626 in Alexa global
'http://www.noelshack.com/',
# Why: #9627 in Alexa global
'http://www.ipanelonline.com/',
# Why: #9628 in Alexa global
'http://www.klart.se/',
# Why: #9629 in Alexa global
'http://www.ismedia.jp/',
# Why: #9630 in Alexa global
'http://hqew.com/',
# Why: #9631 in Alexa global
'http://www.moodle.org/',
# Why: #9632 in Alexa global
'http://www.westernunion.fr/',
# Why: #9633 in Alexa global
'http://www.medindia.net/',
# Why: #9634 in Alexa global
'http://www.sencha.com/',
# Why: #9635 in Alexa global
'http://www.moveon.org/',
# Why: #9636 in Alexa global
'http://www.sipeliculas.com/',
# Why: #9637 in Alexa global
'http://www.beachbody.com/',
# Why: #9639 in Alexa global
'http://www.experts-exchange.com/',
# Why: #9640 in Alexa global
'http://www.davidsbridal.com/',
# Why: #9641 in Alexa global
'http://www.apotheken-umschau.de/',
# Why: #9642 in Alexa global
'http://www.melaleuca.com/',
# Why: #9643 in Alexa global
'http://www.cdbaby.com/',
# Why: #9644 in Alexa global
'http://www.humblebundle.com/',
# Why: #9645 in Alexa global
'http://www.telenet.be/',
# Why: #9646 in Alexa global
'http://www.labaq.com/',
# Why: #9647 in Alexa global
'http://www.smartaddons.com/',
# Why: #9648 in Alexa global
'http://www.vukajlija.com/',
# Why: #9649 in Alexa global
'http://www.zalando.es/',
# Why: #9650 in Alexa global
'http://www.articlerich.com/',
# Why: #9651 in Alexa global
'http://www.dm456.com/',
# Why: #9652 in Alexa global
'http://www.global-adsopt.com/',
# Why: #9653 in Alexa global
'http://www.forumophilia.com/',
# Why: #9654 in Alexa global
'http://www.dafiti.com.mx/',
# Why: #9655 in Alexa global
'http://www.funnystuff247.org/',
# Why: #9656 in Alexa global
'http://www.300mbfilms.com/',
# Why: #9657 in Alexa global
'http://www.xvideospornogratis.com/',
# Why: #9658 in Alexa global
'http://www.readnovel.com/',
# Why: #9659 in Alexa global
'http://www.khmer-news.org/',
# Why: #9660 in Alexa global
'http://www.media970.com/',
# Why: #9661 in Alexa global
'http://www.zwinky.com/',
# Why: #9662 in Alexa global
'http://www.newsbullet.in/',
# Why: #9663 in Alexa global
'http://www.pingfarm.com/',
# Why: #9664 in Alexa global
'http://www.lovetoknow.com/',
# Why: #9665 in Alexa global
'http://www.dntx.com/',
# Why: #9666 in Alexa global
'http://www.dip.jp/',
# Why: #9667 in Alexa global
'http://www.pap.fr/',
# Why: #9668 in Alexa global
'http://www.dizzcloud.com/',
# Why: #9669 in Alexa global
'http://www.nav.no/',
# Why: #9670 in Alexa global
'http://www.lotto.pl/',
# Why: #9671 in Alexa global
'http://www.freemp3whale.com/',
# Why: #9672 in Alexa global
'http://www.smartadserver.com/',
# Why: #9673 in Alexa global
'http://www.westpac.co.nz/',
# Why: #9674 in Alexa global
'http://www.kenrockwell.com/',
# Why: #9675 in Alexa global
'http://www.hongkongpost.com/',
# Why: #9676 in Alexa global
'http://www.delish.com/',
# Why: #9677 in Alexa global
'http://www.islam-lovers.com/',
# Why: #9678 in Alexa global
'http://www.edis.at/',
# Why: #9679 in Alexa global
'http://www.avery.com/',
# Why: #9680 in Alexa global
'http://www.giaitri.com/',
# Why: #9681 in Alexa global
'http://www.linksmanagement.com/',
# Why: #9682 in Alexa global
'http://www.beruby.com/',
# Why: #9683 in Alexa global
'http://www.1stwebgame.com/',
# Why: #9684 in Alexa global
'http://www.whocallsme.com/',
# Why: #9685 in Alexa global
'http://www.westwood.com/',
# Why: #9686 in Alexa global
'http://www.lmaohub.com/',
# Why: #9687 in Alexa global
'http://www.theresumator.com/',
# Why: #9688 in Alexa global
'http://www.nude.tv/',
# Why: #9689 in Alexa global
'http://www.nvrcp.com/',
# Why: #9690 in Alexa global
'http://www.bebinin.com/',
# Why: #9691 in Alexa global
'http://www.buddypress.org/',
# Why: #9693 in Alexa global
'http://www.uitzendinggemist.nl/',
# Why: #9694 in Alexa global
'http://www.majorleaguegaming.com/',
# Why: #9695 in Alexa global
'http://www.phpclasses.org/',
# Why: #9696 in Alexa global
'http://www.inteligo.pl/',
# Why: #9697 in Alexa global
'http://www.pinkbike.com/',
# Why: #9698 in Alexa global
'http://www.songlyrics.com/',
# Why: #9699 in Alexa global
'http://www.ct.gov/',
# Why: #9700 in Alexa global
'http://www.timeslive.co.za/',
# Why: #9701 in Alexa global
'http://www.snapwidget.com/',
# Why: #9702 in Alexa global
'http://www.watchkart.com/',
# Why: #9703 in Alexa global
'http://www.col3negoriginalcom.com/',
# Why: #9704 in Alexa global
'http://www.bronto.com/',
# Why: #9705 in Alexa global
'http://www.coasttocoastam.com/',
# Why: #9706 in Alexa global
'http://www.theladbible.com/',
# Why: #9707 in Alexa global
'http://narkive.com/',
# Why: #9708 in Alexa global
'http://www.the-village.ru/',
# Why: #9709 in Alexa global
'http://www.roem.ru/',
# Why: #9710 in Alexa global
'http://www.hi-pda.com/',
# Why: #9711 in Alexa global
'http://www.411.info/',
# Why: #9712 in Alexa global
'http://www.likesasap.com/',
# Why: #9713 in Alexa global
'http://www.blitz.bg/',
# Why: #9714 in Alexa global
'http://www.goodfon.ru/',
# Why: #9715 in Alexa global
'http://www.desktopnexus.com/',
# Why: #9716 in Alexa global
'http://www.demis.ru/',
# Why: #9717 in Alexa global
'http://www.begun.ru/',
# Why: #9718 in Alexa global
'http://www.ekikara.jp/',
# Why: #9719 in Alexa global
'http://www.linktech.cn/',
# Why: #9720 in Alexa global
'http://www.tezaktrafficpower.com/',
# Why: #9721 in Alexa global
'http://www.videos.com/',
# Why: #9722 in Alexa global
'http://www.pnet.co.za/',
# Why: #9723 in Alexa global
'http://www.rds.ca/',
# Why: #9724 in Alexa global
'http://www.dlink.com/',
# Why: #9725 in Alexa global
'http://www.ispajuegos.com/',
# Why: #9726 in Alexa global
'http://www.foxsportsasia.com/',
# Why: #9727 in Alexa global
'http://www.lexisnexis.com/',
# Why: #9728 in Alexa global
'http://www.ddproperty.com/',
# Why: #9729 in Alexa global
'http://www.1channelmovie.com/',
# Why: #9731 in Alexa global
'http://www.postimage.org/',
# Why: #9732 in Alexa global
'http://www.rahedaneshjou.ir/',
# Why: #9733 in Alexa global
'http://www.modern.az/',
# Why: #9734 in Alexa global
'http://www.givemegay.com/',
# Why: #9735 in Alexa global
'http://www.tejaratbank.net/',
# Why: #9736 in Alexa global
'http://www.rockpapershotgun.com/',
# Why: #9737 in Alexa global
'http://www.infogue.com/',
# Why: #9738 in Alexa global
'http://www.sfora.pl/',
# Why: #9739 in Alexa global
'http://www.liberoquotidiano.it/',
# Why: #9740 in Alexa global
'http://www.forumok.com/',
# Why: #9741 in Alexa global
'http://www.infonavit.org.mx/',
# Why: #9742 in Alexa global
'http://www.bankwest.com.au/',
# Why: #9743 in Alexa global
'http://www.al-mashhad.com/',
# Why: #9744 in Alexa global
'http://www.ogame.de/',
# Why: #9745 in Alexa global
'http://www.triviatoday.com/',
# Why: #9746 in Alexa global
'http://www.topspeed.com/',
# Why: #9747 in Alexa global
'http://www.kuku123.com/',
# Why: #9748 in Alexa global
'http://www.gayforit.eu/',
# Why: #9749 in Alexa global
'http://www.alahlionline.com/',
# Why: #9750 in Alexa global
'http://www.phonegap.com/',
# Why: #9752 in Alexa global
'http://www.superhry.cz/',
# Why: #9753 in Alexa global
'http://www.sweepstakes.com/',
# Why: #9754 in Alexa global
'http://www.australianbusinessgroup.net/',
# Why: #9755 in Alexa global
'http://www.nacion.com/',
# Why: #9756 in Alexa global
'http://www.futura-sciences.com/',
# Why: #9757 in Alexa global
'http://www.education.gouv.fr/',
# Why: #9758 in Alexa global
'http://www.haott.com/',
# Why: #9759 in Alexa global
'http://www.ey.com/',
# Why: #9760 in Alexa global
'http://www.roksa.pl/',
# Why: #9761 in Alexa global
'http://www.manoramanews.com/',
# Why: #9762 in Alexa global
'http://www.secretsearchenginelabs.com/',
# Why: #9763 in Alexa global
'http://www.alitui.com/',
# Why: #9764 in Alexa global
'http://www.depor.pe/',
# Why: #9765 in Alexa global
'http://www.rbc.com/',
# Why: #9766 in Alexa global
'http://www.tvaguuco.blogspot.se/',
# Why: #9767 in Alexa global
'http://www.mediaturf.net/',
# Why: #9768 in Alexa global
'http://www.mobilemoneycode.com/',
# Why: #9769 in Alexa global
'http://www.radio-canada.ca/',
# Why: #9770 in Alexa global
'http://www.shijue.me/',
# Why: #9771 in Alexa global
'http://www.upyim.com/',
# Why: #9772 in Alexa global
'http://www.indeed.com.br/',
# Why: #9773 in Alexa global
'http://www.indianrailways.gov.in/',
# Why: #9774 in Alexa global
'http://www.myfreepaysite.com/',
# Why: #9775 in Alexa global
'http://www.adchiever.com/',
# Why: #9776 in Alexa global
'http://www.xonei.com/',
# Why: #9777 in Alexa global
'http://www.kingworldnews.com/',
# Why: #9779 in Alexa global
'http://www.twenga.fr/',
# Why: #9780 in Alexa global
'http://www.oknation.net/',
# Why: #9782 in Alexa global
'http://www.zj4v.info/',
# Why: #9783 in Alexa global
'http://www.usanetwork.com/',
# Why: #9784 in Alexa global
'http://www.carphonewarehouse.com/',
# Why: #9785 in Alexa global
'http://www.impactradius.com/',
# Why: #9786 in Alexa global
'http://www.cinepolis.com/',
# Why: #9787 in Alexa global
'http://www.tvfun.ma/',
# Why: #9788 in Alexa global
'http://www.secureupload.eu/',
# Why: #9789 in Alexa global
'http://www.sarsefiling.co.za/',
# Why: #9790 in Alexa global
'http://www.flvmplayer.com/',
# Why: #9791 in Alexa global
'http://www.gemius.com.tr/',
# Why: #9792 in Alexa global
'http://www.alibris.com/',
# Why: #9793 in Alexa global
'http://www.insomniagamer.com/',
# Why: #9795 in Alexa global
'http://www.osxdaily.com/',
# Why: #9796 in Alexa global
'http://www.novasdodia.com/',
# Why: #9797 in Alexa global
'http://www.ayuwage.com/',
# Why: #9798 in Alexa global
'http://www.c-date.it/',
# Why: #9799 in Alexa global
'http://www.meetic.es/',
# Why: #9800 in Alexa global
'http://www.cineplex.com/',
# Why: #9801 in Alexa global
'http://www.mugshots.com/',
# Why: #9802 in Alexa global
'http://www.allabolag.se/',
# Why: #9803 in Alexa global
'http://www.parentsconnect.com/',
# Why: #9804 in Alexa global
'http://www.sina.cn/',
# Why: #9805 in Alexa global
'http://www.ibis.com/',
# Why: #9806 in Alexa global
'http://find.blog.co.uk/',
# Why: #9807 in Alexa global
'http://www.findcheaters.com/',
# Why: #9808 in Alexa global
'http://www.telly.com/',
# Why: #9809 in Alexa global
'http://www.alphacoders.com/',
# Why: #9810 in Alexa global
'http://www.sciencenet.cn/',
# Why: #9811 in Alexa global
'http://www.sreality.cz/',
# Why: #9812 in Alexa global
'http://www.wall-street-exposed.com/',
# Why: #9813 in Alexa global
'http://www.mizhe.com/',
# Why: #9814 in Alexa global
'http://www.telugumatrimony.com/',
# Why: #9815 in Alexa global
'http://www.220tube.com/',
# Why: #9816 in Alexa global
'http://www.gboxapp.com/',
# Why: #9817 in Alexa global
'http://www.activeden.net/',
# Why: #9818 in Alexa global
'http://www.worldsex.com/',
# Why: #9819 in Alexa global
'http://www.tdscpc.gov.in/',
# Why: #9821 in Alexa global
'http://www.mlbtraderumors.com/',
# Why: #9822 in Alexa global
'http://www.top-channel.tv/',
# Why: #9823 in Alexa global
'http://www.publiekeomroep.nl/',
# Why: #9824 in Alexa global
'http://www.flvs.net/',
# Why: #9825 in Alexa global
'http://www.inwi.ma/',
# Why: #9826 in Alexa global
'http://www.web-ip.ru/',
# Why: #9827 in Alexa global
'http://www.er7mne.com/',
# Why: #9828 in Alexa global
'http://www.valueclickmedia.com/',
# Why: #9829 in Alexa global
'http://www.1pondo.tv/',
# Why: #9830 in Alexa global
'http://www.capcom.co.jp/',
# Why: #9831 in Alexa global
'http://www.covers.com/',
# Why: #9832 in Alexa global
'http://www.be2.it/',
# Why: #9833 in Alexa global
'http://www.e-cigarette-forum.com/',
# Why: #9834 in Alexa global
'http://www.himarin.net/',
# Why: #9835 in Alexa global
'http://www.indiainfoline.com/',
# Why: #9836 in Alexa global
'http://www.51gxqm.com/',
# Why: #9837 in Alexa global
'http://www.sebank.se/',
# Why: #9838 in Alexa global
'http://www.18inhd.com/',
# Why: #9839 in Alexa global
'http://www.unionbankonline.co.in/',
# Why: #9840 in Alexa global
'http://www.filetram.com/',
# Why: #9841 in Alexa global
'http://www.santasporngirls.com/',
# Why: #9842 in Alexa global
'http://www.drupal.ru/',
# Why: #9843 in Alexa global
'http://www.tokfm.pl/',
# Why: #9844 in Alexa global
'http://www.steamgifts.com/',
# Why: #9845 in Alexa global
'http://www.residentadvisor.net/',
# Why: #9846 in Alexa global
'http://www.magento.com/',
# Why: #9847 in Alexa global
'http://www.28.com/',
# Why: #9848 in Alexa global
'http://www.style.com/',
# Why: #9849 in Alexa global
'http://www.nikkei.co.jp/',
# Why: #9850 in Alexa global
'http://www.alitalia.com/',
# Why: #9851 in Alexa global
'http://www.vudu.com/',
# Why: #9852 in Alexa global
'http://www.underarmour.com/',
# Why: #9853 in Alexa global
'http://www.wine-searcher.com/',
# Why: #9854 in Alexa global
'http://www.indiaproperty.com/',
# Why: #9855 in Alexa global
'http://www.bet365affiliates.com/',
# Why: #9856 in Alexa global
'http://www.cnnewmusic.com/',
# Why: #9857 in Alexa global
'http://www.longdo.com/',
# Why: #9858 in Alexa global
'http://www.destructoid.com/',
# Why: #9859 in Alexa global
'http://diyifanwen.com/',
# Why: #9860 in Alexa global
'http://www.logic-immo.com/',
# Why: #9861 in Alexa global
'http://www.mate1.com/',
# Why: #9862 in Alexa global
'http://www.pissedconsumer.com/',
# Why: #9863 in Alexa global
'http://www.blocked-website.com/',
# Why: #9864 in Alexa global
'http://www.cremonamostre.it/',
# Why: #9865 in Alexa global
'http://www.sayidaty.net/',
# Why: #9866 in Alexa global
'http://www.globalewallet.com/',
# Why: #9867 in Alexa global
'http://www.maxgames.com/',
# Why: #9868 in Alexa global
'http://www.auctionzip.com/',
# Why: #9870 in Alexa global
'http://www.aldaniti.net/',
# Why: #9871 in Alexa global
'http://www.workle.ru/',
# Why: #9872 in Alexa global
'http://www.arduino.cc/',
# Why: #9873 in Alexa global
'http://www.buenosaires.gob.ar/',
# Why: #9874 in Alexa global
'http://www.overtenreps.com/',
# Why: #9876 in Alexa global
'http://www.enalquiler.com/',
# Why: #9877 in Alexa global
'http://www.gazetadopovo.com.br/',
# Why: #9878 in Alexa global
'http://www.hftogo.com/',
# Why: #9879 in Alexa global
'http://www.usana.com/',
# Why: #9880 in Alexa global
'http://www.bancochile.cl/',
# Why: #9881 in Alexa global
'http://www.on24.com/',
# Why: #9882 in Alexa global
'http://www.samenblog.com/',
# Why: #9883 in Alexa global
'http://www.goindigo.in/',
# Why: #9884 in Alexa global
'http://www.iranvij.ir/',
# Why: #9885 in Alexa global
'http://www.postfinance.ch/',
# Why: #9886 in Alexa global
'http://www.grupobancolombia.com/',
# Why: #9887 in Alexa global
'http://www.flycell.pe/',
# Why: #9888 in Alexa global
'http://www.sobesednik.ru/',
# Why: #9889 in Alexa global
'http://www.banglalionwimax.com/',
# Why: #9890 in Alexa global
'http://www.yasni.com/',
# Why: #9891 in Alexa global
'http://www.diziizle.net/',
# Why: #9892 in Alexa global
'http://www.publichd.se/',
# Why: #9893 in Alexa global
'http://www.socialsurveycenter.com/',
# Why: #9894 in Alexa global
'http://www.blockbuster.com/',
# Why: #9895 in Alexa global
'http://www.el-ahly.com/',
# Why: #9896 in Alexa global
'http://www.1gb.ru/',
# Why: #9897 in Alexa global
'http://www.utah.edu/',
# Why: #9898 in Alexa global
'http://www.dziennik.pl/',
# Why: #9899 in Alexa global
'http://www.tizerads.com/',
# Why: #9901 in Alexa global
'http://www.global-free-classified-ads.com/',
# Why: #9902 in Alexa global
'http://www.afp.com/',
# Why: #9903 in Alexa global
'http://www.tiberiumalliances.com/',
# Why: #9904 in Alexa global
'http://www.worldstaruncut.com/',
# Why: #9905 in Alexa global
'http://www.watchfreeinhd.com/',
# Why: #9906 in Alexa global
'http://www.5278.cc/',
# Why: #9907 in Alexa global
'http://www.azdrama.info/',
# Why: #9908 in Alexa global
'http://fjsen.com/',
# Why: #9909 in Alexa global
'http://www.fandongxi.com/',
# Why: #9910 in Alexa global
'http://www.spicytranny.com/',
# Why: #9911 in Alexa global
'http://www.parsonline.net/',
# Why: #9912 in Alexa global
'http://www.libreoffice.org/',
# Why: #9913 in Alexa global
'http://www.atlassian.com/',
# Why: #9914 in Alexa global
'http://www.europeantour.com/',
# Why: #9915 in Alexa global
'http://www.smartsource.com/',
# Why: #9916 in Alexa global
'http://www.ashford.edu/',
# Why: #9917 in Alexa global
'http://www.moo.com/',
# Why: #9918 in Alexa global
'http://www.bplaced.net/',
# Why: #9919 in Alexa global
'http://www.themify.me/',
# Why: #9920 in Alexa global
'http://www.holidaypromo.info/',
# Why: #9921 in Alexa global
'http://www.nta.go.jp/',
# Why: #9922 in Alexa global
'http://www.kanglu.com/',
# Why: #9923 in Alexa global
'http://www.yicai.com/',
# Why: #9924 in Alexa global
'http://www.classesusa.com/',
# Why: #9925 in Alexa global
'http://www.huoche.net/',
# Why: #9926 in Alexa global
'http://www.linkomanija.net/',
# Why: #9927 in Alexa global
'http://www.blog.de/',
# Why: #9928 in Alexa global
'http://www.vw.com.tr/',
# Why: #9929 in Alexa global
'http://www.worldgmn.com/',
# Why: #9930 in Alexa global
'http://www.tommy.com/',
# Why: #9931 in Alexa global
'http://www.100bt.com/',
# Why: #9932 in Alexa global
'http://www.springsource.org/',
# Why: #9933 in Alexa global
'http://www.betfairinvest.com/',
# Why: #9934 in Alexa global
'http://www.broker.to/',
# Why: #9935 in Alexa global
'http://www.islamstory.com/',
# Why: #9937 in Alexa global
'http://www.sparebank1.no/',
# Why: #9938 in Alexa global
'http://www.towleroad.com/',
# Why: #9939 in Alexa global
'http://www.jetcost.com/',
# Why: #9940 in Alexa global
'http://www.pinping.com/',
# Why: #9941 in Alexa global
'http://www.millenniumbcp.pt/',
# Why: #9942 in Alexa global
'http://www.vikatan.com/',
# Why: #9943 in Alexa global
'http://www.dorkly.com/',
# Why: #9944 in Alexa global
'http://www.clubedohardware.com.br/',
# Why: #9945 in Alexa global
'http://www.fclub.cn/',
# Why: #9946 in Alexa global
'http://www.any.gs/',
# Why: #9947 in Alexa global
'http://www.danskebank.dk/',
# Why: #9948 in Alexa global
'http://www.tvmongol.com/',
# Why: #9949 in Alexa global
'http://www.ahnegao.com.br/',
# Why: #9950 in Alexa global
'http://www.filipinocupid.com/',
# Why: #9951 in Alexa global
'http://www.casacinemas.com/',
# Why: #9952 in Alexa global
'http://www.standvirtual.com/',
# Why: #9953 in Alexa global
'http://www.nbg.gr/',
# Why: #9954 in Alexa global
'http://www.onlywire.com/',
# Why: #9955 in Alexa global
'http://www.megacurioso.com.br/',
# Why: #9956 in Alexa global
'http://www.elaph.com/',
# Why: #9957 in Alexa global
'http://www.xvideos-field5.com/',
# Why: #9958 in Alexa global
'http://www.base.de/',
# Why: #9959 in Alexa global
'http://www.zzstream.li/',
# Why: #9960 in Alexa global
'http://www.qype.co.uk/',
# Why: #9961 in Alexa global
'http://www.ubergizmo.com/',
# Why: #9963 in Alexa global
'http://www.habervaktim.com/',
# Why: #9965 in Alexa global
'http://www.nationaljournal.com/',
# Why: #9966 in Alexa global
'http://www.fanslave.com/',
# Why: #9967 in Alexa global
'http://www.agreementfind.com/',
# Why: #9968 in Alexa global
'http://www.unionbankph.com/',
# Why: #9969 in Alexa global
'http://www.hometalk.com/',
# Why: #9970 in Alexa global
'http://www.hotnigerianjobs.com/',
# Why: #9971 in Alexa global
'http://www.infoq.com/',
# Why: #9972 in Alexa global
'http://www.matalan.co.uk/',
# Why: #9973 in Alexa global
'http://www.hottopic.com/',
# Why: #9974 in Alexa global
'http://www.hammihan.com/',
# Why: #9976 in Alexa global
'http://www.stsoftware.biz/',
# Why: #9977 in Alexa global
'http://www.elimparcial.com/',
# Why: #9978 in Alexa global
'http://www.lingualeo.ru/',
# Why: #9979 in Alexa global
'http://www.firstdirect.com/',
# Why: #9980 in Alexa global
'http://www.linkprosperity.com/',
# Why: #9982 in Alexa global
'http://www.ele.me/',
# Why: #9983 in Alexa global
'http://www.beep.com/',
# Why: #9984 in Alexa global
'http://w-t-f.jp/',
# Why: #9985 in Alexa global
'http://www.netcombo.com.br/',
# Why: #9986 in Alexa global
'http://www.meme.li/',
# Why: #9987 in Alexa global
'http://www.privateproperty.co.za/',
# Why: #9988 in Alexa global
'http://www.wunderlist.com/',
# Why: #9989 in Alexa global
'http://www.designyoutrust.com/',
# Why: #9990 in Alexa global
'http://century21.com/',
# Why: #9991 in Alexa global
'http://www.huuto.net/',
# Why: #9992 in Alexa global
'http://www.adsoftheworld.com/',
# Why: #9993 in Alexa global
'http://www.kabu.co.jp/',
# Why: #9994 in Alexa global
'http://www.vouchercodes.co.uk/',
# Why: #9995 in Alexa global
'http://www.allyou.com/',
# Why: #9996 in Alexa global
'http://www.mastemplate.com/',
# Why: #9997 in Alexa global
'http://www.bolha.com/',
# Why: #9998 in Alexa global
'http://www.tastyplay.com/',
# Why: #9999 in Alexa global
'http://www.busuk.org/']
for url in urls_list:
self.AddPage(Alexa1To10000Page(url, self))
| bsd-3-clause |
djbaldey/django | tests/template_tests/syntax_tests/test_ssi.py | 199 | 4226 | from __future__ import unicode_literals
import os
from django.template import Context, Engine
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import ROOT, setup
@ignore_warnings(category=RemovedInDjango110Warning)
class SsiTagTests(SimpleTestCase):
# Test normal behavior
@setup({'ssi01': '{%% ssi "%s" %%}' % os.path.join(
ROOT, 'templates', 'ssi_include.html',
)})
def test_ssi01(self):
output = self.engine.render_to_string('ssi01')
self.assertEqual(output, 'This is for testing an ssi include. {{ test }}\n')
@setup({'ssi02': '{%% ssi "%s" %%}' % os.path.join(
ROOT, 'not_here',
)})
def test_ssi02(self):
output = self.engine.render_to_string('ssi02')
self.assertEqual(output, ''),
@setup({'ssi03': "{%% ssi '%s' %%}" % os.path.join(
ROOT, 'not_here',
)})
def test_ssi03(self):
output = self.engine.render_to_string('ssi03')
self.assertEqual(output, ''),
# Test passing as a variable
@setup({'ssi04': '{% ssi ssi_file %}'})
def test_ssi04(self):
output = self.engine.render_to_string('ssi04', {
'ssi_file': os.path.join(ROOT, 'templates', 'ssi_include.html')
})
self.assertEqual(output, 'This is for testing an ssi include. {{ test }}\n')
@setup({'ssi05': '{% ssi ssi_file %}'})
def test_ssi05(self):
output = self.engine.render_to_string('ssi05', {'ssi_file': 'no_file'})
self.assertEqual(output, '')
# Test parsed output
@setup({'ssi06': '{%% ssi "%s" parsed %%}' % os.path.join(
ROOT, 'templates', 'ssi_include.html',
)})
def test_ssi06(self):
output = self.engine.render_to_string('ssi06', {'test': 'Look ma! It parsed!'})
self.assertEqual(output, 'This is for testing an ssi include. '
'Look ma! It parsed!\n')
@setup({'ssi07': '{%% ssi "%s" parsed %%}' % os.path.join(
ROOT, 'not_here',
)})
def test_ssi07(self):
output = self.engine.render_to_string('ssi07', {'test': 'Look ma! It parsed!'})
self.assertEqual(output, '')
# Test space in file name
@setup({'ssi08': '{%% ssi "%s" %%}' % os.path.join(
ROOT, 'templates', 'ssi include with spaces.html',
)})
def test_ssi08(self):
output = self.engine.render_to_string('ssi08')
self.assertEqual(output, 'This is for testing an ssi include '
'with spaces in its name. {{ test }}\n')
@setup({'ssi09': '{%% ssi "%s" parsed %%}' % os.path.join(
ROOT, 'templates', 'ssi include with spaces.html',
)})
def test_ssi09(self):
output = self.engine.render_to_string('ssi09', {'test': 'Look ma! It parsed!'})
self.assertEqual(output, 'This is for testing an ssi include '
'with spaces in its name. Look ma! It parsed!\n')
@ignore_warnings(category=RemovedInDjango110Warning)
class SSISecurityTests(SimpleTestCase):
def setUp(self):
self.ssi_dir = os.path.join(ROOT, "templates", "first")
self.engine = Engine(allowed_include_roots=(self.ssi_dir,))
def render_ssi(self, path):
# the path must exist for the test to be reliable
self.assertTrue(os.path.exists(path))
return self.engine.from_string('{%% ssi "%s" %%}' % path).render(Context({}))
def test_allowed_paths(self):
acceptable_path = os.path.join(self.ssi_dir, "..", "first", "test.html")
self.assertEqual(self.render_ssi(acceptable_path), 'First template\n')
def test_relative_include_exploit(self):
"""
May not bypass allowed_include_roots with relative paths
e.g. if allowed_include_roots = ("/var/www",), it should not be
possible to do {% ssi "/var/www/../../etc/passwd" %}
"""
disallowed_paths = [
os.path.join(self.ssi_dir, "..", "ssi_include.html"),
os.path.join(self.ssi_dir, "..", "second", "test.html"),
]
for disallowed_path in disallowed_paths:
self.assertEqual(self.render_ssi(disallowed_path), '')
| bsd-3-clause |
arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/demos/monteverdi.py | 1 | 13787 | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: demos/monteverdi.py
# Purpose: Bellairs Workshop on Monteverdi Madrigals, Barbados, Feb 2011
#
# Authors: Michael Scott Cuthbert
#
# Copyright: Copyright © 2011 Michael Scott Cuthbert and the music21 Project
# License: BSD or LGPL, see license.txt
#-------------------------------------------------------------------------------
'''
The project was to see how well (or not) Monteverdi's 5-voice madrigals in Books
3, 4, and 5 follow the principles of common-practice, tonal harmony. Organized
by Dmitri T.
The workshop gave the excuse to add the romanText format, which DT and others
have encoded lots of analyses in. Some demos of the format are below
'''
from music21 import corpus, clef, interval, pitch, voiceLeading, roman
def spliceAnalysis(book = 3, madrigal = 1):
'''
splice an analysis of the madrigal under the analysis itself
'''
#mad = corpus.parse('monteverdi/madrigal.%s.%s.xml' % (book, madrigal))
analysis = corpus.parse('monteverdi/madrigal.%s.%s.rntxt' % (book, madrigal))
# these are multiple parts in a score stream
#excerpt = mad.measures(1,20)
# get from first part
aMeasures = analysis.parts[0].measures(1,20)
aMeasures.getElementsByClass('Measure')[0].clef = clef.TrebleClef()
for myN in aMeasures.flat.notesAndRests:
myN.hideObjectOnPrint = True
x = aMeasures.write()
print (x)
#excerpt.insert(0, aMeasures)
#excerpt.show()
def showAnalysis(book = 3, madrigal = 13):
#analysis = converter.parse('d:/docs/research/music21/dmitri_analyses/Mozart Piano Sonatas/k331.rntxt')
filename = 'monteverdi/madrigal.%s.%s.rntxt' % (book, madrigal)
analysis = corpus.parse(filename)
#analysis.show()
(major, minor) = iqSemitonesAndPercentage(analysis)
print (major)
print (minor)
def analyzeBooks(books = (3,), start = 1, end = 20, show = False, strict = False):
majorFig = ""
minorFig = ""
majorSt = ""
minorSt = ""
majorRoot = ""
minorRoot = ""
for book in books:
for i in range(start, end+1):
filename = 'monteverdi/madrigal.%s.%s.rntxt' % (book, i)
if strict == True:
analysis = corpus.parse(filename)
print(book,i)
else:
try:
analysis = corpus.parse(filename)
print(book,i)
except Exception:
print("Cannot parse %s, maybe it does not exist..." % (filename))
continue
if show == True:
analysis.show()
(MF, mF) = iqChordsAndPercentage(analysis)
(MSt, mSt) = iqSemitonesAndPercentage(analysis)
(MRoot, mRoot) = iqRootsAndPercentage(analysis)
majorFig += MF
minorFig += mF
majorSt += MSt
minorSt += mSt
majorRoot += MRoot
minorRoot += mRoot
print(majorFig)
print(minorFig)
print(majorSt)
print(minorSt)
print(majorRoot)
print(minorRoot)
def iqChordsAndPercentage(analysisStream):
'''
returns two strings, one for major, one for minor, containing the key,
figure, and (in parentheses) the % of the total duration that this chord represents.
Named for Ian Quinn
'''
totalDuration = analysisStream.duration.quarterLength
romMerged = analysisStream.flat.stripTies()
major = ""
minor = ""
active = 'minor'
for element in romMerged:
if "RomanNumeral" in element.classes:
fig = element.figure
fig = fig.replace('[no5]','')
fig = fig.replace('[no3]','')
fig = fig.replace('[no1]','')
longString = fig + " (" + str(int(element.duration.quarterLength*10000.0/totalDuration)/100.0) + ") "
if active == 'major':
major += longString
else:
minor += longString
elif hasattr(element, 'tonic'):
if element.mode == 'major':
active = 'major'
major += "\n" + element.tonic + " " + element.mode + " "
else:
active = 'minor'
minor += "\n" + element.tonic + " " + element.mode + " "
return (major, minor)
def iqSemitonesAndPercentage(analysisStream):
totalDuration = analysisStream.duration.quarterLength
romMerged = analysisStream.flat.stripTies()
major = ""
minor = ""
active = 'minor'
for element in romMerged:
if "RomanNumeral" in element.classes:
distanceToTonicInSemis = int((element.root().ps - pitch.Pitch(element.scale.tonic).ps) % 12)
longString = str(distanceToTonicInSemis) + " (" + str(int(element.duration.quarterLength*10000.0/totalDuration)/100.0) + ") "
if active == 'major':
major += longString
else:
minor += longString
elif hasattr(element, 'tonic'):
if element.mode == 'major':
active = 'major'
major += "\n" + element.tonic + " " + element.mode + " "
else:
active = 'minor'
minor += "\n" + element.tonic + " " + element.mode + " "
return (major, minor)
def iqRootsAndPercentage(analysisStream):
totalDuration = analysisStream.duration.quarterLength
romMerged = analysisStream.flat.stripTies()
major = ""
minor = ""
active = 'minor'
for element in romMerged:
if "RomanNumeral" in element.classes:
#distanceToTonicInSemis = int((element.root().ps - pitch.Pitch(element.scale.tonic).ps) % 12)
elementLetter = str(element.root().name)
## leave El
if element.quality == 'minor' or element.quality == 'diminished':
elementLetter = elementLetter.lower()
elif element.quality == 'other':
rootScaleDegree = element.scale.getScaleDegreeFromPitch(element.root())
if rootScaleDegree:
thirdPitch = element.scale.pitchFromDegree((rootScaleDegree + 2) % 7)
int1 = interval.notesToInterval(element.root(), thirdPitch)
if int1.intervalClass == 3:
elementLetter = elementLetter.lower()
else:
pass
longString = elementLetter + " (" + str(int(element.duration.quarterLength*10000.0/totalDuration)/100.0) + ") "
if active == 'major':
major += longString
else:
minor += longString
elif "Key" in element.classes:
if element.mode == 'major':
active = 'major'
major += "\n" + element.tonic + " " + element.mode + " "
else:
active = 'minor'
minor += "\n" + element.tonic + " " + element.mode + " "
return (major, minor)
def monteverdiParallels(books = (3,), start = 1, end = 20, show = True, strict = False):
'''
find all instances of parallel fifths or octaves in Monteverdi madrigals.
'''
for book in books:
for i in range(start, end+1):
filename = 'monteverdi/madrigal.%s.%s.xml' % (book, i)
if strict == True:
c = corpus.parse(filename)
print (book,i)
else:
try:
c = corpus.parse(filename)
print (book,i)
except:
print ("Cannot parse %s, maybe it does not exist..." % (filename))
continue
displayMe = False
for i in range(len(c.parts) - 1):
#iName = c.parts[i].id
ifn = c.parts[i].flat.notesAndRests
omi = ifn.offsetMap
for j in range(i+1, len(c.parts)):
jName = c.parts[j].id
jfn = c.parts[j].flat.notesAndRests
for k in range(len(omi) - 1):
n1pi = omi[k]['element']
n2pi = omi[k+1]['element']
n1pjAll = jfn.getElementsByOffset(offsetStart = omi[k]['endTime'] - .001, offsetEnd = omi[k]['endTime'] - .001, mustBeginInSpan = False)
if len(n1pjAll) == 0:
continue
n1pj = n1pjAll[0]
n2pjAll = jfn.getElementsByOffset(offsetStart = omi[k+1]['offset'], offsetEnd = omi[k+1]['offset'], mustBeginInSpan = False)
if len(n2pjAll) == 0:
continue
n2pj = n2pjAll[0]
if n1pj is n2pj:
continue # no oblique motion
if n1pi.isRest or n2pi.isRest or n1pj.isRest or n2pj.isRest:
continue
if n1pi.isChord or n2pi.isChord or n1pj.isChord or n2pj.isChord:
continue
vlq = voiceLeading.VoiceLeadingQuartet(n1pi, n2pi, n1pj, n2pj)
if vlq.parallelMotion('P8') is False and vlq.parallelMotion('P5') is False:
continue
displayMe = True
n1pi.addLyric('par ' + str(vlq.vIntervals[0].name))
n2pi.addLyric(' w/ ' + jName)
if displayMe and show:
c.show()
def findPhraseBoundaries(book = 4, madrigal = 12):
filename = 'monteverdi/madrigal.%s.%s' % (book, madrigal)
sc = corpus.parse(filename + '.xml')
analysis = corpus.parse(filename + '.rntxt')
analysisFlat = analysis.flat.stripTies().getElementsByClass(roman.RomanNumeral)
phraseScoresByOffset = {}
for p in sc.parts:
partNotes = p.flat.stripTies(matchByPitch = True).notesAndRests
#thisPartPhraseScores = [] # keeps track of the likelihood that a phrase boundary is after note i
for i in range(2, len(partNotes) - 2): # start on the third note and stop searching on the third to last note...
thisScore = 0
twoNotesBack = partNotes[i-2]
previousNote = partNotes[i-1]
thisNote = partNotes[i]
nextNote = partNotes[i+1]
nextAfterThatNote = partNotes[i+2]
phraseOffset = nextNote.offset
if phraseOffset in phraseScoresByOffset:
existingScore = phraseScoresByOffset[phraseOffset]
else:
phraseScoresByOffset[phraseOffset] = 0
existingScore = 0
if thisNote.isRest == True:
continue
if nextNote.isRest == True:
thisScore = thisScore + 10
else:
intervalToNextNote = interval.notesToInterval(thisNote, nextNote)
if intervalToNextNote.chromatic.undirected >= 6: # a tritone or bigger
thisScore = thisScore + 10
if (thisNote.quarterLength > previousNote.quarterLength) and \
(thisNote.quarterLength > nextNote.quarterLength):
thisScore = thisScore + 10
if (thisNote.quarterLength > previousNote.quarterLength) and \
(thisNote.quarterLength > twoNotesBack.quarterLength) and \
(nextNote.quarterLength > nextAfterThatNote.quarterLength):
thisScore = thisScore + 10
previousNoteAnalysis = analysisFlat.getElementAtOrBefore(previousNote.offset)
thisNoteAnalysis = analysisFlat.getElementAtOrBefore(thisNote.offset)
if previousNoteAnalysis.romanNumeral == 'V' and thisNoteAnalysis.romanNumeral.upper() == 'I':
thisScore = thisScore + 11
elif previousNoteAnalysis.romanNumeral.upper() == 'II' and thisNoteAnalysis.romanNumeral.upper() == 'I':
thisScore = thisScore + 6
if thisNote.lyric is not None and thisNote.lyric.endswith('.'):
thisScore = thisScore + 15 # would be higher but our lyrics data is bad.
phraseScoresByOffset[phraseOffset] = existingScore + thisScore
flattenedBass = sc.parts[-1].flat.notesAndRests
for thisOffset in sorted(phraseScoresByOffset.keys()):
psbo = phraseScoresByOffset[thisOffset]
if psbo > 0:
print (thisOffset, psbo)
relevantNote = flattenedBass.getElementAtOrBefore(thisOffset - 0.1)
if hasattr(relevantNote, 'score'):
print ("adjusting score from %d to %d for note in measure %d" % (relevantNote.score, relevantNote.score + psbo, relevantNote.measureNumber))
relevantNote.score += psbo
else:
relevantNote.score = psbo
for n in flattenedBass:
if hasattr(n, 'score'):
n.lyric = str(n.score)
sc.show()
if __name__ == '__main__':
#spliceAnalysis()
#analyzeBooks(books = [3,4,5])
#analyzeBooks(books = [4], start=10, end=10, show=True, strict=True)
findPhraseBoundaries(book = 4, madrigal = 12)
#monteverdiParallels(books = [3], start=1, end=1, show=True, strict=True)
| mit |
tastynoodle/django | django/views/generic/edit.py | 15 | 8635 | import warnings
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.detail import (SingleObjectMixin,
SingleObjectTemplateResponseMixin, BaseDetailView)
class FormMixin(ContextMixin):
"""
A mixin that provides a way to show and handle a form in a request.
"""
initial = {}
form_class = None
success_url = None
prefix = None
def get_initial(self):
"""
Returns the initial data to use for forms on this view.
"""
return self.initial.copy()
def get_prefix(self):
"""
Returns the prefix to use for forms on this view
"""
return self.prefix
def get_form_class(self):
"""
Returns the form class to use in this view
"""
return self.form_class
def get_form(self, form_class):
"""
Returns an instance of the form to be used in this view.
"""
return form_class(**self.get_form_kwargs())
def get_form_kwargs(self):
"""
Returns the keyword arguments for instantiating the form.
"""
kwargs = {
'initial': self.get_initial(),
'prefix': self.get_prefix(),
}
if self.request.method in ('POST', 'PUT'):
kwargs.update({
'data': self.request.POST,
'files': self.request.FILES,
})
return kwargs
def get_success_url(self):
"""
Returns the supplied success URL.
"""
if self.success_url:
# Forcing possible reverse_lazy evaluation
url = force_text(self.success_url)
else:
raise ImproperlyConfigured(
"No URL to redirect to. Provide a success_url.")
return url
def form_valid(self, form):
"""
If the form is valid, redirect to the supplied URL.
"""
return HttpResponseRedirect(self.get_success_url())
def form_invalid(self, form):
"""
If the form is invalid, re-render the context data with the
data-filled form and errors.
"""
return self.render_to_response(self.get_context_data(form=form))
class ModelFormMixin(FormMixin, SingleObjectMixin):
"""
A mixin that provides a way to show and handle a modelform in a request.
"""
fields = None
def get_form_class(self):
"""
Returns the form class to use in this view.
"""
if self.form_class:
return self.form_class
else:
if self.model is not None:
# If a model has been explicitly provided, use it
model = self.model
elif hasattr(self, 'object') and self.object is not None:
# If this view is operating on a single object, use
# the class of that object
model = self.object.__class__
else:
# Try to get a queryset and extract the model class
# from that
model = self.get_queryset().model
if self.fields is None:
warnings.warn("Using ModelFormMixin (base class of %s) without "
"the 'fields' attribute is deprecated." % self.__class__.__name__,
DeprecationWarning)
return model_forms.modelform_factory(model, fields=self.fields)
def get_form_kwargs(self):
"""
Returns the keyword arguments for instantiating the form.
"""
kwargs = super(ModelFormMixin, self).get_form_kwargs()
kwargs.update({'instance': self.object})
return kwargs
def get_success_url(self):
"""
Returns the supplied URL.
"""
if self.success_url:
url = self.success_url % self.object.__dict__
else:
try:
url = self.object.get_absolute_url()
except AttributeError:
raise ImproperlyConfigured(
"No URL to redirect to. Either provide a url or define"
" a get_absolute_url method on the Model.")
return url
def form_valid(self, form):
"""
If the form is valid, save the associated model.
"""
self.object = form.save()
return super(ModelFormMixin, self).form_valid(form)
class ProcessFormView(View):
"""
A mixin that renders a form on GET and processes it on POST.
"""
def get(self, request, *args, **kwargs):
"""
Handles GET requests and instantiates a blank version of the form.
"""
form_class = self.get_form_class()
form = self.get_form(form_class)
return self.render_to_response(self.get_context_data(form=form))
def post(self, request, *args, **kwargs):
"""
Handles POST requests, instantiating a form instance with the passed
POST variables and then checked for validity.
"""
form_class = self.get_form_class()
form = self.get_form(form_class)
if form.is_valid():
return self.form_valid(form)
else:
return self.form_invalid(form)
# PUT is a valid HTTP verb for creating (with a known URL) or editing an
# object, note that browsers only support POST for now.
def put(self, *args, **kwargs):
return self.post(*args, **kwargs)
class BaseFormView(FormMixin, ProcessFormView):
"""
A base view for displaying a form
"""
class FormView(TemplateResponseMixin, BaseFormView):
"""
A view for displaying a form, and rendering a template response.
"""
class BaseCreateView(ModelFormMixin, ProcessFormView):
"""
Base view for creating an new object instance.
Using this base class requires subclassing to provide a response mixin.
"""
def get(self, request, *args, **kwargs):
self.object = None
return super(BaseCreateView, self).get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
self.object = None
return super(BaseCreateView, self).post(request, *args, **kwargs)
class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView):
"""
View for creating a new object instance,
with a response rendered by template.
"""
template_name_suffix = '_form'
class BaseUpdateView(ModelFormMixin, ProcessFormView):
"""
Base view for updating an existing object.
Using this base class requires subclassing to provide a response mixin.
"""
def get(self, request, *args, **kwargs):
self.object = self.get_object()
return super(BaseUpdateView, self).get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
self.object = self.get_object()
return super(BaseUpdateView, self).post(request, *args, **kwargs)
class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
"""
View for updating an object,
with a response rendered by template.
"""
template_name_suffix = '_form'
class DeletionMixin(object):
"""
A mixin providing the ability to delete objects
"""
success_url = None
def delete(self, request, *args, **kwargs):
"""
Calls the delete() method on the fetched object and then
redirects to the success URL.
"""
self.object = self.get_object()
success_url = self.get_success_url()
self.object.delete()
return HttpResponseRedirect(success_url)
# Add support for browsers which only accept GET and POST for now.
def post(self, request, *args, **kwargs):
return self.delete(request, *args, **kwargs)
def get_success_url(self):
if self.success_url:
return self.success_url % self.object.__dict__
else:
raise ImproperlyConfigured(
"No URL to redirect to. Provide a success_url.")
class BaseDeleteView(DeletionMixin, BaseDetailView):
"""
Base view for deleting an object.
Using this base class requires subclassing to provide a response mixin.
"""
class DeleteView(SingleObjectTemplateResponseMixin, BaseDeleteView):
"""
View for deleting an object retrieved with `self.get_object()`,
with a response rendered by template.
"""
template_name_suffix = '_confirm_delete'
| bsd-3-clause |
fhe-odoo/odoo | openerp/osv/osv.py | 337 | 1384 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from ..exceptions import except_orm
from .orm import Model, TransientModel, AbstractModel
# Deprecated, kept for backward compatibility.
# openerp.exceptions.Warning should be used instead.
except_osv = except_orm
# Deprecated, kept for backward compatibility.
osv = Model
osv_memory = TransientModel
osv_abstract = AbstractModel # ;-)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| agpl-3.0 |
grevutiu-gabriel/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/watchlist/watchlist_mock.py | 130 | 1851 | # Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import logging
_log = logging.getLogger(__name__)
class MockWatchList(object):
def determine_cc_and_messages(self, diff):
_log.info("MockWatchList: determine_cc_and_messages")
return {'cc_list': ['abarth@webkit.org', 'eric@webkit.org', 'levin@chromium.org'], 'messages': ['Message1.', 'Message2.'], }
| bsd-3-clause |
uber/pyodbc | tests3/dbapi20.py | 44 | 31431 | #!/usr/bin/env python
''' Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read the subject line with 'Anal Compliance' in it. All around
this is turning out to be a thoroughly unwholesome unit test."
-- Ian Bicking
'''
__rcs_id__ = '$Id: dbapi20.py,v 1.10 2003/10/09 03:14:14 zenzen Exp $'
__version__ = '$Revision: 1.10 $'[11:-2]
__author__ = 'Stuart Bishop <zen@shangri-la.dropbear.id.au>'
import unittest
import time
# $Log: dbapi20.py,v $
# Revision 1.10 2003/10/09 03:14:14 zenzen
# Add test for DB API 2.0 optional extension, where database exceptions
# are exposed as attributes on the Connection object.
#
# Revision 1.9 2003/08/13 01:16:36 zenzen
# Minor tweak from Stefan Fleiter
#
# Revision 1.8 2003/04/10 00:13:25 zenzen
# Changes, as per suggestions by M.-A. Lemburg
# - Add a table prefix, to ensure namespace collisions can always be avoided
#
# Revision 1.7 2003/02/26 23:33:37 zenzen
# Break out DDL into helper functions, as per request by David Rushby
#
# Revision 1.6 2003/02/21 03:04:33 zenzen
# Stuff from Henrik Ekelund:
# added test_None
# added test_nextset & hooks
#
# Revision 1.5 2003/02/17 22:08:43 zenzen
# Implement suggestions and code from Henrik Eklund - test that cursor.arraysize
# defaults to 1 & generic cursor.callproc test added
#
# Revision 1.4 2003/02/15 00:16:33 zenzen
# Changes, as per suggestions and bug reports by M.-A. Lemburg,
# Matthew T. Kromer, Federico Di Gregorio and Daniel Dittmar
# - Class renamed
# - Now a subclass of TestCase, to avoid requiring the driver stub
# to use multiple inheritance
# - Reversed the polarity of buggy test in test_description
# - Test exception heirarchy correctly
# - self.populate is now self._populate(), so if a driver stub
# overrides self.ddl1 this change propogates
# - VARCHAR columns now have a width, which will hopefully make the
# DDL even more portible (this will be reversed if it causes more problems)
# - cursor.rowcount being checked after various execute and fetchXXX methods
# - Check for fetchall and fetchmany returning empty lists after results
# are exhausted (already checking for empty lists if select retrieved
# nothing
# - Fix bugs in test_setoutputsize_basic and test_setinputsizes
#
class DatabaseAPI20Test(unittest.TestCase):
''' Test a database self.driver for DB API 2.0 compatibility.
This implementation tests Gadfly, but the TestCase
is structured so that other self.drivers can subclass this
test case to ensure compiliance with the DB-API. It is
expected that this TestCase may be expanded in the future
if ambiguities or edge conditions are discovered.
The 'Optional Extensions' are not yet being tested.
self.drivers should subclass this test, overriding setUp, tearDown,
self.driver, connect_args and connect_kw_args. Class specification
should be as follows:
import dbapi20
class mytest(dbapi20.DatabaseAPI20Test):
[...]
Don't 'import DatabaseAPI20Test from dbapi20', or you will
confuse the unit tester - just 'import dbapi20'.
'''
# The self.driver module. This should be the module where the 'connect'
# method is to be found
driver = None
connect_args = () # List of arguments to pass to connect
connect_kw_args = {} # Keyword arguments for connect
table_prefix = 'dbapi20test_' # If you need to specify a prefix for tables
ddl1 = 'create table %sbooze (name varchar(20))' % table_prefix
ddl2 = 'create table %sbarflys (name varchar(20))' % table_prefix
xddl1 = 'drop table %sbooze' % table_prefix
xddl2 = 'drop table %sbarflys' % table_prefix
lowerfunc = 'lower' # Name of stored procedure to convert string->lowercase
# Some drivers may need to override these helpers, for example adding
# a 'commit' after the execute.
def executeDDL1(self,cursor):
cursor.execute(self.ddl1)
def executeDDL2(self,cursor):
cursor.execute(self.ddl2)
def setUp(self):
''' self.drivers should override this method to perform required setup
if any is necessary, such as creating the database.
'''
pass
def tearDown(self):
''' self.drivers should override this method to perform required cleanup
if any is necessary, such as deleting the test database.
The default drops the tables that may be created.
'''
con = self._connect()
try:
cur = con.cursor()
for i, ddl in enumerate((self.xddl1,self.xddl2)):
try:
cur.execute(ddl)
con.commit()
except self.driver.Error:
# Assume table didn't exist. Other tests will check if
# execute is busted.
pass
finally:
con.close()
def _connect(self):
try:
return self.driver.connect(
*self.connect_args,**self.connect_kw_args
)
except AttributeError:
self.fail("No connect method found in self.driver module")
def test_connect(self):
con = self._connect()
con.close()
def test_apilevel(self):
try:
# Must exist
apilevel = self.driver.apilevel
# Must equal 2.0
self.assertEqual(apilevel,'2.0')
except AttributeError:
self.fail("Driver doesn't define apilevel")
def test_threadsafety(self):
try:
# Must exist
threadsafety = self.driver.threadsafety
# Must be a valid value
self.failUnless(threadsafety in (0,1,2,3))
except AttributeError:
self.fail("Driver doesn't define threadsafety")
def test_paramstyle(self):
try:
# Must exist
paramstyle = self.driver.paramstyle
# Must be a valid value
self.failUnless(paramstyle in (
'qmark','numeric','named','format','pyformat'
))
except AttributeError:
self.fail("Driver doesn't define paramstyle")
def test_Exceptions(self):
# Make sure required exceptions exist, and are in the
# defined heirarchy.
self.failUnless(issubclass(self.driver.Warning,StandardError))
self.failUnless(issubclass(self.driver.Error,StandardError))
self.failUnless(
issubclass(self.driver.InterfaceError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.DatabaseError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.OperationalError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.IntegrityError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.InternalError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.ProgrammingError,self.driver.Error)
)
self.failUnless(
issubclass(self.driver.NotSupportedError,self.driver.Error)
)
def test_ExceptionsAsConnectionAttributes(self):
# OPTIONAL EXTENSION
# Test for the optional DB API 2.0 extension, where the exceptions
# are exposed as attributes on the Connection object
# I figure this optional extension will be implemented by any
# driver author who is using this test suite, so it is enabled
# by default.
con = self._connect()
drv = self.driver
self.failUnless(con.Warning is drv.Warning)
self.failUnless(con.Error is drv.Error)
self.failUnless(con.InterfaceError is drv.InterfaceError)
self.failUnless(con.DatabaseError is drv.DatabaseError)
self.failUnless(con.OperationalError is drv.OperationalError)
self.failUnless(con.IntegrityError is drv.IntegrityError)
self.failUnless(con.InternalError is drv.InternalError)
self.failUnless(con.ProgrammingError is drv.ProgrammingError)
self.failUnless(con.NotSupportedError is drv.NotSupportedError)
def test_commit(self):
con = self._connect()
try:
# Commit must work, even if it doesn't do anything
con.commit()
finally:
con.close()
def test_rollback(self):
con = self._connect()
# If rollback is defined, it should either work or throw
# the documented exception
if hasattr(con,'rollback'):
try:
con.rollback()
except self.driver.NotSupportedError:
pass
def test_cursor(self):
con = self._connect()
try:
cur = con.cursor()
finally:
con.close()
def test_cursor_isolation(self):
con = self._connect()
try:
# Make sure cursors created from the same connection have
# the documented transaction isolation level
cur1 = con.cursor()
cur2 = con.cursor()
self.executeDDL1(cur1)
cur1.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
cur2.execute("select name from %sbooze" % self.table_prefix)
booze = cur2.fetchall()
self.assertEqual(len(booze),1)
self.assertEqual(len(booze[0]),1)
self.assertEqual(booze[0][0],'Victoria Bitter')
finally:
con.close()
def test_description(self):
con = self._connect()
try:
cur = con.cursor()
self.executeDDL1(cur)
self.assertEqual(cur.description,None,
'cursor.description should be none after executing a '
'statement that can return no rows (such as DDL)'
)
cur.execute('select name from %sbooze' % self.table_prefix)
self.assertEqual(len(cur.description),1,
'cursor.description describes too many columns'
)
self.assertEqual(len(cur.description[0]),7,
'cursor.description[x] tuples must have 7 elements'
)
self.assertEqual(cur.description[0][0].lower(),'name',
'cursor.description[x][0] must return column name'
)
self.assertEqual(cur.description[0][1],self.driver.STRING,
'cursor.description[x][1] must return column type. Got %r'
% cur.description[0][1]
)
# Make sure self.description gets reset
self.executeDDL2(cur)
self.assertEqual(cur.description,None,
'cursor.description not being set to None when executing '
'no-result statements (eg. DDL)'
)
finally:
con.close()
def test_rowcount(self):
con = self._connect()
try:
cur = con.cursor()
self.executeDDL1(cur)
self.assertEqual(cur.rowcount,-1,
'cursor.rowcount should be -1 after executing no-result '
'statements'
)
cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
self.failUnless(cur.rowcount in (-1,1),
'cursor.rowcount should == number or rows inserted, or '
'set to -1 after executing an insert statement'
)
cur.execute("select name from %sbooze" % self.table_prefix)
self.failUnless(cur.rowcount in (-1,1),
'cursor.rowcount should == number of rows returned, or '
'set to -1 after executing a select statement'
)
self.executeDDL2(cur)
self.assertEqual(cur.rowcount,-1,
'cursor.rowcount not being reset to -1 after executing '
'no-result statements'
)
finally:
con.close()
lower_func = 'lower'
def test_callproc(self):
con = self._connect()
try:
cur = con.cursor()
if self.lower_func and hasattr(cur,'callproc'):
r = cur.callproc(self.lower_func,('FOO',))
self.assertEqual(len(r),1)
self.assertEqual(r[0],'FOO')
r = cur.fetchall()
self.assertEqual(len(r),1,'callproc produced no result set')
self.assertEqual(len(r[0]),1,
'callproc produced invalid result set'
)
self.assertEqual(r[0][0],'foo',
'callproc produced invalid results'
)
finally:
con.close()
def test_close(self):
con = self._connect()
try:
cur = con.cursor()
finally:
con.close()
# cursor.execute should raise an Error if called after connection
# closed
self.assertRaises(self.driver.Error,self.executeDDL1,cur)
# connection.commit should raise an Error if called after connection'
# closed.'
self.assertRaises(self.driver.Error,con.commit)
# connection.close should raise an Error if called more than once
self.assertRaises(self.driver.Error,con.close)
def test_execute(self):
con = self._connect()
try:
cur = con.cursor()
self._paraminsert(cur)
finally:
con.close()
def _paraminsert(self,cur):
self.executeDDL1(cur)
cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
self.failUnless(cur.rowcount in (-1,1))
if self.driver.paramstyle == 'qmark':
cur.execute(
'insert into %sbooze values (?)' % self.table_prefix,
("Cooper's",)
)
elif self.driver.paramstyle == 'numeric':
cur.execute(
'insert into %sbooze values (:1)' % self.table_prefix,
("Cooper's",)
)
elif self.driver.paramstyle == 'named':
cur.execute(
'insert into %sbooze values (:beer)' % self.table_prefix,
{'beer':"Cooper's"}
)
elif self.driver.paramstyle == 'format':
cur.execute(
'insert into %sbooze values (%%s)' % self.table_prefix,
("Cooper's",)
)
elif self.driver.paramstyle == 'pyformat':
cur.execute(
'insert into %sbooze values (%%(beer)s)' % self.table_prefix,
{'beer':"Cooper's"}
)
else:
self.fail('Invalid paramstyle')
self.failUnless(cur.rowcount in (-1,1))
cur.execute('select name from %sbooze' % self.table_prefix)
res = cur.fetchall()
self.assertEqual(len(res),2,'cursor.fetchall returned too few rows')
beers = [res[0][0],res[1][0]]
beers.sort()
self.assertEqual(beers[0],"Cooper's",
'cursor.fetchall retrieved incorrect data, or data inserted '
'incorrectly'
)
self.assertEqual(beers[1],"Victoria Bitter",
'cursor.fetchall retrieved incorrect data, or data inserted '
'incorrectly'
)
def test_executemany(self):
con = self._connect()
try:
cur = con.cursor()
self.executeDDL1(cur)
largs = [ ("Cooper's",) , ("Boag's",) ]
margs = [ {'beer': "Cooper's"}, {'beer': "Boag's"} ]
if self.driver.paramstyle == 'qmark':
cur.executemany(
'insert into %sbooze values (?)' % self.table_prefix,
largs
)
elif self.driver.paramstyle == 'numeric':
cur.executemany(
'insert into %sbooze values (:1)' % self.table_prefix,
largs
)
elif self.driver.paramstyle == 'named':
cur.executemany(
'insert into %sbooze values (:beer)' % self.table_prefix,
margs
)
elif self.driver.paramstyle == 'format':
cur.executemany(
'insert into %sbooze values (%%s)' % self.table_prefix,
largs
)
elif self.driver.paramstyle == 'pyformat':
cur.executemany(
'insert into %sbooze values (%%(beer)s)' % (
self.table_prefix
),
margs
)
else:
self.fail('Unknown paramstyle')
self.failUnless(cur.rowcount in (-1,2),
'insert using cursor.executemany set cursor.rowcount to '
'incorrect value %r' % cur.rowcount
)
cur.execute('select name from %sbooze' % self.table_prefix)
res = cur.fetchall()
self.assertEqual(len(res),2,
'cursor.fetchall retrieved incorrect number of rows'
)
beers = [res[0][0],res[1][0]]
beers.sort()
self.assertEqual(beers[0],"Boag's",'incorrect data retrieved')
self.assertEqual(beers[1],"Cooper's",'incorrect data retrieved')
finally:
con.close()
def test_fetchone(self):
con = self._connect()
try:
cur = con.cursor()
# cursor.fetchone should raise an Error if called before
# executing a select-type query
self.assertRaises(self.driver.Error,cur.fetchone)
# cursor.fetchone should raise an Error if called after
# executing a query that cannnot return rows
self.executeDDL1(cur)
self.assertRaises(self.driver.Error,cur.fetchone)
cur.execute('select name from %sbooze' % self.table_prefix)
self.assertEqual(cur.fetchone(),None,
'cursor.fetchone should return None if a query retrieves '
'no rows'
)
self.failUnless(cur.rowcount in (-1,0))
# cursor.fetchone should raise an Error if called after
# executing a query that cannnot return rows
cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
self.assertRaises(self.driver.Error,cur.fetchone)
cur.execute('select name from %sbooze' % self.table_prefix)
r = cur.fetchone()
self.assertEqual(len(r),1,
'cursor.fetchone should have retrieved a single row'
)
self.assertEqual(r[0],'Victoria Bitter',
'cursor.fetchone retrieved incorrect data'
)
self.assertEqual(cur.fetchone(),None,
'cursor.fetchone should return None if no more rows available'
)
self.failUnless(cur.rowcount in (-1,1))
finally:
con.close()
samples = [
'Carlton Cold',
'Carlton Draft',
'Mountain Goat',
'Redback',
'Victoria Bitter',
'XXXX'
]
def _populate(self):
''' Return a list of sql commands to setup the DB for the fetch
tests.
'''
populate = [
"insert into %sbooze values ('%s')" % (self.table_prefix,s)
for s in self.samples
]
return populate
def test_fetchmany(self):
con = self._connect()
try:
cur = con.cursor()
# cursor.fetchmany should raise an Error if called without
#issuing a query
self.assertRaises(self.driver.Error,cur.fetchmany,4)
self.executeDDL1(cur)
for sql in self._populate():
cur.execute(sql)
cur.execute('select name from %sbooze' % self.table_prefix)
r = cur.fetchmany()
self.assertEqual(len(r),1,
'cursor.fetchmany retrieved incorrect number of rows, '
'default of arraysize is one.'
)
cur.arraysize=10
r = cur.fetchmany(3) # Should get 3 rows
self.assertEqual(len(r),3,
'cursor.fetchmany retrieved incorrect number of rows'
)
r = cur.fetchmany(4) # Should get 2 more
self.assertEqual(len(r),2,
'cursor.fetchmany retrieved incorrect number of rows'
)
r = cur.fetchmany(4) # Should be an empty sequence
self.assertEqual(len(r),0,
'cursor.fetchmany should return an empty sequence after '
'results are exhausted'
)
self.failUnless(cur.rowcount in (-1,6))
# Same as above, using cursor.arraysize
cur.arraysize=4
cur.execute('select name from %sbooze' % self.table_prefix)
r = cur.fetchmany() # Should get 4 rows
self.assertEqual(len(r),4,
'cursor.arraysize not being honoured by fetchmany'
)
r = cur.fetchmany() # Should get 2 more
self.assertEqual(len(r),2)
r = cur.fetchmany() # Should be an empty sequence
self.assertEqual(len(r),0)
self.failUnless(cur.rowcount in (-1,6))
cur.arraysize=6
cur.execute('select name from %sbooze' % self.table_prefix)
rows = cur.fetchmany() # Should get all rows
self.failUnless(cur.rowcount in (-1,6))
self.assertEqual(len(rows),6)
self.assertEqual(len(rows),6)
rows = [r[0] for r in rows]
rows.sort()
# Make sure we get the right data back out
for i in range(0,6):
self.assertEqual(rows[i],self.samples[i],
'incorrect data retrieved by cursor.fetchmany'
)
rows = cur.fetchmany() # Should return an empty list
self.assertEqual(len(rows),0,
'cursor.fetchmany should return an empty sequence if '
'called after the whole result set has been fetched'
)
self.failUnless(cur.rowcount in (-1,6))
self.executeDDL2(cur)
cur.execute('select name from %sbarflys' % self.table_prefix)
r = cur.fetchmany() # Should get empty sequence
self.assertEqual(len(r),0,
'cursor.fetchmany should return an empty sequence if '
'query retrieved no rows'
)
self.failUnless(cur.rowcount in (-1,0))
finally:
con.close()
def test_fetchall(self):
con = self._connect()
try:
cur = con.cursor()
# cursor.fetchall should raise an Error if called
# without executing a query that may return rows (such
# as a select)
self.assertRaises(self.driver.Error, cur.fetchall)
self.executeDDL1(cur)
for sql in self._populate():
cur.execute(sql)
# cursor.fetchall should raise an Error if called
# after executing a a statement that cannot return rows
self.assertRaises(self.driver.Error,cur.fetchall)
cur.execute('select name from %sbooze' % self.table_prefix)
rows = cur.fetchall()
self.failUnless(cur.rowcount in (-1,len(self.samples)))
self.assertEqual(len(rows),len(self.samples),
'cursor.fetchall did not retrieve all rows'
)
rows = [r[0] for r in rows]
rows.sort()
for i in range(0,len(self.samples)):
self.assertEqual(rows[i],self.samples[i],
'cursor.fetchall retrieved incorrect rows'
)
rows = cur.fetchall()
self.assertEqual(
len(rows),0,
'cursor.fetchall should return an empty list if called '
'after the whole result set has been fetched'
)
self.failUnless(cur.rowcount in (-1,len(self.samples)))
self.executeDDL2(cur)
cur.execute('select name from %sbarflys' % self.table_prefix)
rows = cur.fetchall()
self.failUnless(cur.rowcount in (-1,0))
self.assertEqual(len(rows),0,
'cursor.fetchall should return an empty list if '
'a select query returns no rows'
)
finally:
con.close()
def test_mixedfetch(self):
con = self._connect()
try:
cur = con.cursor()
self.executeDDL1(cur)
for sql in self._populate():
cur.execute(sql)
cur.execute('select name from %sbooze' % self.table_prefix)
rows1 = cur.fetchone()
rows23 = cur.fetchmany(2)
rows4 = cur.fetchone()
rows56 = cur.fetchall()
self.failUnless(cur.rowcount in (-1,6))
self.assertEqual(len(rows23),2,
'fetchmany returned incorrect number of rows'
)
self.assertEqual(len(rows56),2,
'fetchall returned incorrect number of rows'
)
rows = [rows1[0]]
rows.extend([rows23[0][0],rows23[1][0]])
rows.append(rows4[0])
rows.extend([rows56[0][0],rows56[1][0]])
rows.sort()
for i in range(0,len(self.samples)):
self.assertEqual(rows[i],self.samples[i],
'incorrect data retrieved or inserted'
)
finally:
con.close()
def help_nextset_setUp(self,cur):
''' Should create a procedure called deleteme
that returns two result sets, first the
number of rows in booze then "name from booze"
'''
raise NotImplementedError,'Helper not implemented'
#sql="""
# create procedure deleteme as
# begin
# select count(*) from booze
# select name from booze
# end
#"""
#cur.execute(sql)
def help_nextset_tearDown(self,cur):
'If cleaning up is needed after nextSetTest'
raise NotImplementedError,'Helper not implemented'
#cur.execute("drop procedure deleteme")
def test_nextset(self):
con = self._connect()
try:
cur = con.cursor()
if not hasattr(cur,'nextset'):
return
try:
self.executeDDL1(cur)
sql=self._populate()
for sql in self._populate():
cur.execute(sql)
self.help_nextset_setUp(cur)
cur.callproc('deleteme')
numberofrows=cur.fetchone()
assert numberofrows[0]== len(self.samples)
assert cur.nextset()
names=cur.fetchall()
assert len(names) == len(self.samples)
s=cur.nextset()
assert s == None,'No more return sets, should return None'
finally:
self.help_nextset_tearDown(cur)
finally:
con.close()
def test_nextset(self):
raise NotImplementedError,'Drivers need to override this test'
def test_arraysize(self):
# Not much here - rest of the tests for this are in test_fetchmany
con = self._connect()
try:
cur = con.cursor()
self.failUnless(hasattr(cur,'arraysize'),
'cursor.arraysize must be defined'
)
finally:
con.close()
def test_setinputsizes(self):
con = self._connect()
try:
cur = con.cursor()
cur.setinputsizes( (25,) )
self._paraminsert(cur) # Make sure cursor still works
finally:
con.close()
def test_setoutputsize_basic(self):
# Basic test is to make sure setoutputsize doesn't blow up
con = self._connect()
try:
cur = con.cursor()
cur.setoutputsize(1000)
cur.setoutputsize(2000,0)
self._paraminsert(cur) # Make sure the cursor still works
finally:
con.close()
def test_setoutputsize(self):
# Real test for setoutputsize is driver dependant
raise NotImplementedError,'Driver need to override this test'
def test_None(self):
con = self._connect()
try:
cur = con.cursor()
self.executeDDL1(cur)
cur.execute('insert into %sbooze values (NULL)' % self.table_prefix)
cur.execute('select name from %sbooze' % self.table_prefix)
r = cur.fetchall()
self.assertEqual(len(r),1)
self.assertEqual(len(r[0]),1)
self.assertEqual(r[0][0],None,'NULL value not returned as None')
finally:
con.close()
def test_Date(self):
d1 = self.driver.Date(2002,12,25)
d2 = self.driver.DateFromTicks(time.mktime((2002,12,25,0,0,0,0,0,0)))
# Can we assume this? API doesn't specify, but it seems implied
# self.assertEqual(str(d1),str(d2))
def test_Time(self):
t1 = self.driver.Time(13,45,30)
t2 = self.driver.TimeFromTicks(time.mktime((2001,1,1,13,45,30,0,0,0)))
# Can we assume this? API doesn't specify, but it seems implied
# self.assertEqual(str(t1),str(t2))
def test_Timestamp(self):
t1 = self.driver.Timestamp(2002,12,25,13,45,30)
t2 = self.driver.TimestampFromTicks(
time.mktime((2002,12,25,13,45,30,0,0,0))
)
# Can we assume this? API doesn't specify, but it seems implied
# self.assertEqual(str(t1),str(t2))
def test_Binary(self):
b = self.driver.Binary('Something')
b = self.driver.Binary('')
def test_STRING(self):
self.failUnless(hasattr(self.driver,'STRING'),
'module.STRING must be defined'
)
def test_BINARY(self):
self.failUnless(hasattr(self.driver,'BINARY'),
'module.BINARY must be defined.'
)
def test_NUMBER(self):
self.failUnless(hasattr(self.driver,'NUMBER'),
'module.NUMBER must be defined.'
)
def test_DATETIME(self):
self.failUnless(hasattr(self.driver,'DATETIME'),
'module.DATETIME must be defined.'
)
def test_ROWID(self):
self.failUnless(hasattr(self.driver,'ROWID'),
'module.ROWID must be defined.'
)
| mit |
pierrepo/web_app_storage_sqlite_json | create_db.py | 1 | 2363 | # -*- coding: utf-8 -*-
import random
import sqlite3
import json
# https://github.com/joke2k/faker
from faker import Factory
fake = Factory.create('fr_FR')
# Create sqlite connection
conn = sqlite3.connect('places_db.sqlite')
curs = conn.cursor()
curs.execute('DROP TABLE IF EXISTS places')
conn.commit()
curs.execute('CREATE TABLE places(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, address TEXT, city TEXT, lat REAL, lon REAL, tel1 TEXT, tel2 TEXT)')
# Create json db
db = []
for i in range(2000):
name = "Pharmacie " + fake.last_name()
address = fake.street_name() + "\n"
address_comp1 = "face entreprise " + fake.last_name()
address_comp2 = "arrêt de bus " + fake.last_name()
address += random.choice([address_comp1, address_comp2])
place = random.choice(['PNR', 'BZV'])
city = ""
lat = 0.0
lon = 0.0
if place == 'PNR':
coords = (-4.787914, 11.864805)
city = "Pointe-Noire"
lat = fake.geo_coordinate(center=coords[0], radius=0.001)
lon = fake.geo_coordinate(center=coords[1], radius=0.001)
if place == 'BZV':
coords = (-4.261874, 15.252113)
city = "Brazzaville"
lat = fake.geo_coordinate(center=coords[0], radius=0.001)
lon = fake.geo_coordinate(center=coords[1], radius=0.001)
tel1 = random.choice(['05', '06']) + "".join([ str(random.randint(0, 9)) for n in range(7)])
tel2 = random.choice(['05', '06']) + "".join([ str(random.randint(0, 9)) for n in range(7)])
# output data
print(i)
print(name)
print(address)
print(city)
print(lat, lon)
print(tel1)
print(tel2)
# store data in sqlite
try:
curs.execute('INSERT INTO places(name, address, city, lat, lon, tel1, tel2) VALUES(?,?,?,?,?,?,?)', (name, address, city, float(lat), float(lon), tel1, tel2))
except:
print(name)
print(address)
print(city)
print(lat, lon)
print(tel1)
print(tel2)
# store in json
db.append( {"id":i, "name":name, "address":address, "city":city, "lat":float(lat), "lon":float(lon), "tel1":tel1, "tel2":tel2} )
# save and close SQLite database
conn.commit()
curs.close()
conn.close()
# save json database
with open("places_db.json", "w") as json_file:
json_file.write("places = ")
json.dump(db, json_file, sort_keys = True, indent=4)
| gpl-3.0 |
kinooo/Sick-Beard | lib/requests/packages/chardet2/sjisprober.py | 52 | 3568 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mark Pilgrim - port to Python
#
# This library 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; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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 GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
######################### END LICENSE BLOCK #########################
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import SJISDistributionAnalysis
from .jpcntx import SJISContextAnalysis
from .mbcssm import SJISSMModel
from . import constants
import sys
from .constants import eStart, eError, eItsMe
class SJISProber(MultiByteCharSetProber):
def __init__(self):
MultiByteCharSetProber.__init__(self)
self._mCodingSM = CodingStateMachine(SJISSMModel)
self._mDistributionAnalyzer = SJISDistributionAnalysis()
self._mContextAnalyzer = SJISContextAnalysis()
self.reset()
def reset(self):
MultiByteCharSetProber.reset(self)
self._mContextAnalyzer.reset()
def get_charset_name(self):
return "SHIFT_JIS"
def feed(self, aBuf):
aLen = len(aBuf)
for i in range(0, aLen):
codingState = self._mCodingSM.next_state(aBuf[i])
if codingState == eError:
if constants._debug:
sys.stderr.write(self.get_charset_name() + ' prober hit error at byte ' + str(i) + '\n')
self._mState = constants.eNotMe
break
elif codingState == eItsMe:
self._mState = constants.eFoundIt
break
elif codingState == eStart:
charLen = self._mCodingSM.get_current_charlen()
if i == 0:
self._mLastChar[1] = aBuf[0]
self._mContextAnalyzer.feed(self._mLastChar[2 - charLen :], charLen)
self._mDistributionAnalyzer.feed(self._mLastChar, charLen)
else:
self._mContextAnalyzer.feed(aBuf[i + 1 - charLen : i + 3 - charLen], charLen)
self._mDistributionAnalyzer.feed(aBuf[i - 1 : i + 1], charLen)
self._mLastChar[0] = aBuf[aLen - 1]
if self.get_state() == constants.eDetecting:
if self._mContextAnalyzer.got_enough_data() and \
(self.get_confidence() > constants.SHORTCUT_THRESHOLD):
self._mState = constants.eFoundIt
return self.get_state()
def get_confidence(self):
contxtCf = self._mContextAnalyzer.get_confidence()
distribCf = self._mDistributionAnalyzer.get_confidence()
return max(contxtCf, distribCf)
| gpl-3.0 |
htzy/bigfour | common/djangoapps/third_party_auth/tests/specs/base.py | 16 | 39186 | """Base integration test for provider implementations."""
import re
import unittest
import json
import mock
from django import test
from django.contrib import auth
from django.contrib.auth import models as auth_models
from django.contrib.messages.storage import fallback
from django.contrib.sessions.backends import cache
from django.test import utils as django_utils
from django.conf import settings as django_settings
from edxmako.tests import mako_middleware_process_request
from social import actions, exceptions
from social.apps.django_app import utils as social_utils
from social.apps.django_app import views as social_views
from student import models as student_models
from student import views as student_views
from student_account.views import account_settings_context
from third_party_auth import middleware, pipeline
from third_party_auth import settings as auth_settings
from third_party_auth.tests import testutil
@unittest.skipUnless(
testutil.AUTH_FEATURES_KEY in django_settings.FEATURES, testutil.AUTH_FEATURES_KEY + ' not in settings.FEATURES')
@django_utils.override_settings() # For settings reversion on a method-by-method basis.
class IntegrationTest(testutil.TestCase, test.TestCase):
"""Abstract base class for provider integration tests."""
# Override setUp and set this:
provider = None
# Methods you must override in your children.
def get_response_data(self):
"""Gets a dict of response data of the form given by the provider.
To determine what the provider returns, drop into a debugger in your
provider's do_auth implementation. Providers may merge different kinds
of data (for example, data about the user and data about the user's
credentials).
"""
raise NotImplementedError
def get_username(self):
"""Gets username based on response data from a provider.
Each provider has different logic for username generation. Sadly,
this is not extracted into its own method in python-social-auth, so we
must provide a getter ourselves.
Note that this is the *initial* value the framework will attempt to use.
If it collides, the pipeline will generate a new username. We extract
it here so we can force collisions in a polymorphic way.
"""
raise NotImplementedError
# Asserts you can optionally override and make more specific.
def assert_redirect_to_provider_looks_correct(self, response):
"""Asserts the redirect to the provider's site looks correct.
When we hit /auth/login/<provider>, we should be redirected to the
provider's site. Here we check that we're redirected, but we don't know
enough about the provider to check what we're redirected to. Child test
implementations may optionally strengthen this assertion with, for
example, more details about the format of the Location header.
"""
self.assertEqual(302, response.status_code)
self.assertTrue(response.has_header('Location'))
def assert_register_response_in_pipeline_looks_correct(self, response, pipeline_kwargs):
"""Performs spot checks of the rendered register.html page.
When we display the new account registration form after the user signs
in with a third party, we prepopulate the form with values sent back
from the provider. The exact set of values varies on a provider-by-
provider basis and is generated by
provider.BaseProvider.get_register_form_data. We provide some stock
assertions based on the provider's implementation; if you want more
assertions in your test, override this method.
"""
self.assertEqual(200, response.status_code)
# Check that the correct provider was selected.
self.assertIn('successfully signed in with <strong>%s</strong>' % self.provider.name, response.content)
# Expect that each truthy value we've prepopulated the register form
# with is actually present.
for prepopulated_form_value in self.provider.get_register_form_data(pipeline_kwargs).values():
if prepopulated_form_value:
self.assertIn(prepopulated_form_value, response.content)
# Implementation details and actual tests past this point -- no more
# configuration needed.
def setUp(self):
super(IntegrationTest, self).setUp()
self.request_factory = test.RequestFactory()
@property
def backend_name(self):
""" Shortcut for the backend name """
return self.provider.backend_name
# pylint: disable=invalid-name
def assert_account_settings_context_looks_correct(self, context, _user, duplicate=False, linked=None):
"""Asserts the user's account settings page context is in the expected state.
If duplicate is True, we expect context['duplicate_provider'] to contain
the duplicate provider backend name. If linked is passed, we conditionally
check that the provider is included in context['auth']['providers'] and
its connected state is correct.
"""
if duplicate:
self.assertEqual(context['duplicate_provider'], self.provider.backend_name)
else:
self.assertIsNone(context['duplicate_provider'])
if linked is not None:
expected_provider = [
provider for provider in context['auth']['providers'] if provider['name'] == self.provider.name
][0]
self.assertIsNotNone(expected_provider)
self.assertEqual(expected_provider['connected'], linked)
def assert_exception_redirect_looks_correct(self, expected_uri, auth_entry=None):
"""Tests middleware conditional redirection.
middleware.ExceptionMiddleware makes sure the user ends up in the right
place when they cancel authentication via the provider's UX.
"""
exception_middleware = middleware.ExceptionMiddleware()
request, _ = self.get_request_and_strategy(auth_entry=auth_entry)
response = exception_middleware.process_exception(
request, exceptions.AuthCanceled(request.backend))
location = response.get('Location')
self.assertEqual(302, response.status_code)
self.assertIn('canceled', location)
self.assertIn(self.backend_name, location)
self.assertTrue(location.startswith(expected_uri + '?'))
def assert_first_party_auth_trumps_third_party_auth(self, email=None, password=None, success=None):
"""Asserts first party auth was used in place of third party auth.
Args:
email: string. The user's email. If not None, will be set on POST.
password: string. The user's password. If not None, will be set on
POST.
success: None or bool. Whether we expect auth to be successful. Set
to None to indicate we expect the request to be invalid (meaning
one of username or password will be missing).
"""
_, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
self.create_user_models_for_existing_account(
strategy, email, password, self.get_username(), skip_social_auth=True)
strategy.request.POST = dict(strategy.request.POST)
if email:
strategy.request.POST['email'] = email
if password:
strategy.request.POST['password'] = 'bad_' + password if success is False else password
self.assert_pipeline_running(strategy.request)
payload = json.loads(student_views.login_user(strategy.request).content)
if success is None:
# Request malformed -- just one of email/password given.
self.assertFalse(payload.get('success'))
self.assertIn('There was an error receiving your login information', payload.get('value'))
elif success:
# Request well-formed and credentials good.
self.assertTrue(payload.get('success'))
else:
# Request well-formed but credentials bad.
self.assertFalse(payload.get('success'))
self.assertIn('incorrect', payload.get('value'))
def assert_json_failure_response_is_inactive_account(self, response):
"""Asserts failure on /login for inactive account looks right."""
self.assertEqual(200, response.status_code) # Yes, it's a 200 even though it's a failure.
payload = json.loads(response.content)
self.assertFalse(payload.get('success'))
self.assertIn('This account has not been activated', payload.get('value'))
def assert_json_failure_response_is_missing_social_auth(self, response):
"""Asserts failure on /login for missing social auth looks right."""
self.assertEqual(403, response.status_code)
self.assertIn(
"successfully logged into your %s account, but this account isn't linked" % self.provider.name,
response.content
)
def assert_json_failure_response_is_username_collision(self, response):
"""Asserts the json response indicates a username collision."""
self.assertEqual(400, response.status_code)
payload = json.loads(response.content)
self.assertFalse(payload.get('success'))
self.assertIn('already exists', payload.get('value'))
def assert_json_success_response_looks_correct(self, response):
"""Asserts the json response indicates success and redirection."""
self.assertEqual(200, response.status_code)
payload = json.loads(response.content)
self.assertTrue(payload.get('success'))
self.assertEqual(pipeline.get_complete_url(self.provider.backend_name), payload.get('redirect_url'))
def assert_login_response_before_pipeline_looks_correct(self, response):
"""Asserts a GET of /login not in the pipeline looks correct."""
self.assertEqual(200, response.status_code)
# The combined login/registration page dynamically generates the login button,
# but we can still check that the provider name is passed in the data attribute
# for the container element.
self.assertIn(self.provider.name, response.content)
def assert_login_response_in_pipeline_looks_correct(self, response):
"""Asserts a GET of /login in the pipeline looks correct."""
self.assertEqual(200, response.status_code)
def assert_password_overridden_by_pipeline(self, username, password):
"""Verifies that the given password is not correct.
The pipeline overrides POST['password'], if any, with random data.
"""
self.assertIsNone(auth.authenticate(password=password, username=username))
def assert_pipeline_running(self, request):
"""Makes sure the given request is running an auth pipeline."""
self.assertTrue(pipeline.running(request))
def assert_redirect_to_dashboard_looks_correct(self, response):
"""Asserts a response would redirect to /dashboard."""
self.assertEqual(302, response.status_code)
# pylint: disable=protected-access
self.assertEqual(auth_settings._SOCIAL_AUTH_LOGIN_REDIRECT_URL, response.get('Location'))
def assert_redirect_to_login_looks_correct(self, response):
"""Asserts a response would redirect to /login."""
self.assertEqual(302, response.status_code)
self.assertEqual('/login', response.get('Location'))
def assert_redirect_to_register_looks_correct(self, response):
"""Asserts a response would redirect to /register."""
self.assertEqual(302, response.status_code)
self.assertEqual('/register', response.get('Location'))
def assert_register_response_before_pipeline_looks_correct(self, response):
"""Asserts a GET of /register not in the pipeline looks correct."""
self.assertEqual(200, response.status_code)
# The combined login/registration page dynamically generates the register button,
# but we can still check that the provider name is passed in the data attribute
# for the container element.
self.assertIn(self.provider.name, response.content)
def assert_social_auth_does_not_exist_for_user(self, user, strategy):
"""Asserts a user does not have an auth with the expected provider."""
social_auths = strategy.storage.user.get_social_auth_for_user(
user, provider=self.provider.backend_name)
self.assertEqual(0, len(social_auths))
def assert_social_auth_exists_for_user(self, user, strategy):
"""Asserts a user has a social auth with the expected provider."""
social_auths = strategy.storage.user.get_social_auth_for_user(
user, provider=self.provider.backend_name)
self.assertEqual(1, len(social_auths))
self.assertEqual(self.backend_name, social_auths[0].provider)
def create_user_models_for_existing_account(self, strategy, email, password, username, skip_social_auth=False):
"""Creates user, profile, registration, and (usually) social auth.
This synthesizes what happens during /register.
See student.views.register and student.views._do_create_account.
"""
response_data = self.get_response_data()
uid = strategy.request.backend.get_user_id(response_data, response_data)
user = social_utils.Storage.user.create_user(email=email, password=password, username=username)
profile = student_models.UserProfile(user=user)
profile.save()
registration = student_models.Registration()
registration.register(user)
registration.save()
if not skip_social_auth:
social_utils.Storage.user.create_social_auth(user, uid, self.provider.backend_name)
return user
def fake_auth_complete(self, strategy):
"""Fake implementation of social.backends.BaseAuth.auth_complete.
Unlike what the docs say, it does not need to return a user instance.
Sometimes (like when directing users to the /register form) it instead
returns a response that 302s to /register.
"""
args = ()
kwargs = {
'request': strategy.request,
'backend': strategy.request.backend,
'user': None,
'response': self.get_response_data(),
}
return strategy.authenticate(*args, **kwargs)
def get_registration_post_vars(self, overrides=None):
"""POST vars generated by the registration form."""
defaults = {
'username': 'username',
'name': 'First Last',
'gender': '',
'year_of_birth': '',
'level_of_education': '',
'goals': '',
'honor_code': 'true',
'terms_of_service': 'true',
'password': 'password',
'mailing_address': '',
'email': 'user@email.com',
}
if overrides:
defaults.update(overrides)
return defaults
def get_request_and_strategy(self, auth_entry=None, redirect_uri=None):
"""Gets a fully-configured request and strategy.
These two objects contain circular references, so we create them
together. The references themselves are a mixture of normal __init__
stuff and monkey-patching done by python-social-auth. See, for example,
social.apps.django_apps.utils.strategy().
"""
request = self.request_factory.get(
pipeline.get_complete_url(self.backend_name) +
'?redirect_state=redirect_state_value&code=code_value&state=state_value')
request.user = auth_models.AnonymousUser()
request.session = cache.SessionStore()
request.session[self.backend_name + '_state'] = 'state_value'
if auth_entry:
request.session[pipeline.AUTH_ENTRY_KEY] = auth_entry
strategy = social_utils.load_strategy(request=request)
request.social_strategy = strategy
request.backend = social_utils.load_backend(strategy, self.backend_name, redirect_uri)
return request, strategy
def get_user_by_email(self, strategy, email):
"""Gets a user by email, using the given strategy."""
return strategy.storage.user.user_model().objects.get(email=email)
def assert_logged_in_cookie_redirect(self, response):
"""Verify that the user was redirected in order to set the logged in cookie. """
self.assertEqual(response.status_code, 302)
self.assertEqual(
response["Location"],
pipeline.get_complete_url(self.provider.backend_name)
)
self.assertEqual(response.cookies[django_settings.EDXMKTG_LOGGED_IN_COOKIE_NAME].value, 'true')
self.assertIn(django_settings.EDXMKTG_USER_INFO_COOKIE_NAME, response.cookies)
def set_logged_in_cookies(self, request):
"""Simulate setting the marketing site cookie on the request. """
request.COOKIES[django_settings.EDXMKTG_LOGGED_IN_COOKIE_NAME] = 'true'
request.COOKIES[django_settings.EDXMKTG_USER_INFO_COOKIE_NAME] = json.dumps({
'version': django_settings.EDXMKTG_USER_INFO_COOKIE_VERSION,
})
# Actual tests, executed once per child.
def test_canceling_authentication_redirects_to_login_when_auth_entry_login(self):
self.assert_exception_redirect_looks_correct('/login', auth_entry=pipeline.AUTH_ENTRY_LOGIN)
def test_canceling_authentication_redirects_to_register_when_auth_entry_register(self):
self.assert_exception_redirect_looks_correct('/register', auth_entry=pipeline.AUTH_ENTRY_REGISTER)
def test_canceling_authentication_redirects_to_login_when_auth_login_2(self):
self.assert_exception_redirect_looks_correct('/account/login/', auth_entry=pipeline.AUTH_ENTRY_LOGIN_2)
def test_canceling_authentication_redirects_to_login_when_auth_register_2(self):
self.assert_exception_redirect_looks_correct('/account/register/', auth_entry=pipeline.AUTH_ENTRY_REGISTER_2)
def test_canceling_authentication_redirects_to_account_settings_when_auth_entry_account_settings(self):
self.assert_exception_redirect_looks_correct(
'/account/settings', auth_entry=pipeline.AUTH_ENTRY_ACCOUNT_SETTINGS
)
def test_canceling_authentication_redirects_to_root_when_auth_entry_not_set(self):
self.assert_exception_redirect_looks_correct('/')
def test_full_pipeline_succeeds_for_linking_account(self):
# First, create, the request and strategy that store pipeline state,
# configure the backend, and mock out wire traffic.
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
pipeline.analytics.track = mock.MagicMock()
request.user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username(), skip_social_auth=True)
# Instrument the pipeline to get to the dashboard with the full
# expected state.
self.client.get(
pipeline.get_login_url(self.provider.provider_id, pipeline.AUTH_ENTRY_LOGIN))
actions.do_complete(request.backend, social_views._do_login) # pylint: disable=protected-access
mako_middleware_process_request(strategy.request)
student_views.signin_user(strategy.request)
student_views.login_user(strategy.request)
actions.do_complete(request.backend, social_views._do_login) # pylint: disable=protected-access
# First we expect that we're in the unlinked state, and that there
# really is no association in the backend.
self.assert_account_settings_context_looks_correct(account_settings_context(request), request.user, linked=False)
self.assert_social_auth_does_not_exist_for_user(request.user, strategy)
# We should be redirected back to the complete page, setting
# the "logged in" cookie for the marketing site.
self.assert_logged_in_cookie_redirect(actions.do_complete(
request.backend, social_views._do_login, request.user, None, # pylint: disable=protected-access
redirect_field_name=auth.REDIRECT_FIELD_NAME
))
# Set the cookie and try again
self.set_logged_in_cookies(request)
# Fire off the auth pipeline to link.
self.assert_redirect_to_dashboard_looks_correct(actions.do_complete(
request.backend, social_views._do_login, request.user, None, # pylint: disable=protected-access
redirect_field_name=auth.REDIRECT_FIELD_NAME))
# Now we expect to be in the linked state, with a backend entry.
self.assert_social_auth_exists_for_user(request.user, strategy)
self.assert_account_settings_context_looks_correct(account_settings_context(request), request.user, linked=True)
def test_full_pipeline_succeeds_for_unlinking_account(self):
# First, create, the request and strategy that store pipeline state,
# configure the backend, and mock out wire traffic.
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username())
self.assert_social_auth_exists_for_user(user, strategy)
# We're already logged in, so simulate that the cookie is set correctly
self.set_logged_in_cookies(request)
# Instrument the pipeline to get to the dashboard with the full
# expected state.
self.client.get(
pipeline.get_login_url(self.provider.provider_id, pipeline.AUTH_ENTRY_LOGIN))
actions.do_complete(request.backend, social_views._do_login) # pylint: disable=protected-access
mako_middleware_process_request(strategy.request)
student_views.signin_user(strategy.request)
student_views.login_user(strategy.request)
actions.do_complete(request.backend, social_views._do_login, user=user) # pylint: disable=protected-access
# First we expect that we're in the linked state, with a backend entry.
self.assert_account_settings_context_looks_correct(account_settings_context(request), user, linked=True)
self.assert_social_auth_exists_for_user(request.user, strategy)
# Fire off the disconnect pipeline to unlink.
self.assert_redirect_to_dashboard_looks_correct(actions.do_disconnect(
request.backend, request.user, None, redirect_field_name=auth.REDIRECT_FIELD_NAME))
# Now we expect to be in the unlinked state, with no backend entry.
self.assert_account_settings_context_looks_correct(account_settings_context(request), user, linked=False)
self.assert_social_auth_does_not_exist_for_user(user, strategy)
def test_linking_already_associated_account_raises_auth_already_associated(self):
# This is of a piece with
# test_already_associated_exception_populates_dashboard_with_error. It
# verifies the exception gets raised when we expect; the latter test
# covers exception handling.
email = 'user@example.com'
password = 'password'
username = self.get_username()
_, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
backend = strategy.request.backend
backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
linked_user = self.create_user_models_for_existing_account(strategy, email, password, username)
unlinked_user = social_utils.Storage.user.create_user(
email='other_' + email, password=password, username='other_' + username)
self.assert_social_auth_exists_for_user(linked_user, strategy)
self.assert_social_auth_does_not_exist_for_user(unlinked_user, strategy)
with self.assertRaises(exceptions.AuthAlreadyAssociated):
# pylint: disable=protected-access
actions.do_complete(backend, social_views._do_login, user=unlinked_user)
def test_already_associated_exception_populates_dashboard_with_error(self):
# Instrument the pipeline with an exception. We test that the
# exception is raised correctly separately, so it's ok that we're
# raising it artificially here. This makes the linked=True artificial
# in the final assert because in practice the account would be
# unlinked, but getting that behavior is cumbersome here and already
# covered in other tests. Using linked=True does, however, let us test
# that the duplicate error has no effect on the state of the controls.
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username())
self.assert_social_auth_exists_for_user(user, strategy)
self.client.get('/login')
self.client.get(pipeline.get_login_url(self.provider.provider_id, pipeline.AUTH_ENTRY_LOGIN))
actions.do_complete(request.backend, social_views._do_login) # pylint: disable=protected-access
mako_middleware_process_request(strategy.request)
student_views.signin_user(strategy.request)
student_views.login_user(strategy.request)
actions.do_complete(request.backend, social_views._do_login, user=user) # pylint: disable=protected-access
# Monkey-patch storage for messaging; pylint: disable=protected-access
request._messages = fallback.FallbackStorage(request)
middleware.ExceptionMiddleware().process_exception(
request,
exceptions.AuthAlreadyAssociated(self.provider.backend_name, 'account is already in use.'))
self.assert_account_settings_context_looks_correct(
account_settings_context(request), user, duplicate=True, linked=True)
def test_full_pipeline_succeeds_for_signing_in_to_existing_active_account(self):
# First, create, the request and strategy that store pipeline state,
# configure the backend, and mock out wire traffic.
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
pipeline.analytics.track = mock.MagicMock()
user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username())
self.assert_social_auth_exists_for_user(user, strategy)
self.assertTrue(user.is_active)
# Begin! Ensure that the login form contains expected controls before
# the user starts the pipeline.
self.assert_login_response_before_pipeline_looks_correct(self.client.get('/login'))
# The pipeline starts by a user GETting /auth/login/<provider>.
# Synthesize that request and check that it redirects to the correct
# provider page.
self.assert_redirect_to_provider_looks_correct(self.client.get(
pipeline.get_login_url(self.provider.provider_id, pipeline.AUTH_ENTRY_LOGIN)))
# Next, the provider makes a request against /auth/complete/<provider>
# to resume the pipeline.
# pylint: disable=protected-access
self.assert_redirect_to_login_looks_correct(actions.do_complete(request.backend, social_views._do_login))
mako_middleware_process_request(strategy.request)
# At this point we know the pipeline has resumed correctly. Next we
# fire off the view that displays the login form and posts it via JS.
self.assert_login_response_in_pipeline_looks_correct(student_views.signin_user(strategy.request))
# Next, we invoke the view that handles the POST, and expect it
# redirects to /auth/complete. In the browser ajax handlers will
# redirect the user to the dashboard; we invoke it manually here.
self.assert_json_success_response_looks_correct(student_views.login_user(strategy.request))
# We should be redirected back to the complete page, setting
# the "logged in" cookie for the marketing site.
self.assert_logged_in_cookie_redirect(actions.do_complete(
request.backend, social_views._do_login, request.user, None, # pylint: disable=protected-access
redirect_field_name=auth.REDIRECT_FIELD_NAME
))
# Set the cookie and try again
self.set_logged_in_cookies(request)
self.assert_redirect_to_dashboard_looks_correct(
actions.do_complete(request.backend, social_views._do_login, user=user))
self.assert_account_settings_context_looks_correct(account_settings_context(request), user)
def test_signin_fails_if_account_not_active(self):
_, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
user = self.create_user_models_for_existing_account(strategy, 'user@example.com', 'password', self.get_username())
user.is_active = False
user.save()
mako_middleware_process_request(strategy.request)
self.assert_json_failure_response_is_inactive_account(student_views.login_user(strategy.request))
def test_signin_fails_if_no_account_associated(self):
_, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username(), skip_social_auth=True)
self.assert_json_failure_response_is_missing_social_auth(student_views.login_user(strategy.request))
def test_first_party_auth_trumps_third_party_auth_but_is_invalid_when_only_email_in_request(self):
self.assert_first_party_auth_trumps_third_party_auth(email='user@example.com')
def test_first_party_auth_trumps_third_party_auth_but_is_invalid_when_only_password_in_request(self):
self.assert_first_party_auth_trumps_third_party_auth(password='password')
def test_first_party_auth_trumps_third_party_auth_and_fails_when_credentials_bad(self):
self.assert_first_party_auth_trumps_third_party_auth(
email='user@example.com', password='password', success=False)
def test_first_party_auth_trumps_third_party_auth_and_succeeds_when_credentials_good(self):
self.assert_first_party_auth_trumps_third_party_auth(
email='user@example.com', password='password', success=True)
def test_full_pipeline_succeeds_registering_new_account(self):
# First, create, the request and strategy that store pipeline state.
# Mock out wire traffic.
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_REGISTER, redirect_uri='social:complete')
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
# Begin! Grab the registration page and check the login control on it.
self.assert_register_response_before_pipeline_looks_correct(self.client.get('/register'))
# The pipeline starts by a user GETting /auth/login/<provider>.
# Synthesize that request and check that it redirects to the correct
# provider page.
self.assert_redirect_to_provider_looks_correct(self.client.get(
pipeline.get_login_url(self.provider.provider_id, pipeline.AUTH_ENTRY_LOGIN)))
# Next, the provider makes a request against /auth/complete/<provider>.
# pylint: disable=protected-access
self.assert_redirect_to_register_looks_correct(actions.do_complete(request.backend, social_views._do_login))
mako_middleware_process_request(strategy.request)
# At this point we know the pipeline has resumed correctly. Next we
# fire off the view that displays the registration form.
self.assert_register_response_in_pipeline_looks_correct(
student_views.register_user(strategy.request), pipeline.get(request)['kwargs'])
# Next, we invoke the view that handles the POST. Not all providers
# supply email. Manually add it as the user would have to; this
# also serves as a test of overriding provider values. Always provide a
# password for us to check that we override it properly.
overridden_password = strategy.request.POST.get('password')
email = 'new@example.com'
if not strategy.request.POST.get('email'):
strategy.request.POST = self.get_registration_post_vars({'email': email})
# The user must not exist yet...
with self.assertRaises(auth_models.User.DoesNotExist):
self.get_user_by_email(strategy, email)
# ...but when we invoke create_account the existing edX view will make
# it, but not social auths. The pipeline creates those later.
self.assert_json_success_response_looks_correct(student_views.create_account(strategy.request))
# We've overridden the user's password, so authenticate() with the old
# value won't work:
created_user = self.get_user_by_email(strategy, email)
self.assert_password_overridden_by_pipeline(overridden_password, created_user.username)
# At this point the user object exists, but there is no associated
# social auth.
self.assert_social_auth_does_not_exist_for_user(created_user, strategy)
# We should be redirected back to the complete page, setting
# the "logged in" cookie for the marketing site.
self.assert_logged_in_cookie_redirect(actions.do_complete(
request.backend, social_views._do_login, request.user, None, # pylint: disable=protected-access
redirect_field_name=auth.REDIRECT_FIELD_NAME
))
# Set the cookie and try again
self.set_logged_in_cookies(request)
self.assert_redirect_to_dashboard_looks_correct(
actions.do_complete(strategy.request.backend, social_views._do_login, user=created_user))
# Now the user has been redirected to the dashboard. Their third party account should now be linked.
self.assert_social_auth_exists_for_user(created_user, strategy)
self.assert_account_settings_context_looks_correct(account_settings_context(request), created_user, linked=True)
def test_new_account_registration_assigns_distinct_username_on_collision(self):
original_username = self.get_username()
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_REGISTER, redirect_uri='social:complete')
# Create a colliding username in the backend, then proceed with
# assignment via pipeline to make sure a distinct username is created.
strategy.storage.user.create_user(username=self.get_username(), email='user@email.com', password='password')
backend = strategy.request.backend
backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
# pylint: disable=protected-access
self.assert_redirect_to_register_looks_correct(actions.do_complete(backend, social_views._do_login))
distinct_username = pipeline.get(request)['kwargs']['username']
self.assertNotEqual(original_username, distinct_username)
def test_new_account_registration_fails_if_email_exists(self):
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_REGISTER, redirect_uri='social:complete')
backend = strategy.request.backend
backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
# pylint: disable=protected-access
self.assert_redirect_to_register_looks_correct(actions.do_complete(backend, social_views._do_login))
mako_middleware_process_request(strategy.request)
self.assert_register_response_in_pipeline_looks_correct(
student_views.register_user(strategy.request), pipeline.get(request)['kwargs'])
strategy.request.POST = self.get_registration_post_vars()
# Create twice: once successfully, and once causing a collision.
student_views.create_account(strategy.request)
self.assert_json_failure_response_is_username_collision(student_views.create_account(strategy.request))
def test_pipeline_raises_auth_entry_error_if_auth_entry_invalid(self):
auth_entry = 'invalid'
self.assertNotIn(auth_entry, pipeline._AUTH_ENTRY_CHOICES) # pylint: disable=protected-access
_, strategy = self.get_request_and_strategy(auth_entry=auth_entry, redirect_uri='social:complete')
with self.assertRaises(pipeline.AuthEntryError):
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
def test_pipeline_raises_auth_entry_error_if_auth_entry_missing(self):
_, strategy = self.get_request_and_strategy(auth_entry=None, redirect_uri='social:complete')
with self.assertRaises(pipeline.AuthEntryError):
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
class Oauth2IntegrationTest(IntegrationTest): # pylint: disable=abstract-method
"""Base test case for integration tests of Oauth2 providers."""
# Dict of string -> object. Information about the token granted to the
# user. Override with test values in subclass; None to force a throw.
TOKEN_RESPONSE_DATA = None
# Dict of string -> object. Information about the user themself. Override
# with test values in subclass; None to force a throw.
USER_RESPONSE_DATA = None
def get_response_data(self):
"""Gets dict (string -> object) of merged data about the user."""
response_data = dict(self.TOKEN_RESPONSE_DATA)
response_data.update(self.USER_RESPONSE_DATA)
return response_data
| agpl-3.0 |
mchrzasz/EMPP_MC | Lecture1/Euler_number/e_num_RMS.py | 1 | 2542 | from ROOT import *
import sys
import numpy as np
from array import array
def main(argv=sys.argv):
ROOT.gStyle.SetOptFit()
e=2.7182818284590452353602874713527
seed=123
rand = TRandom(seed)
hist = TH1I("hist", "hist", 100,0.,100.)
n_points=1000
n_toys=[100, 1000, 10000, 100000]
hists=[]
for i in range(len(n_toys)):
hists.append(TH1D('e with ' +str(n_toys[i]) +' toys', 'e with ' +str(n_toys[i]) +' toys' , 100, -3/sqrt(n_toys[i]),3/sqrt(n_toys[i])))
for i_repear in range(n_points):
for i in range(len(n_toys)):
hist = TH1I("hist"+str(i), "hist", 100,0.,100.)
for itoy in range(0,n_toys[i]):
n=0
start=0.;
while(true):
tmp=rand.Rndm()
n=n+1
if(tmp<start): break
else:
start=tmp
hist.Fill(n)
#print 'Measured e with ', n_toys[i], 'toys = ', hist.GetMean(), '+/- ', hist.GetMeanError()
hists[i].Fill(hist.GetMean()-e)
#############################################3
c1= TCanvas("results", "results", 800,600)
c1.Divide(2,2)
sigma=[]
sigma_err=[]
for i in range(len(n_toys)):
c1.cd(i+1)
hists[i].GetXaxis().SetTitle("#hat{e}-e")
hists[i].Draw()
hists[i].Fit("gaus")
fit = hists[i].GetFunction("gaus");
sigma.append(fit.GetParameter(2))
sigma_err.append(fit.GetParError(2))
c1.SaveAs("result_error.pdf")
print sigma
#############################################
# Doing a graph error
############################################
x= np.array(n_toys)
xe=np.array(n_toys)
for i in range(len(xe)):
xe[i]=0.
y= np.array(sigma)
ye= np.array(sigma_err)
print x,y,xe,ye
print len(xe)
gr=TGraphErrors(len(xe), array("d",x), array("d",y) ,array("d",xe) ,array("d",ye))
gr.GetXaxis().SetTitle("N.of.Toys")
gr.GetYaxis().SetTitle("Expected Uncertainty")
c2=TCanvas("results_gr", "results_gr", 800,600)
c2.cd()
gr.Draw("AP")
fun = TF1("fun","[0]/sqrt(x)",0.9*n_toys[0] ,1.1*n_toys[3])
gr.Fit("fun")
fun.Draw("SAME")
c2.SetLogx();
c2.SaveAs("result_error_dep.pdf")
print 'Exiting'
if __name__ == "__main__":
sys.exit(main())
| mit |
mistercrunch/airflow | tests/providers/amazon/aws/transfers/test_s3_to_redshift_system.py | 10 | 2103 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
import os
import pytest
from airflow.models import Connection
from airflow.utils import db
from airflow.utils.session import create_session
from tests.test_utils import AIRFLOW_MAIN_FOLDER
from tests.test_utils.amazon_system_helpers import AWS_DAG_FOLDER, AmazonSystemTest
from tests.test_utils.terraform import Terraform
@pytest.mark.backend("mysql", "postgres")
class TestS3ToRedshiftExampleDags(AmazonSystemTest, Terraform):
TERRAFORM_DIR = os.path.join(
AIRFLOW_MAIN_FOLDER, "tests", "providers", "amazon", "aws", "infrastructure", "example_s3_to_redshift"
)
def setUp(self) -> None:
super().setUp()
host, port = self.get_tf_output("redshift_endpoint").split(':')
schema = self.get_tf_output("redshift_database_name")
login = self.get_tf_output("redshift_master_username")
password = self.get_tf_output("redshift_master_password")
db.merge_conn(Connection("redshift_default", "postgres", host, login, password, schema, port))
def test_run_example_dag_s3_to_redshift(self):
self.run_dag('example_s3_to_redshift', AWS_DAG_FOLDER)
def tearDown(self) -> None:
super().tearDown()
with create_session() as session:
session.query(Connection).filter(Connection.conn_id == "redshift_default").delete()
| apache-2.0 |
tomi77/python-t77-django | tests/tests.py | 1 | 8870 | from datetime import datetime
import django
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from django.test.utils import override_settings
from django_extra_tools.auth.backends import ThroughSuperuserModelBackend
from django_extra_tools.db import pg_version
from django_extra_tools.db.models.aggregates import First, Last, Median, \
StringAgg
from django_extra_tools.templatetags.parse import parse_duration
from django_extra_tools.wsgi_request import get_client_ip
from .models import FirstLastTest, MedianTest, StringAggTest, \
TimestampableTest
try:
from unittest import mock
except ImportError:
from mock import mock
def mock_get_connection(version):
class MockCursor(object):
def __init__(self, _version):
self.version = _version
def execute(self, *args):
pass
def fetchone(self):
return [self.version]
class MockConnection(object):
def __init__(self, _version):
self.version = _version
def cursor(self):
return MockCursor(self.version)
def get_connection(using):
return MockConnection(version)
return get_connection
class PgVersionTestCase(TestCase):
@mock.patch('django_extra_tools.db.get_connection', mock_get_connection('9.4.1'))
def test_9_4_1(self):
"""Version 9.4.1"""
self.assertEqual(pg_version(), (9, 4, 1))
@mock.patch('django_extra_tools.db.get_connection', mock_get_connection('9.1.2'))
def test_9_1_2(self):
"""Version 9.1.2"""
self.assertEqual(pg_version(), (9, 1, 2))
class FirstTestCase(TestCase):
fixtures = ['first_last.yaml']
def test_first_with_order(self):
qs = FirstLastTest.objects.all().aggregate(first=First('val', order_by='ts'))
self.assertEqual(qs['first'], 10)
class LastTestCase(TestCase):
fixtures = ['first_last.yaml']
def test_last_with_order(self):
qs = FirstLastTest.objects.all().aggregate(last=Last('val', order_by='ts'))
self.assertEqual(qs['last'], 15)
class MedianTestCase(TestCase):
fixtures = ['median.yaml']
def test_odd_number_of_integers(self):
qs = MedianTest.objects.all().aggregate(Median('val_int'))
self.assertEqual(qs['val_int__median'], 15)
def test_even_number_of_integers(self):
qs = MedianTest.objects.filter(pk__lt=5).aggregate(Median('val_int'))
self.assertEqual(qs['val_int__median'], 17.5)
def test_odd_number_of_floats(self):
qs = MedianTest.objects.all().aggregate(Median('val_float'))
self.assertEqual(qs['val_float__median'], 15.0)
def test_even_number_of_floats(self):
qs = MedianTest.objects.filter(pk__lt=5).aggregate(Median('val_float'))
self.assertEqual(qs['val_float__median'], 17.5)
class StringAggTestCase(TestCase):
fixtures = ['string_agg.yaml']
def test_default_delimiter(self):
qs = StringAggTest.objects.all().aggregate(StringAgg('val_str'))
self.assertEqual(qs['val_str__stringagg'], '1,2,3')
def test_own_delimiter(self):
qs = StringAggTest.objects.all().aggregate(StringAgg('val_str', delimiter='-'))
self.assertEqual(qs['val_str__stringagg'], '1-2-3')
def test_int_default_delimiter(self):
qs = StringAggTest.objects.all().aggregate(StringAgg('val_int'))
self.assertEqual(qs['val_int__stringagg'], '1,2,3')
def test_int_own_delimiter(self):
qs = StringAggTest.objects.all().aggregate(StringAgg('val_int', delimiter='-'))
self.assertEqual(qs['val_int__stringagg'], '1-2-3')
class GetClientIpTestCase(TestCase):
def test_empty_all(self):
request = HttpRequest()
self.assertIsNone(get_client_ip(request))
def test_remote_addr(self):
request = HttpRequest()
request.META = {'REMOTE_ADDR': '10.10.0.1'}
self.assertEqual(get_client_ip(request), '10.10.0.1')
def test_x_forwarded_for(self):
request = HttpRequest()
request.META = {'HTTP_X_FORWARDED_FOR': '10.10.0.1'}
self.assertIsNone(get_client_ip(request))
def test_proxy(self):
request = HttpRequest()
request.META = {'REMOTE_ADDR': '192.168.0.1',
'HTTP_X_FORWARDED_FOR': '192.168.0.1,123.234.123.234'}
self.assertEqual(get_client_ip(request), '123.234.123.234')
class ParseDateTestCase(TestCase):
def test_parse_date(self):
tpl = render_to_string('date.txt', {'datestr': '2016-01-02'})
self.assertEqual(tpl, '2016-01-02')
def test_incorrect_date(self):
tpl = render_to_string('date.txt', {'datestr': 'not a date'})
self.assertEqual(tpl, '')
class ParseDateTimeTestCase(TestCase):
def test_parse_datetime(self):
tpl = render_to_string('datetime.txt', {'datetimestr': '2016-01-02T12:23:34'})
self.assertEqual(tpl, '2016-01-02 12:23:34')
def test_incorrect_datetime(self):
tpl = render_to_string('datetime.txt', {'datetimestr': 'not a datetime'})
self.assertEqual(tpl, '')
class ParseTimeTestCase(TestCase):
def test_parse_time(self):
tpl = render_to_string('time.txt', {'timestr': '12:23:34'})
self.assertEqual(tpl, '12:23:34')
def test_incorrect_time(self):
tpl = render_to_string('time.txt', {'timestr': 'not a time'})
self.assertEqual(tpl, '')
if parse_duration is not None:
class ParseDurationCase(TestCase):
def test_parse_duration(self):
tpl = render_to_string('duration.txt', {'durationstr': '12:23:34'})
self.assertEqual(tpl, '12:23:34')
def test_incorrect_duration(self):
tpl = render_to_string('duration.txt', {'durationstr': 'not a duration'})
self.assertEqual(tpl, 'None')
class TimestampableTestCase(TestCase):
fixtures = ['timestampable']
def setUp(self):
user = User.objects.get(pk=1)
self.obj = TimestampableTest.objects.create(name='1', created_by=user)
def test_created_at(self):
self.assertIsInstance(self.obj.created_at, datetime)
def test_updated_at(self):
# self.assertIsNone(self.obj.updated_at)
self.obj.name = 'update'
self.obj.save()
self.assertIsInstance(self.obj.updated_at, datetime)
def test_deleted_at(self):
self.assertIsNone(self.obj.deleted_at)
self.obj.delete()
self.assertIsInstance(self.obj.deleted_at, datetime)
def test_created_by(self):
self.assertIsInstance(self.obj.created_by, User)
def test_updated_by(self):
user = User.objects.get(pk=2)
self.assertIsNone(self.obj.updated_by)
self.obj.name = 'delete'
self.obj.save_by(user)
self.assertIsInstance(self.obj.updated_by, User)
self.assertEqual(self.obj.updated_by, user)
def test_deleted_by(self):
user = User.objects.get(pk=3)
self.assertIsNone(self.obj.deleted_by)
self.obj.delete_by(user)
self.assertIsInstance(self.obj.deleted_by, User)
self.assertEqual(self.obj.deleted_by, user)
self.assertIsInstance(self.obj.deleted_at, datetime)
class ThroughSuperuserModelBackendTestCase(TestCase):
fixtures = ['through-superuser-model-backend']
backend = ThroughSuperuserModelBackend()
def authenticate(self, username, password):
if django.VERSION[:2] < (1, 11):
return self.backend.authenticate(username, password)
else:
return self.backend.authenticate(None, username, password)
def test_user_through_superuser(self):
"""Test authenticate as user through superuser username and password"""
user = self.authenticate('superuser:user', 'test')
self.assertIsInstance(user, User)
self.assertEqual(user.username, 'user')
def test_unknown_superuser(self):
"""Test authenticate as user through unknown superuser"""
user = self.authenticate('superuser2:user', 'test')
self.assertIsNone(user)
@override_settings(AUTH_BACKEND_USERNAME_SEPARATOR='@')
def test_separator(self):
"""Test authenticate as user through superuser username and password and @ as separator"""
user = self.authenticate('superuser@user', 'test')
self.assertIsInstance(user, User)
self.assertEqual(user.username, 'user')
class ViewPermissionsTestCase(TestCase):
def test_create(self):
"""Test of creation view_* permissions"""
content_types = ContentType.objects.count()
view_permissions = Permission.objects.filter(codename__startswith='view_').count()
self.assertEqual(content_types, view_permissions)
| mit |
ckirby/django | django/contrib/gis/gdal/libgdal.py | 449 | 3598 | from __future__ import unicode_literals
import logging
import os
import re
from ctypes import CDLL, CFUNCTYPE, c_char_p, c_int
from ctypes.util import find_library
from django.contrib.gis.gdal.error import GDALException
from django.core.exceptions import ImproperlyConfigured
logger = logging.getLogger('django.contrib.gis')
# Custom library path set?
try:
from django.conf import settings
lib_path = settings.GDAL_LIBRARY_PATH
except (AttributeError, EnvironmentError,
ImportError, ImproperlyConfigured):
lib_path = None
if lib_path:
lib_names = None
elif os.name == 'nt':
# Windows NT shared libraries
lib_names = ['gdal111', 'gdal110', 'gdal19', 'gdal18', 'gdal17']
elif os.name == 'posix':
# *NIX library names.
lib_names = ['gdal', 'GDAL', 'gdal1.11.0', 'gdal1.10.0', 'gdal1.9.0',
'gdal1.8.0', 'gdal1.7.0']
else:
raise GDALException('Unsupported OS "%s"' % os.name)
# Using the ctypes `find_library` utility to find the
# path to the GDAL library from the list of library names.
if lib_names:
for lib_name in lib_names:
lib_path = find_library(lib_name)
if lib_path is not None:
break
if lib_path is None:
raise GDALException('Could not find the GDAL library (tried "%s"). '
'Try setting GDAL_LIBRARY_PATH in your settings.' %
'", "'.join(lib_names))
# This loads the GDAL/OGR C library
lgdal = CDLL(lib_path)
# On Windows, the GDAL binaries have some OSR routines exported with
# STDCALL, while others are not. Thus, the library will also need to
# be loaded up as WinDLL for said OSR functions that require the
# different calling convention.
if os.name == 'nt':
from ctypes import WinDLL
lwingdal = WinDLL(lib_path)
def std_call(func):
"""
Returns the correct STDCALL function for certain OSR routines on Win32
platforms.
"""
if os.name == 'nt':
return lwingdal[func]
else:
return lgdal[func]
# #### Version-information functions. ####
# Returns GDAL library version information with the given key.
_version_info = std_call('GDALVersionInfo')
_version_info.argtypes = [c_char_p]
_version_info.restype = c_char_p
def gdal_version():
"Returns only the GDAL version number information."
return _version_info(b'RELEASE_NAME')
def gdal_full_version():
"Returns the full GDAL version information."
return _version_info('')
version_regex = re.compile(r'^(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<subminor>\d+))?')
def gdal_version_info():
ver = gdal_version().decode()
m = version_regex.match(ver)
if not m:
raise GDALException('Could not parse GDAL version string "%s"' % ver)
return {key: m.group(key) for key in ('major', 'minor', 'subminor')}
_verinfo = gdal_version_info()
GDAL_MAJOR_VERSION = int(_verinfo['major'])
GDAL_MINOR_VERSION = int(_verinfo['minor'])
GDAL_SUBMINOR_VERSION = _verinfo['subminor'] and int(_verinfo['subminor'])
GDAL_VERSION = (GDAL_MAJOR_VERSION, GDAL_MINOR_VERSION, GDAL_SUBMINOR_VERSION)
del _verinfo
# Set library error handling so as errors are logged
CPLErrorHandler = CFUNCTYPE(None, c_int, c_int, c_char_p)
def err_handler(error_class, error_number, message):
logger.error('GDAL_ERROR %d: %s' % (error_number, message))
err_handler = CPLErrorHandler(err_handler)
def function(name, args, restype):
func = std_call(name)
func.argtypes = args
func.restype = restype
return func
set_error_handler = function('CPLSetErrorHandler', [CPLErrorHandler], CPLErrorHandler)
set_error_handler(err_handler)
| bsd-3-clause |
hexxcointakeover/hexxcoin | qa/rpc-tests/bipdersig-p2p.py | 49 | 6866 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script import CScript
from io import BytesIO
import time
# A canonical signature consists of:
# <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
def unDERify(tx):
'''
Make the signature in vin 0 of a tx non-DER-compliant,
by adding padding after the S-value.
'''
scriptSig = CScript(tx.vin[0].scriptSig)
newscript = []
for i in scriptSig:
if (len(newscript) == 0):
newscript.append(i[0:-1] + b'\0' + i[-1:])
else:
newscript.append(i)
tx.vin[0].scriptSig = CScript(newscript)
'''
This test is meant to exercise BIP66 (DER SIG).
Connect to a single node.
Mine 2 (version 2) blocks (save the coinbases for later).
Generate 98 more version 2 blocks, verify the node accepts.
Mine 749 version 3 blocks, verify the node accepts.
Check that the new DERSIG rules are not enforced on the 750th version 3 block.
Check that the new DERSIG rules are enforced on the 751st version 3 block.
Mine 199 new version blocks.
Mine 1 old-version block.
Mine 1 new version block.
Mine 1 old version block, see that the node rejects.
'''
class BIP66Test(ComparisonTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
# Must set the blockversion for this test
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=2']],
binary=[self.options.testbinary])
def run_test(self):
test = TestManager(self, self.options.tmpdir)
test.add_all_connections(self.nodes)
NetworkThread().start() # Start up network handling in another thread
test.run()
def create_transaction(self, node, coinbase, to_address, amount):
from_txid = node.getblock(coinbase)['tx'][0]
inputs = [{ "txid" : from_txid, "vout" : 0}]
outputs = { to_address : amount }
rawtx = node.createrawtransaction(inputs, outputs)
signresult = node.signrawtransaction(rawtx)
tx = CTransaction()
f = BytesIO(hex_str_to_bytes(signresult['hex']))
tx.deserialize(f)
return tx
def get_tests(self):
self.coinbase_blocks = self.nodes[0].generate(2)
height = 3 # height of the next block to build
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
self.nodeaddress = self.nodes[0].getnewaddress()
self.last_block_time = int(time.time())
''' 98 more version 2 blocks '''
test_blocks = []
for i in range(98):
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 2
block.rehash()
block.solve()
test_blocks.append([block, True])
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance(test_blocks, sync_every_block=False)
''' Mine 749 version 3 blocks '''
test_blocks = []
for i in range(749):
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 3
block.rehash()
block.solve()
test_blocks.append([block, True])
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance(test_blocks, sync_every_block=False)
'''
Check that the new DERSIG rules are not enforced in the 750th
version 3 block.
'''
spendtx = self.create_transaction(self.nodes[0],
self.coinbase_blocks[0], self.nodeaddress, 1.0)
unDERify(spendtx)
spendtx.rehash()
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 3
block.vtx.append(spendtx)
block.hashMerkleRoot = block.calc_merkle_root()
block.rehash()
block.solve()
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance([[block, True]])
'''
Check that the new DERSIG rules are enforced in the 751st version 3
block.
'''
spendtx = self.create_transaction(self.nodes[0],
self.coinbase_blocks[1], self.nodeaddress, 1.0)
unDERify(spendtx)
spendtx.rehash()
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 3
block.vtx.append(spendtx)
block.hashMerkleRoot = block.calc_merkle_root()
block.rehash()
block.solve()
self.last_block_time += 1
yield TestInstance([[block, False]])
''' Mine 199 new version blocks on last valid tip '''
test_blocks = []
for i in range(199):
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 3
block.rehash()
block.solve()
test_blocks.append([block, True])
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance(test_blocks, sync_every_block=False)
''' Mine 1 old version block '''
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 2
block.rehash()
block.solve()
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance([[block, True]])
''' Mine 1 new version block '''
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 3
block.rehash()
block.solve()
self.last_block_time += 1
self.tip = block.sha256
height += 1
yield TestInstance([[block, True]])
''' Mine 1 old version block, should be invalid '''
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
block.nVersion = 2
block.rehash()
block.solve()
self.last_block_time += 1
yield TestInstance([[block, False]])
if __name__ == '__main__':
BIP66Test().main()
| mit |
biswajitsahu/kuma | vendor/packages/pyflakes/reporter.py | 52 | 2666 | """
Provide the Reporter class.
"""
import re
import sys
class Reporter(object):
"""
Formats the results of pyflakes checks to users.
"""
def __init__(self, warningStream, errorStream):
"""
Construct a L{Reporter}.
@param warningStream: A file-like object where warnings will be
written to. The stream's C{write} method must accept unicode.
C{sys.stdout} is a good value.
@param errorStream: A file-like object where error output will be
written to. The stream's C{write} method must accept unicode.
C{sys.stderr} is a good value.
"""
self._stdout = warningStream
self._stderr = errorStream
def unexpectedError(self, filename, msg):
"""
An unexpected error occurred trying to process C{filename}.
@param filename: The path to a file that we could not process.
@ptype filename: C{unicode}
@param msg: A message explaining the problem.
@ptype msg: C{unicode}
"""
self._stderr.write("%s: %s\n" % (filename, msg))
def syntaxError(self, filename, msg, lineno, offset, text):
"""
There was a syntax errror in C{filename}.
@param filename: The path to the file with the syntax error.
@ptype filename: C{unicode}
@param msg: An explanation of the syntax error.
@ptype msg: C{unicode}
@param lineno: The line number where the syntax error occurred.
@ptype lineno: C{int}
@param offset: The column on which the syntax error occurred, or None.
@ptype offset: C{int}
@param text: The source code containing the syntax error.
@ptype text: C{unicode}
"""
line = text.splitlines()[-1]
if offset is not None:
offset = offset - (len(text) - len(line))
self._stderr.write('%s:%d:%d: %s\n' %
(filename, lineno, offset + 1, msg))
else:
self._stderr.write('%s:%d: %s\n' % (filename, lineno, msg))
self._stderr.write(line)
self._stderr.write('\n')
if offset is not None:
self._stderr.write(re.sub(r'\S', ' ', line[:offset]) +
"^\n")
def flake(self, message):
"""
pyflakes found something wrong with the code.
@param: A L{pyflakes.messages.Message}.
"""
self._stdout.write(str(message))
self._stdout.write('\n')
def _makeDefaultReporter():
"""
Make a reporter that can be used when no reporter is specified.
"""
return Reporter(sys.stdout, sys.stderr)
| mpl-2.0 |
ianw/pip | pip/req/req_install.py | 1 | 42022 | from __future__ import absolute_import
import logging
import os
import re
import shutil
import sys
import tempfile
import warnings
import zipfile
from distutils.util import change_root
from distutils import sysconfig
from email.parser import FeedParser
from pip._vendor import pkg_resources, six
from pip._vendor.distlib.markers import interpret as markers_interpret
from pip._vendor.six.moves import configparser
from pip._vendor.six.moves.urllib import parse as urllib_parse
import pip.wheel
from pip.compat import native_str, WINDOWS
from pip.download import is_url, url_to_path, path_to_url, is_archive_file
from pip.exceptions import (
InstallationError, UninstallationError, UnsupportedWheel,
)
from pip.locations import (
bin_py, running_under_virtualenv, PIP_DELETE_MARKER_FILENAME, bin_user,
)
from pip.utils import (
display_path, rmtree, ask_path_exists, backup_dir, is_installable_dir,
dist_in_usersite, dist_in_site_packages, egg_link_path, make_path_relative,
call_subprocess, read_text_file, FakeFile, _make_build_dir,
)
from pip.utils.deprecation import RemovedInPip8Warning
from pip.utils.logging import indent_log
from pip.req.req_uninstall import UninstallPathSet
from pip.vcs import vcs
from pip.wheel import move_wheel_files, Wheel, wheel_ext
from pip._vendor.packaging.version import Version
logger = logging.getLogger(__name__)
class InstallRequirement(object):
def __init__(self, req, comes_from, source_dir=None, editable=False,
url=None, as_egg=False, update=True, editable_options=None,
pycompile=True, markers=None, isolated=False):
self.extras = ()
if isinstance(req, six.string_types):
req = pkg_resources.Requirement.parse(req)
self.extras = req.extras
self.req = req
self.comes_from = comes_from
self.source_dir = source_dir
self.editable = editable
if editable_options is None:
editable_options = {}
self.editable_options = editable_options
self.url = url
self.as_egg = as_egg
self.markers = markers
self._egg_info_path = None
# This holds the pkg_resources.Distribution object if this requirement
# is already available:
self.satisfied_by = None
# This hold the pkg_resources.Distribution object if this requirement
# conflicts with another installed distribution:
self.conflicts_with = None
self._temp_build_dir = None
# True if the editable should be updated:
self.update = update
# Set to True after successful installation
self.install_succeeded = None
# UninstallPathSet of uninstalled distribution (for possible rollback)
self.uninstalled = None
self.use_user_site = False
self.target_dir = None
self.pycompile = pycompile
self.isolated = isolated
@classmethod
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
isolated=False):
name, url, extras_override, editable_options = parse_editable(
editable_req, default_vcs)
if url.startswith('file:'):
source_dir = url_to_path(url)
else:
source_dir = None
res = cls(name, comes_from, source_dir=source_dir,
editable=True,
url=url,
editable_options=editable_options,
isolated=isolated)
if extras_override is not None:
res.extras = extras_override
return res
@classmethod
def from_line(cls, name, comes_from=None, isolated=False):
"""Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL.
"""
from pip.index import Link
url = None
if is_url(name):
marker_sep = '; '
else:
marker_sep = ';'
if marker_sep in name:
name, markers = name.split(marker_sep, 1)
markers = markers.strip()
if not markers:
markers = None
else:
markers = None
name = name.strip()
req = None
path = os.path.normpath(os.path.abspath(name))
link = None
if is_url(name):
link = Link(name)
elif (os.path.isdir(path)
and (os.path.sep in name or name.startswith('.'))):
if not is_installable_dir(path):
raise InstallationError(
"Directory %r is not installable. File 'setup.py' not "
"found." % name
)
link = Link(path_to_url(name))
elif is_archive_file(path):
if not os.path.isfile(path):
logger.warning(
'Requirement %r looks like a filename, but the file does '
'not exist',
name
)
link = Link(path_to_url(name))
# it's a local file, dir, or url
if link:
url = link.url
# Handle relative file URLs
if link.scheme == 'file' and re.search(r'\.\./', url):
url = path_to_url(os.path.normpath(os.path.abspath(link.path)))
# wheel file
if link.ext == wheel_ext:
wheel = Wheel(link.filename) # can raise InvalidWheelFilename
if not wheel.supported():
raise UnsupportedWheel(
"%s is not a supported wheel on this platform." %
wheel.filename
)
req = "%s==%s" % (wheel.name, wheel.version)
else:
# set the req to the egg fragment. when it's not there, this
# will become an 'unnamed' requirement
req = link.egg_fragment
# a requirement specifier
else:
req = name
return cls(req, comes_from, url=url, markers=markers,
isolated=isolated)
def __str__(self):
if self.req:
s = str(self.req)
if self.url:
s += ' from %s' % self.url
else:
s = self.url
if self.satisfied_by is not None:
s += ' in %s' % display_path(self.satisfied_by.location)
if self.comes_from:
if isinstance(self.comes_from, six.string_types):
comes_from = self.comes_from
else:
comes_from = self.comes_from.from_path()
if comes_from:
s += ' (from %s)' % comes_from
return s
@property
def specifier(self):
return self.req.specifier
def from_path(self):
if self.req is None:
return None
s = str(self.req)
if self.comes_from:
if isinstance(self.comes_from, six.string_types):
comes_from = self.comes_from
else:
comes_from = self.comes_from.from_path()
if comes_from:
s += '->' + comes_from
return s
def build_location(self, build_dir):
if self._temp_build_dir is not None:
return self._temp_build_dir
if self.req is None:
self._temp_build_dir = tempfile.mkdtemp('-build', 'pip-')
self._ideal_build_dir = build_dir
return self._temp_build_dir
if self.editable:
name = self.name.lower()
else:
name = self.name
# FIXME: Is there a better place to create the build_dir? (hg and bzr
# need this)
if not os.path.exists(build_dir):
_make_build_dir(build_dir)
return os.path.join(build_dir, name)
def correct_build_location(self):
"""If the build location was a temporary directory, this will move it
to a new more permanent location"""
if self.source_dir is not None:
return
assert self.req is not None
assert self._temp_build_dir
old_location = self._temp_build_dir
new_build_dir = self._ideal_build_dir
del self._ideal_build_dir
if self.editable:
name = self.name.lower()
else:
name = self.name
new_location = os.path.join(new_build_dir, name)
if not os.path.exists(new_build_dir):
logger.debug('Creating directory %s', new_build_dir)
_make_build_dir(new_build_dir)
if os.path.exists(new_location):
raise InstallationError(
'A package already exists in %s; please remove it to continue'
% display_path(new_location))
logger.debug(
'Moving package %s from %s to new location %s',
self, display_path(old_location), display_path(new_location),
)
shutil.move(old_location, new_location)
self._temp_build_dir = new_location
self.source_dir = new_location
self._egg_info_path = None
@property
def name(self):
if self.req is None:
return None
return native_str(self.req.project_name)
@property
def url_name(self):
if self.req is None:
return None
return urllib_parse.quote(self.req.project_name.lower())
@property
def setup_py(self):
try:
import setuptools # noqa
except ImportError:
# Setuptools is not available
raise InstallationError(
"setuptools must be installed to install from a source "
"distribution"
)
setup_file = 'setup.py'
if self.editable_options and 'subdirectory' in self.editable_options:
setup_py = os.path.join(self.source_dir,
self.editable_options['subdirectory'],
setup_file)
else:
setup_py = os.path.join(self.source_dir, setup_file)
# Python2 __file__ should not be unicode
if six.PY2 and isinstance(setup_py, six.text_type):
setup_py = setup_py.encode(sys.getfilesystemencoding())
return setup_py
def run_egg_info(self):
assert self.source_dir
if self.name:
logger.debug(
'Running setup.py (path:%s) egg_info for package %s',
self.setup_py, self.name,
)
else:
logger.debug(
'Running setup.py (path:%s) egg_info for package from %s',
self.setup_py, self.url,
)
with indent_log():
# if it's distribute>=0.7, it won't contain an importable
# setuptools, and having an egg-info dir blocks the ability of
# setup.py to find setuptools plugins, so delete the egg-info dir
# if no setuptools. it will get recreated by the run of egg_info
# NOTE: this self.name check only works when installing from a
# specifier (not archive path/urls)
# TODO: take this out later
if (self.name == 'distribute'
and not os.path.isdir(
os.path.join(self.source_dir, 'setuptools'))):
rmtree(os.path.join(self.source_dir, 'distribute.egg-info'))
script = self._run_setup_py
script = script.replace('__SETUP_PY__', repr(self.setup_py))
script = script.replace('__PKG_NAME__', repr(self.name))
base_cmd = [sys.executable, '-c', script]
if self.isolated:
base_cmd += ["--no-user-cfg"]
egg_info_cmd = base_cmd + ['egg_info']
# We can't put the .egg-info files at the root, because then the
# source code will be mistaken for an installed egg, causing
# problems
if self.editable:
egg_base_option = []
else:
egg_info_dir = os.path.join(self.source_dir, 'pip-egg-info')
if not os.path.exists(egg_info_dir):
os.makedirs(egg_info_dir)
egg_base_option = ['--egg-base', 'pip-egg-info']
cwd = self.source_dir
if self.editable_options and \
'subdirectory' in self.editable_options:
cwd = os.path.join(cwd, self.editable_options['subdirectory'])
call_subprocess(
egg_info_cmd + egg_base_option,
cwd=cwd,
filter_stdout=self._filter_install,
show_stdout=False,
command_level=logging.DEBUG,
command_desc='python setup.py egg_info')
if not self.req:
if isinstance(
pkg_resources.parse_version(self.pkg_info()["Version"]),
Version):
op = "=="
else:
op = "==="
self.req = pkg_resources.Requirement.parse(
"".join([
self.pkg_info()["Name"],
op,
self.pkg_info()["Version"],
]))
self.correct_build_location()
# FIXME: This is a lame hack, entirely for PasteScript which has
# a self-provided entry point that causes this awkwardness
_run_setup_py = """
__file__ = __SETUP_PY__
from setuptools.command import egg_info
import pkg_resources
import os
import tokenize
def replacement_run(self):
self.mkpath(self.egg_info)
installer = self.distribution.fetch_build_egg
for ep in pkg_resources.iter_entry_points('egg_info.writers'):
# require=False is the change we're making:
writer = ep.load(require=False)
if writer:
writer(self, ep.name, os.path.join(self.egg_info,ep.name))
self.find_sources()
egg_info.egg_info.run = replacement_run
exec(compile(
getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'),
__file__,
'exec'
))
"""
def egg_info_data(self, filename):
if self.satisfied_by is not None:
if not self.satisfied_by.has_metadata(filename):
return None
return self.satisfied_by.get_metadata(filename)
assert self.source_dir
filename = self.egg_info_path(filename)
if not os.path.exists(filename):
return None
data = read_text_file(filename)
return data
def egg_info_path(self, filename):
if self._egg_info_path is None:
if self.editable:
base = self.source_dir
else:
base = os.path.join(self.source_dir, 'pip-egg-info')
filenames = os.listdir(base)
if self.editable:
filenames = []
for root, dirs, files in os.walk(base):
for dir in vcs.dirnames:
if dir in dirs:
dirs.remove(dir)
# Iterate over a copy of ``dirs``, since mutating
# a list while iterating over it can cause trouble.
# (See https://github.com/pypa/pip/pull/462.)
for dir in list(dirs):
# Don't search in anything that looks like a virtualenv
# environment
if (
os.path.exists(
os.path.join(root, dir, 'bin', 'python')
)
or os.path.exists(
os.path.join(
root, dir, 'Scripts', 'Python.exe'
)
)):
dirs.remove(dir)
# Also don't search through tests
elif dir == 'test' or dir == 'tests':
dirs.remove(dir)
filenames.extend([os.path.join(root, dir)
for dir in dirs])
filenames = [f for f in filenames if f.endswith('.egg-info')]
if not filenames:
raise InstallationError(
'No files/directories in %s (from %s)' % (base, filename)
)
assert filenames, \
"No files/directories in %s (from %s)" % (base, filename)
# if we have more than one match, we pick the toplevel one. This
# can easily be the case if there is a dist folder which contains
# an extracted tarball for testing purposes.
if len(filenames) > 1:
filenames.sort(
key=lambda x: x.count(os.path.sep)
+ (os.path.altsep and x.count(os.path.altsep) or 0)
)
self._egg_info_path = os.path.join(base, filenames[0])
return os.path.join(self._egg_info_path, filename)
def pkg_info(self):
p = FeedParser()
data = self.egg_info_data('PKG-INFO')
if not data:
logger.warning(
'No PKG-INFO file found in %s',
display_path(self.egg_info_path('PKG-INFO')),
)
p.feed(data or '')
return p.close()
_requirements_section_re = re.compile(r'\[(.*?)\]')
@property
def installed_version(self):
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(self.name)
# We want to avoid having this cached, so we need to construct a new
# working set each time.
working_set = pkg_resources.WorkingSet()
# Get the installed distribution from our working set
dist = working_set.find(req)
# Check to see if we got an installed distribution or not, if we did
# we want to return it's version.
if dist:
return dist.version
def assert_source_matches_version(self):
assert self.source_dir
version = self.pkg_info()['version']
if version not in self.req:
logger.warning(
'Requested %s, but installing version %s',
self,
self.installed_version,
)
else:
logger.debug(
'Source in %s has version %s, which satisfies requirement %s',
display_path(self.source_dir),
version,
self,
)
def update_editable(self, obtain=True):
if not self.url:
logger.debug(
"Cannot update repository at %s; repository location is "
"unknown",
self.source_dir,
)
return
assert self.editable
assert self.source_dir
if self.url.startswith('file:'):
# Static paths don't get updated
return
assert '+' in self.url, "bad url: %r" % self.url
if not self.update:
return
vc_type, url = self.url.split('+', 1)
backend = vcs.get_backend(vc_type)
if backend:
vcs_backend = backend(self.url)
if obtain:
vcs_backend.obtain(self.source_dir)
else:
vcs_backend.export(self.source_dir)
else:
assert 0, (
'Unexpected version control type (in %s): %s'
% (self.url, vc_type))
def uninstall(self, auto_confirm=False):
"""
Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_confirm`` is True.
Refuses to delete or modify files outside of ``sys.prefix`` -
thus uninstallation within a virtual environment can only
modify that virtual environment, even if the virtualenv is
linked to global site-packages.
"""
if not self.check_if_exists():
raise UninstallationError(
"Cannot uninstall requirement %s, not installed" % (self.name,)
)
dist = self.satisfied_by or self.conflicts_with
paths_to_remove = UninstallPathSet(dist)
develop_egg_link = egg_link_path(dist)
egg_info_exists = dist.egg_info and os.path.exists(dist.egg_info)
# Special case for distutils installed package
distutils_egg_info = getattr(dist._provider, 'path', None)
if develop_egg_link:
# develop egg
with open(develop_egg_link, 'r') as fh:
link_pointer = os.path.normcase(fh.readline().strip())
assert (link_pointer == dist.location), (
'Egg-link %s does not match installed location of %s '
'(at %s)' % (link_pointer, self.name, dist.location)
)
paths_to_remove.add(develop_egg_link)
easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
'easy-install.pth')
paths_to_remove.add_pth(easy_install_pth, dist.location)
elif egg_info_exists and dist.egg_info.endswith('.egg-info'):
paths_to_remove.add(dist.egg_info)
if dist.has_metadata('installed-files.txt'):
for installed_file in dist.get_metadata(
'installed-files.txt').splitlines():
path = os.path.normpath(
os.path.join(dist.egg_info, installed_file)
)
paths_to_remove.add(path)
# FIXME: need a test for this elif block
# occurs with --single-version-externally-managed/--record outside
# of pip
elif dist.has_metadata('top_level.txt'):
if dist.has_metadata('namespace_packages.txt'):
namespaces = dist.get_metadata('namespace_packages.txt')
else:
namespaces = []
for top_level_pkg in [
p for p
in dist.get_metadata('top_level.txt').splitlines()
if p and p not in namespaces]:
path = os.path.join(dist.location, top_level_pkg)
paths_to_remove.add(path)
paths_to_remove.add(path + '.py')
paths_to_remove.add(path + '.pyc')
elif distutils_egg_info:
warnings.warn(
"Uninstalling a distutils installed project ({0}) has been "
"deprecated and will be removed in a future version. This is "
"due to the fact that uninstalling a distutils project will "
"only partially uninstall the project.".format(self.name),
RemovedInPip8Warning,
)
paths_to_remove.add(distutils_egg_info)
elif dist.location.endswith('.egg'):
# package installed by easy_install
# We cannot match on dist.egg_name because it can slightly vary
# i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg
paths_to_remove.add(dist.location)
easy_install_egg = os.path.split(dist.location)[1]
easy_install_pth = os.path.join(os.path.dirname(dist.location),
'easy-install.pth')
paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)
elif egg_info_exists and dist.egg_info.endswith('.dist-info'):
for path in pip.wheel.uninstallation_paths(dist):
paths_to_remove.add(path)
else:
logger.debug(
'Not sure how to uninstall: %s - Check: %s',
dist, dist.location)
# find distutils scripts= scripts
if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
for script in dist.metadata_listdir('scripts'):
if dist_in_usersite(dist):
bin_dir = bin_user
else:
bin_dir = bin_py
paths_to_remove.add(os.path.join(bin_dir, script))
if WINDOWS:
paths_to_remove.add(os.path.join(bin_dir, script) + '.bat')
# find console_scripts
if dist.has_metadata('entry_points.txt'):
config = configparser.SafeConfigParser()
config.readfp(
FakeFile(dist.get_metadata_lines('entry_points.txt'))
)
if config.has_section('console_scripts'):
for name, value in config.items('console_scripts'):
if dist_in_usersite(dist):
bin_dir = bin_user
else:
bin_dir = bin_py
paths_to_remove.add(os.path.join(bin_dir, name))
if WINDOWS:
paths_to_remove.add(
os.path.join(bin_dir, name) + '.exe'
)
paths_to_remove.add(
os.path.join(bin_dir, name) + '.exe.manifest'
)
paths_to_remove.add(
os.path.join(bin_dir, name) + '-script.py'
)
paths_to_remove.remove(auto_confirm)
self.uninstalled = paths_to_remove
def rollback_uninstall(self):
if self.uninstalled:
self.uninstalled.rollback()
else:
logger.error(
"Can't rollback %s, nothing uninstalled.", self.project_name,
)
def commit_uninstall(self):
if self.uninstalled:
self.uninstalled.commit()
else:
logger.error(
"Can't commit %s, nothing uninstalled.", self.project_name,
)
def archive(self, build_dir):
assert self.source_dir
create_archive = True
archive_name = '%s-%s.zip' % (self.name, self.pkg_info()["version"])
archive_path = os.path.join(build_dir, archive_name)
if os.path.exists(archive_path):
response = ask_path_exists(
'The file %s exists. (i)gnore, (w)ipe, (b)ackup ' %
display_path(archive_path), ('i', 'w', 'b'))
if response == 'i':
create_archive = False
elif response == 'w':
logger.warning('Deleting %s', display_path(archive_path))
os.remove(archive_path)
elif response == 'b':
dest_file = backup_dir(archive_path)
logger.warning(
'Backing up %s to %s',
display_path(archive_path),
display_path(dest_file),
)
shutil.move(archive_path, dest_file)
if create_archive:
zip = zipfile.ZipFile(
archive_path, 'w', zipfile.ZIP_DEFLATED,
allowZip64=True
)
dir = os.path.normcase(os.path.abspath(self.source_dir))
for dirpath, dirnames, filenames in os.walk(dir):
if 'pip-egg-info' in dirnames:
dirnames.remove('pip-egg-info')
for dirname in dirnames:
dirname = os.path.join(dirpath, dirname)
name = self._clean_zip_name(dirname, dir)
zipdir = zipfile.ZipInfo(self.name + '/' + name + '/')
zipdir.external_attr = 0x1ED << 16 # 0o755
zip.writestr(zipdir, '')
for filename in filenames:
if filename == PIP_DELETE_MARKER_FILENAME:
continue
filename = os.path.join(dirpath, filename)
name = self._clean_zip_name(filename, dir)
zip.write(filename, self.name + '/' + name)
zip.close()
logger.info('Saved %s', display_path(archive_path))
def _clean_zip_name(self, name, prefix):
assert name.startswith(prefix + os.path.sep), (
"name %r doesn't start with prefix %r" % (name, prefix)
)
name = name[len(prefix) + 1:]
name = name.replace(os.path.sep, '/')
return name
def match_markers(self):
if self.markers is not None:
return markers_interpret(self.markers)
else:
return True
def install(self, install_options, global_options=(), root=None):
if self.editable:
self.install_editable(install_options, global_options)
return
if self.is_wheel:
version = pip.wheel.wheel_version(self.source_dir)
pip.wheel.check_compatibility(version, self.name)
self.move_wheel_files(self.source_dir, root=root)
self.install_succeeded = True
return
if self.isolated:
global_options = list(global_options) + ["--no-user-cfg"]
temp_location = tempfile.mkdtemp('-record', 'pip-')
record_filename = os.path.join(temp_location, 'install-record.txt')
try:
install_args = [sys.executable]
install_args.append('-c')
install_args.append(
"import setuptools, tokenize;__file__=%r;"
"exec(compile(getattr(tokenize, 'open', open)(__file__).read()"
".replace('\\r\\n', '\\n'), __file__, 'exec'))" % self.setup_py
)
install_args += list(global_options) + \
['install', '--record', record_filename]
if not self.as_egg:
install_args += ['--single-version-externally-managed']
if root is not None:
install_args += ['--root', root]
if self.pycompile:
install_args += ["--compile"]
else:
install_args += ["--no-compile"]
if running_under_virtualenv():
# FIXME: I'm not sure if this is a reasonable location;
# probably not but we can't put it in the default location, as
# that is a virtualenv symlink that isn't writable
py_ver_str = 'python' + sysconfig.get_python_version()
install_args += ['--install-headers',
os.path.join(sys.prefix, 'include', 'site',
py_ver_str)]
logger.info('Running setup.py install for %s', self.name)
with indent_log():
call_subprocess(
install_args + install_options,
cwd=self.source_dir,
filter_stdout=self._filter_install,
show_stdout=False,
)
if not os.path.exists(record_filename):
logger.debug('Record file %s not found', record_filename)
return
self.install_succeeded = True
if self.as_egg:
# there's no --always-unzip option we can pass to install
# command so we unable to save the installed-files.txt
return
def prepend_root(path):
if root is None or not os.path.isabs(path):
return path
else:
return change_root(root, path)
with open(record_filename) as f:
for line in f:
directory = os.path.dirname(line)
if directory.endswith('.egg-info'):
egg_info_dir = prepend_root(directory)
break
else:
logger.warning(
'Could not find .egg-info directory in install record'
' for %s',
self,
)
# FIXME: put the record somewhere
# FIXME: should this be an error?
return
new_lines = []
with open(record_filename) as f:
for line in f:
filename = line.strip()
if os.path.isdir(filename):
filename += os.path.sep
new_lines.append(
make_path_relative(
prepend_root(filename), egg_info_dir)
)
inst_files_path = os.path.join(egg_info_dir, 'installed-files.txt')
with open(inst_files_path, 'w') as f:
f.write('\n'.join(new_lines) + '\n')
finally:
if os.path.exists(record_filename):
os.remove(record_filename)
os.rmdir(temp_location)
def remove_temporary_source(self):
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing source in %s', self.source_dir)
rmtree(self.source_dir)
self.source_dir = None
if self._temp_build_dir and os.path.exists(self._temp_build_dir):
rmtree(self._temp_build_dir)
self._temp_build_dir = None
def install_editable(self, install_options, global_options=()):
logger.info('Running setup.py develop for %s', self.name)
if self.isolated:
global_options = list(global_options) + ["--no-user-cfg"]
with indent_log():
# FIXME: should we do --install-headers here too?
cwd = self.source_dir
if self.editable_options and \
'subdirectory' in self.editable_options:
cwd = os.path.join(cwd, self.editable_options['subdirectory'])
call_subprocess(
[
sys.executable,
'-c',
"import setuptools, tokenize; __file__=%r; exec(compile("
"getattr(tokenize, 'open', open)(__file__).read().replace"
"('\\r\\n', '\\n'), __file__, 'exec'))" % self.setup_py
]
+ list(global_options)
+ ['develop', '--no-deps']
+ list(install_options),
cwd=cwd, filter_stdout=self._filter_install,
show_stdout=False)
self.install_succeeded = True
def _filter_install(self, line):
level = logging.INFO
for regex in [
r'^running .*',
r'^writing .*',
'^creating .*',
'^[Cc]opying .*',
r'^reading .*',
r"^removing .*\.egg-info' \(and everything under it\)$",
r'^byte-compiling ',
r'^SyntaxError:',
r'^SyntaxWarning:',
r'^\s*Skipping implicit fixer: ',
r'^\s*(warning: )?no previously-included (files|directories) ',
r'^\s*warning: no files found matching \'.*\'',
# Not sure what this warning is, but it seems harmless:
r"^warning: manifest_maker: standard file '-c' not found$"]:
if not line or re.search(regex, line.strip()):
level = logging.DEBUG
break
return (level, line)
def check_if_exists(self):
"""Find an installed distribution that satisfies or conflicts
with this requirement, and set self.satisfied_by or
self.conflicts_with appropriately."""
if self.req is None:
return False
try:
# DISTRIBUTE TO SETUPTOOLS UPGRADE HACK (1 of 3 parts)
# if we've already set distribute as a conflict to setuptools
# then this check has already run before. we don't want it to
# run again, and return False, since it would block the uninstall
# TODO: remove this later
if (self.req.project_name == 'setuptools'
and self.conflicts_with
and self.conflicts_with.project_name == 'distribute'):
return True
else:
self.satisfied_by = pkg_resources.get_distribution(self.req)
except pkg_resources.DistributionNotFound:
return False
except pkg_resources.VersionConflict:
existing_dist = pkg_resources.get_distribution(
self.req.project_name
)
if self.use_user_site:
if dist_in_usersite(existing_dist):
self.conflicts_with = existing_dist
elif (running_under_virtualenv()
and dist_in_site_packages(existing_dist)):
raise InstallationError(
"Will not install to the user site because it will "
"lack sys.path precedence to %s in %s" %
(existing_dist.project_name, existing_dist.location)
)
else:
self.conflicts_with = existing_dist
return True
@property
def is_wheel(self):
return self.url and '.whl' in self.url
def move_wheel_files(self, wheeldir, root=None):
move_wheel_files(
self.name, self.req, wheeldir,
user=self.use_user_site,
home=self.target_dir,
root=root,
pycompile=self.pycompile,
isolated=self.isolated,
)
def get_dist(self):
"""Return a pkg_resources.Distribution built from self.egg_info_path"""
egg_info = self.egg_info_path('')
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(egg_info))[0]
return pkg_resources.Distribution(
os.path.dirname(egg_info),
project_name=dist_name,
metadata=metadata)
def _strip_postfix(req):
"""
Strip req postfix ( -dev, 0.2, etc )
"""
# FIXME: use package_to_requirement?
match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
if match:
# Strip off -dev, -0.2, etc.
req = match.group(1)
return req
def _build_req_from_url(url):
parts = [p for p in url.split('#', 1)[0].split('/') if p]
req = None
if parts[-2] in ('tags', 'branches', 'tag', 'branch'):
req = parts[-3]
elif parts[-1] == 'trunk':
req = parts[-2]
return req
def _build_editable_options(req):
"""
This method generates a dictionary of the query string
parameters contained in a given editable URL.
"""
regexp = re.compile(r"[\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)")
matched = regexp.findall(req)
if matched:
ret = dict()
for option in matched:
(name, value) = option
if name in ret:
raise Exception("%s option already defined" % name)
ret[name] = value
return ret
return None
def parse_editable(editable_req, default_vcs=None):
"""Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra]
"""
url = editable_req
extras = None
# If a file path is specified with extras, strip off the extras.
m = re.match(r'^(.+)(\[[^\]]+\])$', url)
if m:
url_no_extras = m.group(1)
extras = m.group(2)
else:
url_no_extras = url
if os.path.isdir(url_no_extras):
if not os.path.exists(os.path.join(url_no_extras, 'setup.py')):
raise InstallationError(
"Directory %r is not installable. File 'setup.py' not found." %
url_no_extras
)
# Treating it as code that has already been checked out
url_no_extras = path_to_url(url_no_extras)
if url_no_extras.lower().startswith('file:'):
if extras:
return (
None,
url_no_extras,
pkg_resources.Requirement.parse(
'__placeholder__' + extras
).extras,
{},
)
else:
return None, url_no_extras, None, {}
for version_control in vcs:
if url.lower().startswith('%s:' % version_control):
url = '%s+%s' % (version_control, url)
break
if '+' not in url:
if default_vcs:
url = default_vcs + '+' + url
else:
raise InstallationError(
'%s should either be a path to a local project or a VCS url '
'beginning with svn+, git+, hg+, or bzr+' %
editable_req
)
vc_type = url.split('+', 1)[0].lower()
if not vcs.get_backend(vc_type):
error_message = 'For --editable=%s only ' % editable_req + \
', '.join([backend.name + '+URL' for backend in vcs.backends]) + \
' is currently supported'
raise InstallationError(error_message)
try:
options = _build_editable_options(editable_req)
except Exception as exc:
raise InstallationError(
'--editable=%s error in editable options:%s' % (editable_req, exc)
)
if not options or 'egg' not in options:
req = _build_req_from_url(editable_req)
if not req:
raise InstallationError(
'--editable=%s is not the right format; it must have '
'#egg=Package' % editable_req
)
else:
req = options['egg']
package = _strip_postfix(req)
return package, url, None, options
| mit |
streamlio/heron | heron/common/tests/python/pex_loader/pex_loader_unittest.py | 2 | 2935 | # Copyright 2016 Twitter. All rights reserved.
#
# 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.
'''Unittest for pex_loader'''
import os
import unittest
import re
import sys
import heron.common.src.python.pex_loader as pex_loader
import heron.common.tests.python.pex_loader.constants as constants
# pylint: disable=missing-docstring
class PexLoaderTest(unittest.TestCase):
def test_deps_regex(self):
# Testing egg_regex to find dependencies
pass_test_cases = [".deps/sample_egg.egg/",
".deps/sample_egg_1234.egg/",
".deps/sample_egg.egg.egg/",
".deps/sample_egg.whl/",
".deps/sample.egg.whl/"]
for test in pass_test_cases:
# should match without the trailing slash
self.assertEqual(re.match(pex_loader.egg_regex, test).group(1), test[:-1])
fail_test_cases = [".deps/sample_egg/",
".deps/sample_egg.egg", # no trailing slash
".deps/sample/egg.egg/", # contains slash
".deps/sample_ egg.egg/", # contains space
"deps/sample_egg.egg/", # not starting from .deps
"/.deps/sample_egg.egg/", # starting from slash
".deps/sample_whl/",
".deps/sample.egg.wh/",
".deps/sample.whl.egg"]
for test in fail_test_cases:
self.assertIsNone(re.match(pex_loader.egg_regex, test))
def test_load_pex(self):
# Testing load_pex without including deps (including deps requires an actual zip file)
test_path = ['sample.pex', 'sample_123.pex', '/tmp/path.pex']
for path in test_path:
pex_loader.load_pex(path, include_deps=False)
abs_path = os.path.abspath(path)
self.assertIn(os.path.dirname(abs_path), sys.path)
def test_sample(self):
path = self.get_path_of_sample(constants.SAMPLE_PEX)
print path
pex_loader.load_pex(path)
cls = pex_loader.import_and_get_class(path, constants.SAMPLE_PEX_CLASSPATH)
self.assertIsNotNone(cls)
self.assertEqual(cls.name, "sample class")
self.assertEqual(cls.age, 100)
@staticmethod
def get_path_of_sample(sample):
file_dir = "/".join(os.path.realpath(__file__).split('/')[:-1])
testdata_dir = os.path.join(file_dir, constants.TEST_DATA_PATH)
sample_pex_path = os.path.join(testdata_dir, sample)
return sample_pex_path
| apache-2.0 |
brokenjacobs/ansible | lib/ansible/modules/cloud/openstack/os_nova_flavor.py | 29 | 8474 | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: os_nova_flavor
short_description: Manage OpenStack compute flavors
extends_documentation_fragment: openstack
version_added: "2.0"
author: "David Shrewsbury (@Shrews)"
description:
- Add or remove flavors from OpenStack.
options:
state:
description:
- Indicate desired state of the resource. When I(state) is 'present',
then I(ram), I(vcpus), and I(disk) are all required. There are no
default values for those parameters.
choices: ['present', 'absent']
required: false
default: present
name:
description:
- Flavor name.
required: true
ram:
description:
- Amount of memory, in MB.
required: false
default: null
vcpus:
description:
- Number of virtual CPUs.
required: false
default: null
disk:
description:
- Size of local disk, in GB.
required: false
default: null
ephemeral:
description:
- Ephemeral space size, in GB.
required: false
default: 0
swap:
description:
- Swap space size, in MB.
required: false
default: 0
rxtx_factor:
description:
- RX/TX factor.
required: false
default: 1.0
is_public:
description:
- Make flavor accessible to the public.
required: false
default: true
flavorid:
description:
- ID for the flavor. This is optional as a unique UUID will be
assigned if a value is not specified.
required: false
default: "auto"
availability_zone:
description:
- Ignored. Present for backwards compatibility
required: false
extra_specs:
description:
- Metadata dictionary
required: false
default: None
version_added: "2.3"
requirements: ["shade"]
'''
EXAMPLES = '''
- name: "Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of local disk, and 10GB of ephemeral."
os_nova_flavor:
cloud: mycloud
state: present
name: tiny
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
- name: "Delete 'tiny' flavor"
os_nova_flavor:
cloud: mycloud
state: absent
name: tiny
- name: Create flavor with metadata
os_nova_flavor:
cloud: mycloud
state: present
name: tiny
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"quota:disk_read_iops_sec": 5000
"aggregate_instance_extra_specs:pinned": false
'''
RETURN = '''
flavor:
description: Dictionary describing the flavor.
returned: On success when I(state) is 'present'
type: complex
contains:
id:
description: Flavor ID.
returned: success
type: string
sample: "515256b8-7027-4d73-aa54-4e30a4a4a339"
name:
description: Flavor name.
returned: success
type: string
sample: "tiny"
disk:
description: Size of local disk, in GB.
returned: success
type: int
sample: 10
ephemeral:
description: Ephemeral space size, in GB.
returned: success
type: int
sample: 10
ram:
description: Amount of memory, in MB.
returned: success
type: int
sample: 1024
swap:
description: Swap space size, in MB.
returned: success
type: int
sample: 100
vcpus:
description: Number of virtual CPUs.
returned: success
type: int
sample: 2
is_public:
description: Make flavor accessible to the public.
returned: success
type: bool
sample: true
extra_specs:
description: Flavor metadata
returned: success
type: dict
sample:
"quota:disk_read_iops_sec": 5000
"aggregate_instance_extra_specs:pinned": false
'''
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
def _system_state_change(module, flavor):
state = module.params['state']
if state == 'present' and not flavor:
return True
if state == 'absent' and flavor:
return True
return False
def main():
argument_spec = openstack_full_argument_spec(
state = dict(required=False, default='present',
choices=['absent', 'present']),
name = dict(required=False),
# required when state is 'present'
ram = dict(required=False, type='int'),
vcpus = dict(required=False, type='int'),
disk = dict(required=False, type='int'),
ephemeral = dict(required=False, default=0, type='int'),
swap = dict(required=False, default=0, type='int'),
rxtx_factor = dict(required=False, default=1.0, type='float'),
is_public = dict(required=False, default=True, type='bool'),
flavorid = dict(required=False, default="auto"),
extra_specs = dict(required=False, default=None, type='dict'),
)
module_kwargs = openstack_module_kwargs()
module = AnsibleModule(
argument_spec,
supports_check_mode=True,
required_if=[
('state', 'present', ['ram', 'vcpus', 'disk'])
],
**module_kwargs)
if not HAS_SHADE:
module.fail_json(msg='shade is required for this module')
state = module.params['state']
name = module.params['name']
extra_specs = module.params['extra_specs'] or {}
try:
cloud = shade.operator_cloud(**module.params)
flavor = cloud.get_flavor(name)
if module.check_mode:
module.exit_json(changed=_system_state_change(module, flavor))
if state == 'present':
if not flavor:
flavor = cloud.create_flavor(
name=name,
ram=module.params['ram'],
vcpus=module.params['vcpus'],
disk=module.params['disk'],
flavorid=module.params['flavorid'],
ephemeral=module.params['ephemeral'],
swap=module.params['swap'],
rxtx_factor=module.params['rxtx_factor'],
is_public=module.params['is_public']
)
changed=True
else:
changed=False
old_extra_specs = flavor['extra_specs']
new_extra_specs = dict([(k, str(v)) for k, v in extra_specs.items()])
unset_keys = set(flavor['extra_specs'].keys()) - set(extra_specs.keys())
if unset_keys:
cloud.unset_flavor_specs(flavor['id'], unset_keys)
if old_extra_specs != new_extra_specs:
cloud.set_flavor_specs(flavor['id'], extra_specs)
changed = (changed or old_extra_specs != new_extra_specs)
module.exit_json(changed=changed,
flavor=flavor,
id=flavor['id'])
elif state == 'absent':
if flavor:
cloud.delete_flavor(name)
module.exit_json(changed=True)
module.exit_json(changed=False)
except shade.OpenStackCloudException as e:
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
if __name__ == '__main__':
main()
| gpl-3.0 |
aosen/macvim | vim/pydiction.py | 3 | 9986 | #!/usr/bin/env python
"""
pydiction.py 1.2.3 by Ryan Kulla (rkulla AT gmail DOT com).
License: BSD.
Description: Creates a Vim dictionary of Python module attributes for Vim's
completion feature. The created dictionary file is used by
the Vim ftplugin "python_pydiction.vim".
Usage: pydiction.py <module> [<module> ...] [-v]
Example: The following will append all the "time" and "math" modules'
attributes to a file, in the current directory, called "pydiction",
with and without the "time." and "math." prefix:
$ python pydiction.py time math
To output only to stdout and not append to file, use -v:
$ python pydiction.py -v time math
"""
__author__ = "Ryan Kulla (rkulla AT gmail DOT com)"
__version__ = "1.2.3"
__copyright__ = "Copyright (c) 2003-2014 Ryan Kulla"
import os
import sys
import types
import shutil
# Path/filename of the vim dictionary file to write to:
PYDICTION_DICT = r'complete-dict'
# Path/filename of the vim dictionary backup file:
PYDICTION_DICT_BACKUP = r'complete-dict.last'
# Sentintal to test if we should only output to stdout:
STDOUT_ONLY = False
def get_submodules(module_name, submodules):
"""Build a list of all the submodules of modules."""
# Try to import a given module, so we can dir() it:
try:
imported_module = my_import(module_name)
except ImportError:
return submodules
mod_attrs = dir(imported_module)
for mod_attr in mod_attrs:
try:
if isinstance(getattr(imported_module, mod_attr), types.ModuleType):
submodules.append(module_name + '.' + mod_attr)
except AttributeError as e:
print(e)
return submodules
def get_format(imported_module, mod_attr, use_prefix):
format = ''
if use_prefix:
format_noncallable = '%s.%s'
format_callable = '%s.%s('
else:
format_noncallable = '%s'
format_callable = '%s('
try:
if callable(getattr(imported_module, mod_attr)):
# If an attribute is callable, show an opening parentheses:
format = format_callable
else:
format = format_noncallable
except AttributeError as e:
print(e)
return format
def write_dictionary(module_name, module_list):
"""Write to module attributes to the vim dictionary file."""
python_version = '%s.%s.%s' % get_python_version()
try:
imported_module = my_import(module_name)
except ImportError:
return
mod_attrs = dir(imported_module)
# If a module was passed on the command-line we'll call it a root module
if module_name in module_list:
try:
module_version = '%s/' % imported_module.__version__
except AttributeError:
module_version = ''
module_info = '(%spy%s/%s/root module) ' % (
module_version, python_version, sys.platform)
else:
module_info = ''
write_to.write('--- import %s %s---\n' % (module_name, module_info))
for mod_attr in mod_attrs:
format = get_format(imported_module, mod_attr, True)
if format != '':
write_to.write(format % (module_name, mod_attr) + '\n')
# Generate submodule names by themselves, for when someone does
# "from foo import bar" and wants to complete bar.baz.
# This works the same no matter how many .'s are in the module.
if module_name.count('.'):
# Get the "from" part of the module. E.g., 'xml.parsers'
# if the module name was 'xml.parsers.expat':
first_part = module_name[:module_name.rfind('.')]
# Get the "import" part of the module. E.g., 'expat'
# if the module name was 'xml.parsers.expat'
second_part = module_name[module_name.rfind('.') + 1:]
write_to.write('--- from %s import %s ---\n' %
(first_part, second_part))
for mod_attr in mod_attrs:
format = get_format(imported_module, mod_attr, True)
if format != '':
write_to.write(format % (second_part, mod_attr) + '\n')
# Generate non-fully-qualified module names:
write_to.write('--- from %s import * ---\n' % module_name)
for mod_attr in mod_attrs:
format = get_format(imported_module, mod_attr, False)
if format != '':
write_to.write(format % mod_attr + '\n')
def my_import(name):
"""Make __import__ import "package.module" formatted names."""
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def remove_duplicates(seq, keep=()):
"""
Remove duplicates from a sequence while perserving order.
The optional tuple argument "keep" can be given to specificy
each string you don't want to be removed as a duplicate.
"""
seq2 = []
seen = set()
for i in seq:
if i in (keep):
seq2.append(i)
continue
elif i not in seen:
seq2.append(i)
seen.add(i)
return seq2
def get_yesno(msg="[Y/n]?"):
"""
Returns True if user inputs 'n', 'Y', "yes", "Yes"...
Returns False if user inputs 'n', 'N', "no", "No"...
If they enter an invalid option it tells them so and asks again.
Hitting Enter is equivalent to answering Yes.
Takes an optional message to display, defaults to "[Y/n]?".
"""
while True:
answer = raw_input(msg)
if answer == '':
return True
elif len(answer):
answer = answer.lower()[0]
if answer == 'y':
return True
break
elif answer == 'n':
return False
break
else:
print("Invalid option. Please try again.")
continue
def main(write_to, module_list):
"""Generate a dictionary for Vim of python module attributes."""
submodules = []
for module_name in module_list:
try:
my_import(module_name)
except ImportError as err:
print("Couldn't import: %s. %s" % (module_name, err))
module_list.remove(module_name)
# Step through each command line argument:
for module_name in module_list:
print("Trying module: %s" % module_name)
submodules = get_submodules(module_name, submodules)
# Step through the current module's submodules:
for submodule_name in submodules:
submodules = get_submodules(submodule_name, submodules)
# Add the top-level modules to the list too:
for module_name in module_list:
submodules.append(module_name)
submodules = remove_duplicates(submodules)
submodules.sort()
# Step through all of the modules and submodules to create the dict file:
for submodule_name in submodules:
write_dictionary(submodule_name, module_list)
if STDOUT_ONLY:
return
# Close and Reopen the file for reading and remove all duplicate lines:
write_to.close()
print("Removing duplicates...")
f = open(PYDICTION_DICT, 'r')
file_lines = f.readlines()
file_lines = remove_duplicates(file_lines)
f.close()
# Delete the original file:
os.unlink(PYDICTION_DICT)
# Recreate the file, this time it won't have any duplicates lines:
f = open(PYDICTION_DICT, 'w')
for attr in file_lines:
f.write(attr)
f.close()
print("Done.")
def get_python_version():
"""Returns the major, minor, micro python version as a tuple"""
return sys.version_info[0:3]
def remove_existing_modules(module_list):
"""Removes any existing modules from module list to try"""
f = open(PYDICTION_DICT, 'r')
file_lines = f.readlines()
for module_name in module_list:
for line in file_lines:
if line.find('--- import %s ' % module_name) != -1:
print('"%s" already exists in %s. Skipping...' % \
(module_name, PYDICTION_DICT))
module_list.remove(module_name)
break
f.close()
return module_list
if __name__ == '__main__':
"""Process the command line."""
if get_python_version() < (2, 3):
sys.exit("You need at least Python 2.3")
if len(sys.argv) <= 1:
sys.exit("%s requires at least one argument. None given." %
sys.argv[0])
module_list = sys.argv[1:]
if '-v' in sys.argv:
write_to = sys.stdout
module_list.remove('-v')
STDOUT_ONLY = True
elif os.path.exists(PYDICTION_DICT):
module_list = remove_existing_modules(sys.argv[1:])
if len(module_list) < 1:
# Check if there's still enough command-line arguments:
sys.exit("Nothing new to do. Aborting.")
if os.path.exists(PYDICTION_DICT_BACKUP):
answer = get_yesno('Overwrite existing backup "%s" [Y/n]? ' %
PYDICTION_DICT_BACKUP)
if (answer):
print("Backing up old dictionary to: %s" % \
PYDICTION_DICT_BACKUP)
try:
shutil.copyfile(PYDICTION_DICT, PYDICTION_DICT_BACKUP)
except IOError as err:
print("Couldn't back up %s. %s" % (PYDICTION_DICT, err))
else:
print("Skipping backup...")
print('Appending to: "%s"' % PYDICTION_DICT)
else:
print("Backing up current %s to %s" % \
(PYDICTION_DICT, PYDICTION_DICT_BACKUP))
try:
shutil.copyfile(PYDICTION_DICT, PYDICTION_DICT_BACKUP)
except IOError as err:
print("Couldn't back up %s. %s" % (PYDICTION_DICT, err))
else:
print('Creating file: "%s"' % PYDICTION_DICT)
if not STDOUT_ONLY:
write_to = open(PYDICTION_DICT, 'a')
main(write_to, module_list)
| gpl-2.0 |
jusdng/odoo | addons/purchase_requisition/wizard/__init__.py | 376 | 1112 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import purchase_requisition_partner
import bid_line_qty
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| agpl-3.0 |
synconics/odoo | addons/account_analytic_default/__init__.py | 445 | 1087 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_analytic_default
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| agpl-3.0 |
ClusterHQ/libcloud | libcloud/storage/drivers/ninefold.py | 69 | 1075 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
from libcloud.storage.providers import Provider
from libcloud.storage.drivers.atmos import AtmosDriver
class NinefoldStorageDriver(AtmosDriver):
host = 'api.ninefold.com'
path = '/storage/v1.0'
type = Provider.NINEFOLD
name = 'Ninefold'
website = 'http://ninefold.com/'
| apache-2.0 |
goddino/libjingle | trunk/tools/gyp/test/mac/gyptest-strip.py | 21 | 1538 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that stripping works.
"""
import TestGyp
import re
import subprocess
import sys
import time
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
test.run_gyp('test.gyp', chdir='strip')
test.build('test.gyp', test.ALL, chdir='strip')
# Lightweight check if stripping was done.
def OutPath(s):
return test.built_file_path(s, type=test.SHARED_LIB, chdir='strip')
def CheckNsyms(p, n_expected):
r = re.compile(r'nsyms\s+(\d+)')
proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE)
o = proc.communicate()[0]
assert not proc.returncode
m = r.search(o)
n = int(m.group(1))
if n != n_expected:
print 'Stripping: Expected %d symbols, got %d' % (n_expected, n)
test.fail_test()
# The actual numbers here are not interesting, they just need to be the same
# in both the xcode and the make build.
CheckNsyms(OutPath('no_postprocess'), 10)
CheckNsyms(OutPath('no_strip'), 10)
CheckNsyms(OutPath('strip_all'), 0)
CheckNsyms(OutPath('strip_nonglobal'), 2)
CheckNsyms(OutPath('strip_debugging'), 2)
CheckNsyms(OutPath('strip_all_custom_flags'), 0)
CheckNsyms(test.built_file_path(
'strip_all_bundle.framework/Versions/A/strip_all_bundle', chdir='strip'),
0)
CheckNsyms(OutPath('strip_save'), 2)
test.pass_test()
| bsd-3-clause |
marcuskelly/recover | Lib/site-packages/sqlalchemy/engine/default.py | 9 | 39630 | # engine/default.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Default implementations of per-dialect sqlalchemy.engine classes.
These are semi-private implementation classes which are only of importance
to database dialect authors; dialects will usually use the classes here
as the base class for their own corresponding classes.
"""
import re
import random
from . import reflection, interfaces, result
from ..sql import compiler, expression, schema
from .. import types as sqltypes
from .. import exc, util, pool, processors
import codecs
import weakref
from .. import event
AUTOCOMMIT_REGEXP = re.compile(
r'\s*(?:UPDATE|INSERT|CREATE|DELETE|DROP|ALTER)',
re.I | re.UNICODE)
# When we're handed literal SQL, ensure it's a SELECT query
SERVER_SIDE_CURSOR_RE = re.compile(
r'\s*SELECT',
re.I | re.UNICODE)
class DefaultDialect(interfaces.Dialect):
"""Default implementation of Dialect"""
statement_compiler = compiler.SQLCompiler
ddl_compiler = compiler.DDLCompiler
type_compiler = compiler.GenericTypeCompiler
preparer = compiler.IdentifierPreparer
supports_alter = True
# the first value we'd get for an autoincrement
# column.
default_sequence_base = 1
# most DBAPIs happy with this for execute().
# not cx_oracle.
execute_sequence_format = tuple
supports_views = True
supports_sequences = False
sequences_optional = False
preexecute_autoincrement_sequences = False
postfetch_lastrowid = True
implicit_returning = False
supports_right_nested_joins = True
supports_native_enum = False
supports_native_boolean = False
supports_simple_order_by_label = True
engine_config_types = util.immutabledict([
('convert_unicode', util.bool_or_str('force')),
('pool_timeout', util.asint),
('echo', util.bool_or_str('debug')),
('echo_pool', util.bool_or_str('debug')),
('pool_recycle', util.asint),
('pool_size', util.asint),
('max_overflow', util.asint),
('pool_threadlocal', util.asbool),
])
# if the NUMERIC type
# returns decimal.Decimal.
# *not* the FLOAT type however.
supports_native_decimal = False
if util.py3k:
supports_unicode_statements = True
supports_unicode_binds = True
returns_unicode_strings = True
description_encoding = None
else:
supports_unicode_statements = False
supports_unicode_binds = False
returns_unicode_strings = False
description_encoding = 'use_encoding'
name = 'default'
# length at which to truncate
# any identifier.
max_identifier_length = 9999
# length at which to truncate
# the name of an index.
# Usually None to indicate
# 'use max_identifier_length'.
# thanks to MySQL, sigh
max_index_name_length = None
supports_sane_rowcount = True
supports_sane_multi_rowcount = True
dbapi_type_map = {}
colspecs = {}
default_paramstyle = 'named'
supports_default_values = False
supports_empty_insert = True
supports_multivalues_insert = False
supports_server_side_cursors = False
server_version_info = None
construct_arguments = None
"""Optional set of argument specifiers for various SQLAlchemy
constructs, typically schema items.
To implement, establish as a series of tuples, as in::
construct_arguments = [
(schema.Index, {
"using": False,
"where": None,
"ops": None
})
]
If the above construct is established on the PostgreSQL dialect,
the :class:`.Index` construct will now accept the keyword arguments
``postgresql_using``, ``postgresql_where``, nad ``postgresql_ops``.
Any other argument specified to the constructor of :class:`.Index`
which is prefixed with ``postgresql_`` will raise :class:`.ArgumentError`.
A dialect which does not include a ``construct_arguments`` member will
not participate in the argument validation system. For such a dialect,
any argument name is accepted by all participating constructs, within
the namespace of arguments prefixed with that dialect name. The rationale
here is so that third-party dialects that haven't yet implemented this
feature continue to function in the old way.
.. versionadded:: 0.9.2
.. seealso::
:class:`.DialectKWArgs` - implementing base class which consumes
:attr:`.DefaultDialect.construct_arguments`
"""
# indicates symbol names are
# UPPERCASEd if they are case insensitive
# within the database.
# if this is True, the methods normalize_name()
# and denormalize_name() must be provided.
requires_name_normalize = False
reflection_options = ()
dbapi_exception_translation_map = util.immutabledict()
"""mapping used in the extremely unusual case that a DBAPI's
published exceptions don't actually have the __name__ that they
are linked towards.
.. versionadded:: 1.0.5
"""
def __init__(self, convert_unicode=False,
encoding='utf-8', paramstyle=None, dbapi=None,
implicit_returning=None,
supports_right_nested_joins=None,
case_sensitive=True,
supports_native_boolean=None,
label_length=None, **kwargs):
if not getattr(self, 'ported_sqla_06', True):
util.warn(
"The %s dialect is not yet ported to the 0.6 format" %
self.name)
self.convert_unicode = convert_unicode
self.encoding = encoding
self.positional = False
self._ischema = None
self.dbapi = dbapi
if paramstyle is not None:
self.paramstyle = paramstyle
elif self.dbapi is not None:
self.paramstyle = self.dbapi.paramstyle
else:
self.paramstyle = self.default_paramstyle
if implicit_returning is not None:
self.implicit_returning = implicit_returning
self.positional = self.paramstyle in ('qmark', 'format', 'numeric')
self.identifier_preparer = self.preparer(self)
self.type_compiler = self.type_compiler(self)
if supports_right_nested_joins is not None:
self.supports_right_nested_joins = supports_right_nested_joins
if supports_native_boolean is not None:
self.supports_native_boolean = supports_native_boolean
self.case_sensitive = case_sensitive
if label_length and label_length > self.max_identifier_length:
raise exc.ArgumentError(
"Label length of %d is greater than this dialect's"
" maximum identifier length of %d" %
(label_length, self.max_identifier_length))
self.label_length = label_length
if self.description_encoding == 'use_encoding':
self._description_decoder = \
processors.to_unicode_processor_factory(
encoding
)
elif self.description_encoding is not None:
self._description_decoder = \
processors.to_unicode_processor_factory(
self.description_encoding
)
self._encoder = codecs.getencoder(self.encoding)
self._decoder = processors.to_unicode_processor_factory(self.encoding)
@util.memoized_property
def _type_memos(self):
return weakref.WeakKeyDictionary()
@property
def dialect_description(self):
return self.name + "+" + self.driver
@classmethod
def get_pool_class(cls, url):
return getattr(cls, 'poolclass', pool.QueuePool)
def initialize(self, connection):
try:
self.server_version_info = \
self._get_server_version_info(connection)
except NotImplementedError:
self.server_version_info = None
try:
self.default_schema_name = \
self._get_default_schema_name(connection)
except NotImplementedError:
self.default_schema_name = None
try:
self.default_isolation_level = \
self.get_isolation_level(connection.connection)
except NotImplementedError:
self.default_isolation_level = None
self.returns_unicode_strings = self._check_unicode_returns(connection)
if self.description_encoding is not None and \
self._check_unicode_description(connection):
self._description_decoder = self.description_encoding = None
self.do_rollback(connection.connection)
def on_connect(self):
"""return a callable which sets up a newly created DBAPI connection.
This is used to set dialect-wide per-connection options such as
isolation modes, unicode modes, etc.
If a callable is returned, it will be assembled into a pool listener
that receives the direct DBAPI connection, with all wrappers removed.
If None is returned, no listener will be generated.
"""
return None
def _check_unicode_returns(self, connection, additional_tests=None):
if util.py2k and not self.supports_unicode_statements:
cast_to = util.binary_type
else:
cast_to = util.text_type
if self.positional:
parameters = self.execute_sequence_format()
else:
parameters = {}
def check_unicode(test):
statement = cast_to(
expression.select([test]).compile(dialect=self))
try:
cursor = connection.connection.cursor()
connection._cursor_execute(cursor, statement, parameters)
row = cursor.fetchone()
cursor.close()
except exc.DBAPIError as de:
# note that _cursor_execute() will have closed the cursor
# if an exception is thrown.
util.warn("Exception attempting to "
"detect unicode returns: %r" % de)
return False
else:
return isinstance(row[0], util.text_type)
tests = [
# detect plain VARCHAR
expression.cast(
expression.literal_column("'test plain returns'"),
sqltypes.VARCHAR(60)
),
# detect if there's an NVARCHAR type with different behavior
# available
expression.cast(
expression.literal_column("'test unicode returns'"),
sqltypes.Unicode(60)
),
]
if additional_tests:
tests += additional_tests
results = set([check_unicode(test) for test in tests])
if results.issuperset([True, False]):
return "conditional"
else:
return results == set([True])
def _check_unicode_description(self, connection):
# all DBAPIs on Py2K return cursor.description as encoded,
# until pypy2.1beta2 with sqlite, so let's just check it -
# it's likely others will start doing this too in Py2k.
if util.py2k and not self.supports_unicode_statements:
cast_to = util.binary_type
else:
cast_to = util.text_type
cursor = connection.connection.cursor()
try:
cursor.execute(
cast_to(
expression.select([
expression.literal_column("'x'").label("some_label")
]).compile(dialect=self)
)
)
return isinstance(cursor.description[0][0], util.text_type)
finally:
cursor.close()
def type_descriptor(self, typeobj):
"""Provide a database-specific :class:`.TypeEngine` object, given
the generic object which comes from the types module.
This method looks for a dictionary called
``colspecs`` as a class or instance-level variable,
and passes on to :func:`.types.adapt_type`.
"""
return sqltypes.adapt_type(typeobj, self.colspecs)
def reflecttable(
self, connection, table, include_columns, exclude_columns, **opts):
insp = reflection.Inspector.from_engine(connection)
return insp.reflecttable(
table, include_columns, exclude_columns, **opts)
def get_pk_constraint(self, conn, table_name, schema=None, **kw):
"""Compatibility method, adapts the result of get_primary_keys()
for those dialects which don't implement get_pk_constraint().
"""
return {
'constrained_columns':
self.get_primary_keys(conn, table_name,
schema=schema, **kw)
}
def validate_identifier(self, ident):
if len(ident) > self.max_identifier_length:
raise exc.IdentifierError(
"Identifier '%s' exceeds maximum length of %d characters" %
(ident, self.max_identifier_length)
)
def connect(self, *cargs, **cparams):
return self.dbapi.connect(*cargs, **cparams)
def create_connect_args(self, url):
opts = url.translate_connect_args()
opts.update(url.query)
return [[], opts]
def set_engine_execution_options(self, engine, opts):
if 'isolation_level' in opts:
isolation_level = opts['isolation_level']
@event.listens_for(engine, "engine_connect")
def set_isolation(connection, branch):
if not branch:
self._set_connection_isolation(connection, isolation_level)
if 'schema_translate_map' in opts:
getter = schema._schema_getter(opts['schema_translate_map'])
engine.schema_for_object = getter
@event.listens_for(engine, "engine_connect")
def set_schema_translate_map(connection, branch):
connection.schema_for_object = getter
def set_connection_execution_options(self, connection, opts):
if 'isolation_level' in opts:
self._set_connection_isolation(connection, opts['isolation_level'])
if 'schema_translate_map' in opts:
getter = schema._schema_getter(opts['schema_translate_map'])
connection.schema_for_object = getter
def _set_connection_isolation(self, connection, level):
if connection.in_transaction():
util.warn(
"Connection is already established with a Transaction; "
"setting isolation_level may implicitly rollback or commit "
"the existing transaction, or have no effect until "
"next transaction")
self.set_isolation_level(connection.connection, level)
connection.connection._connection_record.\
finalize_callback.append(self.reset_isolation_level)
def do_begin(self, dbapi_connection):
pass
def do_rollback(self, dbapi_connection):
dbapi_connection.rollback()
def do_commit(self, dbapi_connection):
dbapi_connection.commit()
def do_close(self, dbapi_connection):
dbapi_connection.close()
def create_xid(self):
"""Create a random two-phase transaction ID.
This id will be passed to do_begin_twophase(), do_rollback_twophase(),
do_commit_twophase(). Its format is unspecified.
"""
return "_sa_%032x" % random.randint(0, 2 ** 128)
def do_savepoint(self, connection, name):
connection.execute(expression.SavepointClause(name))
def do_rollback_to_savepoint(self, connection, name):
connection.execute(expression.RollbackToSavepointClause(name))
def do_release_savepoint(self, connection, name):
connection.execute(expression.ReleaseSavepointClause(name))
def do_executemany(self, cursor, statement, parameters, context=None):
cursor.executemany(statement, parameters)
def do_execute(self, cursor, statement, parameters, context=None):
cursor.execute(statement, parameters)
def do_execute_no_params(self, cursor, statement, context=None):
cursor.execute(statement)
def is_disconnect(self, e, connection, cursor):
return False
def reset_isolation_level(self, dbapi_conn):
# default_isolation_level is read from the first connection
# after the initial set of 'isolation_level', if any, so is
# the configured default of this dialect.
self.set_isolation_level(dbapi_conn, self.default_isolation_level)
class StrCompileDialect(DefaultDialect):
statement_compiler = compiler.StrSQLCompiler
ddl_compiler = compiler.DDLCompiler
type_compiler = compiler.StrSQLTypeCompiler
preparer = compiler.IdentifierPreparer
supports_sequences = True
sequences_optional = True
preexecute_autoincrement_sequences = False
implicit_returning = False
supports_native_boolean = True
supports_simple_order_by_label = True
class DefaultExecutionContext(interfaces.ExecutionContext):
isinsert = False
isupdate = False
isdelete = False
is_crud = False
is_text = False
isddl = False
executemany = False
compiled = None
statement = None
result_column_struct = None
returned_defaults = None
_is_implicit_returning = False
_is_explicit_returning = False
# a hook for SQLite's translation of
# result column names
_translate_colname = None
@classmethod
def _init_ddl(cls, dialect, connection, dbapi_connection, compiled_ddl):
"""Initialize execution context for a DDLElement construct."""
self = cls.__new__(cls)
self.root_connection = connection
self._dbapi_connection = dbapi_connection
self.dialect = connection.dialect
self.compiled = compiled = compiled_ddl
self.isddl = True
self.execution_options = compiled.execution_options
if connection._execution_options:
self.execution_options = dict(self.execution_options)
self.execution_options.update(connection._execution_options)
if not dialect.supports_unicode_statements:
self.unicode_statement = util.text_type(compiled)
self.statement = dialect._encoder(self.unicode_statement)[0]
else:
self.statement = self.unicode_statement = util.text_type(compiled)
self.cursor = self.create_cursor()
self.compiled_parameters = []
if dialect.positional:
self.parameters = [dialect.execute_sequence_format()]
else:
self.parameters = [{}]
return self
@classmethod
def _init_compiled(cls, dialect, connection, dbapi_connection,
compiled, parameters):
"""Initialize execution context for a Compiled construct."""
self = cls.__new__(cls)
self.root_connection = connection
self._dbapi_connection = dbapi_connection
self.dialect = connection.dialect
self.compiled = compiled
# this should be caught in the engine before
# we get here
assert compiled.can_execute
self.execution_options = compiled.execution_options.union(
connection._execution_options)
self.result_column_struct = (
compiled._result_columns, compiled._ordered_columns,
compiled._textual_ordered_columns)
self.unicode_statement = util.text_type(compiled)
if not dialect.supports_unicode_statements:
self.statement = self.unicode_statement.encode(
self.dialect.encoding)
else:
self.statement = self.unicode_statement
self.isinsert = compiled.isinsert
self.isupdate = compiled.isupdate
self.isdelete = compiled.isdelete
self.is_text = compiled.isplaintext
if not parameters:
self.compiled_parameters = [compiled.construct_params()]
else:
self.compiled_parameters = \
[compiled.construct_params(m, _group_number=grp) for
grp, m in enumerate(parameters)]
self.executemany = len(parameters) > 1
self.cursor = self.create_cursor()
if self.isinsert or self.isupdate or self.isdelete:
self.is_crud = True
self._is_explicit_returning = bool(compiled.statement._returning)
self._is_implicit_returning = bool(
compiled.returning and not compiled.statement._returning)
if self.compiled.insert_prefetch or self.compiled.update_prefetch:
if self.executemany:
self._process_executemany_defaults()
else:
self._process_executesingle_defaults()
processors = compiled._bind_processors
# Convert the dictionary of bind parameter values
# into a dict or list to be sent to the DBAPI's
# execute() or executemany() method.
parameters = []
if dialect.positional:
for compiled_params in self.compiled_parameters:
param = []
for key in self.compiled.positiontup:
if key in processors:
param.append(processors[key](compiled_params[key]))
else:
param.append(compiled_params[key])
parameters.append(dialect.execute_sequence_format(param))
else:
encode = not dialect.supports_unicode_statements
for compiled_params in self.compiled_parameters:
if encode:
param = dict(
(
dialect._encoder(key)[0],
processors[key](compiled_params[key])
if key in processors
else compiled_params[key]
)
for key in compiled_params
)
else:
param = dict(
(
key,
processors[key](compiled_params[key])
if key in processors
else compiled_params[key]
)
for key in compiled_params
)
parameters.append(param)
self.parameters = dialect.execute_sequence_format(parameters)
return self
@classmethod
def _init_statement(cls, dialect, connection, dbapi_connection,
statement, parameters):
"""Initialize execution context for a string SQL statement."""
self = cls.__new__(cls)
self.root_connection = connection
self._dbapi_connection = dbapi_connection
self.dialect = connection.dialect
self.is_text = True
# plain text statement
self.execution_options = connection._execution_options
if not parameters:
if self.dialect.positional:
self.parameters = [dialect.execute_sequence_format()]
else:
self.parameters = [{}]
elif isinstance(parameters[0], dialect.execute_sequence_format):
self.parameters = parameters
elif isinstance(parameters[0], dict):
if dialect.supports_unicode_statements:
self.parameters = parameters
else:
self.parameters = [
dict((dialect._encoder(k)[0], d[k]) for k in d)
for d in parameters
] or [{}]
else:
self.parameters = [dialect.execute_sequence_format(p)
for p in parameters]
self.executemany = len(parameters) > 1
if not dialect.supports_unicode_statements and \
isinstance(statement, util.text_type):
self.unicode_statement = statement
self.statement = dialect._encoder(statement)[0]
else:
self.statement = self.unicode_statement = statement
self.cursor = self.create_cursor()
return self
@classmethod
def _init_default(cls, dialect, connection, dbapi_connection):
"""Initialize execution context for a ColumnDefault construct."""
self = cls.__new__(cls)
self.root_connection = connection
self._dbapi_connection = dbapi_connection
self.dialect = connection.dialect
self.execution_options = connection._execution_options
self.cursor = self.create_cursor()
return self
@util.memoized_property
def engine(self):
return self.root_connection.engine
@util.memoized_property
def postfetch_cols(self):
return self.compiled.postfetch
@util.memoized_property
def prefetch_cols(self):
if self.isinsert:
return self.compiled.insert_prefetch
elif self.isupdate:
return self.compiled.update_prefetch
else:
return ()
@util.memoized_property
def returning_cols(self):
self.compiled.returning
@util.memoized_property
def no_parameters(self):
return self.execution_options.get("no_parameters", False)
@util.memoized_property
def should_autocommit(self):
autocommit = self.execution_options.get('autocommit',
not self.compiled and
self.statement and
expression.PARSE_AUTOCOMMIT
or False)
if autocommit is expression.PARSE_AUTOCOMMIT:
return self.should_autocommit_text(self.unicode_statement)
else:
return autocommit
def _execute_scalar(self, stmt, type_):
"""Execute a string statement on the current cursor, returning a
scalar result.
Used to fire off sequences, default phrases, and "select lastrowid"
types of statements individually or in the context of a parent INSERT
or UPDATE statement.
"""
conn = self.root_connection
if isinstance(stmt, util.text_type) and \
not self.dialect.supports_unicode_statements:
stmt = self.dialect._encoder(stmt)[0]
if self.dialect.positional:
default_params = self.dialect.execute_sequence_format()
else:
default_params = {}
conn._cursor_execute(self.cursor, stmt, default_params, context=self)
r = self.cursor.fetchone()[0]
if type_ is not None:
# apply type post processors to the result
proc = type_._cached_result_processor(
self.dialect,
self.cursor.description[0][1]
)
if proc:
return proc(r)
return r
@property
def connection(self):
return self.root_connection._branch()
def should_autocommit_text(self, statement):
return AUTOCOMMIT_REGEXP.match(statement)
def _use_server_side_cursor(self):
if not self.dialect.supports_server_side_cursors:
return False
if self.dialect.server_side_cursors:
use_server_side = \
self.execution_options.get('stream_results', True) and (
(self.compiled and isinstance(self.compiled.statement,
expression.Selectable)
or
(
(not self.compiled or
isinstance(self.compiled.statement,
expression.TextClause))
and self.statement and SERVER_SIDE_CURSOR_RE.match(
self.statement))
)
)
else:
use_server_side = \
self.execution_options.get('stream_results', False)
return use_server_side
def create_cursor(self):
if self._use_server_side_cursor():
self._is_server_side = True
return self.create_server_side_cursor()
else:
self._is_server_side = False
return self._dbapi_connection.cursor()
def create_server_side_cursor(self):
raise NotImplementedError()
def pre_exec(self):
pass
def post_exec(self):
pass
def get_result_processor(self, type_, colname, coltype):
"""Return a 'result processor' for a given type as present in
cursor.description.
This has a default implementation that dialects can override
for context-sensitive result type handling.
"""
return type_._cached_result_processor(self.dialect, coltype)
def get_lastrowid(self):
"""return self.cursor.lastrowid, or equivalent, after an INSERT.
This may involve calling special cursor functions,
issuing a new SELECT on the cursor (or a new one),
or returning a stored value that was
calculated within post_exec().
This function will only be called for dialects
which support "implicit" primary key generation,
keep preexecute_autoincrement_sequences set to False,
and when no explicit id value was bound to the
statement.
The function is called once, directly after
post_exec() and before the transaction is committed
or ResultProxy is generated. If the post_exec()
method assigns a value to `self._lastrowid`, the
value is used in place of calling get_lastrowid().
Note that this method is *not* equivalent to the
``lastrowid`` method on ``ResultProxy``, which is a
direct proxy to the DBAPI ``lastrowid`` accessor
in all cases.
"""
return self.cursor.lastrowid
def handle_dbapi_exception(self, e):
pass
def get_result_proxy(self):
if self._is_server_side:
return result.BufferedRowResultProxy(self)
else:
return result.ResultProxy(self)
@property
def rowcount(self):
return self.cursor.rowcount
def supports_sane_rowcount(self):
return self.dialect.supports_sane_rowcount
def supports_sane_multi_rowcount(self):
return self.dialect.supports_sane_multi_rowcount
def _setup_crud_result_proxy(self):
if self.isinsert and \
not self.executemany:
if not self._is_implicit_returning and \
not self.compiled.inline and \
self.dialect.postfetch_lastrowid:
self._setup_ins_pk_from_lastrowid()
elif not self._is_implicit_returning:
self._setup_ins_pk_from_empty()
result = self.get_result_proxy()
if self.isinsert:
if self._is_implicit_returning:
row = result.fetchone()
self.returned_defaults = row
self._setup_ins_pk_from_implicit_returning(row)
result._soft_close(_autoclose_connection=False)
result._metadata = None
elif not self._is_explicit_returning:
result._soft_close(_autoclose_connection=False)
result._metadata = None
elif self.isupdate and self._is_implicit_returning:
row = result.fetchone()
self.returned_defaults = row
result._soft_close(_autoclose_connection=False)
result._metadata = None
elif result._metadata is None:
# no results, get rowcount
# (which requires open cursor on some drivers
# such as kintersbasdb, mxodbc)
result.rowcount
result._soft_close(_autoclose_connection=False)
return result
def _setup_ins_pk_from_lastrowid(self):
key_getter = self.compiled._key_getters_for_crud_column[2]
table = self.compiled.statement.table
compiled_params = self.compiled_parameters[0]
lastrowid = self.get_lastrowid()
if lastrowid is not None:
autoinc_col = table._autoincrement_column
if autoinc_col is not None:
# apply type post processors to the lastrowid
proc = autoinc_col.type._cached_result_processor(
self.dialect, None)
if proc is not None:
lastrowid = proc(lastrowid)
self.inserted_primary_key = [
lastrowid if c is autoinc_col else
compiled_params.get(key_getter(c), None)
for c in table.primary_key
]
else:
# don't have a usable lastrowid, so
# do the same as _setup_ins_pk_from_empty
self.inserted_primary_key = [
compiled_params.get(key_getter(c), None)
for c in table.primary_key
]
def _setup_ins_pk_from_empty(self):
key_getter = self.compiled._key_getters_for_crud_column[2]
table = self.compiled.statement.table
compiled_params = self.compiled_parameters[0]
self.inserted_primary_key = [
compiled_params.get(key_getter(c), None)
for c in table.primary_key
]
def _setup_ins_pk_from_implicit_returning(self, row):
if row is None:
self.inserted_primary_key = None
return
key_getter = self.compiled._key_getters_for_crud_column[2]
table = self.compiled.statement.table
compiled_params = self.compiled_parameters[0]
self.inserted_primary_key = [
row[col] if value is None else value
for col, value in [
(col, compiled_params.get(key_getter(col), None))
for col in table.primary_key
]
]
def lastrow_has_defaults(self):
return (self.isinsert or self.isupdate) and \
bool(self.compiled.postfetch)
def set_input_sizes(self, translate=None, exclude_types=None):
"""Given a cursor and ClauseParameters, call the appropriate
style of ``setinputsizes()`` on the cursor, using DB-API types
from the bind parameter's ``TypeEngine`` objects.
This method only called by those dialects which require it,
currently cx_oracle.
"""
if not hasattr(self.compiled, 'bind_names'):
return
types = dict(
(self.compiled.bind_names[bindparam], bindparam.type)
for bindparam in self.compiled.bind_names)
if self.dialect.positional:
inputsizes = []
for key in self.compiled.positiontup:
typeengine = types[key]
dbtype = typeengine.dialect_impl(self.dialect).\
get_dbapi_type(self.dialect.dbapi)
if dbtype is not None and \
(not exclude_types or dbtype not in exclude_types):
inputsizes.append(dbtype)
try:
self.cursor.setinputsizes(*inputsizes)
except BaseException as e:
self.root_connection._handle_dbapi_exception(
e, None, None, None, self)
else:
inputsizes = {}
for key in self.compiled.bind_names.values():
typeengine = types[key]
dbtype = typeengine.dialect_impl(self.dialect).\
get_dbapi_type(self.dialect.dbapi)
if dbtype is not None and \
(not exclude_types or dbtype not in exclude_types):
if translate:
key = translate.get(key, key)
if not self.dialect.supports_unicode_binds:
key = self.dialect._encoder(key)[0]
inputsizes[key] = dbtype
try:
self.cursor.setinputsizes(**inputsizes)
except BaseException as e:
self.root_connection._handle_dbapi_exception(
e, None, None, None, self)
def _exec_default(self, default, type_):
if default.is_sequence:
return self.fire_sequence(default, type_)
elif default.is_callable:
return default.arg(self)
elif default.is_clause_element:
# TODO: expensive branching here should be
# pulled into _exec_scalar()
conn = self.connection
c = expression.select([default.arg]).compile(bind=conn)
return conn._execute_compiled(c, (), {}).scalar()
else:
return default.arg
def get_insert_default(self, column):
if column.default is None:
return None
else:
return self._exec_default(column.default, column.type)
def get_update_default(self, column):
if column.onupdate is None:
return None
else:
return self._exec_default(column.onupdate, column.type)
def _process_executemany_defaults(self):
key_getter = self.compiled._key_getters_for_crud_column[2]
scalar_defaults = {}
insert_prefetch = self.compiled.insert_prefetch
update_prefetch = self.compiled.update_prefetch
# pre-determine scalar Python-side defaults
# to avoid many calls of get_insert_default()/
# get_update_default()
for c in insert_prefetch:
if c.default and c.default.is_scalar:
scalar_defaults[c] = c.default.arg
for c in update_prefetch:
if c.onupdate and c.onupdate.is_scalar:
scalar_defaults[c] = c.onupdate.arg
for param in self.compiled_parameters:
self.current_parameters = param
for c in insert_prefetch:
if c in scalar_defaults:
val = scalar_defaults[c]
else:
val = self.get_insert_default(c)
if val is not None:
param[key_getter(c)] = val
for c in update_prefetch:
if c in scalar_defaults:
val = scalar_defaults[c]
else:
val = self.get_update_default(c)
if val is not None:
param[key_getter(c)] = val
del self.current_parameters
def _process_executesingle_defaults(self):
key_getter = self.compiled._key_getters_for_crud_column[2]
self.current_parameters = compiled_parameters = \
self.compiled_parameters[0]
for c in self.compiled.insert_prefetch:
if c.default and \
not c.default.is_sequence and c.default.is_scalar:
val = c.default.arg
else:
val = self.get_insert_default(c)
if val is not None:
compiled_parameters[key_getter(c)] = val
for c in self.compiled.update_prefetch:
val = self.get_update_default(c)
if val is not None:
compiled_parameters[key_getter(c)] = val
del self.current_parameters
DefaultDialect.execution_ctx_cls = DefaultExecutionContext
| bsd-2-clause |
pombreda/androguard | androlyze.py | 36 | 10564 | #!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard 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, either version 3 of the License, or
# (at your option) any later version.
#
# Androguard 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
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Androguard. If not, see <http://www.gnu.org/licenses/>.
import sys, os, cmd, threading, code, re
from optparse import OptionParser
from androguard.core import *
from androguard.core.androgen import *
from androguard.core.androconf import *
from androguard.core.bytecode import *
from androguard.core.bytecodes.jvm import *
from androguard.core.bytecodes.dvm import *
from androguard.core.bytecodes.apk import *
from androguard.core.analysis.analysis import *
from androguard.core.analysis.ganalysis import *
from androguard.core.analysis.risk import *
from androguard.decompiler.decompiler import *
from androguard.core import androconf
from IPython.frontend.terminal.embed import InteractiveShellEmbed
from IPython.config.loader import Config
from cPickle import dumps, loads
option_0 = { 'name' : ('-i', '--input'), 'help' : 'file : use this filename', 'nargs' : 1 }
option_1 = { 'name' : ('-d', '--display'), 'help' : 'display the file in human readable format', 'action' : 'count' }
option_2 = { 'name' : ('-m', '--method'), 'help' : 'display method(s) respect with a regexp', 'nargs' : 1 }
option_3 = { 'name' : ('-f', '--field'), 'help' : 'display field(s) respect with a regexp', 'nargs' : 1 }
option_4 = { 'name' : ('-s', '--shell'), 'help' : 'open an interactive shell to play more easily with objects', 'action' : 'count' }
option_5 = { 'name' : ('-v', '--version'), 'help' : 'version of the API', 'action' : 'count' }
option_6 = { 'name' : ('-p', '--pretty'), 'help' : 'pretty print !', 'action' : 'count' }
option_8 = { 'name' : ('-x', '--xpermissions'), 'help' : 'show paths of permissions', 'action' : 'count' }
options = [option_0, option_1, option_2, option_3, option_4, option_5, option_6, option_8]
def init_print_colors():
from IPython.utils import coloransi, io
default_colors(coloransi.TermColors)
CONF["PRINT_FCT"] = io.stdout.write
def interact():
cfg = Config()
ipshell = InteractiveShellEmbed(config=cfg, banner1="Androlyze version %s" % androconf.ANDROGUARD_VERSION)
init_print_colors()
ipshell()
def save_session(l, filename):
"""
save your session !
:param l: a list of objects
:type: a list of object
:param filename: output filename to save the session
:type filename: string
:Example:
save_session([a, vm, vmx], "msession.json")
"""
fd = open(filename, "w")
fd.write(dumps(l, -1))
fd.close()
def load_session(filename):
"""
load your session !
:param filename: the filename where the session has been saved
:type filename: string
:rtype: the elements of your session :)
:Example:
a, vm, vmx = load_session("mysession.json")
"""
return loads(open(filename, "r").read())
def AnalyzeAPK(filename, raw=False, decompiler=None):
"""
Analyze an android application and setup all stuff for a more quickly analysis !
:param filename: the filename of the android application or a buffer which represents the application
:type filename: string
:param raw: True is you would like to use a buffer (optional)
:type raw: boolean
:param decompiler: ded, dex2jad, dad (optional)
:type decompiler: string
:rtype: return the :class:`APK`, :class:`DalvikVMFormat`, and :class:`VMAnalysis` objects
"""
androconf.debug("APK ...")
a = APK(filename, raw)
d, dx = AnalyzeDex(a.get_dex(), raw=True, decompiler=decompiler)
return a, d, dx
def AnalyzeDex(filename, raw=False, decompiler=None):
"""
Analyze an android dex file and setup all stuff for a more quickly analysis !
:param filename: the filename of the android dex file or a buffer which represents the dex file
:type filename: string
:param raw: True is you would like to use a buffer (optional)
:type raw: boolean
:rtype: return the :class:`DalvikVMFormat`, and :class:`VMAnalysis` objects
"""
androconf.debug("DalvikVMFormat ...")
d = None
if raw == False:
d = DalvikVMFormat(open(filename, "rb").read())
else:
d = DalvikVMFormat(filename)
androconf.debug("Export VM to python namespace")
d.create_python_export()
androconf.debug("VMAnalysis ...")
dx = uVMAnalysis(d)
androconf.debug("GVMAnalysis ...")
gx = GVMAnalysis(dx, None)
d.set_vmanalysis(dx)
d.set_gvmanalysis(gx)
RunDecompiler(d, dx, decompiler)
androconf.debug("XREF ...")
d.create_xref()
androconf.debug("DREF ...")
d.create_dref()
return d, dx
def AnalyzeODex(filename, raw=False, decompiler=None):
"""
Analyze an android odex file and setup all stuff for a more quickly analysis !
:param filename: the filename of the android dex file or a buffer which represents the dex file
:type filename: string
:param raw: True is you would like to use a buffer (optional)
:type raw: boolean
:rtype: return the :class:`DalvikOdexVMFormat`, and :class:`VMAnalysis` objects
"""
androconf.debug("DalvikOdexVMFormat ...")
d = None
if raw == False:
d = DalvikOdexVMFormat(open(filename, "rb").read())
else:
d = DalvikOdexVMFormat(filename)
androconf.debug("Export VM to python namespace")
d.create_python_export()
androconf.debug("VMAnalysis ...")
dx = uVMAnalysis(d)
androconf.debug("GVMAnalysis ...")
gx = GVMAnalysis(dx, None)
d.set_vmanalysis(dx)
d.set_gvmanalysis(gx)
RunDecompiler(d, dx, decompiler)
androconf.debug("XREF ...")
d.create_xref()
androconf.debug("DREF ...")
d.create_dref()
return d, dx
def RunDecompiler(d, dx, decompiler):
"""
Run the decompiler on a specific analysis
:param d: the DalvikVMFormat object
:type d: :class:`DalvikVMFormat` object
:param dx: the analysis of the format
:type dx: :class:`VMAnalysis` object
:param decompiler: the type of decompiler to use ("dad", "dex2jad", "ded")
:type decompiler: string
"""
if decompiler != None:
androconf.debug("Decompiler ...")
decompiler = decompiler.lower()
if decompiler == "dex2jad":
d.set_decompiler(DecompilerDex2Jad(d,
androconf.CONF["PATH_DEX2JAR"],
androconf.CONF["BIN_DEX2JAR"],
androconf.CONF["PATH_JAD"],
androconf.CONF["BIN_JAD"],
androconf.CONF["TMP_DIRECTORY"]))
elif decompiler == "dex2fernflower":
d.set_decompiler(DecompilerDex2Fernflower(d,
androconf.CONF["PATH_DEX2JAR"],
androconf.CONF["BIN_DEX2JAR"],
androconf.CONF["PATH_FERNFLOWER"],
androconf.CONF["BIN_FERNFLOWER"],
androconf.CONF["OPTIONS_FERNFLOWER"],
androconf.CONF["TMP_DIRECTORY"]))
elif decompiler == "ded":
d.set_decompiler(DecompilerDed(d,
androconf.CONF["PATH_DED"],
androconf.CONF["BIN_DED"],
androconf.CONF["TMP_DIRECTORY"]))
else:
d.set_decompiler(DecompilerDAD(d, dx))
def AnalyzeElf(filename, raw=False):
# avoid to install smiasm for everybody
from androguard.core.binaries.elf import ELF
e = None
if raw == False:
e = ELF(open(filename, "rb").read())
else:
e = ELF(filename)
ExportElfToPython(e)
return e
def ExportElfToPython(e):
for function in e.get_functions():
name = "FUNCTION_" + function.name
setattr(e, name, function)
def AnalyzeJAR(filename, raw=False):
androconf.debug("JAR ...")
a = JAR(filename, raw)
d = AnalyzeClasses(a.get_classes())
return a, d
def AnalyzeClasses(classes):
d = {}
for i in classes:
d[i[0]] = JVMFormat(i[1])
return d
def main(options, arguments):
if options.shell != None:
interact()
elif options.input != None :
_a = AndroguardS( options.input )
if options.pretty != None :
init_print_colors()
if options.display != None :
if options.pretty != None :
_a.ianalyze()
_a.pretty_show()
else :
_a.show()
elif options.method != None :
for method in _a.get("method", options.method) :
if options.pretty != None :
_a.ianalyze()
method.pretty_show()
else :
method.show()
elif options.field != None :
for field in _a.get("field", options.field) :
field.show()
elif options.xpermissions != None :
_a.ianalyze()
perms_access = _a.get_analysis().get_permissions( [] )
for perm in perms_access :
print "PERM : ", perm
for path in perms_access[ perm ] :
show_Path( _a.get_vm(), path )
elif options.version != None :
print "Androlyze version %s" % androconf.ANDROGUARD_VERSION
if __name__ == "__main__" :
parser = OptionParser()
for option in options :
param = option['name']
del option['name']
parser.add_option(*param, **option)
options, arguments = parser.parse_args()
sys.argv[:] = arguments
main(options, arguments)
| apache-2.0 |
vovojh/gem5 | configs/ruby/CntrlBase.py | 31 | 2100 | # Copyright (c) 2013 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Derek Hower
class CntrlBase:
_seqs = 0
@classmethod
def seqCount(cls):
# Use SeqCount not class since we need global count
CntrlBase._seqs += 1
return CntrlBase._seqs - 1
_cntrls = 0
@classmethod
def cntrlCount(cls):
# Use CntlCount not class since we need global count
CntrlBase._cntrls += 1
return CntrlBase._cntrls - 1
_version = 0
@classmethod
def versionCount(cls):
cls._version += 1 # Use count for this particular type
return cls._version - 1
| bsd-3-clause |
nirmeshk/oh-mainline | vendor/packages/kombu/kombu/tests/transport/test_librabbitmq.py | 30 | 4882 | from __future__ import absolute_import
try:
import librabbitmq
except ImportError:
librabbitmq = None # noqa
else:
from kombu.transport import librabbitmq # noqa
from kombu.tests.case import Case, Mock, SkipTest, patch
class lrmqCase(Case):
def setUp(self):
if librabbitmq is None:
raise SkipTest('librabbitmq is not installed')
class test_Message(lrmqCase):
def test_init(self):
chan = Mock(name='channel')
message = librabbitmq.Message(
chan, {'prop': 42}, {'delivery_tag': 337}, 'body',
)
self.assertEqual(message.body, 'body')
self.assertEqual(message.delivery_tag, 337)
self.assertEqual(message.properties['prop'], 42)
class test_Channel(lrmqCase):
def test_prepare_message(self):
conn = Mock(name='connection')
chan = librabbitmq.Channel(conn, 1)
self.assertTrue(chan)
body = 'the quick brown fox...'
properties = {'name': 'Elaine M.'}
body2, props2 = chan.prepare_message(
body, properties=properties,
priority=999,
content_type='ctype',
content_encoding='cenc',
headers={'H': 2},
)
self.assertEqual(props2['name'], 'Elaine M.')
self.assertEqual(props2['priority'], 999)
self.assertEqual(props2['content_type'], 'ctype')
self.assertEqual(props2['content_encoding'], 'cenc')
self.assertEqual(props2['headers'], {'H': 2})
self.assertEqual(body2, body)
body3, props3 = chan.prepare_message(body, priority=777)
self.assertEqual(props3['priority'], 777)
self.assertEqual(body3, body)
class test_Transport(lrmqCase):
def setUp(self):
super(test_Transport, self).setUp()
self.client = Mock(name='client')
self.T = librabbitmq.Transport(self.client)
def test_driver_version(self):
self.assertTrue(self.T.driver_version())
def test_create_channel(self):
conn = Mock(name='connection')
chan = self.T.create_channel(conn)
self.assertTrue(chan)
conn.channel.assert_called_with()
def test_drain_events(self):
conn = Mock(name='connection')
self.T.drain_events(conn, timeout=1.33)
conn.drain_events.assert_called_with(timeout=1.33)
def test_establish_connection_SSL_not_supported(self):
self.client.ssl = True
with self.assertRaises(NotImplementedError):
self.T.establish_connection()
def test_establish_connection(self):
self.T.Connection = Mock(name='Connection')
self.T.client.ssl = False
self.T.client.port = None
self.T.client.transport_options = {}
conn = self.T.establish_connection()
self.assertEqual(
self.T.client.port,
self.T.default_connection_params['port'],
)
self.assertEqual(conn.client, self.T.client)
self.assertEqual(self.T.client.drain_events, conn.drain_events)
def test_collect__no_conn(self):
self.T.client.drain_events = 1234
self.T._collect(None)
self.assertIsNone(self.client.drain_events)
self.assertIsNone(self.T.client)
def test_collect__with_conn(self):
self.T.client.drain_events = 1234
conn = Mock(name='connection')
chans = conn.channels = {1: Mock(name='chan1'), 2: Mock(name='chan2')}
conn.callbacks = {'foo': Mock(name='cb1'), 'bar': Mock(name='cb2')}
for i, chan in enumerate(conn.channels.values()):
chan.connection = i
with patch('os.close') as close:
self.T._collect(conn)
close.assert_called_with(conn.fileno())
self.assertFalse(conn.channels)
self.assertFalse(conn.callbacks)
for chan in chans.values():
self.assertIsNone(chan.connection)
self.assertIsNone(self.client.drain_events)
self.assertIsNone(self.T.client)
with patch('os.close') as close:
self.T.client = self.client
close.side_effect = OSError()
self.T._collect(conn)
close.assert_called_with(conn.fileno())
def test_register_with_event_loop(self):
conn = Mock(name='conn')
loop = Mock(name='loop')
self.T.register_with_event_loop(conn, loop)
loop.add_reader.assert_called_with(
conn.fileno(), self.T.on_readable, conn, loop,
)
def test_verify_connection(self):
conn = Mock(name='connection')
conn.connected = True
self.assertTrue(self.T.verify_connection(conn))
def test_close_connection(self):
conn = Mock(name='connection')
self.client.drain_events = 1234
self.T.close_connection(conn)
self.assertIsNone(self.client.drain_events)
conn.close.assert_called_with()
| agpl-3.0 |
sadol/voltlog | libs/plotFrame.py | 1 | 3608 | #/usr/lib/env python
import matplotlib as mpl
mpl.use('TkAgg')
#from matplotlib import pyplot as plt # DONT USE IT WITH TKINTER!!!!!!!!!!!!!!
from matplotlib.figure import Figure # USE THIS INSTEAD!!!!!!!!!!!!!
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg as tkCanvas
class PlotFrame():
"""tkinter frame with embeded matplotlib real-time suplot object"""
def __init__(self, root, VQueue, IQueue, delay, color):
"""PlotFrame constructor
Arguments:
root -> tkinter root frame
VQueue -> deque object with 50 samples of fresh V data from PSU
IQueue -> deque object with 50 samples of fresh I data from PSU
delay -> int(miliseconds) refresh delay
color -> background color"""
self.root = root
self.delay = delay
self.color = color
self.tData = range(50) # x axis for both V and I
self.VQueue = VQueue # internal queue of V values to plot
self.IQueue = IQueue # internal queue of I values to plot
# DONT USE PYPLOT WITK TKAGG CANVAS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#self.fig = plt.figure(figsize=(5, 1.7))
# USE NATIVE matplotlib.figure.Figure() INSTEAD!!!!!!!!!!!!!!!!!!!!!!!
self.fig = Figure(figsize=(5, 1.2), facecolor=self.color,
edgecolor=self.color, frameon=False, linewidth=0.00)
self.fig.subplots_adjust(left=0.15, right=0.85) # important
self.canvas = tkCanvas(self.fig, master=self.root)
self.axesV = self.fig.add_subplot(1, 1, 1) # left y ax is V
self.axesI = self.axesV.twinx() # right y ax is I
self.labelsV = self.axesV.set_ylim([0, 20])
self.labelsI = self.axesI.set_ylim([0, 10])
self.axesV.set_ylabel('voltage [V]', color='g', size='small')
self.axesI.set_ylabel('current [A]', color='r', size='small')
self.axesV.tick_params(axis='y', colors='g')
self.axesI.tick_params(axis='y', colors='r')
self.axesV.spines['left'].set_color('g')
self.axesV.spines['right'].set_color('r')
self.lineV, = self.axesV.plot(self.tData, self.VQueue, 'g-',
label='V', linewidth=2)
self.lineI, = self.axesI.plot(self.tData, self.IQueue, 'r-',
label='I', linewidth=2)
lines = self.lineV, self.lineI
labels = [line.get_label() for line in lines]
self.axesV.legend(lines, labels, loc=2, fontsize='small',
frameon=False, framealpha=0.5) # stackoverflow trick
self.canvas.get_tk_widget().grid()
def plot(self):
"""draws V and I plot on the tkinter canvas
Arguments:
Rreturns:
"after" job ID which can be intercept for cancel thread"""
self.axesV.set_ylim(self._setLimits(self.VQueue))
self.axesI.set_ylim(self._setLimits(self.IQueue))
self.lineV.set_ydata(self.VQueue)
self.lineI.set_ydata(self.IQueue)
self.canvas.draw()
self.root.after(self.delay, self.plot)
def _setLimits(self, dequeObj):
"""sets y range limits for self.plotObj
Arguments:
dequeObj -> collection.deque object populated with values
Returns:
list [min, max] values (with offsets) of the argument"""
mi = min(dequeObj)
ma = max(dequeObj) + 0.1 # prevents overlaping min and max boundiaries
return [mi - (0.1 * mi), ma + (0.1 * ma)]
| gpl-2.0 |
TechBK/horizon-dev | horizon/test/test_dashboards/dogs/puppies/views.py | 89 | 1077 | # 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.
from horizon import tabs
from horizon.test.test_dashboards.dogs.puppies import tabs as dogs_tabs
from horizon import views
class IndexView(views.APIView):
# A very simple class-based view...
template_name = 'dogs/puppies/index.html'
def get_data(self, request, context, *args, **kwargs):
# Add data to the context here...
return context
class TwoTabsView(tabs.TabbedTableView):
tab_group_class = dogs_tabs.PuppiesTabs
template_name = 'dogs/puppies/two_tabs.html'
| apache-2.0 |
anntzer/numpy | numpy/core/tests/test_numeric.py | 1 | 132753 | import sys
import warnings
import itertools
import platform
import pytest
import math
from decimal import Decimal
import numpy as np
from numpy.core import umath
from numpy.random import rand, randint, randn
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_raises_regex,
assert_array_equal, assert_almost_equal, assert_array_almost_equal,
assert_warns, assert_array_max_ulp, HAS_REFCOUNT
)
from numpy.core._rational_tests import rational
from hypothesis import assume, given, strategies as st
from hypothesis.extra import numpy as hynp
class TestResize:
def test_copies(self):
A = np.array([[1, 2], [3, 4]])
Ar1 = np.array([[1, 2, 3, 4], [1, 2, 3, 4]])
assert_equal(np.resize(A, (2, 4)), Ar1)
Ar2 = np.array([[1, 2], [3, 4], [1, 2], [3, 4]])
assert_equal(np.resize(A, (4, 2)), Ar2)
Ar3 = np.array([[1, 2, 3], [4, 1, 2], [3, 4, 1], [2, 3, 4]])
assert_equal(np.resize(A, (4, 3)), Ar3)
def test_repeats(self):
A = np.array([1, 2, 3])
Ar1 = np.array([[1, 2, 3, 1], [2, 3, 1, 2]])
assert_equal(np.resize(A, (2, 4)), Ar1)
Ar2 = np.array([[1, 2], [3, 1], [2, 3], [1, 2]])
assert_equal(np.resize(A, (4, 2)), Ar2)
Ar3 = np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]])
assert_equal(np.resize(A, (4, 3)), Ar3)
def test_zeroresize(self):
A = np.array([[1, 2], [3, 4]])
Ar = np.resize(A, (0,))
assert_array_equal(Ar, np.array([]))
assert_equal(A.dtype, Ar.dtype)
Ar = np.resize(A, (0, 2))
assert_equal(Ar.shape, (0, 2))
Ar = np.resize(A, (2, 0))
assert_equal(Ar.shape, (2, 0))
def test_reshape_from_zero(self):
# See also gh-6740
A = np.zeros(0, dtype=[('a', np.float32)])
Ar = np.resize(A, (2, 1))
assert_array_equal(Ar, np.zeros((2, 1), Ar.dtype))
assert_equal(A.dtype, Ar.dtype)
def test_negative_resize(self):
A = np.arange(0, 10, dtype=np.float32)
new_shape = (-10, -1)
with pytest.raises(ValueError, match=r"negative"):
np.resize(A, new_shape=new_shape)
def test_subclass(self):
class MyArray(np.ndarray):
__array_priority__ = 1.
my_arr = np.array([1]).view(MyArray)
assert type(np.resize(my_arr, 5)) is MyArray
assert type(np.resize(my_arr, 0)) is MyArray
my_arr = np.array([]).view(MyArray)
assert type(np.resize(my_arr, 5)) is MyArray
class TestNonarrayArgs:
# check that non-array arguments to functions wrap them in arrays
def test_choose(self):
choices = [[0, 1, 2],
[3, 4, 5],
[5, 6, 7]]
tgt = [5, 1, 5]
a = [2, 0, 1]
out = np.choose(a, choices)
assert_equal(out, tgt)
def test_clip(self):
arr = [-1, 5, 2, 3, 10, -4, -9]
out = np.clip(arr, 2, 7)
tgt = [2, 5, 2, 3, 7, 2, 2]
assert_equal(out, tgt)
def test_compress(self):
arr = [[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]]
tgt = [[5, 6, 7, 8, 9]]
out = np.compress([0, 1], arr, axis=0)
assert_equal(out, tgt)
def test_count_nonzero(self):
arr = [[0, 1, 7, 0, 0],
[3, 0, 0, 2, 19]]
tgt = np.array([2, 3])
out = np.count_nonzero(arr, axis=1)
assert_equal(out, tgt)
def test_cumproduct(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_(np.all(np.cumproduct(A) == np.array([1, 2, 6, 24, 120, 720])))
def test_diagonal(self):
a = [[0, 1, 2, 3],
[4, 5, 6, 7],
[8, 9, 10, 11]]
out = np.diagonal(a)
tgt = [0, 5, 10]
assert_equal(out, tgt)
def test_mean(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_(np.mean(A) == 3.5)
assert_(np.all(np.mean(A, 0) == np.array([2.5, 3.5, 4.5])))
assert_(np.all(np.mean(A, 1) == np.array([2., 5.])))
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings('always', '', RuntimeWarning)
assert_(np.isnan(np.mean([])))
assert_(w[0].category is RuntimeWarning)
def test_ptp(self):
a = [3, 4, 5, 10, -3, -5, 6.0]
assert_equal(np.ptp(a, axis=0), 15.0)
def test_prod(self):
arr = [[1, 2, 3, 4],
[5, 6, 7, 9],
[10, 3, 4, 5]]
tgt = [24, 1890, 600]
assert_equal(np.prod(arr, axis=-1), tgt)
def test_ravel(self):
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tgt = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
assert_equal(np.ravel(a), tgt)
def test_repeat(self):
a = [1, 2, 3]
tgt = [1, 1, 2, 2, 3, 3]
out = np.repeat(a, 2)
assert_equal(out, tgt)
def test_reshape(self):
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tgt = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
assert_equal(np.reshape(arr, (2, 6)), tgt)
def test_round(self):
arr = [1.56, 72.54, 6.35, 3.25]
tgt = [1.6, 72.5, 6.4, 3.2]
assert_equal(np.around(arr, decimals=1), tgt)
s = np.float64(1.)
assert_(isinstance(s.round(), np.float64))
assert_equal(s.round(), 1.)
@pytest.mark.parametrize('dtype', [
np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64,
np.float16, np.float32, np.float64,
])
def test_dunder_round(self, dtype):
s = dtype(1)
assert_(isinstance(round(s), int))
assert_(isinstance(round(s, None), int))
assert_(isinstance(round(s, ndigits=None), int))
assert_equal(round(s), 1)
assert_equal(round(s, None), 1)
assert_equal(round(s, ndigits=None), 1)
@pytest.mark.parametrize('val, ndigits', [
pytest.param(2**31 - 1, -1,
marks=pytest.mark.xfail(reason="Out of range of int32")
),
(2**31 - 1, 1-math.ceil(math.log10(2**31 - 1))),
(2**31 - 1, -math.ceil(math.log10(2**31 - 1)))
])
def test_dunder_round_edgecases(self, val, ndigits):
assert_equal(round(val, ndigits), round(np.int32(val), ndigits))
def test_dunder_round_accuracy(self):
f = np.float64(5.1 * 10**73)
assert_(isinstance(round(f, -73), np.float64))
assert_array_max_ulp(round(f, -73), 5.0 * 10**73)
assert_(isinstance(round(f, ndigits=-73), np.float64))
assert_array_max_ulp(round(f, ndigits=-73), 5.0 * 10**73)
i = np.int64(501)
assert_(isinstance(round(i, -2), np.int64))
assert_array_max_ulp(round(i, -2), 500)
assert_(isinstance(round(i, ndigits=-2), np.int64))
assert_array_max_ulp(round(i, ndigits=-2), 500)
@pytest.mark.xfail(raises=AssertionError, reason="gh-15896")
def test_round_py_consistency(self):
f = 5.1 * 10**73
assert_equal(round(np.float64(f), -73), round(f, -73))
def test_searchsorted(self):
arr = [-8, -5, -1, 3, 6, 10]
out = np.searchsorted(arr, 0)
assert_equal(out, 3)
def test_size(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_(np.size(A) == 6)
assert_(np.size(A, 0) == 2)
assert_(np.size(A, 1) == 3)
def test_squeeze(self):
A = [[[1, 1, 1], [2, 2, 2], [3, 3, 3]]]
assert_equal(np.squeeze(A).shape, (3, 3))
assert_equal(np.squeeze(np.zeros((1, 3, 1))).shape, (3,))
assert_equal(np.squeeze(np.zeros((1, 3, 1)), axis=0).shape, (3, 1))
assert_equal(np.squeeze(np.zeros((1, 3, 1)), axis=-1).shape, (1, 3))
assert_equal(np.squeeze(np.zeros((1, 3, 1)), axis=2).shape, (1, 3))
assert_equal(np.squeeze([np.zeros((3, 1))]).shape, (3,))
assert_equal(np.squeeze([np.zeros((3, 1))], axis=0).shape, (3, 1))
assert_equal(np.squeeze([np.zeros((3, 1))], axis=2).shape, (1, 3))
assert_equal(np.squeeze([np.zeros((3, 1))], axis=-1).shape, (1, 3))
def test_std(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_almost_equal(np.std(A), 1.707825127659933)
assert_almost_equal(np.std(A, 0), np.array([1.5, 1.5, 1.5]))
assert_almost_equal(np.std(A, 1), np.array([0.81649658, 0.81649658]))
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings('always', '', RuntimeWarning)
assert_(np.isnan(np.std([])))
assert_(w[0].category is RuntimeWarning)
def test_swapaxes(self):
tgt = [[[0, 4], [2, 6]], [[1, 5], [3, 7]]]
a = [[[0, 1], [2, 3]], [[4, 5], [6, 7]]]
out = np.swapaxes(a, 0, 2)
assert_equal(out, tgt)
def test_sum(self):
m = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
tgt = [[6], [15], [24]]
out = np.sum(m, axis=1, keepdims=True)
assert_equal(tgt, out)
def test_take(self):
tgt = [2, 3, 5]
indices = [1, 2, 4]
a = [1, 2, 3, 4, 5]
out = np.take(a, indices)
assert_equal(out, tgt)
def test_trace(self):
c = [[1, 2], [3, 4], [5, 6]]
assert_equal(np.trace(c), 5)
def test_transpose(self):
arr = [[1, 2], [3, 4], [5, 6]]
tgt = [[1, 3, 5], [2, 4, 6]]
assert_equal(np.transpose(arr, (1, 0)), tgt)
def test_var(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_almost_equal(np.var(A), 2.9166666666666665)
assert_almost_equal(np.var(A, 0), np.array([2.25, 2.25, 2.25]))
assert_almost_equal(np.var(A, 1), np.array([0.66666667, 0.66666667]))
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings('always', '', RuntimeWarning)
assert_(np.isnan(np.var([])))
assert_(w[0].category is RuntimeWarning)
B = np.array([None, 0])
B[0] = 1j
assert_almost_equal(np.var(B), 0.25)
class TestIsscalar:
def test_isscalar(self):
assert_(np.isscalar(3.1))
assert_(np.isscalar(np.int16(12345)))
assert_(np.isscalar(False))
assert_(np.isscalar('numpy'))
assert_(not np.isscalar([3.1]))
assert_(not np.isscalar(None))
# PEP 3141
from fractions import Fraction
assert_(np.isscalar(Fraction(5, 17)))
from numbers import Number
assert_(np.isscalar(Number()))
class TestBoolScalar:
def test_logical(self):
f = np.False_
t = np.True_
s = "xyz"
assert_((t and s) is s)
assert_((f and s) is f)
def test_bitwise_or(self):
f = np.False_
t = np.True_
assert_((t | t) is t)
assert_((f | t) is t)
assert_((t | f) is t)
assert_((f | f) is f)
def test_bitwise_and(self):
f = np.False_
t = np.True_
assert_((t & t) is t)
assert_((f & t) is f)
assert_((t & f) is f)
assert_((f & f) is f)
def test_bitwise_xor(self):
f = np.False_
t = np.True_
assert_((t ^ t) is f)
assert_((f ^ t) is t)
assert_((t ^ f) is t)
assert_((f ^ f) is f)
class TestBoolArray:
def setup(self):
# offset for simd tests
self.t = np.array([True] * 41, dtype=bool)[1::]
self.f = np.array([False] * 41, dtype=bool)[1::]
self.o = np.array([False] * 42, dtype=bool)[2::]
self.nm = self.f.copy()
self.im = self.t.copy()
self.nm[3] = True
self.nm[-2] = True
self.im[3] = False
self.im[-2] = False
def test_all_any(self):
assert_(self.t.all())
assert_(self.t.any())
assert_(not self.f.all())
assert_(not self.f.any())
assert_(self.nm.any())
assert_(self.im.any())
assert_(not self.nm.all())
assert_(not self.im.all())
# check bad element in all positions
for i in range(256 - 7):
d = np.array([False] * 256, dtype=bool)[7::]
d[i] = True
assert_(np.any(d))
e = np.array([True] * 256, dtype=bool)[7::]
e[i] = False
assert_(not np.all(e))
assert_array_equal(e, ~d)
# big array test for blocked libc loops
for i in list(range(9, 6000, 507)) + [7764, 90021, -10]:
d = np.array([False] * 100043, dtype=bool)
d[i] = True
assert_(np.any(d), msg="%r" % i)
e = np.array([True] * 100043, dtype=bool)
e[i] = False
assert_(not np.all(e), msg="%r" % i)
def test_logical_not_abs(self):
assert_array_equal(~self.t, self.f)
assert_array_equal(np.abs(~self.t), self.f)
assert_array_equal(np.abs(~self.f), self.t)
assert_array_equal(np.abs(self.f), self.f)
assert_array_equal(~np.abs(self.f), self.t)
assert_array_equal(~np.abs(self.t), self.f)
assert_array_equal(np.abs(~self.nm), self.im)
np.logical_not(self.t, out=self.o)
assert_array_equal(self.o, self.f)
np.abs(self.t, out=self.o)
assert_array_equal(self.o, self.t)
def test_logical_and_or_xor(self):
assert_array_equal(self.t | self.t, self.t)
assert_array_equal(self.f | self.f, self.f)
assert_array_equal(self.t | self.f, self.t)
assert_array_equal(self.f | self.t, self.t)
np.logical_or(self.t, self.t, out=self.o)
assert_array_equal(self.o, self.t)
assert_array_equal(self.t & self.t, self.t)
assert_array_equal(self.f & self.f, self.f)
assert_array_equal(self.t & self.f, self.f)
assert_array_equal(self.f & self.t, self.f)
np.logical_and(self.t, self.t, out=self.o)
assert_array_equal(self.o, self.t)
assert_array_equal(self.t ^ self.t, self.f)
assert_array_equal(self.f ^ self.f, self.f)
assert_array_equal(self.t ^ self.f, self.t)
assert_array_equal(self.f ^ self.t, self.t)
np.logical_xor(self.t, self.t, out=self.o)
assert_array_equal(self.o, self.f)
assert_array_equal(self.nm & self.t, self.nm)
assert_array_equal(self.im & self.f, False)
assert_array_equal(self.nm & True, self.nm)
assert_array_equal(self.im & False, self.f)
assert_array_equal(self.nm | self.t, self.t)
assert_array_equal(self.im | self.f, self.im)
assert_array_equal(self.nm | True, self.t)
assert_array_equal(self.im | False, self.im)
assert_array_equal(self.nm ^ self.t, self.im)
assert_array_equal(self.im ^ self.f, self.im)
assert_array_equal(self.nm ^ True, self.im)
assert_array_equal(self.im ^ False, self.im)
class TestBoolCmp:
def setup(self):
self.f = np.ones(256, dtype=np.float32)
self.ef = np.ones(self.f.size, dtype=bool)
self.d = np.ones(128, dtype=np.float64)
self.ed = np.ones(self.d.size, dtype=bool)
# generate values for all permutation of 256bit simd vectors
s = 0
for i in range(32):
self.f[s:s+8] = [i & 2**x for x in range(8)]
self.ef[s:s+8] = [(i & 2**x) != 0 for x in range(8)]
s += 8
s = 0
for i in range(16):
self.d[s:s+4] = [i & 2**x for x in range(4)]
self.ed[s:s+4] = [(i & 2**x) != 0 for x in range(4)]
s += 4
self.nf = self.f.copy()
self.nd = self.d.copy()
self.nf[self.ef] = np.nan
self.nd[self.ed] = np.nan
self.inff = self.f.copy()
self.infd = self.d.copy()
self.inff[::3][self.ef[::3]] = np.inf
self.infd[::3][self.ed[::3]] = np.inf
self.inff[1::3][self.ef[1::3]] = -np.inf
self.infd[1::3][self.ed[1::3]] = -np.inf
self.inff[2::3][self.ef[2::3]] = np.nan
self.infd[2::3][self.ed[2::3]] = np.nan
self.efnonan = self.ef.copy()
self.efnonan[2::3] = False
self.ednonan = self.ed.copy()
self.ednonan[2::3] = False
self.signf = self.f.copy()
self.signd = self.d.copy()
self.signf[self.ef] *= -1.
self.signd[self.ed] *= -1.
self.signf[1::6][self.ef[1::6]] = -np.inf
self.signd[1::6][self.ed[1::6]] = -np.inf
self.signf[3::6][self.ef[3::6]] = -np.nan
self.signd[3::6][self.ed[3::6]] = -np.nan
self.signf[4::6][self.ef[4::6]] = -0.
self.signd[4::6][self.ed[4::6]] = -0.
def test_float(self):
# offset for alignment test
for i in range(4):
assert_array_equal(self.f[i:] > 0, self.ef[i:])
assert_array_equal(self.f[i:] - 1 >= 0, self.ef[i:])
assert_array_equal(self.f[i:] == 0, ~self.ef[i:])
assert_array_equal(-self.f[i:] < 0, self.ef[i:])
assert_array_equal(-self.f[i:] + 1 <= 0, self.ef[i:])
r = self.f[i:] != 0
assert_array_equal(r, self.ef[i:])
r2 = self.f[i:] != np.zeros_like(self.f[i:])
r3 = 0 != self.f[i:]
assert_array_equal(r, r2)
assert_array_equal(r, r3)
# check bool == 0x1
assert_array_equal(r.view(np.int8), r.astype(np.int8))
assert_array_equal(r2.view(np.int8), r2.astype(np.int8))
assert_array_equal(r3.view(np.int8), r3.astype(np.int8))
# isnan on amd64 takes the same code path
assert_array_equal(np.isnan(self.nf[i:]), self.ef[i:])
assert_array_equal(np.isfinite(self.nf[i:]), ~self.ef[i:])
assert_array_equal(np.isfinite(self.inff[i:]), ~self.ef[i:])
assert_array_equal(np.isinf(self.inff[i:]), self.efnonan[i:])
assert_array_equal(np.signbit(self.signf[i:]), self.ef[i:])
def test_double(self):
# offset for alignment test
for i in range(2):
assert_array_equal(self.d[i:] > 0, self.ed[i:])
assert_array_equal(self.d[i:] - 1 >= 0, self.ed[i:])
assert_array_equal(self.d[i:] == 0, ~self.ed[i:])
assert_array_equal(-self.d[i:] < 0, self.ed[i:])
assert_array_equal(-self.d[i:] + 1 <= 0, self.ed[i:])
r = self.d[i:] != 0
assert_array_equal(r, self.ed[i:])
r2 = self.d[i:] != np.zeros_like(self.d[i:])
r3 = 0 != self.d[i:]
assert_array_equal(r, r2)
assert_array_equal(r, r3)
# check bool == 0x1
assert_array_equal(r.view(np.int8), r.astype(np.int8))
assert_array_equal(r2.view(np.int8), r2.astype(np.int8))
assert_array_equal(r3.view(np.int8), r3.astype(np.int8))
# isnan on amd64 takes the same code path
assert_array_equal(np.isnan(self.nd[i:]), self.ed[i:])
assert_array_equal(np.isfinite(self.nd[i:]), ~self.ed[i:])
assert_array_equal(np.isfinite(self.infd[i:]), ~self.ed[i:])
assert_array_equal(np.isinf(self.infd[i:]), self.ednonan[i:])
assert_array_equal(np.signbit(self.signd[i:]), self.ed[i:])
class TestSeterr:
def test_default(self):
err = np.geterr()
assert_equal(err,
dict(divide='warn',
invalid='warn',
over='warn',
under='ignore')
)
def test_set(self):
with np.errstate():
err = np.seterr()
old = np.seterr(divide='print')
assert_(err == old)
new = np.seterr()
assert_(new['divide'] == 'print')
np.seterr(over='raise')
assert_(np.geterr()['over'] == 'raise')
assert_(new['divide'] == 'print')
np.seterr(**old)
assert_(np.geterr() == old)
@pytest.mark.skipif(platform.machine() == "armv5tel", reason="See gh-413.")
def test_divide_err(self):
with np.errstate(divide='raise'):
with assert_raises(FloatingPointError):
np.array([1.]) / np.array([0.])
np.seterr(divide='ignore')
np.array([1.]) / np.array([0.])
def test_errobj(self):
olderrobj = np.geterrobj()
self.called = 0
try:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
with np.errstate(divide='warn'):
np.seterrobj([20000, 1, None])
np.array([1.]) / np.array([0.])
assert_equal(len(w), 1)
def log_err(*args):
self.called += 1
extobj_err = args
assert_(len(extobj_err) == 2)
assert_("divide" in extobj_err[0])
with np.errstate(divide='ignore'):
np.seterrobj([20000, 3, log_err])
np.array([1.]) / np.array([0.])
assert_equal(self.called, 1)
np.seterrobj(olderrobj)
with np.errstate(divide='ignore'):
np.divide(1., 0., extobj=[20000, 3, log_err])
assert_equal(self.called, 2)
finally:
np.seterrobj(olderrobj)
del self.called
def test_errobj_noerrmask(self):
# errmask = 0 has a special code path for the default
olderrobj = np.geterrobj()
try:
# set errobj to something non default
np.seterrobj([umath.UFUNC_BUFSIZE_DEFAULT,
umath.ERR_DEFAULT + 1, None])
# call a ufunc
np.isnan(np.array([6]))
# same with the default, lots of times to get rid of possible
# pre-existing stack in the code
for i in range(10000):
np.seterrobj([umath.UFUNC_BUFSIZE_DEFAULT, umath.ERR_DEFAULT,
None])
np.isnan(np.array([6]))
finally:
np.seterrobj(olderrobj)
class TestFloatExceptions:
def assert_raises_fpe(self, fpeerr, flop, x, y):
ftype = type(x)
try:
flop(x, y)
assert_(False,
"Type %s did not raise fpe error '%s'." % (ftype, fpeerr))
except FloatingPointError as exc:
assert_(str(exc).find(fpeerr) >= 0,
"Type %s raised wrong fpe error '%s'." % (ftype, exc))
def assert_op_raises_fpe(self, fpeerr, flop, sc1, sc2):
# Check that fpe exception is raised.
#
# Given a floating operation `flop` and two scalar values, check that
# the operation raises the floating point exception specified by
# `fpeerr`. Tests all variants with 0-d array scalars as well.
self.assert_raises_fpe(fpeerr, flop, sc1, sc2)
self.assert_raises_fpe(fpeerr, flop, sc1[()], sc2)
self.assert_raises_fpe(fpeerr, flop, sc1, sc2[()])
self.assert_raises_fpe(fpeerr, flop, sc1[()], sc2[()])
def test_floating_exceptions(self):
# Test basic arithmetic function errors
with np.errstate(all='raise'):
# Test for all real and complex float types
for typecode in np.typecodes['AllFloat']:
ftype = np.obj2sctype(typecode)
if np.dtype(ftype).kind == 'f':
# Get some extreme values for the type
fi = np.finfo(ftype)
ft_tiny = fi.tiny
ft_max = fi.max
ft_eps = fi.eps
underflow = 'underflow'
divbyzero = 'divide by zero'
else:
# 'c', complex, corresponding real dtype
rtype = type(ftype(0).real)
fi = np.finfo(rtype)
ft_tiny = ftype(fi.tiny)
ft_max = ftype(fi.max)
ft_eps = ftype(fi.eps)
# The complex types raise different exceptions
underflow = ''
divbyzero = ''
overflow = 'overflow'
invalid = 'invalid'
self.assert_raises_fpe(underflow,
lambda a, b: a/b, ft_tiny, ft_max)
self.assert_raises_fpe(underflow,
lambda a, b: a*b, ft_tiny, ft_tiny)
self.assert_raises_fpe(overflow,
lambda a, b: a*b, ft_max, ftype(2))
self.assert_raises_fpe(overflow,
lambda a, b: a/b, ft_max, ftype(0.5))
self.assert_raises_fpe(overflow,
lambda a, b: a+b, ft_max, ft_max*ft_eps)
self.assert_raises_fpe(overflow,
lambda a, b: a-b, -ft_max, ft_max*ft_eps)
self.assert_raises_fpe(overflow,
np.power, ftype(2), ftype(2**fi.nexp))
self.assert_raises_fpe(divbyzero,
lambda a, b: a/b, ftype(1), ftype(0))
self.assert_raises_fpe(invalid,
lambda a, b: a/b, ftype(np.inf), ftype(np.inf))
self.assert_raises_fpe(invalid,
lambda a, b: a/b, ftype(0), ftype(0))
self.assert_raises_fpe(invalid,
lambda a, b: a-b, ftype(np.inf), ftype(np.inf))
self.assert_raises_fpe(invalid,
lambda a, b: a+b, ftype(np.inf), ftype(-np.inf))
self.assert_raises_fpe(invalid,
lambda a, b: a*b, ftype(0), ftype(np.inf))
def test_warnings(self):
# test warning code path
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
with np.errstate(all="warn"):
np.divide(1, 0.)
assert_equal(len(w), 1)
assert_("divide by zero" in str(w[0].message))
np.array(1e300) * np.array(1e300)
assert_equal(len(w), 2)
assert_("overflow" in str(w[-1].message))
np.array(np.inf) - np.array(np.inf)
assert_equal(len(w), 3)
assert_("invalid value" in str(w[-1].message))
np.array(1e-300) * np.array(1e-300)
assert_equal(len(w), 4)
assert_("underflow" in str(w[-1].message))
class TestTypes:
def check_promotion_cases(self, promote_func):
# tests that the scalars get coerced correctly.
b = np.bool_(0)
i8, i16, i32, i64 = np.int8(0), np.int16(0), np.int32(0), np.int64(0)
u8, u16, u32, u64 = np.uint8(0), np.uint16(0), np.uint32(0), np.uint64(0)
f32, f64, fld = np.float32(0), np.float64(0), np.longdouble(0)
c64, c128, cld = np.complex64(0), np.complex128(0), np.clongdouble(0)
# coercion within the same kind
assert_equal(promote_func(i8, i16), np.dtype(np.int16))
assert_equal(promote_func(i32, i8), np.dtype(np.int32))
assert_equal(promote_func(i16, i64), np.dtype(np.int64))
assert_equal(promote_func(u8, u32), np.dtype(np.uint32))
assert_equal(promote_func(f32, f64), np.dtype(np.float64))
assert_equal(promote_func(fld, f32), np.dtype(np.longdouble))
assert_equal(promote_func(f64, fld), np.dtype(np.longdouble))
assert_equal(promote_func(c128, c64), np.dtype(np.complex128))
assert_equal(promote_func(cld, c128), np.dtype(np.clongdouble))
assert_equal(promote_func(c64, fld), np.dtype(np.clongdouble))
# coercion between kinds
assert_equal(promote_func(b, i32), np.dtype(np.int32))
assert_equal(promote_func(b, u8), np.dtype(np.uint8))
assert_equal(promote_func(i8, u8), np.dtype(np.int16))
assert_equal(promote_func(u8, i32), np.dtype(np.int32))
assert_equal(promote_func(i64, u32), np.dtype(np.int64))
assert_equal(promote_func(u64, i32), np.dtype(np.float64))
assert_equal(promote_func(i32, f32), np.dtype(np.float64))
assert_equal(promote_func(i64, f32), np.dtype(np.float64))
assert_equal(promote_func(f32, i16), np.dtype(np.float32))
assert_equal(promote_func(f32, u32), np.dtype(np.float64))
assert_equal(promote_func(f32, c64), np.dtype(np.complex64))
assert_equal(promote_func(c128, f32), np.dtype(np.complex128))
assert_equal(promote_func(cld, f64), np.dtype(np.clongdouble))
# coercion between scalars and 1-D arrays
assert_equal(promote_func(np.array([b]), i8), np.dtype(np.int8))
assert_equal(promote_func(np.array([b]), u8), np.dtype(np.uint8))
assert_equal(promote_func(np.array([b]), i32), np.dtype(np.int32))
assert_equal(promote_func(np.array([b]), u32), np.dtype(np.uint32))
assert_equal(promote_func(np.array([i8]), i64), np.dtype(np.int8))
assert_equal(promote_func(u64, np.array([i32])), np.dtype(np.int32))
assert_equal(promote_func(i64, np.array([u32])), np.dtype(np.uint32))
assert_equal(promote_func(np.int32(-1), np.array([u64])),
np.dtype(np.float64))
assert_equal(promote_func(f64, np.array([f32])), np.dtype(np.float32))
assert_equal(promote_func(fld, np.array([f32])), np.dtype(np.float32))
assert_equal(promote_func(np.array([f64]), fld), np.dtype(np.float64))
assert_equal(promote_func(fld, np.array([c64])),
np.dtype(np.complex64))
assert_equal(promote_func(c64, np.array([f64])),
np.dtype(np.complex128))
assert_equal(promote_func(np.complex64(3j), np.array([f64])),
np.dtype(np.complex128))
# coercion between scalars and 1-D arrays, where
# the scalar has greater kind than the array
assert_equal(promote_func(np.array([b]), f64), np.dtype(np.float64))
assert_equal(promote_func(np.array([b]), i64), np.dtype(np.int64))
assert_equal(promote_func(np.array([b]), u64), np.dtype(np.uint64))
assert_equal(promote_func(np.array([i8]), f64), np.dtype(np.float64))
assert_equal(promote_func(np.array([u16]), f64), np.dtype(np.float64))
# uint and int are treated as the same "kind" for
# the purposes of array-scalar promotion.
assert_equal(promote_func(np.array([u16]), i32), np.dtype(np.uint16))
# float and complex are treated as the same "kind" for
# the purposes of array-scalar promotion, so that you can do
# (0j + float32array) to get a complex64 array instead of
# a complex128 array.
assert_equal(promote_func(np.array([f32]), c128),
np.dtype(np.complex64))
def test_coercion(self):
def res_type(a, b):
return np.add(a, b).dtype
self.check_promotion_cases(res_type)
# Use-case: float/complex scalar * bool/int8 array
# shouldn't narrow the float/complex type
for a in [np.array([True, False]), np.array([-3, 12], dtype=np.int8)]:
b = 1.234 * a
assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
b = np.longdouble(1.234) * a
assert_equal(b.dtype, np.dtype(np.longdouble),
"array type %s" % a.dtype)
b = np.float64(1.234) * a
assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
b = np.float32(1.234) * a
assert_equal(b.dtype, np.dtype('f4'), "array type %s" % a.dtype)
b = np.float16(1.234) * a
assert_equal(b.dtype, np.dtype('f2'), "array type %s" % a.dtype)
b = 1.234j * a
assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
b = np.clongdouble(1.234j) * a
assert_equal(b.dtype, np.dtype(np.clongdouble),
"array type %s" % a.dtype)
b = np.complex128(1.234j) * a
assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
b = np.complex64(1.234j) * a
assert_equal(b.dtype, np.dtype('c8'), "array type %s" % a.dtype)
# The following use-case is problematic, and to resolve its
# tricky side-effects requires more changes.
#
# Use-case: (1-t)*a, where 't' is a boolean array and 'a' is
# a float32, shouldn't promote to float64
#
# a = np.array([1.0, 1.5], dtype=np.float32)
# t = np.array([True, False])
# b = t*a
# assert_equal(b, [1.0, 0.0])
# assert_equal(b.dtype, np.dtype('f4'))
# b = (1-t)*a
# assert_equal(b, [0.0, 1.5])
# assert_equal(b.dtype, np.dtype('f4'))
#
# Probably ~t (bitwise negation) is more proper to use here,
# but this is arguably less intuitive to understand at a glance, and
# would fail if 't' is actually an integer array instead of boolean:
#
# b = (~t)*a
# assert_equal(b, [0.0, 1.5])
# assert_equal(b.dtype, np.dtype('f4'))
def test_result_type(self):
self.check_promotion_cases(np.result_type)
assert_(np.result_type(None) == np.dtype(None))
def test_promote_types_endian(self):
# promote_types should always return native-endian types
assert_equal(np.promote_types('<i8', '<i8'), np.dtype('i8'))
assert_equal(np.promote_types('>i8', '>i8'), np.dtype('i8'))
with pytest.warns(FutureWarning,
match="Promotion of numbers and bools to strings"):
assert_equal(np.promote_types('>i8', '>U16'), np.dtype('U21'))
assert_equal(np.promote_types('<i8', '<U16'), np.dtype('U21'))
assert_equal(np.promote_types('>U16', '>i8'), np.dtype('U21'))
assert_equal(np.promote_types('<U16', '<i8'), np.dtype('U21'))
assert_equal(np.promote_types('<S5', '<U8'), np.dtype('U8'))
assert_equal(np.promote_types('>S5', '>U8'), np.dtype('U8'))
assert_equal(np.promote_types('<U8', '<S5'), np.dtype('U8'))
assert_equal(np.promote_types('>U8', '>S5'), np.dtype('U8'))
assert_equal(np.promote_types('<U5', '<U8'), np.dtype('U8'))
assert_equal(np.promote_types('>U8', '>U5'), np.dtype('U8'))
assert_equal(np.promote_types('<M8', '<M8'), np.dtype('M8'))
assert_equal(np.promote_types('>M8', '>M8'), np.dtype('M8'))
assert_equal(np.promote_types('<m8', '<m8'), np.dtype('m8'))
assert_equal(np.promote_types('>m8', '>m8'), np.dtype('m8'))
def test_can_cast_and_promote_usertypes(self):
# The rational type defines safe casting for signed integers,
# boolean. Rational itself *does* cast safely to double.
# (rational does not actually cast to all signed integers, e.g.
# int64 can be both long and longlong and it registers only the first)
valid_types = ["int8", "int16", "int32", "int64", "bool"]
invalid_types = "BHILQP" + "FDG" + "mM" + "f" + "V"
rational_dt = np.dtype(rational)
for numpy_dtype in valid_types:
numpy_dtype = np.dtype(numpy_dtype)
assert np.can_cast(numpy_dtype, rational_dt)
assert np.promote_types(numpy_dtype, rational_dt) is rational_dt
for numpy_dtype in invalid_types:
numpy_dtype = np.dtype(numpy_dtype)
assert not np.can_cast(numpy_dtype, rational_dt)
with pytest.raises(TypeError):
np.promote_types(numpy_dtype, rational_dt)
double_dt = np.dtype("double")
assert np.can_cast(rational_dt, double_dt)
assert np.promote_types(double_dt, rational_dt) is double_dt
@pytest.mark.parametrize("swap", ["", "swap"])
@pytest.mark.parametrize("string_dtype", ["U", "S"])
def test_promote_types_strings(self, swap, string_dtype):
if swap == "swap":
promote_types = lambda a, b: np.promote_types(b, a)
else:
promote_types = np.promote_types
S = string_dtype
with pytest.warns(FutureWarning,
match="Promotion of numbers and bools to strings") as record:
# Promote numeric with unsized string:
assert_equal(promote_types('bool', S), np.dtype(S+'5'))
assert_equal(promote_types('b', S), np.dtype(S+'4'))
assert_equal(promote_types('u1', S), np.dtype(S+'3'))
assert_equal(promote_types('u2', S), np.dtype(S+'5'))
assert_equal(promote_types('u4', S), np.dtype(S+'10'))
assert_equal(promote_types('u8', S), np.dtype(S+'20'))
assert_equal(promote_types('i1', S), np.dtype(S+'4'))
assert_equal(promote_types('i2', S), np.dtype(S+'6'))
assert_equal(promote_types('i4', S), np.dtype(S+'11'))
assert_equal(promote_types('i8', S), np.dtype(S+'21'))
# Promote numeric with sized string:
assert_equal(promote_types('bool', S+'1'), np.dtype(S+'5'))
assert_equal(promote_types('bool', S+'30'), np.dtype(S+'30'))
assert_equal(promote_types('b', S+'1'), np.dtype(S+'4'))
assert_equal(promote_types('b', S+'30'), np.dtype(S+'30'))
assert_equal(promote_types('u1', S+'1'), np.dtype(S+'3'))
assert_equal(promote_types('u1', S+'30'), np.dtype(S+'30'))
assert_equal(promote_types('u2', S+'1'), np.dtype(S+'5'))
assert_equal(promote_types('u2', S+'30'), np.dtype(S+'30'))
assert_equal(promote_types('u4', S+'1'), np.dtype(S+'10'))
assert_equal(promote_types('u4', S+'30'), np.dtype(S+'30'))
assert_equal(promote_types('u8', S+'1'), np.dtype(S+'20'))
assert_equal(promote_types('u8', S+'30'), np.dtype(S+'30'))
# Promote with object:
assert_equal(promote_types('O', S+'30'), np.dtype('O'))
assert len(record) == 22 # each string promotion gave one warning
@pytest.mark.parametrize(["dtype1", "dtype2"],
[[np.dtype("V6"), np.dtype("V10")],
[np.dtype([("name1", "i8")]), np.dtype([("name2", "i8")])],
[np.dtype("i8,i8"), np.dtype("i4,i4")],
])
def test_invalid_void_promotion(self, dtype1, dtype2):
# Mainly test structured void promotion, which currently allows
# byte-swapping, but nothing else:
with pytest.raises(TypeError):
np.promote_types(dtype1, dtype2)
@pytest.mark.parametrize(["dtype1", "dtype2"],
[[np.dtype("V10"), np.dtype("V10")],
[np.dtype([("name1", "<i8")]), np.dtype([("name1", ">i8")])],
[np.dtype("i8,i8"), np.dtype("i8,>i8")],
])
def test_valid_void_promotion(self, dtype1, dtype2):
assert np.promote_types(dtype1, dtype2) is dtype1
@pytest.mark.parametrize("dtype",
list(np.typecodes["All"]) +
["i,i", "S3", "S100", "U3", "U100", rational])
def test_promote_identical_types_metadata(self, dtype):
# The same type passed in twice to promote types always
# preserves metadata
metadata = {1: 1}
dtype = np.dtype(dtype, metadata=metadata)
res = np.promote_types(dtype, dtype)
assert res.metadata == dtype.metadata
# byte-swapping preserves and makes the dtype native:
dtype = dtype.newbyteorder()
if dtype.isnative:
# The type does not have byte swapping
return
res = np.promote_types(dtype, dtype)
if res.char in "?bhilqpBHILQPefdgFDGOmM" or dtype.type is rational:
# Metadata is lost for simple promotions (they create a new dtype)
assert res.metadata is None
else:
assert res.metadata == metadata
if dtype.kind != "V":
# the result is native (except for structured void)
assert res.isnative
@pytest.mark.slow
@pytest.mark.filterwarnings('ignore:Promotion of numbers:FutureWarning')
@pytest.mark.parametrize(["dtype1", "dtype2"],
itertools.product(
list(np.typecodes["All"]) +
["i,i", "S3", "S100", "U3", "U100", rational],
repeat=2))
def test_promote_types_metadata(self, dtype1, dtype2):
"""Metadata handling in promotion does not appear formalized
right now in NumPy. This test should thus be considered to
document behaviour, rather than test the correct definition of it.
This test is very ugly, it was useful for rewriting part of the
promotion, but probably should eventually be replaced/deleted
(i.e. when metadata handling in promotion is better defined).
"""
metadata1 = {1: 1}
metadata2 = {2: 2}
dtype1 = np.dtype(dtype1, metadata=metadata1)
dtype2 = np.dtype(dtype2, metadata=metadata2)
try:
res = np.promote_types(dtype1, dtype2)
except TypeError:
# Promotion failed, this test only checks metadata
return
if res.char in "?bhilqpBHILQPefdgFDGOmM" or res.type is rational:
# All simple types lose metadata (due to using promotion table):
assert res.metadata is None
elif res == dtype1:
# If one result is the result, it is usually returned unchanged:
assert res is dtype1
elif res == dtype2:
# dtype1 may have been cast to the same type/kind as dtype2.
# If the resulting dtype is identical we currently pick the cast
# version of dtype1, which lost the metadata:
if np.promote_types(dtype1, dtype2.kind) == dtype2:
res.metadata is None
else:
res.metadata == metadata2
else:
assert res.metadata is None
# Try again for byteswapped version
dtype1 = dtype1.newbyteorder()
assert dtype1.metadata == metadata1
res_bs = np.promote_types(dtype1, dtype2)
if res_bs.names is not None:
# Structured promotion doesn't remove byteswap:
assert res_bs.newbyteorder() == res
else:
assert res_bs == res
assert res_bs.metadata == res.metadata
@pytest.mark.parametrize(["dtype1", "dtype2"],
[[np.dtype("V6"), np.dtype("V10")],
[np.dtype([("name1", "i8")]), np.dtype([("name2", "i8")])],
[np.dtype("i8,i8"), np.dtype("i4,i4")],
])
def test_invalid_void_promotion(self, dtype1, dtype2):
# Mainly test structured void promotion, which currently allows
# byte-swapping, but nothing else:
with pytest.raises(TypeError):
np.promote_types(dtype1, dtype2)
@pytest.mark.parametrize(["dtype1", "dtype2"],
[[np.dtype("V10"), np.dtype("V10")],
[np.dtype([("name1", "<i8")]), np.dtype([("name1", ">i8")])],
[np.dtype("i8,i8"), np.dtype("i8,>i8")],
])
def test_valid_void_promotion(self, dtype1, dtype2):
assert np.promote_types(dtype1, dtype2) is dtype1
def test_can_cast(self):
assert_(np.can_cast(np.int32, np.int64))
assert_(np.can_cast(np.float64, complex))
assert_(not np.can_cast(complex, float))
assert_(np.can_cast('i8', 'f8'))
assert_(not np.can_cast('i8', 'f4'))
assert_(np.can_cast('i4', 'S11'))
assert_(np.can_cast('i8', 'i8', 'no'))
assert_(not np.can_cast('<i8', '>i8', 'no'))
assert_(np.can_cast('<i8', '>i8', 'equiv'))
assert_(not np.can_cast('<i4', '>i8', 'equiv'))
assert_(np.can_cast('<i4', '>i8', 'safe'))
assert_(not np.can_cast('<i8', '>i4', 'safe'))
assert_(np.can_cast('<i8', '>i4', 'same_kind'))
assert_(not np.can_cast('<i8', '>u4', 'same_kind'))
assert_(np.can_cast('<i8', '>u4', 'unsafe'))
assert_(np.can_cast('bool', 'S5'))
assert_(not np.can_cast('bool', 'S4'))
assert_(np.can_cast('b', 'S4'))
assert_(not np.can_cast('b', 'S3'))
assert_(np.can_cast('u1', 'S3'))
assert_(not np.can_cast('u1', 'S2'))
assert_(np.can_cast('u2', 'S5'))
assert_(not np.can_cast('u2', 'S4'))
assert_(np.can_cast('u4', 'S10'))
assert_(not np.can_cast('u4', 'S9'))
assert_(np.can_cast('u8', 'S20'))
assert_(not np.can_cast('u8', 'S19'))
assert_(np.can_cast('i1', 'S4'))
assert_(not np.can_cast('i1', 'S3'))
assert_(np.can_cast('i2', 'S6'))
assert_(not np.can_cast('i2', 'S5'))
assert_(np.can_cast('i4', 'S11'))
assert_(not np.can_cast('i4', 'S10'))
assert_(np.can_cast('i8', 'S21'))
assert_(not np.can_cast('i8', 'S20'))
assert_(np.can_cast('bool', 'S5'))
assert_(not np.can_cast('bool', 'S4'))
assert_(np.can_cast('b', 'U4'))
assert_(not np.can_cast('b', 'U3'))
assert_(np.can_cast('u1', 'U3'))
assert_(not np.can_cast('u1', 'U2'))
assert_(np.can_cast('u2', 'U5'))
assert_(not np.can_cast('u2', 'U4'))
assert_(np.can_cast('u4', 'U10'))
assert_(not np.can_cast('u4', 'U9'))
assert_(np.can_cast('u8', 'U20'))
assert_(not np.can_cast('u8', 'U19'))
assert_(np.can_cast('i1', 'U4'))
assert_(not np.can_cast('i1', 'U3'))
assert_(np.can_cast('i2', 'U6'))
assert_(not np.can_cast('i2', 'U5'))
assert_(np.can_cast('i4', 'U11'))
assert_(not np.can_cast('i4', 'U10'))
assert_(np.can_cast('i8', 'U21'))
assert_(not np.can_cast('i8', 'U20'))
assert_raises(TypeError, np.can_cast, 'i4', None)
assert_raises(TypeError, np.can_cast, None, 'i4')
# Also test keyword arguments
assert_(np.can_cast(from_=np.int32, to=np.int64))
def test_can_cast_simple_to_structured(self):
# Non-structured can only be cast to structured in 'unsafe' mode.
assert_(not np.can_cast('i4', 'i4,i4'))
assert_(not np.can_cast('i4', 'i4,i2'))
assert_(np.can_cast('i4', 'i4,i4', casting='unsafe'))
assert_(np.can_cast('i4', 'i4,i2', casting='unsafe'))
# Even if there is just a single field which is OK.
assert_(not np.can_cast('i2', [('f1', 'i4')]))
assert_(not np.can_cast('i2', [('f1', 'i4')], casting='same_kind'))
assert_(np.can_cast('i2', [('f1', 'i4')], casting='unsafe'))
# It should be the same for recursive structured or subarrays.
assert_(not np.can_cast('i2', [('f1', 'i4,i4')]))
assert_(np.can_cast('i2', [('f1', 'i4,i4')], casting='unsafe'))
assert_(not np.can_cast('i2', [('f1', '(2,3)i4')]))
assert_(np.can_cast('i2', [('f1', '(2,3)i4')], casting='unsafe'))
def test_can_cast_structured_to_simple(self):
# Need unsafe casting for structured to simple.
assert_(not np.can_cast([('f1', 'i4')], 'i4'))
assert_(np.can_cast([('f1', 'i4')], 'i4', casting='unsafe'))
assert_(np.can_cast([('f1', 'i4')], 'i2', casting='unsafe'))
# Since it is unclear what is being cast, multiple fields to
# single should not work even for unsafe casting.
assert_(not np.can_cast('i4,i4', 'i4', casting='unsafe'))
# But a single field inside a single field is OK.
assert_(not np.can_cast([('f1', [('x', 'i4')])], 'i4'))
assert_(np.can_cast([('f1', [('x', 'i4')])], 'i4', casting='unsafe'))
# And a subarray is fine too - it will just take the first element
# (arguably not very consistently; might also take the first field).
assert_(not np.can_cast([('f0', '(3,)i4')], 'i4'))
assert_(np.can_cast([('f0', '(3,)i4')], 'i4', casting='unsafe'))
# But a structured subarray with multiple fields should fail.
assert_(not np.can_cast([('f0', ('i4,i4'), (2,))], 'i4',
casting='unsafe'))
def test_can_cast_values(self):
# gh-5917
for dt in np.sctypes['int'] + np.sctypes['uint']:
ii = np.iinfo(dt)
assert_(np.can_cast(ii.min, dt))
assert_(np.can_cast(ii.max, dt))
assert_(not np.can_cast(ii.min - 1, dt))
assert_(not np.can_cast(ii.max + 1, dt))
for dt in np.sctypes['float']:
fi = np.finfo(dt)
assert_(np.can_cast(fi.min, dt))
assert_(np.can_cast(fi.max, dt))
# Custom exception class to test exception propagation in fromiter
class NIterError(Exception):
pass
class TestFromiter:
def makegen(self):
return (x**2 for x in range(24))
def test_types(self):
ai32 = np.fromiter(self.makegen(), np.int32)
ai64 = np.fromiter(self.makegen(), np.int64)
af = np.fromiter(self.makegen(), float)
assert_(ai32.dtype == np.dtype(np.int32))
assert_(ai64.dtype == np.dtype(np.int64))
assert_(af.dtype == np.dtype(float))
def test_lengths(self):
expected = np.array(list(self.makegen()))
a = np.fromiter(self.makegen(), int)
a20 = np.fromiter(self.makegen(), int, 20)
assert_(len(a) == len(expected))
assert_(len(a20) == 20)
assert_raises(ValueError, np.fromiter,
self.makegen(), int, len(expected) + 10)
def test_values(self):
expected = np.array(list(self.makegen()))
a = np.fromiter(self.makegen(), int)
a20 = np.fromiter(self.makegen(), int, 20)
assert_(np.alltrue(a == expected, axis=0))
assert_(np.alltrue(a20 == expected[:20], axis=0))
def load_data(self, n, eindex):
# Utility method for the issue 2592 tests.
# Raise an exception at the desired index in the iterator.
for e in range(n):
if e == eindex:
raise NIterError('error at index %s' % eindex)
yield e
def test_2592(self):
# Test iteration exceptions are correctly raised.
count, eindex = 10, 5
assert_raises(NIterError, np.fromiter,
self.load_data(count, eindex), dtype=int, count=count)
def test_2592_edge(self):
# Test iter. exceptions, edge case (exception at end of iterator).
count = 10
eindex = count-1
assert_raises(NIterError, np.fromiter,
self.load_data(count, eindex), dtype=int, count=count)
class TestNonzero:
def test_nonzero_trivial(self):
assert_equal(np.count_nonzero(np.array([])), 0)
assert_equal(np.count_nonzero(np.array([], dtype='?')), 0)
assert_equal(np.nonzero(np.array([])), ([],))
assert_equal(np.count_nonzero(np.array([0])), 0)
assert_equal(np.count_nonzero(np.array([0], dtype='?')), 0)
assert_equal(np.nonzero(np.array([0])), ([],))
assert_equal(np.count_nonzero(np.array([1])), 1)
assert_equal(np.count_nonzero(np.array([1], dtype='?')), 1)
assert_equal(np.nonzero(np.array([1])), ([0],))
def test_nonzero_zerod(self):
assert_equal(np.count_nonzero(np.array(0)), 0)
assert_equal(np.count_nonzero(np.array(0, dtype='?')), 0)
with assert_warns(DeprecationWarning):
assert_equal(np.nonzero(np.array(0)), ([],))
assert_equal(np.count_nonzero(np.array(1)), 1)
assert_equal(np.count_nonzero(np.array(1, dtype='?')), 1)
with assert_warns(DeprecationWarning):
assert_equal(np.nonzero(np.array(1)), ([0],))
def test_nonzero_onedim(self):
x = np.array([1, 0, 2, -1, 0, 0, 8])
assert_equal(np.count_nonzero(x), 4)
assert_equal(np.count_nonzero(x), 4)
assert_equal(np.nonzero(x), ([0, 2, 3, 6],))
# x = np.array([(1, 2), (0, 0), (1, 1), (-1, 3), (0, 7)],
# dtype=[('a', 'i4'), ('b', 'i2')])
x = np.array([(1, 2, -5, -3), (0, 0, 2, 7), (1, 1, 0, 1), (-1, 3, 1, 0), (0, 7, 0, 4)],
dtype=[('a', 'i4'), ('b', 'i2'), ('c', 'i1'), ('d', 'i8')])
assert_equal(np.count_nonzero(x['a']), 3)
assert_equal(np.count_nonzero(x['b']), 4)
assert_equal(np.count_nonzero(x['c']), 3)
assert_equal(np.count_nonzero(x['d']), 4)
assert_equal(np.nonzero(x['a']), ([0, 2, 3],))
assert_equal(np.nonzero(x['b']), ([0, 2, 3, 4],))
def test_nonzero_twodim(self):
x = np.array([[0, 1, 0], [2, 0, 3]])
assert_equal(np.count_nonzero(x.astype('i1')), 3)
assert_equal(np.count_nonzero(x.astype('i2')), 3)
assert_equal(np.count_nonzero(x.astype('i4')), 3)
assert_equal(np.count_nonzero(x.astype('i8')), 3)
assert_equal(np.nonzero(x), ([0, 1, 1], [1, 0, 2]))
x = np.eye(3)
assert_equal(np.count_nonzero(x.astype('i1')), 3)
assert_equal(np.count_nonzero(x.astype('i2')), 3)
assert_equal(np.count_nonzero(x.astype('i4')), 3)
assert_equal(np.count_nonzero(x.astype('i8')), 3)
assert_equal(np.nonzero(x), ([0, 1, 2], [0, 1, 2]))
x = np.array([[(0, 1), (0, 0), (1, 11)],
[(1, 1), (1, 0), (0, 0)],
[(0, 0), (1, 5), (0, 1)]], dtype=[('a', 'f4'), ('b', 'u1')])
assert_equal(np.count_nonzero(x['a']), 4)
assert_equal(np.count_nonzero(x['b']), 5)
assert_equal(np.nonzero(x['a']), ([0, 1, 1, 2], [2, 0, 1, 1]))
assert_equal(np.nonzero(x['b']), ([0, 0, 1, 2, 2], [0, 2, 0, 1, 2]))
assert_(not x['a'].T.flags.aligned)
assert_equal(np.count_nonzero(x['a'].T), 4)
assert_equal(np.count_nonzero(x['b'].T), 5)
assert_equal(np.nonzero(x['a'].T), ([0, 1, 1, 2], [1, 1, 2, 0]))
assert_equal(np.nonzero(x['b'].T), ([0, 0, 1, 2, 2], [0, 1, 2, 0, 2]))
def test_sparse(self):
# test special sparse condition boolean code path
for i in range(20):
c = np.zeros(200, dtype=bool)
c[i::20] = True
assert_equal(np.nonzero(c)[0], np.arange(i, 200 + i, 20))
c = np.zeros(400, dtype=bool)
c[10 + i:20 + i] = True
c[20 + i*2] = True
assert_equal(np.nonzero(c)[0],
np.concatenate((np.arange(10 + i, 20 + i), [20 + i*2])))
def test_return_type(self):
class C(np.ndarray):
pass
for view in (C, np.ndarray):
for nd in range(1, 4):
shape = tuple(range(2, 2+nd))
x = np.arange(np.prod(shape)).reshape(shape).view(view)
for nzx in (np.nonzero(x), x.nonzero()):
for nzx_i in nzx:
assert_(type(nzx_i) is np.ndarray)
assert_(nzx_i.flags.writeable)
def test_count_nonzero_axis(self):
# Basic check of functionality
m = np.array([[0, 1, 7, 0, 0], [3, 0, 0, 2, 19]])
expected = np.array([1, 1, 1, 1, 1])
assert_equal(np.count_nonzero(m, axis=0), expected)
expected = np.array([2, 3])
assert_equal(np.count_nonzero(m, axis=1), expected)
assert_raises(ValueError, np.count_nonzero, m, axis=(1, 1))
assert_raises(TypeError, np.count_nonzero, m, axis='foo')
assert_raises(np.AxisError, np.count_nonzero, m, axis=3)
assert_raises(TypeError, np.count_nonzero,
m, axis=np.array([[1], [2]]))
def test_count_nonzero_axis_all_dtypes(self):
# More thorough test that the axis argument is respected
# for all dtypes and responds correctly when presented with
# either integer or tuple arguments for axis
msg = "Mismatch for dtype: %s"
def assert_equal_w_dt(a, b, err_msg):
assert_equal(a.dtype, b.dtype, err_msg=err_msg)
assert_equal(a, b, err_msg=err_msg)
for dt in np.typecodes['All']:
err_msg = msg % (np.dtype(dt).name,)
if dt != 'V':
if dt != 'M':
m = np.zeros((3, 3), dtype=dt)
n = np.ones(1, dtype=dt)
m[0, 0] = n[0]
m[1, 0] = n[0]
else: # np.zeros doesn't work for np.datetime64
m = np.array(['1970-01-01'] * 9)
m = m.reshape((3, 3))
m[0, 0] = '1970-01-12'
m[1, 0] = '1970-01-12'
m = m.astype(dt)
expected = np.array([2, 0, 0], dtype=np.intp)
assert_equal_w_dt(np.count_nonzero(m, axis=0),
expected, err_msg=err_msg)
expected = np.array([1, 1, 0], dtype=np.intp)
assert_equal_w_dt(np.count_nonzero(m, axis=1),
expected, err_msg=err_msg)
expected = np.array(2)
assert_equal(np.count_nonzero(m, axis=(0, 1)),
expected, err_msg=err_msg)
assert_equal(np.count_nonzero(m, axis=None),
expected, err_msg=err_msg)
assert_equal(np.count_nonzero(m),
expected, err_msg=err_msg)
if dt == 'V':
# There are no 'nonzero' objects for np.void, so the testing
# setup is slightly different for this dtype
m = np.array([np.void(1)] * 6).reshape((2, 3))
expected = np.array([0, 0, 0], dtype=np.intp)
assert_equal_w_dt(np.count_nonzero(m, axis=0),
expected, err_msg=err_msg)
expected = np.array([0, 0], dtype=np.intp)
assert_equal_w_dt(np.count_nonzero(m, axis=1),
expected, err_msg=err_msg)
expected = np.array(0)
assert_equal(np.count_nonzero(m, axis=(0, 1)),
expected, err_msg=err_msg)
assert_equal(np.count_nonzero(m, axis=None),
expected, err_msg=err_msg)
assert_equal(np.count_nonzero(m),
expected, err_msg=err_msg)
def test_count_nonzero_axis_consistent(self):
# Check that the axis behaviour for valid axes in
# non-special cases is consistent (and therefore
# correct) by checking it against an integer array
# that is then casted to the generic object dtype
from itertools import combinations, permutations
axis = (0, 1, 2, 3)
size = (5, 5, 5, 5)
msg = "Mismatch for axis: %s"
rng = np.random.RandomState(1234)
m = rng.randint(-100, 100, size=size)
n = m.astype(object)
for length in range(len(axis)):
for combo in combinations(axis, length):
for perm in permutations(combo):
assert_equal(
np.count_nonzero(m, axis=perm),
np.count_nonzero(n, axis=perm),
err_msg=msg % (perm,))
def test_countnonzero_axis_empty(self):
a = np.array([[0, 0, 1], [1, 0, 1]])
assert_equal(np.count_nonzero(a, axis=()), a.astype(bool))
def test_countnonzero_keepdims(self):
a = np.array([[0, 0, 1, 0],
[0, 3, 5, 0],
[7, 9, 2, 0]])
assert_equal(np.count_nonzero(a, axis=0, keepdims=True),
[[1, 2, 3, 0]])
assert_equal(np.count_nonzero(a, axis=1, keepdims=True),
[[1], [2], [3]])
assert_equal(np.count_nonzero(a, keepdims=True),
[[6]])
def test_array_method(self):
# Tests that the array method
# call to nonzero works
m = np.array([[1, 0, 0], [4, 0, 6]])
tgt = [[0, 1, 1], [0, 0, 2]]
assert_equal(m.nonzero(), tgt)
def test_nonzero_invalid_object(self):
# gh-9295
a = np.array([np.array([1, 2]), 3], dtype=object)
assert_raises(ValueError, np.nonzero, a)
class BoolErrors:
def __bool__(self):
raise ValueError("Not allowed")
assert_raises(ValueError, np.nonzero, np.array([BoolErrors()]))
def test_nonzero_sideeffect_safety(self):
# gh-13631
class FalseThenTrue:
_val = False
def __bool__(self):
try:
return self._val
finally:
self._val = True
class TrueThenFalse:
_val = True
def __bool__(self):
try:
return self._val
finally:
self._val = False
# result grows on the second pass
a = np.array([True, FalseThenTrue()])
assert_raises(RuntimeError, np.nonzero, a)
a = np.array([[True], [FalseThenTrue()]])
assert_raises(RuntimeError, np.nonzero, a)
# result shrinks on the second pass
a = np.array([False, TrueThenFalse()])
assert_raises(RuntimeError, np.nonzero, a)
a = np.array([[False], [TrueThenFalse()]])
assert_raises(RuntimeError, np.nonzero, a)
def test_nonzero_exception_safe(self):
# gh-13930
class ThrowsAfter:
def __init__(self, iters):
self.iters_left = iters
def __bool__(self):
if self.iters_left == 0:
raise ValueError("called `iters` times")
self.iters_left -= 1
return True
"""
Test that a ValueError is raised instead of a SystemError
If the __bool__ function is called after the error state is set,
Python (cpython) will raise a SystemError.
"""
# assert that an exception in first pass is handled correctly
a = np.array([ThrowsAfter(5)]*10)
assert_raises(ValueError, np.nonzero, a)
# raise exception in second pass for 1-dimensional loop
a = np.array([ThrowsAfter(15)]*10)
assert_raises(ValueError, np.nonzero, a)
# raise exception in second pass for n-dimensional loop
a = np.array([[ThrowsAfter(15)]]*10)
assert_raises(ValueError, np.nonzero, a)
class TestIndex:
def test_boolean(self):
a = rand(3, 5, 8)
V = rand(5, 8)
g1 = randint(0, 5, size=15)
g2 = randint(0, 8, size=15)
V[g1, g2] = -V[g1, g2]
assert_((np.array([a[0][V > 0], a[1][V > 0], a[2][V > 0]]) == a[:, V > 0]).all())
def test_boolean_edgecase(self):
a = np.array([], dtype='int32')
b = np.array([], dtype='bool')
c = a[b]
assert_equal(c, [])
assert_equal(c.dtype, np.dtype('int32'))
class TestBinaryRepr:
def test_zero(self):
assert_equal(np.binary_repr(0), '0')
def test_positive(self):
assert_equal(np.binary_repr(10), '1010')
assert_equal(np.binary_repr(12522),
'11000011101010')
assert_equal(np.binary_repr(10736848),
'101000111101010011010000')
def test_negative(self):
assert_equal(np.binary_repr(-1), '-1')
assert_equal(np.binary_repr(-10), '-1010')
assert_equal(np.binary_repr(-12522),
'-11000011101010')
assert_equal(np.binary_repr(-10736848),
'-101000111101010011010000')
def test_sufficient_width(self):
assert_equal(np.binary_repr(0, width=5), '00000')
assert_equal(np.binary_repr(10, width=7), '0001010')
assert_equal(np.binary_repr(-5, width=7), '1111011')
def test_neg_width_boundaries(self):
# see gh-8670
# Ensure that the example in the issue does not
# break before proceeding to a more thorough test.
assert_equal(np.binary_repr(-128, width=8), '10000000')
for width in range(1, 11):
num = -2**(width - 1)
exp = '1' + (width - 1) * '0'
assert_equal(np.binary_repr(num, width=width), exp)
def test_large_neg_int64(self):
# See gh-14289.
assert_equal(np.binary_repr(np.int64(-2**62), width=64),
'11' + '0'*62)
class TestBaseRepr:
def test_base3(self):
assert_equal(np.base_repr(3**5, 3), '100000')
def test_positive(self):
assert_equal(np.base_repr(12, 10), '12')
assert_equal(np.base_repr(12, 10, 4), '000012')
assert_equal(np.base_repr(12, 4), '30')
assert_equal(np.base_repr(3731624803700888, 36), '10QR0ROFCEW')
def test_negative(self):
assert_equal(np.base_repr(-12, 10), '-12')
assert_equal(np.base_repr(-12, 10, 4), '-000012')
assert_equal(np.base_repr(-12, 4), '-30')
def test_base_range(self):
with assert_raises(ValueError):
np.base_repr(1, 1)
with assert_raises(ValueError):
np.base_repr(1, 37)
class TestArrayComparisons:
def test_array_equal(self):
res = np.array_equal(np.array([1, 2]), np.array([1, 2]))
assert_(res)
assert_(type(res) is bool)
res = np.array_equal(np.array([1, 2]), np.array([1, 2, 3]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equal(np.array([1, 2]), np.array([3, 4]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equal(np.array([1, 2]), np.array([1, 3]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equal(np.array(['a'], dtype='S1'), np.array(['a'], dtype='S1'))
assert_(res)
assert_(type(res) is bool)
res = np.array_equal(np.array([('a', 1)], dtype='S1,u4'),
np.array([('a', 1)], dtype='S1,u4'))
assert_(res)
assert_(type(res) is bool)
def test_array_equal_equal_nan(self):
# Test array_equal with equal_nan kwarg
a1 = np.array([1, 2, np.nan])
a2 = np.array([1, np.nan, 2])
a3 = np.array([1, 2, np.inf])
# equal_nan=False by default
assert_(not np.array_equal(a1, a1))
assert_(np.array_equal(a1, a1, equal_nan=True))
assert_(not np.array_equal(a1, a2, equal_nan=True))
# nan's not conflated with inf's
assert_(not np.array_equal(a1, a3, equal_nan=True))
# 0-D arrays
a = np.array(np.nan)
assert_(not np.array_equal(a, a))
assert_(np.array_equal(a, a, equal_nan=True))
# Non-float dtype - equal_nan should have no effect
a = np.array([1, 2, 3], dtype=int)
assert_(np.array_equal(a, a))
assert_(np.array_equal(a, a, equal_nan=True))
# Multi-dimensional array
a = np.array([[0, 1], [np.nan, 1]])
assert_(not np.array_equal(a, a))
assert_(np.array_equal(a, a, equal_nan=True))
# Complex values
a, b = [np.array([1 + 1j])]*2
a.real, b.imag = np.nan, np.nan
assert_(not np.array_equal(a, b, equal_nan=False))
assert_(np.array_equal(a, b, equal_nan=True))
def test_none_compares_elementwise(self):
a = np.array([None, 1, None], dtype=object)
assert_equal(a == None, [True, False, True])
assert_equal(a != None, [False, True, False])
a = np.ones(3)
assert_equal(a == None, [False, False, False])
assert_equal(a != None, [True, True, True])
def test_array_equiv(self):
res = np.array_equiv(np.array([1, 2]), np.array([1, 2]))
assert_(res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([1, 2, 3]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([3, 4]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([1, 3]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 1]), np.array([1]))
assert_(res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 1]), np.array([[1], [1]]))
assert_(res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([2]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([[1], [2]]))
assert_(not res)
assert_(type(res) is bool)
res = np.array_equiv(np.array([1, 2]), np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
assert_(not res)
assert_(type(res) is bool)
def assert_array_strict_equal(x, y):
assert_array_equal(x, y)
# Check flags, 32 bit arches typically don't provide 16 byte alignment
if ((x.dtype.alignment <= 8 or
np.intp().dtype.itemsize != 4) and
sys.platform != 'win32'):
assert_(x.flags == y.flags)
else:
assert_(x.flags.owndata == y.flags.owndata)
assert_(x.flags.writeable == y.flags.writeable)
assert_(x.flags.c_contiguous == y.flags.c_contiguous)
assert_(x.flags.f_contiguous == y.flags.f_contiguous)
assert_(x.flags.writebackifcopy == y.flags.writebackifcopy)
# check endianness
assert_(x.dtype.isnative == y.dtype.isnative)
class TestClip:
def setup(self):
self.nr = 5
self.nc = 3
def fastclip(self, a, m, M, out=None, casting=None):
if out is None:
if casting is None:
return a.clip(m, M)
else:
return a.clip(m, M, casting=casting)
else:
if casting is None:
return a.clip(m, M, out)
else:
return a.clip(m, M, out, casting=casting)
def clip(self, a, m, M, out=None):
# use slow-clip
selector = np.less(a, m) + 2*np.greater(a, M)
return selector.choose((a, m, M), out=out)
# Handy functions
def _generate_data(self, n, m):
return randn(n, m)
def _generate_data_complex(self, n, m):
return randn(n, m) + 1.j * rand(n, m)
def _generate_flt_data(self, n, m):
return (randn(n, m)).astype(np.float32)
def _neg_byteorder(self, a):
a = np.asarray(a)
if sys.byteorder == 'little':
a = a.astype(a.dtype.newbyteorder('>'))
else:
a = a.astype(a.dtype.newbyteorder('<'))
return a
def _generate_non_native_data(self, n, m):
data = randn(n, m)
data = self._neg_byteorder(data)
assert_(not data.dtype.isnative)
return data
def _generate_int_data(self, n, m):
return (10 * rand(n, m)).astype(np.int64)
def _generate_int32_data(self, n, m):
return (10 * rand(n, m)).astype(np.int32)
# Now the real test cases
@pytest.mark.parametrize("dtype", '?bhilqpBHILQPefdgFDGO')
def test_ones_pathological(self, dtype):
# for preservation of behavior described in
# gh-12519; amin > amax behavior may still change
# in the future
arr = np.ones(10, dtype=dtype)
expected = np.zeros(10, dtype=dtype)
actual = np.clip(arr, 1, 0)
if dtype == 'O':
assert actual.tolist() == expected.tolist()
else:
assert_equal(actual, expected)
def test_simple_double(self):
# Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = 0.1
M = 0.6
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_simple_int(self):
# Test native int input with scalar min/max.
a = self._generate_int_data(self.nr, self.nc)
a = a.astype(int)
m = -2
M = 4
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_array_double(self):
# Test native double input with array min/max.
a = self._generate_data(self.nr, self.nc)
m = np.zeros(a.shape)
M = m + 0.5
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_simple_nonnative(self):
# Test non native double input with scalar min/max.
# Test native double input with non native double scalar min/max.
a = self._generate_non_native_data(self.nr, self.nc)
m = -0.5
M = 0.6
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_equal(ac, act)
# Test native double input with non native double scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = self._neg_byteorder(0.6)
assert_(not M.dtype.isnative)
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_equal(ac, act)
def test_simple_complex(self):
# Test native complex input with native double scalar min/max.
# Test native input with complex double scalar min/max.
a = 3 * self._generate_data_complex(self.nr, self.nc)
m = -0.5
M = 1.
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
# Test native input with complex double scalar min/max.
a = 3 * self._generate_data(self.nr, self.nc)
m = -0.5 + 1.j
M = 1. + 2.j
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_clip_complex(self):
# Address Issue gh-5354 for clipping complex arrays
# Test native complex input without explicit min/max
# ie, either min=None or max=None
a = np.ones(10, dtype=complex)
m = a.min()
M = a.max()
am = self.fastclip(a, m, None)
aM = self.fastclip(a, None, M)
assert_array_strict_equal(am, a)
assert_array_strict_equal(aM, a)
def test_clip_non_contig(self):
# Test clip for non contiguous native input and native scalar min/max.
a = self._generate_data(self.nr * 2, self.nc * 3)
a = a[::2, ::3]
assert_(not a.flags['F_CONTIGUOUS'])
assert_(not a.flags['C_CONTIGUOUS'])
ac = self.fastclip(a, -1.6, 1.7)
act = self.clip(a, -1.6, 1.7)
assert_array_strict_equal(ac, act)
def test_simple_out(self):
# Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
ac = np.zeros(a.shape)
act = np.zeros(a.shape)
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
@pytest.mark.parametrize("casting", [None, "unsafe"])
def test_simple_int32_inout(self, casting):
# Test native int32 input with double min/max and int32 out.
a = self._generate_int32_data(self.nr, self.nc)
m = np.float64(0)
M = np.float64(2)
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
if casting is None:
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac, casting=casting)
else:
# explicitly passing "unsafe" will silence warning
self.fastclip(a, m, M, ac, casting=casting)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_simple_int64_out(self):
# Test native int32 input with int32 scalar min/max and int64 out.
a = self._generate_int32_data(self.nr, self.nc)
m = np.int32(-1)
M = np.int32(1)
ac = np.zeros(a.shape, dtype=np.int64)
act = ac.copy()
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_simple_int64_inout(self):
# Test native int32 input with double array min/max and int32 out.
a = self._generate_int32_data(self.nr, self.nc)
m = np.zeros(a.shape, np.float64)
M = np.float64(1)
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_simple_int32_out(self):
# Test native double input with scalar min/max and int out.
a = self._generate_data(self.nr, self.nc)
m = -1.0
M = 2.0
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_simple_inplace_01(self):
# Test native double input with array min/max in-place.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = np.zeros(a.shape)
M = 1.0
self.fastclip(a, m, M, a)
self.clip(a, m, M, ac)
assert_array_strict_equal(a, ac)
def test_simple_inplace_02(self):
# Test native double input with scalar min/max in-place.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
M = 0.6
self.fastclip(a, m, M, a)
self.clip(ac, m, M, ac)
assert_array_strict_equal(a, ac)
def test_noncontig_inplace(self):
# Test non contiguous double input with double scalar min/max in-place.
a = self._generate_data(self.nr * 2, self.nc * 3)
a = a[::2, ::3]
assert_(not a.flags['F_CONTIGUOUS'])
assert_(not a.flags['C_CONTIGUOUS'])
ac = a.copy()
m = -0.5
M = 0.6
self.fastclip(a, m, M, a)
self.clip(ac, m, M, ac)
assert_array_equal(a, ac)
def test_type_cast_01(self):
# Test native double input with scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_type_cast_02(self):
# Test native int32 input with int32 scalar min/max.
a = self._generate_int_data(self.nr, self.nc)
a = a.astype(np.int32)
m = -2
M = 4
ac = self.fastclip(a, m, M)
act = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_type_cast_03(self):
# Test native int32 input with float64 scalar min/max.
a = self._generate_int32_data(self.nr, self.nc)
m = -2
M = 4
ac = self.fastclip(a, np.float64(m), np.float64(M))
act = self.clip(a, np.float64(m), np.float64(M))
assert_array_strict_equal(ac, act)
def test_type_cast_04(self):
# Test native int32 input with float32 scalar min/max.
a = self._generate_int32_data(self.nr, self.nc)
m = np.float32(-2)
M = np.float32(4)
act = self.fastclip(a, m, M)
ac = self.clip(a, m, M)
assert_array_strict_equal(ac, act)
def test_type_cast_05(self):
# Test native int32 with double arrays min/max.
a = self._generate_int_data(self.nr, self.nc)
m = -0.5
M = 1.
ac = self.fastclip(a, m * np.zeros(a.shape), M)
act = self.clip(a, m * np.zeros(a.shape), M)
assert_array_strict_equal(ac, act)
def test_type_cast_06(self):
# Test native with NON native scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = 0.5
m_s = self._neg_byteorder(m)
M = 1.
act = self.clip(a, m_s, M)
ac = self.fastclip(a, m_s, M)
assert_array_strict_equal(ac, act)
def test_type_cast_07(self):
# Test NON native with native array min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5 * np.ones(a.shape)
M = 1.
a_s = self._neg_byteorder(a)
assert_(not a_s.dtype.isnative)
act = a_s.clip(m, M)
ac = self.fastclip(a_s, m, M)
assert_array_strict_equal(ac, act)
def test_type_cast_08(self):
# Test NON native with native scalar min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 1.
a_s = self._neg_byteorder(a)
assert_(not a_s.dtype.isnative)
ac = self.fastclip(a_s, m, M)
act = a_s.clip(m, M)
assert_array_strict_equal(ac, act)
def test_type_cast_09(self):
# Test native with NON native array min/max.
a = self._generate_data(self.nr, self.nc)
m = -0.5 * np.ones(a.shape)
M = 1.
m_s = self._neg_byteorder(m)
assert_(not m_s.dtype.isnative)
ac = self.fastclip(a, m_s, M)
act = self.clip(a, m_s, M)
assert_array_strict_equal(ac, act)
def test_type_cast_10(self):
# Test native int32 with float min/max and float out for output argument.
a = self._generate_int_data(self.nr, self.nc)
b = np.zeros(a.shape, dtype=np.float32)
m = np.float32(-0.5)
M = np.float32(1)
act = self.clip(a, m, M, out=b)
ac = self.fastclip(a, m, M, out=b)
assert_array_strict_equal(ac, act)
def test_type_cast_11(self):
# Test non native with native scalar, min/max, out non native
a = self._generate_non_native_data(self.nr, self.nc)
b = a.copy()
b = b.astype(b.dtype.newbyteorder('>'))
bt = b.copy()
m = -0.5
M = 1.
self.fastclip(a, m, M, out=b)
self.clip(a, m, M, out=bt)
assert_array_strict_equal(b, bt)
def test_type_cast_12(self):
# Test native int32 input and min/max and float out
a = self._generate_int_data(self.nr, self.nc)
b = np.zeros(a.shape, dtype=np.float32)
m = np.int32(0)
M = np.int32(1)
act = self.clip(a, m, M, out=b)
ac = self.fastclip(a, m, M, out=b)
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple(self):
# Test native double input with scalar min/max
a = self._generate_data(self.nr, self.nc)
m = -0.5
M = 0.6
ac = np.zeros(a.shape)
act = np.zeros(a.shape)
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple2(self):
# Test native int32 input with double min/max and int32 out
a = self._generate_int32_data(self.nr, self.nc)
m = np.float64(0)
M = np.float64(2)
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_clip_with_out_simple_int32(self):
# Test native int32 input with int32 scalar min/max and int64 out
a = self._generate_int32_data(self.nr, self.nc)
m = np.int32(-1)
M = np.int32(1)
ac = np.zeros(a.shape, dtype=np.int64)
act = ac.copy()
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_clip_with_out_array_int32(self):
# Test native int32 input with double array min/max and int32 out
a = self._generate_int32_data(self.nr, self.nc)
m = np.zeros(a.shape, np.float64)
M = np.float64(1)
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_clip_with_out_array_outint32(self):
# Test native double input with scalar min/max and int out
a = self._generate_data(self.nr, self.nc)
m = -1.0
M = 2.0
ac = np.zeros(a.shape, dtype=np.int32)
act = ac.copy()
with assert_warns(DeprecationWarning):
# NumPy 1.17.0, 2018-02-24 - casting is unsafe
self.fastclip(a, m, M, ac)
self.clip(a, m, M, act)
assert_array_strict_equal(ac, act)
def test_clip_with_out_transposed(self):
# Test that the out argument works when transposed
a = np.arange(16).reshape(4, 4)
out = np.empty_like(a).T
a.clip(4, 10, out=out)
expected = self.clip(a, 4, 10)
assert_array_equal(out, expected)
def test_clip_with_out_memory_overlap(self):
# Test that the out argument works when it has memory overlap
a = np.arange(16).reshape(4, 4)
ac = a.copy()
a[:-1].clip(4, 10, out=a[1:])
expected = self.clip(ac[:-1], 4, 10)
assert_array_equal(a[1:], expected)
def test_clip_inplace_array(self):
# Test native double input with array min/max
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = np.zeros(a.shape)
M = 1.0
self.fastclip(a, m, M, a)
self.clip(a, m, M, ac)
assert_array_strict_equal(a, ac)
def test_clip_inplace_simple(self):
# Test native double input with scalar min/max
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
M = 0.6
self.fastclip(a, m, M, a)
self.clip(a, m, M, ac)
assert_array_strict_equal(a, ac)
def test_clip_func_takes_out(self):
# Ensure that the clip() function takes an out=argument.
a = self._generate_data(self.nr, self.nc)
ac = a.copy()
m = -0.5
M = 0.6
a2 = np.clip(a, m, M, out=a)
self.clip(a, m, M, ac)
assert_array_strict_equal(a2, ac)
assert_(a2 is a)
def test_clip_nan(self):
d = np.arange(7.)
with assert_warns(DeprecationWarning):
assert_equal(d.clip(min=np.nan), d)
with assert_warns(DeprecationWarning):
assert_equal(d.clip(max=np.nan), d)
with assert_warns(DeprecationWarning):
assert_equal(d.clip(min=np.nan, max=np.nan), d)
with assert_warns(DeprecationWarning):
assert_equal(d.clip(min=-2, max=np.nan), d)
with assert_warns(DeprecationWarning):
assert_equal(d.clip(min=np.nan, max=10), d)
def test_object_clip(self):
a = np.arange(10, dtype=object)
actual = np.clip(a, 1, 5)
expected = np.array([1, 1, 2, 3, 4, 5, 5, 5, 5, 5])
assert actual.tolist() == expected.tolist()
def test_clip_all_none(self):
a = np.arange(10, dtype=object)
with assert_raises_regex(ValueError, 'max or min'):
np.clip(a, None, None)
def test_clip_invalid_casting(self):
a = np.arange(10, dtype=object)
with assert_raises_regex(ValueError,
'casting must be one of'):
self.fastclip(a, 1, 8, casting="garbage")
@pytest.mark.parametrize("amin, amax", [
# two scalars
(1, 0),
# mix scalar and array
(1, np.zeros(10)),
# two arrays
(np.ones(10), np.zeros(10)),
])
def test_clip_value_min_max_flip(self, amin, amax):
a = np.arange(10, dtype=np.int64)
# requirement from ufunc_docstrings.py
expected = np.minimum(np.maximum(a, amin), amax)
actual = np.clip(a, amin, amax)
assert_equal(actual, expected)
@pytest.mark.parametrize("arr, amin, amax, exp", [
# for a bug in npy_ObjectClip, based on a
# case produced by hypothesis
(np.zeros(10, dtype=np.int64),
0,
-2**64+1,
np.full(10, -2**64+1, dtype=object)),
# for bugs in NPY_TIMEDELTA_MAX, based on a case
# produced by hypothesis
(np.zeros(10, dtype='m8') - 1,
0,
0,
np.zeros(10, dtype='m8')),
])
def test_clip_problem_cases(self, arr, amin, amax, exp):
actual = np.clip(arr, amin, amax)
assert_equal(actual, exp)
@pytest.mark.xfail(reason="no scalar nan propagation yet",
raises=AssertionError,
strict=True)
@pytest.mark.parametrize("arr, amin, amax", [
# problematic scalar nan case from hypothesis
(np.zeros(10, dtype=np.int64),
np.array(np.nan),
np.zeros(10, dtype=np.int32)),
])
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_clip_scalar_nan_propagation(self, arr, amin, amax):
# enforcement of scalar nan propagation for comparisons
# called through clip()
expected = np.minimum(np.maximum(arr, amin), amax)
actual = np.clip(arr, amin, amax)
assert_equal(actual, expected)
@pytest.mark.xfail(reason="propagation doesn't match spec")
@pytest.mark.parametrize("arr, amin, amax", [
(np.array([1] * 10, dtype='m8'),
np.timedelta64('NaT'),
np.zeros(10, dtype=np.int32)),
])
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_NaT_propagation(self, arr, amin, amax):
# NOTE: the expected function spec doesn't
# propagate NaT, but clip() now does
expected = np.minimum(np.maximum(arr, amin), amax)
actual = np.clip(arr, amin, amax)
assert_equal(actual, expected)
@given(data=st.data(), shape=hynp.array_shapes())
def test_clip_property(self, data, shape):
"""A property-based test using Hypothesis.
This aims for maximum generality: it could in principle generate *any*
valid inputs to np.clip, and in practice generates much more varied
inputs than human testers come up with.
Because many of the inputs have tricky dependencies - compatible dtypes
and mutually-broadcastable shapes - we use `st.data()` strategy draw
values *inside* the test function, from strategies we construct based
on previous values. An alternative would be to define a custom strategy
with `@st.composite`, but until we have duplicated code inline is fine.
That accounts for most of the function; the actual test is just three
lines to calculate and compare actual vs expected results!
"""
# Our base array and bounds should not need to be of the same type as
# long as they are all compatible - so we allow any int or float type.
dtype_strategy = hynp.integer_dtypes() | hynp.floating_dtypes()
# The following line is a total hack to disable the varied-dtypes
# component of this test, because result != expected if dtypes can vary.
dtype_strategy = st.just(data.draw(dtype_strategy))
# Generate an arbitrary array of the chosen shape and dtype
# This is the value that we clip.
arr = data.draw(hynp.arrays(dtype=dtype_strategy, shape=shape))
# Generate shapes for the bounds which can be broadcast with each other
# and with the base shape. Below, we might decide to use scalar bounds,
# but it's clearer to generate these shapes unconditionally in advance.
in_shapes, result_shape = data.draw(
hynp.mutually_broadcastable_shapes(
num_shapes=2,
base_shape=shape,
# Commenting out the min_dims line allows zero-dimensional arrays,
# and zero-dimensional arrays containing NaN make the test fail.
min_dims=1
)
)
amin = data.draw(
dtype_strategy.flatmap(hynp.from_dtype)
| hynp.arrays(dtype=dtype_strategy, shape=in_shapes[0])
)
amax = data.draw(
dtype_strategy.flatmap(hynp.from_dtype)
| hynp.arrays(dtype=dtype_strategy, shape=in_shapes[1])
)
# If we allow either bound to be a scalar `nan`, the test will fail -
# so we just "assume" that away (if it is, this raises a special
# exception and Hypothesis will try again with different inputs)
assume(not np.isscalar(amin) or not np.isnan(amin))
assume(not np.isscalar(amax) or not np.isnan(amax))
# Then calculate our result and expected result and check that they're
# equal! See gh-12519 for discussion deciding on this property.
result = np.clip(arr, amin, amax)
expected = np.minimum(amax, np.maximum(arr, amin))
assert_array_equal(result, expected)
class TestAllclose:
rtol = 1e-5
atol = 1e-8
def setup(self):
self.olderr = np.seterr(invalid='ignore')
def teardown(self):
np.seterr(**self.olderr)
def tst_allclose(self, x, y):
assert_(np.allclose(x, y), "%s and %s not close" % (x, y))
def tst_not_allclose(self, x, y):
assert_(not np.allclose(x, y), "%s and %s shouldn't be close" % (x, y))
def test_ip_allclose(self):
# Parametric test factory.
arr = np.array([100, 1000])
aran = np.arange(125).reshape((5, 5, 5))
atol = self.atol
rtol = self.rtol
data = [([1, 0], [1, 0]),
([atol], [0]),
([1], [1+rtol+atol]),
(arr, arr + arr*rtol),
(arr, arr + arr*rtol + atol*2),
(aran, aran + aran*rtol),
(np.inf, np.inf),
(np.inf, [np.inf])]
for (x, y) in data:
self.tst_allclose(x, y)
def test_ip_not_allclose(self):
# Parametric test factory.
aran = np.arange(125).reshape((5, 5, 5))
atol = self.atol
rtol = self.rtol
data = [([np.inf, 0], [1, np.inf]),
([np.inf, 0], [1, 0]),
([np.inf, np.inf], [1, np.inf]),
([np.inf, np.inf], [1, 0]),
([-np.inf, 0], [np.inf, 0]),
([np.nan, 0], [np.nan, 0]),
([atol*2], [0]),
([1], [1+rtol+atol*2]),
(aran, aran + aran*atol + atol*2),
(np.array([np.inf, 1]), np.array([0, np.inf]))]
for (x, y) in data:
self.tst_not_allclose(x, y)
def test_no_parameter_modification(self):
x = np.array([np.inf, 1])
y = np.array([0, np.inf])
np.allclose(x, y)
assert_array_equal(x, np.array([np.inf, 1]))
assert_array_equal(y, np.array([0, np.inf]))
def test_min_int(self):
# Could make problems because of abs(min_int) == min_int
min_int = np.iinfo(np.int_).min
a = np.array([min_int], dtype=np.int_)
assert_(np.allclose(a, a))
def test_equalnan(self):
x = np.array([1.0, np.nan])
assert_(np.allclose(x, x, equal_nan=True))
def test_return_class_is_ndarray(self):
# Issue gh-6475
# Check that allclose does not preserve subtypes
class Foo(np.ndarray):
def __new__(cls, *args, **kwargs):
return np.array(*args, **kwargs).view(cls)
a = Foo([1])
assert_(type(np.allclose(a, a)) is bool)
class TestIsclose:
rtol = 1e-5
atol = 1e-8
def setup(self):
atol = self.atol
rtol = self.rtol
arr = np.array([100, 1000])
aran = np.arange(125).reshape((5, 5, 5))
self.all_close_tests = [
([1, 0], [1, 0]),
([atol], [0]),
([1], [1 + rtol + atol]),
(arr, arr + arr*rtol),
(arr, arr + arr*rtol + atol),
(aran, aran + aran*rtol),
(np.inf, np.inf),
(np.inf, [np.inf]),
([np.inf, -np.inf], [np.inf, -np.inf]),
]
self.none_close_tests = [
([np.inf, 0], [1, np.inf]),
([np.inf, -np.inf], [1, 0]),
([np.inf, np.inf], [1, -np.inf]),
([np.inf, np.inf], [1, 0]),
([np.nan, 0], [np.nan, -np.inf]),
([atol*2], [0]),
([1], [1 + rtol + atol*2]),
(aran, aran + rtol*1.1*aran + atol*1.1),
(np.array([np.inf, 1]), np.array([0, np.inf])),
]
self.some_close_tests = [
([np.inf, 0], [np.inf, atol*2]),
([atol, 1, 1e6*(1 + 2*rtol) + atol], [0, np.nan, 1e6]),
(np.arange(3), [0, 1, 2.1]),
(np.nan, [np.nan, np.nan, np.nan]),
([0], [atol, np.inf, -np.inf, np.nan]),
(0, [atol, np.inf, -np.inf, np.nan]),
]
self.some_close_results = [
[True, False],
[True, False, False],
[True, True, False],
[False, False, False],
[True, False, False, False],
[True, False, False, False],
]
def test_ip_isclose(self):
self.setup()
tests = self.some_close_tests
results = self.some_close_results
for (x, y), result in zip(tests, results):
assert_array_equal(np.isclose(x, y), result)
def tst_all_isclose(self, x, y):
assert_(np.all(np.isclose(x, y)), "%s and %s not close" % (x, y))
def tst_none_isclose(self, x, y):
msg = "%s and %s shouldn't be close"
assert_(not np.any(np.isclose(x, y)), msg % (x, y))
def tst_isclose_allclose(self, x, y):
msg = "isclose.all() and allclose aren't same for %s and %s"
msg2 = "isclose and allclose aren't same for %s and %s"
if np.isscalar(x) and np.isscalar(y):
assert_(np.isclose(x, y) == np.allclose(x, y), msg=msg2 % (x, y))
else:
assert_array_equal(np.isclose(x, y).all(), np.allclose(x, y), msg % (x, y))
def test_ip_all_isclose(self):
self.setup()
for (x, y) in self.all_close_tests:
self.tst_all_isclose(x, y)
def test_ip_none_isclose(self):
self.setup()
for (x, y) in self.none_close_tests:
self.tst_none_isclose(x, y)
def test_ip_isclose_allclose(self):
self.setup()
tests = (self.all_close_tests + self.none_close_tests +
self.some_close_tests)
for (x, y) in tests:
self.tst_isclose_allclose(x, y)
def test_equal_nan(self):
assert_array_equal(np.isclose(np.nan, np.nan, equal_nan=True), [True])
arr = np.array([1.0, np.nan])
assert_array_equal(np.isclose(arr, arr, equal_nan=True), [True, True])
def test_masked_arrays(self):
# Make sure to test the output type when arguments are interchanged.
x = np.ma.masked_where([True, True, False], np.arange(3))
assert_(type(x) is type(np.isclose(2, x)))
assert_(type(x) is type(np.isclose(x, 2)))
x = np.ma.masked_where([True, True, False], [np.nan, np.inf, np.nan])
assert_(type(x) is type(np.isclose(np.inf, x)))
assert_(type(x) is type(np.isclose(x, np.inf)))
x = np.ma.masked_where([True, True, False], [np.nan, np.nan, np.nan])
y = np.isclose(np.nan, x, equal_nan=True)
assert_(type(x) is type(y))
# Ensure that the mask isn't modified...
assert_array_equal([True, True, False], y.mask)
y = np.isclose(x, np.nan, equal_nan=True)
assert_(type(x) is type(y))
# Ensure that the mask isn't modified...
assert_array_equal([True, True, False], y.mask)
x = np.ma.masked_where([True, True, False], [np.nan, np.nan, np.nan])
y = np.isclose(x, x, equal_nan=True)
assert_(type(x) is type(y))
# Ensure that the mask isn't modified...
assert_array_equal([True, True, False], y.mask)
def test_scalar_return(self):
assert_(np.isscalar(np.isclose(1, 1)))
def test_no_parameter_modification(self):
x = np.array([np.inf, 1])
y = np.array([0, np.inf])
np.isclose(x, y)
assert_array_equal(x, np.array([np.inf, 1]))
assert_array_equal(y, np.array([0, np.inf]))
def test_non_finite_scalar(self):
# GH7014, when two scalars are compared the output should also be a
# scalar
assert_(np.isclose(np.inf, -np.inf) is np.False_)
assert_(np.isclose(0, np.inf) is np.False_)
assert_(type(np.isclose(0, np.inf)) is np.bool_)
def test_timedelta(self):
# Allclose currently works for timedelta64 as long as `atol` is
# an integer or also a timedelta64
a = np.array([[1, 2, 3, "NaT"]], dtype="m8[ns]")
assert np.isclose(a, a, atol=0, equal_nan=True).all()
assert np.isclose(a, a, atol=np.timedelta64(1, "ns"), equal_nan=True).all()
assert np.allclose(a, a, atol=0, equal_nan=True)
assert np.allclose(a, a, atol=np.timedelta64(1, "ns"), equal_nan=True)
class TestStdVar:
def setup(self):
self.A = np.array([1, -1, 1, -1])
self.real_var = 1
def test_basic(self):
assert_almost_equal(np.var(self.A), self.real_var)
assert_almost_equal(np.std(self.A)**2, self.real_var)
def test_scalars(self):
assert_equal(np.var(1), 0)
assert_equal(np.std(1), 0)
def test_ddof1(self):
assert_almost_equal(np.var(self.A, ddof=1),
self.real_var*len(self.A)/float(len(self.A)-1))
assert_almost_equal(np.std(self.A, ddof=1)**2,
self.real_var*len(self.A)/float(len(self.A)-1))
def test_ddof2(self):
assert_almost_equal(np.var(self.A, ddof=2),
self.real_var*len(self.A)/float(len(self.A)-2))
assert_almost_equal(np.std(self.A, ddof=2)**2,
self.real_var*len(self.A)/float(len(self.A)-2))
def test_out_scalar(self):
d = np.arange(10)
out = np.array(0.)
r = np.std(d, out=out)
assert_(r is out)
assert_array_equal(r, out)
r = np.var(d, out=out)
assert_(r is out)
assert_array_equal(r, out)
r = np.mean(d, out=out)
assert_(r is out)
assert_array_equal(r, out)
class TestStdVarComplex:
def test_basic(self):
A = np.array([1, 1.j, -1, -1.j])
real_var = 1
assert_almost_equal(np.var(A), real_var)
assert_almost_equal(np.std(A)**2, real_var)
def test_scalars(self):
assert_equal(np.var(1j), 0)
assert_equal(np.std(1j), 0)
class TestCreationFuncs:
# Test ones, zeros, empty and full.
def setup(self):
dtypes = {np.dtype(tp) for tp in itertools.chain(*np.sctypes.values())}
# void, bytes, str
variable_sized = {tp for tp in dtypes if tp.str.endswith('0')}
self.dtypes = sorted(dtypes - variable_sized |
{np.dtype(tp.str.replace("0", str(i)))
for tp in variable_sized for i in range(1, 10)},
key=lambda dtype: dtype.str)
self.orders = {'C': 'c_contiguous', 'F': 'f_contiguous'}
self.ndims = 10
def check_function(self, func, fill_value=None):
par = ((0, 1, 2),
range(self.ndims),
self.orders,
self.dtypes)
fill_kwarg = {}
if fill_value is not None:
fill_kwarg = {'fill_value': fill_value}
for size, ndims, order, dtype in itertools.product(*par):
shape = ndims * [size]
# do not fill void type
if fill_kwarg and dtype.str.startswith('|V'):
continue
arr = func(shape, order=order, dtype=dtype,
**fill_kwarg)
assert_equal(arr.dtype, dtype)
assert_(getattr(arr.flags, self.orders[order]))
if fill_value is not None:
if dtype.str.startswith('|S'):
val = str(fill_value)
else:
val = fill_value
assert_equal(arr, dtype.type(val))
def test_zeros(self):
self.check_function(np.zeros)
def test_ones(self):
self.check_function(np.ones)
def test_empty(self):
self.check_function(np.empty)
def test_full(self):
self.check_function(np.full, 0)
self.check_function(np.full, 1)
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
def test_for_reference_leak(self):
# Make sure we have an object for reference
dim = 1
beg = sys.getrefcount(dim)
np.zeros([dim]*10)
assert_(sys.getrefcount(dim) == beg)
np.ones([dim]*10)
assert_(sys.getrefcount(dim) == beg)
np.empty([dim]*10)
assert_(sys.getrefcount(dim) == beg)
np.full([dim]*10, 0)
assert_(sys.getrefcount(dim) == beg)
class TestLikeFuncs:
'''Test ones_like, zeros_like, empty_like and full_like'''
def setup(self):
self.data = [
# Array scalars
(np.array(3.), None),
(np.array(3), 'f8'),
# 1D arrays
(np.arange(6, dtype='f4'), None),
(np.arange(6), 'c16'),
# 2D C-layout arrays
(np.arange(6).reshape(2, 3), None),
(np.arange(6).reshape(3, 2), 'i1'),
# 2D F-layout arrays
(np.arange(6).reshape((2, 3), order='F'), None),
(np.arange(6).reshape((3, 2), order='F'), 'i1'),
# 3D C-layout arrays
(np.arange(24).reshape(2, 3, 4), None),
(np.arange(24).reshape(4, 3, 2), 'f4'),
# 3D F-layout arrays
(np.arange(24).reshape((2, 3, 4), order='F'), None),
(np.arange(24).reshape((4, 3, 2), order='F'), 'f4'),
# 3D non-C/F-layout arrays
(np.arange(24).reshape(2, 3, 4).swapaxes(0, 1), None),
(np.arange(24).reshape(4, 3, 2).swapaxes(0, 1), '?'),
]
self.shapes = [(), (5,), (5,6,), (5,6,7,)]
def compare_array_value(self, dz, value, fill_value):
if value is not None:
if fill_value:
try:
z = dz.dtype.type(value)
except OverflowError:
pass
else:
assert_(np.all(dz == z))
else:
assert_(np.all(dz == value))
def check_like_function(self, like_function, value, fill_value=False):
if fill_value:
fill_kwarg = {'fill_value': value}
else:
fill_kwarg = {}
for d, dtype in self.data:
# default (K) order, dtype
dz = like_function(d, dtype=dtype, **fill_kwarg)
assert_equal(dz.shape, d.shape)
assert_equal(np.array(dz.strides)*d.dtype.itemsize,
np.array(d.strides)*dz.dtype.itemsize)
assert_equal(d.flags.c_contiguous, dz.flags.c_contiguous)
assert_equal(d.flags.f_contiguous, dz.flags.f_contiguous)
if dtype is None:
assert_equal(dz.dtype, d.dtype)
else:
assert_equal(dz.dtype, np.dtype(dtype))
self.compare_array_value(dz, value, fill_value)
# C order, default dtype
dz = like_function(d, order='C', dtype=dtype, **fill_kwarg)
assert_equal(dz.shape, d.shape)
assert_(dz.flags.c_contiguous)
if dtype is None:
assert_equal(dz.dtype, d.dtype)
else:
assert_equal(dz.dtype, np.dtype(dtype))
self.compare_array_value(dz, value, fill_value)
# F order, default dtype
dz = like_function(d, order='F', dtype=dtype, **fill_kwarg)
assert_equal(dz.shape, d.shape)
assert_(dz.flags.f_contiguous)
if dtype is None:
assert_equal(dz.dtype, d.dtype)
else:
assert_equal(dz.dtype, np.dtype(dtype))
self.compare_array_value(dz, value, fill_value)
# A order
dz = like_function(d, order='A', dtype=dtype, **fill_kwarg)
assert_equal(dz.shape, d.shape)
if d.flags.f_contiguous:
assert_(dz.flags.f_contiguous)
else:
assert_(dz.flags.c_contiguous)
if dtype is None:
assert_equal(dz.dtype, d.dtype)
else:
assert_equal(dz.dtype, np.dtype(dtype))
self.compare_array_value(dz, value, fill_value)
# Test the 'shape' parameter
for s in self.shapes:
for o in 'CFA':
sz = like_function(d, dtype=dtype, shape=s, order=o,
**fill_kwarg)
assert_equal(sz.shape, s)
if dtype is None:
assert_equal(sz.dtype, d.dtype)
else:
assert_equal(sz.dtype, np.dtype(dtype))
if o == 'C' or (o == 'A' and d.flags.c_contiguous):
assert_(sz.flags.c_contiguous)
elif o == 'F' or (o == 'A' and d.flags.f_contiguous):
assert_(sz.flags.f_contiguous)
self.compare_array_value(sz, value, fill_value)
if (d.ndim != len(s)):
assert_equal(np.argsort(like_function(d, dtype=dtype,
shape=s, order='K',
**fill_kwarg).strides),
np.argsort(np.empty(s, dtype=dtype,
order='C').strides))
else:
assert_equal(np.argsort(like_function(d, dtype=dtype,
shape=s, order='K',
**fill_kwarg).strides),
np.argsort(d.strides))
# Test the 'subok' parameter
class MyNDArray(np.ndarray):
pass
a = np.array([[1, 2], [3, 4]]).view(MyNDArray)
b = like_function(a, **fill_kwarg)
assert_(type(b) is MyNDArray)
b = like_function(a, subok=False, **fill_kwarg)
assert_(type(b) is not MyNDArray)
def test_ones_like(self):
self.check_like_function(np.ones_like, 1)
def test_zeros_like(self):
self.check_like_function(np.zeros_like, 0)
def test_empty_like(self):
self.check_like_function(np.empty_like, None)
def test_filled_like(self):
self.check_like_function(np.full_like, 0, True)
self.check_like_function(np.full_like, 1, True)
self.check_like_function(np.full_like, 1000, True)
self.check_like_function(np.full_like, 123.456, True)
self.check_like_function(np.full_like, np.inf, True)
class TestCorrelate:
def _setup(self, dt):
self.x = np.array([1, 2, 3, 4, 5], dtype=dt)
self.xs = np.arange(1, 20)[::3]
self.y = np.array([-1, -2, -3], dtype=dt)
self.z1 = np.array([ -3., -8., -14., -20., -26., -14., -5.], dtype=dt)
self.z1_4 = np.array([-2., -5., -8., -11., -14., -5.], dtype=dt)
self.z1r = np.array([-15., -22., -22., -16., -10., -4., -1.], dtype=dt)
self.z2 = np.array([-5., -14., -26., -20., -14., -8., -3.], dtype=dt)
self.z2r = np.array([-1., -4., -10., -16., -22., -22., -15.], dtype=dt)
self.zs = np.array([-3., -14., -30., -48., -66., -84.,
-102., -54., -19.], dtype=dt)
def test_float(self):
self._setup(float)
z = np.correlate(self.x, self.y, 'full')
assert_array_almost_equal(z, self.z1)
z = np.correlate(self.x, self.y[:-1], 'full')
assert_array_almost_equal(z, self.z1_4)
z = np.correlate(self.y, self.x, 'full')
assert_array_almost_equal(z, self.z2)
z = np.correlate(self.x[::-1], self.y, 'full')
assert_array_almost_equal(z, self.z1r)
z = np.correlate(self.y, self.x[::-1], 'full')
assert_array_almost_equal(z, self.z2r)
z = np.correlate(self.xs, self.y, 'full')
assert_array_almost_equal(z, self.zs)
def test_object(self):
self._setup(Decimal)
z = np.correlate(self.x, self.y, 'full')
assert_array_almost_equal(z, self.z1)
z = np.correlate(self.y, self.x, 'full')
assert_array_almost_equal(z, self.z2)
def test_no_overwrite(self):
d = np.ones(100)
k = np.ones(3)
np.correlate(d, k)
assert_array_equal(d, np.ones(100))
assert_array_equal(k, np.ones(3))
def test_complex(self):
x = np.array([1, 2, 3, 4+1j], dtype=complex)
y = np.array([-1, -2j, 3+1j], dtype=complex)
r_z = np.array([3-1j, 6, 8+1j, 11+5j, -5+8j, -4-1j], dtype=complex)
r_z = r_z[::-1].conjugate()
z = np.correlate(y, x, mode='full')
assert_array_almost_equal(z, r_z)
def test_zero_size(self):
with pytest.raises(ValueError):
np.correlate(np.array([]), np.ones(1000), mode='full')
with pytest.raises(ValueError):
np.correlate(np.ones(1000), np.array([]), mode='full')
class TestConvolve:
def test_object(self):
d = [1.] * 100
k = [1.] * 3
assert_array_almost_equal(np.convolve(d, k)[2:-2], np.full(98, 3))
def test_no_overwrite(self):
d = np.ones(100)
k = np.ones(3)
np.convolve(d, k)
assert_array_equal(d, np.ones(100))
assert_array_equal(k, np.ones(3))
class TestArgwhere:
@pytest.mark.parametrize('nd', [0, 1, 2])
def test_nd(self, nd):
# get an nd array with multiple elements in every dimension
x = np.empty((2,)*nd, bool)
# none
x[...] = False
assert_equal(np.argwhere(x).shape, (0, nd))
# only one
x[...] = False
x.flat[0] = True
assert_equal(np.argwhere(x).shape, (1, nd))
# all but one
x[...] = True
x.flat[0] = False
assert_equal(np.argwhere(x).shape, (x.size - 1, nd))
# all
x[...] = True
assert_equal(np.argwhere(x).shape, (x.size, nd))
def test_2D(self):
x = np.arange(6).reshape((2, 3))
assert_array_equal(np.argwhere(x > 1),
[[0, 2],
[1, 0],
[1, 1],
[1, 2]])
def test_list(self):
assert_equal(np.argwhere([4, 0, 2, 1, 3]), [[0], [2], [3], [4]])
class TestStringFunction:
def test_set_string_function(self):
a = np.array([1])
np.set_string_function(lambda x: "FOO", repr=True)
assert_equal(repr(a), "FOO")
np.set_string_function(None, repr=True)
assert_equal(repr(a), "array([1])")
np.set_string_function(lambda x: "FOO", repr=False)
assert_equal(str(a), "FOO")
np.set_string_function(None, repr=False)
assert_equal(str(a), "[1]")
class TestRoll:
def test_roll1d(self):
x = np.arange(10)
xr = np.roll(x, 2)
assert_equal(xr, np.array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]))
def test_roll2d(self):
x2 = np.reshape(np.arange(10), (2, 5))
x2r = np.roll(x2, 1)
assert_equal(x2r, np.array([[9, 0, 1, 2, 3], [4, 5, 6, 7, 8]]))
x2r = np.roll(x2, 1, axis=0)
assert_equal(x2r, np.array([[5, 6, 7, 8, 9], [0, 1, 2, 3, 4]]))
x2r = np.roll(x2, 1, axis=1)
assert_equal(x2r, np.array([[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]))
# Roll multiple axes at once.
x2r = np.roll(x2, 1, axis=(0, 1))
assert_equal(x2r, np.array([[9, 5, 6, 7, 8], [4, 0, 1, 2, 3]]))
x2r = np.roll(x2, (1, 0), axis=(0, 1))
assert_equal(x2r, np.array([[5, 6, 7, 8, 9], [0, 1, 2, 3, 4]]))
x2r = np.roll(x2, (-1, 0), axis=(0, 1))
assert_equal(x2r, np.array([[5, 6, 7, 8, 9], [0, 1, 2, 3, 4]]))
x2r = np.roll(x2, (0, 1), axis=(0, 1))
assert_equal(x2r, np.array([[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]))
x2r = np.roll(x2, (0, -1), axis=(0, 1))
assert_equal(x2r, np.array([[1, 2, 3, 4, 0], [6, 7, 8, 9, 5]]))
x2r = np.roll(x2, (1, 1), axis=(0, 1))
assert_equal(x2r, np.array([[9, 5, 6, 7, 8], [4, 0, 1, 2, 3]]))
x2r = np.roll(x2, (-1, -1), axis=(0, 1))
assert_equal(x2r, np.array([[6, 7, 8, 9, 5], [1, 2, 3, 4, 0]]))
# Roll the same axis multiple times.
x2r = np.roll(x2, 1, axis=(0, 0))
assert_equal(x2r, np.array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]))
x2r = np.roll(x2, 1, axis=(1, 1))
assert_equal(x2r, np.array([[3, 4, 0, 1, 2], [8, 9, 5, 6, 7]]))
# Roll more than one turn in either direction.
x2r = np.roll(x2, 6, axis=1)
assert_equal(x2r, np.array([[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]))
x2r = np.roll(x2, -4, axis=1)
assert_equal(x2r, np.array([[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]))
def test_roll_empty(self):
x = np.array([])
assert_equal(np.roll(x, 1), np.array([]))
class TestRollaxis:
# expected shape indexed by (axis, start) for array of
# shape (1, 2, 3, 4)
tgtshape = {(0, 0): (1, 2, 3, 4), (0, 1): (1, 2, 3, 4),
(0, 2): (2, 1, 3, 4), (0, 3): (2, 3, 1, 4),
(0, 4): (2, 3, 4, 1),
(1, 0): (2, 1, 3, 4), (1, 1): (1, 2, 3, 4),
(1, 2): (1, 2, 3, 4), (1, 3): (1, 3, 2, 4),
(1, 4): (1, 3, 4, 2),
(2, 0): (3, 1, 2, 4), (2, 1): (1, 3, 2, 4),
(2, 2): (1, 2, 3, 4), (2, 3): (1, 2, 3, 4),
(2, 4): (1, 2, 4, 3),
(3, 0): (4, 1, 2, 3), (3, 1): (1, 4, 2, 3),
(3, 2): (1, 2, 4, 3), (3, 3): (1, 2, 3, 4),
(3, 4): (1, 2, 3, 4)}
def test_exceptions(self):
a = np.arange(1*2*3*4).reshape(1, 2, 3, 4)
assert_raises(np.AxisError, np.rollaxis, a, -5, 0)
assert_raises(np.AxisError, np.rollaxis, a, 0, -5)
assert_raises(np.AxisError, np.rollaxis, a, 4, 0)
assert_raises(np.AxisError, np.rollaxis, a, 0, 5)
def test_results(self):
a = np.arange(1*2*3*4).reshape(1, 2, 3, 4).copy()
aind = np.indices(a.shape)
assert_(a.flags['OWNDATA'])
for (i, j) in self.tgtshape:
# positive axis, positive start
res = np.rollaxis(a, axis=i, start=j)
i0, i1, i2, i3 = aind[np.array(res.shape) - 1]
assert_(np.all(res[i0, i1, i2, i3] == a))
assert_(res.shape == self.tgtshape[(i, j)], str((i,j)))
assert_(not res.flags['OWNDATA'])
# negative axis, positive start
ip = i + 1
res = np.rollaxis(a, axis=-ip, start=j)
i0, i1, i2, i3 = aind[np.array(res.shape) - 1]
assert_(np.all(res[i0, i1, i2, i3] == a))
assert_(res.shape == self.tgtshape[(4 - ip, j)])
assert_(not res.flags['OWNDATA'])
# positive axis, negative start
jp = j + 1 if j < 4 else j
res = np.rollaxis(a, axis=i, start=-jp)
i0, i1, i2, i3 = aind[np.array(res.shape) - 1]
assert_(np.all(res[i0, i1, i2, i3] == a))
assert_(res.shape == self.tgtshape[(i, 4 - jp)])
assert_(not res.flags['OWNDATA'])
# negative axis, negative start
ip = i + 1
jp = j + 1 if j < 4 else j
res = np.rollaxis(a, axis=-ip, start=-jp)
i0, i1, i2, i3 = aind[np.array(res.shape) - 1]
assert_(np.all(res[i0, i1, i2, i3] == a))
assert_(res.shape == self.tgtshape[(4 - ip, 4 - jp)])
assert_(not res.flags['OWNDATA'])
class TestMoveaxis:
def test_move_to_end(self):
x = np.random.randn(5, 6, 7)
for source, expected in [(0, (6, 7, 5)),
(1, (5, 7, 6)),
(2, (5, 6, 7)),
(-1, (5, 6, 7))]:
actual = np.moveaxis(x, source, -1).shape
assert_(actual, expected)
def test_move_new_position(self):
x = np.random.randn(1, 2, 3, 4)
for source, destination, expected in [
(0, 1, (2, 1, 3, 4)),
(1, 2, (1, 3, 2, 4)),
(1, -1, (1, 3, 4, 2)),
]:
actual = np.moveaxis(x, source, destination).shape
assert_(actual, expected)
def test_preserve_order(self):
x = np.zeros((1, 2, 3, 4))
for source, destination in [
(0, 0),
(3, -1),
(-1, 3),
([0, -1], [0, -1]),
([2, 0], [2, 0]),
(range(4), range(4)),
]:
actual = np.moveaxis(x, source, destination).shape
assert_(actual, (1, 2, 3, 4))
def test_move_multiples(self):
x = np.zeros((0, 1, 2, 3))
for source, destination, expected in [
([0, 1], [2, 3], (2, 3, 0, 1)),
([2, 3], [0, 1], (2, 3, 0, 1)),
([0, 1, 2], [2, 3, 0], (2, 3, 0, 1)),
([3, 0], [1, 0], (0, 3, 1, 2)),
([0, 3], [0, 1], (0, 3, 1, 2)),
]:
actual = np.moveaxis(x, source, destination).shape
assert_(actual, expected)
def test_errors(self):
x = np.random.randn(1, 2, 3)
assert_raises_regex(np.AxisError, 'source.*out of bounds',
np.moveaxis, x, 3, 0)
assert_raises_regex(np.AxisError, 'source.*out of bounds',
np.moveaxis, x, -4, 0)
assert_raises_regex(np.AxisError, 'destination.*out of bounds',
np.moveaxis, x, 0, 5)
assert_raises_regex(ValueError, 'repeated axis in `source`',
np.moveaxis, x, [0, 0], [0, 1])
assert_raises_regex(ValueError, 'repeated axis in `destination`',
np.moveaxis, x, [0, 1], [1, 1])
assert_raises_regex(ValueError, 'must have the same number',
np.moveaxis, x, 0, [0, 1])
assert_raises_regex(ValueError, 'must have the same number',
np.moveaxis, x, [0, 1], [0])
def test_array_likes(self):
x = np.ma.zeros((1, 2, 3))
result = np.moveaxis(x, 0, 0)
assert_(x.shape, result.shape)
assert_(isinstance(result, np.ma.MaskedArray))
x = [1, 2, 3]
result = np.moveaxis(x, 0, 0)
assert_(x, list(result))
assert_(isinstance(result, np.ndarray))
class TestCross:
def test_2x2(self):
u = [1, 2]
v = [3, 4]
z = -2
cp = np.cross(u, v)
assert_equal(cp, z)
cp = np.cross(v, u)
assert_equal(cp, -z)
def test_2x3(self):
u = [1, 2]
v = [3, 4, 5]
z = np.array([10, -5, -2])
cp = np.cross(u, v)
assert_equal(cp, z)
cp = np.cross(v, u)
assert_equal(cp, -z)
def test_3x3(self):
u = [1, 2, 3]
v = [4, 5, 6]
z = np.array([-3, 6, -3])
cp = np.cross(u, v)
assert_equal(cp, z)
cp = np.cross(v, u)
assert_equal(cp, -z)
def test_broadcasting(self):
# Ticket #2624 (Trac #2032)
u = np.tile([1, 2], (11, 1))
v = np.tile([3, 4], (11, 1))
z = -2
assert_equal(np.cross(u, v), z)
assert_equal(np.cross(v, u), -z)
assert_equal(np.cross(u, u), 0)
u = np.tile([1, 2], (11, 1)).T
v = np.tile([3, 4, 5], (11, 1))
z = np.tile([10, -5, -2], (11, 1))
assert_equal(np.cross(u, v, axisa=0), z)
assert_equal(np.cross(v, u.T), -z)
assert_equal(np.cross(v, v), 0)
u = np.tile([1, 2, 3], (11, 1)).T
v = np.tile([3, 4], (11, 1)).T
z = np.tile([-12, 9, -2], (11, 1))
assert_equal(np.cross(u, v, axisa=0, axisb=0), z)
assert_equal(np.cross(v.T, u.T), -z)
assert_equal(np.cross(u.T, u.T), 0)
u = np.tile([1, 2, 3], (5, 1))
v = np.tile([4, 5, 6], (5, 1)).T
z = np.tile([-3, 6, -3], (5, 1))
assert_equal(np.cross(u, v, axisb=0), z)
assert_equal(np.cross(v.T, u), -z)
assert_equal(np.cross(u, u), 0)
def test_broadcasting_shapes(self):
u = np.ones((2, 1, 3))
v = np.ones((5, 3))
assert_equal(np.cross(u, v).shape, (2, 5, 3))
u = np.ones((10, 3, 5))
v = np.ones((2, 5))
assert_equal(np.cross(u, v, axisa=1, axisb=0).shape, (10, 5, 3))
assert_raises(np.AxisError, np.cross, u, v, axisa=1, axisb=2)
assert_raises(np.AxisError, np.cross, u, v, axisa=3, axisb=0)
u = np.ones((10, 3, 5, 7))
v = np.ones((5, 7, 2))
assert_equal(np.cross(u, v, axisa=1, axisc=2).shape, (10, 5, 3, 7))
assert_raises(np.AxisError, np.cross, u, v, axisa=-5, axisb=2)
assert_raises(np.AxisError, np.cross, u, v, axisa=1, axisb=-4)
# gh-5885
u = np.ones((3, 4, 2))
for axisc in range(-2, 2):
assert_equal(np.cross(u, u, axisc=axisc).shape, (3, 4))
def test_outer_out_param():
arr1 = np.ones((5,))
arr2 = np.ones((2,))
arr3 = np.linspace(-2, 2, 5)
out1 = np.ndarray(shape=(5,5))
out2 = np.ndarray(shape=(2, 5))
res1 = np.outer(arr1, arr3, out1)
assert_equal(res1, out1)
assert_equal(np.outer(arr2, arr3, out2), out2)
class TestIndices:
def test_simple(self):
[x, y] = np.indices((4, 3))
assert_array_equal(x, np.array([[0, 0, 0],
[1, 1, 1],
[2, 2, 2],
[3, 3, 3]]))
assert_array_equal(y, np.array([[0, 1, 2],
[0, 1, 2],
[0, 1, 2],
[0, 1, 2]]))
def test_single_input(self):
[x] = np.indices((4,))
assert_array_equal(x, np.array([0, 1, 2, 3]))
[x] = np.indices((4,), sparse=True)
assert_array_equal(x, np.array([0, 1, 2, 3]))
def test_scalar_input(self):
assert_array_equal([], np.indices(()))
assert_array_equal([], np.indices((), sparse=True))
assert_array_equal([[]], np.indices((0,)))
assert_array_equal([[]], np.indices((0,), sparse=True))
def test_sparse(self):
[x, y] = np.indices((4,3), sparse=True)
assert_array_equal(x, np.array([[0], [1], [2], [3]]))
assert_array_equal(y, np.array([[0, 1, 2]]))
@pytest.mark.parametrize("dtype", [np.int32, np.int64, np.float32, np.float64])
@pytest.mark.parametrize("dims", [(), (0,), (4, 3)])
def test_return_type(self, dtype, dims):
inds = np.indices(dims, dtype=dtype)
assert_(inds.dtype == dtype)
for arr in np.indices(dims, dtype=dtype, sparse=True):
assert_(arr.dtype == dtype)
class TestRequire:
flag_names = ['C', 'C_CONTIGUOUS', 'CONTIGUOUS',
'F', 'F_CONTIGUOUS', 'FORTRAN',
'A', 'ALIGNED',
'W', 'WRITEABLE',
'O', 'OWNDATA']
def generate_all_false(self, dtype):
arr = np.zeros((2, 2), [('junk', 'i1'), ('a', dtype)])
arr.setflags(write=False)
a = arr['a']
assert_(not a.flags['C'])
assert_(not a.flags['F'])
assert_(not a.flags['O'])
assert_(not a.flags['W'])
assert_(not a.flags['A'])
return a
def set_and_check_flag(self, flag, dtype, arr):
if dtype is None:
dtype = arr.dtype
b = np.require(arr, dtype, [flag])
assert_(b.flags[flag])
assert_(b.dtype == dtype)
# a further call to np.require ought to return the same array
# unless OWNDATA is specified.
c = np.require(b, None, [flag])
if flag[0] != 'O':
assert_(c is b)
else:
assert_(c.flags[flag])
def test_require_each(self):
id = ['f8', 'i4']
fd = [None, 'f8', 'c16']
for idtype, fdtype, flag in itertools.product(id, fd, self.flag_names):
a = self.generate_all_false(idtype)
self.set_and_check_flag(flag, fdtype, a)
def test_unknown_requirement(self):
a = self.generate_all_false('f8')
assert_raises(KeyError, np.require, a, None, 'Q')
def test_non_array_input(self):
a = np.require([1, 2, 3, 4], 'i4', ['C', 'A', 'O'])
assert_(a.flags['O'])
assert_(a.flags['C'])
assert_(a.flags['A'])
assert_(a.dtype == 'i4')
assert_equal(a, [1, 2, 3, 4])
def test_C_and_F_simul(self):
a = self.generate_all_false('f8')
assert_raises(ValueError, np.require, a, None, ['C', 'F'])
def test_ensure_array(self):
class ArraySubclass(np.ndarray):
pass
a = ArraySubclass((2, 2))
b = np.require(a, None, ['E'])
assert_(type(b) is np.ndarray)
def test_preserve_subtype(self):
class ArraySubclass(np.ndarray):
pass
for flag in self.flag_names:
a = ArraySubclass((2, 2))
self.set_and_check_flag(flag, None, a)
class TestBroadcast:
def test_broadcast_in_args(self):
# gh-5881
arrs = [np.empty((6, 7)), np.empty((5, 6, 1)), np.empty((7,)),
np.empty((5, 1, 7))]
mits = [np.broadcast(*arrs),
np.broadcast(np.broadcast(*arrs[:0]), np.broadcast(*arrs[0:])),
np.broadcast(np.broadcast(*arrs[:1]), np.broadcast(*arrs[1:])),
np.broadcast(np.broadcast(*arrs[:2]), np.broadcast(*arrs[2:])),
np.broadcast(arrs[0], np.broadcast(*arrs[1:-1]), arrs[-1])]
for mit in mits:
assert_equal(mit.shape, (5, 6, 7))
assert_equal(mit.ndim, 3)
assert_equal(mit.nd, 3)
assert_equal(mit.numiter, 4)
for a, ia in zip(arrs, mit.iters):
assert_(a is ia.base)
def test_broadcast_single_arg(self):
# gh-6899
arrs = [np.empty((5, 6, 7))]
mit = np.broadcast(*arrs)
assert_equal(mit.shape, (5, 6, 7))
assert_equal(mit.ndim, 3)
assert_equal(mit.nd, 3)
assert_equal(mit.numiter, 1)
assert_(arrs[0] is mit.iters[0].base)
def test_number_of_arguments(self):
arr = np.empty((5,))
for j in range(35):
arrs = [arr] * j
if j > 32:
assert_raises(ValueError, np.broadcast, *arrs)
else:
mit = np.broadcast(*arrs)
assert_equal(mit.numiter, j)
def test_broadcast_error_kwargs(self):
#gh-13455
arrs = [np.empty((5, 6, 7))]
mit = np.broadcast(*arrs)
mit2 = np.broadcast(*arrs, **{})
assert_equal(mit.shape, mit2.shape)
assert_equal(mit.ndim, mit2.ndim)
assert_equal(mit.nd, mit2.nd)
assert_equal(mit.numiter, mit2.numiter)
assert_(mit.iters[0].base is mit2.iters[0].base)
assert_raises(ValueError, np.broadcast, 1, **{'x': 1})
class TestKeepdims:
class sub_array(np.ndarray):
def sum(self, axis=None, dtype=None, out=None):
return np.ndarray.sum(self, axis, dtype, out, keepdims=True)
def test_raise(self):
sub_class = self.sub_array
x = np.arange(30).view(sub_class)
assert_raises(TypeError, np.sum, x, keepdims=True)
class TestTensordot:
def test_zero_dimension(self):
# Test resolution to issue #5663
a = np.ndarray((3,0))
b = np.ndarray((0,4))
td = np.tensordot(a, b, (1, 0))
assert_array_equal(td, np.dot(a, b))
assert_array_equal(td, np.einsum('ij,jk', a, b))
def test_zero_dimensional(self):
# gh-12130
arr_0d = np.array(1)
ret = np.tensordot(arr_0d, arr_0d, ([], [])) # contracting no axes is well defined
assert_array_equal(ret, arr_0d)
| bsd-3-clause |
redhat-openstack/nova | nova/api/openstack/compute/plugins/v3/flavor_rxtx.py | 25 | 2114 | # Copyright 2012 Nebula, Inc.
#
# 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.
"""The Flavor Rxtx API extension."""
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
ALIAS = 'os-flavor-rxtx'
authorize = extensions.soft_extension_authorizer('compute', 'v3:' + ALIAS)
class FlavorRxtxController(wsgi.Controller):
def _extend_flavors(self, req, flavors):
for flavor in flavors:
db_flavor = req.get_db_flavor(flavor['id'])
key = 'rxtx_factor'
flavor[key] = db_flavor['rxtx_factor'] or ""
def _show(self, req, resp_obj):
if not authorize(req.environ['nova.context']):
return
if 'flavor' in resp_obj.obj:
self._extend_flavors(req, [resp_obj.obj['flavor']])
@wsgi.extends
def show(self, req, resp_obj, id):
return self._show(req, resp_obj)
@wsgi.extends(action='create')
def create(self, req, resp_obj, body):
return self._show(req, resp_obj)
@wsgi.extends
def detail(self, req, resp_obj):
if not authorize(req.environ['nova.context']):
return
self._extend_flavors(req, list(resp_obj.obj['flavors']))
class FlavorRxtx(extensions.V3APIExtensionBase):
"""Support to show the rxtx status of a flavor."""
name = "FlavorRxtx"
alias = ALIAS
version = 1
def get_controller_extensions(self):
controller = FlavorRxtxController()
extension = extensions.ControllerExtension(self, 'flavors', controller)
return [extension]
def get_resources(self):
return []
| apache-2.0 |
LS80/script.module.html5lib | lib/html5lib/treewalkers/dom.py | 1229 | 1457 | from __future__ import absolute_import, division, unicode_literals
from xml.dom import Node
import gettext
_ = gettext.gettext
from . import _base
class TreeWalker(_base.NonRecursiveTreeWalker):
def getNodeDetails(self, node):
if node.nodeType == Node.DOCUMENT_TYPE_NODE:
return _base.DOCTYPE, node.name, node.publicId, node.systemId
elif node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
return _base.TEXT, node.nodeValue
elif node.nodeType == Node.ELEMENT_NODE:
attrs = {}
for attr in list(node.attributes.keys()):
attr = node.getAttributeNode(attr)
if attr.namespaceURI:
attrs[(attr.namespaceURI, attr.localName)] = attr.value
else:
attrs[(None, attr.name)] = attr.value
return (_base.ELEMENT, node.namespaceURI, node.nodeName,
attrs, node.hasChildNodes())
elif node.nodeType == Node.COMMENT_NODE:
return _base.COMMENT, node.nodeValue
elif node.nodeType in (Node.DOCUMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE):
return (_base.DOCUMENT,)
else:
return _base.UNKNOWN, node.nodeType
def getFirstChild(self, node):
return node.firstChild
def getNextSibling(self, node):
return node.nextSibling
def getParentNode(self, node):
return node.parentNode
| mit |
stevenewey/django | tests/syndication_tests/feeds.py | 278 | 4547 | from __future__ import unicode_literals
from django.contrib.syndication import views
from django.utils import feedgenerator
from django.utils.timezone import get_fixed_timezone
from .models import Article, Entry
class TestRss2Feed(views.Feed):
title = 'My blog'
description = 'A more thorough description of my blog.'
link = '/blog/'
feed_guid = '/foo/bar/1234'
author_name = 'Sally Smith'
author_email = 'test@example.com'
author_link = 'http://www.example.com/'
categories = ('python', 'django')
feed_copyright = 'Copyright (c) 2007, Sally Smith'
ttl = 600
def items(self):
return Entry.objects.all()
def item_description(self, item):
return "Overridden description: %s" % item
def item_pubdate(self, item):
return item.published
def item_updateddate(self, item):
return item.updated
item_author_name = 'Sally Smith'
item_author_email = 'test@example.com'
item_author_link = 'http://www.example.com/'
item_categories = ('python', 'testing')
item_copyright = 'Copyright (c) 2007, Sally Smith'
class TestRss2FeedWithGuidIsPermaLinkTrue(TestRss2Feed):
def item_guid_is_permalink(self, item):
return True
class TestRss2FeedWithGuidIsPermaLinkFalse(TestRss2Feed):
def item_guid(self, item):
return str(item.pk)
def item_guid_is_permalink(self, item):
return False
class TestRss091Feed(TestRss2Feed):
feed_type = feedgenerator.RssUserland091Feed
class TestNoPubdateFeed(views.Feed):
title = 'Test feed'
link = '/feed/'
def items(self):
return Entry.objects.all()
class TestAtomFeed(TestRss2Feed):
feed_type = feedgenerator.Atom1Feed
subtitle = TestRss2Feed.description
class TestLatestFeed(TestRss2Feed):
"""
A feed where the latest entry date is an `updated` element.
"""
feed_type = feedgenerator.Atom1Feed
subtitle = TestRss2Feed.description
def items(self):
return Entry.objects.exclude(pk=5)
class ArticlesFeed(TestRss2Feed):
"""
A feed to test no link being defined. Articles have no get_absolute_url()
method, and item_link() is not defined.
"""
def items(self):
return Article.objects.all()
class TestEnclosureFeed(TestRss2Feed):
pass
class TemplateFeed(TestRss2Feed):
"""
A feed to test defining item titles and descriptions with templates.
"""
title_template = 'syndication/title.html'
description_template = 'syndication/description.html'
# Defining a template overrides any item_title definition
def item_title(self):
return "Not in a template"
class TemplateContextFeed(TestRss2Feed):
"""
A feed to test custom context data in templates for title or description.
"""
title_template = 'syndication/title_context.html'
description_template = 'syndication/description_context.html'
def get_context_data(self, **kwargs):
context = super(TemplateContextFeed, self).get_context_data(**kwargs)
context['foo'] = 'bar'
return context
class NaiveDatesFeed(TestAtomFeed):
"""
A feed with naive (non-timezone-aware) dates.
"""
def item_pubdate(self, item):
return item.published
class TZAwareDatesFeed(TestAtomFeed):
"""
A feed with timezone-aware dates.
"""
def item_pubdate(self, item):
# Provide a weird offset so that the test can know it's getting this
# specific offset and not accidentally getting on from
# settings.TIME_ZONE.
return item.published.replace(tzinfo=get_fixed_timezone(42))
class TestFeedUrlFeed(TestAtomFeed):
feed_url = 'http://example.com/customfeedurl/'
class MyCustomAtom1Feed(feedgenerator.Atom1Feed):
"""
Test of a custom feed generator class.
"""
def root_attributes(self):
attrs = super(MyCustomAtom1Feed, self).root_attributes()
attrs['django'] = 'rocks'
return attrs
def add_root_elements(self, handler):
super(MyCustomAtom1Feed, self).add_root_elements(handler)
handler.addQuickElement('spam', 'eggs')
def item_attributes(self, item):
attrs = super(MyCustomAtom1Feed, self).item_attributes(item)
attrs['bacon'] = 'yum'
return attrs
def add_item_elements(self, handler, item):
super(MyCustomAtom1Feed, self).add_item_elements(handler, item)
handler.addQuickElement('ministry', 'silly walks')
class TestCustomFeed(TestAtomFeed):
feed_type = MyCustomAtom1Feed
| bsd-3-clause |
syaiful6/django | tests/transaction_hooks/tests.py | 288 | 6402 | from django.db import connection, transaction
from django.test import TransactionTestCase, skipUnlessDBFeature
from .models import Thing
class ForcedError(Exception):
pass
class TestConnectionOnCommit(TransactionTestCase):
"""
Tests for transaction.on_commit().
Creation/checking of database objects in parallel with callback tracking is
to verify that the behavior of the two match in all tested cases.
"""
available_apps = ['transaction_hooks']
def setUp(self):
self.notified = []
def notify(self, id_):
if id_ == 'error':
raise ForcedError()
self.notified.append(id_)
def do(self, num):
"""Create a Thing instance and notify about it."""
Thing.objects.create(num=num)
transaction.on_commit(lambda: self.notify(num))
def assertDone(self, nums):
self.assertNotified(nums)
self.assertEqual(sorted(t.num for t in Thing.objects.all()), sorted(nums))
def assertNotified(self, nums):
self.assertEqual(self.notified, nums)
def test_executes_immediately_if_no_transaction(self):
self.do(1)
self.assertDone([1])
def test_delays_execution_until_after_transaction_commit(self):
with transaction.atomic():
self.do(1)
self.assertNotified([])
self.assertDone([1])
def test_does_not_execute_if_transaction_rolled_back(self):
try:
with transaction.atomic():
self.do(1)
raise ForcedError()
except ForcedError:
pass
self.assertDone([])
def test_executes_only_after_final_transaction_committed(self):
with transaction.atomic():
with transaction.atomic():
self.do(1)
self.assertNotified([])
self.assertNotified([])
self.assertDone([1])
def test_discards_hooks_from_rolled_back_savepoint(self):
with transaction.atomic():
# one successful savepoint
with transaction.atomic():
self.do(1)
# one failed savepoint
try:
with transaction.atomic():
self.do(2)
raise ForcedError()
except ForcedError:
pass
# another successful savepoint
with transaction.atomic():
self.do(3)
# only hooks registered during successful savepoints execute
self.assertDone([1, 3])
def test_no_hooks_run_from_failed_transaction(self):
"""If outer transaction fails, no hooks from within it run."""
try:
with transaction.atomic():
with transaction.atomic():
self.do(1)
raise ForcedError()
except ForcedError:
pass
self.assertDone([])
def test_inner_savepoint_rolled_back_with_outer(self):
with transaction.atomic():
try:
with transaction.atomic():
with transaction.atomic():
self.do(1)
raise ForcedError()
except ForcedError:
pass
self.do(2)
self.assertDone([2])
def test_no_savepoints_atomic_merged_with_outer(self):
with transaction.atomic():
with transaction.atomic():
self.do(1)
try:
with transaction.atomic(savepoint=False):
raise ForcedError()
except ForcedError:
pass
self.assertDone([])
def test_inner_savepoint_does_not_affect_outer(self):
with transaction.atomic():
with transaction.atomic():
self.do(1)
try:
with transaction.atomic():
raise ForcedError()
except ForcedError:
pass
self.assertDone([1])
def test_runs_hooks_in_order_registered(self):
with transaction.atomic():
self.do(1)
with transaction.atomic():
self.do(2)
self.do(3)
self.assertDone([1, 2, 3])
def test_hooks_cleared_after_successful_commit(self):
with transaction.atomic():
self.do(1)
with transaction.atomic():
self.do(2)
self.assertDone([1, 2]) # not [1, 1, 2]
def test_hooks_cleared_after_rollback(self):
try:
with transaction.atomic():
self.do(1)
raise ForcedError()
except ForcedError:
pass
with transaction.atomic():
self.do(2)
self.assertDone([2])
@skipUnlessDBFeature('test_db_allows_multiple_connections')
def test_hooks_cleared_on_reconnect(self):
with transaction.atomic():
self.do(1)
connection.close()
connection.connect()
with transaction.atomic():
self.do(2)
self.assertDone([2])
def test_error_in_hook_doesnt_prevent_clearing_hooks(self):
try:
with transaction.atomic():
transaction.on_commit(lambda: self.notify('error'))
except ForcedError:
pass
with transaction.atomic():
self.do(1)
self.assertDone([1])
def test_db_query_in_hook(self):
with transaction.atomic():
Thing.objects.create(num=1)
transaction.on_commit(
lambda: [self.notify(t.num) for t in Thing.objects.all()]
)
self.assertDone([1])
def test_transaction_in_hook(self):
def on_commit():
with transaction.atomic():
t = Thing.objects.create(num=1)
self.notify(t.num)
with transaction.atomic():
transaction.on_commit(on_commit)
self.assertDone([1])
def test_raises_exception_non_autocommit_mode(self):
def should_never_be_called():
raise AssertionError('this function should never be called')
try:
connection.set_autocommit(False)
with self.assertRaises(transaction.TransactionManagementError):
transaction.on_commit(should_never_be_called)
finally:
connection.set_autocommit(True)
| bsd-3-clause |
Kutsoloshchenko/Wizard_West | levels.py | 1 | 6240 | import pygame
import os
from constants import *
from grounds import *
from characters import Bandit, Witch, Ahriman_mage, Elf_girl
from pick_objects import Health_potion, Mana_potion, Quest_object
from quest_menu import *
class Level:
#Level superclass
def __init__(self, player):
# list of ground, enemies, and adding player
self.ground_list = pygame.sprite.Group()
self.enemy_list = pygame.sprite.Group()
self.character_list = pygame.sprite.Group()
self.projectile_list = pygame.sprite.Group()
self.items_list = pygame.sprite.Group()
self.use_list = pygame.sprite.Group()
self.player = player
self.character_list.add(player)
# This is background
self.background = None
# Level settings
self.shift = 0
self.world_limit = -1000
def shift_level(self, shift_x):
self.shift += shift_x
for use in self.use_list:
use.rect.x += shift_x
for item in self.items_list:
item.rect.x += shift_x
for ground in self.ground_list:
ground.rect.x += shift_x
for enemy in self.enemy_list:
enemy.rect.x += shift_x
for projectile in self.projectile_list:
projectile.rect.x += shift_x
def update(self):
self.items_list.update()
self.ground_list.update()
self.enemy_list.update()
self.projectile_list.update()
self.use_list.update()
def draw(self, screen):
screen.fill(self.background)
self.ground_list.draw(screen)
self.enemy_list.draw(screen)
self.projectile_list.draw(screen)
self.items_list.draw(screen)
self.use_list.draw(screen)
def _get_text_from_txt(self, file):
file = open(file, 'r')
file_read = file.read()
file.close()
file = file_read.split('***')
file_not_taken = file[0:2]
file_taken = file[2:4]
file_complete = file[4:]
not_taken = self._get_object_from_list(file_not_taken)
taken = self._get_object_from_list(file_taken)
comleated = self._get_object_from_list(file_complete)
for el in not_taken:
for element in el:
if not element:
el.remove(element)
for el in taken:
for element in el:
if not element:
el.remove(element)
for el in comleated:
for element in el:
if not element:
el.remove(element)
return not_taken, taken, comleated
def _get_object_from_list(self, list):
text = list[0].split('\n')
text = [i.lstrip() for i in text]
answers = list[1].split('\n')
return_answers = []
for i in answers:
answers_list = i.split('@')
temp = []
for answer in answers_list:
answer_from_func = self._get_class_from_answer(answer)
if answer_from_func:
temp.append(self._get_class_from_answer(answer))
return_answers.append(temp)
return [text, return_answers]
def _get_class_from_answer(self, answer):
answer_line = answer.split('#')
answer_line = [i.lstrip() for i in answer_line]
if 'Confirm' in answer_line[0]:
return Confirm(answer_line[1], int(answer_line[2]))
elif 'Answer' in answer_line[0]:
return Answer(answer_line[1], int(answer_line[2]))
elif 'Exit' in answer_line[0]:
return Exit(answer_line[1])
elif 'Complete_quest' in answer_line[0]:
return Complete_quest(answer_line[1], int(answer_line[2]), int(answer_line[3]))
elif 'Success' in answer_line[0]:
return Success(answer_line[1])
class Training_ground(Level):
def __init__(self, player):
Level.__init__(self, player)
self.background = SKY
wall = Ground('.//Grass//stonewall.png')
wall.set_possition(0, 0)
self.ground_list.add(wall)
wall = Ground('.//Grass//Grass_wals.png')
wall.set_possition(0, SCREEN_HEIGHT-70)
self.ground_list.add(wall)
wall = Ground('.//Grass//Grass_wals.png')
wall.set_possition(1600, SCREEN_HEIGHT - 70)
self.ground_list.add(wall)
platform = Ground('.//Grass//big_grass.png')
platform.set_possition(250, 185)
self.ground_list.add(platform)
platform = Ground('.//Grass//block_grass.png')
platform.set_possition(480, SCREEN_HEIGHT - 210)
self.ground_list.add(platform)
platform = Ground('.//Grass//block_grass.png')
platform.set_possition(300, SCREEN_HEIGHT - 210)
self.ground_list.add(platform)
platform = Hover_ground((0, 0), (280, 400), [0, -2], self, self.character_list, './/Grass//block_grass.png')
platform.set_possition(130, 344)
self.ground_list.add(platform)
platform = Hover_ground((700, 1300), (0, 0), [2, 0], self, self.character_list, './/Grass//block_grass.png')
platform.set_possition(700, 185)
self.ground_list.add(platform)
platform = Ground('.//Grass//small_grass.png')
platform.set_possition(1450, 250)
self.ground_list.add(platform)
self.items_list.add(Health_potion(self, 200, 200))
self.items_list.add(Mana_potion(self, 1800, 500))
gem = Quest_object(self, 300, 200)
self.items_list.add(gem)
witch = Witch(self, (750, SCREEN_HEIGHT-150, 400))
self.enemy_list.add(witch)
self.enemy_list.add(Bandit(self, (400, 135, 400)))
file = os.path.join('.//quests//ahriman_quest')
not_taken, taken, comleated = self._get_text_from_txt(file)
quest_npc = Ahriman_mage(self, witch, (1600, 200), Mana_potion, 'kill', not_taken, taken, comleated)
self.use_list.add(quest_npc)
file = os.path.join('.//quests//forest_elf_quest')
not_taken, taken, comleated = self._get_text_from_txt(file)
quest_npc = Elf_girl(self, gem, (2000, 200), Health_potion, 'bring', not_taken, taken, comleated)
self.use_list.add(quest_npc) | gpl-3.0 |
jiangwei1221/django-virtualenv-demo | env/lib/python2.7/site-packages/sqlparse/sql.py | 1 | 19239 | # -*- coding: utf-8 -*-
"""This module contains classes representing syntactical elements of SQL."""
import re
import sys
from sqlparse import tokens as T
class Token(object):
"""Base class for all other classes in this module.
It represents a single token and has two instance attributes:
``value`` is the unchange value of the token and ``ttype`` is
the type of the token.
"""
__slots__ = ('value', 'ttype', 'parent', 'normalized', 'is_keyword')
def __init__(self, ttype, value):
self.value = value
if ttype in T.Keyword:
self.normalized = value.upper()
else:
self.normalized = value
self.ttype = ttype
self.is_keyword = ttype in T.Keyword
self.parent = None
def __str__(self):
if sys.version_info[0] == 3:
return self.value
else:
return unicode(self).encode('utf-8')
def __repr__(self):
short = self._get_repr_value()
if sys.version_info[0] < 3:
short = short.encode('utf-8')
return '<%s \'%s\' at 0x%07x>' % (self._get_repr_name(),
short, id(self))
def __unicode__(self):
"""Returns a unicode representation of this object."""
return self.value or ''
def to_unicode(self):
"""Returns a unicode representation of this object.
.. deprecated:: 0.1.5
Use ``unicode(token)`` (for Python 3: ``str(token)``) instead.
"""
return unicode(self)
def _get_repr_name(self):
return str(self.ttype).split('.')[-1]
def _get_repr_value(self):
raw = unicode(self)
if len(raw) > 7:
raw = raw[:6] + u'...'
return re.sub('\s+', ' ', raw)
def flatten(self):
"""Resolve subgroups."""
yield self
def match(self, ttype, values, regex=False):
"""Checks whether the token matches the given arguments.
*ttype* is a token type. If this token doesn't match the given token
type.
*values* is a list of possible values for this token. The values
are OR'ed together so if only one of the values matches ``True``
is returned. Except for keyword tokens the comparison is
case-sensitive. For convenience it's ok to pass in a single string.
If *regex* is ``True`` (default is ``False``) the given values are
treated as regular expressions.
"""
type_matched = self.ttype is ttype
if not type_matched or values is None:
return type_matched
if regex:
if isinstance(values, basestring):
values = set([values])
if self.ttype is T.Keyword:
values = set(re.compile(v, re.IGNORECASE) for v in values)
else:
values = set(re.compile(v) for v in values)
for pattern in values:
if pattern.search(self.value):
return True
return False
if isinstance(values, basestring):
if self.is_keyword:
return values.upper() == self.normalized
return values == self.value
if self.is_keyword:
for v in values:
if v.upper() == self.normalized:
return True
return False
return self.value in values
def is_group(self):
"""Returns ``True`` if this object has children."""
return False
def is_whitespace(self):
"""Return ``True`` if this token is a whitespace token."""
return self.ttype and self.ttype in T.Whitespace
def within(self, group_cls):
"""Returns ``True`` if this token is within *group_cls*.
Use this method for example to check if an identifier is within
a function: ``t.within(sql.Function)``.
"""
parent = self.parent
while parent:
if isinstance(parent, group_cls):
return True
parent = parent.parent
return False
def is_child_of(self, other):
"""Returns ``True`` if this token is a direct child of *other*."""
return self.parent == other
def has_ancestor(self, other):
"""Returns ``True`` if *other* is in this tokens ancestry."""
parent = self.parent
while parent:
if parent == other:
return True
parent = parent.parent
return False
class TokenList(Token):
"""A group of tokens.
It has an additional instance attribute ``tokens`` which holds a
list of child-tokens.
"""
__slots__ = ('value', 'ttype', 'tokens')
def __init__(self, tokens=None):
if tokens is None:
tokens = []
self.tokens = tokens
Token.__init__(self, None, self._to_string())
def __unicode__(self):
return self._to_string()
def __str__(self):
str_ = self._to_string()
if sys.version_info[0] < 2:
str_ = str_.encode('utf-8')
return str_
def _to_string(self):
if sys.version_info[0] == 3:
return ''.join(x.value for x in self.flatten())
else:
return ''.join(unicode(x) for x in self.flatten())
def _get_repr_name(self):
return self.__class__.__name__
def _pprint_tree(self, max_depth=None, depth=0):
"""Pretty-print the object tree."""
indent = ' ' * (depth * 2)
for idx, token in enumerate(self.tokens):
if token.is_group():
pre = ' +-'
else:
pre = ' | '
print '%s%s%d %s \'%s\'' % (indent, pre, idx,
token._get_repr_name(),
token._get_repr_value())
if (token.is_group() and (max_depth is None or depth < max_depth)):
token._pprint_tree(max_depth, depth + 1)
def _remove_quotes(self, val):
"""Helper that removes surrounding quotes from strings."""
if not val:
return val
if val[0] in ('"', '\'') and val[-1] == val[0]:
val = val[1:-1]
return val
def get_token_at_offset(self, offset):
"""Returns the token that is on position offset."""
idx = 0
for token in self.flatten():
end = idx + len(token.value)
if idx <= offset <= end:
return token
idx = end
def flatten(self):
"""Generator yielding ungrouped tokens.
This method is recursively called for all child tokens.
"""
for token in self.tokens:
if isinstance(token, TokenList):
for item in token.flatten():
yield item
else:
yield token
# def __iter__(self):
# return self
#
# def next(self):
# for token in self.tokens:
# yield token
def is_group(self):
return True
def get_sublists(self):
# return [x for x in self.tokens if isinstance(x, TokenList)]
for x in self.tokens:
if isinstance(x, TokenList):
yield x
@property
def _groupable_tokens(self):
return self.tokens
def token_first(self, ignore_whitespace=True):
"""Returns the first child token.
If *ignore_whitespace* is ``True`` (the default), whitespace
tokens are ignored.
"""
for token in self.tokens:
if ignore_whitespace and token.is_whitespace():
continue
return token
def token_next_by_instance(self, idx, clss):
"""Returns the next token matching a class.
*idx* is where to start searching in the list of child tokens.
*clss* is a list of classes the token should be an instance of.
If no matching token can be found ``None`` is returned.
"""
if not isinstance(clss, (list, tuple)):
clss = (clss,)
for token in self.tokens[idx:]:
if isinstance(token, clss):
return token
def token_next_by_type(self, idx, ttypes):
"""Returns next matching token by it's token type."""
if not isinstance(ttypes, (list, tuple)):
ttypes = [ttypes]
for token in self.tokens[idx:]:
if token.ttype in ttypes:
return token
def token_next_match(self, idx, ttype, value, regex=False):
"""Returns next token where it's ``match`` method returns ``True``."""
if not isinstance(idx, int):
idx = self.token_index(idx)
for n in xrange(idx, len(self.tokens)):
token = self.tokens[n]
if token.match(ttype, value, regex):
return token
def token_not_matching(self, idx, funcs):
for token in self.tokens[idx:]:
passed = False
for func in funcs:
if func(token):
passed = True
break
if not passed:
return token
def token_matching(self, idx, funcs):
for token in self.tokens[idx:]:
for func in funcs:
if func(token):
return token
def token_prev(self, idx, skip_ws=True):
"""Returns the previous token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
``None`` is returned if there's no previous token.
"""
if idx is None:
return None
if not isinstance(idx, int):
idx = self.token_index(idx)
while idx:
idx -= 1
if self.tokens[idx].is_whitespace() and skip_ws:
continue
return self.tokens[idx]
def token_next(self, idx, skip_ws=True):
"""Returns the next token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
``None`` is returned if there's no next token.
"""
if idx is None:
return None
if not isinstance(idx, int):
idx = self.token_index(idx)
while idx < len(self.tokens) - 1:
idx += 1
if self.tokens[idx].is_whitespace() and skip_ws:
continue
return self.tokens[idx]
def token_index(self, token):
"""Return list index of token."""
return self.tokens.index(token)
def tokens_between(self, start, end, exclude_end=False):
"""Return all tokens between (and including) start and end.
If *exclude_end* is ``True`` (default is ``False``) the end token
is included too.
"""
# FIXME(andi): rename exclude_end to inlcude_end
if exclude_end:
offset = 0
else:
offset = 1
end_idx = self.token_index(end) + offset
start_idx = self.token_index(start)
return self.tokens[start_idx:end_idx]
def group_tokens(self, grp_cls, tokens, ignore_ws=False):
"""Replace tokens by an instance of *grp_cls*."""
idx = self.token_index(tokens[0])
if ignore_ws:
while tokens and tokens[-1].is_whitespace():
tokens = tokens[:-1]
for t in tokens:
self.tokens.remove(t)
grp = grp_cls(tokens)
for token in tokens:
token.parent = grp
grp.parent = self
self.tokens.insert(idx, grp)
return grp
def insert_before(self, where, token):
"""Inserts *token* before *where*."""
self.tokens.insert(self.token_index(where), token)
def insert_after(self, where, token, skip_ws=True):
"""Inserts *token* after *where*."""
next_token = self.token_next(where, skip_ws=skip_ws)
if next_token is None:
self.tokens.append(token)
else:
self.tokens.insert(self.token_index(next_token), token)
def has_alias(self):
"""Returns ``True`` if an alias is present."""
return self.get_alias() is not None
def get_alias(self):
"""Returns the alias for this identifier or ``None``."""
kw = self.token_next_match(0, T.Keyword, 'AS')
if kw is not None:
alias = self.token_next(self.token_index(kw))
if alias is None:
return None
else:
next_ = self.token_next_by_instance(0, Identifier)
if next_ is None:
next_ = self.token_next_by_type(0, T.String.Symbol)
if next_ is None:
return None
alias = next_
if isinstance(alias, Identifier):
return alias.get_name()
return self._remove_quotes(unicode(alias))
def get_name(self):
"""Returns the name of this identifier.
This is either it's alias or it's real name. The returned valued can
be considered as the name under which the object corresponding to
this identifier is known within the current statement.
"""
alias = self.get_alias()
if alias is not None:
return alias
return self.get_real_name()
def get_real_name(self):
"""Returns the real name (object name) of this identifier."""
# a.b
dot = self.token_next_match(0, T.Punctuation, '.')
if dot is None:
next_ = self.token_next_by_type(0, T.Name)
if next_ is not None:
return self._remove_quotes(next_.value)
return None
next_ = self.token_next_by_type(self.token_index(dot),
(T.Name, T.Wildcard, T.String.Symbol))
if next_ is None: # invalid identifier, e.g. "a."
return None
return self._remove_quotes(next_.value)
class Statement(TokenList):
"""Represents a SQL statement."""
__slots__ = ('value', 'ttype', 'tokens')
def get_type(self):
"""Returns the type of a statement.
The returned value is a string holding an upper-cased reprint of
the first DML or DDL keyword. If the first token in this group
isn't a DML or DDL keyword "UNKNOWN" is returned.
"""
first_token = self.token_first()
if first_token is None:
# An "empty" statement that either has not tokens at all
# or only whitespace tokens.
return 'UNKNOWN'
elif first_token.ttype in (T.Keyword.DML, T.Keyword.DDL):
return first_token.normalized
return 'UNKNOWN'
class Identifier(TokenList):
"""Represents an identifier.
Identifiers may have aliases or typecasts.
"""
__slots__ = ('value', 'ttype', 'tokens')
def get_parent_name(self):
"""Return name of the parent object if any.
A parent object is identified by the first occuring dot.
"""
dot = self.token_next_match(0, T.Punctuation, '.')
if dot is None:
return None
prev_ = self.token_prev(self.token_index(dot))
if prev_ is None: # something must be verry wrong here..
return None
return self._remove_quotes(prev_.value)
def is_wildcard(self):
"""Return ``True`` if this identifier contains a wildcard."""
token = self.token_next_by_type(0, T.Wildcard)
return token is not None
def get_typecast(self):
"""Returns the typecast or ``None`` of this object as a string."""
marker = self.token_next_match(0, T.Punctuation, '::')
if marker is None:
return None
next_ = self.token_next(self.token_index(marker), False)
if next_ is None:
return None
return unicode(next_)
def get_ordering(self):
"""Returns the ordering or ``None`` as uppercase string."""
ordering = self.token_next_by_type(0, T.Keyword.Order)
if ordering is None:
return None
return ordering.value.upper()
class IdentifierList(TokenList):
"""A list of :class:`~sqlparse.sql.Identifier`\'s."""
__slots__ = ('value', 'ttype', 'tokens')
def get_identifiers(self):
"""Returns the identifiers.
Whitespaces and punctuations are not included in this generator.
"""
for x in self.tokens:
if not x.is_whitespace() and not x.match(T.Punctuation, ','):
yield x
class Parenthesis(TokenList):
"""Tokens between parenthesis."""
__slots__ = ('value', 'ttype', 'tokens')
@property
def _groupable_tokens(self):
return self.tokens[1:-1]
class Assignment(TokenList):
"""An assignment like 'var := val;'"""
__slots__ = ('value', 'ttype', 'tokens')
class If(TokenList):
"""An 'if' clause with possible 'else if' or 'else' parts."""
__slots__ = ('value', 'ttype', 'tokens')
class For(TokenList):
"""A 'FOR' loop."""
__slots__ = ('value', 'ttype', 'tokens')
class Comparison(TokenList):
"""A comparison used for example in WHERE clauses."""
__slots__ = ('value', 'ttype', 'tokens')
@property
def left(self):
return self.tokens[0]
@property
def right(self):
return self.tokens[-1]
class Comment(TokenList):
"""A comment."""
__slots__ = ('value', 'ttype', 'tokens')
class Where(TokenList):
"""A WHERE clause."""
__slots__ = ('value', 'ttype', 'tokens')
class Case(TokenList):
"""A CASE statement with one or more WHEN and possibly an ELSE part."""
__slots__ = ('value', 'ttype', 'tokens')
def get_cases(self):
"""Returns a list of 2-tuples (condition, value).
If an ELSE exists condition is None.
"""
CONDITION = 1
VALUE = 2
ret = []
mode = CONDITION
for token in self.tokens:
# Set mode from the current statement
if token.match(T.Keyword, 'CASE'):
continue
elif token.match(T.Keyword, 'WHEN'):
ret.append(([], []))
mode = CONDITION
elif token.match(T.Keyword, 'THEN'):
mode = VALUE
elif token.match(T.Keyword, 'ELSE'):
ret.append((None, []))
mode = VALUE
elif token.match(T.Keyword, 'END'):
mode = None
# First condition without preceding WHEN
if mode and not ret:
ret.append(([], []))
# Append token depending of the current mode
if mode == CONDITION:
ret[-1][0].append(token)
elif mode == VALUE:
ret[-1][1].append(token)
# Return cases list
return ret
class Function(TokenList):
"""A function or procedure call."""
__slots__ = ('value', 'ttype', 'tokens')
def get_parameters(self):
"""Return a list of parameters."""
parenthesis = self.tokens[-1]
for t in parenthesis.tokens:
if isinstance(t, IdentifierList):
return t.get_identifiers()
elif isinstance(t, Identifier):
return [t,]
return []
| unlicense |
saeki-masaki/cinder | cinder/tests/unit/scheduler/test_rpcapi.py | 11 | 5066 |
# Copyright 2012, Red Hat, Inc.
#
# 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.
"""
Unit Tests for cinder.scheduler.rpcapi
"""
import copy
import mock
from oslo_config import cfg
from cinder import context
from cinder.scheduler import rpcapi as scheduler_rpcapi
from cinder import test
CONF = cfg.CONF
class SchedulerRpcAPITestCase(test.TestCase):
def setUp(self):
super(SchedulerRpcAPITestCase, self).setUp()
def tearDown(self):
super(SchedulerRpcAPITestCase, self).tearDown()
def _test_scheduler_api(self, method, rpc_method,
fanout=False, **kwargs):
ctxt = context.RequestContext('fake_user', 'fake_project')
rpcapi = scheduler_rpcapi.SchedulerAPI()
expected_retval = 'foo' if rpc_method == 'call' else None
target = {
"fanout": fanout,
"version": kwargs.pop('version', rpcapi.RPC_API_VERSION)
}
expected_msg = copy.deepcopy(kwargs)
self.fake_args = None
self.fake_kwargs = None
def _fake_prepare_method(*args, **kwds):
for kwd in kwds:
self.assertEqual(kwds[kwd], target[kwd])
return rpcapi.client
def _fake_rpc_method(*args, **kwargs):
self.fake_args = args
self.fake_kwargs = kwargs
if expected_retval:
return expected_retval
with mock.patch.object(rpcapi.client, "prepare") as mock_prepared:
mock_prepared.side_effect = _fake_prepare_method
with mock.patch.object(rpcapi.client, rpc_method) as mock_method:
mock_method.side_effect = _fake_rpc_method
retval = getattr(rpcapi, method)(ctxt, **kwargs)
self.assertEqual(retval, expected_retval)
expected_args = [ctxt, method, expected_msg]
for arg, expected_arg in zip(self.fake_args, expected_args):
self.assertEqual(arg, expected_arg)
def test_update_service_capabilities(self):
self._test_scheduler_api('update_service_capabilities',
rpc_method='cast',
service_name='fake_name',
host='fake_host',
capabilities='fake_capabilities',
fanout=True)
def test_create_volume(self):
self._test_scheduler_api('create_volume',
rpc_method='cast',
topic='topic',
volume_id='volume_id',
snapshot_id='snapshot_id',
image_id='image_id',
request_spec='fake_request_spec',
filter_properties='filter_properties',
version='1.2')
def test_migrate_volume_to_host(self):
self._test_scheduler_api('migrate_volume_to_host',
rpc_method='cast',
topic='topic',
volume_id='volume_id',
host='host',
force_host_copy=True,
request_spec='fake_request_spec',
filter_properties='filter_properties',
version='1.3')
def test_retype(self):
self._test_scheduler_api('retype',
rpc_method='cast',
topic='topic',
volume_id='volume_id',
request_spec='fake_request_spec',
filter_properties='filter_properties',
version='1.4')
def test_manage_existing(self):
self._test_scheduler_api('manage_existing',
rpc_method='cast',
topic='topic',
volume_id='volume_id',
request_spec='fake_request_spec',
filter_properties='filter_properties',
version='1.5')
def test_get_pools(self):
self._test_scheduler_api('get_pools',
rpc_method='call',
filters=None,
version='1.7')
| apache-2.0 |
leonsooi/pymel | pymel/util/external/ply/yacc.py | 319 | 128492 | # -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2009,
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the David Beazley or Dabeaz LLC may be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# This implements an LR parser that is constructed from grammar rules defined
# as Python functions. The grammer is specified by supplying the BNF inside
# Python documentation strings. The inspiration for this technique was borrowed
# from John Aycock's Spark parsing system. PLY might be viewed as cross between
# Spark and the GNU bison utility.
#
# The current implementation is only somewhat object-oriented. The
# LR parser itself is defined in terms of an object (which allows multiple
# parsers to co-exist). However, most of the variables used during table
# construction are defined in terms of global variables. Users shouldn't
# notice unless they are trying to define multiple parsers at the same
# time using threads (in which case they should have their head examined).
#
# This implementation supports both SLR and LALR(1) parsing. LALR(1)
# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu),
# using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles,
# Techniques, and Tools" (The Dragon Book). LALR(1) has since been replaced
# by the more efficient DeRemer and Pennello algorithm.
#
# :::::::: WARNING :::::::
#
# Construction of LR parsing tables is fairly complicated and expensive.
# To make this module run fast, a *LOT* of work has been put into
# optimization---often at the expensive of readability and what might
# consider to be good Python "coding style." Modify the code at your
# own risk!
# ----------------------------------------------------------------------------
__version__ = "3.3"
__tabversion__ = "3.2" # Table version
#-----------------------------------------------------------------------------
# === User configurable parameters ===
#
# Change these to modify the default behavior of yacc (if you wish)
#-----------------------------------------------------------------------------
yaccdebug = 1 # Debugging mode. If set, yacc generates a
# a 'parser.out' file in the current directory
debug_file = 'parser.out' # Default name of the debugging file
tab_module = 'parsetab' # Default name of the table module
default_lr = 'LALR' # Default LR table generation method
error_count = 3 # Number of symbols that must be shifted to leave recovery mode
yaccdevel = 0 # Set to True if developing yacc. This turns off optimized
# implementations of certain functions.
resultlimit = 40 # Size limit of results when running in debug mode.
pickle_protocol = 0 # Protocol to use when writing pickle files
import re, types, sys, os.path
# Compatibility function for python 2.6/3.0
if sys.version_info[0] < 3:
def func_code(f):
return f.func_code
else:
def func_code(f):
return f.__code__
# Compatibility
try:
MAXINT = sys.maxint
except AttributeError:
MAXINT = sys.maxsize
# Python 2.x/3.0 compatibility.
def load_ply_lex():
if sys.version_info[0] < 3:
import lex
else:
import ply.lex as lex
return lex
# This object is a stand-in for a logging object created by the
# logging module. PLY will use this by default to create things
# such as the parser.out file. If a user wants more detailed
# information, they can create their own logging object and pass
# it into PLY.
class PlyLogger(object):
def __init__(self,f):
self.f = f
def debug(self,msg,*args,**kwargs):
self.f.write((msg % args) + "\n")
info = debug
def warning(self,msg,*args,**kwargs):
self.f.write("WARNING: "+ (msg % args) + "\n")
def error(self,msg,*args,**kwargs):
self.f.write("ERROR: " + (msg % args) + "\n")
critical = debug
# Null logger is used when no output is generated. Does nothing.
class NullLogger(object):
def __getattribute__(self,name):
return self
def __call__(self,*args,**kwargs):
return self
# Exception raised for yacc-related errors
class YaccError(Exception): pass
# Format the result message that the parser produces when running in debug mode.
def format_result(r):
repr_str = repr(r)
if '\n' in repr_str: repr_str = repr(repr_str)
if len(repr_str) > resultlimit:
repr_str = repr_str[:resultlimit]+" ..."
result = "<%s @ 0x%x> (%s)" % (type(r).__name__,id(r),repr_str)
return result
# Format stack entries when the parser is running in debug mode
def format_stack_entry(r):
repr_str = repr(r)
if '\n' in repr_str: repr_str = repr(repr_str)
if len(repr_str) < 16:
return repr_str
else:
return "<%s @ 0x%x>" % (type(r).__name__,id(r))
#-----------------------------------------------------------------------------
# === LR Parsing Engine ===
#
# The following classes are used for the LR parser itself. These are not
# used during table construction and are independent of the actual LR
# table generation algorithm
#-----------------------------------------------------------------------------
# This class is used to hold non-terminal grammar symbols during parsing.
# It normally has the following attributes set:
# .type = Grammar symbol type
# .value = Symbol value
# .lineno = Starting line number
# .endlineno = Ending line number (optional, set automatically)
# .lexpos = Starting lex position
# .endlexpos = Ending lex position (optional, set automatically)
class YaccSymbol:
def __str__(self): return self.type
def __repr__(self): return str(self)
# This class is a wrapper around the objects actually passed to each
# grammar rule. Index lookup and assignment actually assign the
# .value attribute of the underlying YaccSymbol object.
# The lineno() method returns the line number of a given
# item (or 0 if not defined). The linespan() method returns
# a tuple of (startline,endline) representing the range of lines
# for a symbol. The lexspan() method returns a tuple (lexpos,endlexpos)
# representing the range of positional information for a symbol.
class YaccProduction:
def __init__(self,s,stack=None):
self.slice = s
self.stack = stack
self.lexer = None
self.parser= None
def __getitem__(self,n):
if n >= 0: return self.slice[n].value
else: return self.stack[n].value
def __setitem__(self,n,v):
self.slice[n].value = v
def __getslice__(self,i,j):
return [s.value for s in self.slice[i:j]]
def __len__(self):
return len(self.slice)
def lineno(self,n):
return getattr(self.slice[n],"lineno",0)
def set_lineno(self,n,lineno):
self.slice[n].lineno = lineno
def linespan(self,n):
startline = getattr(self.slice[n],"lineno",0)
endline = getattr(self.slice[n],"endlineno",startline)
return startline,endline
def lexpos(self,n):
return getattr(self.slice[n],"lexpos",0)
def lexspan(self,n):
startpos = getattr(self.slice[n],"lexpos",0)
endpos = getattr(self.slice[n],"endlexpos",startpos)
return startpos,endpos
def error(self):
raise SyntaxError
# -----------------------------------------------------------------------------
# == LRParser ==
#
# The LR Parsing engine.
# -----------------------------------------------------------------------------
class LRParser:
def __init__(self,lrtab,errorf):
self.productions = lrtab.lr_productions
self.action = lrtab.lr_action
self.goto = lrtab.lr_goto
self.errorfunc = errorf
def errok(self):
self.errorok = 1
def restart(self):
del self.statestack[:]
del self.symstack[:]
sym = YaccSymbol()
sym.type = '$end'
self.symstack.append(sym)
self.statestack.append(0)
def parse(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None):
if debug or yaccdevel:
if isinstance(debug,int):
debug = PlyLogger(sys.stderr)
return self.parsedebug(input,lexer,debug,tracking,tokenfunc)
elif tracking:
return self.parseopt(input,lexer,debug,tracking,tokenfunc)
else:
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# parsedebug().
#
# This is the debugging enabled version of parse(). All changes made to the
# parsing engine should be made here. For the non-debugging version,
# copy this code to a method parseopt() and delete all of the sections
# enclosed in:
#
# #--! DEBUG
# statements
# #--! DEBUG
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
def parsedebug(self,input=None,lexer=None,debug=None,tracking=0,tokenfunc=None):
lookahead = None # Current lookahead symbol
lookaheadstack = [ ] # Stack of lookahead symbols
actions = self.action # Local reference to action table (to avoid lookup on self.)
goto = self.goto # Local reference to goto table (to avoid lookup on self.)
prod = self.productions # Local reference to production list (to avoid lookup on self.)
pslice = YaccProduction(None) # Production object passed to grammar rules
errorcount = 0 # Used during error recovery
# --! DEBUG
debug.info("PLY: PARSE DEBUG START")
# --! DEBUG
# If no lexer was given, we will try to use the lex module
if not lexer:
lex = load_ply_lex()
lexer = lex.lexer
# Set up the lexer and parser objects on pslice
pslice.lexer = lexer
pslice.parser = self
# If input was supplied, pass to lexer
if input is not None:
lexer.input(input)
if tokenfunc is None:
# Tokenize function
get_token = lexer.token
else:
get_token = tokenfunc
# Set up the state and symbol stacks
statestack = [ ] # Stack of parsing states
self.statestack = statestack
symstack = [ ] # Stack of grammar symbols
self.symstack = symstack
pslice.stack = symstack # Put in the production
errtoken = None # Err token
# The start state is assumed to be (0,$end)
statestack.append(0)
sym = YaccSymbol()
sym.type = "$end"
symstack.append(sym)
state = 0
while 1:
# Get the next symbol on the input. If a lookahead symbol
# is already set, we just use that. Otherwise, we'll pull
# the next token off of the lookaheadstack or from the lexer
# --! DEBUG
debug.debug('')
debug.debug('State : %s', state)
# --! DEBUG
if not lookahead:
if not lookaheadstack:
lookahead = get_token() # Get the next token
else:
lookahead = lookaheadstack.pop()
if not lookahead:
lookahead = YaccSymbol()
lookahead.type = "$end"
# --! DEBUG
debug.debug('Stack : %s',
("%s . %s" % (" ".join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())
# --! DEBUG
# Check the action table
ltype = lookahead.type
t = actions[state].get(ltype)
if t is not None:
if t > 0:
# shift a symbol on the stack
statestack.append(t)
state = t
# --! DEBUG
debug.debug("Action : Shift and goto state %s", t)
# --! DEBUG
symstack.append(lookahead)
lookahead = None
# Decrease error count on successful shift
if errorcount: errorcount -=1
continue
if t < 0:
# reduce a symbol on the stack, emit a production
p = prod[-t]
pname = p.name
plen = p.len
# Get production function
sym = YaccSymbol()
sym.type = pname # Production name
sym.value = None
# --! DEBUG
if plen:
debug.info("Action : Reduce rule [%s] with %s and goto state %d", p.str, "["+",".join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+"]",-t)
else:
debug.info("Action : Reduce rule [%s] with %s and goto state %d", p.str, [],-t)
# --! DEBUG
if plen:
targ = symstack[-plen-1:]
targ[0] = sym
# --! TRACKING
if tracking:
t1 = targ[1]
sym.lineno = t1.lineno
sym.lexpos = t1.lexpos
t1 = targ[-1]
sym.endlineno = getattr(t1,"endlineno",t1.lineno)
sym.endlexpos = getattr(t1,"endlexpos",t1.lexpos)
# --! TRACKING
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# below as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
del symstack[-plen:]
del statestack[-plen:]
p.callable(pslice)
# --! DEBUG
debug.info("Result : %s", format_result(pslice[0]))
# --! DEBUG
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
else:
# --! TRACKING
if tracking:
sym.lineno = lexer.lineno
sym.lexpos = lexer.lexpos
# --! TRACKING
targ = [ sym ]
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# above as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
p.callable(pslice)
# --! DEBUG
debug.info("Result : %s", format_result(pslice[0]))
# --! DEBUG
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if t == 0:
n = symstack[-1]
result = getattr(n,"value",None)
# --! DEBUG
debug.info("Done : Returning %s", format_result(result))
debug.info("PLY: PARSE DEBUG END")
# --! DEBUG
return result
if t == None:
# --! DEBUG
debug.error('Error : %s',
("%s . %s" % (" ".join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())
# --! DEBUG
# We have some kind of parsing error here. To handle
# this, we are going to push the current token onto
# the tokenstack and replace it with an 'error' token.
# If there are any synchronization rules, they may
# catch it.
#
# In addition to pushing the error token, we call call
# the user defined p_error() function if this is the
# first syntax error. This function is only called if
# errorcount == 0.
if errorcount == 0 or self.errorok:
errorcount = error_count
self.errorok = 0
errtoken = lookahead
if errtoken.type == "$end":
errtoken = None # End of file!
if self.errorfunc:
global errok,token,restart
errok = self.errok # Set some special functions available in error recovery
token = get_token
restart = self.restart
if errtoken and not hasattr(errtoken,'lexer'):
errtoken.lexer = lexer
tok = self.errorfunc(errtoken)
del errok, token, restart # Delete special functions
if self.errorok:
# User must have done some kind of panic
# mode recovery on their own. The
# returned token is the next lookahead
lookahead = tok
errtoken = None
continue
else:
if errtoken:
if hasattr(errtoken,"lineno"): lineno = lookahead.lineno
else: lineno = 0
if lineno:
sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type))
else:
sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type)
else:
sys.stderr.write("yacc: Parse error in input. EOF\n")
return
else:
errorcount = error_count
# case 1: the statestack only has 1 entry on it. If we're in this state, the
# entire parse has been rolled back and we're completely hosed. The token is
# discarded and we just keep going.
if len(statestack) <= 1 and lookahead.type != "$end":
lookahead = None
errtoken = None
state = 0
# Nuke the pushback stack
del lookaheadstack[:]
continue
# case 2: the statestack has a couple of entries on it, but we're
# at the end of the file. nuke the top entry and generate an error token
# Start nuking entries on the stack
if lookahead.type == "$end":
# Whoa. We're really hosed here. Bail out
return
if lookahead.type != 'error':
sym = symstack[-1]
if sym.type == 'error':
# Hmmm. Error is on top of stack, we'll just nuke input
# symbol and continue
lookahead = None
continue
t = YaccSymbol()
t.type = 'error'
if hasattr(lookahead,"lineno"):
t.lineno = lookahead.lineno
t.value = lookahead
lookaheadstack.append(lookahead)
lookahead = t
else:
symstack.pop()
statestack.pop()
state = statestack[-1] # Potential bug fix
continue
# Call an error function here
raise RuntimeError("yacc: internal parser error!!!\n")
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# parseopt().
#
# Optimized version of parse() method. DO NOT EDIT THIS CODE DIRECTLY.
# Edit the debug version above, then copy any modifications to the method
# below while removing #--! DEBUG sections.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
def parseopt(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None):
lookahead = None # Current lookahead symbol
lookaheadstack = [ ] # Stack of lookahead symbols
actions = self.action # Local reference to action table (to avoid lookup on self.)
goto = self.goto # Local reference to goto table (to avoid lookup on self.)
prod = self.productions # Local reference to production list (to avoid lookup on self.)
pslice = YaccProduction(None) # Production object passed to grammar rules
errorcount = 0 # Used during error recovery
# If no lexer was given, we will try to use the lex module
if not lexer:
lex = load_ply_lex()
lexer = lex.lexer
# Set up the lexer and parser objects on pslice
pslice.lexer = lexer
pslice.parser = self
# If input was supplied, pass to lexer
if input is not None:
lexer.input(input)
if tokenfunc is None:
# Tokenize function
get_token = lexer.token
else:
get_token = tokenfunc
# Set up the state and symbol stacks
statestack = [ ] # Stack of parsing states
self.statestack = statestack
symstack = [ ] # Stack of grammar symbols
self.symstack = symstack
pslice.stack = symstack # Put in the production
errtoken = None # Err token
# The start state is assumed to be (0,$end)
statestack.append(0)
sym = YaccSymbol()
sym.type = '$end'
symstack.append(sym)
state = 0
while 1:
# Get the next symbol on the input. If a lookahead symbol
# is already set, we just use that. Otherwise, we'll pull
# the next token off of the lookaheadstack or from the lexer
if not lookahead:
if not lookaheadstack:
lookahead = get_token() # Get the next token
else:
lookahead = lookaheadstack.pop()
if not lookahead:
lookahead = YaccSymbol()
lookahead.type = '$end'
# Check the action table
ltype = lookahead.type
t = actions[state].get(ltype)
if t is not None:
if t > 0:
# shift a symbol on the stack
statestack.append(t)
state = t
symstack.append(lookahead)
lookahead = None
# Decrease error count on successful shift
if errorcount: errorcount -=1
continue
if t < 0:
# reduce a symbol on the stack, emit a production
p = prod[-t]
pname = p.name
plen = p.len
# Get production function
sym = YaccSymbol()
sym.type = pname # Production name
sym.value = None
if plen:
targ = symstack[-plen-1:]
targ[0] = sym
# --! TRACKING
if tracking:
t1 = targ[1]
sym.lineno = t1.lineno
sym.lexpos = t1.lexpos
t1 = targ[-1]
sym.endlineno = getattr(t1,"endlineno",t1.lineno)
sym.endlexpos = getattr(t1,"endlexpos",t1.lexpos)
# --! TRACKING
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# below as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
del symstack[-plen:]
del statestack[-plen:]
p.callable(pslice)
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
else:
# --! TRACKING
if tracking:
sym.lineno = lexer.lineno
sym.lexpos = lexer.lexpos
# --! TRACKING
targ = [ sym ]
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# above as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
p.callable(pslice)
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if t == 0:
n = symstack[-1]
return getattr(n,"value",None)
if t == None:
# We have some kind of parsing error here. To handle
# this, we are going to push the current token onto
# the tokenstack and replace it with an 'error' token.
# If there are any synchronization rules, they may
# catch it.
#
# In addition to pushing the error token, we call call
# the user defined p_error() function if this is the
# first syntax error. This function is only called if
# errorcount == 0.
if errorcount == 0 or self.errorok:
errorcount = error_count
self.errorok = 0
errtoken = lookahead
if errtoken.type == '$end':
errtoken = None # End of file!
if self.errorfunc:
global errok,token,restart
errok = self.errok # Set some special functions available in error recovery
token = get_token
restart = self.restart
if errtoken and not hasattr(errtoken,'lexer'):
errtoken.lexer = lexer
tok = self.errorfunc(errtoken)
del errok, token, restart # Delete special functions
if self.errorok:
# User must have done some kind of panic
# mode recovery on their own. The
# returned token is the next lookahead
lookahead = tok
errtoken = None
continue
else:
if errtoken:
if hasattr(errtoken,"lineno"): lineno = lookahead.lineno
else: lineno = 0
if lineno:
sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type))
else:
sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type)
else:
sys.stderr.write("yacc: Parse error in input. EOF\n")
return
else:
errorcount = error_count
# case 1: the statestack only has 1 entry on it. If we're in this state, the
# entire parse has been rolled back and we're completely hosed. The token is
# discarded and we just keep going.
if len(statestack) <= 1 and lookahead.type != '$end':
lookahead = None
errtoken = None
state = 0
# Nuke the pushback stack
del lookaheadstack[:]
continue
# case 2: the statestack has a couple of entries on it, but we're
# at the end of the file. nuke the top entry and generate an error token
# Start nuking entries on the stack
if lookahead.type == '$end':
# Whoa. We're really hosed here. Bail out
return
if lookahead.type != 'error':
sym = symstack[-1]
if sym.type == 'error':
# Hmmm. Error is on top of stack, we'll just nuke input
# symbol and continue
lookahead = None
continue
t = YaccSymbol()
t.type = 'error'
if hasattr(lookahead,"lineno"):
t.lineno = lookahead.lineno
t.value = lookahead
lookaheadstack.append(lookahead)
lookahead = t
else:
symstack.pop()
statestack.pop()
state = statestack[-1] # Potential bug fix
continue
# Call an error function here
raise RuntimeError("yacc: internal parser error!!!\n")
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# parseopt_notrack().
#
# Optimized version of parseopt() with line number tracking removed.
# DO NOT EDIT THIS CODE DIRECTLY. Copy the optimized version and remove
# code in the #--! TRACKING sections
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
def parseopt_notrack(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None):
lookahead = None # Current lookahead symbol
lookaheadstack = [ ] # Stack of lookahead symbols
actions = self.action # Local reference to action table (to avoid lookup on self.)
goto = self.goto # Local reference to goto table (to avoid lookup on self.)
prod = self.productions # Local reference to production list (to avoid lookup on self.)
pslice = YaccProduction(None) # Production object passed to grammar rules
errorcount = 0 # Used during error recovery
# If no lexer was given, we will try to use the lex module
if not lexer:
lex = load_ply_lex()
lexer = lex.lexer
# Set up the lexer and parser objects on pslice
pslice.lexer = lexer
pslice.parser = self
# If input was supplied, pass to lexer
if input is not None:
lexer.input(input)
if tokenfunc is None:
# Tokenize function
get_token = lexer.token
else:
get_token = tokenfunc
# Set up the state and symbol stacks
statestack = [ ] # Stack of parsing states
self.statestack = statestack
symstack = [ ] # Stack of grammar symbols
self.symstack = symstack
pslice.stack = symstack # Put in the production
errtoken = None # Err token
# The start state is assumed to be (0,$end)
statestack.append(0)
sym = YaccSymbol()
sym.type = '$end'
symstack.append(sym)
state = 0
while 1:
# Get the next symbol on the input. If a lookahead symbol
# is already set, we just use that. Otherwise, we'll pull
# the next token off of the lookaheadstack or from the lexer
if not lookahead:
if not lookaheadstack:
lookahead = get_token() # Get the next token
else:
lookahead = lookaheadstack.pop()
if not lookahead:
lookahead = YaccSymbol()
lookahead.type = '$end'
# Check the action table
ltype = lookahead.type
t = actions[state].get(ltype)
if t is not None:
if t > 0:
# shift a symbol on the stack
statestack.append(t)
state = t
symstack.append(lookahead)
lookahead = None
# Decrease error count on successful shift
if errorcount: errorcount -=1
continue
if t < 0:
# reduce a symbol on the stack, emit a production
p = prod[-t]
pname = p.name
plen = p.len
# Get production function
sym = YaccSymbol()
sym.type = pname # Production name
sym.value = None
if plen:
targ = symstack[-plen-1:]
targ[0] = sym
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# below as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
del symstack[-plen:]
del statestack[-plen:]
p.callable(pslice)
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
else:
targ = [ sym ]
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# The code enclosed in this section is duplicated
# above as a performance optimization. Make sure
# changes get made in both locations.
pslice.slice = targ
try:
# Call the grammar rule with our special slice object
p.callable(pslice)
symstack.append(sym)
state = goto[statestack[-1]][pname]
statestack.append(state)
except SyntaxError:
# If an error was set. Enter error recovery state
lookaheadstack.append(lookahead)
symstack.pop()
statestack.pop()
state = statestack[-1]
sym.type = 'error'
lookahead = sym
errorcount = error_count
self.errorok = 0
continue
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if t == 0:
n = symstack[-1]
return getattr(n,"value",None)
if t == None:
# We have some kind of parsing error here. To handle
# this, we are going to push the current token onto
# the tokenstack and replace it with an 'error' token.
# If there are any synchronization rules, they may
# catch it.
#
# In addition to pushing the error token, we call call
# the user defined p_error() function if this is the
# first syntax error. This function is only called if
# errorcount == 0.
if errorcount == 0 or self.errorok:
errorcount = error_count
self.errorok = 0
errtoken = lookahead
if errtoken.type == '$end':
errtoken = None # End of file!
if self.errorfunc:
global errok,token,restart
errok = self.errok # Set some special functions available in error recovery
token = get_token
restart = self.restart
if errtoken and not hasattr(errtoken,'lexer'):
errtoken.lexer = lexer
tok = self.errorfunc(errtoken)
del errok, token, restart # Delete special functions
if self.errorok:
# User must have done some kind of panic
# mode recovery on their own. The
# returned token is the next lookahead
lookahead = tok
errtoken = None
continue
else:
if errtoken:
if hasattr(errtoken,"lineno"): lineno = lookahead.lineno
else: lineno = 0
if lineno:
sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type))
else:
sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type)
else:
sys.stderr.write("yacc: Parse error in input. EOF\n")
return
else:
errorcount = error_count
# case 1: the statestack only has 1 entry on it. If we're in this state, the
# entire parse has been rolled back and we're completely hosed. The token is
# discarded and we just keep going.
if len(statestack) <= 1 and lookahead.type != '$end':
lookahead = None
errtoken = None
state = 0
# Nuke the pushback stack
del lookaheadstack[:]
continue
# case 2: the statestack has a couple of entries on it, but we're
# at the end of the file. nuke the top entry and generate an error token
# Start nuking entries on the stack
if lookahead.type == '$end':
# Whoa. We're really hosed here. Bail out
return
if lookahead.type != 'error':
sym = symstack[-1]
if sym.type == 'error':
# Hmmm. Error is on top of stack, we'll just nuke input
# symbol and continue
lookahead = None
continue
t = YaccSymbol()
t.type = 'error'
if hasattr(lookahead,"lineno"):
t.lineno = lookahead.lineno
t.value = lookahead
lookaheadstack.append(lookahead)
lookahead = t
else:
symstack.pop()
statestack.pop()
state = statestack[-1] # Potential bug fix
continue
# Call an error function here
raise RuntimeError("yacc: internal parser error!!!\n")
# -----------------------------------------------------------------------------
# === Grammar Representation ===
#
# The following functions, classes, and variables are used to represent and
# manipulate the rules that make up a grammar.
# -----------------------------------------------------------------------------
import re
# regex matching identifiers
_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$')
# -----------------------------------------------------------------------------
# class Production:
#
# This class stores the raw information about a single production or grammar rule.
# A grammar rule refers to a specification such as this:
#
# expr : expr PLUS term
#
# Here are the basic attributes defined on all productions
#
# name - Name of the production. For example 'expr'
# prod - A list of symbols on the right side ['expr','PLUS','term']
# prec - Production precedence level
# number - Production number.
# func - Function that executes on reduce
# file - File where production function is defined
# lineno - Line number where production function is defined
#
# The following attributes are defined or optional.
#
# len - Length of the production (number of symbols on right hand side)
# usyms - Set of unique symbols found in the production
# -----------------------------------------------------------------------------
class Production(object):
reduced = 0
def __init__(self,number,name,prod,precedence=('right',0),func=None,file='',line=0):
self.name = name
self.prod = tuple(prod)
self.number = number
self.func = func
self.callable = None
self.file = file
self.line = line
self.prec = precedence
# Internal settings used during table construction
self.len = len(self.prod) # Length of the production
# Create a list of unique production symbols used in the production
self.usyms = [ ]
for s in self.prod:
if s not in self.usyms:
self.usyms.append(s)
# List of all LR items for the production
self.lr_items = []
self.lr_next = None
# Create a string representation
if self.prod:
self.str = "%s -> %s" % (self.name," ".join(self.prod))
else:
self.str = "%s -> <empty>" % self.name
def __str__(self):
return self.str
def __repr__(self):
return "Production("+str(self)+")"
def __len__(self):
return len(self.prod)
def __nonzero__(self):
return 1
def __getitem__(self,index):
return self.prod[index]
# Return the nth lr_item from the production (or None if at the end)
def lr_item(self,n):
if n > len(self.prod): return None
p = LRItem(self,n)
# Precompute the list of productions immediately following. Hack. Remove later
try:
p.lr_after = Prodnames[p.prod[n+1]]
except (IndexError,KeyError):
p.lr_after = []
try:
p.lr_before = p.prod[n-1]
except IndexError:
p.lr_before = None
return p
# Bind the production function name to a callable
def bind(self,pdict):
if self.func:
self.callable = pdict[self.func]
# This class serves as a minimal standin for Production objects when
# reading table data from files. It only contains information
# actually used by the LR parsing engine, plus some additional
# debugging information.
class MiniProduction(object):
def __init__(self,str,name,len,func,file,line):
self.name = name
self.len = len
self.func = func
self.callable = None
self.file = file
self.line = line
self.str = str
def __str__(self):
return self.str
def __repr__(self):
return "MiniProduction(%s)" % self.str
# Bind the production function name to a callable
def bind(self,pdict):
if self.func:
self.callable = pdict[self.func]
# -----------------------------------------------------------------------------
# class LRItem
#
# This class represents a specific stage of parsing a production rule. For
# example:
#
# expr : expr . PLUS term
#
# In the above, the "." represents the current location of the parse. Here
# basic attributes:
#
# name - Name of the production. For example 'expr'
# prod - A list of symbols on the right side ['expr','.', 'PLUS','term']
# number - Production number.
#
# lr_next Next LR item. Example, if we are ' expr -> expr . PLUS term'
# then lr_next refers to 'expr -> expr PLUS . term'
# lr_index - LR item index (location of the ".") in the prod list.
# lookaheads - LALR lookahead symbols for this item
# len - Length of the production (number of symbols on right hand side)
# lr_after - List of all productions that immediately follow
# lr_before - Grammar symbol immediately before
# -----------------------------------------------------------------------------
class LRItem(object):
def __init__(self,p,n):
self.name = p.name
self.prod = list(p.prod)
self.number = p.number
self.lr_index = n
self.lookaheads = { }
self.prod.insert(n,".")
self.prod = tuple(self.prod)
self.len = len(self.prod)
self.usyms = p.usyms
def __str__(self):
if self.prod:
s = "%s -> %s" % (self.name," ".join(self.prod))
else:
s = "%s -> <empty>" % self.name
return s
def __repr__(self):
return "LRItem("+str(self)+")"
# -----------------------------------------------------------------------------
# rightmost_terminal()
#
# Return the rightmost terminal from a list of symbols. Used in add_production()
# -----------------------------------------------------------------------------
def rightmost_terminal(symbols, terminals):
i = len(symbols) - 1
while i >= 0:
if symbols[i] in terminals:
return symbols[i]
i -= 1
return None
# -----------------------------------------------------------------------------
# === GRAMMAR CLASS ===
#
# The following class represents the contents of the specified grammar along
# with various computed properties such as first sets, follow sets, LR items, etc.
# This data is used for critical parts of the table generation process later.
# -----------------------------------------------------------------------------
class GrammarError(YaccError): pass
class Grammar(object):
def __init__(self,terminals):
self.Productions = [None] # A list of all of the productions. The first
# entry is always reserved for the purpose of
# building an augmented grammar
self.Prodnames = { } # A dictionary mapping the names of nonterminals to a list of all
# productions of that nonterminal.
self.Prodmap = { } # A dictionary that is only used to detect duplicate
# productions.
self.Terminals = { } # A dictionary mapping the names of terminal symbols to a
# list of the rules where they are used.
for term in terminals:
self.Terminals[term] = []
self.Terminals['error'] = []
self.Nonterminals = { } # A dictionary mapping names of nonterminals to a list
# of rule numbers where they are used.
self.First = { } # A dictionary of precomputed FIRST(x) symbols
self.Follow = { } # A dictionary of precomputed FOLLOW(x) symbols
self.Precedence = { } # Precedence rules for each terminal. Contains tuples of the
# form ('right',level) or ('nonassoc', level) or ('left',level)
self.UsedPrecedence = { } # Precedence rules that were actually used by the grammer.
# This is only used to provide error checking and to generate
# a warning about unused precedence rules.
self.Start = None # Starting symbol for the grammar
def __len__(self):
return len(self.Productions)
def __getitem__(self,index):
return self.Productions[index]
# -----------------------------------------------------------------------------
# set_precedence()
#
# Sets the precedence for a given terminal. assoc is the associativity such as
# 'left','right', or 'nonassoc'. level is a numeric level.
#
# -----------------------------------------------------------------------------
def set_precedence(self,term,assoc,level):
assert self.Productions == [None],"Must call set_precedence() before add_production()"
if term in self.Precedence:
raise GrammarError("Precedence already specified for terminal '%s'" % term)
if assoc not in ['left','right','nonassoc']:
raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'")
self.Precedence[term] = (assoc,level)
# -----------------------------------------------------------------------------
# add_production()
#
# Given an action function, this function assembles a production rule and
# computes its precedence level.
#
# The production rule is supplied as a list of symbols. For example,
# a rule such as 'expr : expr PLUS term' has a production name of 'expr' and
# symbols ['expr','PLUS','term'].
#
# Precedence is determined by the precedence of the right-most non-terminal
# or the precedence of a terminal specified by %prec.
#
# A variety of error checks are performed to make sure production symbols
# are valid and that %prec is used correctly.
# -----------------------------------------------------------------------------
def add_production(self,prodname,syms,func=None,file='',line=0):
if prodname in self.Terminals:
raise GrammarError("%s:%d: Illegal rule name '%s'. Already defined as a token" % (file,line,prodname))
if prodname == 'error':
raise GrammarError("%s:%d: Illegal rule name '%s'. error is a reserved word" % (file,line,prodname))
if not _is_identifier.match(prodname):
raise GrammarError("%s:%d: Illegal rule name '%s'" % (file,line,prodname))
# Look for literal tokens
for n,s in enumerate(syms):
if s[0] in "'\"":
try:
c = eval(s)
if (len(c) > 1):
raise GrammarError("%s:%d: Literal token %s in rule '%s' may only be a single character" % (file,line,s, prodname))
if not c in self.Terminals:
self.Terminals[c] = []
syms[n] = c
continue
except SyntaxError:
pass
if not _is_identifier.match(s) and s != '%prec':
raise GrammarError("%s:%d: Illegal name '%s' in rule '%s'" % (file,line,s, prodname))
# Determine the precedence level
if '%prec' in syms:
if syms[-1] == '%prec':
raise GrammarError("%s:%d: Syntax error. Nothing follows %%prec" % (file,line))
if syms[-2] != '%prec':
raise GrammarError("%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule" % (file,line))
precname = syms[-1]
prodprec = self.Precedence.get(precname,None)
if not prodprec:
raise GrammarError("%s:%d: Nothing known about the precedence of '%s'" % (file,line,precname))
else:
self.UsedPrecedence[precname] = 1
del syms[-2:] # Drop %prec from the rule
else:
# If no %prec, precedence is determined by the rightmost terminal symbol
precname = rightmost_terminal(syms,self.Terminals)
prodprec = self.Precedence.get(precname,('right',0))
# See if the rule is already in the rulemap
map = "%s -> %s" % (prodname,syms)
if map in self.Prodmap:
m = self.Prodmap[map]
raise GrammarError("%s:%d: Duplicate rule %s. " % (file,line, m) +
"Previous definition at %s:%d" % (m.file, m.line))
# From this point on, everything is valid. Create a new Production instance
pnumber = len(self.Productions)
if not prodname in self.Nonterminals:
self.Nonterminals[prodname] = [ ]
# Add the production number to Terminals and Nonterminals
for t in syms:
if t in self.Terminals:
self.Terminals[t].append(pnumber)
else:
if not t in self.Nonterminals:
self.Nonterminals[t] = [ ]
self.Nonterminals[t].append(pnumber)
# Create a production and add it to the list of productions
p = Production(pnumber,prodname,syms,prodprec,func,file,line)
self.Productions.append(p)
self.Prodmap[map] = p
# Add to the global productions list
try:
self.Prodnames[prodname].append(p)
except KeyError:
self.Prodnames[prodname] = [ p ]
return 0
# -----------------------------------------------------------------------------
# set_start()
#
# Sets the starting symbol and creates the augmented grammar. Production
# rule 0 is S' -> start where start is the start symbol.
# -----------------------------------------------------------------------------
def set_start(self,start=None):
if not start:
start = self.Productions[1].name
if start not in self.Nonterminals:
raise GrammarError("start symbol %s undefined" % start)
self.Productions[0] = Production(0,"S'",[start])
self.Nonterminals[start].append(0)
self.Start = start
# -----------------------------------------------------------------------------
# find_unreachable()
#
# Find all of the nonterminal symbols that can't be reached from the starting
# symbol. Returns a list of nonterminals that can't be reached.
# -----------------------------------------------------------------------------
def find_unreachable(self):
# Mark all symbols that are reachable from a symbol s
def mark_reachable_from(s):
if reachable[s]:
# We've already reached symbol s.
return
reachable[s] = 1
for p in self.Prodnames.get(s,[]):
for r in p.prod:
mark_reachable_from(r)
reachable = { }
for s in list(self.Terminals) + list(self.Nonterminals):
reachable[s] = 0
mark_reachable_from( self.Productions[0].prod[0] )
return [s for s in list(self.Nonterminals)
if not reachable[s]]
# -----------------------------------------------------------------------------
# infinite_cycles()
#
# This function looks at the various parsing rules and tries to detect
# infinite recursion cycles (grammar rules where there is no possible way
# to derive a string of only terminals).
# -----------------------------------------------------------------------------
def infinite_cycles(self):
terminates = {}
# Terminals:
for t in self.Terminals:
terminates[t] = 1
terminates['$end'] = 1
# Nonterminals:
# Initialize to false:
for n in self.Nonterminals:
terminates[n] = 0
# Then propagate termination until no change:
while 1:
some_change = 0
for (n,pl) in self.Prodnames.items():
# Nonterminal n terminates iff any of its productions terminates.
for p in pl:
# Production p terminates iff all of its rhs symbols terminate.
for s in p.prod:
if not terminates[s]:
# The symbol s does not terminate,
# so production p does not terminate.
p_terminates = 0
break
else:
# didn't break from the loop,
# so every symbol s terminates
# so production p terminates.
p_terminates = 1
if p_terminates:
# symbol n terminates!
if not terminates[n]:
terminates[n] = 1
some_change = 1
# Don't need to consider any more productions for this n.
break
if not some_change:
break
infinite = []
for (s,term) in terminates.items():
if not term:
if not s in self.Prodnames and not s in self.Terminals and s != 'error':
# s is used-but-not-defined, and we've already warned of that,
# so it would be overkill to say that it's also non-terminating.
pass
else:
infinite.append(s)
return infinite
# -----------------------------------------------------------------------------
# undefined_symbols()
#
# Find all symbols that were used the grammar, but not defined as tokens or
# grammar rules. Returns a list of tuples (sym, prod) where sym in the symbol
# and prod is the production where the symbol was used.
# -----------------------------------------------------------------------------
def undefined_symbols(self):
result = []
for p in self.Productions:
if not p: continue
for s in p.prod:
if not s in self.Prodnames and not s in self.Terminals and s != 'error':
result.append((s,p))
return result
# -----------------------------------------------------------------------------
# unused_terminals()
#
# Find all terminals that were defined, but not used by the grammar. Returns
# a list of all symbols.
# -----------------------------------------------------------------------------
def unused_terminals(self):
unused_tok = []
for s,v in self.Terminals.items():
if s != 'error' and not v:
unused_tok.append(s)
return unused_tok
# ------------------------------------------------------------------------------
# unused_rules()
#
# Find all grammar rules that were defined, but not used (maybe not reachable)
# Returns a list of productions.
# ------------------------------------------------------------------------------
def unused_rules(self):
unused_prod = []
for s,v in self.Nonterminals.items():
if not v:
p = self.Prodnames[s][0]
unused_prod.append(p)
return unused_prod
# -----------------------------------------------------------------------------
# unused_precedence()
#
# Returns a list of tuples (term,precedence) corresponding to precedence
# rules that were never used by the grammar. term is the name of the terminal
# on which precedence was applied and precedence is a string such as 'left' or
# 'right' corresponding to the type of precedence.
# -----------------------------------------------------------------------------
def unused_precedence(self):
unused = []
for termname in self.Precedence:
if not (termname in self.Terminals or termname in self.UsedPrecedence):
unused.append((termname,self.Precedence[termname][0]))
return unused
# -------------------------------------------------------------------------
# _first()
#
# Compute the value of FIRST1(beta) where beta is a tuple of symbols.
#
# During execution of compute_first1, the result may be incomplete.
# Afterward (e.g., when called from compute_follow()), it will be complete.
# -------------------------------------------------------------------------
def _first(self,beta):
# We are computing First(x1,x2,x3,...,xn)
result = [ ]
for x in beta:
x_produces_empty = 0
# Add all the non-<empty> symbols of First[x] to the result.
for f in self.First[x]:
if f == '<empty>':
x_produces_empty = 1
else:
if f not in result: result.append(f)
if x_produces_empty:
# We have to consider the next x in beta,
# i.e. stay in the loop.
pass
else:
# We don't have to consider any further symbols in beta.
break
else:
# There was no 'break' from the loop,
# so x_produces_empty was true for all x in beta,
# so beta produces empty as well.
result.append('<empty>')
return result
# -------------------------------------------------------------------------
# compute_first()
#
# Compute the value of FIRST1(X) for all symbols
# -------------------------------------------------------------------------
def compute_first(self):
if self.First:
return self.First
# Terminals:
for t in self.Terminals:
self.First[t] = [t]
self.First['$end'] = ['$end']
# Nonterminals:
# Initialize to the empty set:
for n in self.Nonterminals:
self.First[n] = []
# Then propagate symbols until no change:
while 1:
some_change = 0
for n in self.Nonterminals:
for p in self.Prodnames[n]:
for f in self._first(p.prod):
if f not in self.First[n]:
self.First[n].append( f )
some_change = 1
if not some_change:
break
return self.First
# ---------------------------------------------------------------------
# compute_follow()
#
# Computes all of the follow sets for every non-terminal symbol. The
# follow set is the set of all symbols that might follow a given
# non-terminal. See the Dragon book, 2nd Ed. p. 189.
# ---------------------------------------------------------------------
def compute_follow(self,start=None):
# If already computed, return the result
if self.Follow:
return self.Follow
# If first sets not computed yet, do that first.
if not self.First:
self.compute_first()
# Add '$end' to the follow list of the start symbol
for k in self.Nonterminals:
self.Follow[k] = [ ]
if not start:
start = self.Productions[1].name
self.Follow[start] = [ '$end' ]
while 1:
didadd = 0
for p in self.Productions[1:]:
# Here is the production set
for i in range(len(p.prod)):
B = p.prod[i]
if B in self.Nonterminals:
# Okay. We got a non-terminal in a production
fst = self._first(p.prod[i+1:])
hasempty = 0
for f in fst:
if f != '<empty>' and f not in self.Follow[B]:
self.Follow[B].append(f)
didadd = 1
if f == '<empty>':
hasempty = 1
if hasempty or i == (len(p.prod)-1):
# Add elements of follow(a) to follow(b)
for f in self.Follow[p.name]:
if f not in self.Follow[B]:
self.Follow[B].append(f)
didadd = 1
if not didadd: break
return self.Follow
# -----------------------------------------------------------------------------
# build_lritems()
#
# This function walks the list of productions and builds a complete set of the
# LR items. The LR items are stored in two ways: First, they are uniquely
# numbered and placed in the list _lritems. Second, a linked list of LR items
# is built for each production. For example:
#
# E -> E PLUS E
#
# Creates the list
#
# [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ]
# -----------------------------------------------------------------------------
def build_lritems(self):
for p in self.Productions:
lastlri = p
i = 0
lr_items = []
while 1:
if i > len(p):
lri = None
else:
lri = LRItem(p,i)
# Precompute the list of productions immediately following
try:
lri.lr_after = self.Prodnames[lri.prod[i+1]]
except (IndexError,KeyError):
lri.lr_after = []
try:
lri.lr_before = lri.prod[i-1]
except IndexError:
lri.lr_before = None
lastlri.lr_next = lri
if not lri: break
lr_items.append(lri)
lastlri = lri
i += 1
p.lr_items = lr_items
# -----------------------------------------------------------------------------
# == Class LRTable ==
#
# This basic class represents a basic table of LR parsing information.
# Methods for generating the tables are not defined here. They are defined
# in the derived class LRGeneratedTable.
# -----------------------------------------------------------------------------
class VersionError(YaccError): pass
class LRTable(object):
def __init__(self):
self.lr_action = None
self.lr_goto = None
self.lr_productions = None
self.lr_method = None
def read_table(self,module):
if isinstance(module,types.ModuleType):
parsetab = module
else:
if sys.version_info[0] < 3:
exec("import %s as parsetab" % module)
else:
env = { }
exec("import %s as parsetab" % module, env, env)
parsetab = env['parsetab']
if parsetab._tabversion != __tabversion__:
raise VersionError("yacc table file version is out of date")
self.lr_action = parsetab._lr_action
self.lr_goto = parsetab._lr_goto
self.lr_productions = []
for p in parsetab._lr_productions:
self.lr_productions.append(MiniProduction(*p))
self.lr_method = parsetab._lr_method
return parsetab._lr_signature
def read_pickle(self,filename):
try:
import cPickle as pickle
except ImportError:
import pickle
in_f = open(filename,"rb")
tabversion = pickle.load(in_f)
if tabversion != __tabversion__:
raise VersionError("yacc table file version is out of date")
self.lr_method = pickle.load(in_f)
signature = pickle.load(in_f)
self.lr_action = pickle.load(in_f)
self.lr_goto = pickle.load(in_f)
productions = pickle.load(in_f)
self.lr_productions = []
for p in productions:
self.lr_productions.append(MiniProduction(*p))
in_f.close()
return signature
# Bind all production function names to callable objects in pdict
def bind_callables(self,pdict):
for p in self.lr_productions:
p.bind(pdict)
# -----------------------------------------------------------------------------
# === LR Generator ===
#
# The following classes and functions are used to generate LR parsing tables on
# a grammar.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# digraph()
# traverse()
#
# The following two functions are used to compute set valued functions
# of the form:
#
# F(x) = F'(x) U U{F(y) | x R y}
#
# This is used to compute the values of Read() sets as well as FOLLOW sets
# in LALR(1) generation.
#
# Inputs: X - An input set
# R - A relation
# FP - Set-valued function
# ------------------------------------------------------------------------------
def digraph(X,R,FP):
N = { }
for x in X:
N[x] = 0
stack = []
F = { }
for x in X:
if N[x] == 0: traverse(x,N,stack,F,X,R,FP)
return F
def traverse(x,N,stack,F,X,R,FP):
stack.append(x)
d = len(stack)
N[x] = d
F[x] = FP(x) # F(X) <- F'(x)
rel = R(x) # Get y's related to x
for y in rel:
if N[y] == 0:
traverse(y,N,stack,F,X,R,FP)
N[x] = min(N[x],N[y])
for a in F.get(y,[]):
if a not in F[x]: F[x].append(a)
if N[x] == d:
N[stack[-1]] = MAXINT
F[stack[-1]] = F[x]
element = stack.pop()
while element != x:
N[stack[-1]] = MAXINT
F[stack[-1]] = F[x]
element = stack.pop()
class LALRError(YaccError): pass
# -----------------------------------------------------------------------------
# == LRGeneratedTable ==
#
# This class implements the LR table generation algorithm. There are no
# public methods except for write()
# -----------------------------------------------------------------------------
class LRGeneratedTable(LRTable):
def __init__(self,grammar,method='LALR',log=None):
if method not in ['SLR','LALR']:
raise LALRError("Unsupported method %s" % method)
self.grammar = grammar
self.lr_method = method
# Set up the logger
if not log:
log = NullLogger()
self.log = log
# Internal attributes
self.lr_action = {} # Action table
self.lr_goto = {} # Goto table
self.lr_productions = grammar.Productions # Copy of grammar Production array
self.lr_goto_cache = {} # Cache of computed gotos
self.lr0_cidhash = {} # Cache of closures
self._add_count = 0 # Internal counter used to detect cycles
# Diagonistic information filled in by the table generator
self.sr_conflict = 0
self.rr_conflict = 0
self.conflicts = [] # List of conflicts
self.sr_conflicts = []
self.rr_conflicts = []
# Build the tables
self.grammar.build_lritems()
self.grammar.compute_first()
self.grammar.compute_follow()
self.lr_parse_table()
# Compute the LR(0) closure operation on I, where I is a set of LR(0) items.
def lr0_closure(self,I):
self._add_count += 1
# Add everything in I to J
J = I[:]
didadd = 1
while didadd:
didadd = 0
for j in J:
for x in j.lr_after:
if getattr(x,"lr0_added",0) == self._add_count: continue
# Add B --> .G to J
J.append(x.lr_next)
x.lr0_added = self._add_count
didadd = 1
return J
# Compute the LR(0) goto function goto(I,X) where I is a set
# of LR(0) items and X is a grammar symbol. This function is written
# in a way that guarantees uniqueness of the generated goto sets
# (i.e. the same goto set will never be returned as two different Python
# objects). With uniqueness, we can later do fast set comparisons using
# id(obj) instead of element-wise comparison.
def lr0_goto(self,I,x):
# First we look for a previously cached entry
g = self.lr_goto_cache.get((id(I),x),None)
if g: return g
# Now we generate the goto set in a way that guarantees uniqueness
# of the result
s = self.lr_goto_cache.get(x,None)
if not s:
s = { }
self.lr_goto_cache[x] = s
gs = [ ]
for p in I:
n = p.lr_next
if n and n.lr_before == x:
s1 = s.get(id(n),None)
if not s1:
s1 = { }
s[id(n)] = s1
gs.append(n)
s = s1
g = s.get('$end',None)
if not g:
if gs:
g = self.lr0_closure(gs)
s['$end'] = g
else:
s['$end'] = gs
self.lr_goto_cache[(id(I),x)] = g
return g
# Compute the LR(0) sets of item function
def lr0_items(self):
C = [ self.lr0_closure([self.grammar.Productions[0].lr_next]) ]
i = 0
for I in C:
self.lr0_cidhash[id(I)] = i
i += 1
# Loop over the items in C and each grammar symbols
i = 0
while i < len(C):
I = C[i]
i += 1
# Collect all of the symbols that could possibly be in the goto(I,X) sets
asyms = { }
for ii in I:
for s in ii.usyms:
asyms[s] = None
for x in asyms:
g = self.lr0_goto(I,x)
if not g: continue
if id(g) in self.lr0_cidhash: continue
self.lr0_cidhash[id(g)] = len(C)
C.append(g)
return C
# -----------------------------------------------------------------------------
# ==== LALR(1) Parsing ====
#
# LALR(1) parsing is almost exactly the same as SLR except that instead of
# relying upon Follow() sets when performing reductions, a more selective
# lookahead set that incorporates the state of the LR(0) machine is utilized.
# Thus, we mainly just have to focus on calculating the lookahead sets.
#
# The method used here is due to DeRemer and Pennelo (1982).
#
# DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1)
# Lookahead Sets", ACM Transactions on Programming Languages and Systems,
# Vol. 4, No. 4, Oct. 1982, pp. 615-649
#
# Further details can also be found in:
#
# J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing",
# McGraw-Hill Book Company, (1985).
#
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# compute_nullable_nonterminals()
#
# Creates a dictionary containing all of the non-terminals that might produce
# an empty production.
# -----------------------------------------------------------------------------
def compute_nullable_nonterminals(self):
nullable = {}
num_nullable = 0
while 1:
for p in self.grammar.Productions[1:]:
if p.len == 0:
nullable[p.name] = 1
continue
for t in p.prod:
if not t in nullable: break
else:
nullable[p.name] = 1
if len(nullable) == num_nullable: break
num_nullable = len(nullable)
return nullable
# -----------------------------------------------------------------------------
# find_nonterminal_trans(C)
#
# Given a set of LR(0) items, this functions finds all of the non-terminal
# transitions. These are transitions in which a dot appears immediately before
# a non-terminal. Returns a list of tuples of the form (state,N) where state
# is the state number and N is the nonterminal symbol.
#
# The input C is the set of LR(0) items.
# -----------------------------------------------------------------------------
def find_nonterminal_transitions(self,C):
trans = []
for state in range(len(C)):
for p in C[state]:
if p.lr_index < p.len - 1:
t = (state,p.prod[p.lr_index+1])
if t[1] in self.grammar.Nonterminals:
if t not in trans: trans.append(t)
state = state + 1
return trans
# -----------------------------------------------------------------------------
# dr_relation()
#
# Computes the DR(p,A) relationships for non-terminal transitions. The input
# is a tuple (state,N) where state is a number and N is a nonterminal symbol.
#
# Returns a list of terminals.
# -----------------------------------------------------------------------------
def dr_relation(self,C,trans,nullable):
dr_set = { }
state,N = trans
terms = []
g = self.lr0_goto(C[state],N)
for p in g:
if p.lr_index < p.len - 1:
a = p.prod[p.lr_index+1]
if a in self.grammar.Terminals:
if a not in terms: terms.append(a)
# This extra bit is to handle the start state
if state == 0 and N == self.grammar.Productions[0].prod[0]:
terms.append('$end')
return terms
# -----------------------------------------------------------------------------
# reads_relation()
#
# Computes the READS() relation (p,A) READS (t,C).
# -----------------------------------------------------------------------------
def reads_relation(self,C, trans, empty):
# Look for empty transitions
rel = []
state, N = trans
g = self.lr0_goto(C[state],N)
j = self.lr0_cidhash.get(id(g),-1)
for p in g:
if p.lr_index < p.len - 1:
a = p.prod[p.lr_index + 1]
if a in empty:
rel.append((j,a))
return rel
# -----------------------------------------------------------------------------
# compute_lookback_includes()
#
# Determines the lookback and includes relations
#
# LOOKBACK:
#
# This relation is determined by running the LR(0) state machine forward.
# For example, starting with a production "N : . A B C", we run it forward
# to obtain "N : A B C ." We then build a relationship between this final
# state and the starting state. These relationships are stored in a dictionary
# lookdict.
#
# INCLUDES:
#
# Computes the INCLUDE() relation (p,A) INCLUDES (p',B).
#
# This relation is used to determine non-terminal transitions that occur
# inside of other non-terminal transition states. (p,A) INCLUDES (p', B)
# if the following holds:
#
# B -> LAT, where T -> epsilon and p' -L-> p
#
# L is essentially a prefix (which may be empty), T is a suffix that must be
# able to derive an empty string. State p' must lead to state p with the string L.
#
# -----------------------------------------------------------------------------
def compute_lookback_includes(self,C,trans,nullable):
lookdict = {} # Dictionary of lookback relations
includedict = {} # Dictionary of include relations
# Make a dictionary of non-terminal transitions
dtrans = {}
for t in trans:
dtrans[t] = 1
# Loop over all transitions and compute lookbacks and includes
for state,N in trans:
lookb = []
includes = []
for p in C[state]:
if p.name != N: continue
# Okay, we have a name match. We now follow the production all the way
# through the state machine until we get the . on the right hand side
lr_index = p.lr_index
j = state
while lr_index < p.len - 1:
lr_index = lr_index + 1
t = p.prod[lr_index]
# Check to see if this symbol and state are a non-terminal transition
if (j,t) in dtrans:
# Yes. Okay, there is some chance that this is an includes relation
# the only way to know for certain is whether the rest of the
# production derives empty
li = lr_index + 1
while li < p.len:
if p.prod[li] in self.grammar.Terminals: break # No forget it
if not p.prod[li] in nullable: break
li = li + 1
else:
# Appears to be a relation between (j,t) and (state,N)
includes.append((j,t))
g = self.lr0_goto(C[j],t) # Go to next set
j = self.lr0_cidhash.get(id(g),-1) # Go to next state
# When we get here, j is the final state, now we have to locate the production
for r in C[j]:
if r.name != p.name: continue
if r.len != p.len: continue
i = 0
# This look is comparing a production ". A B C" with "A B C ."
while i < r.lr_index:
if r.prod[i] != p.prod[i+1]: break
i = i + 1
else:
lookb.append((j,r))
for i in includes:
if not i in includedict: includedict[i] = []
includedict[i].append((state,N))
lookdict[(state,N)] = lookb
return lookdict,includedict
# -----------------------------------------------------------------------------
# compute_read_sets()
#
# Given a set of LR(0) items, this function computes the read sets.
#
# Inputs: C = Set of LR(0) items
# ntrans = Set of nonterminal transitions
# nullable = Set of empty transitions
#
# Returns a set containing the read sets
# -----------------------------------------------------------------------------
def compute_read_sets(self,C, ntrans, nullable):
FP = lambda x: self.dr_relation(C,x,nullable)
R = lambda x: self.reads_relation(C,x,nullable)
F = digraph(ntrans,R,FP)
return F
# -----------------------------------------------------------------------------
# compute_follow_sets()
#
# Given a set of LR(0) items, a set of non-terminal transitions, a readset,
# and an include set, this function computes the follow sets
#
# Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)}
#
# Inputs:
# ntrans = Set of nonterminal transitions
# readsets = Readset (previously computed)
# inclsets = Include sets (previously computed)
#
# Returns a set containing the follow sets
# -----------------------------------------------------------------------------
def compute_follow_sets(self,ntrans,readsets,inclsets):
FP = lambda x: readsets[x]
R = lambda x: inclsets.get(x,[])
F = digraph(ntrans,R,FP)
return F
# -----------------------------------------------------------------------------
# add_lookaheads()
#
# Attaches the lookahead symbols to grammar rules.
#
# Inputs: lookbacks - Set of lookback relations
# followset - Computed follow set
#
# This function directly attaches the lookaheads to productions contained
# in the lookbacks set
# -----------------------------------------------------------------------------
def add_lookaheads(self,lookbacks,followset):
for trans,lb in lookbacks.items():
# Loop over productions in lookback
for state,p in lb:
if not state in p.lookaheads:
p.lookaheads[state] = []
f = followset.get(trans,[])
for a in f:
if a not in p.lookaheads[state]: p.lookaheads[state].append(a)
# -----------------------------------------------------------------------------
# add_lalr_lookaheads()
#
# This function does all of the work of adding lookahead information for use
# with LALR parsing
# -----------------------------------------------------------------------------
def add_lalr_lookaheads(self,C):
# Determine all of the nullable nonterminals
nullable = self.compute_nullable_nonterminals()
# Find all non-terminal transitions
trans = self.find_nonterminal_transitions(C)
# Compute read sets
readsets = self.compute_read_sets(C,trans,nullable)
# Compute lookback/includes relations
lookd, included = self.compute_lookback_includes(C,trans,nullable)
# Compute LALR FOLLOW sets
followsets = self.compute_follow_sets(trans,readsets,included)
# Add all of the lookaheads
self.add_lookaheads(lookd,followsets)
# -----------------------------------------------------------------------------
# lr_parse_table()
#
# This function constructs the parse tables for SLR or LALR
# -----------------------------------------------------------------------------
def lr_parse_table(self):
Productions = self.grammar.Productions
Precedence = self.grammar.Precedence
goto = self.lr_goto # Goto array
action = self.lr_action # Action array
log = self.log # Logger for output
actionp = { } # Action production array (temporary)
log.info("Parsing method: %s", self.lr_method)
# Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items
# This determines the number of states
C = self.lr0_items()
if self.lr_method == 'LALR':
self.add_lalr_lookaheads(C)
# Build the parser table, state by state
st = 0
for I in C:
# Loop over each production in I
actlist = [ ] # List of actions
st_action = { }
st_actionp = { }
st_goto = { }
log.info("")
log.info("state %d", st)
log.info("")
for p in I:
log.info(" (%d) %s", p.number, str(p))
log.info("")
for p in I:
if p.len == p.lr_index + 1:
if p.name == "S'":
# Start symbol. Accept!
st_action["$end"] = 0
st_actionp["$end"] = p
else:
# We are at the end of a production. Reduce!
if self.lr_method == 'LALR':
laheads = p.lookaheads[st]
else:
laheads = self.grammar.Follow[p.name]
for a in laheads:
actlist.append((a,p,"reduce using rule %d (%s)" % (p.number,p)))
r = st_action.get(a,None)
if r is not None:
# Whoa. Have a shift/reduce or reduce/reduce conflict
if r > 0:
# Need to decide on shift or reduce here
# By default we favor shifting. Need to add
# some precedence rules here.
sprec,slevel = Productions[st_actionp[a].number].prec
rprec,rlevel = Precedence.get(a,('right',0))
if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')):
# We really need to reduce here.
st_action[a] = -p.number
st_actionp[a] = p
if not slevel and not rlevel:
log.info(" ! shift/reduce conflict for %s resolved as reduce",a)
self.sr_conflicts.append((st,a,'reduce'))
Productions[p.number].reduced += 1
elif (slevel == rlevel) and (rprec == 'nonassoc'):
st_action[a] = None
else:
# Hmmm. Guess we'll keep the shift
if not rlevel:
log.info(" ! shift/reduce conflict for %s resolved as shift",a)
self.sr_conflicts.append((st,a,'shift'))
elif r < 0:
# Reduce/reduce conflict. In this case, we favor the rule
# that was defined first in the grammar file
oldp = Productions[-r]
pp = Productions[p.number]
if oldp.line > pp.line:
st_action[a] = -p.number
st_actionp[a] = p
chosenp,rejectp = pp,oldp
Productions[p.number].reduced += 1
Productions[oldp.number].reduced -= 1
else:
chosenp,rejectp = oldp,pp
self.rr_conflicts.append((st,chosenp,rejectp))
log.info(" ! reduce/reduce conflict for %s resolved using rule %d (%s)", a,st_actionp[a].number, st_actionp[a])
else:
raise LALRError("Unknown conflict in state %d" % st)
else:
st_action[a] = -p.number
st_actionp[a] = p
Productions[p.number].reduced += 1
else:
i = p.lr_index
a = p.prod[i+1] # Get symbol right after the "."
if a in self.grammar.Terminals:
g = self.lr0_goto(I,a)
j = self.lr0_cidhash.get(id(g),-1)
if j >= 0:
# We are in a shift state
actlist.append((a,p,"shift and go to state %d" % j))
r = st_action.get(a,None)
if r is not None:
# Whoa have a shift/reduce or shift/shift conflict
if r > 0:
if r != j:
raise LALRError("Shift/shift conflict in state %d" % st)
elif r < 0:
# Do a precedence check.
# - if precedence of reduce rule is higher, we reduce.
# - if precedence of reduce is same and left assoc, we reduce.
# - otherwise we shift
rprec,rlevel = Productions[st_actionp[a].number].prec
sprec,slevel = Precedence.get(a,('right',0))
if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')):
# We decide to shift here... highest precedence to shift
Productions[st_actionp[a].number].reduced -= 1
st_action[a] = j
st_actionp[a] = p
if not rlevel:
log.info(" ! shift/reduce conflict for %s resolved as shift",a)
self.sr_conflicts.append((st,a,'shift'))
elif (slevel == rlevel) and (rprec == 'nonassoc'):
st_action[a] = None
else:
# Hmmm. Guess we'll keep the reduce
if not slevel and not rlevel:
log.info(" ! shift/reduce conflict for %s resolved as reduce",a)
self.sr_conflicts.append((st,a,'reduce'))
else:
raise LALRError("Unknown conflict in state %d" % st)
else:
st_action[a] = j
st_actionp[a] = p
# Print the actions associated with each terminal
_actprint = { }
for a,p,m in actlist:
if a in st_action:
if p is st_actionp[a]:
log.info(" %-15s %s",a,m)
_actprint[(a,m)] = 1
log.info("")
# Print the actions that were not used. (debugging)
not_used = 0
for a,p,m in actlist:
if a in st_action:
if p is not st_actionp[a]:
if not (a,m) in _actprint:
log.debug(" ! %-15s [ %s ]",a,m)
not_used = 1
_actprint[(a,m)] = 1
if not_used:
log.debug("")
# Construct the goto table for this state
nkeys = { }
for ii in I:
for s in ii.usyms:
if s in self.grammar.Nonterminals:
nkeys[s] = None
for n in nkeys:
g = self.lr0_goto(I,n)
j = self.lr0_cidhash.get(id(g),-1)
if j >= 0:
st_goto[n] = j
log.info(" %-30s shift and go to state %d",n,j)
action[st] = st_action
actionp[st] = st_actionp
goto[st] = st_goto
st += 1
# -----------------------------------------------------------------------------
# write()
#
# This function writes the LR parsing tables to a file
# -----------------------------------------------------------------------------
def write_table(self,modulename,outputdir='',signature=""):
basemodulename = modulename.split(".")[-1]
filename = os.path.join(outputdir,basemodulename) + ".py"
try:
f = open(filename,"w")
f.write("""
# %s
# This file is automatically generated. Do not edit.
_tabversion = %r
_lr_method = %r
_lr_signature = %r
""" % (filename, __tabversion__, self.lr_method, signature))
# Change smaller to 0 to go back to original tables
smaller = 1
# Factor out names to try and make smaller
if smaller:
items = { }
for s,nd in self.lr_action.items():
for name,v in nd.items():
i = items.get(name)
if not i:
i = ([],[])
items[name] = i
i[0].append(s)
i[1].append(v)
f.write("\n_lr_action_items = {")
for k,v in items.items():
f.write("%r:([" % k)
for i in v[0]:
f.write("%r," % i)
f.write("],[")
for i in v[1]:
f.write("%r," % i)
f.write("]),")
f.write("}\n")
f.write("""
_lr_action = { }
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = { }
_lr_action[_x][_k] = _y
del _lr_action_items
""")
else:
f.write("\n_lr_action = { ");
for k,v in self.lr_action.items():
f.write("(%r,%r):%r," % (k[0],k[1],v))
f.write("}\n");
if smaller:
# Factor out names to try and make smaller
items = { }
for s,nd in self.lr_goto.items():
for name,v in nd.items():
i = items.get(name)
if not i:
i = ([],[])
items[name] = i
i[0].append(s)
i[1].append(v)
f.write("\n_lr_goto_items = {")
for k,v in items.items():
f.write("%r:([" % k)
for i in v[0]:
f.write("%r," % i)
f.write("],[")
for i in v[1]:
f.write("%r," % i)
f.write("]),")
f.write("}\n")
f.write("""
_lr_goto = { }
for _k, _v in _lr_goto_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_goto: _lr_goto[_x] = { }
_lr_goto[_x][_k] = _y
del _lr_goto_items
""")
else:
f.write("\n_lr_goto = { ");
for k,v in self.lr_goto.items():
f.write("(%r,%r):%r," % (k[0],k[1],v))
f.write("}\n");
# Write production table
f.write("_lr_productions = [\n")
for p in self.lr_productions:
if p.func:
f.write(" (%r,%r,%d,%r,%r,%d),\n" % (p.str,p.name, p.len, p.func,p.file,p.line))
else:
f.write(" (%r,%r,%d,None,None,None),\n" % (str(p),p.name, p.len))
f.write("]\n")
f.close()
except IOError:
e = sys.exc_info()[1]
sys.stderr.write("Unable to create '%s'\n" % filename)
sys.stderr.write(str(e)+"\n")
return
# -----------------------------------------------------------------------------
# pickle_table()
#
# This function pickles the LR parsing tables to a supplied file object
# -----------------------------------------------------------------------------
def pickle_table(self,filename,signature=""):
try:
import cPickle as pickle
except ImportError:
import pickle
outf = open(filename,"wb")
pickle.dump(__tabversion__,outf,pickle_protocol)
pickle.dump(self.lr_method,outf,pickle_protocol)
pickle.dump(signature,outf,pickle_protocol)
pickle.dump(self.lr_action,outf,pickle_protocol)
pickle.dump(self.lr_goto,outf,pickle_protocol)
outp = []
for p in self.lr_productions:
if p.func:
outp.append((p.str,p.name, p.len, p.func,p.file,p.line))
else:
outp.append((str(p),p.name,p.len,None,None,None))
pickle.dump(outp,outf,pickle_protocol)
outf.close()
# -----------------------------------------------------------------------------
# === INTROSPECTION ===
#
# The following functions and classes are used to implement the PLY
# introspection features followed by the yacc() function itself.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# get_caller_module_dict()
#
# This function returns a dictionary containing all of the symbols defined within
# a caller further down the call stack. This is used to get the environment
# associated with the yacc() call if none was provided.
# -----------------------------------------------------------------------------
def get_caller_module_dict(levels):
try:
raise RuntimeError
except RuntimeError:
e,b,t = sys.exc_info()
f = t.tb_frame
while levels > 0:
f = f.f_back
levels -= 1
ldict = f.f_globals.copy()
if f.f_globals != f.f_locals:
ldict.update(f.f_locals)
return ldict
# -----------------------------------------------------------------------------
# parse_grammar()
#
# This takes a raw grammar rule string and parses it into production data
# -----------------------------------------------------------------------------
def parse_grammar(doc,file,line):
grammar = []
# Split the doc string into lines
pstrings = doc.splitlines()
lastp = None
dline = line
for ps in pstrings:
dline += 1
p = ps.split()
if not p: continue
try:
if p[0] == '|':
# This is a continuation of a previous rule
if not lastp:
raise SyntaxError("%s:%d: Misplaced '|'" % (file,dline))
prodname = lastp
syms = p[1:]
else:
prodname = p[0]
lastp = prodname
syms = p[2:]
assign = p[1]
if assign != ':' and assign != '::=':
raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file,dline))
grammar.append((file,dline,prodname,syms))
except SyntaxError:
raise
except Exception:
raise SyntaxError("%s:%d: Syntax error in rule '%s'" % (file,dline,ps.strip()))
return grammar
# -----------------------------------------------------------------------------
# ParserReflect()
#
# This class represents information extracted for building a parser including
# start symbol, error function, tokens, precedence list, action functions,
# etc.
# -----------------------------------------------------------------------------
class ParserReflect(object):
def __init__(self,pdict,log=None):
self.pdict = pdict
self.start = None
self.error_func = None
self.tokens = None
self.files = {}
self.grammar = []
self.error = 0
if log is None:
self.log = PlyLogger(sys.stderr)
else:
self.log = log
# Get all of the basic information
def get_all(self):
self.get_start()
self.get_error_func()
self.get_tokens()
self.get_precedence()
self.get_pfunctions()
# Validate all of the information
def validate_all(self):
self.validate_start()
self.validate_error_func()
self.validate_tokens()
self.validate_precedence()
self.validate_pfunctions()
self.validate_files()
return self.error
# Compute a signature over the grammar
def signature(self):
try:
from hashlib import md5
except ImportError:
from md5 import md5
try:
sig = md5()
if self.start:
sig.update(self.start.encode('latin-1'))
if self.prec:
sig.update("".join(["".join(p) for p in self.prec]).encode('latin-1'))
if self.tokens:
sig.update(" ".join(self.tokens).encode('latin-1'))
for f in self.pfuncs:
if f[3]:
sig.update(f[3].encode('latin-1'))
except (TypeError,ValueError):
pass
return sig.digest()
# -----------------------------------------------------------------------------
# validate_file()
#
# This method checks to see if there are duplicated p_rulename() functions
# in the parser module file. Without this function, it is really easy for
# users to make mistakes by cutting and pasting code fragments (and it's a real
# bugger to try and figure out why the resulting parser doesn't work). Therefore,
# we just do a little regular expression pattern matching of def statements
# to try and detect duplicates.
# -----------------------------------------------------------------------------
def validate_files(self):
# Match def p_funcname(
fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(')
for filename in self.files.keys():
base,ext = os.path.splitext(filename)
if ext != '.py': return 1 # No idea. Assume it's okay.
try:
f = open(filename)
lines = f.readlines()
f.close()
except IOError:
continue
counthash = { }
for linen,l in enumerate(lines):
linen += 1
m = fre.match(l)
if m:
name = m.group(1)
prev = counthash.get(name)
if not prev:
counthash[name] = linen
else:
self.log.warning("%s:%d: Function %s redefined. Previously defined on line %d", filename,linen,name,prev)
# Get the start symbol
def get_start(self):
self.start = self.pdict.get('start')
# Validate the start symbol
def validate_start(self):
if self.start is not None:
if not isinstance(self.start,str):
self.log.error("'start' must be a string")
# Look for error handler
def get_error_func(self):
self.error_func = self.pdict.get('p_error')
# Validate the error function
def validate_error_func(self):
if self.error_func:
if isinstance(self.error_func,types.FunctionType):
ismethod = 0
elif isinstance(self.error_func, types.MethodType):
ismethod = 1
else:
self.log.error("'p_error' defined, but is not a function or method")
self.error = 1
return
eline = func_code(self.error_func).co_firstlineno
efile = func_code(self.error_func).co_filename
self.files[efile] = 1
if (func_code(self.error_func).co_argcount != 1+ismethod):
self.log.error("%s:%d: p_error() requires 1 argument",efile,eline)
self.error = 1
# Get the tokens map
def get_tokens(self):
tokens = self.pdict.get("tokens",None)
if not tokens:
self.log.error("No token list is defined")
self.error = 1
return
if not isinstance(tokens,(list, tuple)):
self.log.error("tokens must be a list or tuple")
self.error = 1
return
if not tokens:
self.log.error("tokens is empty")
self.error = 1
return
self.tokens = tokens
# Validate the tokens
def validate_tokens(self):
# Validate the tokens.
if 'error' in self.tokens:
self.log.error("Illegal token name 'error'. Is a reserved word")
self.error = 1
return
terminals = {}
for n in self.tokens:
if n in terminals:
self.log.warning("Token '%s' multiply defined", n)
terminals[n] = 1
# Get the precedence map (if any)
def get_precedence(self):
self.prec = self.pdict.get("precedence",None)
# Validate and parse the precedence map
def validate_precedence(self):
preclist = []
if self.prec:
if not isinstance(self.prec,(list,tuple)):
self.log.error("precedence must be a list or tuple")
self.error = 1
return
for level,p in enumerate(self.prec):
if not isinstance(p,(list,tuple)):
self.log.error("Bad precedence table")
self.error = 1
return
if len(p) < 2:
self.log.error("Malformed precedence entry %s. Must be (assoc, term, ..., term)",p)
self.error = 1
return
assoc = p[0]
if not isinstance(assoc,str):
self.log.error("precedence associativity must be a string")
self.error = 1
return
for term in p[1:]:
if not isinstance(term,str):
self.log.error("precedence items must be strings")
self.error = 1
return
preclist.append((term,assoc,level+1))
self.preclist = preclist
# Get all p_functions from the grammar
def get_pfunctions(self):
p_functions = []
for name, item in self.pdict.items():
if name[:2] != 'p_': continue
if name == 'p_error': continue
if isinstance(item,(types.FunctionType,types.MethodType)):
line = func_code(item).co_firstlineno
file = func_code(item).co_filename
p_functions.append((line,file,name,item.__doc__))
# Sort all of the actions by line number
p_functions.sort()
self.pfuncs = p_functions
# Validate all of the p_functions
def validate_pfunctions(self):
grammar = []
# Check for non-empty symbols
if len(self.pfuncs) == 0:
self.log.error("no rules of the form p_rulename are defined")
self.error = 1
return
for line, file, name, doc in self.pfuncs:
func = self.pdict[name]
if isinstance(func, types.MethodType):
reqargs = 2
else:
reqargs = 1
if func_code(func).co_argcount > reqargs:
self.log.error("%s:%d: Rule '%s' has too many arguments",file,line,func.__name__)
self.error = 1
elif func_code(func).co_argcount < reqargs:
self.log.error("%s:%d: Rule '%s' requires an argument",file,line,func.__name__)
self.error = 1
elif not func.__doc__:
self.log.warning("%s:%d: No documentation string specified in function '%s' (ignored)",file,line,func.__name__)
else:
try:
parsed_g = parse_grammar(doc,file,line)
for g in parsed_g:
grammar.append((name, g))
except SyntaxError:
e = sys.exc_info()[1]
self.log.error(str(e))
self.error = 1
# Looks like a valid grammar rule
# Mark the file in which defined.
self.files[file] = 1
# Secondary validation step that looks for p_ definitions that are not functions
# or functions that look like they might be grammar rules.
for n,v in self.pdict.items():
if n[0:2] == 'p_' and isinstance(v, (types.FunctionType, types.MethodType)): continue
if n[0:2] == 't_': continue
if n[0:2] == 'p_' and n != 'p_error':
self.log.warning("'%s' not defined as a function", n)
if ((isinstance(v,types.FunctionType) and func_code(v).co_argcount == 1) or
(isinstance(v,types.MethodType) and func_code(v).co_argcount == 2)):
try:
doc = v.__doc__.split(" ")
if doc[1] == ':':
self.log.warning("%s:%d: Possible grammar rule '%s' defined without p_ prefix",
func_code(v).co_filename, func_code(v).co_firstlineno,n)
except Exception:
pass
self.grammar = grammar
# -----------------------------------------------------------------------------
# yacc(module)
#
# Build a parser
# -----------------------------------------------------------------------------
def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None,
check_recursion=1, optimize=0, write_tables=1, debugfile=debug_file,outputdir='',
debuglog=None, errorlog = None, picklefile=None):
global parse # Reference to the parsing method of the last built parser
# If pickling is enabled, table files are not created
if picklefile:
write_tables = 0
if errorlog is None:
errorlog = PlyLogger(sys.stderr)
# Get the module dictionary used for the parser
if module:
_items = [(k,getattr(module,k)) for k in dir(module)]
pdict = dict(_items)
else:
pdict = get_caller_module_dict(2)
# Collect parser information from the dictionary
pinfo = ParserReflect(pdict,log=errorlog)
pinfo.get_all()
if pinfo.error:
raise YaccError("Unable to build parser")
# Check signature against table files (if any)
signature = pinfo.signature()
# Read the tables
try:
lr = LRTable()
if picklefile:
read_signature = lr.read_pickle(picklefile)
else:
read_signature = lr.read_table(tabmodule)
if optimize or (read_signature == signature):
try:
lr.bind_callables(pinfo.pdict)
parser = LRParser(lr,pinfo.error_func)
parse = parser.parse
return parser
except Exception:
e = sys.exc_info()[1]
errorlog.warning("There was a problem loading the table file: %s", repr(e))
except VersionError:
e = sys.exc_info()
errorlog.warning(str(e))
except Exception:
pass
if debuglog is None:
if debug:
debuglog = PlyLogger(open(debugfile,"w"))
else:
debuglog = NullLogger()
debuglog.info("Created by PLY version %s (http://www.dabeaz.com/ply)", __version__)
errors = 0
# Validate the parser information
if pinfo.validate_all():
raise YaccError("Unable to build parser")
if not pinfo.error_func:
errorlog.warning("no p_error() function is defined")
# Create a grammar object
grammar = Grammar(pinfo.tokens)
# Set precedence level for terminals
for term, assoc, level in pinfo.preclist:
try:
grammar.set_precedence(term,assoc,level)
except GrammarError:
e = sys.exc_info()[1]
errorlog.warning("%s",str(e))
# Add productions to the grammar
for funcname, gram in pinfo.grammar:
file, line, prodname, syms = gram
try:
grammar.add_production(prodname,syms,funcname,file,line)
except GrammarError:
e = sys.exc_info()[1]
errorlog.error("%s",str(e))
errors = 1
# Set the grammar start symbols
try:
if start is None:
grammar.set_start(pinfo.start)
else:
grammar.set_start(start)
except GrammarError:
e = sys.exc_info()[1]
errorlog.error(str(e))
errors = 1
if errors:
raise YaccError("Unable to build parser")
# Verify the grammar structure
undefined_symbols = grammar.undefined_symbols()
for sym, prod in undefined_symbols:
errorlog.error("%s:%d: Symbol '%s' used, but not defined as a token or a rule",prod.file,prod.line,sym)
errors = 1
unused_terminals = grammar.unused_terminals()
if unused_terminals:
debuglog.info("")
debuglog.info("Unused terminals:")
debuglog.info("")
for term in unused_terminals:
errorlog.warning("Token '%s' defined, but not used", term)
debuglog.info(" %s", term)
# Print out all productions to the debug log
if debug:
debuglog.info("")
debuglog.info("Grammar")
debuglog.info("")
for n,p in enumerate(grammar.Productions):
debuglog.info("Rule %-5d %s", n, p)
# Find unused non-terminals
unused_rules = grammar.unused_rules()
for prod in unused_rules:
errorlog.warning("%s:%d: Rule '%s' defined, but not used", prod.file, prod.line, prod.name)
if len(unused_terminals) == 1:
errorlog.warning("There is 1 unused token")
if len(unused_terminals) > 1:
errorlog.warning("There are %d unused tokens", len(unused_terminals))
if len(unused_rules) == 1:
errorlog.warning("There is 1 unused rule")
if len(unused_rules) > 1:
errorlog.warning("There are %d unused rules", len(unused_rules))
if debug:
debuglog.info("")
debuglog.info("Terminals, with rules where they appear")
debuglog.info("")
terms = list(grammar.Terminals)
terms.sort()
for term in terms:
debuglog.info("%-20s : %s", term, " ".join([str(s) for s in grammar.Terminals[term]]))
debuglog.info("")
debuglog.info("Nonterminals, with rules where they appear")
debuglog.info("")
nonterms = list(grammar.Nonterminals)
nonterms.sort()
for nonterm in nonterms:
debuglog.info("%-20s : %s", nonterm, " ".join([str(s) for s in grammar.Nonterminals[nonterm]]))
debuglog.info("")
if check_recursion:
unreachable = grammar.find_unreachable()
for u in unreachable:
errorlog.warning("Symbol '%s' is unreachable",u)
infinite = grammar.infinite_cycles()
for inf in infinite:
errorlog.error("Infinite recursion detected for symbol '%s'", inf)
errors = 1
unused_prec = grammar.unused_precedence()
for term, assoc in unused_prec:
errorlog.error("Precedence rule '%s' defined for unknown symbol '%s'", assoc, term)
errors = 1
if errors:
raise YaccError("Unable to build parser")
# Run the LRGeneratedTable on the grammar
if debug:
errorlog.debug("Generating %s tables", method)
lr = LRGeneratedTable(grammar,method,debuglog)
if debug:
num_sr = len(lr.sr_conflicts)
# Report shift/reduce and reduce/reduce conflicts
if num_sr == 1:
errorlog.warning("1 shift/reduce conflict")
elif num_sr > 1:
errorlog.warning("%d shift/reduce conflicts", num_sr)
num_rr = len(lr.rr_conflicts)
if num_rr == 1:
errorlog.warning("1 reduce/reduce conflict")
elif num_rr > 1:
errorlog.warning("%d reduce/reduce conflicts", num_rr)
# Write out conflicts to the output file
if debug and (lr.sr_conflicts or lr.rr_conflicts):
debuglog.warning("")
debuglog.warning("Conflicts:")
debuglog.warning("")
for state, tok, resolution in lr.sr_conflicts:
debuglog.warning("shift/reduce conflict for %s in state %d resolved as %s", tok, state, resolution)
already_reported = {}
for state, rule, rejected in lr.rr_conflicts:
if (state,id(rule),id(rejected)) in already_reported:
continue
debuglog.warning("reduce/reduce conflict in state %d resolved using rule (%s)", state, rule)
debuglog.warning("rejected rule (%s) in state %d", rejected,state)
errorlog.warning("reduce/reduce conflict in state %d resolved using rule (%s)", state, rule)
errorlog.warning("rejected rule (%s) in state %d", rejected, state)
already_reported[state,id(rule),id(rejected)] = 1
warned_never = []
for state, rule, rejected in lr.rr_conflicts:
if not rejected.reduced and (rejected not in warned_never):
debuglog.warning("Rule (%s) is never reduced", rejected)
errorlog.warning("Rule (%s) is never reduced", rejected)
warned_never.append(rejected)
# Write the table file if requested
if write_tables:
lr.write_table(tabmodule,outputdir,signature)
# Write a pickled version of the tables
if picklefile:
lr.pickle_table(picklefile,signature)
# Build the parser
lr.bind_callables(pinfo.pdict)
parser = LRParser(lr,pinfo.error_func)
parse = parser.parse
return parser
| bsd-3-clause |
BeaverCC/opencv | face/face.py | 1 | 1197 | __author__ = 'beaver'
import cv2
import os
from time import sleep
cascPath = "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
video_capture = cv2.VideoCapture(0)
width = 360
height = 360
def warn():
print("back off")
os.system("""
vol=`osascript -e 'output volume of (get volume settings)'`
osascript -e "set volume output volume 70"
say back off
osascript -e "set volume output volume $vol"
""")
while True:
sleep(1)
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
# flags=cv2.cv.CV_HAAR_SCALE_IMAGE
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
# print(w, h)
if w > width or h > height:
warn()
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
# cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.