def disable_disk_logging(): """ Disables disk logging altogether. """ app.set_option(_DISK_LOG_LEVEL_OPTION, LogOptions._LOG_LEVEL_NONE_KEY, force=True)
def configure_app(app): """ Register the application's options, set usage, and configure submodules. """ app.set_name('starsystem') app.set_usage("{} [opts]\nOptions marked with * are required.".format(app.name())) app.add_option('-i', '--uri', dest='subsonic_uri', help='* URI of the Subsonic server.') app.add_option('-u', '--user', dest='username', help='* Username on the specified Subsonic server.') app.add_option('-t', '--token', dest='token', help='* API token for the given username/salt combination\n' 'See: http://www.subsonic.org/pages/api.jsp') app.add_option('-s', '--salt', dest='salt', help='* Salt used to generate the API token.') app.add_option('-p', '--path', dest='download_path', help='* Path to the directory whither songs will be downloaded.') app.add_option('-S', '--since', dest='since', type='date', help='Collect all songs since the specified date.') app.add_option('-I', '--insecure', dest='insecure', default=False, action="store_true", help='Don\'t verify SSL certificates. Verification is enabled by default.') app.add_option('-g', '--gen-token-interactive', dest='gen_token', default=False, action="store_true", help='Generate an API token interactively.') app.add_option('-v', '--debug', dest='debug', default=False, action="store_true", help='Enable debug output.') app.set_option('twitter_common_log_disk_log_level', 'NONE', force=True)
def proxy_main(): """Proxy main function. setuptools entrypoints with twitter.common.app is so awkward. """ def main(_, opts): """Main""" if not opts.bucket: log.error('--bucket is required.') app.help() server = S3Web(bucket=opts.bucket, prefix=opts.prefix, access_key_id=opts.access_key_id, secret_key=opts.secret_key) thread = ExceptionalThread( target=lambda: server.run(opts.listen, opts.port, server='cherrypy')) thread.daemon = True thread.start() log.info('Ready.') app.wait_forever() register_opts() app.set_usage(__doc__) app.set_option('twitter_common_log_stderr_log_level', 'google:INFO') app.set_name('s3webfront') app.main()
def disable_scribe_logging(): """ Disables scribe logging altogether. """ app.set_option("_SCRIBE_LOG_LEVEL", LogOptions._LOG_LEVEL_NONE_KEY, force=True)
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================================== import os from zipfile import ZipFile from twitter.common import app, log from twitter.common.java.class_file import ClassFile app.set_option('log_to_stderr', 'INFO') def main(args): log.debug('main got args: %s' % args) for arg in args: if arg.endswith('.jar'): zp = ZipFile(arg) for f in zp.filelist: if f.filename.endswith('.class'): print print print '%s' % f.filename, foo = ClassFile(zp.read(f.filename)) print ' => methods:%s, interfaces:%s' % ( len(foo.methods()), len(foo.interfaces()))
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================================== import os from zipfile import ZipFile from twitter.common import app, log from twitter.common.java.class_file import ClassFile app.set_option('log_to_stdout', 'INFO') def main(args): log.debug('main got args: %s' % args) for arg in args: if arg.endswith('.jar'): zp = ZipFile(arg) for f in zp.filelist: if f.filename.endswith('.class'): print print print '%s' % f.filename, foo = ClassFile(zp.read(f.filename)) print ' => methods:%s, interfaces:%s' % ( len(foo.methods()), len(foo.interfaces()))
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================================== import os from zipfile import ZipFile from twitter.common import app, log from twitter.common.java.class_file import ClassFile app.set_option('log_to_stderr', 'INFO') def main(args): log.debug('main got args: %s' % args) for arg in args: if arg.endswith('.jar'): zp = ZipFile(arg) for f in zp.filelist: if f.filename.endswith('.class'): print print print '%s' % f.filename, foo = ClassFile(zp.read(f.filename)) print ' => methods:%s, interfaces:%s' % (len( foo.methods()), len(foo.interfaces()))