The Napoly integral is the very useful method for calculations of wake potentials in structures where parts of the boundary extend below the beam pipe radius or the radii of the two beam pipes at both ends are unequal. It reduces CPU time a lot by deforming the integration path so that the integration contour is confined to the finite length over the gap of the structures. However, the original Napoly method cannot be applied to the transverse wake potentials in a structure where the two beam tubes on both sides have unequal radii . In this case, the integration path needed to be a straight line and the integration is stretched out to an infinite, in principle. We generalize the Napoly integrals so that integrals are always confined in a finite length even when the two beam tubes have unequal radii, for both longitudinal and transverse wake potential calculations. The extended method has been successfully implemented to the ABCI code.