text
stringlengths 4
5.48M
| meta
stringlengths 14
6.54k
|
---|---|
#pragma once
#if !defined( JDKSAVDECC_CPP_NO_IOSTREAM )
#include <iostream>
#endif
#if !defined( JDKSAVDECC_CPP_NO_STDIO )
#include <stdio.h>
#endif
#include <memory>
#include <utility>
#include <vector>
#include "jdksavdecc_world.h"
#include "jdksavdecc.h"
#ifdef __cplusplus
namespace jdksavdecc
{
template <typename T>
struct wrap : public T
{
wrap() { memset( this, 0, sizeof( *this ) ); }
wrap( T const &other )
{
if ( &other != this )
{
memcpy( this, &other, sizeof( *this ) );
}
}
void reset() { memset( this, 0, sizeof( *this ) ); }
T *get() { return this; }
T const *get() const { return this; }
T const &operator=( const T &other )
{
if ( &other != this )
{
memcpy( this, &other, sizeof( *this ) );
}
return *this;
}
bool operator==( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) == 0; }
bool operator!=( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) != 0; }
bool operator<( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) < 0; }
bool operator<=( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) <= 0; }
bool operator>=( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) >= 0; }
bool operator>( T const &other ) { return memcmp( this, &other, sizeof( *this ) ) > 0; }
};
struct acmpdu : wrap<jdksavdecc_acmpdu>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_acmpdu_read( this, base, pos, len ); };
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_acmpdu_write( this, base, pos, len ); }
};
struct acmpdu_common_control_header : wrap<jdksavdecc_acmpdu_common_control_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_acmpdu_common_control_header_read( this, base, pos, len );
};
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_acmpdu_common_control_header_write( this, base, pos, len );
}
};
struct adpdu : wrap<jdksavdecc_adpdu>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_adpdu_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_adpdu_write( this, base, pos, len ); }
};
struct adpdu_common_control_header : wrap<jdksavdecc_adpdu_common_control_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_adpdu_common_control_header_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_adpdu_common_control_header_write( this, base, pos, len );
}
};
struct aecp_aa : wrap<jdksavdecc_aecp_aa>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_aecp_aa_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_aecp_aa_write( this, base, pos, len ); }
};
struct aecp_aa_tlv : wrap<jdksavdecc_aecp_aa_tlv>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_aecp_aa_tlv_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aecp_aa_tlv_write( this, base, pos, len );
}
};
struct aecpdu_aem : wrap<jdksavdecc_aecpdu_aem>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_aecpdu_aem_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aecpdu_aem_write( this, base, pos, len );
}
};
struct aecpdu_common : wrap<jdksavdecc_aecpdu_common>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aecpdu_common_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aecpdu_common_write( this, base, pos, len );
}
};
struct aecpdu_common_control_header : wrap<jdksavdecc_aecpdu_common_control_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aecpdu_common_control_header_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aecpdu_common_control_header_write( this, base, pos, len );
}
};
namespace aem_command
{
struct abort_operation : wrap<jdksavdecc_aem_command_abort_operation>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_abort_operation_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_abort_operation_write( this, base, pos, len );
}
};
struct abort_operation_response : wrap<jdksavdecc_aem_command_abort_operation_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_abort_operation_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_abort_operation_response_write( this, base, pos, len );
}
};
struct acquire_entity : wrap<jdksavdecc_aem_command_acquire_entity>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_acquire_entity_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_acquire_entity_write( this, base, pos, len );
}
};
struct acquire_entity_response : wrap<jdksavdecc_aem_command_acquire_entity_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_acquire_entity_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_acquire_entity_response_write( this, base, pos, len );
}
};
struct add_audio_mappings : wrap<jdksavdecc_aem_command_add_audio_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_audio_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_audio_mappings_write( this, base, pos, len );
}
};
struct add_audio_mappings_response : wrap<jdksavdecc_aem_command_add_audio_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_audio_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_audio_mappings_response_write( this, base, pos, len );
}
};
struct add_sensor_mappings : wrap<jdksavdecc_aem_command_add_sensor_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_sensor_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_sensor_mappings_write( this, base, pos, len );
}
};
struct add_sensor_mappings_response : wrap<jdksavdecc_aem_command_add_sensor_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_sensor_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_sensor_mappings_response_write( this, base, pos, len );
}
};
struct add_video_mappings : wrap<jdksavdecc_aem_command_add_video_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_video_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_video_mappings_write( this, base, pos, len );
}
};
struct add_video_mappings_response : wrap<jdksavdecc_aem_command_add_video_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_add_video_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_add_video_mappings_response_write( this, base, pos, len );
}
};
struct auth_add_key : wrap<jdksavdecc_aem_command_auth_add_key>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_key_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_key_write( this, base, pos, len );
}
};
struct auth_add_key_response : wrap<jdksavdecc_aem_command_auth_add_key_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_key_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_key_response_write( this, base, pos, len );
}
};
struct auth_add_key_to_chain : wrap<jdksavdecc_aem_command_auth_add_key_to_chain>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_key_to_chain_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_key_to_chain_write( this, base, pos, len );
}
};
struct auth_add_key_to_chain_response : wrap<jdksavdecc_aem_command_auth_add_key_to_chain_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_key_to_chain_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_key_to_chain_response_write( this, base, pos, len );
}
};
struct auth_add_token : wrap<jdksavdecc_aem_command_auth_add_token>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_token_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_token_write( this, base, pos, len );
}
};
struct auth_add_token_response : wrap<jdksavdecc_aem_command_auth_add_token_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_add_token_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_add_token_response_write( this, base, pos, len );
}
};
struct auth_delete_key : wrap<jdksavdecc_aem_command_auth_delete_key>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_key_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_key_write( this, base, pos, len );
}
};
struct auth_delete_key_from_chain : wrap<jdksavdecc_aem_command_auth_delete_key_from_chain>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_key_from_chain_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_key_from_chain_write( this, base, pos, len );
}
};
struct auth_delete_key_from_chain_response : wrap<jdksavdecc_aem_command_auth_delete_key_from_chain_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_key_from_chain_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_key_from_chain_response_write( this, base, pos, len );
}
};
struct auth_delete_key_response : wrap<jdksavdecc_aem_command_auth_delete_key_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_key_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_key_response_write( this, base, pos, len );
}
};
struct auth_delete_token : wrap<jdksavdecc_aem_command_auth_delete_token>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_token_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_token_write( this, base, pos, len );
}
};
struct auth_delete_token_response : wrap<jdksavdecc_aem_command_auth_delete_token_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_delete_token_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_delete_token_response_write( this, base, pos, len );
}
};
struct auth_get_identity : wrap<jdksavdecc_aem_command_auth_get_identity>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_identity_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_identity_write( this, base, pos, len );
}
};
struct auth_get_identity_response : wrap<jdksavdecc_aem_command_auth_get_identity_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_identity_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_identity_response_write( this, base, pos, len );
}
};
struct auth_get_key : wrap<jdksavdecc_aem_command_auth_get_key>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_key_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_key_write( this, base, pos, len );
}
};
struct auth_get_key_list : wrap<jdksavdecc_aem_command_auth_get_key_list>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_key_list_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_key_list_write( this, base, pos, len );
}
};
struct auth_get_key_list_response : wrap<jdksavdecc_aem_command_auth_get_key_list_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_key_list_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_key_list_response_write( this, base, pos, len );
}
};
struct auth_get_key_response : wrap<jdksavdecc_aem_command_auth_get_key_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_key_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_key_response_write( this, base, pos, len );
}
};
struct auth_get_keychain_list : wrap<jdksavdecc_aem_command_auth_get_keychain_list>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_keychain_list_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_keychain_list_write( this, base, pos, len );
}
};
struct auth_get_keychain_list_response : wrap<jdksavdecc_aem_command_auth_get_keychain_list_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_auth_get_keychain_list_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_auth_get_keychain_list_response_write( this, base, pos, len );
}
};
struct authenticate : wrap<jdksavdecc_aem_command_authenticate>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_authenticate_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_authenticate_write( this, base, pos, len );
}
};
struct authenticate_response : wrap<jdksavdecc_aem_command_authenticate_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_authenticate_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_authenticate_response_write( this, base, pos, len );
}
};
struct controller_available : wrap<jdksavdecc_aem_command_controller_available>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_controller_available_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_controller_available_write( this, base, pos, len );
}
};
struct controller_available_response : wrap<jdksavdecc_aem_command_controller_available_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_controller_available_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_controller_available_response_write( this, base, pos, len );
}
};
struct deauthenticate : wrap<jdksavdecc_aem_command_deauthenticate>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_deauthenticate_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_deauthenticate_write( this, base, pos, len );
}
};
struct deauthenticate_response : wrap<jdksavdecc_aem_command_deauthenticate_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_deauthenticate_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_deauthenticate_response_write( this, base, pos, len );
}
};
struct decrement_control : wrap<jdksavdecc_aem_command_decrement_control>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_decrement_control_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_decrement_control_write( this, base, pos, len );
}
};
struct decrement_control_response : wrap<jdksavdecc_aem_command_decrement_control_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_decrement_control_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_decrement_control_response_write( this, base, pos, len );
}
};
struct deregister_unsolicited_notification : wrap<jdksavdecc_aem_command_deregister_unsolicited_notification>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_deregister_unsolicited_notification_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_deregister_unsolicited_notification_write( this, base, pos, len );
}
};
struct deregister_unsolicited_notification_response : wrap<jdksavdecc_aem_command_deregister_unsolicited_notification_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_deregister_unsolicited_notification_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_deregister_unsolicited_notification_response_write( this, base, pos, len );
}
};
struct disable_stream_encryption : wrap<jdksavdecc_aem_command_disable_stream_encryption>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_disable_stream_encryption_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_disable_stream_encryption_write( this, base, pos, len );
}
};
struct disable_stream_encryption_response : wrap<jdksavdecc_aem_command_disable_stream_encryption_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_disable_stream_encryption_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_disable_stream_encryption_response_write( this, base, pos, len );
}
};
struct disable_transport_security : wrap<jdksavdecc_aem_command_disable_transport_security>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_disable_transport_security_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_disable_transport_security_write( this, base, pos, len );
}
};
struct disable_transport_security_response : wrap<jdksavdecc_aem_command_disable_transport_security_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_disable_transport_security_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_disable_transport_security_response_write( this, base, pos, len );
}
};
struct enable_stream_encryption : wrap<jdksavdecc_aem_command_enable_stream_encryption>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_enable_stream_encryption_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_enable_stream_encryption_write( this, base, pos, len );
}
};
struct enable_stream_encryption_response : wrap<jdksavdecc_aem_command_enable_stream_encryption_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_enable_stream_encryption_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_enable_stream_encryption_response_write( this, base, pos, len );
}
};
struct enable_transport_security : wrap<jdksavdecc_aem_command_enable_transport_security>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_enable_transport_security_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_enable_transport_security_write( this, base, pos, len );
}
};
struct enable_transport_security_response : wrap<jdksavdecc_aem_command_enable_transport_security_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_enable_transport_security_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_enable_transport_security_response_write( this, base, pos, len );
}
};
struct entity_available : wrap<jdksavdecc_aem_command_entity_available>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_entity_available_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_entity_available_write( this, base, pos, len );
}
};
struct entity_available_response : wrap<jdksavdecc_aem_command_entity_available_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_entity_available_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_entity_available_response_write( this, base, pos, len );
}
};
struct get_as_path : wrap<jdksavdecc_aem_command_get_as_path>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_as_path_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_as_path_write( this, base, pos, len );
}
};
struct get_as_path_response : wrap<jdksavdecc_aem_command_get_as_path_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_as_path_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_as_path_response_write( this, base, pos, len );
}
};
struct get_association_id : wrap<jdksavdecc_aem_command_get_association_id>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_association_id_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_association_id_write( this, base, pos, len );
}
};
struct get_association_id_response : wrap<jdksavdecc_aem_command_get_association_id_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_association_id_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_association_id_response_write( this, base, pos, len );
}
};
struct get_audio_map : wrap<jdksavdecc_aem_command_get_audio_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_audio_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_audio_map_write( this, base, pos, len );
}
};
struct get_audio_map_response : wrap<jdksavdecc_aem_command_get_audio_map_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_audio_map_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_audio_map_response_write( this, base, pos, len );
}
};
struct get_avb_info : wrap<jdksavdecc_aem_command_get_avb_info>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_avb_info_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_avb_info_write( this, base, pos, len );
}
};
struct get_avb_info_response : wrap<jdksavdecc_aem_command_get_avb_info_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_avb_info_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_avb_info_response_write( this, base, pos, len );
}
};
struct get_clock_source : wrap<jdksavdecc_aem_command_get_clock_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_clock_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_clock_source_write( this, base, pos, len );
}
};
struct get_clock_source_response : wrap<jdksavdecc_aem_command_get_clock_source_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_clock_source_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_clock_source_response_write( this, base, pos, len );
}
};
struct get_configuration : wrap<jdksavdecc_aem_command_get_configuration>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_configuration_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_configuration_write( this, base, pos, len );
}
};
struct get_configuration_response : wrap<jdksavdecc_aem_command_get_configuration_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_configuration_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_configuration_response_write( this, base, pos, len );
}
};
struct get_control : wrap<jdksavdecc_aem_command_get_control>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_control_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_control_write( this, base, pos, len );
}
};
struct get_control_response : wrap<jdksavdecc_aem_command_get_control_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_control_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_control_response_write( this, base, pos, len );
}
};
struct get_counters : wrap<jdksavdecc_aem_command_get_counters>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_counters_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_counters_write( this, base, pos, len );
}
};
struct get_counters_response : wrap<jdksavdecc_aem_command_get_counters_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_counters_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_counters_response_write( this, base, pos, len );
}
};
struct get_matrix : wrap<jdksavdecc_aem_command_get_matrix>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_matrix_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_matrix_write( this, base, pos, len );
}
};
struct get_matrix_response : wrap<jdksavdecc_aem_command_get_matrix_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_matrix_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_matrix_response_write( this, base, pos, len );
}
};
struct get_memory_object_length : wrap<jdksavdecc_aem_command_get_memory_object_length>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_memory_object_length_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_memory_object_length_write( this, base, pos, len );
}
};
struct get_memory_object_length_response : wrap<jdksavdecc_aem_command_get_memory_object_length_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_memory_object_length_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_memory_object_length_response_write( this, base, pos, len );
}
};
struct get_mixer : wrap<jdksavdecc_aem_command_get_mixer>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_mixer_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_mixer_write( this, base, pos, len );
}
};
struct get_mixer_response : wrap<jdksavdecc_aem_command_get_mixer_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_mixer_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_mixer_response_write( this, base, pos, len );
}
};
struct get_name : wrap<jdksavdecc_aem_command_get_name>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_name_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_name_write( this, base, pos, len );
}
};
struct get_name_response : wrap<jdksavdecc_aem_command_get_name_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_name_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_name_response_write( this, base, pos, len );
}
};
struct get_sampling_rate : wrap<jdksavdecc_aem_command_get_sampling_rate>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sampling_rate_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sampling_rate_write( this, base, pos, len );
}
};
struct get_sampling_rate_response : wrap<jdksavdecc_aem_command_get_sampling_rate_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sampling_rate_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sampling_rate_response_write( this, base, pos, len );
}
};
struct get_sensor_format : wrap<jdksavdecc_aem_command_get_sensor_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sensor_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sensor_format_write( this, base, pos, len );
}
};
struct get_sensor_format_response : wrap<jdksavdecc_aem_command_get_sensor_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sensor_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sensor_format_response_write( this, base, pos, len );
}
};
struct get_sensor_map : wrap<jdksavdecc_aem_command_get_sensor_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sensor_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sensor_map_write( this, base, pos, len );
}
};
struct get_sensor_map_response : wrap<jdksavdecc_aem_command_get_sensor_map_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_sensor_map_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_sensor_map_response_write( this, base, pos, len );
}
};
struct get_signal_selector : wrap<jdksavdecc_aem_command_get_signal_selector>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_signal_selector_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_signal_selector_write( this, base, pos, len );
}
};
struct get_signal_selector_response : wrap<jdksavdecc_aem_command_get_signal_selector_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_signal_selector_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_signal_selector_response_write( this, base, pos, len );
}
};
// struct get_stream_backup : wrap<jdksavdecc_aem_command_get_stream_backup> {};
// struct get_stream_backup_response : wrap<jdksavdecc_aem_command_get_stream_backup_response> {};
struct get_stream_format : wrap<jdksavdecc_aem_command_get_stream_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_stream_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_stream_format_write( this, base, pos, len );
}
};
struct get_stream_format_response : wrap<jdksavdecc_aem_command_get_stream_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_stream_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_stream_format_response_write( this, base, pos, len );
}
};
struct get_stream_info : wrap<jdksavdecc_aem_command_get_stream_info>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_stream_info_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_stream_info_write( this, base, pos, len );
}
};
struct get_stream_info_response : wrap<jdksavdecc_aem_command_get_stream_info_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_stream_info_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_stream_info_response_write( this, base, pos, len );
}
};
struct get_video_format : wrap<jdksavdecc_aem_command_get_video_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_video_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_video_format_write( this, base, pos, len );
}
};
struct get_video_format_response : wrap<jdksavdecc_aem_command_get_video_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_video_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_video_format_response_write( this, base, pos, len );
}
};
struct get_video_map : wrap<jdksavdecc_aem_command_get_video_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_video_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_video_map_write( this, base, pos, len );
}
};
struct get_video_map_response : wrap<jdksavdecc_aem_command_get_video_map_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_get_video_map_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_get_video_map_response_write( this, base, pos, len );
}
};
struct identify_notification : wrap<jdksavdecc_aem_command_identify_notification>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_identify_notification_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_identify_notification_write( this, base, pos, len );
}
};
struct increment_control : wrap<jdksavdecc_aem_command_increment_control>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_increment_control_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_increment_control_write( this, base, pos, len );
}
};
struct increment_control_response : wrap<jdksavdecc_aem_command_increment_control_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_increment_control_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_increment_control_response_write( this, base, pos, len );
}
};
struct lock_entity : wrap<jdksavdecc_aem_command_lock_entity>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_lock_entity_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_lock_entity_write( this, base, pos, len );
}
};
struct lock_entity_response : wrap<jdksavdecc_aem_command_lock_entity_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_lock_entity_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_lock_entity_response_write( this, base, pos, len );
}
};
struct operation_status_response : wrap<jdksavdecc_aem_command_operation_status_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_operation_status_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_operation_status_response_write( this, base, pos, len );
}
};
struct read_descriptor : wrap<jdksavdecc_aem_command_read_descriptor>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_read_descriptor_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_read_descriptor_write( this, base, pos, len );
}
};
struct read_descriptor_response : wrap<jdksavdecc_aem_command_read_descriptor_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_read_descriptor_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_read_descriptor_response_write( this, base, pos, len );
}
};
struct reboot : wrap<jdksavdecc_aem_command_reboot>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_reboot_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_reboot_write( this, base, pos, len );
}
};
struct reboot_response : wrap<jdksavdecc_aem_command_reboot_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_reboot_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_reboot_response_write( this, base, pos, len );
}
};
struct register_unsolicited_notification : wrap<jdksavdecc_aem_command_register_unsolicited_notification>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_register_unsolicited_notification_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_register_unsolicited_notification_write( this, base, pos, len );
}
};
struct register_unsolicited_notification_response : wrap<jdksavdecc_aem_command_register_unsolicited_notification_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_register_unsolicited_notification_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_register_unsolicited_notification_response_write( this, base, pos, len );
}
};
struct remove_audio_mappings : wrap<jdksavdecc_aem_command_remove_audio_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_audio_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_audio_mappings_write( this, base, pos, len );
}
};
struct remove_audio_mappings_response : wrap<jdksavdecc_aem_command_remove_audio_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_audio_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_audio_mappings_response_write( this, base, pos, len );
}
};
struct remove_sensor_mappings : wrap<jdksavdecc_aem_command_remove_sensor_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_sensor_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_sensor_mappings_write( this, base, pos, len );
}
};
struct remove_sensor_mappings_response : wrap<jdksavdecc_aem_command_remove_sensor_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_sensor_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_sensor_mappings_response_write( this, base, pos, len );
}
};
struct remove_video_mappings : wrap<jdksavdecc_aem_command_remove_video_mappings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_video_mappings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_video_mappings_write( this, base, pos, len );
}
};
struct remove_video_mappings_response : wrap<jdksavdecc_aem_command_remove_video_mappings_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_remove_video_mappings_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_remove_video_mappings_response_write( this, base, pos, len );
}
};
struct set_association_id : wrap<jdksavdecc_aem_command_set_association_id>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_association_id_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_association_id_write( this, base, pos, len );
}
};
struct set_association_id_response : wrap<jdksavdecc_aem_command_set_association_id_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_association_id_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_association_id_response_write( this, base, pos, len );
}
};
struct set_clock_source : wrap<jdksavdecc_aem_command_set_clock_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_clock_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_clock_source_write( this, base, pos, len );
}
};
struct set_clock_source_response : wrap<jdksavdecc_aem_command_set_clock_source_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_clock_source_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_clock_source_response_write( this, base, pos, len );
}
};
struct set_configuration : wrap<jdksavdecc_aem_command_set_configuration>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_configuration_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_configuration_write( this, base, pos, len );
}
};
struct set_configuration_response : wrap<jdksavdecc_aem_command_set_configuration_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_configuration_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_configuration_response_write( this, base, pos, len );
}
};
struct set_control : wrap<jdksavdecc_aem_command_set_control>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_control_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_control_write( this, base, pos, len );
}
};
struct set_control_response : wrap<jdksavdecc_aem_command_set_control_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_control_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_control_response_write( this, base, pos, len );
}
};
struct set_matrix : wrap<jdksavdecc_aem_command_set_matrix>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_matrix_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_matrix_write( this, base, pos, len );
}
};
struct set_matrix_response : wrap<jdksavdecc_aem_command_set_matrix_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_matrix_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_matrix_response_write( this, base, pos, len );
}
};
struct set_memory_object_length : wrap<jdksavdecc_aem_command_set_memory_object_length>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_memory_object_length_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_memory_object_length_write( this, base, pos, len );
}
};
struct set_memory_object_length_response : wrap<jdksavdecc_aem_command_set_memory_object_length_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_memory_object_length_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_memory_object_length_response_write( this, base, pos, len );
}
};
struct set_mixer : wrap<jdksavdecc_aem_command_set_mixer>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_mixer_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_mixer_write( this, base, pos, len );
}
};
struct set_mixer_response : wrap<jdksavdecc_aem_command_set_mixer_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_mixer_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_mixer_response_write( this, base, pos, len );
}
};
struct set_name : wrap<jdksavdecc_aem_command_set_name>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_name_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_name_write( this, base, pos, len );
}
};
struct set_name_response : wrap<jdksavdecc_aem_command_set_name_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_name_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_name_response_write( this, base, pos, len );
}
};
struct set_sampling_rate : wrap<jdksavdecc_aem_command_set_sampling_rate>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_sampling_rate_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_sampling_rate_write( this, base, pos, len );
}
};
struct set_sampling_rate_response : wrap<jdksavdecc_aem_command_set_sampling_rate_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_sampling_rate_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_sampling_rate_response_write( this, base, pos, len );
}
};
struct set_sensor_format : wrap<jdksavdecc_aem_command_set_sensor_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_sensor_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_sensor_format_write( this, base, pos, len );
}
};
struct set_sensor_format_response : wrap<jdksavdecc_aem_command_set_sensor_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_sensor_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_sensor_format_response_write( this, base, pos, len );
}
};
struct set_signal_selector : wrap<jdksavdecc_aem_command_set_signal_selector>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_signal_selector_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_signal_selector_write( this, base, pos, len );
}
};
struct set_signal_selector_response : wrap<jdksavdecc_aem_command_set_signal_selector_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_signal_selector_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_signal_selector_response_write( this, base, pos, len );
}
};
// struct set_stream_backup : wrap<jdksavdecc_aem_command_set_stream_backup;> {};
// struct set_stream_backup_response : wrap<jdksavdecc_aem_command_set_stream_backup_response;> {};
struct set_stream_format : wrap<jdksavdecc_aem_command_set_stream_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_stream_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_stream_format_write( this, base, pos, len );
}
};
struct set_stream_format_response : wrap<jdksavdecc_aem_command_set_stream_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_stream_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_stream_format_response_write( this, base, pos, len );
}
};
struct set_stream_info : wrap<jdksavdecc_aem_command_set_stream_info>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_stream_info_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_stream_info_write( this, base, pos, len );
}
};
struct set_stream_info_response : wrap<jdksavdecc_aem_command_set_stream_info_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_stream_info_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_stream_info_response_write( this, base, pos, len );
}
};
struct set_video_format : wrap<jdksavdecc_aem_command_set_video_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_video_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_video_format_write( this, base, pos, len );
}
};
struct set_video_format_response : wrap<jdksavdecc_aem_command_set_video_format_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_set_video_format_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_set_video_format_response_write( this, base, pos, len );
}
};
struct start_operation : wrap<jdksavdecc_aem_command_start_operation>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_start_operation_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_start_operation_write( this, base, pos, len );
}
};
struct start_operation_response : wrap<jdksavdecc_aem_command_start_operation_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_start_operation_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_start_operation_response_write( this, base, pos, len );
}
};
struct start_streaming : wrap<jdksavdecc_aem_command_start_streaming>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_start_streaming_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_start_streaming_write( this, base, pos, len );
}
};
struct start_streaming_response : wrap<jdksavdecc_aem_command_start_streaming_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_start_streaming_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_start_streaming_response_write( this, base, pos, len );
}
};
struct stop_streaming : wrap<jdksavdecc_aem_command_stop_streaming>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_stop_streaming_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_stop_streaming_write( this, base, pos, len );
}
};
struct stop_streaming_response : wrap<jdksavdecc_aem_command_stop_streaming_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_stop_streaming_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_stop_streaming_response_write( this, base, pos, len );
}
};
struct write_descriptor : wrap<jdksavdecc_aem_command_write_descriptor>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_write_descriptor_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_write_descriptor_write( this, base, pos, len );
}
};
struct write_descriptor_response : wrap<jdksavdecc_aem_command_write_descriptor_response>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_aem_command_write_descriptor_response_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_aem_command_write_descriptor_response_write( this, base, pos, len );
}
};
}
// struct aem_ecc_private_256 : wrap<jdksavdecc_aem_ecc_private_256> {};
// struct aem_ecc_public_256 : wrap<jdksavdecc_aem_ecc_public_256 > {};
struct appdu : wrap<jdksavdecc_appdu>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_appdu_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_appdu_write( this, base, pos, len ); }
};
struct audio_mapping : wrap<jdksavdecc_audio_mapping>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_audio_mapping_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_audio_mapping_write( this, base, pos, len );
}
};
struct audio_mappings_format : wrap<jdksavdecc_audio_mappings_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_audio_mappings_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_audio_mappings_format_write( this, base, pos, len );
}
};
struct combiner_map : wrap<jdksavdecc_combiner_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_combiner_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_combiner_map_write( this, base, pos, len );
}
};
struct common_control_header : wrap<jdksavdecc_common_control_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_common_control_header_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_common_control_header_write( this, base, pos, len );
}
};
struct demultiplexer_map : wrap<jdksavdecc_demultiplexer_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_demultiplexer_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_demultiplexer_map_write( this, base, pos, len );
}
};
namespace descriptor
{
struct descriptor : wrap<jdksavdecc_descriptor>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
reset();
if ( len <= JDKSAVDECC_AEM_DESCRIPTOR_SIZE )
{
memcpy( data, base + pos, len );
}
return len;
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
if ( len <= JDKSAVDECC_AEM_DESCRIPTOR_SIZE )
{
memcpy( base + pos, data, len );
}
return len;
}
};
struct audio : wrap<jdksavdecc_descriptor_audio>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_audio_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_audio_write( this, base, pos, len );
}
};
struct audio_cluster : wrap<jdksavdecc_descriptor_audio_cluster>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_audio_cluster_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_audio_cluster_write( this, base, pos, len );
}
};
struct audio_map : wrap<jdksavdecc_descriptor_audio_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_audio_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_audio_map_write( this, base, pos, len );
}
};
struct avb_interface : wrap<jdksavdecc_descriptor_avb_interface>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_avb_interface_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_avb_interface_write( this, base, pos, len );
}
};
struct clock_domain : wrap<jdksavdecc_descriptor_clock_domain>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_clock_domain_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_clock_domain_write( this, base, pos, len );
}
};
struct clock_source : wrap<jdksavdecc_descriptor_clock_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_clock_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_clock_source_write( this, base, pos, len );
}
};
struct configuration : wrap<jdksavdecc_descriptor_configuration>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_configuration_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_configuration_write( this, base, pos, len );
}
};
struct control : wrap<jdksavdecc_descriptor_control>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_control_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_control_write( this, base, pos, len );
}
};
struct control_block : wrap<jdksavdecc_descriptor_control_block>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_control_block_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_control_block_write( this, base, pos, len );
}
};
struct entity : wrap<jdksavdecc_descriptor_entity>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_entity_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_entity_write( this, base, pos, len );
}
};
struct external_port : wrap<jdksavdecc_descriptor_external_port>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_external_port_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_external_port_write( this, base, pos, len );
}
};
struct internal_port : wrap<jdksavdecc_descriptor_internal_port>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_internal_port_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_internal_port_write( this, base, pos, len );
}
};
struct jack : wrap<jdksavdecc_descriptor_jack>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_jack_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_jack_write( this, base, pos, len );
}
};
struct locale : wrap<jdksavdecc_descriptor_locale>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_locale_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_locale_write( this, base, pos, len );
}
};
struct matrix : wrap<jdksavdecc_descriptor_matrix>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_matrix_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_matrix_write( this, base, pos, len );
}
};
struct matrix_signal : wrap<jdksavdecc_descriptor_matrix_signal>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_matrix_signal_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_matrix_signal_write( this, base, pos, len );
}
};
struct memory_object : wrap<jdksavdecc_descriptor_memory_object>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_memory_object_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_memory_object_write( this, base, pos, len );
}
};
struct mixer : wrap<jdksavdecc_descriptor_mixer>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_mixer_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_mixer_write( this, base, pos, len );
}
};
struct sensor : wrap<jdksavdecc_descriptor_sensor>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_sensor_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_sensor_write( this, base, pos, len );
}
};
struct sensor_cluster : wrap<jdksavdecc_descriptor_sensor_cluster>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_sensor_cluster_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_sensor_cluster_write( this, base, pos, len );
}
};
struct sensor_map : wrap<jdksavdecc_descriptor_sensor_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_sensor_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_sensor_map_write( this, base, pos, len );
}
};
struct signal_combiner : wrap<jdksavdecc_descriptor_signal_combiner>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_signal_combiner_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_signal_combiner_write( this, base, pos, len );
}
};
struct signal_demultiplexer : wrap<jdksavdecc_descriptor_signal_demultiplexer>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_signal_demultiplexer_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_signal_demultiplexer_write( this, base, pos, len );
}
};
struct signal_multiplexer : wrap<jdksavdecc_descriptor_signal_multiplexer>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_signal_multiplexer_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_signal_multiplexer_write( this, base, pos, len );
}
};
struct signal_selector : wrap<jdksavdecc_descriptor_signal_selector>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_signal_selector_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_signal_selector_write( this, base, pos, len );
}
};
struct signal_splitter : wrap<jdksavdecc_descriptor_signal_splitter>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_signal_splitter_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_signal_splitter_write( this, base, pos, len );
}
};
struct storage : wrap<jdksavdecc_descriptor_storage>
{
};
struct storage_gen : wrap<jdksavdecc_descriptor_storage_gen>
{
};
struct storage_gen_descriptor : wrap<jdksavdecc_descriptor_storage_gen_descriptor>
{
};
struct storage_gen_symbol : wrap<jdksavdecc_descriptor_storage_gen_symbol>
{
};
struct storage_header : wrap<jdksavdecc_descriptor_storage_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_storage_header_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_storage_header_write( this, base, pos, len );
}
};
struct storage_item : wrap<jdksavdecc_descriptor_storage_item>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_storage_item_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_storage_item_write( this, base, pos, len );
}
};
struct storage_symbol : wrap<jdksavdecc_descriptor_storage_symbol>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_storage_symbol_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_storage_symbol_write( this, base, pos, len );
}
};
struct storage_symbol_dispatch_item : wrap<jdksavdecc_descriptor_storage_symbol_dispatch_item>
{
};
struct storage_symbols : wrap<jdksavdecc_descriptor_storage_symbols>
{
};
struct stream : wrap<jdksavdecc_descriptor_stream>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_stream_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_stream_write( this, base, pos, len );
}
};
struct stream_port : wrap<jdksavdecc_descriptor_stream_port>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_stream_port_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_stream_port_write( this, base, pos, len );
}
};
struct strings : wrap<jdksavdecc_descriptor_strings>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_strings_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_strings_write( this, base, pos, len );
}
};
struct transcoder : wrap<jdksavdecc_descriptor_transcoder>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_transcoder_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_transcoder_write( this, base, pos, len );
}
};
struct video : wrap<jdksavdecc_descriptor_video>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_video_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_video_write( this, base, pos, len );
}
};
struct video_cluster : wrap<jdksavdecc_descriptor_video_cluster>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_video_cluster_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_video_cluster_write( this, base, pos, len );
}
};
struct video_map : wrap<jdksavdecc_descriptor_video_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_descriptor_video_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_descriptor_video_map_write( this, base, pos, len );
}
};
}
struct entity_model : wrap<jdksavdecc_entity_model>
{
};
struct eui48 : wrap<jdksavdecc_eui48>
{
eui48() {}
eui48( eui48 const &other ) : wrap<jdksavdecc_eui48>( other ) {}
eui48( uint8_t v0, uint8_t v1, uint8_t v2, uint8_t v3, uint8_t v4, uint8_t v5 )
{
value[0] = v0;
value[1] = v1;
value[2] = v2;
value[3] = v3;
value[4] = v4;
value[5] = v5;
}
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_eui48_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_eui48_write( this, base, pos, len ); }
};
struct eui64 : wrap<jdksavdecc_eui64>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_eui64_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_eui64_write( this, base, pos, len ); }
};
struct frame : wrap<jdksavdecc_frame>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_frame_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_frame_write( this, base, pos, len ); }
};
struct frame_sender : wrap<jdksavdecc_frame_sender>
{
};
struct fullappdu : wrap<jdksavdecc_fullappdu>
{
};
struct gptp_seconds : wrap<jdksavdecc_gptp_seconds>
{
};
struct jdks_log_console_command : wrap<jdksavdecc_jdks_log_console_command>
{
};
struct jdks_log_control : wrap<jdksavdecc_jdks_log_control>
{
};
struct maap : wrap<jdksavdecc_maap>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_maap_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_maap_write( this, base, pos, len ); }
};
struct maap_common_control_header : wrap<jdksavdecc_maap_common_control_header>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_maap_common_control_header_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_maap_common_control_header_write( this, base, pos, len );
}
};
struct mixer_source : wrap<jdksavdecc_mixer_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_mixer_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_mixer_source_write( this, base, pos, len );
}
};
struct msrp_mappings_format : wrap<jdksavdecc_msrp_mappings_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_msrp_mappings_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_msrp_mappings_format_write( this, base, pos, len );
}
};
struct multiplexer_source : wrap<jdksavdecc_multiplexer_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_multiplexer_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_multiplexer_source_write( this, base, pos, len );
}
};
struct signal_selector_source : wrap<jdksavdecc_signal_selector_source>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_signal_selector_source_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_signal_selector_source_write( this, base, pos, len );
}
};
struct splitter_map : wrap<jdksavdecc_splitter_map>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_splitter_map_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_splitter_map_write( this, base, pos, len );
}
};
struct avdecc_string : wrap<jdksavdecc_string>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len ) { return jdksavdecc_string_read( this, base, pos, len ); }
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const { return jdksavdecc_string_write( this, base, pos, len ); }
};
struct values_bode_plot : wrap<jdksavdecc_values_bode_plot>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_values_bode_plot_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_values_bode_plot_write( this, base, pos, len );
}
};
struct values_gptp_time : wrap<jdksavdecc_values_gptp_time>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_values_gptp_time_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_values_gptp_time_write( this, base, pos, len );
}
};
struct values_sample_rate : wrap<jdksavdecc_values_sample_rate>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_values_sample_rate_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_values_sample_rate_write( this, base, pos, len );
}
};
struct values_smpte_time : wrap<jdksavdecc_values_smpte_time>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_values_smpte_time_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_values_smpte_time_write( this, base, pos, len );
}
};
struct values_vendor : wrap<jdksavdecc_values_vendor>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_values_vendor_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_values_vendor_write( this, base, pos, len );
}
};
struct video_mapping : wrap<jdksavdecc_video_mapping>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_video_mapping_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_video_mapping_write( this, base, pos, len );
}
};
struct video_mappings_format : wrap<jdksavdecc_video_mappings_format>
{
ssize_t read( const uint8_t *base, ssize_t pos, size_t len )
{
return jdksavdecc_video_mappings_format_read( this, base, pos, len );
}
ssize_t write( uint8_t *base, ssize_t pos, size_t len ) const
{
return jdksavdecc_video_mappings_format_write( this, base, pos, len );
}
};
struct printer : wrap<jdksavdecc_printer>
{
printer() {}
printer( char *buf, size_t buflen ) { jdksavdecc_printer_init( this, buf, buflen ); }
void init( char *buf, size_t buflen ) { jdksavdecc_printer_init( this, buf, buflen ); }
printer &print( eui48 const &v )
{
jdksavdecc_printer_print_eui48( this, *v.get() );
return *this;
}
printer &print( eui64 const &v )
{
jdksavdecc_printer_print_eui64( this, *v.get() );
return *this;
}
printer &print_streamid( eui64 const &v )
{
jdksavdecc_printer_print_streamid( this, *v.get() );
return *this;
}
printer &print_label( const char *v )
{
jdksavdecc_printer_print_label( this, v );
return *this;
}
printer &print_label( std::string const &v )
{
jdksavdecc_printer_print_label( this, v.c_str() );
return *this;
}
printer &print_block( const uint8_t *p, size_t sz, size_t start_pos, size_t end_pos )
{
jdksavdecc_printer_print_block( this, p, sz, start_pos, end_pos );
return *this;
}
printer &print_hexdigits( uint8_t v )
{
jdksavdecc_printer_print_hexdigits( this, v );
return *this;
}
printer &print( uint8_t v )
{
jdksavdecc_printer_print_uint8( this, v );
return *this;
}
printer &print( uint16_t v )
{
jdksavdecc_printer_print_uint16( this, v );
return *this;
}
printer &print( uint32_t v )
{
jdksavdecc_printer_print_uint32( this, v );
return *this;
}
printer &print( uint64_t v )
{
jdksavdecc_printer_print_uint64( this, v );
return *this;
}
printer &print( avdecc_string const &v )
{
jdksavdecc_printer_print_string( this, v.get() );
return *this;
}
printer &print( jdksavdecc_16bit_name const names[], uint16_t v )
{
jdksavdecc_printer_print_16bit_names( this, names, v );
return *this;
}
printer &print( jdksavdecc_32bit_name const names[], uint32_t v )
{
jdksavdecc_printer_print_32bit_names( this, names, v );
return *this;
}
printer &print( jdksavdecc_uint16_name const names[], uint16_t v )
{
jdksavdecc_printer_print_uint16_name( this, names, v );
return *this;
}
printer &print( jdksavdecc_uint32_name const names[], uint32_t v )
{
jdksavdecc_printer_print_uint32_name( this, names, v );
return *this;
}
printer &print( jdksavdecc_uint64_name const names[], uint64_t v )
{
jdksavdecc_printer_print_uint64_name( this, names, v );
return *this;
}
printer &print( jdksavdecc_eui48_name const names[], eui48 v )
{
jdksavdecc_printer_print_eui48_name( this, names, v );
return *this;
}
printer &print( jdksavdecc_eui64_name const names[], eui64 v )
{
jdksavdecc_printer_print_eui64_name( this, names, v );
return *this;
}
printer &print( gptp_seconds const &v )
{
jdksavdecc_printer_print_gptp_seconds( this, v );
return *this;
}
#if !defined( JDKSAVDECC_CPP_NO_STDIO )
bool output( FILE *f ) { return fwrite( buf, pos, 1, f ) == 1; }
#endif
};
template <typename T>
printer &operator<<( printer &p, T &v )
{
p.print( v );
return p;
}
struct printer_with_buf : printer
{
char *allocated_buf;
printer_with_buf( size_t bufsz ) : allocated_buf( (char *)malloc( bufsz ) ) { init( allocated_buf, bufsz ); }
~printer_with_buf() { free( allocated_buf ); }
};
#if !defined( JDKSAVDECC_CPP_NO_IOSTREAM )
inline std::ostream &operator<<( std::ostream &ostr, printer const &v )
{
ostr << v.buf;
return ostr;
}
inline std::ostream &operator<<( std::ostream &ostr, eui48 &v )
{
printer p;
char buf[128];
p.init( buf, sizeof( buf ) );
p.print( v );
ostr << buf;
return ostr;
}
inline std::ostream &operator<<( std::ostream &ostr, eui64 &v )
{
jdksavdecc_printer p;
char buf[128];
jdksavdecc_printer_init( &p, buf, sizeof( buf ) );
jdksavdecc_printer_print_eui64( &p, v );
ostr << buf;
return ostr;
}
#endif
}
#endif
| {'content_hash': 'e38a63838db44536c66ac5d544db1f77', 'timestamp': '', 'source': 'github', 'line_count': 2616, 'max_line_length': 128, 'avg_line_length': 35.98318042813456, 'alnum_prop': 0.6510432159095738, 'repo_name': 'arvidtp/jdksavdecc-c', 'id': '7a190d3602b6b653d2c64093a12e018c2f8068cb', 'size': '95714', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'include/jdksavdecc_plus.hpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '3338351'}, {'name': 'C++', 'bytes': '95714'}, {'name': 'CMake', 'bytes': '4789'}, {'name': 'CSS', 'bytes': '19795'}, {'name': 'HTML', 'bytes': '2945'}, {'name': 'Makefile', 'bytes': '124958'}, {'name': 'Shell', 'bytes': '35'}]} |
/* © 2010 JetBrains | {'content_hash': '9e5939a6c825fd598507e6b0dd72f40b', 'timestamp': '', 'source': 'github', 'line_count': 1, 'max_line_length': 24, 'avg_line_length': 24.0, 'alnum_prop': 0.7083333333333334, 'repo_name': 'Maccimo/intellij-community', 'id': 'daa76bc2f10627998800ee5567d58caeddf91b85', 'size': '24', 'binary': False, 'copies': '13', 'ref': 'refs/heads/master', 'path': 'plugins/java-i18n/testData/quickFix/convertToBasicLatin/UnclosedPlainComment_after.java', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
class Fantasy {
@Author(first="Eugene", second="Wampirchik") void compose () {}
} | {'content_hash': '7e66c3ebbba75dd102a19cd41fb83e6c', 'timestamp': '', 'source': 'github', 'line_count': 3, 'max_line_length': 66, 'avg_line_length': 28.0, 'alnum_prop': 0.6666666666666666, 'repo_name': 'diorcety/intellij-community', 'id': '85308287cf9360d9bbc626e953bec3b3eee322aa', 'size': '84', 'binary': False, 'copies': '88', 'ref': 'refs/heads/master', 'path': 'java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Complex.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AspectJ', 'bytes': '182'}, {'name': 'Batchfile', 'bytes': '63659'}, {'name': 'C', 'bytes': '214180'}, {'name': 'C#', 'bytes': '1538'}, {'name': 'C++', 'bytes': '190028'}, {'name': 'CSS', 'bytes': '108843'}, {'name': 'CoffeeScript', 'bytes': '1759'}, {'name': 'Cucumber', 'bytes': '14382'}, {'name': 'Erlang', 'bytes': '10'}, {'name': 'FLUX', 'bytes': '57'}, {'name': 'Groff', 'bytes': '35232'}, {'name': 'Groovy', 'bytes': '2211774'}, {'name': 'HTML', 'bytes': '1674627'}, {'name': 'J', 'bytes': '5050'}, {'name': 'JFlex', 'bytes': '166194'}, {'name': 'Java', 'bytes': '146664059'}, {'name': 'JavaScript', 'bytes': '125292'}, {'name': 'Kotlin', 'bytes': '225274'}, {'name': 'Makefile', 'bytes': '2352'}, {'name': 'NSIS', 'bytes': '85938'}, {'name': 'Objective-C', 'bytes': '28634'}, {'name': 'Perl6', 'bytes': '26'}, {'name': 'Protocol Buffer', 'bytes': '6570'}, {'name': 'Python', 'bytes': '21485830'}, {'name': 'Ruby', 'bytes': '1213'}, {'name': 'Scala', 'bytes': '11698'}, {'name': 'Shell', 'bytes': '63323'}, {'name': 'Smalltalk', 'bytes': '64'}, {'name': 'TeX', 'bytes': '60798'}, {'name': 'TypeScript', 'bytes': '6152'}, {'name': 'XSLT', 'bytes': '113040'}]} |
<?php
namespace Usine\MachineBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class StockType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('nomArticle')->add('quantite')->add('prix')->add('dateentre')->add('datesortie');
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Usine\MachineBundle\Entity\Stock'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'usine_machinebundle_stock';
}
}
| {'content_hash': 'ea2720eaba96b158b0276d0b7f60fab8', 'timestamp': '', 'source': 'github', 'line_count': 38, 'max_line_length': 103, 'avg_line_length': 21.710526315789473, 'alnum_prop': 0.6315151515151515, 'repo_name': 'Nabil005/pfa2.4', 'id': 'fbdf298952ffac2b0412737c6e76e7c190982e56', 'size': '825', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Usine/MachineBundle/Form/StockType.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '3605'}, {'name': 'CSS', 'bytes': '3844849'}, {'name': 'CoffeeScript', 'bytes': '83631'}, {'name': 'HTML', 'bytes': '1455021'}, {'name': 'JavaScript', 'bytes': '17188853'}, {'name': 'PHP', 'bytes': '129425'}, {'name': 'Shell', 'bytes': '444'}]} |
// Copyright 2015 The Bazel 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.
package com.google.devtools.build.singlejar;
import com.google.devtools.build.singlejar.ZipEntryFilter.CustomMergeStrategy;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.annotation.concurrent.NotThreadSafe;
/**
* A strategy that merges a set of files by concatenating them. It inserts no
* additional characters and copies bytes one by one. Used for testing.
*/
@NotThreadSafe
final class SlowConcatenateStrategy implements CustomMergeStrategy {
@Override
public void merge(InputStream in, OutputStream out) throws IOException {
int nextByte;
while ((nextByte = in.read()) != -1) {
out.write(nextByte);
}
}
@Override
public void finish(OutputStream out) {
// No need to do anything. All the data was already written.
}
}
| {'content_hash': 'de45500ee428377d9208bd0dd98d4401', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 78, 'avg_line_length': 31.844444444444445, 'alnum_prop': 0.7487787857641311, 'repo_name': 'spxtr/bazel', 'id': 'c82e89ad7ebc71d4f466b94a964309905c417c98', 'size': '1433', 'binary': False, 'copies': '41', 'ref': 'refs/heads/master', 'path': 'src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SlowConcatenateStrategy.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '14332'}, {'name': 'C++', 'bytes': '985839'}, {'name': 'HTML', 'bytes': '20974'}, {'name': 'Java', 'bytes': '25691487'}, {'name': 'JavaScript', 'bytes': '9186'}, {'name': 'Makefile', 'bytes': '248'}, {'name': 'PowerShell', 'bytes': '5473'}, {'name': 'Protocol Buffer', 'bytes': '114160'}, {'name': 'Python', 'bytes': '574080'}, {'name': 'Roff', 'bytes': '481'}, {'name': 'Shell', 'bytes': '909294'}]} |
package consulo.restclient.actions;
import javax.swing.SwingUtilities;
import consulo.restclient.ui.RestClientPanel;
import org.wiztools.restclient.bean.RequestBean;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
/**
* @author VISTALL
* @since 20.11.13.
*/
public class CleanAction extends AnAction
{
@Override
public void actionPerformed(final AnActionEvent e)
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
RequestBean requestBean = new RequestBean();
RestClientPanel.getInstance(e.getProject()).setRequestBean(requestBean);
}
});
}
}
| {'content_hash': '818855ef63d9d6801c5b4c5db51b45d1', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 76, 'avg_line_length': 20.78125, 'alnum_prop': 0.7578947368421053, 'repo_name': 'consulo/consulo-restclient', 'id': '44573928c4229e44cb7e3fec495554c607fb0736', 'size': '1260', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/consulo/restclient/actions/CleanAction.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '134828'}]} |
package org.zalando.spring.boot.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ExampleApplication.class, args);
}
}
| {'content_hash': '178c9c08dc576f29aa9469ff42f2c44b', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 68, 'avg_line_length': 24.214285714285715, 'alnum_prop': 0.7905604719764012, 'repo_name': 'zalando-stups/booties', 'id': '1a730b8231d809fc815ed75a6b1903b7fa4ae565', 'size': '967', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'async-spring-boot-starter/src/test/java/org/zalando/spring/boot/example/ExampleApplication.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '256794'}, {'name': 'SQLPL', 'bytes': '312'}]} |
#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__
/* Automatically generated file; DO NOT EDIT. */
/* RT-Thread Configuration */
/* RT-Thread Kernel */
#define RT_NAME_MAX 8
#define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 100
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
#define RT_HOOK_USING_FUNC_PTR
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
#define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512
/* kservice optimization */
#define RT_DEBUG
#define RT_DEBUG_COLOR
/* Inter-Thread communication */
#define RT_USING_SEMAPHORE
#define RT_USING_MUTEX
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE
/* Memory Management */
#define RT_USING_MEMPOOL
#define RT_USING_MEMHEAP
#define RT_MEMHEAP_FAST_MODE
#define RT_USING_MEMHEAP_AS_HEAP
#define RT_USING_MEMHEAP_AUTO_BINDING
#define RT_USING_HEAP
/* Kernel Device Object */
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart4"
#define RT_VER_NUM 0x40100
#define ARCH_ARM
#define RT_USING_CPU_FFS
#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M4
/* RT-Thread Components */
#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10
/* C++ features */
/* Command shell */
#define RT_USING_FINSH
#define RT_USING_MSH
#define FINSH_USING_MSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_CMD_SIZE 80
#define MSH_USING_BUILT_IN_COMMANDS
#define FINSH_USING_DESCRIPTION
#define FINSH_ARG_MAX 10
/* Device virtual file system */
/* Device Drivers */
#define RT_USING_DEVICE_IPC
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V1
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
/* Using USB */
/* POSIX layer and C standard library */
#define RT_LIBC_DEFAULT_TIMEZONE 8
/* POSIX (Portable Operating System Interface) layer */
/* Interprocess Communication (IPC) */
/* Socket is in the 'Network' category */
/* Network */
/* Socket abstraction layer */
/* Network interface device */
/* light weight TCP/IP stack */
/* AT commands */
/* VBUS(Virtual Software BUS) */
/* Utilities */
/* RT-Thread Utestcases */
/* RT-Thread online packages */
/* IoT - internet of things */
/* Wi-Fi */
/* Marvell WiFi */
/* Wiced WiFi */
/* IoT Cloud */
/* security packages */
/* language packages */
/* multimedia packages */
/* LVGL: powerful and easy-to-use embedded GUI library */
/* u8g2: a monochrome graphic library */
/* PainterEngine: A cross-platform graphics application framework written in C language */
/* tools packages */
/* system packages */
/* enhanced kernel services */
/* POSIX extension functions */
/* acceleration: Assembly language or algorithmic acceleration packages */
/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
/* Micrium: Micrium software products porting for RT-Thread */
/* peripheral libraries and drivers */
/* AI packages */
/* miscellaneous packages */
/* samples: kernel and components samples */
/* entertainment: terminal games and other interesting software packages */
#define SOC_FAMILY_STM32
#define SOC_SERIES_STM32MP1
/* Hardware Drivers Config */
#define SOC_STM32MP157A
/* Onboard Peripheral Drivers */
#define BSP_USING_STLINK_TO_USART
/* On-chip Peripheral Drivers */
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART4
/* Board extended module Drivers */
#endif
| {'content_hash': '9a02216e71a2f6dc3d4fe1928e5f4373', 'timestamp': '', 'source': 'github', 'line_count': 220, 'max_line_length': 90, 'avg_line_length': 17.304545454545455, 'alnum_prop': 0.7262936695560809, 'repo_name': 'geniusgogo/rt-thread', 'id': '7a577a9ae4d2ed6880275ea1b637f02b0994060e', 'size': '3807', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'bsp/stm32/stm32mp157a-st-discovery/rtconfig.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '11062568'}, {'name': 'Batchfile', 'bytes': '185448'}, {'name': 'C', 'bytes': '591567235'}, {'name': 'C++', 'bytes': '8172991'}, {'name': 'CMake', 'bytes': '148026'}, {'name': 'CSS', 'bytes': '9978'}, {'name': 'DIGITAL Command Language', 'bytes': '13234'}, {'name': 'GDB', 'bytes': '11796'}, {'name': 'HTML', 'bytes': '1647354'}, {'name': 'Lex', 'bytes': '7026'}, {'name': 'Logos', 'bytes': '7078'}, {'name': 'M4', 'bytes': '17515'}, {'name': 'Makefile', 'bytes': '436637'}, {'name': 'Module Management System', 'bytes': '1548'}, {'name': 'Objective-C', 'bytes': '4111275'}, {'name': 'Pawn', 'bytes': '2854'}, {'name': 'Perl', 'bytes': '21070'}, {'name': 'Python', 'bytes': '1588969'}, {'name': 'RPC', 'bytes': '14162'}, {'name': 'Rich Text Format', 'bytes': '177701'}, {'name': 'Roff', 'bytes': '4486'}, {'name': 'Ruby', 'bytes': '869'}, {'name': 'Shell', 'bytes': '416809'}, {'name': 'TeX', 'bytes': '3113'}, {'name': 'Yacc', 'bytes': '16084'}]} |
<?php
/**
* Module: update_profile
* Purpose: AJAX synchronisation of search page
*
*/
require_once('mod/search.php');
function update_search_content(&$a) {
$profile_uid = intval($_GET['p']);
if(! $profile_uid)
$profile_uid = (-1);
$load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
header("Content-type: text/html");
echo "<!DOCTYPE html><html><body>\r\n";
/**
* We can remove this hack once Internet Explorer recognises HTML5 natively
*/
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
/**
*
* Grab the page inner contents by calling the content function from the profile module directly,
* but move any image src attributes to another attribute name. This is because
* some browsers will prefetch all the images for the page even if we don't need them.
* The only ones we need to fetch are those for new page additions, which we'll discover
* on the client side and then swap the image back.
*
*/
$text = search_content($a,$profile_uid,$load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
/**
* reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
*/
echo str_replace("\t",' ',$text);
echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
echo "</body></html>\r\n";
killme();
} | {'content_hash': '502a6e23e623f3f8d762a5d8fd984904', 'timestamp': '', 'source': 'github', 'line_count': 66, 'max_line_length': 99, 'avg_line_length': 29.060606060606062, 'alnum_prop': 0.5828988529718456, 'repo_name': 'dawnbreak/redmatrix', 'id': 'ec7599b7932f28ca54d14e52a4c340e83aa57a19', 'size': '1918', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'mod/update_search.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '17461'}, {'name': 'ApacheConf', 'bytes': '2791'}, {'name': 'Batchfile', 'bytes': '22'}, {'name': 'CSS', 'bytes': '596860'}, {'name': 'Go', 'bytes': '14151'}, {'name': 'HTML', 'bytes': '559782'}, {'name': 'JavaScript', 'bytes': '1350822'}, {'name': 'Makefile', 'bytes': '1726'}, {'name': 'PHP', 'bytes': '7878283'}, {'name': 'Python', 'bytes': '36179'}, {'name': 'Ruby', 'bytes': '4978'}, {'name': 'Shell', 'bytes': '27815'}, {'name': 'Smarty', 'bytes': '384394'}]} |
/*
* 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.
*/
package com.facebook.presto.benchmark.driver;
import com.facebook.presto.client.ClientSession;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.HostAndPort;
import io.airlift.airline.Option;
import io.airlift.units.Duration;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.CharsetEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.TimeZone;
import static com.google.common.base.Preconditions.checkArgument;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.util.Locale.ENGLISH;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.MINUTES;
public class BenchmarkDriverOptions
{
@Option(name = "--server", title = "server", description = "Presto server location (default: localhost:8080)")
public String server = "localhost:8080";
@Option(name = "--user", title = "user", description = "Username")
public String user = System.getProperty("user.name");
@Option(name = "--catalog", title = "catalog", description = "Default catalog")
public String catalog;
@Option(name = "--schema", title = "schema", description = "Default schema")
public String schema;
@Option(name = "--suite", title = "suite", description = "Suite to execute")
public List<String> suites = new ArrayList<>();
@Option(name = "--suite-config", title = "suite-config", description = "Suites configuration file (default: suite.json)")
public String suiteConfigFile = "suite.json";
@Option(name = "--sql", title = "sql", description = "Directory containing sql files (default: sql)")
public String sqlTemplateDir = "sql";
@Option(name = "--query", title = "query", description = "Queries to execute")
public List<String> queries = new ArrayList<>();
@Option(name = "--debug", title = "debug", description = "Enable debug information (default: false)")
public boolean debug;
@Option(name = "--session", title = "session", description = "Session property (property can be used multiple times; format is key=value)")
public final List<ClientSessionProperty> sessionProperties = new ArrayList<>();
@Option(name = "--runs", title = "runs", description = "Number of times to run each query (default: 3)")
public int runs = 3;
@Option(name = "--warm", title = "warm", description = "Number of times to run each query for a warm-up (default: 1)")
public int warm = 1;
@Option(name = "--max-failures", title = "max failures", description = "Max number of consecutive failures before benchmark fails")
public int maxFailures = 10;
@Option(name = "--socks", title = "socks", description = "Socks proxy to use")
public HostAndPort socksProxy;
@Option(name = "--client-request-timeout", title = "client request timeout", description = "Client request timeout (default: 2m)")
public Duration clientRequestTimeout = new Duration(2, MINUTES);
public ClientSession getClientSession()
{
return new ClientSession(
parseServer(server),
user,
"presto-benchmark",
Optional.empty(),
ImmutableSet.of(),
null,
catalog,
schema,
null,
TimeZone.getDefault().getID(),
Locale.getDefault(),
ImmutableMap.of(),
toProperties(this.sessionProperties),
ImmutableMap.of(),
null,
clientRequestTimeout);
}
private static URI parseServer(String server)
{
server = server.toLowerCase(ENGLISH);
if (server.startsWith("http://") || server.startsWith("https://")) {
return URI.create(server);
}
HostAndPort host = HostAndPort.fromString(server);
try {
return new URI("http", null, host.getHost(), host.getPortOrDefault(80), null, null, null);
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
private static Map<String, String> toProperties(List<ClientSessionProperty> sessionProperties)
{
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
for (ClientSessionProperty sessionProperty : sessionProperties) {
String name = sessionProperty.getName();
if (sessionProperty.getCatalog().isPresent()) {
name = sessionProperty.getCatalog().get() + "." + name;
}
builder.put(name, sessionProperty.getValue());
}
return builder.build();
}
public static final class ClientSessionProperty
{
private static final Splitter NAME_VALUE_SPLITTER = Splitter.on('=').limit(2);
private static final Splitter NAME_SPLITTER = Splitter.on('.');
private final Optional<String> catalog;
private final String name;
private final String value;
public ClientSessionProperty(String property)
{
List<String> nameValue = NAME_VALUE_SPLITTER.splitToList(property);
checkArgument(nameValue.size() == 2, "Session property: %s", property);
List<String> nameParts = NAME_SPLITTER.splitToList(nameValue.get(0));
checkArgument(nameParts.size() == 1 || nameParts.size() == 2, "Invalid session property: %s", property);
if (nameParts.size() == 1) {
catalog = Optional.empty();
name = nameParts.get(0);
}
else {
catalog = Optional.of(nameParts.get(0));
name = nameParts.get(1);
}
value = nameValue.get(1);
verifyProperty(catalog, name, value);
}
public ClientSessionProperty(Optional<String> catalog, String name, String value)
{
this.catalog = requireNonNull(catalog, "catalog is null");
this.name = requireNonNull(name, "name is null");
this.value = requireNonNull(value, "value is null");
verifyProperty(catalog, name, value);
}
private static void verifyProperty(Optional<String> catalog, String name, String value)
{
checkArgument(!catalog.isPresent() || !catalog.get().isEmpty(), "Invalid session property: %s.%s:%s", catalog, name, value);
checkArgument(!name.isEmpty(), "Session property name is empty");
CharsetEncoder charsetEncoder = US_ASCII.newEncoder();
checkArgument(catalog.orElse("").indexOf('=') < 0, "Session property catalog must not contain '=': %s", name);
checkArgument(charsetEncoder.canEncode(catalog.orElse("")), "Session property catalog is not US_ASCII: %s", name);
checkArgument(name.indexOf('=') < 0, "Session property name must not contain '=': %s", name);
checkArgument(charsetEncoder.canEncode(name), "Session property name is not US_ASCII: %s", name);
checkArgument(charsetEncoder.canEncode(value), "Session property value is not US_ASCII: %s", value);
}
public Optional<String> getCatalog()
{
return catalog;
}
public String getName()
{
return name;
}
public String getValue()
{
return value;
}
@Override
public String toString()
{
return (catalog.isPresent() ? catalog.get() + '.' : "") + name + '=' + value;
}
@Override
public int hashCode()
{
return Objects.hash(catalog, name, value);
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ClientSessionProperty other = (ClientSessionProperty) obj;
return Objects.equals(this.catalog, other.catalog) &&
Objects.equals(this.name, other.name) &&
Objects.equals(this.value, other.value);
}
}
}
| {'content_hash': '09056c8eb354e20297ddf6e6b2b576d7', 'timestamp': '', 'source': 'github', 'line_count': 230, 'max_line_length': 143, 'avg_line_length': 39.02608695652174, 'alnum_prop': 0.6228832442067737, 'repo_name': 'haozhun/presto', 'id': '00e7bcb6e64541c637332fc743b8408c34fa0045', 'size': '8976', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'presto-benchmark-driver/src/main/java/com/facebook/presto/benchmark/driver/BenchmarkDriverOptions.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ANTLR', 'bytes': '27185'}, {'name': 'CSS', 'bytes': '12676'}, {'name': 'HTML', 'bytes': '50340'}, {'name': 'Java', 'bytes': '29630209'}, {'name': 'JavaScript', 'bytes': '203589'}, {'name': 'Makefile', 'bytes': '6822'}, {'name': 'PLSQL', 'bytes': '8074'}, {'name': 'Python', 'bytes': '7552'}, {'name': 'SQLPL', 'bytes': '8247'}, {'name': 'Shell', 'bytes': '26210'}, {'name': 'Thrift', 'bytes': '12060'}]} |
Given an array of strings `strs`, group the anagrams together. You can return the answer in any order.
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
### Example 1:
```
Input: strs = ["eat","tea","tan","ate","nat","bat"]
Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
```
### Example 2:
```
Input: strs = [""]
Output: [[""]]
```
### Example 3:
```
Input: strs = ["a"]
Output: [["a"]]
```
### Constraints:
- 1 <= strs.length <= 10^4
- 0 <= strs[i].length <= 100
- strs[i] consists of lower-case English letters.
## Solution
Store into hash table key by signature. Signature function can be a sorted string or a character count sequence.
#FB #AMZN #BBG #UBER #YELP #ALL
#Explore Facebook
#Hash Table #String
| {'content_hash': '9b5ac04acf704525f48c23aeda32b0cd', 'timestamp': '', 'source': 'github', 'line_count': 40, 'max_line_length': 150, 'avg_line_length': 20.725, 'alnum_prop': 0.6489746682750301, 'repo_name': 'l33tdaima/l33tdaima', 'id': '4dd4d3b9f98e5e159756663367d9821b9c35c44f', 'size': '850', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'p049m/README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '214858'}, {'name': 'CMake', 'bytes': '185'}, {'name': 'Go', 'bytes': '3918'}, {'name': 'JavaScript', 'bytes': '357357'}, {'name': 'Kotlin', 'bytes': '893'}, {'name': 'OCaml', 'bytes': '11241'}, {'name': 'Python', 'bytes': '534124'}]} |
#include "tensorflow/core/platform/env.h"
#include <Shlwapi.h>
#include <Windows.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#undef LoadLibrary
#undef ERROR
#include <thread>
#include <vector>
#include <string>
#include "tensorflow/core/lib/core/error_codes.pb.h"
#include "tensorflow/core/platform/load_library.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/windows/windows_file_system.h"
#pragma comment(lib, "Shlwapi.lib")
namespace tensorflow {
namespace {
class StdThread : public Thread {
public:
// name and thread_options are both ignored.
StdThread(const ThreadOptions& thread_options, const string& name,
std::function<void()> fn)
: thread_(fn) {}
~StdThread() { thread_.join(); }
private:
std::thread thread_;
};
class WindowsEnv : public Env {
public:
WindowsEnv()
: GetSystemTimePreciseAsFileTime_(NULL) {
// GetSystemTimePreciseAsFileTime function is only available in the latest
// versions of Windows. For that reason, we try to look it up in
// kernel32.dll at runtime and use an alternative option if the function
// is not available.
HMODULE module = GetModuleHandleW(L"kernel32.dll");
if (module != NULL) {
auto func = (FnGetSystemTimePreciseAsFileTime)GetProcAddress(
module, "GetSystemTimePreciseAsFileTime");
GetSystemTimePreciseAsFileTime_ = func;
}
}
~WindowsEnv() override {
LOG(FATAL) << "Env::Default() must not be destroyed";
}
bool MatchPath(const string& path, const string& pattern) override {
std::wstring ws_path(WindowsFileSystem::Utf8ToWideChar(path));
std::wstring ws_pattern(WindowsFileSystem::Utf8ToWideChar(pattern));
return PathMatchSpecW(ws_path.c_str(), ws_pattern.c_str()) == TRUE;
}
void SleepForMicroseconds(int64 micros) override { Sleep(micros / 1000); }
Thread* StartThread(const ThreadOptions& thread_options, const string& name,
std::function<void()> fn) override {
return new StdThread(thread_options, name, fn);
}
static VOID CALLBACK SchedClosureCallback(PTP_CALLBACK_INSTANCE Instance,
PVOID Context, PTP_WORK Work) {
CloseThreadpoolWork(Work);
std::function<void()>* f = (std::function<void()>*)Context;
(*f)();
delete f;
}
void SchedClosure(std::function<void()> closure) override {
PTP_WORK work = CreateThreadpoolWork(
SchedClosureCallback, new std::function<void()>(std::move(closure)),
nullptr);
SubmitThreadpoolWork(work);
}
static VOID CALLBACK SchedClosureAfterCallback(PTP_CALLBACK_INSTANCE Instance,
PVOID Context,
PTP_TIMER Timer) {
CloseThreadpoolTimer(Timer);
std::function<void()>* f = (std::function<void()>*)Context;
(*f)();
delete f;
}
void SchedClosureAfter(int64 micros, std::function<void()> closure) override {
PTP_TIMER timer = CreateThreadpoolTimer(
SchedClosureAfterCallback,
new std::function<void()>(std::move(closure)), nullptr);
// in 100 nanosecond units
FILETIME FileDueTime;
ULARGE_INTEGER ulDueTime;
// Negative indicates the amount of time to wait is relative to the current
// time.
ulDueTime.QuadPart = (ULONGLONG) - (10 * micros);
FileDueTime.dwHighDateTime = ulDueTime.HighPart;
FileDueTime.dwLowDateTime = ulDueTime.LowPart;
SetThreadpoolTimer(timer, &FileDueTime, 0, 0);
}
Status LoadLibrary(const char *library_filename, void** handle) override {
std::string file_name = library_filename;
std::replace(file_name.begin(), file_name.end(), '/', '\\');
std::wstring ws_file_name(WindowsFileSystem::Utf8ToWideChar(file_name));
HMODULE hModule = LoadLibraryExW(ws_file_name.c_str(), NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
if (!hModule) {
return errors::NotFound(file_name + " not found");
}
*handle = hModule;
return Status::OK();
}
Status GetSymbolFromLibrary(void* handle, const char* symbol_name,
void** symbol) override {
FARPROC found_symbol;
found_symbol = GetProcAddress((HMODULE)handle, symbol_name);
if (found_symbol == NULL) {
return errors::NotFound(std::string(symbol_name) + " not found");
}
*symbol = (void **)found_symbol;
return Status::OK();
}
string FormatLibraryFileName(const string& name, const string& version)
override {
string filename;
if (version.size() == 0) {
filename = name + ".dll";
}
else {
filename = name + version + ".dll";
}
return filename;
}
private:
typedef VOID(WINAPI * FnGetSystemTimePreciseAsFileTime)(LPFILETIME);
FnGetSystemTimePreciseAsFileTime GetSystemTimePreciseAsFileTime_;
};
} // namespace
REGISTER_FILE_SYSTEM("", WindowsFileSystem);
REGISTER_FILE_SYSTEM("file", LocalWinFileSystem);
Env* Env::Default() {
static Env* default_env = new WindowsEnv;
return default_env;
}
void Env::GetLocalTempDirectories(std::vector<string>* list) {
list->clear();
// On windows we'll try to find a directory in this order:
// C:/Documents & Settings/whomever/TEMP (or whatever GetTempPath() is)
// C:/TMP/
// C:/TEMP/
// C:/WINDOWS/ or C:/WINNT/
// .
char tmp[MAX_PATH];
// GetTempPath can fail with either 0 or with a space requirement > bufsize.
// See http://msdn.microsoft.com/en-us/library/aa364992(v=vs.85).aspx
DWORD n = GetTempPathA(MAX_PATH, tmp);
if (n > 0 && n <= MAX_PATH) list->push_back(tmp);
list->push_back("C:\\tmp\\");
list->push_back("C:\\temp\\");
}
} // namespace tensorflow
| {'content_hash': 'eac99eafd6e397327661b425784992fd', 'timestamp': '', 'source': 'github', 'line_count': 183, 'max_line_length': 80, 'avg_line_length': 31.26775956284153, 'alnum_prop': 0.6627053477804963, 'repo_name': 'with-git/tensorflow', 'id': '788a4bf4b1af74393099d1b590a1e589d9a07f25', 'size': '6390', 'binary': False, 'copies': '32', 'ref': 'refs/heads/master', 'path': 'tensorflow/core/platform/windows/env.cc', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '7666'}, {'name': 'C', 'bytes': '191403'}, {'name': 'C++', 'bytes': '28574091'}, {'name': 'CMake', 'bytes': '635785'}, {'name': 'Go', 'bytes': '957914'}, {'name': 'Java', 'bytes': '404257'}, {'name': 'Jupyter Notebook', 'bytes': '1833674'}, {'name': 'LLVM', 'bytes': '6536'}, {'name': 'Makefile', 'bytes': '38060'}, {'name': 'Objective-C', 'bytes': '7056'}, {'name': 'Objective-C++', 'bytes': '63210'}, {'name': 'Perl', 'bytes': '6715'}, {'name': 'Protocol Buffer', 'bytes': '261191'}, {'name': 'PureBasic', 'bytes': '24932'}, {'name': 'Python', 'bytes': '25144780'}, {'name': 'Ruby', 'bytes': '327'}, {'name': 'Shell', 'bytes': '371221'}]} |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.Azure.Commands.Automation.Model;
using System.Management.Automation;
using System.Security.Permissions;
namespace Microsoft.Azure.Commands.Automation.Cmdlet
{
/// <summary>
/// Publishes an azure automation runbook.
/// </summary>
[Cmdlet(VerbsData.Publish, "AzureRmAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
[OutputType(typeof(Runbook))]
public class PublishAzureAutomationRunbook : AzureAutomationBaseCmdlet
{
/// <summary>
/// Gets or sets the runbook name
/// </summary>
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
[ValidateNotNullOrEmpty]
[Alias("RunbookName")]
public string Name { get; set; }
/// <summary>
/// Execute this cmdlet.
/// </summary>
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
protected override void AutomationProcessRecord()
{
var runbook = this.AutomationClient.PublishRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name);
this.WriteObject(runbook);
}
}
}
| {'content_hash': '42dbfabd179ac68d63905247894cb426', 'timestamp': '', 'source': 'github', 'line_count': 48, 'max_line_length': 190, 'avg_line_length': 43.645833333333336, 'alnum_prop': 0.6548926014319809, 'repo_name': 'jtlibing/azure-powershell', 'id': '534e5e3d2c76b14651263771b5db04fddff058a9', 'size': '2097', 'binary': False, 'copies': '29', 'ref': 'refs/heads/master', 'path': 'src/ResourceManager/Automation/Commands.Automation/Cmdlet/PublishAzureAutomationRunbook.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '16509'}, {'name': 'C#', 'bytes': '31783821'}, {'name': 'HTML', 'bytes': '209'}, {'name': 'JavaScript', 'bytes': '4979'}, {'name': 'PHP', 'bytes': '41'}, {'name': 'PowerShell', 'bytes': '3573307'}, {'name': 'Shell', 'bytes': '50'}, {'name': 'XSLT', 'bytes': '6114'}]} |
.class public final Landroid/support/v4/R$xml;
.super Ljava/lang/Object;
.source "R.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroid/support/v4/R;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = "xml"
.end annotation
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
| {'content_hash': 'e3fd71aad49d0ad4c05fca843f554681', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 53, 'avg_line_length': 19.666666666666668, 'alnum_prop': 0.722457627118644, 'repo_name': 'BatMan-Rom/ModdedFiles', 'id': 'ed3dd5dda3cb84763c5520b1f60603c4208758fe', 'size': '472', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SystemUI/smali/android/support/v4/R$xml.smali', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'GLSL', 'bytes': '15069'}, {'name': 'HTML', 'bytes': '139176'}, {'name': 'Smali', 'bytes': '541934400'}]} |
#include <gtest/gtest.h>
#include <folly/futures/Future.h>
#include <folly/Memory.h>
#include <folly/Executor.h>
#include <folly/dynamic.h>
#include <folly/Baton.h>
#include <algorithm>
#include <atomic>
#include <memory>
#include <numeric>
#include <string>
#include <thread>
#include <type_traits>
#include <unistd.h>
using namespace folly;
#define EXPECT_TYPE(x, T) \
EXPECT_TRUE((std::is_same<decltype(x), T>::value))
typedef FutureException eggs_t;
static eggs_t eggs("eggs");
// Future
TEST(Future, onError) {
bool theFlag = false;
auto flag = [&]{ theFlag = true; };
#define EXPECT_FLAG() \
do { \
EXPECT_TRUE(theFlag); \
theFlag = false; \
} while(0);
#define EXPECT_NO_FLAG() \
do { \
EXPECT_FALSE(theFlag); \
theFlag = false; \
} while(0);
// By reference
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t& e) { flag(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t& e) { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// By value
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t e) { flag(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t e) { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// Polymorphic
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (std::exception& e) { flag(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (std::exception& e) { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// Non-exceptions
{
auto f = makeFuture()
.then([] { throw -1; })
.onError([&] (int e) { flag(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
{
auto f = makeFuture()
.then([] { throw -1; })
.onError([&] (int e) { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// Mutable lambda
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t& e) mutable { flag(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (eggs_t& e) mutable { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// No throw
{
auto f = makeFuture()
.then([] { return 42; })
.onError([&] (eggs_t& e) { flag(); return -1; });
EXPECT_NO_FLAG();
EXPECT_EQ(42, f.value());
}
{
auto f = makeFuture()
.then([] { return 42; })
.onError([&] (eggs_t& e) { flag(); return makeFuture<int>(-1); });
EXPECT_NO_FLAG();
EXPECT_EQ(42, f.value());
}
// Catch different exception
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (std::runtime_error& e) { flag(); });
EXPECT_NO_FLAG();
EXPECT_THROW(f.value(), eggs_t);
}
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (std::runtime_error& e) { flag(); return makeFuture(); });
EXPECT_NO_FLAG();
EXPECT_THROW(f.value(), eggs_t);
}
// Returned value propagates
{
auto f = makeFuture()
.then([] { throw eggs; return 0; })
.onError([&] (eggs_t& e) { return 42; });
EXPECT_EQ(42, f.value());
}
// Returned future propagates
{
auto f = makeFuture()
.then([] { throw eggs; return 0; })
.onError([&] (eggs_t& e) { return makeFuture<int>(42); });
EXPECT_EQ(42, f.value());
}
// Throw in callback
{
auto f = makeFuture()
.then([] { throw eggs; return 0; })
.onError([&] (eggs_t& e) { throw e; return -1; });
EXPECT_THROW(f.value(), eggs_t);
}
{
auto f = makeFuture()
.then([] { throw eggs; return 0; })
.onError([&] (eggs_t& e) { throw e; return makeFuture<int>(-1); });
EXPECT_THROW(f.value(), eggs_t);
}
// exception_wrapper, return Future<T>
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (exception_wrapper e) { flag(); return makeFuture(); });
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
// exception_wrapper, return Future<T> but throw
{
auto f = makeFuture()
.then([]{ throw eggs; return 0; })
.onError([&] (exception_wrapper e) {
flag();
throw eggs;
return makeFuture<int>(-1);
});
EXPECT_FLAG();
EXPECT_THROW(f.value(), eggs_t);
}
// exception_wrapper, return T
{
auto f = makeFuture()
.then([]{ throw eggs; return 0; })
.onError([&] (exception_wrapper e) {
flag();
return -1;
});
EXPECT_FLAG();
EXPECT_EQ(-1, f.value());
}
// exception_wrapper, return T but throw
{
auto f = makeFuture()
.then([]{ throw eggs; return 0; })
.onError([&] (exception_wrapper e) {
flag();
throw eggs;
return -1;
});
EXPECT_FLAG();
EXPECT_THROW(f.value(), eggs_t);
}
// const exception_wrapper&
{
auto f = makeFuture()
.then([] { throw eggs; })
.onError([&] (const exception_wrapper& e) {
flag();
return makeFuture();
});
EXPECT_FLAG();
EXPECT_NO_THROW(f.value());
}
}
TEST(Future, special) {
EXPECT_FALSE(std::is_copy_constructible<Future<int>>::value);
EXPECT_FALSE(std::is_copy_assignable<Future<int>>::value);
EXPECT_TRUE(std::is_move_constructible<Future<int>>::value);
EXPECT_TRUE(std::is_move_assignable<Future<int>>::value);
}
TEST(Future, then) {
auto f = makeFuture<std::string>("0")
.then([](){
return makeFuture<std::string>("1"); })
.then([](Try<std::string>&& t) {
return makeFuture(t.value() + ";2"); })
.then([](const Try<std::string>&& t) {
return makeFuture(t.value() + ";3"); })
.then([](Try<std::string>& t) {
return makeFuture(t.value() + ";4"); })
.then([](const Try<std::string>& t) {
return makeFuture(t.value() + ";5"); })
.then([](Try<std::string> t) {
return makeFuture(t.value() + ";6"); })
.then([](const Try<std::string> t) {
return makeFuture(t.value() + ";7"); })
.then([](std::string&& s) {
return makeFuture(s + ";8"); })
.then([](const std::string&& s) {
return makeFuture(s + ";9"); })
.then([](std::string& s) {
return makeFuture(s + ";10"); })
.then([](const std::string& s) {
return makeFuture(s + ";11"); })
.then([](std::string s) {
return makeFuture(s + ";12"); })
.then([](const std::string s) {
return makeFuture(s + ";13"); })
;
EXPECT_EQ(f.value(), "1;2;3;4;5;6;7;8;9;10;11;12;13");
}
TEST(Future, thenTry) {
bool flag = false;
makeFuture<int>(42).then([&](Try<int>&& t) {
flag = true;
EXPECT_EQ(42, t.value());
});
EXPECT_TRUE(flag); flag = false;
makeFuture<int>(42)
.then([](Try<int>&& t) { return t.value(); })
.then([&](Try<int>&& t) { flag = true; EXPECT_EQ(42, t.value()); });
EXPECT_TRUE(flag); flag = false;
makeFuture().then([&](Try<Unit>&& t) { flag = true; t.value(); });
EXPECT_TRUE(flag); flag = false;
Promise<Unit> p;
auto f = p.getFuture().then([&](Try<Unit>&& t) { flag = true; });
EXPECT_FALSE(flag);
EXPECT_FALSE(f.isReady());
p.setValue();
EXPECT_TRUE(flag);
EXPECT_TRUE(f.isReady());
}
TEST(Future, thenValue) {
bool flag = false;
makeFuture<int>(42).then([&](int i){
EXPECT_EQ(42, i);
flag = true;
});
EXPECT_TRUE(flag); flag = false;
makeFuture<int>(42)
.then([](int i){ return i; })
.then([&](int i) { flag = true; EXPECT_EQ(42, i); });
EXPECT_TRUE(flag); flag = false;
makeFuture().then([&]{
flag = true;
});
EXPECT_TRUE(flag); flag = false;
auto f = makeFuture<int>(eggs).then([&](int i){});
EXPECT_THROW(f.value(), eggs_t);
f = makeFuture<Unit>(eggs).then([&]{});
EXPECT_THROW(f.value(), eggs_t);
}
TEST(Future, thenValueFuture) {
bool flag = false;
makeFuture<int>(42)
.then([](int i){ return makeFuture<int>(std::move(i)); })
.then([&](Try<int>&& t) { flag = true; EXPECT_EQ(42, t.value()); });
EXPECT_TRUE(flag); flag = false;
makeFuture()
.then([]{ return makeFuture(); })
.then([&](Try<Unit>&& t) { flag = true; });
EXPECT_TRUE(flag); flag = false;
}
static std::string doWorkStatic(Try<std::string>&& t) {
return t.value() + ";static";
}
TEST(Future, thenFunction) {
struct Worker {
std::string doWork(Try<std::string>&& t) {
return t.value() + ";class";
}
static std::string doWorkStatic(Try<std::string>&& t) {
return t.value() + ";class-static";
}
} w;
auto f = makeFuture<std::string>("start")
.then(doWorkStatic)
.then(Worker::doWorkStatic)
.then(&Worker::doWork, &w);
EXPECT_EQ(f.value(), "start;static;class-static;class");
}
static Future<std::string> doWorkStaticFuture(Try<std::string>&& t) {
return makeFuture(t.value() + ";static");
}
TEST(Future, thenFunctionFuture) {
struct Worker {
Future<std::string> doWorkFuture(Try<std::string>&& t) {
return makeFuture(t.value() + ";class");
}
static Future<std::string> doWorkStaticFuture(Try<std::string>&& t) {
return makeFuture(t.value() + ";class-static");
}
} w;
auto f = makeFuture<std::string>("start")
.then(doWorkStaticFuture)
.then(Worker::doWorkStaticFuture)
.then(&Worker::doWorkFuture, &w);
EXPECT_EQ(f.value(), "start;static;class-static;class");
}
TEST(Future, thenStdFunction) {
{
std::function<int()> fn = [](){ return 42; };
auto f = makeFuture().then(std::move(fn));
EXPECT_EQ(f.value(), 42);
}
{
std::function<int(int)> fn = [](int i){ return i + 23; };
auto f = makeFuture(19).then(std::move(fn));
EXPECT_EQ(f.value(), 42);
}
{
std::function<int(Try<int>&)> fn = [](Try<int>& t){ return t.value() + 2; };
auto f = makeFuture(1).then(std::move(fn));
EXPECT_EQ(f.value(), 3);
}
{
bool flag = false;
std::function<void()> fn = [&flag](){ flag = true; };
auto f = makeFuture().then(std::move(fn));
EXPECT_TRUE(f.isReady());
EXPECT_TRUE(flag);
}
}
TEST(Future, thenBind) {
auto l = []() {
return makeFuture("bind");
};
auto b = std::bind(l);
auto f = makeFuture().then(std::move(b));
EXPECT_EQ(f.value(), "bind");
}
TEST(Future, thenBindTry) {
auto l = [](Try<std::string>&& t) {
return makeFuture(t.value() + ";bind");
};
auto b = std::bind(l, std::placeholders::_1);
auto f = makeFuture<std::string>("start").then(std::move(b));
EXPECT_EQ(f.value(), "start;bind");
}
TEST(Future, value) {
auto f = makeFuture(std::unique_ptr<int>(new int(42)));
auto up = std::move(f.value());
EXPECT_EQ(42, *up);
EXPECT_THROW(makeFuture<int>(eggs).value(), eggs_t);
}
TEST(Future, isReady) {
Promise<int> p;
auto f = p.getFuture();
EXPECT_FALSE(f.isReady());
p.setValue(42);
EXPECT_TRUE(f.isReady());
}
TEST(Future, futureNotReady) {
Promise<int> p;
Future<int> f = p.getFuture();
EXPECT_THROW(f.value(), eggs_t);
}
TEST(Future, hasException) {
EXPECT_TRUE(makeFuture<int>(eggs).getTry().hasException());
EXPECT_FALSE(makeFuture(42).getTry().hasException());
}
TEST(Future, hasValue) {
EXPECT_TRUE(makeFuture(42).getTry().hasValue());
EXPECT_FALSE(makeFuture<int>(eggs).getTry().hasValue());
}
TEST(Future, makeFuture) {
EXPECT_TYPE(makeFuture(42), Future<int>);
EXPECT_EQ(42, makeFuture(42).value());
EXPECT_TYPE(makeFuture<float>(42), Future<float>);
EXPECT_EQ(42, makeFuture<float>(42).value());
auto fun = [] { return 42; };
EXPECT_TYPE(makeFutureWith(fun), Future<int>);
EXPECT_EQ(42, makeFutureWith(fun).value());
auto funf = [] { return makeFuture<int>(43); };
EXPECT_TYPE(makeFutureWith(funf), Future<int>);
EXPECT_EQ(43, makeFutureWith(funf).value());
auto failfun = []() -> int { throw eggs; };
EXPECT_TYPE(makeFutureWith(failfun), Future<int>);
EXPECT_NO_THROW(makeFutureWith(failfun));
EXPECT_THROW(makeFutureWith(failfun).value(), eggs_t);
auto failfunf = []() -> Future<int> { throw eggs; };
EXPECT_TYPE(makeFutureWith(failfunf), Future<int>);
EXPECT_NO_THROW(makeFutureWith(failfunf));
EXPECT_THROW(makeFutureWith(failfunf).value(), eggs_t);
EXPECT_TYPE(makeFuture(), Future<Unit>);
}
TEST(Future, finish) {
auto x = std::make_shared<int>(0);
{
Promise<int> p;
auto f = p.getFuture().then([x](Try<int>&& t) { *x = t.value(); });
// The callback hasn't executed
EXPECT_EQ(0, *x);
// The callback has a reference to x
EXPECT_EQ(2, x.use_count());
p.setValue(42);
// the callback has executed
EXPECT_EQ(42, *x);
}
// the callback has been destructed
// and has released its reference to x
EXPECT_EQ(1, x.use_count());
}
TEST(Future, unwrap) {
Promise<int> a;
Promise<int> b;
auto fa = a.getFuture();
auto fb = b.getFuture();
bool flag1 = false;
bool flag2 = false;
// do a, then do b, and get the result of a + b.
Future<int> f = fa.then([&](Try<int>&& ta) {
auto va = ta.value();
flag1 = true;
return fb.then([va, &flag2](Try<int>&& tb) {
flag2 = true;
return va + tb.value();
});
});
EXPECT_FALSE(flag1);
EXPECT_FALSE(flag2);
EXPECT_FALSE(f.isReady());
a.setValue(3);
EXPECT_TRUE(flag1);
EXPECT_FALSE(flag2);
EXPECT_FALSE(f.isReady());
b.setValue(4);
EXPECT_TRUE(flag1);
EXPECT_TRUE(flag2);
EXPECT_EQ(7, f.value());
}
TEST(Future, throwCaughtInImmediateThen) {
// Neither of these should throw "Promise already satisfied"
makeFuture().then(
[=](Try<Unit>&&) -> int { throw std::exception(); });
makeFuture().then(
[=](Try<Unit>&&) -> Future<int> { throw std::exception(); });
}
TEST(Future, throwIfFailed) {
makeFuture<Unit>(eggs)
.then([=](Try<Unit>&& t) {
EXPECT_THROW(t.throwIfFailed(), eggs_t);
});
makeFuture()
.then([=](Try<Unit>&& t) {
EXPECT_NO_THROW(t.throwIfFailed());
});
makeFuture<int>(eggs)
.then([=](Try<int>&& t) {
EXPECT_THROW(t.throwIfFailed(), eggs_t);
});
makeFuture<int>(42)
.then([=](Try<int>&& t) {
EXPECT_NO_THROW(t.throwIfFailed());
});
}
TEST(Future, getFutureAfterSetValue) {
Promise<int> p;
p.setValue(42);
EXPECT_EQ(42, p.getFuture().value());
}
TEST(Future, getFutureAfterSetException) {
Promise<Unit> p;
p.setWith([]() -> void { throw std::logic_error("foo"); });
EXPECT_THROW(p.getFuture().value(), std::logic_error);
}
TEST(Future, detachRace) {
// Task #5438209
// This test is designed to detect a race that was in Core::detachOne()
// where detached_ was incremented and then tested, and that
// allowed a race where both Promise and Future would think they were the
// second and both try to delete. This showed up at scale but was very
// difficult to reliably repro in a test. As it is, this only fails about
// once in every 1,000 executions. Doing this 1,000 times is going to make a
// slow test so I won't do that but if it ever fails, take it seriously, and
// run the test binary with "--gtest_repeat=10000 --gtest_filter=*detachRace"
// (Don't forget to enable ASAN)
auto p = folly::make_unique<Promise<bool>>();
auto f = folly::make_unique<Future<bool>>(p->getFuture());
folly::Baton<> baton;
std::thread t1([&]{
baton.post();
p.reset();
});
baton.wait();
f.reset();
t1.join();
}
// Test of handling of a circular dependency. It's never recommended
// to have one because of possible memory leaks. Here we test that
// we can handle freeing of the Future while it is running.
TEST(Future, CircularDependencySharedPtrSelfReset) {
Promise<int64_t> promise;
auto ptr = std::make_shared<Future<int64_t>>(promise.getFuture());
ptr->then(
[ptr] (folly::Try<int64_t>&& uid) mutable {
EXPECT_EQ(1, ptr.use_count());
// Leaving no references to ourselves.
ptr.reset();
EXPECT_EQ(0, ptr.use_count());
}
);
EXPECT_EQ(2, ptr.use_count());
ptr.reset();
promise.setValue(1);
}
TEST(Future, Constructor) {
auto f1 = []() -> Future<int> { return Future<int>(3); }();
EXPECT_EQ(f1.value(), 3);
auto f2 = []() -> Future<Unit> { return Future<Unit>(); }();
EXPECT_NO_THROW(f2.value());
}
TEST(Future, ImplicitConstructor) {
auto f1 = []() -> Future<int> { return 3; }();
EXPECT_EQ(f1.value(), 3);
// Unfortunately, the C++ standard does not allow the
// following implicit conversion to work:
//auto f2 = []() -> Future<Unit> { }();
}
TEST(Future, thenDynamic) {
// folly::dynamic has a constructor that takes any T, this test makes
// sure that we call the then lambda with folly::dynamic and not
// Try<folly::dynamic> because that then fails to compile
Promise<folly::dynamic> p;
Future<folly::dynamic> f = p.getFuture().then(
[](const folly::dynamic& d) {
return folly::dynamic(d.asInt() + 3);
}
);
p.setValue(2);
EXPECT_EQ(f.get(), 5);
}
TEST(Future, RequestContext) {
class NewThreadExecutor : public Executor {
public:
~NewThreadExecutor() override {
std::for_each(v_.begin(), v_.end(), [](std::thread& t){ t.join(); });
}
void add(Func f) override {
if (throwsOnAdd_) { throw std::exception(); }
v_.emplace_back(std::move(f));
}
void addWithPriority(Func f, int8_t prio) override { add(std::move(f)); }
uint8_t getNumPriorities() const override { return numPriorities_; }
void setHandlesPriorities() { numPriorities_ = 2; }
void setThrowsOnAdd() { throwsOnAdd_ = true; }
private:
std::vector<std::thread> v_;
uint8_t numPriorities_ = 1;
bool throwsOnAdd_ = false;
};
struct MyRequestData : RequestData {
MyRequestData(bool value = false) : value(value) {}
bool value;
};
NewThreadExecutor e;
RequestContext::create();
RequestContext::get()->setContextData("key",
folly::make_unique<MyRequestData>(true));
auto checker = [](int lineno) {
return [lineno](Try<int>&& t) {
auto d = static_cast<MyRequestData*>(
RequestContext::get()->getContextData("key"));
EXPECT_TRUE(d && d->value) << "on line " << lineno;
};
};
makeFuture(1).via(&e).then(checker(__LINE__));
e.setHandlesPriorities();
makeFuture(2).via(&e).then(checker(__LINE__));
Promise<int> p1, p2;
p1.getFuture().then(checker(__LINE__));
e.setThrowsOnAdd();
p2.getFuture().via(&e).then(checker(__LINE__));
RequestContext::create();
p1.setValue(3);
p2.setValue(4);
}
TEST(Future, makeFutureNoThrow) {
makeFuture().value();
}
| {'content_hash': '7db683e28cb134e05267ee501bb46e3a', 'timestamp': '', 'source': 'github', 'line_count': 736, 'max_line_length': 80, 'avg_line_length': 25.69836956521739, 'alnum_prop': 0.5790948503753833, 'repo_name': 'upsoft/folly', 'id': 'cdec62e9e1d7fd29b9772401c0b92017540101e2', 'size': '19509', 'binary': False, 'copies': '29', 'ref': 'refs/heads/master', 'path': 'folly/futures/test/FutureTest.cpp', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '28884'}, {'name': 'C++', 'bytes': '5170065'}, {'name': 'CSS', 'bytes': '165'}, {'name': 'Makefile', 'bytes': '700'}, {'name': 'Python', 'bytes': '8495'}, {'name': 'Ruby', 'bytes': '1531'}, {'name': 'Shell', 'bytes': '3187'}]} |
<?php
/**
* @see Zend_Mime_Decode
*/
require_once 'Zend/Mime/Decode.php';
/**
* @see Zend_Mail_Part
*/
require_once 'Zend/Mail/Part.php';
/**
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Mail_Part_File extends Zend_Mail_Part
{
protected $_contentPos = array();
protected $_partPos = array();
protected $_fh;
/**
* Public constructor
*
* This handler supports the following params:
* - file filename or open file handler with message content (required)
* - startPos start position of message or part in file (default: current position)
* - endPos end position of message or part in file (default: end of file)
*
* @param array $params full message with or without headers
* @throws Zend_Mail_Exception
*/
public function __construct(array $params)
{
if (empty($params['file'])) {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no file given in params');
}
if (!is_resource($params['file'])) {
$this->_fh = fopen($params['file'], 'r');
} else {
$this->_fh = $params['file'];
}
if (!$this->_fh) {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('could not open file');
}
if (isset($params['startPos'])) {
fseek($this->_fh, $params['startPos']);
}
$header = '';
$endPos = isset($params['endPos']) ? $params['endPos'] : null;
while (($endPos === null || ftell($this->_fh) < $endPos) && trim($line = fgets($this->_fh))) {
$header .= $line;
}
Zend_Mime_Decode::splitMessage($header, $this->_headers, $null);
$this->_contentPos[0] = ftell($this->_fh);
if ($endPos !== null) {
$this->_contentPos[1] = $endPos;
} else {
fseek($this->_fh, 0, SEEK_END);
$this->_contentPos[1] = ftell($this->_fh);
}
if (!$this->isMultipart()) {
return;
}
$boundary = $this->getHeaderField('content-type', 'boundary');
if (!$boundary) {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
$part = array();
$pos = $this->_contentPos[0];
fseek($this->_fh, $pos);
while (!feof($this->_fh) && ($endPos === null || $pos < $endPos)) {
$line = fgets($this->_fh);
if ($line === false) {
if (feof($this->_fh)) {
break;
}
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('error reading file');
}
$lastPos = $pos;
$pos = ftell($this->_fh);
$line = trim($line);
if ($line == '--' . $boundary) {
if ($part) {
// not first part
$part[1] = $lastPos;
$this->_partPos[] = $part;
}
$part = array($pos);
} else if ($line == '--' . $boundary . '--') {
$part[1] = $lastPos;
$this->_partPos[] = $part;
break;
}
}
$this->_countParts = count($this->_partPos);
}
/**
* Body of part
*
* If part is multipart the raw content of this part with all sub parts is returned
*
* @return string body
* @throws Zend_Mail_Exception
*/
public function getContent($stream = null)
{
fseek($this->_fh, $this->_contentPos[0]);
if ($stream !== null) {
return stream_copy_to_stream($this->_fh, $stream, $this->_contentPos[1] - $this->_contentPos[0]);
}
$length = $this->_contentPos[1] - $this->_contentPos[0];
return $length < 1 ? '' : fread($this->_fh, $length);
}
/**
* Return size of part
*
* Quite simple implemented currently (not decoding). Handle with care.
*
* @return int size
*/
public function getSize() {
return $this->_contentPos[1] - $this->_contentPos[0];
}
/**
* Get part of multipart message
*
* @param int $num number of part starting with 1 for first part
* @return Zend_Mail_Part wanted part
* @throws Zend_Mail_Exception
*/
public function getPart($num)
{
--$num;
if (!isset($this->_partPos[$num])) {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('part not found');
}
return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0],
'endPos' => $this->_partPos[$num][1]));
}
}
| {'content_hash': '03d3f2fb8e8f55ee4ee9802718e1b67e', 'timestamp': '', 'source': 'github', 'line_count': 180, 'max_line_length': 113, 'avg_line_length': 31.294444444444444, 'alnum_prop': 0.46635895615125156, 'repo_name': 'ankuradhey/dealtrip', 'id': '44919139f2062960dfb1835c7c9f540137969cf4', 'size': '6385', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'library/Zend/Mail/Part/File.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '395'}, {'name': 'CSS', 'bytes': '674987'}, {'name': 'HTML', 'bytes': '2367754'}, {'name': 'JavaScript', 'bytes': '2191952'}, {'name': 'PHP', 'bytes': '16297944'}, {'name': 'Python', 'bytes': '42582'}]} |
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
/*global define: false*/
(function (root, factory) {
// Export to Node, Require.JS, or globally
var mustache = {};
factory(mustache);
// Define plugin
var plugin = function(oj, settings){
if (typeof settings !== 'object') settings = {};
// oj.mustache
return {mustache: function(){
// Union arguments into json and args
var u = oj.unionArguments(arguments), json = u.options, args = u.args, template;
// Handle errors
if (args.length == 0) throw new Error('oj.mustache: template string not found');
else if (Object.keys(json).length == 0) throw new Error('oj.mustache: json object not found');
// Join with newline because JavaScript doesn't support multi-line comments
template = args.join('\n');
return oj.emit(mustache.to_html(template, json));
}};
};
// Export plugin to Node, RequireJS, and Globally
if (typeof module === 'object' && module.exports) module.exports = plugin;
else if (typeof define === "function" && define.amd) define(function(){return plugin});
else root.Mustache = mustache;
// Export to OJ
if (typeof oj != 'undefined') oj.use(plugin);
}(this, function (mustache) {
var whiteRe = /\s*/;
var spaceRe = /\s+/;
var nonSpaceRe = /\S/;
var eqRe = /\s*=/;
var curlyRe = /\s*\}/;
var tagRe = /#|\^|\/|>|\{|&|=|!/;
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
// See https://github.com/janl/mustache.js/issues/189
var RegExp_test = RegExp.prototype.test;
function testRegExp(re, string) {
return RegExp_test.call(re, string);
}
function isWhitespace(string) {
return !testRegExp(nonSpaceRe, string);
}
var Object_toString = Object.prototype.toString;
var isArray = Array.isArray || function (object) {
return Object_toString.call(object) === '[object Array]';
};
function isFunction(object) {
return typeof object === 'function';
}
function escapeRegExp(string) {
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}
var entityMap = {
"&": "&",
"<": "<",
">": ">",
'"': '"',
"'": ''',
"/": '/'
};
function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s];
});
}
function Scanner(string) {
this.string = string;
this.tail = string;
this.pos = 0;
}
/**
* Returns `true` if the tail is empty (end of string).
*/
Scanner.prototype.eos = function () {
return this.tail === "";
};
/**
* Tries to match the given regular expression at the current position.
* Returns the matched text if it can match, the empty string otherwise.
*/
Scanner.prototype.scan = function (re) {
var match = this.tail.match(re);
if (match && match.index === 0) {
var string = match[0];
this.tail = this.tail.substring(string.length);
this.pos += string.length;
return string;
}
return "";
};
/**
* Skips all text until the given regular expression can be matched. Returns
* the skipped string, which is the entire tail if no match can be made.
*/
Scanner.prototype.scanUntil = function (re) {
var index = this.tail.search(re), match;
switch (index) {
case -1:
match = this.tail;
this.tail = "";
break;
case 0:
match = "";
break;
default:
match = this.tail.substring(0, index);
this.tail = this.tail.substring(index);
}
this.pos += match.length;
return match;
};
function Context(view, parent) {
this.view = view == null ? {} : view;
this.parent = parent;
this._cache = { '.': this.view };
}
Context.make = function (view) {
return (view instanceof Context) ? view : new Context(view);
};
Context.prototype.push = function (view) {
return new Context(view, this);
};
Context.prototype.lookup = function (name) {
var value;
if (name in this._cache) {
value = this._cache[name];
} else {
var context = this;
while (context) {
if (name.indexOf('.') > 0) {
value = context.view;
var names = name.split('.'), i = 0;
while (value != null && i < names.length) {
value = value[names[i++]];
}
} else {
value = context.view[name];
}
if (value != null) break;
context = context.parent;
}
this._cache[name] = value;
}
if (isFunction(value)) {
value = value.call(this.view);
}
return value;
};
function Writer() {
this.clearCache();
}
Writer.prototype.clearCache = function () {
this._cache = {};
this._partialCache = {};
};
Writer.prototype.compile = function (template, tags) {
var fn = this._cache[template];
if (!fn) {
var tokens = mustache.parse(template, tags);
fn = this._cache[template] = this.compileTokens(tokens, template);
}
return fn;
};
Writer.prototype.compilePartial = function (name, template, tags) {
var fn = this.compile(template, tags);
this._partialCache[name] = fn;
return fn;
};
Writer.prototype.getPartial = function (name) {
if (!(name in this._partialCache) && this._loadPartial) {
this.compilePartial(name, this._loadPartial(name));
}
return this._partialCache[name];
};
Writer.prototype.compileTokens = function (tokens, template) {
var self = this;
return function (view, partials) {
if (partials) {
if (isFunction(partials)) {
self._loadPartial = partials;
} else {
for (var name in partials) {
self.compilePartial(name, partials[name]);
}
}
}
return renderTokens(tokens, self, Context.make(view), template);
};
};
Writer.prototype.render = function (template, view, partials) {
return this.compile(template)(view, partials);
};
/**
* Low-level function that renders the given `tokens` using the given `writer`
* and `context`. The `template` string is only needed for templates that use
* higher-order sections to extract the portion of the original template that
* was contained in that section.
*/
function renderTokens(tokens, writer, context, template) {
var buffer = '';
// This function is used to render an artbitrary template
// in the current context by higher-order functions.
function subRender(template) {
return writer.render(template, context);
}
var token, tokenValue, value;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
tokenValue = token[1];
switch (token[0]) {
case '#':
value = context.lookup(tokenValue);
if (typeof value === 'object' || typeof value === 'string') {
if (isArray(value)) {
for (var j = 0, jlen = value.length; j < jlen; ++j) {
buffer += renderTokens(token[4], writer, context.push(value[j]), template);
}
} else if (value) {
buffer += renderTokens(token[4], writer, context.push(value), template);
}
} else if (isFunction(value)) {
var text = template == null ? null : template.slice(token[3], token[5]);
value = value.call(context.view, text, subRender);
if (value != null) buffer += value;
} else if (value) {
buffer += renderTokens(token[4], writer, context, template);
}
break;
case '^':
value = context.lookup(tokenValue);
// Use JavaScript's definition of falsy. Include empty arrays.
// See https://github.com/janl/mustache.js/issues/186
if (!value || (isArray(value) && value.length === 0)) {
buffer += renderTokens(token[4], writer, context, template);
}
break;
case '>':
value = writer.getPartial(tokenValue);
if (isFunction(value)) buffer += value(context);
break;
case '&':
value = context.lookup(tokenValue);
if (value != null) buffer += value;
break;
case 'name':
value = context.lookup(tokenValue);
if (value != null) buffer += mustache.escape(value);
break;
case 'text':
buffer += tokenValue;
break;
}
}
return buffer;
}
/**
* Forms the given array of `tokens` into a nested tree structure where
* tokens that represent a section have two additional items: 1) an array of
* all tokens that appear in that section and 2) the index in the original
* template that represents the end of that section.
*/
function nestTokens(tokens) {
var tree = [];
var collector = tree;
var sections = [];
var token;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
switch (token[0]) {
case '#':
case '^':
sections.push(token);
collector.push(token);
collector = token[4] = [];
break;
case '/':
var section = sections.pop();
section[5] = token[2];
collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;
break;
default:
collector.push(token);
}
}
return tree;
}
/**
* Combines the values of consecutive text tokens in the given `tokens` array
* to a single token.
*/
function squashTokens(tokens) {
var squashedTokens = [];
var token, lastToken;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
if (token) {
if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
lastToken[1] += token[1];
lastToken[3] = token[3];
} else {
lastToken = token;
squashedTokens.push(token);
}
}
}
return squashedTokens;
}
function escapeTags(tags) {
return [
new RegExp(escapeRegExp(tags[0]) + "\\s*"),
new RegExp("\\s*" + escapeRegExp(tags[1]))
];
}
/**
* Breaks up the given `template` string into a tree of token objects. If
* `tags` is given here it must be an array with two string values: the
* opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
* course, the default is to use mustaches (i.e. Mustache.tags).
*/
function parseTemplate(template, tags) {
template = template || '';
tags = tags || mustache.tags;
if (typeof tags === 'string') tags = tags.split(spaceRe);
if (tags.length !== 2) throw new Error('Invalid tags: ' + tags.join(', '));
var tagRes = escapeTags(tags);
var scanner = new Scanner(template);
var sections = []; // Stack to hold section tokens
var tokens = []; // Buffer to hold the tokens
var spaces = []; // Indices of whitespace tokens on the current line
var hasTag = false; // Is there a {{tag}} on the current line?
var nonSpace = false; // Is there a non-space char on the current line?
// Strips all whitespace tokens array for the current line
// if there was a {{#tag}} on it and otherwise only space.
function stripSpace() {
if (hasTag && !nonSpace) {
while (spaces.length) {
delete tokens[spaces.pop()];
}
} else {
spaces = [];
}
hasTag = false;
nonSpace = false;
}
var start, type, value, chr, token, openSection;
while (!scanner.eos()) {
start = scanner.pos;
// Match any text between tags.
value = scanner.scanUntil(tagRes[0]);
if (value) {
for (var i = 0, len = value.length; i < len; ++i) {
chr = value.charAt(i);
if (isWhitespace(chr)) {
spaces.push(tokens.length);
} else {
nonSpace = true;
}
tokens.push(['text', chr, start, start + 1]);
start += 1;
// Check for whitespace on the current line.
if (chr == '\n') stripSpace();
}
}
// Match the opening tag.
if (!scanner.scan(tagRes[0])) break;
hasTag = true;
// Get the tag type.
type = scanner.scan(tagRe) || 'name';
scanner.scan(whiteRe);
// Get the tag value.
if (type === '=') {
value = scanner.scanUntil(eqRe);
scanner.scan(eqRe);
scanner.scanUntil(tagRes[1]);
} else if (type === '{') {
value = scanner.scanUntil(new RegExp('\\s*' + escapeRegExp('}' + tags[1])));
scanner.scan(curlyRe);
scanner.scanUntil(tagRes[1]);
type = '&';
} else {
value = scanner.scanUntil(tagRes[1]);
}
// Match the closing tag.
if (!scanner.scan(tagRes[1])) throw new Error('Unclosed tag at ' + scanner.pos);
token = [type, value, start, scanner.pos];
tokens.push(token);
if (type === '#' || type === '^') {
sections.push(token);
} else if (type === '/') {
// Check section nesting.
openSection = sections.pop();
if (!openSection) {
throw new Error('Unopened section "' + value + '" at ' + start);
}
if (openSection[1] !== value) {
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
}
} else if (type === 'name' || type === '{' || type === '&') {
nonSpace = true;
} else if (type === '=') {
// Set the tags for the next time around.
tags = value.split(spaceRe);
if (tags.length !== 2) {
throw new Error('Invalid tags at ' + start + ': ' + tags.join(', '));
}
tagRes = escapeTags(tags);
}
}
// Make sure there are no open sections when we're done.
openSection = sections.pop();
if (openSection) {
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
}
return nestTokens(squashTokens(tokens));
}
mustache.name = "mustache.js";
mustache.version = "0.7.3";
mustache.tags = ["{{", "}}"];
mustache.Scanner = Scanner;
mustache.Context = Context;
mustache.Writer = Writer;
mustache.parse = parseTemplate;
// Export the escaping function so that the user may override it.
// See https://github.com/janl/mustache.js/issues/244
mustache.escape = escapeHtml;
// All Mustache.* functions use this writer.
var defaultWriter = new Writer();
/**
* Clears all cached templates and partials in the default writer.
*/
mustache.clearCache = function () {
return defaultWriter.clearCache();
};
/**
* Compiles the given `template` to a reusable function using the default
* writer.
*/
mustache.compile = function (template, tags) {
return defaultWriter.compile(template, tags);
};
/**
* Compiles the partial with the given `name` and `template` to a reusable
* function using the default writer.
*/
mustache.compilePartial = function (name, template, tags) {
return defaultWriter.compilePartial(name, template, tags);
};
/**
* Compiles the given array of tokens (the output of a parse) to a reusable
* function using the default writer.
*/
mustache.compileTokens = function (tokens, template) {
return defaultWriter.compileTokens(tokens, template);
};
/**
* Renders the `template` with the given `view` and `partials` using the
* default writer.
*/
mustache.render = function (template, view, partials) {
return defaultWriter.render(template, view, partials);
};
// This is here for backwards compatibility with 0.4.x.
mustache.to_html = function (template, view, partials, send) {
var result = mustache.render(template, view, partials);
if (isFunction(send)) {
send(result);
} else {
return result;
}
};
}));
| {'content_hash': '8f855481e799e77f1e439b4662ba26cc', 'timestamp': '', 'source': 'github', 'line_count': 574, 'max_line_length': 100, 'avg_line_length': 27.714285714285715, 'alnum_prop': 0.5766281116419412, 'repo_name': 'ojjs/oj.mustache', 'id': '96ab65adc055cecec1b464919c0c270380a8ce13', 'size': '15908', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'oj.mustache.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '15908'}]} |
module Facter::Util::Macaddress
def self.standardize(macaddress)
return nil unless macaddress
macaddress.split(":").map{|x| "0#{x}"[-2..-1]}.join(":")
end
module Darwin
def self.macaddress
iface = default_interface
Facter.warn "Could not find a default route. Using first non-loopback interface" if iface.empty?
macaddress = `#{ifconfig_command} #{iface} | /usr/bin/awk '/ether/{print $2;exit}'`.chomp
macaddress.empty? ? nil : macaddress
end
def self.default_interface
`#{netstat_command} | /usr/bin/awk '/^default/{print $6;exit}'`.chomp
end
private
def self.netstat_command
'/usr/sbin/netstat -rn'
end
def self.ifconfig_command
'/sbin/ifconfig'
end
end
module Windows
def macaddress
require 'facter/util/wmi'
query = "select MACAddress from Win32_NetworkAdapterConfiguration where IPEnabled = True"
ether = nil
Facter::Util::WMI.execquery(query).each do |nic|
ether = nic.MacAddress
break
end
ether
end
module_function :macaddress
end
end
| {'content_hash': '74c7edb315b21a50e82e8b3c409dfceb', 'timestamp': '', 'source': 'github', 'line_count': 47, 'max_line_length': 102, 'avg_line_length': 23.72340425531915, 'alnum_prop': 0.6394618834080718, 'repo_name': 'phatpenguin/boxen-belgarion', 'id': '82470ec41cb8d75c2caaa4ed060ce74ef61a7235', 'size': '1155', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': '.bundle/ruby/1.8/gems/facter-1.6.17/lib/facter/util/macaddress.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Augeas', 'bytes': '1424'}, {'name': 'C', 'bytes': '568976'}, {'name': 'CSS', 'bytes': '8916'}, {'name': 'Emacs Lisp', 'bytes': '29522'}, {'name': 'Java', 'bytes': '570780'}, {'name': 'Pascal', 'bytes': '1016'}, {'name': 'Puppet', 'bytes': '119715'}, {'name': 'Python', 'bytes': '7514'}, {'name': 'Ragel in Ruby Host', 'bytes': '242384'}, {'name': 'Ruby', 'bytes': '17618641'}, {'name': 'Shell', 'bytes': '71164'}, {'name': 'VimL', 'bytes': '19010'}]} |
package clients;
import edu.ucsb.jpregel.system.VertexSources;
import edu.ucsb.jpregel.system.WorkerOutputMakerStandard;
import edu.ucsb.jpregel.system.MasterOutputMakerStandard;
import edu.ucsb.jpregel.system.ClientToMaster;
import edu.ucsb.jpregel.system.MasterGraphMakerStandard;
import edu.ucsb.jpregel.system.WorkerGraphMakerStandard;
import edu.ucsb.jpregel.system.Job;
import edu.ucsb.jpregel.system.LocalReservationService;
public class SourcesLocalClient
{
/**
* @param args [0]: Job directory name
*/
public static void main( String[] args ) throws Exception
{
Job job = new Job(
"Identify source nodes", // jobName
args[0], // jobDirectoryName
new VertexSources(), // vertexFactory
new MasterGraphMakerStandard(),
new WorkerGraphMakerStandard(),
new MasterOutputMakerStandard(),
new WorkerOutputMakerStandard()
);
int numWorkers = 1;
System.out.println( job + "\n numWorkers: " + numWorkers );
ClientToMaster master = LocalReservationService.newCluster( numWorkers );
System.out.println( master.run( job ) );
System.exit( 0 );
}
} | {'content_hash': '4c734840eba136c509f424a4bdae3dc7', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 81, 'avg_line_length': 39.42424242424242, 'alnum_prop': 0.6356648731744812, 'repo_name': 'charlesmunger/jpregel-aws', 'id': '51b269cff4704a33bbabc8a28f043f2af8171b48', 'size': '1301', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/clients/SourcesLocalClient.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '343905'}, {'name': 'Shell', 'bytes': '565'}]} |
--TEST--
ReflectionMethod::getDocComment() uses wrong comment block
--INI--
opcache.save_comments=1
--FILE--
<?php
function strip_doc_comment($c)
{
if (!strlen($c) || $c === false) return $c;
return trim(substr($c, 3, -2));
}
/** Comment for class A */
class A
{
/** Method A::bla()
*/
function bla()
{
}
function foo() {
/**
* This is a valid comment inside a method
*/
}
function bar() {
// I don't have a doc comment....
}
/**
* Comment for A::baz()
*/
function baz() {
}
}
$r = new ReflectionClass('A');
var_dump(strip_doc_comment($r->getDocComment()));
foreach($r->getMethods() as $m)
{
var_dump(strip_doc_comment($m->getDocComment()));
}
?>
===DONE===
--EXPECT--
string(19) "Comment for class A"
string(15) "Method A::bla()"
bool(false)
bool(false)
string(22) "* Comment for A::baz()"
===DONE===
| {'content_hash': 'd199401b43abb0a6cfb4ca11caf8cace', 'timestamp': '', 'source': 'github', 'line_count': 56, 'max_line_length': 58, 'avg_line_length': 15.875, 'alnum_prop': 0.562429696287964, 'repo_name': 'asgrim/better-reflection', 'id': 'e40fcc30992dfd7cdcd315a802771725b4374ac6', 'size': '889', 'binary': False, 'copies': '5', 'ref': 'refs/heads/5.4.x', 'path': 'test/core/005.phpt', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '1277968'}, {'name': 'Shell', 'bytes': '66'}]} |
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/babydrum1" android:duration="300" />
<item android:drawable="@drawable/babydrum2" android:duration="300" />
<item android:drawable="@drawable/babydrum3" android:duration="300" />
</animation-list>
| {'content_hash': '6b11ec966db0823ee4577466db5fe6ac', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 74, 'avg_line_length': 56.833333333333336, 'alnum_prop': 0.7419354838709677, 'repo_name': 'oixhwotl/RecursoDeAndroidProgramming', 'id': '0b776149d4a7c8694bd0adb670d7bd6e9dcc296d', 'size': '341', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'REF/AndExam4_1/res/drawable-nodpi/babydrum.xml', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '22586'}, {'name': 'C', 'bytes': '3152'}, {'name': 'C#', 'bytes': '396582'}, {'name': 'C++', 'bytes': '433954'}, {'name': 'CSS', 'bytes': '2373955'}, {'name': 'Groff', 'bytes': '16446'}, {'name': 'HTML', 'bytes': '67259'}, {'name': 'Java', 'bytes': '4072644'}, {'name': 'JavaScript', 'bytes': '5704207'}, {'name': 'Makefile', 'bytes': '22176'}, {'name': 'Objective-C', 'bytes': '638417'}, {'name': 'QML', 'bytes': '14604'}]} |
import 'rxjs/add/operator/let';
import {Component, ChangeDetectionStrategy, NgModule} from '@angular/core';
import {
Router,
Event as RouterEvent,
NavigationStart,
NavigationEnd,
NavigationCancel,
NavigationError
} from '@angular/router';
import {Http} from '@angular/http';
@Component({
selector: 'indigo-app',
styles: [` `],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="loading-overlay" *ngIf="loading">
<!-- show something fancy here, here with Angular 2 Material's loading bar or circle -->
<md-progress-bar mode="indeterminate"></md-progress-bar>
</div>
<router-outlet></router-outlet>
`
})
export class AppComponent {
loading: boolean = true;
constructor(private router: Router) {
router.events.subscribe((event: RouterEvent) => {
this.navigationInterceptor(event);
});
}
navigationInterceptor(event: RouterEvent): void {
if (event instanceof NavigationStart) {
this.loading = true;
}
if (event instanceof NavigationEnd) {
this.loading = false;
}
// Set loading state to false in both of the below events to hide the spinner in case a request fails
if (event instanceof NavigationCancel) {
this.loading = false;
}
if (event instanceof NavigationError) {
this.loading = false;
}
}
}
| {'content_hash': 'd889fc9b365e9975244f2742f9f1737e', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 105, 'avg_line_length': 21.5, 'alnum_prop': 0.6656976744186046, 'repo_name': 'larjohn/obeu-indicators', 'id': '04525ea3edbc677eea476a17824e9209ae59a4fb', 'size': '1376', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/app/containers/app.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '11607'}, {'name': 'JavaScript', 'bytes': '3658'}, {'name': 'TypeScript', 'bytes': '158442'}]} |
package com.gkirico.gym_sheet;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by gkirico on 03.05.15.
*/
public class SheetItemAdapter extends RecyclerView.Adapter<SheetItemAdapter.ViewHolder> {
private List<String> mDataSet;
public SheetItemAdapter() {
mDataSet = new ArrayList<>();
Random rand = new Random();
for (int i = 0; i < 30; i++) {
mDataSet.add(Integer.toString(rand.nextInt(100)));
}
}
@Override
public SheetItemAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.my_card_view, viewGroup, false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int i) {
holder.mTextView.setText(mDataSet.get(i));
}
@Override
public int getItemCount() {
return mDataSet.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public TextView mTextView;
public ViewHolder(View v) {
super(v);
mTextView = (TextView) v.findViewById(R.id.cv_title);
}
}
}
| {'content_hash': 'da914b82c3c06cd6adc040d235a73d2b', 'timestamp': '', 'source': 'github', 'line_count': 58, 'max_line_length': 110, 'avg_line_length': 24.637931034482758, 'alnum_prop': 0.6627011896431071, 'repo_name': 'gkirico/gym-sheet', 'id': '2117b2fc9817784b480b1baa99964360fe1a836d', 'size': '1429', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/java/com/gkirico/gym_sheet/SheetItemAdapter.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '3439'}]} |
/**
* Created by wuhao on 2017-03-17.
*/
module.exports = function (app) {
var mongoose = require("mongoose");
mongoose.Promise = require('q').Promise;
var PageSchema = require("./page.schema.server")();
var PageModel = mongoose.model("PageModel", PageSchema);
var api = {
"createPage": createPage,
"findAllPagesForWebsite": findAllPagesForWebsite,
"findPageById": findPageById,
"updatePage": updatePage,
"deletePage": deletePage
};
return api;
function createPage(websiteId, page) {
page._website = websiteId;
return PageModel.create(page);
}
function findAllPagesForWebsite(websiteId) {
return PageModel.find({_website: websiteId});
}
function findPageById(pageId) {
return PageModel.findById(pageId);
}
function updatePage(pageId, page) {
return PageModel.update({_id: pageId}, {$set: page});
}
function deletePage(pageId) {
return PageModel.remove({_id: pageId});
}
}; | {'content_hash': 'dc6c4d0f99491b078b532fec0cc8f56e', 'timestamp': '', 'source': 'github', 'line_count': 40, 'max_line_length': 61, 'avg_line_length': 25.925, 'alnum_prop': 0.6258437801350049, 'repo_name': 'wuhao4u/wu-hao-webdev', 'id': 'a8b5d43beb69eeaa7b398bdf76555bff6a03cb8c', 'size': '1037', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'assignment/model/page/page.model.server.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '8873'}, {'name': 'HTML', 'bytes': '88804'}, {'name': 'JavaScript', 'bytes': '149531'}]} |
import * as React from 'react';
import { StandardProps } from '..';
export interface DialogTitleProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, DialogTitleClassKey> {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* If `true`, the children won't be wrapped by a typography component.
* For instance, this can be useful to render an h4 instead of the default h2.
*/
disableTypography?: boolean;
}
export type DialogTitleClassKey = 'root';
/**
*
* Demos:
*
* - [Dialogs](https://material-ui.com/components/dialogs/)
*
* API:
*
* - [DialogTitle API](https://material-ui.com/api/dialog-title/)
*/
export default function DialogTitle(props: DialogTitleProps): JSX.Element;
| {'content_hash': '96375dfb2d32d64cbfc8d59a706f7965', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 84, 'avg_line_length': 25.75862068965517, 'alnum_prop': 0.6974564926372155, 'repo_name': 'cdnjs/cdnjs', 'id': '1a62caf74c7acd14a3aad8b4d452b350b5d304f4', 'size': '747', 'binary': False, 'copies': '22', 'ref': 'refs/heads/master', 'path': 'ajax/libs/material-ui/4.10.2/DialogTitle/DialogTitle.d.ts', 'mode': '33188', 'license': 'mit', 'language': []} |
<a href='https://github.com/angular/angular.js/edit/v1.4.x/docs/content/error/$compile/nonassign.ngdoc?message=docs(error%2Fnonassign)%3A%20describe%20your%20change...' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a>
<h1>Error: $compile:nonassign
<div><span class='hint'>Non-Assignable Expression</span></div>
</h1>
<div>
<pre class="minerr-errmsg" error-display="Expression '{0}' used with directive '{1}' is non-assignable!">Expression '{0}' used with directive '{1}' is non-assignable!</pre>
</div>
<h2>Description</h2>
<div class="description">
<p>This error occurs when a directive defines an isolate scope property
(using the <code>=</code> mode in the <a href="api/ng/service/$compile#directive-definition-object"><code>scope</code> option</a> of a directive definition) but the directive is used with an expression that is not-assignable.</p>
<p>In order for the two-way data-binding to work, it must be possible to write new values back into the path defined with the expression.</p>
<p>For example, given a directive:</p>
<pre><code>myModule.directive('myDirective', function factory() {
return {
...
scope: {
localValue: '=bind'
}
...
}
});
</code></pre>
<p>Following are invalid uses of this directive:</p>
<pre><code><!-- ERROR because `1+2=localValue` is an invalid statement -->
<my-directive bind="1+2">
<!-- ERROR because `myFn()=localValue` is an invalid statement -->
<my-directive bind="myFn()">
<!-- ERROR because attribute bind wasn't provided -->
<my-directive>
</code></pre>
<p>To resolve this error, do one of the following options:</p>
<ul>
<li>use path expressions with scope properties that are two-way data-bound like so:</li>
</ul>
<pre><code><my-directive bind="some.property">
<my-directive bind="some[3]['property']">
</code></pre>
<ul>
<li>Make the binding optional</li>
</ul>
<pre><code>myModule.directive('myDirective', function factory() {
return {
...
scope: {
localValue: '=?bind' // <-- the '?' makes it optional
}
...
}
});
</code></pre>
</div>
| {'content_hash': 'dc9e865091809695eff8397d0b28cea1', 'timestamp': '', 'source': 'github', 'line_count': 61, 'max_line_length': 272, 'avg_line_length': 36.950819672131146, 'alnum_prop': 0.6814551907719609, 'repo_name': 'seniya/angular_demo', 'id': '16ff7c6d8135447f90e531a0c32abb61477e9393', 'size': '2254', 'binary': False, 'copies': '78', 'ref': 'refs/heads/master', 'path': 'angular_demo/WebContent/lib/angular-1.4.4/docs/partials/error/$compile/nonassign.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '314337'}, {'name': 'CoffeeScript', 'bytes': '83631'}, {'name': 'HTML', 'bytes': '6372454'}, {'name': 'JavaScript', 'bytes': '2227620'}, {'name': 'Makefile', 'bytes': '285'}, {'name': 'Shell', 'bytes': '2624'}]} |
package com.amazonaws.services.cognitosync;
import javax.annotation.Generated;
import com.amazonaws.services.cognitosync.model.*;
import com.amazonaws.*;
/**
* Abstract implementation of {@code AmazonCognitoSync}. Convenient method forms pass through to the corresponding
* overload that takes a request object, which throws an {@code UnsupportedOperationException}.
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AbstractAmazonCognitoSync implements AmazonCognitoSync {
protected AbstractAmazonCognitoSync() {
}
@Override
public void setEndpoint(String endpoint) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public void setRegion(com.amazonaws.regions.Region region) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BulkPublishResult bulkPublish(BulkPublishRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DeleteDatasetResult deleteDataset(DeleteDatasetRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DescribeDatasetResult describeDataset(DescribeDatasetRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DescribeIdentityPoolUsageResult describeIdentityPoolUsage(DescribeIdentityPoolUsageRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DescribeIdentityUsageResult describeIdentityUsage(DescribeIdentityUsageRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetBulkPublishDetailsResult getBulkPublishDetails(GetBulkPublishDetailsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetCognitoEventsResult getCognitoEvents(GetCognitoEventsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetIdentityPoolConfigurationResult getIdentityPoolConfiguration(GetIdentityPoolConfigurationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListDatasetsResult listDatasets(ListDatasetsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListIdentityPoolUsageResult listIdentityPoolUsage(ListIdentityPoolUsageRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListRecordsResult listRecords(ListRecordsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public RegisterDeviceResult registerDevice(RegisterDeviceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public SetCognitoEventsResult setCognitoEvents(SetCognitoEventsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public SetIdentityPoolConfigurationResult setIdentityPoolConfiguration(SetIdentityPoolConfigurationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public SubscribeToDatasetResult subscribeToDataset(SubscribeToDatasetRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public UnsubscribeFromDatasetResult unsubscribeFromDataset(UnsubscribeFromDatasetRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public UpdateRecordsResult updateRecords(UpdateRecordsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public void shutdown() {
throw new java.lang.UnsupportedOperationException();
}
@Override
public com.amazonaws.ResponseMetadata getCachedResponseMetadata(com.amazonaws.AmazonWebServiceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
}
| {'content_hash': 'b9379cb13077a3602ab2f0c8705d8522', 'timestamp': '', 'source': 'github', 'line_count': 124, 'max_line_length': 121, 'avg_line_length': 33.04838709677419, 'alnum_prop': 0.7601268911664226, 'repo_name': 'aws/aws-sdk-java', 'id': 'b893309f74b032cf7ab3901fd5cbef96a171cd3e', 'size': '4678', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'aws-java-sdk-cognitosync/src/main/java/com/amazonaws/services/cognitosync/AbstractAmazonCognitoSync.java', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
/**
*
*/
package gov.nih.nci.calims2.ui.inventory.antibody;
import static org.junit.Assert.assertEquals;
import java.util.Locale;
import org.junit.Test;
import org.springframework.web.servlet.ModelAndView;
import gov.nih.nci.calims2.business.common.type.TypeEnumeration;
import gov.nih.nci.calims2.domain.administration.Location;
import gov.nih.nci.calims2.domain.administration.Organization;
import gov.nih.nci.calims2.domain.administration.Person;
import gov.nih.nci.calims2.domain.administration.StandardUnit;
import gov.nih.nci.calims2.domain.common.Type;
import gov.nih.nci.calims2.domain.inventory.Antibody;
import gov.nih.nci.calims2.domain.inventory.Antigen;
import gov.nih.nci.calims2.domain.inventory.Container;
import gov.nih.nci.calims2.domain.inventory.ContainerSubcategory;
import gov.nih.nci.calims2.domain.inventory.ContainerType;
import gov.nih.nci.calims2.domain.inventory.FillPattern;
import gov.nih.nci.calims2.domain.inventory.Specimen;
import gov.nih.nci.calims2.domain.inventory.Taxon;
import gov.nih.nci.calims2.ui.generic.crud.CRUDAssert;
import gov.nih.nci.calims2.ui.generic.crud.CRUDTableDecorator;
import gov.nih.nci.calims2.ui.inventory.quantity.QuantityHelperMockup;
import gov.nih.nci.calims2.ui.util.GenericServiceMockup;
/**
* @author connollym
*
*/
public class AntibodyControllerTest {
/**
* Test the controller constructor.
*/
@Test
public void testConstructor() {
AntibodyController controller = new AntibodyController();
CRUDAssert.assertControllerConstructor(controller, AntibodyController.URL_PREFIX, "inventory.antibody.", "name",
Antibody.class, AntibodyForm.class, CRUDTableDecorator.class);
}
/**
* Test the controller completeDetailsModel method.
*/
@Test
public void testCompleteDetailsModel() {
AntibodyController controller = new AntibodyController();
QuantityHelperMockup quantityHelper = new QuantityHelperMockup();
controller.setQuantityHelper(quantityHelper);
ModelAndView model = new ModelAndView();
AntibodyForm form = new AntibodyForm();
form.setEntity(new Antibody());
model.addObject("form", form);
ModelAndView result = controller.completeDetailsModel(model, Locale.US);
assertEquals("Wrong model returned", model, result);
CRUDAssert.assertQuantities(model, quantityHelper, TypeEnumeration.SPECIMEN_QUANTITY, false);
}
/**
* Test the controller completeEditModel method.
*/
@SuppressWarnings("unchecked")
@Test
public void testCompleteEditModel() {
AntibodyController controller = new AntibodyController();
GenericServiceMockup<Antigen> antigenService = new GenericServiceMockup<Antigen>();
controller.setAntigenService(antigenService);
GenericServiceMockup<Container> containerService = new GenericServiceMockup<Container>();
controller.setContainerService(containerService);
GenericServiceMockup<ContainerSubcategory> containerSubcategoryService = new GenericServiceMockup<ContainerSubcategory>();
controller.setContainerSubcategoryService(containerSubcategoryService);
GenericServiceMockup<ContainerType> containerTypeService = new GenericServiceMockup<ContainerType>();
controller.setContainerTypeService(containerTypeService);
GenericServiceMockup<FillPattern> fillPatternService = new GenericServiceMockup<FillPattern>();
controller.setFillPatternService(fillPatternService);
GenericServiceMockup<Location> locationService = new GenericServiceMockup<Location>();
controller.setLocationService(locationService);
GenericServiceMockup<Organization> organizationService = new GenericServiceMockup<Organization>();
controller.setOrganizationService(organizationService);
GenericServiceMockup<Person> personService = new GenericServiceMockup<Person>();
controller.setPersonService(personService);
QuantityHelperMockup quantityHelper = new QuantityHelperMockup();
controller.setQuantityHelper(quantityHelper);
GenericServiceMockup<Specimen> specimenService = new GenericServiceMockup<Specimen>();
controller.setMainService((GenericServiceMockup) specimenService);
GenericServiceMockup<Taxon> taxonService = new GenericServiceMockup<Taxon>();
controller.setTaxonService(taxonService);
GenericServiceMockup<Type> typeService = new GenericServiceMockup<Type>();
controller.setTypeService(typeService);
GenericServiceMockup<StandardUnit> unitService = new GenericServiceMockup<StandardUnit>();
controller.setUnitService(unitService);
ModelAndView model = new ModelAndView();
AntibodyForm form = new AntibodyForm();
model.addObject("form", form);
ModelAndView result = controller.completeEditModel(model, Locale.US);
assertEquals("Wrong model returned", model, result);
String containerQueryName = Container.class.getName() + ".findContainersForSpecimenCreation";
CRUDAssert.assertNamedQuery(result, containerService, 0, containerQueryName, "containers");
CRUDAssert.assertFindAll(antigenService, Antigen.class, "name", "antigens", result);
CRUDAssert.assertFindAll(containerSubcategoryService, ContainerSubcategory.class, "name", "containerSubcategories", result);
CRUDAssert.assertFindAll(containerTypeService, ContainerType.class, "name", "containerTypes", result);
CRUDAssert.assertFindAll(fillPatternService, FillPattern.class, "name", "fillPatterns", result);
CRUDAssert.assertFindAll(locationService, Location.class, "name", "locations", result);
CRUDAssert.assertFindAll(organizationService, Organization.class, "name", "organizations", result);
CRUDAssert.assertFindAll(personService, Person.class, "familyName", "persons", result);
CRUDAssert.assertFindAll(specimenService, Specimen.class, "name", "specimens", result);
CRUDAssert.assertFindAll(taxonService, Taxon.class, "name", "taxons", result);
CRUDAssert.assertTypes(typeService, TypeEnumeration.ANTIBODY, "types", result);
CRUDAssert.assertQuantities(model, quantityHelper, TypeEnumeration.SPECIMEN_QUANTITY, true);
}
}
| {'content_hash': '462dcc32fd67fa22796ac6c7e47564da', 'timestamp': '', 'source': 'github', 'line_count': 122, 'max_line_length': 128, 'avg_line_length': 49.5, 'alnum_prop': 0.7920185461169068, 'repo_name': 'NCIP/calims', 'id': '2c22384d420723023f68b5f35d05dedb3cae5883', 'size': '6203', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'calims2-webapp/test/unit/java/gov/nih/nci/calims2/ui/inventory/antibody/AntibodyControllerTest.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ActionScript', 'bytes': '21071'}, {'name': 'Groovy', 'bytes': '18022'}, {'name': 'Java', 'bytes': '3560462'}, {'name': 'JavaScript', 'bytes': '9753998'}, {'name': 'Logos', 'bytes': '2499369'}, {'name': 'PHP', 'bytes': '558478'}, {'name': 'Perl', 'bytes': '12068'}, {'name': 'Racket', 'bytes': '2236'}, {'name': 'Ruby', 'bytes': '5391'}, {'name': 'Shell', 'bytes': '26208'}, {'name': 'XML', 'bytes': '295031'}]} |
NSString * const A0EmailValidatorIdentifer = @"A0EmailValidatorIdentifer";
@interface A0EmailValidator ()
@property (copy, nonatomic) A0EmailValidatorSourceBlock emailSource;
@property (strong, nonatomic) NSPredicate *emailPredicate;
@end
@implementation A0EmailValidator
@synthesize identifier = _identifier;
- (instancetype)init {
[self doesNotRecognizeSelector:_cmd];
return [self initWithSource:^NSString * _Nullable {
return nil;
}];
}
- (instancetype)initWithSource:(A0EmailValidatorSourceBlock)source {
self = [super init];
if (self) {
_emailSource = [source copy];
NSString *emailRegex = @"[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?";
_emailPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
_identifier = A0EmailValidatorIdentifer;
}
return self;
}
- (instancetype)initWithField:(UITextField *)field {
return [self initWithSource:^NSString * _Nullable{
return field.text;
}];
}
- (NSError *)validate {
NSString *trimmedEmail = [self.emailSource() stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
BOOL valid = [self.emailPredicate evaluateWithObject:trimmedEmail];
return valid ? nil : [A0Errors invalidEmail];
}
@end
| {'content_hash': 'd62147769ba9998419fafe9373d149aa', 'timestamp': '', 'source': 'github', 'line_count': 42, 'max_line_length': 194, 'avg_line_length': 33.54761904761905, 'alnum_prop': 0.6713981547196594, 'repo_name': 'madison-kerndt/native', 'id': 'ff56dd542901430956dda011ec141901f62f770c', 'size': '2608', 'binary': False, 'copies': '13', 'ref': 'refs/heads/master', 'path': 'native/ios/Pods/Lock/Lock/CoreUI/A0EmailValidator.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '1433'}, {'name': 'JavaScript', 'bytes': '17209'}, {'name': 'Objective-C', 'bytes': '1465561'}, {'name': 'Python', 'bytes': '1637'}, {'name': 'Ruby', 'bytes': '115'}, {'name': 'Shell', 'bytes': '8617'}]} |
require 'ostruct'
module YARD
module Tags
# The base directive class. Subclass this class to create a custom
# directive, registering it with {Library.define_directive}. Directive
# classes are executed via the {#call} method, which perform all directive
# processing on the object.
#
# If processing occurs within a handler, the {#handler} attribute is
# available to access more information about parsing context and state.
# Handlers are only available when parsing from {Parser::SourceParser},
# not when parsing directly from {DocstringParser}. If the docstring is
# attached to an object declaration, {#object} will be set and available
# to modify the generated code object directly. Note that both of these
# attributes may be nil, and directives should test their existence
# before attempting to use them.
#
# @abstract Subclasses should implement {#call}.
# @see Library.define_directive
# @since 0.8.0
class Directive
# @return [Tag] the meta-data tag containing data input to the directive
attr_accessor :tag
# Set this field to replace the directive definition inside of a docstring
# with arbitrary text. For instance, the {MacroDirective} uses this field
# to expand its macro data in place of the call to a +@!macro+.
#
# @return [String] the text to expand in the original docstring in place
# of this directive definition.
# @return [nil] if no expansion should take place for this directive
attr_accessor :expanded_text
# @return [DocstringParser] the parser that is parsing all tag
# information out of the docstring
attr_accessor :parser
# @!attribute [r] object
# @return [CodeObjects::Base, nil] the object the parent docstring is
# attached to. May be nil.
def object; parser.object end
# @!attribute [r] handler
# @return [Handlers::Base, nil] the handler object the docstring parser
# might be attached to. May be nil. Only available when parsing
# through {Parser::SourceParser}.
def handler; parser.handler end
# @!endgroup
# @param [Tag] tag the meta-data tag containing all input to the docstring
# @param [DocstringParser] parser the docstring parser object
def initialize(tag, parser)
self.tag = tag
self.parser = parser
self.expanded_text = nil
end
# @!group Parser callbacks
# Called when processing the directive. Subclasses should implement
# this method to perform all functionality of the directive.
#
# @abstract implement this method to perform all data processing for
# the directive.
# @return [void]
def call; raise NotImplementedError end
# Called after parsing all directives and tags in the docstring. Used
# to perform any cleanup after all directives perform their main task.
# @return [void]
def after_parse; end
protected :parser
end
# Ends a group listing definition. Group definition automatically end
# when class or module blocks are closed, and defining a new group overrides
# the last group definition, but occasionally you need to end the current
# group to return to the default listing. Use {tag:!group} to begin a
# group listing.
#
# @example
# class Controller
# # @!group Callbacks
#
# def before_filter; end
# def after_filter; end
#
# # @!endgroup
#
# def index; end
# end
# @see tag:!group
# @since 0.6.0
class EndGroupDirective < Directive
def call
return unless handler
handler.extra_state.group = nil
end
end
# Defines a group listing. All methods (and attributes) seen after this
# directive are placed into a group with the given description as the
# group name. The group listing is used by templates to organize methods
# and attributes into respective logical groups. To end a group listing
# use {tag:!endgroup}.
#
# @note A group definition only applies to the scope it is defined in.
# If a new class or module is opened after the directive, this directive
# will not apply to methods in that class or module.
# @example
# # @!group Callbacks
#
# def before_filter; end
# def after_filter; end
# @see tag:!endgroup
# @since 0.6.0
class GroupDirective < Directive
def call
return unless handler
handler.extra_state.group = tag.text
end
end
# Defines a block of text to be expanded whenever the macro is called by name
# in subsequent docstrings. The macro data can be any arbitrary text data, be
# it regular documentation, meta-data tags or directives.
#
# == Defining a Macro
#
# A macro must first be defined in order to be used. Note that a macro is also
# expanded upon definition if it defined on an object (the docstring of a
# method, class, module or constant object as opposed to a free standing
# comment). To define a macro, use the "new" or "attach" identifier in the
# types specifier list. A macro will also automatically be created if an
# indented macro data block is given, so the keywords are not strictly needed.
#
# === Anonymous Macros
#
# In addition to standard named macros, macros can be defined anonymously if
# no name is given. In this case, they can not be re-used in future docstrings,
# but they will expand in the first definition. This is useful when needing
# to take advantage of the macro expansion variables (described below).
#
# == Using a Macro
#
# To re-use a macro in another docstring after it is defined, simply use
# <tt>@!macro the_name</tt> with no indented block of macro data. The resulting
# data will be expanded in place.
#
# == Attaching a Macro to a DSL Method
#
# Macros can be defined to auto-expand on DSL-style class method calls. To
# define a macro to be auto expanded in this way, use the "attach" keyword
# in the type specifier list ("new" is implied).
#
# Attached macros can also be attached directly on the class method declaration
# that provides the DSL method to its subclasses. The syntax in either case
# is the same.
#
# == Macro Expansion Variables
#
# In the case of using macros on DSL-style method calls, a number of expansion
# variables can be used for interpolation inside of the macro data. The variables,
# similar in syntax to Ruby's global variables, are as follows:
#
# * $0 - the method name being called
# * $1, $2, $3, ... - the Nth argument in the method call
# * $& - the full source line
#
# The following example shows what the expansion variables might hold for a given
# DSL method call:
#
# property :foo, :a, :b, :c, String
# # $0 => "property"
# # $1 => "foo"
# # $2 => "a"
# # $& => "property :foo, :a, :b, :c, String"
#
# === Ranges
#
# Ranges are also acceptable with the syntax <tt>${N-M}</tt>. Negative values
# on either N or M are valid, and refer to indexes from the end of the list.
# Consider a DSL method that creates a method using the first argument with
# argument names following, ending with the return type of the method. This
# could be documented as:
#
# # @!macro dsl_method
# # @!method $1(${2--2})
# # @return [${-1}] the return value of $0
# create_method_with_args :foo, :a, :b, :c, String
#
# As described, the method is using the signature <tt>foo(a, b, c)</tt> and the return
# type from the last argument, +String+. When using ranges, tokens are joined
# with commas. Note that this includes using $0:
#
# !!!plain
# $0-1 # => Interpolates to "create_method_with_args, foo"
#
# If you want to separate them with spaces, use <tt>$1 $2 $3 $4 ...</tt>. Note that
# if the token cannot be expanded, it will return the empty string (not an error),
# so it would be safe to list <tt>$1 $2 ... $10</tt>, for example.
#
# === Escaping Interpolation
#
# Interpolation can be escaped by prefixing the +$+ with +\\\+, like so:
#
# # @!macro foo
# # I have \$2.00 USD.
#
# @example Defining a simple macro
# # @!macro [new] returnself
# # @return [self] returns itself
# @example Using a simple macro in multiple docstrings
# # Documentation for map
# # ...
# # @macro returnself
# def map; end
#
# # Documentation for filter
# # ...
# # @macro returnself
# def filter; end
# @example Attaching a macro to a class method (for DSL usage)
# class Resource
# # Defines a new property
# # @param [String] name the property name
# # @param [Class] type the property's type
# # @!macro [attach] property
# # @return [$2] the $1 property
# def self.property(name, type) end
# end
#
# class Post < Resource
# property :title, String
# property :view_count, Integer
# end
# @example Attaching a macro directly to a DSL method
# class Post < Resource
# # @!macro [attach] property
# # @return [$2] the $1 property
# property :title, String
#
# # Macro will expand on this definition too
# property :view_count, Integer
# end
# @since 0.7.0
class MacroDirective < Directive
def call
raise TagFormatError if tag.name.nil? && tag.text.to_s.empty?
macro_data = find_or_create
unless macro_data
warn
return
end
self.expanded_text = expand(macro_data)
end
private
def new?
(tag.types && tag.types.include?('new')) ||
(tag.text && !tag.text.strip.empty?)
end
def attach?
new? && # must have data or there is nothing to attach
class_method? || # always attach to class methods
(tag.types && tag.types.include?('attach'))
end
def class_method?
object && object.is_a?(CodeObjects::MethodObject) &&
object.scope == :class
end
def anonymous?
tag.name.nil? || tag.name.empty?
end
def expand(macro_data)
return if attach? && class_method?
return if !anonymous? && new? &&
(!handler || handler.statement.source.empty?)
call_params = []
caller_method = nil
full_source = ''
if handler
call_params = handler.call_params
caller_method = handler.caller_method
full_source = handler.statement.source
end
all_params = ([caller_method] + call_params).compact
CodeObjects::MacroObject.expand(macro_data, all_params, full_source)
end
def find_or_create
if new? || attach?
if handler && attach?
if object && object.is_a?(CodeObjects::NamespaceObject)
log.warn "Attaching macros to non-methods is unsupported, ignoring: " \
"#{object.path} (#{handler.parser.file}:#{handler.statement.line})"
obj = nil
else
obj = object ? object :
P("#{handler.namespace}.#{handler.caller_method}")
end
else
obj = nil
end
return tag.text || "" if anonymous? # anonymous macro
macro = CodeObjects::MacroObject.create(tag.name, tag.text, obj)
else
macro = CodeObjects::MacroObject.find(tag.name)
end
macro ? macro.macro_data : nil
end
def warn
if object && handler
log.warn "Invalid/missing macro name for " \
"#{object.path} (#{handler.parser.file}:#{handler.statement.line})"
end
end
end
# Defines a method object with a given method signature, using indented
# block data as the method's docstring. The signature is similar to the
# {tag:overload} tag. The comment containing this directive does not need
# to be attached to any source, but if it is, that source code will be
# used as the method's source.
#
# To define an attribute method, see {tag:!attribute}
#
# @note For backwards compatibility support, you do not need to indent
# the method's docstring text. If a +@!method+ directive is seen with
# no indented block, the entire docstring is used as the new method's
# docstring text.
# @example Defining a simple method
# # @!method quit(username, message = "Quit")
# # Sends a quit message to the server for a +username+.
# # @param [String] username the username to quit
# # @param [String] message the quit message
# quit_message_method
# @example Attaching multiple methods to the same source
# # @!method method1
# # @!method method2
# create_methods :method1, :method2
# @see tag:!attribute
# @since 0.7.0
class MethodDirective < Directive
SCOPE_MATCH = /\A\s*self\s*\.\s*/
def call; end
def after_parse
return unless handler
use_indented_text
create_object
end
protected
def method_name
sig = sanitized_tag_signature
if sig && sig =~ /^#{CodeObjects::METHODNAMEMATCH}(\s|\(|$)/
sig[/\A\s*([^\(; \t]+)/, 1]
else
handler.call_params.first
end
end
def method_signature
"def #{sanitized_tag_signature || method_name}"
end
def sanitized_tag_signature
if tag.name && tag.name =~ SCOPE_MATCH
parser.state.scope = :class
$'
else
tag.name
end
end
def use_indented_text
return if tag.text.empty?
handler = parser.handler
object = parser.object
self.parser = parser.class.new(parser.library)
parser.state.inside_directive = true
parser.parse(tag.text, object, handler)
parser.state.inside_directive = false
end
def create_object
name = method_name
scope = parser.state.scope || handler.scope
visibility = parser.state.visibility || handler.visibility
ns = CodeObjects::NamespaceObject === object ? object : handler.namespace
obj = CodeObjects::MethodObject.new(ns, name, scope)
handler.register_file_info(obj)
handler.register_source(obj)
handler.register_visibility(obj, visibility)
handler.register_group(obj)
obj.signature = method_signature
obj.parameters = OverloadTag.new(:overload, method_signature).parameters
obj.docstring = Docstring.new!(parser.text, parser.tags, obj,
parser.raw_text, parser.reference)
handler.register_module_function(obj)
old_obj = parser.object
parser.object = obj
parser.post_process
parser.object = old_obj
obj
end
end
# Defines an attribute with a given name, using indented block data as the
# attribute's docstring. If the type specifier is supplied with "r", "w", or
# "rw", the attribute is made readonly, writeonly or readwrite respectively.
# A readwrite attribute is the default, if no type is specified. The comment
# containing this directive does not need to be attached to any source, but
# if it is, that source code will be used as the method's source.
#
# To define a regular method, see {tag:!method}
#
# @note For backwards compatibility support, you do not need to indent
# the attribute's docstring text. If an +@!attribute+ directive is seen with
# no indented block, the entire docstring is used as the new attribute's
# docstring text.
# @example Defining a simple readonly attribute
# # @!attribute [r] count
# # @return [Fixnum] the size of the list
# @example Defining a simple readwrite attribute
# # @!attribute name
# # @return [String] the name of the user
# @see tag:!method
# @since 0.7.0
class AttributeDirective < MethodDirective
def after_parse
return unless handler
use_indented_text
create_attribute_data(create_object)
end
protected
def method_name
name = sanitized_tag_signature || handler.call_params.first
name += '=' unless readable?
name
end
def method_signature
if readable?
"def #{method_name}"
else
"def #{method_name}(value)"
end
end
private
def create_attribute_data(object)
return unless object
clean_name = object.name.to_s.sub(/=$/, '')
attrs = object.namespace.attributes[object.scope]
attrs[clean_name] ||= SymbolHash[:read => nil, :write => nil]
attrs[clean_name][:read] = object if readable?
if writable?
if object.name.to_s[-1, 1] == '='
writer = object
writer.parameters = [['value', nil]]
else
writer = CodeObjects::MethodObject.new(object.namespace,
object.name.to_s + '=', object.scope)
writer.signature = "def #{object.name}=(value)"
writer.visibility = object.visibility
writer.dynamic = object.dynamic
writer.source = object.source
writer.group = object.group
writer.parameters = [['value', nil]]
writer.docstring = object.base_docstring
handler.register_file_info(writer)
end
attrs[clean_name][:write] = writer
end
end
def writable?
!tag.types || tag.types.join.include?('w')
end
def readable?
!tag.types || tag.types.join =~ /(?!w)r/
end
end
# Parses a block of code as if it were present in the source file at that
# location. This directive is useful if a class has dynamic meta-programmed
# behaviour that cannot be recognized by YARD.
#
# You can specify the language of the code block using the types
# specification list. By default, the code language is "ruby".
#
# @example Documenting dynamic module inclusion
# class User
# # includes "UserMixin" and extends "UserMixin::ClassMethods"
# # using the UserMixin.included callback.
# # @!parse include UserMixin
# # @!parse extend UserMixin::ClassMethods
# end
# @example Declaring a method as an attribute
# # This should really be an attribute
# # @!parse attr_reader :foo
# def object; @parent.object end
# @example Parsing C code
# # @!parse [c]
# # void Init_Foo() {
# # rb_define_method(rb_cFoo, "method", method, 0);
# # }
# @since 0.8.0
class ParseDirective < Directive
def call
lang = tag.types ? tag.types.first.to_sym :
(handler ? handler.parser.parser_type : :ruby)
if handler && lang == handler.parser.parser_type
pclass = Parser::SourceParser.parser_types[handler.parser.parser_type]
pobj = pclass.new(tag.text, handler.parser.file)
pobj.parse
handler.parser.process(pobj.enumerator)
else # initialize a new parse chain
src_parser = Parser::SourceParser.new(lang, handler ? handler.globals : nil)
src_parser.file = handler.parser.file if handler
src_parser.parse(StringIO.new(tag.text))
end
end
end
# Modifies the current parsing scope (class or instance). If this
# directive is defined on a docstring attached to an object definition,
# it is applied only to that object. Otherwise, it applies the scope
# to all future objects in the namespace.
#
# @example Modifying the scope of a DSL method
# # @!scope class
# cattr_accessor :subclasses
# @example Modifying the scope of a set of methods
# # @!scope class
#
# # Documentation for method1
# def method1; end
#
# # Documentation for method2
# def method2; end
# @since 0.7.0
class ScopeDirective < Directive
def call
if %w(class instance module).include?(tag.text)
if object.is_a?(CodeObjects::MethodObject)
object.scope = tag.text.to_sym
else
parser.state.scope = tag.text.to_sym
end
end
end
end
# Modifies the current parsing visibility (public, protected, or private).
# If this directive is defined on a docstring attached to an object
# definition, it is applied only to that object. Otherwise, it applies
# the visibility to all future objects in the namespace.
#
# @example Modifying the visibility of a DSL method
# # @!visibility private
# cattr_accessor :subclasses
# @example Modifying the visibility of a set of methods
# # Note that Ruby's "protected" is recommended over this directive
# # @!visibility protected
#
# # Documentation for method1
# def method1; end
#
# # Documentation for method2
# def method2; end
# @since 0.7.0
class VisibilityDirective < Directive
def call
if %w(public protected private).include?(tag.text)
if object.is_a?(CodeObjects::Base)
object.visibility = tag.text.to_sym
elsif handler && !parser.state.inside_directive
handler.visibility = tag.text.to_sym
else
parser.state.visibility = tag.text.to_sym
end
end
end
end
end
end
| {'content_hash': 'b4010ff2c217d5603c1916eacbd723b3', 'timestamp': '', 'source': 'github', 'line_count': 607, 'max_line_length': 90, 'avg_line_length': 36.138385502471166, 'alnum_prop': 0.6148340627279358, 'repo_name': 'amclain/yard', 'id': 'd505d1279b525654c73f4b1b7d4a801c032b9aa6', 'size': '21966', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'lib/yard/tags/directives.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '34563'}, {'name': 'HTML', 'bytes': '79388'}, {'name': 'JavaScript', 'bytes': '14162'}, {'name': 'Ruby', 'bytes': '1387806'}]} |
function(cmake_token_range_comment_section_find_all range regex_section_name)
cmake_token_range("${range}")
ans_extract(current end)
set(sections)
while(current)
cmake_token_range_comment_section_find("${current};${end}" "${regex_section_name}")
ans(section)
ans_extract(section_begin section_end)
if(NOT section)
break()
endif()
list(APPEND sections ${section})
map_tryget(${section_end} next)
ans(current)
endwhile()
return_ref(sections)
endfunction()
| {'content_hash': '7de980ae5bb1b8c44247a3f3e71f5f2e', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 89, 'avg_line_length': 24.818181818181817, 'alnum_prop': 0.6318681318681318, 'repo_name': 'tempbottle/cmakepp', 'id': 'a05ef7dfd2c9443e78c95139d76639fb2a1595e2', 'size': '547', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'cmake/cmake/reflection/utilities/comment_section/cmake_token_range_comment_section_find_all.cmake', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CMake', 'bytes': '1421202'}, {'name': 'JavaScript', 'bytes': '2280'}, {'name': 'PowerShell', 'bytes': '194'}, {'name': 'Shell', 'bytes': '149'}]} |
/* $NetBSD: getent.c,v 1.7 1998/02/27 10:33:46 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)getent.c 8.2 (Berkeley) 12/15/93";
#else
__RCSID("$NetBSD: getent.c,v 1.7 1998/02/27 10:33:46 christos Exp $");
#endif
#endif /* not lint */
#include <stdlib.h>
#include "misc-proto.h"
static char *area;
int getent __P((char *, char *));
char *getstr __P((char *, char **));
/*ARGSUSED*/
int
getent(cp, name)
char *cp, *name;
{
#ifdef HAS_CGETENT
char *dba[2];
dba[0] = "/etc/gettytab";
dba[1] = 0;
return((cgetent(&area, dba, name) == 0) ? 1 : 0);
#else
return(0);
#endif
}
#ifndef SOLARIS
/*ARGSUSED*/
char *
getstr(id, cpp)
char *id, **cpp;
{
# ifdef HAS_CGETENT
char *answer;
return((cgetstr(area, id, &answer) > 0) ? answer : 0);
# else
return(0);
# endif
}
#endif
| {'content_hash': 'b42012af881db78b32af9677106ca660', 'timestamp': '', 'source': 'github', 'line_count': 82, 'max_line_length': 77, 'avg_line_length': 32.353658536585364, 'alnum_prop': 0.7195627591405955, 'repo_name': 'MarginC/kame', 'id': 'e695519b5f78b39d83a2032f8f34316e310c64de', 'size': '2653', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'netbsd/lib/libtelnet/getent.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Arc', 'bytes': '7491'}, {'name': 'Assembly', 'bytes': '14375563'}, {'name': 'Awk', 'bytes': '313712'}, {'name': 'Batchfile', 'bytes': '6819'}, {'name': 'C', 'bytes': '356715789'}, {'name': 'C++', 'bytes': '4231647'}, {'name': 'DIGITAL Command Language', 'bytes': '11155'}, {'name': 'Emacs Lisp', 'bytes': '790'}, {'name': 'Forth', 'bytes': '253695'}, {'name': 'GAP', 'bytes': '9964'}, {'name': 'Groff', 'bytes': '2220485'}, {'name': 'Lex', 'bytes': '168376'}, {'name': 'Logos', 'bytes': '570213'}, {'name': 'Makefile', 'bytes': '1778847'}, {'name': 'Mathematica', 'bytes': '16549'}, {'name': 'Objective-C', 'bytes': '529629'}, {'name': 'PHP', 'bytes': '11283'}, {'name': 'Perl', 'bytes': '151251'}, {'name': 'Perl6', 'bytes': '2572'}, {'name': 'Ruby', 'bytes': '7283'}, {'name': 'Scheme', 'bytes': '76872'}, {'name': 'Shell', 'bytes': '583253'}, {'name': 'Stata', 'bytes': '408'}, {'name': 'Yacc', 'bytes': '606054'}]} |
int
main(void)
{
float a, b, c, d, score;
printf("Enter thresholds for A, B, C, D\nin that order, decreasing percentages > ");
scanf("%f%f%f%f", &a, &b, &c, &d);
printf("Thank you. Now enter student score (percent) >");
scanf("%f", &score);
if (score>=a)
printf("Student has a A grade\n");
else if (score>=b && score<a)
printf("Student has a B grade\n");
else if (score>=c && score<b)
printf("Student has a C grade\n");
else if (score>=d && score <c)
printf("Student has a D grade\n");
else if (score<d)
printf("Student has failed the course\n");
return(0);
}
| {'content_hash': 'bebe9e5368a2ecf8caa509b366db0a10', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 85, 'avg_line_length': 27.428571428571427, 'alnum_prop': 0.625, 'repo_name': 'ProgramRepair/IntroClass', 'id': 'cd46626f6b47e3eeea0702c2df1ebdede710d465', 'size': '599', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'grade/95362737dcd262ddd67b0fe1381c25f1e6b885860b4e51efb6f57223dceb77b4c6c7d855e3fe891c10cd51b48c9b052cf2c74f181a28d3020d77a4a2d6e4db18/007/grade.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '653883'}, {'name': 'Makefile', 'bytes': '172923'}, {'name': 'Python', 'bytes': '19073'}, {'name': 'Shell', 'bytes': '2562133'}]} |
package commands
import (
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
type MockHostInfo struct {
name string
ip string
sshPort int
sshUsername string
sshKeyPath string
}
func (h *MockHostInfo) GetMachineName() string {
return h.name
}
func (h *MockHostInfo) GetSSHHostname() (string, error) {
return h.ip, nil
}
func (h *MockHostInfo) GetSSHPort() (int, error) {
return h.sshPort, nil
}
func (h *MockHostInfo) GetSSHUsername() string {
return h.sshUsername
}
func (h *MockHostInfo) GetSSHKeyPath() string {
return h.sshKeyPath
}
type MockHostInfoLoader struct {
hostInfo MockHostInfo
}
func (l *MockHostInfoLoader) load(name string) (HostInfo, error) {
info := l.hostInfo
info.name = name
return &info, nil
}
func TestGetInfoForLocalScpArg(t *testing.T) {
host, user, path, opts, err := getInfoForScpArg("/tmp/foo", nil)
assert.Nil(t, host)
assert.Empty(t, user)
assert.Equal(t, "/tmp/foo", path)
assert.Nil(t, opts)
assert.NoError(t, err)
host, user, path, opts, err = getInfoForScpArg("localhost:C:\\path", nil)
assert.Nil(t, host)
assert.Empty(t, user)
assert.Equal(t, "C:\\path", path)
assert.Nil(t, opts)
assert.NoError(t, err)
}
func TestGetInfoForRemoteScpArg(t *testing.T) {
hostInfoLoader := MockHostInfoLoader{MockHostInfo{
sshKeyPath: "/fake/keypath/id_rsa",
}}
host, user, path, opts, err := getInfoForScpArg("myuser@myfunhost:/home/docker/foo", &hostInfoLoader)
assert.Equal(t, "myfunhost", host.GetMachineName())
assert.Equal(t, "myuser", user)
assert.Equal(t, "/home/docker/foo", path)
assert.Equal(t, []string{"-o", `IdentityFile="/fake/keypath/id_rsa"`}, opts)
assert.NoError(t, err)
host, user, path, opts, err = getInfoForScpArg("myfunhost:C:\\path", &hostInfoLoader)
assert.Equal(t, "myfunhost", host.GetMachineName())
assert.Empty(t, user)
assert.Equal(t, "C:\\path", path)
assert.Equal(t, []string{"-o", `IdentityFile="/fake/keypath/id_rsa"`}, opts)
assert.NoError(t, err)
}
func TestHostLocation(t *testing.T) {
arg, err := generateLocationArg(nil, "user1", "/home/docker/foo")
assert.Equal(t, "/home/docker/foo", arg)
assert.NoError(t, err)
}
func TestRemoteLocation(t *testing.T) {
hostInfo := MockHostInfo{
ip: "12.34.56.78",
sshUsername: "root",
}
arg, err := generateLocationArg(&hostInfo, "", "/home/docker/foo")
assert.Equal(t, "[email protected]:/home/docker/foo", arg)
assert.NoError(t, err)
argWithUser, err := generateLocationArg(&hostInfo, "user1", "/home/docker/foo")
assert.Equal(t, "[email protected]:/home/docker/foo", argWithUser)
assert.NoError(t, err)
}
func TestGetScpCmd(t *testing.T) {
hostInfoLoader := MockHostInfoLoader{MockHostInfo{
ip: "12.34.56.78",
sshPort: 234,
sshUsername: "root",
sshKeyPath: "/fake/keypath/id_rsa",
}}
cmd, err := getScpCmd("/tmp/foo", "myfunhost:/home/docker/foo", true, false, false, &hostInfoLoader)
expectedArgs := append(
baseSSHArgs,
"-3",
"-r",
"-o",
"IdentitiesOnly=yes",
"-o",
"Port=234",
"-o",
`IdentityFile="/fake/keypath/id_rsa"`,
"/tmp/foo",
"[email protected]:/home/docker/foo",
)
expectedCmd := exec.Command("/usr/bin/scp", expectedArgs...)
assert.Equal(t, expectedCmd, cmd)
assert.NoError(t, err)
}
func TestGetScpCmdWithoutSshKey(t *testing.T) {
hostInfoLoader := MockHostInfoLoader{MockHostInfo{
ip: "1.2.3.4",
sshUsername: "user",
}}
cmd, err := getScpCmd("/tmp/foo", "myfunhost:/home/docker/foo", true, false, false, &hostInfoLoader)
expectedArgs := append(
baseSSHArgs,
"-3",
"-r",
"/tmp/foo",
"[email protected]:/home/docker/foo",
)
expectedCmd := exec.Command("/usr/bin/scp", expectedArgs...)
assert.Equal(t, expectedCmd, cmd)
assert.NoError(t, err)
}
func TestGetScpCmdWithDelta(t *testing.T) {
hostInfoLoader := MockHostInfoLoader{MockHostInfo{
ip: "1.2.3.4",
sshUsername: "user",
}}
cmd, err := getScpCmd("/tmp/foo", "myfunhost:/home/docker/foo", true, true, false, &hostInfoLoader)
expectedArgs := append(
[]string{"--progress"},
"-e",
"ssh "+strings.Join(baseSSHArgs, " "),
"-r",
"/tmp/foo",
"[email protected]:/home/docker/foo",
)
expectedCmd := exec.Command("/usr/bin/rsync", expectedArgs...)
assert.Equal(t, expectedCmd, cmd)
assert.NoError(t, err)
}
| {'content_hash': '2f53d4eecb45f8d91d968a12868d7eb5', 'timestamp': '', 'source': 'github', 'line_count': 179, 'max_line_length': 102, 'avg_line_length': 24.07262569832402, 'alnum_prop': 0.6716175446739383, 'repo_name': 'praveenkumar/minishift', 'id': '9e89432072756455886225444432f67ad629c659', 'size': '4309', 'binary': False, 'copies': '7', 'ref': 'refs/heads/master', 'path': 'vendor/github.com/docker/machine/commands/scp_test.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Gherkin', 'bytes': '76817'}, {'name': 'Go', 'bytes': '963321'}, {'name': 'Makefile', 'bytes': '12248'}, {'name': 'Python', 'bytes': '6457'}, {'name': 'Shell', 'bytes': '22719'}]} |
/* 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.
*/
package org.camunda.bpm.engine.impl.persistence.entity;
import java.io.Serializable;
import org.camunda.bpm.engine.impl.db.DbEntity;
import org.camunda.bpm.engine.repository.Resource;
/**
* @author Tom Baeyens
*/
public class ResourceEntity implements Serializable, DbEntity, Resource {
private static final long serialVersionUID = 1L;
protected String id;
protected String name;
protected byte[] bytes;
protected String deploymentId;
protected boolean generated = false;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte[] getBytes() {
return bytes;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public Object getPersistentState() {
return ResourceEntity.class;
}
public void setGenerated(boolean generated) {
this.generated = generated;
}
/**
* Indicated whether or not the resource has been generated while deploying rather than
* being actual part of the deployment.
*/
public boolean isGenerated() {
return generated;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", name=" + name
+ ", deploymentId=" + deploymentId
+ ", generated=" + generated
+ "]";
}
}
| {'content_hash': '550dae78540ba5b71a726ca58d652192', 'timestamp': '', 'source': 'github', 'line_count': 92, 'max_line_length': 89, 'avg_line_length': 23.554347826086957, 'alnum_prop': 0.6820489155514536, 'repo_name': 'tcrossland/camunda-bpm-platform', 'id': '453a6ab8ac7af361a0630957eb1b205c11f9f59a', 'size': '2167', 'binary': False, 'copies': '12', 'ref': 'refs/heads/master', 'path': 'engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ResourceEntity.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '6657'}, {'name': 'CSS', 'bytes': '1301'}, {'name': 'Groovy', 'bytes': '1594'}, {'name': 'HTML', 'bytes': '35292'}, {'name': 'Java', 'bytes': '19901012'}, {'name': 'JavaScript', 'bytes': '43'}, {'name': 'PLpgSQL', 'bytes': '3405'}, {'name': 'Python', 'bytes': '187'}, {'name': 'Ruby', 'bytes': '60'}, {'name': 'Shell', 'bytes': '4048'}]} |
module.exports = {
'name': 'multinomial',
'category': 'Probability',
'syntax': [
'multinomial(A)'
],
'description': 'Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0.',
'examples': [
'multinomial([1, 2, 1])'
],
'seealso': ['combinations', 'factorial']
}; | {'content_hash': '76ca77f489efd7e1239bb240f82d8dcc', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 254, 'avg_line_length': 38.583333333333336, 'alnum_prop': 0.6695464362850972, 'repo_name': 'saromanov/mathjs', 'id': '604578114f11246391bbf513d0297bd35ac3e1c6', 'size': '463', 'binary': False, 'copies': '46', 'ref': 'refs/heads/master', 'path': 'lib/expression/docs/function/probability/multinomial.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '20501'}, {'name': 'JavaScript', 'bytes': '3822079'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2017-2019 Dremio Corporation
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.dremio.services</groupId>
<artifactId>dremio-services-jobtelemetry</artifactId>
<version>23.0.1-202210141019030815-c1de8bcc</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.dremio.services</groupId>
<artifactId>dremio-services-jobtelemetry-client</artifactId>
<packaging>jar</packaging>
<name>Services - Job Telemetry Client</name>
<version>23.0.1-202210141019030815-c1de8bcc</version>
<dependencies>
<dependency>
<groupId>com.dremio</groupId>
<artifactId>dremio-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.dremio</groupId>
<artifactId>dremio-protocol</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<artifactId>dremio-services-jobtelemetry-common</artifactId>
<groupId>com.dremio.services</groupId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
| {'content_hash': 'd048b3901ccb53c48addc0933bc9e49a', 'timestamp': '', 'source': 'github', 'line_count': 54, 'max_line_length': 108, 'avg_line_length': 35.166666666666664, 'alnum_prop': 0.7040547656661401, 'repo_name': 'dremio/dremio-oss', 'id': 'a6af6ca9564abab91ea0ef625d83574647d1b7c4', 'size': '1899', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'services/jobtelemetry/client/pom.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '47376'}, {'name': 'Dockerfile', 'bytes': '1668'}, {'name': 'FreeMarker', 'bytes': '132156'}, {'name': 'GAP', 'bytes': '15936'}, {'name': 'HTML', 'bytes': '6544'}, {'name': 'Java', 'bytes': '39679012'}, {'name': 'JavaScript', 'bytes': '5439822'}, {'name': 'Less', 'bytes': '547002'}, {'name': 'SCSS', 'bytes': '95688'}, {'name': 'Shell', 'bytes': '16063'}, {'name': 'TypeScript', 'bytes': '887739'}]} |
import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store';
export default class Select {
select: HTMLSelectElement;
listen: boolean;
onSelectChange?: (data: DataArrayPartial) => void;
onValueChange?: (value: string[]) => void;
private observer;
constructor(select: HTMLSelectElement);
enable(): void;
disable(): void;
hideUI(): void;
showUI(): void;
changeListen(on: boolean): void;
addSelectChangeListener(func: (data: DataArrayPartial) => void): void;
removeSelectChangeListener(): void;
addValueChangeListener(func: (value: string[]) => void): void;
removeValueChangeListener(): void;
valueChange(ev: Event): any;
private observeWrapper;
private addObserver;
private connectObserver;
private disconnectObserver;
getData(): DataArrayPartial;
getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional;
getDataFromOption(option: HTMLOptionElement): Option;
getSelectedValues(): string[];
setSelected(value: string[]): void;
updateSelect(id?: string, style?: string, classes?: string[]): void;
updateOptions(data: DataArray): void;
createOptgroup(optgroup: Optgroup): HTMLOptGroupElement;
createOption(info: Option): HTMLOptionElement;
destroy(): void;
}
| {'content_hash': 'a3b3c1e830a18bb694b4a77a044c961b', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 90, 'avg_line_length': 40.90909090909091, 'alnum_prop': 0.6918518518518518, 'repo_name': 'brianvoe/slim-select', 'id': 'a84f3dac3ed1e798ce450b9edc31e417c135e021', 'size': '1350', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/vue/dist/slim-select/select.d.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Go', 'bytes': '188'}, {'name': 'HTML', 'bytes': '3346'}, {'name': 'JavaScript', 'bytes': '3799'}, {'name': 'SCSS', 'bytes': '23591'}, {'name': 'TypeScript', 'bytes': '92480'}, {'name': 'Vue', 'bytes': '124929'}]} |
package net.folab.metaj.jast;
import net.folab.metaj.bytecode.JavaType;
import net.folab.metaj.bytecode.StatementContext;
import org.objectweb.asm.MethodVisitor;
public class LocalVariable implements Expression {
private final String name;
public LocalVariable(String name) {
this.name = name;
}
@Override
public void generate(MethodVisitor mv, StatementContext ctx) {
int index = ctx.indexOfLocal(name);
JavaType type = ctx.typeOfLocal(name);
ctx.incStack();
mv.visitVarInsn(type.loadOpcode, index);
}
@Override
public JavaType getType() {
throw new RuntimeException();
}
}
| {'content_hash': '48344afc6f4a8d65164dd35e55ebd437', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 66, 'avg_line_length': 23.0, 'alnum_prop': 0.6851574212893553, 'repo_name': 'leafriend/metaj', 'id': '016885876e4aeba6bdad37999f62a3b8be1ceb4b', 'size': '667', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/net/folab/metaj/jast/LocalVariable.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '34230'}]} |
require "helper"
describe Google::Cloud::Bigquery::External::DataSource do
it "can be used for AVRO" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.avro"]
e.gapi.source_format = "AVRO"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.avro"],
source_format: "AVRO"
)
table.must_be_kind_of Google::Cloud::Bigquery::External::DataSource
table.urls.must_equal ["gs://my-bucket/path/to/file.avro"]
table.must_be :avro?
table.format.must_equal "AVRO"
table.wont_be :csv?
table.wont_be :json?
table.wont_be :sheets?
table.wont_be :backup?
table.wont_be :bigtable?
table.to_gapi.to_h.must_equal table_gapi.to_h
end
it "can be used for DATASTORE_BACKUP" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.backup_info"]
e.gapi.source_format = "DATASTORE_BACKUP"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.backup_info"],
source_format: "DATASTORE_BACKUP"
)
table.must_be_kind_of Google::Cloud::Bigquery::External::DataSource
table.urls.must_equal ["gs://my-bucket/path/to/file.backup_info"]
table.must_be :backup?
table.format.must_equal "DATASTORE_BACKUP"
table.wont_be :csv?
table.wont_be :json?
table.wont_be :sheets?
table.wont_be :avro?
table.wont_be :bigtable?
table.to_gapi.to_h.must_equal table_gapi.to_h
end
it "sets autodetect" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.avro"]
e.gapi.source_format = "AVRO"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.avro"],
source_format: "AVRO",
autodetect: true
)
table.autodetect.must_be :nil?
table.autodetect = true
table.autodetect.must_equal true
table.to_gapi.to_h.must_equal table_gapi.to_h
end
it "sets compression" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.avro"]
e.gapi.source_format = "AVRO"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.avro"],
source_format: "AVRO",
compression: "GZIP"
)
table.compression.must_be :nil?
table.compression = "GZIP"
table.compression.must_equal "GZIP"
table.to_gapi.to_h.must_equal table_gapi.to_h
end
it "sets ignore_unknown" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.avro"]
e.gapi.source_format = "AVRO"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.avro"],
source_format: "AVRO",
ignore_unknown_values: true
)
table.ignore_unknown.must_be :nil?
table.ignore_unknown = true
table.ignore_unknown.must_equal true
table.to_gapi.to_h.must_equal table_gapi.to_h
end
it "sets max_bad_records" do
table = Google::Cloud::Bigquery::External::DataSource.new.tap do |e|
e.gapi.source_uris = ["gs://my-bucket/path/to/file.avro"]
e.gapi.source_format = "AVRO"
end
table_gapi = Google::Apis::BigqueryV2::ExternalDataConfiguration.new(
source_uris: ["gs://my-bucket/path/to/file.avro"],
source_format: "AVRO",
max_bad_records: 10
)
table.max_bad_records.must_be :nil?
table.max_bad_records = 10
table.max_bad_records.must_equal 10
table.to_gapi.to_h.must_equal table_gapi.to_h
end
end
| {'content_hash': 'b020f7f3ed2ad43569cc5bfc5b18b85e', 'timestamp': '', 'source': 'github', 'line_count': 131, 'max_line_length': 73, 'avg_line_length': 30.236641221374047, 'alnum_prop': 0.6563998990154002, 'repo_name': 'landrito/google-cloud-ruby', 'id': 'cb458421893dd596bfb089219201076900bcb6e6', 'size': '4540', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'google-cloud-bigquery/test/google/cloud/bigquery/external_data_souce_test.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '25312'}, {'name': 'CSS', 'bytes': '1422'}, {'name': 'DIGITAL Command Language', 'bytes': '2216'}, {'name': 'HTML', 'bytes': '10040'}, {'name': 'JavaScript', 'bytes': '1862'}, {'name': 'Ruby', 'bytes': '11131240'}, {'name': 'Shell', 'bytes': '786'}]} |
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef LIB_TPM2_ATTR_UTIL_H_
#define LIB_TPM2_ATTR_UTIL_H_
#include <stdbool.h>
#include <tss2/tss2_sys.h>
/**
* Converts a list of | (pipe) separated attributes as defined in tavle 204
* of https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf
* to an actual bit field representation. The trailing TPMA_NV_ can be omitted and must be lower-case.
* For example, TPMA_NV_PPWRITE, becomes ppwrite. To append them together, just do the pipe in between.
* ppwrite|ownerwrite.
*
* @param attribute_list
* The attribute string to parse, which may be modified in place.
* @param nvattrs
* The TPMA_NV attributes set based on the attribute list. Only valid on true returns.
* @return
* true on success, false on error.
*/
bool tpm2_attr_util_nv_strtoattr(char *attribute_list, TPMA_NV *nvattrs);
/**
* Like tpm2_attr_util_nv_strtoattr() but converts TPMA_OBJECT attributes as defined in:
* Table 31 of https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf
* @param attribute_list
* The attribute string to parse, which may be modified in place.
* The TPMA_OBJECT attributes set based on the attribute list. Only valid on true returns.
* @return
* true on success, false on error.
*/
bool tpm2_attr_util_obj_strtoattr(char *attribute_list, TPMA_OBJECT *objattrs);
/**
* Converts a numerical or friendly string described object attribute into the
* TPMA_OBJECT. Similar to tpm2_alg_util_from_optarg().
* @param argvalue
* Either a raw numeric for a UINT32 or a friendly name object attribute list
* as in tpm2_attr_util_nv_strtoattr().
* @param objattrs
* The converted bits for a TPMA_OBJECT
* @return
* true on success or false on error.
*/
bool tpm2_attr_util_obj_from_optarg(char *argvalue, TPMA_OBJECT *objattrs);
/**
* Converts a TPMA_NV structure to a friendly name style string.
* @param nvattrs
* The nvattrs to convert to nice name.
* @return A string allocated with calloc(), callers shall use
* free() to free it. The string is a null terminated text representation
* of the TPMA_NV attributes.
*/
char *tpm2_attr_util_nv_attrtostr(TPMA_NV nvattrs);
/**
* Like tpm2_nv_util_obj_strtoattr() but converts TPMA_OBJECT attributes as defined in:
* Table 31 of https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf
* @param objattrs
* The object parameters to convert to a name
* @return
* The name of the object attrs as a string that must be freed via free().
*/
char *tpm2_attr_util_obj_attrtostr(TPMA_OBJECT objattrs);
#endif /* LIB_TPM2_ATTR_UTIL_H_ */
| {'content_hash': 'e4123f288e5f05c0fe8b678d3eb0add7', 'timestamp': '', 'source': 'github', 'line_count': 70, 'max_line_length': 107, 'avg_line_length': 38.34285714285714, 'alnum_prop': 0.7309985096870343, 'repo_name': '01org/tpm2.0-tools', 'id': '637d5573313d2834a5b0ce2303e153d0ee199d34', 'size': '2684', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/tpm2_attr_util.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '239369'}, {'name': 'C++', 'bytes': '11363'}, {'name': 'M4', 'bytes': '5658'}, {'name': 'Makefile', 'bytes': '13651'}, {'name': 'Shell', 'bytes': '150071'}]} |
class ControlRowConverter < BaseRowConverter
@model_class = :Control
def setup_object
object = setup_object_by_slug(attrs)
if object.directive.present? && object.directive != @importer.options[:directive]
add_error(:slug, "Code is used in #{object.directive.meta_kind.to_s.titleize}: #{object.directive.slug}")
else
object.directive = @importer.options[:directive]
end
end
def reify
handle(:slug, SlugColumnHandler)
handle_date(:start_date)
handle_date(:stop_date)
handle_date(:created_at, :no_import => true)
handle_date(:updated_at, :no_import => true)
handle_text_or_html(:description)
handle_text_or_html(:documentation_description)
handle_raw_attr(:title)
handle_raw_attr(:url)
handle_option(:kind, :role => :control_kind)
handle_option(:means, :role => :control_means)
handle_option(:verify_frequency)
handle_boolean(:key_control, :truthy_values => %w(key key_control key\ control))
handle_boolean(:fraud_related, :truthy_values => %w(fraud fraud_related fraud\ related))
handle_boolean(:active, :truthy_values => %w(active))
handle(:documents, LinkDocumentsHandler)
handle(:categories, LinkCategoriesHandler, :scope_id => Control::CATEGORY_TYPE_ID)
handle(:assertions, LinkCategoriesHandler, :scope_id => Control::CATEGORY_ASSERTION_TYPE_ID)
handle(:people_responsible, LinkPeopleHandler,
:role => :responsible)
handle(:people_accountable, LinkPeopleHandler,
:role => :accountable)
handle(:systems, LinkSystemsHandler,
:is_biz_process => false)
handle(:processes, LinkSystemsHandler,
:association => :systems,
:is_biz_process => true)
end
end
class ControlsConverter < BaseConverter
@metadata_map = Hash[*%w(
Type type
Directive\ Code slug
)]
@object_map = Hash[*%w(
Control\ Code slug
Title title
Description description
Kind kind
Means means
Version version
Start\ Date start_date
Stop\ Date stop_date
URL url
Link:Systems systems
Link:Processes processes
Link:Categories categories
Link:Assertions assertions
Documentation documentation_description
Frequency verify_frequency
References documents
Link:People;Responsible people_responsible
Link:People;Accountable people_accountable
Key\ Control key_control
Active active
Fraud\ Related fraud_related
Created created_at
Updated updated_at
)]
@row_converter = ControlRowConverter
def directive
options[:directive]
end
def metadata_map
Hash[*self.class.metadata_map.map do |k,v|
[k.sub("Directive", directive.meta_kind.to_s.titleize),v]
end.flatten]
end
def validate_metadata(attrs)
validate_metadata_type(attrs, "Controls")
if !attrs.has_key?(:slug)
errors.push("Missing \"#{directive.meta_kind.to_s.titleize} Code\" heading")
elsif attrs[:slug].upcase != directive.slug.upcase
errors.push("#{directive.meta_kind.to_s.titleize} Code must be #{directive.slug}")
end
end
def do_export_metadata
yield CSV.generate_line(metadata_map.keys)
yield CSV.generate_line(["Controls", directive.slug])
yield CSV.generate_line([])
yield CSV.generate_line([])
yield CSV.generate_line(object_map.keys)
end
end
| {'content_hash': '876427132c03619a85c7127dd726fc65', 'timestamp': '', 'source': 'github', 'line_count': 115, 'max_line_length': 111, 'avg_line_length': 29.095652173913045, 'alnum_prop': 0.6861924686192469, 'repo_name': 'nixers/compliance-management', 'id': '0f61dabe063b139d9eae9b119a72ae5ee2646326', 'size': '3347', 'binary': False, 'copies': '19', 'ref': 'refs/heads/master', 'path': 'app/converters/controls_converter.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '117993'}, {'name': 'CoffeeScript', 'bytes': '341'}, {'name': 'JavaScript', 'bytes': '303960'}, {'name': 'Ruby', 'bytes': '592691'}]} |
default['yum']['epel-debuginfo']['repositoryid'] = 'epel-debuginfo'
case node['platform']
when 'amazon'
default['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch'
default['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch'
default['yum']['epel-debuginfo']['gpgkey'] = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6'
else
case node['platform_version'].to_i
when 5
default['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 5 - $basearch - Debug'
default['yum']['epel-debuginfo']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch'
default['yum']['epel-debuginfo']['gpgkey'] = 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL'
when 6
default['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch - Debug'
default['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch'
default['yum']['epel-debuginfo']['gpgkey'] = 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'
when 7
default['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 7 - $basearch - Debug'
default['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch'
default['yum']['epel-debuginfo']['gpgkey'] = 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7'
end
end
default['yum']['epel-debuginfo']['failovermethod'] = 'priority'
default['yum']['epel-debuginfo']['gpgcheck'] = true
default['yum']['epel-debuginfo']['enabled'] = false
default['yum']['epel-debuginfo']['managed'] = false
| {'content_hash': '6742ec492bab6285122cfd7da4a73a66', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 131, 'avg_line_length': 63.642857142857146, 'alnum_prop': 0.6952861952861953, 'repo_name': 'd1d1200/chef-solo', 'id': '9119eb2e63911a13123f6ca78fe835ed26cf4661', 'size': '1782', 'binary': False, 'copies': '8', 'ref': 'refs/heads/master', 'path': 'cookbooks/yum-epel/attributes/epel-debuginfo.rb', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '700828'}, {'name': 'Perl', 'bytes': '82959'}, {'name': 'Python', 'bytes': '1654898'}, {'name': 'Ruby', 'bytes': '1763139'}, {'name': 'Shell', 'bytes': '68875'}]} |
package org.apache.cassandra.db;
import java.util.concurrent.TimeUnit;
import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.apache.cassandra.db.rows.BufferCell;
import org.apache.cassandra.db.rows.Cell;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.schema.TableMetadata;
import org.apache.cassandra.service.ClientWarn;
import org.apache.cassandra.utils.NoSpamLogger;
public class ExpirationDateOverflowHandling
{
private static final Logger logger = LoggerFactory.getLogger(ExpirationDateOverflowHandling.class);
private static final int EXPIRATION_OVERFLOW_WARNING_INTERVAL_MINUTES = Integer.getInteger("cassandra.expiration_overflow_warning_interval_minutes", 5);
public enum ExpirationDateOverflowPolicy
{
REJECT, CAP_NOWARN, CAP
}
@VisibleForTesting
public static ExpirationDateOverflowPolicy policy;
static {
String policyAsString = System.getProperty("cassandra.expiration_date_overflow_policy", ExpirationDateOverflowPolicy.REJECT.name());
try
{
policy = ExpirationDateOverflowPolicy.valueOf(policyAsString.toUpperCase());
}
catch (RuntimeException e)
{
logger.warn("Invalid expiration date overflow policy: {}. Using default: {}", policyAsString, ExpirationDateOverflowPolicy.REJECT.name());
policy = ExpirationDateOverflowPolicy.REJECT;
}
}
public static final String MAXIMUM_EXPIRATION_DATE_EXCEEDED_WARNING = "Request on table {}.{} with {}ttl of {} seconds exceeds maximum supported expiration " +
"date of 2038-01-19T03:14:06+00:00 and will have its expiration capped to that date. " +
"In order to avoid this use a lower TTL or upgrade to a version where this limitation " +
"is fixed. See CASSANDRA-14092 for more details.";
public static final String MAXIMUM_EXPIRATION_DATE_EXCEEDED_REJECT_MESSAGE = "Request on table %s.%s with %sttl of %d seconds exceeds maximum supported expiration " +
"date of 2038-01-19T03:14:06+00:00. In order to avoid this use a lower TTL, change " +
"the expiration date overflow policy or upgrade to a version where this limitation " +
"is fixed. See CASSANDRA-14092 for more details.";
public static void maybeApplyExpirationDateOverflowPolicy(TableMetadata metadata, int ttl, boolean isDefaultTTL) throws InvalidRequestException
{
if (ttl == BufferCell.NO_TTL)
return;
// Check for localExpirationTime overflow (CASSANDRA-14092)
int nowInSecs = (int)(System.currentTimeMillis() / 1000);
if (ttl + nowInSecs < 0)
{
switch (policy)
{
case CAP:
ClientWarn.instance.warn(MessageFormatter.arrayFormat(MAXIMUM_EXPIRATION_DATE_EXCEEDED_WARNING, new Object[] { metadata.keyspace,
metadata.name,
isDefaultTTL? "default " : "", ttl })
.getMessage());
case CAP_NOWARN:
/**
* Capping at this stage is basically not rejecting the request. The actual capping is done
* by {@link #computeLocalExpirationTime(int, int)}, which converts the negative TTL
* to {@link org.apache.cassandra.db.BufferExpiringCell#MAX_DELETION_TIME}
*/
NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, EXPIRATION_OVERFLOW_WARNING_INTERVAL_MINUTES, TimeUnit.MINUTES, MAXIMUM_EXPIRATION_DATE_EXCEEDED_WARNING,
metadata.keyspace, metadata.name, isDefaultTTL? "default " : "", ttl);
return;
default:
throw new InvalidRequestException(String.format(MAXIMUM_EXPIRATION_DATE_EXCEEDED_REJECT_MESSAGE, metadata.keyspace, metadata.name,
isDefaultTTL? "default " : "", ttl));
}
}
}
/**
* This method computes the {@link Cell#localDeletionTime()}, maybe capping to the maximum representable value
* which is {@link Cell#MAX_DELETION_TIME}.
*
* Please note that the {@link ExpirationDateOverflowHandling.ExpirationDateOverflowPolicy} is applied
* during {@link ExpirationDateOverflowHandling#maybeApplyExpirationDateOverflowPolicy(org.apache.cassandra.schema.TableMetadata, int, boolean)},
* so if the request was not denied it means its expiration date should be capped.
*
* See CASSANDRA-14092
*/
public static int computeLocalExpirationTime(int nowInSec, int timeToLive)
{
int localExpirationTime = nowInSec + timeToLive;
return localExpirationTime >= 0? localExpirationTime : Cell.MAX_DELETION_TIME;
}
}
| {'content_hash': '8e6a50f313f9ad3d7d752daebbdba49a', 'timestamp': '', 'source': 'github', 'line_count': 104, 'max_line_length': 175, 'avg_line_length': 54.17307692307692, 'alnum_prop': 0.5910543130990416, 'repo_name': 'stef1927/cassandra', 'id': '81e3d1e24ba7cfa676f0e9704a0e0b7037868b61', 'size': '6439', 'binary': False, 'copies': '35', 'ref': 'refs/heads/trunk', 'path': 'src/java/org/apache/cassandra/db/ExpirationDateOverflowHandling.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AMPL', 'bytes': '801'}, {'name': 'Batchfile', 'bytes': '38885'}, {'name': 'GAP', 'bytes': '86159'}, {'name': 'Groovy', 'bytes': '11636'}, {'name': 'HTML', 'bytes': '264240'}, {'name': 'Java', 'bytes': '23662991'}, {'name': 'Lex', 'bytes': '10151'}, {'name': 'PowerShell', 'bytes': '39042'}, {'name': 'Python', 'bytes': '525100'}, {'name': 'Shell', 'bytes': '92274'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.jcrinstall.parent</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.jcrinstall.testbundles.observer</artifactId>
<packaging>bundle</packaging>
<version>2.0.3-incubator-SNAPSHOT</version>
<name>Apache Sling Jcrinstall Observer Test Bundle</name>
<description> Bundle used in jcrinstall automated tests. </description>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/extensions/jcrinstall/testbundles/observer</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/extensions/jcrinstall/testbundles/observer</developerConnection>
<url>http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/testbundles/observer</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Private-Package>org.apache.sling.jcrinstall.testing.testbundles.*</Private-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.log</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.api</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.0.3-incubator-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
| {'content_hash': 'c10739ce429993f24d070108dcf94099', 'timestamp': '', 'source': 'github', 'line_count': 101, 'max_line_length': 158, 'avg_line_length': 37.31683168316832, 'alnum_prop': 0.71690103475723, 'repo_name': 'codders/k2-sling-fork', 'id': 'bba17cdc6289c2b5ae17fc43b41cc9ea64b88c8d', 'size': '3769', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'contrib/extensions/jcrinstall/testbundles/observer/pom.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '1565995'}, {'name': 'JavaScript', 'bytes': '46509'}, {'name': 'Python', 'bytes': '298'}, {'name': 'Scala', 'bytes': '45215'}]} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>string::find_last_not_of</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.JSON">
<link rel="up" href="../boost__json__string.html" title="string">
<link rel="prev" href="find_last_of.html" title="string::find_last_of">
<link rel="next" href="find_last_not_of/overload1.html" title="string::find_last_not_of (1 of 2 overloads)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="find_last_of.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__json__string.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="find_last_not_of/overload1.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="json.ref.boost__json__string.find_last_not_of"></a><a class="link" href="find_last_not_of.html" title="string::find_last_not_of">string::find_last_not_of</a>
</h5></div></div></div>
<p>
<a class="indexterm" name="idm45725627479984"></a>
</p>
<p>
Find the last occurrence of a character not within the string.
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span>
<a class="link" href="find_last_not_of/overload1.html" title="string::find_last_not_of (1 of 2 overloads)">find_last_not_of</a><span class="special">(</span>
<span class="identifier">string_view</span> <span class="identifier">sv</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">pos</span> <span class="special">=</span> <a class="link" href="npos.html" title="string::npos">npos</a><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="emphasis"><em>» <a class="link" href="find_last_not_of/overload1.html" title="string::find_last_not_of (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">more</span><span class="special">...</span></code></a></em></span>
</pre>
<p>
Find the last occurrence of a character not equal to <code class="computeroutput"><span class="identifier">ch</span></code>.
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span>
<a class="link" href="find_last_not_of/overload2.html" title="string::find_last_not_of (2 of 2 overloads)">find_last_not_of</a><span class="special">(</span>
<span class="keyword">char</span> <span class="identifier">ch</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">pos</span> <span class="special">=</span> <a class="link" href="npos.html" title="string::npos">npos</a><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="emphasis"><em>» <a class="link" href="find_last_not_of/overload2.html" title="string::find_last_not_of (2 of 2 overloads)"><code class="computeroutput"><span class="identifier">more</span><span class="special">...</span></code></a></em></span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2019, 2020 Vinnie Falco<br>Copyright © 2020 Krystian Stasiowski<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="find_last_of.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__json__string.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="find_last_not_of/overload1.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {'content_hash': '9ca5f0c1256705002b9618aeff21905e', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 474, 'avg_line_length': 84.40625, 'alnum_prop': 0.6362458348759719, 'repo_name': 'davehorton/drachtio-server', 'id': '9b143aa04e8ebea4cacbee294851c7e619aef580', 'size': '5408', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'deps/boost_1_77_0/libs/json/doc/html/json/ref/boost__json__string/find_last_not_of.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '662596'}, {'name': 'Dockerfile', 'bytes': '1330'}, {'name': 'JavaScript', 'bytes': '60639'}, {'name': 'M4', 'bytes': '35273'}, {'name': 'Makefile', 'bytes': '5960'}, {'name': 'Shell', 'bytes': '47298'}]} |
// Copyright 2014 ExxonMobil Technical Computing Company
//
// 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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace ExxonMobil.IOBench.Core
{
public class BenchmarkException : ExceptionWithHelp
{
internal BenchmarkException() :
base()
{ }
internal BenchmarkException(string message) :
base(message)
{ }
internal BenchmarkException(string message, Exception innerException) :
base(message, innerException)
{ }
internal BenchmarkException(SerializationInfo info, StreamingContext context) :
base()
{ }
}
}
| {'content_hash': 'daf2d7794dba5c7960a340652d487c5a', 'timestamp': '', 'source': 'github', 'line_count': 40, 'max_line_length': 81, 'avg_line_length': 30.3, 'alnum_prop': 0.7277227722772277, 'repo_name': 'wpbrown/iobench', 'id': 'bd8333a5a27fb88f69f5fc5c135b2be1ef2a2112', 'size': '1214', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'ExxonMobil.IOBench.Core/NetworkAnalysisException.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '3044'}, {'name': 'C#', 'bytes': '167843'}, {'name': 'C++', 'bytes': '46089'}, {'name': 'PowerShell', 'bytes': '1843'}]} |
package javax.imageio.event;
import java.util.EventListener;
import javax.imageio.ImageWriter;
/**
* An interface used by <code>ImageWriter</code> implementations to
* notify callers of their image and thumbnail reading methods of
* warnings (non-fatal errors). Fatal errors cause the relevant
* read method to throw an <code>IIOException</code>.
*
* <p> Localization is handled by associating a <code>Locale</code>
* with each <code>IIOWriteWarningListener</code> as it is registered
* with an <code>ImageWriter</code>. It is up to the
* <code>ImageWriter</code> to provide localized messages.
*
* @see javax.imageio.ImageWriter#addIIOWriteWarningListener
* @see javax.imageio.ImageWriter#removeIIOWriteWarningListener
*
*/
public interface IIOWriteWarningListener extends EventListener {
/**
* Reports the occurence of a non-fatal error in encoding. Encoding
* will continue following the call to this method. The application
* may choose to display a dialog, print the warning to the console,
* ignore the warning, or take any other action it chooses.
*
* @param source the <code>ImageWriter</code> object calling this method.
* @param imageIndex the index, starting with 0, of the image
* generating the warning.
* @param warning a <code>String</code> containing the warning.
*/
void warningOccurred(ImageWriter source,
int imageIndex,
String warning);
}
| {'content_hash': '48623981c9199fefea9d81afed0788b4', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 77, 'avg_line_length': 38.205128205128204, 'alnum_prop': 0.7114093959731543, 'repo_name': 'ArcherSys/ArcherSys', 'id': 'c39f0fed92681e65c4e6cc686ce09f8e7d2fbf69', 'size': '2696', 'binary': False, 'copies': '35', 'ref': 'refs/heads/master', 'path': 'java/bin/javax/imageio/event/IIOWriteWarningListener.java', 'mode': '33188', 'license': 'mit', 'language': []} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': 'e41011cde5930a520861dd010f13c99c', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': 'dab3045af7569463f332f8d8ed0b9d0054b61b50', 'size': '172', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Pteridophyta/Polypodiopsida/Cyatheales/Cyatheaceae/Cyathea/Cyathea oldhamii/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cpp_redis: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="cpp_redis_logo.jpg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">cpp_redis
 <span id="projectnumber">4.0.0</span>
</div>
<div id="projectbrief">cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a id="index_k"></a>- k -</h3><ul>
<li>ko()
: <a class="el" href="classcpp__redis_1_1reply.html#a17e261cc8e7686bb2126d7df9223611a">cpp_redis::reply</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
| {'content_hash': 'a491c6babcf0d5e1650c23e894156868', 'timestamp': '', 'source': 'github', 'line_count': 79, 'max_line_length': 162, 'avg_line_length': 38.58227848101266, 'alnum_prop': 0.6863517060367454, 'repo_name': 'Cylix/cpp_redis', 'id': '269150101080a4cee4c2d03999381695453edb57', 'size': '3048', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'docs/html/functions_k.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '426116'}, {'name': 'CMake', 'bytes': '8854'}, {'name': 'Python', 'bytes': '5208'}, {'name': 'Shell', 'bytes': '161'}]} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
Lecanora anopta Nyl.
### Remarks
null | {'content_hash': 'ca2af839506cf6247226e94900f25b77', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 11.538461538461538, 'alnum_prop': 0.7066666666666667, 'repo_name': 'mdoering/backbone', 'id': 'afa749b25391cd3f71e607843d4ff08a2aa8121a', 'size': '194', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Lecanoraceae/Lecanora/Lecanora anopta/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
import React from 'react';
import { connect } from 'react-redux';
import { AnyAction, Dispatch } from 'redux';
import { setVisibilityFilter } from 'services/todos/actions';
import { IGlobalStateRecord } from 'types/global';
const styles = require('./todoFilter.scss');
// Component
interface ITodoFilterStateProps {
active: boolean;
}
interface ITodoFilterDispatchProps {
setVisibilityFilter(): void;
}
interface ITodoFilterProps extends ITodoFilterStateProps, ITodoFilterDispatchProps { }
export class TodoFilter extends React.Component<ITodoFilterProps> {
public onClick = (e: React.MouseEvent<HTMLElement>) => {
e.preventDefault();
this.props.setVisibilityFilter();
}
public render() {
if (this.props.active) {
return (
<a href='#' className={`btn waves-effect waves-light ${styles['todo-filter-btn']}`} onClick={this.onClick}>
{this.props.children}
</a>
);
} else {
return (
<a href='#' className={`btn-flat waves-effect waves-light ${styles['todo-filter-btn']}`} onClick={this.onClick}>
{this.props.children}
</a>
);
}
}
}
// Container
interface ITodoFilterOwnProps {
filter: string;
}
const mapStateToProps = (state: IGlobalStateRecord, ownProps: ITodoFilterOwnProps): ITodoFilterStateProps => ({
active: ownProps.filter === state.get('todosState').visibilityFilter,
});
const mapDispatchToProps = (dispatch: Dispatch<AnyAction>, ownProps: ITodoFilterOwnProps): ITodoFilterDispatchProps => ({
setVisibilityFilter: () => {
dispatch(setVisibilityFilter(ownProps.filter));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(TodoFilter);
| {'content_hash': 'a3b4f77ee66a54851e533c544d48fef2', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 121, 'avg_line_length': 26.5, 'alnum_prop': 0.6933962264150944, 'repo_name': 'Armour/express-webpack-react-redux-typescript-boilerplate', 'id': 'ceb61ac59700dc1e0f0422e56df6d68ce41f1407', 'size': '1696', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'frontend/src/pages/ReactPage/components/TodoLayout/components/TodoFooter/components/TodoFilter/todoFilter.tsx', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '3468'}, {'name': 'Dockerfile', 'bytes': '242'}, {'name': 'HCL', 'bytes': '870'}, {'name': 'HTML', 'bytes': '2395'}, {'name': 'JavaScript', 'bytes': '17857'}, {'name': 'TypeScript', 'bytes': '61818'}]} |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
state_restore::StateSnapshotRestore,
test_helper::{arb_state_kv_sets, update_store},
AptosDB,
};
use aptos_jellyfish_merkle::TreeReader;
use aptos_temppath::TempPath;
use aptos_types::{
access_path::AccessPath, account_address::AccountAddress, state_store::state_key::StateKeyTag,
};
use proptest::{collection::hash_map, prelude::*};
use storage_interface::{jmt_update_refs, jmt_updates, DbReader, DbWriter, StateSnapshotReceiver};
use super::*;
fn put_value_set(
state_store: &StateStore,
value_set: Vec<(StateKey, StateValue)>,
version: Version,
base_version: Option<Version>,
) -> HashValue {
let value_set: HashMap<_, _> = value_set
.iter()
.map(|(key, value)| (key.clone(), Some(value.clone())))
.collect();
let jmt_updates = jmt_updates(&value_set);
let root = state_store
.merklize_value_set(jmt_update_refs(&jmt_updates), None, version, base_version)
.unwrap();
let mut batch = SchemaBatch::new();
state_store
.put_value_sets(
vec![&value_set],
version,
StateStorageUsage::new_untracked(),
&mut batch,
)
.unwrap();
state_store.ledger_db.write_schemas(batch).unwrap();
root
}
fn verify_value_and_proof(
store: &StateStore,
key: StateKey,
expected_value: Option<&StateValue>,
version: Version,
root: HashValue,
) {
verify_value_and_proof_in_store(store, key.clone(), expected_value, version, root);
verify_value_index_in_store(store, key, expected_value, version);
}
fn verify_value_and_proof_in_store(
store: &StateStore,
key: StateKey,
expected_value: Option<&StateValue>,
version: Version,
root: HashValue,
) {
let (value, proof) = store
.get_state_value_with_proof_by_version(&key, version)
.unwrap();
assert_eq!(value.as_ref(), expected_value);
proof.verify(root, key.hash(), value.as_ref()).unwrap();
}
fn verify_value_index_in_store(
store: &StateStore,
key: StateKey,
expected_value: Option<&StateValue>,
version: Version,
) {
let value = store.get_state_value_by_version(&key, version).unwrap();
assert_eq!(value.as_ref(), expected_value);
}
#[test]
fn test_empty_store() {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
let key = StateKey::Raw(String::from("test_key").into_bytes());
assert!(store
.get_state_value_with_proof_by_version(&key, 0)
.is_err());
}
#[test]
fn test_state_store_reader_writer() {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
let key1 = StateKey::Raw(String::from("test_key1").into_bytes());
let key2 = StateKey::Raw(String::from("test_key2").into_bytes());
let key3 = StateKey::Raw(String::from("test_key3").into_bytes());
let value1 = StateValue::from(String::from("test_val1").into_bytes());
let value1_update = StateValue::from(String::from("test_val1_update").into_bytes());
let value2 = StateValue::from(String::from("test_val2").into_bytes());
let value3 = StateValue::from(String::from("test_val3").into_bytes());
// Insert address1 with value 1 and verify new states.
let mut root = put_value_set(
store,
vec![(key1.clone(), value1.clone())],
0, /* version */
None,
);
verify_value_and_proof(store, key1.clone(), Some(&value1), 0, root);
verify_value_and_proof(store, key2.clone(), None, 0, root);
verify_value_and_proof(store, key3.clone(), None, 0, root);
// Insert address 1 with updated value1, address2 with value 2 and address3 with value3 and
// verify new states.
root = put_value_set(
store,
vec![
(key1.clone(), value1_update.clone()),
(key2.clone(), value2.clone()),
(key3.clone(), value3.clone()),
],
1, /* version */
Some(0),
);
verify_value_and_proof(store, key1, Some(&value1_update), 1, root);
verify_value_and_proof(store, key2, Some(&value2), 1, root);
verify_value_and_proof(store, key3, Some(&value3), 1, root);
}
fn traverse_values(
store: &StateStore,
prefix: &StateKeyPrefix,
version: Version,
) -> HashMap<StateKey, StateValue> {
let mut ret = HashMap::new();
let mut cursor = None;
loop {
let mut iter = store
.get_prefixed_state_value_iterator(prefix, cursor.as_ref(), version)
.unwrap();
if let Some((k, v)) = iter.next().transpose().unwrap() {
ret.insert(k, v);
}
cursor = iter.next().transpose().unwrap().map(|(k, _v)| k);
if cursor.is_none() {
return ret;
}
}
}
#[test]
fn test_get_values_by_key_prefix() {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
let address = AccountAddress::new([12u8; AccountAddress::LENGTH]);
let key1 = StateKey::AccessPath(AccessPath::new(address, b"state_key1".to_vec()));
let key2 = StateKey::AccessPath(AccessPath::new(address, b"state_key2".to_vec()));
let value1_v0 = StateValue::from(String::from("value1_v0").into_bytes());
let value2_v0 = StateValue::from(String::from("value2_v0").into_bytes());
let account_key_prefx = StateKeyPrefix::new(StateKeyTag::AccessPath, address.to_vec());
put_value_set(
store,
vec![
(key1.clone(), value1_v0.clone()),
(key2.clone(), value2_v0.clone()),
],
0,
None,
);
let key_value_map = traverse_values(store, &account_key_prefx, 0);
assert_eq!(key_value_map.len(), 2);
assert_eq!(*key_value_map.get(&key1).unwrap(), value1_v0);
assert_eq!(*key_value_map.get(&key2).unwrap(), value2_v0);
let key4 = StateKey::AccessPath(AccessPath::new(address, b"state_key4".to_vec()));
let value2_v1 = StateValue::from(String::from("value2_v1").into_bytes());
let value4_v1 = StateValue::from(String::from("value4_v1").into_bytes());
put_value_set(
store,
vec![
(key2.clone(), value2_v1.clone()),
(key4.clone(), value4_v1.clone()),
],
1,
Some(0),
);
// Ensure that we still get only values for key1 and key2 for version 0 after the update
let key_value_map = traverse_values(store, &account_key_prefx, 0);
assert_eq!(key_value_map.len(), 2);
assert_eq!(*key_value_map.get(&key1).unwrap(), value1_v0);
assert_eq!(*key_value_map.get(&key2).unwrap(), value2_v0);
// Ensure that key value map for version 1 returns value for key1 at version 0.
let key_value_map = traverse_values(store, &account_key_prefx, 1);
assert_eq!(key_value_map.len(), 3);
assert_eq!(*key_value_map.get(&key1).unwrap(), value1_v0);
assert_eq!(*key_value_map.get(&key2).unwrap(), value2_v1);
assert_eq!(*key_value_map.get(&key4).unwrap(), value4_v1);
// Add values for one more account and verify the state
let address1 = AccountAddress::new([22u8; AccountAddress::LENGTH]);
let key5 = StateKey::AccessPath(AccessPath::new(address1, b"state_key5".to_vec()));
let value5_v2 = StateValue::from(String::from("value5_v2").into_bytes());
let account1_key_prefx = StateKeyPrefix::new(StateKeyTag::AccessPath, address1.to_vec());
put_value_set(store, vec![(key5.clone(), value5_v2.clone())], 2, Some(1));
// address1 did not exist in version 0 and 1.
let key_value_map = traverse_values(store, &account1_key_prefx, 0);
assert_eq!(key_value_map.len(), 0);
let key_value_map = traverse_values(store, &account1_key_prefx, 1);
assert_eq!(key_value_map.len(), 0);
let key_value_map = traverse_values(store, &account1_key_prefx, 2);
assert_eq!(key_value_map.len(), 1);
assert_eq!(*key_value_map.get(&key5).unwrap(), value5_v2);
}
#[test]
pub fn test_get_state_snapshot_before() {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
// Empty store
assert_eq!(store.get_state_snapshot_before(0).unwrap(), None,);
// put in genesis
let kv = vec![(
StateKey::Raw(b"key".to_vec()),
StateValue::from(b"value".to_vec()),
)];
let hash = put_value_set(store, kv.clone(), 0, None);
assert_eq!(store.get_state_snapshot_before(0).unwrap(), None);
assert_eq!(store.get_state_snapshot_before(1).unwrap(), Some((0, hash)));
assert_eq!(store.get_state_snapshot_before(2).unwrap(), Some((0, hash)));
// hack: VersionData expected on every version, so duplicate the data at version 1
let usage = store.get_usage(Some(0)).unwrap();
store
.ledger_db
.put::<VersionDataSchema>(&1, &usage.into())
.unwrap();
// put in another version
put_value_set(store, kv, 2, Some(0));
assert_eq!(store.get_state_snapshot_before(4).unwrap(), Some((2, hash)));
assert_eq!(store.get_state_snapshot_before(3).unwrap(), Some((2, hash)));
assert_eq!(store.get_state_snapshot_before(2).unwrap(), Some((0, hash)));
assert_eq!(store.get_state_snapshot_before(1).unwrap(), Some((0, hash)));
assert_eq!(store.get_state_snapshot_before(0).unwrap(), None,);
}
proptest! {
#![proptest_config(ProptestConfig::with_cases(10))]
#[test]
fn test_get_account_iter(
input in hash_map(any::<StateKey>(), any::<StateValue>(), 1..200)
) {
// Convert to a vector so iteration order becomes deterministic.
let kvs: Vec<_> = input.into_iter().collect();
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
init_store(store, kvs.clone().into_iter());
// Test iterator at each version.
for i in 0..kvs.len() {
let actual_values = db
.get_backup_handler()
.get_account_iter(i as Version)
.unwrap()
.collect::<Result<Vec<_>>>()
.unwrap();
let mut expected_values: Vec<_> = kvs[..=i]
.iter()
.map(|(key, value)| (key.clone(), value.clone()))
.collect();
expected_values.sort_unstable_by_key(|item| item.0.hash());
prop_assert_eq!(actual_values, expected_values);
}
}
#[test]
fn test_raw_restore(
(input, batch1_size) in hash_map(any::<StateKey>(), any::<StateValue>(), 2..1000)
.prop_flat_map(|input| {
let len = input.len();
(Just(input), 1..len)
})
) {
let tmp_dir1 = TempPath::new();
let db1 = AptosDB::new_for_test(&tmp_dir1);
let store1 = &db1.state_store;
init_store(store1, input.clone().into_iter());
let version = (input.len() - 1) as Version;
let expected_root_hash = store1.get_root_hash(version).unwrap();
let tmp_dir2 = TempPath::new();
let db2 = AptosDB::new_for_test(&tmp_dir2);
let store2 = &db2.state_store;
let mut restore =
StateSnapshotRestore::new(&store2.state_merkle_db, store2, version, expected_root_hash, true /* async_commit */).unwrap();
let mut ordered_input: Vec<_> = input
.into_iter()
.collect();
ordered_input.sort_unstable_by_key(|(key, _value)| key.hash());
let batch1: Vec<_> = ordered_input
.clone()
.into_iter()
.take(batch1_size)
.collect();
let rightmost_of_batch1 = batch1.last().map(|(key, _value)| key.hash()).unwrap();
let proof_of_batch1 = store1
.get_value_range_proof(rightmost_of_batch1, version)
.unwrap();
restore.add_chunk(batch1, proof_of_batch1).unwrap();
let batch2: Vec<_> = ordered_input
.into_iter()
.skip(batch1_size)
.collect();
let rightmost_of_batch2 = batch2.last().map(|(key, _value)| key.hash()).unwrap();
let proof_of_batch2 = store1
.get_value_range_proof(rightmost_of_batch2, version)
.unwrap();
restore.add_chunk(batch2, proof_of_batch2).unwrap();
restore.finish().unwrap();
let actual_root_hash = store2.get_root_hash(version).unwrap();
prop_assert_eq!(actual_root_hash, expected_root_hash);
}
#[test]
fn test_restore(
(input, batch_size) in hash_map(any::<StateKey>(), any::<StateValue>(), 2..1000)
.prop_flat_map(|input| {
let len = input.len();
(Just(input), 1..len*2)
})
) {
let tmp_dir1 = TempPath::new();
let db1 = AptosDB::new_for_test(&tmp_dir1);
let store1 = &db1.state_store;
init_store(store1, input.clone().into_iter());
let version = (input.len() - 1) as Version;
let expected_root_hash = store1.get_root_hash(version).unwrap();
prop_assert_eq!(
store1.get_value_count(version).unwrap(),
input.len()
);
let tmp_dir2 = TempPath::new();
let db2 = AptosDB::new_for_test(&tmp_dir2);
let store2 = &db2.state_store;
let mut restore = store2.get_snapshot_receiver(version, expected_root_hash).unwrap();
let mut current_idx = 0;
while current_idx < input.len() {
let chunk = store1.get_value_chunk_with_proof(version, current_idx, batch_size).unwrap();
restore.add_chunk(chunk.raw_values, chunk.proof).unwrap();
current_idx += batch_size;
}
restore.finish_box().unwrap();
let actual_root_hash = store2.get_root_hash(version).unwrap();
prop_assert_eq!(actual_root_hash, expected_root_hash);
prop_assert_eq!(
store2.get_value_count(version).unwrap(),
input.len()
);
}
#[test]
fn test_get_rightmost_leaf(
(input, batch1_size) in hash_map(any::<StateKey>(), any::<StateValue>(), 2..1000)
.prop_flat_map(|input| {
let len = input.len();
(Just(input), 1..len)
})
) {
let tmp_dir1 = TempPath::new();
let db1 = AptosDB::new_for_test(&tmp_dir1);
let store1 = &db1.state_store;
init_store(store1, input.clone().into_iter());
let version = (input.len() - 1) as Version;
let expected_root_hash = store1.get_root_hash(version).unwrap();
let tmp_dir2 = TempPath::new();
let db2 = AptosDB::new_for_test(&tmp_dir2);
let store2 = &db2.state_store;
let max_hash = HashValue::new([0xff; HashValue::LENGTH]);
let mut restore =
StateSnapshotRestore::new(&store2.state_merkle_db, store2, version, expected_root_hash, true, /* async_commit */).unwrap();
let dummy_state_key = StateKey::Raw(vec![]);
let (batch, _) = store2.state_merkle_db.merklize_value_set(vec![(max_hash, Some(&(HashValue::random(), dummy_state_key)))], None, 0, None, None).unwrap();
store2.state_merkle_db.db.write_schemas(batch).unwrap();
assert!(store2.state_merkle_db.get_rightmost_leaf(version).unwrap().is_none());
let mut ordered_input: Vec<_> = input
.into_iter()
.collect();
ordered_input.sort_unstable_by_key(|(key, _value)| key.hash());
let batch1: Vec<_> = ordered_input
.into_iter()
.take(batch1_size)
.collect();
let rightmost_of_batch1 = batch1.last().map(|(key, _value)| key.hash()).unwrap();
let proof_of_batch1 = store1
.get_value_range_proof(rightmost_of_batch1, version)
.unwrap();
restore.add_chunk(batch1, proof_of_batch1).unwrap();
restore.wait_for_async_commit().unwrap();
let expected = store2.state_merkle_db.get_rightmost_leaf_naive(version).unwrap();
let actual = store2.state_merkle_db.get_rightmost_leaf(version).unwrap();
prop_assert_eq!(actual, expected);
}
#[test]
fn test_get_usage(
input in arb_state_kv_sets(10, 5, 5)
) {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
let mut version = 0;
for batch in input {
let next_version = version + batch.len() as Version;
let root_hash = update_store(store, batch.into_iter(), version);
let last_version = next_version - 1;
let snapshot = db
.get_backup_handler()
.get_account_iter(last_version)
.unwrap()
.collect::<Result<Vec<_>>>()
.unwrap();
let (items, bytes) = snapshot.iter().fold((0, 0), |(items, bytes), (k, v)| {
(items + 1, bytes + k.size() + v.size())
});
let expected_usage = StateStorageUsage::new(items, bytes);
prop_assert_eq!(
expected_usage,
store.get_usage(Some(last_version)).unwrap(),
"version: {} next_version: {}",
version,
next_version,
);
// Check db-restore calculates usage correctly as well.
let tmp_dir = TempPath::new();
let db2 = AptosDB::new_for_test(&tmp_dir);
let mut restore = db2.get_state_snapshot_receiver(100, root_hash).unwrap();
let proof = if let Some((k, _v)) = snapshot.last() {
db.get_backup_handler().get_account_state_range_proof(k.hash(), last_version).unwrap()
} else {
SparseMerkleRangeProof::new(vec![])
};
restore.add_chunk(snapshot, proof).unwrap();
restore.finish_box().unwrap();
prop_assert_eq!(
expected_usage,
db2.state_store.get_usage(Some(100)).unwrap(),
"version: {} next_version: {}",
version,
next_version,
);
version = next_version;
}
}
}
// Initializes the state store by inserting one key at each version.
fn init_store(store: &StateStore, input: impl Iterator<Item = (StateKey, StateValue)>) {
update_store(store, input.into_iter().map(|(k, v)| (k, Some(v))), 0);
}
| {'content_hash': '8c3b2b67099d4671f5c535432dc0b95b', 'timestamp': '', 'source': 'github', 'line_count': 513, 'max_line_length': 162, 'avg_line_length': 36.09356725146199, 'alnum_prop': 0.5772305033484554, 'repo_name': 'aptos-labs/aptos-core', 'id': '5498a23f7c20153ec10fef567c5ed36b8268e2ed', 'size': '18516', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'storage/aptosdb/src/state_store/state_store_test.rs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Boogie', 'bytes': '62'}, {'name': 'CSS', 'bytes': '31355'}, {'name': 'Dockerfile', 'bytes': '10300'}, {'name': 'Go', 'bytes': '1308'}, {'name': 'HCL', 'bytes': '190756'}, {'name': 'HTML', 'bytes': '2168'}, {'name': 'JavaScript', 'bytes': '48386'}, {'name': 'Makefile', 'bytes': '2632'}, {'name': 'Move', 'bytes': '1354163'}, {'name': 'Mustache', 'bytes': '21042'}, {'name': 'PLpgSQL', 'bytes': '1145'}, {'name': 'PowerShell', 'bytes': '842'}, {'name': 'Python', 'bytes': '240445'}, {'name': 'Rust', 'bytes': '10592521'}, {'name': 'Shell', 'bytes': '69203'}, {'name': 'Smarty', 'bytes': '1224'}, {'name': 'TypeScript', 'bytes': '513895'}]} |
<?php
if (!defined('APPPATH'))
exit('No direct script access allowed');
/**
* views/template.php
*
* Pass in $pagetitle (which will in turn be passed along)
* and $pagebody, the name of the content view.
*
* ------------------------------------------------------------------------
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{title}</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<h1>{title}</h1>
</div>
</div>
<div id="content">
{content}
</div>
</div>
</body>
</html>
| {'content_hash': '954c7ad4f076bd29b6b4096ce7c930c8', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 109, 'avg_line_length': 30.28125, 'alnum_prop': 0.49226006191950467, 'repo_name': '4711Lab7/timetable', 'id': '311b431ba694e89f06d06fa43d5fba1782776a8c', 'size': '969', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'application/views/_template.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '123'}, {'name': 'HTML', 'bytes': '1965'}, {'name': 'PHP', 'bytes': '92695'}]} |
import { Injectable } from '@angular/core';
@Injectable()
export class ListData {
private items: Array<any> = [];
constructor() {
const str: string = 'ABCJLDEFGOQRHINSXY';
for (let i: number = 0; i < str.length; i++) {
const nextChar: string = str.charAt(i);
for (let j: number = 0; j < 3; j++) {
const name: string = nextChar + 'name' + j;
this.items.push({
name: name,
description: 'My name is ' + name
});
}
}
}
list(): Promise<Array<any>> {
return new Promise<Array<any>>(resolve => {
resolve(this.items);
});
}
filter(searchTerm): Promise<Array<any>> {
searchTerm = searchTerm || '';
return new Promise<Array<any>>(resolve => {
resolve(this.items.filter((item) => {
return item.name.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1;
}));
});
}
}
| {'content_hash': '969f98b382c98f0b63883e3b5f867845', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 78, 'avg_line_length': 25.514285714285716, 'alnum_prop': 0.5531914893617021, 'repo_name': 'squallliu/ionic2-demo', 'id': '7eba313cdb5db9235f845978cdd97a4114ca1fae', 'size': '893', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/providers/list-data.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '3647'}, {'name': 'HTML', 'bytes': '10746'}, {'name': 'JavaScript', 'bytes': '741'}, {'name': 'TypeScript', 'bytes': '21645'}]} |
package com.restfiddle.controller.rest;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.restfiddle.dao.DataMapRepository;
import com.restfiddle.dto.DataMapDTO;
import com.restfiddle.entity.DataMap;
@RestController
@EnableAutoConfiguration
@ComponentScan
@Transactional
public class DataMapController {
Logger logger = LoggerFactory.getLogger(DataMapController.class);
@Resource
private DataMapRepository dataMapRepository;
@RequestMapping(value = "/api/dataMaps", method = RequestMethod.POST, headers = "Accept=application/json")
public @ResponseBody
DataMap create(@RequestBody DataMapDTO dataMapDTO) {
logger.debug("Creating a new dataMap with information: " + dataMapDTO);
DataMap dataMap = new DataMap();
dataMap.setDataKey(dataMapDTO.getKey());
dataMap.setValue(dataMapDTO.getValue());
dataMap.setType(dataMapDTO.getType());
return dataMapRepository.save(dataMap);
}
@RequestMapping(value = "/api/dataMaps/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
public @ResponseBody
DataMap delete(@PathVariable("id") String id) {
logger.debug("Deleting dataMap with id: " + id);
DataMap deleted = dataMapRepository.findOne(id);
dataMapRepository.delete(deleted);
return deleted;
}
@RequestMapping(value = "/api/dataMaps", method = RequestMethod.GET)
public @ResponseBody
List<DataMap> findAll() {
logger.debug("Finding all dataMaps");
return dataMapRepository.findAll();
}
@RequestMapping(value = "/api/dataMaps/{id}", method = RequestMethod.GET)
public @ResponseBody
DataMap findById(@PathVariable("id") String id) {
logger.debug("Finding dataMap by id: " + id);
return dataMapRepository.findOne(id);
}
@RequestMapping(value = "/api/dataMaps/{id}", method = RequestMethod.PUT, headers = "Accept=application/json")
public @ResponseBody
DataMap update(@PathVariable("id") Long id, @RequestBody DataMapDTO updated) {
logger.debug("Updating dataMap with information: " + updated);
DataMap dataMap = dataMapRepository.findOne(updated.getId());
dataMap.setDataKey(updated.getKey());
dataMap.setValue(updated.getValue());
return dataMap;
}
}
| {'content_hash': '0b7bab8ba268a8aa826d2844ae3e43da', 'timestamp': '', 'source': 'github', 'line_count': 86, 'max_line_length': 117, 'avg_line_length': 32.98837209302326, 'alnum_prop': 0.7698272823405006, 'repo_name': 'chiranjeevjain/restfiddle', 'id': '7b375b4924f45a5d9ded1c67b8da3df6455071a3', 'size': '3430', 'binary': False, 'copies': '10', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/restfiddle/controller/rest/DataMapController.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '232428'}, {'name': 'Java', 'bytes': '437665'}, {'name': 'JavaScript', 'bytes': '275839'}]} |
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') {
options = options || {};
if (value === null) {
value = '';
options = $.extend({}, options);
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
}; | {'content_hash': '262ef39fb706b9b1479c003f27537fbf', 'timestamp': '', 'source': 'github', 'line_count': 38, 'max_line_length': 118, 'avg_line_length': 56.78947368421053, 'alnum_prop': 0.3493975903614458, 'repo_name': 'liuzirui1122/Danmaku-Universe', 'id': '925f363417deb95397eafa06f6a5a7b5d0a08010', 'size': '2158', 'binary': False, 'copies': '15', 'ref': 'refs/heads/master', 'path': 'assets/js/cookie.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '64266'}, {'name': 'HTML', 'bytes': '7090'}, {'name': 'JavaScript', 'bytes': '133424'}]} |
package com.InfinityRaider.elemancy.magic.spell.zone;
import com.InfinityRaider.elemancy.magic.DuplicateSpellException;
import com.InfinityRaider.elemancy.magic.Element;
import com.InfinityRaider.elemancy.magic.spell.SpellZone;
import com.InfinityRaider.elemancy.reference.Names;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public final class SpellSunstrike extends SpellZone {
public SpellSunstrike() throws DuplicateSpellException {
super(Element.FIRE, Element.FIRE, Names.Spells.SUNSTRIKE);
}
@Override
public boolean isChanneled() {
return false;
}
@Override
public void castSpell(World world, int x, int y, int z, EntityPlayer player, int lvl1, int lvl2, int channelTicks) {
}
@Override
public void onStopChannel(World world, int x, int y, int z, EntityPlayer player, int lvl1, int lvl2, int channelTicks) {
}
@Override
public void spellParticles(World world, int x, int y, int z, EntityPlayer player, int lvl1, int lvl2, int channelTicks) {
}
}
| {'content_hash': 'a1adac685b1ada5322f93e003b11b525', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 125, 'avg_line_length': 31.5, 'alnum_prop': 0.742296918767507, 'repo_name': 'InfinityRaider/Elemancy', 'id': '29b76bbc21c4043212f79406ccbd36e695d03efc', 'size': '1071', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/InfinityRaider/elemancy/magic/spell/zone/SpellSunstrike.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '169712'}]} |
package com.amazonaws.services.ec2.model;
import java.io.Serializable;
/**
* <p>
* Describes the S3 bucket for the disk image.
* </p>
*/
public class UserBucketDetails implements Serializable, Cloneable {
/**
* The S3 bucket from which the disk image was created.
*/
private String s3Bucket;
/**
* The key from which the disk image was created.
*/
private String s3Key;
/**
* The S3 bucket from which the disk image was created.
*
* @return The S3 bucket from which the disk image was created.
*/
public String getS3Bucket() {
return s3Bucket;
}
/**
* The S3 bucket from which the disk image was created.
*
* @param s3Bucket The S3 bucket from which the disk image was created.
*/
public void setS3Bucket(String s3Bucket) {
this.s3Bucket = s3Bucket;
}
/**
* The S3 bucket from which the disk image was created.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param s3Bucket The S3 bucket from which the disk image was created.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public UserBucketDetails withS3Bucket(String s3Bucket) {
this.s3Bucket = s3Bucket;
return this;
}
/**
* The key from which the disk image was created.
*
* @return The key from which the disk image was created.
*/
public String getS3Key() {
return s3Key;
}
/**
* The key from which the disk image was created.
*
* @param s3Key The key from which the disk image was created.
*/
public void setS3Key(String s3Key) {
this.s3Key = s3Key;
}
/**
* The key from which the disk image was created.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param s3Key The key from which the disk image was created.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public UserBucketDetails withS3Key(String s3Key) {
this.s3Key = s3Key;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getS3Bucket() != null) sb.append("S3Bucket: " + getS3Bucket() + ",");
if (getS3Key() != null) sb.append("S3Key: " + getS3Key() );
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getS3Bucket() == null) ? 0 : getS3Bucket().hashCode());
hashCode = prime * hashCode + ((getS3Key() == null) ? 0 : getS3Key().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof UserBucketDetails == false) return false;
UserBucketDetails other = (UserBucketDetails)obj;
if (other.getS3Bucket() == null ^ this.getS3Bucket() == null) return false;
if (other.getS3Bucket() != null && other.getS3Bucket().equals(this.getS3Bucket()) == false) return false;
if (other.getS3Key() == null ^ this.getS3Key() == null) return false;
if (other.getS3Key() != null && other.getS3Key().equals(this.getS3Key()) == false) return false;
return true;
}
@Override
public UserBucketDetails clone() {
try {
return (UserBucketDetails) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!",
e);
}
}
}
| {'content_hash': '8a630aa39694faee1eb5a63004b70816', 'timestamp': '', 'source': 'github', 'line_count': 147, 'max_line_length': 114, 'avg_line_length': 29.0, 'alnum_prop': 0.5829228243021346, 'repo_name': 'seoj/aws-sdk-java', 'id': '45c1f6672d5ec9724d5e5e5d4d355a0a74bbbde0', 'size': '4850', 'binary': False, 'copies': '28', 'ref': 'refs/heads/master', 'path': 'aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/UserBucketDetails.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '88239405'}, {'name': 'Scilab', 'bytes': '2436'}]} |
The branch for the (Bacterial Battle Web Page)[http://pajtai.github.com/Bacterial-Battle/] | {'content_hash': 'ecb54530e9e6eaf3a3731556e358520d', 'timestamp': '', 'source': 'github', 'line_count': 1, 'max_line_length': 90, 'avg_line_length': 90.0, 'alnum_prop': 0.7888888888888889, 'repo_name': 'pajtai/Bacterial-Battle', 'id': '0f65104522f264f31fb599c4bb78b309d2e646bb', 'size': '90', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'targets/live/README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CoffeeScript', 'bytes': '16824'}, {'name': 'JavaScript', 'bytes': '39068'}]} |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include "sysrepo.h"
#include "sysrepo/values.h"
volatile int exit_application = 0;
static int
rpc_cb(const char *xpath, const sr_val_t *input, const size_t input_cnt,
sr_val_t **output, size_t *output_cnt, void *private_ctx)
{
int rc = SR_ERR_OK;
sr_val_t *notif = NULL;
sr_session_ctx_t *session = (sr_session_ctx_t *)private_ctx;
/* print input values */
printf("\n\n ========== RECEIVED RPC REQUEST ==========\n\n");
printf(">>> RPC Input:\n\n");
for (size_t i = 0; i < input_cnt; ++i) {
sr_print_val(input+i);
}
printf("\n");
/**
* Here you would actually run the operation against the provided input values
* and obtained the output values.
*/
printf(">>> Executing RPC...\n\n");
/* allocate output values */
rc = sr_new_values(2, output);
if (SR_ERR_OK != rc) {
return rc;
}
/* set 'output/step-count' leaf */
rc = sr_val_set_xpath(&(*output)[0], "/turing-machine:run-until/step-count");
if (SR_ERR_OK != rc) {
return rc;
}
(*output)[0].type = SR_UINT64_T;
(*output)[0].data.uint64_val = 256;
/* set 'output/halted' leaf */
rc = sr_val_set_xpath(&(*output)[1], "/turing-machine:run-until/halted");
if (SR_ERR_OK != rc) {
return rc;
}
(*output)[1].type = SR_BOOL_T;
(*output)[1].data.bool_val = false;
/* inform sysrepo about the number of output values */
*output_cnt = 2;
printf(">>> RPC Output:\n\n");
for (size_t i = 0; i < *output_cnt; ++i) {
sr_print_val(&(*output)[i]);
}
printf("\n");
/* convert input values into data for the notification */
rc = sr_dup_values(input, input_cnt, ¬if);
if (SR_ERR_OK != rc) {
return rc;
}
/* note: sysrepo values are bind to xpath, which is different for the notification */
for (size_t i = 0; i < input_cnt; ++i) {
rc = sr_val_build_xpath(¬if[i], "/turing-machine:paused/%s",
notif[i].xpath+strlen("/turing-machine:run-until/"));
if (SR_ERR_OK != rc) {
sr_free_values(notif, input_cnt);
return rc;
}
}
/* send notification for event_notif_sub(_tree)_example */
printf(">>> Sending event notification for '/turing-machine:paused'...\n");
rc = sr_event_notif_send(session, "/turing-machine:paused", notif, input_cnt);
if (SR_ERR_NOT_FOUND == rc) {
printf("No application subscribed for '/turing-machine:paused', skipping.\n"
"(run event_notif_sub_example or event_notif_sub_tree_example)\n\n");
rc = SR_ERR_OK;
}
sr_free_values(notif, input_cnt);
/**
* Do not deallocate input values!
* They will get freed automatically by sysrepo.
*/
printf(">>> RPC finished.\n\n");
return rc;
}
static void
sigint_handler(int signum)
{
exit_application = 1;
}
static int
rpc_handler(sr_session_ctx_t *session)
{
sr_subscription_ctx_t *subscription = NULL;
int rc = SR_ERR_OK;
/* subscribe for handling RPC */
rc = sr_rpc_subscribe(session, "/turing-machine:run-until", rpc_cb,
(void *)session, SR_SUBSCR_DEFAULT, &subscription);
if (SR_ERR_OK != rc) {
fprintf(stderr, "Error by sr_rpc_subscribe: %s\n", sr_strerror(rc));
goto cleanup;
}
printf("\n\n ========== SUBSCRIBED FOR HANDLING RPC ==========\n\n");
/* loop until ctrl-c is pressed / SIGINT is received */
signal(SIGINT, sigint_handler);
signal(SIGPIPE, SIG_IGN);
while (!exit_application) {
sleep(1000); /* or do some more useful work... */
}
printf("Application exit requested, exiting.\n");
cleanup:
if (NULL != subscription) {
sr_unsubscribe(session, subscription);
}
return rc;
}
static int
rpc_caller(sr_session_ctx_t *session)
{
sr_val_t *input = NULL, *output = NULL;
size_t output_cnt = 0, input_cnt = 0;
int rc = SR_ERR_OK;
/* allocate input values */
input_cnt = 7;
rc = sr_new_values(input_cnt, &input);
if (SR_ERR_OK != rc) {
return rc;
}
/* set 'input/state' leaf */
rc = sr_val_set_xpath(&input[0], "/turing-machine:run-until/state");
if (SR_ERR_OK != rc) {
return rc;
}
input[0].type = SR_UINT16_T;
input[0].data.uint16_val = 10;
/* set 'input/head-position' leaf */
rc = sr_val_set_xpath(&input[1], "/turing-machine:run-until/head-position");
if (SR_ERR_OK != rc) {
return rc;
}
input[1].type = SR_INT64_T;
input[1].data.uint16_val = 123;
/* set 'input/tape' list entries */
for (size_t i = 0; i < 5; ++i) {
rc = sr_val_build_xpath(&input[i+2], "/turing-machine:run-until/tape/cell[coord='%d']/symbol", i);
if (SR_ERR_OK != rc) {
return rc;
}
sr_val_build_str_data(&input[i+2], SR_STRING_T, "%c", 'A'+i);
}
printf("\n\n ========== EXECUTING RPC ==========\n\n");
printf(">>> RPC Input:\n\n");
for (size_t i = 0; i < input_cnt; ++i) {
sr_print_val(&input[i]);
}
printf("\n");
/* execute RPC */
rc = sr_rpc_send(session, "/turing-machine:run-until", input, input_cnt, &output, &output_cnt);
if (SR_ERR_OK != rc) {
return rc;
}
/* print output values */
printf("\n>>> Received an RPC response:\n\n");
for (size_t i = 0; i < output_cnt; ++i) {
sr_print_val(output+i);
}
printf("\n");
/* don't forget to de-allocate the output values */
sr_free_values(output, output_cnt);
return SR_ERR_OK;
}
int
main(int argc, char **argv)
{
sr_conn_ctx_t *connection = NULL;
sr_session_ctx_t *session = NULL;
int rc = SR_ERR_OK;
/* connect to sysrepo */
rc = sr_connect("example_application", SR_CONN_DEFAULT, &connection);
if (SR_ERR_OK != rc) {
fprintf(stderr, "Error by sr_connect: %s\n", sr_strerror(rc));
goto cleanup;
}
/* start session */
rc = sr_session_start(connection, SR_DS_RUNNING, SR_SESS_DEFAULT, &session);
if (SR_ERR_OK != rc) {
fprintf(stderr, "Error by sr_session_start: %s\n", sr_strerror(rc));
goto cleanup;
}
if (1 == argc) {
/* run as a RPC handler */
printf("This application will be an RPC handler for 'run-until' operation of 'turing-machine'.\n");
printf("Run the same executable (or rpc_tree_example) with one (any) argument to execute the RPC.\n");
rc = rpc_handler(session);
} else {
/* run as a RPC caller */
printf("Executing RPC 'run-until' of 'turing-machine':\n");
rc = rpc_caller(session);
}
cleanup:
if (NULL != session) {
sr_session_stop(session);
}
if (NULL != connection) {
sr_disconnect(connection);
}
return rc;
}
| {'content_hash': 'cc7ea864d8a6bce6648d4b0ee1f21177', 'timestamp': '', 'source': 'github', 'line_count': 241, 'max_line_length': 110, 'avg_line_length': 28.717842323651453, 'alnum_prop': 0.5626354573038578, 'repo_name': 'fanchanghu/sysrepo', 'id': '088913d4e536068520238e06e25f6a4c15a3052a', 'size': '7730', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'examples/rpc_example.c', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2657230'}, {'name': 'C++', 'bytes': '123254'}, {'name': 'CMake', 'bytes': '40853'}, {'name': 'Go', 'bytes': '12296'}, {'name': 'Java', 'bytes': '11750'}, {'name': 'Lua', 'bytes': '18362'}, {'name': 'Protocol Buffer', 'bytes': '27154'}, {'name': 'Python', 'bytes': '116279'}, {'name': 'Ruby', 'bytes': '1481'}, {'name': 'Shell', 'bytes': '4217'}]} |
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/** @addtogroup STM32F4xx_HAL_Driver
* @{
*/
/** @defgroup SAIEx SAIEx
* @brief SAI Extension HAL module driver
* @{
*/
#ifdef HAL_SAI_MODULE_ENABLED
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || \
defined(STM32F423xx)
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* SAI registers Masks */
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup SAI_Private_Functions SAI Private Functions
* @{
*/
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup SAIEx_Exported_Functions SAI Extended Exported Functions
* @{
*/
/** @defgroup SAIEx_Exported_Functions_Group1 Extension features functions
* @brief Extension features functions
*
@verbatim
===============================================================================
##### Extension features Functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to manage the possible
SAI clock sources.
@endverbatim
* @{
*/
/**
* @brief Configure SAI Block synchronization mode
* @param hsai: pointer to a SAI_HandleTypeDef structure that contains
* the configuration information for SAI module.
* @retval SAI Clock Input
*/
void SAI_BlockSynchroConfig(SAI_HandleTypeDef *hsai)
{
uint32_t tmpregisterGCR = 0U;
#if defined(STM32F446xx)
/* This setting must be done with both audio block (A & B) disabled */
switch(hsai->Init.SynchroExt)
{
case SAI_SYNCEXT_DISABLE :
tmpregisterGCR = 0U;
break;
case SAI_SYNCEXT_OUTBLOCKA_ENABLE :
tmpregisterGCR = SAI_GCR_SYNCOUT_0;
break;
case SAI_SYNCEXT_OUTBLOCKB_ENABLE :
tmpregisterGCR = SAI_GCR_SYNCOUT_1;
break;
default:
break;
}
if((hsai->Init.Synchro) == SAI_SYNCHRONOUS_EXT_SAI2)
{
tmpregisterGCR |= SAI_GCR_SYNCIN_0;
}
if((hsai->Instance == SAI1_Block_A) || (hsai->Instance == SAI1_Block_B))
{
SAI1->GCR = tmpregisterGCR;
}
else
{
SAI2->GCR = tmpregisterGCR;
}
#endif /* STM32F446xx */
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx)
/* This setting must be done with both audio block (A & B) disabled */
switch(hsai->Init.SynchroExt)
{
case SAI_SYNCEXT_DISABLE :
tmpregisterGCR = 0U;
break;
case SAI_SYNCEXT_OUTBLOCKA_ENABLE :
tmpregisterGCR = SAI_GCR_SYNCOUT_0;
break;
case SAI_SYNCEXT_OUTBLOCKB_ENABLE :
tmpregisterGCR = SAI_GCR_SYNCOUT_1;
break;
default:
break;
}
SAI1->GCR = tmpregisterGCR;
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */
}
/**
* @brief Get SAI Input Clock based on SAI source clock selection
* @param hsai: pointer to a SAI_HandleTypeDef structure that contains
* the configuration information for SAI module.
* @retval SAI Clock Input
*/
uint32_t SAI_GetInputClock(SAI_HandleTypeDef *hsai)
{
/* This variable used to store the SAI_CK_x (value in Hz) */
uint32_t saiclocksource = 0U;
#if defined(STM32F446xx)
if ((hsai->Instance == SAI1_Block_A) || (hsai->Instance == SAI1_Block_B))
{
saiclocksource = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SAI1);
}
else /* SAI2_Block_A || SAI2_Block_B*/
{
saiclocksource = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SAI2);
}
#endif /* STM32F446xx */
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx)
uint32_t vcoinput = 0U, tmpreg = 0U;
/* Check the SAI Block parameters */
assert_param(IS_SAI_CLK_SOURCE(hsai->Init.ClockSource));
/* SAI Block clock source selection */
if(hsai->Instance == SAI1_Block_A)
{
__HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(hsai->Init.ClockSource);
}
else
{
__HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG((uint32_t)(hsai->Init.ClockSource << 2U));
}
/* VCO Input Clock value calculation */
if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSI)
{
/* In Case the PLL Source is HSI (Internal Clock) */
vcoinput = (HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM));
}
else
{
/* In Case the PLL Source is HSE (External Clock) */
vcoinput = ((HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)));
}
#if defined(STM32F413xx) || defined(STM32F423xx)
/* SAI_CLK_x : SAI Block Clock configuration for different clock sources selected */
if(hsai->Init.ClockSource == SAI_CLKSOURCE_PLLR)
{
/* Configure the PLLI2S division factor */
/* PLL_VCO Input = PLL_SOURCE/PLLM */
/* PLL_VCO Output = PLL_VCO Input * PLLN */
/* SAI_CLK(first level) = PLL_VCO Output/PLLR */
tmpreg = (RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U;
saiclocksource = (vcoinput * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U))/(tmpreg);
/* SAI_CLK_x = SAI_CLK(first level)/PLLDIVR */
tmpreg = (((RCC->DCKCFGR & RCC_DCKCFGR_PLLDIVR) >> 8U) + 1U);
saiclocksource = saiclocksource/(tmpreg);
}
else if(hsai->Init.ClockSource == SAI_CLKSOURCE_PLLI2S)
{
/* Configure the PLLI2S division factor */
/* PLLI2S_VCO Input = PLL_SOURCE/PLLM */
/* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */
/* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SR */
tmpreg = (RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U;
saiclocksource = (vcoinput * ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U))/(tmpreg);
/* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVR */
tmpreg = ((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVR) + 1U);
saiclocksource = saiclocksource/(tmpreg);
}
else if(hsai->Init.ClockSource == SAI_CLKSOURCE_HS)
{
if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE)
{
/* Get the I2S source clock value */
saiclocksource = (uint32_t)(HSE_VALUE);
}
else
{
/* Get the I2S source clock value */
saiclocksource = (uint32_t)(HSI_VALUE);
}
}
else /* sConfig->ClockSource == SAI_CLKSource_Ext */
{
saiclocksource = EXTERNAL_CLOCK_VALUE;
}
#else
/* SAI_CLK_x : SAI Block Clock configuration for different clock sources selected */
if(hsai->Init.ClockSource == SAI_CLKSOURCE_PLLSAI)
{
/* Configure the PLLI2S division factor */
/* PLLSAI_VCO Input = PLL_SOURCE/PLLM */
/* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */
/* SAI_CLK(first level) = PLLSAI_VCO Output/PLLSAIQ */
tmpreg = (RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> 24U;
saiclocksource = (vcoinput * ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIN) >> 6U))/(tmpreg);
/* SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ */
tmpreg = (((RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVQ) >> 8U) + 1U);
saiclocksource = saiclocksource/(tmpreg);
}
else if(hsai->Init.ClockSource == SAI_CLKSOURCE_PLLI2S)
{
/* Configure the PLLI2S division factor */
/* PLLI2S_VCO Input = PLL_SOURCE/PLLM */
/* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */
/* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */
tmpreg = (RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> 24U;
saiclocksource = (vcoinput * ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U))/(tmpreg);
/* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ */
tmpreg = ((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVQ) + 1U);
saiclocksource = saiclocksource/(tmpreg);
}
else /* sConfig->ClockSource == SAI_CLKSource_Ext */
{
/* Enable the External Clock selection */
__HAL_RCC_I2S_CONFIG(RCC_I2SCLKSOURCE_EXT);
saiclocksource = EXTERNAL_CLOCK_VALUE;
}
#endif /* STM32F413xx || STM32F423xx */
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */
/* the return result is the value of SAI clock */
return saiclocksource;
}
/**
* @}
*/
/**
* @}
*/
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */
#endif /* HAL_SAI_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| {'content_hash': '5ee2f7851b3154afbb16b1192c4bf2b1', 'timestamp': '', 'source': 'github', 'line_count': 273, 'max_line_length': 145, 'avg_line_length': 33.362637362637365, 'alnum_prop': 0.5993631971892841, 'repo_name': 'dinkdeng/STM32Plus_IAR', 'id': 'bf0338c3d03359960841a1a4d3fab4a4fd7d11e8', 'size': '12033', 'binary': False, 'copies': '60', 'ref': 'refs/heads/master', 'path': 'IAR/CommonFiles/F4CommonFiles/HAL_Lib/Src/stm32f4xx_hal_sai_ex.c', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '1095520'}, {'name': 'C', 'bytes': '93675555'}, {'name': 'C++', 'bytes': '340251'}]} |
package vg.civcraft.mc.namelayer.command.commands;
import java.util.List;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import vg.civcraft.mc.namelayer.GroupManager.PlayerType;
import vg.civcraft.mc.namelayer.NameAPI;
import vg.civcraft.mc.namelayer.command.PlayerCommandMiddle;
import vg.civcraft.mc.namelayer.command.TabCompleters.GroupTabCompleter;
import vg.civcraft.mc.namelayer.group.Group;
import vg.civcraft.mc.namelayer.permission.PermissionType;
public class SetDefaultGroup extends PlayerCommandMiddle{
public SetDefaultGroup(String name) {
super(name);
setIdentifier("nlsdg");
setDescription("Set or change a default group");
setUsage("/nlsdg <group>");
setArguments(1,1);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("I don't think you need to do that.");
return true;
}
Player p = (Player) sender;
UUID uuid = NameAPI.getUUID(p.getName());
Group g = gm.getGroup(args[0]);
if (groupIsNull(sender, args[0], g)) {
return true;
}
PlayerType pType = g.getPlayerType(uuid);
if (pType == null){
p.sendMessage(ChatColor.RED + "You do not have access to that group.");
return true;
}
String x = gm.getDefaultGroup(uuid);
if(x == null){
g.setDefaultGroup(uuid);
p.sendMessage(ChatColor.GREEN + "You have set your default group to " + g.getName());
}
else{
g.changeDefaultGroup(uuid);
p.sendMessage(ChatColor.GREEN + "You changed your default group from " + x + " to " + gm.getDefaultGroup(uuid));
}
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
if (!(sender instanceof Player))
return null;
if (args.length == 1)
return GroupTabCompleter.complete(args[0], PermissionType.getPermission("BLOCKS"), (Player) sender);
else{
return GroupTabCompleter.complete(null, PermissionType.getPermission("BLOCKS"), (Player)sender);
}
}
}
| {'content_hash': '840e1d3ffaa78d158123ea4677a274da', 'timestamp': '', 'source': 'github', 'line_count': 69, 'max_line_length': 115, 'avg_line_length': 29.63768115942029, 'alnum_prop': 0.7276283618581907, 'repo_name': 'suirad/NameLayer', 'id': 'c267735542a63cc852680d2b8a386a18a395a7a3', 'size': '2045', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'namelayer-spigot/src/main/java/vg/civcraft/mc/namelayer/command/commands/SetDefaultGroup.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Java', 'bytes': '376008'}]} |
import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Header.css';
import Link from '../Link';
import Navigation from '../Navigation';
import logoUrl from './logo-small.png';
import logoUrl2x from './[email protected]';
class Header extends React.Component {
render() {
return (
<div className={s.root}>
<div className={s.container}>
<Navigation />
<Link className={s.brand} to="/">
<img src={logoUrl} srcSet={`${logoUrl2x} 2x`} width="38" height="38" alt="React"/>
<span className={s.brandTxt}>Yvan Blog</span>
</Link>
{/*<div className={s.banner}>
<h1 className={s.bannerTitle}>React</h1>
<p className={s.bannerDesc}>Complex web apps made easy</p>
</div>*/}
</div>
</div>
);
}
}
export default withStyles(s)(Header);
| {'content_hash': '61e46371591a7dbc3ccab3cdcd537e32', 'timestamp': '', 'source': 'github', 'line_count': 31, 'max_line_length': 106, 'avg_line_length': 34.0, 'alnum_prop': 0.5132827324478179, 'repo_name': 'yvanwangl/UniversalBlog', 'id': 'e4850a542903629969c086f42a3123c69324625e', 'size': '1318', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/components/Header/Header.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '14207'}, {'name': 'JavaScript', 'bytes': '76492'}]} |
import os
import sys
import sysconfig
from setuptools import setup
from setuptools import find_packages
from setuptools.command.test import test as test
from distutils.extension import Extension
from distutils.command.bdist import bdist
import distutils.cmd
import distutils.log
import pickle
import pprint
import hashlib
import subprocess
from subprocess import call
import shutil
import re
class Tox(test):
"""Setuptools test command to run Tox."""
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
"""Initialize test."""
test.initialize_options(self)
self.tox_args = None
def finalize_options(self):
"""Initialize test."""
test.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
"""Do the actual running of the tests."""
# import here, cause outside the eggs aren't loaded
import tox
import shlex
args = self.tox_args
if args:
args = shlex.split(self.tox_args)
errno = tox.cmdline(args=args)
sys.exit(errno)
class CythonModule(object):
"""Cython module to be compiled in Unreal Engine ecosystem."""
def __init__(self, pyx, announce):
"""Construct a CythonModule from the pyx path provided."""
super(CythonModule, self).__init__()
pyx = os.path.abspath(pyx)
if not os.path.exists(pyx):
raise Exception('Bad pyx path: {}'.format(pyx))
self.pyx = pyx
pxd, __ = os.path.splitext(pyx)
pxd = '{}.pxd'.format(pxd)
if os.path.exists(pxd):
self.pxd = pxd
basename, __ = os.path.splitext(os.path.basename(pyx))
self.name = basename
root_path = os.path.dirname(os.path.realpath(__file__))
relpath = os.path.relpath(pyx, root_path)
names = []
remaining = relpath
while True:
remaining, tail = os.path.split(remaining)
tail, __ = os.path.splitext(tail)
tail = tail.replace('_', '')
if len(tail) == 0:
break
names = [tail] + names
if len(names) < 2:
raise Exception("Unexpected path for module {}, should at least be inside 'unrealpy' and have a name. {}".format(pyx, names))
if names[0] != 'unrealpy':
raise Exception("Expected first directory to be 'unrealpy' for module {}".format(pyx))
names = names[1:]
if len(names) > 1 and names[-1] == names[-2]:
# if pyx file is same name as dir we only keep one
names = names[:-1]
# turn submodule/foo_bar into UnrealPy_Submodule_FooBar
self.unreal_name = 'UnrealPy_{}'.format(
'_'.join(names).title())
self.pch = 'Private/{}PrivatePCH.h'.format(self.unreal_name)
# this isn't right, but #yolo
self.announce = announce
def __repr__(self):
"""String repsresentation of module."""
return "{}".format(self.name)
def generate_cython(self, unreal_path):
"""Generate cython for this module."""
cython_output_file = self.cython_output_path(unreal_path)
output_dir = os.path.dirname(cython_output_file)
# make sure output dir exists
if not os.path.exists(output_dir):
os.makedirs(output_dir)
if call([
'cython',
'--verbose',
'--cplus',
'-o', cython_output_file,
'-I', 'unrealpy/',
self.pyx]) == 0:
pass
else:
raise Exception("cython command exited with non-zero status"
" for {0}".format(self.name))
# post-process the output
# add PCH include to make UE happy
lines = []
inc_pattern = re.compile('^\s*#include\s+[<"]([\w\.]+)[">]')
py_inc, py_lib, py_lib_name, _ = python_vars()
with open(cython_output_file) as fin:
for line in fin:
m = inc_pattern.match(line)
if m and m.group(1):
replacement = 'Python/{}'.format(m.group(1))
if os.path.exists(os.path.join(py_inc, replacement)):
# we prefix python header include with Python/
line = line.replace(
m.group(1), replacement)
self.announce(
"Replacing include to '{}' with '{}'".format(
m.group(1), replacement),
distutils.log.INFO)
lines.extend([line])
with open(cython_output_file, 'w') as fout:
fout.write("\n#include \"{}\"\n\n".format(self.pch))
for line in lines:
fout.write(line)
return cython_output_file
def generate_unreal_module(self, unreal_path):
"""Setup UE4 module for Cython module."""
build_file_path = os.path.join(
self.unreal_module_path(unreal_path),
'{}.Build.cs'.format(self.unreal_name))
py_inc, py_lib, py_lib_name, py_debug = python_vars()
#print(py_inc, py_lib, py_lib_name)
build_file_contents = """
// This file is generated by setup.py and edits will be overwritten!
using UnrealBuildTool;
using System.Diagnostics;
using System.IO;
public class {module_name} : ModuleRules
{{
public {module_name}(TargetInfo Target)
{{
// Cython does some shadowing :|
bEnableShadowVariableWarnings = false;
PublicDependencyModuleNames.AddRange(
new string[] {{
"Core",
"CoreUObject",
"Engine",
"UnrealEd",
}}
);
/** if true we will load Python debug libs */
const bool PythonDebug = {python_debug};
var LibName = "python27" + (PythonDebug ? "_d" : "");
// Path to Python include files
PrivateIncludePaths.Add("{python_include_path}");
Definitions.Add("WITH_PYTHON=1");
Definitions.Add("Py_ENABLE_SHARED=1");
if (PythonDebug)
{{
// We have some C extensions in here, and they have to link properly
Definitions.Add("Py_DEBUG=1");
Definitions.Add("_DEBUG=1");
}}
if (Target.Platform == UnrealTargetPlatform.Win64)
{{
PublicLibraryPaths.Add("{python_lib_path}");
PublicAdditionalLibraries.Add(LibName + ".lib");
RuntimeDependencies.Add(new RuntimeDependency(LibName + ".dll"));
}}
}}
}}
""".format(module_name=self.unreal_name,
python_include_path=py_inc.replace('\\', '\\\\'),
python_lib_path=py_lib.replace('\\', '\\\\'),
python_debug='true' if py_debug else 'false')
with open(build_file_path, 'w') as f:
f.write(build_file_contents)
self.add_to_ue_editor_target(unreal_path)
self.create_pch(unreal_path)
def add_to_ue_editor_target(self, unreal_path):
"""Inject UE module name into UE4Editor.Target.cs."""
editor_target_path = os.path.join(
unreal_path, 'Engine', 'Source', 'UE4Editor.Target.cs')
target_lines = []
marker_found = False
with open(editor_target_path, 'r') as fread:
for line in fread:
if marker_found:
target_lines.extend([line])
continue
else:
target_lines.extend([line])
if "@UNREALPY@" in line:
marker_found = True
target_lines.extend([
"OutExtraModuleNames.Add(\"{}\");\n".format(
self.unreal_name)])
with open(editor_target_path, 'w') as fwrite:
fwrite.write("".join(target_lines))
def create_pch(self, unreal_path):
"""Create PCH for module if it doesn't exist."""
pch_contents = """
// This file is generated by setup.py and edits will be overwritten!
#pragma warning (disable:4510)
#pragma warning (disable:4610)
#pragma warning (disable:4146)
#pragma warning (disable:4191)
#pragma warning (disable:4706)
#include "Core.h"
"""
with open(os.path.join(
unreal_path, 'Engine', 'Source', 'Editor',
self.unreal_name, self.pch), 'w') as f:
f.write(pch_contents)
def checksum(self):
"""Get checksum of module."""
# todo : recursively check dependencies too (from cimport+include)
# this is very temporary...
hasher = hashlib.sha256()
hasher.update(file_hash(self.pyx))
if hasattr(self, 'pxd'):
hasher.update(file_hash(self.pxd))
return hasher.hexdigest()
def python_lib_path(self, in_source_dir=False):
"""Get path as a Python module."""
library_ext = None
if sys.platform == 'win32':
library_ext = '.pyd'
elif sys.platform == 'darwin':
library_ext = '.so'
else:
raise Exception('Unsupported platform: {}'.format(sys.platform))
_, __, ___, py_debug = python_vars()
suffix = '_d' if py_debug else ''
filename = '{}{}{}'.format(self.name, suffix, library_ext)
if in_source_dir:
return os.path.join(
os.path.abspath(os.path.dirname(self.pyx)),
filename)
rel_path = os.path.relpath(os.path.dirname(self.pyx), '.')
base_path = os.path.join('build', 'lib')
return os.path.join(base_path, rel_path, filename)
def unreal_lib_path(self, unreal_config, unreal_path):
"""Get path as a Unreal Engine module binary."""
unreal_library_name = None
library_ext = None
unreal_platform = None
binary_path_prefix = ''
if sys.platform == 'win32':
library_ext = '.dll'
unreal_platform = 'Win64'
elif sys.platform == 'darwin':
library_ext = '.dylib'
unreal_platform = 'Mac'
if unreal_config == 'Development':
binary_path_prefix = 'UE4Editor.app/Contents/MacOS'
elif unreal_config == 'Debug':
binary_path_prefix = 'UE4Editor-Mac-Debug.app/Contents/MacOS'
else:
raise Exception("Unsupported platform: {}".format(sys.platform))
if unreal_config == 'Development':
unreal_library_name = 'UE4Editor-{}{}'.format(
self.unreal_name,
library_ext)
elif unreal_config == 'Debug':
unreal_library_name = 'UE4Editor-{}-{}-Debug{}'.format(
self.unreal_name,
unreal_platform,
library_ext)
else:
raise Exception('Unknown unreal_config: {}'.format(unreal_config))
return os.path.join(
unreal_path,
'Engine',
'Binaries',
unreal_platform,
binary_path_prefix,
unreal_library_name)
def cython_output_path(self, unreal_path):
"""Get path to generated Cython output."""
return os.path.join(
self.unreal_module_path(unreal_path),
'Private',
self.unreal_name + '.cpp')
def unreal_module_path(self, unreal_path):
"""Get path of Unreal module directory."""
return os.path.join(
unreal_path,
'Engine', 'Source', 'Editor',
self.unreal_name)
class GenerateReadmeCommand(distutils.cmd.Command):
"""
A custom command to generate README.txt in reStructuredTxt from README.md.
"""
description = 'generate README.txt from README.md'
user_options = [
('pandoc-path=', None, 'Path to Pandoc')
]
def initialize_options(self):
"""Set default values for options."""
self.pandoc_path = os.environ.get('PANDOC_PATH')
def finalize_options(self):
"""Post-process options."""
assert self.pandoc_path and os.path.exists(self.pandoc_path), (
'pandoc-path not set or doesn\'t exist.')
def run(self):
import pandoc
doc = pandoc.Document()
doc.markdown = open('README.md').read()
f = open('README.txt', 'w+')
f.write(doc.rst)
f.close()
class BuildUnrealCommand(distutils.cmd.Command):
"""
A custom command to generate and compile Unreal Engine API.
Will detect pyx files, generate UE modules for them,
compile these modules in the UE ecosystem,
and extract the compiled libraries.
"""
description = 'generate and compile Unreal API'
user_options = [
('unreal-path=', None, 'Path to UE4 root directory'),
('unreal-config=', None, 'Unreal build config [Debug, Development]'),
('stage-in-source', None, 'Stage build artefacts into source'),
('rebuild', None, 'Force rebuild'),
]
module_checksum_path = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'.cache',
'cython_module_checksums.p')
def initialize_options(self):
"""Set default values for options."""
self.unreal_path = os.environ.get('UNREAL_PATH')
self.unreal_config = os.environ.get('UNREAL_CONFIG') or 'Development'
self.stage_in_source = False
self.rebuild = False
self.include_dirs = None
self.library_dirs = None
def finalize_options(self):
"""Post-process options."""
assert self.unreal_path, (
'unreal-path not set.')
self.unreal_path = os.path.expanduser(self.unreal_path)
assert os.path.exists(self.unreal_path), (
'unreal-path %s not found.' % self.unreal_path)
assert os.path.exists(os.path.join(self.unreal_path, 'Engine')), (
'unreal-path %s not sane, no Engine dir found.' % self.unreal_path)
def find_modules(self):
"""Search recursively for .pyx files."""
modules = []
for root, dirs, files in os.walk(
os.path.abspath(os.path.dirname(__file__))):
for file in files:
file_path = os.path.join(root, file)
if not file.endswith('.pyx'):
continue
self.announce(
"Found .pyx file @ {0}".format(file_path),
level=distutils.log.INFO)
module = CythonModule(file_path, self.announce)
modules.extend([module])
return modules
def filter_changed_modules(self, modules):
"""Remove modules that haven't changed since previous build."""
checksums = self.load_checksums()
if len(checksums) == 0:
self.announce(
"No checksums found, everything is dirty",
distutils.log.INFO)
return modules
self.announce("loaded checksums: {}".format(pprint.pformat(checksums)), distutils.log.INFO)
for module in modules:
self.announce(
'module: {}\n\tchecksum: {}\n\told checksum known: {}\n\tchecksum changed: {}\n\tbinary exists: {}'.format(
module.name,
module.checksum(),
module.name in checksums,
(module.name not in checksums) or module.checksum() != checksums[module.name],
os.path.exists(module.unreal_lib_path(
self.unreal_config, self.unreal_path))),
distutils.log.INFO)
return [module for module in modules
if module.name not in checksums
or module.checksum() != checksums[module.name]
or not os.path.exists(module.unreal_lib_path(
self.unreal_config, self.unreal_path))]
def generate_cython(self, modules):
"""Generate Cythonized C++ to later compile."""
for module in modules:
output_path = module.generate_cython(self.unreal_path)
self.announce(
'Generated {}'.format(output_path),
distutils.log.INFO)
def clean_unreal_editor_target(self):
"""Remove injected lines in UE4Editor.Target.cs."""
editor_target_path = os.path.join(
self.unreal_path, 'Engine', 'Source', 'UE4Editor.Target.cs')
target_lines = []
marker_found = False
end_marker_found = False
with open(editor_target_path, 'r') as fread:
for line in fread:
if end_marker_found or not marker_found:
target_lines.extend([line])
if "@UNREALPY@" in line:
marker_found = True
elif marker_found and "@/UNREALPY@" in line:
end_marker_found = True
target_lines.extend([line])
with open(editor_target_path, 'w') as fwrite:
fwrite.write("".join(target_lines))
if not marker_found or not end_marker_found:
raise Exception(
"Unable to work with UE4Editor.Target.cs. "
"You need to manually add the following lines somewhere "
"in SetupBinaries(...) among the OutExtraModuleNames.Add(...) "
"calls:\n"
"// @UNREALPY@\n"
"// @/UNREALPY@")
def generate_unreal_module(self, modules):
"""Generate Unreal Engine Build.cs files for provided modules."""
for module in modules:
module.generate_unreal_module(self.unreal_path)
def load_checksums(self):
"""Load the checksum dict from file."""
if os.path.exists(self.module_checksum_path):
return pickle.load(open(self.module_checksum_path, 'rb'))
return {}
def save_checksums(self, modules):
"""Save the checksum dict to file."""
checksums = self.load_checksums()
for module in modules:
checksums[module.name] = module.checksum()
checksum_dir = os.path.dirname(self.module_checksum_path)
if not os.path.exists(checksum_dir):
os.makedirs(checksum_dir)
pickle.dump(checksums, open(self.module_checksum_path, 'wb'))
def generate_unreal_project(self):
"""Run Unreal Engine script to generate project files."""
script_ext = None
if sys.platform == 'win32':
script_ext = '.bat'
elif sys.platform == 'darwin':
script_ext = '.sh'
else:
raise Exception('Unsupported platform: {}'.format(sys.platform))
gen_script = os.path.join(
self.unreal_path,
'GenerateProjectFiles' + script_ext)
for output in run(gen_script, self.unreal_path):
self.announce(
'Unreal-GenerateProjectFiles > {}'.format(
output.replace('\n', '')),
distutils.log.INFO)
def invoke_unreal_build(self):
"""Invoke the Unreal Engine build system."""
unreal_build_script = None
unreal_platform = None
if sys.platform == 'win32':
unreal_build_script = os.path.join(
self.unreal_path, 'Engine', 'Build',
'BatchFiles', 'Build.bat')
unreal_platform = 'Win64'
elif sys.platform == 'darwin':
unreal_build_script = os.path.join(
self.unreal_path, 'Engine', 'Build',
'BatchFiles', 'Mac', 'Build.sh')
unreal_platform = 'Mac'
args = [
unreal_build_script,
'UE4Editor',
unreal_platform,
self.unreal_config]
self.announce(
'Running {}'.format(' '.join(args)), distutils.log.INFO)
for output in run(args,
self.unreal_path):
self.announce(
'Unreal-Build > {}'.format(output.replace('\n', '')),
distutils.log.INFO)
def extract_libraries(self):
"""
Find and retrieve build libraries from UE build location.
Will copy libraries from the location where Unreal builds them,
Engine/Binaries/<platform>/... and stage it into this package
for Python import, changing the name and suffix accordingly.
"""
modules = self.find_modules()
for module in modules:
from_path = module.unreal_lib_path(
self.unreal_config,
self.unreal_path)
to_path = module.python_lib_path(self.stage_in_source)
base_dir = os.path.dirname(os.path.abspath(__file__))
self.announce(
'{}\n\t-> {}'.format(
from_path.replace(self.unreal_path, ''),
to_path),
distutils.log.INFO)
to_dir = os.path.dirname(to_path)
if not os.path.exists(to_dir):
os.makedirs(to_dir)
shutil.copyfile(from_path, to_path)
def run(self):
"""Actually run the command."""
modules = self.find_modules()
self.announce(
"Found modules:\n{}".format(pprint.pformat(modules)),
distutils.log.INFO)
if not self.rebuild:
modules = self.filter_changed_modules(modules)
self.announce(
"Modules considered dirty:\n{}".format(
pprint.pformat(modules)),
distutils.log.INFO)
if len(modules) > 0:
self.generate_cython(modules)
self.clean_unreal_editor_target()
self.generate_unreal_module(modules)
self.generate_unreal_project()
self.invoke_unreal_build()
self.save_checksums(modules)
self.extract_libraries()
class DeployEmbedCommand(distutils.cmd.Command):
"""A custom command to deploy unrealpy to local UnrealPyEmbed."""
description = 'deploy dist to local UnrealPyEmbed'
user_options = [
('unreal-path=', None, 'Path to UE4 root directory'),
]
def initialize_options(self):
"""Set default values for options."""
self.unreal_path = os.environ.get('UNREAL_PATH')
def finalize_options(self):
"""Post-process options."""
assert self.unreal_path and os.path.exists(self.unreal_path), (
'unreal-path not set or doesn\'t exist.')
def run(self):
deploy_dir = os.path.join(self.unreal_path,
'Engine',
'Plugins',
'Developer',
'UnrealPyEmbed',
'Source',
'Python',
'Lib',
'python27',
'site-packages')
for item in os.listdir(deploy_dir):
if item.startswith('unrealpy'):
print("Removing {}".format(item))
shutil.rmtree(os.path.join(deploy_dir, item))
install = self.reinitialize_command('install', reinit_subcommands=1)
install.root = deploy_dir
install.warn_dir = 0
install.prefix = '.'
print("installing to %s" % install.root)
self.run_command('install')
install_dir = os.path.join(deploy_dir, 'Lib', 'site-packages')
for item in os.listdir(install_dir):
shutil.move(os.path.join(install_dir, item), os.path.join(deploy_dir, item))
shutil.rmtree(os.path.join(deploy_dir, 'Lib'))
def read(fname):
"""Return the contents of fname relative to setup.py, used for README."""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def file_hash(fname, blocksize=65536):
"""Return the checksum of file at fname."""
hasher = hashlib.sha256()
with open(fname, 'rb') as f:
buf = f.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = f.read(blocksize)
return hasher.digest()
def run(exe, cwd):
"""Run provided exe and yield output."""
if type(exe) is str:
exe = [exe]
p = subprocess.Popen(
exe,
cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
while True:
retcode = p.poll()
line = p.stdout.readline()
yield line
if retcode is not None:
if retcode != 0:
# todo: this is 0 even if UBT throws an error :(
raise Exception(
'{} failed with status {}'.format(' '.join(exe), retcode))
break
def python_vars():
"""Get include path, lib path, and lib name for Python dev env."""
python_base = os.environ.get('PYTHON_BASE')
if not python_base:
raise Exception('PYTHON_BASE environment variable need'
'to point to Python root directory.')
lib_name = None
if sys.platform == 'win32':
lib_name = 'python27.lib'
elif sys.platform == 'darwin':
lib_name = 'libpython2.7.dylib'
if not lib_name:
raise Exception("Unsupported platform: {}".format(sys.platform))
header_to_find = os.path.join(python_base, 'include_unrealpy', 'Python', 'Python.h')
if not os.path.exists(header_to_find):
raise Exception("""
----------------------------------------
Python environment requires manual setup,
Didn't find expected header {header}
----
1. Inside PYTHON_BASE ({python_base})
create a directory called 'include_unrealpy'
2. inside this directory create a symlink (directory junction on Windows)
called 'Python' which points back to PYTHON_BASE/include
({desired_inc}),
that's ../include in relative terms.
This is needed because Python's headers will collide with Unreal's,
e.g. datetime.h with DateTime.h. Putting everything in a subdirectory
we'll include it as "Python/Python.h" and most things will be happy.
There will however be issues when Cython wants to use Unreal's DateTime.h
and instead accidentally include Python's. Sorry that this is so hacky,
I'm eager for a better solution...
----
""".format(python_base=python_base,
desired_inc=os.path.join(python_base, 'include'),
header=header_to_find))
inc_path = os.path.join(python_base, 'include_unrealpy')
lib_path = os.path.join(python_base, 'lib')
# are Python libs built in debug?
debug = True
return inc_path, lib_path, lib_name, debug
def find_pyx(dir, files=[]):
"""Recursively search dir for .pyx files."""
for file in os.listdir(dir):
path = os.path.join(dir, file)
if os.path.isfile(path) and path.endswith(".pyx"):
files.append(path.replace(os.path.sep, ".")[:-4])
elif os.path.isdir(path):
find_pyx(path, files)
return files
def make_extension(name):
"""Create and Extension object from a given name."""
ext_path = name.replace(".", os.path.sep) + ".pyx"
return Extension(
name,
[ext_path],
include_dirs=[],
libraries=[],
)
def distutils_dir_name(dname):
"""Return the name of a distutils build directory."""
f = "{dirname}.{platform}-{version[0]}.{version[1]}"
return f.format(dirname=dname,
platform=sysconfig.get_platform(),
version=sys.version_info)
# ext_names = find_pyx("unrealpy")
# extensions = [make_extension(name) for name in ext_names]
long_description = None
if os.path.exists('README.txt'):
long_description = open('README.txt').read()
setup(
name="unrealpy",
version="0.0.1",
author="Tobias Mollstam",
author_email="[email protected]",
description=("A Python API for the Unreal Engine 4 Editor"),
license="MIT",
keywords="unreal ue4 gamedev",
long_description=long_description,
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
],
tests_require=['tox'],
cmdclass={
'test': Tox,
'build_ue': BuildUnrealCommand,
'build_ext': BuildUnrealCommand,
'generate_readme': GenerateReadmeCommand,
'deploy_embed': DeployEmbedCommand,
},
#packages=['unrealpy'],
packages=find_packages(),
package_data={'': ['*.so', '*.pyd']},
# ext_modules=extensions,
)
| {'content_hash': '2fdd35e4e93af7e33f73dfec01f95a6d', 'timestamp': '', 'source': 'github', 'line_count': 777, 'max_line_length': 137, 'avg_line_length': 36.465894465894465, 'alnum_prop': 0.562822051245853, 'repo_name': 'mollstam/UnrealPy', 'id': 'a9fed24578a62d421a546b419536e183e8aae193', 'size': '28334', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'UnrealPy/setup.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'APL', 'bytes': '587'}, {'name': 'ASP', 'bytes': '2753'}, {'name': 'ActionScript', 'bytes': '5686'}, {'name': 'Ada', 'bytes': '94225'}, {'name': 'Agda', 'bytes': '3154'}, {'name': 'Alloy', 'bytes': '6579'}, {'name': 'ApacheConf', 'bytes': '12482'}, {'name': 'AppleScript', 'bytes': '421'}, {'name': 'Assembly', 'bytes': '1093261'}, {'name': 'AutoHotkey', 'bytes': '3733'}, {'name': 'AutoIt', 'bytes': '667'}, {'name': 'Awk', 'bytes': '63276'}, {'name': 'Batchfile', 'bytes': '147828'}, {'name': 'BlitzBasic', 'bytes': '185102'}, {'name': 'BlitzMax', 'bytes': '2387'}, {'name': 'Boo', 'bytes': '1111'}, {'name': 'Bro', 'bytes': '7337'}, {'name': 'C', 'bytes': '108397183'}, {'name': 'C#', 'bytes': '156749'}, {'name': 'C++', 'bytes': '13535833'}, {'name': 'CLIPS', 'bytes': '6933'}, {'name': 'CMake', 'bytes': '12441'}, {'name': 'COBOL', 'bytes': '114812'}, {'name': 'CSS', 'bytes': '430375'}, {'name': 'Ceylon', 'bytes': '1387'}, {'name': 'Chapel', 'bytes': '4366'}, {'name': 'Cirru', 'bytes': '2574'}, {'name': 'Clean', 'bytes': '9679'}, {'name': 'Clojure', 'bytes': '23871'}, {'name': 'CoffeeScript', 'bytes': '20149'}, {'name': 'ColdFusion', 'bytes': '9006'}, {'name': 'Common Lisp', 'bytes': '49017'}, {'name': 'Coq', 'bytes': '66'}, {'name': 'Cucumber', 'bytes': '390'}, {'name': 'Cuda', 'bytes': '776'}, {'name': 'D', 'bytes': '7556'}, {'name': 'DIGITAL Command Language', 'bytes': '425938'}, {'name': 'DTrace', 'bytes': '6706'}, {'name': 'Dart', 'bytes': '591'}, {'name': 'Dylan', 'bytes': '6343'}, {'name': 'Ecl', 'bytes': '2599'}, {'name': 'Eiffel', 'bytes': '2145'}, {'name': 'Elixir', 'bytes': '4340'}, {'name': 'Emacs Lisp', 'bytes': '18303'}, {'name': 'Erlang', 'bytes': '5746'}, {'name': 'F#', 'bytes': '19156'}, {'name': 'FORTRAN', 'bytes': '38458'}, {'name': 'Factor', 'bytes': '10194'}, {'name': 'Fancy', 'bytes': '2581'}, {'name': 'Fantom', 'bytes': '25331'}, {'name': 'GAP', 'bytes': '29880'}, {'name': 'GLSL', 'bytes': '450'}, {'name': 'Gnuplot', 'bytes': '11501'}, {'name': 'Go', 'bytes': '5444'}, {'name': 'Golo', 'bytes': '1649'}, {'name': 'Gosu', 'bytes': '2853'}, {'name': 'Groff', 'bytes': '3458639'}, {'name': 'Groovy', 'bytes': '2586'}, {'name': 'HTML', 'bytes': '92126540'}, {'name': 'Haskell', 'bytes': '49593'}, {'name': 'Haxe', 'bytes': '16812'}, {'name': 'Hy', 'bytes': '7237'}, {'name': 'IDL', 'bytes': '2098'}, {'name': 'Idris', 'bytes': '2771'}, {'name': 'Inform 7', 'bytes': '1944'}, {'name': 'Inno Setup', 'bytes': '18796'}, {'name': 'Ioke', 'bytes': '469'}, {'name': 'Isabelle', 'bytes': '21392'}, {'name': 'Jasmin', 'bytes': '9428'}, {'name': 'Java', 'bytes': '4040623'}, {'name': 'JavaScript', 'bytes': '223927'}, {'name': 'Julia', 'bytes': '27687'}, {'name': 'KiCad', 'bytes': '475'}, {'name': 'Kotlin', 'bytes': '971'}, {'name': 'LSL', 'bytes': '160'}, {'name': 'Lasso', 'bytes': '18650'}, {'name': 'Lean', 'bytes': '6921'}, {'name': 'Limbo', 'bytes': '9891'}, {'name': 'Liquid', 'bytes': '862'}, {'name': 'LiveScript', 'bytes': '972'}, {'name': 'Logos', 'bytes': '19509'}, {'name': 'Logtalk', 'bytes': '7260'}, {'name': 'Lua', 'bytes': '8677'}, {'name': 'Makefile', 'bytes': '2053844'}, {'name': 'Mask', 'bytes': '815'}, {'name': 'Mathematica', 'bytes': '191'}, {'name': 'Max', 'bytes': '296'}, {'name': 'Modelica', 'bytes': '6213'}, {'name': 'Modula-2', 'bytes': '23838'}, {'name': 'Module Management System', 'bytes': '14798'}, {'name': 'Monkey', 'bytes': '2587'}, {'name': 'Moocode', 'bytes': '3343'}, {'name': 'MoonScript', 'bytes': '14862'}, {'name': 'Myghty', 'bytes': '3939'}, {'name': 'NSIS', 'bytes': '7663'}, {'name': 'Nemerle', 'bytes': '1517'}, {'name': 'NewLisp', 'bytes': '42726'}, {'name': 'Nimrod', 'bytes': '37191'}, {'name': 'Nit', 'bytes': '55581'}, {'name': 'Nix', 'bytes': '2448'}, {'name': 'OCaml', 'bytes': '42416'}, {'name': 'Objective-C', 'bytes': '104883'}, {'name': 'Objective-J', 'bytes': '15340'}, {'name': 'Opa', 'bytes': '172'}, {'name': 'OpenEdge ABL', 'bytes': '49943'}, {'name': 'PAWN', 'bytes': '6555'}, {'name': 'PHP', 'bytes': '68611'}, {'name': 'PLSQL', 'bytes': '45772'}, {'name': 'Pan', 'bytes': '1241'}, {'name': 'Pascal', 'bytes': '349743'}, {'name': 'Perl', 'bytes': '5931502'}, {'name': 'Perl6', 'bytes': '113623'}, {'name': 'PigLatin', 'bytes': '6657'}, {'name': 'Pike', 'bytes': '8479'}, {'name': 'PostScript', 'bytes': '18216'}, {'name': 'PowerShell', 'bytes': '14236'}, {'name': 'Prolog', 'bytes': '43750'}, {'name': 'Protocol Buffer', 'bytes': '3401'}, {'name': 'Puppet', 'bytes': '130'}, {'name': 'Python', 'bytes': '122886305'}, {'name': 'QML', 'bytes': '3912'}, {'name': 'R', 'bytes': '49247'}, {'name': 'Racket', 'bytes': '11341'}, {'name': 'Rebol', 'bytes': '17708'}, {'name': 'Red', 'bytes': '10536'}, {'name': 'Redcode', 'bytes': '830'}, {'name': 'Ruby', 'bytes': '91403'}, {'name': 'Rust', 'bytes': '6788'}, {'name': 'SAS', 'bytes': '15603'}, {'name': 'SaltStack', 'bytes': '1040'}, {'name': 'Scala', 'bytes': '730'}, {'name': 'Scheme', 'bytes': '50346'}, {'name': 'Scilab', 'bytes': '943'}, {'name': 'Shell', 'bytes': '2925518'}, {'name': 'ShellSession', 'bytes': '320'}, {'name': 'Smali', 'bytes': '832'}, {'name': 'Smalltalk', 'bytes': '158636'}, {'name': 'Smarty', 'bytes': '523'}, {'name': 'SourcePawn', 'bytes': '130'}, {'name': 'Standard ML', 'bytes': '36869'}, {'name': 'Swift', 'bytes': '2035'}, {'name': 'SystemVerilog', 'bytes': '265'}, {'name': 'Tcl', 'bytes': '6077233'}, {'name': 'TeX', 'bytes': '487999'}, {'name': 'Tea', 'bytes': '391'}, {'name': 'TypeScript', 'bytes': '535'}, {'name': 'VHDL', 'bytes': '4446'}, {'name': 'VimL', 'bytes': '32053'}, {'name': 'Visual Basic', 'bytes': '19441'}, {'name': 'XQuery', 'bytes': '4289'}, {'name': 'XS', 'bytes': '178055'}, {'name': 'XSLT', 'bytes': '1995174'}, {'name': 'Xtend', 'bytes': '727'}, {'name': 'Yacc', 'bytes': '25665'}, {'name': 'Zephir', 'bytes': '485'}, {'name': 'eC', 'bytes': '31545'}, {'name': 'mupad', 'bytes': '2442'}, {'name': 'nesC', 'bytes': '23697'}, {'name': 'xBase', 'bytes': '3349'}]} |
#include "sky/engine/config.h"
#include "sky/engine/platform/graphics/Canvas2DLayerManager.h"
#include "sky/engine/public/platform/Platform.h"
#include "sky/engine/wtf/StdLibExtras.h"
namespace {
enum {
DefaultMaxBytesAllocated = 64*1024*1024,
DefaultTargetBytesAllocated = 16*1024*1024,
};
} // unnamed namespace
namespace blink {
Canvas2DLayerManager::Canvas2DLayerManager()
: m_bytesAllocated(0)
, m_maxBytesAllocated(DefaultMaxBytesAllocated)
, m_targetBytesAllocated(DefaultTargetBytesAllocated)
, m_limitPendingFramesTimer(this, &Canvas2DLayerManager::limitPendingFramesTimerFired)
{
}
Canvas2DLayerManager::~Canvas2DLayerManager()
{
ASSERT(!m_bytesAllocated);
ASSERT(!m_layerList.head());
}
void Canvas2DLayerManager::init(size_t maxBytesAllocated, size_t targetBytesAllocated)
{
ASSERT(maxBytesAllocated >= targetBytesAllocated);
m_maxBytesAllocated = maxBytesAllocated;
m_targetBytesAllocated = targetBytesAllocated;
if (m_limitPendingFramesTimer.isActive())
m_limitPendingFramesTimer.stop();
}
Canvas2DLayerManager& Canvas2DLayerManager::get()
{
DEFINE_STATIC_LOCAL(Canvas2DLayerManager, manager, ());
return manager;
}
void Canvas2DLayerManager::limitPendingFramesTimerFired(Timer<Canvas2DLayerManager>*)
{
Canvas2DLayerBridge* layer = m_layerList.head();
while (layer) {
Canvas2DLayerBridge* currentLayer = layer;
// must increment iterator before calling limitPendingFrames, which
// may result in the layer being removed from the list.
layer = layer->next();
currentLayer->limitPendingFrames();
}
}
void Canvas2DLayerManager::layerDidDraw(Canvas2DLayerBridge* layer)
{
if (isInList(layer)) {
if (layer != m_layerList.head()) {
m_layerList.remove(layer);
m_layerList.push(layer); // Set as MRU
}
}
if (!m_limitPendingFramesTimer.isActive())
m_limitPendingFramesTimer.startOneShot(0, FROM_HERE);
}
void Canvas2DLayerManager::layerTransientResourceAllocationChanged(Canvas2DLayerBridge* layer, intptr_t deltaBytes)
{
ASSERT((intptr_t)m_bytesAllocated + deltaBytes >= 0);
m_bytesAllocated = (intptr_t)m_bytesAllocated + deltaBytes;
if (!isInList(layer) && layer->hasTransientResources()) {
m_layerList.push(layer);
} else if (isInList(layer) && !layer->hasTransientResources()) {
m_layerList.remove(layer);
layer->setNext(0);
layer->setPrev(0);
}
if (deltaBytes > 0)
freeMemoryIfNecessary();
}
void Canvas2DLayerManager::freeMemoryIfNecessary()
{
if (m_bytesAllocated >= m_maxBytesAllocated) {
// Pass 1: Free memory from caches
Canvas2DLayerBridge* layer = m_layerList.tail(); // LRU
while (layer && m_bytesAllocated > m_targetBytesAllocated) {
Canvas2DLayerBridge* currentLayer = layer;
layer = layer->prev();
currentLayer->freeMemoryIfPossible(m_bytesAllocated - m_targetBytesAllocated);
ASSERT(isInList(currentLayer) == currentLayer->hasTransientResources());
}
// Pass 2: Flush canvases
layer = m_layerList.tail();
while (m_bytesAllocated > m_targetBytesAllocated && layer) {
Canvas2DLayerBridge* currentLayer = layer;
layer = layer->prev();
currentLayer->flush();
currentLayer->freeMemoryIfPossible(m_bytesAllocated - m_targetBytesAllocated);
ASSERT(isInList(currentLayer) == currentLayer->hasTransientResources());
}
}
}
bool Canvas2DLayerManager::isInList(Canvas2DLayerBridge* layer) const
{
return layer->prev() || m_layerList.head() == layer;
}
} // namespace blink
| {'content_hash': '83e1bd18f42af6e2ef4f59d32af1b3b9', 'timestamp': '', 'source': 'github', 'line_count': 120, 'max_line_length': 115, 'avg_line_length': 31.091666666666665, 'alnum_prop': 0.6909675690163495, 'repo_name': 'collinjackson/mojo', 'id': '6408abea6d2ba3f59c07eb6bec08949a71b057a5', 'size': '5026', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'sky/engine/platform/graphics/Canvas2DLayerManager.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Bison', 'bytes': '31162'}, {'name': 'C', 'bytes': '1870198'}, {'name': 'C++', 'bytes': '36473977'}, {'name': 'CSS', 'bytes': '1897'}, {'name': 'Dart', 'bytes': '508640'}, {'name': 'Go', 'bytes': '181090'}, {'name': 'Groff', 'bytes': '29030'}, {'name': 'HTML', 'bytes': '6258864'}, {'name': 'Java', 'bytes': '1187123'}, {'name': 'JavaScript', 'bytes': '204155'}, {'name': 'Makefile', 'bytes': '402'}, {'name': 'Objective-C', 'bytes': '74603'}, {'name': 'Objective-C++', 'bytes': '370763'}, {'name': 'Protocol Buffer', 'bytes': '1048'}, {'name': 'Python', 'bytes': '5515876'}, {'name': 'Shell', 'bytes': '143302'}, {'name': 'nesC', 'bytes': '18347'}]} |
package org.springframework.boot.configurationsample.method;
import org.springframework.boot.configurationsample.ConfigurationProperties;
/**
* Sample for testing protected method configuration.
*
* @author Andy Wilkinson
*/
public class ProtectedMethodConfig {
@ConfigurationProperties(prefix = "foo")
protected Foo foo() {
return new Foo();
}
public static class Foo {
private String name;
private boolean flag;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public boolean isFlag() {
return this.flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
}
}
| {'content_hash': 'a1efe9d51850e89b8a131dfbe7de75c4', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 76, 'avg_line_length': 15.767441860465116, 'alnum_prop': 0.7050147492625368, 'repo_name': 'shakuzen/spring-boot', 'id': '6d5f3c409002596d1b068bfa368daa10c29b2c9c', 'size': '1299', 'binary': False, 'copies': '23', 'ref': 'refs/heads/master', 'path': 'spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/method/ProtectedMethodConfig.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1948'}, {'name': 'CSS', 'bytes': '115'}, {'name': 'Dockerfile', 'bytes': '1770'}, {'name': 'FreeMarker', 'bytes': '3599'}, {'name': 'Groovy', 'bytes': '54320'}, {'name': 'HTML', 'bytes': '70214'}, {'name': 'Java', 'bytes': '14619008'}, {'name': 'JavaScript', 'bytes': '37789'}, {'name': 'Kotlin', 'bytes': '35612'}, {'name': 'Ruby', 'bytes': '884'}, {'name': 'Shell', 'bytes': '37185'}, {'name': 'Smarty', 'bytes': '2885'}, {'name': 'XSLT', 'bytes': '3545'}]} |
layout: category
title: Visual Art
description: You know what it is.
category: visualart
permalink: /visualart/
author_profile: false
sidebar:
- title: "Roundup"
text: "Some text here."
---
| {'content_hash': '043253d586b919e7f737ae5aeb54beb9', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 33, 'avg_line_length': 19.6, 'alnum_prop': 0.7244897959183674, 'repo_name': 'glvno/low-toner', 'id': '81eff8319ede480b2b75d40640c358cfc8d12df7', 'size': '200', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_pages/visualart.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '72782'}, {'name': 'HTML', 'bytes': '143610'}, {'name': 'JavaScript', 'bytes': '54872'}, {'name': 'Ruby', 'bytes': '3306'}]} |
angular.module('coderace.race', ['ui.codemirror'])
.controller('raceController', function ($scope, $rootScope, Race, socket){
var master = false;
$scope.room = false;
$scope.opponentLeft = false;
$scope.opponentPassed = false;
$scope.username = Race.username;
// codemirror options
// codemirror
$scope.editorOptions = {
mode: 'javascript',
theme: 'cobalt',
lineNumbers: true,
lineWrapping: true,
showCursorWhenSelecting: true,
autofocus: true,
keyMap: 'sublime',
autoCloseBrackets: true,
tabSize: 2,
extraKeys: {"Ctrl-Space": "autocomplete"},
gutters: ['CodeMirror-lint-markers'],
lint: true
};
function autocomplete(){
CodeMirror.showHint({hint: CodeMirror.hint.anyword});
}
function getRandomArbitrary(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}//generate a random number
// var random = getRandomArbitrary(0, Race.count+1);//random is between 0 and the number of questions
// $scope.code = Race.start[random]; //set a temp value to put in the text area. This needs to be abstracted.
// $scope.question = Race.question[random];
var challengeInputs;
$scope.dataLoaded = false;
$scope.$on('Race:ready', function (event, data) {
$scope.code = data.startingCode;
$scope.question = data.question;
$scope.$apply();
challengeInputs = {
inputs: data.inputs,
answers: data.answers,
functionName: data.functionName
};
});
$scope.evaluate = function(code) {
var renderCodeResponse = function(codeResponse) {
$scope.dataLoaded = true; //set this to true to stop the spinner.
$scope.validResponse = codeResponse.valid;
$scope.error = codeResponse.error;
$scope.tests = codeResponse.tests;
$scope.passed = codeResponse.passed;
$scope.responseText = codeResponse.passed ? "correct!" : "incorrect";
$scope.$apply();
};
//the worker will not be able to access the factory directly.
if (window.Worker) { //verify that the browser has worker capability.
var evalWorker = new Worker("client/evalWorker.js");
angular.extend(challengeInputs, {code: code}); //add the code to the challenge inputs.
evalWorker.postMessage(challengeInputs);
var workerComplete = false;
//if the input from the form is invalid, this worker will trigger.
evalWorker.onerror = function(error) {
evalWorker.terminate();
workerComplete = true;
var codeResponse = {
valid: false,
error: error.message,
passed: false
};
renderCodeResponse(codeResponse);
console.log("worker errored!!", error);
};
evalWorker.onmessage = function(codeResponse) { //when the worker sends back its response, update the scope.
if(codeResponse.data.passed === true){
socket.emit('passed');
}
workerComplete = true; //don't execute the timeout function.
console.log("codeResponse in on", codeResponse.data);
renderCodeResponse(codeResponse.data);
}
//check for worker timeout.
setTimeout(function() {
if (workerComplete === false){ //the worker has not completed after 5 seconds.
console.log("taking longer than 5 seconds");
evalWorker.terminate(); //terminate the worker.
renderCodeResponse({
valid: false,
error: "Code is taking longer than 5 seconds to process",
passed: false
});
//create a response for the timeout issues;
}
}, 5000);
}
}
$scope.typing = function(code){
socket.emit('typing', {
code: code
});
};
$scope.$on('$destroy', function(){
socket.disconnect();
});
if(!socket.connected){
socket.connect();
}
socket.emit('start', {
username:Race.username
});
socket.on('opponentLeft', function(){
$scope.opponentLeft = true;
});
socket.on('typing', function(data) {
$scope.competitorCode = data.code;
})
socket.on('roomJoined', function(matchData){
$scope.room = matchData.room;
$scope.opponent = master ?
matchData.player2: matchData.player1;
});
socket.on('passed', function(){
console.log('opponent passed');
$scope.opponentPassed = true;
});
socket.on('master', function(){
master = true;
Race.getLength();
$scope.$on('GotLength', function(event,data){
var random = getRandomArbitrary(0, data);
Race.getData(random, function(problem){
socket.emit('problem', problem);
});
});
});
socket.on('problem', function(problem){
setTimeout(function(){
Race.setProblem(problem);
}, 0, problem);
});
});
| {'content_hash': '44f30cf84e7f97eb6a69dfb727701b5b', 'timestamp': '', 'source': 'github', 'line_count': 165, 'max_line_length': 114, 'avg_line_length': 28.8969696969697, 'alnum_prop': 0.6262583892617449, 'repo_name': 'TheFourLoops/TheFourLoops', 'id': 'e374ac880e91da2e090cc0a621bd9c1eaa9b0de8', 'size': '4769', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'public/client/Race/raceController.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '10266'}, {'name': 'HTML', 'bytes': '9467'}, {'name': 'JavaScript', 'bytes': '1072961'}]} |
package no.nrk.common.development;
import static no.nrk.common.arguments.Validator.notEmpty;
public final class MissingImplementationException extends RuntimeException {
private static final long serialVersionUID = 1L;
public MissingImplementationException() {
super("MISSING IMPLEMENTATION");
}
public MissingImplementationException(String message) {
super(notEmpty(message, "message"));
}
}
| {'content_hash': '3945f6c58dd3c7c01a7938e5e93f753d', 'timestamp': '', 'source': 'github', 'line_count': 15, 'max_line_length': 76, 'avg_line_length': 27.066666666666666, 'alnum_prop': 0.8004926108374384, 'repo_name': 'nrkno/nrk-shared-java', 'id': 'c85eb293aed094f2538c882b7a388460c0153f58', 'size': '406', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'nrk-common/src/main/java/no/nrk/common/development/MissingImplementationException.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '80330'}]} |
"""Basic tests for Chromoting it2me."""
import chromoting_base
import pyauto
class IT2MeBasic(chromoting_base.ChromotingBase):
"""Drives it2me basic test cases."""
def setUp(self):
"""Set up for it2me basic test."""
# Disable test on vista and xp until the failure is figured
if self.IsWinVista() or self.IsWinXP():
return
pyauto.PyUITest.setUp(self)
webapp = self.InstallExtension(self.GetWebappPath())
self.LaunchApp(webapp)
self.Authenticate()
if self.client_local:
self.client.LaunchApp(webapp)
def testIT2MeBasic(self):
"""Verify that we can start and disconnect a Chromoting it2me session."""
# Disable test on vista and xp until the failure is figured
if self.IsWinVista() or self.IsWinXP():
return
access_code = self.host.Share()
self.assertTrue(access_code,
msg='Host attempted to share, but it failed. '
'No access code was found.')
self.client.Connect(access_code, self.client_tab_index)
self.host.CancelShare()
self.client.Disconnect(self.client_tab_index)
if __name__ == '__main__':
chromoting_base.Main()
| {'content_hash': '5876ba8c4943290e087e88055392c7d5', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 77, 'avg_line_length': 27.11627906976744, 'alnum_prop': 0.6663807890222985, 'repo_name': 'imply/chuu', 'id': '2661e52f948cbc7a01e518ad5738d0073c1f025a', 'size': '1355', 'binary': False, 'copies': '68', 'ref': 'refs/heads/master', 'path': 'chrome/test/functional/chromoting/it2me_basic.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ASP', 'bytes': '853'}, {'name': 'AppleScript', 'bytes': '6973'}, {'name': 'Arduino', 'bytes': '464'}, {'name': 'Assembly', 'bytes': '54831'}, {'name': 'Awk', 'bytes': '8660'}, {'name': 'C', 'bytes': '39725805'}, {'name': 'C#', 'bytes': '1132'}, {'name': 'C++', 'bytes': '177176563'}, {'name': 'CSS', 'bytes': '761070'}, {'name': 'DOT', 'bytes': '1559'}, {'name': 'Java', 'bytes': '4360771'}, {'name': 'JavaScript', 'bytes': '22413752'}, {'name': 'M', 'bytes': '2190'}, {'name': 'Matlab', 'bytes': '2262'}, {'name': 'Objective-C', 'bytes': '7515772'}, {'name': 'PHP', 'bytes': '97817'}, {'name': 'Perl', 'bytes': '685944'}, {'name': 'Python', 'bytes': '9733381'}, {'name': 'R', 'bytes': '262'}, {'name': 'Shell', 'bytes': '1152317'}, {'name': 'Tcl', 'bytes': '277091'}, {'name': 'XSLT', 'bytes': '13493'}]} |
class CQGnuPlotCanvasTipLabel : public QWidget {
public:
CQGnuPlotCanvasTipLabel(QWidget *parent=0) :
QWidget(parent) {
}
const CGnuPlotTipData &tip() const { return tip_; }
void setTip(const CGnuPlotTipData &t) {
tip_ = t;
}
void paintEvent(QPaintEvent *) {
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
QPainterPath path;
QRectF r(rect());
double rr = r.height()/6.0;
path.addRoundedRect(r.adjusted(1, 1, -1, -1), rr, rr);
QColor bg = palette().color(QPalette::ToolTipBase);
bg.setAlpha(180);
painter.fillPath(path, bg);
QString text;
if (tip_.ystr() == "") {
painter.setPen(CQUtil::toQColor(tip_.xcolor()));
QString text = tip_.xstr().c_str();
painter.drawText(rect(), Qt::AlignCenter, text);
}
else {
#if 0
// TODO: encode xstr, ystr for HTML or draw manually
QString html = QString("<font color=\"%1\">%2:</font> <font color=\"%3\">%4</font>").
arg(CQUtil::colorToHtml(CQUtil::toQColor(tip_.xcolor()))).
arg(tip_.xstr().c_str()).
arg(CQUtil::colorToHtml(CQUtil::toQColor(tip_.ycolor()))).
arg(tip_.ystr().c_str());
CQUtil::drawHtmlText(this, &painter, html, palette(), rect());
#endif
QFontMetrics fm(font());
QString text = QString("%1: %2").arg(tip_.xstr().c_str()).arg(tip_.ystr().c_str());
int tw = fm.horizontalAdvance(text);
int dx = (rect().width() - tw)/2;
int dy = (fm.ascent() - fm.descent())/2;
painter.setPen(CQUtil::toQColor(tip_.xcolor()));
QString xtext = QString("%1: ").arg(tip_.xstr().c_str());
painter.drawText(dx, rect().height()/2 + dy, xtext);
int xtw = fm.horizontalAdvance(xtext);
painter.setPen(CQUtil::toQColor(tip_.ycolor()));
QString ytext = tip_.ystr().c_str();
painter.drawText(dx + xtw, rect().height()/2 + dy, ytext);
}
QPen pen(CQUtil::toQColor(tip_.borderColor()));
pen.setWidth(2);
painter.strokePath(path, pen);
}
QSize sizeHint() const {
QFontMetrics fm(font());
QString text;
if (tip_.ystr() == "")
text = tip_.xstr().c_str();
else
text = QString("%1 : %2").arg(tip_.xstr().c_str()).arg(tip_.ystr().c_str());
return QSize(fm.horizontalAdvance(text) + 2*border_, fm.height() + 2*border_);
}
private:
CGnuPlotTipData tip_;
int border_ { 4 };
};
class CQGnuPlotCanvasTip : public CQToolTipIFace {
public:
CQGnuPlotCanvasTip(CQGnuPlotCanvas *canvas) :
canvas_(canvas), label_(0) {
}
~CQGnuPlotCanvasTip() {
delete label_;
}
bool canTip(const QPoint &pos) const {
CGnuPlotTipData tip;
QPoint p = canvas_->mapFromGlobal(pos);
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel(CPoint2D(p.x(), p.y()));
return canvas_->qwindow()->mouseTip(mouseEvent, tip);
}
QWidget *showWidget(const QPoint &pos) {
if (! label_)
label_ = new CQGnuPlotCanvasTipLabel();
if (! updateWidget(pos))
return label_;
return label_;
}
void hideWidget() {
canvas_->qwindow()->highlightObject(0);
delete label_;
label_ = 0;
}
bool trackMouse() const { return true; }
bool updateWidget(const QPoint &pos) {
QPoint p = canvas_->mapFromGlobal(pos);
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel(CPoint2D(p.x(), p.y()));
if (! canvas_->qwindow()->mouseTip(mouseEvent, tip_))
return false;
label_->resize(label_->sizeHint());
label_->setTip(tip_);
return true;
}
int margin() const { return 0; }
double opacity() const { return 1.0; }
bool isTransparent() const { return true; }
bool outside() const { return canvas_->qwindow()->isTipOutside(); }
Qt::Alignment alignment() const {
if (outside())
return Qt::AlignLeft | Qt::AlignBottom;
else
return Qt::AlignHCenter | Qt::AlignBottom;
}
private:
CQGnuPlotCanvas *canvas_;
CQGnuPlotCanvasTipLabel *label_;
CGnuPlotTipData tip_;
};
//----
CQGnuPlotCanvas::
CQGnuPlotCanvas(CQGnuPlotMainWindow *window) :
QWidget(0), window_(window), pressed_(false)
{
setObjectName("canvas");
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
CQToolTip::setToolTip(this, new CQGnuPlotCanvasTip(this));
}
CQGnuPlotCanvas::
~CQGnuPlotCanvas()
{
}
void
CQGnuPlotCanvas::
paintEvent(QPaintEvent *)
{
QPainter p(this);
window_->paint(&p);
}
void
CQGnuPlotCanvas::
mousePressEvent(QMouseEvent *e)
{
pressed_ = true;
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel (CPoint2D(e->pos().x(), e->pos().y()));
mouseEvent.setButton (CQUtil::convertButton(e->button()));
mouseEvent.setShift (e->modifiers() & Qt::ShiftModifier );
mouseEvent.setControl(e->modifiers() & Qt::ControlModifier);
mouseEvent.setAlt (e->modifiers() & Qt::AltModifier );
CQGnuPlotGroup *group = window_->getGroupAt(mouseEvent.pixel());
window_->setCurrentGroup(group);
//if (group) group->mousePress(mouseEvent);
window_->mousePress(mouseEvent);
}
void
CQGnuPlotCanvas::
mouseMoveEvent(QMouseEvent *e)
{
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel(CPoint2D(e->pos().x(), e->pos().y()));
CQGnuPlotGroup *group = window_->getGroupAt(mouseEvent.pixel());
window_->setCurrentGroup(group);
QString groupName = (group ? QString("Group%1").arg(group->id()) : QString(""));
CPoint2D p;
if (pixelToWindow(mouseEvent.pixel(), p))
window_->showPos(groupName, e->pos().x(), e->pos().y(), p.x, p.y);
window_->mouseMove(mouseEvent, pressed_);
}
void
CQGnuPlotCanvas::
mouseReleaseEvent(QMouseEvent *e)
{
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel (CPoint2D(e->pos().x(), e->pos().y()));
mouseEvent.setButton (CQUtil::convertButton(e->button()));
mouseEvent.setShift (e->modifiers() & Qt::ShiftModifier );
mouseEvent.setControl(e->modifiers() & Qt::ControlModifier);
mouseEvent.setAlt (e->modifiers() & Qt::AltModifier );
CQGnuPlotGroup *group = window_->getGroupAt(mouseEvent.pixel());
window_->setCurrentGroup(group);
if (group)
group->mouseRelease(mouseEvent);
window_->mouseRelease(mouseEvent);
pressed_ = false;
}
void
CQGnuPlotCanvas::
wheelEvent(QWheelEvent *e)
{
window_->mouseWheel(CQWidgetUtil::wheelDelta(e));
}
void
CQGnuPlotCanvas::
keyPressEvent(QKeyEvent *e)
{
QPoint pos = this->mapFromGlobal(QCursor::pos());
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel(CPoint2D(pos.x(), pos.y()));
CQGnuPlotGroup *group = window_->getGroupAt(mouseEvent.pixel());
window_->setCurrentGroup(group);
CGnuPlotKeyEvent keyEvent;
keyEvent.setPixel (CPoint2D(pos.x(), pos.y()));
keyEvent.setShift (e->modifiers() & Qt::ShiftModifier );
keyEvent.setControl(e->modifiers() & Qt::ControlModifier);
keyEvent.setAlt (e->modifiers() & Qt::AltModifier );
keyEvent.setType (CQUtil::convertKey(e->key(), e->modifiers()));
keyEvent.setKey (e->key());
keyEvent.setChar (CEvent::keyTypeChar(keyEvent.type()));
keyEvent.setText (e->text().toStdString());
window_->keyPress(keyEvent);
}
bool
CQGnuPlotCanvas::
pixelToWindow(const CPoint2D &p, CPoint2D &w)
{
CQGnuPlotGroup *group = window_->getGroupAt(p);
if (! group) return false;
CGnuPlotRenderer *renderer = group->app()->renderer();
renderer->setRegion(group->region());
renderer->setRange(group->getMappedDisplayRange(1, 1));
renderer->pixelToWindow(p, w);
double z = 0;
group->unmapLogPoint(1, 1, 1, &w.x, &w.y, &z);
return true;
}
bool
CQGnuPlotCanvas::
event(QEvent *e)
{
#if 0
if (e->type() == QEvent::ToolTip) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e);
QPoint p = helpEvent->pos();
CGnuPlotMouseEvent mouseEvent;
mouseEvent.setPixel(CPoint2D(p.x(), p.y()));
CGnuPlotTipData tip;
if (window_->mouseTip(mouseEvent, tip)) {
QToolTip::showText(helpEvent->globalPos(), tip.str, this, tip.rect.toRect());
}
return true;
}
#endif
return QWidget::event(e);
}
| {'content_hash': '11a24ff9ef3e9b497de032b794f3b81d', 'timestamp': '', 'source': 'github', 'line_count': 361, 'max_line_length': 91, 'avg_line_length': 22.26038781163435, 'alnum_prop': 0.6441015430562469, 'repo_name': 'colinw7/CQGnuPlot', 'id': '6f5adce3643aec1f0f77a0733d22a137eefca546', 'size': '8339', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/CQGnuPlotCanvas.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '3524'}, {'name': 'C++', 'bytes': '3154262'}, {'name': 'Gnuplot', 'bytes': '161224'}, {'name': 'Makefile', 'bytes': '102'}, {'name': 'QMake', 'bytes': '12154'}, {'name': 'Shell', 'bytes': '87'}]} |
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/activatedBackgroundIndicator"
android:textAppearance="@android:style/TextAppearance.Material.Title"
android:textColor="?android:textColorSecondary">
</TextView>
| {'content_hash': '943aea245bd9cead0c62d2580d0f823d', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 73, 'avg_line_length': 44.111111111111114, 'alnum_prop': 0.760705289672544, 'repo_name': 'aporter/androidui', 'id': '9ed04e75a9979e2fd85ce34f274794a1d23d29c5', 'size': '397', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'Examples/FragmentStaticConfigLayout/app/src/main/res/layout-land/list_item.xml', 'mode': '33188', 'license': 'mit', 'language': []} |
require "acceptance/support/output"
# This creates a matcher that is used to match against certain
# Vagrant output. Vagrant output is not what is being tested,
# so all that state is hidden away in Acceptance::Output.
RSpec::Matchers.define :match_output do |expected, *args|
match do |actual|
Acceptance::Output.new(actual).send(expected, *args)
end
failure_message_for_should do |actual|
"expected output to match: #{expected} #{args.inspect}"
end
end
| {'content_hash': '502e29ba90e14a15ea30c5e391859969', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 62, 'avg_line_length': 33.785714285714285, 'alnum_prop': 0.7399577167019028, 'repo_name': 'scalp42/vagrant-1.0.7', 'id': 'c58c6f9d3d8210071d362d51ae29ad43d2ae6e66', 'size': '473', 'binary': False, 'copies': '15', 'ref': 'refs/heads/master', 'path': 'test/acceptance/support/matchers/match_output.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Emacs Lisp', 'bytes': '420'}, {'name': 'JavaScript', 'bytes': '2165'}, {'name': 'Python', 'bytes': '14300'}, {'name': 'Ruby', 'bytes': '673055'}, {'name': 'Shell', 'bytes': '3925'}, {'name': 'VimL', 'bytes': '227'}]} |
.oo-ui-icon-bell {
background-image: /* @embed */ url(themes/mediawiki/images/icons/bell.svg);
}
.oo-ui-icon-bellOn {
background-image: /* @embed */ url(themes/mediawiki/images/icons/bellOn-rtl.svg);
}
.oo-ui-icon-eye {
background-image: /* @embed */ url(themes/mediawiki/images/icons/eye.svg);
}
.oo-ui-icon-eyeClosed {
background-image: /* @embed */ url(themes/mediawiki/images/icons/eyeClosed.svg);
}
.oo-ui-icon-message {
background-image: /* @embed */ url(themes/mediawiki/images/icons/message-rtl.svg);
}
.oo-ui-icon-signature {
background-image: /* @embed */ url(themes/mediawiki/images/icons/signature-rtl.svg);
}
.oo-ui-icon-speechBubble {
background-image: /* @embed */ url(themes/mediawiki/images/icons/speechBubble-rtl.svg);
}
.oo-ui-icon-speechBubbleAdd {
background-image: /* @embed */ url(themes/mediawiki/images/icons/speechBubbleAdd-rtl.svg);
}
.oo-ui-icon-speechBubbles {
background-image: /* @embed */ url(themes/mediawiki/images/icons/speechBubbles-rtl.svg);
}
| {'content_hash': '90dbaced1d928d4322676643b22581e0', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 91, 'avg_line_length': 35.392857142857146, 'alnum_prop': 0.7204843592330978, 'repo_name': 'dada0423/cdnjs', 'id': 'f35e51e3406a4e8e10f23b77ddab1ce8fb88295c', 'size': '1218', 'binary': False, 'copies': '39', 'ref': 'refs/heads/master', 'path': 'ajax/libs/oojs-ui/0.9.4/oojs-ui-mediawiki-icons-alerts.vector.rtl.css', 'mode': '33188', 'license': 'mit', 'language': []} |
@interface AppDelegate ()
@property (nonatomic, assign) ProcessSerialNumber previousPSN;
@end
@implementation AppDelegate
@synthesize window = _window;
@synthesize iconPopUp;
@synthesize pluginController;
@synthesize showDevices;
@synthesize quitTitle;
@synthesize preferencesTitle;
@synthesize openPreferencesTitle;
@synthesize iconTitle;
@synthesize startAtLoginTitle;
@synthesize noPluginPrefsTitle;
@synthesize moduleLabel;
@synthesize iconInMenu;
@synthesize iconInDock;
@synthesize iconInBoth;
@synthesize noIcon;
@synthesize toolbar;
@synthesize generalItem;
@synthesize modulesItem;
@synthesize tabView;
@synthesize tableView;
@synthesize moduleColumn;
@synthesize containerView;
@synthesize noPrefsLabel;
@synthesize placeholderView;
@synthesize currentView;
@synthesize previousPSN;
+(void)initialize
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], @"OnLogin",
[NSNumber numberWithBool:YES], @"ShowExisting",
[NSNumber numberWithBool:NO], @"GroupNetwork",
[NSNumber numberWithInteger:0], @"Visibility", nil]];
[[NSUserDefaults standardUserDefaults] synchronize];
[super initialize];
}
- (void)dealloc
{
[showDevices release];
[quitTitle release];
[preferencesTitle release];
[openPreferencesTitle release];
[iconTitle release];
[startAtLoginTitle release];
[noPluginPrefsTitle release];
[moduleLabel release];
[iconInMenu release];
[iconInDock release];
[iconInBoth release];
[noIcon release];
[pluginController release];
[super dealloc];
}
- (void) awakeFromNib {
self.iconInMenu = NSLocalizedString(@"Show icon in the menubar", @"default option for where the icon should be seen");
self.iconInDock = NSLocalizedString(@"Show icon in the dock", @"display the icon only in the dock");
self.iconInBoth = NSLocalizedString(@"Show icon in both", @"display the icon in both the menubar and the dock");
self.noIcon = NSLocalizedString(@"No icon visible", @"display no icon at all");
[generalItem setLabel:NSLocalizedString(@"General", @"")];
[modulesItem setLabel:NSLocalizedString(@"Modules", @"")];
NSNumber *visibility = [[NSUserDefaults standardUserDefaults] objectForKey:@"Visibility"];
if(visibility == nil || [visibility integerValue] == kShowIconInDock || [visibility integerValue] == kShowIconInBoth){
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
}
if(visibility == nil || [visibility integerValue] == kShowIconInMenu || [visibility integerValue] == kShowIconInBoth){
[self initMenu];
}
[onLoginSwitch setState:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] boolForKey:@"OnLogin"]];
[onLoginSwitch addObserver:self
forKeyPath:@"state"
options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld
context:nil];
self.pluginController = [[[HWGrowlPluginController alloc] init] autorelease];
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:.75]];
[shadow setShadowOffset:CGSizeMake(0.0, -1.0)];
NSDictionary *attrDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:13.0f], NSFontAttributeName,
[NSColor colorWithDeviceWhite:0.5f alpha:1.0f], NSForegroundColorAttributeName,
shadow, NSShadowAttributeName, nil];
NSMutableAttributedString *noPrefsAttributed = [[NSMutableAttributedString alloc] initWithString:NoPluginPrefsTitle
attributes:attrDict];
[noPrefsAttributed setAlignment:NSCenterTextAlignment range:NSMakeRange(0, [noPrefsAttributed length])];
[noPrefsLabel setAttributedStringValue:noPrefsAttributed];
[shadow release];
[noPrefsAttributed release];
ACImageAndTextCell *imageTextCell = [[[ACImageAndTextCell alloc] init] autorelease];
[moduleColumn setDataCell:imageTextCell];
}
#ifndef NSFoundationVersionNumber10_7
#define NSFoundationVersionNumber10_7 833.1
#endif
- (IBAction)showPreferences:(id)sender
{
[NSApp activateIgnoringOtherApps:YES];
if(![self.window isVisible]){
[self.window center];
[self.window setFrameAutosaveName:@"HWGrowlerPrefsWindowFrame"];
[self.window setFrameUsingName:@"HWGrowlerPrefsWindowFrame" force:YES];
}
[self.window makeKeyAndOrderFront:sender];
if((BOOL)isgreaterequal(NSFoundationVersionNumber, NSFoundationVersionNumber10_7)) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
NSNotificationCenter *nc = [[NSWorkspace sharedWorkspace] notificationCenter];
[nc addObserverForName:NSWorkspaceDidActivateApplicationNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
ProcessSerialNumber newFrontPSN;
GetFrontProcess(&newFrontPSN);
ProcessSerialNumber growlPsn = { 0, kCurrentProcess };
Boolean result;
SameProcess(&newFrontPSN, &growlPsn, &result);
if(!result){
GetFrontProcess(&previousPSN);
}
}];
}
}
- (void)windowWillClose:(NSNotification *)notification {
if((BOOL)isgreaterequal(NSFoundationVersionNumber, NSFoundationVersionNumber10_7)) {
NSNumber *value = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] valueForKey:@"Visibility"];
HWGrowlIconState visibility = [value integerValue];
if(visibility == kDontShowIcon || visibility == kShowIconInMenu){
dispatch_async(dispatch_get_main_queue(), ^{
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
SetFrontProcess(&previousPSN);
});
}
}
}
- (void) initMenu{
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];
[statusItem setMenu:statusMenu];
NSString* icon_path = [[NSBundle mainBundle] pathForResource:@"menubarIcon_Normal" ofType:@"png"];
NSString* icon_path_selected = [[NSBundle mainBundle] pathForResource:@"menubarIcon_Selected" ofType:@"png"];
NSImage *icon = [[NSImage alloc] initWithContentsOfFile:icon_path];
NSImage *icon_selected = [[NSImage alloc] initWithContentsOfFile:icon_path_selected];
[statusItem setImage:icon];
[statusItem setAlternateImage:icon_selected];
[icon release];
[icon_selected release];
[statusItem setHighlightMode:YES];
}
- (void) initTitles{
self.showDevices = ShowDevicesTitle;
self.quitTitle = QuitTitle;
self.preferencesTitle = PreferencesTitle;
self.openPreferencesTitle = OpenPreferencesTitle;
self.iconTitle = IconTitle;
self.startAtLoginTitle = StartAtLoginTitle;
self.noPluginPrefsTitle = NoPluginPrefsTitle;
self.moduleLabel = ModuleLabel;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[self toolbar] setVisible:YES];
if([[[self toolbar] items] count] == 0){
[[self toolbar] insertItemWithItemIdentifier:@"General" atIndex:0];
[[self toolbar] insertItemWithItemIdentifier:@"Modules" atIndex:1];
}
[self selectTabIndex:0];
[self expiryCheck];
[self initTitles];
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeyPath:@"values.Visibility"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeyPath:@"values.OnLogin"
options:NSKeyValueObservingOptionNew
context:nil];
oldIconValue = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] integerForKey:@"Visibility"];
oldOnLoginValue = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] boolForKey:@"OnLogin"];
}
- (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {
[self showPreferences:self];
return YES;
}
- (void)observeValueForKeyPath:(NSString*)keyPath
ofObject:(id)object
change:(NSDictionary*)change
context:(void*)context
{
NSUserDefaultsController *defaultController = [NSUserDefaultsController sharedUserDefaultsController];
if([keyPath isEqualToString:@"values.Visibility"])
{
NSNumber *value = [[defaultController defaults] valueForKey:@"Visibility"];
HWGrowlIconState index = [value integerValue];
switch (index) {
case kDontShowIcon:
if(![[defaultController defaults] boolForKey:@"SuppressNoIconWarn"])
{
[NSApp activateIgnoringOtherApps:YES];
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Warning! Enabling this option will cause HardwareGrowler to run in the background", nil)
defaultButton:NSLocalizedString(@"Ok", nil)
alternateButton:NSLocalizedString(@"Cancel", nil)
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"Enabling this option will cause HardwareGrowler to run without showing a dock icon or a menu item.\n\nTo access preferences, tap HardwareGrowler in Launchpad, or open HardwareGrowler in Finder.", nil)];
alert.showsSuppressionButton = YES;
NSInteger allow = [alert runModal];
if(allow == NSAlertDefaultReturn)
{
if([[alert suppressionButton] state] == NSOnState){
[[defaultController defaults] setBool:YES forKey:@"SuppressNoIconWarn"];
}
[self warnUserAboutIcons];
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
[statusItem release];
statusItem = nil;
}
else
{
[[defaultController defaults] setInteger:oldIconValue forKey:@"Visibility"];
[[defaultController defaults] synchronize];
[iconPopUp selectItemAtIndex:oldIconValue];
}
}else{
[self warnUserAboutIcons];
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
[statusItem release];
statusItem = nil;
}
break;
case kShowIconInBoth:
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if(!statusItem)
[self initMenu];
break;
case kShowIconInDock:
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
[statusItem release];
statusItem = nil;
break;
case kShowIconInMenu:
default:
if(!statusItem)
[self initMenu];
if(oldIconValue == kShowIconInBoth || oldIconValue == kShowIconInDock)
[self warnUserAboutIcons];
break;
}
oldIconValue = index;
}
else if ([keyPath isEqualToString:@"values.OnLogin"])
{
BOOL state = [[defaultController defaults] boolForKey:@"OnLogin"];
if(state && (oldOnLoginValue != state))
{
if(![[defaultController defaults] boolForKey:@"SuppressStartAtLogin"])
{
[NSApp activateIgnoringOtherApps:YES];
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Alert! Enabling this option will add HardwareGrowler to your login items", nil)
defaultButton:NSLocalizedString(@"Ok", nil)
alternateButton:NSLocalizedString(@"Cancel", nil)
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"Allowing this will let HardwareGrowler launch everytime you login, so that it is available for applications which use it at all times", nil)];
alert.showsSuppressionButton = YES;
NSInteger allow = [alert runModal];
if(allow == NSAlertDefaultReturn)
{
if([[alert suppressionButton] state] == NSOnState){
[[defaultController defaults] setBool:YES forKey:@"SuppressStartAtLogin"];
}
[self setStartAtLogin:YES];
}
else
{
[self setStartAtLogin:NO];
[[defaultController defaults] setBool:oldOnLoginValue forKey:@"OnLogin"];
[[defaultController defaults] synchronize];
[onLoginSwitch setState:oldOnLoginValue];
}
}else{
[self setStartAtLogin:YES];
}
}
else{
[self setStartAtLogin:NO];
}
oldOnLoginValue = state;
}
else if(object == onLoginSwitch && [keyPath isEqualToString:@"state"])
{
[[defaultController values] setValue:[NSNumber numberWithBool:[onLoginSwitch state]] forKey:@"OnLogin"];
[defaultController save:nil];
}
}
- (void)warnUserAboutIcons
{
if((BOOL)isless(NSFoundationVersionNumber, NSFoundationVersionNumber10_7)) {
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:NSLocalizedString(@"This setting will take effect when Hardware Growler restarts",nil)];
[alert runModal];
}
}
- (void) setStartAtLogin:(BOOL)enabled {
if(!SMLoginItemSetEnabled(CFSTR("com.growl.HardwareGrowlerLauncher"), enabled)){
//NSLog(@"Failure Setting HardwareGrowlLauncher to %@start at login", enabled ? @"" : @"not ");
}
}
#pragma mark Module Table
-(IBAction)moduleCheckbox:(id)sender {
NSInteger selection = [tableView clickedRow];
if(selection >= 0 && (NSUInteger)selection < [[pluginController plugins] count]){
NSMutableDictionary *pluginDict = [[pluginController plugins] objectAtIndex:selection];
id<HWGrowlPluginProtocol> plugin = [pluginDict objectForKey:@"plugin"];
NSString *identifier = [[NSBundle bundleForClass:[plugin class]] bundleIdentifier];
NSNumber *disabled = [pluginDict objectForKey:@"disabled"];
if([disabled boolValue]){
if([plugin respondsToSelector:@selector(stopObserving)])
[plugin stopObserving];
}else{
if([plugin respondsToSelector:@selector(startObserving)])
[plugin startObserving];
}
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *disabledDict = [[[defaults objectForKey:@"DisabledPlugins"] mutableCopy] autorelease];
if(!disabledDict)
disabledDict = [NSMutableDictionary dictionary];
[disabledDict setObject:disabled forKey:identifier];
[defaults setObject:disabledDict forKey:@"DisabledPlugins"];
[defaults synchronize];
}
}
-(void)tableViewSelectionDidChange:(NSNotification *)notification {
NSInteger selection = [tableView selectedRow];
NSView *newView = nil;
if(selection >= 0 && (NSUInteger)selection < [[pluginController plugins] count]){
id<HWGrowlPluginProtocol> plugin = [[[pluginController plugins] objectAtIndex:selection] objectForKey:@"plugin"];
if([plugin preferencePane]){
newView = [plugin preferencePane];
}else{
newView = placeholderView;
}
}else
newView = placeholderView;
[newView setFrameSize:[containerView frame].size];
if([currentView superview])
[currentView removeFromSuperview];
[containerView addSubview:newView];
self.currentView = newView;
[_window recalculateKeyViewLoop];
}
- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
if (aTableColumn == moduleColumn) {
NSCell *cell = [aTableColumn dataCellForRow:rowIndex];
id<HWGrowlPluginProtocol> plugin = [[[pluginController plugins] objectAtIndex:rowIndex] objectForKey:@"plugin"];
if([plugin preferenceIcon])
[cell setImage:[plugin preferenceIcon]];
else{
static NSImage *placeholder = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
placeholder = [[NSImage imageNamed:@"HWGPrefsDefault"] retain];
});
[cell setImage:placeholder];
}
}
return nil;
}
#pragma mark Toolbar
-(void)selectTabIndex:(NSInteger)tab {
if(tab < 0 || tab > 1)
tab = 0;
[toolbar setSelectedItemIdentifier:[NSString stringWithFormat:@"%ld", tab]];
[tabView selectTabViewItemAtIndex:tab];
}
-(IBAction)selectTab:(id)sender {
[self selectTabIndex:[sender tag]];
}
-(BOOL)validateToolbarItem:(NSToolbarItem *)theItem {
return YES;
}
-(NSArray*)toolbarSelectableItemIdentifiers:(NSToolbar*)aToolbar
{
return [NSArray arrayWithObjects:@"0", @"1", nil];
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
{
return [NSArray arrayWithObjects:@"0", @"1", nil];
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)aToolbar
{
return [NSArray arrayWithObjects:@"0", @"1", nil];
}
#ifdef BETA
#define DAYSTOEXPIRY 21
- (NSCalendarDate *)dateWithString:(NSString *)str {
str = [str stringByReplacingOccurrencesOfString:@" " withString:@" "];
NSArray *dateParts = [str componentsSeparatedByString:@" "];
int month = 1;
NSString *monthString = [dateParts objectAtIndex:0];
if ([monthString isEqualToString:@"Feb"]) {
month = 2;
} else if ([monthString isEqualToString:@"Mar"]) {
month = 3;
} else if ([monthString isEqualToString:@"Apr"]) {
month = 4;
} else if ([monthString isEqualToString:@"May"]) {
month = 5;
} else if ([monthString isEqualToString:@"Jun"]) {
month = 6;
} else if ([monthString isEqualToString:@"Jul"]) {
month = 7;
} else if ([monthString isEqualToString:@"Aug"]) {
month = 8;
} else if ([monthString isEqualToString:@"Sep"]) {
month = 9;
} else if ([monthString isEqualToString:@"Oct"]) {
month = 10;
} else if ([monthString isEqualToString:@"Nov"]) {
month = 11;
} else if ([monthString isEqualToString:@"Dec"]) {
month = 12;
}
NSString *dateString = [NSString stringWithFormat:@"%@-%d-%@ 00:00:00 +0000", [dateParts objectAtIndex:2], month, [dateParts objectAtIndex:1]];
return [NSCalendarDate dateWithString:dateString];
}
- (BOOL)expired
{
BOOL result = YES;
NSCalendarDate* nowDate = [self dateWithString:[NSString stringWithUTF8String:__DATE__]];
NSCalendarDate* expiryDate = [nowDate dateByAddingTimeInterval:(60*60*24* DAYSTOEXPIRY)];
if ([expiryDate earlierDate:[NSDate date]] != expiryDate)
result = NO;
return result;
}
- (void)expiryCheck
{
if([self expired])
{
[NSApp activateIgnoringOtherApps:YES];
NSInteger alert = NSRunAlertPanel(@"This Beta Has Expired", [NSString stringWithFormat:@"Please download a new version to keep using %@.", [[NSProcessInfo processInfo] processName]], @"Quit", nil, nil);
if (alert == NSOKButton)
{
[NSApp terminate:self];
}
}
}
#else
- (void)expiryCheck{
}
#endif
@end
| {'content_hash': '7d1a8d39f5183d5b75b1774c3ce5ae70', 'timestamp': '', 'source': 'github', 'line_count': 510, 'max_line_length': 260, 'avg_line_length': 35.21764705882353, 'alnum_prop': 0.7288012916875453, 'repo_name': 'xhruso00/growl', 'id': '9767b62759d2e2c307e30b09d52bbd12758bf030', 'size': '18933', 'binary': False, 'copies': '16', 'ref': 'refs/heads/master', 'path': 'Extras/HardwareGrowler/HardwareGrowler/AppDelegate.m', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'AppleScript', 'bytes': '1264'}, {'name': 'C', 'bytes': '43215'}, {'name': 'C++', 'bytes': '16000'}, {'name': 'CSS', 'bytes': '22727'}, {'name': 'Groff', 'bytes': '5515'}, {'name': 'HTML', 'bytes': '1351140'}, {'name': 'JavaScript', 'bytes': '2472'}, {'name': 'Makefile', 'bytes': '2322'}, {'name': 'Mathematica', 'bytes': '78408'}, {'name': 'Objective-C', 'bytes': '2671250'}, {'name': 'Ruby', 'bytes': '37765'}, {'name': 'Shell', 'bytes': '7027'}]} |
package org.xcolab.client.moderation.pojo;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.xcolab.client.moderation.pojo.tables.pojos.ReportTarget;
import java.io.Serializable;
@JsonDeserialize(as = ReportTarget.class)
public interface IReportTarget extends Serializable {
Long getId();
void setId(Long id);
String getType();
void setType(String type);
String getReason();
void setReason(String reason);
Integer getNotificationThreshold();
void setNotificationThreshold(Integer notificationThreshold);
Integer getScreeningThreshold();
void setScreeningThreshold(Integer screeningThreshold);
}
| {'content_hash': 'e20b3d0e867ebcf6f0d26e9cda9d3600', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 67, 'avg_line_length': 22.5, 'alnum_prop': 0.7703703703703704, 'repo_name': 'CCI-MIT/XCoLab', 'id': 'adc93b3d603b8965cbd10d57ef45e6deab02a9e9', 'size': '675', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'microservices/clients/moderation-client/src/main/java/org/xcolab/client/moderation/pojo/IReportTarget.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '22697'}, {'name': 'HTML', 'bytes': '69904'}, {'name': 'Java', 'bytes': '4089581'}, {'name': 'JavaScript', 'bytes': '1172118'}, {'name': 'SCSS', 'bytes': '201019'}, {'name': 'Shell', 'bytes': '13707'}]} |
package cc.bitky.clustermanage.netty.message.base;
public class BaseTcpResponseMsg extends BaseMessage {
private final int status;
public BaseTcpResponseMsg(int groupId, int boxId, int status) {
super(groupId, boxId);
this.status = status;
}
public int getStatus() {
return status;
}
}
| {'content_hash': '362d1bf2396e8a97e10194603f4ee1a3', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 67, 'avg_line_length': 20.9375, 'alnum_prop': 0.6716417910447762, 'repo_name': 'bitkylin/ClusterDeviceControlPlatform', 'id': 'd98bb3f632512d1a085ce3a13eb03844f6014b10', 'size': '335', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseTcpResponseMsg.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '42071'}, {'name': 'CSS', 'bytes': '3767'}, {'name': 'Java', 'bytes': '647762'}, {'name': 'Python', 'bytes': '14188'}, {'name': 'Shell', 'bytes': '2265'}]} |
/*----------------------------------------------------------------------
[-----*** TABLE OF CONTENT ***-----]
1. Header - Topbar
2. Header - Navbar
3. Header - Responsive Navbar Style
4. Header - Submenu
5. Header - Search
6. Header - Mega Menu
7. Header - Dark Option
8. Header - Fixed
-----------------------------------------------------------------------*/
/*--------------------------------------------------
[1. Header - Topbar]
----------------------------------------------------*/
/*Top Bar (login, search etc.)
------------------------------------*/
.header .topbar {
z-index: 12;
padding: 8px 0;
position: relative;
}
@media (max-width: 991px) {
.header .topbar {
margin-bottom: 20px;
}
}
.header .topbar ul.loginbar {
margin: 0;
}
.header .topbar ul.loginbar > li {
display: inline;
list-style: none;
position: relative;
padding-bottom: 15px;
}
.header .topbar ul.loginbar > li > a,
.header .topbar ul.loginbar > li > a:hover {
color: #7c8082;
font-size: 11px;
text-transform: uppercase;
}
.header .topbar ul.loginbar li i.fa {
color: #bbb;
}
.header .topbar ul.loginbar li.topbar-devider {
top: -1px;
padding: 0;
font-size: 8px;
position: relative;
margin: 0 5px 0 9px;
font-family: Tahoma;
border-left: solid 1px #bbb;
}
/*languages*/
.header .topbar ul.languages {
top: 25px;
right: -5px;
display: none;
padding: 4px 0;
padding-right: 0;
list-style: none;
min-width: 100px;
position: absolute;
background: #f0f0f0;
}
.header .topbar li:hover ul.languages {
display: block;
}
.header .topbar ul.languages:after {
top: -4px;
width: 0;
height: 0;
right: 8px;
content: " ";
display: block;
position: absolute;
border-bottom: 6px solid #f0f0f0;
border-right: 6px solid transparent;
border-left: 6px solid transparent;
border-right-style: inset; /*FF fixes*/
border-left-style: inset; /*FF fixes*/
}
.header .topbar ul.languages li a {
color: #555;
display: block;
font-size: 10px;
padding: 2px 12px;
margin-bottom: 1px;
text-transform: uppercase;
}
.header .topbar ul.languages li.active a i {
color: #999;
float: left;
margin-top: 2px;
}
.header .topbar ul.languages li a:hover,
.header .topbar ul.languages li.active a {
background: #fafafa;
}
.header .topbar ul.languages li a:hover {
text-decoration: none;
}
/*--------------------------------------------------
[2. Header - Navbar]
----------------------------------------------------*/
/*Navbar*/
.header {
z-index: 99;
background: #fff;
position: relative;
border-bottom: solid 2px #eee;
}
/*Header Container*/
.header > .container {
display: table;
margin-bottom: -40px;
}
@media (max-width: 768px) {
.header > .container {
width: 100%;
}
}
@media (max-width: 991px) {
.header > .container {
margin-bottom: 0;
}
}
/*Logo*/
.header .logo {
height: 100%;
width: 100px;
display: table-cell;
vertical-align: middle;
}
.header .logo img {
z-index: 1;
margin: 20px 0;
position: relative;
}
/*Big Logo Style*/
@media (max-width: 1200px) {
.header img.big-logo {
width: 170px;
height: auto;
}
}
@media (max-width: 500px) {
.header img.big-logo {
width: 130px;
height: auto;
}
}
.header img.big-logo {
transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-webkit-transition: all 0.4s ease-in-out;
}
/*Navbar Toggle*/
.header .navbar-toggle {
border-color: #5fb611;
}
@media (max-width: 991px) {
.header .navbar-toggle {
margin-left: 0;
}
}
.header .navbar-toggle .fa {
color: #fff;
font-size: 19px;
}
.header .navbar-toggle,
.header .navbar-toggle:hover,
.header .navbar-toggle:focus {
background: #72c02c;
padding: 6px 10px 2px;
}
.header .navbar-toggle:hover {
background: #5fb611 !important;
}
/*Navbar Collapse*/
.header .navbar-collapse {
position: relative;
}
/*Navbar Menu*/
.header .navbar-nav > li > a {
color: #687074;
font-size: 15px;
font-weight:400;
text-transform: uppercase;
}
.header .navbar-nav > .active > a {
color: #72c02c;
}
@media (min-width: 992px) {
.header .navbar-nav {
float: left;
}
}
/*No Topbar*/
.header.no-topbar .navbar-toggle {
margin-top: 25px;
}
@media (min-width: 992px) {
.header.no-topbar .navbar-nav {
padding-top: 36px;
}
}
/*Navbar Collapse*/
@media (max-width: 991px) {
.header .navbar-collapse,
.header .navbar-collapse .container {
padding-right: 0;
padding-left: 0;
}
}
/*--------------------------------------------------
[3. Header - Responsive Navbar Style]
----------------------------------------------------*/
/*Responsive Navbar*/
@media (max-width: 991px) {
/*Responsive code for max-width: 991px*/
.header .navbar-header {
float: none;
}
.header .navbar-toggle {
display: block;
}
.header .navbar-collapse.collapse {
display: none !important;
}
.header .navbar-collapse.collapse.in {
display: block !important;
overflow-y: auto !important;
}
.header .navbar-nav {
margin: 0 0 5px;
float: none !important;
}
.header .navbar-nav > li {
float: none;
}
.header .navbar-nav > li > a {
padding-top: 30px;
padding-bottom: 40px;
}
/*Pull Right*/
.header .dropdown-menu.pull-right {
float: none !important;
}
/*Dropdown Menu Slide Down Effect*/
.header .navbar-nav .open .dropdown-menu {
border: 0;
float: none;
width: auto;
margin-top: 0;
position: static;
box-shadow: none;
background-color: transparent;
}
.header .navbar-nav .open > a,
.header .navbar-nav .open > a:hover,
.header .navbar-nav .open > a:focus {
border-bottom-color: #eee;
}
.header .navbar-nav .open .dropdown-menu > li > a,
.header .navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 25px 5px 15px;
}
.header .navbar-nav .open .dropdown-menu > li > a {
line-height: 20px;
}
.header .navbar-nav .open .dropdown-menu > li > a:hover,
.header .navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none;
}
.header .navbar-nav .open .dropdown-menu > li > a {
color: #777;
}
.header .navbar-nav .open .dropdown-menu > li > a:hover,
.header .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
background-color: transparent;
}
.header .navbar-nav .open .dropdown-menu > .active > a,
.header .navbar-nav .open .dropdown-menu > .active > a:hover,
.header .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.header .navbar-nav .open .dropdown-menu > .disabled > a,
.header .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.header .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
.header .dropdown-menu.no-bottom-space {
padding-bottom: 0;
}
/*Design for max-width: 991px*/
.header .navbar-nav > li > a {
font-size: 14px;
padding: 9px 10px;
}
.header .navbar-nav > li a {
border-bottom: solid 1px #eee;
}
.header .navbar-nav > li > a:focus {
background: none;
}
.header .navbar-nav > li > a:hover {
color: #72c02c;
}
.header .navbar-nav > .active > a,
.header .navbar-nav > .active > a:hover,
.header .navbar-nav > .active > a:focus {
background: #72c02c;
color: #fff !important;
}
.header .dropdown .dropdown-submenu > a {
font-size: 13px;
color: #555 !important;
text-transform: uppercase;
}
}
@media (min-width: 992px) {
/*Navbar Collapse*/
.header .navbar-collapse {
padding: 0;
}
/*Navbar*/
.header .container > .navbar-header,
.header .container-fluid > .navbar-header,
.header .container > .navbar-collapse,
.header .container-fluid > .navbar-collapse {
margin-bottom: -10px;
}
.header .navbar-nav {
position: relative;
}
.header .navbar-nav > li > a {
bottom: -2px;
position: relative;
padding: 9px 20px 9px 30px;
}
.header .navbar-nav > li > a,
.header .navbar-nav > li > a:focus {
border-bottom: solid 2px transparent;
}
.header .navbar-nav > li > a:hover,
.header .navbar-nav > .active > a {
bottom: -2px;
position: relative;
border-bottom: solid 2px #72c02c;
}
.header .navbar-nav > li > a,
.header .navbar-nav > li > a:hover,
.header .navbar-nav > li > a:focus,
.header .navbar-nav > .active > a,
.header .navbar-nav > .active > a:hover,
.header .navbar-nav > .active > a:focus {
background: none;
}
.header .navbar-nav > .open > a,
.header .navbar-nav > .open > a:hover,
.header .navbar-nav > .open > a:focus {
color: #72c02c;
}
.header .navbar-nav > li:hover > a {
color: #72c02c;
}
/*Dropdown Menu*/
.header .dropdown-menu {
padding: 0;
border: none;
min-width: 200px;
border-radius: 0;
z-index: 9999 !important;
border-top: solid 2px #72c02c;
border-bottom: solid 2px #687074;
}
.header .dropdown-menu li a {
color: #687074;
font-size: 13px;
font-weight: 400;
padding: 6px 15px;
border-bottom: solid 1px #eee;
}
.header .dropdown-menu .active > a,
.header .dropdown-menu li > a:hover {
color: #687074;
filter: none !important;
background: #eee !important;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.header .dropdown-menu li > a:focus {
background: none;
filter: none !important;
}
.header .navbar-nav > li.dropdown:hover > .dropdown-menu {
display: block;
}
.header .open > .dropdown-menu {
display: none;
}
/*Search*/
.header .navbar-nav .search-open {
width: 330px;
}
}
/*--------------------------------------------------
[4. Header - Submenu]
----------------------------------------------------*/
/*Dropdown Submenu for BS3
------------------------------------*/
.header .dropdown-submenu {
position: relative;
}
.header .dropdown > a:after,
.header .dropdown-submenu > a:after {
top: 8px;
left: 9px;
font-size: 11px;
content: "\f105";
position: absolute;
font-weight: normal;
display: inline-block;
font-family: FontAwesome;
}
@media (max-width: 991px) {
.header .dropdown-submenu > a:after {
content: " ";
}
}
.header .dropdown > a:after {
top: 9px;
left: 15px;
content: "\f107";
}
.header .dropdown-submenu > .dropdown-menu {
top: 3px;
right: 100%;
margin-top: -5px;
margin-right: 0px;
}
/*Submenu comes from LEFT side*/
.header .dropdown-submenu > .dropdown-menu.submenu-left {
right: -100%;
}
.header .dropdown-submenu:hover > .dropdown-menu {
display: block;
}
@media (max-width: 991px) {
.header .dropdown-submenu > .dropdown-menu {
display: block;
margin-right: 15px;
}
}
.header .dropdown-submenu.pull-left {
float: none;
}
.header .dropdown-submenu.pull-left > .dropdown-menu {
right: -100%;
margin-right: 10px;
}
.header .dropdown-menu li [class^="fa-"],
.header .dropdown-menu li [class*=" fa-"] {
right: -3px;
width: 1.25em;
margin-left: 1px;
position: relative;
text-align: center;
display: inline-block;
}
.header .dropdown-menu li [class^="fa-"].fa-lg,
.header .dropdown-menu li [class*=" fa-"].fa-lg {
/* increased font size for fa-lg */
width: 1.5625em;
}
/*--------------------------------------------------
[5. Header - Search]
----------------------------------------------------*/
/*Search Box
------------------------------------*/
.header .nav > li > .search {
color: #aaa;
cursor: pointer;
min-width: 35px;
font-size: 15px;
text-align: center;
background: #f7f7f7;
padding: 11px 0 12px;
display: inline-block;
border-bottom: solid 2px #aaa;
}
@media (min-width: 992px) {
.header .nav > li > .search {
bottom: -2px;
position: relative;
}
}
.header .nav > li > .search:hover {
color: #72c02c;
background: #f7f7f7;
border-bottom-color: #72c02c;
}
.header .nav .search-open {
left: 0;
top: 40px;
display: none;
padding: 14px;
position: absolute;
background: #fcfcfc;
border-top: solid 2px #eee;
box-shadow: 0 1px 3px #ddd;
}
.header .nav .search-open form {
margin: 0;
}
@media (min-width: 767px) and (max-width: 991px) {
.header .navbar-toggle {
margin-left: 0;
}
.header .nav .search-open {
width: 93%;
}
}
@media (max-width: 991px) {
.header .nav > li > .search {
color: #999;
width: 35px;
height: 34px;
text-align: right;
background: #eee;
line-height: 12px;
text-align: center;
margin: 5px 10px 0;
border-bottom: none;
}
.header .nav > li > .search:hover {
background: #5fb611;
color: #fff !important;
}
.header .nav .search-open {
top: 5px;
padding: 0;
right: 48px;
border-top: none;
box-shadow: none;
background: none;
margin-left: 10px;
}
}
/*--------------------------------------------------
[6. Header - Mega Menu]
----------------------------------------------------*/
/*Mega Menu
------------------------------------*/
.header .mega-menu .nav,
.header .mega-menu .dropup,
.header .mega-menu .dropdown,
.header .mega-menu .collapse {
position: static;
}
.header .mega-menu .navbar-inner,
.header .mega-menu .container {
position: relative;
}
.header .mega-menu .dropdown-menu {
right: auto;
}
.header .mega-menu .dropdown-menu > li {
display: block;
}
.header .mega-menu .dropdown-submenu .dropdown-menu {
right: 100%;
}
.header .mega-menu .nav.pull-right .dropdown-menu {
left: 0;
}
.header .mega-menu .mega-menu-content {
*zoom: 1;
padding: 4px 15px;
}
.header .mega-menu .mega-menu-content:before,
.header .mega-menu .mega-menu-content:after {
content: "";
display: table;
line-height: 0;
}
.header .mega-menu .mega-menu-content:after {
clear: both;
}
.header .mega-menu .nav > li > .dropdown-menu:after,
.header .mega-menu .nav > li > .dropdown-menu:before {
display: none;
}
.header .mega-menu .dropdown.mega-menu-fullwidth .dropdown-menu {
right: 0;
left: 0;
overflow: hidden;
}
@media (min-width: 992px) {
/*Mega Menu for Two Columns*/
.header .mega-menu .mega-menu-content.content-two-col {
min-width: 596px;
}
/*Mega Menu for Three Columns*/
.header .mega-menu .mega-menu-content.content-three-col {
min-width: 864px;
}
}
/*Mega Menu Dropdown OPENS from LEFT Side*/
.header .mega-menu .dropdown.mega-menu-left .dropdown-menu {
right: auto;
overflow: hidden;
}
/*Mega Menu Dropdown OPENS from RIGHT Side*/
.header .mega-menu .dropdown.mega-menu-right .dropdown-menu,
.header .mega-menu .dropdown.mega-menu-two-col-right .dropdown-menu {
left: 0;
overflow: hidden;
}
/*Equal Height Lists*/
@media (min-width: 992px) {
.header .mega-menu .equal-height {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.header .mega-menu .equal-height-in {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
/*Mega Menu Style Effect*/
.header .mega-menu .equal-height-list h3 {
font-size: 15px;
font-weight: 400;
padding: 0 13px 0 10px;
text-transform: uppercase;
}
/*Space for only Big Resolution*/
@media (min-width: 992px) {
.header .mega-menu .big-screen-space {
margin-bottom: 20px;
}
}
/*Mega Menu Content*/
@media (min-width: 992px) {
.header .mega-menu .equal-height-in {
padding: 20px 0;
border-right: 1px solid #eee;
}
.header .mega-menu .equal-height-in:first-child {
border-right: none;
margin-right: -1px;
}
.header .mega-menu .equal-height-list {
width: 100%;
}
.header .mega-menu .equal-height-list li a {
display: block;
margin-bottom: 1px;
position: relative;
border-bottom: none;
padding: 5px 15px 5px 10px;
}
.header .mega-menu .equal-height-list a:hover {
text-decoration: none;
}
/*Dropdown Arrow Icons*/
.header .mega-menu .mega-menu-content li a {
padding: 5px 30px 5px 10px;
}
.header .mega-menu .mega-menu-content li a:after {
top: 7px;
right: 15px;
font-size: 11px;
content: "\f105";
position: absolute;
font-weight: normal;
display: inline-block;
font-family: FontAwesome;
}
/*Dropdown Arrow Icons Disable class*/
.header .mega-menu .disable-icons li a {
padding: 5px 15px 5px 10px;
}
.header .mega-menu .disable-icons li a:after {
display: none;
}
}
/*Equal Hight List Style*/
@media (max-width: 991px) {
/*Equal Height List Style*/
.header .mega-menu .equal-height-list h3 {
color: #555;
margin: 0 0 5px;
font-size: 13px;
font-weight: 400;
padding: 6px 25px 5px;
border-bottom: solid 1px #eee;
}
.header .mega-menu .equal-height-list li a {
color: #687074;
display: block;
font-size: 13px;
font-weight: 400;
margin-right: 15px;
padding: 6px 25px;
border-bottom: solid 1px #eee;
}
.header .mega-menu .equal-height-list > h3.active,
.header .mega-menu .equal-height-list > .active > a,
.header .mega-menu .equal-height-list > .active > a:hover,
.header .mega-menu .equal-height-list > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.header .mega-menu .equal-height-list li a:hover {
color: #333;
text-decoration: none;
}
}
/*--------------------------------------------------
[7. Header - Dark Option]
----------------------------------------------------*/
/*Header*/
.header.header-dark {
background: #2d2d2d;
border-bottom-color: #555;
}
/*Topbar*/
.header.header-dark .topbar ul.languages {
background: #444;
}
.header.header-dark .topbar ul.loginbar li.topbar-devider {
border-left-color: #666;
}
.header.header-dark .topbar ul.languages li a {
color: #bbb;
}
.header.header-dark .topbar ul.languages:after {
border-bottom-color: #444;
}
.header.header-dark .topbar ul.languages li a:hover,
.header.header-dark .topbar ul.languages li.active a {
color: #bbb;
background: #555;
}
/*Navbar Nav*/
.header.header-dark .navbar-nav > li > a {
color: #ddd;
}
.header.header-dark .navbar-nav > .open > a,
.header.header-dark .navbar-nav > .open > a:hover,
.header.header-dark .navbar-nav > .open > a:focus {
background: inherit;
}
@media (max-width: 991px) {
.header.header-dark .navbar-nav > li a {
border-bottom-color: #666;
}
.header.header-dark .navbar-nav .dropdown > a:hover {
color: #72c02c;
background: inherit;
}
.header.header-dark .navbar-nav .open > a,
.header.header-dark .navbar-nav .open > a:hover,
.header.header-dark .navbar-nav .open > a:focus {
border-bottom-color: #666;
}
.header.header-dark .navbar-nav .open .dropdown-menu > li > a {
color: #bbb;
}
.header.header-dark .navbar-nav .open .dropdown-menu > li > a:hover,
.header.header-dark .navbar-nav .open .dropdown-menu > li > a:focus {
color: #fff !important;
}
.header.header-dark .navbar-nav .open .dropdown-menu > .active > a,
.header.header-dark .navbar-nav .open .dropdown-menu > .active > a:hover,
.header.header-dark .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #bbb;
background: #444;
}
.header.header-dark .dropdown .dropdown-submenu > a {
color: #bbb !important;
}
}
@media (min-width: 992px) {
.header.header-dark .navbar-nav > li > a:hover,
.header.header-dark .navbar-nav > .active > a {
color: #72c02c !important;
}
.header.header-dark .dropdown-menu {
background: #2d2d2d;
}
.header.header-dark .dropdown-menu li > a {
color: #bbb;
border-bottom-color: #666;
}
.header.header-dark .dropdown-menu .active > a,
.header.header-dark .dropdown-menu li > a:hover {
background: #202020 !important;
}
}
/*Search*/
.header.header-dark .nav > li > .search {
background: #444;
}
.header.header-dark .search-open {
background: #2d2d2d;
border-top-color: #555;
box-shadow: 0 1px 3px #888;
}
.header.header-dark .input-group .form-control {
color: #bbb;
background: #555;
border-color: #999;
box-shadow: 0 0 2px #555;
}
/*Mega Menu*/
.header.header-dark .mega-menu .equal-height-list h3 {
color: #eee;
}
@media (max-width: 991px) {
.header.header-dark .mega-menu .equal-height-list li a {
color: #bbb;
border-bottom-color: #666;
}
.header.header-dark .mega-menu .equal-height-list li a:focus,
.header.header-dark .mega-menu .equal-height-list li a:hover {
color: #fff;
}
.header.header-dark .mega-menu .equal-height-list h3 {
border-bottom-color: #666;
}
}
@media (min-width: 992px) {
.header.header-dark .mega-menu .equal-height-in {
border-right-color: #666;
}
}
/*--------------------------------------------------
[8. Header - Fixed]
----------------------------------------------------*/
/*Header*/
.header-fixed .header {
height: auto;
}
.header-fixed .header.header-fixed-shrink {
top: 0;
right: 0;
width: 100%;
height: 95px;
z-index: 9999;
position: fixed;
margin-top: -35px;
border-bottom: none;
box-shadow: 0 0 3px #bbb;
background: rgba(255,255,255, 0.96);
}
@media (max-width: 991px) {
/*Header*/
.header-fixed .header,
.header-fixed .header.header-fixed-shrink {
height: inherit;
position: relative;
}
}
@media (min-width: 992px) {
/*Container*/
.header-fixed .header.header-fixed-shrink > .container {
margin-bottom: -46px;
}
/*Logo*/
.header-fixed .header.header-fixed-shrink .logo img {
max-width: 105px;
margin: 45px 0 -4px;
}
/*Topbar*/
.header-fixed .header.header-fixed-shrink .topbar {
margin-top: -10px;
}
/*Navbar Nav*/
.header-fixed .header.header-fixed-shrink .navbar-nav > li > a {
padding-top: 19px;
padding-bottom: 19px;
}
.header-fixed .header.header-fixed-shrink .navbar-nav > li > a:hover,
.header-fixed .header.header-fixed-shrink .navbar-nav > .active > a {
border-bottom: none;
}
/*Dropdown*/
.header-fixed .header.header-fixed-shrink .dropdown > a:after {
top: 20px;
}
/*Search*/
.header-fixed .header.header-fixed-shrink .nav > li > .search {
color: #555;
padding: 20px 0 22px;
background: inherit;
border-bottom: none;
}
.header-fixed .header.header-fixed-shrink .nav .search-open {
top: 60px;
}
} | {'content_hash': '756197a8dd37c2df980124d0cc1dcd8e', 'timestamp': '', 'source': 'github', 'line_count': 1097, 'max_line_length': 75, 'avg_line_length': 20.10847766636281, 'alnum_prop': 0.6083684663856023, 'repo_name': 'corner82/sanalFabrika', 'id': 'e2a9141a7fedf7d25239ff420b4879117ccb0bb9', 'size': '22059', 'binary': False, 'copies': '21', 'ref': 'refs/heads/master', 'path': 'public/onyuz/assets/css/css-rtl/headers/header-default-rtl.css', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '711'}, {'name': 'CSS', 'bytes': '5894163'}, {'name': 'HTML', 'bytes': '9319794'}, {'name': 'JavaScript', 'bytes': '8187769'}, {'name': 'PHP', 'bytes': '189108'}, {'name': 'Python', 'bytes': '32324'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.exog_names" href="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.exog_names.html" />
<link rel="prev" title="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.predict" href="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.predict.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.12.1</span>
<span class="md-header-nav__topic"> statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../regression.html" class="md-tabs__link">Linear Regression</a></li>
<li class="md-tabs__item"><a href="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.html" class="md-tabs__link">statsmodels.regression.dimred.SlicedAverageVarianceEstimation</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.12.1</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../regression.html" class="md-nav__link">Linear Regression</a>
</li>
<li class="md-nav__item">
<a href="../glm.html" class="md-nav__link">Generalized Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a>
</li>
<li class="md-nav__item">
<a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a>
</li>
<li class="md-nav__item">
<a href="../rlm.html" class="md-nav__link">Robust Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a>
</li>
<li class="md-nav__item">
<a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../anova.html" class="md-nav__link">ANOVA</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-regression-dimred-slicedaveragevarianceestimation-endog-names--page-root">statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names<a class="headerlink" href="#generated-statsmodels-regression-dimred-slicedaveragevarianceestimation-endog-names--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt id="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names">
<em class="property">property </em><code class="sig-prename descclassname">SlicedAverageVarianceEstimation.</code><code class="sig-name descname">endog_names</code><a class="headerlink" href="#statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Names of endogenous variables.</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.predict.html" title="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.predict"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.regression.dimred.SlicedAverageVarianceEstimation.predict </span>
</div>
</a>
<a href="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.exog_names.html" title="statsmodels.regression.dimred.SlicedAverageVarianceEstimation.exog_names"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.regression.dimred.SlicedAverageVarianceEstimation.exog_names </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 29, 2020.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html> | {'content_hash': '608f5c0ed8449f7556eeddf8c893dce2', 'timestamp': '', 'source': 'github', 'line_count': 491, 'max_line_length': 999, 'avg_line_length': 37.97148676171079, 'alnum_prop': 0.6033576485732676, 'repo_name': 'statsmodels/statsmodels.github.io', 'id': '4f6874a95ea140d0e6b82455cf128cf95d535b11', 'size': '18648', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'v0.12.1/generated/statsmodels.regression.dimred.SlicedAverageVarianceEstimation.endog_names.html', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []} |
module Martyr
module Runtime
class BaseLevelScope
include Martyr::Level
include Martyr::LevelComparator
attr_accessor :level
attr_reader :collection
delegate :level_definition, :name, :dimension_name, :query?, :degenerate?, :to_i, to: :level
delegate :fact_key, :fact_alias, to: :level_definition
def initialize(collection, level)
@collection = collection
@level = level
@cache = nil
end
end
end
end
| {'content_hash': '82188bfad5117b6ac61100d8463e43ea', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 98, 'avg_line_length': 24.35, 'alnum_prop': 0.6386036960985626, 'repo_name': 'Liboul/martyr', 'id': 'eec3c4c70b447a1bc4aadfc6e8b29f116d3d8a07', 'size': '487', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'lib/martyr/runtime/dimension_scopes/base_level_scope.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '311419'}, {'name': 'Shell', 'bytes': '115'}]} |
@interface FTRNetworkTestViewController : UIViewController
- (instancetype)init NS_UNAVAILABLE;
@end
| {'content_hash': '433c94d95ad8e3d234106440db340ae9', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 58, 'avg_line_length': 20.6, 'alnum_prop': 0.8252427184466019, 'repo_name': 'sskhandp/EarlGrey', 'id': '733d907962912fcc359b341148c468bea0775dc7', 'size': '849', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'Tests/FunctionalTests/TestRig/Sources/FTRNetworkTestViewController.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '5760'}, {'name': 'HTML', 'bytes': '8531'}, {'name': 'Objective-C', 'bytes': '2084923'}, {'name': 'Python', 'bytes': '4166'}, {'name': 'Ruby', 'bytes': '38233'}, {'name': 'Shell', 'bytes': '16824'}, {'name': 'Swift', 'bytes': '29168'}]} |
Contributors
============
NEXT has been developed by the following people (alphabetically):
* Ari Biswas
* Chris Fernandez
* Nick Glattard
* Lalit Jain
* Kevin Jamieson
* Liam Marshall
* Daniel Ross
* Scott Sievert
| {'content_hash': '925baffb1282a6e86e90b4afaa753ec2', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 65, 'avg_line_length': 16.692307692307693, 'alnum_prop': 0.7235023041474654, 'repo_name': 'kgjamieson/NEXT', 'id': '00bed62a467f35c3c09ef00c565884cbe63fc8d1', 'size': '217', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'CONTRIBUTORS.md', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '64959'}, {'name': 'JavaScript', 'bytes': '20467'}, {'name': 'Python', 'bytes': '822904'}, {'name': 'Shell', 'bytes': '5783'}]} |
/**
* WikimediaUI Base v0.9.2
* Wikimedia Foundation user interface base variables
*/
/* Colors */
/* Positioning */
/* Box Model properties */
/* Max Widths */
/* Typography incl. print properties */
/* Other Properties */
/* Animation & Transition */
.oo-ui-icon-bright {
background-image: url('themes/wikimediaui/images/icons/bright.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bright.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bright.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/bright.png');
}
.oo-ui-image-invert.oo-ui-icon-bright {
background-image: url('themes/wikimediaui/images/icons/bright-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bright-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bright-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/bright-invert.png');
}
.oo-ui-icon-halfBright {
background-image: url('themes/wikimediaui/images/icons/halfBright.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/halfBright.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/halfBright.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/halfBright.png');
}
.oo-ui-image-invert.oo-ui-icon-halfBright {
background-image: url('themes/wikimediaui/images/icons/halfBright-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/halfBright-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/halfBright-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/halfBright-invert.png');
}
.oo-ui-icon-notBright {
background-image: url('themes/wikimediaui/images/icons/notBright.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notBright.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notBright.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/notBright.png');
}
.oo-ui-image-invert.oo-ui-icon-notBright {
background-image: url('themes/wikimediaui/images/icons/notBright-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notBright-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notBright-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/notBright-invert.png');
}
.oo-ui-icon-eye {
background-image: url('themes/wikimediaui/images/icons/eye.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eye.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eye.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/eye.png');
}
.oo-ui-image-invert.oo-ui-icon-eye {
background-image: url('themes/wikimediaui/images/icons/eye-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eye-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eye-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/eye-invert.png');
}
.oo-ui-icon-eyeClosed {
background-image: url('themes/wikimediaui/images/icons/eyeClosed.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eyeClosed.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eyeClosed.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/eyeClosed.png');
}
.oo-ui-image-invert.oo-ui-icon-eyeClosed {
background-image: url('themes/wikimediaui/images/icons/eyeClosed-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eyeClosed-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/eyeClosed-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/eyeClosed-invert.png');
}
.oo-ui-icon-moon {
background-image: url('themes/wikimediaui/images/icons/moon.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/moon.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/moon.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/moon.png');
}
.oo-ui-image-invert.oo-ui-icon-moon {
background-image: url('themes/wikimediaui/images/icons/moon-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/moon-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/moon-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/moon-invert.png');
}
.oo-ui-icon-largerText {
background-image: url('themes/wikimediaui/images/icons/largerText-rtl.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/largerText-rtl.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/largerText-rtl.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/largerText-rtl.png');
}
.oo-ui-image-invert.oo-ui-icon-largerText {
background-image: url('themes/wikimediaui/images/icons/largerText-rtl-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/largerText-rtl-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/largerText-rtl-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/largerText-rtl-invert.png');
}
.oo-ui-icon-smallerText {
background-image: url('themes/wikimediaui/images/icons/smallerText-rtl.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/smallerText-rtl.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/smallerText-rtl.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/smallerText-rtl.png');
}
.oo-ui-image-invert.oo-ui-icon-smallerText {
background-image: url('themes/wikimediaui/images/icons/smallerText-rtl-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/smallerText-rtl-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/smallerText-rtl-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/smallerText-rtl-invert.png');
}
.oo-ui-icon-visionSimulator {
background-image: url('themes/wikimediaui/images/icons/visionSimulator.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/visionSimulator.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/visionSimulator.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/visionSimulator.png');
}
.oo-ui-image-invert.oo-ui-icon-visionSimulator {
background-image: url('themes/wikimediaui/images/icons/visionSimulator-invert.png');
background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/visionSimulator-invert.svg');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/visionSimulator-invert.svg');
background-image: -o-linear-gradient(transparent, transparent), url('themes/wikimediaui/images/icons/visionSimulator-invert.png');
}
| {'content_hash': 'fc07f6e98f5d5c162eebada93b83ad57', 'timestamp': '', 'source': 'github', 'line_count': 120, 'max_line_length': 150, 'avg_line_length': 79.06666666666666, 'alnum_prop': 0.7653878583473862, 'repo_name': 'froala/cdnjs', 'id': '14387628c16a679915d9c07640b1de5a3b31c296', 'size': '9719', 'binary': False, 'copies': '16', 'ref': 'refs/heads/master', 'path': 'ajax/libs/oojs-ui/0.23.2/oojs-ui-wikimediaui-icons-accessibility.rtl.css', 'mode': '33188', 'license': 'mit', 'language': []} |
package org.elasticsearch.index.translog;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
/**
* only for testing until we have a disk-full FileSystem
*/
@FunctionalInterface
public interface ChannelFactory {
default FileChannel open(Path path) throws IOException {
return open(path, StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.CREATE_NEW);
}
FileChannel open(Path path, OpenOption... options) throws IOException;
}
| {'content_hash': 'ab9ed3684b349749d3ea31b6fff8187e', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 108, 'avg_line_length': 29.3, 'alnum_prop': 0.7781569965870307, 'repo_name': 'fred84/elasticsearch', 'id': 'ccb362a35077253816da86d9d72f2e1b2de5a14d', 'size': '1374', 'binary': False, 'copies': '65', 'ref': 'refs/heads/master', 'path': 'server/src/main/java/org/elasticsearch/index/translog/ChannelFactory.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ANTLR', 'bytes': '11082'}, {'name': 'Batchfile', 'bytes': '11603'}, {'name': 'Emacs Lisp', 'bytes': '3341'}, {'name': 'FreeMarker', 'bytes': '45'}, {'name': 'Groovy', 'bytes': '356024'}, {'name': 'HTML', 'bytes': '2186'}, {'name': 'Java', 'bytes': '44964586'}, {'name': 'Perl', 'bytes': '11756'}, {'name': 'Python', 'bytes': '19852'}, {'name': 'Shell', 'bytes': '100808'}]} |
<?php
namespace Symfony\Component\HttpFoundation\SessionStorage;
/**
* PdoSessionStorage.
*
* @author Fabien Potencier <[email protected]>
* @author Michael Williams <[email protected]>
*/
class PdoSessionStorage extends NativeSessionStorage
{
private $db;
private $dbOptions;
/**
* Constructor.
*
* @param \PDO $db A PDO instance
* @param array $options An associative array of session options
* @param array $dbOptions An associative array of DB options
*
* @throws \InvalidArgumentException When "db_table" option is not provided
*
* @see NativeSessionStorage::__construct()
*/
public function __construct(\PDO $db, array $options = array(), array $dbOptions = array())
{
if (!array_key_exists('db_table', $dbOptions)) {
throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.');
}
$this->db = $db;
$this->dbOptions = array_merge(array(
'db_id_col' => 'sess_id',
'db_data_col' => 'sess_data',
'db_time_col' => 'sess_time',
), $dbOptions);
parent::__construct($options);
}
/**
* Starts the session.
*/
public function start()
{
if (self::$sessionStarted) {
return;
}
// use this object as the session handler
session_set_save_handler(
array($this, 'sessionOpen'),
array($this, 'sessionClose'),
array($this, 'sessionRead'),
array($this, 'sessionWrite'),
array($this, 'sessionDestroy'),
array($this, 'sessionGC')
);
parent::start();
}
/**
* Opens a session.
*
* @param string $path (ignored)
* @param string $name (ignored)
*
* @return Boolean true, if the session was opened, otherwise an exception is thrown
*/
public function sessionOpen($path = null, $name = null)
{
return true;
}
/**
* Closes a session.
*
* @return Boolean true, if the session was closed, otherwise false
*/
public function sessionClose()
{
// do nothing
return true;
}
/**
* Destroys a session.
*
* @param string $id A session ID
*
* @return Boolean true, if the session was destroyed, otherwise an exception is thrown
*
* @throws \RuntimeException If the session cannot be destroyed
*/
public function sessionDestroy($id)
{
// get table/column
$dbTable = $this->dbOptions['db_table'];
$dbIdCol = $this->dbOptions['db_id_col'];
// delete the record associated with this id
$sql = "DELETE FROM $dbTable WHERE $dbIdCol = :id";
try {
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->execute();
} catch (\PDOException $e) {
throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
}
/**
* Cleans up old sessions.
*
* @param int $lifetime The lifetime of a session
*
* @return Boolean true, if old sessions have been cleaned, otherwise an exception is thrown
*
* @throws \RuntimeException If any old sessions cannot be cleaned
*/
public function sessionGC($lifetime)
{
// get table/column
$dbTable = $this->dbOptions['db_table'];
$dbTimeCol = $this->dbOptions['db_time_col'];
// delete the record associated with this id
$sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)";
try {
$stmt = $this->db->prepare($sql);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute();
} catch (\PDOException $e) {
throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
}
/**
* Reads a session.
*
* @param string $id A session ID
*
* @return string The session data if the session was read or created, otherwise an exception is thrown
*
* @throws \RuntimeException If the session cannot be read
*/
public function sessionRead($id)
{
// get table/columns
$dbTable = $this->dbOptions['db_table'];
$dbDataCol = $this->dbOptions['db_data_col'];
$dbIdCol = $this->dbOptions['db_id_col'];
try {
$sql = "SELECT $dbDataCol FROM $dbTable WHERE $dbIdCol = :id";
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->execute();
// it is recommended to use fetchAll so that PDO can close the DB cursor
// we anyway expect either no rows, or one row with one column. fetchColumn, seems to be buggy #4777
$sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM);
if (count($sessionRows) == 1) {
$session = is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
return base64_decode($session);
}
// session does not exist, create it
$this->createNewSession($id);
return '';
} catch (\PDOException $e) {
throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
}
/**
* Writes session data.
*
* @param string $id A session ID
* @param string $data A serialized chunk of session data
*
* @return Boolean true, if the session was written, otherwise an exception is thrown
*
* @throws \RuntimeException If the session data cannot be written
*/
public function sessionWrite($id, $data)
{
// get table/column
$dbTable = $this->dbOptions['db_table'];
$dbDataCol = $this->dbOptions['db_data_col'];
$dbIdCol = $this->dbOptions['db_id_col'];
$dbTimeCol = $this->dbOptions['db_time_col'];
$sql = ('mysql' === $this->db->getAttribute(\PDO::ATTR_DRIVER_NAME))
? "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time) "
."ON DUPLICATE KEY UPDATE $dbDataCol = VALUES($dbDataCol), $dbTimeCol = CASE WHEN $dbTimeCol = :time THEN (VALUES($dbTimeCol) + 1) ELSE VALUES($dbTimeCol) END"
: "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id";
try {
//session data can contain non binary safe characters so we need to encode it
$encoded = base64_encode($data);
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute();
if (!$stmt->rowCount()) {
// No session exists in the database to update. This happens when we have called
// session_regenerate_id()
$this->createNewSession($id, $data);
}
} catch (\PDOException $e) {
throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
}
/**
* Creates a new session with the given $id and $data
*
* @param string $id
* @param string $data
*/
private function createNewSession($id, $data = '')
{
// get table/column
$dbTable = $this->dbOptions['db_table'];
$dbDataCol = $this->dbOptions['db_data_col'];
$dbIdCol = $this->dbOptions['db_id_col'];
$dbTimeCol = $this->dbOptions['db_time_col'];
$sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)";
//session data can contain non binary safe characters so we need to encode it
$encoded = base64_encode($data);
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute();
return true;
}
}
| {'content_hash': '3b6f5fb82ff8bb349f9f4232997d42d0', 'timestamp': '', 'source': 'github', 'line_count': 261, 'max_line_length': 173, 'avg_line_length': 32.95402298850575, 'alnum_prop': 0.5612138123474014, 'repo_name': 'christophedebatz/MakinMind', 'id': '0fcaa4c41c40d03b660712f97b1727afbed8bae5', 'size': '8830', 'binary': False, 'copies': '10', 'ref': 'refs/heads/master', 'path': 'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '733452'}, {'name': 'JavaScript', 'bytes': '309892'}, {'name': 'PHP', 'bytes': '186531'}]} |
package com.amazonaws.services.simplesystemsmanagement.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteOpsMetadata" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeleteOpsMetadataResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeleteOpsMetadataResult == false)
return false;
DeleteOpsMetadataResult other = (DeleteOpsMetadataResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public DeleteOpsMetadataResult clone() {
try {
return (DeleteOpsMetadataResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| {'content_hash': 'e22cbb87e4bdba56404ac4611797557e', 'timestamp': '', 'source': 'github', 'line_count': 61, 'max_line_length': 150, 'avg_line_length': 29.21311475409836, 'alnum_prop': 0.643658810325477, 'repo_name': 'aws/aws-sdk-java', 'id': 'd135bbd81e12ec31cccc5fbe53af45217140c165', 'size': '2362', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/DeleteOpsMetadataResult.java', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
import Node from '../Node';
export default class VariableDeclarator extends Node {
// TODO: Initial value is required for const.
constructor(childNodes) {
super('VariableDeclarator', childNodes);
}
_acceptChildren(children) {
let id = children.passPattern();
let init = null;
if (!children.isEnd) {
children.skipNonCode();
children.passToken('Punctuator', '=');
children.skipNonCode();
init = children.passExpression();
}
children.assertEnd();
this.id = id;
this.init = init;
}
}
| {'content_hash': '7bcf26c5d02fa3f6c54c7ebf33dbfcee', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 54, 'avg_line_length': 22.142857142857142, 'alnum_prop': 0.5693548387096774, 'repo_name': 'markelog/cst', 'id': '7226c2ac09b580294e84162a8d3d2f1096a284e2', 'size': '620', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'src/elements/types/VariableDeclarator.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '562330'}]} |
class ConferencesArraySerializer < ActiveModel::ArraySerializer
def as_json(*args)
json = super
json.merge!(version: 1)
end
end
| {'content_hash': '06949dc850f59920d7f27fc0a0d604cf', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 63, 'avg_line_length': 23.333333333333332, 'alnum_prop': 0.7285714285714285, 'repo_name': 'bear454/osem', 'id': '8ca8df53e9c020ae4b798993ffc63fc9701dc32a', 'size': '248', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/serializers/conferences_array_serializer.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '18968'}, {'name': 'Dockerfile', 'bytes': '623'}, {'name': 'HTML', 'bytes': '361829'}, {'name': 'JavaScript', 'bytes': '28406'}, {'name': 'Ruby', 'bytes': '1210142'}, {'name': 'Shell', 'bytes': '1885'}]} |
package cpu
import (
"context"
"errors"
"fmt"
"os/exec"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
)
var ClocksPerSec = float64(128)
func init() {
getconf, err := exec.LookPath("getconf")
if err != nil {
return
}
out, err := invoke.Command(getconf, "CLK_TCK")
// ignore errors
if err == nil {
i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64)
if err == nil {
ClocksPerSec = float64(i)
}
}
}
//sum all values in a float64 map with float64 keys
func msum(x map[float64]float64) float64 {
total := 0.0
for _, y := range x {
total += y
}
return total
}
func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu)
}
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
kstatSys, err := exec.LookPath("kstat")
if err != nil {
return nil, fmt.Errorf("cannot find kstat: %s", err)
}
cpu := make(map[float64]float64)
idle := make(map[float64]float64)
user := make(map[float64]float64)
kern := make(map[float64]float64)
iowt := make(map[float64]float64)
//swap := make(map[float64]float64)
kstatSysOut, err := invoke.CommandWithContext(ctx, kstatSys, "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/")
if err != nil {
return nil, fmt.Errorf("cannot execute kstat: %s", err)
}
re := regexp.MustCompile(`[:\s]+`)
for _, line := range strings.Split(string(kstatSysOut), "\n") {
fields := re.Split(line, -1)
if fields[0] != "cpu_stat" {
continue
}
cpuNumber, err := strconv.ParseFloat(fields[1], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse cpu number: %s", err)
}
cpu[cpuNumber] = cpuNumber
switch fields[3] {
case "idle":
idle[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse idle: %s", err)
}
case "user":
user[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse user: %s", err)
}
case "kernel":
kern[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse kernel: %s", err)
}
case "iowait":
iowt[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse iowait: %s", err)
}
//not sure how this translates, don't report, add to kernel, something else?
/*case "swap":
swap[cpuNumber], err = strconv.ParseFloat(fields[4], 64)
if err != nil {
return nil, fmt.Errorf("cannot parse swap: %s", err)
} */
}
}
ret := make([]TimesStat, 0, len(cpu))
if percpu {
for _, c := range cpu {
ct := &TimesStat{
CPU: fmt.Sprintf("cpu%d", int(cpu[c])),
Idle: idle[c] / ClocksPerSec,
User: user[c] / ClocksPerSec,
System: kern[c] / ClocksPerSec,
Iowait: iowt[c] / ClocksPerSec,
}
ret = append(ret, *ct)
}
} else {
ct := &TimesStat{
CPU: "cpu-total",
Idle: msum(idle) / ClocksPerSec,
User: msum(user) / ClocksPerSec,
System: msum(kern) / ClocksPerSec,
Iowait: msum(iowt) / ClocksPerSec,
}
ret = append(ret, *ct)
}
return ret, nil
}
func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background())
}
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
psrInfo, err := exec.LookPath("psrinfo")
if err != nil {
return nil, fmt.Errorf("cannot find psrinfo: %s", err)
}
psrInfoOut, err := invoke.CommandWithContext(ctx, psrInfo, "-p", "-v")
if err != nil {
return nil, fmt.Errorf("cannot execute psrinfo: %s", err)
}
isaInfo, err := exec.LookPath("isainfo")
if err != nil {
return nil, fmt.Errorf("cannot find isainfo: %s", err)
}
isaInfoOut, err := invoke.CommandWithContext(ctx, isaInfo, "-b", "-v")
if err != nil {
return nil, fmt.Errorf("cannot execute isainfo: %s", err)
}
procs, err := parseProcessorInfo(string(psrInfoOut))
if err != nil {
return nil, fmt.Errorf("error parsing psrinfo output: %s", err)
}
flags, err := parseISAInfo(string(isaInfoOut))
if err != nil {
return nil, fmt.Errorf("error parsing isainfo output: %s", err)
}
result := make([]InfoStat, 0, len(flags))
for _, proc := range procs {
procWithFlags := proc
procWithFlags.Flags = flags
result = append(result, procWithFlags)
}
return result, nil
}
var flagsMatch = regexp.MustCompile(`[\w\.]+`)
func parseISAInfo(cmdOutput string) ([]string, error) {
words := flagsMatch.FindAllString(cmdOutput, -1)
// Sanity check the output
if len(words) < 4 || words[1] != "bit" || words[3] != "applications" {
return nil, errors.New("attempted to parse invalid isainfo output")
}
flags := make([]string, len(words)-4)
for i, val := range words[4:] {
flags[i] = val
}
sort.Strings(flags)
return flags, nil
}
var psrInfoMatch = regexp.MustCompile(`The physical processor has (?:([\d]+) virtual processor \(([\d]+)\)|([\d]+) cores and ([\d]+) virtual processors[^\n]+)\n(?:\s+ The core has.+\n)*\s+.+ \((\w+) ([\S]+) family (.+) model (.+) step (.+) clock (.+) MHz\)\n[\s]*(.*)`)
const (
psrNumCoresOffset = 1
psrNumCoresHTOffset = 3
psrNumHTOffset = 4
psrVendorIDOffset = 5
psrFamilyOffset = 7
psrModelOffset = 8
psrStepOffset = 9
psrClockOffset = 10
psrModelNameOffset = 11
)
func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
matches := psrInfoMatch.FindAllStringSubmatch(cmdOutput, -1)
var infoStatCount int32
result := make([]InfoStat, 0, len(matches))
for physicalIndex, physicalCPU := range matches {
var step int32
var clock float64
if physicalCPU[psrStepOffset] != "" {
stepParsed, err := strconv.ParseInt(physicalCPU[psrStepOffset], 10, 32)
if err != nil {
return nil, fmt.Errorf("cannot parse value %q for step as 32-bit integer: %s", physicalCPU[9], err)
}
step = int32(stepParsed)
}
if physicalCPU[psrClockOffset] != "" {
clockParsed, err := strconv.ParseInt(physicalCPU[psrClockOffset], 10, 64)
if err != nil {
return nil, fmt.Errorf("cannot parse value %q for clock as 32-bit integer: %s", physicalCPU[10], err)
}
clock = float64(clockParsed)
}
var err error
var numCores int64
var numHT int64
switch {
case physicalCPU[psrNumCoresOffset] != "":
numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresOffset], 10, 32)
if err != nil {
return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %s", physicalCPU[1], err)
}
for i := 0; i < int(numCores); i++ {
result = append(result, InfoStat{
CPU: infoStatCount,
PhysicalID: strconv.Itoa(physicalIndex),
CoreID: strconv.Itoa(i),
Cores: 1,
VendorID: physicalCPU[psrVendorIDOffset],
ModelName: physicalCPU[psrModelNameOffset],
Family: physicalCPU[psrFamilyOffset],
Model: physicalCPU[psrModelOffset],
Stepping: step,
Mhz: clock,
})
infoStatCount++
}
case physicalCPU[psrNumCoresHTOffset] != "":
numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresHTOffset], 10, 32)
if err != nil {
return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %s", physicalCPU[3], err)
}
numHT, err = strconv.ParseInt(physicalCPU[psrNumHTOffset], 10, 32)
if err != nil {
return nil, fmt.Errorf("cannot parse value %q for hyperthread count as 32-bit integer: %s", physicalCPU[4], err)
}
for i := 0; i < int(numCores); i++ {
result = append(result, InfoStat{
CPU: infoStatCount,
PhysicalID: strconv.Itoa(physicalIndex),
CoreID: strconv.Itoa(i),
Cores: int32(numHT) / int32(numCores),
VendorID: physicalCPU[psrVendorIDOffset],
ModelName: physicalCPU[psrModelNameOffset],
Family: physicalCPU[psrFamilyOffset],
Model: physicalCPU[psrModelOffset],
Stepping: step,
Mhz: clock,
})
infoStatCount++
}
default:
return nil, errors.New("values for cores with and without hyperthreading are both set")
}
}
return result, nil
}
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
return runtime.NumCPU(), nil
}
| {'content_hash': '8d4fcf300600b2454885821dbfe9fb20', 'timestamp': '', 'source': 'github', 'line_count': 286, 'max_line_length': 269, 'avg_line_length': 28.513986013986013, 'alnum_prop': 0.643286327406499, 'repo_name': 'qiniu/logkit', 'id': '3de0984240249a54fb76d63c5aacf6ccf971d46e', 'size': '8155', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'vendor/github.com/shirou/gopsutil/cpu/cpu_solaris.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1875'}, {'name': 'CSS', 'bytes': '4581'}, {'name': 'Dockerfile', 'bytes': '683'}, {'name': 'Go', 'bytes': '2606689'}, {'name': 'HTML', 'bytes': '4256'}, {'name': 'JavaScript', 'bytes': '157768'}, {'name': 'Makefile', 'bytes': '264'}, {'name': 'Python', 'bytes': '10544'}, {'name': 'Shell', 'bytes': '1418'}]} |
package abi42_0_0.host.exp.exponent.modules.api.components.maps;
import android.view.View;
import abi42_0_0.com.facebook.react.bridge.Arguments;
import abi42_0_0.com.facebook.react.bridge.ReactApplicationContext;
import abi42_0_0.com.facebook.react.bridge.ReadableArray;
import abi42_0_0.com.facebook.react.bridge.ReadableMap;
import abi42_0_0.com.facebook.react.bridge.WritableMap;
import abi42_0_0.com.facebook.react.common.MapBuilder;
import abi42_0_0.com.facebook.react.modules.core.DeviceEventManagerModule;
import abi42_0_0.com.facebook.react.uimanager.LayoutShadowNode;
import abi42_0_0.com.facebook.react.uimanager.ThemedReactContext;
import abi42_0_0.com.facebook.react.uimanager.ViewGroupManager;
import abi42_0_0.com.facebook.react.uimanager.annotations.ReactProp;
import abi42_0_0.com.facebook.react.uimanager.events.RCTEventEmitter;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.MapStyleOptions;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
public class AirMapManager extends ViewGroupManager<AirMapView> {
private static final String REACT_CLASS = "AIRMap";
private static final int ANIMATE_TO_REGION = 1;
private static final int ANIMATE_TO_COORDINATE = 2;
private static final int ANIMATE_TO_VIEWING_ANGLE = 3;
private static final int ANIMATE_TO_BEARING = 4;
private static final int FIT_TO_ELEMENTS = 5;
private static final int FIT_TO_SUPPLIED_MARKERS = 6;
private static final int FIT_TO_COORDINATES = 7;
private static final int SET_MAP_BOUNDARIES = 8;
private static final int ANIMATE_TO_NAVIGATION = 9;
private static final int SET_INDOOR_ACTIVE_LEVEL_INDEX = 10;
private static final int SET_CAMERA = 11;
private static final int ANIMATE_CAMERA = 12;
private final Map<String, Integer> MAP_TYPES = MapBuilder.of(
"standard", GoogleMap.MAP_TYPE_NORMAL,
"satellite", GoogleMap.MAP_TYPE_SATELLITE,
"hybrid", GoogleMap.MAP_TYPE_HYBRID,
"terrain", GoogleMap.MAP_TYPE_TERRAIN,
"none", GoogleMap.MAP_TYPE_NONE
);
private final Map<String, Integer> MY_LOCATION_PRIORITY = MapBuilder.of(
"balanced", LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY,
"high", LocationRequest.PRIORITY_HIGH_ACCURACY,
"low", LocationRequest.PRIORITY_LOW_POWER,
"passive", LocationRequest.PRIORITY_NO_POWER
);
private final ReactApplicationContext appContext;
private AirMapMarkerManager markerManager;
protected GoogleMapOptions googleMapOptions;
public AirMapManager(ReactApplicationContext context) {
this.appContext = context;
this.googleMapOptions = new GoogleMapOptions();
}
public AirMapMarkerManager getMarkerManager() {
return this.markerManager;
}
public void setMarkerManager(AirMapMarkerManager markerManager) {
this.markerManager = markerManager;
}
@Override
public String getName() {
return REACT_CLASS;
}
@Override
protected AirMapView createViewInstance(ThemedReactContext context) {
return new AirMapView(context, this.appContext, this, googleMapOptions);
}
private void emitMapError(ThemedReactContext context, String message, String type) {
WritableMap error = Arguments.createMap();
error.putString("message", message);
error.putString("type", type);
context
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("onError", error);
}
@ReactProp(name = "region")
public void setRegion(AirMapView view, ReadableMap region) {
view.setRegion(region);
}
@ReactProp(name = "initialRegion")
public void setInitialRegion(AirMapView view, ReadableMap initialRegion) {
view.setInitialRegion(initialRegion);
}
@ReactProp(name = "camera")
public void setCamera(AirMapView view, ReadableMap camera) {
view.setCamera(camera);
}
@ReactProp(name = "initialCamera")
public void setInitialCamera(AirMapView view, ReadableMap initialCamera) {
view.setInitialCamera(initialCamera);
}
@ReactProp(name = "mapType")
public void setMapType(AirMapView view, @Nullable String mapType) {
int typeId = MAP_TYPES.get(mapType);
view.map.setMapType(typeId);
}
@ReactProp(name = "customMapStyleString")
public void setMapStyle(AirMapView view, @Nullable String customMapStyleString) {
view.map.setMapStyle(new MapStyleOptions(customMapStyleString));
}
@ReactProp(name = "mapPadding")
public void setMapPadding(AirMapView view, @Nullable ReadableMap padding) {
int left = 0;
int top = 0;
int right = 0;
int bottom = 0;
double density = (double) view.getResources().getDisplayMetrics().density;
if (padding != null) {
if (padding.hasKey("left")) {
left = (int) (padding.getDouble("left") * density);
}
if (padding.hasKey("top")) {
top = (int) (padding.getDouble("top") * density);
}
if (padding.hasKey("right")) {
right = (int) (padding.getDouble("right") * density);
}
if (padding.hasKey("bottom")) {
bottom = (int) (padding.getDouble("bottom") * density);
}
}
view.applyBaseMapPadding(left, top, right, bottom);
view.map.setPadding(left, top, right, bottom);
}
@ReactProp(name = "showsUserLocation", defaultBoolean = false)
public void setShowsUserLocation(AirMapView view, boolean showUserLocation) {
view.setShowsUserLocation(showUserLocation);
}
@ReactProp(name = "userLocationPriority")
public void setUserLocationPriority(AirMapView view, @Nullable String accuracy) {
view.setUserLocationPriority(MY_LOCATION_PRIORITY.get(accuracy));
}
@ReactProp(name = "userLocationUpdateInterval", defaultInt = 5000)
public void setUserLocationUpdateInterval(AirMapView view, int updateInterval) {
view.setUserLocationUpdateInterval(updateInterval);
}
@ReactProp(name = "userLocationFastestInterval", defaultInt = 5000)
public void setUserLocationFastestInterval(AirMapView view, int fastestInterval) {
view.setUserLocationFastestInterval(fastestInterval);
}
@ReactProp(name = "showsMyLocationButton", defaultBoolean = true)
public void setShowsMyLocationButton(AirMapView view, boolean showMyLocationButton) {
view.setShowsMyLocationButton(showMyLocationButton);
}
@ReactProp(name = "toolbarEnabled", defaultBoolean = true)
public void setToolbarEnabled(AirMapView view, boolean toolbarEnabled) {
view.setToolbarEnabled(toolbarEnabled);
}
// This is a private prop to improve performance of panDrag by disabling it when the callback
// is not set
@ReactProp(name = "handlePanDrag", defaultBoolean = false)
public void setHandlePanDrag(AirMapView view, boolean handlePanDrag) {
view.setHandlePanDrag(handlePanDrag);
}
@ReactProp(name = "showsTraffic", defaultBoolean = false)
public void setShowTraffic(AirMapView view, boolean showTraffic) {
view.map.setTrafficEnabled(showTraffic);
}
@ReactProp(name = "showsBuildings", defaultBoolean = false)
public void setShowBuildings(AirMapView view, boolean showBuildings) {
view.map.setBuildingsEnabled(showBuildings);
}
@ReactProp(name = "showsIndoors", defaultBoolean = false)
public void setShowIndoors(AirMapView view, boolean showIndoors) {
view.map.setIndoorEnabled(showIndoors);
}
@ReactProp(name = "showsIndoorLevelPicker", defaultBoolean = false)
public void setShowsIndoorLevelPicker(AirMapView view, boolean showsIndoorLevelPicker) {
view.map.getUiSettings().setIndoorLevelPickerEnabled(showsIndoorLevelPicker);
}
@ReactProp(name = "showsCompass", defaultBoolean = false)
public void setShowsCompass(AirMapView view, boolean showsCompass) {
view.map.getUiSettings().setCompassEnabled(showsCompass);
}
@ReactProp(name = "scrollEnabled", defaultBoolean = false)
public void setScrollEnabled(AirMapView view, boolean scrollEnabled) {
view.map.getUiSettings().setScrollGesturesEnabled(scrollEnabled);
}
@ReactProp(name = "zoomEnabled", defaultBoolean = false)
public void setZoomEnabled(AirMapView view, boolean zoomEnabled) {
view.map.getUiSettings().setZoomGesturesEnabled(zoomEnabled);
}
@ReactProp(name = "zoomControlEnabled", defaultBoolean = true)
public void setZoomControlEnabled(AirMapView view, boolean zoomControlEnabled) {
view.map.getUiSettings().setZoomControlsEnabled(zoomControlEnabled);
}
@ReactProp(name = "rotateEnabled", defaultBoolean = false)
public void setRotateEnabled(AirMapView view, boolean rotateEnabled) {
view.map.getUiSettings().setRotateGesturesEnabled(rotateEnabled);
}
@ReactProp(name = "scrollDuringRotateOrZoomEnabled", defaultBoolean = true)
public void setScrollDuringRotateOrZoomEnabled(AirMapView view, boolean scrollDuringRotateOrZoomEnabled) {
view.map.getUiSettings().setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringRotateOrZoomEnabled);
}
@ReactProp(name = "cacheEnabled", defaultBoolean = false)
public void setCacheEnabled(AirMapView view, boolean cacheEnabled) {
view.setCacheEnabled(cacheEnabled);
}
@ReactProp(name = "loadingEnabled", defaultBoolean = false)
public void setLoadingEnabled(AirMapView view, boolean loadingEnabled) {
view.enableMapLoading(loadingEnabled);
}
@ReactProp(name = "moveOnMarkerPress", defaultBoolean = true)
public void setMoveOnMarkerPress(AirMapView view, boolean moveOnPress) {
view.setMoveOnMarkerPress(moveOnPress);
}
@ReactProp(name = "loadingBackgroundColor", customType = "Color")
public void setLoadingBackgroundColor(AirMapView view, @Nullable Integer loadingBackgroundColor) {
view.setLoadingBackgroundColor(loadingBackgroundColor);
}
@ReactProp(name = "loadingIndicatorColor", customType = "Color")
public void setLoadingIndicatorColor(AirMapView view, @Nullable Integer loadingIndicatorColor) {
view.setLoadingIndicatorColor(loadingIndicatorColor);
}
@ReactProp(name = "pitchEnabled", defaultBoolean = false)
public void setPitchEnabled(AirMapView view, boolean pitchEnabled) {
view.map.getUiSettings().setTiltGesturesEnabled(pitchEnabled);
}
@ReactProp(name = "minZoomLevel")
public void setMinZoomLevel(AirMapView view, float minZoomLevel) {
view.map.setMinZoomPreference(minZoomLevel);
}
@ReactProp(name = "maxZoomLevel")
public void setMaxZoomLevel(AirMapView view, float maxZoomLevel) {
view.map.setMaxZoomPreference(maxZoomLevel);
}
@ReactProp(name = "kmlSrc")
public void setKmlSrc(AirMapView view, String kmlUrl) {
if (kmlUrl != null) {
view.setKmlSrc(kmlUrl);
}
}
@Override
public void receiveCommand(AirMapView view, int commandId, @Nullable ReadableArray args) {
Integer duration;
Double lat;
Double lng;
Double lngDelta;
Double latDelta;
float bearing;
float angle;
ReadableMap region;
ReadableMap camera;
switch (commandId) {
case SET_CAMERA:
camera = args.getMap(0);
view.animateToCamera(camera, 0);
break;
case ANIMATE_CAMERA:
camera = args.getMap(0);
duration = args.getInt(1);
view.animateToCamera(camera, duration);
break;
case ANIMATE_TO_NAVIGATION:
region = args.getMap(0);
lng = region.getDouble("longitude");
lat = region.getDouble("latitude");
LatLng location = new LatLng(lat, lng);
bearing = (float)args.getDouble(1);
angle = (float)args.getDouble(2);
duration = args.getInt(3);
view.animateToNavigation(location, bearing, angle, duration);
break;
case ANIMATE_TO_REGION:
region = args.getMap(0);
duration = args.getInt(1);
lng = region.getDouble("longitude");
lat = region.getDouble("latitude");
lngDelta = region.getDouble("longitudeDelta");
latDelta = region.getDouble("latitudeDelta");
LatLngBounds bounds = new LatLngBounds(
new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
new LatLng(lat + latDelta / 2, lng + lngDelta / 2) // northeast
);
view.animateToRegion(bounds, duration);
break;
case ANIMATE_TO_COORDINATE:
region = args.getMap(0);
duration = args.getInt(1);
lng = region.getDouble("longitude");
lat = region.getDouble("latitude");
view.animateToCoordinate(new LatLng(lat, lng), duration);
break;
case ANIMATE_TO_VIEWING_ANGLE:
angle = (float)args.getDouble(0);
duration = args.getInt(1);
view.animateToViewingAngle(angle, duration);
break;
case ANIMATE_TO_BEARING:
bearing = (float)args.getDouble(0);
duration = args.getInt(1);
view.animateToBearing(bearing, duration);
break;
case FIT_TO_ELEMENTS:
view.fitToElements(args.getMap(0), args.getBoolean(1));
break;
case FIT_TO_SUPPLIED_MARKERS:
view.fitToSuppliedMarkers(args.getArray(0), args.getMap(1), args.getBoolean(2));
break;
case FIT_TO_COORDINATES:
view.fitToCoordinates(args.getArray(0), args.getMap(1), args.getBoolean(2));
break;
case SET_MAP_BOUNDARIES:
view.setMapBoundaries(args.getMap(0), args.getMap(1));
break;
case SET_INDOOR_ACTIVE_LEVEL_INDEX:
view.setIndoorActiveLevelIndex(args.getInt(0));
break;
}
}
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
Map<String, Map<String, String>> map = MapBuilder.of(
"onMapReady", MapBuilder.of("registrationName", "onMapReady"),
"onPress", MapBuilder.of("registrationName", "onPress"),
"onLongPress", MapBuilder.of("registrationName", "onLongPress"),
"onMarkerPress", MapBuilder.of("registrationName", "onMarkerPress"),
"onMarkerSelect", MapBuilder.of("registrationName", "onMarkerSelect"),
"onMarkerDeselect", MapBuilder.of("registrationName", "onMarkerDeselect"),
"onCalloutPress", MapBuilder.of("registrationName", "onCalloutPress")
);
map.putAll(MapBuilder.of(
"onUserLocationChange", MapBuilder.of("registrationName", "onUserLocationChange"),
"onMarkerDragStart", MapBuilder.of("registrationName", "onMarkerDragStart"),
"onMarkerDrag", MapBuilder.of("registrationName", "onMarkerDrag"),
"onMarkerDragEnd", MapBuilder.of("registrationName", "onMarkerDragEnd"),
"onPanDrag", MapBuilder.of("registrationName", "onPanDrag"),
"onKmlReady", MapBuilder.of("registrationName", "onKmlReady"),
"onPoiClick", MapBuilder.of("registrationName", "onPoiClick")
));
map.putAll(MapBuilder.of(
"onIndoorLevelActivated", MapBuilder.of("registrationName", "onIndoorLevelActivated"),
"onIndoorBuildingFocused", MapBuilder.of("registrationName", "onIndoorBuildingFocused"),
"onDoublePress", MapBuilder.of("registrationName", "onDoublePress"),
"onMapLoaded", MapBuilder.of("registrationName", "onMapLoaded")
));
return map;
}
@Nullable
@Override
public Map<String, Integer> getCommandsMap() {
Map<String, Integer> map = this.CreateMap(
"setCamera", SET_CAMERA,
"animateCamera", ANIMATE_CAMERA,
"animateToRegion", ANIMATE_TO_REGION,
"animateToCoordinate", ANIMATE_TO_COORDINATE,
"animateToViewingAngle", ANIMATE_TO_VIEWING_ANGLE,
"animateToBearing", ANIMATE_TO_BEARING,
"fitToElements", FIT_TO_ELEMENTS,
"fitToSuppliedMarkers", FIT_TO_SUPPLIED_MARKERS,
"fitToCoordinates", FIT_TO_COORDINATES,
"animateToNavigation", ANIMATE_TO_NAVIGATION
);
map.putAll(MapBuilder.of(
"setMapBoundaries", SET_MAP_BOUNDARIES,
"setIndoorActiveLevelIndex", SET_INDOOR_ACTIVE_LEVEL_INDEX
));
return map;
}
public static <K, V> Map<K, V> CreateMap(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) {
Map map = new HashMap<K, V>();
map.put(k1, v1);
map.put(k2, v2);
map.put(k3, v3);
map.put(k4, v4);
map.put(k5, v5);
map.put(k6, v6);
map.put(k7, v7);
map.put(k8, v8);
map.put(k9, v9);
map.put(k10, v10);
return map;
}
@Override
public LayoutShadowNode createShadowNodeInstance() {
// A custom shadow node is needed in order to pass back the width/height of the map to the
// view manager so that it can start applying camera moves with bounds.
return new SizeReportingShadowNode();
}
@Override
public void addView(AirMapView parent, View child, int index) {
parent.addFeature(child, index);
}
@Override
public int getChildCount(AirMapView view) {
return view.getFeatureCount();
}
@Override
public View getChildAt(AirMapView view, int index) {
return view.getFeatureAt(index);
}
@Override
public void removeViewAt(AirMapView parent, int index) {
parent.removeFeatureAt(index);
}
@Override
public void updateExtraData(AirMapView view, Object extraData) {
view.updateExtraData(extraData);
}
void pushEvent(ThemedReactContext context, View view, String name, WritableMap data) {
context.getJSModule(RCTEventEmitter.class)
.receiveEvent(view.getId(), name, data);
}
@Override
public void onDropViewInstance(AirMapView view) {
view.doDestroy();
super.onDropViewInstance(view);
}
}
| {'content_hash': '8e64353439789446f3aaf65d948dd1b2', 'timestamp': '', 'source': 'github', 'line_count': 499, 'max_line_length': 125, 'avg_line_length': 35.408817635270545, 'alnum_prop': 0.7130001697888958, 'repo_name': 'exponent/exponent', 'id': '063db2f62fe5c85fb9d9e59e9b8623d7d17c86da', 'size': '17669', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'android/versioned-abis/expoview-abi42_0_0/src/main/java/abi42_0_0/host/exp/exponent/modules/api/components/maps/AirMapManager.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '113276'}, {'name': 'Batchfile', 'bytes': '127'}, {'name': 'C', 'bytes': '1744836'}, {'name': 'C++', 'bytes': '1801159'}, {'name': 'CSS', 'bytes': '7854'}, {'name': 'HTML', 'bytes': '176329'}, {'name': 'IDL', 'bytes': '897'}, {'name': 'Java', 'bytes': '6251130'}, {'name': 'JavaScript', 'bytes': '4416558'}, {'name': 'Makefile', 'bytes': '18061'}, {'name': 'Objective-C', 'bytes': '13971362'}, {'name': 'Objective-C++', 'bytes': '725480'}, {'name': 'Perl', 'bytes': '5860'}, {'name': 'Prolog', 'bytes': '287'}, {'name': 'Python', 'bytes': '125673'}, {'name': 'Ruby', 'bytes': '61190'}, {'name': 'Shell', 'bytes': '4441'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': 'a6ef089019cbcbe378202216255cc107', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': '9a27a2b9d213c4ff01de224074de9bca3c2e49e7', 'size': '176', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Malpighiaceae/Bunchosia/Bunchosia martiana/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
static VP8StatusCode ParseRIFF(const uint8_t** const data,
size_t* const data_size, int have_all_data,
size_t* const riff_size) {
assert(data != NULL);
assert(data_size != NULL);
assert(riff_size != NULL);
*riff_size = 0; // Default: no RIFF present.
if (*data_size >= RIFF_HEADER_SIZE && !memcmp(*data, "RIFF", TAG_SIZE)) {
if (memcmp(*data + 8, "WEBP", TAG_SIZE)) {
return VP8_STATUS_BITSTREAM_ERROR; // Wrong image file signature.
} else {
const uint32_t size = GetLE32(*data + TAG_SIZE);
// Check that we have at least one chunk (i.e "WEBP" + "VP8?nnnn").
if (size < TAG_SIZE + CHUNK_HEADER_SIZE) {
return VP8_STATUS_BITSTREAM_ERROR;
}
if (size > MAX_CHUNK_PAYLOAD) {
return VP8_STATUS_BITSTREAM_ERROR;
}
if (have_all_data && (size > *data_size - CHUNK_HEADER_SIZE)) {
return VP8_STATUS_NOT_ENOUGH_DATA; // Truncated bitstream.
}
// We have a RIFF container. Skip it.
*riff_size = size;
*data += RIFF_HEADER_SIZE;
*data_size -= RIFF_HEADER_SIZE;
}
}
return VP8_STATUS_OK;
}
// Validates the VP8X header and skips over it.
// Returns VP8_STATUS_BITSTREAM_ERROR for invalid VP8X header,
// VP8_STATUS_NOT_ENOUGH_DATA in case of insufficient data, and
// VP8_STATUS_OK otherwise.
// If a VP8X chunk is found, found_vp8x is set to true and *width_ptr,
// *height_ptr and *flags_ptr are set to the corresponding values extracted
// from the VP8X chunk.
static VP8StatusCode ParseVP8X(const uint8_t** const data,
size_t* const data_size,
int* const found_vp8x,
int* const width_ptr, int* const height_ptr,
uint32_t* const flags_ptr) {
const uint32_t vp8x_size = CHUNK_HEADER_SIZE + VP8X_CHUNK_SIZE;
assert(data != NULL);
assert(data_size != NULL);
assert(found_vp8x != NULL);
*found_vp8x = 0;
if (*data_size < CHUNK_HEADER_SIZE) {
return VP8_STATUS_NOT_ENOUGH_DATA; // Insufficient data.
}
if (!memcmp(*data, "VP8X", TAG_SIZE)) {
int width, height;
uint32_t flags;
const uint32_t chunk_size = GetLE32(*data + TAG_SIZE);
if (chunk_size != VP8X_CHUNK_SIZE) {
return VP8_STATUS_BITSTREAM_ERROR; // Wrong chunk size.
}
// Verify if enough data is available to validate the VP8X chunk.
if (*data_size < vp8x_size) {
return VP8_STATUS_NOT_ENOUGH_DATA; // Insufficient data.
}
flags = GetLE32(*data + 8);
width = 1 + GetLE24(*data + 12);
height = 1 + GetLE24(*data + 15);
if (width * (uint64_t)height >= MAX_IMAGE_AREA) {
return VP8_STATUS_BITSTREAM_ERROR; // image is too large
}
if (flags_ptr != NULL) *flags_ptr = flags;
if (width_ptr != NULL) *width_ptr = width;
if (height_ptr != NULL) *height_ptr = height;
// Skip over VP8X header bytes.
*data += vp8x_size;
*data_size -= vp8x_size;
*found_vp8x = 1;
}
return VP8_STATUS_OK;
}
// Skips to the next VP8/VP8L chunk header in the data given the size of the
// RIFF chunk 'riff_size'.
// Returns VP8_STATUS_BITSTREAM_ERROR if any invalid chunk size is encountered,
// VP8_STATUS_NOT_ENOUGH_DATA in case of insufficient data, and
// VP8_STATUS_OK otherwise.
// If an alpha chunk is found, *alpha_data and *alpha_size are set
// appropriately.
static VP8StatusCode ParseOptionalChunks(const uint8_t** const data,
size_t* const data_size,
size_t const riff_size,
const uint8_t** const alpha_data,
size_t* const alpha_size) {
const uint8_t* buf;
size_t buf_size;
uint32_t total_size = TAG_SIZE + // "WEBP".
CHUNK_HEADER_SIZE + // "VP8Xnnnn".
VP8X_CHUNK_SIZE; // data.
assert(data != NULL);
assert(data_size != NULL);
buf = *data;
buf_size = *data_size;
assert(alpha_data != NULL);
assert(alpha_size != NULL);
*alpha_data = NULL;
*alpha_size = 0;
while (1) {
uint32_t chunk_size;
uint32_t disk_chunk_size; // chunk_size with padding
*data = buf;
*data_size = buf_size;
if (buf_size < CHUNK_HEADER_SIZE) { // Insufficient data.
return VP8_STATUS_NOT_ENOUGH_DATA;
}
chunk_size = GetLE32(buf + TAG_SIZE);
if (chunk_size > MAX_CHUNK_PAYLOAD) {
return VP8_STATUS_BITSTREAM_ERROR; // Not a valid chunk size.
}
// For odd-sized chunk-payload, there's one byte padding at the end.
disk_chunk_size = (CHUNK_HEADER_SIZE + chunk_size + 1) & ~1;
total_size += disk_chunk_size;
// Check that total bytes skipped so far does not exceed riff_size.
if (riff_size > 0 && (total_size > riff_size)) {
return VP8_STATUS_BITSTREAM_ERROR; // Not a valid chunk size.
}
// Start of a (possibly incomplete) VP8/VP8L chunk implies that we have
// parsed all the optional chunks.
// Note: This check must occur before the check 'buf_size < disk_chunk_size'
// below to allow incomplete VP8/VP8L chunks.
if (!memcmp(buf, "VP8 ", TAG_SIZE) ||
!memcmp(buf, "VP8L", TAG_SIZE)) {
return VP8_STATUS_OK;
}
if (buf_size < disk_chunk_size) { // Insufficient data.
return VP8_STATUS_NOT_ENOUGH_DATA;
}
if (!memcmp(buf, "ALPH", TAG_SIZE)) { // A valid ALPH header.
*alpha_data = buf + CHUNK_HEADER_SIZE;
*alpha_size = chunk_size;
}
// We have a full and valid chunk; skip it.
buf += disk_chunk_size;
buf_size -= disk_chunk_size;
}
}
// Validates the VP8/VP8L Header ("VP8 nnnn" or "VP8L nnnn") and skips over it.
// Returns VP8_STATUS_BITSTREAM_ERROR for invalid (chunk larger than
// riff_size) VP8/VP8L header,
// VP8_STATUS_NOT_ENOUGH_DATA in case of insufficient data, and
// VP8_STATUS_OK otherwise.
// If a VP8/VP8L chunk is found, *chunk_size is set to the total number of bytes
// extracted from the VP8/VP8L chunk header.
// The flag '*is_lossless' is set to 1 in case of VP8L chunk / raw VP8L data.
static VP8StatusCode ParseVP8Header(const uint8_t** const data_ptr,
size_t* const data_size, int have_all_data,
size_t riff_size, size_t* const chunk_size,
int* const is_lossless) {
const uint8_t* const data = *data_ptr;
const int is_vp8 = !memcmp(data, "VP8 ", TAG_SIZE);
const int is_vp8l = !memcmp(data, "VP8L", TAG_SIZE);
const uint32_t minimal_size =
TAG_SIZE + CHUNK_HEADER_SIZE; // "WEBP" + "VP8 nnnn" OR
// "WEBP" + "VP8Lnnnn"
assert(data != NULL);
assert(data_size != NULL);
assert(chunk_size != NULL);
assert(is_lossless != NULL);
if (*data_size < CHUNK_HEADER_SIZE) {
return VP8_STATUS_NOT_ENOUGH_DATA; // Insufficient data.
}
if (is_vp8 || is_vp8l) {
// Bitstream contains VP8/VP8L header.
const uint32_t size = GetLE32(data + TAG_SIZE);
if ((riff_size >= minimal_size) && (size > riff_size - minimal_size)) {
return VP8_STATUS_BITSTREAM_ERROR; // Inconsistent size information.
}
if (have_all_data && (size > *data_size - CHUNK_HEADER_SIZE)) {
return VP8_STATUS_NOT_ENOUGH_DATA; // Truncated bitstream.
}
// Skip over CHUNK_HEADER_SIZE bytes from VP8/VP8L Header.
*chunk_size = size;
*data_ptr += CHUNK_HEADER_SIZE;
*data_size -= CHUNK_HEADER_SIZE;
*is_lossless = is_vp8l;
} else {
// Raw VP8/VP8L bitstream (no header).
*is_lossless = VP8LCheckSignature(data, *data_size);
*chunk_size = *data_size;
}
return VP8_STATUS_OK;
}
//------------------------------------------------------------------------------
// Fetch '*width', '*height', '*has_alpha' and fill out 'headers' based on
// 'data'. All the output parameters may be NULL. If 'headers' is NULL only the
// minimal amount will be read to fetch the remaining parameters.
// If 'headers' is non-NULL this function will attempt to locate both alpha
// data (with or without a VP8X chunk) and the bitstream chunk (VP8/VP8L).
// Note: The following chunk sequences (before the raw VP8/VP8L data) are
// considered valid by this function:
// RIFF + VP8(L)
// RIFF + VP8X + (optional chunks) + VP8(L)
// ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose.
// VP8(L) <-- Not a valid WebP format: only allowed for internal purpose.
static VP8StatusCode ParseHeadersInternal(const uint8_t* data,
size_t data_size,
int* const width,
int* const height,
int* const has_alpha,
int* const has_animation,
int* const format,
WebPHeaderStructure* const headers) {
int canvas_width = 0;
int canvas_height = 0;
int image_width = 0;
int image_height = 0;
int found_riff = 0;
int found_vp8x = 0;
int animation_present = 0;
const int have_all_data = (headers != NULL) ? headers->have_all_data : 0;
VP8StatusCode status;
WebPHeaderStructure hdrs;
if (data == NULL || data_size < RIFF_HEADER_SIZE) {
return VP8_STATUS_NOT_ENOUGH_DATA;
}
memset(&hdrs, 0, sizeof(hdrs));
hdrs.data = data;
hdrs.data_size = data_size;
// Skip over RIFF header.
status = ParseRIFF(&data, &data_size, have_all_data, &hdrs.riff_size);
if (status != VP8_STATUS_OK) {
return status; // Wrong RIFF header / insufficient data.
}
found_riff = (hdrs.riff_size > 0);
// Skip over VP8X.
{
uint32_t flags = 0;
status = ParseVP8X(&data, &data_size, &found_vp8x,
&canvas_width, &canvas_height, &flags);
if (status != VP8_STATUS_OK) {
return status; // Wrong VP8X / insufficient data.
}
animation_present = !!(flags & ANIMATION_FLAG);
if (!found_riff && found_vp8x) {
// Note: This restriction may be removed in the future, if it becomes
// necessary to send VP8X chunk to the decoder.
return VP8_STATUS_BITSTREAM_ERROR;
}
if (has_alpha != NULL) *has_alpha = !!(flags & ALPHA_FLAG);
if (has_animation != NULL) *has_animation = animation_present;
if (format != NULL) *format = 0; // default = undefined
image_width = canvas_width;
image_height = canvas_height;
if (found_vp8x && animation_present && headers == NULL) {
status = VP8_STATUS_OK;
goto ReturnWidthHeight; // Just return features from VP8X header.
}
}
if (data_size < TAG_SIZE) {
status = VP8_STATUS_NOT_ENOUGH_DATA;
goto ReturnWidthHeight;
}
// Skip over optional chunks if data started with "RIFF + VP8X" or "ALPH".
if ((found_riff && found_vp8x) ||
(!found_riff && !found_vp8x && !memcmp(data, "ALPH", TAG_SIZE))) {
status = ParseOptionalChunks(&data, &data_size, hdrs.riff_size,
&hdrs.alpha_data, &hdrs.alpha_data_size);
if (status != VP8_STATUS_OK) {
goto ReturnWidthHeight; // Invalid chunk size / insufficient data.
}
}
// Skip over VP8/VP8L header.
status = ParseVP8Header(&data, &data_size, have_all_data, hdrs.riff_size,
&hdrs.compressed_size, &hdrs.is_lossless);
if (status != VP8_STATUS_OK) {
goto ReturnWidthHeight; // Wrong VP8/VP8L chunk-header / insufficient data.
}
if (hdrs.compressed_size > MAX_CHUNK_PAYLOAD) {
return VP8_STATUS_BITSTREAM_ERROR;
}
if (format != NULL && !animation_present) {
*format = hdrs.is_lossless ? 2 : 1;
}
if (!hdrs.is_lossless) {
if (data_size < VP8_FRAME_HEADER_SIZE) {
status = VP8_STATUS_NOT_ENOUGH_DATA;
goto ReturnWidthHeight;
}
// Validates raw VP8 data.
if (!VP8GetInfo(data, data_size, (uint32_t)hdrs.compressed_size,
&image_width, &image_height)) {
return VP8_STATUS_BITSTREAM_ERROR;
}
} else {
if (data_size < VP8L_FRAME_HEADER_SIZE) {
status = VP8_STATUS_NOT_ENOUGH_DATA;
goto ReturnWidthHeight;
}
// Validates raw VP8L data.
if (!VP8LGetInfo(data, data_size, &image_width, &image_height, has_alpha)) {
return VP8_STATUS_BITSTREAM_ERROR;
}
}
// Validates image size coherency.
if (found_vp8x) {
if (canvas_width != image_width || canvas_height != image_height) {
return VP8_STATUS_BITSTREAM_ERROR;
}
}
if (headers != NULL) {
*headers = hdrs;
headers->offset = data - headers->data;
assert((uint64_t)(data - headers->data) < MAX_CHUNK_PAYLOAD);
assert(headers->offset == headers->data_size - data_size);
}
ReturnWidthHeight:
if (status == VP8_STATUS_OK ||
(status == VP8_STATUS_NOT_ENOUGH_DATA && found_vp8x && headers == NULL)) {
if (has_alpha != NULL) {
// If the data did not contain a VP8X/VP8L chunk the only definitive way
// to set this is by looking for alpha data (from an ALPH chunk).
*has_alpha |= (hdrs.alpha_data != NULL);
}
if (width != NULL) *width = image_width;
if (height != NULL) *height = image_height;
return VP8_STATUS_OK;
} else {
return status;
}
}
VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) {
// status is marked volatile as a workaround for a clang-3.8 (aarch64) bug
volatile VP8StatusCode status;
int has_animation = 0;
assert(headers != NULL);
// fill out headers, ignore width/height/has_alpha.
status = ParseHeadersInternal(headers->data, headers->data_size,
NULL, NULL, NULL, &has_animation,
NULL, headers);
if (status == VP8_STATUS_OK || status == VP8_STATUS_NOT_ENOUGH_DATA) {
// TODO(jzern): full support of animation frames will require API additions.
if (has_animation) {
status = VP8_STATUS_UNSUPPORTED_FEATURE;
}
}
return status;
}
//------------------------------------------------------------------------------
// WebPDecParams
void WebPResetDecParams(WebPDecParams* const params) {
if (params != NULL) {
memset(params, 0, sizeof(*params));
}
}
//------------------------------------------------------------------------------
// "Into" decoding variants
// Main flow
static VP8StatusCode DecodeInto(const uint8_t* const data, size_t data_size,
WebPDecParams* const params) {
VP8StatusCode status;
VP8Io io;
WebPHeaderStructure headers;
headers.data = data;
headers.data_size = data_size;
headers.have_all_data = 1;
status = WebPParseHeaders(&headers); // Process Pre-VP8 chunks.
if (status != VP8_STATUS_OK) {
return status;
}
assert(params != NULL);
VP8InitIo(&io);
io.data = headers.data + headers.offset;
io.data_size = headers.data_size - headers.offset;
WebPInitCustomIo(params, &io); // Plug the I/O functions.
if (!headers.is_lossless) {
VP8Decoder* const dec = VP8New();
if (dec == NULL) {
return VP8_STATUS_OUT_OF_MEMORY;
}
dec->alpha_data_ = headers.alpha_data;
dec->alpha_data_size_ = headers.alpha_data_size;
// Decode bitstream header, update io->width/io->height.
if (!VP8GetHeaders(dec, &io)) {
status = dec->status_; // An error occurred. Grab error status.
} else {
// Allocate/check output buffers.
status = WebPAllocateDecBuffer(io.width, io.height, params->options,
params->output);
if (status == VP8_STATUS_OK) { // Decode
// This change must be done before calling VP8Decode()
dec->mt_method_ = VP8GetThreadMethod(params->options, &headers,
io.width, io.height);
VP8InitDithering(params->options, dec);
if (!VP8Decode(dec, &io)) {
status = dec->status_;
}
}
}
VP8Delete(dec);
} else {
VP8LDecoder* const dec = VP8LNew();
if (dec == NULL) {
return VP8_STATUS_OUT_OF_MEMORY;
}
if (!VP8LDecodeHeader(dec, &io)) {
status = dec->status_; // An error occurred. Grab error status.
} else {
// Allocate/check output buffers.
status = WebPAllocateDecBuffer(io.width, io.height, params->options,
params->output);
if (status == VP8_STATUS_OK) { // Decode
if (!VP8LDecodeImage(dec)) {
status = dec->status_;
}
}
}
VP8LDelete(dec);
}
if (status != VP8_STATUS_OK) {
WebPFreeDecBuffer(params->output);
} else {
if (params->options != NULL && params->options->flip) {
// This restores the original stride values if options->flip was used
// during the call to WebPAllocateDecBuffer above.
status = WebPFlipBuffer(params->output);
}
}
return status;
}
// Helpers
static uint8_t* DecodeIntoRGBABuffer(WEBP_CSP_MODE colorspace,
const uint8_t* const data,
size_t data_size,
uint8_t* const rgba,
int stride, size_t size) {
WebPDecParams params;
WebPDecBuffer buf;
if (rgba == NULL) {
return NULL;
}
WebPInitDecBuffer(&buf);
WebPResetDecParams(¶ms);
params.output = &buf;
buf.colorspace = colorspace;
buf.u.RGBA.rgba = rgba;
buf.u.RGBA.stride = stride;
buf.u.RGBA.size = size;
buf.is_external_memory = 1;
if (DecodeInto(data, data_size, ¶ms) != VP8_STATUS_OK) {
return NULL;
}
return rgba;
}
uint8_t* WebPDecodeRGBInto(const uint8_t* data, size_t data_size,
uint8_t* output, size_t size, int stride) {
return DecodeIntoRGBABuffer(MODE_RGB, data, data_size, output, stride, size);
}
uint8_t* WebPDecodeRGBAInto(const uint8_t* data, size_t data_size,
uint8_t* output, size_t size, int stride) {
return DecodeIntoRGBABuffer(MODE_RGBA, data, data_size, output, stride, size);
}
uint8_t* WebPDecodeARGBInto(const uint8_t* data, size_t data_size,
uint8_t* output, size_t size, int stride) {
return DecodeIntoRGBABuffer(MODE_ARGB, data, data_size, output, stride, size);
}
uint8_t* WebPDecodeBGRInto(const uint8_t* data, size_t data_size,
uint8_t* output, size_t size, int stride) {
return DecodeIntoRGBABuffer(MODE_BGR, data, data_size, output, stride, size);
}
uint8_t* WebPDecodeBGRAInto(const uint8_t* data, size_t data_size,
uint8_t* output, size_t size, int stride) {
return DecodeIntoRGBABuffer(MODE_BGRA, data, data_size, output, stride, size);
}
uint8_t* WebPDecodeYUVInto(const uint8_t* data, size_t data_size,
uint8_t* luma, size_t luma_size, int luma_stride,
uint8_t* u, size_t u_size, int u_stride,
uint8_t* v, size_t v_size, int v_stride) {
WebPDecParams params;
WebPDecBuffer output;
if (luma == NULL) return NULL;
WebPInitDecBuffer(&output);
WebPResetDecParams(¶ms);
params.output = &output;
output.colorspace = MODE_YUV;
output.u.YUVA.y = luma;
output.u.YUVA.y_stride = luma_stride;
output.u.YUVA.y_size = luma_size;
output.u.YUVA.u = u;
output.u.YUVA.u_stride = u_stride;
output.u.YUVA.u_size = u_size;
output.u.YUVA.v = v;
output.u.YUVA.v_stride = v_stride;
output.u.YUVA.v_size = v_size;
output.is_external_memory = 1;
if (DecodeInto(data, data_size, ¶ms) != VP8_STATUS_OK) {
return NULL;
}
return luma;
}
//------------------------------------------------------------------------------
static uint8_t* Decode(WEBP_CSP_MODE mode, const uint8_t* const data,
size_t data_size, int* const width, int* const height,
WebPDecBuffer* const keep_info) {
WebPDecParams params;
WebPDecBuffer output;
WebPInitDecBuffer(&output);
WebPResetDecParams(¶ms);
params.output = &output;
output.colorspace = mode;
// Retrieve (and report back) the required dimensions from bitstream.
if (!WebPGetInfo(data, data_size, &output.width, &output.height)) {
return NULL;
}
if (width != NULL) *width = output.width;
if (height != NULL) *height = output.height;
// Decode
if (DecodeInto(data, data_size, ¶ms) != VP8_STATUS_OK) {
return NULL;
}
if (keep_info != NULL) { // keep track of the side-info
WebPCopyDecBuffer(&output, keep_info);
}
// return decoded samples (don't clear 'output'!)
return WebPIsRGBMode(mode) ? output.u.RGBA.rgba : output.u.YUVA.y;
}
uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size,
int* width, int* height) {
return Decode(MODE_RGB, data, data_size, width, height, NULL);
}
uint8_t* WebPDecodeRGBA(const uint8_t* data, size_t data_size,
int* width, int* height) {
return Decode(MODE_RGBA, data, data_size, width, height, NULL);
}
uint8_t* WebPDecodeARGB(const uint8_t* data, size_t data_size,
int* width, int* height) {
return Decode(MODE_ARGB, data, data_size, width, height, NULL);
}
uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
int* width, int* height) {
return Decode(MODE_BGR, data, data_size, width, height, NULL);
}
uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size,
int* width, int* height) {
return Decode(MODE_BGRA, data, data_size, width, height, NULL);
}
uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
int* width, int* height, uint8_t** u, uint8_t** v,
int* stride, int* uv_stride) {
WebPDecBuffer output; // only to preserve the side-infos
uint8_t* const out = Decode(MODE_YUV, data, data_size,
width, height, &output);
if (out != NULL) {
const WebPYUVABuffer* const buf = &output.u.YUVA;
*u = buf->u;
*v = buf->v;
*stride = buf->y_stride;
*uv_stride = buf->u_stride;
assert(buf->u_stride == buf->v_stride);
}
return out;
}
static void DefaultFeatures(WebPBitstreamFeatures* const features) {
assert(features != NULL);
memset(features, 0, sizeof(*features));
}
static VP8StatusCode GetFeatures(const uint8_t* const data, size_t data_size,
WebPBitstreamFeatures* const features) {
if (features == NULL || data == NULL) {
return VP8_STATUS_INVALID_PARAM;
}
DefaultFeatures(features);
// Only parse enough of the data to retrieve the features.
return ParseHeadersInternal(data, data_size,
&features->width, &features->height,
&features->has_alpha, &features->has_animation,
&features->format, NULL);
}
//------------------------------------------------------------------------------
// WebPGetInfo()
int WebPGetInfo(const uint8_t* data, size_t data_size,
int* width, int* height) {
WebPBitstreamFeatures features;
if (GetFeatures(data, data_size, &features) != VP8_STATUS_OK) {
return 0;
}
if (width != NULL) {
*width = features.width;
}
if (height != NULL) {
*height = features.height;
}
return 1;
}
//------------------------------------------------------------------------------
// Advance decoding API
int WebPInitDecoderConfigInternal(WebPDecoderConfig* config,
int version) {
if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) {
return 0; // version mismatch
}
if (config == NULL) {
return 0;
}
memset(config, 0, sizeof(*config));
DefaultFeatures(&config->input);
WebPInitDecBuffer(&config->output);
return 1;
}
VP8StatusCode WebPGetFeaturesInternal(const uint8_t* data, size_t data_size,
WebPBitstreamFeatures* features,
int version) {
if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) {
return VP8_STATUS_INVALID_PARAM; // version mismatch
}
if (features == NULL) {
return VP8_STATUS_INVALID_PARAM;
}
return GetFeatures(data, data_size, features);
}
VP8StatusCode WebPDecode(const uint8_t* data, size_t data_size,
WebPDecoderConfig* config) {
WebPDecParams params;
VP8StatusCode status;
if (config == NULL) {
return VP8_STATUS_INVALID_PARAM;
}
status = GetFeatures(data, data_size, &config->input);
if (status != VP8_STATUS_OK) {
if (status == VP8_STATUS_NOT_ENOUGH_DATA) {
return VP8_STATUS_BITSTREAM_ERROR; // Not-enough-data treated as error.
}
return status;
}
WebPResetDecParams(¶ms);
params.options = &config->options;
params.output = &config->output;
if (WebPAvoidSlowMemory(params.output, &config->input)) {
// decoding to slow memory: use a temporary in-mem buffer to decode into.
WebPDecBuffer in_mem_buffer;
WebPInitDecBuffer(&in_mem_buffer);
in_mem_buffer.colorspace = config->output.colorspace;
in_mem_buffer.width = config->input.width;
in_mem_buffer.height = config->input.height;
params.output = &in_mem_buffer;
status = DecodeInto(data, data_size, ¶ms);
if (status == VP8_STATUS_OK) { // do the slow-copy
status = WebPCopyDecBufferPixels(&in_mem_buffer, &config->output);
}
WebPFreeDecBuffer(&in_mem_buffer);
} else {
status = DecodeInto(data, data_size, ¶ms);
}
return status;
}
//------------------------------------------------------------------------------
// Cropping and rescaling.
int WebPIoInitFromOptions(const WebPDecoderOptions* const options,
VP8Io* const io, WEBP_CSP_MODE src_colorspace) {
const int W = io->width;
const int H = io->height;
int x = 0, y = 0, w = W, h = H;
// Cropping
io->use_cropping = (options != NULL) && (options->use_cropping > 0);
if (io->use_cropping) {
w = options->crop_width;
h = options->crop_height;
x = options->crop_left;
y = options->crop_top;
if (!WebPIsRGBMode(src_colorspace)) { // only snap for YUV420
x &= ~1;
y &= ~1;
}
if (x < 0 || y < 0 || w <= 0 || h <= 0 || x + w > W || y + h > H) {
return 0; // out of frame boundary error
}
}
io->crop_left = x;
io->crop_top = y;
io->crop_right = x + w;
io->crop_bottom = y + h;
io->mb_w = w;
io->mb_h = h;
// Scaling
io->use_scaling = (options != NULL) && (options->use_scaling > 0);
if (io->use_scaling) {
int scaled_width = options->scaled_width;
int scaled_height = options->scaled_height;
if (!WebPRescalerGetScaledDimensions(w, h, &scaled_width, &scaled_height)) {
return 0;
}
io->scaled_width = scaled_width;
io->scaled_height = scaled_height;
}
// Filter
io->bypass_filtering = (options != NULL) && options->bypass_filtering;
// Fancy upsampler
#ifdef FANCY_UPSAMPLING
io->fancy_upsampling = (options == NULL) || (!options->no_fancy_upsampling);
#endif
if (io->use_scaling) {
// disable filter (only for large downscaling ratio).
io->bypass_filtering = (io->scaled_width < W * 3 / 4) &&
(io->scaled_height < H * 3 / 4);
io->fancy_upsampling = 0;
}
return 1;
}
//------------------------------------------------------------------------------
| {'content_hash': '3b83447c0d10fa6eff621edc08d75497', 'timestamp': '', 'source': 'github', 'line_count': 790, 'max_line_length': 80, 'avg_line_length': 35.063291139240505, 'alnum_prop': 0.5861371841155235, 'repo_name': 'zzjkf2009/Midterm_Astar', 'id': 'a8e9c2c510bf6e27e5d41e67f5842055857eafd0', 'size': '30028', 'binary': False, 'copies': '58', 'ref': 'refs/heads/master', 'path': 'opencv/3rdparty/libwebp/dec/webp_dec.c', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '7310'}, {'name': 'C', 'bytes': '1157337'}, {'name': 'C#', 'bytes': '42254'}, {'name': 'C++', 'bytes': '28411379'}, {'name': 'CMake', 'bytes': '810399'}, {'name': 'CSS', 'bytes': '4784'}, {'name': 'Clojure', 'bytes': '1487'}, {'name': 'Cuda', 'bytes': '1699447'}, {'name': 'HLSL', 'bytes': '3314'}, {'name': 'HTML', 'bytes': '220169'}, {'name': 'Java', 'bytes': '831255'}, {'name': 'JavaScript', 'bytes': '113900'}, {'name': 'Makefile', 'bytes': '2690'}, {'name': 'Objective-C', 'bytes': '44625'}, {'name': 'Objective-C++', 'bytes': '211774'}, {'name': 'Perl', 'bytes': '15867'}, {'name': 'PowerShell', 'bytes': '14589'}, {'name': 'Python', 'bytes': '911972'}, {'name': 'Scala', 'bytes': '5683'}, {'name': 'Shell', 'bytes': '16088'}, {'name': 'TeX', 'bytes': '34757'}]} |
/*!
* FileInput Portuguese Translations
*
* This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
* any HTML markup tags in the messages must not be converted or translated.
*
* @see http://github.com/kartik-v/bootstrap-fileinput
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof module === 'object' && typeof module.exports === 'object') {
factory(require('jquery'));
} else {
factory(window.jQuery);
}
}(function ($) {
"use strict";
$.fn.fileinputLocales['pt'] = {
sizeUnits: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
bitRateUnits: ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'],
fileSingle: 'ficheiro',
filePlural: 'ficheiros',
browseLabel: 'Procurar …',
removeLabel: 'Remover',
removeTitle: 'Remover ficheiros selecionados',
cancelLabel: 'Cancelar',
cancelTitle: 'Abortar envio',
pauseLabel: 'Parar',
pauseTitle: 'Parar envio em curso',
uploadLabel: 'Enviar',
uploadTitle: 'Enviar ficheiros selecionados',
msgNo: 'Não',
msgNoFilesSelected: 'Nenhum ficheiro selecionado',
msgPaused: 'Parado',
msgCancelled: 'Cancelado',
msgPlaceholder: 'Selecionar {files} ...',
msgZoomModalHeading: 'Pré-visualização detalhada',
msgFileRequired: 'É necessário selecionar um ficheiro a enviar.',
msgSizeTooSmall: 'Ficheiro "{name}" (<b>{size}</b>) é demasiado pequeno, tem ser ser maior que <b>{minSize}</b>.',
msgSizeTooLarge: 'Ficheiro "{name}" (<b>{size}</b>) excede o tamanho máximo permido de <b>{maxSize}</b>.',
msgFilesTooLess: 'Deve selecionar pelo menos <b>{n}</b> {files} para enviar.',
msgFilesTooMany: 'Número máximo de ficheiros selecionados <b>({n})</b> excede o limite máximo de <b>{m}</b>.',
msgTotalFilesTooMany: 'Pode enviar no máximo <b>{m}</b> ficheiros (<b>{n}</b> ficheiros detetados).',
msgFileNotFound: 'Ficheiro "{name}" não encontrado.',
msgFileSecured: 'Restrições de segurança impedem a leitura do ficheiro "{name}".',
msgFileNotReadable: 'Ficheiro "{name}" não pode ser lido.',
msgFilePreviewAborted: 'Pré-visualização abortado para o ficheiro "{name}".',
msgFilePreviewError: 'Ocorreu um erro ao ler o ficheiro "{name}".',
msgInvalidFileName: 'Caracteres inválidos ou não suportados no nome de ficheiro "{name}".',
msgInvalidFileType: 'Tipo inválido para o ficheiro "{name}". Apenas ficheiros "{types}" são suportados.',
msgInvalidFileExtension: 'Extensão inválida para o ficheiro "{name}". Apenas ficheiros "{extensions}" são suportados.',
msgFileTypes: {
'image': 'imagem',
'html': 'HTML',
'text': 'texto',
'video': 'vídeo',
'audio': 'audio',
'flash': 'flash',
'pdf': 'PDF',
'object': 'objeto'
},
msgUploadAborted: 'O envio do ficheiro foi abortado',
msgUploadThreshold: 'A processar …',
msgUploadBegin: 'A inicializar …',
msgUploadEnd: 'Concluído',
msgUploadResume: 'A retomar o envio …',
msgUploadEmpty: 'Não existem dados válidos disponíveis para o envio.',
msgUploadError: 'Erro de Envio',
msgDeleteError: 'Erro de Eliminação',
msgProgressError: 'Erro',
msgValidationError: 'Erro de Validação',
msgLoading: 'A enviar ficheiro {index} de {files} …',
msgProgress: 'A enviar ficheiro {index} de {files} - {name} - {percent}% completo.',
msgSelected: '{n} {files} selecionados',
msgProcessing: 'Processing ...',
msgFoldersNotAllowed: 'Arrastar e largar ficheiros apenas. {n} pasta(s) ignoradas.',
msgImageWidthSmall: 'Largura da imagem "{name}" deve ser pelo menos <b>{size} px</b> (detected <b>{dimension} px</b>).',
msgImageHeightSmall: 'Altura da imagem "{name}" deve ser pelo menos <b>{size} px</b> (detected <b>{dimension} px</b>).',
msgImageWidthLarge: 'Largura da imagem "{name}" não pode exceder <b>{size} px</b> (detected <b>{dimension} px</b>).',
msgImageHeightLarge: 'Altura da imagem "{name}" não pode exceder <b>{size} px</b> (detected <b>{dimension} px</b>).',
msgImageResizeError: 'Nãofoi possível obter as dimensões da imagem para redimensionar.',
msgImageResizeException: 'Erro ao redimensionar a imagem.<pre>{errors}</pre>',
msgAjaxError: 'Ocorreu um erro durante a operação {operation}. Por favor tente de novo mais tarde.',
msgAjaxProgressError: '{operation} falhou',
msgDuplicateFile: 'O ficheiro "{name}" com o mesmo tamanho "{size}" já foi anteriormente selecionado. O ficheiro duplicado foi ignorado.',
msgResumableUploadRetriesExceeded: 'O envio foi abortado após <b>{max}</b> tentativas para o ficheiro <b>{file}</b>. Detalhes do erro: <pre>{error}</pre>',
msgPendingTime: '{time} restante',
msgCalculatingTime: 'a calcular o tempo restante',
ajaxOperations: {
deleteThumb: 'eliminar ficheiro',
uploadThumb: 'enviar ficheiro',
uploadBatch: 'envio de ficheiros em lote',
uploadExtra: 'envio de ficheiro em formulário'
},
dropZoneTitle: 'Arrastar e largar ficheiros aqui …',
dropZoneClickTitle: '<br>(ou clique para selecionar {files})',
fileActionSettings: {
removeTitle: 'Remover ficheiro',
uploadTitle: 'Enviar ficheiro',
uploadRetryTitle: 'Voltar a tentar o envio',
downloadTitle: 'Transferir ficheiro',
rotateTitle: 'Rotate 90 deg. clockwise',
zoomTitle: 'Ver detalhes',
dragTitle: 'Mover / Reorganizar',
indicatorNewTitle: 'Ainda Não Enviado',
indicatorSuccessTitle: 'Enviado',
indicatorErrorTitle: 'Erro de Envio',
indicatorPausedTitle: 'Envio Parado',
indicatorLoadingTitle: 'A enviar …'
},
previewZoomButtonTitles: {
prev: 'Ver ficheiro anterior',
next: 'Ver próximo ficheiro',
rotate: 'Rotate 90 deg. clockwise',
toggleheader: 'Mostrar/esconder cabeçalho',
fullscreen: 'Alternar entre ecrã completo',
borderless: 'Alternar entre modo sem bordas',
close: 'Fechar pré-visualização detalhada'
}
};
}));
| {'content_hash': '00368efc9d7a38bebce753ff3d472890', 'timestamp': '', 'source': 'github', 'line_count': 126, 'max_line_length': 163, 'avg_line_length': 54.142857142857146, 'alnum_prop': 0.6074464966285547, 'repo_name': 'cdnjs/cdnjs', 'id': 'cee3f885dcac845b34cfb1f086e27c2942301a9d', 'size': '6875', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'ajax/libs/bootstrap-fileinput/5.5.1/js/locales/pt.js', 'mode': '33188', 'license': 'mit', 'language': []} |
// dnlib: See LICENSE.txt for more info
using System;
using System.IO;
namespace dnlib.DotNet.Writer {
/// <summary>
/// Writes field marshal blobs
/// </summary>
public struct MarshalBlobWriter : IDisposable, IFullNameCreatorHelper {
readonly ModuleDef module;
readonly MemoryStream outStream;
readonly BinaryWriter writer;
readonly IWriterError helper;
/// <summary>
/// Creates a field marshal blob from <paramref name="marshalType"/>
/// </summary>
/// <param name="module">Owner module</param>
/// <param name="marshalType">Marshal type</param>
/// <param name="helper">Helps this class</param>
/// <returns>A field marshal blob or <c>null</c> if <paramref name="marshalType"/> is
/// <c>null</c></returns>
public static byte[] Write(ModuleDef module, MarshalType marshalType, IWriterError helper) {
using (var writer = new MarshalBlobWriter(module, helper))
return writer.Write(marshalType);
}
MarshalBlobWriter(ModuleDef module, IWriterError helper) {
this.module = module;
this.outStream = new MemoryStream();
this.writer = new BinaryWriter(outStream);
this.helper = helper;
}
byte[] Write(MarshalType marshalType) {
if (marshalType == null)
return null;
var type = marshalType.NativeType;
if (type != NativeType.RawBlob) {
if ((uint)type > byte.MaxValue)
helper.Error("Invalid MarshalType.NativeType");
writer.Write((byte)type);
}
bool canWrite = true;
switch (type) {
case NativeType.FixedSysString:
var fixedSysString = (FixedSysStringMarshalType)marshalType;
if (fixedSysString.IsSizeValid)
WriteCompressedUInt32((uint)fixedSysString.Size);
break;
case NativeType.SafeArray:
var safeArray = (SafeArrayMarshalType)marshalType;
if (UpdateCanWrite(safeArray.IsVariantTypeValid, "VariantType", ref canWrite))
WriteCompressedUInt32((uint)safeArray.VariantType);
if (UpdateCanWrite(safeArray.IsUserDefinedSubTypeValid, "UserDefinedSubType", ref canWrite))
Write(safeArray.UserDefinedSubType.AssemblyQualifiedName);
break;
case NativeType.FixedArray:
var fixedArray = (FixedArrayMarshalType)marshalType;
if (UpdateCanWrite(fixedArray.IsSizeValid, "Size", ref canWrite))
WriteCompressedUInt32((uint)fixedArray.Size);
if (UpdateCanWrite(fixedArray.IsElementTypeValid, "ElementType", ref canWrite))
WriteCompressedUInt32((uint)fixedArray.ElementType);
break;
case NativeType.Array:
var array = (ArrayMarshalType)marshalType;
if (UpdateCanWrite(array.IsElementTypeValid, "ElementType", ref canWrite))
WriteCompressedUInt32((uint)array.ElementType);
if (UpdateCanWrite(array.IsParamNumberValid, "ParamNumber", ref canWrite))
WriteCompressedUInt32((uint)array.ParamNumber);
if (UpdateCanWrite(array.IsSizeValid, "Size", ref canWrite))
WriteCompressedUInt32((uint)array.Size);
if (UpdateCanWrite(array.IsFlagsValid, "Flags", ref canWrite))
WriteCompressedUInt32((uint)array.Flags);
break;
case NativeType.CustomMarshaler:
var custMarshaler = (CustomMarshalType)marshalType;
Write(custMarshaler.Guid);
Write(custMarshaler.NativeTypeName);
var cm = custMarshaler.CustomMarshaler;
var cmName = cm == null ? string.Empty : FullNameCreator.AssemblyQualifiedName(cm, this);
Write(cmName);
Write(custMarshaler.Cookie);
break;
case NativeType.IUnknown:
case NativeType.IDispatch:
case NativeType.IntF:
var iface = (InterfaceMarshalType)marshalType;
if (iface.IsIidParamIndexValid)
WriteCompressedUInt32((uint)iface.IidParamIndex);
break;
case NativeType.RawBlob:
var data = ((RawMarshalType)marshalType).Data;
if (data != null)
writer.Write(data);
break;
default:
break;
}
writer.Flush();
return outStream.ToArray();
}
bool UpdateCanWrite(bool isValid, string field, ref bool canWriteMore) {
if (!canWriteMore) {
if (isValid)
helper.Error(string.Format("MarshalType field {0} is valid even though a previous field was invalid", field));
return canWriteMore;
}
if (!isValid)
canWriteMore = false;
return canWriteMore;
}
uint WriteCompressedUInt32(uint value) {
return writer.WriteCompressedUInt32(helper, value);
}
void Write(UTF8String s) {
writer.Write(helper, s);
}
/// <inheritdoc/>
public void Dispose() {
if (outStream != null)
outStream.Dispose();
}
bool IFullNameCreatorHelper.MustUseAssemblyName(IType type) {
return FullNameCreator.MustUseAssemblyName(module, type);
}
}
}
| {'content_hash': '1d9448ce1ab7771f84ada4452f34ae65', 'timestamp': '', 'source': 'github', 'line_count': 145, 'max_line_length': 115, 'avg_line_length': 31.572413793103447, 'alnum_prop': 0.7182175622542595, 'repo_name': 'yck1509/dnlib', 'id': 'ae650354a5d57cb3acbca95e821e91ce580bb1a2', 'size': '4580', 'binary': False, 'copies': '13', 'ref': 'refs/heads/master', 'path': 'src/DotNet/Writer/MarshalBlobWriter.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '2788099'}]} |
package com.amazonaws.services.lambda.model.transform;
import static com.amazonaws.util.StringUtils.UTF8;
import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.regex.Pattern;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.lambda.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.SdkHttpUtils;
import com.amazonaws.protocol.json.*;
/**
* CreateFunctionRequest Marshaller
*/
public class CreateFunctionRequestMarshaller implements
Marshaller<Request<CreateFunctionRequest>, CreateFunctionRequest> {
private static final String DEFAULT_CONTENT_TYPE = "application/x-amz-json-1.1";
private final SdkJsonProtocolFactory protocolFactory;
public CreateFunctionRequestMarshaller(
SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<CreateFunctionRequest> marshall(
CreateFunctionRequest createFunctionRequest) {
if (createFunctionRequest == null) {
throw new AmazonClientException(
"Invalid argument passed to marshall(...)");
}
Request<CreateFunctionRequest> request = new DefaultRequest<CreateFunctionRequest>(
createFunctionRequest, "AWSLambda");
request.setHttpMethod(HttpMethodName.POST);
String uriResourcePath = "/2015-03-31/functions";
request.setResourcePath(uriResourcePath);
try {
final StructuredJsonGenerator jsonGenerator = protocolFactory
.createGenerator();
jsonGenerator.writeStartObject();
if (createFunctionRequest.getFunctionName() != null) {
jsonGenerator.writeFieldName("FunctionName").writeValue(
createFunctionRequest.getFunctionName());
}
if (createFunctionRequest.getRuntime() != null) {
jsonGenerator.writeFieldName("Runtime").writeValue(
createFunctionRequest.getRuntime());
}
if (createFunctionRequest.getRole() != null) {
jsonGenerator.writeFieldName("Role").writeValue(
createFunctionRequest.getRole());
}
if (createFunctionRequest.getHandler() != null) {
jsonGenerator.writeFieldName("Handler").writeValue(
createFunctionRequest.getHandler());
}
if (createFunctionRequest.getCode() != null) {
jsonGenerator.writeFieldName("Code");
FunctionCodeJsonMarshaller.getInstance().marshall(
createFunctionRequest.getCode(), jsonGenerator);
}
if (createFunctionRequest.getDescription() != null) {
jsonGenerator.writeFieldName("Description").writeValue(
createFunctionRequest.getDescription());
}
if (createFunctionRequest.getTimeout() != null) {
jsonGenerator.writeFieldName("Timeout").writeValue(
createFunctionRequest.getTimeout());
}
if (createFunctionRequest.getMemorySize() != null) {
jsonGenerator.writeFieldName("MemorySize").writeValue(
createFunctionRequest.getMemorySize());
}
if (createFunctionRequest.getPublish() != null) {
jsonGenerator.writeFieldName("Publish").writeValue(
createFunctionRequest.getPublish());
}
if (createFunctionRequest.getVpcConfig() != null) {
jsonGenerator.writeFieldName("VpcConfig");
VpcConfigJsonMarshaller.getInstance().marshall(
createFunctionRequest.getVpcConfig(), jsonGenerator);
}
jsonGenerator.writeEndObject();
byte[] content = jsonGenerator.getBytes();
request.setContent(new ByteArrayInputStream(content));
request.addHeader("Content-Length",
Integer.toString(content.length));
if (!request.getHeaders().containsKey("Content-Type")) {
request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE);
}
} catch (Throwable t) {
throw new AmazonClientException(
"Unable to marshall request to JSON: " + t.getMessage(), t);
}
return request;
}
}
| {'content_hash': 'ca2232ac3f7f06ce88e86132f7f3a297', 'timestamp': '', 'source': 'github', 'line_count': 128, 'max_line_length': 91, 'avg_line_length': 39.3203125, 'alnum_prop': 0.6427577985297039, 'repo_name': 'nterry/aws-sdk-java', 'id': '0aeb70f9a389818c8673ec2485589189ea86c741', 'size': '5620', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/transform/CreateFunctionRequestMarshaller.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'FreeMarker', 'bytes': '126417'}, {'name': 'Java', 'bytes': '113994954'}, {'name': 'Scilab', 'bytes': '3561'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '725663478f404849a3ff15a6aaefbc9d', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': '35d12c90655c64d4c438c6580fdb3b4d6e592174', 'size': '189', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Papaveraceae/Chelidonium/Chelidonium hylomeconoides/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
namespace mojo {
namespace {
base::WritableSharedMemoryRegion CreateWritableSharedMemoryRegion(size_t size) {
mojo::ScopedSharedBufferHandle handle =
mojo::SharedBufferHandle::Create(size);
if (!handle.is_valid())
return base::WritableSharedMemoryRegion();
return mojo::UnwrapWritableSharedMemoryRegion(std::move(handle));
}
base::MappedReadOnlyRegion CreateReadOnlySharedMemoryRegion(
size_t size,
base::SharedMemoryMapper* mapper) {
auto writable_region = CreateWritableSharedMemoryRegion(size);
if (!writable_region.IsValid())
return {};
base::WritableSharedMemoryMapping mapping = writable_region.Map(mapper);
return {base::WritableSharedMemoryRegion::ConvertToReadOnly(
std::move(writable_region)),
std::move(mapping)};
}
base::UnsafeSharedMemoryRegion CreateUnsafeSharedMemoryRegion(size_t size) {
auto writable_region = CreateWritableSharedMemoryRegion(size);
if (!writable_region.IsValid())
return base::UnsafeSharedMemoryRegion();
return base::WritableSharedMemoryRegion::ConvertToUnsafe(
std::move(writable_region));
}
} // namespace
void SharedMemoryUtils::InstallBaseHooks() {
if (mojo::core::IsMojoIpczEnabled()) {
mojo::core::InstallMojoIpczBaseSharedMemoryHooks();
return;
}
base::SharedMemoryHooks::SetCreateHooks(&CreateReadOnlySharedMemoryRegion,
&CreateUnsafeSharedMemoryRegion,
&CreateWritableSharedMemoryRegion);
}
} // namespace mojo
| {'content_hash': '734ce7a5962869d1840366f67c1c616e', 'timestamp': '', 'source': 'github', 'line_count': 49, 'max_line_length': 80, 'avg_line_length': 31.489795918367346, 'alnum_prop': 0.7161373946856773, 'repo_name': 'nwjs/chromium.src', 'id': '723f8a6410b3337c71c355f21cdbaeea5183ce07', 'size': '2135', 'binary': False, 'copies': '8', 'ref': 'refs/heads/nw70', 'path': 'mojo/public/cpp/base/shared_memory_utils.cc', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []} |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.sharedpreferences.MainActivity$PlaceholderFragment" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/name" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/name"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/age" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/age"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/saveButton" android:text="@string/saveSetting" android:onClick="saveSetting"/>
</LinearLayout> | {'content_hash': '0cb4dbd7eae532b33c4a6b7fe4fd14bf', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 102, 'avg_line_length': 37.25, 'alnum_prop': 0.686055182699478, 'repo_name': 'tangzhichao/blog', 'id': 'c10034068d71573402fd27363ae0af4c6ac7c2c9', 'size': '1341', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'sharedpreferences/res/layout/fragment_main.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '14771'}]} |
package cpu
import (
"syscall"
"time"
)
const isLinux = true
func nanospinLinux(d time.Duration) {
// runtime.nanotime() is not exported so it cannot be used to busy loop for
// very short sleep (10µs or less).
time := syscall.NsecToTimespec(d.Nanoseconds())
leftover := syscall.Timespec{}
for syscall.Nanosleep(&time, &leftover) != nil {
time = leftover
}
}
| {'content_hash': 'b1e744f8b06741da985a5754706d726e', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 76, 'avg_line_length': 20.666666666666668, 'alnum_prop': 0.6989247311827957, 'repo_name': 'maruel/dotstar', 'id': 'c227c88705adcf717c440b3e53ed8f0fb3411e72', 'size': '552', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'vendor/periph.io/x/periph/host/cpu/cpu_linux.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Go', 'bytes': '41086'}, {'name': 'HTML', 'bytes': '1020'}]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.