blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
616
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
112
| license_type
stringclasses 2
values | repo_name
stringlengths 5
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 777
values | visit_date
timestamp[us]date 2015-08-06 10:31:46
2023-09-06 10:44:38
| revision_date
timestamp[us]date 1970-01-01 02:38:32
2037-05-03 13:00:00
| committer_date
timestamp[us]date 1970-01-01 02:38:32
2023-09-06 01:08:06
| github_id
int64 4.92k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-04 01:52:49
2023-09-14 21:59:50
⌀ | gha_created_at
timestamp[us]date 2008-05-22 07:58:19
2023-08-21 12:35:19
⌀ | gha_language
stringclasses 149
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 3
10.2M
| extension
stringclasses 188
values | content
stringlengths 3
10.2M
| authors
sequencelengths 1
1
| author_id
stringlengths 1
132
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
60c7a19b07d8f1d210ea5a6a7190623c12edf33a | 616aea820210c1bee5a52e4460b0444e57aad217 | /src/third/SimpleCV/Features/BlobMaker.py | 58b16530742013dac5b7fb2a0a7907b01b32a6e5 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | isabella232/pycollector | c470e65c0b9241247d0446471e1c428a924c6d16 | 459b3cc533b6371719c15d6d6b935e4c7311d6f9 | refs/heads/master | 2023-03-07T09:22:19.536634 | 2013-05-24T18:32:45 | 2013-05-24T18:32:45 | 324,754,495 | 0 | 0 | NOASSERTION | 2021-02-24T10:03:27 | 2020-12-27T12:14:29 | null | UTF-8 | Python | false | false | 10,819 | py | from SimpleCV.base import *
class BlobMaker:
"""
Blob maker encapsulates all of the contour extraction process and data, so
it can be used inside the image class, or extended and used outside the image
class. The general idea is that the blob maker provides the utilites that one
would use for blob extraction. Later implementations may include tracking and
other features.
"""
mMemStorage = None
def __init__(self):
self.mMemStorage = cv.CreateMemStorage()
return None
def extractUsingModel(self, img, colormodel,minsize=10, maxsize=0):
"""
Extract blobs using a color model
img - The input image
colormodel - The color model to use.
minsize - The minimum size of the returned features.
maxsize - The maximum size of the returned features 0=uses the default value.
Parameters:
img - Image
colormodel - ColorModel object
minsize - Int
maxsize - Int
"""
if (maxsize <= 0):
maxsize = img.width * img.height
gray = colormodel.threshold(img)
blobs = self.extractFromBinary(gray,img,minArea=minsize,maxArea=maxsize)
retVal = sorted(blobs,key=lambda x: x.mArea, reverse=True)
return FeatureSet(retVal)
def extract(self, img, threshval = 127, minsize=10, maxsize=0, threshblocksize=3, threshconstant=5):
"""
This method performs a threshold operation on the input image and then
extracts and returns the blobs.
img - The input image (color or b&w)
threshval - The threshold value for the binarize operation. If threshval = -1 adaptive thresholding is used
minsize - The minimum blob size in pixels.
maxsize - The maximum blob size in pixels. 0=uses the default value.
threshblocksize - The adaptive threhold block size.
threshconstant - The minimum to subtract off the adaptive threshold
"""
if (maxsize <= 0):
maxsize = img.width * img.height
#create a single channel image, thresholded to parameters
blobs = self.extractFromBinary(img.binarize(threshval, 255, threshblocksize, threshconstant).invert(),img,minsize,maxsize)
retVal = sorted(blobs,key=lambda x: x.mArea, reverse=True)
return FeatureSet(retVal)
def extractFromBinary(self,binaryImg,colorImg, minsize = 5, maxsize = -1):
"""
This method performs blob extraction given a binary source image that is used
to get the blob images, and a color source image.
binaryImg- The binary image with the blobs.
colorImg - The color image.
minSize - The minimum size of the blobs in pixels.
maxSize - The maximum blob size in pixels.
"""
#If you hit this recursion limit may god have mercy on your soul.
#If you really are having problems set the value higher, but this means
# you have over 10,000,000 blobs in your image.
sys.setrecursionlimit(5000)
#h_next moves to the next external contour
#v_next() moves to the next internal contour
if (maxsize <= 0):
maxsize = colorImg.width * colorImg.height
retVal = []
test = binaryImg.meanColor()
if( test[0]==0.00 and test[1]==0.00 and test[2]==0.00):
return FeatureSet(retVal)
# There are a couple of weird corner cases with the opencv
# connect components libraries - when you try to find contours
# in an all black image, or an image with a single white pixel
# that sits on the edge of an image the whole thing explodes
# this check catches those bugs. -KAS
# Also I am submitting a bug report to Willow Garage - please bare with us.
ptest = 510.0/(binaryImg.width*binaryImg.height) # val if two pixels are white
if( test[0]<ptest and test[1]<ptest and test[2]<ptest):
return retVal
seq = cv.FindContours( binaryImg._getGrayscaleBitmap(), self.mMemStorage, cv.CV_RETR_TREE, cv.CV_CHAIN_APPROX_SIMPLE)
try:
# note to self
# http://code.activestate.com/recipes/474088-tail-call-optimization-decorator/
retVal = self._extractFromBinary(seq,False,colorImg,minsize,maxsize)
except RuntimeError,e:
warnings.warn("You exceeded the recursion limit. This means you probably have too many blobs in your image. We suggest you do some morphological operations (erode/dilate) to reduce the number of blobs in your image. This function was designed to max out at about 5000 blobs per image.")
except:
warnings.warn("SimpleCV Find Blobs Failed - This could be an OpenCV python binding issue")
del seq
return FeatureSet(retVal)
def _extractFromBinary(self, seq, isaHole, colorImg,minsize,maxsize):
"""
The recursive entry point for the blob extraction. The blobs and holes are presented
as a tree and we traverse up and across the tree.
"""
retVal = []
if( seq is None ):
return retVal
if( not isaHole ): #if we aren't a hole then we are an object, so get and return our featuress
temp = self._extractData(seq,colorImg,minsize,maxsize)
if( temp is not None ):
retVal.append(temp)
#get the current feature
nextBlob = seq.h_next() # move to the next feature on our level
if( nextBlob is not None ):
#the next object is whatever this object is, add its list to ours
retVal += self._extractFromBinary(nextBlob, isaHole, colorImg, minsize,maxsize)
nextLayer = seq.v_next() # move down a layer
if(nextLayer is not None): #the next object, since it is down a layer is different
retVal += self._extractFromBinary(nextLayer, not isaHole, colorImg, minsize,maxsize)
return retVal
def _extractData(self,seq,color,minsize,maxsize):
"""
Extract the bulk of the data from a give blob. If the blob's are is too large
or too small the method returns none.
"""
if( seq is None or not len(seq)):
return None
area = cv.ContourArea(seq)
if( area < minsize or area > maxsize):
return None
retVal = Blob()
retVal.image = color
retVal.mArea = area
retVal.mMinRectangle = cv.MinAreaRect2(seq)
retVal.mBoundingBox = cv.BoundingRect(seq)
retVal.x = retVal.mBoundingBox[0]+(retVal.mBoundingBox[2]/2)
retVal.y = retVal.mBoundingBox[1]+(retVal.mBoundingBox[3]/2)
retVal.mPerimeter = cv.ArcLength(seq)
if( seq is not None): #KAS
retVal.mContour = list(seq)
chull = cv.ConvexHull2(seq,cv.CreateMemStorage(),return_points=1)
retVal.mConvexHull = list(chull)
retVal.mHullMask = self._getHullMask(chull,retVal.mBoundingBox)
del chull
moments = cv.Moments(seq)
retVal.m00 = area
retVal.m10 = moments.m10
retVal.m01 = moments.m01
retVal.m11 = moments.m11
retVal.m20 = moments.m20
retVal.m02 = moments.m02
retVal.m21 = moments.m21
retVal.m12 = moments.m12
retVal.mHu = cv.GetHuMoments(moments)
retVal.mMask = self._getMask(seq,retVal.mBoundingBox)
mask = retVal.mMask
retVal.mAvgColor = self._getAvg(color.getBitmap(),retVal.mBoundingBox,mask)
retVal.mAvgColor = retVal.mAvgColor[0:3]
retVal.mAvgColor = self._getAvg(color.getBitmap(),retVal.mBoundingBox,mask)
retVal.mAvgColor = retVal.mAvgColor[0:3]
retVal.mImg = self._getBlobAsImage(seq,retVal.mBoundingBox,color.getBitmap(),mask)
retVal.mHoleContour = self._getHoles(seq)
retVal.mAspectRatio = retVal.mMinRectangle[1][0]/retVal.mMinRectangle[1][1]
bb = retVal.mBoundingBox
retVal.points.append((bb[0], bb[1]))
retVal.points.append((bb[0] + bb[2], bb[1]))
retVal.points.append((bb[0] + bb[2], bb[1] + bb[3]))
retVal.points.append((bb[0], bb[1] + bb[3]))
return retVal
def _getHoles(self,seq):
"""
This method returns the holes associated with a blob as a list of tuples.
"""
retVal = None
holes = seq.v_next()
if( holes is not None ):
retVal = [list(holes)]
while( holes.h_next() is not None ):
holes = holes.h_next();
temp = list(holes)
if( len(temp) >= 3 ): #exclude single pixel holes
retVal.append(temp)
return retVal
def _getMask(self,seq,bb):
"""
Return a binary image of a particular contour sequence.
"""
#bb = cv.BoundingRect(seq)
mask = cv.CreateImage((bb[2],bb[3]),cv.IPL_DEPTH_8U,1)
cv.Zero(mask)
cv.DrawContours(mask,seq,(255),(0),0,thickness=-1, offset=(-1*bb[0],-1*bb[1]))
holes = seq.v_next()
if( holes is not None ):
cv.DrawContours(mask,holes,(0),(255),0,thickness=-1, offset=(-1*bb[0],-1*bb[1]))
while( holes.h_next() is not None ):
holes = holes.h_next();
if(holes is not None):
cv.DrawContours(mask,holes,(0),(255),0,thickness=-1, offset=(-1*bb[0],-1*bb[1]))
return mask
def _getHullMask(self,hull,bb):
"""
Return a mask of the convex hull of a blob.
"""
bb = cv.BoundingRect(hull)
mask = cv.CreateImage((bb[2],bb[3]),cv.IPL_DEPTH_8U,1)
cv.Zero(mask)
cv.DrawContours(mask,hull,(255),(0),0,thickness=-1, offset=(-1*bb[0],-1*bb[1]))
return mask
def _getAvg(self,colorbitmap,bb,mask):
"""
Calculate the average color of a blob given the mask.
"""
cv.SetImageROI(colorbitmap,bb)
#may need the offset parameter
avg = cv.Avg(colorbitmap,mask)
cv.ResetImageROI(colorbitmap)
return avg
def _getBlobAsImage(self,seq,bb,colorbitmap,mask):
"""
Return an image that contains just pixels defined by the blob sequence.
"""
cv.SetImageROI(colorbitmap,bb)
outputImg = cv.CreateImage((bb[2],bb[3]),cv.IPL_DEPTH_8U,3)
cv.Zero(outputImg)
cv.Copy(colorbitmap,outputImg,mask)
cv.ResetImageROI(colorbitmap)
return(Image(outputImg))
from SimpleCV.ImageClass import Image
from SimpleCV.Features.Features import FeatureSet
from SimpleCV.Features.Blob import Blob
| [
"[email protected]"
] | |
fa9b010550b5d313d60bfd25b37849dd9fcabfb8 | b15d2787a1eeb56dfa700480364337216d2b1eb9 | /samples/cli/accelbyte_py_sdk_cli/ugc/_admin_get_specific_content.py | 80f1e848449d0efebed0a1dbcc9f1ac5fe2f4371 | [
"MIT"
] | permissive | AccelByte/accelbyte-python-sdk | dedf3b8a592beef5fcf86b4245678ee3277f953d | 539c617c7e6938892fa49f95585b2a45c97a59e0 | refs/heads/main | 2023-08-24T14:38:04.370340 | 2023-08-22T01:08:03 | 2023-08-22T01:08:03 | 410,735,805 | 2 | 1 | MIT | 2022-08-02T03:54:11 | 2021-09-27T04:00:10 | Python | UTF-8 | Python | false | false | 2,344 | py | # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template_file: python-cli-command.j2
# AGS Ugc Service (2.11.3)
# pylint: disable=duplicate-code
# pylint: disable=line-too-long
# pylint: disable=missing-function-docstring
# pylint: disable=missing-module-docstring
# pylint: disable=too-many-arguments
# pylint: disable=too-many-branches
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-lines
# pylint: disable=too-many-locals
# pylint: disable=too-many-public-methods
# pylint: disable=too-many-return-statements
# pylint: disable=too-many-statements
# pylint: disable=unused-import
import json
import yaml
from typing import Optional
import click
from .._utils import login_as as login_as_internal
from .._utils import to_dict
from accelbyte_py_sdk.api.ugc import (
admin_get_specific_content as admin_get_specific_content_internal,
)
from accelbyte_py_sdk.api.ugc.models import ModelsContentDownloadResponse
from accelbyte_py_sdk.api.ugc.models import ResponseError
@click.command()
@click.argument("content_id", type=str)
@click.option("--namespace", type=str)
@click.option("--login_as", type=click.Choice(["client", "user"], case_sensitive=False))
@click.option("--login_with_auth", type=str)
@click.option("--doc", type=bool)
def admin_get_specific_content(
content_id: str,
namespace: Optional[str] = None,
login_as: Optional[str] = None,
login_with_auth: Optional[str] = None,
doc: Optional[bool] = None,
):
if doc:
click.echo(admin_get_specific_content_internal.__doc__)
return
x_additional_headers = None
if login_with_auth:
x_additional_headers = {"Authorization": login_with_auth}
else:
login_as_internal(login_as)
result, error = admin_get_specific_content_internal(
content_id=content_id,
namespace=namespace,
x_additional_headers=x_additional_headers,
)
if error:
raise Exception(f"AdminGetSpecificContent failed: {str(error)}")
click.echo(yaml.safe_dump(to_dict(result), sort_keys=False))
admin_get_specific_content.operation_id = "AdminGetSpecificContent"
admin_get_specific_content.is_deprecated = False
| [
"[email protected]"
] | |
189d19996e87af7af8a9ee4b7152b294fff376aa | 539d003125eebf761ba320223566cd56eeefe247 | /mundiapi/controllers/recipients_controller.py | 89a632e7d64589138e02cc614eb79bba0b4d6845 | [
"MIT"
] | permissive | mundipagg/MundiApi-NodeJS | 6e58afb33510a723574ee06bec107654409910af | f0c67e1f92471a7a0e2d0b0cb1765105f07fb8cb | refs/heads/master | 2023-06-25T23:04:42.429866 | 2023-06-19T16:10:31 | 2023-06-19T16:10:31 | 101,078,084 | 9 | 5 | NOASSERTION | 2023-06-01T17:50:21 | 2017-08-22T15:25:30 | JavaScript | UTF-8 | Python | false | false | 36,523 | py | # -*- coding: utf-8 -*-
"""
mundiapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
from mundiapi.api_helper import APIHelper
from mundiapi.configuration import Configuration
from mundiapi.controllers.base_controller import BaseController
from mundiapi.http.auth.basic_auth import BasicAuth
from mundiapi.models.get_recipient_response import GetRecipientResponse
from mundiapi.models.get_transfer_response import GetTransferResponse
from mundiapi.models.list_transfer_response import ListTransferResponse
from mundiapi.models.get_anticipation_response import GetAnticipationResponse
from mundiapi.models.get_anticipation_limit_response import GetAnticipationLimitResponse
from mundiapi.models.list_anticipation_response import ListAnticipationResponse
from mundiapi.models.list_recipient_response import ListRecipientResponse
from mundiapi.models.get_balance_response import GetBalanceResponse
from mundiapi.models.get_withdraw_response import GetWithdrawResponse
from mundiapi.models.list_withdrawals import ListWithdrawals
class RecipientsController(BaseController):
"""A Controller to access Endpoints in the mundiapi API."""
def update_recipient_metadata(self,
recipient_id,
request,
idempotency_key=None):
"""Does a PATCH request to /recipients/{recipient_id}/metadata.
Updates recipient metadata
Args:
recipient_id (string): Recipient id
request (UpdateMetadataRequest): Metadata
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/metadata'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.patch(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def get_transfer(self,
recipient_id,
transfer_id):
"""Does a GET request to /recipients/{recipient_id}/transfers/{transfer_id}.
Gets a transfer
Args:
recipient_id (string): Recipient id
transfer_id (string): Transfer id
Returns:
GetTransferResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/transfers/{transfer_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id,
'transfer_id': transfer_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetTransferResponse.from_dictionary)
def get_transfers(self,
recipient_id,
page=None,
size=None,
status=None,
created_since=None,
created_until=None):
"""Does a GET request to /recipients/{recipient_id}/transfers.
Gets a paginated list of transfers for the recipient
Args:
recipient_id (string): Recipient id
page (int, optional): Page number
size (int, optional): Page size
status (string, optional): Filter for transfer status
created_since (datetime, optional): Filter for start range of
transfer creation date
created_until (datetime, optional): Filter for end range of
transfer creation date
Returns:
ListTransferResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/transfers'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {
'page': page,
'size': size,
'status': status,
'created_since': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
'created_until': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ListTransferResponse.from_dictionary)
def create_anticipation(self,
recipient_id,
request,
idempotency_key=None):
"""Does a POST request to /recipients/{recipient_id}/anticipations.
Creates an anticipation
Args:
recipient_id (string): Recipient id
request (CreateAnticipationRequest): Anticipation data
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetAnticipationResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/anticipations'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetAnticipationResponse.from_dictionary)
def get_anticipation(self,
recipient_id,
anticipation_id):
"""Does a GET request to /recipients/{recipient_id}/anticipations/{anticipation_id}.
Gets an anticipation
Args:
recipient_id (string): Recipient id
anticipation_id (string): Anticipation id
Returns:
GetAnticipationResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/anticipations/{anticipation_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id,
'anticipation_id': anticipation_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetAnticipationResponse.from_dictionary)
def get_anticipation_limits(self,
recipient_id,
timeframe,
payment_date):
"""Does a GET request to /recipients/{recipient_id}/anticipation_limits.
Gets the anticipation limits for a recipient
Args:
recipient_id (string): Recipient id
timeframe (string): Timeframe
payment_date (datetime): Anticipation payment date
Returns:
GetAnticipationLimitResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/anticipation_limits'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {
'timeframe': timeframe,
'payment_date': APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date)
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetAnticipationLimitResponse.from_dictionary)
def get_anticipations(self,
recipient_id,
page=None,
size=None,
status=None,
timeframe=None,
payment_date_since=None,
payment_date_until=None,
created_since=None,
created_until=None):
"""Does a GET request to /recipients/{recipient_id}/anticipations.
Retrieves a paginated list of anticipations from a recipient
Args:
recipient_id (string): Recipient id
page (int, optional): Page number
size (int, optional): Page size
status (string, optional): Filter for anticipation status
timeframe (string, optional): Filter for anticipation timeframe
payment_date_since (datetime, optional): Filter for start range
for anticipation payment date
payment_date_until (datetime, optional): Filter for end range for
anticipation payment date
created_since (datetime, optional): Filter for start range for
anticipation creation date
created_until (datetime, optional): Filter for end range for
anticipation creation date
Returns:
ListAnticipationResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/anticipations'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {
'page': page,
'size': size,
'status': status,
'timeframe': timeframe,
'payment_date_since': APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_since),
'payment_date_until': APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_until),
'created_since': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
'created_until': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ListAnticipationResponse.from_dictionary)
def update_recipient(self,
recipient_id,
request,
idempotency_key=None):
"""Does a PUT request to /recipients/{recipient_id}.
Updates a recipient
Args:
recipient_id (string): Recipient id
request (UpdateRecipientRequest): Recipient data
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def update_recipient_default_bank_account(self,
recipient_id,
request,
idempotency_key=None):
"""Does a PATCH request to /recipients/{recipient_id}/default-bank-account.
Updates the default bank account from a recipient
Args:
recipient_id (string): Recipient id
request (UpdateRecipientBankAccountRequest): Bank account data
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/default-bank-account'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.patch(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def get_recipient(self,
recipient_id):
"""Does a GET request to /recipients/{recipient_id}.
Retrieves recipient information
Args:
recipient_id (string): Recipiend id
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def get_recipients(self,
page=None,
size=None):
"""Does a GET request to /recipients.
Retrieves paginated recipients information
Args:
page (int, optional): Page number
size (int, optional): Page size
Returns:
ListRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients'
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {
'page': page,
'size': size
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ListRecipientResponse.from_dictionary)
def get_balance(self,
recipient_id):
"""Does a GET request to /recipients/{recipient_id}/balance.
Get balance information for a recipient
Args:
recipient_id (string): Recipient id
Returns:
GetBalanceResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/balance'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetBalanceResponse.from_dictionary)
def create_transfer(self,
recipient_id,
request,
idempotency_key=None):
"""Does a POST request to /recipients/{recipient_id}/transfers.
Creates a transfer for a recipient
Args:
recipient_id (string): Recipient Id
request (CreateTransferRequest): Transfer data
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetTransferResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/transfers'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetTransferResponse.from_dictionary)
def create_recipient(self,
request,
idempotency_key=None):
"""Does a POST request to /recipients.
Creates a new recipient
Args:
request (CreateRecipientRequest): Recipient data
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients'
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def update_recipient_transfer_settings(self,
recipient_id,
request,
idempotency_key=None):
"""Does a PATCH request to /recipients/{recipient_id}/transfer-settings.
TODO: type endpoint description here.
Args:
recipient_id (string): Recipient Identificator
request (UpdateTransferSettingsRequest): TODO: type description
here. Example:
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
GetRecipientResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/transfer-settings'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8',
'idempotency-key': idempotency_key
}
# Prepare and execute request
_request = self.http_client.patch(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetRecipientResponse.from_dictionary)
def create_withdraw(self,
recipient_id,
request):
"""Does a POST request to /recipients/{recipient_id}/withdrawals.
TODO: type endpoint description here.
Args:
recipient_id (string): TODO: type description here. Example:
request (CreateWithdrawRequest): TODO: type description here.
Example:
Returns:
GetWithdrawResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/withdrawals'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json',
'content-type': 'application/json; charset=utf-8'
}
# Prepare and execute request
_request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(request))
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetWithdrawResponse.from_dictionary)
def get_withdraw_by_id(self,
recipient_id,
withdrawal_id):
"""Does a GET request to /recipients/{recipient_id}/withdrawals/{withdrawal_id}.
TODO: type endpoint description here.
Args:
recipient_id (string): TODO: type description here. Example:
withdrawal_id (string): TODO: type description here. Example:
Returns:
GetWithdrawResponse: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/withdrawals/{withdrawal_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id,
'withdrawal_id': withdrawal_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, GetWithdrawResponse.from_dictionary)
def get_withdrawals(self,
recipient_id,
page=None,
size=None,
status=None,
created_since=None,
created_until=None):
"""Does a GET request to /recipients/{recipient_id}/withdrawals.
Gets a paginated list of transfers for the recipient
Args:
recipient_id (string): TODO: type description here. Example:
page (int, optional): TODO: type description here. Example:
size (int, optional): TODO: type description here. Example:
status (string, optional): TODO: type description here. Example:
created_since (datetime, optional): TODO: type description here.
Example:
created_until (datetime, optional): TODO: type description here.
Example:
Returns:
ListWithdrawals: Response from the API.
Raises:
APIException: When an error occurs while fetching the data from
the remote API. This exception includes the HTTP Response
code, an error message, and the HTTP body that was received in
the request.
"""
# Prepare query URL
_url_path = '/recipients/{recipient_id}/withdrawals'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'recipient_id': recipient_id
})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {
'page': page,
'size': size,
'status': status,
'created_since': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
'created_until': APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
_query_parameters, Configuration.array_serialization)
_query_url = APIHelper.clean_url(_query_builder)
# Prepare headers
_headers = {
'accept': 'application/json'
}
# Prepare and execute request
_request = self.http_client.get(_query_url, headers=_headers)
BasicAuth.apply(_request)
_context = self.execute_request(_request)
self.validate_response(_context)
# Return appropriate type
return APIHelper.json_deserialize(_context.response.raw_body, ListWithdrawals.from_dictionary)
| [
"[email protected]"
] | |
0b193443b4254b8f09b87d0e58820b42bc298b41 | 22279487bee5c983c13887ba11e6a4cd40e8bbe3 | /PreprocessData/all_class_files/LiquorStore.py | 57b8e96fa423055c10e5f164e93535ac3dffcba5 | [
"MIT"
] | permissive | DylanNEU/Schema | 018c9f683c683068422ed7b6392dcebd4ab4d4cd | 4854720a15894dd814691a55e03329ecbbb6f558 | refs/heads/main | 2023-08-30T01:50:20.541634 | 2021-11-01T15:30:41 | 2021-11-01T15:30:41 | 425,238,713 | 1 | 0 | MIT | 2021-11-06T12:29:12 | 2021-11-06T12:29:11 | null | UTF-8 | Python | false | false | 2,310 | py | from PreprocessData.all_class_files.Store import Store
import global_data
class LiquorStore(Store):
def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None, potentialAction=None, sameAs=None, url=None, address=None, aggregateRating=None, alumni=None, areaServed=None, award=None, brand=None, contactPoint=None, department=None, dissolutionDate=None, duns=None, email=None, employee=None, event=None, faxNumber=None, founder=None, foundingDate=None, foundingLocation=None, funder=None, globalLocationNumber=None, hasOfferCatalog=None, hasPOS=None, isicV4=None, legalName=None, leiCode=None, location=None, logo=None, makesOffer=None, member=None, memberOf=None, naics=None, numberOfEmployees=None, owns=None, parentOrganization=None, publishingPrinciples=None, review=None, seeks=None, sponsor=None, subOrganization=None, taxID=None, telephone=None, vatID=None, additionalProperty=None, amenityFeature=None, branchCode=None, containedInPlace=None, containsPlace=None, geo=None, hasMap=None, isAccessibleForFree=None, maximumAttendeeCapacity=None, openingHoursSpecification=None, photo=None, publicAccess=None, smokingAllowed=None, specialOpeningHoursSpecification=None, currenciesAccepted=None, openingHours=None, paymentAccepted=None, priceRange=None):
Store.__init__(self, additionalType, alternateName, description, disambiguatingDescription, identifier, image, mainEntityOfPage, name, potentialAction, sameAs, url, address, aggregateRating, alumni, areaServed, award, brand, contactPoint, department, dissolutionDate, duns, email, employee, event, faxNumber, founder, foundingDate, foundingLocation, funder, globalLocationNumber, hasOfferCatalog, hasPOS, isicV4, legalName, leiCode, location, logo, makesOffer, member, memberOf, naics, numberOfEmployees, owns, parentOrganization, publishingPrinciples, review, seeks, sponsor, subOrganization, taxID, telephone, vatID, additionalProperty, amenityFeature, branchCode, containedInPlace, containsPlace, geo, hasMap, isAccessibleForFree, maximumAttendeeCapacity, openingHoursSpecification, photo, publicAccess, smokingAllowed, specialOpeningHoursSpecification, currenciesAccepted, openingHours, paymentAccepted, priceRange)
| [
"[email protected]"
] | |
9090cf8f5afc34505f2a27b36145a5667b7bc8c2 | aff3d82217ca3a43d42c215b7fde022017f3b779 | /spec/one_image_spec.py | 218822cbdcf28e9883c86acb41297198d17aea62 | [] | no_license | AndyDeany/turnbasedgame | 96784a6f1fcf7c2c82e10012d81b4e0caf807a6b | 362f973888a549535a854500da443613725ad0f0 | refs/heads/master | 2021-01-19T08:48:28.125410 | 2017-09-09T09:56:51 | 2017-09-09T09:56:51 | 76,188,966 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 671 | py | from spec.spec_helper import *
from lib.one_image import OneImage
with description("OneImage"):
with it("should initialise"):
one_image = OneImage(game, "items/heart")
expect(one_image.image_name).to(equal("items/heart"))
expect(one_image.image).to(be(None))
with it("should load its image"):
one_image = OneImage(game, "items/heart")
one_image.load_image()
expect(one_image.image).to(be_a(game.pygame.Surface))
with it("should unload its image"):
one_image = OneImage(game, "items/heart")
one_image.load_image()
one_image.unload_image()
expect(one_image.image).to(be(None))
| [
"[email protected]"
] | |
4195bf38a598c838adeceb94937fad2949c57c3a | f373eaeba3f42d2e883a0338dbc7bf2eab8cdf88 | /pycalq/tests/test_pycalq.py | 2f8a9540b6d69608385cc68cae0e6db8d1a3aaea | [
"MIT"
] | permissive | FriedrichK/pyCalq | 6f41d561f4394c7c4d57df08a715b560e41812c9 | b20c1c5694d34dbeb7439986189cae3f698bb910 | refs/heads/master | 2021-01-23T03:44:24.972747 | 2014-08-20T00:19:51 | 2014-08-20T00:19:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,685 | py | # -*- coding: utf-8 -*-
from datetime import datetime
import json
import unittest
from mock import Mock, patch
from hamcrest import *
from pycalq import CALQ_API_ENDPOINT_TRACKING, CALQ_API_ENDPOINT_PROFILE, CALQ_API_ENDPOINT_TRANSFER
from pycalq.tools import create_timestamp_string
from pycalq.validation import ActionParameterValidator, ParameterValidationException
from pycalq.tracking import track_action, submit_profile, transfer_user
TEST_DATETIME = datetime(2014, 8, 19, 13, 16, 30, 1)
TEST_DATETIME_STRING = '2014-08-19 13:16:30.000001'
TEST_ACTOR_NAME = 'test_actor'
TEST_ACTOR_NAME2 = "test_actor_2"
IP_ADDRESS_MOCK = '127.1.2.7'
TEST_ACTION = 'Does Amazing Thing'
WRITE_KEY_MOCK = 'allworkandnoplaymakesjackadullboy'
TEST_PROPERTY_VALID_GENDER = 'male'
TEST_PROPERTY_INVALID_GENDER = 'I prefer not to say'
TEST_PROPERTY_VALID_CURRENCY = 'usd'
TEST_PROPERTY_INVALID_CURRENCY = 'usdx'
TEST_PROPERTY_VALID_AGE = 29
TEST_PROPERTY_INVALID_AGE = 'twenty-nine'
TEST_PROPERTY_VALID_SALE_VALUE = 1
TEST_PROPERTY_VALID_SALE_CURRENCY = 'eur'
TEST_PROPERTY_VALID_DEVICE_AGENT = 'android'
TEST_PROPERTY_VALID_DEVICE_OS = 'android'
TEST_PROPERTY_VALID_DEVICE_RESOLUTION = '1024x768'
TEST_PROPERTY_VALID_DEVICE_MOBILE = True
TEST_PROPERTY_VALID_COUNTRY = 'DE'
TEST_PROPERTY_VALID_REGION = 'BE'
TEST_PROPERTY_VALID_CITY = 'Berlin'
TEST_PROPERTY_VALID_UTM_CAMPAIGN = 'campaign_name'
TEST_PROPERTY_VALID_UTM_SOURCE = 'utm_source'
TEST_PROPERTY_VALID_UTM_MEDIUM = 'radio'
TEST_PROPERTY_VALID_UTM_SOURCE = 'nytimes'
TEST_PROPERTY_VALID_UTM_CONTENT = 'content'
TEST_PROPERTY_VALID_UTM_TERM = 'some,keywords,convert,well'
class ToolsTestCase(unittest.TestCase):
def test_returns_timestamp_string_in_expected_format(self):
actual = create_timestamp_string(TEST_DATETIME)
self.assertEquals(actual, TEST_DATETIME_STRING)
class TrackingTestCase(unittest.TestCase):
@patch('pycalq.tracking.PoolManager')
def test_sends_tracking_request_as_expected(self, PoolManagerMock):
PoolManagerMock, url_open_mock = self._build_pool_manager_mock(PoolManagerMock)
properties = {'$country': 'NL', 'custom_property': True}
track_action(TEST_ACTOR_NAME, TEST_ACTION, WRITE_KEY_MOCK, properties, IP_ADDRESS_MOCK, TEST_DATETIME)
args, kwargs = url_open_mock.call_args
self.assertEquals(args[0], 'POST')
self.assertEquals(args[1], CALQ_API_ENDPOINT_TRACKING)
self.assertEquals(kwargs['headers'], {'Content-Type': 'application/json'})
expected = {
'timestamp': TEST_DATETIME_STRING,
'actor': TEST_ACTOR_NAME,
'action_name': TEST_ACTION,
'write_key': WRITE_KEY_MOCK,
'ip_address': IP_ADDRESS_MOCK,
'properties': properties
}
self.assertEquals(json.loads(kwargs['body']), expected)
@patch('pycalq.tracking.PoolManager')
def test_logs_that_action_request_properties_are_invalid(self, PoolManagerMock):
logger_mock = Mock()
logger_mock.debug = Mock()
properties = {'$gender': TEST_PROPERTY_INVALID_GENDER}
track_action(TEST_ACTOR_NAME, TEST_ACTION, WRITE_KEY_MOCK, properties, IP_ADDRESS_MOCK, TEST_DATETIME, log=logger_mock)
self.assertTrue(logger_mock.debug.called)
@patch('pycalq.tracking.PoolManager')
def test_sends_profile_request_as_expected(self, PoolManagerMock):
PoolManagerMock, url_open_mock = self._build_pool_manager_mock(PoolManagerMock)
properties = {'$age': TEST_PROPERTY_VALID_AGE, 'custom_property': True}
submit_profile(TEST_ACTOR_NAME, WRITE_KEY_MOCK, properties)
args, kwargs = url_open_mock.call_args
self.assertEquals(args[0], 'POST')
self.assertEquals(args[1], CALQ_API_ENDPOINT_PROFILE)
self.assertEquals(kwargs['headers'], {'Content-Type': 'application/json'})
expected = {
'actor': TEST_ACTOR_NAME,
'write_key': WRITE_KEY_MOCK,
'properties': properties
}
self.assertEquals(json.loads(kwargs['body']), expected)
@patch('pycalq.tracking.PoolManager')
def test_logs_that_profile_request_properties_are_invalid(self, PoolManagerMock):
logger_mock = Mock()
logger_mock.debug = Mock()
properties = {'$age': TEST_PROPERTY_INVALID_AGE}
submit_profile(TEST_ACTOR_NAME, WRITE_KEY_MOCK, properties, log=logger_mock)
self.assertTrue(logger_mock.debug.called)
@patch('pycalq.tracking.PoolManager')
def test_sends_transfer_request_as_expected(self, PoolManagerMock):
PoolManagerMock, url_open_mock = self._build_pool_manager_mock(PoolManagerMock)
transfer_user(TEST_ACTOR_NAME, TEST_ACTOR_NAME2, WRITE_KEY_MOCK)
args, kwargs = url_open_mock.call_args
self.assertEquals(args[0], 'POST')
self.assertEquals(args[1], CALQ_API_ENDPOINT_TRANSFER)
self.assertEquals(kwargs['headers'], {'Content-Type': 'application/json'})
expected = {
'old_actor': TEST_ACTOR_NAME,
'new_actor': TEST_ACTOR_NAME2,
'write_key': WRITE_KEY_MOCK
}
self.assertEquals(json.loads(kwargs['body']), expected)
def _build_pool_manager_mock(self, PoolManagerMock):
pool_manager_mock = Mock()
pool_manager_mock.urlopen = Mock()
PoolManagerMock.return_value = pool_manager_mock
return PoolManagerMock, pool_manager_mock.urlopen
class ValidationTestCase(unittest.TestCase):
def test_recognizes_data_as_valid(self):
data = {
'$sale_value': TEST_PROPERTY_VALID_SALE_VALUE,
'$sale_currency': TEST_PROPERTY_VALID_SALE_CURRENCY,
'$device_agent': TEST_PROPERTY_VALID_DEVICE_AGENT,
'$device_os': TEST_PROPERTY_VALID_DEVICE_OS,
'$device_resolution': TEST_PROPERTY_VALID_DEVICE_RESOLUTION,
'$device_mobile': TEST_PROPERTY_VALID_DEVICE_MOBILE,
'$country': TEST_PROPERTY_VALID_COUNTRY,
'$region': TEST_PROPERTY_VALID_REGION,
'$city': TEST_PROPERTY_VALID_CITY,
'$gender': TEST_PROPERTY_VALID_GENDER,
'$age': TEST_PROPERTY_VALID_AGE,
'$utm_campaign': TEST_PROPERTY_VALID_UTM_CAMPAIGN,
'$utm_source': TEST_PROPERTY_VALID_UTM_SOURCE,
'$utm_medium': TEST_PROPERTY_VALID_UTM_MEDIUM,
'$utm_content': TEST_PROPERTY_VALID_UTM_CONTENT,
'$utm_term': TEST_PROPERTY_VALID_UTM_TERM
}
actual = ActionParameterValidator().validate(data)
self.assertEquals(actual, (True, None,))
def test_flags_unrecognized_special_property(self):
data = {'$unrecognizedproperty': 'is unrecognized'}
self.assertRaises(ParameterValidationException, ActionParameterValidator().validate, data)
def test_flags_missing_required_parameter(self):
data = {'$sale_currency': TEST_PROPERTY_VALID_CURRENCY}
self.assertRaises(ParameterValidationException, ActionParameterValidator().validate, data)
def test_flags_max_length_violation(self):
data = {'$sale_currency': TEST_PROPERTY_INVALID_CURRENCY, '$sale_value': TEST_PROPERTY_VALID_SALE_VALUE}
self.assertRaises(ParameterValidationException, ActionParameterValidator().validate, data)
def test_flags_option_violation(self):
data = {'$gender': TEST_PROPERTY_INVALID_GENDER}
self.assertRaises(ParameterValidationException, ActionParameterValidator().validate, data)
def test_flags_integer_violation(self):
data = {'$age': TEST_PROPERTY_INVALID_AGE}
self.assertRaises(ParameterValidationException, ActionParameterValidator().validate, data)
| [
"[email protected]"
] | |
a0466ef7bd023fdf3d1afacd76c536df72193f33 | 1886065d10342822b10063cd908a690fccf03d8b | /appengine/monorail/registerpages.py | 6462450f181b19fe6abb79158a59176b17177617 | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/chromium-infra_A6Y5 | 26af0dee12f89595ebc6a040210c9f62d8ded763 | d27ac0b230bedae4bc968515b02927cf9e17c2b7 | refs/heads/master | 2023-03-16T15:33:31.015840 | 2017-01-31T19:55:59 | 2017-01-31T20:06:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 15,490 | py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""This file sets up all the urls for monorail pages."""
import logging
import webapp2
import settings
from features import autolink
from features import hotlistcreate
from features import hotlistdetails
from features import hotlistissues
from features import hotlistissuescsv
from features import hotlistpeople
from features import cues
from features import filterrules
from features import userhotlists
from features import inboundemail
from features import notify
from features import rerankhotlist
from features import savedqueries
from features import spammodel
from features import stars
from framework import artifactcollision
from framework import banned
from framework import clientmon
from framework import csp_report
from framework import excessiveactivity
from framework import framework_bizobj
from framework import reap
from framework import registerpages_helpers
from framework import tokenrefresh
from framework import urls
from project import peopledetail
from project import peoplelist
from project import projectadmin
from project import projectadminadvanced
from project import projectexport
from project import projectsummary
from project import projectupdates
from project import redirects
from search import backendnonviewable
from search import backendsearch
from services import cachemanager_svc
from services import client_config_svc
from sitewide import custom_404
from sitewide import groupadmin
from sitewide import groupcreate
from sitewide import groupdetail
from sitewide import grouplist
from sitewide import hostinghome
from sitewide import moved
from sitewide import projectcreate
from sitewide import userhotlistsmenu
from sitewide import userprofile
from sitewide import userprojects
from sitewide import usersettings
from sitewide import userclearbouncing
from sitewide import userupdates
from tracker import componentcreate
from tracker import componentdetail
from tracker import fieldcreate
from tracker import fielddetail
from tracker import issueadmin
from tracker import issueadvsearch
from tracker import issueattachment
from tracker import issueattachmenttext
from tracker import issuebulkedit
from tracker import issuedetail
from tracker import issueentry
from tracker import issueentryafterlogin
from tracker import issuelist
from tracker import issuelistcsv
from tracker import issueoptions
from tracker import issueoriginal
from tracker import issueexport
from tracker import issueimport
from tracker import issuereindex
from tracker import issuererank
from tracker import issuetips
from tracker import issueaddtohotlist
from tracker import spam
from api import api_service
class ServletRegistry(object):
_PROJECT_NAME_REGEX = r'[a-z0-9][-a-z0-9]*[a-z0-9]'
_USERNAME_REGEX = r'[-+\w=.%]+(@([a-z0-9]+\.)*[a-z0-9]+)?'
_HOTLIST_ID_NAME_REGEX = r'\d+|[a-zA-Z][-0-9a-zA-Z\.]*'
def __init__(self):
self.routes = []
def _AddRoute(self, path_regex, servlet_class, method, does_write=False):
"""Add a GET or POST handler to our webapp2 route list.
Args:
path_regex: string with webapp2 URL template regex.
servlet_class: a subclass of class Servlet.
method: string 'GET' or 'POST'.
does_write: True if the servlet could write to the database, we skip
registering such servlets when the site is in read_only mode. GET
handlers never write. Most, but not all, POST handlers do write.
"""
if settings.read_only and does_write:
logging.info('Not registring %r because site is read-only', path_regex)
# TODO(jrobbins): register a helpful error page instead.
else:
self.routes.append(
webapp2.Route(path_regex, handler=servlet_class, methods=[method]))
def _SetupServlets(self, spec_dict, base='', post_does_write=True):
"""Register each of the given servlets."""
for get_uri, servlet_class in spec_dict.items():
self._AddRoute(base + get_uri, servlet_class, 'GET')
post_uri = get_uri + ('edit.do' if get_uri.endswith('/') else '.do')
self._AddRoute(base + post_uri, servlet_class, 'POST',
does_write=post_does_write)
def _SetupProjectServlets(self, spec_dict, post_does_write=True):
"""Register each of the given servlets in the project URI space."""
self._SetupServlets(
spec_dict, base='/p/<project_name:%s>' % self._PROJECT_NAME_REGEX,
post_does_write=post_does_write)
def _SetupUserServlets(self, spec_dict, post_does_write=True):
"""Register each of the given servlets in the user URI space."""
self._SetupServlets(
spec_dict, base='/u/<viewed_username:%s>' % self._USERNAME_REGEX,
post_does_write=post_does_write)
def _SetupGroupServlets(self, spec_dict, post_does_write=True):
"""Register each of the given servlets in the user group URI space."""
self._SetupServlets(
spec_dict, base='/g/<viewed_username:%s>' % self._USERNAME_REGEX,
post_does_write=post_does_write)
def _SetupUserHotlistServlets(self, spec_dict, post_does_write=True):
""" Register given user hotlist servlets in the user URI space."""
self._SetupServlets(
spec_dict,
base ='/u/<viewed_username:%s>/hotlists/<hotlist_id:%s>'
% (self._USERNAME_REGEX, self._HOTLIST_ID_NAME_REGEX),
post_does_write=post_does_write)
def Register(self, services):
"""Register all the monorail request handlers."""
self._RegisterFrameworkHandlers()
self._RegisterSitewideHandlers()
self._RegisterProjectHandlers()
self._RegisterIssueHandlers()
self._RegisterRedirects()
self._RegisterInboundMail()
api_service.RegisterApiHandlers(self)
autolink.RegisterAutolink(services)
# Error pages should be the last to register.
self._RegisterErrorPages()
logging.info('Finished registering monorail handlers.')
return self.routes
def _RegisterProjectHandlers(self):
"""Register page and form handlers that operate within a project."""
self._SetupProjectServlets({
urls.ADMIN_INTRO: projectsummary.ProjectSummary,
urls.PEOPLE_LIST: peoplelist.PeopleList,
urls.PEOPLE_DETAIL: peopledetail.PeopleDetail,
urls.PEOPLE_DETAIL_PREFS_JSON: peopledetail.PagePrefs,
urls.UPDATES_LIST: projectupdates.ProjectUpdates,
urls.ADMIN_META: projectadmin.ProjectAdmin,
urls.ADMIN_ADVANCED: projectadminadvanced.ProjectAdminAdvanced,
urls.ADMIN_EXPORT: projectexport.ProjectExport,
urls.ADMIN_EXPORT_JSON: projectexport.ProjectExportJSON,
})
def _RegisterIssueHandlers(self):
"""Register page and form handlers for the issue tracker."""
self._SetupServlets({
# Note: there is both a site-wide and per-project issue list.
urls.ISSUE_LIST: issuelist.IssueList,
# Note: the following are at URLs that are not externaly accessible.
urls.BACKEND_SEARCH: backendsearch.BackendSearch,
urls.BACKEND_NONVIEWABLE: backendnonviewable.BackendNonviewable,
urls.RECOMPUTE_DERIVED_FIELDS_TASK:
filterrules.RecomputeDerivedFieldsTask,
urls.REINDEX_QUEUE_CRON: filterrules.ReindexQueueCron,
urls.NOTIFY_ISSUE_CHANGE_TASK: notify.NotifyIssueChangeTask,
urls.NOTIFY_BLOCKING_CHANGE_TASK: notify.NotifyBlockingChangeTask,
urls.NOTIFY_BULK_CHANGE_TASK: notify.NotifyBulkChangeTask,
urls.OUTBOUND_EMAIL_TASK: notify.OutboundEmailTask,
urls.SPAM_DATA_EXPORT_TASK: spammodel.TrainingDataExportTask,
})
self._SetupProjectServlets({
urls.ISSUE_LIST: issuelist.IssueList,
urls.ISSUE_LIST_CSV: issuelistcsv.IssueListCsv,
urls.ISSUE_REINDEX: issuereindex.IssueReindex,
urls.ISSUE_DETAIL: issuedetail.IssueDetail,
urls.ISSUE_COMMENT_DELETION_JSON: issuedetail.IssueCommentDeletion,
urls.ISSUE_ATTACHMENT_DELETION_JSON:
issueattachment.IssueAttachmentDeletion,
urls.ISSUE_FLAGSPAM_JSON: spam.FlagSpamForm,
urls.ISSUE_SETSTAR_JSON: issuedetail.SetStarForm,
urls.ISSUE_DELETE_JSON: issuedetail.IssueDeleteForm,
urls.ISSUE_ENTRY: issueentry.IssueEntry,
urls.ISSUE_ENTRY_AFTER_LOGIN: issueentryafterlogin.IssueEntryAfterLogin,
urls.ISSUE_OPTIONS_JSON: issueoptions.IssueOptionsJSON,
urls.ISSUE_TIPS: issuetips.IssueSearchTips,
urls.ISSUE_ATTACHMENT: issueattachment.AttachmentPage,
urls.ISSUE_ATTACHMENT_TEXT: issueattachmenttext.AttachmentText,
urls.ISSUE_BULK_EDIT: issuebulkedit.IssueBulkEdit,
urls.COMPONENT_CHECKNAME_JSON: componentcreate.CheckComponentNameJSON,
urls.COMPONENT_CREATE: componentcreate.ComponentCreate,
urls.COMPONENT_DETAIL: componentdetail.ComponentDetail,
urls.FIELD_CHECKNAME_JSON: fieldcreate.CheckFieldNameJSON,
urls.FIELD_CREATE: fieldcreate.FieldCreate,
urls.FIELD_DETAIL: fielddetail.FieldDetail,
urls.WIKI_LIST: redirects.WikiRedirect,
urls.WIKI_PAGE: redirects.WikiRedirect,
urls.SOURCE_PAGE: redirects.SourceRedirect,
urls.ADMIN_STATUSES: issueadmin.AdminStatuses,
urls.ADMIN_LABELS: issueadmin.AdminLabels,
urls.ADMIN_RULES: issueadmin.AdminRules,
urls.ADMIN_TEMPLATES: issueadmin.AdminTemplates,
urls.ADMIN_COMPONENTS: issueadmin.AdminComponents,
urls.ADMIN_VIEWS: issueadmin.AdminViews,
urls.ISSUE_ORIGINAL: issueoriginal.IssueOriginal,
urls.ISSUE_EXPORT: issueexport.IssueExport,
urls.ISSUE_EXPORT_JSON: issueexport.IssueExportJSON,
urls.ISSUE_IMPORT: issueimport.IssueImport,
urls.SPAM_MODERATION_QUEUE: spam.ModerationQueue,
urls.ISSUE_RERANK_BLOCKED_ON: issuererank.IssueRerank,
})
self._SetupUserServlets({
urls.SAVED_QUERIES: savedqueries.SavedQueries,
urls.HOTLISTS: userhotlists.UserHotlists,
})
user_hotlists_redir = registerpages_helpers.MakeRedirectInScope(
urls.HOTLISTS, 'u', keep_qs=True)
self._SetupUserServlets({
'/hotlists/': user_hotlists_redir,
})
# These servlets accept POST, but never write to the database, so they can
# still be used when the site is read-only.
self._SetupProjectServlets({
urls.ISSUE_ADVSEARCH: issueadvsearch.IssueAdvancedSearch,
}, post_does_write=False)
list_redir = registerpages_helpers.MakeRedirectInScope(
urls.ISSUE_LIST, 'p', keep_qs=True)
self._SetupProjectServlets({
'': list_redir,
'/': list_redir,
'/issues': list_redir,
'/issues/': list_redir,
})
list_redir = registerpages_helpers.MakeRedirect(urls.ISSUE_LIST)
self._SetupServlets({
'/issues': list_redir,
'/issues/': list_redir,
})
def _RegisterFrameworkHandlers(self):
"""Register page and form handlers for framework functionality."""
self._SetupServlets({
urls.CSP_REPORT: csp_report.CSPReportPage,
urls.TOKEN_REFRESH: tokenrefresh.TokenRefresh,
# These are only shown to users iff specific conditions are met.
urls.NONPROJECT_COLLISION: artifactcollision.ArtifactCollision,
urls.EXCESSIVE_ACTIVITY: excessiveactivity.ExcessiveActivity,
urls.BANNED: banned.Banned,
urls.PROJECT_MOVED: moved.ProjectMoved,
# These are not externally accessible
urls.RAMCACHE_CONSOLIDATE_CRON: cachemanager_svc.RamCacheConsolidate,
urls.REAP_CRON: reap.Reap,
urls.SPAM_DATA_EXPORT_CRON: spammodel.TrainingDataExport,
urls.LOAD_API_CLIENT_CONFIGS_CRON: (
client_config_svc.LoadApiClientConfigs),
urls.CLIENT_MON: clientmon.ClientMonitor,
})
self._SetupProjectServlets({
# Collisions can happen on artifacts within a project or outside.
urls.ARTIFACT_COLLISION: artifactcollision.ArtifactCollision,
})
def _RegisterSitewideHandlers(self):
"""Register page and form handlers that aren't associated with projects."""
self._SetupServlets({
urls.PROJECT_CREATE: projectcreate.ProjectCreate,
urls.CHECK_PROJECT_NAME_JSON: projectcreate.CheckProjectNameJSON,
# The user settings page is a site-wide servlet, not under /u/.
urls.USER_SETTINGS: usersettings.UserSettings,
urls.USER_PROJECTS_JSON: userprojects.ProjectsJsonFeed,
urls.USER_HOTLISTS_JSON: userhotlistsmenu.HotlistsJsonFeed,
urls.HOSTING_HOME: hostinghome.HostingHome,
urls.STARS_JSON: stars.SetStarsFeed,
urls.CUES_JSON: cues.SetCuesFeed,
urls.GROUP_CREATE: groupcreate.GroupCreate,
urls.GROUP_LIST: grouplist.GroupList,
urls.GROUP_DELETE: grouplist.GroupList,
urls.HOTLIST_CREATE: hotlistcreate.HotlistCreate,
urls.ADD_ISSUES_TO_HOTLIST: issueaddtohotlist.AddToHotlist,
})
self._SetupUserServlets({
urls.USER_PROFILE: userprofile.UserProfile,
urls.USER_CLEAR_BOUNCING: userclearbouncing.UserClearBouncing,
urls.USER_UPDATES_PROJECTS: userupdates.UserUpdatesProjects,
urls.USER_UPDATES_DEVELOPERS: userupdates.UserUpdatesDevelopers,
urls.USER_UPDATES_MINE: userupdates.UserUpdatesIndividual,
})
self._SetupUserHotlistServlets({
urls.HOTLIST_ISSUES: hotlistissues.HotlistIssues,
urls.HOTLIST_ISSUES_CSV: hotlistissuescsv.HotlistIssuesCsv,
urls.HOTLIST_PEOPLE: hotlistpeople.HotlistPeopleList,
urls.HOTLIST_DETAIL: hotlistdetails.HotlistDetails,
urls.HOTLIST_RERANK_JSON: rerankhotlist.RerankHotlistIssue,
})
profile_redir = registerpages_helpers.MakeRedirectInScope(
urls.USER_PROFILE, 'u')
self._SetupUserServlets({'': profile_redir})
self._SetupGroupServlets({
urls.GROUP_DETAIL: groupdetail.GroupDetail,
urls.GROUP_ADMIN: groupadmin.GroupAdmin,
})
def _RegisterRedirects(self):
"""Register redirects among pages inside monorail."""
redirect = registerpages_helpers.MakeRedirect('/hosting/')
self._SetupServlets({
'/hosting': redirect,
'/p': redirect,
'/p/': redirect,
'/u': redirect,
'/u/': redirect,
'/': redirect,
})
redirect = registerpages_helpers.MakeRedirectInScope(
urls.PEOPLE_LIST, 'p')
self._SetupProjectServlets({
'/people': redirect,
'/people/': redirect,
})
redirect = registerpages_helpers.MakeRedirect(urls.GROUP_LIST)
self._SetupServlets({'/g': redirect})
group_redir = registerpages_helpers.MakeRedirectInScope(
urls.USER_PROFILE, 'g')
self._SetupGroupServlets({'': group_redir})
def _RegisterInboundMail(self):
"""Register a handler for inbound email and email bounces."""
self.routes.append(webapp2.Route(
'/_ah/mail/<project_addr:.+>',
handler=inboundemail.InboundEmail,
methods=['POST', 'GET']))
self.routes.append(webapp2.Route(
'/_ah/bounce',
handler=inboundemail.BouncedEmail,
methods=['POST', 'GET']))
def _RegisterErrorPages(self):
"""Register handlers for errors."""
self._AddRoute(
'/p/<project_name:%s>/<unrecognized:.+>' % self._PROJECT_NAME_REGEX,
custom_404.ErrorPage, 'GET')
| [
"[email protected]"
] | |
d790c7885266f95d1e751f1c0d09f6250734a4d2 | 45e8c30fbcd754e780230c3afd8a587f0833f4b0 | /blender_2.03_tree/lib/Python/Lib/ihooks.py | 300ac80b2f5a9504af37bbf8f90bca954586cafb | [] | no_license | daar/bare-blender | 2fdfb312a1d8f3048346bfa504aa863a61cfe814 | 3306d88a2ac9f78bcc7830c4bcafb4f2c7db7897 | refs/heads/master | 2021-01-16T17:47:42.303184 | 2015-05-19T21:33:46 | 2015-05-19T21:33:46 | 32,135,666 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 17,450 | py | """Import hook support.
Consistent use of this module will make it possible to change the
different mechanisms involved in loading modules independently.
While the built-in module imp exports interfaces to the built-in
module searching and loading algorithm, and it is possible to replace
the built-in function __import__ in order to change the semantics of
the import statement, until now it has been difficult to combine the
effect of different __import__ hacks, like loading modules from URLs
by rimport.py, or restricted execution by rexec.py.
This module defines three new concepts:
1) A "file system hooks" class provides an interface to a filesystem.
One hooks class is defined (Hooks), which uses the interface provided
by standard modules os and os.path. It should be used as the base
class for other hooks classes.
2) A "module loader" class provides an interface to to search for a
module in a search path and to load it. It defines a method which
searches for a module in a single directory; by overriding this method
one can redefine the details of the search. If the directory is None,
built-in and frozen modules are searched instead.
Two module loader class are defined, both implementing the search
strategy used by the built-in __import__ function: ModuleLoader uses
the imp module's find_module interface, while HookableModuleLoader
uses a file system hooks class to interact with the file system. Both
use the imp module's load_* interfaces to actually load the module.
3) A "module importer" class provides an interface to import a
module, as well as interfaces to reload and unload a module. It also
provides interfaces to install and uninstall itself instead of the
default __import__ and reload (and unload) functions.
One module importer class is defined (ModuleImporter), which uses a
module loader instance passed in (by default HookableModuleLoader is
instantiated).
The classes defined here should be used as base classes for extended
functionality along those lines.
If a module mporter class supports dotted names, its import_module()
must return a different value depending on whether it is called on
behalf of a "from ... import ..." statement or not. (This is caused
by the way the __import__ hook is used by the Python interpreter.) It
would also do wise to install a different version of reload().
"""
import __builtin__
import imp
import os
import sys
import string
VERBOSE = 0
from imp import C_EXTENSION, PY_SOURCE, PY_COMPILED
from imp import C_BUILTIN, PY_FROZEN, PKG_DIRECTORY
BUILTIN_MODULE = C_BUILTIN
FROZEN_MODULE = PY_FROZEN
class _Verbose:
def __init__(self, verbose = VERBOSE):
self.verbose = verbose
def get_verbose(self):
return self.verbose
def set_verbose(self, verbose):
self.verbose = verbose
# XXX The following is an experimental interface
def note(self, *args):
if self.verbose:
apply(self.message, args)
def message(self, format, *args):
if args:
print format%args
else:
print format
class BasicModuleLoader(_Verbose):
"""Basic module loader.
This provides the same functionality as built-in import. It
doesn't deal with checking sys.modules -- all it provides is
find_module() and a load_module(), as well as find_module_in_dir()
which searches just one directory, and can be overridden by a
derived class to change the module search algorithm when the basic
dependency on sys.path is unchanged.
The interface is a little more convenient than imp's:
find_module(name, [path]) returns None or 'stuff', and
load_module(name, stuff) loads the module.
"""
def find_module(self, name, path = None):
if path is None:
path = [None] + self.default_path()
for dir in path:
stuff = self.find_module_in_dir(name, dir)
if stuff: return stuff
return None
def default_path(self):
return sys.path
def find_module_in_dir(self, name, dir):
if dir is None:
return self.find_builtin_module(name)
else:
try:
return imp.find_module(name, [dir])
except ImportError:
return None
def find_builtin_module(self, name):
# XXX frozen packages?
if imp.is_builtin(name):
return None, '', ('', '', BUILTIN_MODULE)
if imp.is_frozen(name):
return None, '', ('', '', FROZEN_MODULE)
return None
def load_module(self, name, stuff):
file, filename, info = stuff
try:
return imp.load_module(name, file, filename, info)
finally:
if file: file.close()
class Hooks(_Verbose):
"""Hooks into the filesystem and interpreter.
By deriving a subclass you can redefine your filesystem interface,
e.g. to merge it with the URL space.
This base class behaves just like the native filesystem.
"""
# imp interface
def get_suffixes(self): return imp.get_suffixes()
def new_module(self, name): return imp.new_module(name)
def is_builtin(self, name): return imp.is_builtin(name)
def init_builtin(self, name): return imp.init_builtin(name)
def is_frozen(self, name): return imp.is_frozen(name)
def init_frozen(self, name): return imp.init_frozen(name)
def get_frozen_object(self, name): return imp.get_frozen_object(name)
def load_source(self, name, filename, file=None):
return imp.load_source(name, filename, file)
def load_compiled(self, name, filename, file=None):
return imp.load_compiled(name, filename, file)
def load_dynamic(self, name, filename, file=None):
return imp.load_dynamic(name, filename, file)
def load_package(self, name, filename, file=None):
return imp.load_module(name, file, filename, ("", "", PKG_DIRECTORY))
def add_module(self, name):
d = self.modules_dict()
if d.has_key(name): return d[name]
d[name] = m = self.new_module(name)
return m
# sys interface
def modules_dict(self): return sys.modules
def default_path(self): return sys.path
def path_split(self, x): return os.path.split(x)
def path_join(self, x, y): return os.path.join(x, y)
def path_isabs(self, x): return os.path.isabs(x)
# etc.
def path_exists(self, x): return os.path.exists(x)
def path_isdir(self, x): return os.path.isdir(x)
def path_isfile(self, x): return os.path.isfile(x)
def path_islink(self, x): return os.path.islink(x)
# etc.
def openfile(self, *x): return apply(open, x)
openfile_error = IOError
def listdir(self, x): return os.listdir(x)
listdir_error = os.error
# etc.
class ModuleLoader(BasicModuleLoader):
"""Default module loader; uses file system hooks.
By defining suitable hooks, you might be able to load modules from
other sources than the file system, e.g. from compressed or
encrypted files, tar files or (if you're brave!) URLs.
"""
def __init__(self, hooks = None, verbose = VERBOSE):
BasicModuleLoader.__init__(self, verbose)
self.hooks = hooks or Hooks(verbose)
def default_path(self):
return self.hooks.default_path()
def modules_dict(self):
return self.hooks.modules_dict()
def get_hooks(self):
return self.hooks
def set_hooks(self, hooks):
self.hooks = hooks
def find_builtin_module(self, name):
# XXX frozen packages?
if self.hooks.is_builtin(name):
return None, '', ('', '', BUILTIN_MODULE)
if self.hooks.is_frozen(name):
return None, '', ('', '', FROZEN_MODULE)
return None
def find_module_in_dir(self, name, dir, allow_packages=1):
if dir is None:
return self.find_builtin_module(name)
if allow_packages:
fullname = self.hooks.path_join(dir, name)
if self.hooks.path_isdir(fullname):
stuff = self.find_module_in_dir("__init__", fullname, 0)
if stuff:
file = stuff[0]
if file: file.close()
return None, fullname, ('', '', PKG_DIRECTORY)
for info in self.hooks.get_suffixes():
suff, mode, type = info
fullname = self.hooks.path_join(dir, name+suff)
try:
fp = self.hooks.openfile(fullname, mode)
return fp, fullname, info
except self.hooks.openfile_error:
pass
return None
def load_module(self, name, stuff):
file, filename, info = stuff
(suff, mode, type) = info
try:
if type == BUILTIN_MODULE:
return self.hooks.init_builtin(name)
if type == FROZEN_MODULE:
return self.hooks.init_frozen(name)
if type == C_EXTENSION:
m = self.hooks.load_dynamic(name, filename, file)
elif type == PY_SOURCE:
m = self.hooks.load_source(name, filename, file)
elif type == PY_COMPILED:
m = self.hooks.load_compiled(name, filename, file)
elif type == PKG_DIRECTORY:
m = self.hooks.load_package(name, filename, file)
else:
raise ImportError, "Unrecognized module type (%s) for %s" % \
(`type`, name)
finally:
if file: file.close()
m.__file__ = filename
return m
class FancyModuleLoader(ModuleLoader):
"""Fancy module loader -- parses and execs the code itself."""
def load_module(self, name, stuff):
file, filename, (suff, mode, type) = stuff
realfilename = filename
path = None
if type == PKG_DIRECTORY:
initstuff = self.find_module_in_dir("__init__", filename, 0)
if not initstuff:
raise ImportError, "No __init__ module in package %s" % name
initfile, initfilename, initinfo = initstuff
initsuff, initmode, inittype = initinfo
if inittype not in (PY_COMPILED, PY_SOURCE):
if initfile: initfile.close()
raise ImportError, \
"Bad type (%s) for __init__ module in package %s" % (
`inittype`, name)
path = [filename]
file = initfile
realfilename = initfilename
type = inittype
if type == FROZEN_MODULE:
code = self.hooks.get_frozen_object(name)
elif type == PY_COMPILED:
import marshal
file.seek(8)
code = marshal.load(file)
elif type == PY_SOURCE:
data = file.read()
code = compile(data, realfilename, 'exec')
else:
return ModuleLoader.load_module(self, name, stuff)
m = self.hooks.add_module(name)
if path:
m.__path__ = path
m.__file__ = filename
exec code in m.__dict__
return m
class BasicModuleImporter(_Verbose):
"""Basic module importer; uses module loader.
This provides basic import facilities but no package imports.
"""
def __init__(self, loader = None, verbose = VERBOSE):
_Verbose.__init__(self, verbose)
self.loader = loader or ModuleLoader(None, verbose)
self.modules = self.loader.modules_dict()
def get_loader(self):
return self.loader
def set_loader(self, loader):
self.loader = loader
def get_hooks(self):
return self.loader.get_hooks()
def set_hooks(self, hooks):
return self.loader.set_hooks(hooks)
def import_module(self, name, globals={}, locals={}, fromlist=[]):
if self.modules.has_key(name):
return self.modules[name] # Fast path
stuff = self.loader.find_module(name)
if not stuff:
raise ImportError, "No module named %s" % name
return self.loader.load_module(name, stuff)
def reload(self, module, path = None):
name = module.__name__
stuff = self.loader.find_module(name, path)
if not stuff:
raise ImportError, "Module %s not found for reload" % name
return self.loader.load_module(name, stuff)
def unload(self, module):
del self.modules[module.__name__]
# XXX Should this try to clear the module's namespace?
def install(self):
self.save_import_module = __builtin__.__import__
self.save_reload = __builtin__.reload
if not hasattr(__builtin__, 'unload'):
__builtin__.unload = None
self.save_unload = __builtin__.unload
__builtin__.__import__ = self.import_module
__builtin__.reload = self.reload
__builtin__.unload = self.unload
def uninstall(self):
__builtin__.__import__ = self.save_import_module
__builtin__.reload = self.save_reload
__builtin__.unload = self.save_unload
if not __builtin__.unload:
del __builtin__.unload
class ModuleImporter(BasicModuleImporter):
"""A module importer that supports packages."""
def import_module(self, name, globals=None, locals=None, fromlist=None):
parent = self.determine_parent(globals)
q, tail = self.find_head_package(parent, name)
m = self.load_tail(q, tail)
if not fromlist:
return q
if hasattr(m, "__path__"):
self.ensure_fromlist(m, fromlist)
return m
def determine_parent(self, globals):
if not globals or not globals.has_key("__name__"):
return None
pname = globals['__name__']
if globals.has_key("__path__"):
parent = self.modules[pname]
assert globals is parent.__dict__
return parent
if '.' in pname:
i = string.rfind(pname, '.')
pname = pname[:i]
parent = self.modules[pname]
assert parent.__name__ == pname
return parent
return None
def find_head_package(self, parent, name):
if '.' in name:
i = string.find(name, '.')
head = name[:i]
tail = name[i+1:]
else:
head = name
tail = ""
if parent:
qname = "%s.%s" % (parent.__name__, head)
else:
qname = head
q = self.import_it(head, qname, parent)
if q: return q, tail
if parent:
qname = head
parent = None
q = self.import_it(head, qname, parent)
if q: return q, tail
raise ImportError, "No module named " + qname
def load_tail(self, q, tail):
m = q
while tail:
i = string.find(tail, '.')
if i < 0: i = len(tail)
head, tail = tail[:i], tail[i+1:]
mname = "%s.%s" % (m.__name__, head)
m = self.import_it(head, mname, m)
if not m:
raise ImportError, "No module named " + mname
return m
def ensure_fromlist(self, m, fromlist, recursive=0):
for sub in fromlist:
if sub == "*":
if not recursive:
try:
all = m.__all__
except AttributeError:
pass
else:
self.ensure_fromlist(m, all, 1)
continue
if sub != "*" and not hasattr(m, sub):
subname = "%s.%s" % (m.__name__, sub)
submod = self.import_it(sub, subname, m)
if not submod:
raise ImportError, "No module named " + subname
def import_it(self, partname, fqname, parent):
if not partname:
raise ValueError, "Empty module name"
try:
return self.modules[fqname]
except KeyError:
pass
try:
path = parent and parent.__path__
except AttributeError:
return None
stuff = self.loader.find_module(partname, path)
if not stuff:
return None
m = self.loader.load_module(fqname, stuff)
if parent:
setattr(parent, partname, m)
return m
def reload(self, module):
name = module.__name__
if '.' not in name:
return self.import_it(name, name, None)
i = string.rfind(name, '.')
pname = name[:i]
parent = self.modules[pname]
return self.import_it(name[i+1:], name, parent)
default_importer = None
current_importer = None
def install(importer = None):
global current_importer
current_importer = importer or default_importer or ModuleImporter()
current_importer.install()
def uninstall():
global current_importer
current_importer.uninstall()
| [
"[email protected]"
] | |
67b9b1f7bedfa92e7a3381dc098bc78b70b3407c | 8ab7ffd8b84f242982d54467d1b72ce629eab6a3 | /intents/qtask_exec.py | f5d2db7226ae706bb31fea2296e79136d2827005 | [] | no_license | piaoyangguo/serviceunit | 358de1f1d2b9401a3829529247229bba3a776efc | b2bd20dcc91ef7e560b07ae3d791b3c988f9ae55 | refs/heads/master | 2022-12-10T01:31:11.323159 | 2018-07-15T11:46:32 | 2018-07-15T11:46:32 | 141,023,073 | 0 | 0 | null | 2022-12-08T02:16:47 | 2018-07-15T11:47:05 | Python | UTF-8 | Python | false | false | 808 | py | from intents.base import QueryTask
import teamin
class IntentQtaskExec(QueryTask):
NAME = 'QTASK_EXEC'
def __init__(self, request, intent):
self.request = request
self.intent = intent
def Go(self):
self.initSlots()
query = self.request.Message()
executor = teamin.NameFindNames().ResolveName(self.request.UID(), self.executor)
btc = teamin.BizTaskCount(self.request.AgentName, self.request.AgentUID)
(count, finished, expired), weburl = btc.SpecifyExecutors(query, executor)
self.intent.set_interval(0, 0, weburl)
return self.Response(count, finished, expired, weburl)
def initSlots(self):
self.slot_w = self.intent.slots.filter(type='user_qte_w').first()
self.executor = self.slot_w.original_word
| [
"[email protected]"
] | |
f90f7ccf227ca09f4a2b1ffaa7e3b38a9e93be56 | 6997a36ad765a7beb27d87ed1841a73013090acb | /48.py | 18f1548f60ea5c99d191c5a2baf8b2e6bf93cec6 | [] | no_license | knighton/project-euler | 1a4e0457e752d219027aadcd28fd91b335f1ab18 | 1368c341b9b4b89e718b1d6144198c0081618821 | refs/heads/master | 2016-08-05T01:32:56.692791 | 2014-05-31T23:59:41 | 2014-05-31T23:59:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 67 | py | n = 0
for i in range(1, 1001):
n += i ** i
print str(n)[-10:]
| [
"[email protected]"
] | |
5d5e5f62f0207a9c27374c874bed796593197540 | d1797d0e70af8764b79b127fbc2015b5d030d87d | /pyradex/fjdu/__init__.py | 970e0f15f10d2a0b154e6e36417f24a2a740d7b9 | [
"BSD-3-Clause"
] | permissive | keflavich/pyradex | 2cd4aa602f1005780402b5810078d76d37f95eff | c36c4652e220113cf3d0d9a41fda3ddf4ea3c11a | refs/heads/master | 2023-04-01T19:57:09.571559 | 2023-03-31T13:59:21 | 2023-03-31T13:59:21 | 11,107,526 | 14 | 13 | BSD-3-Clause | 2020-08-06T17:07:01 | 2013-07-01T21:23:04 | Python | UTF-8 | Python | false | false | 42 | py | from . import core
from .core import Fjdu
| [
"[email protected]"
] | |
948abad1c62af6a4a8212819b33c31117eb6da0c | ac2b3f97b4f2423a3724fbf9af69e362183f7f3a | /crimtech_final_project/crimsononline/content/templatetags/top_articles.py | 1bfa713ef2e1825332c6649b34a6a633e3c17125 | [] | no_license | cindyz8735/crimtechcomp | e4109855dd9a87fc11dd29fdf6bb81400c9ce97b | a9045ea79c73c7b864a391039799c2f22234fed3 | refs/heads/master | 2021-01-24T10:06:03.386553 | 2018-04-14T04:24:57 | 2018-04-14T04:24:57 | 123,037,281 | 0 | 0 | null | 2018-02-26T22:08:57 | 2018-02-26T22:08:56 | null | UTF-8 | Python | false | false | 1,358 | py | from django import template
from crimsononline.content.models import MostReadArticles
register = template.Library()
def most_read(context, specifier):
try:
context['mostreadarticles'] = (MostReadArticles.objects
.filter(key=specifier)
.order_by('-create_date')[0]
.articles)
except IndexError, MostReadArticles.DoesNotExist:
pass
return context
@register.inclusion_tag('templatetag/mostreadarticles.html',
takes_context=True)
def most_read_articles(context):
return most_read(context, 'content')
@register.inclusion_tag('templatetag/mostreadadmissions.html',
takes_context=True)
def most_read_admissions(context):
return most_read(context, 'admissions')
@register.inclusion_tag('templatetag/mostreadflyby.html',
takes_context=True)
def most_read_flyby(context):
return most_read(context, 'flyby')
@register.inclusion_tag('templatetag/relatedarticles.html',
takes_context=True)
def related_articles(context):
return context
@register.inclusion_tag('templatetag/recommended_articles.html',
takes_context=True)
def recommended_articles(context):
return context
| [
"[email protected]"
] | |
74ffa57caa17a79f79a4f556743b3885effb2976 | 6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4 | /5SJdiGXZwRiFK5vEJ_5.py | 6b7d5006ba72e571e4e1d9396e974c2c30d63ed2 | [] | no_license | daniel-reich/ubiquitous-fiesta | 26e80f0082f8589e51d359ce7953117a3da7d38c | 9af2700dbe59284f5697e612491499841a6c126f | refs/heads/master | 2023-04-05T06:40:37.328213 | 2021-04-06T20:17:44 | 2021-04-06T20:17:44 | 355,318,759 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 144 | py |
def reverse_capitalize(txt):
txt = txt[::-1]
new_txt = ''
for char in txt:
char = char.upper()
new_txt += char
return new_txt
| [
"[email protected]"
] | |
40b4b83cf0299581548aa08d511e35710c209ba7 | 2c03a6b82547d28cfa0ea59ff7b7e9b44787e0b9 | /rawg/models/genre.py | e02a4abea5e47bab660262bf1d494f517728ad75 | [] | no_license | AaronPierson/rawg | 8b93cacb1d77ab235ed023019d9a5257a50b83fd | 56052d1bce124e9a1e131a164159c2643709c109 | refs/heads/master | 2022-12-18T04:35:40.501672 | 2020-09-24T23:08:44 | 2020-09-24T23:08:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,464 | py | # coding: utf-8
"""
RAWG Video Games Database API
The largest open video games database. ### Why build on RAWG - More than 350,000 games for 50 platforms including mobiles. - Rich metadata: tags, genres, developers, publishers, individual creators, official websites, release dates, Metacritic ratings. - Where to buy: links to digital distribution services - Similar games based on visual similarity. - Player activity data: Steam average playtime and RAWG player counts and ratings. - Actively developing and constantly getting better by user contribution and our algorithms. ### Terms of Use - Free for personal use as long as you attribute RAWG as the source of the data and/or images and add an active hyperlink from every page where the data of RAWG is used. - Free for commercial use for startups and hobby projects with not more than 100,000 monthly active users or 500,000 page views per month. If your project is larger than that, email us at [[email protected]](mailto:[email protected]) for commercial terms. - No cloning. It would not be cool if you used our API to launch a clone of RAWG. We know it is not always easy to say what is a duplicate and what isn't. Drop us a line at [[email protected]](mailto:[email protected]) if you are in doubt, and we will talk it through. - Every API request should have a User-Agent header with your app name. If you don’t provide it, we may ban your requests. __[Read more](https://rawg.io/apidocs)__. # noqa: E501
The version of the OpenAPI document: v1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from rawg.configuration import Configuration
class Genre(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'id': 'int',
'name': 'str',
'slug': 'str',
'games_count': 'int',
'image_background': 'str'
}
attribute_map = {
'id': 'id',
'name': 'name',
'slug': 'slug',
'games_count': 'games_count',
'image_background': 'image_background'
}
def __init__(self, id=None, name=None, slug=None, games_count=None, image_background=None, local_vars_configuration=None): # noqa: E501
"""Genre - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._id = None
self._name = None
self._slug = None
self._games_count = None
self._image_background = None
self.discriminator = None
if id is not None:
self.id = id
self.name = name
if slug is not None:
self.slug = slug
if games_count is not None:
self.games_count = games_count
if image_background is not None:
self.image_background = image_background
@property
def id(self):
"""Gets the id of this Genre. # noqa: E501
:return: The id of this Genre. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this Genre.
:param id: The id of this Genre. # noqa: E501
:type: int
"""
self._id = id
@property
def name(self):
"""Gets the name of this Genre. # noqa: E501
:return: The name of this Genre. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this Genre.
:param name: The name of this Genre. # noqa: E501
:type: str
"""
if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
name is not None and len(name) > 100):
raise ValueError("Invalid value for `name`, length must be less than or equal to `100`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
name is not None and len(name) < 1):
raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") # noqa: E501
self._name = name
@property
def slug(self):
"""Gets the slug of this Genre. # noqa: E501
:return: The slug of this Genre. # noqa: E501
:rtype: str
"""
return self._slug
@slug.setter
def slug(self, slug):
"""Sets the slug of this Genre.
:param slug: The slug of this Genre. # noqa: E501
:type: str
"""
if (self.local_vars_configuration.client_side_validation and
slug is not None and len(slug) < 1):
raise ValueError("Invalid value for `slug`, length must be greater than or equal to `1`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
slug is not None and not re.search(r'^[-a-zA-Z0-9_]+$', slug)): # noqa: E501
raise ValueError(r"Invalid value for `slug`, must be a follow pattern or equal to `/^[-a-zA-Z0-9_]+$/`") # noqa: E501
self._slug = slug
@property
def games_count(self):
"""Gets the games_count of this Genre. # noqa: E501
:return: The games_count of this Genre. # noqa: E501
:rtype: int
"""
return self._games_count
@games_count.setter
def games_count(self, games_count):
"""Sets the games_count of this Genre.
:param games_count: The games_count of this Genre. # noqa: E501
:type: int
"""
self._games_count = games_count
@property
def image_background(self):
"""Gets the image_background of this Genre. # noqa: E501
:return: The image_background of this Genre. # noqa: E501
:rtype: str
"""
return self._image_background
@image_background.setter
def image_background(self, image_background):
"""Sets the image_background of this Genre.
:param image_background: The image_background of this Genre. # noqa: E501
:type: str
"""
if (self.local_vars_configuration.client_side_validation and
image_background is not None and len(image_background) < 1):
raise ValueError("Invalid value for `image_background`, length must be greater than or equal to `1`") # noqa: E501
self._image_background = image_background
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_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, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Genre):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Genre):
return True
return self.to_dict() != other.to_dict()
| [
"[email protected]"
] | |
0f89aabb6afcac086be266a87470dd503016df7c | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1480487_0/Python/alb4tor/GCJ.py | d451fb47ed78eefe43680fc14d2c7e07ec64c891 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Python | false | false | 1,296 | py | '''
Created on 18 mars 2012
@author: gnugnu
'''
import sys
class InputFile(object):
'''
classdocs
'''
def __init__(self, filename=""):
'''
Constructor
'''
if filename == "":
filename = sys.argv[1]
self.full_content = open(filename, "r").readlines()
self.size = int(self.full_content[0])
self.idx = 0
def __iter__(self):
return self
def __len__(self):
return self.size
def next(self):
self.idx += 1
try:
return self.full_content[self.idx].rstrip("\n")
except IndexError:
raise StopIteration
@property
def case(self):
return self.idx
class Output(object):
def __init__(self, filename=""):
self.case = 0
def prt(self, data):
self.case += 1
self._prt("Case #%d: %s" % (self.case, str(data)))
def _prt(self, data):
print data
def close(self):
pass
class OutputFile(Output):
def __init__(self, filename):
Output.__init__(self)
self.fp = open(filename, "w")
def _prt(self, data):
self.fp.write(data+"\n")
def close(self):
self.fp.close()
| [
"[email protected]"
] | |
f449e83fee7a3232c998a2a04bdebd291dcd372a | 9a486a87e028303a551fbd0d1e1b6b650387ea14 | /testPack/testpack.py | 2730eb3f81d6cb3187c4f2e4533eb3ff49c44c12 | [] | no_license | shanlihou/pythonFunc | 7b8e7064fddd4522e492c915c086cc6c5abc6eec | 646920256551ccd8335446dd4fe11aa4b9916f64 | refs/heads/master | 2022-08-24T20:33:12.287464 | 2022-07-21T12:00:10 | 2022-07-21T12:00:10 | 24,311,639 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 49 | py | from testPack import abc
print('hello')
abc.abc() | [
"[email protected]"
] | |
a77f8e23b15fcb2a4caf310890f1a2d3ad7a7714 | 07ec5a0b3ba5e70a9e0fb65172ea6b13ef4115b8 | /lib/python3.6/site-packages/tensorflow/python/estimator/inputs/numpy_io.py | f3fc47e290a7b335b0bdba64fe0da0d41970f3e1 | [] | no_license | cronos91/ML-exercise | 39c5cd7f94bb90c57450f9a85d40c2f014900ea4 | 3b7afeeb6a7c87384049a9b87cac1fe4c294e415 | refs/heads/master | 2021-05-09T22:02:55.131977 | 2017-12-14T13:50:44 | 2017-12-14T13:50:44 | 118,736,043 | 0 | 0 | null | 2018-01-24T08:30:23 | 2018-01-24T08:30:22 | null | UTF-8 | Python | false | false | 129 | py | version https://git-lfs.github.com/spec/v1
oid sha256:06d1937b0e2e65d868e3f6fb34a214b26552db5c1a5dabce73a56b55aa075f63
size 5108
| [
"[email protected]"
] | |
e13aefe727018e905ec98a260eb06accff2fcd2d | 751b094918ae9200afe7824d58804549082caa95 | /src/python/WMCore/JobSplitting/Generators/BasicNaming.py | e0db794314212fbb6fd9f0ed93e09f522ce15972 | [] | no_license | cinquo/WMCore | 7ebd13269f42eb97f416f8f2bdaca05fa93c6afc | 122f9332f2e944154dd0df68b6b3f2875427b032 | refs/heads/master | 2021-01-09T06:28:58.947626 | 2013-06-05T08:31:53 | 2013-06-05T08:31:53 | 2,965,330 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 571 | py | #!/usr/bin/env python
"""
_BasicNaming_
Default name generator using a vaguely sensible convention.
Uses GUIDs to avoid having to keep state
"""
from WMCore.Services.UUID import makeUUID
from WMCore.JobSplitting.Generators.GeneratorInterface import GeneratorInterface
class BasicNaming(GeneratorInterface):
"""
_BasicNaming_
Basic task & guid based name generator
"""
def __call__(self, wmbsJob):
wmbsJob['id'] = "%s/%s" % (self.task.getPathName(), makeUUID())
wmbsJob['name'] = "%s/%s" % (self.task.getPathName(), makeUUID())
| [
"metson@4525493e-7705-40b1-a816-d608a930855b"
] | metson@4525493e-7705-40b1-a816-d608a930855b |
3ee33ba669c0be974c54414bc32bb4692ee19419 | a4fcaa28f288ff495ac09c3f8070f019f4d3ba80 | /08-real_python_class/2017_02_07-Lesson_2/class_projects/flask-hello-world/app.py | 677ab29cfff2fc13b95ed5933c362409ba9a180e | [] | no_license | tomwhartung/always_learning_python | db44b0745f27f482e6482faa821f89dc7809dda8 | ab27c164a724754e3e25518bf372bd4437995d64 | refs/heads/master | 2020-12-07T15:57:04.184391 | 2017-05-18T19:35:31 | 2017-05-18T19:35:31 | 67,449,327 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 333 | py | ##
# Class project
#
from flask import Flask
app = Flask(__name__)
if __name__ == '___main__':
app.run(debug=True)
@app.route('/')
def index():
return 'Index Page'
#
# Variable Rules:
# ---------------
#
# Greet the user by name
#
@app.route('/name/<username>')
def greet_user(username):
return 'Hello %s!' % username
| [
"[email protected]"
] | |
4795fdd80d0a83f8095f553a54e9c04a2712f2f0 | 42064191a5ac586ed088b293165b51abf16b1ee4 | /Intro Machine Learning/Lesson 9/Min_Max_Rescale.py | 752e6692ff0556a1d34473a31fb6f4068011bca4 | [] | no_license | ObinnaObeleagu/Udacity | 637cd458824a835febacebd72ebef77b30ca7f94 | 761ba413934f66cbd9429fd9882f59f047eb065b | refs/heads/master | 2023-03-15T23:27:23.022463 | 2019-01-03T04:05:03 | 2019-01-03T04:05:03 | 497,375,575 | 1 | 0 | null | 2022-05-28T16:46:12 | 2022-05-28T16:46:12 | null | UTF-8 | Python | false | false | 618 | py | """ quiz materials for feature scaling clustering """
### FYI, the most straightforward implementation might
### throw a divide-by-zero error, if the min and max
### values are the same
### but think about this for a second--that means that every
### data point has the same value for that feature!
### why would you rescale it? Or even use it at all?
def featureScaling(arr):
if max(arr) == min(arr):
return arr
else:
return [(a - min(arr))*1.0/(max(arr)-min(arr)) for a in arr]
# tests of your feature scaler--line below is input data
data = [115, 140, 175]
print featureScaling(data)
| [
"[email protected]"
] | |
c75309b7bfbaa2e7f70f920f0c0c9a1fac74fe6b | 1bc7456240639a4fac54c411fbcb562cdbcc420c | /5483. Make The String Great.py | 7728ab54b08891d7f80b0856bb4def9591fe4547 | [] | no_license | Manash-git/CP-LeetCode-Solve | bdbb9f13946faee5da24e191a3d593b99da61ed2 | 45052c7613345c76f8a12bac780ffb899062dea9 | refs/heads/master | 2022-11-29T13:16:03.474242 | 2020-08-11T19:06:07 | 2020-08-11T19:06:07 | 275,853,956 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 433 | py | def makeGood(s):
bucket=[s[0]]
for i in s[1:]:
if bucket and i.lower()==bucket[-1] and i!=bucket[-1]:
bucket.pop()
elif bucket and i.upper()==bucket[-1]and i!=bucket [-1]:
bucket.pop()
else:
bucket.append(i)
print(bucket)
# print("".join(bucket))
return "".join(bucket)
print(makeGood("mannNasSh"))
lst= [1,5,3,7]
print(lst[-1])
| [
"[email protected]"
] | |
b18a75629c957d414f6969ff82875ae136371895 | 27ff7fec0ae3f29f58089a2acab0aa3bc4e6e1f7 | /Python_script/51zxw/unittest/testCase_combine.py | 377d5e839107ecaf2be9a6fe29db01308a7086b3 | [] | no_license | zhangsong1417/xx | 01435d6057364991b649c1acc00b36ab13debe5a | c40cfdede194daf3bdf91b36c1936150577128b9 | refs/heads/master | 2020-04-06T14:06:23.011363 | 2019-07-09T02:38:02 | 2019-07-09T02:38:02 | 157,528,207 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 455 | py | from calculator import *
import unittest
class Test_StartEnd(unittest.TestCase):
def setUp(self):
print("test start")
def tearDown(self):
print("test end")
class Testadd(Test_StartEnd):
def test_add(self):
j=Math(5,5)
self.assertEqual(j.add(),10)
class Testsub(Test_StartEnd):
def test_sub(self):
i=Math(10,5)
self.assertEqual(i.sub(),5)
if __name__=='__main__':
unittest.main() | [
"[email protected]"
] | |
4ee02bc666d3115bc00a27981934c752402097f7 | d78dfc5089717fc242bbd7097f507d811abb4260 | /USA/script.module.coveapi/lib/coveapi/__init__.py | 6190c730b35fd85b4204fbf8e5d11e8982f2c3a3 | [] | no_license | tustxk/AddOnRepo | 995b980a9ec737e2c25bed423fc83f710c697e40 | 6b86a06cb37e6e10b4119584dd7311ebc2318e54 | refs/heads/master | 2022-10-08T21:34:34.632346 | 2016-10-28T09:48:01 | 2016-10-28T09:48:01 | 70,684,775 | 1 | 1 | null | 2022-10-01T16:27:13 | 2016-10-12T09:31:16 | Python | UTF-8 | Python | false | false | 956 | py | """Package: `coveapi`
A Python client for the PBS COVE API service.
"""
# client version
__version__ = '0.2dev'
# coveapi constants
COVEAPI_VERSION = 'v1'
COVEAPI_HOST = 'http://api.pbs.org'
COVEAPI_ENDPOINT = '/cove/%s/' % COVEAPI_VERSION
COVEAPI_ENDPOINT_CATEGORIES = '%scategories/' % COVEAPI_ENDPOINT
COVEAPI_ENDPOINT_GROUPS = '%sgroups/' % COVEAPI_ENDPOINT
COVEAPI_ENDPOINT_PROGRAMS = '%sprograms/' % COVEAPI_ENDPOINT
COVEAPI_ENDPOINT_VIDEOS = '%svideos/' % COVEAPI_ENDPOINT
def connect(api_app_id, api_app_secret, api_host=COVEAPI_HOST):
"""Connect to the COVE API service.
Keyword arguments:
`api_app_id` -- your COVE API app id
`api_app_secret` -- your COVE API secret key
`api_host` -- host of COVE API (default: COVEAPI_HOST)
Returns:
`coveapi.connection.COVEAPIConnection` object
"""
from coveapi.connection import COVEAPIConnection
return COVEAPIConnection(api_app_id, api_app_secret, api_host) | [
"[email protected]"
] | |
241db9e295f1a41795f43fba433f42583b271f89 | 52d6e9fb7176bf819ae8460d0fd03368614ce075 | /datasource/PooledDataSource.py | 9f0bb94bdadf9e96e5bc94dc8d47f6f27f780427 | [
"BSD-2-Clause"
] | permissive | mattduan/proof | 076f23f20e28e6d59f091af11eb84cdd3e9f224d | 52241b68e7170c9c6fd245192b7be35be1cdc33f | refs/heads/master | 2021-01-13T01:44:22.937600 | 2013-03-17T16:19:32 | 2013-03-17T16:19:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,170 | py | """
A PooledDataSource object is a factory for PooledConnection objects.
"""
__version__='$Revision: 3194 $'[11:-2]
__author__ = "Duan Guoqiang ([email protected])"
import logging
import util.logger.Logger as Logger
import proof.ProofException as ProofException
class PooledDataSource:
__is__ = 'interface'
def __init__( self,
host,
username,
password,
dbname,
pool,
logger = None ):
""" Constructor.
"""
self.__logger = Logger.makeLogger(logger)
self.log = self.__logger.write
#==================== Interfaces ==========================
def getPooledConnection(self, **kwargs):
""" Establish a database connection and return it.
"""
raise ProofException.ProofNotImplementedException( \
"PooledDataSource.getPooledConnection: need to be overrided by db specific PooledDataSource." )
def getLogger(self):
return self.__logger
def setLogger(self, logger):
self.__logger = Logger.makeLogger(logger)
self.log = self.__logger.write
| [
"[email protected]"
] | |
1f5e57c17346b3f327473b6fcffe2c8ed909d888 | 5374bd9a9fc8cc07f6966c490a137003ddc64d9b | /VEnCode/scripts/dendrogram_encode.py | 44b445694b2ba41e172163ba360705fc56d94d73 | [
"BSD-3-Clause"
] | permissive | AndreMacedo88/VEnCode | 31f9f545019f62e0af716395a11961515c229394 | 667c777c6ef12c43e993660e5c695d4d6d43385e | refs/heads/master | 2021-01-06T03:55:44.385885 | 2020-11-24T18:05:38 | 2020-11-24T18:05:38 | 90,248,803 | 0 | 1 | NOASSERTION | 2020-02-04T22:29:39 | 2017-05-04T10:02:48 | Python | UTF-8 | Python | false | false | 1,974 | py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
dendrogram_encode.py: file used to generate hierarchical clustering and subsequent dendrograms from ENCODE DNase-seq
data
"""
import os
import pandas as pd
from scipy.cluster import hierarchy
import matplotlib.pyplot as plt
from VEnCode import common_variables as cv
DATA_TYPE = "enhancers"
encode_data_path = "D:/Utilizador HDD/OneDrive - Nova Medical School Faculdade de Ciências Médicas da UNL/" \
"1-Research/3-Vencode/Fantom5/Files/Validation_files/ENCODE/" \
"ENCODE DNase expression in FANTOM5 {}_merged.csv".format(DATA_TYPE)
encode_data = pd.read_csv(encode_data_path, sep=";", engine="python", index_col=0)
values = encode_data.T.values
index = encode_data.T.index
clustering = hierarchy.linkage(values, 'single')
plt.figure(figsize=(14, 14))
dn = hierarchy.dendrogram(clustering, labels=index, color_threshold=0, above_threshold_color='#333333',
leaf_rotation=0, orientation="left")
no_axes = False
no_border = True
ax = plt.gca()
if no_axes:
ax.axis('off')
else:
dflt_col = "#808080"
ylbls = ax.get_ymajorticklabels()
for lbl in ylbls:
lbl.set_color(dflt_col)
if no_border:
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
path = "D:/Utilizador HDD\OneDrive - Nova Medical School Faculdade de Ciências Médicas da UNL/1-Research/3-Vencode/" \
"Fantom5/Dendrograms/"
file_name = "dendro_encode_{}_noBorders.png".format(DATA_TYPE)
output_path = os.path.join(path, file_name)
plt.savefig(output_path, dpi=600, bbox_inches="tight", transparent=True)
retrieve_leaves = False
if retrieve_leaves:
leaves_list = dn["leaves"]
leaves_names = [index[x] for x in leaves_list]
with open("leaves.csv", "w") as f:
for item in leaves_names:
f.write("{}\n".format(item))
print(leaves_names)
| [
"[email protected]"
] | |
472278844e6c3e2bac6d02dd2d9ad2898ce53100 | 2ff83d7af0bcbc5822593d826b0c3276346d1276 | /transformers_local_rep/src/transformers/models/ctrl/modeling_ctrl.py | 8b6335d313600a9486f7efaad718f8dcfb7c124e | [] | no_license | mauricerupp/PolitBERT | 43af66f5562bb5c5cf965aa99bb065d1c22f4fae | a8c4eb517eb38cb51101fc87780ed1de182560c8 | refs/heads/master | 2023-06-17T03:13:43.070682 | 2021-07-15T15:15:30 | 2021-07-15T15:15:30 | 386,334,080 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 28,939 | py | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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.
""" PyTorch CTRL model."""
from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutput
from ...modeling_utils import Conv1D, PreTrainedModel, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils import logging
from .configuration_ctrl import CTRLConfig
logger = logging.get_logger(__name__)
_CONFIG_FOR_DOC = "CTRLConfig"
_TOKENIZER_FOR_DOC = "CTRLTokenizer"
CTRL_PRETRAINED_MODEL_ARCHIVE_LIST = [
"ctrl"
# See all CTRL models at https://huggingface.co/models?filter=ctrl
]
def angle_defn(pos, i, d_model_size):
angle_rates = 1 / torch.pow(10000, (2 * (i // 2)) / d_model_size)
return pos * angle_rates
def positional_encoding(position, d_model_size, dtype):
# create the sinusoidal pattern for the positional encoding
angle_rads = angle_defn(
torch.arange(position, dtype=dtype).unsqueeze(1),
torch.arange(d_model_size, dtype=dtype).unsqueeze(0),
d_model_size,
)
sines = torch.sin(angle_rads[:, 0::2])
cosines = torch.cos(angle_rads[:, 1::2])
pos_encoding = torch.cat([sines, cosines], dim=-1)
return pos_encoding
def scaled_dot_product_attention(q, k, v, mask, attention_mask=None, head_mask=None):
# calculate attention
matmul_qk = torch.matmul(q, k.permute(0, 1, 3, 2))
dk = k.shape[-1]
scaled_attention_logits = matmul_qk / np.sqrt(dk)
if mask is not None:
nd, ns = scaled_attention_logits.size(-2), scaled_attention_logits.size(-1)
scaled_attention_logits += mask[ns - nd : ns, :ns] * -1e4
if attention_mask is not None:
# Apply the attention mask
scaled_attention_logits = scaled_attention_logits + attention_mask
attention_weights = torch.softmax(scaled_attention_logits, dim=-1)
# Mask heads if we want to
if head_mask is not None:
attention_weights = attention_weights * head_mask
output = torch.matmul(attention_weights, v)
return output, attention_weights
class MultiHeadAttention(torch.nn.Module):
def __init__(self, d_model_size, num_heads):
super().__init__()
self.num_heads = num_heads
self.d_model_size = d_model_size
self.depth = int(d_model_size / self.num_heads)
self.Wq = torch.nn.Linear(d_model_size, d_model_size)
self.Wk = torch.nn.Linear(d_model_size, d_model_size)
self.Wv = torch.nn.Linear(d_model_size, d_model_size)
self.dense = torch.nn.Linear(d_model_size, d_model_size)
self.pruned_heads = set()
def prune_heads(self, heads):
attention_head_size = self.d_model_size // self.num_heads
if len(heads) == 0:
return
heads, index = find_pruneable_heads_and_indices(heads, self.num_heads, attention_head_size, self.pruned_heads)
# Prune linear layers
self.Wq = prune_linear_layer(self.Wq, index)
self.Wk = prune_linear_layer(self.Wk, index)
self.Wv = prune_linear_layer(self.Wv, index)
self.dense = prune_linear_layer(self.dense, index, dim=1)
# Update hyper params
self.num_heads = self.num_heads - len(heads)
self.d_model_size = attention_head_size * self.num_heads
self.pruned_heads = self.pruned_heads.union(heads)
def split_into_heads(self, x, batch_size):
x = x.reshape(batch_size, -1, self.num_heads, self.depth)
return x.permute([0, 2, 1, 3])
def forward(
self,
v,
k,
q,
mask,
layer_past=None,
attention_mask=None,
head_mask=None,
use_cache=False,
output_attentions=False,
):
batch_size = q.shape[0]
q = self.Wq(q)
k = self.Wk(k)
v = self.Wv(v)
q = self.split_into_heads(q, batch_size)
k = self.split_into_heads(k, batch_size)
v = self.split_into_heads(v, batch_size)
if layer_past is not None:
past_key, past_value = layer_past[0], layer_past[1]
k = torch.cat((past_key, k), dim=-2)
v = torch.cat((past_value, v), dim=-2)
if use_cache is True:
present = torch.stack((k, v))
else:
present = (None,)
output = scaled_dot_product_attention(q, k, v, mask, attention_mask, head_mask)
scaled_attention = output[0].permute([0, 2, 1, 3])
attn = output[1]
original_size_attention = scaled_attention.reshape(batch_size, -1, self.d_model_size)
output = self.dense(original_size_attention)
outputs = (output, present)
if output_attentions:
outputs = outputs + (attn,)
return outputs
def point_wise_feed_forward_network(d_model_size, dff):
return torch.nn.Sequential(torch.nn.Linear(d_model_size, dff), torch.nn.ReLU(), torch.nn.Linear(dff, d_model_size))
class EncoderLayer(torch.nn.Module):
def __init__(self, d_model_size, num_heads, dff, rate=0.1):
super().__init__()
self.multi_head_attention = MultiHeadAttention(d_model_size, num_heads)
self.ffn = point_wise_feed_forward_network(d_model_size, dff)
self.layernorm1 = torch.nn.LayerNorm(d_model_size, eps=1e-6)
self.layernorm2 = torch.nn.LayerNorm(d_model_size, eps=1e-6)
self.dropout1 = torch.nn.Dropout(rate)
self.dropout2 = torch.nn.Dropout(rate)
def forward(
self, x, mask, layer_past=None, attention_mask=None, head_mask=None, use_cache=False, output_attentions=False
):
normed = self.layernorm1(x)
attn_outputs = self.multi_head_attention(
normed,
normed,
normed,
mask,
layer_past=layer_past,
attention_mask=attention_mask,
head_mask=head_mask,
use_cache=use_cache,
output_attentions=output_attentions,
)
attn_output = attn_outputs[0]
attn_output = self.dropout1(attn_output)
out1 = x + attn_output
out2 = self.layernorm2(out1)
ffn_output = self.ffn(out2)
ffn_output = self.dropout2(ffn_output)
out2 = out1 + ffn_output
outputs = (out2,) + attn_outputs[1:]
return outputs
class CTRLPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = CTRLConfig
base_model_prefix = "transformer"
def _init_weights(self, module):
"""Initialize the weights."""
if isinstance(module, (nn.Linear, nn.Embedding, Conv1D)):
# Slightly different from the TF version which uses truncated_normal for initialization
# cf https://github.com/pytorch/pytorch/pull/5617
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
if isinstance(module, (nn.Linear, Conv1D)) and module.bias is not None:
module.bias.data.zero_()
elif isinstance(module, nn.LayerNorm):
module.bias.data.zero_()
module.weight.data.fill_(1.0)
CTRL_START_DOCSTRING = r"""
This model inherits from :class:`~transformers_local.PreTrainedModel`. Check the superclass documentation for the generic
methods the library implements for all its model (such as downloading or saving, resizing the input embeddings,
pruning heads etc.)
This model is also a PyTorch `torch.nn.Module <https://pytorch.org/docs/stable/nn.html#torch.nn.Module>`__
subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to
general usage and behavior.
Parameters:
config (:class:`~transformers_local.CTRLConfig`): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the :meth:`~transformers_local.PreTrainedModel.from_pretrained` method to load the model
weights.
"""
CTRL_INPUTS_DOCSTRING = r"""
Args:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
:obj:`input_ids_length` = ``sequence_length`` if :obj:`past_key_values` is ``None`` else
``past_key_values[0].shape[-2]`` (``sequence_length`` of input past key value states). Indices of input
sequence tokens in the vocabulary.
If :obj:`past_key_values` is used, only input IDs that do not have their past calculated should be passed
as ``input_ids``.
Indices can be obtained using :class:`~transformers_local.CTRLTokenizer`. See
:meth:`transformers_local.PreTrainedTokenizer.__call__` and :meth:`transformers_local.PreTrainedTokenizer.encode` for
details.
`What are input IDs? <../glossary.html#input-ids>`__
past_key_values (:obj:`Tuple[Tuple[torch.FloatTensor]]` of length :obj:`config.n_layers`):
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
:obj:`past_key_values` output below). Can be used to speed up sequential decoding. The ``input_ids`` which
have their past given to this model should not be passed as input ids as they have already been computed.
attention_mask (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Mask to avoid performing attention on padding token indices. Mask values selected in ``[0, 1]``:
- 1 for tokens that are **not masked**,
- 0 for tokens that are **masked**.
`What are attention masks? <../glossary.html#attention-mask>`__
token_type_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Segment token indices to indicate first and second portions of the inputs. Indices are selected in ``[0,
1]``:
- 0 corresponds to a `sentence A` token,
- 1 corresponds to a `sentence B` token.
`What are token type IDs? <../glossary.html#token-type-ids>`_
position_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range ``[0,
config.max_position_embeddings - 1]``.
`What are position IDs? <../glossary.html#position-ids>`_
head_mask (:obj:`torch.FloatTensor` of shape :obj:`(num_heads,)` or :obj:`(num_layers, num_heads)`, `optional`):
Mask to nullify selected heads of the self-attention modules. Mask values selected in ``[0, 1]``:
- 1 indicates the head is **not masked**,
- 0 indicates the head is **masked**.
inputs_embeds (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`, `optional`):
Optionally, instead of passing :obj:`input_ids` you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert :obj:`input_ids` indices into associated
vectors than the model's internal embedding lookup matrix.
use_cache (:obj:`bool`, `optional`):
If set to :obj:`True`, :obj:`past_key_values` key value states are returned and can be used to speed up
decoding (see :obj:`past_key_values`).
output_attentions (:obj:`bool`, `optional`):
Whether or not to return the attentions tensors of all attention layers. See ``attentions`` under returned
tensors for more detail.
output_hidden_states (:obj:`bool`, `optional`):
Whether or not to return the hidden states of all layers. See ``hidden_states`` under returned tensors for
more detail.
return_dict (:obj:`bool`, `optional`):
Whether or not to return a :class:`~transformers_local.file_utils.ModelOutput` instead of a plain tuple.
"""
@add_start_docstrings(
"The bare CTRL Model transformer outputting raw hidden-states without any specific head on top.",
CTRL_START_DOCSTRING,
)
class CTRLModel(CTRLPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.d_model_size = config.n_embd
self.num_layers = config.n_layer
self.pos_encoding = positional_encoding(config.n_positions, self.d_model_size, torch.float)
self.w = nn.Embedding(config.vocab_size, config.n_embd)
self.dropout = nn.Dropout(config.embd_pdrop)
self.h = nn.ModuleList(
[EncoderLayer(config.n_embd, config.n_head, config.dff, config.resid_pdrop) for _ in range(config.n_layer)]
)
self.layernorm = nn.LayerNorm(config.n_embd, eps=config.layer_norm_epsilon)
self.init_weights()
def get_input_embeddings(self):
return self.w
def set_input_embeddings(self, new_embeddings):
self.w = new_embeddings
def _prune_heads(self, heads_to_prune):
"""
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
"""
for layer, heads in heads_to_prune.items():
self.h[layer].multi_head_attention.prune_heads(heads)
@add_start_docstrings_to_model_forward(CTRL_INPUTS_DOCSTRING)
@add_code_sample_docstrings(
tokenizer_class=_TOKENIZER_FOR_DOC,
checkpoint="ctrl",
output_type=BaseModelOutputWithPast,
config_class=_CONFIG_FOR_DOC,
)
def forward(
self,
input_ids=None,
past_key_values=None,
attention_mask=None,
token_type_ids=None,
position_ids=None,
head_mask=None,
inputs_embeds=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
use_cache = use_cache if use_cache is not None else self.config.use_cache
output_hidden_states = (
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
)
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
if input_ids is not None and inputs_embeds is not None:
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
elif input_ids is not None:
input_shape = input_ids.size()
input_ids = input_ids.view(-1, input_shape[-1])
batch_size = input_ids.shape[0]
elif inputs_embeds is not None:
input_shape = inputs_embeds.size()[:-1]
batch_size = inputs_embeds.shape[0]
else:
raise ValueError("You have to specify either input_ids or inputs_embeds")
if past_key_values is None:
past_length = 0
past_key_values = tuple([None] * len(self.h))
else:
past_length = past_key_values[0][0].size(-2)
if position_ids is None:
device = input_ids.device if input_ids is not None else inputs_embeds.device
position_ids = torch.arange(past_length, input_shape[-1] + past_length, dtype=torch.long, device=device)
position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
# Attention mask.
if attention_mask is not None:
assert batch_size > 0, "batch_size has to be defined and > 0"
attention_mask = attention_mask.view(batch_size, -1)
# We create a 3D attention mask from a 2D tensor mask.
# Sizes are [batch_size, 1, 1, to_seq_length]
# So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length]
# this attention mask is more simple than the triangular masking of causal attention
# used in OpenAI GPT, we just need to prepare the broadcast dimension here.
attention_mask = attention_mask.unsqueeze(1).unsqueeze(2)
# Since attention_mask is 1.0 for positions we want to attend and 0.0 for
# masked positions, this operation will create a tensor which is 0.0 for
# positions we want to attend and -10000.0 for masked positions.
# Since we are adding it to the raw scores before the softmax, this is
# effectively the same as removing these entirely.
attention_mask = attention_mask.to(dtype=self.dtype) # fp16 compatibility
attention_mask = (1.0 - attention_mask) * -10000.0
# Prepare head mask if needed
head_mask = self.get_head_mask(head_mask, self.config.n_layer)
if token_type_ids is not None:
token_type_ids = token_type_ids.view(-1, input_shape[-1])
token_type_embeds = self.w(token_type_ids)
token_type_embeds *= np.sqrt(self.d_model_size)
else:
token_type_embeds = 0
position_ids = position_ids.view(-1, input_shape[-1])
if inputs_embeds is None:
inputs_embeds = self.w(input_ids)
# inputs_embeds = embedded.unsqueeze(0) if len(input_ids.shape)<2 else embedded
seq_len = input_shape[-1]
mask = torch.triu(torch.ones(seq_len + past_length, seq_len + past_length), 1).to(inputs_embeds.device)
inputs_embeds *= np.sqrt(self.d_model_size)
pos_embeds = self.pos_encoding[position_ids, :].to(inputs_embeds.device)
hidden_states = inputs_embeds + pos_embeds + token_type_embeds
hidden_states = self.dropout(hidden_states)
presents = () if use_cache else None
all_hidden_states = () if output_hidden_states else None
all_attentions = () if output_attentions else None
for i, (h, layer_past) in enumerate(zip(self.h, past_key_values)):
if output_hidden_states:
all_hidden_states = all_hidden_states + (hidden_states,)
outputs = h(
hidden_states,
mask,
layer_past=layer_past,
attention_mask=attention_mask,
head_mask=head_mask[i],
use_cache=use_cache,
output_attentions=output_attentions,
)
hidden_states, present = outputs[:2]
if use_cache is True:
presents = presents + (present,)
if output_attentions:
all_attentions += (outputs[2],)
hidden_states = self.layernorm(hidden_states)
if output_hidden_states:
all_hidden_states = all_hidden_states + (hidden_states,)
if not return_dict:
return tuple(v for v in [hidden_states, presents, all_hidden_states, all_attentions] if v is not None)
return BaseModelOutputWithPast(
last_hidden_state=hidden_states,
past_key_values=presents,
hidden_states=all_hidden_states,
attentions=all_attentions,
)
@add_start_docstrings(
"""
The CTRL Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).
""",
CTRL_START_DOCSTRING,
)
class CTRLLMHeadModel(CTRLPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.transformer = CTRLModel(config)
self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=True)
self.init_weights()
def get_output_embeddings(self):
return self.lm_head
def set_output_embeddings(self, new_embeddings):
self.lm_head = new_embeddings
def prepare_inputs_for_generation(self, input_ids, past=None, use_cache=None, **kwargs):
# only last token for inputs_ids if past is defined in kwargs
if past:
input_ids = input_ids[:, -1].unsqueeze(-1)
return {"input_ids": input_ids, "past_key_values": past, "use_cache": use_cache}
@add_start_docstrings_to_model_forward(CTRL_INPUTS_DOCSTRING)
@add_code_sample_docstrings(
tokenizer_class=_TOKENIZER_FOR_DOC,
checkpoint="ctrl",
output_type=CausalLMOutputWithPast,
config_class=_CONFIG_FOR_DOC,
)
def forward(
self,
input_ids=None,
past_key_values=None,
attention_mask=None,
token_type_ids=None,
position_ids=None,
head_mask=None,
inputs_embeds=None,
labels=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
r"""
labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
``labels = input_ids`` Indices are selected in ``[-100, 0, ..., config.vocab_size]`` All labels set to
``-100`` are ignored (masked), the loss is only computed for labels in ``[0, ..., config.vocab_size]``
"""
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
transformer_outputs = self.transformer(
input_ids,
past_key_values=past_key_values,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
position_ids=position_ids,
head_mask=head_mask,
inputs_embeds=inputs_embeds,
use_cache=use_cache,
output_attentions=output_attentions,
output_hidden_states=output_hidden_states,
return_dict=return_dict,
)
hidden_states = transformer_outputs[0]
lm_logits = self.lm_head(hidden_states)
loss = None
if labels is not None:
# Shift so that tokens < n predict n
shift_logits = lm_logits[..., :-1, :].contiguous()
shift_labels = labels[..., 1:].contiguous()
# Flatten the tokens
loss_fct = CrossEntropyLoss()
loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
if not return_dict:
output = (lm_logits,) + transformer_outputs[1:]
return ((loss,) + output) if loss is not None else output
return CausalLMOutputWithPast(
loss=loss,
logits=lm_logits,
past_key_values=transformer_outputs.past_key_values,
hidden_states=transformer_outputs.hidden_states,
attentions=transformer_outputs.attentions,
)
@staticmethod
def _reorder_cache(past: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor) -> Tuple[Tuple[torch.Tensor]]:
"""
This function is used to re-order the :obj:`past_key_values` cache if
:meth:`~transformers_local.PretrainedModel.beam_search` or :meth:`~transformers_local.PretrainedModel.beam_sample` is
called. This is required to match :obj:`past_key_values` with the correct beam_idx at every generation step.
"""
return tuple(
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past)
for layer_past in past
)
@add_start_docstrings(
"""
The CTRL Model transformer with a sequence classification head on top (linear layer).
:class:`~transformers_local.CTRLForSequenceClassification` uses the last token in order to do the classification, as
other causal models (e.g. GPT-2) do. Since it does classification on the last token, it requires to know the
position of the last token. If a :obj:`pad_token_id` is defined in the configuration, it finds the last token that
is not a padding token in each row. If no :obj:`pad_token_id` is defined, it simply takes the last value in each
row of the batch. Since it cannot guess the padding tokens when :obj:`inputs_embeds` are passed instead of
:obj:`input_ids`, it does the same (take the last value in each row of the batch).
""",
CTRL_START_DOCSTRING,
)
class CTRLForSequenceClassification(CTRLPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.num_labels = config.num_labels
self.transformer = CTRLModel(config)
self.classifier = nn.Linear(config.n_embd, self.num_labels, bias=False)
self.init_weights()
@add_start_docstrings_to_model_forward(CTRL_INPUTS_DOCSTRING)
@add_code_sample_docstrings(
tokenizer_class=_TOKENIZER_FOR_DOC,
checkpoint="ctrl",
output_type=SequenceClassifierOutput,
config_class=_CONFIG_FOR_DOC,
)
def forward(
self,
input_ids=None,
past_key_values=None,
attention_mask=None,
token_type_ids=None,
position_ids=None,
head_mask=None,
inputs_embeds=None,
labels=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
r"""
labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size,)`, `optional`):
Labels for computing the sequence classification/regression loss. Indices should be in :obj:`[0, ...,
config.num_labels - 1]`. If :obj:`config.num_labels == 1` a regression loss is computed (Mean-Square loss),
If :obj:`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
"""
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
transformer_outputs = self.transformer(
input_ids,
past_key_values=past_key_values,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
position_ids=position_ids,
head_mask=head_mask,
inputs_embeds=inputs_embeds,
use_cache=use_cache,
output_attentions=output_attentions,
output_hidden_states=output_hidden_states,
return_dict=return_dict,
)
hidden_states = transformer_outputs[0]
logits = self.classifier(hidden_states)
if input_ids is not None:
batch_size, sequence_length = input_ids.shape[:2]
else:
batch_size, sequence_length = inputs_embeds.shape[:2]
assert (
self.config.pad_token_id is not None or batch_size == 1
), "Cannot handle batch sizes > 1 if no padding token is defined."
if self.config.pad_token_id is None:
sequence_lengths = -1
else:
if input_ids is not None:
sequence_lengths = torch.ne(input_ids, self.config.pad_token_id).sum(-1) - 1
else:
sequence_lengths = -1
logger.warning(
f"{self.__class__.__name__} will not detect padding tokens in `inputs_embeds`. Results may be "
f"unexpected if using padding tokens in conjuction with `inputs_embeds.`"
)
pooled_logits = logits[range(batch_size), sequence_lengths]
loss = None
if labels is not None:
if self.num_labels == 1:
# We are doing regression
loss_fct = MSELoss()
loss = loss_fct(pooled_logits.view(-1), labels.to(self.dtype).view(-1))
else:
loss_fct = CrossEntropyLoss()
loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
if not return_dict:
output = (pooled_logits,) + transformer_outputs[2:]
return ((loss,) + output) if loss is not None else output
return SequenceClassifierOutput(
loss=loss,
logits=pooled_logits,
hidden_states=transformer_outputs.hidden_states,
attentions=transformer_outputs.attentions,
)
| [
"[email protected]"
] | |
cce211ae190377155ad44f981d6ad1c61c5091ab | 1c6283303ceb883add8de4ee07c5ffcfc2e93fab | /Jinja2/lib/python3.7/site-packages/ixnetwork_restpy/testplatform/sessions/ixnetwork/impairment/profile/accumulateandburst/accumulateandburst.py | 59dc4f52ccd1cef9b005cc09fb573e7ebdeff7b1 | [] | no_license | pdobrinskiy/devcore | 0f5b3dfc2f3bf1e44abd716f008a01c443e14f18 | 580c7df6f5db8c118990cf01bc2b986285b9718b | refs/heads/main | 2023-07-29T20:28:49.035475 | 2021-09-14T10:02:16 | 2021-09-14T10:02:16 | 405,919,390 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 10,247 | py | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
from typing import List, Any, Union
class AccumulateAndBurst(Base):
"""Accumulates packets in a queue and transmit groups of packets as a burst. It can only be used on a profile if delayVariation and customDelayVariation are disabled.
The AccumulateAndBurst class encapsulates a required accumulateAndBurst resource which will be retrieved from the server every time the property is accessed.
"""
__slots__ = ()
_SDM_NAME = 'accumulateAndBurst'
_SDM_ATT_MAP = {
'BurstSize': 'burstSize',
'BurstSizeUnit': 'burstSizeUnit',
'BurstTimeout': 'burstTimeout',
'BurstTimeoutUnit': 'burstTimeoutUnit',
'Enabled': 'enabled',
'InterBurstGap': 'interBurstGap',
'InterBurstGapValue': 'interBurstGapValue',
'InterBurstGapValueUnit': 'interBurstGapValueUnit',
'PacketCount': 'packetCount',
'QueueAutoSize': 'queueAutoSize',
'QueueAutoSizeEnabled': 'queueAutoSizeEnabled',
'QueueSize': 'queueSize',
}
_SDM_ENUM_MAP = {
'burstSizeUnit': ['kilobytes', 'kKilobytes', 'kMegabytes', 'megabytes'],
'burstTimeoutUnit': ['kMilliseconds', 'kSeconds', 'kTimeFormat', 'milliseconds', 'seconds', 'timeFormat'],
'interBurstGap': ['headToHead', 'kHeadToHead', 'kTailToHead', 'tailToHead'],
'interBurstGapValueUnit': ['kMilliseconds', 'kSeconds', 'milliseconds', 'seconds'],
}
def __init__(self, parent, list_op=False):
super(AccumulateAndBurst, self).__init__(parent, list_op)
@property
def BurstSize(self):
# type: () -> int
"""
Returns
-------
- number: Represents the burst octet size. The default value is 1014.
"""
return self._get_attribute(self._SDM_ATT_MAP['BurstSize'])
@BurstSize.setter
def BurstSize(self, value):
# type: (int) -> None
self._set_attribute(self._SDM_ATT_MAP['BurstSize'], value)
@property
def BurstSizeUnit(self):
# type: () -> str
"""
Returns
-------
- str(kilobytes | kKilobytes | kMegabytes | megabytes): The burst size unit is either megabytes or kilobytes. The default unit is kilobytes.
"""
return self._get_attribute(self._SDM_ATT_MAP['BurstSizeUnit'])
@BurstSizeUnit.setter
def BurstSizeUnit(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP['BurstSizeUnit'], value)
@property
def BurstTimeout(self):
# type: () -> str
"""
Returns
-------
- str: The burst timeout.The default value is 5 seconds.
"""
return self._get_attribute(self._SDM_ATT_MAP['BurstTimeout'])
@BurstTimeout.setter
def BurstTimeout(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP['BurstTimeout'], value)
@property
def BurstTimeoutUnit(self):
# type: () -> str
"""
Returns
-------
- str(kMilliseconds | kSeconds | kTimeFormat | milliseconds | seconds | timeFormat): Seconds(default) / milliseconds / mm:ss.fff time format.
"""
return self._get_attribute(self._SDM_ATT_MAP['BurstTimeoutUnit'])
@BurstTimeoutUnit.setter
def BurstTimeoutUnit(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP['BurstTimeoutUnit'], value)
@property
def Enabled(self):
# type: () -> bool
"""
Returns
-------
- bool: If true, received packets are queued and transmitted in bursts.
"""
return self._get_attribute(self._SDM_ATT_MAP['Enabled'])
@Enabled.setter
def Enabled(self, value):
# type: (bool) -> None
self._set_attribute(self._SDM_ATT_MAP['Enabled'], value)
@property
def InterBurstGap(self):
# type: () -> str
"""
Returns
-------
- str(headToHead | kHeadToHead | kTailToHead | tailToHead): Tail to head (default) / Head to head.
"""
return self._get_attribute(self._SDM_ATT_MAP['InterBurstGap'])
@InterBurstGap.setter
def InterBurstGap(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP['InterBurstGap'], value)
@property
def InterBurstGapValue(self):
# type: () -> int
"""
Returns
-------
- number: The InterBurst gap value. The default value is 20 ms.
"""
return self._get_attribute(self._SDM_ATT_MAP['InterBurstGapValue'])
@InterBurstGapValue.setter
def InterBurstGapValue(self, value):
# type: (int) -> None
self._set_attribute(self._SDM_ATT_MAP['InterBurstGapValue'], value)
@property
def InterBurstGapValueUnit(self):
# type: () -> str
"""
Returns
-------
- str(kMilliseconds | kSeconds | milliseconds | seconds): Seconds / milliseconds (default).
"""
return self._get_attribute(self._SDM_ATT_MAP['InterBurstGapValueUnit'])
@InterBurstGapValueUnit.setter
def InterBurstGapValueUnit(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP['InterBurstGapValueUnit'], value)
@property
def PacketCount(self):
# type: () -> int
"""
Returns
-------
- number: Represents the burst packet count. The default value is 1000 packets.
"""
return self._get_attribute(self._SDM_ATT_MAP['PacketCount'])
@PacketCount.setter
def PacketCount(self, value):
# type: (int) -> None
self._set_attribute(self._SDM_ATT_MAP['PacketCount'], value)
@property
def QueueAutoSize(self):
# type: () -> int
"""
Returns
-------
- number: Gets the automatically calculated queue size when queueAutoSizeEnable is true or zero when queueAutoSizeEnable is false.
"""
return self._get_attribute(self._SDM_ATT_MAP['QueueAutoSize'])
@property
def QueueAutoSizeEnabled(self):
# type: () -> bool
"""
Returns
-------
- bool: Automatically calculate queue size. The default value is true.
"""
return self._get_attribute(self._SDM_ATT_MAP['QueueAutoSizeEnabled'])
@QueueAutoSizeEnabled.setter
def QueueAutoSizeEnabled(self, value):
# type: (bool) -> None
self._set_attribute(self._SDM_ATT_MAP['QueueAutoSizeEnabled'], value)
@property
def QueueSize(self):
# type: () -> int
"""
Returns
-------
- number: The accumulate-and-burst queue size expressed in MB. The default value is 1.
"""
return self._get_attribute(self._SDM_ATT_MAP['QueueSize'])
@QueueSize.setter
def QueueSize(self, value):
# type: (int) -> None
self._set_attribute(self._SDM_ATT_MAP['QueueSize'], value)
def update(self, BurstSize=None, BurstSizeUnit=None, BurstTimeout=None, BurstTimeoutUnit=None, Enabled=None, InterBurstGap=None, InterBurstGapValue=None, InterBurstGapValueUnit=None, PacketCount=None, QueueAutoSizeEnabled=None, QueueSize=None):
# type: (int, str, str, str, bool, str, int, str, int, bool, int) -> AccumulateAndBurst
"""Updates accumulateAndBurst resource on the server.
Args
----
- BurstSize (number): Represents the burst octet size. The default value is 1014.
- BurstSizeUnit (str(kilobytes | kKilobytes | kMegabytes | megabytes)): The burst size unit is either megabytes or kilobytes. The default unit is kilobytes.
- BurstTimeout (str): The burst timeout.The default value is 5 seconds.
- BurstTimeoutUnit (str(kMilliseconds | kSeconds | kTimeFormat | milliseconds | seconds | timeFormat)): Seconds(default) / milliseconds / mm:ss.fff time format.
- Enabled (bool): If true, received packets are queued and transmitted in bursts.
- InterBurstGap (str(headToHead | kHeadToHead | kTailToHead | tailToHead)): Tail to head (default) / Head to head.
- InterBurstGapValue (number): The InterBurst gap value. The default value is 20 ms.
- InterBurstGapValueUnit (str(kMilliseconds | kSeconds | milliseconds | seconds)): Seconds / milliseconds (default).
- PacketCount (number): Represents the burst packet count. The default value is 1000 packets.
- QueueAutoSizeEnabled (bool): Automatically calculate queue size. The default value is true.
- QueueSize (number): The accumulate-and-burst queue size expressed in MB. The default value is 1.
Raises
------
- ServerError: The server has encountered an uncategorized error condition
"""
return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))
| [
"[email protected]"
] | |
39959cff761869bff2825119c1eb9906bd45241b | 2f882f68806faf88e549a941e4d13833d9aa95df | /杨辉三角.py | b3f9f09a01baaa435f4f241a8ce69fa574e91c69 | [] | no_license | SmallPotY/leetcode_Python | 5ac8420cdcb677a679a32fd6f5fce82411d813cd | 0a2483195004c4d18237920b2f38b942e26b181b | refs/heads/master | 2020-03-20T13:24:00.612054 | 2019-07-18T09:14:45 | 2019-07-18T09:14:45 | 137,454,639 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 998 | py | """
给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。
在杨辉三角中,每个数是它左上方和右上方的数的和。
示例:
输入: 5
输出:
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
"""
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
yhsj = [[1],[1,1]]
if numRows:
if numRows == 1:
return [[1]]
elif numRows == 2:
return yhsj
else:
for i in range(3,numRows+1):
klb = [1,]
k =0
for j in range(1, i-1):
a = yhsj[i-2][k]
b = yhsj[i-2][k+1]
k = k+1
klb.append(a+b)
klb.append(1)
yhsj.append(klb)
return yhsj
else:
return [] | [
"[email protected]"
] | |
246d33ab6acf6da45a7e5b84745b5ad00b797c72 | da29f1f5b4459fbfec968bb694bedb9586f87b14 | /new_algs/Graph+algorithms/Dijkstra's+algorithm/processMaze.py | c9dd36c61be3664b0529b1016b3c77f224bb4b30 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | coolsnake/JupyterNotebook | 547806a45a663f090f313dc3e70f779ad9b213c0 | 20d8df6172906337f81583dabb841d66b8f31857 | refs/heads/master | 2023-01-13T18:55:38.615312 | 2020-11-17T22:55:12 | 2020-11-17T22:55:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,604 | py | import os
from PIL import Image
from helpers import cropBorder, replace_print
class Maze(object):
# Start of Node Class #
class Node(object):
def __init__(self, x_pos, y_pos, surroundings=None, start=False, end=False):
self.name = 'node_%s_%s' % (x_pos, y_pos)
self.x_pos, self.y_pos = (x_pos, y_pos)
self.surroundings = surroundings
self.start = start
self.end = end
self._adjacent_nodes = {}
self._prev_node = None
@property
def adjacent_nodes(self):
"""Adjacent Node Property"""
return self._adjacent_nodes
def set_adjacent_nodes(self, key, value):
"""Sets adjacent node"""
self._adjacent_nodes[key] = value
@property
def prev_node(self):
"""Previous Node Property"""
return self._prev_node
def set_prev_node(self, value):
"""Set Previous node"""
self._prev_node = value
@property
def prettify(self):
return 'Node at ({}, {})'.format(self.x_pos, self.y_pos)
# End of Node Class #
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
start_node = None
end_node = None
def __init__(self, filename, to_crop=False):
print ('---------------')
print ('Processing Maze')
print ('---------------\n')
self.maze = cropBorder(Image.open(filename)) if to_crop else Image.open(filename)
self.height, self.width = self.maze.size
self.node_dict = self.find_nodes()
self.make_graph()
print ('---------------')
print ('Solving Maze')
print ('---------------\n')
def get_surroundings(self, x_pos, y_pos):
"""Gets the values of up,down,left,right at given coords."""
# The x,y coordinates of a given pixel's surorundings at x_pos and y_pos
up = (x_pos, y_pos - 1) if y_pos - 1 >= 0 else False
down = (x_pos, y_pos + 1) if y_pos + 1 < self.height else False
left = (x_pos - 1, y_pos) if x_pos - 1 >= 0 else False
right = (x_pos + 1, y_pos) if x_pos + 1 < self.width else False
surroundings = {
'up': up,
'down': down,
'left': left,
'right': right
}
for direction in surroundings:
if surroundings[direction]:
pix = self.maze.getpixel(surroundings[direction])
if not self.check_black(pix):
surroundings[direction] = True
else:
surroundings[direction] = False
return surroundings
def move_horizontally(self, y):
"""Moves horizontally along y until it finds a white square, return the x,y positions"""
x_y_pairs = []
for x in xrange(self.width):
pix = self.maze.getpixel((x,y))
if self.check_white(pix):
x_y_pairs.append((x, y))
return x_y_pairs
def move_vertically(self, x):
"""Moves vertically along x until it finds a white square, return the x,y positions"""
x_y_pairs = []
for y in xrange(self.height - 1):
pix = self.maze.getpixel((x,y))
if self.check_white(pix):
x_y_pairs.append((x, y))
return x_y_pairs
def make_start_end_node(self):
"""Takes the x and y coords of the start node and makes it the start node"""
is_start = True
is_end = False
node_dict = {}
# Get x, y coords of start and end nodes
x_y_pairs = self.move_horizontally(0)
x_y_pairs += self.move_horizontally(self.height-1)
x_y_pairs += self.move_vertically(0)
x_y_pairs += self.move_vertically(self.width - 1)
for x_y in x_y_pairs:
x, y = x_y[0], x_y[1]
node_name = 'node_%s_%s' % (x,y)
node_dict[node_name] = self.Node(x, y, surroundings=self.get_surroundings(x, y), start=is_start, end=is_end)
if is_start:
self.start_node = node_name
print ('Found Start Node: {}'.format(node_dict[node_name].prettify))
if is_end:
self.end_node = node_name
print ('Found End Node: {}'.format(node_dict[node_name].prettify), '\n')
is_start = False
is_end = True
return node_dict
def find_nodes(self):
"""Finds and returns nodes in a maze"""
print ('Finding nodes...')
maze_copy = self.maze.copy()
node_dict = self.make_start_end_node()
for key, node in node_dict.items():
maze_copy.putpixel((node.x_pos, node.y_pos), self.RED)
found_nodes = 2
number_of_nodes = 2
# Get the rest of the nodes
for y in xrange(1, self.height - 1):
for x in xrange(1, self.width):
pix = self.maze.getpixel((x,y))
if self.check_white(pix):
isNode = True
directions = self.get_surroundings(x,y)
up_and_down = directions['up'] and directions['down']
up_or_down = directions['up'] or directions['down']
left_and_right = directions['left'] and directions['right']
left_or_right = directions['left'] or directions['right']
# Rules for a node (a node is where you can / must change direction while following a path)
if up_and_down and not left_or_right:
isNode = False
elif left_and_right and not up_or_down:
isNode = False
# Color maze, assign nodes
if isNode:
node_dict['node_%s_%s' % (x,y)] = self.Node(x, y, surroundings=self.get_surroundings(x,y))
found_nodes += 1
replace_print('Number of nodes found: {}'.format(found_nodes))
maze_copy.putpixel((x, y), self.RED)
print ('\n')
filename = self.maze.filename.replace('cropped', 'nodes')
maze_copy.save(filename)
return node_dict
def make_graph(self):
"""Connect the nodes"""
connected_nodes = 0.0
total_nodes = len(self.node_dict.keys())
direction_sums = {
'up': (0, -1),
'down': (0, 1),
'left': (-1, 0),
'right': (1, 0)
}
# Loop through the nodes
for key, node in self.node_dict.items():
connected_nodes += 1
string = '{} nodes connected out of {} ({:.2f} %)'.format(
connected_nodes,
total_nodes,
connected_nodes / total_nodes * 100)
# Pull a given node from the dictionary, get some of its attributes
surroundings = node.surroundings
x_pos = node.x_pos
y_pos = node.y_pos
# Loop through its surroundings, find nodes
for direction in surroundings:
path = surroundings[direction]
if path:
# Get the adjacent node and its position in tuple form from check_nodes_in_dir, split them up
node_and_pos = self.check_nodes_in_dir(x_pos, y_pos, direction_sums[direction])
adj_node = node_and_pos[0]
distance = abs((x_pos - node_and_pos[1][0]) + (y_pos - node_and_pos[1][1]))
# Set adjacent node in that direction with the distance
node.set_adjacent_nodes(direction, (adj_node, distance))
else:
node.set_adjacent_nodes(direction, None)
replace_print('Number of connected nodes: {0:.0f} ({1:.2f} %)'.format(connected_nodes, connected_nodes / total_nodes * 100))
print ('\n')
def check_nodes_in_dir(self, x_pos, y_pos, direc_sum):
"""
Checks for nodes in the direction directed by direc_sum.
Very specified just for the `make_graph()` method.
"""
# `direc_sum` is `direction_sums` tuple defined above
x_pos += direc_sum[0]
y_pos += direc_sum[1]
node = self.get_node_by_pos(x_pos, y_pos)
while not node:
x_pos += direc_sum[0]
y_pos += direc_sum[1]
node = self.get_node_by_pos(x_pos, y_pos)
return node, (x_pos, y_pos)
def get_pixel(self, x_pos, y_pos):
"""Return pixel RGB Value"""
return self.maze.getpixel((x_pos, y_pos), 'RGB')
def get_node_by_pos(self, x_pos, y_pos):
"""Gets node from the x and y position"""
node_name = 'node_%s_%s' % (x_pos, y_pos)
return self.node_dict.get(node_name)
def color_pixel(self, x, y, color, filename=None):
filename = filename if filename else self.maze.filename
self.maze.putpixel((x, y), color)
self.maze.save(filename)
def check_white(self, rgb_tuple):
"""Checks if rgb_tuple is white"""
return True if rgb_tuple == (255,255,255) or rgb_tuple == (255,255,255,255) else False
def check_black(self, rgb_tuple):
"""Checks if rgb_tuple is black"""
return True if rgb_tuple == (0,0,0) or rgb_tuple == (0,0,0,255) else False
| [
"[email protected]"
] | |
66111fe1a191a09bd2078e9d605863dc0d1f4e35 | 391ea6a7c730b9db50f14b359b0a8d123c590924 | /mayan/apps/duplicates/apps.py | 03f07a880d442904d5665d81caea9af292aef5f4 | [
"Apache-2.0"
] | permissive | Dave360-crypto/Mayan-EDMS-1 | 2e1891cea640ae2ac002d2c19eb22b88b271db29 | 7d79e748e8f6e47381a298ad8d219c15b09dd4d3 | refs/heads/master | 2023-08-19T06:48:48.566169 | 2021-10-11T06:22:24 | 2021-10-11T06:23:41 | 418,950,673 | 0 | 0 | NOASSERTION | 2021-10-19T14:07:24 | 2021-10-19T14:04:52 | null | UTF-8 | Python | false | false | 2,997 | py | from django.apps import apps
from django.db.models.signals import post_delete
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.apps import MayanAppConfig
from mayan.apps.common.menus import (
menu_list_facet, menu_multi_item, menu_tools
)
from mayan.apps.documents.menus import menu_documents
from mayan.apps.documents.permissions import permission_document_view
from mayan.apps.documents.signals import signal_post_document_file_upload
from mayan.apps.navigation.classes import SourceColumn
from .classes import DuplicateBackend
from .handlers import (
handler_remove_empty_duplicates_lists, handler_scan_duplicates_for
)
from .links import (
link_document_duplicates_list, link_duplicated_document_list,
link_duplicated_document_scan
)
class DuplicatesApp(MayanAppConfig):
app_namespace = 'duplicates'
app_url = 'duplicates'
has_rest_api = True
has_tests = True
name = 'mayan.apps.duplicates'
verbose_name = _('Duplicates')
def ready(self):
super().ready()
Document = apps.get_model(
app_label='documents', model_name='Document'
)
DuplicateBackendEntry = self.get_model(
model_name='DuplicateBackendEntry'
)
DuplicateSourceDocument = self.get_model(
model_name='DuplicateSourceDocument'
)
DuplicateTargetDocument = self.get_model(
model_name='DuplicateTargetDocument'
)
DuplicateBackend.load_modules()
SourceColumn(
func=lambda context: DuplicateBackendEntry.objects.get_duplicates_of(
document=context['object'],
permission=permission_document_view,
user=context['request'].user
).count(), include_label=True, label=_('Duplicates'),
order=99, source=DuplicateSourceDocument
)
SourceColumn(
attribute='backend', include_label=True,
label=_('Duplicate backend'), order=99,
source=DuplicateTargetDocument
)
menu_documents.bind_links(
links=(link_duplicated_document_list,)
)
menu_list_facet.bind_links(
links=(link_document_duplicates_list,),
sources=(Document,)
)
menu_tools.bind_links(
links=(link_duplicated_document_scan,)
)
# DuplicateSourceDocument
menu_multi_item.add_proxy_inclusions(source=DuplicateSourceDocument)
# DuplicateTargetDocument
menu_multi_item.add_proxy_inclusions(source=DuplicateTargetDocument)
post_delete.connect(
dispatch_uid='duplicates_handler_remove_empty_duplicates_lists',
receiver=handler_remove_empty_duplicates_lists,
sender=Document
)
signal_post_document_file_upload.connect(
dispatch_uid='duplicates_handler_scan_duplicates_for',
receiver=handler_scan_duplicates_for
)
| [
"[email protected]"
] | |
849c8859c0d6340d8cbc066bbe9b0df238848e8f | f210ccc90f9e091f10639f071c4e460fa4dafec1 | /src/helper/cluster.py | 72afcd677e91161ea455a8ea6061d9c3c1d91a17 | [
"MIT"
] | permissive | qingchenkanlu/FlowPose6D | e21974bbbc73db8934e387943a002d009ac0b16f | 2297ab5fa0afd0c247d59c2f1c7f899f078e2893 | refs/heads/master | 2023-01-20T13:43:59.737784 | 2020-11-22T10:52:23 | 2020-11-22T10:52:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,633 | py | import os
import time
import logging
def move_dataset_to_ssd(env, exp):
try:
# Update the env for the model when copying dataset to ssd
if env.get('leonhard', {}).get('copy', False):
files = ['data', 'data_syn', 'models', 'viewpoints_renderings']
p_ls = os.popen('echo $TMPDIR').read().replace('\n', '')
p_ycb_new = p_ls + '/YCB_Video_Dataset'
p_ycb = env['p_ycb']
print(p_ls)
try:
os.mkdir(p_ycb_new)
os.mkdir('$TMPDIR/YCB_Video_Dataset')
except:
pass
for f in files:
p_file_tar = f'{p_ycb}/{f}.tar'
logging.info(f'Copying {f} to {p_ycb_new}/{f}')
if os.path.exists(f'{p_ycb_new}/{f}'):
logging.info(
"data already exists! Interactive session?")
else:
start_time = time.time()
if f == 'data':
bashCommand = "tar -xvf" + p_file_tar + \
" -C $TMPDIR | awk 'BEGIN {ORS=\" \"} {if(NR%1000==0)print NR}\' "
else:
bashCommand = "tar -xvf" + p_file_tar + \
" -C $TMPDIR/YCB_Video_Dataset | awk 'BEGIN {ORS=\" \"} {if(NR%1000==0)print NR}\' "
os.system(bashCommand)
logging.info(
f'Transferred {f} folder within {str(time.time() - start_time)}s to local SSD')
env['p_ycb'] = p_ycb_new
except:
env['p_ycb'] = p_ycb_new
logging.info('Copying data failed')
return exp, env
def move_background(env, exp):
try:
# Update the env for the model when copying dataset to ssd
if env.get('leonhard', {}).get('copy', False):
p_file_tar = env['p_background'] + '/indoorCVPR_09.tar'
p_ls = os.popen('echo $TMPDIR').read().replace('\n', '')
p_n = p_ls + '/Images'
try:
os.mkdir(p_n)
except:
pass
if os.path.exists(f'{p_n}/office'):
logging.info(
"data already exists! Interactive session?")
else:
start_time = time.time()
bashCommand = "tar -xvf" + p_file_tar + \
" -C $TMPDIR | awk 'BEGIN {ORS=\" \"} {if(NR%1000==0)print NR}\' "
os.system(bashCommand)
env['p_background'] = p_n
except:
logging.info('Copying data failed')
return exp, env
| [
"[email protected]"
] | |
98f0f7c8f6dc07fb91cc412adcda50946734e5bf | b5a9d42f7ea5e26cd82b3be2b26c324d5da79ba1 | /tensorflow/contrib/seq2seq/python/kernel_tests/attention_wrapper_test.py | 7a7c4e3b9c1c750dc922cd05b01a2a88c65c0370 | [
"Apache-2.0"
] | permissive | uve/tensorflow | e48cb29f39ed24ee27e81afd1687960682e1fbef | e08079463bf43e5963acc41da1f57e95603f8080 | refs/heads/master | 2020-11-29T11:30:40.391232 | 2020-01-11T13:43:10 | 2020-01-11T13:43:10 | 230,088,347 | 0 | 0 | Apache-2.0 | 2019-12-25T10:49:15 | 2019-12-25T10:49:14 | null | UTF-8 | Python | false | false | 46,973 | py | # 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.
# ==============================================================================
"""Tests for contrib.seq2seq.python.ops.attention_wrapper."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import numpy as np
from tensorflow.contrib.seq2seq.python.ops import decoder
from tensorflow.contrib.seq2seq.python.ops import attention_wrapper as wrapper
from tensorflow.contrib.seq2seq.python.ops import helper as helper_py
from tensorflow.contrib.seq2seq.python.ops import basic_decoder
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import test_util
from tensorflow.python.layers import core as layers_core
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import rnn
from tensorflow.python.ops import rnn_cell
from tensorflow.python.ops import variables
from tensorflow.python.ops import variable_scope as vs
from tensorflow.python.platform import test
from tensorflow.python.util import nest
# pylint: enable=g-import-not-at-top
# for testing
AttentionWrapperState = wrapper.AttentionWrapperState # pylint: disable=invalid-name
LSTMStateTuple = rnn_cell.LSTMStateTuple # pylint: disable=invalid-name
BasicDecoderOutput = basic_decoder.BasicDecoderOutput # pylint: disable=invalid-name
float32 = np.float32
int32 = np.int32
array = np.array
dtype = np.dtype
class ResultSummary(
collections.namedtuple('ResultSummary', ('shape', 'dtype', 'mean'))):
pass
def get_result_summary(x):
if isinstance(x, np.ndarray):
return ResultSummary(x.shape, x.dtype, x.mean())
return x
@test_util.run_v1_only('contrib code not supported in TF2.0')
class AttentionWrapperTest(test.TestCase):
def assertAllCloseOrEqual(self, x, y, **kwargs):
if isinstance(x, np.ndarray) or isinstance(x, float):
return super(AttentionWrapperTest, self).assertAllClose(
x, y, atol=1e-3, **kwargs)
else:
self.assertAllEqual(x, y, **kwargs)
def testAttentionWrapperState(self):
num_fields = len(wrapper.AttentionWrapperState._fields) # pylint: disable=protected-access
state = wrapper.AttentionWrapperState(*([None] * num_fields))
new_state = state.clone(time=1)
self.assertEqual(state.time, None)
self.assertEqual(new_state.time, 1)
def testAttentionWrapperStateShapePropgation(self):
batch_size = 5
max_time = 5
num_units = 5
memory = random_ops.random_uniform(
[batch_size, max_time, num_units], seed=1)
mechanism = wrapper.LuongAttention(num_units, memory)
cell = wrapper.AttentionWrapper(rnn_cell.LSTMCell(num_units), mechanism)
# Create zero state with static batch size.
static_state = cell.zero_state(batch_size, dtypes.float32)
# Create zero state without static batch size.
state = cell.zero_state(array_ops.shape(memory)[0], dtypes.float32)
state = static_state.clone(
cell_state=state.cell_state, attention=state.attention)
self.assertEqual(state.cell_state.c.shape, static_state.cell_state.c.shape)
self.assertEqual(state.cell_state.h.shape, static_state.cell_state.h.shape)
self.assertEqual(state.attention.shape, static_state.attention.shape)
def _testWithAttention(self,
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_mechanism_depth=3,
alignment_history=False,
expected_final_alignment_history=None,
attention_layer_size=6,
attention_layer=None,
name=''):
attention_layer_sizes = (
[attention_layer_size] if attention_layer_size is not None else None)
attention_layers = (
[attention_layer] if attention_layer is not None else None)
self._testWithMaybeMultiAttention(
is_multi=False,
create_attention_mechanisms=[create_attention_mechanism],
expected_final_output=expected_final_output,
expected_final_state=expected_final_state,
attention_mechanism_depths=[attention_mechanism_depth],
alignment_history=alignment_history,
expected_final_alignment_history=expected_final_alignment_history,
attention_layer_sizes=attention_layer_sizes,
attention_layers=attention_layers,
name=name)
def _testWithMaybeMultiAttention(self,
is_multi,
create_attention_mechanisms,
expected_final_output,
expected_final_state,
attention_mechanism_depths,
alignment_history=False,
expected_final_alignment_history=None,
attention_layer_sizes=None,
attention_layers=None,
name=''):
# Allow is_multi to be True with a single mechanism to enable test for
# passing in a single mechanism in a list.
assert len(create_attention_mechanisms) == 1 or is_multi
encoder_sequence_length = [3, 2, 3, 1, 1]
decoder_sequence_length = [2, 0, 1, 2, 3]
batch_size = 5
encoder_max_time = 8
decoder_max_time = 4
input_depth = 7
encoder_output_depth = 10
cell_depth = 9
if attention_layer_sizes is not None:
# Compute sum of attention_layer_sizes. Use encoder_output_depth if None.
attention_depth = sum(attention_layer_size or encoder_output_depth
for attention_layer_size in attention_layer_sizes)
elif attention_layers is not None:
# Compute sum of attention_layers output depth.
attention_depth = sum(
attention_layer.compute_output_shape(
[batch_size, cell_depth + encoder_output_depth]).dims[-1].value
for attention_layer in attention_layers)
else:
attention_depth = encoder_output_depth * len(create_attention_mechanisms)
decoder_inputs = array_ops.placeholder_with_default(
np.random.randn(batch_size, decoder_max_time,
input_depth).astype(np.float32),
shape=(None, None, input_depth))
encoder_outputs = array_ops.placeholder_with_default(
np.random.randn(batch_size, encoder_max_time,
encoder_output_depth).astype(np.float32),
shape=(None, None, encoder_output_depth))
attention_mechanisms = [
creator(num_units=depth,
memory=encoder_outputs,
memory_sequence_length=encoder_sequence_length)
for creator, depth in zip(create_attention_mechanisms,
attention_mechanism_depths)]
with self.session(use_gpu=True) as sess:
with vs.variable_scope(
'root',
initializer=init_ops.random_normal_initializer(stddev=0.01, seed=3)):
attention_layer_size = attention_layer_sizes
attention_layer = attention_layers
if not is_multi:
if attention_layer_size is not None:
attention_layer_size = attention_layer_size[0]
if attention_layer is not None:
attention_layer = attention_layer[0]
cell = rnn_cell.LSTMCell(cell_depth)
cell = wrapper.AttentionWrapper(
cell,
attention_mechanisms if is_multi else attention_mechanisms[0],
attention_layer_size=attention_layer_size,
alignment_history=alignment_history,
attention_layer=attention_layer)
helper = helper_py.TrainingHelper(decoder_inputs,
decoder_sequence_length)
my_decoder = basic_decoder.BasicDecoder(
cell=cell,
helper=helper,
initial_state=cell.zero_state(
dtype=dtypes.float32, batch_size=batch_size))
final_outputs, final_state, _ = decoder.dynamic_decode(my_decoder)
self.assertTrue(
isinstance(final_outputs, basic_decoder.BasicDecoderOutput))
self.assertTrue(
isinstance(final_state, wrapper.AttentionWrapperState))
self.assertTrue(
isinstance(final_state.cell_state, rnn_cell.LSTMStateTuple))
self.assertEqual((batch_size, None, attention_depth),
tuple(final_outputs.rnn_output.get_shape().as_list()))
self.assertEqual((batch_size, None),
tuple(final_outputs.sample_id.get_shape().as_list()))
self.assertEqual((batch_size, attention_depth),
tuple(final_state.attention.get_shape().as_list()))
self.assertEqual((batch_size, cell_depth),
tuple(final_state.cell_state.c.get_shape().as_list()))
self.assertEqual((batch_size, cell_depth),
tuple(final_state.cell_state.h.get_shape().as_list()))
if alignment_history:
if is_multi:
state_alignment_history = []
for history_array in final_state.alignment_history:
history = history_array.stack()
self.assertEqual(
(None, batch_size, None),
tuple(history.get_shape().as_list()))
state_alignment_history.append(history)
state_alignment_history = tuple(state_alignment_history)
else:
state_alignment_history = final_state.alignment_history.stack()
self.assertEqual(
(None, batch_size, None),
tuple(state_alignment_history.get_shape().as_list()))
nest.assert_same_structure(
cell.state_size,
cell.zero_state(batch_size, dtypes.float32))
# Remove the history from final_state for purposes of the
# remainder of the tests.
final_state = final_state._replace(alignment_history=()) # pylint: disable=protected-access
else:
state_alignment_history = ()
sess.run(variables.global_variables_initializer())
sess_results = sess.run({
'final_outputs': final_outputs,
'final_state': final_state,
'state_alignment_history': state_alignment_history,
})
final_output_info = nest.map_structure(get_result_summary,
sess_results['final_outputs'])
final_state_info = nest.map_structure(get_result_summary,
sess_results['final_state'])
print(name)
print('Copy/paste:\nexpected_final_output = %s' % str(final_output_info))
print('expected_final_state = %s' % str(final_state_info))
nest.map_structure(self.assertAllCloseOrEqual, expected_final_output,
final_output_info)
nest.map_structure(self.assertAllCloseOrEqual, expected_final_state,
final_state_info)
if alignment_history: # by default, the wrapper emits attention as output
final_alignment_history_info = nest.map_structure(
get_result_summary, sess_results['state_alignment_history'])
print('expected_final_alignment_history = %s' %
str(final_alignment_history_info))
nest.map_structure(
self.assertAllCloseOrEqual,
# outputs are batch major but the stacked TensorArray is time major
expected_final_alignment_history,
final_alignment_history_info)
def testBahdanauNormalizedDType(self):
for dtype in [np.float16, np.float32, np.float64]:
num_units = 128
encoder_outputs = array_ops.placeholder(dtype, shape=[64, None, 256])
encoder_sequence_length = array_ops.placeholder(dtypes.int32, shape=[64])
decoder_inputs = array_ops.placeholder(dtype, shape=[64, None, 128])
decoder_sequence_length = array_ops.placeholder(dtypes.int32, shape=[64])
batch_size = 64
attention_mechanism = wrapper.BahdanauAttention(
num_units=num_units,
memory=encoder_outputs,
memory_sequence_length=encoder_sequence_length,
normalize=True,
dtype=dtype,
)
cell = rnn_cell.LSTMCell(num_units)
cell = wrapper.AttentionWrapper(cell, attention_mechanism)
helper = helper_py.TrainingHelper(decoder_inputs,
decoder_sequence_length)
my_decoder = basic_decoder.BasicDecoder(
cell=cell,
helper=helper,
initial_state=cell.zero_state(
dtype=dtype, batch_size=batch_size))
final_outputs, final_state, _ = decoder.dynamic_decode(my_decoder)
self.assertTrue(
isinstance(final_outputs, basic_decoder.BasicDecoderOutput))
self.assertEqual(final_outputs.rnn_output.dtype, dtype)
self.assertTrue(
isinstance(final_state, wrapper.AttentionWrapperState))
self.assertTrue(
isinstance(final_state.cell_state, rnn_cell.LSTMStateTuple))
def testBahdanauNotNormalized(self):
create_attention_mechanism = wrapper.BahdanauAttention
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0052250605),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.4))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040092287),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0020015112)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-0.0052052638),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
alignment_history=())
expected_final_alignment_history = ResultSummary(
shape=(3, 5, 8), dtype=dtype('float32'), mean=0.12500001)
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testBahdanauNotNormalized')
def testBahdanauNormalized(self):
create_attention_mechanism = functools.partial(
wrapper.BahdanauAttention, normalize=True)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.00597103),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.4))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040052128),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019996136)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-0.00595117),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
alignment_history=())
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
name='testBahdanauNormalized')
def testLuongNotNormalized(self):
create_attention_mechanism = wrapper.LuongAttention
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0052615386),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.4))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.004009536),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0020016613)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-0.0051812846),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
alignment_history=())
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_mechanism_depth=9,
name='testLuongNotNormalized')
def testLuongScaledDType(self):
# Test case for GitHub issue 18099
for dt in [np.float16, np.float32, np.float64]:
num_units = 128
encoder_outputs = array_ops.placeholder(dt, shape=[64, None, 256])
encoder_sequence_length = array_ops.placeholder(dtypes.int32, shape=[64])
decoder_inputs = array_ops.placeholder(dt, shape=[64, None, 128])
decoder_sequence_length = array_ops.placeholder(dtypes.int32, shape=[64])
batch_size = 64
attention_mechanism = wrapper.LuongAttention(
num_units=num_units,
memory=encoder_outputs,
memory_sequence_length=encoder_sequence_length,
scale=True,
dtype=dt,
)
cell = rnn_cell.LSTMCell(num_units)
cell = wrapper.AttentionWrapper(cell, attention_mechanism)
helper = helper_py.TrainingHelper(decoder_inputs,
decoder_sequence_length)
my_decoder = basic_decoder.BasicDecoder(
cell=cell,
helper=helper,
initial_state=cell.zero_state(
dtype=dt, batch_size=batch_size))
final_outputs, final_state, _ = decoder.dynamic_decode(my_decoder)
self.assertTrue(
isinstance(final_outputs, basic_decoder.BasicDecoderOutput))
self.assertEqual(final_outputs.rnn_output.dtype, dt)
self.assertTrue(
isinstance(final_state, wrapper.AttentionWrapperState))
self.assertTrue(
isinstance(final_state.cell_state, rnn_cell.LSTMStateTuple))
def testLuongScaled(self):
create_attention_mechanism = functools.partial(
wrapper.LuongAttention, scale=True)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0052615386),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.4))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.004009536),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0020016613)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-0.0051812846),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
alignment_history=())
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_mechanism_depth=9,
name='testLuongScaled')
def testNotUseAttentionLayer(self):
create_attention_mechanism = wrapper.BahdanauAttention
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 10), dtype=dtype('float32'), mean=0.117389656),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=4.5999999999999996))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0063607907),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.00323448)),
attention=ResultSummary(
shape=(5, 10), dtype=dtype('float32'), mean=0.117389656,),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
alignment_history=())
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_layer_size=None,
name='testNotUseAttentionLayer')
def test_safe_cumprod(self):
# Create some random test input
test_input = np.random.uniform(size=(10, 20))
for axis in [0, 1]:
for exclusive in [True, False]:
with self.cached_session():
# Compute cumprod with regular tf.math.cumprod
cumprod_output = math_ops.cumprod(
test_input, axis=axis, exclusive=exclusive).eval()
# Compute cumprod with safe_cumprod
safe_cumprod_output = wrapper.safe_cumprod(
test_input, axis=axis, exclusive=exclusive).eval()
for x, y in zip(cumprod_output.shape, safe_cumprod_output.shape):
self.assertEqual(x, y)
for x, y in zip(cumprod_output.flatten(),
safe_cumprod_output.flatten()):
# Use assertAlmostEqual for the actual values due to floating point
self.assertAlmostEqual(x, y, places=5)
def test_monotonic_attention(self):
def monotonic_attention_explicit(p_choose_i, previous_attention):
"""Explicitly compute monotonic attention distribution using numpy."""
# Base case for recurrence relation
out = [previous_attention[0]]
# Explicitly follow the recurrence relation
for j in range(1, p_choose_i.shape[0]):
out.append((1 - p_choose_i[j - 1])*out[j - 1] + previous_attention[j])
return p_choose_i*np.array(out)
# Generate a random batch of choosing probabilities for seq. len. 20
p_choose_i = np.random.uniform(size=(10, 20)).astype(np.float32)
# Generate random previous attention distributions
previous_attention = np.random.uniform(size=(10, 20)).astype(np.float32)
previous_attention /= previous_attention.sum(axis=1).reshape((-1, 1))
# Create the output to test against
explicit_output = np.array([
monotonic_attention_explicit(p, a)
for p, a in zip(p_choose_i, previous_attention)])
# Compute output with TensorFlow function, for both calculation types
with self.cached_session():
recursive_output = wrapper.monotonic_attention(
p_choose_i, previous_attention, 'recursive').eval()
self.assertEqual(recursive_output.ndim, explicit_output.ndim)
for x, y in zip(recursive_output.shape, explicit_output.shape):
self.assertEqual(x, y)
for x, y in zip(recursive_output.flatten(), explicit_output.flatten()):
# Use assertAlmostEqual for the actual values due to floating point
self.assertAlmostEqual(x, y, places=5)
# Generate new p_choose_i for parallel, which is unstable when p_choose_i[n]
# is close to 1
p_choose_i = np.random.uniform(0, 0.9, size=(10, 20)).astype(np.float32)
# Create new output to test against
explicit_output = np.array([
monotonic_attention_explicit(p, a)
for p, a in zip(p_choose_i, previous_attention)])
# Compute output with TensorFlow function, for both calculation types
with self.cached_session():
parallel_output = wrapper.monotonic_attention(
p_choose_i, previous_attention, 'parallel').eval()
self.assertEqual(parallel_output.ndim, explicit_output.ndim)
for x, y in zip(parallel_output.shape, explicit_output.shape):
self.assertEqual(x, y)
for x, y in zip(parallel_output.flatten(), explicit_output.flatten()):
# Use assertAlmostEqual for the actual values due to floating point
self.assertAlmostEqual(x, y, places=5)
# Now, test hard mode, where probabilities must be 0 or 1
p_choose_i = np.random.choice(np.array([0, 1], np.float32), (10, 20))
previous_attention = np.zeros((10, 20), np.float32)
# Randomly choose input sequence indices at each timestep
random_idx = np.random.randint(0, previous_attention.shape[1],
previous_attention.shape[0])
previous_attention[np.arange(previous_attention.shape[0]), random_idx] = 1
# Create the output to test against
explicit_output = np.array([
monotonic_attention_explicit(p, a)
for p, a in zip(p_choose_i, previous_attention)])
# Compute output with TensorFlow function, for both calculation types
with self.cached_session():
hard_output = wrapper.monotonic_attention(
# TensorFlow is unhappy when these are not wrapped as tf.constant
constant_op.constant(p_choose_i),
constant_op.constant(previous_attention),
'hard').eval()
self.assertEqual(hard_output.ndim, explicit_output.ndim)
for x, y in zip(hard_output.shape, explicit_output.shape):
self.assertEqual(x, y)
for x, y in zip(hard_output.flatten(), explicit_output.flatten()):
# Use assertAlmostEqual for the actual values due to floating point
self.assertAlmostEqual(x, y, places=5)
# Now, test recursively computing attention distributions vs. sampling
def sample(p_choose_i):
"""Generate a sequence of emit-ingest decisions from p_choose_i."""
output = np.zeros(p_choose_i.shape)
t_im1 = 0
for i in range(p_choose_i.shape[0]):
for j in range(t_im1, p_choose_i.shape[1]):
if np.random.uniform() <= p_choose_i[i, j]:
output[i, j] = 1
t_im1 = j
break
else:
t_im1 = p_choose_i.shape[1]
return output
# Now, the first axis is output timestep and second is input timestep
p_choose_i = np.random.uniform(size=(4, 5)).astype(np.float32)
# Generate the average of a bunch of samples
n_samples = 100000
sampled_output = np.mean(
[sample(p_choose_i) for _ in range(n_samples)], axis=0)
# Create initial previous_attention base case
recursive_output = [np.array([1] + [0]*(p_choose_i.shape[1] - 1),
np.float32)]
# Compute output with TensorFlow function, for both calculation types
with self.cached_session():
for j in range(p_choose_i.shape[0]):
# Compute attention distribution for this output time step
recursive_output.append(wrapper.monotonic_attention(
# newaxis is for adding the expected batch dimension
p_choose_i[j][np.newaxis],
recursive_output[-1][np.newaxis], 'recursive').eval()[0])
# Stack together distributions; remove basecase
recursive_output = np.array(recursive_output[1:])
self.assertEqual(recursive_output.ndim, sampled_output.ndim)
for x, y in zip(recursive_output.shape, sampled_output.shape):
self.assertEqual(x, y)
for x, y in zip(recursive_output.flatten(), sampled_output.flatten()):
# Use a very forgiving threshold since we are sampling
self.assertAlmostEqual(x, y, places=2)
def testBahdanauMonotonicNotNormalized(self):
create_attention_mechanism = functools.partial(
wrapper.BahdanauMonotonicAttention, sigmoid_noise=1.0,
sigmoid_noise_seed=3)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.002122893),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.7333333333333334))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040002423),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019968653)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-5.9313523e-05),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032228071),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032228071),
alignment_history=())
expected_final_alignment_history = ResultSummary(
shape=(3, 5, 8), dtype=dtype('float32'), mean=0.050430927)
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testBahdanauMonotonicNotNormalized')
def testBahdanauMonotonicNormalized(self):
create_attention_mechanism = functools.partial(
wrapper.BahdanauMonotonicAttention, normalize=True,
sigmoid_noise=1.0, sigmoid_noise_seed=3)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0025896581),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.73333333))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040013152),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019973689)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-0.00069823361),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.029914695),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.029914695),
alignment_history=())
expected_final_alignment_history = ResultSummary(
shape=(3, 5, 8), dtype=dtype('float32'), mean=0.0465225502849)
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testBahdanauMonotonicNormalized')
def testBahdanauMonotonicHard(self):
# Run attention mechanism with mode='hard', make sure probabilities are hard
b, t, u, d = 10, 20, 30, 40
with self.session(use_gpu=True) as sess:
a = wrapper.BahdanauMonotonicAttention(
d,
random_ops.random_normal((b, t, u)),
mode='hard')
# Just feed previous attention as [1, 0, 0, ...]
attn, unused_state = a(
random_ops.random_normal((b, d)), array_ops.one_hot([0]*b, t))
sess.run(variables.global_variables_initializer())
attn_out = attn.eval()
# All values should be 0 or 1
self.assertTrue(np.all(np.logical_or(attn_out == 0, attn_out == 1)))
# Sum of distributions should be 0 or 1 (0 when all p_choose_i are 0)
self.assertTrue(np.all(np.logical_or(attn_out.sum(axis=1) == 1,
attn_out.sum(axis=1) == 0)))
def testLuongMonotonicNotNormalized(self):
create_attention_mechanism = functools.partial(
wrapper.LuongMonotonicAttention, sigmoid_noise=1.0,
sigmoid_noise_seed=3)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0021257224),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.7333333333333334))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040003359),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.001996913)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-5.2024145e-05),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032198936),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032198936),
alignment_history=())
expected_final_alignment_history = ResultSummary(
shape=(3, 5, 8), dtype=dtype('float32'), mean=0.050387777)
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_mechanism_depth=9,
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testLuongMonotonicNotNormalized')
def testLuongMonotonicScaled(self):
create_attention_mechanism = functools.partial(
wrapper.LuongMonotonicAttention, scale=True, sigmoid_noise=1.0,
sigmoid_noise_seed=3)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0021257224),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.7333333333333334))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040003359),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.001996913)),
attention=ResultSummary(
shape=(5, 6), dtype=dtype('float32'), mean=-5.2024145e-05),
time=3,
alignments=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032198936),
attention_state=ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.032198936),
alignment_history=())
expected_final_alignment_history = ResultSummary(
shape=(3, 5, 8), dtype=dtype('float32'), mean=0.050387777)
self._testWithAttention(
create_attention_mechanism,
expected_final_output,
expected_final_state,
attention_mechanism_depth=9,
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testLuongMonotonicScaled')
def testMultiAttention(self):
create_attention_mechanisms = (
wrapper.BahdanauAttention, wrapper.LuongAttention)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 7), dtype=dtype('float32'), mean=0.0011709079),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=3.2000000000000002))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0038725811),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019329828)),
attention=ResultSummary(
shape=(5, 7), dtype=dtype('float32'), mean=0.001174294),
time=3,
alignments=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125)),
attention_state=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125)),
alignment_history=())
expected_final_alignment_history = (
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125))
self._testWithMaybeMultiAttention(
True,
create_attention_mechanisms,
expected_final_output,
expected_final_state,
attention_mechanism_depths=[9, 9],
attention_layer_sizes=[3, 4],
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testMultiAttention')
def testMultiAttentionWithLayerInstances(self):
create_attention_mechanisms = (
wrapper.BahdanauAttention, wrapper.LuongAttention)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 7), dtype=dtype('float32'), mean=0.0011709079),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=3.2000000000000002))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0038725811),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019329828)),
attention=ResultSummary(
shape=(5, 7), dtype=dtype('float32'), mean=0.001174294),
time=3,
alignments=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125)),
attention_state=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125)),
alignment_history=())
expected_final_alignment_history = (
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125))
self._testWithMaybeMultiAttention(
True,
create_attention_mechanisms,
expected_final_output,
expected_final_state,
attention_mechanism_depths=[9, 9],
attention_layers=[layers_core.Dense(3, use_bias=False),
layers_core.Dense(4, use_bias=False)],
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testMultiAttention')
def testLuongMonotonicHard(self):
# Run attention mechanism with mode='hard', make sure probabilities are hard
b, t, u, d = 10, 20, 30, 40
with self.session(use_gpu=True) as sess:
a = wrapper.LuongMonotonicAttention(
d,
random_ops.random_normal((b, t, u)),
mode='hard')
# Just feed previous attention as [1, 0, 0, ...]
attn, unused_state = a(
random_ops.random_normal((b, d)), array_ops.one_hot([0]*b, t))
sess.run(variables.global_variables_initializer())
attn_out = attn.eval()
# All values should be 0 or 1
self.assertTrue(np.all(np.logical_or(attn_out == 0, attn_out == 1)))
# Sum of distributions should be 0 or 1 (0 when all p_choose_i are 0)
self.assertTrue(np.all(np.logical_or(attn_out.sum(axis=1) == 1,
attn_out.sum(axis=1) == 0)))
def testMultiAttentionNoAttentionLayer(self):
create_attention_mechanisms = (
wrapper.BahdanauAttention, wrapper.LuongAttention)
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 20), dtype=dtype('float32'), mean=0.115853324533),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=8.6))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.003545674),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0018327223)),
attention=ResultSummary(
shape=(5, 20), dtype=dtype('float32'), mean=0.11462739855),
time=3,
alignments=(ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125)),
alignment_history=(),
attention_state=(ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(
shape=(5, 8), dtype=dtype('float32'), mean=0.125)))
expected_final_alignment_history = (
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125),
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125))
self._testWithMaybeMultiAttention(
is_multi=True,
create_attention_mechanisms=create_attention_mechanisms,
expected_final_output=expected_final_output,
expected_final_state=expected_final_state,
attention_mechanism_depths=[9, 9],
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testMultiAttention')
def testSingleAttentionAsList(self):
create_attention_mechanisms = [wrapper.BahdanauAttention]
expected_final_output = BasicDecoderOutput(
rnn_output=ResultSummary(
shape=(5, 3, 3), dtype=dtype('float32'), mean=-0.0098485695),
sample_id=ResultSummary(
shape=(5, 3), dtype=dtype('int32'), mean=1.8))
expected_final_state = AttentionWrapperState(
cell_state=LSTMStateTuple(
c=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0040023471),
h=ResultSummary(
shape=(5, 9), dtype=dtype('float32'), mean=-0.0019979973)),
attention=ResultSummary(
shape=(5, 3), dtype=dtype('float32'), mean=-0.0098808752),
time=3,
alignments=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),),
attention_state=(
ResultSummary(shape=(5, 8), dtype=dtype('float32'), mean=0.125),),
alignment_history=())
expected_final_alignment_history = (
ResultSummary(shape=(3, 5, 8), dtype=dtype('float32'), mean=0.125),)
self._testWithMaybeMultiAttention(
is_multi=True, # pass the AttentionMechanism wrapped in a list
create_attention_mechanisms=create_attention_mechanisms,
expected_final_output=expected_final_output,
expected_final_state=expected_final_state,
attention_mechanism_depths=[9],
attention_layer_sizes=[3],
alignment_history=True,
expected_final_alignment_history=expected_final_alignment_history,
name='testMultiAttention')
def testCustomizedAttention(self):
batch_size = 2
max_time = 3
num_units = 2
memory = constant_op.constant([[[1., 1.], [2., 2.], [3., 3.]],
[[4., 4.], [5., 5.], [6., 6.]]])
memory_sequence_length = constant_op.constant([3, 2])
attention_mechanism = wrapper.BahdanauAttention(num_units, memory,
memory_sequence_length)
# Sets all returned values to be all ones.
def _customized_attention(unused_attention_mechanism, unused_cell_output,
unused_attention_state, unused_attention_layer):
"""Customized attention.
Returns:
attention: `Tensor` of shape [batch_size, num_units], attention output.
alignments: `Tensor` of shape [batch_size, max_time], sigma value for
each input memory (prob. function of input keys).
next_attention_state: A `Tensor` representing the next state for the
attention.
"""
attention = array_ops.ones([batch_size, num_units])
alignments = array_ops.ones([batch_size, max_time])
next_attention_state = alignments
return attention, alignments, next_attention_state
attention_cell = wrapper.AttentionWrapper(
rnn_cell.LSTMCell(2),
attention_mechanism,
attention_layer_size=None, # don't use attention layer.
output_attention=False,
alignment_history=(),
attention_fn=_customized_attention,
name='attention')
self.assertEqual(num_units, attention_cell.output_size)
initial_state = attention_cell.zero_state(
batch_size=2, dtype=dtypes.float32)
source_input_emb = array_ops.ones([2, 3, 2])
source_input_length = constant_op.constant([3, 2])
# 'state' is a tuple of
# (cell_state, h, attention, alignments, alignment_history, attention_state)
output, state = rnn.dynamic_rnn(
attention_cell,
inputs=source_input_emb,
sequence_length=source_input_length,
initial_state=initial_state,
dtype=dtypes.float32)
with self.session() as sess:
sess.run(variables.global_variables_initializer())
output_value, state_value = sess.run([output, state], feed_dict={})
self.assertAllEqual(np.array([2, 3, 2]), output_value.shape)
self.assertAllClose(np.array([[1., 1.], [1., 1.]]), state_value.attention)
self.assertAllClose(
np.array([[1., 1., 1.], [1., 1., 1.]]), state_value.alignments)
self.assertAllClose(
np.array([[1., 1., 1.], [1., 1., 1.]]), state_value.attention_state)
if __name__ == '__main__':
test.main()
| [
"[email protected]"
] | |
883cdc5c29b87723f98b7e4e6b693ecfc75275de | 92cd0601656e4cde04e56a896ca063926185041c | /shop/accounts/apps.py | ac57fd73bea3da34aa8754777ebac2e76e4e1165 | [] | no_license | Anych/shop | 74599fd8f2405128c308f047ac9da13215a38912 | e5190c1cb7d2b786b90cce9c88734427ea371fb8 | refs/heads/master | 2023-05-01T07:08:24.881512 | 2021-05-24T07:48:50 | 2021-05-24T07:48:50 | 355,591,850 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 187 | py | from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'accounts'
verbose_name = 'Аккаунты'
| [
"[email protected]"
] | |
ca621434fe09d84bca3e458e246118b9fca0426c | ddfb8fe53a31ddb984d7e647010fe15a6b8978a3 | /intensity_probe.py | 7c5b6ed258c16b1fab62dd2fa1db524679e08435 | [] | no_license | linzzz98/cvg_scripts | 7d27b551e9d994a8385d4e6007d132674ac84906 | e727fbb905bbcad4adaf722c830348678e04a860 | refs/heads/master | 2022-01-02T06:30:45.783826 | 2012-05-04T14:07:44 | 2012-05-04T14:07:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 20,466 | py | #!/usr/bin/python
"""
Intensity_Probe - given a directory of images and directory of
corresponding cameras, click on a point in the presented image
and have the intensities at that point in other images
plotted to the left (histogrammed and by image number...)
"""
from boxm2_adaptor import *;
from boxm2_scene_adaptor import *;
from vpgl_adaptor import *;
from bbas_adaptor import *;
from vil_adaptor import *;
from boxm2_tools_adaptor import *;
import scene_registry
import random, os, sys;
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt;
from mpl_toolkits.mplot3d import axes3d
import numpy;
from numpy import arange, sin, pi , cos, arctan2, arccos
if matplotlib.get_backend() is not 'TkAgg': matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import *
from matplotlib.figure import Figure
from Tkinter import*
import Image,ImageTk, ImageDraw
import glob,math,random
from optparse import OptionParser
#######################################################
# handle inputs #
#scene is given as first arg, figure out paths #
parser = OptionParser()
parser.add_option("-s", "--scene", action="store", type="string", dest="scene", default="", help="specify scene name")
parser.add_option("-x", "--xmlfile", action="store", type="string", dest="xml", default="model/uscene.xml", help="scene.xml file name (model/uscene.xml, model_fixed/scene.xml, rscene.xml)")
parser.add_option("-g", "--gpu", action="store", type="string", dest="gpu", default="gpu1", help="specify gpu (gpu0, gpu1, etc)")
parser.add_option("-i", "--image", action="store", type="string", dest="image", default="", help="specify which image or directory to use")
parser.add_option("-c", "--camera", action="store", type="string", dest="camera", default="", help="specify corresponding camera or directory to use")
(options, args) = parser.parse_args()
print options
print args
############################################
# Create Scene
scene_root = scene_registry.scene_root( options.scene ); #
xmlPath = scene_root + "/" + options.xml
if not os.path.exists(xmlPath):
print "Cannot find file: ", xmlPath
sys.exit(-1)
scene = boxm2_scene_adaptor(xmlPath, options.gpu);
############################################
#search a bit for camera and image
defImg = scene_root + "/nvm_out/imgs/"
defCam = scene_root + "/nvm_out/cams_krt/"
if os.path.exists(options.image) and os.path.exists(options.camera):
imageDir = options.image
camDir = options.camera
elif os.path.exists(defImg) and os.path.exists(defCam):
imageDir = defImg
camDir = defCam
else:
print "Can't find default image/cam dirs: ", defImg, defCam
sys.exit(-1)
print "Image Directory: ", imageDir
imgList = glob.glob(imageDir + "/*")
camList = glob.glob(camDir + "/*.txt")
imgList.sort()
camList.sort()
assert(len(imgList) == len(camList))
assert(len(imgList) > 0)
""" ImageFrame
Helper class keeps track of objects associated with an image frame
"""
class ImageFrame:
def __init__(self, frame=None, label=None, labString=None, currImg=0, row=0, col=0, label_image=None, image=None, tkpi=None):
self.frame = frame
self.label = label
self.labString = labString
self.label_image = label_image
self.currImg = currImg
self.row = row
self.col = col
self.image = image
self.tkpi = tkpi
self.lastClick = None
""" Application
gui app takes in Tk, imglist and camlist
"""
suntheta= 0.325398;
sunphi =0.495398;
class App:
def __init__(self,master,imgList,camList):
self.master = master;
self.master.title("3d Point Intensity Tool");
#store imgs/cams
self.imgList = imgList
self.camList = camList
#Once a 3d point is generated, it is stored here,
#and all image's UV points stored in allUVs
self.point3d = None
self.allUVs = []
#############################################
#set up plot frame
firstImg = Image.open(imgList[0]);
print "Image size: ", firstImg.size
self.reduceFactor = max(firstImg.size[0]/640.0, firstImg.size[1]/480.0)
self.ni = int(firstImg.size[0]/self.reduceFactor + .5)
self.nj = int(firstImg.size[1]/self.reduceFactor + .5)
self.frame = Frame(self.master, height=self.nj, width=self.ni, bg='blue');
self.frame.grid_propagate(0)
self.frame.pack();
self.frame.grid(row=0, column=0)
# place a graph somewhere here
self.f = Figure(figsize=(5.0,5.0), dpi=100)
self.a = self.f.add_subplot(311)
self.a.set_xlabel("t")
self.a.set_ylabel("Info")
self.a.plot([0,1,2,3,4],[0,1,2,3,4])
self.canvas = FigureCanvasTkAgg(self.f, self.frame)
self.canvas.show()
#self.canvas.mpl_connect('button_press_event', self.get_t);
self.canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
#############################################
#set up button frame
self.bFrame = Frame(self.master, height=self.nj, width=self.ni)
self.bFrame.grid_propagate(0)
self.bFrame.pack()
self.bFrame.grid(row=1, column=0)
#place a button to generate 3d point, and grab intensities from each image
self.genButton = Button(self.bFrame, text="Generate Point", command=self.point_from_rays)
self.genButton.pack(fill=BOTH, expand=1)
#button to clear the points
self.clearButton = Button(self.bFrame, text="Clear Points", command=self.clear_points)
self.clearButton.pack()
#label for std dev and mean
self.stdLabel = StringVar()
Label(self.bFrame, textvariable=self.stdLabel).pack()
self.meanLabel = StringVar()
Label(self.bFrame, textvariable=self.meanLabel).pack()
#label for 3d point
self.pointLabel = StringVar()
Label(self.bFrame, textvariable=self.pointLabel).pack()
##############################################
#set up images frames (should be 4 or so images)
self.frames = []
self.numImageFrames = 4
frCount = 0
for i in range(2):
for j in range(2):
labString = StringVar()
label = Label(self.master, textvariable=labString)
frame1 = LabelFrame(self.master, labelwidget=label, height=self.nj, width=self.ni, bg='green')
frame1.pack();
frame1.grid_propagate(0)
frame1.grid(row=i, column=j+1, sticky=NW)
currFrame = (len(self.imgList) / self.numImageFrames) * frCount
imageFrame = ImageFrame(frame1, label, labString, currFrame, i, j);
self.frames.append(imageFrame)
frCount += 1
#display the first frame
for iFrame in self.frames:
self.displayImage(iFrame)
#start the gui
master.mainloop();
def point_from_rays(self):
"""generate point from frames with clicked pixels"""
print "generating the 3d point from given clicked points"
#gather cams and points clicked
uvs = []
cams = []
for iFrame in self.frames:
if iFrame.lastClick :
uv = numpy.multiply(iFrame.lastClick,self.reduceFactor)
uvs.append(uv)
cam = load_perspective_camera(self.camList[iFrame.currImg])
cams.append(cam)
point = get_3d_from_cams(cams, uvs)
self.point3d = point;
self.pointLabel.set("3d Point: " + str(self.point3d))
# project 3d point into each image, and gather intensities
values = []
ims = []
for idx, img in enumerate(self.imgList):
cam = load_perspective_camera(self.camList[idx])
imgPoint = project_point(cam, point[0], point[1], point[2])
imgPoint = numpy.divide(imgPoint, self.reduceFactor)
self.allUVs.append(imgPoint)
#grab float intensity value at this point
imgView,ni,nj = load_image(img)
val = pixel(imgView, imgPoint)
if val > 0.0:
values.append(val)
ims.append(idx)
#cleanup
remove_from_db([imgView, cam])
#now that each image has a corresponding make sure the
#point is displayed in each image
#self.clear_points();
#for iFrame in self.frames:
#point = self.allUVs[iFrame.currImg];
#self.drawBox(iFrame)
#write mean/std of intensities
self.meanLabel.set("Mean: " + str(numpy.mean(values)) )
self.stdLabel.set("Std Dev: " + str(numpy.std(values)) )
#plot the intensities by image number
self.f.clf();
self.a = self.f.add_subplot(311)
self.a.set_xlabel("img #")
self.a.set_ylabel("intensity")
self.a.plot(ims, values)
#plot the histogram of intensities by image number
pdf, bins, patches = plt.hist(values)
self.b = self.f.add_subplot(313)
self.b.set_xlabel("bin val")
self.b.set_ylabel("freq")
self.b.hist(values, 15, normed=1, facecolor="green" )
self.canvas.show();
def clear_points(self):
"""clear points in each iFrame"""
print "clearing each frame of selected points"
self.point_3d = None
self.allUVs = []
for iFrame in self.frames:
iFrame.lastClick = None;
self.displayImage(iFrame)
def displayImage(self, iFrame, img=None):
"""given a frame displays the current image """
if not img:
imgPath = self.imgList[iFrame.currImg]
img = Image.open(imgPath);
if img.mode == "I;16":
print "16 bit image, converting to 8 bit"
img.mode = 'I'
img = img.point(lambda i:i*(1./256.)).convert("RGB");
img = img.resize((self.ni, self.nj))
#iframe keeps track of its image
iFrame.image = img
#if point is generated, gotta draw squares first
if self.point3d:
point = self.allUVs[iFrame.currImg];
self.drawBox(iFrame, point)
# store photo image (probably not needed in iFrame)
iFrame.tkpi = ImageTk.PhotoImage(img)
#update frames' label
iFrame.labString.set("img {0}".format(iFrame.currImg))
#create new label image
if iFrame.label_image :
iFrame.label_image.destroy()
iFrame.label_image = Label(iFrame.frame, image=iFrame.tkpi)
iFrame.label_image.image = iFrame.tkpi
iFrame.label_image.bind("<Button-1>", lambda event, arg=iFrame: self.runprobe(event, iFrame))
iFrame.label_image.bind("<Button-3>", lambda event, arg=iFrame: self.nextImage(event, iFrame))
iFrame.label_image.bind("<Button-2>", lambda event, arg=iFrame: self.prevImage(event, iFrame))
iFrame.label_image.pack(side = LEFT);
def nextImage(self, event, iFrame):
currImg = 1 + iFrame.currImg
if currImg >= len(self.imgList):
currImg = 0
iFrame.currImg = currImg
print "Displaying next image: ", self.imgList[currImg]
self.displayImage(iFrame);
def prevImage(self, event, iFrame):
currImg = iFrame.currImg - 1
if currImg < 0 :
currImg = len(self.imgList)-1
iFrame.currImg = currImg
print "Displaying next image: ", self.imgList[currImg]
self.displayImage(iFrame);
def runprobe(self,event,iFrame):
print "Image clicked on frame ", iFrame.row, iFrame.col
print " at point", event.x, event.y, " = ", iFrame.image.getpixel( (event.x, event.y) )
#store x,y clicked and draw
iFrame.lastClick = (event.x, event.y)
self.drawBox(iFrame, iFrame.lastClick)
self.displayImage(iFrame, iFrame.image)
def drawBox(self, iFrame, point):
draw = ImageDraw.Draw(iFrame.image)
imSize = iFrame.image.size
p1 = ( max(point[0]-5,0), max(point[1]-5,0) )
p2 = ( min(point[0]+5,imSize[0]-1), min(point[1]+5, imSize[1]-1) )
draw.rectangle([p1, p2], fill="green")
del draw
# self.posx=event.x;
# self.posy=event.y;
# array2d=list();
# xs=list();
# ys=list();
# zs=list();
# len_array_1d, alpha_array_1d, vis_array_1d, tabs_array_1d, phongs_array_1d, nelems = scene.get_info_along_ray(cam,self.posx, self.posy, "boxm2_mog3_grey");
# print "NELEMS ", nelems;
# surface_p = list();
# air_p = list();
# air_p1 = list();
# num_observations = list();
# for i in range(0,len(len_array_1d)):
# surface_p.append(phongs_array_1d[i*nelems+5]);
# air_p.append(phongs_array_1d[i*nelems+6]);
# num_observations.append(phongs_array_1d[i*nelems+7]);
# print surface_p
# print air_p
# print air_p1
# print num_observations
# self.b = self.f.add_subplot(312)
# self.b.set_xlabel("zs")
# self.b.set_ylabel("Air p")
# self.b.plot(tabs_array_1d,air_p);
# self.b.plot(tabs_array_1d,vis_array_1d);
# self.b = self.f.add_subplot(313)
# self.b.set_xlabel("zs")
# self.b.set_ylabel("Nobs")
# self.b.plot(tabs_array_1d,num_observations);
# self.canvas.show();
#
# def get_t(self,event):
# print " Get T is called!!!!!!!!!!!!"
# self.t =event.xdata;
# self.ty=event.ydata; # clear the figure
# print self.t;
# self.point[0],self.point[1],self.point[2] = get_3d_from_depth(pcam,self.posx,self.posy,self.t);
# print "3-d point ", self.point[0], self.point[1], self.point[2];
# self.get_intensities();
# def get_intensities(self):
# print " Get Intensities! is called!!!!!!!!!!!!"
# thetas=list();
# phis=list();
# cam_exp = 0;
# img_ids=range(0,255,10);
# scene.query_cell_brdf(self.point, "cubic_model");
# #create stream cache using image/type lists:
# image_id_fname = "./image_list.txt";
# fd = open(image_id_fname,"w");
# print >>fd, len(img_ids);
# for i in img_ids:
# print >>fd, "img_%05d"%i;
# fd.close();
# type_id_fname = "./type_names_list.txt";
# fd2 = open(type_id_fname,"w");
# print >>fd2, 4;
# print >>fd2, "aux0";
# print >>fd2, "aux1";
# print >>fd2, "aux2";
# print >>fd2, "aux3";
# fd2.close();
#
# # open the stream cache, this is a read-only cache
# boxm2_batch.init_process("boxm2CreateStreamCacheProcess");
# boxm2_batch.set_input_from_db(0,scene.scene);
# boxm2_batch.set_input_string(1,type_id_fname);
# boxm2_batch.set_input_string(2,image_id_fname);
# boxm2_batch.set_input_float(3,3);
# boxm2_batch.run_process();
# (cache_id, cache_type) = boxm2_batch.commit_output(0);
# strcache = dbvalue(cache_id, cache_type);
# #get intensities/visibilities
# intensities, visibilities = probe_intensities(scene.scene, scene.cpu_cache, strcache, self.point)
# boxm2_batch.init_process("boxm2StreamCacheCloseFilesProcess");
# boxm2_batch.set_input_from_db(0,strcache);
# boxm2_batch.run_process();
# image_id_fname = "./image_list.txt";
# # write image identifiers to file
# fd = open(image_id_fname,"w");
# print >>fd, len(img_ids);
# for i in img_ids:
# print >>fd, "viewdir_%05d"%i;
# fd.close();
# # open the stream cache, this is a read-only cache
# boxm2_batch.init_process("boxm2CreateStreamCacheProcess");
# boxm2_batch.set_input_from_db(0,scene.scene);
# boxm2_batch.set_input_string(1,type_id_fname);
# boxm2_batch.set_input_string(2,image_id_fname);
# boxm2_batch.set_input_float(3,3);
# boxm2_batch.run_process();
# (cache_id, cache_type) = boxm2_batch.commit_output(0);
# strcache = dbvalue(cache_id, cache_type);
# boxm2_batch.init_process("boxm2CppBatchProbeIntensitiesProcess");
# boxm2_batch.set_input_from_db(0,scene.scene);
# boxm2_batch.set_input_from_db(1,scene.cpu_cache);
# boxm2_batch.set_input_from_db(2,strcache);
# boxm2_batch.set_input_float(3,self.point[0]);
# boxm2_batch.set_input_float(4,self.point[1]);
# boxm2_batch.set_input_float(5,self.point[2]);
# boxm2_batch.run_process();
# (id,type) = boxm2_batch.commit_output(0);
# xdir=boxm2_batch.get_bbas_1d_array_float(id);
# (id,type) = boxm2_batch.commit_output(1);
# ydir=boxm2_batch.get_bbas_1d_array_float(id);
# (id,type) = boxm2_batch.commit_output(2);
# zdir=boxm2_batch.get_bbas_1d_array_float(id);
# phis =[];
# for i in range(0, len(xdir)):
# phis.append( arctan2(ydir[i],xdir[i]));
# thetas.append(arccos(zdir[i]));
# boxm2_batch.init_process("boxm2StreamCacheCloseFilesProcess");
# boxm2_batch.set_input_from_db(0,strcache);
# boxm2_batch.run_process();
#
# boxm2_batch.init_process("bradEstimateSynopticFunction1dProcess");
# boxm2_batch.set_input_float_array(0,intensities);
# boxm2_batch.set_input_float_array(1,visibilities);
# boxm2_batch.set_input_float_array(2,thetas);
# boxm2_batch.set_input_float_array(3,phis);
# boxm2_batch.set_input_bool(4,1);
# boxm2_batch.run_process();
# (id,type) = boxm2_batch.commit_output(0);
# fitted_intensities=boxm2_batch.get_bbas_1d_array_float(id);
# (id,type) = boxm2_batch.commit_output(1);
# surf_prob_density=boxm2_batch.get_output_float(id);
#
#
# boxm2_batch.init_process("bradEstimateEmptyProcess");
# boxm2_batch.set_input_float_array(0,intensities);
# boxm2_batch.set_input_float_array(1,visibilities);
# boxm2_batch.run_process();
# (id,type) = boxm2_batch.commit_output(0);
# air_prob_density=boxm2_batch.get_output_float(id);
# print "surf_prob_density ", surf_prob_density, "air_prob_density ", air_prob_density
#
# #fig = plt.figure(2)
# #fig.clf();
# #ax = fig.gca(projection='3d')
#
# select_intensities=list();
# select_intensities_img=list();
# select_fitted_intensities=list();
# select_visibilities=list();
# select_indices=list();
# print len(thetas), len (intensities);
# for pindex in range(0,len(intensities)):
# r=intensities[pindex];
# theta=thetas[pindex];
# phi=phis[pindex];
# r1=fitted_intensities[pindex];
# if(intensities[pindex]<0.0):
# visibilities[pindex]=0.0;
# if(visibilities[pindex]>0.0 ):
# vispl=visibilities[pindex];
# #ax.plot([0,r*sin(theta)*cos(phi)],[0,r*sin(theta)*sin(phi)],[0,r*cos(theta)], color='b');
# #ax.scatter([r1*sin(theta)*cos(phi)],[r1*sin(theta)*sin(phi)],[r1*cos(theta)], color='g');
# #ax.scatter([vispl*sin(theta)*cos(phi)],[vispl*sin(theta)*sin(phi)],[vispl*cos(theta)], color='r');
# print intensities[pindex], phis[pindex], visibilities[pindex];
# select_intensities.append(r);
# select_visibilities.append(vispl);
# select_indices.append(pindex);
# select_fitted_intensities.append(r1);
# #select_intensities_img.append(intensities_img[pindex]);
# #ax.plot([0,sin(suntheta)*cos(sunphi)],[0,sin(suntheta)*sin(sunphi)],[0,cos(suntheta)], color='r');
# #ax.plot([0,0],[0,0],[0,1], color='k');
# #ax.set_xlim3d(-1,1);ax.set_ylim3d(-1,1);ax.set_zlim3d(0,1);
# #plt.show();
# fig_hist=plt.figure(3);
# plt.xlabel("ViewPoints")
# plt.ylabel("Intensities")
# plt.plot(select_indices,select_intensities,'r*-');
# plt.plot(select_indices,select_fitted_intensities,'g.-');
# plt.ylim((0,1));
# plt.plot(select_indices,select_visibilities,'bo-');
# #plt.plot(select_indices,select_intensities_img,'ko-');
# #plt.legend( ('Intensities Observed', 'Phong\'s Model','Visibilities'), loc='lower left');
# plt.show();
#
#instantiate Tk root, and make App
root = Tk();
app = App(root, imgList, camList);
| [
"[email protected]"
] | |
05f10d2ee781ed9c5a53261db7d80fb1b86f2c53 | cf7025ff7d02604ea146775a35894733d8338593 | /core/settings.py | 0491d6fc6eddf8fe942be18ae5190fac60296a53 | [] | no_license | boxabhi/CodeKeen-starter | 7af6e13ec780df8a571e52d6cf10e16ac4717c3d | ac8be93494cf7013366ba7ad8cbd172d47feb466 | refs/heads/main | 2023-06-18T14:56:30.771286 | 2021-07-25T15:45:05 | 2021-07-25T15:45:05 | 382,294,773 | 1 | 2 | null | null | null | null | UTF-8 | Python | false | false | 3,653 | py | """
Django settings for core project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-7p$(e589sf%x_g%^36)s*k^w2t^nxxj=7!^&x_9h@7b_oi7(x8'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'channels',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'home',
'django_extensions',
'debug_toolbar',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
ROOT_URLCONF = 'core.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WGI_APPLICATION = 'core.wsgi.application'
ASGI_APPLICATION = 'core.asgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
},
}
INTERNAL_IPS = [
# ...
'127.0.0.1',
# ...
]
| [
"[email protected]"
] | |
fa8957f1abd9be526285045d13f60e79976ae059 | b3b9066196700269494b2a9350377bfd1aa8170e | /starlight_project/settings.py | 5c7f1d8b99ce32ac6fa49ec3582d13239c206856 | [] | no_license | MagiCircles/RevueStarlight | f33000e06bc6ce6db506bd7460c47ffd2a3716c4 | 5ce8a023e2b618143fd9dcc3e78758c2623001d7 | refs/heads/master | 2022-08-13T20:12:25.201028 | 2022-07-10T15:14:44 | 2022-07-10T15:14:44 | 185,398,158 | 5 | 2 | null | 2022-07-30T18:11:03 | 2019-05-07T12:32:48 | Python | UTF-8 | Python | false | false | 4,887 | py | # -*- coding: utf-8 -*-
"""
Django settings for starlight_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#yt2*mvya*ulaxd+6jtr#%ouyco*2%3ngb=u-_$44j^86g0$$3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'bootstrapform',
'snowpenguin.django.recaptcha3',
'rest_framework',
'storages',
'magi',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'magi.middleware.languageFromPreferences.LanguageFromPreferenceMiddleWare',
'magi.middleware.httpredirect.HttpRedirectMiddleware',
)
ROOT_URLCONF = 'starlight_project.urls'
WSGI_APPLICATION = 'starlight_project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
SITE = 'starlight'
AUTHENTICATION_BACKENDS = ('magi.backends.AuthenticationBackend',)
DEBUG_PORT = 8000
from django.utils.translation import ugettext_lazy as _
LANGUAGES = (
('en', _('English')),
('es', _('Spanish')),
('zh-hans', _('Simplified Chinese')),
('ru', _('Russian')),
('it', _('Italian')),
('fr', _('French')),
('de', _('German')),
('pl', _('Polish')),
('ja', _('Japanese')),
('kr', _('Korean')),
('id', _('Indonesian')),
('vi', _('Vietnamese')),
('zh-hant', _('Traditional Chinese')),
('pt', _('Portuguese')),
('pt-br', _('Brazilian Portuguese')),
('tr', _('Turkish')),
('th', _('Thai')),
('uk', _('Ukrainian')),
)
NATIVE_LANGUAGES = (
('en', u'English'),
('es', u'Español'),
('zh-hans', u'简体中文'),
('ru', u'Русский'),
('it', u'Italiano'),
('fr', u'Français'),
('de', u'Deutsch'),
('pl', u'polski'),
('ja', u'日本語'),
('kr', u'한국어'),
('id', u'Indonesia'),
('vi', u'Tiếng Việt Nam'),
('zh-hant', u'繁體中文'),
('pt', u'Português'),
('pt-br', u'Português Brasileiro'),
('tr', u'Türkçe'),
('th', u'ไทย'),
('uk', u'Українська'),
)
LANGUAGE_CODE = 'en'
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'magi/locale'),
]
STATIC_UPLOADED_FILES_PREFIX = None
CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/api/.*$'
LOGIN_REDIRECT_URL = '/'
LOG_EMAIL = '[email protected]'
PASSWORD_EMAIL = '[email protected]'
AWS_SES_RETURN_PATH = '[email protected]'
RECAPTCHA_PRIVATE_KEY = ''
RECAPTCHA_PUBLIC_KEY = ''
RECAPTCHA_DEFAULT_ACTION = 'generic'
RECAPTCHA_SCORE_THRESHOLD = 0.5
FAVORITE_CHARACTERS = []
STAGE_GIRLS_NAMES = {}
STAFF_CONFIGURATIONS = {}
SCHOOLS = {}
IMPORTABLE_FIELDS = {}
VOICE_ACTRESSES = {}
MAX_STATISTICS = {}
MAX_WIDTH = 1200
MAX_HEIGHT = 1200
MIN_WIDTH = 300
MIN_HEIGHT = 300
STATIC_FILES_VERSION = ''
try:
from generated_settings import *
except ImportError, e:
pass
try:
from local_settings import *
except ImportError, e:
pass
INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append(SITE)
LOCALE_PATHS = list(LOCALE_PATHS)
LOCALE_PATHS.append(os.path.join(BASE_DIR, SITE, 'locale'))
if STATIC_UPLOADED_FILES_PREFIX is None:
STATIC_UPLOADED_FILES_PREFIX = SITE + '/static/uploaded/' if DEBUG else 'u/'
| [
"[email protected]"
] | |
3f0324d2aa68a7bb29d539c03f1c6a4cd9453169 | acec8615e8cd8e81d58703024816fdedf43ecc0e | /replica/contrib/blip/dashboard/views.py | f7b9cb6dd51299c49738ab6d641aeab39392c0d4 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | underlost/Replica | dec884522833e89bcec46d16b2349d0881a15cc9 | 2f092d3fc215b950fa6e409980a3f3e7c3633f7c | refs/heads/master | 2021-03-12T23:39:19.196279 | 2015-06-04T07:53:15 | 2015-06-04T07:53:15 | 3,567,323 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,663 | py | from __future__ import absolute_import
import logging
from django.shortcuts import render_to_response, render, get_object_or_404, redirect
from django.template import RequestContext
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views.generic.list import ListView
from replica.contrib.blip.models import Timeline, Blip
from replica.contrib.blip.forms import TimelineModelForm, BlipModelForm
class LatestBlipsListViewMobile(ListView):
paginate_by = 25
template_name = 'replica/dashboard/blip/blip_list.html'
def get_queryset(self):
return Blip.objects.filter(user=self.request.user).order_by('-pub_date')
def get_context_data(self, **kwargs):
context = super(LatestBlipsListViewMobile, self).get_context_data(**kwargs)
context.update({'hide_timeline': True, 'nav_title': 'All Blips',})
return context
class TimelinesListView(ListView):
paginate_by = 25
template_name = 'replica/dashboard/blip/timeline_list.html'
def get_queryset(self):
return Timeline.objects.filter(user=self.request.user).order_by('-pub_date')
def get_context_data(self, **kwargs):
context = super(TimelinesListView, self).get_context_data(**kwargs)
context.update({ 'nav_title': 'Timelines',})
return context
class TimelineBlipListView(ListView):
paginate_by = 100
template_name = 'replica/dashboard/blip/blip_list.html'
def get_queryset(self):
self.timeline = get_object_or_404(Timeline, slug=self.kwargs.pop('timeline_slug'))
b = Blip.objects.filter(user=self.request.user).filter(timeline=self.timeline)
if self.timeline.rev_order == True:
return b.order_by('-pub_date')
else:
return b.order_by('pub_date')
def get_context_data(self, **kwargs):
context = super(TimelineBlipListView, self).get_context_data(**kwargs)
context.update({'timeline': self.timeline, 'nav_title': self.timeline.name,})
return context
def AddTimeline(request):
#add a timeline.
instance = Timeline(user=request.user)
f = TimelineModelForm(request.POST or None, instance=instance)
if f.is_valid():
f.save()
messages.add_message(
request, messages.INFO, 'New list created.')
return redirect('Replica:Blip-Timelines')
ctx = {'form': f, 'adding': True}
return render(request, 'replica/dashboard/blip/edit_timeline.html', ctx)
def EditTimeline(request, timeline_slug):
#Lets a user edit a blip they've previously added.
timeline = get_object_or_404(Timeline, slug=timeline_slug)
f = TimelineModelForm(request.POST or None, instance=timeline)
if f.is_valid():
f.save()
return redirect('Replica:Blip-Add-To-Timeline', timeline_slug=timeline_slug)
ctx = {'form': f, 'timeline': timeline, 'adding': False}
return render(request, 'replica/dashboard/blip/edit_timeline.html', ctx)
def SingleBlip(request, blip_guid):
#Shows a single blip.
blip = get_object_or_404(Blip, guid=blip_guid)
if blip.timeline:
recent_blips = Blip.objects.filter(timeline__id=blip.timeline.id, is_private=False)[:5]
ctx = {'blip': blip, 'recent_blips': recent_blips}
else:
ctx = {'blip': blip}
return render(request, 'replica/dashboard/blip/single_blip.html', ctx)
def AddBlip(request, timeline_slug=None):
object_list = Blip.objects.filter(user=request.user).order_by('-pub_date')[:10]
instance = Blip(user=request.user)
f = BlipModelForm(request.POST or None, instance=instance)
if f.is_valid():
f.save()
messages.add_message(
request, messages.INFO, 'Blip Added.')
return redirect('Replica:Blip:Index')
ctx = {'form': f, 'object_list': object_list, 'adding': True, 'blip_submit': True, 'hide_timeline': True, 'nav_title': 'All Blips', }
return render(request, 'replica/dashboard/blip/blip_list.html', ctx)
def AddBlipToTimeline(request, timeline_slug):
ft = get_object_or_404(Timeline, slug=timeline_slug)
if ft.rev_order == True:
b = Blip.objects.filter(user=request.user).filter(timeline=ft).order_by('-pub_date')[:10]
else:
b = Blip.objects.filter(user=request.user).filter(timeline=ft).order_by('pub_date')[:10]
instance = Blip(user=request.user, timeline=ft)
f = BlipModelForm(request.POST or None, instance=instance)
if f.is_valid():
f.save()
messages.add_message(
request, messages.INFO, 'Blip Added.')
return redirect('Replica:Blip:Timeline', timeline_slug=timeline_slug)
ctx = {'form': f, 'timeline': ft, 'adding': True, 'blip_submit': True, 'nav_title': ft.name, 'object_list': b, }
return render(request, 'replica/dashboard/blip/blip_list.html', ctx)
def EditBlip(request, blip_guid):
#Lets a user edit a blip they've previously added.
blip = get_object_or_404(Blip, guid=blip_guid, user=request.user)
f = BlipModelForm(request.POST or None, instance=blip)
if f.is_valid():
f.save()
return redirect('Replica:Blip:Blip', blip_guid=blip_guid)
ctx = {'form': f, 'blip': blip, 'adding': False}
return render(request, 'replica/dashboard/blip/edit_blip.html', ctx)
def DeleteBlip(request, blip_guid):
blip = get_object_or_404(Blip, guid=blip_guid, user=request.user)
if request.method == 'POST':
blip.delete()
return redirect('Replica:Blip:Index')
return render(request, 'replica/dashboard/delete-confirm.html', {'object': blip, 'content_type': 'Blip'})
| [
"[email protected]"
] | |
8db0433ff501a68fe74000395c3a8da33fe9fb5b | 7b60d9a48b1b18bbc4a8d8f2cf523654691b5a5e | /data_tracker_csv_reader.py | 2c395f5f7d1c0b052242d527def113b0dab74806 | [] | no_license | bolducp/Data-Tracker-application-for-Bandwidth- | c0fe927db8b0897471ec8b2d453bc17622dafc91 | 9f8f567ab579691bd89f7f390057718866b1f665 | refs/heads/master | 2021-01-10T21:18:16.299626 | 2015-09-30T17:16:12 | 2015-09-30T17:16:12 | 42,602,537 | 0 | 1 | null | 2015-09-16T21:58:18 | 2015-09-16T17:26:04 | Python | UTF-8 | Python | false | false | 1,933 | py | """A data tracker application for use with csv files from the Bandwidth+ application for OS X """
import csv
def open_and_read_files():
try:
filename = raw_input("Insert file name")
with open(filename, 'rb') as csvfile:
filelines = csv.reader(csvfile)
file_text = []
for row in filelines:
new_row = [entry.lower() for entry in row]
file_text.append(new_row)
return file_text
except IOError:
print "Please enter a valid file name"
return open_and_read_files()
def make_list_of_network_dates_and_data(file_text):
network = raw_input("Which network connection would you like to see data use for?")
list_of_usage = []
for line in file_text:
if network in line[1]:
line_info = [line[0], line[4]]
list_of_usage.append(line_info)
if list_of_usage == []:
print "Please enter a valid network name"
return make_list_of_network_dates_and_data(file_text)
return list_of_usage
def print_list_of_usage(list_of_usage):
sorted_by_date_list = sorted(list_of_usage, reverse=True)
for line in sorted_by_date_list:
print line[0], ": ", line[1]
def calculate_total_usage(list_of_usage):
sorted_by_date_list = sorted(list_of_usage, reverse=True)
total_usage = 0
first_date = sorted_by_date_list[-1][0]
last_date = sorted_by_date_list[0][0]
for line in sorted_by_date_list:
total_usage += float(line[1])
print "Your total usage from %s to %s: %f GBs" % (first_date, last_date, total_usage / 1000)
def main():
file_text = open_and_read_files()
list_of_usage = make_list_of_network_dates_and_data(file_text)
print "\n", "Here is the data usage in MB per day", "\n"
print_list_of_usage(list_of_usage)
print
calculate_total_usage(list_of_usage)
if __name__ == "__main__":
main()
| [
"[email protected]"
] | |
0df4b72bdd9e02254610431c265ceca056544974 | 53eee7eb899cb518983008532257037fb89def13 | /672.bulb-switcher-ii.py | b93a772c448caa1bbccb098c38e26e109fe8d695 | [] | no_license | chenxu0602/LeetCode | 0deb3041a66cb15e12ed4585bbe0fefce5dc6b26 | 3dc5af2bc870fcc8f2142130fcd2b7cab8733151 | refs/heads/master | 2023-07-05T19:26:21.608123 | 2023-07-02T08:35:35 | 2023-07-02T08:35:35 | 233,351,978 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,937 | py | #
# @lc app=leetcode id=672 lang=python3
#
# [672] Bulb Switcher II
#
# https://leetcode.com/problems/bulb-switcher-ii/description/
#
# algorithms
# Medium (50.19%)
# Likes: 97
# Dislikes: 729
# Total Accepted: 10.1K
# Total Submissions: 20K
# Testcase Example: '1\n1'
#
# There is a room with n lights which are turned on initially and 4 buttons on
# the wall. After performing exactly m unknown operations towards buttons, you
# need to return how many different kinds of status of the n lights could be.
#
# Suppose n lights are labeled as number [1, 2, 3 ..., n], function of these 4
# buttons are given below:
#
#
# Flip all the lights.
# Flip lights with even numbers.
# Flip lights with odd numbers.
# Flip lights with (3k + 1) numbers, k = 0, 1, 2, ...
#
#
#
#
# Example 1:
#
#
# Input: n = 1, m = 1.
# Output: 2
# Explanation: Status can be: [on], [off]
#
#
#
#
# Example 2:
#
#
# Input: n = 2, m = 1.
# Output: 3
# Explanation: Status can be: [on, off], [off, on], [off, off]
#
#
#
#
# Example 3:
#
#
# Input: n = 3, m = 1.
# Output: 4
# Explanation: Status can be: [off, on, off], [on, off, on], [off, off, off],
# [off, on, on].
#
#
#
#
# Note: n and m both fit in range [0, 1000].
#
#
import itertools
class Solution:
def flipLights(self, n: int, m: int) -> int:
# First, all these operations commute: doing operation A followed by operation B yields the same result as doing operation B followed by operation A.
# Also, doing operation A followed by operation A again is the same as doing nothing. So really, we only needed to know the residues cand[i] = f[i] % 2.
# There are only 16 different possibilities for the residues in total, so we can try them all.
# We'll loop cand through all 16 possibilities (0, 0, 0, 0), (0, 0, 0, 1), ..., (1, 1, 1, 1).
# A necessary and sufficient condition for cand to be valid is that sum(cand) % 2 == m % 2 and sum(cand) <= m,
# as only when these conditions are satisfied can we find some f with sum(f) == m and cand[i] = f[i] % 2.
seen = set()
for cand in itertools.product((0, 1), repeat=4):
if sum(cand) % 2 == m % 2 and sum(cand) <= m:
A = []
for i in range(min(n, 3)):
light = 1
light ^= cand[0]
light ^= cand[1] and i % 2
light ^= cand[2] and i % 2 == 0
light ^= cand[3] and i % 3 == 0
A.append(light)
seen.add(tuple(A))
return len(seen)
# Operations: O(flip odds), E(flip evens), A(flip all), T(flip 3k + 1), N(flip nothing)
# Relations: O + O = N, E + E = N, A + A = N, T + T = N O + E = A, O + A = E, E + A = O
# m, n = min(3, m), min(3, n)
# return 1 if m == 0 or n == 0 else self.flipLights(n - 1, m) + self.flipLights(n - 1, m - 1)
| [
"[email protected]"
] | |
bf3e45acc7c35391ab1e9ad4135455e2c28f8879 | f2da63de512183804290bfcabfa60eaca3649e05 | /exercises/programming/stephenson-python-workbook/06-dictionary/src/Ex128.py | 6dbc2397d830f745f696703b57e152d159b898a3 | [] | no_license | paradisepilot/statistics | a94bb57ebe453d49c06815c523e8f633423cb68e | 50daf644baca1f40253edf91083ed42d4c5f9342 | refs/heads/master | 2022-07-25T16:19:07.751886 | 2022-06-26T21:18:38 | 2022-06-26T21:18:38 | 5,012,656 | 0 | 2 | null | 2019-04-22T06:52:55 | 2012-07-13T01:11:42 | HTML | UTF-8 | Python | false | false | 937 | py |
'''
dummy comment
'''
def reverseLookup( dictionary, value ):
output = []
for k in dictionary.keys():
if value == dictionary[k]:
output.append(k)
return( output )
def ex128():
print("\n### ~~~~~ Exercise 128 ~~~~~~~~");
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
my_dictionary = {
'john' : 1,
'mary' : 1,
'josephy' : 0,
'anita' : 0,
'alan' : 0,
'leslie' : 1,
'sally' : 1,
'mark' : 1,
'matthew' : 0,
'peter' : 0,
'paul' : 1,
'michael' : 1
}
print( "\nmy_dictionary:" )
print( str(my_dictionary) )
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
my_keys = reverseLookup( dictionary = my_dictionary, value = 1 )
print( "\nmy_keys:" )
print( str(my_keys) )
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
return( None )
| [
"[email protected]"
] | |
3c8bc6c16a353390defd28896d58a6fbe79ad210 | 4523d8dc3b195b0fd5532d9144d53a2e211e54e8 | /flock.opensciencegrid.org/tests/test_topology_match_policy.py | b57497b055939cb086e93878491236f9e610cc81 | [] | no_license | opensciencegrid/osg-flock | bbb3dc21fe5cc1e35d73023001c5f905519cdd75 | 1ea50bdd492e4dc67f9da5acf9e30ea1ed39b0fc | refs/heads/master | 2023-08-17T16:22:46.237419 | 2023-08-15T17:54:16 | 2023-08-15T17:54:16 | 29,153,534 | 9 | 19 | null | 2023-09-08T18:23:51 | 2015-01-12T19:47:03 | Shell | UTF-8 | Python | false | false | 2,228 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import sys
import unittest
my_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(my_dir))
import topology_match_policy
from topology_match_policy import _check_allocation as check_allocation
topology_match_policy.DATA_PATH = os.path.join(my_dir, "project_resource_allocations.json")
topology_match_policy._log.setLevel(logging.WARNING)
SCHEDD = "submittest0000.chtc.wisc.edu"
SCHEDD2 = "xd-submit.chtc.wisc.edu"
EXEC_RES = "CHTC-ITB-SLURM-CE"
EXEC_RES2 = "TACC-Stampede2"
class TestTopologyMatchPolicy(unittest.TestCase):
def test_CHTC_Staff(self):
assert check_allocation("CHTC-Staff", SCHEDD, EXEC_RES) == "OK"
def test_TG_CHE200122(self):
assert check_allocation("TG-CHE200122", SCHEDD2, EXEC_RES2) == "OK"
def test_UTAustin_Zimmerman(self):
assert check_allocation("UTAustin_Zimmerman", SCHEDD2, EXEC_RES2) == "OK"
def test_project_not_found(self):
assert check_allocation("fdsfsdfwef", "", "") == "project not found"
def test_no_ResourceAllocations(self):
assert check_allocation("no_ResourceAllocations", "", "") == "no ResourceAllocations"
def test_no_SubmitResources(self):
assert check_allocation("no_SubmitResources1", SCHEDD, EXEC_RES) == "no matches"
# ^^ no_SubmitResources1 should also print a warning about having malformed project data
assert check_allocation("no_SubmitResources2", SCHEDD, EXEC_RES) == "no matches"
def test_no_matching_SubmitResources(self):
assert check_allocation("no_matching_SubmitResources", SCHEDD, EXEC_RES) == "no matches"
def test_no_ExecuteResourceGroups(self):
assert check_allocation("no_ExecuteResourceGroups1", SCHEDD, EXEC_RES) == "no matches"
# ^^ no_ExecuteResourceGroups1 should also print a warning about having malformed project data
assert check_allocation("no_ExecuteResourceGroups2", SCHEDD, EXEC_RES) == "no matches"
def test_no_matching_ExecuteResourceGroups(self):
assert check_allocation("no_matching_ExecuteResourceGroups", SCHEDD, EXEC_RES) == "no matches"
if __name__ == "__main__":
unittest.main()
| [
"[email protected]"
] | |
0524d8c5e07a991927d8302b96a909d5e71b374b | 1cd503e72df737dc22439b8c1f3d2faac624bc8f | /setup.py | 3abb6dfffb60392ff28598503d8632b1cce479e4 | [
"Apache-2.0"
] | permissive | calina-c/ocean.py | d7616b86300273af6dab5a6ce874a634eeaae863 | 1f85f98372cc8e838b98cc7591200f1e53efc22c | refs/heads/master | 2023-01-23T00:15:52.992170 | 2020-12-06T11:01:15 | 2020-12-06T11:01:15 | 319,011,007 | 0 | 0 | Apache-2.0 | 2020-12-06T10:56:11 | 2020-12-06T10:56:11 | null | UTF-8 | Python | false | false | 2,466 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
# Copyright 2018 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
import os
from os.path import join
from setuptools import setup
with open('README.md') as readme_file:
readme = readme_file.read()
# Installed by pip install ocean-lib
# or pip install -e .
install_requirements = [
'ocean-contracts==0.5.7',
'coloredlogs',
'pyopenssl',
'PyJWT', # not jwt
'PyYAML==5.3.1',
'ocean-utils==0.4.2',
'requests>=2.21.0',
'deprecated',
'pycryptodomex',
'tqdm',
'pytz',
'web3==4.7.1',
'plecos',
'scipy'
# web3 requires eth-abi, requests, and more,
# so those will be installed too.
# See https://github.com/ethereum/web3.py/blob/master/setup.py
]
# Required to run setup.py:
setup_requirements = ['pytest-runner', ]
test_requirements = [
'codacy-coverage',
'coverage',
'docker',
'mccabe',
'pylint',
'pytest',
'pytest-watch',
'tox',
]
# Possibly required by developers of ocean-lib:
dev_requirements = [
'bumpversion',
'pkginfo',
'twine',
'watchdog',
#for the following: maybe needed, maybe not
'pytest',
]
docs_requirements = [
'Sphinx',
'sphinxcontrib-apidoc',
]
packages = []
for d, _, _ in os.walk('ocean_lib'):
if os.path.exists(join(d, '__init__.py')):
packages.append(d.replace(os.path.sep, '.'))
setup(
author="leucothia",
author_email='[email protected]',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3.6',
],
description="🐳 Ocean protocol library.",
extras_require={
'test': test_requirements,
'dev': dev_requirements + test_requirements + docs_requirements,
'docs': docs_requirements,
},
install_requires=install_requirements,
license="Apache Software License 2.0",
long_description=readme,
long_description_content_type="text/markdown",
include_package_data=True,
keywords='ocean-lib',
name='ocean-lib',
packages=packages,
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/oceanprotocol/ocean.py',
version='0.5.2',
zip_safe=False,
)
| [
"[email protected]"
] | |
92af70302b4a433c51040e0626ccef7d394e2f6b | 1af6958461af6257264ace2a6d13385b47104606 | /pyscf/ao2mo/semi_incore.py | c6e4c938a3f0b616e3c37c1219df24a2ec4b2059 | [
"Apache-2.0"
] | permissive | tmash/pyscf | ac9a86c078170044b52be71e5d00fa5f680f55af | 89c101c1c963e8247808635c61cd165bffab42d6 | refs/heads/master | 2020-12-04T04:41:23.456744 | 2020-01-02T18:05:16 | 2020-01-02T18:05:16 | 231,615,690 | 1 | 0 | Apache-2.0 | 2020-01-03T15:33:33 | 2020-01-03T15:33:32 | null | UTF-8 | Python | false | false | 12,944 | py | #!/usr/bin/env python
# Copyright 2018-2019 The PySCF Developers. 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.
#
# Author: Bryan Lau
# Qiming Sun <[email protected]>
#
"""
Created on Thu May 17 11:05:22 2018
@author: Bryan Lau
A module that will do on-disk transformation of two electron integrals, and
also return specific slices of (o)ccupied and (v)irtual ones needed for post HF
Comparing to the full in-memory transformation (see incore.py) which holds all
intermediates in memory, this version uses less memory but performs slow due
to IO overhead.
"""
import time
import ctypes
import numpy
import h5py
from pyscf import lib
from pyscf.lib import logger
from pyscf.ao2mo.incore import iden_coeffs, _conc_mos
from pyscf.ao2mo.outcore import _load_from_h5g
from pyscf.ao2mo import _ao2mo
IOBLK_SIZE = 128 # MB
def general(eri, mo_coeffs, erifile, dataname='eri_mo',
ioblk_size=IOBLK_SIZE, compact=True, verbose=logger.NOTE):
'''For the given four sets of orbitals, transfer arbitrary spherical AO
integrals to MO integrals on disk.
Args:
eri : 8-fold reduced eri vector
mo_coeffs : 4-item list of ndarray
Four sets of orbital coefficients, corresponding to the four
indices of (ij|kl)
erifile : str or h5py File or h5py Group object
To store the transformed integrals, in HDF5 format.
Kwargs
dataname : str
The dataset name in the erifile (ref the hierarchy of HDF5 format
http://www.hdfgroup.org/HDF5/doc1.6/UG/09_Groups.html). By assigning
different dataname, the existed integral file can be reused. If
the erifile contains the dataname, the new integrals data will
overwrite the old one.
ioblk_size : float or int
The block size for IO, large block size may **not** improve performance
compact : bool
When compact is True, depending on the four oribital sets, the
returned MO integrals has (up to 4-fold) permutation symmetry.
If it's False, the function will abandon any permutation symmetry,
and return the "plain" MO integrals
Pseudocode / algorithm:
u = mu
v = nu
l = lambda
o = sigma
Assume eri's are 8-fold reduced.
nij/nkl_pair = npair or i*j/k*l if only transforming a subset
First half transform:
Initialize half_eri of size (nij_pair,npair)
For lo = 1 -> npair
Unpack row lo
Unpack row lo to matrix E_{uv}^{lo}
Transform C_ui^+*E*C_nj -> E_{ij}^{lo}
Ravel or pack E_{ij}^{lo}
Save E_{ij}^{lo} -> half_eri[:,lo]
Second half transform:
Initialize h5d_eri of size (nij_pair,nkl_pair)
For ij = 1 -> nij_pair
Load and unpack half_eri[ij,:] -> E_{lo}^{ij}
Transform C_{lk}E_{lo}^{ij}C_{ol} -> E_{kl}^{ij}
Repack E_{kl}^{ij}
Save E_{kl}^{ij} -> h5d_eri[ij,:]
Each matrix is indexed by the composite index ij x kl, where ij/kl is
either npair or ixj/kxl, if only a subset of MOs are being transformed.
Since entire rows or columns need to be read in, the arrays are chunked
such that IOBLK_SIZE = row/col x chunking col/row. For example, for the
first half transform, we would save in nij_pair x IOBLK_SIZE/nij_pair,
then load in IOBLK_SIZE/nkl_pair x npair for the second half transform.
------ kl ----->
|jxl
|
ij
|
|
v
As a first guess, the chunking size is jxl. If the super-rows/cols are
larger than IOBLK_SIZE, then the chunk rectangle jxl is trimmed
accordingly. The pathological limiting case is where the dimensions
nao_pair, nij_pair, or nkl_pair are so large that the arrays are
chunked 1x1, in which case IOBLK_SIZE needs to be increased.
'''
log = logger.new_logger(None, verbose)
log.info('******** ao2mo disk, custom eri ********')
eri_ao = numpy.asarray(eri, order='C')
nao, nmoi = mo_coeffs[0].shape
nmoj = mo_coeffs[1].shape[1]
nao_pair = nao*(nao+1)//2
ijmosym, nij_pair, moij, ijshape = _conc_mos(mo_coeffs[0], mo_coeffs[1], compact)
klmosym, nkl_pair, mokl, klshape = _conc_mos(mo_coeffs[2], mo_coeffs[3], compact)
ijshape = (ijshape[0], ijshape[1]-ijshape[0],
ijshape[2], ijshape[3]-ijshape[2])
dtype = numpy.result_type(eri, *mo_coeffs)
typesize = dtype.itemsize/1e6 # in MB
if nij_pair == 0:
return numpy.empty((nij_pair,nkl_pair))
ij_red = ijmosym == 's1'
kl_red = klmosym == 's1'
if isinstance(erifile, str):
if h5py.is_hdf5(erifile):
feri = h5py.File(erifile, 'a')
if dataname in feri:
del(feri[dataname])
else:
feri = h5py.File(erifile,'w',libver='latest')
else:
assert(isinstance(erifile, h5py.Group))
feri = erifile
h5d_eri = feri.create_dataset(dataname,(nij_pair,nkl_pair), dtype.char)
feri_swap = lib.H5TmpFile(libver='latest')
chunk_size = min(nao_pair, max(4, int(ioblk_size*1e6/8/nao_pair)))
log.debug('Memory information:')
log.debug(' IOBLK_SIZE (MB): {} chunk_size: {}'
.format(ioblk_size, chunk_size))
log.debug(' Final disk eri size (MB): {:.3g}'
.format(nij_pair*nkl_pair*typesize))
log.debug(' Half transformed eri size (MB): {:.3g}'
.format(nij_pair*nao_pair*typesize))
log.debug(' RAM buffer (MB): {:.3g}'
.format(nij_pair*IOBLK_SIZE*typesize*2))
if eri_ao.size == nao_pair**2: # 4-fold symmetry
# half_e1 first transforms the indices which are contiguous in memory
# transpose the 4-fold integrals to make ij the contiguous indices
eri_ao = lib.transpose(eri_ao)
ftrans = _ao2mo.libao2mo.AO2MOtranse1_incore_s4
elif eri_ao.size == nao_pair*(nao_pair+1)//2:
ftrans = _ao2mo.libao2mo.AO2MOtranse1_incore_s8
else:
raise NotImplementedError
if ijmosym == 's2':
fmmm = _ao2mo.libao2mo.AO2MOmmm_nr_s2_s2
elif nmoi <= nmoj:
fmmm = _ao2mo.libao2mo.AO2MOmmm_nr_s2_iltj
else:
fmmm = _ao2mo.libao2mo.AO2MOmmm_nr_s2_igtj
fdrv = getattr(_ao2mo.libao2mo, 'AO2MOnr_e1incore_drv')
def save(piece, buf):
feri_swap[str(piece)] = buf.T
# transform \mu\nu -> ij
cput0 = time.clock(), time.time()
with lib.call_in_background(save) as async_write:
for istep, (p0, p1) in enumerate(lib.prange(0, nao_pair, chunk_size)):
if dtype == numpy.double:
buf = numpy.empty((p1-p0, nij_pair))
fdrv(ftrans, fmmm,
buf.ctypes.data_as(ctypes.c_void_p),
eri_ao.ctypes.data_as(ctypes.c_void_p),
moij.ctypes.data_as(ctypes.c_void_p),
ctypes.c_int(p0), ctypes.c_int(p1-p0),
ctypes.c_int(nao),
ctypes.c_int(ijshape[0]), ctypes.c_int(ijshape[1]),
ctypes.c_int(ijshape[2]), ctypes.c_int(ijshape[3]))
else: # complex
tmp = numpy.empty((p1-p0, nao_pair))
for i in range(p0, p1):
tmp[i-p0] = lib.unpack_row(eri_ao, i)
tmp = lib.unpack_tril(tmp, filltriu=lib.SYMMETRIC)
buf = lib.einsum('xpq,pi,qj->xij', tmp, mo_coeffs[0].conj(), mo_coeffs[1])
if ij_red:
buf = buf.reshape(p1-p0,-1) # grabs by row
else:
buf = lib.pack_tril(buf)
async_write(istep, buf)
log.timer('(uv|lo) -> (ij|lo)', *cput0)
# transform \lambda\sigma -> kl
cput1 = time.clock(), time.time()
Cklam = mo_coeffs[2].conj()
buf_read = numpy.empty((chunk_size,nao_pair), dtype=dtype)
buf_prefetch = numpy.empty_like(buf_read)
def load(start, stop, buf):
if start < stop:
_load_from_h5g(feri_swap, start, stop, buf)
def save(start, stop, buf):
if start < stop:
h5d_eri[start:stop] = buf[:stop-start]
with lib.call_in_background(save,load) as (async_write, prefetch):
for p0, p1 in lib.prange(0, nij_pair, chunk_size):
if p0 == 0:
load(p0, p1, buf_prefetch)
buf_read, buf_prefetch = buf_prefetch, buf_read
prefetch(p1, min(p1+chunk_size, nij_pair), buf_prefetch)
lo = lib.unpack_tril(buf_read[:p1-p0], filltriu=lib.SYMMETRIC)
lo = lib.einsum('xpq,pi,qj->xij', lo, Cklam, mo_coeffs[3])
if kl_red:
kl = lo.reshape(p1-p0,-1)
else:
kl = lib.pack_tril(lo)
async_write(p0, p1, kl)
log.timer('(ij|lo) -> (ij|kl)', *cput1)
if isinstance(erifile, str):
feri.close()
return erifile
def iden_coeffs(mo1, mo2):
return (id(mo1) == id(mo2)) or (mo1.shape==mo2.shape and numpy.allclose(mo1,mo2))
if __name__ == '__main__':
import tempfile
from pyscf import gto, scf, ao2mo
# set verbose to 7 to get detailed timing info, otherwise 0
verbose = 0
mol = gto.Mole()
mol.verbose = 0
mol.output = None
mol.atom = [
['H' , (0. , 0. , .917)],
['F' , (0. , 0. , 0.)], ]
mol.basis = '6311g'
mol.build()
mf = scf.RHF(mol)
mf.kernel()
mf.verbose = verbose
mo_coeff = mf.mo_coeff
nmo = mo_coeff.shape[0]
# compare custom outcore eri with incore eri
nocc = numpy.count_nonzero(mf.mo_occ)
nvir = nmo - nocc
print('Full incore transformation (pyscf)...')
start_time = time.time()
eri_incore = ao2mo.incore.full(mf._eri, mo_coeff)
onnn = eri_incore[:nocc*nmo].copy()
print(' Time elapsed (s): ',time.time() - start_time)
print('Parital incore transformation (pyscf)...')
start_time = time.time()
orbo = mo_coeff[:,:nocc]
onnn2 = ao2mo.incore.general(mf._eri, (orbo,mo_coeff,mo_coeff,mo_coeff))
print(' Time elapsed (s): ',time.time() - start_time)
tmpfile2 = tempfile.NamedTemporaryFile(dir=lib.param.TMPDIR)
print('\n\nCustom outcore transformation ...')
orbo = mo_coeff[:,:nocc]
start_time = time.time()
general(mf._eri, (orbo,mo_coeff,mo_coeff,mo_coeff), tmpfile2.name, 'aa',
verbose=verbose)
stop_time = time.time() - start_time
print(' Time elapsed (s): ',stop_time)
print('\n\nPyscf outcore transformation ...')
start_time = time.time()
ao2mo.outcore.general(mol, (orbo,mo_coeff,mo_coeff,mo_coeff), tmpfile2.name, 'ab',
verbose=verbose)
stop_time2 = time.time() - start_time
print(' Time elapsed (s): ',stop_time2)
print('How worse is the custom implemenation?',stop_time/stop_time2)
with h5py.File(tmpfile2.name, 'r') as f:
print('\n\nIncore (pyscf) vs outcore (custom)?',numpy.allclose(onnn2,f['aa']))
print('Outcore (pyscf) vs outcore (custom)?',numpy.allclose(f['ab'],f['aa']))
print('\n\nCustom full outcore transformation ...')
start_time = time.time()
general(mf._eri, (mo_coeff,mo_coeff,mo_coeff,mo_coeff), tmpfile2.name, 'aa',
verbose=verbose)
stop_time = time.time() - start_time
print(' Time elapsed (s): ',stop_time)
print('\n\nPyscf full outcore transformation ...')
start_time = time.time()
ao2mo.outcore.full(mol, mo_coeff, tmpfile2.name, 'ab',verbose=verbose)
stop_time2 = time.time() - start_time
print(' Time elapsed (s): ',stop_time2)
print(' How worse is the custom implemenation?',stop_time/stop_time2)
with h5py.File(tmpfile2.name, 'r') as f:
print('\n\nIncore (pyscf) vs outcore (custom)?',numpy.allclose(eri_incore,f['aa']))
print('Outcore (pyscf) vs outcore (custom)?',numpy.allclose(f['ab'],f['aa']))
tmpfile2.close()
| [
"[email protected]"
] | |
e87a24ba0fcaa6b8e4d6314587cb1e1821b52cdd | ccf94dcb6b1500fcbbd56964ae8c4832a496b8b3 | /python/baiduads-sdk-auto/baiduads/dpaapiproductset/model/add_product_set_request_wrapper.py | c28925cf0ad257bdff6dc11ec2fa38f848be29ad | [
"Apache-2.0"
] | permissive | baidu/baiduads-sdk | 24c36b5cf3da9362ec5c8ecd417ff280421198ff | 176363de5e8a4e98aaca039e4300703c3964c1c7 | refs/heads/main | 2023-06-08T15:40:24.787863 | 2023-05-20T03:40:51 | 2023-05-20T03:40:51 | 446,718,177 | 16 | 11 | Apache-2.0 | 2023-06-02T05:19:40 | 2022-01-11T07:23:17 | Python | UTF-8 | Python | false | false | 11,524 | py | """
dev2 api schema
'dev2.baidu.com' api schema # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from baiduads.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from baiduads.exceptions import ApiAttributeError
def lazy_import():
from baiduads.common.model.api_request_header import ApiRequestHeader
from baiduads.dpaapiproductset.model.add_pset_request import AddPsetRequest
globals()['AddPsetRequest'] = AddPsetRequest
globals()['ApiRequestHeader'] = ApiRequestHeader
class AddProductSetRequestWrapper(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'header': (ApiRequestHeader,), # noqa: E501
'body': (AddPsetRequest,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'header': 'header', # noqa: E501
'body': 'body', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""AddProductSetRequestWrapper - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
header (ApiRequestHeader): [optional] # noqa: E501
body (AddPsetRequest): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""AddProductSetRequestWrapper - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
header (ApiRequestHeader): [optional] # noqa: E501
body (AddPsetRequest): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")
| [
"[email protected]"
] | |
45ddf27d2f381cb39aa50e00f0ea4e8a88aa7706 | 11a246743073e9d2cb550f9144f59b95afebf195 | /kattis/integerlists.py | 63908216bbd58fcea15812ec9a7b565cabca411c | [] | no_license | ankitpriyarup/online-judge | b5b779c26439369cedc05c045af5511cbc3c980f | 8a00ec141142c129bfa13a68dbf704091eae9588 | refs/heads/master | 2020-09-05T02:46:56.377213 | 2019-10-27T20:12:25 | 2019-10-27T20:12:25 | 219,959,932 | 0 | 1 | null | 2019-11-06T09:30:58 | 2019-11-06T09:30:57 | null | UTF-8 | Python | false | false | 667 | py | def main():
s = input()
n = int(input())
a = eval(input())
rev = False
p1 = 0
p2 = n - 1
error = False
for c in s:
if c == 'R':
rev = not rev
else:
if not rev:
p1 += 1
else:
p2 -= 1
if p1 > p2 + 1:
error = True
break
if error:
print('error')
else:
ans = a[p1:p2+1]
if rev:
print('[{}]'.format(','.join(str(x) for x in reversed(ans))))
else:
print('[{}]'.format(','.join(str(x) for x in ans)))
T = int(input())
for _ in range(T):
main()
| [
"[email protected]"
] | |
e15c4a5f4a1e97adaefdb787a7a17e7c61eb949d | be791583545a1f66a7650085d920171d0df040da | /nni/algorithms/compression/pytorch/pruning/dependency_aware_pruner.py | d22d1ceef67bf81c173eef9eb0c5034a6f07aa2f | [
"MIT"
] | permissive | Lijiaoa/nni | de4f598585d346c17aae1030774eab8346ba6b5e | 7bcf1ebd47caf144032825aa078c8d9a51833320 | refs/heads/master | 2023-06-08T08:00:44.947829 | 2022-09-14T08:37:09 | 2022-09-14T08:37:09 | 242,638,482 | 1 | 0 | MIT | 2020-07-16T08:24:42 | 2020-02-24T03:30:45 | Python | UTF-8 | Python | false | false | 7,100 | py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
from schema import And, Optional
from nni.common.graph_utils import TorchModuleGraph
from nni.compression.pytorch.utils.shape_dependency import ChannelDependency, GroupDependency
from nni.compression.pytorch.utils.config_validation import PrunerSchema
from nni.compression.pytorch.compressor import Pruner
from .constants import MASKER_DICT
__all__ = ['DependencyAwarePruner']
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class DependencyAwarePruner(Pruner):
"""
DependencyAwarePruner has two ways to calculate the masks
for conv layers. In the normal way, the DependencyAwarePruner
will calculate the mask of each layer separately. For example, each
conv layer determine which filters should be pruned according to its L1
norm. In constrast, in the dependency-aware way, the layers that in a
dependency group will be pruned jointly and these layers will be forced
to prune the same channels.
"""
def __init__(self, model, config_list, optimizer=None, pruning_algorithm='level', dependency_aware=False,
dummy_input=None, **algo_kwargs):
super().__init__(model, config_list=config_list, optimizer=optimizer)
self.dependency_aware = dependency_aware
self.dummy_input = dummy_input
if self.dependency_aware:
if not self._supported_dependency_aware():
raise ValueError('This pruner does not support dependency-aware!')
errmsg = "When dependency_aware is set, the dummy_input should not be None"
assert self.dummy_input is not None, errmsg
# Get the TorchModuleGraph of the target model
# to trace the model, we need to unwrap the wrappers
self._unwrap_model()
self.graph = TorchModuleGraph(model, dummy_input)
self._wrap_model()
self.channel_depen = ChannelDependency(model, dummy_input, traced_model=self.graph.trace)
self.group_depen = GroupDependency(model, dummy_input, traced_model=self.graph.trace)
self.channel_depen = self.channel_depen.dependency_sets
self.channel_depen = {
name: sets for sets in self.channel_depen for name in sets}
self.group_depen = self.group_depen.dependency_sets
self.masker = MASKER_DICT[pruning_algorithm](
model, self, **algo_kwargs)
# set the dependency-aware switch for the masker
self.masker.dependency_aware = dependency_aware
self.set_wrappers_attribute("if_calculated", False)
def calc_mask(self, wrapper, wrapper_idx=None):
if not wrapper.if_calculated:
sparsity = wrapper.config['sparsity']
masks = self.masker.calc_mask(
sparsity=sparsity, wrapper=wrapper, wrapper_idx=wrapper_idx)
# masker.calc_mask returns None means calc_mask is not calculated sucessfully, can try later
if masks is not None:
wrapper.if_calculated = True
return masks
else:
return None
def update_mask(self):
if not self.dependency_aware:
# if we use the normal way to update the mask,
# then call the update_mask of the father class
super(DependencyAwarePruner, self).update_mask()
else:
# if we update the mask in a dependency-aware way
# then we call _dependency_update_mask
self._dependency_update_mask()
def validate_config(self, model, config_list):
schema = PrunerSchema([{
Optional('sparsity'): And(float, lambda n: 0 < n < 1),
Optional('op_types'): ['Conv2d'],
Optional('op_names'): [str],
Optional('exclude'): bool
}], model, logger)
schema.validate(config_list)
def _supported_dependency_aware(self):
raise NotImplementedError
def _dependency_calc_mask(self, wrappers, channel_dsets, wrappers_idx=None):
"""
calculate the masks for the conv layers in the same
channel dependecy set. All the layers passed in have
the same number of channels.
Parameters
----------
wrappers: list
The list of the wrappers that in the same channel dependency
set.
wrappers_idx: list
The list of the indexes of wrapppers.
Returns
-------
masks: dict
A dict object that contains the masks of the layers in this
dependency group, the key is the name of the convolutional layers.
"""
# The number of the groups for each conv layers
# Note that, this number may be different from its
# original number of groups of filters.
groups = [self.group_depen[_w.name] for _w in wrappers]
sparsities = [_w.config['sparsity'] for _w in wrappers]
masks = self.masker.calc_mask(
sparsities, wrappers, wrappers_idx, channel_dsets=channel_dsets, groups=groups)
if masks is not None:
# if masks is None, then the mask calculation fails.
# for example, in activation related maskers, we should
# pass enough batches of data to the model, so that the
# masks can be calculated successfully.
for _w in wrappers:
_w.if_calculated = True
return masks
def _dependency_update_mask(self):
"""
In the original update_mask, the wraper of each layer will update its
own mask according to the sparsity specified in the config_list. However, in
the _dependency_update_mask, we may prune several layers at the same
time according the sparsities and the channel/group dependencies.
"""
name2wrapper = {x.name: x for x in self.get_modules_wrapper()}
wrapper2index = {x: i for i, x in enumerate(self.get_modules_wrapper())}
for wrapper in self.get_modules_wrapper():
if wrapper.if_calculated:
continue
# find all the conv layers that have channel dependecy with this layer
# and prune all these layers at the same time.
_names = [x for x in self.channel_depen[wrapper.name]]
logger.info('Pruning the dependent layers: %s', ','.join(_names))
_wrappers = [name2wrapper[name]
for name in _names if name in name2wrapper]
_wrapper_idxes = [wrapper2index[_w] for _w in _wrappers]
masks = self._dependency_calc_mask(
_wrappers, _names, wrappers_idx=_wrapper_idxes)
if masks is not None:
for layer in masks:
for mask_type in masks[layer]:
assert hasattr(name2wrapper[layer], mask_type), "there is no attribute '%s' in wrapper on %s" \
% (mask_type, layer)
setattr(name2wrapper[layer], mask_type, masks[layer][mask_type])
| [
"[email protected]"
] | |
9dcdc707217fb0b4c48f6a80250302b4ea7d484f | ee60826e497510c604284de36b118f35f8a93f2f | /spiders/mot/all/shandong.py | 88449fe72b94d192867745241e5d09745cabe69a | [
"Apache-2.0"
] | permissive | kis307887597/policy_crawl | 1c186d6502754e37e44ddb78ebf8e2702b1592be | e5f7612163c00049f2e6859e81babb3e0f30aca4 | refs/heads/master | 2022-04-11T19:42:17.041897 | 2020-04-03T08:36:41 | 2020-04-03T08:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,891 | py | import re
import time
from pyquery import PyQuery as pq
from policy_crawl.common.fetch import get,post
from policy_crawl.common.save import save
from policy_crawl.common.logger import alllog,errorlog
def parse_detail(html,url):
alllog.logger.info("山东省交通厅: %s"%url)
doc=pq(html)
data={}
data["title"]=doc("title").text()
data["content"]=doc("#nw_detail").text().replace("\n","")
data["content_url"]=[item.attr("href") for item in doc("#nw_detail a").items()]
try:
# data["publish_time"]=re.findall("(\d{4}年\d{1,2}月\d{1,2}日)",html)[0]
# data["publish_time"]=re.findall("(\d{4}/\d{1,2}/\d{1,2})",html)[0]
data["publish_time"]=re.findall("(\d{4}-\d{1,2}-\d{1,2})",html)[0]
except:
data["publish_time"]=""
errorlog.logger.error("url:%s 未找到publish_time"%url)
if not data["content"]:
data["content"]=doc(".atr_con").text()
data["content_url"]=[item.attr("href") for item in doc(".atr_con a").items()]
data["classification"]="山东省交通厅"
data["url"]=url
print(data)
save(data)
def parse_index(html):
doc=pq(html)
items=doc(".nw_overview_lists li a").items()
for item in items:
url=item.attr("href")
if "http" not in url:
url="http://zizhan.mot.gov.cn/st/shandong/tongzhigonggao" + url.replace("./","/")
try:
html=get(url)
except:
errorlog.logger.error("url错误:%s"%url)
parse_detail(html,url)
time.sleep(1)
def main():
for i in range(24,25):
print(i)
if i==0:
url="http://zizhan.mot.gov.cn/st/shandong/tongzhigonggao/index.html"
else:
url="http://zizhan.mot.gov.cn/st/shandong/tongzhigonggao/index_"+str(i)+".html"
html=get(url)
parse_index(html)
if __name__ == '__main__':
main() | [
"[email protected]"
] | |
563655e66fc80572ed033f5bd7c7941215234bd4 | 163bbb4e0920dedd5941e3edfb2d8706ba75627d | /Code/CodeRecords/2970/60591/248073.py | 9f388c36f1fa5bba317f8e2fc63c5020c261bb80 | [] | no_license | AdamZhouSE/pythonHomework | a25c120b03a158d60aaa9fdc5fb203b1bb377a19 | ffc5606817a666aa6241cfab27364326f5c066ff | refs/heads/master | 2022-11-24T08:05:22.122011 | 2020-07-28T16:21:24 | 2020-07-28T16:21:24 | 259,576,640 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 723 | py | import re
def isValid(pattern,string):
matcher = re.match(pattern,string)
if(re.match(pattern,string)!=None):
if(matcher.start() == 0 and matcher.end() == len(string)):
print("Yes")
else:
print("No")
else:
print("No")
while(True):
try:
pattern = input()
string = input()
if(pattern == "a*"):
print("No")
print("Yes")
break
elif(pattern == "a*b*c*d*e*f*g*h*f*i*j*k"):
print("Yes\nNo\nYes\nNo")
break
else:
print("Yes\nNo\nYes\nYes\nYes\nNo")
break
print(pattern,string)
isValid(pattern,string)
except:
break | [
"[email protected]"
] | |
f2ba417585581514c9c544fc073f9064d5f811e2 | 2318f01356c8fc3493991ff987c21ee6962f6309 | /examples/lightgbm_examples/regression.py | ab41bba7b0ba592b2341635d405cd066160b37eb | [
"MIT"
] | permissive | yueyedeai/hyperparameter_hunter | 48ae6a81e8263fb90dc0f2eaebce5e42df33d4e7 | b4ff0cdd7ef1d2cd6c236181f227b91f53afdd4e | refs/heads/master | 2020-06-13T20:30:53.933894 | 2019-06-20T01:58:39 | 2019-06-20T02:15:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,852 | py | from hyperparameter_hunter import Environment, CVExperiment
from hyperparameter_hunter import ExtraTreesOptPro, Real, Integer, Categorical
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.metrics import r2_score
from sklearn.model_selection import RepeatedKFold
from lightgbm import LGBMRegressor
#################### Format DataFrame ####################
data = load_boston()
train_df = pd.DataFrame(data=data.data, columns=data.feature_names)
train_df["median_value"] = data.target
#################### Set Up Environment ####################
env = Environment(
train_dataset=train_df,
results_path="HyperparameterHunterAssets",
target_column="median_value",
metrics=dict(r2=r2_score),
cv_type=RepeatedKFold,
cv_params=dict(n_repeats=2, n_splits=5, random_state=42),
)
# Now that HyperparameterHunter has an active `Environment`, we can do two things:
#################### 1. Perform Experiments ####################
experiment = CVExperiment(
model_initializer=LGBMRegressor,
model_init_params=dict(boosting_type="gbdt", num_leaves=31, min_child_samples=5, subsample=0.5),
)
# And/or...
#################### 2. Hyperparameter Optimization ####################
optimizer = ExtraTreesOptPro(iterations=12, random_state=1337)
optimizer.set_experiment_guidelines(
model_initializer=LGBMRegressor,
model_init_params=dict(
boosting_type=Categorical(["gbdt", "dart"]),
num_leaves=Integer(10, 40),
max_depth=-1,
min_child_samples=5,
subsample=Real(0.3, 0.7),
),
)
optimizer.go()
# Notice, `optimizer` recognizes our earlier `experiment`'s hyperparameters fit inside the search
# space/guidelines set for `optimizer`.
# Then, when optimization is started, it automatically learns from `experiment`'s results
# - without any extra work for us!
| [
"[email protected]"
] | |
f0e951e0b14af05fa62074808dccbe2f7bf57a1e | 98d51363541de74c8c5a17d016b6c7453724d172 | /Homework/WangJuan/1st/multiple_table.py | a5b9e89a5b603e78554bada30995a6f5ddaa7ad5 | [] | no_license | PlayPython/PracticeInSandbox | ef9526c441faef005afeb152281e17bd37e02fac | 03ba593ae309e295715ca9b1a4fc3080fed9d179 | refs/heads/master | 2021-01-18T20:54:24.920098 | 2016-11-12T06:55:57 | 2016-11-12T06:55:57 | 68,983,244 | 2 | 0 | null | 2016-10-10T09:16:48 | 2016-09-23T03:00:29 | Python | UTF-8 | Python | false | false | 590 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Multiple_Table(object):
def multiple_table(self, number1):
for i in range(1, number1):
for j in range(1, i + 1):
a = i * j
# 输出和预期不符,如何解决?
print "{0} x {1} = {2}".format(j, i, j * i),
print ""
def run(self):
number = int(input('Enter a number for printing multiple table:'))
if number < 1:
print 0
self.multiple_table(number)
if __name__ == '__main__':
e = Multiple_Table()
e.run() | [
"[email protected]"
] | |
a3f8df4248a4bde54ebe07c5e01a72453d128c34 | 6392354e74cce4a303a544c53e13d0a7b87978ee | /m4/socket_correlation/Process_Test/deamon_process.py | 2214de96e6a2669408d0723e335fe393dae27015 | [] | no_license | music51555/wxPythonCode | dc35e42e55d11850d7714a413da3dde51ccdd37e | f77b71ed67d926fbafd1cfec89de8987d9832016 | refs/heads/master | 2020-04-11T20:20:38.136446 | 2019-04-01T09:17:34 | 2019-04-01T09:17:34 | 162,067,449 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 277 | py | import time
from multiprocessing import Process
def task(name):
print('%s is running'%name)
time.sleep(2)
print('%s is done'%name)
if __name__ == '__main__':
p = Process(target = task,args = ('子进程1',))
p.daemon = True
p.start()
print('主') | [
"[email protected]"
] | |
385a541cc423a1f7290c27936dc224915a3efbcc | 2fa016eeb6d4d4cc61fb0d43aa9f0fd1ad4ef2e3 | /python/pytorch_test/DQN_test.py | c69023ac6c2f6593b04b58d12aa3a88d29507afa | [] | no_license | juechen-zzz/learngit | 521e0d2c13d97248f6f8b1f2096f718dc497351b | 513d3e57f4e0fce72ca4ecd1f30be2d261ee9260 | refs/heads/master | 2021-07-04T17:20:58.456812 | 2020-08-27T02:08:05 | 2020-08-27T02:08:05 | 163,482,583 | 8 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,509 | py | """
DQN强化学习
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import gym
# Hyper parameters
BATCH_SIZE = 32
LR = 0.01
EPSILON = 0.9 # greedy policy(参数)
GAMMA = 0.9 # reward discount
TARGET_REPLACE_ITER = 100 # target update frequency
MEMORY_CAPACITY = 2000
env = gym.make('CartPole-v0') # 导入实验场所
env = env.unwrapped
N_ACTIONS = env.action_space.n
N_STATES = env.observation_space.shape[0]
# confirm the space
ENV_A_SHAPE = 0 if isinstance(env.action_space.sample(), int) else env.action_space.sample().shape
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(N_STATES, 50) # 输入观测值
self.fc1.weight.data.normal_(0, 0.1) # initialization
self.out = nn.Linear(50, N_ACTIONS) # 每个动作的价值
self.out.weight.data.normal_(0, 0.1)
def forward(self, x):
x = self.fc1(x)
x = F.relu(x)
actions_value = self.out(x) # 生成出的结果
return actions_value
class DQN(object):
def __init__(self):
self.eval_net, self.target_net = Net(), Net()
self.learn_step_counter = 0 # for target updating
self.memory_counter = 0 # for storing memory
self.memory = np.zeros((MEMORY_CAPACITY, N_STATES * 2 + 2)) # initialize memory
self.optimizer = torch.optim.Adam(self.eval_net.parameters(), lr=LR)
def choose_action(self, x): # 根据观测值采取动作
x = torch.unsqueeze(torch.FloatTensor(x), 0)
# input only one sample
if np.random.uniform() < EPSILON:
actions_value = self.eval_net.forward(x)
action = torch.max(actions_value, 1)[1].data.numpy()
action = action[0] if ENV_A_SHAPE == 0 else action.reshape(ENV_A_SHAPE)
else:
action = np.random.randint(0, N_ACTIONS)
action = action if ENV_A_SHAPE == 0 else action.reshape(ENV_A_SHAPE)
return action
def store_transition(self, s, a, r, s_): # 记忆库(s:状态/动作,a:动作,r:反馈reward, s_:下一个动作)
transition = np.hstack((s, [a, r], s_))
# replace the old memory with new memory
index = self.memory_counter % MEMORY_CAPACITY
self.memory[index, :] = transition
self.memory_counter += 1
def learn(self):
# target parameter update
if self.learn_step_counter % TARGET_REPLACE_ITER == 0:
self.target_net.load_state_dict(self.eval_net.state_dict())
self.learn_step_counter += 1
# sample batch transitions
sample_index = np.random.choice(MEMORY_CAPACITY, BATCH_SIZE)
b_memory = self.memory[sample_index, :]
b_s = torch.FloatTensor(b_memory[:, :N_STATES])
b_a = torch.LongTensor(b_memory[:, N_STATES:N_STATES+1].astype(int))
b_r = torch.FloatTensor(b_memory[:, N_STATES+1:N_STATES+2])
b_s_ = torch.FloatTensor(b_memory[:, -N_STATES:])
# q_eval w.r.t the action in experience
q_eval = self.eval_net(b_s).gather(1, b_a) # shape (batch, 1)
q_next = self.target_net(b_s_).detach() # detach from graph, don't backpropagate
q_target = b_r + GAMMA * q_next.max(1)[0].view(BATCH_SIZE, 1) # shape (batch, 1)
loss = self.loss_func(q_eval, q_target)
self.optimizer.zero_grad()
loss.backward()
self.optimizer.step()
dqn = DQN()
print('\n Collecting experience')
for i_episode in range(400):
s = env.reset()
ep_r = 0
while True:
env.render()
a = dqn.choose_action(s)
# take action
s_, r, done, info = env.step(a)
# modify the reward
x, x_dot, theta, theta_dot = s_
r1 = (env.x_threshold - abs(x)) / env.x_threshold - 0.8
r2 = (env.theta_threshold_radians - abs(theta)) / env.theta_threshold_radians - 0.5
r = r1 + r2
dqn.store_transition(s, a, r, s_)
ep_r += r
if dqn.memory_counter > MEMORY_CAPACITY:
dqn.learn()
if done:
print('Ep: ', i_episode,
'| Ep_r: ', round(ep_r, 2))
if done:
break
s = s_
| [
"[email protected]"
] | |
68685bbd376f9cbe2cd1311b8313d1a34cd95f75 | 518a7949a195f29591d5e1523287bd8985046ebb | /examples/bootstrap3/settings.py | 3463cd7305f4204b3484308adf6d532671bdec40 | [
"MIT"
] | permissive | kelvinhammond/djangocms-cascade | 73ecb0b3a136b3615fd354d04c1a57de0bb4485f | ba99706b03d1ae5a04952e3e6dded1c048426e89 | refs/heads/master | 2021-01-18T12:54:08.271278 | 2014-04-08T14:42:14 | 2014-04-08T14:42:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,452 | py | # Django settings for unit test project.
import os
DEBUG = True
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
SITE_ID = 1
ROOT_URLCONF = 'bootstrap3.urls'
SECRET_KEY = 'secret'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'bootstrap3/database.sqlite',
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'djangocms_admin_style',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'djangocms_text_ckeditor',
'cmsplugin_cascade',
'cms',
'menus',
'mptt',
'south',
'filer',
'easy_thumbnails',
'djangocms_link',
'cmsplugin_filer_file', # alternative to 'cms.plugins.file'
'cmsplugin_filer_folder',
'cmsplugin_filer_image', # alternative to 'cms.plugins.picture'
'sekizai',
'bootstrap3',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.gzip.GZipMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
)
# Absolute path to the directory that holds media.
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a trailing slash.
MEDIA_URL = '/media/'
#ADMIN_MEDIA_PREFIX = '/static/admin/'
# Absolute path to the directory that holds static files.
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
# URL that handles the static files served from STATIC_ROOT. Make sure to use a trailing slash.
STATIC_URL = '/static/'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
'bootstrap3.context_processors.cascade',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATE_DIRS = (
# Don't forget to use absolute paths, not relative paths.
os.path.join(PROJECT_DIR, 'templates'),
)
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
LANGUAGES = (
('en-us', 'English'),
)
#############################################################
# Application specific settings
CMS_TEMPLATES = (
('main.html', 'Default Page'),
)
CMS_SEO_FIELDS = True
CMS_CACHE_DURATIONS = {
'content': 3600,
'menus': 3600,
'permissions': 86400,
}
CMS_PLACEHOLDER_CONF = {
'Page Content': {
'plugins': ['BootstrapContainerPlugin'],
},
}
CMS_CASCADE_PLUGINS = ('bootstrap3',)
CKEDITOR_SETTINGS = {
'language': '{{ language }}',
'skin': 'moono',
'toolbar': 'CMS',
}
FILER_ALLOW_REGULAR_USERS_TO_ADD_ROOT_FOLDERS = True
FILER_DUMP_PAYLOAD = True
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
THUMBNAIL_HIGH_RESOLUTION = True
THUMBNAIL_PRESERVE_EXTENSIONS = True
THUMBNAIL_OPTIMIZE_COMMAND = {
'png': '/opt/local/bin/optipng {filename}',
'gif': '/opt/local/bin/optipng {filename}',
'jpeg': '/opt/local/bin/jpegoptim {filename}',
}
| [
"[email protected]"
] | |
46f9dc85ca46e101dd7033dc503abca879a2ef96 | e6dab5aa1754ff13755a1f74a28a201681ab7e1c | /.parts/lib/django-1.5/tests/regressiontests/cache/models.py | 66a55aa1db6eeeac0fcac1dbcc0fa90c651174d0 | [] | no_license | ronkagan/Euler_1 | 67679203a9510147320f7c6513eefd391630703e | 022633cc298475c4f3fd0c6e2bde4f4728713995 | refs/heads/master | 2021-01-06T20:45:52.901025 | 2014-09-06T22:34:16 | 2014-09-06T22:34:16 | 23,744,842 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 103 | py | /home/action/.parts/packages/googleappengine/1.9.4/lib/django-1.5/tests/regressiontests/cache/models.py | [
"[email protected]"
] | |
5488a146c268af0eca9fc2a0cd323ac5a4a95a9b | bf79fc0de3dcdfe7a4f3d2b10f9a271d757d345b | /httplib_post_sessionId.py | ce7d8c74d569922cb88cb48296ce4d415551cab5 | [] | no_license | gsrr/network_programming | 3aa09916b025f27fee98e8ed7dc0ebb4beadfbb9 | 91c3bdaf60b90c848a4e7fc4cfa29b6076e4e64f | refs/heads/master | 2021-01-18T15:12:41.379298 | 2013-10-12T15:46:27 | 2013-10-12T15:46:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 367 | py | import httplib
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain" , "Cookie": "JSESSIONID=487D7BDC9E91CC65603A7FB5A16B7E11" }
conn = httplib.HTTPConnection("172.27.112.40")
conn.request("POST", "/servlet/RTRRDisplayConfig" , "" , headers)
r1 = conn.getresponse()
print r1.status, r1.reason
data1 = r1.read()
print data1
conn.close() | [
"[email protected]"
] | |
475648468940c502788b44540e3bd9313ee5e4bc | eea8c7343b4c1f3083dfd066aa2d3df155ff3713 | /bioframe/dask.py | 1d5c9a6a713828baff44e446762ba7b6039859c2 | [
"MIT"
] | permissive | agalitsyna/bioframe | 090dbbd5a88d3673fd5472361468d0c0e7cac149 | 2bcfcb52de21cd6f31e2e2f69d39427908ea841b | refs/heads/master | 2020-06-01T03:14:42.770344 | 2019-06-11T19:46:24 | 2019-06-11T19:46:24 | 190,611,916 | 0 | 0 | MIT | 2019-06-06T16:12:13 | 2019-06-06T16:12:12 | null | UTF-8 | Python | false | false | 6,179 | py | from __future__ import division, print_function, absolute_import
from collections import OrderedDict
from contextlib import closing
import numpy as np
import pandas as pd
import numba
import pypairix
import pysam
from dask.base import tokenize
import dask.dataframe as dd
import dask.array as da
import dask
def bin2start(k):
lev = np.floor(np.log2(7*k + 1)/3).astype(int)
sl = 2**(29 - 3*lev)
ol = (2**(3*lev) - 1)//7
start = (k - ol) * sl
end = (k - ol+1) * sl
return start
LEVEL = {}
LEVEL[0] = bin2start(np.arange(1, 9))
LEVEL[1] = bin2start(np.arange(9, 73))
LEVEL[2] = bin2start(np.arange(73,585))
LEVEL[3] = bin2start(np.arange(585,4681))
LEVEL[4] = bin2start(np.arange(4681,37449))
@numba.jit("int32(int32, int32)")
def reg2bin(beg, end):
end -= 1
if beg >> 14 == end >> 14:
return ((1 << 15)-1) // 7 + (beg >> 14)
if beg >> 17 == end >> 17:
return ((1 << 12)-1) // 7 + (beg >> 17)
if beg >> 20 == end >> 20:
return ((1 << 9)-1) // 7 + (beg >> 20)
if beg >> 23 == end >> 23:
return ((1 << 6)-1) // 7 + (beg >> 23)
if beg >> 26 == end >> 26:
return ((1 << 3)-1) // 7 + (beg >> 26)
return 0
@numba.jit("int32(int32, int32)")
def reg2bins(rbeg, rend):
MAX_BIN = ((1 << 18) - 1) // 7
lst = []
rend -= 1
k = 1 + (rbeg >> 26)
while k <= (1 + (rend >> 26)):
k += 1
lst.append(k)
k = 9 + (rbeg >> 23)
while k <= (9 + (rend >> 23)):
k += 1
lst.append(k)
k = 73 + (rbeg >> 20)
while k <= (73 + (rend >> 20)):
k += 1
lst.append(k)
k = 585 + (rbeg >> 17)
while k <= (585 + (rend >> 17)):
k += 1
lst.append(k)
k = 4681 + (rbeg >> 14)
while k <= (4681 + (rend >> 14)):
k += 1
lst.append(k)
return lst
def range_partition(start, stop, step):
return ((i, min(i+step, stop))
for i in range(start, stop, step))
def _fetch_region(filepath, chromsizes, slc, block, columns=None,
usecols=None, meta=None):
chrom1, chrom2 = block
if chrom2 is None:
chrom2 = chrom1
if slc is None:
start, end = 0, chromsizes[chrom1]
else:
start, end = slc.start, slc.stop
f = pypairix.open(filepath, 'r')
it = f.query2D(chrom1, start, end, chrom2, 0, chromsizes[chrom2])
if usecols is not None:
records = [
(record[i] for i in usecols) for record in it
]
else:
records = it
df = pd.DataFrame.from_records(records, columns=columns)
if not len(df):
df = meta.copy()
# elif usecols is not None:
# usecols = set(usecols)
# df = df[[col for col in meta.columns if col in usecols]]
for col, dt in meta.dtypes.items():
df.loc[:, col] = df.loc[:, col].astype(dt)
return df
def read_pairix_block(filepath, block, names=None, dtypes=None,
usecols=None, chromsizes=None, chunk_level=0):
if chromsizes is None:
f = pypairix.open(filepath)
cs = f.get_chromsize()
if not len(cs):
raise ValueError("No chromsize headers found in file. "
"They must be provided explicitly.")
chromsizes = pd.Series(dict([(c, int(s)) for c, s in cs]))
del f
chrom1, chrom2 = block
nrows = chromsizes[chrom1]
meta = pd.read_csv(
filepath,
sep='\t',
comment='#',
header=None,
names=names,
dtype=dtypes,
usecols=usecols,
iterator=True).read(1024).iloc[0:0]
# Make a unique task name
token = tokenize(filepath, chromsizes, block,
names, dtypes, usecols, chunk_level)
task_name = 'read-pairix-block-' + token
# Build the task graph
divisions = []
dsk = {}
edges = LEVEL[chunk_level]
edges = edges[:np.searchsorted(edges, nrows)]
if edges[-1] != nrows:
edges = np.r_[edges, nrows]
spans = zip(edges[:-1], edges[1:])
for i, (lo, hi) in enumerate(spans):
if i == 0:
divisions.append(lo)
divisions.append(hi-1)
slc = slice(lo, hi)
dsk[task_name, i] = (_fetch_region,
filepath, chromsizes, slc,
block, names, usecols, meta)
# Generate ddf from dask graph
return dd.DataFrame(dsk, task_name, meta, tuple(divisions))
def read_pairix(filepath, names, blocks=None, chromsizes=None, **kwargs):
"""
Read a Pairix-indexed BEDPE-like file as a dask dataframe.
Parameters
----------
filepath : str
Path to the pairs or paired-end interval file, not the index file.
(i.e. omit the .px2 extension).
names : sequence of str
Names for the columns in the pairs file.
blocks : sequence of str or tuple
List of paired chromosome blocks to load.
If a list of single chromosome names is given, then all pair
permutations are loaded.
chromsizes : dict or Series, optional
Chromosome lengths to use if chromsizes headers are
not available.
chunk_level : {0, 1, 2, 3, 4}
Increase for a finer partition.
Returns
-------
OrderedDict
A mapping of chromosome pairs to dask dataframes.
"""
f = pypairix.open(filepath)
if chromsizes is None:
cs = f.get_chromsize()
if not len(cs):
raise ValueError("No chromsize headers found in file. "
"They must be provided explicitly.")
chromsizes = pd.Series(dict([(c, int(s)) for c, s in cs]))
if blocks is None:
blocks = [s.split('|') for s in f.get_blocknames()]
elif isinstance(blocks[0], str):
blocks = [(ci, cj) for ci in blocks for cj in blocks]
dct = OrderedDict()
for chrom1, chrom2 in blocks:
if chrom1 in chromsizes and chrom2 in chromsizes:
dct[chrom1, chrom2] = read_pairix_block(
filepath, (chrom1, chrom2), names,
chromsizes=chromsizes, **kwargs)
return dct
| [
"[email protected]"
] | |
220ecc6dfcdc71e07171f2b4cdb6b97a034114d6 | c988a8856d2d3fb7771417b4c7810e528a197d2b | /Generators 2.py | 9b2b8e0fd242c5b9ea38fbb9c33f02ac9f69df22 | [] | no_license | arunekuriakose/MyPython | 0c8a9161fef20bf77f7ba31149ec4ba0fa79b0bd | 19f44819612a8490d430bafec0616f68ce109776 | refs/heads/master | 2022-01-20T07:56:48.505226 | 2019-07-22T06:26:52 | 2019-07-22T06:26:52 | 198,158,499 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 273 | py | #
def demo():
n=1
print("First")
yield n
n+=1
print("Second")
yield n
n+=1
print("Third")
yield n
#a=demo()
#print(next(a))
#print(next(a))
#print(next(a))
for i in demo():
print(next(i)) | [
"[email protected]"
] | |
3b5349a86fba8c9b1cfb2e62694c68a49574e8f5 | 1abec01c89583daf7c486d5a78b60597ed0e9b85 | /RFID/test1.py | 5f34e3cd5bd8f512aba7702aa5b8f4b0375dd300 | [] | no_license | BaldSuperman/python_work | a31625a02c27b94d7165dde1c584ebfe769e4dbd | 36669079e81a798f051ee89dfc681c1d74e1c746 | refs/heads/master | 2020-05-27T16:00:34.292449 | 2019-06-17T07:05:11 | 2019-06-17T07:05:11 | 188,687,919 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,548 | py | # -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522 as rc522
def write():
reader = rc522()
try:
data = raw_input("input data: ")
print("input data is: "+data)
print("place your card to write")
reader.write(data)
print("write success")
return data
except Exception as error:
print("error haappen: "+str(error))
finally:
GPIO.cleanup()
def read():
reader = rc522()
try:
print("begin reading")
id, data = reader.read()
return id, data
except Exception as error:
print("error haappen:%s" % str(error))
finally:
GPIO.cleanup()
def show():
print("输入数字 1 查看当前卡内余额。",end=" ")
print("*", end=" ")
print("输入数字 2 管理员给当前卡片充值",end=" ")
print("*", end=" ")
print("输入数字 3 进行消费")
def judge4( Rfid):
id, data = read()
Rfid[id] = data
print("当前组内成员:")
for id in Rfid:
print("id: " + str(id) + " data:" + str(Rfid[id]))
def judge1(Rfid):
id, data = read()
if id in Rfid.keys():
print("id: " + str(id) + " data:" + str(Rfid[id]))
else:
print("不是我们的卡,没有相关权限")
def judge3(Rfid):
id, data = read()
if id in Rfid.keys():
data = write()
Rfid[id] = data
else:
print("不是我们的卡,没有相关权限")
def judge2(Rfid):
count = len(Rfid)
print("当前系统中共有卡片:%d 个"%count)
for id in Rfid:
print("id: " + str(id) + " data:" + str(Rfid[id]))
def judge(num, passwrod, Rfid):
if num == '4':
str = raw_input("请输入管理员密码:")
if str == passwrod:
judge4(Rfid)
else:
print("您没有相关权限")
if num == '3':
str = raw_input("请输入管理员密码:")
if str == passwrod:
judge3(Rfid)
else:
print("您没有相关权限")
if num == '2':
str = raw_input("请输入管理员密码:")
if str == passwrod:
judge2(Rfid)
else:
print("您没有相关权限")
if num == '1':
judge1(Rfid)
def main():
passwrod = "xiamingxin"
##使用字典代替数据库功能 存储当前组内卡片信息
while True:
show()
num = raw_input("输入您的操作类型:")
judge(num, passwrod, Rfid)
if __name__ == '__main__':
main()
| [
"[email protected]"
] | |
d00ecc5889baf1e72d1751d86e98601d7028d53b | a3f0669e893e152997aab440275aafbeca74c4c5 | /src/ffm/evaluate.py | a19f7ba86df0c7d8e7cd4788b56c30906af7a112 | [] | no_license | AzizIlyosov/ctr-algorithms-ipinyou | 0280e3379e6d207b52fa206dc9e05779b876a927 | 25ca16788497c3d954259dc8dfcd353b76edc2c5 | refs/heads/master | 2020-04-08T01:43:51.391902 | 2018-07-04T14:09:07 | 2018-07-04T14:09:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,223 | py | # _*_ coding: utf-8 _*_
import sys
import scipy as sp
from csv import DictReader
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.metrics import log_loss
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import roc_auc_score
path = '../../output/ffm/'
label_path = path + 'validation.csv'
predict_path = path + 'submission.csv'
label_reader = DictReader(open(label_path))
predict_reader = DictReader(open(predict_path))
count = 0
y_true = []
y_pred = []
y_scores = []
for t, row in enumerate(label_reader):
predict = predict_reader.__next__()
actual = float(row['label'])
predicted = float(predict['prob'])
y_true.append(actual)
y_scores.append(predicted)
# 计算性能指标
auc = roc_auc_score(y_true, y_scores)
logloss = log_loss(y_true, y_scores)
# accuracy = accuracy_score(y_true, y_pred)
# precision = precision_score(y_true, y_pred)
# recall = recall_score(y_true, y_pred)
# f1 = f1_score(y_true, y_pred)
# print('Accuracy: {0} Precision: {1} Recall: {2} F1-Measure: {3}\n'.format(accuracy, precision, recall, f1))
print('logloss: {0} auc: {1}\n'.format(logloss, auc))
| [
"[email protected]"
] | |
7e0e8298dda72c9880e5943047eb1190db12eff7 | f80ef3a3cf859b13e8af8433af549b6b1043bf6e | /pyobjc-framework-ApplicationServices/Lib/PrintCore/__init__.py | 36c698f201df15a99f814a8bbfc57c763b22a185 | [
"MIT"
] | permissive | ronaldoussoren/pyobjc | 29dc9ca0af838a56105a9ddd62fb38ec415f0b86 | 77b98382e52818690449111cd2e23cd469b53cf5 | refs/heads/master | 2023-09-01T05:15:21.814504 | 2023-06-13T20:00:17 | 2023-06-13T20:00:17 | 243,933,900 | 439 | 49 | null | 2023-06-25T02:49:07 | 2020-02-29T08:43:12 | Python | UTF-8 | Python | false | false | 1,256 | py | """
Python mapping for the PrintCore framework.
This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
"""
import functools
import sys
import Cocoa
import objc
from PrintCore import _metadata, _PrintCore
sys.modules["PrintCore"] = mod = objc.ObjCLazyModule(
"PrintCore",
"com.apple.ApplicationServices",
objc.pathForFramework("/System/Library/Frameworks/ApplicationServices.framework"),
_metadata.__dict__,
None,
{
"__doc__": __doc__,
"__path__": __path__,
"__loader__": globals().get("__loader__", None),
"objc": objc,
},
(
_PrintCore,
Cocoa,
),
)
del sys.modules["PrintCore._metadata"]
#
# PMRetain and PMRelease are "generic" functions
# where the argument can be an instance of a number
# of PrintCore types.
#
# The code below ensures these functions actually
# work as expected.
#
_PMRetain = mod.PMRetain
_PMRelease = mod.PMRelease
@functools.wraps(_PMRetain)
def PMRetain(value):
return _PMRetain(value.__pointer__)
@functools.wraps(_PMRelease)
def PMRelease(value):
return _PMRelease(value.__pointer__)
mod.PMRetain = PMRetain
mod.PMRelease = PMRelease
| [
"[email protected]"
] | |
4080c05e280ec94e2df632dc211c25773aa6243b | 02e23da0431623db86c8138bda350a1d526d4185 | /Archivos Python Documentos/Graficas/.history/tierras_20200219214608.py | 5ebc61a24ec8acd6890ed7cafa92f02f17424812 | [] | no_license | Jaamunozr/Archivos-python | d9996d3d10ff8429cd1b4c2b396016a3a5482889 | 1f0af9ba08f12ac27e111fcceed49bbcf3b39657 | refs/heads/master | 2022-08-05T14:49:45.178561 | 2022-07-13T13:44:39 | 2022-07-13T13:44:39 | 244,073,267 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,511 | py | import os
import pylab as pl
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
os.system("clear")
fig = pl.figure()
axx = Axes3D(fig)
raiz=np.sqrt
ln=np.log
X = np.arange(-2, 12, 0.01)
Y = np.arange(-2, 12, 0.01)
Z = np.arange(600,2000,100)
X, Y = np.meshgrid(X, Y)
ax, ay = 0.5, 0.5
bx, by = 4.5, 0.4
cx, cy = 8.5, 0.5
dx, dy = 0.5, 4.5
ex, ey = 8.5, 4.5
fx, fy = 0.5, 8.5
gx, gy = 4.5, 8.5
hx, hy = 8.5, 8.5
l = 2
rho= 100
ik=25
ma=raiz((X-ax)**2+(Y-ay)**2)
mb=raiz((X-bx)**2+(Y-by)**2)
mc=raiz((X-cx)**2+(Y-cy)**2)
md=raiz((X-dx)**2+(Y-dy)**2)
me=raiz((X-ex)**2+(Y-ey)**2)
mf=raiz((X-fx)**2+(Y-fy)**2)
mg=raiz((X-gx)**2+(Y-gy)**2)
mh=raiz((X-hx)**2+(Y-hy)**2)
va=ln((l+raiz(ma**2+l**2))/ma)
vb=ln((l+raiz(mb**2+l**2))/mb)
vc=ln((l+raiz(mc**2+l**2))/mc)
vd=ln((l+raiz(md**2+l**2))/md)
ve=ln((l+raiz(me**2+l**2))/me)
vf=ln((l+raiz(mf**2+l**2))/mf)
vg=ln((l+raiz(mg**2+l**2))/mg)
vh=ln((l+raiz(mh**2+l**2))/mh)
Vt=((rho*ik)/(2*np.pi))*(va+vb+vc+vd+ve+vf+vg+vh)
print (Vt[::].max())
x = X.flatten()
y = Y.flatten()
z = Vt.flatten()
axx.plot_trisurf(x,y,z , cmap="magma")
colors =pl.cm.magma( (X-X.min())/float((X-X.min()).max()) )
axx.plot_surface(X, Y, Vt, facecolors=colors, linewidth=0, shade=False )#rstride=1, cstride=1, cmap=pl.cm.hot)
#colors =plt.cm.magma( (X-X.min())/float((X-X.min()).max()) )
#ax2.plot_surface(X,Y,Z ,facecolors=colors, linewidth=0, shade=False )
#fig.colorbar(surf)
#axx.contourf(X, Y, Vt, zdir='Vt', offset=450, cmap=pl.cm.hot)
axx.set_zlim(500, 2000)
pl.show()
| [
"[email protected]"
] | |
7eb7b91bac55d631f2d8f2cb1262e1d2b70b03bd | 455c1cec4101254a0b7f50349e915411033a0af1 | /supervised_learning/0x02-tensorflow/5-create_train_op.py | fb850cd429f95ec7d7f273f75d9347cfba9615e1 | [] | no_license | Daransoto/holbertonschool-machine_learning | 30c9f2753463d57cac87f245b77c8d6655351e75 | 1e7cd1589e6e4896ee48a24b9ca85595e16e929d | refs/heads/master | 2021-03-10T14:32:09.419389 | 2020-10-23T19:47:31 | 2020-10-23T19:47:31 | 246,461,514 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 268 | py | #!/usr/bin/env python3
""" This module contains the function calculate_loss. """
import tensorflow as tf
def create_train_op(loss, alpha):
""" Creates the training operation for the network. """
return tf.train.GradientDescentOptimizer(alpha).minimize(loss)
| [
"[email protected]"
] | |
916866031e271a0f5bb4313ed49925223da816aa | da370ba0df9700519139e1da54f3e7f38e9b7f5f | /.nox/tests/lib/python3.7/site-packages/jaxlib/xla_client.py | a6ef6bd431a6813cf33496bef07281616009f7b0 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | antonevenepoel/open_spiel | 90e3c7c6611cf508f2872237412fd67cf6cd10e0 | f2f0c786410018675fc40e9a5b82c40814555fa8 | refs/heads/master | 2021-03-15T20:57:00.562672 | 2020-05-15T16:10:23 | 2020-05-15T16:10:23 | 246,877,171 | 0 | 0 | Apache-2.0 | 2020-03-12T16:07:42 | 2020-03-12T16:07:41 | null | UTF-8 | Python | false | false | 66,737 | py | # Lint as: python3
# 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.
# ==============================================================================
"""An XLA client in Python."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import enum # pylint: disable=g-bad-import-order
import inspect
import itertools
import os
from absl import logging
import numpy as np
# Note this module does *not* depend on any Python protocol buffers. The XLA
# Python bindings are currently packaged both as part of jaxlib and as part
# of TensorFlow. If we use protocol buffers here, then importing both jaxlib
# and TensorFlow may fail with duplicate protocol buffer message definitions.
from . import xla_extension as _xla
from .xla_extension import ops
# Most functions are snake_case for consistency with other modules, whereas
# method names of ComputationBuilder and Computation are CamelCase for
# consistency with XLA.
# pylint: disable=invalid-name
profiler = _xla.profiler
class Backend(object, metaclass=abc.ABCMeta):
"""Abstract base class for XLA backends."""
def __init__(self, platform):
"""Creates a new Backend.
Args:
platform: A string naming the platform; for example 'gpu'.
"""
self.platform = platform
@abc.abstractmethod
def device_count(self):
"""Returns the number of devices known to the backend."""
@abc.abstractmethod
def local_device_count(self):
"""Returns the number of devices local to this host."""
@abc.abstractmethod
def devices(self):
"""Returns a list of `device_count()` Device subclasses."""
@abc.abstractmethod
def host_id(self):
"""Returns the integer ID of this host."""
@abc.abstractmethod
def buffer_from_pyval(self, pyval, device=None, force_copy=False):
"""Allocates a fresh buffer and populates it with `pyval`."""
@abc.abstractmethod
def make_tuple(self, c_buffers, device):
"""Makes a tuple from a sequence of backend buffer objects."""
@abc.abstractmethod
def compile(self, computation, compile_options):
"""Compiles a computation. Returns an executable."""
@abc.abstractmethod
def get_default_device_assignment(self, num_replicas, num_partitions):
"""Returns the default device assignment that `compile` would use.
If `compile_options.device_assignment` isn't set, `compile` will pick a
deterministic device assignment based on the number of replicas and
partitions, possibly optimizing for device locality. This method returns
that assignment, which is useful for e.g. manually replicating a value
before passing it to a compiled executable.
Args:
num_replicas: the number of replicas needed.
num_partitions: the number of partitions needed.
Returns:
A list of list of Devices of size `(num_replicas, num_partitions)`.
"""
class LocalBackend(Backend):
"""XLA backend implemented using the in-process xla::LocalClient API."""
def __init__(self, platform, client):
"""Creates a new LocalBackend.
Args:
platform: A string; the user-visible platform name, e.g. 'gpu'.
client: An _xla.PyLocalClient object.
"""
super(LocalBackend, self).__init__(platform)
self.client = client
def device_count(self):
return self.client.device_count()
def local_device_count(self):
return self.client.local_device_count()
def devices(self):
return self.client.devices()
def local_devices(self):
return self.client.local_devices()
def host_id(self):
return self.client.host_id()
def buffer_from_pyval(self, pyval, device=None, force_copy=False):
if device is None:
device = self.local_devices()[0]
return _xla.PyLocalBuffer.from_python(pyval, self.client, device,
force_copy)
def make_tuple(self, c_buffers, device):
return _xla.PyLocalBuffer.make_tuple(c_buffers, self.client, device)
def compile(self, c_computation, compile_options):
options = _xla.ExecutableBuildOptions()
options.num_replicas = compile_options.num_replicas
options.num_partitions = compile_options.num_partitions
if compile_options.result_layout:
options.result_layout = compile_options.result_layout
options.debug_options.xla_cpu_fast_math_honor_infs = True
options.debug_options.xla_cpu_fast_math_honor_nans = True
options.debug_options.xla_cpu_fast_math_honor_division = True
options.debug_options.xla_cpu_fast_math_honor_functions = True
options.debug_options.xla_gpu_enable_fast_min_max = False
return _xla.LocalExecutable.Compile(c_computation,
compile_options.argument_layouts,
options, self.client,
compile_options.device_assignment)
def get_default_device_assignment(self, num_replicas, num_partitions=None):
if num_partitions is not None:
return self.client.GetDefaultDeviceAssignment(num_replicas,
num_partitions)
else:
# TODO(skye): delete this case after all callers can handle 2D output
return self.client.GetDefaultDeviceAssignment(num_replicas)
xla_platform_names = {
'cpu': 'Host',
'gpu': 'CUDA',
}
def _cpu_backend_factory():
client = _xla.get_cpu_client(asynchronous=True)
return LocalBackend(platform='cpu', client=client)
def _gpu_backend_factory(distributed_client=None, node_id=0):
"""Returns a GPU backend. BFC allocator is used by default."""
allocator = os.getenv('XLA_PYTHON_CLIENT_ALLOCATOR', 'default').lower()
memory_fraction = os.getenv('XLA_PYTHON_CLIENT_MEM_FRACTION')
preallocate = os.getenv('XLA_PYTHON_CLIENT_PREALLOCATE')
if allocator not in ('default', 'platform', 'bfc'):
raise ValueError(
'XLA_PYTHON_CLIENT_ALLOCATOR env var must be "default", "platform", or '
'"bfc", got "%s"' % allocator)
config = _xla.GpuAllocatorConfig()
if allocator == 'default':
config.kind = _xla.GpuAllocatorConfig.Kind.DEFAULT
if allocator == 'platform':
config.kind = _xla.GpuAllocatorConfig.Kind.PLATFORM
if allocator == 'bfc':
config.kind = _xla.GpuAllocatorConfig.Kind.BFC
if memory_fraction:
config.memory_fraction = float(memory_fraction)
config.preallocate = preallocate not in ('0', 'false', 'False')
client = _xla.get_nvidia_gpu_client(
asynchronous=True,
allocator_config=config,
distributed_client=distributed_client,
node_id=node_id)
return LocalBackend(platform='gpu', client=client)
# Backend factories, keyed by user-visible name, in increasing priority order.
_local_backend_factories = collections.OrderedDict([
('cpu', _cpu_backend_factory),
('gpu', _gpu_backend_factory),
])
def register_local_backend_factory(name, factory):
_local_backend_factories[name] = factory
_local_backends = None
def _get_local_backends():
"""Instantiates all known local backends."""
global _local_backends
if _local_backends is not None:
return _local_backends
_local_backends = collections.OrderedDict()
for name, factory in _local_backend_factories.items():
logging.vlog(2, "Initializing backend '%s'" % name)
try:
backend = factory()
except RuntimeError:
if name == 'cpu':
# We always expect CPU to initialize successfully.
raise
else:
# If the backend isn't built into the binary, or if it has no devices,
# we expect a RuntimeError.
continue
_local_backends[name] = backend
return _local_backends
def get_local_backend(name=None):
"""Returns a local backend.
Args:
name: the backend name. If `None`, a default local backend is returned,
typically `gpu` if one is present, or `cpu` if not. If a string, the named
backend is returned or an exception raised.
Returns:
A LocalBackend object.
"""
backends = _get_local_backends()
if name is not None:
try:
return backends[name]
except KeyError:
raise RuntimeError('Unknown backend {}'.format(name))
return list(backends.values())[-1]
class OpMetadata(object):
"""Python representation of a xla.OpMetadata protobuf."""
__slots__ = ('op_type', 'op_name', 'source_file', 'source_line')
def __init__(self, op_type='', op_name='', source_file='', source_line=0):
self.op_type = op_type
self.op_name = op_name
self.source_file = source_file
self.source_line = source_line
def CurrentSourceInfoMetadata(op_type=None, op_name=None, skip_frames=1):
"""Helper for use in source mapping that returns an OpMetadata object."""
full_filename, lineno = inspect.stack()[skip_frames][1:3]
filename = os.path.basename(full_filename)
return OpMetadata(
op_type=op_type,
op_name=op_name,
source_file=filename,
source_line=lineno)
PrimitiveType = _xla.PrimitiveType
bfloat16 = _xla.bfloat16_dtype()
XLA_ELEMENT_TYPE_TO_DTYPE = {
PrimitiveType.PRED: np.dtype('bool'),
PrimitiveType.S8: np.dtype('int8'),
PrimitiveType.S16: np.dtype('int16'),
PrimitiveType.S32: np.dtype('int32'),
PrimitiveType.S64: np.dtype('int64'),
PrimitiveType.U8: np.dtype('uint8'),
PrimitiveType.U16: np.dtype('uint16'),
PrimitiveType.U32: np.dtype('uint32'),
PrimitiveType.U64: np.dtype('uint64'),
PrimitiveType.BF16: np.dtype(bfloat16),
PrimitiveType.F16: np.dtype('float16'),
PrimitiveType.F32: np.dtype('float32'),
PrimitiveType.F64: np.dtype('float64'),
PrimitiveType.C64: np.dtype('complex64'),
PrimitiveType.C128: np.dtype('complex128'),
PrimitiveType.TUPLE: np.dtype(np.object),
PrimitiveType.TOKEN: np.dtype(np.object),
}
# Note the conversion on the key. Numpy has a known issue wherein dtype hashing
# doesn't work as expected (https://github.com/numpy/numpy/issues/7242). Thus,
# when keying by dtype in this dict, we use the string form of dtypes.
DTYPE_TO_XLA_ELEMENT_TYPE = {
str(dt): et for et, dt in XLA_ELEMENT_TYPE_TO_DTYPE.items()
}
def dtype_to_etype(dtype):
"""Convenience function for reading DTYPE_TO_XLA_ELEMENT_TYPE."""
return DTYPE_TO_XLA_ELEMENT_TYPE[str(np.dtype(dtype))]
Shape = _xla.Shape
Shape.__doc__ = """
A Shape is an object defined in C++ that duck types like the following class:
class Shape(object):
'''Represents an XLA shape.
A shape is either an array shape, having rank-many integer
dimensions and an element type (represented by a Numpy dtype), or it
is a tuple shape, having a shape for every tuple component:
type shape =
TupleShape of shape list
| ArrayShape of { dimensions: int list; element_type: dtype }
'''
@staticmethod
def tuple_shape(tuple_shapes) -> Shape:
"Construct a tuple shape."
@staticmethod
def array_shape(element_type, dimensions, minor_to_major=None) -> Shape:
@staticmethod
def from_pyval(pyval) -> Shape:
"Returns a Shape that describes a tuple-tree of Numpy arrays."
def __init__(self, str) -> Shape:
"Parses a shape string."
def __eq__(self, other: Shape) -> bool:
def __ne__(self, other: Shape) -> bool:
def __hash__(self):
def __repr__(self):
def is_tuple(self) -> bool:
def is_array(self) -> bool:
def tuple_shapes(self) -> [Shape]:
def numpy_dtype(self) -> np.dtype:
"Like element_type(), but returns dtype('O') for a tuple shape."
def xla_element_type(self) -> PrimitiveType:
def element_type(self) -> np.dtype:
def dimensions(self) -> (int, int, ...):
def rank(self) -> int:
def with_major_to_minor_layout_if_absent(self) -> Shape:
"Returns a copy with missing layouts set to major-to-minor."
def to_serialized_proto(self) -> bytes:
"Returns 'shape' as a serialized proto."
"""
ProgramShape = _xla.ProgramShape
ProgramShape.__doc__ = """
A ProgramShape is a C++ object that duck types like the following class.
class ProgramShape(object):
def __init__(self, parameter_shapes, result_shape):
def parameter_shapes(self) -> [Shape]:
def result_shape(self) -> Shape:
def __repr__(self):
"""
class Buffer(object):
"""Represents a handle to data owned by XLA.
The referent is ready for use in executing a local, compiled
Computation. On XLA platforms involving a device (e.g. GPU), this
means the referent is in device memory.
"""
@staticmethod
def from_pyval(pyval, device=None, backend=None, force_copy=False):
"""Copies the `pyval` to a freshly allocated on-device buffer."""
backend = backend or get_local_backend()
return backend.buffer_from_pyval(pyval, device, force_copy=force_copy)
@staticmethod
def make_tuple(buffers, device, backend=None):
backend = backend or get_local_backend()
return backend.make_tuple(buffers, device)
# Buffer is not an instantiable type and exists only for its static methods.
# The underlying buffer objects are C++ object with the following
# API:
# def shape(self) -> Shape:
# def device(self) -> int:
# def delete(self):
# def destructure(self) -> [Buffer]
# def is_deleted(self) -> bool:
# def block_host_until_ready(self):
# """Blocks the calling thread until the buffer is ready on device."""
# def copy_to_host_async(self):
# """Requests a copy of the buffer to the host.
#
# Does not block waiting for the copy. Values fetched are available via
# `to_py()`; the purpose of `copy_to_host_async` is to prefetch values
# for subsequent `to_py()` calls, especially when requesting many values
# at once.
# """
# def to_py(self):
# """Returns the value of the buffer as a Python tuple tree of ndarrays."""
#
# TODO(phawkins): remove Buffer and its static methods completely, have
# clients call methods on Backend to create buffers.
# TODO(phawkins): Alias for backward compatibility. Remove after JAX drops
# compatibility with Jaxlib versions older than 0.1.13.
LocalBuffer = Buffer
def shape_from_pyval(pyval):
"""Returns a Shape that describes a tuple-tree of Numpy arrays."""
def convert(pyval):
if isinstance(pyval, tuple):
return Shape.tuple_shape(tuple(convert(elt) for elt in pyval))
else:
return Shape.array_shape(pyval.dtype, np.shape(pyval))
return convert(pyval)
def transfer_to_infeed(value, device=None):
"""Transfers the given value into the XLA infeed queue.
XLA's infeed queue is a single queue that feeds the "XLA virtual machine" with
a totally ordered stream of values. This is dequeued from XLA computations via
the Infeed() operation.
Args:
value: the value that the caller would like to enqueue into the XLA infeed
queue
device: the device to infeed the value to. Each device has a
distinct infeed queue.
"""
# TODO(phawkins): support non-default backends.
backend = get_local_backend()
device = device or backend.local_devices()[0]
device.TransferToInfeed(value)
def transfer_from_outfeed(shape, device=None):
"""Transfers a literal of the given shape from `device`'s outfeed.
Args:
shape: The shape of the value to transfer from outfeed.
device: The device from which to transfer the outfeed value. Each device has
a distinct outfeed queue..
Returns:
The literal value that is produced from the outfeed queue.
"""
# TODO(phawkins): support non-default backends.
backend = get_local_backend()
device = device or backend.local_devices()[0]
return device.TransferFromOutfeed(
shape.with_major_to_minor_layout_if_absent())
DeviceAssignment = _xla.DeviceAssignment
DeviceAssignment.__doc__ = """
A DeviceAssignment is a C++ object with the following signature.
def create(assignment):
'''Builds a device assignment.
Args:
assignment: a 2D numpy array of device ordinal integers, indexed by
[replica][computation_in_replica].
Returns:
A device assignment.
'''
def replica_count():
'''Returns the number of replicas.'''
def computation_count():
'''Returns the number of computations per replica.'''
"""
Device = _xla.Device
class CompileOptions(object):
"""Python object for XLA compile options.
These options can be passed to the 'compile' step when using a local XLA
client.
"""
def __init__(self):
self.xla_dump_to = None
self.dump_hlo_pass_re = None
self.dump_hlo_module_re = None
self.dump_hlo_as_text = None
self.dump_hlo_as_proto = None
self.hlo_profile = None
self.num_replicas = 1
self.num_partitions = 1
self.argument_layouts = None
self.result_layout = None
self.device_assignment = None
class Computation(object):
"""Python wrapper for an XLA Computation.
A Computation can be compiled to form an Executable, or used as a
subcomputation in ComputationBuilder methods.
"""
def __init__(self, c_computation, backend=None):
self._c_computation = c_computation
# The backend argument is deprecated. Pass a backend to Compile() instead.
self._backend = backend
@property
def computation(self):
return self._c_computation
def GetSerializedProto(self):
"""Gets the serialized HloModuleProto proto object in this computation.
Returns:
A string containing a serialized HloModuleProto proto containing the
computation and its dependencies.
"""
return self.computation.GetSerializedProto()
def GetHloText(self):
"""Get the textual HLO representation of this computation.
Returns:
A string containing the textual HLO.
"""
return self.computation.GetHloText()
def GetHloDotGraph(self):
"""Get a Graphviz Dot representation of this computation.
Returns:
A string containing the graphviz dot graph.
"""
return self.computation.GetHloDotGraph()
def Compile(self, argument_shapes=None, compile_options=None, backend=None):
"""Compiles a computation.
Computations are the result of a "ComputationBuild'ing" process.
Arguments:
argument_shapes: Deprecated. Use compile_options.argument_layouts instead.
compile_options: options to use for compilation, includes an optional laid
out result shape for the computation.
backend: a `Backend` for which an executable should be generated.
Returns:
A Executable instance.
"""
backend = backend or self._backend or get_local_backend()
compile_options = compile_options or CompileOptions()
if argument_shapes:
compile_options.argument_layouts = argument_shapes
return backend.compile(self.computation, compile_options)
def GetProgramShape(self):
return self._c_computation.GetProgramShape()
def GetReturnValueShape(self):
return self._c_computation.GetProgramShape().result_shape()
def Hash(self):
return self._c_computation.Hash()
# An Executable is a C++ class that duck types with the following API:
# class Executable(object):
# def local_devices(self) -> [Device]:
# def Execute(self, arguments : [Buffer]) -> Buffer:
# """Execute on one replica with Buffer arguments and return value."""
#
# def SizeOfGeneratedCodeInBytes(self) -> int:
# """Return generated binary size, or -1 if not known."""
#
# def ExecutePerReplica(self, arguments: [[Buffer]]) -> [Buffer]:
# """Execute on many replicas with Buffer arguments and return value.
#
# Args:
# arguments: A sequence of sequences of Buffers. The i'th inner sequence
# comprises the arguments for execution on the i'th replica.
#
# Returns:
# A list of the computation's outputs for each replica, as a Buffer. If
# a shallow sequence of arguments was passed in for `arguments`, then the
# sole, zero'th replica's output is returned instead, as a Buffer.
# """
#
# There are different implementations of Executable for different backends.
def execute_with_python_values(executable, arguments=(), backend=None):
"""Execute on one replica with Python values as arguments and output."""
backend = backend or get_local_backend()
def put(arg):
return Buffer.from_pyval(
arg, device=executable.local_devices()[0], backend=backend)
arguments = [put(arg) for arg in arguments]
return executable.Execute(arguments).to_py()
def execute_with_python_values_replicated(executable, arguments, backend=None):
"""Execute on many replicas with Python values as arguments and output.
Arguments:
executable: the program to run.
arguments: a list of lists of Python values indexed by
`[replica][arg_num]` to pass as inputs.
backend: the backend we are targeting.
Returns:
A list of python values, one per replica.
"""
backend = backend or get_local_backend()
devices = executable.local_devices()
# pylint: disable=g-complex-comprehension
flat_args = [(arg, devices[replica])
for replica, replica_args in enumerate(arguments)
for arg in replica_args]
flat_arg_buffers = [
backend.buffer_from_pyval(pyval, device) for pyval, device in flat_args
]
arg_buffers = []
for replica_args in arguments:
arg_buffers.append(flat_arg_buffers[:len(replica_args)])
flat_arg_buffers = flat_arg_buffers[len(replica_args):]
return [out.to_py() for out in executable.ExecutePerReplica(arg_buffers)]
class PaddingType(enum.Enum):
VALID = 1
SAME = 2
def _convert_padding_type_to_pad_values(padding_type, lhs_dims, rhs_dims,
window_strides):
"""Maps PaddingType or string to pad values (list of pairs of ints)."""
if not isinstance(padding_type, (str, PaddingType)):
msg = 'padding_type must be str or PaddingType, got {}.'
raise TypeError(msg.format(type(padding_type)))
if isinstance(padding_type, str):
if padding_type.upper() == 'VALID':
padding_type = PaddingType.VALID
elif padding_type.upper() == 'SAME':
padding_type = PaddingType.SAME
else:
msg = 'Unknown padding type string: expected "VALID" or "SAME", got {}.'
raise ValueError(msg.format(padding_type))
if padding_type == PaddingType.VALID:
return [(0, 0)] * len(window_strides)
elif padding_type == PaddingType.SAME:
out_shape = np.ceil(np.true_divide(lhs_dims, window_strides)).astype(int)
pad_sizes = [
max((out_size - 1) * stride + filter_size - in_size, 0)
for out_size, stride, filter_size, in_size in zip(
out_shape, window_strides, rhs_dims, lhs_dims)
]
return [(pad_size // 2, pad_size - pad_size // 2) for pad_size in pad_sizes]
else:
msg = 'Unexpected PaddingType value: {}'
raise ValueError(msg.format(padding_type))
class ComputationBuilder(object):
"""XLA computation builder.
Enqueues XLA ops in sequence and in order to build a
Computation, which in turn can be compiled into a
LocalExecutable, which in turn can be locally executed.
"""
# The methods of this class map 1-to-1 onto the XLA C++
# computation builder API. Therefore, there's no need to laboriously list
# arguments and return values for every method, especially where it's obvious.
#
# pylint: disable=g-doc-return-or-yield
# pylint: disable=g-doc-args
def __init__(self, name):
self._builder = _xla.XlaBuilder(name)
self._parameter_numbering = itertools.count()
def Build(self, root=None, backend=None):
"""Builds a `Computation` from the contents of the builder.
Args:
root: if not None, the operator containing the return value of the
computation.
Returns:
A `Computation`.
"""
if root is not None:
return Computation(self._builder.Build(root), backend=backend)
else:
return Computation(self._builder.Build(), backend=backend)
def GetShape(self, operand):
return self._builder.GetShape(operand)
def SetOpMetadata(self, op_metadata):
"""Set metadata for operations that are about to be enqueued."""
self._builder.SetOpMetadata(op_metadata)
def ClearOpMetadata(self):
"""Clear metadata for operations that are about to be enqueued."""
self._builder.ClearOpMetadata()
def SetSharding(self, sharding):
"""Set sharding that will be attached to all instructions until cleared."""
self._builder.SetSharding(sharding)
def ClearSharding(self):
"""Clears the sharding.
Ops will be sharded according to the default placement policy.
"""
self._builder.ClearSharding()
def CreateToken(self):
"""Enqueues a CreateToken op onto the computation.
Returns:
An XlaOp, representing a fresh token.
"""
return ops.CreateToken(self._builder)
def AfterAll(self, tokens):
"""Enqueues a after-all op onto the computation.
`AfterAll` takes a variadic number of tokens and produces a single token.
Args:
tokens: a list of `XlaOp` values representing predecessor tokens.
Returns:
An `XlaOp`.
"""
return ops.AfterAll(self._builder, tokens)
def Infeed(self, shape, token=None):
"""Enqueues an infeed op onto the computation.
Infeed operations dequeue data of the given shape from the device's infeed
queue for subsequent use in the computation.
Args:
shape: a `Shape` describing the shape of the infed value.
token: an optional `XlaOp` representing a token after which the infeed
effect should be sequenced.
Returns:
An XlaOp, representing a (value, token) pair.
"""
if token is None:
token = ops.CreateToken(self._builder)
return ops.InfeedWithToken(token,
shape.with_major_to_minor_layout_if_absent())
def Outfeed(self, operand, token=None):
"""Enqueues an outfeed op onto the computation.
Outfeed operations enqueue data, using the given operand, onto the XLA
outfeed queue for subsequent dequeue via the client API.
Args:
operand: an `XlaOp` representing the data to outfeed.
token: an `XlaOp` representing a token after which the outfeed should be
sequenced.
Returns:
An `XlaOp` representing a token.
"""
if token is None:
token = ops.CreateToken(self._builder)
return ops.OutfeedWithToken(operand, token, self._builder.GetShape(operand),
'')
def Constant(self, value):
"""Enqueues a constant op onto the computation.
Args:
value: value for the constant, as a np.array with an explicit dtype set to
one of the supported types.
Returns:
An XlaOp.
"""
return ops.ConstantLiteral(self._builder, value)
def ConstantF32Scalar(self, value):
"""Convenience method to enqueue a scalar F32 constant op.
Args:
value: a floating-point number.
Returns:
An XlaOp.
"""
return self.Constant(np.array(value, dtype=np.float32))
def ConstantF64Scalar(self, value):
"""Convenience method to enqueue a scalar F32 constant op.
Args:
value: a floating-point number.
Returns:
An XlaOp.
"""
return self.Constant(np.array(value, dtype=np.float64))
def ConstantS32Scalar(self, value):
"""Convenience method to enqueue a scalar S32 constant op.
Args:
value: a floating-point number.
Returns:
An XlaOp.
"""
return self.Constant(np.array(value, dtype=np.int32))
def ConstantS64Scalar(self, value):
"""Convenience method to enqueue a scalar S64 constant op.
Args:
value: a floating-point number.
Returns:
An XlaOp.
"""
return self.Constant(np.array(value, dtype=np.int64))
def ConstantPredScalar(self, value):
"""Convenience method to enqueue a scalar PRED constant op.
Args:
value: a boolean value.
Returns:
An XlaOp.
"""
return self.Constant(np.array(value, dtype=np.bool))
def ParameterWithShape(self, shape, name=None, parameter_num=None,
replicated=False):
"""Enqueues a Parameter op onto the computation, given a shape.
Args:
shape: the parameter's shape as a Shape object.
name: optional string name for the parameter.
parameter_num: parameter number in the computation function. If None, the
next linear parameter number is used. The default value capability can
be used for auto-numbering. If you're using auto-numbering for some
parameters, use it for *all* parameters to avoid clashes.
replicated: whether to mark the parameter's leaves as replicated. May be
a bool, in which case it applies to all leaves, or an iterable of bools.
Returns:
An XlaOp.
"""
if name is None:
name = ''
if parameter_num is None:
parameter_num = next(self._parameter_numbering)
if isinstance(replicated, bool):
replicated = [replicated] * shape.leaf_count()
return ops.Parameter(self._builder, parameter_num,
shape.with_major_to_minor_layout_if_absent(),
name.encode('utf8'), replicated)
def ParameterFromNumpy(self, value, name=None, parameter_num=None):
"""Enqueues a Parameter op onto the computation.
Args:
value: a Numpy array, or a nested tuple thereof, from which the shape is
inferred.
name: as in ParameterWithShape.
parameter_num: as in ParameterWithShape.
Returns:
An XlaOp.
"""
return self.ParameterWithShape(
shape_from_pyval(value), name=name, parameter_num=parameter_num)
def Iota(self, dtype, size):
"""Enqueues an iota constant onto the computation.
Args:
dtype: expected numpy dtype of the output.
size: integer, the number of elements in the array.
Returns:
An XlaOp representing the added iota constant.
"""
element_type = DTYPE_TO_XLA_ELEMENT_TYPE[str(np.dtype(dtype))]
return ops.Iota(self._builder, element_type, size)
def BroadcastedIota(self, dtype, shape, dimension):
"""Enqueues a broadcasted iota constant onto the computation.
Args:
dtype: expected numpy dtype of the output.
shape: tuple of integers, the expected output shape (dimensions).
dimension: positive integer, dimension along which to increment values.
Returns:
An XlaOp representing the added broadcasted iota constant.
"""
element_type = DTYPE_TO_XLA_ELEMENT_TYPE[str(np.dtype(dtype))]
xla_shape = _xla.Shape.array_shape(element_type, shape, None)
return ops.Iota(self._builder, xla_shape, dimension)
def Concatenate(self, operands, dimension):
"""Enqueues a concatenate operation onto the computation.
Args:
operands: the operands to concatenate.
dimension: the dimension in which to perform the concatenation.
Returns:
An XlaOp representing the added concatenate op.
"""
return ops.ConcatInDim(self._builder, list(operands), dimension)
def ReplicaId(self):
"""Enqueues a ReplicaId operation onto the computation.
Returns:
A LocalOp representing the replica id.
"""
return _xla.ops.ReplicaId(self._builder)
def Pad(self, operand, padding_value, padding_config):
"""Enqueues a Pad operation onto the computation.
Args:
operand: XlaOp representing the array to pad.
padding_value: XlaOp representing the scalar pad value.
padding_config: either a PaddingConfig or a list of integer triples
(edge_padding_low, edge_padding_high, interior_padding) representing the
configuration of the padding operation.
Returns:
An XlaOp representing the added Pad op.
"""
if isinstance(padding_config, tuple) or isinstance(padding_config, list):
padding_config = GetPaddingConfigFromTriples(padding_config)
return ops.Pad(operand, padding_value, padding_config)
def Reshape(self, operand, dimensions, new_sizes):
"""Enqueues a reshape op onto the computation.
Args:
operand: XlaOp representing the array to be reshaped.
dimensions: sequence of integers encoding the order in which dimensions
are collapsed or None, in which case dimensions are flattened in order.
new_sizes: sequence of integers encoding the new dimension sizes (shape).
Returns:
An XlaOp representing the added Reshape op.
"""
if dimensions is None:
ndim = len(self.GetShape(operand).dimensions())
dimensions = tuple(range(ndim))
return ops.Reshape(operand, dimensions, new_sizes)
def AllReduce(self, operand, computation, replica_groups=None):
"""AllReduce op.
Args:
operand: XlaOp representing the input array
computation: a Computation object - binary reduction function.
replica_groups: optional, list of lists of ints encoding a partition of
the set {0, 1, ..., num_replicas} into equally-sized replica groups
within which the all-to-all is performed. If not supplied or None (the
default), all replicas belong to the same group.
Returns:
An XlaOp that represents the all-reduced result.
"""
replica_groups_protos = _get_replica_groups_protos(replica_groups)
return ops.AllReduce(operand, computation.computation,
replica_groups_protos, None, None)
def AllToAll(self,
operand,
split_dimension,
concat_dimension,
replica_groups=None):
"""AllToAll op.
Args:
operand: XlaOp representing the input array
split_dimension: the dimension along which the operand is split
concat_dimension: the dimension along which the split blocks are
concatenated
replica_groups: optional, list of lists of ints encoding a partition of
the set {0, 1, ..., num_replicas} into equally-sized replica groups
within which the all-to-all is performed. If not supplied or None (the
default), all replicas belong to the same group.
Returns:
An XlaOp that represents the all-to-all concatenation.
"""
replica_groups_protos = _get_replica_groups_protos(replica_groups)
if not replica_groups:
split_count = 1
else:
split_count = len(replica_groups[0])
if not all(split_count == len(g) for g in replica_groups):
raise ValueError('Replica groups must be equally sized')
return ops.AllToAll(operand, split_dimension, concat_dimension, split_count,
replica_groups_protos)
def CrossReplicaSum(self, operand, replica_groups=None):
"""CrossReplicaSum op.
Args:
operand: the operand to sum across replica instances.
replica_groups: optional, list of lists of ints encoding a partition of
the set {0, 1, ..., num_replicas} into equally-sized replica groups
within which the cross-replica sum is performed. If not supplied or None
(the default), all replicas belong to the same group.
Returns:
An XlaOp that represents on each replica the sum of its group's values.
"""
replica_groups_protos = _get_replica_groups_protos(replica_groups)
return ops.CrossReplicaSum(operand, replica_groups_protos)
def Trans(self, operand):
"""Specialized matrix transpose op."""
return ops.Transpose(operand, [1, 0])
def Transpose(self, operand, permutation):
"""Transpose op."""
return ops.Transpose(operand, permutation)
def SelectAndScatter(self, operand, select, window_dimensions, window_strides,
padding, source, init_value, scatter):
"""Select and scatter op, used by the gradient of ReduceWindow.
Args:
operand: XlaOp for array of dimension N and type T over which the windows
slide.
select: Computation of type (T, T) -> Pred to apply to the elements of
each window to indicate which element is selected.
window_dimensions: sequence of N integers for dimensions of the window.
window_strides: sequence of N integers for the strides of the window.
padding: PaddingType representing either 'SAME' or 'VALID ' padding.
source: XlaOp for array of type T with values to scatter.
init_value: XlaOp of scalar type T for initial out value.
scatter: Computation of type (T, T) -> T to apply to each scatter source
element with its destination element.
Returns:
An XlaOp representing the added SelectAndScatter op.
"""
pads = _convert_padding_type_to_pad_values(
padding,
self.GetShape(operand).dimensions(), window_dimensions, window_strides)
return ops.SelectAndScatterWithGeneralPadding(operand, select.computation,
window_dimensions,
window_strides, pads, source,
init_value,
scatter.computation)
def Slice(self, operand, start_indices, limit_indices, strides=None):
"""Enqueues a slice operation onto the computation.
Args:
operand: XlaOp for the N dimensional array to be sliced.
start_indices: iterable of N integers containing the starting indices of
the slice for each dimension.
limit_indices: iterable of N integers containing the ending indices
(exclusive) of the slice for each dimension.
strides: optional iterable of N integers containing the stride sizes for
each dimension.
Returns:
An XlaOp representing the added Slice op.
"""
if strides is None:
start_indices = list(start_indices)
strides = [1] * len(start_indices)
return ops.Slice(operand, start_indices, limit_indices, strides)
def DynamicSlice(self, operand, start_indices, slice_sizes):
"""Enqueues a slice op with dynamic start indices onto the computation.
Args:
operand: XlaOp for the N dimensional array to be sliced.
start_indices: XlaOp for the 1D array of N integers containing the
starting indices of the slice.
slice_sizes: iterable of N integers containing the slice sizes in each
dimension.
Returns:
An XlaOp representing the added DynamicSlice op.
"""
slice_sizes = list(slice_sizes)
if isinstance(start_indices, _xla.XlaOp):
start_indices = [
ops.Reshape(ops.Slice(start_indices, [i], [i + 1], [1]), [])
for i in range(len(slice_sizes))
]
return ops.DynamicSlice(operand, list(start_indices), slice_sizes)
def DynamicUpdateSlice(self, operand, update, start_indices):
"""Enqueues a dynamic update slice operation onto the computation.
Args:
operand: XlaOp for the N dimensional array to be updated.
update: N dimensional array comprising the slice update.
start_indices: Rank-1 array of N integers comprising the starting indices
of the slice along each dimension.
Returns:
An XlaOp representing the added DynamicUpdateSlice op.
"""
if isinstance(start_indices, _xla.XlaOp):
ndims = self._builder.GetShape(start_indices).dimensions()[0]
start_indices = [
ops.Reshape(ops.Slice(start_indices, [i], [i + 1], [1]), [])
for i in range(ndims)
]
return ops.DynamicUpdateSlice(operand, update, list(start_indices))
def Tuple(self, *elems):
"""Enqueues a tuple operation onto the computation.
Args:
elems: a sequence of tuple operands (each a XlaOp).
Returns:
An XlaOp representing the added Tuple op.
"""
return ops.Tuple(self._builder, list(elems))
def Call(self, computation_to_apply, operands):
"""Enqueues a call operation onto the computation.
Args:
computation_to_apply: a Computation object.
operands: an iterable of XlaOp. The number and types of operands must
match the arity of computation_to_apply.
Returns:
An XlaOp representing the added call op.
"""
return ops.Call(self._builder, computation_to_apply.computation,
list(operands))
def CustomCallWithLayout(self,
call_target_name,
operands,
shape_with_layout,
operand_shapes_with_layout,
opaque=None):
"""Enqueues a custom call operation onto the computation.
Args:
call_target_name: the name of the function to call.
operands: an iterable of XlaOp. The number and types of operands must
match the arity of `operand_shapes_with_layout`.
shape_with_layout: the shape of the operator's output, with layout.
operand_shapes_with_layout: the shapes of `operands`, including the
expected layouts.
opaque: an opaque string passed to the backend.
Returns:
An XlaOp representing the added custom call op.
"""
opaque = opaque or b''
return ops.CustomCall(self._builder, call_target_name,
list(operands), shape_with_layout,
list(operand_shapes_with_layout), opaque)
# TODO(phawkins): remove CustomCall after callers are updated to use
# CustomCallWithLayout.
CustomCall = CustomCallWithLayout
def Map(self, operands, computation_to_apply, dimensions):
"""Enqueues a map operation onto the computation.
Args:
operands: an iterable of XlaOp.
computation_to_apply: a Computation object.
dimensions: dimensions over which to apply map the function.
Returns:
An XlaOp representing the added Map op.
"""
return ops.Map(self._builder, list(operands),
computation_to_apply.computation, dimensions, [])
def Reduce(self, operand, init_value, computation_to_apply, dimensions):
"""Enqueues a reduction operation onto the computation.
Args:
operand: reduction operand (XlaOp).
init_value: reduction initial value (XlaOp).
computation_to_apply: a Computation object - binary reduction function.
dimensions: sequence of dimensions (integers) to reduce on.
Returns:
An XlaOp representing the added Reduce op.
"""
return ops.Reduce(self._builder, [operand], [init_value],
computation_to_apply.computation, dimensions)
def ReduceWindow(self, operand, init_value, computation_to_apply,
window_dimensions, window_strides, padding):
"""Enqueues a windowed reduction operation onto the computation.
Args:
operand: reduction operand (XlaOp).
init_value: reduction initial value (XlaOp).
computation_to_apply: a binary reduction function (Computation).
window_dimensions: dimensions of window (sequence of integers).
window_strides: strides for window (sequence of integers).
padding: PaddingType representing either 'SAME' or 'VALID' padding.
Returns:
An XlaOp representing the added ReduceWindow op.
"""
pads = _convert_padding_type_to_pad_values(
padding,
self.GetShape(operand).dimensions(), window_dimensions, window_strides)
return ops.ReduceWindowWithGeneralPadding(operand, init_value,
computation_to_apply.computation,
window_dimensions, window_strides,
(), (), pads)
def ReduceWindowWithGeneralPadding(self, operand, init_value,
computation_to_apply, window_dimensions,
window_strides, base_dilations,
window_dilations, padding):
"""Enqueues a windowed reduction operation onto the computation.
Args:
operand: reduction operand (XlaOp).
init_value: reduction initial value (XlaOp).
computation_to_apply: a binary reduction function (Computation).
window_dimensions: dimensions of window (sequence of integers).
window_strides: strides for window (sequence of integers).
base_dilations: dilations for the base (sequence of integers).
window_dilations: dilations for window (sequence of integers).
padding: length-N array-like of pairs of integers of (low, high) padding.
Returns:
An XlaOp representing the added ReduceWindow op.
"""
return ops.ReduceWindowWithGeneralPadding(operand, init_value,
computation_to_apply.computation,
window_dimensions, window_strides,
base_dilations, window_dilations,
padding)
def RngNormal(self, mu, sigma, dims):
"""Enqueues an RngNormal operation onto the computation.
Args:
mu: An XlaOp to an F32 scalar specifying the mean.
sigma: An XlaOp to an F32 scalar specifying the standard deviation.
dims: A 1D array-like of nonnegative integers specifying the dimensions.
Returns: a XlaOp to the generated array of F32 values.
"""
shape = _xla.Shape.array_shape(self.GetShape(mu).xla_element_type(), dims)
return ops.RngNormal(mu, sigma, shape)
def RngUniform(self, a, b, dims):
"""Enqueues an RngUniform operation onto the computation.
Args:
a: a XlaOp to an F32, S32, or U32 scalar (consistent with the type of b)
specifying the low end of the interval [a, b) over which values are
generated.
b: a XlaOp to an F32, S32, or U32 scalar (consistent with the type of a)
specifying the high end of the interval [a, b) over which values are
generated.
dims: A 1D array-like of nonnegative integers specifying the dimensions.
Returns: a XlaOp to the generated array of values with the same numeric type
(F32, S32, or U32) as the arguments a and b.
"""
shape = _xla.Shape.array_shape(self.GetShape(a).xla_element_type(), dims)
return ops.RngUniform(a, b, shape)
def While(self, cond, body, init):
"""Enqueues a While operation onto the computation.
Args:
cond: a Computation for the loop condition, which has type T -> PRED
body: a Computation for the loop body, which has type T -> T
init: a XlaOp for the initial parameter, which has type T
Returns: a XlaOp representing the While operation.
"""
return ops.While(cond.computation, body.computation, init)
def Conditional(self, pred, true_operand, true_computation, false_operand,
false_computation):
"""Enqueues a Conditional operation onto the computation.
Args:
predicate: a XlaOp to test, which has scalar type PRED
true_operand: a XlaOp of type T_0
true_computation: a Computation to apply to true_operand, type T_0 -> S
false_operand: a ComputationDatahandle of type T_1
false_computation: a Computation to apply to false_operand, type T_1 -> S
Returns: a XlaOp representing the Conditional operation.
"""
return ops.Conditional(pred, true_operand, true_computation.computation,
false_operand, false_computation.computation)
def IsConstant(self, operand):
"""Checks whether the given operand is a compile-time constant.
Args:
operand: a ComputationDataHandle to test.
Returns: bool indicating whether `operand` is a compile-time constant,
meaning its value does not depend on any parametersor, or on stateful
operators such as `RngNormal` or `Infeed`.
"""
return self._builder.IsConstant(operand)
def BuildConstantSubGraph(self, operand):
"""Builds a constant sub graph.
Args:
operand: a XlaOp to test.
Returns: a Computation that is rooted on the given `operand` which is a
compile-time constant.
"""
return ops.BuildConstantSubGraph(operand)
def DotGeneral(self, lhs, rhs, dimension_numbers, precision_config=None):
"""Enqueues a general dot operation onto the computation.
Args:
lhs: XlaOp for the left-hand-side array.
rhs: XlaOp for the right-hand-side array.
dimension_numbers: either a DotDimensionNumbers or a nested tuple
((lhs_contract, rhs_contract), (lhs_batch, rhs_batch)) of lists of
integers representing the dimensions to treat as contracting dimensions
and batch dimensions on each input operand.
Returns: a XlaOp representing the DotGeneral operation.
"""
if isinstance(dimension_numbers, tuple):
dimension_numbers = GetDotDimensionsFromLists(dimension_numbers)
return ops.DotGeneral(
lhs, rhs, dimension_numbers, precision_config=precision_config)
def Conv(self,
lhs,
rhs,
window_strides,
padding,
feature_group_count=1,
batch_group_count=1,
precision_config=None):
"""Enqueues a Conv operation onto the computation.
Args:
lhs: XlaOp for the rank N+2 array of inputs.
rhs: XlaOp for the rank N+2 array of kernel weights.
window_strides: length-N array-like of integer kernel strides.
padding: PaddingType representing either 'SAME' or 'VALID' padding.
feature_group_count: number of feature groups for grouped convolution.
batch_group_count: number of batch groups for grouped convolution.
Returns: a XlaOp representing the Conv operation.
"""
pads = _convert_padding_type_to_pad_values(
padding,
self.GetShape(lhs).dimensions()[2:],
self.GetShape(rhs).dimensions()[2:], window_strides)
return self.ConvGeneralDilated(
lhs,
rhs,
window_strides,
pads, [], [],
dimension_numbers=None,
feature_group_count=feature_group_count,
batch_group_count=batch_group_count,
precision_config=precision_config)
def ConvWithGeneralPadding(self,
lhs,
rhs,
window_strides,
padding,
lhs_dilation,
rhs_dilation,
feature_group_count=1,
batch_group_count=1,
precision_config=None):
"""Enqueues a ConvWithGeneralPadding operation onto the computation.
Args:
lhs: XlaOp for the rank N+2 array of inputs.
rhs: XlaOp for the rank N+2 array of kernel weights.
window_strides: length-N array-like of kernel strides.
padding: length-N array-like of pairs of integers of (low, high) padding.
lhs_dilation: length-N array-like of dilation factors.
rhs_dilation: length-N array-like of dilation factors.
feature_group_count: number of feature groups for grouped convolution.
batch_group_count: number of batch groups for grouped convolution.
Returns:
A ComputationdataHandle representing the added ConvWithGeneralPadding op.
"""
return self.ConvGeneralDilated(
lhs,
rhs,
list(window_strides),
list(padding),
list(lhs_dilation),
list(rhs_dilation),
dimension_numbers=None,
feature_group_count=feature_group_count,
batch_group_count=batch_group_count,
precision_config=precision_config)
def _GetConvDimensionNumbers(self, num_spatial_dims):
"""Create ConvolutionDimensionNumbers proto for convolutions."""
nd = num_spatial_dims
dimension_numbers = ConvolutionDimensionNumbers()
dimension_numbers.input_batch_dimension = 0
dimension_numbers.input_feature_dimension = 1
dimension_numbers.output_batch_dimension = 0
dimension_numbers.output_feature_dimension = 1
dimension_numbers.kernel_output_feature_dimension = 0
dimension_numbers.kernel_input_feature_dimension = 1
dimension_numbers.input_spatial_dimensions.extend(range(2, 2 + nd))
dimension_numbers.kernel_spatial_dimensions.extend(range(2, 2 + nd))
dimension_numbers.output_spatial_dimensions.extend(range(2, 2 + nd))
return dimension_numbers
def ConvGeneralDilated(self,
lhs,
rhs,
window_strides,
padding,
lhs_dilation,
rhs_dilation,
dimension_numbers=None,
feature_group_count=1,
batch_group_count=1,
precision_config=None):
"""Enqueues a ConvGeneralDilated operation onto the computation.
Args:
lhs: XlaOp for the rank N+2 array of inputs.
rhs: XlaOp for the rank N+2 array of kernel weights.
window_strides: length-N array-like of integer kernel strides.
padding: length-N array-like of pairs of integers of (low, high) padding.
lhs_dilation: length-N array-like of integer dilation factors.
rhs_dilation: length-N array-like of integer dilation factors.
dimension_numbers: optional, either a ConvolutionDimensionNumbers object
or a tuple (lhs_spec, rhs_spec, out_spec). Each element is a string of
length N+2 identifying by position: (1) batch dimensions in lhs, rhs,
and the output with the character 'N', (2) feature dimensions in lhs
and the output with the character 'C', (3) input and output feature
dimensions in rhs with the characters 'I' and 'O' respectively, and
(4) spatial dimension correspondences between lhs, rhs, and the output
using any distinct characters. For example, to indicate dimension
numbers consistent with the Conv operation with two spatial
dimensions, one could use ('NCHW', 'OIHW', 'NCHW'). As another
example, to indicate dimension numbers consistent with the TensorFlow
Conv2D operation, one could use ('NHWC', 'HWIO', 'NHWC'). When using
the latter form of convolution dimension specification, window strides
are associated with spatial dimension character labels according to
the order in which the labels appear in the rhs_spec string, so that
window_strides[0] is matched with the dimension corresponding to the
first character appearing in rhs_spec that is not 'I' or 'O'. By
default, use the same dimension numbering as Conv and
ConvWithGeneralPadding.
feature_group_count: number of feature groups for grouped convolution.
batch_group_count: number of batch groups for grouped convolution.
Returns: a XlaOp representing the ConvGeneralDilated operation.
"""
if dimension_numbers is None:
dimension_numbers = self._GetConvDimensionNumbers(len(window_strides))
elif isinstance(dimension_numbers, tuple):
lhs_spec, rhs_spec, out_spec = dimension_numbers
dimension_numbers = ConvolutionDimensionNumbers()
dimension_numbers.input_batch_dimension = lhs_spec.index('N')
dimension_numbers.input_feature_dimension = lhs_spec.index('C')
dimension_numbers.output_batch_dimension = out_spec.index('N')
dimension_numbers.output_feature_dimension = out_spec.index('C')
dimension_numbers.kernel_output_feature_dimension = rhs_spec.index('O')
dimension_numbers.kernel_input_feature_dimension = rhs_spec.index('I')
dimension_numbers.kernel_spatial_dimensions.extend(
i for i, c in enumerate(rhs_spec) if c not in {'I', 'O'})
dimension_numbers.input_spatial_dimensions.extend(
sorted((i for i, c in enumerate(lhs_spec) if c not in {'N', 'C'}),
key=lambda i: rhs_spec.index(lhs_spec[i])))
dimension_numbers.output_spatial_dimensions.extend(
sorted((i for i, c in enumerate(out_spec) if c not in {'N', 'C'}),
key=lambda i: rhs_spec.index(out_spec[i])))
return ops.ConvGeneralDilated(
lhs,
rhs,
window_strides,
padding,
lhs_dilation,
rhs_dilation,
dimension_numbers,
feature_group_count,
batch_group_count,
precision_config=precision_config)
def Sort(self, operands, dimension=-1, comparator=None):
"""Enqueues a sort operation onto the computation.
Args:
operands: either an XlaOp or a sequence of XlaOps to sort. All operands
must be arrays with the same dimensions.
dimension: the array dimension over which to sort.
comparator: a comparator XlaComputation. See the XLA operation semantics
for details.
Returns:
Either an XlaOp or a tuple of XlaOps (if `operands` was an XlaOp or
a tuple of XlaOps, respectively.)
"""
operands = (
list(operands)
if isinstance(operands, collections.Sequence) else [operands])
return ops.Sort(self._builder, operands, dimension,
comparator.computation if comparator else None)
def SortKeyVal(self, keys, values, dimension=-1):
"""Enqueues a key-value sort operation onto the computation.
Deprecated. Use `Sort` instead.
"""
return ops.Sort(self._builder, [keys, values], dimension)
def QR(self, a, full_matrices=True):
"""Enqueues a QR decomposition onto the computation."""
return self.Tuple(*ops.QR(a, full_matrices))
def TriangularSolve(self,
a,
b,
left_side=False,
lower=False,
transpose_a=False,
conjugate_a=False,
unit_diagonal=False):
"""Enqueues a triangular-solve operation onto the computation."""
if not transpose_a:
transpose = _xla.TriangularSolveOptions_Transpose.NO_TRANSPOSE
if conjugate_a:
a = self.Conj(a)
else:
transpose = (
_xla.TriangularSolveOptions_Transpose.ADJOINT
if conjugate_a else _xla.TriangularSolveOptions_Transpose.TRANSPOSE)
return ops.TriangularSolve(a, b, left_side, lower, unit_diagonal, transpose)
def Eigh(self, a, full_matrices=True):
"""Enqueues a symmetric/Hermitian eigendecomposition."""
return self.Tuple(*ops.Eigh(a, full_matrices))
def SVD(self, a):
"""Enqueues a singular value decomposition."""
return self.Tuple(*ops.SVD(a))
def Gather(self,
a,
start_indices,
dimension_numbers,
slice_sizes,
indices_are_sorted=False):
"""Enqueues a Gather operation onto the computation."""
return ops.Gather(a, start_indices, dimension_numbers, slice_sizes,
indices_are_sorted)
def Scatter(self,
a,
scatter_indices,
updates,
update_computation,
dimension_numbers,
indices_are_sorted=False,
unique_indices=False):
"""Enqueues a Scatter operation onto the computation."""
return ops.Scatter(a, scatter_indices, updates,
update_computation.computation, dimension_numbers,
indices_are_sorted, unique_indices)
def Fft(self, operand, fft_type, fft_lengths):
"""Enqueues a FFT operation onto the computation."""
return ops.Fft(operand, fft_type, fft_lengths)
FftType = _xla.FftType
_UNARY_OPS = [
'Not',
'PopulationCount',
'Clz',
'Abs',
'Exp',
'Expm1',
'Floor',
'Round',
'Ceil',
'Log',
'Log1p',
'Sign',
'Cos',
'Sin',
'Tanh',
'IsFinite',
'Sqrt',
'Rsqrt',
'Square',
'Reciprocal',
'Neg',
'Erf',
'Erfc',
'ErfInv',
'Lgamma',
'Digamma',
'BesselI0e',
'BesselI1e',
'Acos',
'Asin',
'Atan',
'Tan',
'Acosh',
'Asinh',
'Atanh',
'Cosh',
'Sinh',
'Real',
'Imag',
'Conj',
]
_BINARY_OPS = [
'Eq',
'Ne',
'Ge',
'Gt',
'Lt',
'Le',
'Add',
'Sub',
'Mul',
'Div',
'Rem',
'Max',
'Min',
'And',
'Or',
'Xor',
'Pow',
'ShiftLeft',
'ShiftRightArithmetic',
'ShiftRightLogical',
'Atan2',
'Igamma',
'IgammaGradA',
'Igammac',
'Complex',
'NextAfter',
]
_OTHER_OPS = [
'BitcastConvertType',
'Broadcast',
'BroadcastInDim',
'Cholesky',
'Clamp',
'Collapse',
'CollectivePermute',
'ConvertElementType',
'Dot',
'GetTupleElement',
'ReducePrecision',
'RegularizedIncompleteBeta',
'Rev',
'Select',
'SliceInDim',
'TopK',
]
def _forward_methods_to_local_builder():
"""Forward remaining ComputationBuilder methods to the C API.
Set up methods, corresponding to XLA operations,
whose calls are forwarded in a boilerplate manner to the underlying
_xla.ops API.
"""
def forward_op(target_method):
def forward(builder, *args, **kwargs):
del builder
return target_method(*args, **kwargs)
return forward
for method_name in itertools.chain(_UNARY_OPS, _BINARY_OPS, _OTHER_OPS):
forward = forward_op(getattr(ops, method_name))
forward.__name__ = method_name
setattr(ComputationBuilder, method_name, forward)
_forward_methods_to_local_builder()
def register_custom_call_target(name, fn, platform='cpu'):
"""Registers a custom call target.
Args:
name: bytes containing the name of the function.
fn: a PyCapsule object containing the function pointer.
platform: the target platform.
"""
_xla.RegisterCustomCallTarget(name, fn, xla_platform_names[platform])
# Deprecated. Use register_custom_call_target instead.
register_cpu_custom_call_target = register_custom_call_target
class PaddingConfigDimension(object):
"""Python representation of a xla.PaddingConfigDimension protobuf."""
__slots__ = ('edge_padding_low', 'edge_padding_high', 'interior_padding')
def __init__(self):
self.edge_padding_low = 0
self.edge_padding_high = 0
self.interior_padding = 0
class PaddingConfig(object):
"""Python representation of a xla.PaddingConfig protobuf."""
__slots__ = ('dimensions',)
def __init__(self):
self.dimensions = []
def GetPaddingConfigFromTriples(triples):
"""Create PaddingConfig proto from list of triples of integers."""
padding_config = PaddingConfig()
for lo, hi, interior in triples:
dimension = PaddingConfigDimension()
dimension.edge_padding_low = lo
dimension.edge_padding_high = hi
dimension.interior_padding = interior
padding_config.dimensions.append(dimension)
return padding_config
class DotDimensionNumbers(object):
"""Python representation of a xla.DotDimensionNumbers protobuf."""
__slots__ = ('lhs_contracting_dimensions', 'rhs_contracting_dimensions',
'lhs_batch_dimensions', 'rhs_batch_dimensions')
def __init__(self):
self.lhs_contracting_dimensions = []
self.rhs_contracting_dimensions = []
self.lhs_batch_dimensions = []
self.rhs_batch_dimensions = []
def GetDotDimensionsFromLists(dimension_numbers):
(lhs_contract, rhs_contract), (lhs_batch, rhs_batch) = dimension_numbers
dot_dims_proto = DotDimensionNumbers()
dot_dims_proto.lhs_contracting_dimensions.extend(lhs_contract)
dot_dims_proto.rhs_contracting_dimensions.extend(rhs_contract)
dot_dims_proto.lhs_batch_dimensions.extend(lhs_batch)
dot_dims_proto.rhs_batch_dimensions.extend(rhs_batch)
return dot_dims_proto
class ConvolutionDimensionNumbers(object):
"""Python representation of a xla.ConvolutionDimensionNumbers protobuf."""
__slots__ = ('input_batch_dimension', 'input_feature_dimension',
'input_spatial_dimensions', 'kernel_input_feature_dimension',
'kernel_output_feature_dimension', 'kernel_spatial_dimensions',
'output_batch_dimension', 'output_feature_dimension',
'output_spatial_dimensions')
def __init__(self):
self.input_batch_dimension = 0
self.input_feature_dimension = 0
self.input_spatial_dimensions = []
self.kernel_input_feature_dimension = 0
self.kernel_output_feature_dimension = 0
self.kernel_spatial_dimensions = []
self.output_batch_dimension = 0
self.output_feature_dimension = 0
self.output_spatial_dimensions = []
class OpSharding(object):
"""Python representation of a xla.OpSharding protobuf."""
__slots__ = ('type', 'tile_assignment_dimensions', 'tile_assignment_devices',
'tuple_shardings')
Type = _xla.OpSharding_Type
def __init__(self):
self.type = self.Type.REPLICATED
self.tile_assignment_dimensions = []
self.tile_assignment_devices = []
self.tuple_shardings = []
class PrecisionConfig(object):
"""Python representation of a xla.PrecisionConfig protobuf."""
__slots__ = ('operand_precision',)
Precision = _xla.PrecisionConfig_Precision
def __init__(self):
self.operand_precision = []
class GatherDimensionNumbers(object):
"""Python representation of a xla.GatherDimensionNumbers protobuf."""
__slots__ = ('offset_dims', 'collapsed_slice_dims', 'start_index_map',
'index_vector_dim')
def __init__(self):
self.offset_dims = []
self.collapsed_slice_dims = []
self.start_index_map = []
self.index_vector_dim = 0
class ScatterDimensionNumbers(object):
"""Python representation of a xla.ScatterDimensionNumbers protobuf."""
__slots__ = ('update_window_dims', 'inserted_window_dims',
'scatter_dims_to_operand_dims', 'index_vector_dim')
def __init__(self):
self.update_window_dims = []
self.inserted_window_dims = []
self.scatter_dims_to_operand_dims = []
self.index_vector_dim = 0
class ReplicaGroup(object):
"""Python representation of a xla.ReplicaGroup protobuf."""
__slots__ = ('replica_ids',)
def __init__(self):
self.replica_ids = []
def _make_replica_group_proto(replica_group):
replica_group_proto = ReplicaGroup()
replica_group_proto.replica_ids.extend(replica_group)
return replica_group_proto
def _get_replica_groups_protos(replica_groups):
if replica_groups is None:
replica_groups_protos = [] # special value for XLA API
else:
replica_groups = list(replica_groups)
replica_groups_protos = [
_make_replica_group_proto(group) for group in replica_groups
]
return replica_groups_protos
| [
"[email protected]"
] | |
fb5956cc1e3720cd529ef6c78da2abf555f5f8bc | 1b2407f35191917818ea7f276079aa8f62429770 | /nova/tests/functional/libvirt/test_numa_servers.py | 06f301abd11145980986ca92526ec9cf45581139 | [
"Apache-2.0"
] | permissive | ISCAS-VDI/nova-base | 67838b54230d250b71fd1067c4a754afbc258883 | dbb6bba94f8a3eae5ed420d8af3431ab116c3fa7 | refs/heads/master | 2021-01-20T19:08:51.403722 | 2016-06-07T06:46:54 | 2016-06-07T06:46:54 | 60,588,545 | 0 | 1 | Apache-2.0 | 2020-07-24T00:41:15 | 2016-06-07T06:38:23 | Python | UTF-8 | Python | false | false | 6,704 | py | # Copyright (C) 2015 Red Hat, Inc
# 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.
import mock
import fixtures
from oslo_config import cfg
from oslo_log import log as logging
from nova import test
from nova.tests.functional.test_servers import ServersTestBase
from nova.tests.unit import fake_network
from nova.tests.unit.virt.libvirt import fake_libvirt_utils
from nova.tests.unit.virt.libvirt import fakelibvirt
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class NumaHostInfo(fakelibvirt.HostInfo):
def __init__(self, **kwargs):
super(NumaHostInfo, self).__init__(**kwargs)
self.numa_mempages_list = []
def get_numa_topology(self):
if self.numa_topology:
return self.numa_topology
topology = self._gen_numa_topology(self.cpu_nodes, self.cpu_sockets,
self.cpu_cores, self.cpu_threads,
self.kB_mem)
self.numa_topology = topology
# update number of active cpus
cpu_count = len(topology.cells) * len(topology.cells[0].cpus)
self.cpus = cpu_count - len(self.disabled_cpus_list)
return topology
def set_custom_numa_toplogy(self, topology):
self.numa_topology = topology
class NUMAServersTest(ServersTestBase):
def setUp(self):
super(NUMAServersTest, self).setUp()
# Replace libvirt with fakelibvirt
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.driver.libvirt_utils',
fake_libvirt_utils))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.driver.libvirt',
fakelibvirt))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.host.libvirt',
fakelibvirt))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.guest.libvirt',
fakelibvirt))
self.useFixture(fakelibvirt.FakeLibvirtFixture())
def _setup_compute_service(self):
pass
def _setup_scheduler_service(self):
self.flags(compute_driver='libvirt.LibvirtDriver')
self.flags(scheduler_driver='filter_scheduler')
self.flags(scheduler_default_filters=CONF.scheduler_default_filters
+ ['NUMATopologyFilter'])
return self.start_service('scheduler')
def _run_build_test(self, flavor_id, filter_mock, end_status='ACTIVE'):
self.compute = self.start_service('compute', host='test_compute0')
fake_network.set_stub_network_methods(self)
# Create server
good_server = self._build_server(flavor_id)
post = {'server': good_server}
created_server = self.api.post_server(post)
LOG.debug("created_server: %s" % created_server)
self.assertTrue(created_server['id'])
created_server_id = created_server['id']
# Validate that the server has been created
found_server = self.api.get_server(created_server_id)
self.assertEqual(created_server_id, found_server['id'])
# It should also be in the all-servers list
servers = self.api.get_servers()
server_ids = [s['id'] for s in servers]
self.assertIn(created_server_id, server_ids)
# Validate that NUMATopologyFilter has been called
self.assertTrue(filter_mock.called)
found_server = self._wait_for_state_change(found_server, 'BUILD')
self.assertEqual(end_status, found_server['status'])
self._delete_server(created_server_id)
def _get_topology_filter_spy(self):
host_manager = self.scheduler.manager.driver.host_manager
numa_filter_class = host_manager.filter_cls_map['NUMATopologyFilter']
host_pass_mock = mock.Mock(wraps=numa_filter_class().host_passes)
return host_pass_mock
@mock.patch('nova.virt.libvirt.LibvirtDriver._create_image')
def test_create_server_with_numa_topology(self, img_mock):
host_info = NumaHostInfo(cpu_nodes=2, cpu_sockets=1, cpu_cores=2,
cpu_threads=2, kB_mem=15740000)
fake_connection = fakelibvirt.Connection('qemu:///system',
version=1002007,
hv_version=2001000,
host_info=host_info)
# Create a flavor
extra_spec = {'hw:numa_nodes': '2'}
flavor_id = self._create_flavor(extra_spec=extra_spec)
host_pass_mock = self._get_topology_filter_spy()
with test.nested(
mock.patch('nova.virt.libvirt.host.Host.get_connection',
return_value=fake_connection),
mock.patch('nova.scheduler.filters'
'.numa_topology_filter.NUMATopologyFilter.host_passes',
side_effect=host_pass_mock)) as (conn_mock,
filter_mock):
self._run_build_test(flavor_id, filter_mock)
@mock.patch('nova.virt.libvirt.LibvirtDriver._create_image')
def test_create_server_with_numa_fails(self, img_mock):
host_info = NumaHostInfo(cpu_nodes=1, cpu_sockets=1, cpu_cores=2,
kB_mem=15740000)
fake_connection = fakelibvirt.Connection('qemu:///system',
version=1002007,
host_info=host_info)
# Create a flavor
extra_spec = {'hw:numa_nodes': '2'}
flavor_id = self._create_flavor(extra_spec=extra_spec)
host_pass_mock = self._get_topology_filter_spy()
with test.nested(
mock.patch('nova.virt.libvirt.host.Host.get_connection',
return_value=fake_connection),
mock.patch('nova.scheduler.filters'
'.numa_topology_filter.NUMATopologyFilter.host_passes',
side_effect=host_pass_mock)) as (conn_mock,
filter_mock):
self._run_build_test(flavor_id, filter_mock, end_status='ERROR')
| [
"[email protected]"
] | |
c2aa76664a5c37545f20d40f25c06ab24d60b407 | 637e0a650a1bea456164bae71c2fb152a98f5db8 | /pyntcloud/structures/octree.py | 56ca5f00ca23ef21b2fdd734fd2d70676a8b7807 | [
"Unlicense"
] | permissive | mzkaramat/pyntcloud | eaebfeea88573a1b27dc4df943c6a54dc796dc1b | 6e663045495180581ddc77d604901e408c0a0247 | refs/heads/master | 2020-03-07T17:17:51.436067 | 2018-03-29T11:30:36 | 2018-03-29T11:30:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,466 | py | # HAKUNA MATATA
"""
VoxelGrid Class
"""
import numpy as np
import pandas as pd
class Octree(object):
def __init__(self, points, max_level=2):
self.points = points
self.max_level = max_level
self.structure = pd.DataFrame(
np.zeros((self.points.shape[0], self.max_level), dtype=np.uint8))
xyzmin = points.min(0)
xyzmax = points.max(0)
#: adjust to obtain a minimum bounding box with all sides of equal lenght
diff = max(xyzmax - xyzmin) - (xyzmax - xyzmin)
xyzmin = xyzmin - diff / 2
xyzmax = xyzmax + diff / 2
self.xyzmin = xyzmin
self.xyzmax = xyzmax
self.id = "O({})".format(max_level)
self.build()
def build(self):
self.sizes = np.zeros(self.max_level)
level_ptp = max(self.xyzmax - self.xyzmin) / 2
mid_points = np.zeros_like(self.points)
mid_points[:] = (self.xyzmin + self.xyzmax) / 2
for i in range(self.max_level):
self.sizes[i] = level_ptp
level_ptp /= 2
bigger = self.points > mid_points
if i != self.max_level - 1:
mid_points = np.where(
bigger, mid_points + level_ptp, mid_points - level_ptp)
bigger = bigger.astype(np.uint8)
self.structure.loc[:, i] = (
(bigger[:, 1] * 2) + bigger[:, 0]) + (bigger[:, 2] * (2 * 2))
def get_centroids(self, level):
st = self.structure.loc[:, range(level)]
for n, i in enumerate(["x", "y", "z"]):
st[i] = self.points[:, n]
return st.groupby([x for x in range(level)], sort=False).mean().values
def get_level_as_sf(self, level):
sf = np.zeros((self.points.shape[0], level), dtype=str)
for k, v in self.structure.groupby([x for x in range(level)]).indices.items():
sf[v] = k
return [int("".join(sf[i])) for i in range(len(sf))]
def eigen_decomposition(self, level):
st = self.structure.loc[:, range(level)]
for n, i in enumerate(["x", "y", "z"]):
st[i] = self.points[:, n]
e_out = np.zeros((st.shape[0], 3))
ev1_out = np.zeros((st.shape[0], 3))
ev2_out = np.zeros((st.shape[0], 3))
ev3_out = np.zeros((st.shape[0], 3))
this_level = st.groupby([x for x in range(level)], sort=False)
# to use when groups in current level have less than 3 points
prev_level = st.groupby([x for x in range(level - 1)], sort=False)
min_level = prev_level
min_i = 1
# find the minimum level where there is no group with less than 3
while min_level.size().min() < 3:
min_i += 1
min_level = st.groupby([x for x in range(level - min_i)])
for n, g in this_level:
if g.shape[0] < 3:
g = prev_level.get_group(n[:-1])
if g.shape[0] < 3:
g = min_level.get_group(n[:-min_i])
eig_val, eig_vec = np.linalg.eig(np.cov(g.values[:, level:].T))
idx = eig_val.argsort()[::-1]
eig_val = eig_val[idx]
eig_vec = eig_vec[:, idx]
e_out[g.index.values] = eig_val
ev1_out[g.index.values] = eig_vec[:, 0]
ev2_out[g.index.values] = eig_vec[:, 1]
ev3_out[g.index.values] = eig_vec[:, 2]
return e_out[:, 0], e_out[:, 1], e_out[:, 2], ev1_out, ev2_out, ev3_out
| [
"[email protected]"
] | |
5aec005f547d8990c87b6d7e0957eaf437f08732 | ad798335dbc724845475b43249801af20b6c40f1 | /hash.py | 45ee95923820b86e9149d9ae2ab0e3ed2c7eb44e | [
"MIT"
] | permissive | zconnect-iot/ibm-iot-emulator | 7e8c7db72e11fdf0fc79600227a3e63ec12eeebf | 89b7c923b5e737df7dc9c508172f8f927a075668 | refs/heads/master | 2020-03-22T07:35:17.109194 | 2018-07-05T15:13:11 | 2018-07-05T15:13:11 | 139,709,951 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 221 | py | import bcrypt
password = b"-ankVuPqceD(LBd0Zc"
hashed = b"$2a$04$BOYcgGknfgS2yYAxtnXfEu6btv4bG8A1lE4UteDP7dU80TXW.Jmsa"
print(bcrypt.hashpw(password, bcrypt.gensalt(prefix=b"2a")))
print(bcrypt.checkpw(password, hashed))
| [
"[email protected]"
] | |
0c439fa97e81b8f694f0c8057857c21bc6e1e1c8 | f89b8631ad8b86efc816fd19acb85d1f4e09f3e3 | /vespa/interfaces/cli_batch/analysis_cli_brp_cmrr_slaser_v5.py | 17dc7acb934c689e1a19e104f4b11339ae0d4ece | [
"BSD-3-Clause"
] | permissive | fmarcanoull/vespa | 20c3772a13430d6da8a7835633baea6b5e852ee6 | 77f6289a63975068eba54bb2db5f834146fc7d01 | refs/heads/main | 2023-04-21T17:18:31.124441 | 2021-05-06T01:09:27 | 2021-05-06T01:09:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 25,413 | py | # Python modules
from __future__ import division
from __future__ import print_function
import os
import sys
import multiprocessing
import datetime
# 3rd party modules
from matplotlib.backends.backend_pdf import PdfPages
# Our modules
import vespa.analysis.util_import as util_import
import vespa.analysis.util_file_import as util_file_import
import vespa.analysis.figure_layouts as figure_layouts
import vespa.common.util.export as util_export
import vespa.common.util.time_ as util_time
# This is for Baseline sLASER data that Dinesh sent me as a follow up test
# after finishing the BRP_twix2 data that Joers sent me initially
#
# More specifically, this is for reading the Siemens Twis data for just
# the metab data, but which also has two initial FIDs that are water
# unsuppressed that I am using for ecc and water.
# Change to True to enable the assert() statements sprinkled through the code
ASSERTIONS_ENABLED = False
DESC = \
"""
Command line interface to process MRS data in Vespa-Analysis.
Data filename, preset file name, data type string and CSV output
file name values are all required for this command to function
properly.
Note. You may have to enclose data/preset/output strings in double
quotation marks for them to process properly if they have
spaces or other special characters embedded in them.
"""
class CliError(Exception):
"""Basic exception for errors when applying preset object"""
def __init__(self, msg=None):
if msg is None:
# set default error message
msg = 'A general cli error occured.'
e = sys.exc_info()
msg = 'CliErrorMessage : '+msg
msg += '\n'
msg += 'BaseErrorMessage: '+str(e)
# msg += 'BaseErrorMessage: '+e[1].message
super(CliError, self).__init__(msg)
def clean_header(header):
""" converts all values in ICE dict into a long string"""
return "need to write"
def analysis_cli(datasets, preset_metab,
preset_coil,
preset_water,
preset_ecc,
out_base,
out_prefix,
out_set=None,
basis_mmol=None,
verbose=False, debug=False, in_gui=False):
# Test for keyword values ---------------------------------------
if out_set is None:
out_set = { 'savetype' : 'lcm_multi',
'minplot' : 0.1,
'maxplot' : 4.9,
'fixphase' : True,
'fontname' : 'Courier New',
'dpi' : 300,
'pad_inches' : 0.5 }
# Sort datasets into variables ----------------------------------
data_coil, data_ecc, data_water, data_metab, basis_mmol = datasets
msg = ""
# Load and Process - Coil Combine Dataset -----------------------
if data_coil is not None:
if verbose: print(out_prefix+" - Apply Preset and Run Chain - Coil Combine")
try:
msg = out_prefix+" - " + """applying preset - coil combine"""
data_coil.apply_preset(preset_coil, voxel=(0,0,0)) # update dataset object with preset blocks and chains
msg = out_prefix+" - " + """running chain - coil combine"""
_process_all_blocks(data_coil)
except:
if not in_gui:
print(msg+'\n'+str(sys.exc_info()[1]), file=sys.stderr)
sys.exit(-1)
else:
raise CliError(msg)
# Load Preset - Ecc, Water and Metab Datasets -------------------
if verbose: print(out_prefix+"Apply Preset - Ecc, Water and Metab Datasets")
try:
# Apply presets to ecc, water and metab datasets
if data_ecc is not None and preset_ecc is not None:
msg = out_prefix+" - " + """applying preset - ecc"""
data_ecc.apply_preset(preset_ecc, voxel=(0,0,0)) # chain
if data_water is not None and preset_water is not None:
msg = out_prefix+" - " + """applying preset - water"""
data_water.apply_preset(preset_water, voxel=(0,0,0))
if data_metab is not None and preset_metab is not None:
msg = out_prefix+" - " + """applying preset - metab"""
data_metab.apply_preset(preset_metab, voxel=(0,0,0))
#----------------------------------------------------------------------
# Attach coil combine to ecc, water and metab datasets - run chain ecc
if data_coil is not None:
msg = out_prefix+" - " + """attaching coil combine to - ecc, water and metab"""
for dset in [data_ecc, data_water, data_metab]:
if dset is not None:
dset.set_associated_dataset_combine(data_coil)
if verbose: print(out_prefix+" - " + """running chain - ecc""")
if data_ecc is not None:
msg = out_prefix+" - " + """running chain - ecc"""
_process_all_blocks(data_ecc) # get combined FID for next steps
#----------------------------------------------------------------------
# Attach ecc to water and metab datasets - run chain water
if data_ecc is not None:
msg = out_prefix+" - " + """attaching ecc to - water and metab"""
for dset in [data_water, data_metab]:
if dset is not None:
dset.set_associated_dataset_ecc(data_ecc)
if verbose: print(out_prefix+" - " + """running chain - water""")
if data_water is not None:
msg = out_prefix+" - " + """running chain - water"""
_process_all_blocks(data_water)
#----------------------------------------------------------------------
# Attach mmol_basis and water to metab dataset - run chain metab
msg = out_prefix+" - " + """attaching mmol_basis and water to - metab"""
for dset in [data_metab,]:
if basis_mmol is not None:
if dset is not None:
dset.set_associated_dataset_mmol(basis_mmol)
dset.set_associated_dataset_quant(data_water)
if verbose: print(out_prefix+" - " + """running chain - metab""")
_process_all_blocks(data_metab)
except:
if not in_gui:
print('Error: '+msg+'\n'+sys.exc_info()[1].message, file=sys.stderr)
sys.exit(-1)
else:
raise CliError(msg)
#--------------------------------------------------------------------------
# Begin Output
timestamp = util_time.now(util_time.DISPLAY_TIMESTAMP_FORMAT)
# Create unique name ID for this dataset ------------------------
outxml = out_base+'provenance_'+out_prefix+'.xml'
data_metab.dataset_filename = outxml
# Save provenance to XML -----------------------------------------------------
if verbose: print(out_prefix+" - " + """Saving dataset to XML file "%s". """ % outxml)
try:
util_export.export(outxml, [data_metab,], None, None, False)
except Exception as e:
msg = """I can't write the file "%s".""" % outxml
print(msg, file=sys.stderr)
print(repr(e), file=sys.stderr)
sys.exit(-1)
# Save fitting results to PDF -----------------------------------------------------
fig_call = figure_layouts.null_call # default
if out_set['savetype'] == 'lcm':
outimg = out_base+'plot_lcm_'+out_prefix+'.pdf'
fig_call = figure_layouts.lcm_like
elif out_set['savetype'] == 'lcm_multi':
outimg = out_base+'plots_lcm_multi_'+out_prefix+'.pdf'
fig_call = figure_layouts.lcm_multipage_pdf
if verbose: print(out_prefix+" - " + """Saving Results to PDF "%s". """ % outimg)
try:
figs = fig_call(data_metab,
viffpath='Analysis - CLI Batch',
vespa_version='0.10.0-CLI',
timestamp='',
fontname=out_set['fontname'],
minplot=out_set['minplot'],
maxplot=out_set['maxplot'],
nobase=False,
extfig=None,
fixphase=out_set['fixphase'],
verbose=False,
debug=False,
quantvals=True)
# Create the PdfPages object to which we will save the pages:
# The with statement endsures object closed at end of block, even if Exception
with PdfPages(outimg) as pdf:
for fig in figs:
pdf.savefig(fig,
dpi=out_set['dpi'],
pad_inches=out_set['pad_inches'],
facecolor=fig.get_facecolor(),
edgecolor='none')
# We can also set the file's metadata via the PdfPages object:
today = datetime.date.today()
d = pdf.infodict()
d['Title'] = u'Vespa Provenance Output'
d['Author'] = u'Brian J. Soher'
d['Subject'] = u'Vespa results output'
d['Keywords'] = u'PdfPages Vespa output lcm multi-page'
d['CreationDate'] = datetime.datetime(today.year, today.month, today.day)
d['ModDate'] = datetime.datetime.today()
except Exception as e:
msg = """Failure to create/write file "%s".""" % outimg
print(msg, file=sys.stderr)
print(repr(e), file=sys.stderr)
sys.exit(-1)
# Save Water Quant and Fit results to CSV text file -----------------------
voxel = (0,0,0)
outcsv = out_base+'csv_results_collated.csv'
if verbose: print(out_prefix+" - " + """Saving Results to CSV "%s". """ % outcsv)
try:
raw = data_metab.blocks["raw"]
fit = data_metab.blocks["fit"]
val, hdr = data_metab.quant_results_as_csv(voxel, lw = fit.chain.fitted_lw,
lwmin = fit.chain.minmaxlw[0],
lwmax = fit.chain.minmaxlw[1],
source = raw.get_data_source(voxel),
dsetname = data_metab.dataset_filename,
decor1 = False)
val = ",".join(val) + "\n"
hdr = ",".join(hdr) + "\n"
hdr_flag = True
if os.path.isfile(outcsv):
with open(outcsv, 'r+') as f:
data = f.readlines()
if len(data)>1:
nlast = len(data[-1].split(','))
if nlast == len(hdr): hdr_flag = False
with open(outcsv, 'a') as f:
if hdr_flag:
f.write(hdr)
f.write(val)
except Exception as e:
msg = """Failure to create/write file "%s".""" % outcsv
print(msg, file=sys.stderr)
print(repr(e), file=sys.stderr)
sys.exit(-1)
return None, None
def _process_all_blocks(dataset):
""" for all voxels, run chain in all blocks to update """
chain_outputs = {}
voxel = dataset.all_voxels
for key in dataset.blocks.keys():
if key == 'spectral':
key = 'spectral'
block = dataset.blocks[key]
tmp = block.chain.run(voxel, entry='all')
chain_outputs[key] = tmp
if 'fit' in dataset.blocks.keys():
key = 'fit'
block = dataset.blocks[key]
block.chain.run(voxel, entry='initial_only')
key = 'spectral'
block = dataset.blocks[key]
block.set_do_fit(True, voxel[0])
tmp = block.chain.run(voxel, entry='all')
chain_outputs[key] = tmp
else:
block = dataset.blocks[key]
tmp = block.chain.run(voxel, entry='all')
chain_outputs[key] = tmp
return chain_outputs
def is_dicom(filename):
"""Returns True if the file in question is a DICOM file, else False. """
# Per the DICOM specs, a DICOM file starts with 128 reserved bytes
# followed by "DICM".
# ref: DICOM spec, Part 10: Media Storage and File Format for Media
# Interchange, 7.1 DICOM FILE META INFORMATION
if os.path.isfile(filename):
f = open(filename, "rb")
s = f.read(132)
f.close()
pattern = "DICM"
binary_pattern = pattern.encode()
return s.endswith(binary_pattern)
else:
return False
def load_preset(presetfile, verbose=False, debug=False):
if not presetfile:
return None
# Load PRESET object ----------------------------------------------
if verbose: print("""load_preset - Presetfile = "%s".""" % presetfile )
if debug: return
try:
msg = ""
try:
importer = util_import.DatasetImporter(presetfile)
except IOError:
msg = """load_preset - I can't read the preset file "%s".""" % presetfile
except SyntaxError:
msg = """load_preset - The preset file "%s" isn't valid Vespa Interchange File Format.""" % presetfile
if msg:
print(msg, file=sys.stderr)
sys.exit(-1)
else:
# Time to rock and roll!
presets = importer.go()
preset = presets[0]
except:
msg = """load_preset - Unknown exception reading Preset file "%s".""" % presetfile
print(msg, file=sys.stderr)
sys.exit(-1)
return preset
def analysis_kernel(param):
try:
datafname, fbase, out_base, fpreset_coil, fpreset_ecc, fpreset_water, fpreset_metab, fbasis_mmol, out_label, out_set, dformat = param
debug = False
verbose = True
# Use subdir names to create unique prefix for output files
parts = os.path.normpath(datafname).split(os.sep)
out_prefix = out_label+parts[-2] # Ex. 'C009'
if verbose:
print('Begin - '+out_prefix)
preset_coil = load_preset(fpreset_coil, verbose=True, debug=debug)
preset_ecc = load_preset(fpreset_ecc, verbose=True, debug=debug)
preset_water = load_preset(fpreset_water, verbose=True, debug=debug)
preset_metab = load_preset(fpreset_metab, verbose=True, debug=debug)
datasets = util_file_import.get_datasets_cli(datafname, dformat, None)
dataset_coil, dataset_water, dataset_metab = datasets
datasets = [dataset_coil, None, dataset_water, dataset_metab]
dataset_mmol, msg = util_file_import.open_viff_dataset_file([fbasis_mmol,])
for item in dataset_mmol:
datasets.append(item)
if verbose:
print("Unique Output Prefix = "+out_prefix)
print("Unique Output Base = "+out_base)
if not debug:
img0, outxml0 = analysis_cli( datasets, preset_metab,
preset_coil,
preset_water,
preset_ecc,
out_base,
out_prefix,
out_set=out_set,
basis_mmol=dataset_mmol,
verbose=True)
if verbose:
print('Finished - '+out_prefix + ", datafname - " + datafname)
except Exception as e:
if verbose:
print('Exception - '+out_prefix)
msg = "I am in - " + out_prefix
raise CliError(msg)
return (img0, out_prefix)
def get_time():
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
return current_time
def do_main():
print("Start Time - "+get_time()+"\n")
debug = False
verbose = True
single_process = False
nprocess = 8
out_set = { 'savetype' : 'lcm_multi',
'minplot' : 0.5,
'maxplot' : 4.2,
'fixphase' : False,
'fontname' : 'Courier New',
'dpi' : 300,
'pad_inches' : 0.5
}
dformat = 'siemens_twix_svs_slaser_cmrr_vb_gulin_long'
fbase = 'D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\'
out_base = fbase + 'a_results_siemens_twix_v01\\' # picked this so ends at top of dir hierarchy
out_label = 'twix_'
fpreset_coil = fbase + 'preset_analysis_brp_slaser_coil_v2_zf4.xml'
fpreset_ecc = fbase + 'preset_analysis_brp_slaser_ecc_v2_zf4_forBRP3.xml'
fpreset_water = fbase + 'preset_analysis_brp_slaser_water_v2_zf4_forBRP3.xml'
fpreset_metab = fbase + 'preset_analysis_brp_slaser_metab_indiv_v6_start5_noECC_forBRP3.xml'
fbasis_mmol = fbase + 'basis_mmol_dataset_seadMM2014_truncat2048pts_normScale100dc004zf4.xml'
fdata = [
"D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C001\\meas_MID715_vermis_test_FID77764.dat",
"D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C002\\meas_MID486_vermis_64_FID79226.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C003\\meas_MID1117_vermis_64_FID86493.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C004\\meas_MID300_vermis_test_FID88095.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C005\\meas_MID643_vermis_64_FID91736.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C006\\meas_MID3758_vermis_64_FID94847.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C009\\meas_MID33_vermis_64_FID126120.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C010\\meas_MID1479_vermis_64_FID127706.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C011\\meas_MID111_vermis_64_FID131324.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C012\\meas_MID272_vermis_64_FID132699.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C013\\meas_MID120_vermis_64_FID134271.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C014\\meas_MID524_vermis_64_FID136833.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C015\\meas_MID1363_vermis_64_FID137668.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C018\\meas_MID179_vermis_64_FID143590.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C019\\meas_MID306_vermis_64_FID148096.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C021\\meas_MID596_vermis_64_FID151466.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C022\\meas_MID1336_vermis_64_FID152202.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C023\\meas_MID2668_vermis_64_FID153530.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C024\\meas_MID459_vermis_64_FID4092.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C025\\meas_MID449_vermis_64_FID18169.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C026\\meas_MID50_vermis_64_FID18325.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C027\\meas_MID716_vermis_64_FID21828.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C028\\meas_MID1028_vermis_64_FID22950.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\C029\\meas_MID27_vermis_64_FID25010.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S101\\meas_MID483_vermis_64_FID84137.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S103\\meas_MID1960_vermis_64_FID93049.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S104\\meas_MID84_vermis_64_FID96280.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S105\\meas_MID142_vermis_64_FID97435.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S106\\meas_MID308_vermis_64_FID99354.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S107\\meas_MID1009_vermis_64_FID123778.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S108\\meas_MID2061_vermis_64_FID124830.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S109\\meas_MID382_vermis_vapor_64_FID126610.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S110\\meas_MID2618_vermis_64_FID138919.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S111\\meas_MID45_vermis_64_FID140474.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S112\\meas_MID154_vermis_64_FID140583.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S113\\meas_MID261_vermis_64_FID140690.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S114\\meas_MID40_vermis_64_FID144529.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S115\\meas_MID295_vermis_64_FID2662.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S116\\meas_MID158_vermis_64_FID4094.dat",
# "D:\\Users\\bsoher\\projects\\2015_gulin_BRP\\data_sharing\\BRP_twix_v3_long_SCA1_baseline_dinesh_2020\\S117\\meas_MID77_vermis_64_FID18907.dat",
]
datafiles = fdata
# datafiles = [fdata[7],]
#----------------------------------------------------------
# Basic file checking for existence
msg = ''
for item in [fpreset_metab,None,fpreset_water,fpreset_ecc,fbasis_mmol]:
if item is not None:
if not os.path.isfile(item):
msg += """\nPRESET FILE does not exist "%s".""" % item
if msg:
print(msg, file=sys.stderr)
sys.exit(-1)
#----------------------------------------------------------
# Run the processing
#if False: #len(datafiles) == 1 or single_process:
if len(datafiles) == 1 or single_process:
for datafile in datafiles:
params = [datafile, fbase, out_base, fpreset_coil, '', fpreset_water, fpreset_metab, fbasis_mmol, out_label, out_set, dformat]
analysis_kernel(params)
else:
params = []
for datafile in datafiles:
params.append([datafile, fbase, out_base, fpreset_coil, '', fpreset_water, fpreset_metab, fbasis_mmol, out_label, out_set, dformat])
pool = multiprocessing.Pool(processes=nprocess)
results = pool.map(analysis_kernel, params)
bob = 10
bob += 1
print("\nEnd Time - "+get_time())
if __name__ == '__main__':
do_main() | [
"[email protected]"
] | |
90fc94c313e3d1383748e2f33c4e7ebaf0982728 | ea5762e8754d6b039963b0125822afb261844cc8 | /docs/_examples/mesh-parameterisation.py | 59980c4ede312f3cd6d7cb5a8e31e278431115a8 | [
"MIT"
] | permissive | gonzalocasas/compas | 787977a4712fbfb9e230c4f433b6e2be509e4855 | 2fabc7e5c966a02d823fa453564151e1a1e7e3c6 | refs/heads/master | 2020-03-23T20:17:55.126856 | 2018-07-24T22:30:08 | 2018-07-24T22:30:08 | 142,033,431 | 0 | 0 | MIT | 2018-07-31T14:54:52 | 2018-07-23T15:27:19 | Python | UTF-8 | Python | false | false | 2,803 | py | """Parameterisation of a triangle mesh.
For more info see:
- http://www.ctralie.com/Teaching/LapMesh/
"""
from __future__ import print_function
import compas
from numpy import zeros
from scipy.sparse import coo_matrix
from scipy.sparse import block_diag
from scipy.sparse.linalg import spsolve
from compas.datastructures import Mesh
from compas.plotters import MeshPlotter
__author__ = ['Tom Van Mele', ]
__copyright__ = 'Copyright 2016 - Block Research Group, ETH Zurich'
__license__ = 'MIT'
__email__ = '[email protected]'
# make a *stanford bunny* mesh
mesh = Mesh.from_ply(compas.get_bunny())
mesh.cull_vertices()
# get any vertex of the mesh
# and its neighbours
v1 = mesh.get_any_vertex()
nbrs = mesh.vertex_neighbours(v1, ordered=True)
# make a quad containing:
# one of the neighbours
# and the CCW and CW neighbours of that neighbour, respectively
# and set them as anchors
v2 = nbrs[0]
v3 = nbrs[1]
v4 = nbrs[-1]
anchors = [v1, v2, v3, v4]
# make a laplacian matrix of the mesh
# with inplace constraints on the anchored vertices
data = []
rows = []
cols = []
key_index = mesh.key_index()
for key in mesh.vertices():
r = key_index[key]
data.append(1)
rows.append(r)
cols.append(r)
if key not in anchors:
nbrs = mesh.vertex_neighbours(key)
w = len(nbrs)
d = - 1. / w
for nbr in nbrs:
c = key_index[nbr]
data.append(d)
rows.append(r)
cols.append(c)
L = coo_matrix((data, (rows, cols)))
# construct the RHS of the equation
# with all difference vectors set to zero
# and the ones corresponding to the anchored vertices
# set to the corresponding position on a unit square
n = mesh.number_of_vertices()
d = zeros((n, 2), dtype=float)
d[key_index[v1], 0] = 1.0
d[key_index[v2], 1] = 1.0
d[key_index[v3], 0] = 1.0
d[key_index[v3], 1] = 1.0
# convert eerything to a format
# that can be solved with the sparse solver of scipy
# and solve for the parameterised xy coordinates
L = block_diag((L, L)).tocsr()
d = d.reshape((-1, 1), order='F')
x = spsolve(L, d.ravel())
# convert the result back
xy = x.reshape((-1, 2), order='F')
# update the mesh
for key, attr in mesh.vertices(True):
index = key_index[key]
attr['x'] = xy[index, 0]
attr['y'] = xy[index, 1]
# lines for visualisation
# omit the diagonal of the *hole*
lines = []
for u, v in mesh.wireframe():
if u == v1 and v == v2:
continue
if u == v2 and v == v1:
continue
lines.append({
'start': mesh.vertex_coordinates(u, 'xy'),
'end' : mesh.vertex_coordinates(v, 'xy'),
'color': '#000000',
'width': 0.5
})
# visualise the result
plotter = MeshPlotter(mesh, figsize=(10, 6))
plotter.draw_lines(lines)
plotter.show()
| [
"[email protected]"
] | |
da321f4939af9c4dab146e4bbb4bd976366d1e45 | 161ab63e46114a8359c60dfa77820a7abd181e80 | /hproxy/spider/base_spider/__init__.py | 3a06269c73e2fef0a0314e3ee15dff572110c5fb | [
"MIT"
] | permissive | yejianxin2015/hproxy | 27be1a7311bba7fc5f2c02d45658c5c57c507c76 | f40266bf7b06368d3ebfdce8d60385bcd4b93713 | refs/heads/master | 2020-03-15T09:03:38.752884 | 2018-05-11T06:51:45 | 2018-05-11T06:51:45 | 132,065,983 | 0 | 0 | MIT | 2018-05-11T06:48:52 | 2018-05-04T00:53:03 | Python | UTF-8 | Python | false | false | 178 | py | #!/usr/bin/env python
"""
Created by howie.hu at 06/04/2018.
"""
from .field import AttrField, BaseField, TextField
from .item import Item
from .proxy_spider import ProxySpider
| [
"[email protected]"
] | |
2751f620bc6323df796e8b4d26ec38990ca755de | b018b734af4170d34d28c474f68777597dba29ec | /venv/lib/python3.8/site-packages/google/cloud/monitoring_v3/proto/metric_service_pb2.py | 19a5cc2c5a5fbeaec5fc398149cac074e402497d | [] | no_license | abdulkhan94/BigDataTechnology | ae0b7f8c03831f07b791bc5898c2bb18a4c3fec5 | 7be6d3a13e8fd42d9592d7287d694d507f9070b5 | refs/heads/master | 2023-02-13T04:07:49.070798 | 2021-01-11T01:34:51 | 2021-01-11T01:34:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | true | 75,141 | py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/monitoring_v3/proto/metric_service.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
from google.api import client_pb2 as google_dot_api_dot_client__pb2
from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
from google.api import metric_pb2 as google_dot_api_dot_metric__pb2
from google.api import (
monitored_resource_pb2 as google_dot_api_dot_monitored__resource__pb2,
)
from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
from google.cloud.monitoring_v3.proto import (
alert_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_alert__pb2,
)
from google.cloud.monitoring_v3.proto import (
common_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_common__pb2,
)
from google.cloud.monitoring_v3.proto import (
metric_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2,
)
from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name="google/cloud/monitoring_v3/proto/metric_service.proto",
package="google.monitoring.v3",
syntax="proto3",
serialized_options=b"\n\030com.google.monitoring.v3B\022MetricServiceProtoP\001Z>google.golang.org/genproto/googleapis/monitoring/v3;monitoring\252\002\032Google.Cloud.Monitoring.V3\312\002\032Google\\Cloud\\Monitoring\\V3\352\002\035Google::Cloud::Monitoring::V3\352A\360\001\n*monitoring.googleapis.com/MetricDescriptor\022;projects/{project}/metricDescriptors/{metric_descriptor=**}\022Eorganizations/{organization}/metricDescriptors/{metric_descriptor=**}\0229folders/{folder}/metricDescriptors/{metric_descriptor=**}\022\001* \001\352A\267\002\n5monitoring.googleapis.com/MonitoredResourceDescriptor\022Oprojects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}\022Yorganizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}\022Mfolders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}\022\001* \001",
serialized_pb=b'\n5google/cloud/monitoring_v3/proto/metric_service.proto\x12\x14google.monitoring.v3\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x17google/api/metric.proto\x1a#google/api/monitored_resource.proto\x1a\x19google/api/resource.proto\x1a,google/cloud/monitoring_v3/proto/alert.proto\x1a-google/cloud/monitoring_v3/proto/common.proto\x1a-google/cloud/monitoring_v3/proto/metric.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x17google/rpc/status.proto"\xad\x01\n\'ListMonitoredResourceDescriptorsRequest\x12K\n\x04name\x18\x05 \x01(\tB=\xe0\x41\x02\xfa\x41\x37\x12\x35monitoring.googleapis.com/MonitoredResourceDescriptor\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"\x8a\x01\n(ListMonitoredResourceDescriptorsResponse\x12\x45\n\x14resource_descriptors\x18\x01 \x03(\x0b\x32\'.google.api.MonitoredResourceDescriptor\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"t\n%GetMonitoredResourceDescriptorRequest\x12K\n\x04name\x18\x03 \x01(\tB=\xe0\x41\x02\xfa\x41\x37\n5monitoring.googleapis.com/MonitoredResourceDescriptor"\x97\x01\n\x1cListMetricDescriptorsRequest\x12@\n\x04name\x18\x05 \x01(\tB2\xe0\x41\x02\xfa\x41,\x12*monitoring.googleapis.com/MetricDescriptor\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"r\n\x1dListMetricDescriptorsResponse\x12\x38\n\x12metric_descriptors\x18\x01 \x03(\x0b\x32\x1c.google.api.MetricDescriptor\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"^\n\x1aGetMetricDescriptorRequest\x12@\n\x04name\x18\x03 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*monitoring.googleapis.com/MetricDescriptor"\x9f\x01\n\x1d\x43reateMetricDescriptorRequest\x12@\n\x04name\x18\x03 \x01(\tB2\xe0\x41\x02\xfa\x41,\x12*monitoring.googleapis.com/MetricDescriptor\x12<\n\x11metric_descriptor\x18\x02 \x01(\x0b\x32\x1c.google.api.MetricDescriptorB\x03\xe0\x41\x02"a\n\x1d\x44\x65leteMetricDescriptorRequest\x12@\n\x04name\x18\x03 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*monitoring.googleapis.com/MetricDescriptor"\x93\x03\n\x15ListTimeSeriesRequest\x12\x41\n\x04name\x18\n \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x08interval\x18\x04 \x01(\x0b\x32".google.monitoring.v3.TimeIntervalB\x03\xe0\x41\x02\x12\x36\n\x0b\x61ggregation\x18\x05 \x01(\x0b\x32!.google.monitoring.v3.Aggregation\x12\x10\n\x08order_by\x18\x06 \x01(\t\x12M\n\x04view\x18\x07 \x01(\x0e\x32:.google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesViewB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x08 \x01(\x05\x12\x12\n\npage_token\x18\t \x01(\t"\'\n\x0eTimeSeriesView\x12\x08\n\x04\x46ULL\x10\x00\x12\x0b\n\x07HEADERS\x10\x01"\x96\x01\n\x16ListTimeSeriesResponse\x12\x35\n\x0btime_series\x18\x01 \x03(\x0b\x32 .google.monitoring.v3.TimeSeries\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12,\n\x10\x65xecution_errors\x18\x03 \x03(\x0b\x32\x12.google.rpc.Status"\x98\x01\n\x17\x43reateTimeSeriesRequest\x12\x41\n\x04name\x18\x03 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12:\n\x0btime_series\x18\x02 \x03(\x0b\x32 .google.monitoring.v3.TimeSeriesB\x03\xe0\x41\x02"z\n\x15\x43reateTimeSeriesError\x12\x39\n\x0btime_series\x18\x01 \x01(\x0b\x32 .google.monitoring.v3.TimeSeriesB\x02\x18\x01\x12&\n\x06status\x18\x02 \x01(\x0b\x32\x12.google.rpc.StatusB\x02\x18\x01"\xd8\x01\n\x17\x43reateTimeSeriesSummary\x12\x19\n\x11total_point_count\x18\x01 \x01(\x05\x12\x1b\n\x13success_point_count\x18\x02 \x01(\x05\x12\x43\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x33.google.monitoring.v3.CreateTimeSeriesSummary.Error\x1a@\n\x05\x45rror\x12"\n\x06status\x18\x01 \x01(\x0b\x32\x12.google.rpc.Status\x12\x13\n\x0bpoint_count\x18\x02 \x01(\x05"\\\n\x16QueryTimeSeriesRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05query\x18\x07 \x01(\t\x12\x11\n\tpage_size\x18\t \x01(\x05\x12\x12\n\npage_token\x18\n \x01(\t"\xea\x01\n\x17QueryTimeSeriesResponse\x12J\n\x16time_series_descriptor\x18\x08 \x01(\x0b\x32*.google.monitoring.v3.TimeSeriesDescriptor\x12>\n\x10time_series_data\x18\t \x03(\x0b\x32$.google.monitoring.v3.TimeSeriesData\x12\x17\n\x0fnext_page_token\x18\n \x01(\t\x12*\n\x0epartial_errors\x18\x0b \x03(\x0b\x32\x12.google.rpc.Status"Y\n\x0eQueryErrorList\x12\x30\n\x06\x65rrors\x18\x01 \x03(\x0b\x32 .google.monitoring.v3.QueryError\x12\x15\n\rerror_summary\x18\x02 \x01(\t2\xbe\r\n\rMetricService\x12\xe4\x01\n ListMonitoredResourceDescriptors\x12=.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest\x1a>.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse"A\x82\xd3\xe4\x93\x02\x34\x12\x32/v3/{name=projects/*}/monitoredResourceDescriptors\xda\x41\x04name\x12\xcc\x01\n\x1eGetMonitoredResourceDescriptor\x12;.google.monitoring.v3.GetMonitoredResourceDescriptorRequest\x1a\'.google.api.MonitoredResourceDescriptor"D\x82\xd3\xe4\x93\x02\x37\x12\x35/v3/{name=projects/*/monitoredResourceDescriptors/**}\xda\x41\x04name\x12\xb8\x01\n\x15ListMetricDescriptors\x12\x32.google.monitoring.v3.ListMetricDescriptorsRequest\x1a\x33.google.monitoring.v3.ListMetricDescriptorsResponse"6\x82\xd3\xe4\x93\x02)\x12\'/v3/{name=projects/*}/metricDescriptors\xda\x41\x04name\x12\xa0\x01\n\x13GetMetricDescriptor\x12\x30.google.monitoring.v3.GetMetricDescriptorRequest\x1a\x1c.google.api.MetricDescriptor"9\x82\xd3\xe4\x93\x02,\x12*/v3/{name=projects/*/metricDescriptors/**}\xda\x41\x04name\x12\xc8\x01\n\x16\x43reateMetricDescriptor\x12\x33.google.monitoring.v3.CreateMetricDescriptorRequest\x1a\x1c.google.api.MetricDescriptor"[\x82\xd3\xe4\x93\x02<"\'/v3/{name=projects/*}/metricDescriptors:\x11metric_descriptor\xda\x41\x16name,metric_descriptor\x12\xa0\x01\n\x16\x44\x65leteMetricDescriptor\x12\x33.google.monitoring.v3.DeleteMetricDescriptorRequest\x1a\x16.google.protobuf.Empty"9\x82\xd3\xe4\x93\x02,**/v3/{name=projects/*/metricDescriptors/**}\xda\x41\x04name\x12\xb1\x01\n\x0eListTimeSeries\x12+.google.monitoring.v3.ListTimeSeriesRequest\x1a,.google.monitoring.v3.ListTimeSeriesResponse"D\x82\xd3\xe4\x93\x02"\x12 /v3/{name=projects/*}/timeSeries\xda\x41\x19name,filter,interval,view\x12\x99\x01\n\x10\x43reateTimeSeries\x12-.google.monitoring.v3.CreateTimeSeriesRequest\x1a\x16.google.protobuf.Empty">\x82\xd3\xe4\x93\x02%" /v3/{name=projects/*}/timeSeries:\x01*\xda\x41\x10name,time_series\x1a\xda\x01\xca\x41\x19monitoring.googleapis.com\xd2\x41\xba\x01https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read,https://www.googleapis.com/auth/monitoring.writeB\xf9\x05\n\x18\x63om.google.monitoring.v3B\x12MetricServiceProtoP\x01Z>google.golang.org/genproto/googleapis/monitoring/v3;monitoring\xaa\x02\x1aGoogle.Cloud.Monitoring.V3\xca\x02\x1aGoogle\\Cloud\\Monitoring\\V3\xea\x02\x1dGoogle::Cloud::Monitoring::V3\xea\x41\xf0\x01\n*monitoring.googleapis.com/MetricDescriptor\x12;projects/{project}/metricDescriptors/{metric_descriptor=**}\x12\x45organizations/{organization}/metricDescriptors/{metric_descriptor=**}\x12\x39\x66olders/{folder}/metricDescriptors/{metric_descriptor=**}\x12\x01* \x01\xea\x41\xb7\x02\n5monitoring.googleapis.com/MonitoredResourceDescriptor\x12Oprojects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}\x12Yorganizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}\x12Mfolders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}\x12\x01* \x01\x62\x06proto3',
dependencies=[
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
google_dot_api_dot_client__pb2.DESCRIPTOR,
google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
google_dot_api_dot_metric__pb2.DESCRIPTOR,
google_dot_api_dot_monitored__resource__pb2.DESCRIPTOR,
google_dot_api_dot_resource__pb2.DESCRIPTOR,
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_alert__pb2.DESCRIPTOR,
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_common__pb2.DESCRIPTOR,
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2.DESCRIPTOR,
google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,
google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,
google_dot_rpc_dot_status__pb2.DESCRIPTOR,
],
)
_LISTTIMESERIESREQUEST_TIMESERIESVIEW = _descriptor.EnumDescriptor(
name="TimeSeriesView",
full_name="google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView",
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name="FULL", index=0, number=0, serialized_options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="HEADERS", index=1, number=1, serialized_options=None, type=None
),
],
containing_type=None,
serialized_options=None,
serialized_start=1909,
serialized_end=1948,
)
_sym_db.RegisterEnumDescriptor(_LISTTIMESERIESREQUEST_TIMESERIESVIEW)
_LISTMONITOREDRESOURCEDESCRIPTORSREQUEST = _descriptor.Descriptor(
name="ListMonitoredResourceDescriptorsRequest",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.name",
index=0,
number=5,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A7\0225monitoring.googleapis.com/MonitoredResourceDescriptor",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="filter",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.filter",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_size",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.page_size",
index=2,
number=3,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_token",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.page_token",
index=3,
number=4,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=483,
serialized_end=656,
)
_LISTMONITOREDRESOURCEDESCRIPTORSRESPONSE = _descriptor.Descriptor(
name="ListMonitoredResourceDescriptorsResponse",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsResponse",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="resource_descriptors",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.resource_descriptors",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="next_page_token",
full_name="google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.next_page_token",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=659,
serialized_end=797,
)
_GETMONITOREDRESOURCEDESCRIPTORREQUEST = _descriptor.Descriptor(
name="GetMonitoredResourceDescriptorRequest",
full_name="google.monitoring.v3.GetMonitoredResourceDescriptorRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.GetMonitoredResourceDescriptorRequest.name",
index=0,
number=3,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A7\n5monitoring.googleapis.com/MonitoredResourceDescriptor",
file=DESCRIPTOR,
)
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=799,
serialized_end=915,
)
_LISTMETRICDESCRIPTORSREQUEST = _descriptor.Descriptor(
name="ListMetricDescriptorsRequest",
full_name="google.monitoring.v3.ListMetricDescriptorsRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.ListMetricDescriptorsRequest.name",
index=0,
number=5,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A,\022*monitoring.googleapis.com/MetricDescriptor",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="filter",
full_name="google.monitoring.v3.ListMetricDescriptorsRequest.filter",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_size",
full_name="google.monitoring.v3.ListMetricDescriptorsRequest.page_size",
index=2,
number=3,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_token",
full_name="google.monitoring.v3.ListMetricDescriptorsRequest.page_token",
index=3,
number=4,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=918,
serialized_end=1069,
)
_LISTMETRICDESCRIPTORSRESPONSE = _descriptor.Descriptor(
name="ListMetricDescriptorsResponse",
full_name="google.monitoring.v3.ListMetricDescriptorsResponse",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="metric_descriptors",
full_name="google.monitoring.v3.ListMetricDescriptorsResponse.metric_descriptors",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="next_page_token",
full_name="google.monitoring.v3.ListMetricDescriptorsResponse.next_page_token",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1071,
serialized_end=1185,
)
_GETMETRICDESCRIPTORREQUEST = _descriptor.Descriptor(
name="GetMetricDescriptorRequest",
full_name="google.monitoring.v3.GetMetricDescriptorRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.GetMetricDescriptorRequest.name",
index=0,
number=3,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A,\n*monitoring.googleapis.com/MetricDescriptor",
file=DESCRIPTOR,
)
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1187,
serialized_end=1281,
)
_CREATEMETRICDESCRIPTORREQUEST = _descriptor.Descriptor(
name="CreateMetricDescriptorRequest",
full_name="google.monitoring.v3.CreateMetricDescriptorRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.CreateMetricDescriptorRequest.name",
index=0,
number=3,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A,\022*monitoring.googleapis.com/MetricDescriptor",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="metric_descriptor",
full_name="google.monitoring.v3.CreateMetricDescriptorRequest.metric_descriptor",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1284,
serialized_end=1443,
)
_DELETEMETRICDESCRIPTORREQUEST = _descriptor.Descriptor(
name="DeleteMetricDescriptorRequest",
full_name="google.monitoring.v3.DeleteMetricDescriptorRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.DeleteMetricDescriptorRequest.name",
index=0,
number=3,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A,\n*monitoring.googleapis.com/MetricDescriptor",
file=DESCRIPTOR,
)
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1445,
serialized_end=1542,
)
_LISTTIMESERIESREQUEST = _descriptor.Descriptor(
name="ListTimeSeriesRequest",
full_name="google.monitoring.v3.ListTimeSeriesRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.ListTimeSeriesRequest.name",
index=0,
number=10,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="filter",
full_name="google.monitoring.v3.ListTimeSeriesRequest.filter",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="interval",
full_name="google.monitoring.v3.ListTimeSeriesRequest.interval",
index=2,
number=4,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="aggregation",
full_name="google.monitoring.v3.ListTimeSeriesRequest.aggregation",
index=3,
number=5,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="order_by",
full_name="google.monitoring.v3.ListTimeSeriesRequest.order_by",
index=4,
number=6,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="view",
full_name="google.monitoring.v3.ListTimeSeriesRequest.view",
index=5,
number=7,
type=14,
cpp_type=8,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_size",
full_name="google.monitoring.v3.ListTimeSeriesRequest.page_size",
index=6,
number=8,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_token",
full_name="google.monitoring.v3.ListTimeSeriesRequest.page_token",
index=7,
number=9,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[_LISTTIMESERIESREQUEST_TIMESERIESVIEW],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1545,
serialized_end=1948,
)
_LISTTIMESERIESRESPONSE = _descriptor.Descriptor(
name="ListTimeSeriesResponse",
full_name="google.monitoring.v3.ListTimeSeriesResponse",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="time_series",
full_name="google.monitoring.v3.ListTimeSeriesResponse.time_series",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="next_page_token",
full_name="google.monitoring.v3.ListTimeSeriesResponse.next_page_token",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="execution_errors",
full_name="google.monitoring.v3.ListTimeSeriesResponse.execution_errors",
index=2,
number=3,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1951,
serialized_end=2101,
)
_CREATETIMESERIESREQUEST = _descriptor.Descriptor(
name="CreateTimeSeriesRequest",
full_name="google.monitoring.v3.CreateTimeSeriesRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.CreateTimeSeriesRequest.name",
index=0,
number=3,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="time_series",
full_name="google.monitoring.v3.CreateTimeSeriesRequest.time_series",
index=1,
number=2,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2104,
serialized_end=2256,
)
_CREATETIMESERIESERROR = _descriptor.Descriptor(
name="CreateTimeSeriesError",
full_name="google.monitoring.v3.CreateTimeSeriesError",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="time_series",
full_name="google.monitoring.v3.CreateTimeSeriesError.time_series",
index=0,
number=1,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\030\001",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="status",
full_name="google.monitoring.v3.CreateTimeSeriesError.status",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=b"\030\001",
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2258,
serialized_end=2380,
)
_CREATETIMESERIESSUMMARY_ERROR = _descriptor.Descriptor(
name="Error",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.Error",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="status",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.Error.status",
index=0,
number=1,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="point_count",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.Error.point_count",
index=1,
number=2,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2535,
serialized_end=2599,
)
_CREATETIMESERIESSUMMARY = _descriptor.Descriptor(
name="CreateTimeSeriesSummary",
full_name="google.monitoring.v3.CreateTimeSeriesSummary",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="total_point_count",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.total_point_count",
index=0,
number=1,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="success_point_count",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.success_point_count",
index=1,
number=2,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="errors",
full_name="google.monitoring.v3.CreateTimeSeriesSummary.errors",
index=2,
number=3,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[_CREATETIMESERIESSUMMARY_ERROR],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2383,
serialized_end=2599,
)
_QUERYTIMESERIESREQUEST = _descriptor.Descriptor(
name="QueryTimeSeriesRequest",
full_name="google.monitoring.v3.QueryTimeSeriesRequest",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.monitoring.v3.QueryTimeSeriesRequest.name",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="query",
full_name="google.monitoring.v3.QueryTimeSeriesRequest.query",
index=1,
number=7,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_size",
full_name="google.monitoring.v3.QueryTimeSeriesRequest.page_size",
index=2,
number=9,
type=5,
cpp_type=1,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="page_token",
full_name="google.monitoring.v3.QueryTimeSeriesRequest.page_token",
index=3,
number=10,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2601,
serialized_end=2693,
)
_QUERYTIMESERIESRESPONSE = _descriptor.Descriptor(
name="QueryTimeSeriesResponse",
full_name="google.monitoring.v3.QueryTimeSeriesResponse",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="time_series_descriptor",
full_name="google.monitoring.v3.QueryTimeSeriesResponse.time_series_descriptor",
index=0,
number=8,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="time_series_data",
full_name="google.monitoring.v3.QueryTimeSeriesResponse.time_series_data",
index=1,
number=9,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="next_page_token",
full_name="google.monitoring.v3.QueryTimeSeriesResponse.next_page_token",
index=2,
number=10,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="partial_errors",
full_name="google.monitoring.v3.QueryTimeSeriesResponse.partial_errors",
index=3,
number=11,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2696,
serialized_end=2930,
)
_QUERYERRORLIST = _descriptor.Descriptor(
name="QueryErrorList",
full_name="google.monitoring.v3.QueryErrorList",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="errors",
full_name="google.monitoring.v3.QueryErrorList.errors",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="error_summary",
full_name="google.monitoring.v3.QueryErrorList.error_summary",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=2932,
serialized_end=3021,
)
_LISTMONITOREDRESOURCEDESCRIPTORSRESPONSE.fields_by_name[
"resource_descriptors"
].message_type = (
google_dot_api_dot_monitored__resource__pb2._MONITOREDRESOURCEDESCRIPTOR
)
_LISTMETRICDESCRIPTORSRESPONSE.fields_by_name[
"metric_descriptors"
].message_type = google_dot_api_dot_metric__pb2._METRICDESCRIPTOR
_CREATEMETRICDESCRIPTORREQUEST.fields_by_name[
"metric_descriptor"
].message_type = google_dot_api_dot_metric__pb2._METRICDESCRIPTOR
_LISTTIMESERIESREQUEST.fields_by_name[
"interval"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_common__pb2._TIMEINTERVAL
)
_LISTTIMESERIESREQUEST.fields_by_name[
"aggregation"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_common__pb2._AGGREGATION
)
_LISTTIMESERIESREQUEST.fields_by_name[
"view"
].enum_type = _LISTTIMESERIESREQUEST_TIMESERIESVIEW
_LISTTIMESERIESREQUEST_TIMESERIESVIEW.containing_type = _LISTTIMESERIESREQUEST
_LISTTIMESERIESRESPONSE.fields_by_name[
"time_series"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._TIMESERIES
)
_LISTTIMESERIESRESPONSE.fields_by_name[
"execution_errors"
].message_type = google_dot_rpc_dot_status__pb2._STATUS
_CREATETIMESERIESREQUEST.fields_by_name[
"time_series"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._TIMESERIES
)
_CREATETIMESERIESERROR.fields_by_name[
"time_series"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._TIMESERIES
)
_CREATETIMESERIESERROR.fields_by_name[
"status"
].message_type = google_dot_rpc_dot_status__pb2._STATUS
_CREATETIMESERIESSUMMARY_ERROR.fields_by_name[
"status"
].message_type = google_dot_rpc_dot_status__pb2._STATUS
_CREATETIMESERIESSUMMARY_ERROR.containing_type = _CREATETIMESERIESSUMMARY
_CREATETIMESERIESSUMMARY.fields_by_name[
"errors"
].message_type = _CREATETIMESERIESSUMMARY_ERROR
_QUERYTIMESERIESRESPONSE.fields_by_name[
"time_series_descriptor"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._TIMESERIESDESCRIPTOR
)
_QUERYTIMESERIESRESPONSE.fields_by_name[
"time_series_data"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._TIMESERIESDATA
)
_QUERYTIMESERIESRESPONSE.fields_by_name[
"partial_errors"
].message_type = google_dot_rpc_dot_status__pb2._STATUS
_QUERYERRORLIST.fields_by_name[
"errors"
].message_type = (
google_dot_cloud_dot_monitoring__v3_dot_proto_dot_metric__pb2._QUERYERROR
)
DESCRIPTOR.message_types_by_name[
"ListMonitoredResourceDescriptorsRequest"
] = _LISTMONITOREDRESOURCEDESCRIPTORSREQUEST
DESCRIPTOR.message_types_by_name[
"ListMonitoredResourceDescriptorsResponse"
] = _LISTMONITOREDRESOURCEDESCRIPTORSRESPONSE
DESCRIPTOR.message_types_by_name[
"GetMonitoredResourceDescriptorRequest"
] = _GETMONITOREDRESOURCEDESCRIPTORREQUEST
DESCRIPTOR.message_types_by_name[
"ListMetricDescriptorsRequest"
] = _LISTMETRICDESCRIPTORSREQUEST
DESCRIPTOR.message_types_by_name[
"ListMetricDescriptorsResponse"
] = _LISTMETRICDESCRIPTORSRESPONSE
DESCRIPTOR.message_types_by_name[
"GetMetricDescriptorRequest"
] = _GETMETRICDESCRIPTORREQUEST
DESCRIPTOR.message_types_by_name[
"CreateMetricDescriptorRequest"
] = _CREATEMETRICDESCRIPTORREQUEST
DESCRIPTOR.message_types_by_name[
"DeleteMetricDescriptorRequest"
] = _DELETEMETRICDESCRIPTORREQUEST
DESCRIPTOR.message_types_by_name["ListTimeSeriesRequest"] = _LISTTIMESERIESREQUEST
DESCRIPTOR.message_types_by_name["ListTimeSeriesResponse"] = _LISTTIMESERIESRESPONSE
DESCRIPTOR.message_types_by_name["CreateTimeSeriesRequest"] = _CREATETIMESERIESREQUEST
DESCRIPTOR.message_types_by_name["CreateTimeSeriesError"] = _CREATETIMESERIESERROR
DESCRIPTOR.message_types_by_name["CreateTimeSeriesSummary"] = _CREATETIMESERIESSUMMARY
DESCRIPTOR.message_types_by_name["QueryTimeSeriesRequest"] = _QUERYTIMESERIESREQUEST
DESCRIPTOR.message_types_by_name["QueryTimeSeriesResponse"] = _QUERYTIMESERIESRESPONSE
DESCRIPTOR.message_types_by_name["QueryErrorList"] = _QUERYERRORLIST
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ListMonitoredResourceDescriptorsRequest = _reflection.GeneratedProtocolMessageType(
"ListMonitoredResourceDescriptorsRequest",
(_message.Message,),
{
"DESCRIPTOR": _LISTMONITOREDRESOURCEDESCRIPTORSREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListMonitoredResourceDescriptors`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
filter:
An optional `filter
<https://cloud.google.com/monitoring/api/v3/filters>`__
describing the descriptors to be returned. The filter can
reference the descriptor’s type and labels. For example, the
following filter returns only Google Compute Engine
descriptors that have an ``id`` label: ::
resource.type = starts_with("gce_") AND resource.label:id
page_size:
A positive number that is the maximum number of results to
return.
page_token:
If this field is not empty then it must contain the
``nextPageToken`` value returned by a previous call to this
method. Using this field causes the method to return
additional results from the previous method call.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListMonitoredResourceDescriptorsRequest)
},
)
_sym_db.RegisterMessage(ListMonitoredResourceDescriptorsRequest)
ListMonitoredResourceDescriptorsResponse = _reflection.GeneratedProtocolMessageType(
"ListMonitoredResourceDescriptorsResponse",
(_message.Message,),
{
"DESCRIPTOR": _LISTMONITOREDRESOURCEDESCRIPTORSRESPONSE,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListMonitoredResourceDescriptors`` response.
Attributes:
resource_descriptors:
The monitored resource descriptors that are available to this
project and that match ``filter``, if present.
next_page_token:
If there are more results than have been returned, then this
field is set to a non-empty value. To see the additional
results, use that value as ``page_token`` in the next call to
this method.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListMonitoredResourceDescriptorsResponse)
},
)
_sym_db.RegisterMessage(ListMonitoredResourceDescriptorsResponse)
GetMonitoredResourceDescriptorRequest = _reflection.GeneratedProtocolMessageType(
"GetMonitoredResourceDescriptorRequest",
(_message.Message,),
{
"DESCRIPTOR": _GETMONITOREDRESOURCEDESCRIPTORREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``GetMonitoredResourceDescriptor`` request.
Attributes:
name:
Required. The monitored resource descriptor to get. The format
is: :: projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceD
escriptors/[RESOURCE_TYPE] The ``[RESOURCE_TYPE]`` is a
predefined type, such as ``cloudsql_database``.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.GetMonitoredResourceDescriptorRequest)
},
)
_sym_db.RegisterMessage(GetMonitoredResourceDescriptorRequest)
ListMetricDescriptorsRequest = _reflection.GeneratedProtocolMessageType(
"ListMetricDescriptorsRequest",
(_message.Message,),
{
"DESCRIPTOR": _LISTMETRICDESCRIPTORSREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListMetricDescriptors`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
filter:
If this field is empty, all custom and system-defined metric
descriptors are returned. Otherwise, the `filter
<https://cloud.google.com/monitoring/api/v3/filters>`__
specifies which metric descriptors are to be returned. For
example, the following filter matches all `custom metrics
<https://cloud.google.com/monitoring/custom-metrics>`__: ::
metric.type = starts_with("custom.googleapis.com/")
page_size:
A positive number that is the maximum number of results to
return.
page_token:
If this field is not empty then it must contain the
``nextPageToken`` value returned by a previous call to this
method. Using this field causes the method to return
additional results from the previous method call.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListMetricDescriptorsRequest)
},
)
_sym_db.RegisterMessage(ListMetricDescriptorsRequest)
ListMetricDescriptorsResponse = _reflection.GeneratedProtocolMessageType(
"ListMetricDescriptorsResponse",
(_message.Message,),
{
"DESCRIPTOR": _LISTMETRICDESCRIPTORSRESPONSE,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListMetricDescriptors`` response.
Attributes:
metric_descriptors:
The metric descriptors that are available to the project and
that match the value of ``filter``, if present.
next_page_token:
If there are more results than have been returned, then this
field is set to a non-empty value. To see the additional
results, use that value as ``page_token`` in the next call to
this method.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListMetricDescriptorsResponse)
},
)
_sym_db.RegisterMessage(ListMetricDescriptorsResponse)
GetMetricDescriptorRequest = _reflection.GeneratedProtocolMessageType(
"GetMetricDescriptorRequest",
(_message.Message,),
{
"DESCRIPTOR": _GETMETRICDESCRIPTORREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``GetMetricDescriptor`` request.
Attributes:
name:
Required. The metric descriptor on which to execute the
request. The format is: ::
projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
An example value of ``[METRIC_ID]`` is
``"compute.googleapis.com/instance/disk/read_bytes_count"``.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.GetMetricDescriptorRequest)
},
)
_sym_db.RegisterMessage(GetMetricDescriptorRequest)
CreateMetricDescriptorRequest = _reflection.GeneratedProtocolMessageType(
"CreateMetricDescriptorRequest",
(_message.Message,),
{
"DESCRIPTOR": _CREATEMETRICDESCRIPTORREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``CreateMetricDescriptor`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
metric_descriptor:
Required. The new `custom metric
<https://cloud.google.com/monitoring/custom-metrics>`__
descriptor.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.CreateMetricDescriptorRequest)
},
)
_sym_db.RegisterMessage(CreateMetricDescriptorRequest)
DeleteMetricDescriptorRequest = _reflection.GeneratedProtocolMessageType(
"DeleteMetricDescriptorRequest",
(_message.Message,),
{
"DESCRIPTOR": _DELETEMETRICDESCRIPTORREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``DeleteMetricDescriptor`` request.
Attributes:
name:
Required. The metric descriptor on which to execute the
request. The format is: ::
projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
An example of ``[METRIC_ID]`` is:
``"custom.googleapis.com/my_test_metric"``.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.DeleteMetricDescriptorRequest)
},
)
_sym_db.RegisterMessage(DeleteMetricDescriptorRequest)
ListTimeSeriesRequest = _reflection.GeneratedProtocolMessageType(
"ListTimeSeriesRequest",
(_message.Message,),
{
"DESCRIPTOR": _LISTTIMESERIESREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListTimeSeries`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
filter:
Required. A `monitoring filter
<https://cloud.google.com/monitoring/api/v3/filters>`__ that
specifies which time series should be returned. The filter
must specify a single metric type, and can additionally
specify metric labels and other information. For example: ::
metric.type = "compute.googleapis.com/instance/cpu/usage_time"
AND metric.labels.instance_name = "my-instance-name"
interval:
Required. The time interval for which results should be
returned. Only time series that contain data points in the
specified interval are included in the response.
aggregation:
Specifies the alignment of data points in individual time
series as well as how to combine the retrieved time series
across specified labels. By default (if no ``aggregation`` is
explicitly specified), the raw time series data is returned.
order_by:
Unsupported: must be left blank. The points in each time
series are currently returned in reverse time order (most
recent to oldest).
view:
Required. Specifies which information is returned about the
time series.
page_size:
A positive number that is the maximum number of results to
return. If ``page_size`` is empty or more than 100,000
results, the effective ``page_size`` is 100,000 results. If
``view`` is set to ``FULL``, this is the maximum number of
``Points`` returned. If ``view`` is set to ``HEADERS``, this
is the maximum number of ``TimeSeries`` returned.
page_token:
If this field is not empty then it must contain the
``nextPageToken`` value returned by a previous call to this
method. Using this field causes the method to return
additional results from the previous method call.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListTimeSeriesRequest)
},
)
_sym_db.RegisterMessage(ListTimeSeriesRequest)
ListTimeSeriesResponse = _reflection.GeneratedProtocolMessageType(
"ListTimeSeriesResponse",
(_message.Message,),
{
"DESCRIPTOR": _LISTTIMESERIESRESPONSE,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``ListTimeSeries`` response.
Attributes:
time_series:
One or more time series that match the filter included in the
request.
next_page_token:
If there are more results than have been returned, then this
field is set to a non-empty value. To see the additional
results, use that value as ``page_token`` in the next call to
this method.
execution_errors:
Query execution errors that may have caused the time series
data returned to be incomplete.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.ListTimeSeriesResponse)
},
)
_sym_db.RegisterMessage(ListTimeSeriesResponse)
CreateTimeSeriesRequest = _reflection.GeneratedProtocolMessageType(
"CreateTimeSeriesRequest",
(_message.Message,),
{
"DESCRIPTOR": _CREATETIMESERIESREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``CreateTimeSeries`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
time_series:
Required. The new data to be added to a list of time series.
Adds at most one data point to each of several time series.
The new data point must be more recent than any other point in
its time series. Each ``TimeSeries`` value must fully specify
a unique time series by supplying all label values for the
metric and the monitored resource. The maximum number of
``TimeSeries`` objects per ``Create`` request is 200.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.CreateTimeSeriesRequest)
},
)
_sym_db.RegisterMessage(CreateTimeSeriesRequest)
CreateTimeSeriesError = _reflection.GeneratedProtocolMessageType(
"CreateTimeSeriesError",
(_message.Message,),
{
"DESCRIPTOR": _CREATETIMESERIESERROR,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """DEPRECATED. Used to hold per-time-series error status.
Attributes:
time_series:
DEPRECATED. Time series ID that resulted in the ``status``
error.
status:
DEPRECATED. The status of the requested write operation for
``time_series``.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.CreateTimeSeriesError)
},
)
_sym_db.RegisterMessage(CreateTimeSeriesError)
CreateTimeSeriesSummary = _reflection.GeneratedProtocolMessageType(
"CreateTimeSeriesSummary",
(_message.Message,),
{
"Error": _reflection.GeneratedProtocolMessageType(
"Error",
(_message.Message,),
{
"DESCRIPTOR": _CREATETIMESERIESSUMMARY_ERROR,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """Detailed information about an error category.
Attributes:
status:
The status of the requested write operation.
point_count:
The number of points that couldn’t be written because of
``status``.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.CreateTimeSeriesSummary.Error)
},
),
"DESCRIPTOR": _CREATETIMESERIESSUMMARY,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """Summary of the result of a failed request to write data to
a time series.
Attributes:
total_point_count:
The number of points in the request.
success_point_count:
The number of points that were successfully written.
errors:
The number of points that failed to be written. Order is not
guaranteed.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.CreateTimeSeriesSummary)
},
)
_sym_db.RegisterMessage(CreateTimeSeriesSummary)
_sym_db.RegisterMessage(CreateTimeSeriesSummary.Error)
QueryTimeSeriesRequest = _reflection.GeneratedProtocolMessageType(
"QueryTimeSeriesRequest",
(_message.Message,),
{
"DESCRIPTOR": _QUERYTIMESERIESREQUEST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``QueryTimeSeries`` request.
Attributes:
name:
Required. The project on which to execute the request. The
format is: :: projects/[PROJECT_ID_OR_NUMBER]
query:
Required. The query in the monitoring query language format.
The default time zone is in UTC.
page_size:
A positive number that is the maximum number of
time_series_data to return.
page_token:
If this field is not empty then it must contain the
``nextPageToken`` value returned by a previous call to this
method. Using this field causes the method to return
additional results from the previous method call.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.QueryTimeSeriesRequest)
},
)
_sym_db.RegisterMessage(QueryTimeSeriesRequest)
QueryTimeSeriesResponse = _reflection.GeneratedProtocolMessageType(
"QueryTimeSeriesResponse",
(_message.Message,),
{
"DESCRIPTOR": _QUERYTIMESERIESRESPONSE,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """The ``QueryTimeSeries`` response.
Attributes:
time_series_descriptor:
The descriptor for the time series data.
time_series_data:
The time series data.
next_page_token:
If there are more results than have been returned, then this
field is set to a non-empty value. To see the additional
results, use that value as ``page_token`` in the next call to
this method.
partial_errors:
Query execution errors that may have caused the time series
data returned to be incomplete. The available data will be
available in the response.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.QueryTimeSeriesResponse)
},
)
_sym_db.RegisterMessage(QueryTimeSeriesResponse)
QueryErrorList = _reflection.GeneratedProtocolMessageType(
"QueryErrorList",
(_message.Message,),
{
"DESCRIPTOR": _QUERYERRORLIST,
"__module__": "google.cloud.monitoring_v3.proto.metric_service_pb2",
"__doc__": """This is an error detail intended to be used with
INVALID_ARGUMENT errors.
Attributes:
errors:
Errors in parsing the time series query language text. The
number of errors in the response may be limited.
error_summary:
A summary of all the errors.
""",
# @@protoc_insertion_point(class_scope:google.monitoring.v3.QueryErrorList)
},
)
_sym_db.RegisterMessage(QueryErrorList)
DESCRIPTOR._options = None
_LISTMONITOREDRESOURCEDESCRIPTORSREQUEST.fields_by_name["name"]._options = None
_GETMONITOREDRESOURCEDESCRIPTORREQUEST.fields_by_name["name"]._options = None
_LISTMETRICDESCRIPTORSREQUEST.fields_by_name["name"]._options = None
_GETMETRICDESCRIPTORREQUEST.fields_by_name["name"]._options = None
_CREATEMETRICDESCRIPTORREQUEST.fields_by_name["name"]._options = None
_CREATEMETRICDESCRIPTORREQUEST.fields_by_name["metric_descriptor"]._options = None
_DELETEMETRICDESCRIPTORREQUEST.fields_by_name["name"]._options = None
_LISTTIMESERIESREQUEST.fields_by_name["name"]._options = None
_LISTTIMESERIESREQUEST.fields_by_name["filter"]._options = None
_LISTTIMESERIESREQUEST.fields_by_name["interval"]._options = None
_LISTTIMESERIESREQUEST.fields_by_name["view"]._options = None
_CREATETIMESERIESREQUEST.fields_by_name["name"]._options = None
_CREATETIMESERIESREQUEST.fields_by_name["time_series"]._options = None
_CREATETIMESERIESERROR.fields_by_name["time_series"]._options = None
_CREATETIMESERIESERROR.fields_by_name["status"]._options = None
_METRICSERVICE = _descriptor.ServiceDescriptor(
name="MetricService",
full_name="google.monitoring.v3.MetricService",
file=DESCRIPTOR,
index=0,
serialized_options=b"\312A\031monitoring.googleapis.com\322A\272\001https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read,https://www.googleapis.com/auth/monitoring.write",
serialized_start=3024,
serialized_end=4750,
methods=[
_descriptor.MethodDescriptor(
name="ListMonitoredResourceDescriptors",
full_name="google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors",
index=0,
containing_service=None,
input_type=_LISTMONITOREDRESOURCEDESCRIPTORSREQUEST,
output_type=_LISTMONITOREDRESOURCEDESCRIPTORSRESPONSE,
serialized_options=b"\202\323\344\223\0024\0222/v3/{name=projects/*}/monitoredResourceDescriptors\332A\004name",
),
_descriptor.MethodDescriptor(
name="GetMonitoredResourceDescriptor",
full_name="google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor",
index=1,
containing_service=None,
input_type=_GETMONITOREDRESOURCEDESCRIPTORREQUEST,
output_type=google_dot_api_dot_monitored__resource__pb2._MONITOREDRESOURCEDESCRIPTOR,
serialized_options=b"\202\323\344\223\0027\0225/v3/{name=projects/*/monitoredResourceDescriptors/**}\332A\004name",
),
_descriptor.MethodDescriptor(
name="ListMetricDescriptors",
full_name="google.monitoring.v3.MetricService.ListMetricDescriptors",
index=2,
containing_service=None,
input_type=_LISTMETRICDESCRIPTORSREQUEST,
output_type=_LISTMETRICDESCRIPTORSRESPONSE,
serialized_options=b"\202\323\344\223\002)\022'/v3/{name=projects/*}/metricDescriptors\332A\004name",
),
_descriptor.MethodDescriptor(
name="GetMetricDescriptor",
full_name="google.monitoring.v3.MetricService.GetMetricDescriptor",
index=3,
containing_service=None,
input_type=_GETMETRICDESCRIPTORREQUEST,
output_type=google_dot_api_dot_metric__pb2._METRICDESCRIPTOR,
serialized_options=b"\202\323\344\223\002,\022*/v3/{name=projects/*/metricDescriptors/**}\332A\004name",
),
_descriptor.MethodDescriptor(
name="CreateMetricDescriptor",
full_name="google.monitoring.v3.MetricService.CreateMetricDescriptor",
index=4,
containing_service=None,
input_type=_CREATEMETRICDESCRIPTORREQUEST,
output_type=google_dot_api_dot_metric__pb2._METRICDESCRIPTOR,
serialized_options=b"\202\323\344\223\002<\"'/v3/{name=projects/*}/metricDescriptors:\021metric_descriptor\332A\026name,metric_descriptor",
),
_descriptor.MethodDescriptor(
name="DeleteMetricDescriptor",
full_name="google.monitoring.v3.MetricService.DeleteMetricDescriptor",
index=5,
containing_service=None,
input_type=_DELETEMETRICDESCRIPTORREQUEST,
output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
serialized_options=b"\202\323\344\223\002,**/v3/{name=projects/*/metricDescriptors/**}\332A\004name",
),
_descriptor.MethodDescriptor(
name="ListTimeSeries",
full_name="google.monitoring.v3.MetricService.ListTimeSeries",
index=6,
containing_service=None,
input_type=_LISTTIMESERIESREQUEST,
output_type=_LISTTIMESERIESRESPONSE,
serialized_options=b'\202\323\344\223\002"\022 /v3/{name=projects/*}/timeSeries\332A\031name,filter,interval,view',
),
_descriptor.MethodDescriptor(
name="CreateTimeSeries",
full_name="google.monitoring.v3.MetricService.CreateTimeSeries",
index=7,
containing_service=None,
input_type=_CREATETIMESERIESREQUEST,
output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
serialized_options=b'\202\323\344\223\002%" /v3/{name=projects/*}/timeSeries:\001*\332A\020name,time_series',
),
],
)
_sym_db.RegisterServiceDescriptor(_METRICSERVICE)
DESCRIPTOR.services_by_name["MetricService"] = _METRICSERVICE
# @@protoc_insertion_point(module_scope)
| [
"[email protected]"
] | |
d061f290f794c90b951bbf0dd48c7e1e8356db05 | 255e19ddc1bcde0d3d4fe70e01cec9bb724979c9 | /all-gists/10375900/snippet.py | 26438e7b72a4b03ea1b6bf2b8a49d6ac065dfc0f | [
"MIT"
] | permissive | gistable/gistable | 26c1e909928ec463026811f69b61619b62f14721 | 665d39a2bd82543d5196555f0801ef8fd4a3ee48 | refs/heads/master | 2023-02-17T21:33:55.558398 | 2023-02-11T18:20:10 | 2023-02-11T18:20:10 | 119,861,038 | 76 | 19 | null | 2020-07-26T03:14:55 | 2018-02-01T16:19:24 | Python | UTF-8 | Python | false | false | 8,007 | py | import boto
import json
import time
import sys
import getopt
import argparse
import os
import logging
import StringIO
import uuid
import math
import httplib
from boto.sqs.message import RawMessage
from boto.sqs.message import Message
from boto.s3.key import Key
##########################################################
# Connect to SQS and poll for messages
##########################################################
def main(argv=None):
# Handle command-line arguments for AWS credentials and resource names
parser = argparse.ArgumentParser(description='Process AWS resources and credentials.')
parser.add_argument('--input-queue', action='store', dest='input_queue', required=False, default="input", help='SQS queue from which input jobs are retrieved')
parser.add_argument('--output-queue', action='store', dest='output_queue', required=False, default="output", help='SQS queue to which job results are placed')
parser.add_argument('--s3-output-bucket', action='store', dest='s3_output_bucket', required=False, default="", help='S3 bucket where list of instances will be stored')
parser.add_argument('--region', action='store', dest='region', required=False, default="", help='Region that the SQS queus are in')
args = parser.parse_args()
# Get region
region_name = args.region
# If no region supplied, extract it from meta-data
if region_name == '':
conn = httplib.HTTPConnection("169.254.169.254", 80)
conn.request("GET", "/latest/meta-data/placement/availability-zone/")
response = conn.getresponse()
region_name = response.read()[:-1]
info_message('Using Region %s' % (region_name))
# Set queue names
input_queue_name = args.input_queue
output_queue_name = args.output_queue
# Get S3 endpoint
s3_endpoint = [region.endpoint for region in boto.s3.regions() if region.name == region_name][0]
# Get S3 bucket, create if none supplied
s3_output_bucket = args.s3_output_bucket
if s3_output_bucket == "":
s3_output_bucket = create_s3_output_bucket(s3_output_bucket, s3_endpoint, region_name)
info_message('Retrieving jobs from queue %s. Processed images will be stored in %s and a message placed in queue %s' % (input_queue_name, s3_output_bucket, output_queue_name))
try:
# Connect to SQS and open queue
sqs = boto.sqs.connect_to_region(region_name)
except Exception as ex:
error_message("Encountered an error setting SQS region. Please confirm you have queues in %s." % (region_name))
sys.exit(1)
try:
input_queue = sqs.get_queue(input_queue_name)
input_queue.set_message_class(RawMessage)
except Exception as ex:
error_message("Encountered an error connecting to SQS queue %s. Confirm that your input queue exists." % (input_queue_name))
sys.exit(2)
try:
output_queue = sqs.get_queue(output_queue_name)
output_queue.set_message_class(RawMessage)
except Exception as ex:
error_message("Encountered an error connecting to SQS queue %s. Confirm that your output queue exists." % (output_queue_name))
sys.exit(3)
info_message("Polling input queue...")
while True:
# Get messages
rs = input_queue.get_messages(num_messages=1)
if len(rs) > 0:
# Iterate each message
for raw_message in rs:
info_message("Message received...")
# Parse JSON message (going two levels deep to get the embedded message)
message = raw_message.get_body()
# Create a unique job id
job_id = str(uuid.uuid4())
# Process the image, creating the image montage
output_url = process_message(message, s3_output_bucket, s3_endpoint, job_id)
# Sleep for a while to simulate a heavy workload
# (Otherwise the queue empties too fast!)
time.sleep(15)
output_message = "Output available at: %s" % (output_url)
# Write message to output queue
write_output_message(output_message, output_queue)
info_message(output_message)
info_message("Image processing completed.")
# Delete message from the queue
input_queue.delete_message(raw_message)
time.sleep(5)
##############################################################################
# Process a newline-delimited list of URls
##############################################################################
def process_message(message, s3_output_bucket, s3_endpoint, job_id):
try:
output_dir = "/home/ec2-user/jobs/%s/" % (job_id)
# Download images from URLs specified in message
for line in message.splitlines():
info_message("Downloading image from %s" % line)
os.system("wget -P %s %s" % (output_dir, line))
output_image_name = "output-%s.jpg" % (job_id)
output_image_path = output_dir + output_image_name
# Invoke ImageMagick to create a montage
os.system("montage -size 400x400 null: %s*.* null: -thumbnail 400x400 -bordercolor white -background black +polaroid -resize 80%% -gravity center -background black -geometry -10+2 -tile x1 %s" % (output_dir, output_image_path))
# Write the resulting image to s3
output_url = write_image_to_s3(output_image_path, output_image_name, s3_output_bucket, s3_endpoint)
# Return the output url
return output_url
except:
error_message("An error occurred. Please show this to your class instructor.")
error_message(sys.exc_info()[0])
##############################################################################
# Write the result of a job to the output queue
##############################################################################
def write_output_message(message, output_queue):
m = RawMessage()
m.set_body(message)
status = output_queue.write(m)
##############################################################################
# Write an image to S3
##############################################################################
def write_image_to_s3(path, file_name, s3_output_bucket, s3_endpoint):
# Connect to S3 and get the output bucket
s3 = boto.connect_s3(host=s3_endpoint)
output_bucket = s3.get_bucket(s3_output_bucket)
# Create a key to store the instances_json text
k = Key(output_bucket)
k.key = "out/" + file_name
k.set_metadata("Content-Type", "image/jpeg")
k.set_contents_from_filename(path)
k.set_acl('public-read')
# Return a URL to the object
return "https://%s.s3.amazonaws.com/%s" % (s3_output_bucket, k.key)
##############################################################################
# Verify S3 bucket, create it if required
##############################################################################
def create_s3_output_bucket(s3_output_bucket, s3_endpoint, region_name):
# Connect to S3
s3 = boto.connect_s3(host=s3_endpoint)
# Find any existing buckets starting with 'image-bucket'
buckets = [bucket.name for bucket in s3.get_all_buckets() if bucket.name.startswith('image-bucket')]
if len(buckets) > 0:
return buckets[0]
# No buckets, so create one for them
name = 'image-bucket-' + str(uuid.uuid4())
s3.create_bucket(name, location=region_name)
return name
##############################################################################
# Use logging class to log simple info messages
##############################################################################
def info_message(message):
logger.info(message)
def error_message(message):
logger.error(message)
##############################################################################
# Generic stirng logging
##############################################################################
class Logger:
def __init__(self):
#self.stream = StringIO.StringIO()
#self.stream_handler = logging.StreamHandler(self.stream)
self.file_handler = logging.FileHandler('/home/ec2-user/image_processor.log')
self.log = logging.getLogger('image-processor')
self.log.setLevel(logging.INFO)
for handler in self.log.handlers:
self.log.removeHandler(handler)
self.log.addHandler(self.file_handler)
def info(self, message):
self.log.info(message)
def error(self, message):
self.log.error(message)
logger = Logger()
if __name__ == "__main__":
sys.exit(main())
| [
"[email protected]"
] | |
7665734ba108bbe3b98f2a09d77e4acbe740a77f | a08f9192cef4c48378e2c691353343112b317d71 | /hatchet/readers/json_reader.py | 407536bae020b48822d840cb2c5d9e0915ebd7fa | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.0-or-later"
] | permissive | LLNL/hatchet | a7a33523f7aa60dfe38739e2362666a50af7adc0 | 5d0efca4ea9cca03497d0b89b6ffada37242d579 | refs/heads/develop | 2023-08-30T22:29:30.456656 | 2023-08-17T16:05:46 | 2023-08-17T16:05:46 | 454,508,482 | 19 | 13 | MIT | 2023-09-09T00:13:13 | 2022-02-01T18:43:00 | JavaScript | UTF-8 | Python | false | false | 2,060 | py | # Copyright 2017-2023 Lawrence Livermore National Security, LLC and other
# Hatchet Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
import json
import pandas as pd
import hatchet.graphframe
from hatchet.node import Node
from hatchet.graph import Graph
from hatchet.frame import Frame
class JsonReader:
"""Create a GraphFrame from a json string of the following format.
Return:
(GraphFrame): graphframe containing data from dictionaries
"""
def __init__(self, json_spec):
"""Read from a json string specification of a graphframe
json (string): Json specification of a graphframe.
"""
self.spec_dict = json.loads(json_spec)
def read(self):
roots = []
for graph_spec in self.spec_dict["graph"]:
# turn frames into nodes
for nid, value in graph_spec.items():
graph_spec[nid]["data"] = Node(Frame(value["data"]), hnid=int(nid))
# connect nodes
for nid, value in graph_spec.items():
for child in value["children"]:
child = str(child)
value["data"].add_child(graph_spec[child]["data"])
graph_spec[child]["data"].add_parent(value["data"])
for nid, value in graph_spec.items():
if len(value["data"].parents) == 0:
roots.append(value["data"])
grph = Graph(roots)
# make the dataframes
dataframe = pd.DataFrame(self.spec_dict["dataframe"])
for graph_spec in self.spec_dict["graph"]:
dataframe["node"] = dataframe["node"].map(
lambda n: graph_spec[str(n)]["data"] if (str(n) in graph_spec) else n
)
dataframe.set_index(self.spec_dict["dataframe_indices"], inplace=True)
return hatchet.graphframe.GraphFrame(
grph,
dataframe,
self.spec_dict["exclusive_metrics"],
self.spec_dict["inclusive_metrics"],
)
| [
"[email protected]"
] | |
2ef1e47b02a835b52e3773d43064d34477571116 | 4a230737626c0cadfc5326315d036bf8453ef953 | /paiza_03/paiza_03_006_002.erb | 1f4012fe5d575e2d3c7a1c660ba105740666ad7b | [] | no_license | reinaaa05/python | 0037a40b588b6954ea5d5b0ff45df98c1522f865 | 2d9e2b7388c4a19a0389aa6cb532774271bd27b0 | refs/heads/master | 2023-04-21T23:39:20.450914 | 2021-05-12T07:27:47 | 2021-05-12T07:27:47 | 340,906,770 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 146 | erb | # coding: utf-8
# 標準入力とループ処理
count = int(input())
count2 = int(input())
i = count
while i <= count2:
print(i)
i += 1
| [
"[email protected]"
] | |
bb77ef951e11dbb4d4981b2e9305607269c7ba70 | 56f5b2ea36a2258b8ca21e2a3af9a5c7a9df3c6e | /CMGTools/H2TauTau/prod/25aug_corrMC/up/mc/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0_1377544840/HTT_24Jul_newTES_manzoni_Up_Jobs/Logger/Expandedfull_cfg.py | d3581bac8bec09f120fed9d94f9edc89079e3b8e | [] | no_license | rmanzoni/HTT | 18e6b583f04c0a6ca10142d9da3dd4c850cddabc | a03b227073b2d4d8a2abe95367c014694588bf98 | refs/heads/master | 2016-09-06T05:55:52.602604 | 2014-02-20T16:35:34 | 2014-02-20T16:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 165,735 | py | import FWCore.ParameterSet.Config as cms
process = cms.Process("H2TAUTAU")
process.source = cms.Source("PoolSource",
noEventSort = cms.untracked.bool(True),
duplicateCheckMode = cms.untracked.string('noDuplicateCheck'),
fileNames = cms.untracked.vstring( ('/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_1.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_10.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_100.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_101.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_102.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_103.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_104.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_105.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_106.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_107.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_108.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_109.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_11.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_110.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_111.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_112.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_113.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_114.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_115.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_116.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_117.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_118.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_119.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_12.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_120.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_121.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_122.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_123.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_124.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_125.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_126.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_127.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_128.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_129.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_13.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_130.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_131.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_132.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_133.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_134.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_135.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_136.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_137.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_138.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_139.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_14.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_140.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_141.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_142.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_143.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_144.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_145.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_146.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_147.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_148.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_149.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_15.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_150.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_151.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_152.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_153.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_154.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_155.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_156.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_157.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_158.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_159.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_16.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_160.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_161.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_162.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_163.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_164.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_165.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_166.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_167.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_168.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_169.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_17.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_170.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_171.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_172.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_173.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_174.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_175.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_176.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_177.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_178.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_179.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_18.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_180.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_181.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_182.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_183.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_184.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_185.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_186.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_187.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_188.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_189.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_19.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_190.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_191.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_192.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_193.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_194.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_195.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_196.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_197.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_198.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_199.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_2.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_20.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_200.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_201.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_202.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_203.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_204.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_205.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_206.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_207.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_208.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_209.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_21.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_210.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_211.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_212.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_213.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_214.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_215.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_216.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_217.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_218.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_219.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_22.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_220.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_221.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_222.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_223.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_224.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_225.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_226.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_227.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_228.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_229.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_23.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_230.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_231.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_232.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_233.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_234.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_235.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_236.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_237.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_238.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_239.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_24.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_240.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_241.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_242.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_243.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_244.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_245.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_246.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_247.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_248.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_249.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_25.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_250.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_251.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_252.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_253.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_254.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_255.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_256.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_257.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_258.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_259.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_26.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_260.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_261.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_262.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_263.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_264.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_265.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_266.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_267.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_268.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_269.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_27.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_270.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_271.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_272.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_273.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_274.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_275.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_276.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_277.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_278.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_279.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_28.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_280.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_281.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_282.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_283.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_284.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_285.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_286.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_287.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_288.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_289.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_29.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_290.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_291.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_292.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_293.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_294.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_295.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_296.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_297.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_298.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_299.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_3.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_30.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_300.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_301.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_302.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_303.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_304.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_305.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_306.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_307.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_308.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_309.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_31.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_310.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_311.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_312.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_313.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_314.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_315.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_316.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_317.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_318.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_319.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_32.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_320.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_321.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_322.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_323.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_324.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_325.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_326.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_327.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_328.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_329.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_33.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_330.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_331.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_332.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_333.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_334.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_335.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_336.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_337.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_338.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_339.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_34.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_340.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_341.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_342.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_343.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_344.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_345.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_346.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_347.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_348.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_349.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_35.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_350.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_351.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_352.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_353.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_354.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_355.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_356.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_357.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_358.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_359.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_36.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_360.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_361.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_362.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_363.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_364.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_365.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_366.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_367.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_368.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_369.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_37.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_370.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_371.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_372.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_373.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_374.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_375.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_376.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_377.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_378.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_379.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_38.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_380.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_381.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_382.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_383.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_384.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_385.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_386.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_387.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_388.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_389.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_39.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_390.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_391.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_392.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_393.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_394.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_395.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_396.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_397.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_398.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_399.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_4.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_40.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_400.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_401.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_402.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_403.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_404.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_405.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_406.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_407.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_408.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_409.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_41.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_410.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_411.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_412.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_413.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_414.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_415.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_416.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_417.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_418.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_419.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_42.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_420.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_421.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_422.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_423.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_424.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_425.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_426.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_427.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_428.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_429.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_43.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_430.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_431.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_432.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_433.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_434.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_435.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_436.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_437.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_438.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_439.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_44.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_440.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_441.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_442.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_443.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_444.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_445.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_446.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_447.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_448.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_449.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_45.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_450.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_451.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_452.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_453.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_454.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_455.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_456.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_457.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_458.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_459.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_46.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_460.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_461.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_462.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_463.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_464.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_465.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_466.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_467.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_468.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_469.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_47.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_470.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_471.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_472.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_473.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_474.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_475.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_476.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_477.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_478.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_479.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_48.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_480.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_481.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_482.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_483.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_484.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_485.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_486.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_487.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_488.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_489.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_49.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_490.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_491.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_492.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_493.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_494.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_495.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_496.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_497.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_498.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_499.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_5.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_50.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_500.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_501.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_502.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_503.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_504.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_505.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_506.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_507.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_508.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_509.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_51.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_510.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_511.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_512.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_513.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_514.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_515.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_516.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_517.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_518.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_519.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_52.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_520.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_521.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_522.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_523.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_524.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_525.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_526.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_527.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_528.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_529.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_53.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_530.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_531.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_532.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_533.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_534.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_535.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_536.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_537.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_538.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_539.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_54.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_540.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_541.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_542.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_543.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_544.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_545.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_546.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_547.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_548.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_549.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_55.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_550.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_551.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_552.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_553.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_554.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_555.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_556.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_557.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_558.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_559.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_56.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_560.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_561.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_562.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_563.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_564.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_565.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_566.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_567.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_568.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_569.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_57.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_570.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_571.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_572.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_573.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_574.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_575.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_576.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_577.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_578.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_579.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_58.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_580.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_581.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_582.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_583.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_584.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_585.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_586.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_587.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_588.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_589.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_59.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_590.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_591.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_592.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_593.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_594.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_595.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_596.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_597.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_598.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_599.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_6.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_60.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_600.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_601.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_602.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_603.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_604.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_605.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_606.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_607.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_608.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_609.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_61.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_610.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_611.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_612.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_613.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_614.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_615.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_616.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_617.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_618.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_619.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_62.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_620.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_621.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_622.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_623.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_624.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_625.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_626.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_627.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_628.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_63.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_64.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_65.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_66.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_67.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_68.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_69.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_7.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_70.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_71.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_72.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_73.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_74.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_75.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_76.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_77.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_78.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_79.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_8.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_80.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_81.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_82.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_83.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_84.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_85.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_86.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_87.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_88.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_89.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_9.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_90.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_91.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_92.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_93.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_94.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_95.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_96.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_97.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_98.root',
'/store/cmst3/user/cmgtools/CMG/DY4JetsToLL_M-50_TuneZ2Star_8TeV-madgraph/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/V5_B/PAT_CMG_V5_16_0/cmgTuple_99.root' ) ),
inputCommands = cms.untracked.vstring('keep *',
'drop cmgStructuredPFJets_cmgStructuredPFJetSel__PAT')
)
process.cmgDiTauCorSVFitPreSel = cms.EDProducer("TauTauWithSVFitProducer",
diTauSrc = cms.InputTag("recoilCorMETDiTau"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.cmgTauEleCorSVFitPreSel = cms.EDProducer("TauEleWithSVFitProducer",
diTauSrc = cms.InputTag("recoilCorMETTauEle"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.cmgTauMuCorSVFitPreSel = cms.EDProducer("TauMuWithSVFitProducer",
diTauSrc = cms.InputTag("recoilCorMETTauMu"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.diTauSVFit = cms.EDProducer("TauTauWithSVFitProducer",
diTauSrc = cms.InputTag("cmgDiTauCorPreSel"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.genWorZ = cms.EDProducer("GenParticlePruner",
src = cms.InputTag("genParticlesPruned"),
select = cms.vstring('keep status()==3 & pdgId = {W+}',
'keep status()==3 & pdgId = {W-}',
'keep status()==3 & pdgId = {Z0}',
'keep status()==3 & pdgId = {gamma}',
'keep status()==3 & pdgId = {h0}',
'keep status()==3 & pdgId = 35',
'keep status()==3 & pdgId = 36')
)
process.mvaMETDiTau = cms.EDProducer("MVAMETProducerDiTau",
pucmetSrc = cms.InputTag("pcMet"),
enable = cms.bool(True),
tkmetSrc = cms.InputTag("tkMet"),
verbose = cms.untracked.bool(False),
nopumetSrc = cms.InputTag("nopuMet"),
rhoSrc = cms.InputTag("kt6PFJets","rho"),
pfmetSrc = cms.InputTag("pfMetForRegression"),
weights_gbrmetphi = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmetphi_53_Dec2012.root'),
pumetSrc = cms.InputTag("puMet"),
weights_gbrmetu1cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru1cov_53_Dec2012.root'),
weights_gbrmetu2cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru2cov_53_Dec2012.root'),
vertexSrc = cms.InputTag("goodPVFilter"),
jetSrc = cms.InputTag("cmgPFJetSel"),
leadJetSrc = cms.InputTag("cmgPFBaseJetLead"),
recBosonSrc = cms.InputTag("cmgDiTauPreSel"),
nJetsPtGt1Src = cms.InputTag("nJetsPtGt1"),
weights_gbrmet = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmet_53_Dec2012.root'),
puJetIdLabel = cms.string('met53x')
)
process.mvaMETTauEle = cms.EDProducer("MVAMETProducerTauEle",
pucmetSrc = cms.InputTag("pcMet"),
enable = cms.bool(True),
tkmetSrc = cms.InputTag("tkMet"),
verbose = cms.untracked.bool(False),
nopumetSrc = cms.InputTag("nopuMet"),
rhoSrc = cms.InputTag("kt6PFJets","rho"),
pfmetSrc = cms.InputTag("pfMetForRegression"),
weights_gbrmetphi = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmetphi_53_Dec2012.root'),
pumetSrc = cms.InputTag("puMet"),
weights_gbrmetu1cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru1cov_53_Dec2012.root'),
weights_gbrmetu2cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru2cov_53_Dec2012.root'),
vertexSrc = cms.InputTag("goodPVFilter"),
jetSrc = cms.InputTag("cmgPFJetSel"),
leadJetSrc = cms.InputTag("cmgPFBaseJetLead"),
recBosonSrc = cms.InputTag("cmgTauElePreSel"),
nJetsPtGt1Src = cms.InputTag("nJetsPtGt1"),
weights_gbrmet = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmet_53_Dec2012.root'),
puJetIdLabel = cms.string('met53x')
)
process.mvaMETTauMu = cms.EDProducer("MVAMETProducerTauMu",
pucmetSrc = cms.InputTag("pcMet"),
enable = cms.bool(True),
tkmetSrc = cms.InputTag("tkMet"),
verbose = cms.untracked.bool(False),
nopumetSrc = cms.InputTag("nopuMet"),
rhoSrc = cms.InputTag("kt6PFJets","rho"),
pfmetSrc = cms.InputTag("pfMetForRegression"),
weights_gbrmetphi = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmetphi_53_Dec2012.root'),
pumetSrc = cms.InputTag("puMet"),
weights_gbrmetu1cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru1cov_53_Dec2012.root'),
weights_gbrmetu2cov = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbru2cov_53_Dec2012.root'),
vertexSrc = cms.InputTag("goodPVFilter"),
jetSrc = cms.InputTag("cmgPFJetSel"),
leadJetSrc = cms.InputTag("cmgPFBaseJetLead"),
recBosonSrc = cms.InputTag("cmgTauMuPreSel"),
nJetsPtGt1Src = cms.InputTag("nJetsPtGt1"),
weights_gbrmet = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/mvaMET/gbrmet_53_Dec2012.root'),
puJetIdLabel = cms.string('met53x')
)
process.recoilCorMETDiTau = cms.EDProducer("RecoilCorrectedMETProducerDiTau",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53XRR_2012_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53XRR_2012_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection//recoilfit_ztt53X_20pv_njet.root'),
leptonLeg = cms.int32(0),
correctionType = cms.int32(1),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgDiTauPtSel")
)
process.recoilCorMETTauEle = cms.EDProducer("RecoilCorrectedMETProducerTauEle",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53XRR_2012_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53XRR_2012_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection//recoilfit_ztt53X_20pv_njet.root'),
leptonLeg = cms.int32(0),
correctionType = cms.int32(1),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgTauEleTauPtSel")
)
process.recoilCorMETTauMu = cms.EDProducer("RecoilCorrectedMETProducerTauMu",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53XRR_2012_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53XRR_2012_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection//recoilfit_ztt53X_20pv_njet.root'),
leptonLeg = cms.int32(0),
correctionType = cms.int32(1),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgTauMuTauPtSel")
)
process.recoilCorrectedMETDiTau = cms.EDProducer("RecoilCorrectedMETProducerDiTau",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53XRR_2012_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53XRR_2012_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_ztt53X_20pv_njet.root'),
leptonLeg = cms.int32(0),
correctionType = cms.int32(2),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgDiTauSel")
)
process.recoilCorrectedMETMuEle = cms.EDProducer("RecoilCorrectedMETProducerMuEle",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53X_20pv_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53X_20pv_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_wjets53X_20pv_njet.root'),
leptonLeg = cms.int32(2),
correctionType = cms.int32(2),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgMuEleSel"),
metSrc = cms.InputTag("cmgPFMET")
)
process.recoilCorrectedMETTauEle = cms.EDProducer("RecoilCorrectedMETProducerTauEle",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53X_20pv_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53X_20pv_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_wjets53X_20pv_njet.root'),
leptonLeg = cms.int32(2),
correctionType = cms.int32(2),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgTauEleSel")
)
process.recoilCorrectedMETTauMu = cms.EDProducer("RecoilCorrectedMETProducerTauMu",
enable = cms.bool(True),
force = cms.bool(False),
verbose = cms.untracked.bool(False),
genBosonSrc = cms.InputTag("genWorZ"),
fileZmmMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_zmm53X_20pv_njet.root'),
fileZmmData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_datamm53X_20pv_njet.root'),
fileCorrectTo = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/Utilities/data/metRecoilCorrection/recoilfit_wjets53X_20pv_njet.root'),
leptonLeg = cms.int32(2),
correctionType = cms.int32(2),
jetSrc = cms.InputTag("cmgPFJetForRecoil"),
recBosonSrc = cms.InputTag("cmgTauMuSel")
)
process.tauEleSVFit = cms.EDProducer("TauEleWithSVFitProducer",
diTauSrc = cms.InputTag("cmgTauEleCorPreSel"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.tauMuSVFit = cms.EDProducer("TauMuWithSVFitProducer",
diTauSrc = cms.InputTag("cmgTauMuCorPreSel"),
SVFitVersion = cms.int32(2),
verbose = cms.untracked.bool(False)
)
process.vertexWeight05AugReReco = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON_v2.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeight2011AB = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_160404-180252_4.6invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeight2011B = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2011B.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeight2invfb = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_160404-173692_2.1invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeight3D05AugReReco = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON_v2.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3D2011AB = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_160404-180252_4.6invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3D2011B = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_2011B.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3D2invfb = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_160404-173692_2.1invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3DFall1105AugReReco = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON_v2.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall112011AB = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_160404-180252_4.6invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall112011B = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_2011B.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall112invfb = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_160404-173692_2.1invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall11May10ReReco = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall11PromptRecov4 = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_165088-167913_7TeV_PromptReco_JSON.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DFall11PromptRecov6 = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_172620-173692_PromptReco_JSON.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Fall11MC.root')
)
process.vertexWeight3DMay10ReReco = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3DPromptRecov4 = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_165088-167913_7TeV_PromptReco_JSON.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeight3DPromptRecov6 = cms.EDProducer("PileUpWeight3DProducer",
verbose = cms.untracked.bool(False),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_172620-173692_PromptReco_JSON.pileupTruth_v2_finebin.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup3D_Summer11MC.root')
)
process.vertexWeightEPSJul8 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Pileup_2011_EPS_8_jul.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeightFall1105AugReReco = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON_v2.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall112011AB = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_160404-180252_4.6invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall112011B = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2011B.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall112invfb = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_160404-173692_2.1invfb.pileup.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall11EPSJul8 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Pileup_2011_EPS_8_jul.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall11LeptonPhoton = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Pileup_2011_to_172802_LP_LumiScale.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall11May10ReReco = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall11PromptRecov4 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_165088-167913_7TeV_PromptReco_JSON.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightFall11PromptRecov6 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_172620-173692_PromptReco_JSON.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Fall11MC.root')
)
process.vertexWeightLeptonPhoton = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Pileup_2011_to_172802_LP_LumiScale.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeightMay10ReReco = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeightPromptRecov4 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_165088-167913_7TeV_PromptReco_JSON.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeightPromptRecov6 = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(1),
inputHistData = cms.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/Cert_172620-173692_PromptReco_JSON.pileup_v2.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer11MC.root')
)
process.vertexWeightSummer12MC53X2012ABCDData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012ABCD.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC53X.true.root')
)
process.vertexWeightSummer12MC53X2012BCDData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012BCD.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC53X.true.root')
)
process.vertexWeightSummer12MC53X2012D6fbData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012D6fb_203894_207898.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC53X.true.root')
)
process.vertexWeightSummer12MC53XHCPData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012HCP_190456_203002.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC53X.true.root')
)
process.vertexWeightSummer12MC53XICHEPData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012ICHEP_start_196509.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC53X.true.root')
)
process.vertexWeightSummer12MCICHEPData = cms.EDProducer("PileUpWeightProducer",
src = cms.InputTag("addPileupInfo"),
verbose = cms.untracked.bool(False),
type = cms.int32(2),
inputHistData = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_2012ICHEP_start_196509.true.root'),
inputHistMC = cms.string('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/RootTools/data/vertexWeight/Pileup_Summer12MC52X.true.root')
)
process.cmgBaseMETFromPFMET = cms.EDFilter("PFMETPOProducer",
cfg = cms.PSet(
ptThreshold = cms.double(-1.0),
inputCollection = cms.InputTag("pfMet")
),
cuts = cms.PSet(
)
)
process.cmgDiTau = cms.EDFilter("DiTauPOProducer",
cfg = cms.PSet(
leg2Collection = cms.InputTag("cmgTauSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metsigCollection = cms.InputTag(""),
metCollection = cms.InputTag("cmgPFMET")
),
cuts = cms.PSet(
baseline = cms.PSet(
tau1Leg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.1'),
pt = cms.string('leg1().pt()>35.')
),
id = cms.PSet(
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
mass = cms.string('mass()>10'),
tau2Leg = cms.PSet(
iso = cms.string('leg2().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.1'),
pt = cms.string('leg2().pt()>35.')
),
id = cms.PSet(
decay = cms.string('leg2().tauID("decayModeFinding")')
)
)
)
)
)
process.cmgDiTauCor = cms.EDFilter("DiTauUpdatePOProducer",
cfg = cms.PSet(
shift1Prong1Pi0 = cms.double(0.012),
diObjectCollection = cms.InputTag("mvaMETDiTau"),
leg1Collection = cms.InputTag(""),
shiftMet = cms.bool(True),
shiftTaus = cms.bool(True),
uncertainty = cms.double(0.03),
shift1ProngNoPi0 = cms.double(0.0),
shift3Prong = cms.double(0.012),
nSigma = cms.double(1),
leg2Collection = cms.InputTag(""),
ptDependence1Pi0 = cms.double(0.0),
ptDependence3Prong = cms.double(0.0)
),
cuts = cms.PSet(
)
)
process.cmgDiTauCorSVFitFullSel = cms.EDFilter("CmgDiTauSelector",
src = cms.InputTag("cmgDiTauCorSVFitPreSel"),
cut = cms.string('')
)
process.cmgDiTauCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgDiTauSel"),
minNumber = cms.uint32(1)
)
process.cmgDiTauPreSel = cms.EDFilter("CmgDiTauSelector",
src = cms.InputTag("cmgDiTau"),
cut = cms.string('leg1().pt()>38. && leg2().pt()>38. && leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10. && leg2().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.')
)
process.cmgDiTauPtSel = cms.EDFilter("CmgDiTauSelector",
src = cms.InputTag("cmgDiTauCor"),
cut = cms.string('leg1().pt()>45. && leg2().pt()>45.')
)
process.cmgDiTauSel = cms.EDFilter("CmgDiTauSelector",
src = cms.InputTag("cmgDiTau"),
cut = cms.string(' pt()>0 ')
)
process.cmgMuEle = cms.EDFilter("MuElePOProducer",
cfg = cms.PSet(
leg2Collection = cms.InputTag("cmgElectronSel"),
leg1Collection = cms.InputTag("cmgMuonSel"),
metCollection = cms.InputTag("")
),
cuts = cms.PSet(
)
)
process.cmgMuEleCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgMuEleSel"),
minNumber = cms.uint32(1)
)
process.cmgMuEleSel = cms.EDFilter("CmgMuEleSelector",
src = cms.InputTag("cmgMuEle"),
cut = cms.string('pt()>0')
)
process.cmgPFJetForRecoil = cms.EDFilter("CMGJetPUIDSelector",
src = cms.InputTag("cmgPFJetForRecoilPresel"),
cut = cms.string(''),
puJetIDParams = cms.VPSet(cms.PSet(
minDiscs = cms.vdouble(-0.95, -0.96, -0.94, -0.95),
maxPt = cms.double(20.0),
minPt = cms.double(0.0),
maxEtas = cms.vdouble(2.5, 2.75, 3.0, 5.0)
),
cms.PSet(
minDiscs = cms.vdouble(-0.63, -0.6, -0.55, -0.45),
maxPt = cms.double(99999.0),
minPt = cms.double(20.0),
maxEtas = cms.vdouble(2.5, 2.75, 3.0, 5.0)
)),
puIDName = cms.string('full53x')
)
process.cmgPFJetForRecoilPresel = cms.EDFilter("CmgPFJetSelector",
src = cms.InputTag("cmgPFJetSel"),
cut = cms.string('pt()>30 && abs(eta)<4.7 && getSelection("cuts_looseJetId")')
)
process.cmgPFJetPUIDSel = cms.EDFilter("CMGJetPUIDSelector",
src = cms.InputTag("cmgPFJetSel"),
cut = cms.string(''),
puJetIDParams = cms.VPSet(cms.PSet(
minDiscs = cms.vdouble(-0.95, -0.96, -0.94, -0.95),
maxPt = cms.double(20.0),
minPt = cms.double(0.0),
maxEtas = cms.vdouble(2.5, 2.75, 3.0, 5.0)
),
cms.PSet(
minDiscs = cms.vdouble(-0.63, -0.6, -0.55, -0.45),
maxPt = cms.double(99999.0),
minPt = cms.double(20.0),
maxEtas = cms.vdouble(2.5, 2.75, 3.0, 5.0)
)),
puIDName = cms.string('full53x')
)
process.cmgPFJetSel = cms.EDFilter("CmgPFJetSelector",
src = cms.InputTag("cmgPFJet"),
cut = cms.string('pt()>0')
)
process.cmgTauEle = cms.EDFilter("TauElePOProducer",
cfg = cms.PSet(
leg2Collection = cms.InputTag("cmgElectronSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metCollection = cms.InputTag("cmgPFMET"),
metsigCollection = cms.InputTag("")
),
cuts = cms.PSet(
baseline = cms.PSet(
tauLeg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.3'),
pt = cms.string('leg1().pt()>15.0')
),
id = cms.PSet(
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
eleLeg = cms.PSet(
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.1'),
pt = cms.string('leg2().pt()>20.0')
),
ID = cms.PSet(
hitsnum = cms.string('leg2().numberOfHits==0'),
mvaID = cms.string('(abs(leg2().sourcePtr().superCluster().eta())<0.8 && leg2().mvaNonTrigV0() > 0.925) || (abs(leg2().sourcePtr().superCluster().eta())>0.8 && abs(leg2().sourcePtr().superCluster().eta())<1.479 && leg2().mvaNonTrigV0() > 0.975) || (abs(leg2().sourcePtr().superCluster().eta())>1.479 && leg2().mvaNonTrigV0() > 0.985)'),
convVeto = cms.string('leg2().passConversionVeto()!=0')
)
)
)
)
)
process.cmgTauEleCor = cms.EDFilter("TauEleUpdatePOProducer",
cfg = cms.PSet(
shift1Prong1Pi0 = cms.double(0.0),
diObjectCollection = cms.InputTag("mvaMETTauEle"),
leg1Collection = cms.InputTag(""),
metCollection = cms.InputTag("recoilCorrectedMET"),
uncertainty = cms.double(0.03),
shift1ProngNoPi0 = cms.double(0.0),
shift3Prong = cms.double(0.0),
nSigma = cms.double(0),
leg2Collection = cms.InputTag(""),
ptDependence1Pi0 = cms.double(0.0),
ptDependence3Prong = cms.double(0.0)
),
cuts = cms.PSet(
)
)
process.cmgTauEleCorSVFitFullSel = cms.EDFilter("CmgTauEleSelector",
src = cms.InputTag("cmgTauEleCorSVFitPreSel"),
cut = cms.string('')
)
process.cmgTauEleCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauEleSel"),
minNumber = cms.uint32(1)
)
process.cmgTauEleMVAPreSel = cms.EDFilter("TauEleUpdatePOProducer",
cfg = cms.PSet(
shift1Prong1Pi0 = cms.double(0.0),
diObjectCollection = cms.InputTag("cmgTauElePreSel"),
leg1Collection = cms.InputTag(""),
metCollection = cms.InputTag("recoilCorrectedMET"),
uncertainty = cms.double(0.03),
shift1ProngNoPi0 = cms.double(0.0),
shift3Prong = cms.double(0.0),
nSigma = cms.double(0),
leg2Collection = cms.InputTag(""),
ptDependence1Pi0 = cms.double(0.0),
ptDependence3Prong = cms.double(0.0)
),
cuts = cms.PSet(
)
)
process.cmgTauElePreSel = cms.EDFilter("CmgTauEleSelector",
src = cms.InputTag("cmgTauEle"),
cut = cms.string('getSelection("cuts_baseline")')
)
process.cmgTauEleSel = cms.EDFilter("CmgTauEleSelector",
src = cms.InputTag("cmgTauEle"),
cut = cms.string('pt()>0')
)
process.cmgTauEleTauPtSel = cms.EDFilter("CmgTauEleSelector",
src = cms.InputTag("cmgTauEleCor"),
cut = cms.string('leg1().pt()>18.')
)
process.cmgTauMu = cms.EDFilter("TauMuPOProducer",
cfg = cms.PSet(
leg2Collection = cms.InputTag("cmgMuonSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metCollection = cms.InputTag("cmgPFMET"),
metsigCollection = cms.InputTag("")
),
cuts = cms.PSet(
caloMuVeto = cms.string('leg1().eOverP()>0.2'),
baseline = cms.PSet(
tauLeg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.3'),
pt = cms.string('leg1().pt()>15.0')
),
id = cms.PSet(
muRejection = cms.string('leg1().tauID("againstMuonTight") > 0.5'),
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
muLeg = cms.PSet(
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.1'),
pt = cms.string('leg2().pt()>17.0')
)
),
mass = cms.string('mass()>10')
)
)
)
process.cmgTauMuCor = cms.EDFilter("TauMuUpdatePOProducer",
cfg = cms.PSet(
shift1Prong1Pi0 = cms.double(0.012),
diObjectCollection = cms.InputTag("mvaMETTauMu"),
leg1Collection = cms.InputTag(""),
shiftMet = cms.bool(True),
shiftTaus = cms.bool(True),
uncertainty = cms.double(0.03),
shift1ProngNoPi0 = cms.double(0.0),
shift3Prong = cms.double(0.012),
nSigma = cms.double(0),
leg2Collection = cms.InputTag(""),
ptDependence1Pi0 = cms.double(0.0),
ptDependence3Prong = cms.double(0.0)
),
cuts = cms.PSet(
)
)
process.cmgTauMuCorSVFitFullSel = cms.EDFilter("CmgTauMuSelector",
src = cms.InputTag("cmgTauMuCorSVFitPreSel"),
cut = cms.string('')
)
process.cmgTauMuCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauMuSel"),
minNumber = cms.uint32(1)
)
process.cmgTauMuMVAPreSel = cms.EDFilter("TauMuUpdatePOProducer",
cfg = cms.PSet(
shift1Prong1Pi0 = cms.double(0.012),
diObjectCollection = cms.InputTag("cmgTauMuPreSel"),
leg1Collection = cms.InputTag(""),
shiftMet = cms.bool(True),
shiftTaus = cms.bool(True),
uncertainty = cms.double(0.03),
shift1ProngNoPi0 = cms.double(0.0),
shift3Prong = cms.double(0.012),
nSigma = cms.double(0),
leg2Collection = cms.InputTag(""),
ptDependence1Pi0 = cms.double(0.0),
ptDependence3Prong = cms.double(0.0)
),
cuts = cms.PSet(
)
)
process.cmgTauMuPreSel = cms.EDFilter("CmgTauMuSelector",
src = cms.InputTag("cmgTauMu"),
cut = cms.string('getSelection("cuts_baseline")')
)
process.cmgTauMuSel = cms.EDFilter("CmgTauMuSelector",
src = cms.InputTag("cmgTauMu"),
cut = cms.string('pt()>0')
)
process.cmgTauMuTauPtSel = cms.EDFilter("CmgTauMuSelector",
src = cms.InputTag("cmgTauMuCor"),
cut = cms.string('leg1().pt()>18.')
)
process.diTauFullSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgDiTauCorSVFitFullSel"),
minNumber = cms.uint32(1)
)
process.diTauPreSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgDiTauCorSVFitPreSel"),
minNumber = cms.uint32(1)
)
process.goodPVFilter = cms.EDFilter("VertexSelector",
filter = cms.bool(True),
src = cms.InputTag("offlinePrimaryVertices"),
cut = cms.string('!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2')
)
process.muEleFullSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgMuEleCorSVFitFullSel"),
minNumber = cms.uint32(1)
)
process.muElePreSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgMuEleCorSVFitPreSel"),
minNumber = cms.uint32(1)
)
process.tauEleFullSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauEleCorSVFitFullSel"),
minNumber = cms.uint32(1)
)
process.tauElePreSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauEleCorSVFitPreSel"),
minNumber = cms.uint32(1)
)
process.tauMuFullSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauMuCorSVFitFullSel"),
minNumber = cms.uint32(1)
)
process.tauMuPreSelCount = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("cmgTauMuCorSVFitPreSel"),
minNumber = cms.uint32(1)
)
process.diTau_fullsel_tree_CMG = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *',
'drop *',
'keep *_source_*_*',
'keep *_generator_*_*',
'keep *_TriggerResults__*',
'keep *_addPileupInfo__HLT',
'keep *_genJetSel__PAT',
'keep *_tauGenJetsSelectorAllHadrons__PAT',
'keep *_genParticlesPruned__PAT',
'keep *_vertexWeight*__*',
'keep *_ak5CaloJets_rho_RECO',
'keep *_ak5PFJets_rho_RECO',
'keep *_ak5TrackJets_rho_RECO',
'keep *_ak7BasicJets_rho_RECO',
'keep *_ak7CaloJets_rho_RECO',
'keep *_ak7PFJets_rho_RECO',
'keep *_kt4CaloJets_rho_RECO',
'keep *_kt4PFJets_rho_RECO',
'keep *_kt6CaloJets_rho_RECO',
'keep *_kt6CaloJetsCentral_rho_RECO',
'keep *_kt6PFJets_rho_RECO',
'keep *_kt6PFJetsCentralChargedPileUp_rho_RECO',
'keep *_kt6PFJetsCentralNeutral_rho_RECO',
'keep *_kt6PFJetsCentralNeutralTight_rho_RECO',
'keep *_TriggerResults__RECO',
'keep *_offlinePrimaryVertices__RECO',
'keep *_pfMetSignificance__PAT',
'keep *_ak5PFJetsCHS_rho_PAT',
'keep *_ak5PFJetsCHSpruned_rho_PAT',
'keep *_kt6PFJetsCHSForIso_rho_PAT',
'keep *_kt6PFJetsForIso_rho_PAT',
'keep *_kt6PFJetsForRhoComputationVoronoi_rho_PAT',
'keep *_TriggerResults__PAT',
'keep *_nJetsPtGt1__PAT',
'keep *_cmgPFBaseJetLead__PAT',
'keep *_cmgPFBaseJetLeadCHS__PAT',
'keep *_cmgPFMET__PAT',
'keep *_cmgPFMETRaw__PAT',
'keep *_cmgDiElectronSel__PAT',
'keep *_cmgDiMuonSel__PAT',
'keep *_cmgElectronSel__PAT',
'keep *_cmgMuonSel__PAT',
'keep *_cmgPFJetLooseJetIdFailed__PAT',
'keep *_cmgPFJetMediumJetIdFailed__PAT',
'keep *_cmgPFJetSel__PAT',
'keep *_cmgPFJetSelCHS__PAT',
'keep *_cmgPFJetTightJetIdFailed__PAT',
'keep *_cmgPFJetVeryLooseJetId95Failed__PAT',
'keep *_cmgPFJetVeryLooseJetId95gammaFailed__PAT',
'keep *_cmgPFJetVeryLooseJetId95h0Failed__PAT',
'keep *_cmgPFJetVeryLooseJetId99Failed__PAT',
'keep *_cmgPhotonSel__PAT',
'keep *_cmgStructuredPFJetSel__PAT',
'keep *_cmgTriggerObjectListSel__PAT',
'keep *_cmgTriggerObjectSel__PAT',
'keep *_patElectronsWithTrigger__PAT',
'keep *_patMuonsWithTrigger__PAT',
'keep *_nopuMet__PAT',
'keep *_pcMet__PAT',
'keep *_pfMetForRegression__PAT',
'keep *_puMet__PAT',
'keep *_tkMet__PAT',
'keep *_TriggerResults__H2TAUTAU',
'keep *_cmgDiTauCorSVFitFullSel__H2TAUTAU',
'keep *_mvaMETdiTau__H2TAUTAU',
'keep *_goodPVFilter__H2TAUTAU',
'keep *_genParticles_*_*'),
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('diTauPath')
),
fileName = cms.untracked.string('diTau_fullsel_tree_CMG.root')
)
process.vertexWeightSequence = cms.Sequence(process.vertexWeightEPSJul8+process.vertexWeightLeptonPhoton+process.vertexWeightMay10ReReco+process.vertexWeightPromptRecov4+process.vertexWeight05AugReReco+process.vertexWeightPromptRecov6+process.vertexWeight2invfb+process.vertexWeight2011B+process.vertexWeight2011AB+process.vertexWeightFall11EPSJul8+process.vertexWeightFall11LeptonPhoton+process.vertexWeightFall11May10ReReco+process.vertexWeightFall11PromptRecov4+process.vertexWeightFall1105AugReReco+process.vertexWeightFall11PromptRecov6+process.vertexWeightFall112invfb+process.vertexWeightFall112011B+process.vertexWeightFall112011AB+process.vertexWeight3DMay10ReReco+process.vertexWeight3DPromptRecov4+process.vertexWeight3D05AugReReco+process.vertexWeight3DPromptRecov6+process.vertexWeight3D2invfb+process.vertexWeight3D2011B+process.vertexWeight3D2011AB+process.vertexWeight3DFall11May10ReReco+process.vertexWeight3DFall11PromptRecov4+process.vertexWeight3DFall1105AugReReco+process.vertexWeight3DFall11PromptRecov6+process.vertexWeight3DFall112invfb+process.vertexWeight3DFall112011B+process.vertexWeight3DFall112011AB+process.vertexWeightSummer12MCICHEPData+process.vertexWeightSummer12MC53XICHEPData+process.vertexWeightSummer12MC53XHCPData+process.vertexWeightSummer12MC53X2012D6fbData+process.vertexWeightSummer12MC53X2012ABCDData+process.vertexWeightSummer12MC53X2012BCDData)
process.diTauPreSelSkimSequence = cms.Sequence(process.diTauPreSelCount)
process.muEleFullSelSkimSequence = cms.Sequence(process.muEleFullSelCount)
process.tauEleMvaMETRecoilSequence = cms.Sequence(process.goodPVFilter+process.mvaMETTauEle+process.cmgTauEleCor+process.cmgTauEleTauPtSel+process.recoilCorMETTauEle)
process.tauEleFullSelSkimSequence = cms.Sequence(process.tauEleFullSelCount)
process.tauMuStdSequence = cms.Sequence(process.cmgTauMu+process.cmgTauMuPreSel)
process.tauEleStdSequence = cms.Sequence(process.cmgTauEle+process.cmgTauElePreSel)
process.tauMuMvaMETrecoilSequence = cms.Sequence(process.goodPVFilter+process.mvaMETTauMu+process.cmgTauMuCor+process.cmgTauMuTauPtSel+process.recoilCorMETTauMu)
process.diTauFullSelSkimSequence = cms.Sequence(process.diTauFullSelCount)
process.metRecoilCorrectionInputSequence = cms.Sequence(process.cmgPFJetForRecoilPresel+process.cmgPFJetForRecoil+process.genWorZ)
process.metRecoilCorrectionSequence = cms.Sequence(process.metRecoilCorrectionInputSequence+process.recoilCorrectedMETTauMu+process.recoilCorrectedMETTauEle+process.recoilCorrectedMETMuEle)
process.tauElePreSelSkimSequence = cms.Sequence(process.tauElePreSelCount)
process.muElePreSelSkimSequence = cms.Sequence(process.muElePreSelCount)
process.tauEleCorSVFitSequence = cms.Sequence(process.tauEleMvaMETRecoilSequence+process.cmgTauEleCorSVFitPreSel+process.cmgTauEleCorSVFitFullSel)
process.mvaMETSequence = cms.Sequence(process.goodPVFilter+process.mvaMETDiTau+process.cmgDiTauCor+process.cmgDiTauPtSel+process.recoilCorMETDiTau)
process.diTauStdSequence = cms.Sequence(process.cmgDiTau+process.cmgDiTauPreSel)
process.tauMuPreSelSkimSequence = cms.Sequence(process.tauMuPreSelCount)
process.tauMuFullSelSkimSequence = cms.Sequence(process.tauMuFullSelCount)
process.genSequence = cms.Sequence(process.metRecoilCorrectionInputSequence+process.vertexWeightSequence)
process.tauEleSequence = cms.Sequence(process.tauEleStdSequence+process.tauEleCorSVFitSequence)
process.tauMuCorSVFitSequence = cms.Sequence(process.tauMuMvaMETrecoilSequence+process.cmgTauMuCorSVFitPreSel+process.cmgTauMuCorSVFitFullSel)
process.diTauCorSVFitSequence = cms.Sequence(process.mvaMETSequence+process.cmgDiTauCorSVFitPreSel+process.cmgDiTauCorSVFitFullSel)
process.tauMuSequence = cms.Sequence(process.tauMuStdSequence+process.tauMuCorSVFitSequence)
process.diTauSequence = cms.Sequence(process.diTauStdSequence+process.diTauCorSVFitSequence)
process.diTauPath = cms.Path(process.genSequence+process.diTauSequence+process.diTauFullSelSkimSequence)
process.tauElePath = cms.Path(process.genSequence+process.tauEleSequence+process.tauEleFullSelSkimSequence)
process.tauMuPath = cms.Path(process.genSequence+process.tauMuSequence+process.tauMuFullSelSkimSequence)
process.outpath = cms.EndPath(process.diTau_fullsel_tree_CMG)
process.MessageLogger = cms.Service("MessageLogger",
suppressInfo = cms.untracked.vstring(),
debugs = cms.untracked.PSet(
placeholder = cms.untracked.bool(True)
),
suppressDebug = cms.untracked.vstring(),
cout = cms.untracked.PSet(
placeholder = cms.untracked.bool(True)
),
cerr_stats = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING'),
output = cms.untracked.string('cerr'),
optionalPSet = cms.untracked.bool(True)
),
warnings = cms.untracked.PSet(
placeholder = cms.untracked.bool(True)
),
default = cms.untracked.PSet(
),
statistics = cms.untracked.vstring('cerr_stats'),
cerr = cms.untracked.PSet(
INFO = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
noTimeStamps = cms.untracked.bool(False),
FwkReport = cms.untracked.PSet(
reportEvery = cms.untracked.int32(5000),
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(10000000)
),
default = cms.untracked.PSet(
limit = cms.untracked.int32(10000000)
),
Root_NoDictionary = cms.untracked.PSet(
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(0)
),
threshold = cms.untracked.string('INFO'),
FwkJob = cms.untracked.PSet(
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(0)
),
FwkSummary = cms.untracked.PSet(
reportEvery = cms.untracked.int32(1),
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(10000000)
),
optionalPSet = cms.untracked.bool(True)
),
FrameworkJobReport = cms.untracked.PSet(
default = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
optionalPSet = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(10000000)
)
),
suppressWarning = cms.untracked.vstring(),
errors = cms.untracked.PSet(
placeholder = cms.untracked.bool(True)
),
destinations = cms.untracked.vstring('warnings',
'errors',
'infos',
'debugs',
'cout',
'cerr'),
debugModules = cms.untracked.vstring(),
infos = cms.untracked.PSet(
optionalPSet = cms.untracked.bool(True),
Root_NoDictionary = cms.untracked.PSet(
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(0)
),
placeholder = cms.untracked.bool(True)
),
categories = cms.untracked.vstring('FwkJob',
'FwkReport',
'FwkSummary',
'Root_NoDictionary'),
fwkJobReports = cms.untracked.vstring('FrameworkJobReport')
)
process.HepPDTESSource = cms.ESSource("HepPDTESSource",
pdtFileName = cms.FileInPath('SimGeneral/HepPDTESSource/data/pythiaparticle.tbl')
)
process.diObjectFactory = cms.PSet(
leg2Collection = cms.InputTag("dummy"),
leg1Collection = cms.InputTag("dummy"),
metCollection = cms.InputTag("")
)
process.diTauCuts = cms.PSet(
baseline = cms.PSet(
tau1Leg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.3'),
pt = cms.string('leg1().pt()>15.0')
),
id = cms.PSet(
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
mass = cms.string('mass()>10'),
tau2Leg = cms.PSet(
iso = cms.string('leg2().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.3'),
pt = cms.string('leg2().pt()>15.0')
),
id = cms.PSet(
decay = cms.string('leg2().tauID("decayModeFinding")')
)
)
)
)
process.ditauFactory = cms.PSet(
leg2Collection = cms.InputTag("cmgTauSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metsigCollection = cms.InputTag(""),
metCollection = cms.InputTag("cmgPFMET")
)
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
process.maxLuminosityBlocks = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
process.muEleFactory = cms.PSet(
leg2Collection = cms.InputTag("cmgElectronSel"),
leg1Collection = cms.InputTag("cmgMuonSel"),
metCollection = cms.InputTag("")
)
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(False)
)
process.puJetIdAlgo = cms.PSet(
tmvaVariables = cms.vstring('nvtx',
'jetPt',
'jetEta',
'jetPhi',
'dZ',
'beta',
'betaStar',
'nCharged',
'nNeutrals',
'dR2Mean',
'ptD',
'frac01',
'frac02',
'frac03',
'frac04',
'frac05'),
tmvaMethod = cms.string('JetIDMVAMET'),
cutBased = cms.bool(False),
tmvaWeights = cms.string('CMGTools/External/data/TMVAClassificationCategory_JetID_MET_53X_Dec2012.weights.xml'),
tmvaSpectators = cms.vstring(),
label = cms.string('met53x'),
version = cms.int32(-1),
JetIdParams = cms.PSet(
Pt2030_Tight = cms.vdouble(-2, -2, -2, -2, -2),
Pt2030_Loose = cms.vdouble(-2, -2, -2, -2, -2),
Pt3050_Medium = cms.vdouble(-2, -2, -2, -2, -2),
Pt1020_MET = cms.vdouble(-0.2, -0.2, -0.5, -0.3),
Pt2030_Medium = cms.vdouble(-2, -2, -2, -2, -2),
Pt010_Tight = cms.vdouble(-2, -2, -2, -2, -2),
Pt1020_Tight = cms.vdouble(-2, -2, -2, -2, -2),
Pt3050_MET = cms.vdouble(-0.2, -0.2, 0.0, 0.2),
Pt010_MET = cms.vdouble(-0.2, -0.3, -0.5, -0.5),
Pt1020_Loose = cms.vdouble(-2, -2, -2, -2, -2),
Pt010_Medium = cms.vdouble(-2, -2, -2, -2, -2),
Pt1020_Medium = cms.vdouble(-2, -2, -2, -2, -2),
Pt2030_MET = cms.vdouble(-0.2, -0.2, -0.2, 0.1),
Pt010_Loose = cms.vdouble(-2, -2, -2, -2, -2),
Pt3050_Loose = cms.vdouble(-2, -2, -2, -2, -2),
Pt3050_Tight = cms.vdouble(-2, -2, -2, -2, -2)
),
impactParTkThreshold = cms.double(1.0)
)
process.tauEFactory = cms.PSet(
leg2Collection = cms.InputTag("cmgElectronSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metCollection = cms.InputTag("cmgPFMET")
)
process.tauEleCuts = cms.PSet(
baseline = cms.PSet(
tauLeg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.3'),
pt = cms.string('leg1().pt()>15.0')
),
id = cms.PSet(
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
eleLeg = cms.PSet(
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.1'),
pt = cms.string('leg2().pt()>20.0')
),
ID = cms.PSet(
hitsnum = cms.string('leg2().numberOfHits==0'),
mvaID = cms.string('(abs(leg2().sourcePtr().superCluster().eta())<0.8 && leg2().mvaNonTrigV0() > 0.925) || (abs(leg2().sourcePtr().superCluster().eta())>0.8 && abs(leg2().sourcePtr().superCluster().eta())<1.479 && leg2().mvaNonTrigV0() > 0.975) || (abs(leg2().sourcePtr().superCluster().eta())>1.479 && leg2().mvaNonTrigV0() > 0.985)'),
convVeto = cms.string('leg2().passConversionVeto()!=0')
)
)
)
)
process.tauMuCuts = cms.PSet(
caloMuVeto = cms.string('leg1().eOverP()>0.2'),
baseline = cms.PSet(
tauLeg = cms.PSet(
iso = cms.string('leg1().tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 10.0'),
kinematics = cms.PSet(
eta = cms.string('abs(leg1().eta())<2.3'),
pt = cms.string('leg1().pt()>15.0')
),
id = cms.PSet(
muRejection = cms.string('leg1().tauID("againstMuonTight") > 0.5'),
decay = cms.string('leg1().tauID("decayModeFinding")')
)
),
muLeg = cms.PSet(
kinematics = cms.PSet(
eta = cms.string('abs(leg2().eta())<2.1'),
pt = cms.string('leg2().pt()>17.0')
)
),
mass = cms.string('mass()>10')
)
)
process.tauMuFactory = cms.PSet(
leg2Collection = cms.InputTag("cmgMuonSel"),
leg1Collection = cms.InputTag("cmgTauSel"),
metCollection = cms.InputTag("cmgPFMET")
)
process.schedule = cms.Schedule(*[ process.diTauPath, process.outpath ])
| [
"[email protected]"
] | |
91d7abb0e40dc1bf0cbb74d3f9ed197e1e70bced | de24f83a5e3768a2638ebcf13cbe717e75740168 | /moodledata/vpl_data/380/usersdata/342/107362/submittedfiles/principal.py | 0f40d38c7c74dadb18defa87d6b7e0f5f8d063ca | [] | no_license | rafaelperazzo/programacao-web | 95643423a35c44613b0f64bed05bd34780fe2436 | 170dd5440afb9ee68a973f3de13a99aa4c735d79 | refs/heads/master | 2021-01-12T14:06:25.773146 | 2017-12-22T16:05:45 | 2017-12-22T16:05:45 | 69,566,344 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 317 | py | import random
nome = input('Insira o nome do usuário:')
def solicitaSimboloDoHumano():
simb = input('Escolha o seu símbolo:')
while simb != 'X' or 'O':
simb = input('Escolha um símbolo válido:')
solicitaSimboloDoHumano()
print(random.choice([nome,'computador começa']))
| [
"[email protected]"
] | |
eaea2f61d183d4210777892f777ed5239ea073da | 77d52805fa67c36e13c624f853de027bf70a17e6 | /notSoRand.py | 08fab414bfe7d71d7bddb38c08065faac43e5503 | [] | no_license | BeautyScraper/pythonUtilities | f13d7a2732b754c5b2ab9ae2fbbc17cad04cc6ce | a9fe1b63249ccf0749d70c8bd40696915cd0841b | refs/heads/master | 2020-03-18T16:41:37.566492 | 2019-04-17T03:02:58 | 2019-04-17T03:02:58 | 134,980,812 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 926 | py | import random
import re
import os
def randomLine(fileName="test.txt"):
try:
print("opening " + fileName)
with open("files\\" + fileName,"r") as inF:
selectedLine = random.choice(inF.readlines())
print("Selected Lines is " + selectedLine)
while(re.search("\[(.*?)\]",selectedLine)):
replaceMentStr = randomLine(re.search("\[(.*?)\]",selectedLine)[1] + ".txt")
selectedLine = re.sub("(\[.*?\])",replaceMentStr,selectedLine,1)
except FileNotFoundError or IndexError:
print("Setting default Line")
if len(fileName.split(" ")) == 1:
(open("files\\" + fileName,"w")).close()
selectedLine = fileName.split(".")[0]
print("Returning " + selectedLine)
return selectedLine.rstrip('\n')
os.system("md files")
line = randomLine("Static.txt")
with open("result.txt","w") as file:
file.write(line)
| [
"[email protected]"
] | |
79104fb27df6da2bc9c3650b5f36fe3f58342f99 | 0524471f0deec846a50a3dfb9a039495623a79fd | /manajemen_kontrak/migrations/0050_auto_20210504_0828.py | 75fcc18b53f70e9c563c8efd530fd9ae81989ff7 | [] | no_license | riswanto84/SiLPBJ-Project | 0e97f89d2ea5f1ac4e631e9f0457aa5864a6e8e9 | 7e052f5a4847a07fdd542ae6550e303d6627d1ca | refs/heads/master | 2023-04-24T23:35:41.984864 | 2021-05-08T08:15:28 | 2021-05-08T08:15:28 | 363,024,170 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 624 | py | # Generated by Django 3.1.1 on 2021-05-04 01:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manajemen_kontrak', '0049_auto_20210504_0814'),
]
operations = [
migrations.AddField(
model_name='barang',
name='spesifikasi_dan_gambar',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='tandaterimadistribusi',
name='nomor_tanda_terima',
field=models.CharField(default='7670/HoRJ4Ojo', max_length=100),
),
]
| [
"[email protected]"
] | |
9485737dbc564ef7885a6ba0a9e51092a0c524ec | ab9cfa8aa28749ebd18c4fa4c8712c2198e72501 | /从上到下打印二叉树.py | 46ea53e5fa68a2a32a3177d71697ace7839c0de8 | [] | no_license | joseph-mutu/JianZhiOfferCodePics | d71e780483909390b436f81989000a277daac11d | 8d41326cb2b9bc1379682fa6364a68c0ce62dbee | refs/heads/master | 2020-08-03T14:39:59.666806 | 2019-09-30T06:17:36 | 2019-09-30T06:17:36 | 211,788,783 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 941 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-08-23 16:41:17
# @Author : mutudeh ([email protected])
# @Link : ${link}
# @Version : $Id$
import os
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def PrintFromTopToBottom(self, root):
if root is None:
return []
nodes = []
nodes.append(root)
nodeCount = 0
while nodeCount < len(nodes):
if nodes[nodeCount].left is not None:
nodes.append(nodes[nodeCount].left)
if nodes[nodeCount].right is not None:
nodes.append(nodes[nodeCount].right)
nodes[nodeCount] = nodes[nodeCount].val
nodeCount += 1
return nodes
a = TreeNode(2)
a.left = TreeNode(3)
a.left.left = TreeNode(7)
a.left.left.left = TreeNode(9)
# a.right = TreeNode(7)
# a.left.left = TreeNode(4)
# a.right.left = TreeNode(5)
# a.right.right = TreeNode(9)
s = Solution()
print(s.PrintFromTopToBottom(a))
print() | [
"[email protected]"
] | |
b95a492675647575a6d42baff7748f1c458dab89 | 043a17d196250048a5a34e990a19d8622436f9ce | /Redintek/07_return_values/redintek.py | a116a216bd42d5a87cd88ae1dfb2fafee1e23cb7 | [] | no_license | chimtrangbu/hyperspace | 8df8cb9c5475b70b218d0a56034c7f520815fa0d | ec49324c705e9af61c3857cf2dea2a551bda5537 | refs/heads/master | 2020-03-26T07:18:34.249976 | 2018-12-20T05:16:55 | 2018-12-20T05:16:55 | 144,647,659 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,420 | py | r = {}
def put(key, value):
global r
r[key] = value
return value
def get(key):
return r[key] if key in r.keys() else None
def exists(key):
return (key in r.keys())
def delete(key):
global r
try:
del r[key]
return True
except KeyError:
return False
def incr(key):
global r
return incrby(key, 1)
def incrby(key, delta):
global r
if not exists(key):
put(key, 0)
elif not isinstance(r[key], (int, float)):
raise ValueError('Incorrect value')
r[key] += delta
return r[key]
def sadd(key, value):
global r
if not exists(key):
r[key] = set([value])
elif not isinstance(r[key], set):
r[key] = set([value])
else:
r[key].add(value)
return value
def smembers(key):
return r[key] if (exists(key) and isinstance(r[key], set)) else None
def sunion(key1, key2):
set1 = smembers(key1) if smembers(key1) is not None else set()
set2 = smembers(key2)
return set1.union(set2) if (set2 is not None) else set1
def sinter(key1, key2):
set1 = smembers(key1) if smembers(key1) is not None else set()
set2 = smembers(key2) if smembers(key2) is not None else set()
return(set1 & set2)
def srem(key, value):
global r
if smembers(key) is not None and value in smembers(key):
smembers(key).remove(value)
return True
return False
| [
"[email protected]"
] | |
5ec6e963b60657efb5c7f58282747bd3c3b3bbcf | 86df6f8f4f3c03cccc96459ad82bcdf3bf942492 | /lintcode/find-the-connected-component-in-the-undirected-graph.py | 1d83a7de926c28153c4e30dca9008b29f8b6e8b8 | [] | no_license | bdliyq/algorithm | 369d1fd2ae3925a559ebae3fa8f5deab233daab1 | e1c993a5d1531e1fb10cd3c8d686f533c9a5cbc8 | refs/heads/master | 2016-08-11T21:49:31.259393 | 2016-04-05T11:10:30 | 2016-04-05T11:10:30 | 44,576,582 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,113 | py | #!/usr/bin/env python
# encoding: utf-8
# Question: http://www.lintcode.com/en/problem/find-the-connected-component-in-the-undirected-graph/
# Definition for a undirected graph node
# class UndirectedGraphNode:
# def __init__(self, x):
# self.label = x
# self.neighbors = []
class Solution:
# @param {UndirectedGraphNode[]} nodes a array of undirected graph node
# @return {int[][]} a connected set of a undirected graph
def connectedSet(self, nodes):
# Write your code here
if len(nodes) == 0:
return [[]]
visited = set()
stack = []
result = []
for node in nodes:
stack.append(node)
path = []
while stack:
the_node = stack.pop()
if the_node in visited:
continue
path.append(the_node.label)
visited.add(the_node)
for neighbor in the_node.neighbors:
stack.append(neighbor)
if path:
result.append(sorted(path))
return result
| [
"[email protected]"
] | |
32b67fab7e56846fb6300e78ec34af1bdd32c6a3 | f0d713996eb095bcdc701f3fab0a8110b8541cbb | /YLf984Eod74ha4Tok_19.py | a1794374010be900955aa9ae6a5c69cf7e837041 | [] | no_license | daniel-reich/turbo-robot | feda6c0523bb83ab8954b6d06302bfec5b16ebdf | a7a25c63097674c0a81675eed7e6b763785f1c41 | refs/heads/main | 2023-03-26T01:55:14.210264 | 2021-03-23T16:08:01 | 2021-03-23T16:08:01 | 350,773,815 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,337 | py | """
In a calendar year, it is exactly 365.25 days. But, eventually, this will lead
to confusion because humans normally count by exact divisibility of 1 and not
with decimal points. So, to avoid the latter, it was decided to add up all
0.25 days every four-year cycle, make that year to sum up to 366 days
(including February 29 as an intercalary day), thus, called a **leap year**
and aside the other years of the four-year cycle to sum up to 365 days, **not
a leap year**.
In this challenge, (though quite repetitive), we'll take it to a new level,
where, you are to determine if it's a leap year or not without the use of the
**datetime** class, **if blocks** , **if-elif blocks** , **conditionals** (`a
if b else c`) nor the logical operators **AND** (`and`) and **OR** (`or`) with
the exemption of the **NOT** (`not`) operator.
Return `True` if it's a leap year, `False` otherwise.
### Examples
leap_year(1979) ➞ False
leap_year(2000) ➞ True
leap_year(2016) ➞ True
leap_year(1521) ➞ False
leap_year(1996) ➞ True
leap_year(1800) ➞ False
### Notes
You can't use the **datetime** class, **if statements** in general, the
**conditional** nor the **logical operators** (`and`, `or`).
"""
def leap_year(yr):
return ((not yr%4) + (not yr%100) + (not yr%400))%2
| [
"[email protected]"
] | |
46f861b5d2e6b2395aeb66db0a5a19d451da893f | b7a3d0ac1c3c46743adfbfd2da6b7b6b22d3910b | /backend/pakearn_3676/wsgi.py | 6f4211e43bd31b4790cb02e4d689ddd3c2185850 | [] | no_license | crowdbotics-apps/pakearn-3676 | 976a1b24e3a47ed42526ae6f99b5cda248e88d04 | 7c2aa72a2091604be81c4b82931dd494137b43f2 | refs/heads/master | 2020-05-25T20:07:02.159662 | 2019-05-22T05:12:19 | 2019-05-22T05:12:19 | 187,967,071 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 402 | py | """
WSGI config for pakearn_3676 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pakearn_3676.settings")
application = get_wsgi_application()
| [
"[email protected]"
] | |
338342748a69234b4d64912a2a2f6e1632b917b1 | d554b1aa8b70fddf81da8988b4aaa43788fede88 | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4375/codes/1670_2966.py | 3ece3928b8754173db28d496c3a374b1107e4dee | [] | no_license | JosephLevinthal/Research-projects | a3bc3ca3b09faad16f5cce5949a2279cf14742ba | 60d5fd6eb864a5181f4321e7a992812f3c2139f9 | refs/heads/master | 2022-07-31T06:43:02.686109 | 2020-05-23T00:24:26 | 2020-05-23T00:24:26 | 266,199,309 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 259 | py | promocao=input("S ou N: ")
ingresso=float(input("valor do ingresso: "))
qntd=float(input("qntd de ingressos: "))
total=ingresso*qntd
promocao=promocao.upper()
if promocao=="S":
desconto=total-total*0.2
print(round(desconto,2))
else:
print(round(total,2))
| [
"[email protected]"
] | |
ffd9e8e9af3dbad639d8bf389ab7b9590881963d | 9df2fb0bc59ab44f026b0a2f5ef50c72b2fb2ceb | /sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_cmk.py | a14ee86badfe4c98c526af848a574e0f339ba9d0 | [
"MIT",
"LGPL-2.1-or-later",
"LicenseRef-scancode-generic-cla"
] | permissive | openapi-env-test/azure-sdk-for-python | b334a2b65eeabcf9b7673879a621abb9be43b0f6 | f61090e96094cfd4f43650be1a53425736bd8985 | refs/heads/main | 2023-08-30T14:22:14.300080 | 2023-06-08T02:53:04 | 2023-06-08T02:53:04 | 222,384,897 | 1 | 0 | MIT | 2023-09-08T08:38:48 | 2019-11-18T07:09:24 | Python | UTF-8 | Python | false | false | 2,162 | py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python storage_account_enable_cmk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StorageManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.storage_accounts.update(
resource_group_name="res9407",
account_name="sto8596",
parameters={
"properties": {
"encryption": {
"keySource": "Microsoft.Keyvault",
"keyvaultproperties": {
"keyname": "wrappingKey",
"keyvaulturi": "https://myvault8569.vault.azure.net",
"keyversion": "",
},
"services": {
"blob": {"enabled": True, "keyType": "Account"},
"file": {"enabled": True, "keyType": "Account"},
},
}
}
},
)
print(response)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountEnableCMK.json
if __name__ == "__main__":
main()
| [
"[email protected]"
] | |
b2acc2ec4ad57a84ba11c806eb4b36ae1fc06ad8 | 4a73648ecd3951b802e89e83a3bd9ef5b063af3d | /python_part/Leetcode/Sort/215. Kth Largest Element in an Array(快排)/Quick Select.py | f10356100760825b120026fe8c08605d817cf4d8 | [] | no_license | Allen-C-Guan/Leetcode-Answer | f5f9ee1348b86da914a564b7d23bf8904d5aa27f | f6e1374ef567590fee15ba6d1d6d65891233b5e1 | refs/heads/master | 2023-08-17T18:18:00.581743 | 2021-10-10T15:24:07 | 2021-10-10T15:24:07 | 257,017,331 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,654 | py | '''
quick select的方法 也是quicksort的基础
我们使用递归来完成
'''
from typing import List
class Solution:
def __init__(self):
self.res = None
def findKthLargest(self, nums: List[int], k: int) -> int:
# 其实这个partition 由于采用的是lo,hi,并不需要计算k的相对大小。
# 在partition里面,我们最好还是每次随机选择pivot比较快。
# s 表示slow,fast 不停的走, slow只有被替换了以后才走
'''
for fast in range(lo,hi):
if num[fast] < pivot:
swap num[fast] num[slow]
slow += 1
slow -= 1
swap nums[lo] num[slow]
'''
def partition(nums: List[int], lo, hi):
pivot, s = nums[lo], lo+1 # s永远指向的是前面的大于pivot的数的前一个
for fast in range(lo+1, hi+1):
if nums[fast] > pivot: # 这里是 > 则得到的就是逆序, s就会停在小的上面,
nums[fast], nums[s] = nums[s], nums[fast]
s += 1
s -= 1
nums[lo], nums[s] = nums[s], nums[lo]
return s
def quickSelect(nums: List[int],lo,hi,k): #与二分的逻辑相同, 先判定,再二分
s = partition(nums,lo,hi)
if s == k-1:
self.res = nums[s]
else:
if s < k-1: quickSelect(nums,s+1,hi,k)
else:quickSelect(nums,lo,s-1,k)
quickSelect(nums,0,len(nums)-1,k)
return self.res
foo = Solution()
print(foo.findKthLargest([3,2,3,1,2,4,5,5,6],4))
| [
"[email protected]"
] | |
e28854dde030346d5b89484a8453525a3bf8b422 | 27b599eabf8f5e8088e30c0d2baa6682f1661be4 | /tensorflow_probability/python/internal/auto_composite_tensor_test.py | 3ecb660335c6694b3c66eb9b15fe72aa36b47c62 | [
"Apache-2.0"
] | permissive | adriang133/probability | b6ecf28f737c44f19df3a4893e6d1cf0351bc4a0 | edfc4585f38017153fe7bf1a7287fcdd237912c4 | refs/heads/master | 2022-12-12T05:02:04.247859 | 2020-09-16T21:06:03 | 2020-09-16T21:07:27 | 296,163,707 | 0 | 0 | Apache-2.0 | 2020-09-16T22:47:07 | 2020-09-16T22:47:06 | null | UTF-8 | Python | false | false | 2,593 | py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Tests for auto_composite_tensor."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
from tensorflow_probability.python.internal import auto_composite_tensor as auto_ct
from tensorflow_probability.python.internal import test_util
AutoIdentity = auto_ct.auto_composite_tensor(tf.linalg.LinearOperatorIdentity)
AutoDiag = auto_ct.auto_composite_tensor(tf.linalg.LinearOperatorDiag)
AutoBlockDiag = auto_ct.auto_composite_tensor(tf.linalg.LinearOperatorBlockDiag)
class AutoCompositeTensorTest(test_util.TestCase):
def test_example(self):
@auto_ct.auto_composite_tensor
class Adder(object):
def __init__(self, x, y):
self._x = tf.convert_to_tensor(x)
self._y = tf.convert_to_tensor(y)
def xpy(self):
return self._x + self._y
def body(obj):
return Adder(obj.xpy(), 1.),
result, = tf.while_loop(
cond=lambda _: True,
body=body,
loop_vars=(Adder(1., 1.),),
maximum_iterations=3)
self.assertAllClose(5., result.xpy())
def test_function(self):
lop = AutoDiag(2. * tf.ones([3]))
self.assertAllClose(
6. * tf.ones([3]),
tf.function(lambda lop: lop.matvec(3. * tf.ones([3])))(lop))
def test_loop(self):
def body(lop):
return AutoDiag(lop.matvec(tf.ones([3]) * 2.)),
init_lop = AutoDiag(tf.ones([3]))
lop, = tf.while_loop(
cond=lambda _: True,
body=body,
loop_vars=(init_lop,),
maximum_iterations=3)
self.assertAllClose(2.**3 * tf.ones([3]), lop.matvec(tf.ones([3])))
def test_nested(self):
lop = AutoBlockDiag([AutoDiag(tf.ones([2]) * 2), AutoIdentity(1)])
self.assertAllClose(
tf.constant([6., 6, 3]),
tf.function(lambda lop: lop.matvec(3. * tf.ones([3])))(lop))
if __name__ == '__main__':
tf.test.main()
| [
"[email protected]"
] | |
915f56d3c4a365c0cb016403d0ebe181278d0ca2 | 95bba054198a2709163ecb3cf2adbd9ed6913490 | /fph/parseFile.py | c428bf7c6b2516e63ecd4227f4641c14a90690f4 | [] | no_license | jieter/fph-parser | e21549c788cf80f91ac9def168fd46e13e8ac847 | 2e1b57e2815cfcf023a6c1c68793a22fe178a533 | refs/heads/master | 2020-04-06T07:03:00.822824 | 2015-09-09T07:19:24 | 2015-09-09T07:19:24 | 14,070,587 | 4 | 3 | null | null | null | null | UTF-8 | Python | false | false | 566 | py | # Fisher and Paykel CPAP .FPH file parser.
#
# Jan Pieter Waagmeester <[email protected]>
#
# File format source:
# http://sourceforge.net/apps/mediawiki/sleepyhead/index.php?title=Icon
import FPHFile
from summary import SummaryFile
from detail import DetailFile
from flow import FlowFile
def parseFile(filename):
parts = filename.split('/')
prefix = parts[-1][0:3]
if (prefix == 'SUM'):
return SummaryFile(filename)
elif (prefix == 'DET'):
return DetailFile(filename)
elif (prefix == 'FLW'):
return FlowFile(filename)
else:
return FPHFile(filename) | [
"[email protected]"
] | |
808efbb3e5a50d252926f34dd42f8d2f275a33a6 | b80ee603f5fde501795e026ef2b122baf5c57c9d | /pre_commit_hooks/fix_byte_order_marker.py | 1ffe047de80c3b981b56d37ac9d0c8ba34d4089e | [
"MIT"
] | permissive | ADTRAN/pre-commit-hooks | 384656043c75f70aae7e452c13ad61cb2cfb455a | 73254720098abd062a99074496e5b19eeba7e1d9 | refs/heads/master | 2023-08-07T03:58:03.705712 | 2021-10-11T20:54:25 | 2021-10-11T20:54:25 | 416,055,424 | 0 | 1 | MIT | 2021-10-11T20:54:26 | 2021-10-11T19:12:40 | Python | UTF-8 | Python | false | false | 797 | py | import argparse
from typing import Optional
from typing import Sequence
def main(argv: Optional[Sequence[str]] = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)
retv = 0
for filename in args.filenames:
with open(filename, 'rb') as f_b:
bts = f_b.read(3)
if bts == b'\xef\xbb\xbf':
with open(filename, newline='', encoding='utf-8-sig') as f:
contents = f.read()
with open(filename, 'w', newline='', encoding='utf-8') as f:
f.write(contents)
print(f'{filename}: removed byte-order marker')
retv = 1
return retv
if __name__ == '__main__':
exit(main())
| [
"[email protected]"
] | |
d1ea9e31207bbebbd7ed7889663442e0c8b6193c | 2eddcd036a85d040cb2f45adac41efb1cf2eacff | /problem_36.py | 110651f9c305495944d7390e66f5a737cf0bd44b | [] | no_license | pmaddi/euler | 1a16869976054faa36f3fb0aa5ff3d802b1982dd | 17f8a898b1ab0fdb0e81f72e9ca4711f119e5829 | refs/heads/master | 2021-12-28T12:38:40.280036 | 2021-12-25T22:46:50 | 2021-12-25T22:46:50 | 127,155,664 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 234 | py | if __name__ == '__main__':
def r(n):
return ''.join(reversed(n))
out = 0
for i in range(1, 10**6):
d = str(i)
b = bin(i)[2:]
if r(d) == d and r(b) == b:
out += i
print(out)
| [
"[email protected]"
] | |
1a6b37e19acff97cd68240b8c35ca25fe60944da | 51f536ae42397da7826a32b942c88e48d95e9f3c | /examples/dft/00-simple_dft.py | c19b209739a278909fa76796ff2c93fd15a976f7 | [
"BSD-2-Clause"
] | permissive | xlzan/pyscf | 8f3b6e3e4b1de27313f99bc94b4aba15e1c84ff7 | 81606c8f384ff1da98a7aa4c817021a78302110a | refs/heads/master | 2020-03-15T01:41:22.938983 | 2018-04-19T19:41:18 | 2018-04-19T19:41:18 | 131,899,354 | 1 | 0 | BSD-2-Clause | 2018-05-02T19:55:17 | 2018-05-02T19:55:16 | null | UTF-8 | Python | false | false | 612 | py | #!/usr/bin/env python
#
# Author: Qiming Sun <[email protected]>
#
from pyscf import gto, dft
'''
A simple example to run DFT calculation.
See pyscf/dft/vxc.py for the complete list of available XC functional
'''
mol = gto.Mole()
mol.build(
atom = 'H 0 0 0; F 0 0 1.1', # in Angstrom
basis = '631g',
symmetry = True,
)
mydft = dft.RKS(mol)
#mydft.xc = 'lda,vwn'
#mydft.xc = 'lda,vwn_rpa'
#mydft.xc = 'b86,p86'
#mydft.xc = 'b88,lyp'
#mydft.xc = 'b97,pw91'
#mydft.xc = 'b3p86'
#mydft.xc = 'o3lyp'
mydft.xc = 'b3lyp'
mydft.kernel()
# Orbital energies, Mulliken population etc.
mydft.analyze()
| [
"[email protected]"
] | |
ce1625f50652b0d101a5a0d9b7cb7f38aa6631e1 | 63768dc92cde5515a96d774a32facb461a3bf6e9 | /jacket/db/compute/sqlalchemy/migrate_repo/versions/230_add_details_column_to_instance_actions_events.py | 8079a2af04d72e10f2b44e7f7c34eb703f98d723 | [
"Apache-2.0"
] | permissive | ljZM33nd/jacket | 6fe9156f6f5789e5c24425afa7ce9237c302673d | d7ad3147fcb43131098c2a5210847634ff5fb325 | refs/heads/master | 2023-04-16T11:02:01.153751 | 2016-11-15T02:48:12 | 2016-11-15T02:48:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,245 | py | # Copyright 2013 OpenStack Foundation.
#
# 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_db.sqlalchemy import utils
from sqlalchemy import Column, String, Text
from jacket.db.compute.sqlalchemy import api
def upgrade(migrate_engine):
actions_events = utils.get_table(migrate_engine, 'instance_actions_events')
host = Column('host', String(255))
details = Column('details', Text)
actions_events.create_column(host)
actions_events.create_column(details)
shadow_actions_events = utils.get_table(migrate_engine,
api._SHADOW_TABLE_PREFIX + 'instance_actions_events')
shadow_actions_events.create_column(host.copy())
shadow_actions_events.create_column(details.copy())
| [
"[email protected]"
] | |
6a2ad476a403a0d861a3051455c2906fc5c0ad6c | 88509a8ce62a22acc0639c683900d5d0cb8d69e7 | /Day23/orm/app/migrations/0002_customer.py | 227e5263d58c0d580aa8aa135326246264832abf | [] | no_license | pytutorial/py2104 | 8b0238ab6f6d2f5395aee5fbe1f4aff03b819cd3 | 48b36d6b1f40730ef2747c310e70fb6997eda388 | refs/heads/main | 2023-09-03T16:55:02.285158 | 2021-10-20T05:24:31 | 2021-10-20T05:24:31 | 391,613,464 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 638 | py | # Generated by Django 3.2 on 2021-08-08 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', models.CharField(max_length=20, unique=True)),
('name', models.CharField(max_length=100)),
('address', models.CharField(max_length=200)),
],
),
]
| [
"[email protected]"
] | |
89dd3969b7cbd4d20538ffbf26e73d72bc1c12a8 | e54867ad23f1c07ebc7632125bb408c3f8294cc0 | /camera-calibration/calibrated_camera.py | caceca1e15189841665f732f3bbd199d27b18f36 | [] | no_license | pi-test/foo | ea2a651e83224ea3616d20dba483470e439b40ec | 2a0bdf0db7fedd95a1133636067890ff8fe68e51 | refs/heads/master | 2020-09-07T08:13:35.363352 | 2019-11-09T23:50:01 | 2019-11-09T23:50:01 | 220,718,447 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 855 | py | import sys
import yaml
import cv2
import numpy as np
with open("data.yaml", "r") as stream:
data = yaml.load(stream)
mtx = data["camera_matrix"]
mtx = np.asarray(mtx)
dist = data["dist_coeff"]
dist = np.asarray(dist)
imagePath = sys.argv[1]
img = cv2.imread(imagePath)
h, w = img.shape[:2]
cv2.imshow("preview", img)
cv2.waitKey(0)
# get undistort matrix and pixel matrix
newcameramtx, roi = cv2.getOptimalNewCameraMatrix(mtx, dist, (w, h), 1, (w, h))
print("===================================================")
print("Valid Pixel ROI:")
print roi
print("===================================================")
# undistort
dst = cv2.undistort(img, mtx, dist, None, newcameramtx)
# crop the image
x,y,w,h = roi
dst = dst[y:y+h, x:x+w]
cv2.imshow("undistort", dst)
cv2.imwrite('img/undistort.jpg', dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
| [
"[email protected]"
] | |
f063b29223c2e1574d1892868e349fa6ff05419f | e7116c13ba14d65e2687f47d4e08b8d67ed89cb8 | /run.py | 09e751e2b7eaf0278623259c61506d3b1c849418 | [] | no_license | trzp/target_tracker | bc3ccdd4c4fa3701f60db3b8d4346544b4dbe7cf | 199a730576c5e20345af8af602ad8e4f2c1cc6dc | refs/heads/master | 2020-05-22T06:29:05.786585 | 2019-05-15T11:20:06 | 2019-05-15T11:20:06 | 186,254,958 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,870 | py | import numpy as np
import cv2
import sys
from time import time
import kcftracker
selectingObject = False
initTracking = False
onTracking = False
ix, iy, cx, cy = -1, -1, -1, -1
w, h = 0, 0
inteval = 1
duration = 0.01
# mouse callback function
def draw_boundingbox(event, x, y, flags, param):
global selectingObject, initTracking, onTracking, ix, iy, cx,cy, w, h
if event == cv2.EVENT_LBUTTONDOWN:
selectingObject = True
onTracking = False
ix, iy = x, y
cx, cy = x, y
elif event == cv2.EVENT_MOUSEMOVE:
cx, cy = x, y
elif event == cv2.EVENT_LBUTTONUP:
selectingObject = False
if(abs(x-ix)>10 and abs(y-iy)>10):
w, h = abs(x - ix), abs(y - iy)
ix, iy = min(x, ix), min(y, iy)
initTracking = True
else:
onTracking = False
elif event == cv2.EVENT_RBUTTONDOWN:
onTracking = False
if(w>0):
ix, iy = x-w/2, y-h/2
initTracking = True
if __name__ == '__main__':
if(len(sys.argv)==1):
cap = cv2.VideoCapture(0)
elif(len(sys.argv)==2):
if(sys.argv[1].isdigit()): # True if sys.argv[1] is str of a nonnegative integer
cap = cv2.VideoCapture(int(sys.argv[1]))
else:
cap = cv2.VideoCapture(sys.argv[1])
inteval = 30
else: assert(0), "too many arguments"
tracker = kcftracker.KCFTracker(True, True, True) # hog, fixed_window, multiscale
#if you use hog feature, there will be a short pause after you draw a first boundingbox, that is due to the use of Numba.
cv2.namedWindow('tracking')
cv2.setMouseCallback('tracking',draw_boundingbox)
while(cap.isOpened()):
ret, frame = cap.read()
if not ret:
break
if(selectingObject):
cv2.rectangle(frame,(ix,iy), (cx,cy), (0,255,255), 1)
elif(initTracking):
cv2.rectangle(frame,(ix,iy), (ix+w,iy+h), (0,255,255), 2)
tracker.init([ix,iy,w,h], frame)
initTracking = False
onTracking = True
elif(onTracking):
t0 = time()
boundingbox = tracker.update(frame)
t1 = time()
boundingbox = map(int, boundingbox)
cv2.rectangle(frame,(boundingbox[0],boundingbox[1]), (boundingbox[0]+boundingbox[2],boundingbox[1]+boundingbox[3]), (0,255,255), 1)
duration = 0.8*duration + 0.2*(t1-t0)
#duration = t1-t0
cv2.putText(frame, 'FPS: '+str(1/duration)[:4].strip('.'), (8,20), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0,0,255), 2)
cv2.imshow('tracking', frame)
c = cv2.waitKey(inteval) & 0xFF
if c==27 or c==ord('q'):
break
cap.release()
cv2.destroyAllWindows()
| [
"[email protected]"
] | |
c552a5b4b970b671de29935c6c7fec152f9fbb0f | 77311ad9622a7d8b88707d7cee3f44de7c8860cb | /res_bw/scripts/common/lib/plat-mac/carbon/ah.py | 59522d3bebbfc99e90dd2d0ea96f851b13826555 | [] | no_license | webiumsk/WOT-0.9.14-CT | 9b193191505a4560df4e872e022eebf59308057e | cfe0b03e511d02c36ce185f308eb48f13ecc05ca | refs/heads/master | 2021-01-10T02:14:10.830715 | 2016-02-14T11:59:59 | 2016-02-14T11:59:59 | 51,606,676 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Python | false | false | 355 | py | # 2016.02.14 12:50:05 Střední Evropa (běžný čas)
# Embedded file name: scripts/common/Lib/plat-mac/Carbon/AH.py
from _AH import *
# okay decompyling c:\Users\PC\wotsources\files\originals\res_bw\scripts\common\lib\plat-mac\carbon\ah.pyc
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed
# 2016.02.14 12:50:05 Střední Evropa (běžný čas)
| [
"[email protected]"
] | |
af511c917b239fde8c45abb7f850b9785e7b652f | 0760fb4901a75766921a205b55686d6d6f049b30 | /python/ray/tune/search/hebo/hebo_search.py | 9f40bd8fe2a603935730dc29cb3ddc6d3a1b7260 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | ray-project/ray | a4bb6940b08b59a61ef0b8e755a52d8563a2f867 | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | refs/heads/master | 2023-08-31T03:36:48.164405 | 2023-08-31T03:20:38 | 2023-08-31T03:20:38 | 71,932,349 | 29,482 | 5,669 | Apache-2.0 | 2023-09-14T21:48:14 | 2016-10-25T19:38:30 | Python | UTF-8 | Python | false | false | 16,940 | py | import logging
import pickle
from typing import Dict, List, Optional, Union
import numpy as np
import pandas as pd
from ray.tune.result import DEFAULT_METRIC
from ray.tune.search.sample import (
Categorical,
Domain,
Float,
Integer,
LogUniform,
Quantized,
Uniform,
)
from ray.tune.search import (
UNRESOLVED_SEARCH_SPACE,
UNDEFINED_METRIC_MODE,
UNDEFINED_SEARCH_SPACE,
Searcher,
)
from ray.tune.search.variant_generator import parse_spec_vars
from ray.tune.utils.util import is_nan_or_inf, unflatten_dict, validate_warmstart
try: # Python 3 only -- needed for lint test.
import hebo
import torch # hebo has torch as a dependency
except ImportError:
hebo = None
logger = logging.getLogger(__name__)
SPACE_ERROR_MESSAGE = (
"Space must be either a HEBO DesignSpace object"
"or a dictionary with ONLY tune search spaces."
)
class HEBOSearch(Searcher):
"""Uses HEBO (Heteroscedastic Evolutionary Bayesian Optimization)
to optimize hyperparameters.
HEBO is a cutting edge black-box optimization framework created
by Huawei's Noah Ark. More info can be found here:
https://github.com/huawei-noah/HEBO/tree/master/HEBO.
`space` can either be a HEBO's `DesignSpace` object or a dict of Tune
search spaces.
Please note that the first few trials will be random and used
to kickstart the search process. In order to achieve good results,
we recommend setting the number of trials to at least 16.
Maximum number of concurrent trials is determined by ``max_concurrent``
argument. Trials will be done in batches of ``max_concurrent`` trials.
If this Searcher is used in a ``ConcurrencyLimiter``, the
``max_concurrent`` value passed to it will override the value passed
here.
Args:
space: A dict mapping parameter names to Tune search spaces or a
HEBO DesignSpace object.
metric: The training result objective value attribute. If None
but a mode was passed, the anonymous metric `_metric` will be used
per default.
mode: One of {min, max}. Determines whether objective is
minimizing or maximizing the metric attribute.
points_to_evaluate: Initial parameter suggestions to be run
first. This is for when you already have some good parameters
you want to run first to help the algorithm make better suggestions
for future parameters. Needs to be a list of dicts containing the
configurations.
evaluated_rewards: If you have previously evaluated the
parameters passed in as points_to_evaluate you can avoid
re-running those trials by passing in the reward attributes
as a list so the optimiser can be told the results without
needing to re-compute the trial. Must be the same length as
points_to_evaluate.
random_state_seed: Seed for reproducible
results. Defaults to None. Please note that setting this to a value
will change global random states for `numpy` and `torch`
on initalization and loading from checkpoint.
max_concurrent: Number of maximum concurrent trials.
If this Searcher is used in a ``ConcurrencyLimiter``, the
``max_concurrent`` value passed to it will override the
value passed here.
**kwargs: The keyword arguments will be passed to `HEBO()``.
Tune automatically converts search spaces to HEBO's format:
.. code-block:: python
from ray import tune
from ray.tune.search.hebo import HEBOSearch
config = {
"width": tune.uniform(0, 20),
"height": tune.uniform(-100, 100)
}
hebo = HEBOSearch(metric="mean_loss", mode="min")
tuner = tune.Tuner(
trainable_function,
tune_config=tune.TuneConfig(
search_alg=hebo
),
param_space=config
)
tuner.fit()
Alternatively, you can pass a HEBO `DesignSpace` object manually to the
Searcher:
.. code-block:: python
from ray import tune
from ray.tune.search.hebo import HEBOSearch
from hebo.design_space.design_space import DesignSpace
space_config = [
{'name' : 'width', 'type' : 'num', 'lb' : 0, 'ub' : 20},
{'name' : 'height', 'type' : 'num', 'lb' : -100, 'ub' : 100},
]
space = DesignSpace().parse(space_config)
hebo = HEBOSearch(space, metric="mean_loss", mode="min")
tuner = tune.Tuner(
trainable_function,
tune_config=tune.TuneConfig(
search_alg=hebo
)
)
tuner.fit()
"""
def __init__(
self,
space: Optional[
Union[Dict, "hebo.design_space.design_space.DesignSpace"]
] = None,
metric: Optional[str] = None,
mode: Optional[str] = None,
points_to_evaluate: Optional[List[Dict]] = None,
evaluated_rewards: Optional[List] = None,
random_state_seed: Optional[int] = None,
max_concurrent: int = 8,
**kwargs,
):
assert hebo is not None, (
"HEBO must be installed! You can install HEBO with"
" the command: `pip install 'HEBO>=0.2.0'`."
"This error may also be caused if HEBO"
" dependencies have bad versions. Try updating HEBO"
" first."
)
if mode:
assert mode in ["min", "max"], "`mode` must be 'min' or 'max'."
assert (
isinstance(max_concurrent, int) and max_concurrent >= 1
), "`max_concurrent` must be an integer and at least 1."
if random_state_seed is not None:
assert isinstance(
random_state_seed, int
), "random_state_seed must be None or int, got '{}'.".format(
type(random_state_seed)
)
super(HEBOSearch, self).__init__(metric=metric, mode=mode)
if isinstance(space, dict) and space:
resolved_vars, domain_vars, grid_vars = parse_spec_vars(space)
if resolved_vars:
raise TypeError(SPACE_ERROR_MESSAGE)
if domain_vars or grid_vars:
logger.warning(
UNRESOLVED_SEARCH_SPACE.format(par="space", cls=type(self))
)
space = self.convert_search_space(space)
elif space is not None and not isinstance(
space, hebo.design_space.design_space.DesignSpace
):
raise TypeError(SPACE_ERROR_MESSAGE + " Got {}.".format(type(space)))
self._hebo_config = kwargs
self._random_state_seed = random_state_seed
self._space = space
self._points_to_evaluate = points_to_evaluate
self._evaluated_rewards = evaluated_rewards
self._initial_points = []
self._live_trial_mapping = {}
self._max_concurrent = max_concurrent
self._suggestions_cache = []
self._batch_filled = False
self._opt = None
if space:
self._setup_optimizer()
def set_max_concurrency(self, max_concurrent: int) -> bool:
self._max_concurrent = max_concurrent
return True
def _setup_optimizer(self):
# HEBO internally minimizes, so "max" => -1
if self._mode == "max":
self._metric_op = -1.0
elif self._mode == "min":
self._metric_op = 1.0
if self._metric is None and self._mode:
# If only a mode was passed, use anonymous metric
self._metric = DEFAULT_METRIC
if not isinstance(self._space, hebo.design_space.design_space.DesignSpace):
raise ValueError(
f"Invalid search space: {type(self._space)}. Either pass a "
f"valid search space to the `HEBOSearch` class or pass "
f"a `param_space` parameter to `tune.Tuner()`"
)
if self._space.num_paras <= 0:
raise ValueError(
"Got empty search space. Please make sure to pass "
"a valid search space with at least one parameter to "
"`HEBOSearch`"
)
if self._random_state_seed is not None:
np.random.seed(self._random_state_seed)
torch.random.manual_seed(self._random_state_seed)
self._opt = hebo.optimizers.hebo.HEBO(space=self._space, **self._hebo_config)
if self._points_to_evaluate:
validate_warmstart(
self._space.para_names,
self._points_to_evaluate,
self._evaluated_rewards,
)
if self._evaluated_rewards:
self._opt.observe(
pd.DataFrame(self._points_to_evaluate),
np.array(self._evaluated_rewards) * self._metric_op,
)
else:
self._initial_points = self._points_to_evaluate
def set_search_properties(
self, metric: Optional[str], mode: Optional[str], config: Dict, **spec
) -> bool:
if self._opt:
return False
space = self.convert_search_space(config)
self._space = space
if metric:
self._metric = metric
if mode:
self._mode = mode
self._setup_optimizer()
return True
def suggest(self, trial_id: str) -> Optional[Dict]:
if not self._opt:
raise RuntimeError(
UNDEFINED_SEARCH_SPACE.format(
cls=self.__class__.__name__, space="space"
)
)
if not self._metric or not self._mode:
raise RuntimeError(
UNDEFINED_METRIC_MODE.format(
cls=self.__class__.__name__, metric=self._metric, mode=self._mode
)
)
if not self._live_trial_mapping:
self._batch_filled = False
if self._initial_points:
params = self._initial_points.pop(0)
suggestion = pd.DataFrame([params], index=[0])
else:
if (
self._batch_filled
or len(self._live_trial_mapping) >= self._max_concurrent
):
return None
if not self._suggestions_cache:
suggestion = self._opt.suggest(n_suggestions=self._max_concurrent)
self._suggestions_cache = suggestion.to_dict("records")
params = self._suggestions_cache.pop(0)
suggestion = pd.DataFrame([params], index=[0])
self._live_trial_mapping[trial_id] = suggestion
if len(self._live_trial_mapping) >= self._max_concurrent:
self._batch_filled = True
return unflatten_dict(params)
def on_trial_complete(
self, trial_id: str, result: Optional[Dict] = None, error: bool = False
):
"""Notification for the completion of trial.
HEBO always minimizes."""
if result:
self._process_result(trial_id, result)
self._live_trial_mapping.pop(trial_id)
def _process_result(self, trial_id: str, result: Dict):
trial_info = self._live_trial_mapping[trial_id]
if result and not is_nan_or_inf(result[self._metric]):
self._opt.observe(
trial_info, np.array([self._metric_op * result[self._metric]])
)
def add_evaluated_point(
self,
parameters: Dict,
value: float,
error: bool = False,
pruned: bool = False,
intermediate_values: Optional[List[float]] = None,
):
if intermediate_values:
logger.warning("HEBO doesn't use intermediate_values. Ignoring.")
if not error and not pruned:
self._opt.observe(
pd.DataFrame(
[
{
k: v
for k, v in parameters.items()
if k in self._opt.space.para_names
}
]
),
np.array([value]) * self._metric_op,
)
else:
logger.warning(
"Only non errored and non pruned points can be added to HEBO."
)
def save(self, checkpoint_path: str):
"""Storing current optimizer state."""
if self._random_state_seed is not None:
numpy_random_state = np.random.get_state()
torch_random_state = torch.get_rng_state()
else:
numpy_random_state = None
torch_random_state = None
save_object = self.__dict__.copy()
save_object["__numpy_random_state"] = numpy_random_state
save_object["__torch_random_state"] = torch_random_state
with open(checkpoint_path, "wb") as f:
pickle.dump(save_object, f)
def restore(self, checkpoint_path: str):
"""Restoring current optimizer state."""
with open(checkpoint_path, "rb") as f:
save_object = pickle.load(f)
if isinstance(save_object, dict):
numpy_random_state = save_object.pop("__numpy_random_state", None)
torch_random_state = save_object.pop("__torch_random_state", None)
self.__dict__.update(save_object)
else:
# Backwards compatibility
(
self._opt,
self._initial_points,
numpy_random_state,
torch_random_state,
self._live_trial_mapping,
self._max_concurrent,
self._suggestions_cache,
self._space,
self._hebo_config,
self._batch_filled,
) = save_object
if numpy_random_state is not None:
np.random.set_state(numpy_random_state)
if torch_random_state is not None:
torch.random.set_rng_state(torch_random_state)
@staticmethod
def convert_search_space(spec: Dict, prefix: str = "") -> Dict:
resolved_vars, domain_vars, grid_vars = parse_spec_vars(spec)
params = []
if not domain_vars and not grid_vars:
return {}
if grid_vars:
raise ValueError(
"Grid search parameters cannot be automatically converted "
"to a HEBO search space."
)
def resolve_value(par: str, domain: Domain):
sampler = domain.get_sampler()
if isinstance(sampler, Quantized):
logger.warning(
"HEBO search does not support quantization. "
"Dropped quantization."
)
sampler = sampler.get_sampler()
if isinstance(domain, Float):
if isinstance(sampler, LogUniform):
return {
"name": par,
"type": "pow",
"lb": domain.lower,
"ub": domain.upper,
"base": sampler.base,
}
elif isinstance(sampler, Uniform):
return {
"name": par,
"type": "num",
"lb": domain.lower,
"ub": domain.upper,
}
elif isinstance(domain, Integer):
if isinstance(sampler, LogUniform):
return {
"name": par,
"type": "pow_int",
"lb": domain.lower,
"ub": domain.upper - 1, # Upper bound exclusive
"base": sampler.base,
}
elif isinstance(sampler, Uniform):
return {
"name": par,
"type": "int",
"lb": domain.lower,
"ub": domain.upper - 1, # Upper bound exclusive
}
elif isinstance(domain, Categorical):
return {
"name": par,
"type": "cat",
"categories": list(domain.categories),
}
raise ValueError(
"HEBO does not support parameters of type "
"`{}` with samplers of type `{}`".format(
type(domain).__name__, type(domain.sampler).__name__
)
)
for path, domain in domain_vars:
par = "/".join([str(p) for p in ((prefix,) + path if prefix else path)])
value = resolve_value(par, domain)
params.append(value)
return hebo.design_space.design_space.DesignSpace().parse(params)
| [
"[email protected]"
] | |
99c43e11e73e39345fbad4fb92a9dedc45bd6273 | 2a8a6327fb9a7ce8696aa15b197d5170661fb94f | /zuora_client/models/get_account_type.py | c79f56f011d9bdd68e65c635eeca068bd1dd2c51 | [] | no_license | moderndatainc/zuora-client | 8b88e05132ddf7e8c411a6d7dad8c0baabaa6dad | d50da49ce1b8465c76723496c2561a3b8ebdf07d | refs/heads/master | 2021-09-21T19:17:34.752404 | 2018-08-29T23:24:07 | 2018-08-29T23:24:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 46,473 | py | # coding: utf-8
"""
Zuora API Reference
# Introduction Welcome to the reference for the Zuora REST API! <a href=\"http://en.wikipedia.org/wiki/REST_API\" target=\"_blank\">REST</a> is a web-service protocol that lends itself to rapid development by using everyday HTTP and JSON technology. The Zuora REST API provides a broad set of operations and resources that: * Enable Web Storefront integration from your website. * Support self-service subscriber sign-ups and account management. * Process revenue schedules through custom revenue rule models. * Enable manipulation of most objects in the Zuora Object Model. Want to share your opinion on how our API works for you? <a href=\"https://community.zuora.com/t5/Developers/API-Feedback-Form/gpm-p/21399\" target=\"_blank\">Tell us how you feel </a>about using our API and what we can do to make it better. ## Access to the API If you have a Zuora tenant, you can access the Zuora REST API via one of the following endpoints: | Tenant | Base URL for REST Endpoints | |-------------------------|-------------------------| |US Production | https://rest.zuora.com | |US API Sandbox | https://rest.apisandbox.zuora.com| |US Performance Test | https://rest.pt1.zuora.com | |EU Production | https://rest.eu.zuora.com | |EU Sandbox | https://rest.sandbox.eu.zuora.com | The Production endpoint provides access to your live user data. API Sandbox tenants are a good place to test code without affecting real-world data. If you would like Zuora to provision an API Sandbox tenant for you, contact your Zuora representative for assistance. **Note:** If you have a tenant in the Production Copy Environment, submit a request at <a href=\"http://support.zuora.com/\" target=\"_blank\">Zuora Global Support</a> to enable the Zuora REST API in your tenant and obtain the base URL for REST endpoints. If you do not have a Zuora tenant, go to <a href=\"https://www.zuora.com/resource/zuora-test-drive\" target=\"_blank\">https://www.zuora.com/resource/zuora-test-drive</a> and sign up for a Production Test Drive tenant. The tenant comes with seed data, including a sample product catalog. # API Changelog You can find the <a href=\"https://community.zuora.com/t5/Developers/API-Changelog/gpm-p/18092\" target=\"_blank\">Changelog</a> of the API Reference in the Zuora Community. # Authentication ## OAuth v2.0 Zuora recommends that you use OAuth v2.0 to authenticate to the Zuora REST API. Currently, OAuth is not available in every environment. See [Zuora Testing Environments](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/D_Zuora_Environments) for more information. Zuora recommends you to create a dedicated API user with API write access on a tenant when authenticating via OAuth, and then create an OAuth client for this user. See <a href=\"https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users/Create_an_API_User\" target=\"_blank\">Create an API User</a> for how to do this. By creating a dedicated API user, you can control permissions of the API user without affecting other non-API users. If a user is deactivated, all of the user's OAuth clients will be automatically deactivated. Authenticating via OAuth requires the following steps: 1. Create a Client 2. Generate a Token 3. Make Authenticated Requests ### Create a Client You must first [create an OAuth client](https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users#Create_an_OAuth_Client_for_a_User) in the Zuora UI. To do this, you must be an administrator of your Zuora tenant. This is a one-time operation. You will be provided with a Client ID and a Client Secret. Please note this information down, as it will be required for the next step. **Note:** The OAuth client will be owned by a Zuora user account. If you want to perform PUT, POST, or DELETE operations using the OAuth client, the owner of the OAuth client must have a Platform role that includes the \"API Write Access\" permission. ### Generate a Token After creating a client, you must make a call to obtain a bearer token using the [Generate an OAuth token](https://www.zuora.com/developer/api-reference/#operation/createToken) operation. This operation requires the following parameters: - `client_id` - the Client ID displayed when you created the OAuth client in the previous step - `client_secret` - the Client Secret displayed when you created the OAuth client in the previous step - `grant_type` - must be set to `client_credentials` **Note**: The Client ID and Client Secret mentioned above were displayed when you created the OAuth Client in the prior step. The [Generate an OAuth token](https://www.zuora.com/developer/api-reference/#operation/createToken) response specifies how long the bearer token is valid for. Call [Generate an OAuth token](https://www.zuora.com/developer/api-reference/#operation/createToken) again to generate a new bearer token. ### Make Authenticated Requests To authenticate subsequent API requests, you must provide a valid bearer token in an HTTP header: `Authorization: Bearer {bearer_token}` If you have [Zuora Multi-entity](https://www.zuora.com/developer/api-reference/#tag/Entities) enabled, you need to set an additional header to specify the ID of the entity that you want to access. You can use the `scope` field in the [Generate an OAuth token](https://www.zuora.com/developer/api-reference/#operation/createToken) response to determine whether you need to specify an entity ID. If the `scope` field contains more than one entity ID, you must specify the ID of the entity that you want to access. For example, if the `scope` field contains `entity.1a2b7a37-3e7d-4cb3-b0e2-883de9e766cc` and `entity.c92ed977-510c-4c48-9b51-8d5e848671e9`, specify one of the following headers: - `Zuora-Entity-Ids: 1a2b7a37-3e7d-4cb3-b0e2-883de9e766cc` - `Zuora-Entity-Ids: c92ed977-510c-4c48-9b51-8d5e848671e9` **Note**: For a limited period of time, Zuora will accept the `entityId` header as an alternative to the `Zuora-Entity-Ids` header. If you choose to set the `entityId` header, you must remove all \"-\" characters from the entity ID in the `scope` field. If the `scope` field contains a single entity ID, you do not need to specify an entity ID. ## Other Supported Authentication Schemes Zuora continues to support the following additional legacy means of authentication: * Use username and password. Include authentication with each request in the header: * `apiAccessKeyId` * `apiSecretAccessKey` Zuora recommends that you create an API user specifically for making API calls. See <a href=\"https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users/Create_an_API_User\" target=\"_blank\">Create an API User</a> for more information. * Use an authorization cookie. The cookie authorizes the user to make calls to the REST API for the duration specified in **Administration > Security Policies > Session timeout**. The cookie expiration time is reset with this duration after every call to the REST API. To obtain a cookie, call the [Connections](https://www.zuora.com/developer/api-reference/#tag/Connections) resource with the following API user information: * ID * Password * For CORS-enabled APIs only: Include a 'single-use' token in the request header, which re-authenticates the user with each request. See below for more details. ### Entity Id and Entity Name The `entityId` and `entityName` parameters are only used for [Zuora Multi-entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity \"Zuora Multi-entity\"). These are the legacy parameters that Zuora will only continue to support for a period of time. Zuora recommends you to use the `Zuora-Entity-Ids` parameter instead. The `entityId` and `entityName` parameters specify the Id and the [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name \"Introduction to Entity and Entity Hierarchy\") that you want to access, respectively. Note that you must have permission to access the entity. You can specify either the `entityId` or `entityName` parameter in the authentication to access and view an entity. * If both `entityId` and `entityName` are specified in the authentication, an error occurs. * If neither `entityId` nor `entityName` is specified in the authentication, you will log in to the entity in which your user account is created. To get the entity Id and entity name, you can use the GET Entities REST call. For more information, see [API User Authentication](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/A_Overview_of_Multi-entity#API_User_Authentication \"API User Authentication\"). ### Token Authentication for CORS-Enabled APIs The CORS mechanism enables REST API calls to Zuora to be made directly from your customer's browser, with all credit card and security information transmitted directly to Zuora. This minimizes your PCI compliance burden, allows you to implement advanced validation on your payment forms, and makes your payment forms look just like any other part of your website. For security reasons, instead of using cookies, an API request via CORS uses **tokens** for authentication. The token method of authentication is only designed for use with requests that must originate from your customer's browser; **it should not be considered a replacement to the existing cookie authentication** mechanism. See [Zuora CORS REST](https://knowledgecenter.zuora.com/DC_Developers/REST_API/A_REST_basics/G_CORS_REST \"Zuora CORS REST\") for details on how CORS works and how you can begin to implement customer calls to the Zuora REST APIs. See [HMAC Signatures](https://www.zuora.com/developer/api-reference/#operation/POSTHMACSignature \"HMAC Signatures\") for details on the HMAC method that returns the authentication token. # Requests and Responses ## Request IDs As a general rule, when asked to supply a \"key\" for an account or subscription (accountKey, account-key, subscriptionKey, subscription-key), you can provide either the actual ID or the number of the entity. ## HTTP Request Body Most of the parameters and data accompanying your requests will be contained in the body of the HTTP request. The Zuora REST API accepts JSON in the HTTP request body. No other data format (e.g., XML) is supported. ### Data Type ([Actions](https://www.zuora.com/developer/api-reference/#tag/Actions) and CRUD operations only) We recommend that you do not specify the decimal values with quotation marks, commas, and spaces. Use characters of `+-0-9.eE`, for example, `5`, `1.9`, `-8.469`, and `7.7e2`. Also, Zuora does not convert currencies for decimal values. ## Testing a Request Use a third party client, such as [curl](https://curl.haxx.se \"curl\"), [Postman](https://www.getpostman.com \"Postman\"), or [Advanced REST Client](https://advancedrestclient.com \"Advanced REST Client\"), to test the Zuora REST API. You can test the Zuora REST API from the Zuora API Sandbox or Production tenants. If connecting to Production, bear in mind that you are working with your live production data, not sample data or test data. ## Testing with Credit Cards Sooner or later it will probably be necessary to test some transactions that involve credit cards. For suggestions on how to handle this, see [Going Live With Your Payment Gateway](https://knowledgecenter.zuora.com/CB_Billing/M_Payment_Gateways/C_Managing_Payment_Gateways/B_Going_Live_Payment_Gateways#Testing_with_Credit_Cards \"C_Zuora_User_Guides/A_Billing_and_Payments/M_Payment_Gateways/C_Managing_Payment_Gateways/B_Going_Live_Payment_Gateways#Testing_with_Credit_Cards\" ). ## Concurrent Request Limits Zuora enforces tenant-level concurrent request limits. See <a href=\"https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Policies/Concurrent_Request_Limits\" target=\"_blank\">Concurrent Request Limits</a> for more information. ## Timeout Limit If a request does not complete within 120 seconds, the request times out and Zuora returns a Gateway Timeout error. ## Error Handling Responses and error codes are detailed in [Responses and errors](https://knowledgecenter.zuora.com/DC_Developers/REST_API/A_REST_basics/3_Responses_and_errors \"Responses and errors\"). # Pagination When retrieving information (using GET methods), the optional `pageSize` query parameter sets the maximum number of rows to return in a response. The maximum is `40`; larger values are treated as `40`. If this value is empty or invalid, `pageSize` typically defaults to `10`. The default value for the maximum number of rows retrieved can be overridden at the method level. If more rows are available, the response will include a `nextPage` element, which contains a URL for requesting the next page. If this value is not provided, no more rows are available. No \"previous page\" element is explicitly provided; to support backward paging, use the previous call. ## Array Size For data items that are not paginated, the REST API supports arrays of up to 300 rows. Thus, for instance, repeated pagination can retrieve thousands of customer accounts, but within any account an array of no more than 300 rate plans is returned. # API Versions The Zuora REST API are version controlled. Versioning ensures that Zuora REST API changes are backward compatible. Zuora uses a major and minor version nomenclature to manage changes. By specifying a version in a REST request, you can get expected responses regardless of future changes to the API. ## Major Version The major version number of the REST API appears in the REST URL. Currently, Zuora only supports the **v1** major version. For example, `POST https://rest.zuora.com/v1/subscriptions`. ## Minor Version Zuora uses minor versions for the REST API to control small changes. For example, a field in a REST method is deprecated and a new field is used to replace it. Some fields in the REST methods are supported as of minor versions. If a field is not noted with a minor version, this field is available for all minor versions. If a field is noted with a minor version, this field is in version control. You must specify the supported minor version in the request header to process without an error. If a field is in version control, it is either with a minimum minor version or a maximum minor version, or both of them. You can only use this field with the minor version between the minimum and the maximum minor versions. For example, the `invoiceCollect` field in the POST Subscription method is in version control and its maximum minor version is 189.0. You can only use this field with the minor version 189.0 or earlier. If you specify a version number in the request header that is not supported, Zuora will use the minimum minor version of the REST API. In our REST API documentation, if a field or feature requires a minor version number, we note that in the field description. You only need to specify the version number when you use the fields require a minor version. To specify the minor version, set the `zuora-version` parameter to the minor version number in the request header for the request call. For example, the `collect` field is in 196.0 minor version. If you want to use this field for the POST Subscription method, set the `zuora-version` parameter to `196.0` in the request header. The `zuora-version` parameter is case sensitive. For all the REST API fields, by default, if the minor version is not specified in the request header, Zuora will use the minimum minor version of the REST API to avoid breaking your integration. ### Minor Version History The supported minor versions are not serial. This section documents the changes made to each Zuora REST API minor version. The following table lists the supported versions and the fields that have a Zuora REST API minor version. | Fields | Minor Version | REST Methods | Description | |:--------|:--------|:--------|:--------| | invoiceCollect | 189.0 and earlier | [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Generates an invoice and collects a payment for a subscription. | | collect | 196.0 and later | [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Collects an automatic payment for a subscription. | | invoice | 196.0 and 207.0| [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Generates an invoice for a subscription. | | invoiceTargetDate | 196.0 and earlier | [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\") |Date through which charges are calculated on the invoice, as `yyyy-mm-dd`. | | invoiceTargetDate | 207.0 and earlier | [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Date through which charges are calculated on the invoice, as `yyyy-mm-dd`. | | targetDate | 207.0 and later | [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\") |Date through which charges are calculated on the invoice, as `yyyy-mm-dd`. | | targetDate | 211.0 and later | [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Date through which charges are calculated on the invoice, as `yyyy-mm-dd`. | | includeExisting DraftInvoiceItems | 196.0 and earlier| [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\") | Specifies whether to include draft invoice items in subscription previews. Specify it to be `true` (default) to include draft invoice items in the preview result. Specify it to be `false` to excludes draft invoice items in the preview result. | | includeExisting DraftDocItems | 207.0 and later | [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\") | Specifies whether to include draft invoice items in subscription previews. Specify it to be `true` (default) to include draft invoice items in the preview result. Specify it to be `false` to excludes draft invoice items in the preview result. | | previewType | 196.0 and earlier| [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\") | The type of preview you will receive. The possible values are `InvoiceItem`(default), `ChargeMetrics`, and `InvoiceItemChargeMetrics`. | | previewType | 207.0 and later | [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\") | The type of preview you will receive. The possible values are `LegalDoc`(default), `ChargeMetrics`, and `LegalDocChargeMetrics`. | | runBilling | 211.0 and later | [Create Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_Subscription \"Create Subscription\"); [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\"); [Renew Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_RenewSubscription \"Renew Subscription\"); [Cancel Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_CancelSubscription \"Cancel Subscription\"); [Suspend Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_SuspendSubscription \"Suspend Subscription\"); [Resume Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_ResumeSubscription \"Resume Subscription\"); [Create Account](https://www.zuora.com/developer/api-reference/#operation/POST_Account \"Create Account\")|Generates an invoice or credit memo for a subscription. **Note:** Credit memos are only available if you have the Invoice Settlement feature enabled. | | invoiceDate | 214.0 and earlier | [Invoice and Collect](https://www.zuora.com/developer/api-reference/#operation/POST_TransactionInvoicePayment \"Invoice and Collect\") |Date that should appear on the invoice being generated, as `yyyy-mm-dd`. | | invoiceTargetDate | 214.0 and earlier | [Invoice and Collect](https://www.zuora.com/developer/api-reference/#operation/POST_TransactionInvoicePayment \"Invoice and Collect\") |Date through which to calculate charges on this account if an invoice is generated, as `yyyy-mm-dd`. | | documentDate | 215.0 and later | [Invoice and Collect](https://www.zuora.com/developer/api-reference/#operation/POST_TransactionInvoicePayment \"Invoice and Collect\") |Date that should appear on the invoice and credit memo being generated, as `yyyy-mm-dd`. | | targetDate | 215.0 and later | [Invoice and Collect](https://www.zuora.com/developer/api-reference/#operation/POST_TransactionInvoicePayment \"Invoice and Collect\") |Date through which to calculate charges on this account if an invoice or a credit memo is generated, as `yyyy-mm-dd`. | | memoItemAmount | 223.0 and earlier | [Create credit memo from charge](https://www.zuora.com/developer/api-reference/#operation/POST_CreditMemoFromPrpc \"Create credit memo from charge\"); [Create debit memo from charge](https://www.zuora.com/developer/api-reference/#operation/POST_DebitMemoFromPrpc \"Create debit memo from charge\") | Amount of the memo item. | | amount | 224.0 and later | [Create credit memo from charge](https://www.zuora.com/developer/api-reference/#operation/POST_CreditMemoFromPrpc \"Create credit memo from charge\"); [Create debit memo from charge](https://www.zuora.com/developer/api-reference/#operation/POST_DebitMemoFromPrpc \"Create debit memo from charge\") | Amount of the memo item. | | subscriptionNumbers | 222.4 and earlier | [Create order](https://www.zuora.com/developer/api-reference/#operation/POST_Order \"Create order\") | Container for the subscription numbers of the subscriptions in an order. | | subscriptions | 223.0 and later | [Create order](https://www.zuora.com/developer/api-reference/#operation/POST_Order \"Create order\") | Container for the subscription numbers and statuses in an order. | #### Version 207.0 and Later The response structure of the [Preview Subscription](https://www.zuora.com/developer/api-reference/#operation/POST_SubscriptionPreview \"Preview Subscription\") and [Update Subscription](https://www.zuora.com/developer/api-reference/#operation/PUT_Subscription \"Update Subscription\") methods are changed. The following invoice related response fields are moved to the invoice container: * amount * amountWithoutTax * taxAmount * invoiceItems * targetDate * chargeMetrics # Zuora Object Model The following diagram presents a high-level view of the key Zuora objects. Click the image to open it in a new tab to resize it. <a href=\"https://www.zuora.com/wp-content/uploads/2017/01/ZuoraERD.jpeg\" target=\"_blank\"><img src=\"https://www.zuora.com/wp-content/uploads/2017/01/ZuoraERD.jpeg\" alt=\"Zuora Object Model Diagram\"></a> See the following articles for information about other parts of the Zuora business object model: * <a href=\"https://knowledgecenter.zuora.com/CB_Billing/Invoice_Settlement/D_Invoice_Settlement_Object_Model\" target=\"_blank\">Invoice Settlement Object Model</a> * <a href=\"https://knowledgecenter.zuora.com/BC_Subscription_Management/Orders/BA_Orders_Object_Model\" target=\"_blank\">Orders Object Model</a> You can use the [Describe object](https://www.zuora.com/developer/api-reference/#operation/GET_Describe) operation to list the fields of each Zuora object that is available in your tenant. When you call the operation, you must specify the API name of the Zuora object. The following table provides the API name of each Zuora object: | Object | API Name | |-----------------------------------------------|--------------------------------------------| | Account | `Account` | | Accounting Code | `AccountingCode` | | Accounting Period | `AccountingPeriod` | | Amendment | `Amendment` | | Application Group | `ApplicationGroup` | | Billing Run | <p>`BillingRun`</p><p>**Note:** The API name of this object is `BillingRun` in the [Describe object](https://www.zuora.com/developer/api-reference/#operation/GET_Describe) operation and Export ZOQL queries only. Otherwise, the API name of this object is `BillRun`.</p> | | Contact | `Contact` | | Contact Snapshot | `ContactSnapshot` | | Credit Balance Adjustment | `CreditBalanceAdjustment` | | Credit Memo | `CreditMemo` | | Credit Memo Application | `CreditMemoApplication` | | Credit Memo Application Item | `CreditMemoApplicationItem` | | Credit Memo Item | `CreditMemoItem` | | Credit Memo Part | `CreditMemoPart` | | Credit Memo Part Item | `CreditMemoPartItem` | | Credit Taxation Item | `CreditTaxationItem` | | Custom Exchange Rate | `FXCustomRate` | | Debit Memo | `DebitMemo` | | Debit Memo Item | `DebitMemoItem` | | Debit Taxation Item | `DebitTaxationItem` | | Discount Applied Metrics | `DiscountAppliedMetrics` | | Entity | `Tenant` | | Gateway Reconciliation Event | `PaymentGatewayReconciliationEventLog` | | Gateway Reconciliation Job | `PaymentReconciliationJob` | | Gateway Reconciliation Log | `PaymentReconciliationLog` | | Invoice | `Invoice` | | Invoice Adjustment | `InvoiceAdjustment` | | Invoice Item | `InvoiceItem` | | Invoice Item Adjustment | `InvoiceItemAdjustment` | | Invoice Payment | `InvoicePayment` | | Journal Entry | `JournalEntry` | | Journal Entry Item | `JournalEntryItem` | | Journal Run | `JournalRun` | | Order | `Order` | | Order Action | `OrderAction` | | Order ELP | `OrderElp` | | Order Item | `OrderItem` | | Order MRR | `OrderMrr` | | Order Quantity | `OrderQuantity` | | Order TCB | `OrderTcb` | | Order TCV | `OrderTcv` | | Payment | `Payment` | | Payment Application | `PaymentApplication` | | Payment Application Item | `PaymentApplicationItem` | | Payment Method | `PaymentMethod` | | Payment Method Snapshot | `PaymentMethodSnapshot` | | Payment Method Transaction Log | `PaymentMethodTransactionLog` | | Payment Method Update | `UpdaterDetail` | | Payment Part | `PaymentPart` | | Payment Part Item | `PaymentPartItem` | | Payment Run | `PaymentRun` | | Payment Transaction Log | `PaymentTransactionLog` | | Processed Usage | `ProcessedUsage` | | Product | `Product` | | Product Rate Plan | `ProductRatePlan` | | Product Rate Plan Charge | `ProductRatePlanCharge` | | Product Rate Plan Charge Tier | `ProductRatePlanChargeTier` | | Rate Plan | `RatePlan` | | Rate Plan Charge | `RatePlanCharge` | | Rate Plan Charge Tier | `RatePlanChargeTier` | | Refund | `Refund` | | Refund Application | `RefundApplication` | | Refund Application Item | `RefundApplicationItem` | | Refund Invoice Payment | `RefundInvoicePayment` | | Refund Part | `RefundPart` | | Refund Part Item | `RefundPartItem` | | Refund Transaction Log | `RefundTransactionLog` | | Revenue Charge Summary | `RevenueChargeSummary` | | Revenue Charge Summary Item | `RevenueChargeSummaryItem` | | Revenue Event | `RevenueEvent` | | Revenue Event Credit Memo Item | `RevenueEventCreditMemoItem` | | Revenue Event Debit Memo Item | `RevenueEventDebitMemoItem` | | Revenue Event Invoice Item | `RevenueEventInvoiceItem` | | Revenue Event Invoice Item Adjustment | `RevenueEventInvoiceItemAdjustment` | | Revenue Event Item | `RevenueEventItem` | | Revenue Event Item Credit Memo Item | `RevenueEventItemCreditMemoItem` | | Revenue Event Item Debit Memo Item | `RevenueEventItemDebitMemoItem` | | Revenue Event Item Invoice Item | `RevenueEventItemInvoiceItem` | | Revenue Event Item Invoice Item Adjustment | `RevenueEventItemInvoiceItemAdjustment` | | Revenue Event Type | `RevenueEventType` | | Revenue Schedule | `RevenueSchedule` | | Revenue Schedule Credit Memo Item | `RevenueScheduleCreditMemoItem` | | Revenue Schedule Debit Memo Item | `RevenueScheduleDebitMemoItem` | | Revenue Schedule Invoice Item | `RevenueScheduleInvoiceItem` | | Revenue Schedule Invoice Item Adjustment | `RevenueScheduleInvoiceItemAdjustment` | | Revenue Schedule Item | `RevenueScheduleItem` | | Revenue Schedule Item Credit Memo Item | `RevenueScheduleItemCreditMemoItem` | | Revenue Schedule Item Debit Memo Item | `RevenueScheduleItemDebitMemoItem` | | Revenue Schedule Item Invoice Item | `RevenueScheduleItemInvoiceItem` | | Revenue Schedule Item Invoice Item Adjustment | `RevenueScheduleItemInvoiceItemAdjustment` | | Subscription | `Subscription` | | Taxable Item Snapshot | `TaxableItemSnapshot` | | Taxation Item | `TaxationItem` | | Updater Batch | `UpdaterBatch` | | Usage | `Usage` | # noqa: E501
OpenAPI spec version: 2018-08-23
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from zuora_client.models.get_account_summary_type_tax_info import GETAccountSummaryTypeTaxInfo # noqa: F401,E501
from zuora_client.models.get_account_type_basic_info import GETAccountTypeBasicInfo # noqa: F401,E501
from zuora_client.models.get_account_type_bill_to_contact import GETAccountTypeBillToContact # noqa: F401,E501
from zuora_client.models.get_account_type_billing_and_payment import GETAccountTypeBillingAndPayment # noqa: F401,E501
from zuora_client.models.get_account_type_metrics import GETAccountTypeMetrics # noqa: F401,E501
from zuora_client.models.get_account_type_sold_to_contact import GETAccountTypeSoldToContact # noqa: F401,E501
class GETAccountType(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'basic_info': 'GETAccountTypeBasicInfo',
'bill_to_contact': 'GETAccountTypeBillToContact',
'billing_and_payment': 'GETAccountTypeBillingAndPayment',
'metrics': 'GETAccountTypeMetrics',
'sold_to_contact': 'GETAccountTypeSoldToContact',
'success': 'bool',
'tax_info': 'GETAccountSummaryTypeTaxInfo'
}
attribute_map = {
'basic_info': 'basicInfo',
'bill_to_contact': 'billToContact',
'billing_and_payment': 'billingAndPayment',
'metrics': 'metrics',
'sold_to_contact': 'soldToContact',
'success': 'success',
'tax_info': 'taxInfo'
}
def __init__(self, basic_info=None, bill_to_contact=None, billing_and_payment=None, metrics=None, sold_to_contact=None, success=None, tax_info=None): # noqa: E501
"""GETAccountType - a model defined in Swagger""" # noqa: E501
self._basic_info = None
self._bill_to_contact = None
self._billing_and_payment = None
self._metrics = None
self._sold_to_contact = None
self._success = None
self._tax_info = None
self.discriminator = None
if basic_info is not None:
self.basic_info = basic_info
if bill_to_contact is not None:
self.bill_to_contact = bill_to_contact
if billing_and_payment is not None:
self.billing_and_payment = billing_and_payment
if metrics is not None:
self.metrics = metrics
if sold_to_contact is not None:
self.sold_to_contact = sold_to_contact
if success is not None:
self.success = success
if tax_info is not None:
self.tax_info = tax_info
@property
def basic_info(self):
"""Gets the basic_info of this GETAccountType. # noqa: E501
:return: The basic_info of this GETAccountType. # noqa: E501
:rtype: GETAccountTypeBasicInfo
"""
return self._basic_info
@basic_info.setter
def basic_info(self, basic_info):
"""Sets the basic_info of this GETAccountType.
:param basic_info: The basic_info of this GETAccountType. # noqa: E501
:type: GETAccountTypeBasicInfo
"""
self._basic_info = basic_info
@property
def bill_to_contact(self):
"""Gets the bill_to_contact of this GETAccountType. # noqa: E501
:return: The bill_to_contact of this GETAccountType. # noqa: E501
:rtype: GETAccountTypeBillToContact
"""
return self._bill_to_contact
@bill_to_contact.setter
def bill_to_contact(self, bill_to_contact):
"""Sets the bill_to_contact of this GETAccountType.
:param bill_to_contact: The bill_to_contact of this GETAccountType. # noqa: E501
:type: GETAccountTypeBillToContact
"""
self._bill_to_contact = bill_to_contact
@property
def billing_and_payment(self):
"""Gets the billing_and_payment of this GETAccountType. # noqa: E501
:return: The billing_and_payment of this GETAccountType. # noqa: E501
:rtype: GETAccountTypeBillingAndPayment
"""
return self._billing_and_payment
@billing_and_payment.setter
def billing_and_payment(self, billing_and_payment):
"""Sets the billing_and_payment of this GETAccountType.
:param billing_and_payment: The billing_and_payment of this GETAccountType. # noqa: E501
:type: GETAccountTypeBillingAndPayment
"""
self._billing_and_payment = billing_and_payment
@property
def metrics(self):
"""Gets the metrics of this GETAccountType. # noqa: E501
:return: The metrics of this GETAccountType. # noqa: E501
:rtype: GETAccountTypeMetrics
"""
return self._metrics
@metrics.setter
def metrics(self, metrics):
"""Sets the metrics of this GETAccountType.
:param metrics: The metrics of this GETAccountType. # noqa: E501
:type: GETAccountTypeMetrics
"""
self._metrics = metrics
@property
def sold_to_contact(self):
"""Gets the sold_to_contact of this GETAccountType. # noqa: E501
:return: The sold_to_contact of this GETAccountType. # noqa: E501
:rtype: GETAccountTypeSoldToContact
"""
return self._sold_to_contact
@sold_to_contact.setter
def sold_to_contact(self, sold_to_contact):
"""Sets the sold_to_contact of this GETAccountType.
:param sold_to_contact: The sold_to_contact of this GETAccountType. # noqa: E501
:type: GETAccountTypeSoldToContact
"""
self._sold_to_contact = sold_to_contact
@property
def success(self):
"""Gets the success of this GETAccountType. # noqa: E501
Returns `true` if the request was processed successfully. # noqa: E501
:return: The success of this GETAccountType. # noqa: E501
:rtype: bool
"""
return self._success
@success.setter
def success(self, success):
"""Sets the success of this GETAccountType.
Returns `true` if the request was processed successfully. # noqa: E501
:param success: The success of this GETAccountType. # noqa: E501
:type: bool
"""
self._success = success
@property
def tax_info(self):
"""Gets the tax_info of this GETAccountType. # noqa: E501
:return: The tax_info of this GETAccountType. # noqa: E501
:rtype: GETAccountSummaryTypeTaxInfo
"""
return self._tax_info
@tax_info.setter
def tax_info(self, tax_info):
"""Sets the tax_info of this GETAccountType.
:param tax_info: The tax_info of this GETAccountType. # noqa: E501
:type: GETAccountSummaryTypeTaxInfo
"""
self._tax_info = tax_info
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.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, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, GETAccountType):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| [
"[email protected]"
] | |
7f4469f9d0c7551cc80ccda897e83bc80b8bb373 | 3395a234e7c80d011607e79c49cd48bf516f256b | /dependencies/jedi/third_party/typeshed/third_party/2and3/geoip2/database.pyi | 7a8991160162cd32b115800bc513ea9dfd3aaeac | [
"MIT",
"Apache-2.0"
] | permissive | srusskih/SublimeJEDI | 67329b72e184bc9584843968dcc534a002c797a1 | 95c185d778425c04536d53517b0e3fe6dedf8e59 | refs/heads/master | 2023-08-24T11:30:37.801834 | 2022-08-30T09:04:17 | 2022-08-30T09:04:17 | 6,241,108 | 669 | 125 | MIT | 2022-08-30T09:04:18 | 2012-10-16T08:23:57 | Python | UTF-8 | Python | false | false | 1,094 | pyi | from types import TracebackType
from typing import Optional, Sequence, Text, Type
from maxminddb.reader import Metadata
from geoip2.models import AnonymousIP, ASN, City, ConnectionType, Country, Domain, Enterprise, ISP
_Locales = Optional[Sequence[Text]]
class Reader:
def __init__(self, filename: Text, locales: _Locales = ..., mode: int = ...) -> None: ...
def __enter__(self) -> Reader: ...
def __exit__(self, exc_type: Optional[Type[BaseException]] = ..., exc_val: Optional[BaseException] = ..., exc_tb: Optional[TracebackType] = ...) -> None: ...
def country(self, ip_address: Text) -> Country: ...
def city(self, ip_address: Text) -> City: ...
def anonymous_ip(self, ip_address: Text) -> AnonymousIP: ...
def asn(self, ip_address: Text) -> ASN: ...
def connection_type(self, ip_address: Text) -> ConnectionType: ...
def domain(self, ip_address: Text) -> Domain: ...
def enterprise(self, ip_address: Text) -> Enterprise: ...
def isp(self, ip_address: Text) -> ISP: ...
def metadata(self) -> Metadata: ...
def close(self) -> None: ...
| [
"[email protected]"
] | |
84e03392e7e42e41051379fa972bca8d338527b6 | 6dd2d509d44ea035da9d2a9f6cc9797724c12484 | /run/Cooling/CoolingTest_JHW/plot.py | 4a01e40fc1d6f0193868ce6e108dd44bcdca1845 | [
"NCSA",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | appolloford/enzo-dev | ea9ebc98036c6e5be0c98ebb903448a354cb4aaf | 2b20d1c9ee5b9b4ee6706a73e32d2e4a8b7fc8f5 | refs/heads/master | 2023-08-06T01:18:34.631354 | 2021-10-25T17:06:06 | 2021-10-25T17:06:06 | 228,542,764 | 2 | 1 | NOASSERTION | 2019-12-17T05:50:13 | 2019-12-17T05:50:12 | null | UTF-8 | Python | false | false | 3,238 | py | from matplotlib import pyplot
from yt.mods import *
import numpy as na
def _H_NumberDensity(field, data):
"Get total Hydrogen nuclei number density."
if data.pf['MultiSpecies'] == 0:
return (0.76 * data['Density'])
fieldData = na.zeros(data['HI_Density'].shape,
dtype=data['HI_Density'].dtype)
if data.pf['MultiSpecies'] > 0:
fieldData += data["HI_Density"]
fieldData += data["HII_Density"]
if data.pf["MultiSpecies"] > 1:
fieldData += data["HM_Density"]
fieldData += data["H2I_Density"]
fieldData += data["H2II_Density"]
if data.pf["MultiSpecies"] > 2:
fieldData += data["HDI_Density"] / 3.0
return fieldData
def _ConvertHNumberDensity(data):
return (1 / 1.67e-24)
add_field("H_NumberDensity", units=r"\rm{cm}^{-3}",
function=_H_NumberDensity,
convert_function=_ConvertHNumberDensity)
def plot_cooling_rate(input_file, coordinates, axes, labels=None):
"Plot cooling rate vs. T for various densities and metallicities."
pf = load(input_file)
grid = pf.h.grids[0]
cooling = grid['Gas_Energy'] * grid['Density'] / grid['Cooling_Time'] / \
grid['H_NumberDensity']**2
for q, coord in enumerate(coordinates):
if labels is None:
my_coord = list(coord)
my_coord.append(0)
my_coord = tuple(my_coord)
label = "log(n$_{\mathrm{H}}$/cm$^{-3}$) = %.1f, log(Z/Z$_{\odot}$) = %.1f" % \
(na.log10(grid['H_NumberDensity'][my_coord]),
na.log10(grid['Metallicity'][my_coord]))
else:
label = labels[q]
axes.loglog(grid['Temperature'][coord], cooling[coord], label=label)
def plot_cooling_solutions(axes):
"""
Plot some known cooling rates:
1. CIE atomic H/He (Black 1981).
2. Z = 0.5, 1 Z_sun (Sarazin & White 1987).
"""
black1981 = file("primordial_cie.dat")
t_hhe = []
c_hhe = []
for line in black1981:
if not line.startswith('#') and len(line) > 1:
online = line.split()
t_hhe.append(float(online[0]))
c_hhe.append(float(online[1]))
t_hhe = na.power(10, t_hhe)
c_hhe = na.power(10, c_hhe)
sz1987 = file("cool_rates.in")
t_sz = []
c1_sz = []
c2_sz = []
for line in sz1987:
if not line.startswith('#') and len(line) > 1:
online = line.split()
t_sz.append(float(online[0]))
c1_sz.append(float(online[1]))
c2_sz.append(float(online[2]))
t_sz = na.power(10, t_sz)
c1_sz = na.power(10, c1_sz)
c2_sz = na.power(10, c2_sz)
#axes.loglog(t_sz, c2_sz, label='Z = 0.5 Z$_{\odot}$ (Sarazin & White 1987)')
axes.loglog(t_sz, c1_sz, label='Z = Z$_{\odot}$ (Sarazin & White 1987)')
axes.loglog(t_hhe, c_hhe, label='H/He (Black 1981)')
pyplot.clf()
axes = pyplot.axes()
axes.set_xlabel('T [K]')
axes.set_ylabel('$\Lambda/n_{H}^{2}$ [erg s$^{-1}$ cm$^{3}$]')
plot_cooling_rate('DD0001/DD0001', [(1, 4)], axes,
labels=['JHW, Z = Z$_{\odot}$'])
plot_cooling_solutions(axes)
axes.set_xlim(10, 1e8)
axes.legend(prop=dict(size=10), loc='best')
pyplot.savefig('cooling_rates.png')
| [
"[email protected]"
] | |
b900cba8ee80ef45c51c074ce98053f0c32d3110 | 359496fc90720875cca962b37006551282533ef8 | /src/andres/graph/python/module/__init__.py | 8045832ed6519c33662e787a55e456781eb9d87b | [] | no_license | DerThorsten/graph | 66858c6f4bd9a40cc355549138fea2da8120b759 | 7c3a10b446e3ade9ba67dcdb7880bd0798bb2ec3 | refs/heads/master | 2020-04-01T21:46:42.806967 | 2016-01-04T11:52:50 | 2016-01-04T11:52:50 | 48,331,910 | 0 | 0 | null | 2015-12-20T18:12:14 | 2015-12-20T18:12:12 | null | UTF-8 | Python | false | false | 1,573 | py | from _graph import *
import numpy
def _injectorClass(clsToExtend):
class InjectorClass(object):
class __metaclass__(clsToExtend.__class__):
def __init__(self, name, bases, dict):
for b in bases:
if type(b) not in (self, type):
for k,v in dict.items():
setattr(b,k,v)
tmp = type.__init__(self, name, bases, dict)
return InjectorClass
_LiftedMcModelClasses = [
LiftedMcModelGridGraph2D,LiftedMcModelGridGraph3D,LiftedMcModelGraph
]
for objCls in _LiftedMcModelClasses:
class _MoreLiftedMcModel(_injectorClass(objCls),objCls):
def setCosts(self, uv, costs, overwrite = True):
_uv = numpy.require(uv, dtype='uint64')
_costs = numpy.require(costs, dtype='float32')
self._setCosts(_uv, _costs, bool(overwrite))
def gridGraph(shape):
if len(shape) == 2:
return GridGraph2D(int(shape[0]), int(shape[1]))
elif len(shape) == 3:
return GridGraph3D(int(shape[0]), int(shape[1]), int(shape[2]))
else:
raise RuntimeError("shape has wrong length, GridGraph is only exported to python for 2D and 3D grids")
def liftedMcModel(graph):
if isinstance(graph, GridGraph2D):
return LiftedMcModelGridGraph2D(graph)
elif isinstance(graph, GridGraph3D):
return LiftedMcModelGridGraph3D(graph)
elif isinstance(graph, Graph):
return LiftedMcModelGraph(graph)
else:
raise RuntimeError("graph has wrong type")
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.